Commit 48b44c53 authored by yanghao's avatar yanghao

chore: 添加默认开票的修改接口

parent e641a573
INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (22, '22', '设置控货无收货人', 'Set Customer NoConsigee', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (23, '23', '设置默认付款', 'Set Customer Default Pay', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (24, '24', '设置默认开票', 'Set Customer Default Billing', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
......@@ -419,6 +419,7 @@ public interface CustomerService extends IService<CustomerDO> {
void changeCustomerNoConsignee(CustomerChangeNoConsigneeReqVO customerChangeNoConsigneeReqVO);
void changeCustomerDefaultPay(CustomerChangeDefaultPayReqVO customerChangeDefaultPayReqVO);
void changeCustomerDefaultBilling(CustomerChangeDefaultBillingReqVO customerChangeDefaultBillingReqVO);
/**
* @param areaCode 区号 eg: 86
......
......@@ -3528,6 +3528,33 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
}
}
@Override
public void changeCustomerDefaultBilling(CustomerChangeDefaultBillingReqVO customerChangeDefaultBillingReqVO) {
List<CustomerDO> customerDOList = customerMapper.selectBatchIds(customerChangeDefaultBillingReqVO.getCustomerIdList());
if (CollectionUtil.isNotEmpty(customerDOList)) {
Boolean defaultBilling = customerChangeDefaultBillingReqVO.getDefaultBilling();
customerDOList.stream()
.filter(t -> t.getDefaultPay() == null || !t.getDefaultPay().equals(defaultBilling))
.forEach(customerDO -> {
customerDO.setDefaultBilling(defaultBilling);
customerMapper.updateById(customerDO);
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
CustomerOperateLogCreateReqVO customerOperateLogCreateReqVO = new CustomerOperateLogCreateReqVO()
.setOperator(loginUser == null ? null : loginUser.getId())
.setOperatorName(loginUser == null ? null : loginUser.getNickname())
.setCustomerId(customerDO.getId())
.setNumber(customerDO.getNumber())
.setName(customerDO.getName())
.setOperateType(CustomerOperateTypeEnum.CHANGE_DEFAULT_PAY.getValue())
.setRemark("设置客户的默认开票为:" + (defaultBilling ? "【是】" : "【否】"));
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
});
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void recycleUnConfirmedCustomer(CustomerUnConfirmReqVO customerUnConfirmReqVO) {
......
package cn.iocoder.yudao.module.customer.vo.customer.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
@ApiModel("管理后台 - 默认开票切换 Request VO")
@Data
@EqualsAndHashCode
@ToString
public class CustomerChangeDefaultBillingReqVO {
@ApiModelProperty(value = "客户ID列表", required = true)
@NotEmpty(message = "客户ID列表不能为空")
private List<Long> customerIdList;
@ApiModelProperty(value = "是否默认开票", required = true)
@NotNull(message = "默认开票值不能为空")
private Boolean defaultBilling;
}
......@@ -1126,8 +1126,7 @@ public class CustomerController {
@PutMapping("/change-customer-no-consignee")
@ApiOperation("设置客户是否是默认付款无收货人")
@PreAuthorize("@ss.hasPermission('ecw:customer:noconsignee')")
@ApiOperation("设置客户是否是默认控货无收货人")
@Idempotent(timeout = 5)
public CommonResult<Boolean> changeCustomerNoConsignee(@Valid @RequestBody CustomerChangeNoConsigneeReqVO customerChangeNoConsigneeReqVO) {
......@@ -1137,8 +1136,7 @@ public class CustomerController {
@PutMapping("/change-customer-default-pay")
@ApiOperation("设置客户是否是默认侍")
@PreAuthorize("@ss.hasPermission('ecw:customer:defaultpay')")
@ApiOperation("设置客户是否是默认付款")
@Idempotent(timeout = 5)
public CommonResult<Boolean> changeCustomerDefaultPay(@Valid @RequestBody CustomerChangeDefaultPayReqVO customerChangeDefaultPayReqVO) {
......@@ -1147,6 +1145,16 @@ public class CustomerController {
}
@PutMapping("/change-customer-default-billing")
@ApiOperation("设置客户是否是默认开票")
@Idempotent(timeout = 5)
public CommonResult<Boolean> changeCustomerDefaultBilling(@Valid @RequestBody CustomerChangeDefaultBillingReqVO customerChangeDefaultBillingReqVO) {
customerService.changeCustomerDefaultBilling(customerChangeDefaultBillingReqVO);
return success(true);
}
@PutMapping("/recycle-unconfirmed-customer")
@ApiOperation("回收已分配未接收的客户")
// @PreAuthorize("@ss.hasPermission('ecw:customer:recycle:unconfirmed')")
......
......@@ -52,6 +52,8 @@ public enum CustomerOperateTypeEnum {
CHANGE_NO_CONSIGNEE(22, "设置控货无收货人"),
CHANGE_DEFAULT_PAY(23, "设置默认付款"),
CHANGE_DEFAULT_BILLING(24, "设置默认开票"),
DELETE(100, "删除"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment