Commit 214a0d72 authored by yanghao's avatar yanghao

chore: 客户合并部分更新

parent 867e988b
......@@ -3,16 +3,20 @@ 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;
@ApiModel("管理后台 - 客户 Response VO")
import javax.validation.constraints.NotNull;
@ApiModel("管理后台 - 客户合并 Req VO")
@Data
@ToString(callSuper = true)
public class CustomerMerge {
@ApiModelProperty(value = "id1")
@ApiModelProperty(value = "被保留的客户id")
@NotNull(message = "被保留的客户id不能为空")
private Long id1;
@ApiModelProperty(value = "id2")
@ApiModelProperty(value = "被删除的客户id")
@NotNull(message = "被删除的客户id不能为空")
private Long id2;
}
......@@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.customer.controller.admin.customer;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
......@@ -25,7 +24,6 @@ import cn.iocoder.yudao.module.customer.dal.dataobject.customer.complaint.Custom
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.follow.CustomerFollowDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerBank.CustomerBankDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerLevelLog.CustomerLevelLogDO;
import cn.iocoder.yudao.module.customer.dal.mysql.customerDetail.CustomerDetailMapper;
import cn.iocoder.yudao.module.customer.dto.CustomerDelayApprovalInfoDto;
import cn.iocoder.yudao.module.customer.dto.CustomerExportReqDTO;
......@@ -372,33 +370,22 @@ public class CustomerController {
// 客户投诉,品牌授权都迁移到保留客户中,其他信息不会迁移,
// 如需要维护非主客户的客户档案信息到保留客户中,请先维护好再操作
if (par.getId1() == null) {
return success(false);
}
if (par.getId2() == null) {
return success(false);
}
CustomerDO customerDO1 =
customerService.getById(par.getId1());
CustomerDO customerDO1 = customerService.getById(par.getId1());
if (customerDO1 == null) {
throw exception(new ErrorCode(0, "保留客户未查询到"));
throw exception(ErrorCodeConstants.CUSTOMER_SAVED_NOT_EXISTS);
}
if (customerDO1.getCustomerService() == null) {
throw exception(new ErrorCode(0, "保留客户的客户经理为空"));
throw exception(ErrorCodeConstants.CUSTOMER_SAVED_CUSTOMER_SERVICE_IS_NULL);
}
CustomerDO customerDO2 =
customerService.getById(par.getId2());
CustomerDO customerDO2 = customerService.getById(par.getId2());
if (customerDO2 == null) {
throw exception(new ErrorCode(0, "被合并客户未查询到"));
throw exception(ErrorCodeConstants.CUSTOMER_DELETED_NOT_EXISTS);
}
if (customerDO2.getCustomerService() == null) {
throw exception(new ErrorCode(0, "被合并客户客户经理为空"));
throw exception(ErrorCodeConstants.CUSTOMER_DELETED_CUSTOMER_SERVICE_IS_NULL);
}
if (customerDO1.getCustomerService() != customerDO2.getCustomerService()) {
throw exception(new ErrorCode(0,
"保留客户和被合并客户客户经理不相同"));
throw exception(ErrorCodeConstants.CUSTOMER_MERGE_CUSTOMER_SERVICE_NOT_SAME);
}
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
......@@ -571,6 +558,8 @@ public class CustomerController {
for (CustomerContactsDO d : cuscontactList2
) {
d.setCustomerId(customerDO1.getId());
//被合并的客户联系人,默认为非默认
d.setIsDefault(0);
d.setUpdateTime(new Date());
d.setUpdater(String.valueOf(loginUserId));
customerContactsService.updateById(d);
......
......@@ -177,5 +177,16 @@ public interface ErrorCodeConstants {
ErrorCode CUSTOMER_DELAY_APPROVAL_MORE_THEN_ONE = new ErrorCode (1004006037,"customer.delay.approval.times.more.then.one") ;
ErrorCode CUSTOMER_SAVED_NOT_EXISTS = new ErrorCode(1004006038, "customer.saved.not.exists");
ErrorCode CUSTOMER_DELETED_NOT_EXISTS = new ErrorCode(1004006039, "customer.deleted.not.exists");
ErrorCode CUSTOMER_SAVED_CUSTOMER_SERVICE_IS_NULL = new ErrorCode(1004006040, "customer.saved.customer.service.is.null");
ErrorCode CUSTOMER_DELETED_CUSTOMER_SERVICE_IS_NULL = new ErrorCode(1004006041, "customer.deleted.customer.service.is.null");
ErrorCode CUSTOMER_MERGE_CUSTOMER_SERVICE_NOT_SAME = new ErrorCode(1004006042, "customer.merge.customer.service.not.same");
}
......@@ -274,3 +274,8 @@ order.cargo.control.limit.update.consignee.error=
order.cargo.control.limit.update.consignee.info=
order.cargo.control.consignee.limit.update.applying=
order.cargo.control.overseas.warehouse.update.applying=
customer.saved.not.exists=
customer.deleted.not.exists=
customer.saved.customer.service.is.null=
customer.deleted.customer.service.is.null=
customer.merge.customer.service.not.same=
......@@ -1081,3 +1081,8 @@ overseas.warehouse.update.processing=Overseas warehouse modification application
overseas.warehouse.update.pass=Overseas warehouse modification approval passed
overseas.warehouse.update.reject=Overseas warehouse modification approval rejected
overseas.warehouse.update.cancel=Overseas warehouse modification approval cancelled
customer.saved.not.exists=customer saved not exists
customer.deleted.not.exists=customer deleted not exists
customer.saved.customer.service.is.null=customer saved customer service is null
customer.deleted.customer.service.is.null=customer merged customer service is null
customer.merge.customer.service.not.same=tow customer's customer serivce not same
......@@ -1031,10 +1031,10 @@ reward.redeem.allow.count.error = \u5DF2\u8D85\u51FA\u4E2A\u4EBA\u5141\u8BB8\u51
reward.node.and.points.list.error = \u521B\u5EFA\u793C\u54C1\u7F51\u70B9\u6216\u6240\u9700\u79EF\u5206\u9519\u8BEF
reward.redeem.recipient.error = \u793C\u54C1\u6536\u8D27\u4EBA\u4FE1\u606F\u4E0D\u5168
redeem.import.no.record = \u8868\u683C\u4E2D\u65E0\u8BB0\u5F55
order.cargo.control.limit.update.consignee.error=\u5f53\u524d\u63a7\u8d27\u8ba2\u5355\u9650\u5236\u4fee\u6539\u6536\u8d27\u4eba\uff0c\u672a\u67e5\u8be2\u5230\u9650\u5236\u65f6\u95f4
order.cargo.control.limit.update.consignee.info=\u63a7\u8d27\u8ba2\u5355\u6536\u8d27\u4eba\u9650\u5236\u4fee\u6539\u65f6\u95f4\u672a\u5230\u671f\uff0c\u4e0d\u80fd\u4fee\u6539\u8ba2\u5355\u6536\u8d27\u4eba\u4fe1\u606f
order.cargo.control.consignee.limit.update.applying=\u6536\u8d27\u4eba\u9650\u5236\u4fee\u6539\u7533\u8bf7\u4e2d\uff0c\u4e0d\u80fd\u8fdb\u884c\u653e\u8d27\uff01
order.cargo.control.overseas.warehouse.update.applying=\u6d77\u5916\u4ed3\u4fee\u6539\u7533\u8bf7\u4e2d\uff0c\u4e0d\u80fd\u8fdb\u884c\u653e\u8d27\uff01
order.cargo.control.limit.update.consignee.error=\u5F53\u524D\u63A7\u8D27\u8BA2\u5355\u9650\u5236\u4FEE\u6539\u6536\u8D27\u4EBA\uFF0C\u672A\u67E5\u8BE2\u5230\u9650\u5236\u65F6\u95F4
order.cargo.control.limit.update.consignee.info=\u63A7\u8D27\u8BA2\u5355\u6536\u8D27\u4EBA\u9650\u5236\u4FEE\u6539\u65F6\u95F4\u672A\u5230\u671F\uFF0C\u4E0D\u80FD\u4FEE\u6539\u8BA2\u5355\u6536\u8D27\u4EBA\u4FE1\u606F
order.cargo.control.consignee.limit.update.applying=\u6536\u8D27\u4EBA\u9650\u5236\u4FEE\u6539\u7533\u8BF7\u4E2D\uFF0C\u4E0D\u80FD\u8FDB\u884C\u653E\u8D27\uFF01
order.cargo.control.overseas.warehouse.update.applying=\u6D77\u5916\u4ED3\u4FEE\u6539\u7533\u8BF7\u4E2D\uFF0C\u4E0D\u80FD\u8FDB\u884C\u653E\u8D27\uFF01
get.lock.failed = \u670D\u52A1\u7E41\u5FD9\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5
reward.redeem.not.exist = \u793C\u54C1\u5151\u6362\u8BB0\u5F55\u4E0D\u5B58\u5728
......@@ -1072,12 +1072,17 @@ score.rule.first.order.error = \u662F\u5426\u9996\u5355\u5FC5\u987B\u4E3A\u662F\
user.address.not.exists = \u7528\u6237\u5730\u5740\u4E0D\u5B58\u5728
user.address.field.error = \u7528\u6237\u5730\u5740\u5B57\u6BB5\u9519\u8BEF\uFF1A{}
consignee.limit.update.processing=\u6536\u8d27\u4eba\u9650\u5236\u4fee\u6539\u7533\u8bf7\u4e2d
consignee.limit.update.pass=\u6536\u8d27\u4eba\u9650\u5236\u4fee\u6539\u5ba1\u6279\u901a\u8fc7
consignee.limit.update.reject=\u6536\u8d27\u4eba\u9650\u5236\u4fee\u6539\u5ba1\u6279\u62d2\u7edd
consignee.limit.update.cancel=\u6536\u8d27\u4eba\u9650\u5236\u4fee\u6539\u5ba1\u6279\u53d6\u6d88
consignee.limit.update.processing=\u6536\u8D27\u4EBA\u9650\u5236\u4FEE\u6539\u7533\u8BF7\u4E2D
consignee.limit.update.pass=\u6536\u8D27\u4EBA\u9650\u5236\u4FEE\u6539\u5BA1\u6279\u901A\u8FC7
consignee.limit.update.reject=\u6536\u8D27\u4EBA\u9650\u5236\u4FEE\u6539\u5BA1\u6279\u62D2\u7EDD
consignee.limit.update.cancel=\u6536\u8D27\u4EBA\u9650\u5236\u4FEE\u6539\u5BA1\u6279\u53D6\u6D88
overseas.warehouse.update.processing=\u6d77\u5916\u4ed3\u4fee\u6539\u7533\u8bf7\u4e2d
overseas.warehouse.update.pass=\u6d77\u5916\u4ed3\u4fee\u6539\u5ba1\u6279\u901a\u8fc7
overseas.warehouse.update.reject=\u6d77\u5916\u4ed3\u4fee\u6539\u5ba1\u6279\u62d2\u7edd
overseas.warehouse.update.cancel=\u6d77\u5916\u4ed3\u4fee\u6539\u5ba1\u6279\u53d6\u6d88
\ No newline at end of file
overseas.warehouse.update.processing=\u6D77\u5916\u4ED3\u4FEE\u6539\u7533\u8BF7\u4E2D
overseas.warehouse.update.pass=\u6D77\u5916\u4ED3\u4FEE\u6539\u5BA1\u6279\u901A\u8FC7
overseas.warehouse.update.reject=\u6D77\u5916\u4ED3\u4FEE\u6539\u5BA1\u6279\u62D2\u7EDD
overseas.warehouse.update.cancel=\u6D77\u5916\u4ED3\u4FEE\u6539\u5BA1\u6279\u53D6\u6D88
customer.saved.not.exists=\u4FDD\u7559\u5BA2\u6237\u4E0D\u5B58\u5728
customer.deleted.not.exists=\u88AB\u5408\u5E76\u5BA2\u6237\u4E0D\u5B58\u5728
customer.saved.customer.service.is.null=\u88AB\u4FDD\u7559\u5BA2\u6237\u7684\u5BA2\u6237\u7ECF\u7406\u4E3A\u7A7A
customer.deleted.customer.service.is.null=\u88AB\u5408\u5E76\u7684\u5BA2\u6237\u7684\u5BA2\u6237\u7ECF\u7406\u4E3A\u7A7A
customer.merge.customer.service.not.same=\u4E24\u5BA2\u6237\u7684\u5BA2\u6237\u7ECF\u7406\u4E0D\u4E00\u81F4
\ No newline at end of file
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