Commit fa434cfb authored by yanghao's avatar yanghao

chore: 客户补充修改默认付款和修改控货无收货人的接口

parent 9a492f87
...@@ -383,7 +383,7 @@ public class CustomerDO extends BaseDO { ...@@ -383,7 +383,7 @@ public class CustomerDO extends BaseDO {
/** /**
* 创建入口 * 创建入口
* <p> * <p>
* 枚举 {@link TODO customer_create_from 字典} * 枚举 {@link TODO customer_from 字典}
*/ */
private Integer createFrom; private Integer createFrom;
......
...@@ -416,6 +416,10 @@ public interface CustomerService extends IService<CustomerDO> { ...@@ -416,6 +416,10 @@ public interface CustomerService extends IService<CustomerDO> {
*/ */
void changeCustomerFcl(CustomerChangeFclReqVO customerChangeFclReqVO); void changeCustomerFcl(CustomerChangeFclReqVO customerChangeFclReqVO);
void changeCustomerNoConsignee(CustomerChangeNoConsigneeReqVO customerChangeNoConsigneeReqVO);
void changeCustomerDefaultPay(CustomerChangeDefaultPayReqVO customerChangeDefaultPayReqVO);
/** /**
* @param areaCode 区号 eg: 86 * @param areaCode 区号 eg: 86
* @param phone 电话 eg: 13233334444 * @param phone 电话 eg: 13233334444
......
...@@ -3474,6 +3474,59 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, ...@@ -3474,6 +3474,59 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper,
} }
} }
@Override
public void changeCustomerNoConsignee(CustomerChangeNoConsigneeReqVO customerChangeNoConsigneeReqVO) {
List<CustomerDO> customerDOList = customerMapper.selectBatchIds(customerChangeNoConsigneeReqVO.getCustomerIdList());
if (CollectionUtil.isNotEmpty(customerDOList)) {
Boolean noConsigee = customerChangeNoConsigneeReqVO.getNoConsigee();
customerDOList.stream()
.filter(t -> t.getNoConsignee() == null || !t.getNoConsignee().equals(noConsigee))
.forEach(customerDO -> {
customerDO.setNoConsignee(noConsigee);
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_NO_CONSIGNEE.getValue())
.setRemark("设置客户的控货无收货人为:" + (noConsigee ? "【是】" : "【否】"));
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
});
}
}
@Override
public void changeCustomerDefaultPay(CustomerChangeDefaultPayReqVO customerChangeDefaultPayReqVO) {
List<CustomerDO> customerDOList = customerMapper.selectBatchIds(customerChangeDefaultPayReqVO.getCustomerIdList());
if (CollectionUtil.isNotEmpty(customerDOList)) {
Boolean defaultPay = customerChangeDefaultPayReqVO.getDefaultPay();
customerDOList.stream()
.filter(t -> t.getDefaultPay() == null || !t.getDefaultPay().equals(defaultPay))
.forEach(customerDO -> {
customerDO.setDefaultPay(defaultPay);
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("设置客户的默认付款为:" + (defaultPay ? "【是】" : "【否】"));
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
});
}
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
......
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 CustomerChangeDefaultPayReqVO {
@ApiModelProperty(value = "客户ID列表", required = true)
@NotEmpty(message = "客户ID列表不能为空")
private List<Long> customerIdList;
@ApiModelProperty(value = "是否默认付款", required = true)
@NotNull(message = "默认付款值不能为空")
private Boolean defaultPay;
}
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 CustomerChangeNoConsigneeReqVO {
@ApiModelProperty(value = "客户ID列表", required = true)
@NotEmpty(message = "客户ID列表不能为空")
private List<Long> customerIdList;
@ApiModelProperty(value = "是否控货无收货人", required = true)
@NotNull(message = "控货无收货人值不能为空")
private Boolean noConsigee;
}
...@@ -1125,6 +1125,28 @@ public class CustomerController { ...@@ -1125,6 +1125,28 @@ public class CustomerController {
} }
@PutMapping("/change-customer-no-consignee")
@ApiOperation("设置客户是否是默认付款无收货人")
@PreAuthorize("@ss.hasPermission('ecw:customer:noconsignee')")
@Idempotent(timeout = 5)
public CommonResult<Boolean> changeCustomerNoConsignee(@Valid @RequestBody CustomerChangeNoConsigneeReqVO customerChangeNoConsigneeReqVO) {
customerService.changeCustomerNoConsignee(customerChangeNoConsigneeReqVO);
return success(true);
}
@PutMapping("/change-customer-default-pay")
@ApiOperation("设置客户是否是默认侍")
@PreAuthorize("@ss.hasPermission('ecw:customer:defaultpay')")
@Idempotent(timeout = 5)
public CommonResult<Boolean> changeCustomerDefaultPay(@Valid @RequestBody CustomerChangeDefaultPayReqVO customerChangeDefaultPayReqVO) {
customerService.changeCustomerDefaultPay(customerChangeDefaultPayReqVO);
return success(true);
}
@PutMapping("/recycle-unconfirmed-customer") @PutMapping("/recycle-unconfirmed-customer")
@ApiOperation("回收已分配未接收的客户") @ApiOperation("回收已分配未接收的客户")
// @PreAuthorize("@ss.hasPermission('ecw:customer:recycle:unconfirmed')") // @PreAuthorize("@ss.hasPermission('ecw:customer:recycle:unconfirmed')")
......
...@@ -49,6 +49,9 @@ public enum CustomerOperateTypeEnum { ...@@ -49,6 +49,9 @@ public enum CustomerOperateTypeEnum {
UPDATE_CUSTOMER_TO_OLD_BY_CUSTOMER_SERVICE(20, "修改客户经理下成交客户的业绩类型"), UPDATE_CUSTOMER_TO_OLD_BY_CUSTOMER_SERVICE(20, "修改客户经理下成交客户的业绩类型"),
UPDATE_CUSTOMER_NEW_OR_OLD(21, "修改客户业绩类型"), UPDATE_CUSTOMER_NEW_OR_OLD(21, "修改客户业绩类型"),
CHANGE_NO_CONSIGNEE(22, "设置控货无收货人"),
CHANGE_DEFAULT_PAY(23, "设置默认付款"),
DELETE(100, "删除"), DELETE(100, "删除"),
......
...@@ -12,11 +12,12 @@ import java.util.Arrays; ...@@ -12,11 +12,12 @@ import java.util.Arrays;
@Getter @Getter
public enum CustomerRoleEnum { public enum CustomerRoleEnum {
//0、CO 1、工程商 2、代理 6、集运 //0、CO 1、工程商 2、代理 3、同行 6、集运
C0(0, "C0"), C0(0, "C0"),
CONTRACTOR(1, "工程商"), CONTRACTOR(1, "工程商"),
PROXY(2, "代理"), PROXY(2, "代理"),
COMPETITOR(3, "同行"),
CONSOLIDATOR(6, "集运"); CONSOLIDATOR(6, "集运");
; ;
......
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