Commit 0368aedb authored by yanghao's avatar yanghao

chore: 合并联系人是将联系人copy一份保存后关联到主客户。 被合并客户的联系人删除,以备以后数据追加查验。

parent 9efe9a18
...@@ -7,7 +7,6 @@ import cn.iocoder.yudao.framework.security.core.LoginUser; ...@@ -7,7 +7,6 @@ import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO; import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.complaint.CustomerComplaintDO; import cn.iocoder.yudao.module.customer.dal.dataobject.customer.complaint.CustomerComplaintDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.follow.CustomerFollowDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO; import cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerFollowup.CustomerFollowupDO; import cn.iocoder.yudao.module.customer.dal.dataobject.customerFollowup.CustomerFollowupDO;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService; import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
...@@ -33,6 +32,7 @@ import cn.iocoder.yudao.module.wealth.service.commissionPayment.CommissionPaymen ...@@ -33,6 +32,7 @@ import cn.iocoder.yudao.module.wealth.service.commissionPayment.CommissionPaymen
import cn.iocoder.yudao.module.wealth.service.receipt.ReceiptServiceImpl; import cn.iocoder.yudao.module.wealth.service.receipt.ReceiptServiceImpl;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
...@@ -338,12 +338,22 @@ public class CustomerMergeServiceImpl implements CustomerMergeService { ...@@ -338,12 +338,22 @@ public class CustomerMergeServiceImpl implements CustomerMergeService {
if (CollectionUtil.isNotEmpty(cuscontactList2)) { if (CollectionUtil.isNotEmpty(cuscontactList2)) {
for (CustomerContactsDO d : cuscontactList2 for (CustomerContactsDO d : cuscontactList2
) { ) {
d.setCustomerId(customerDOSaved.getId()); try {
// 1、联系人copy一份
CustomerContactsDO newCustomer = new CustomerContactsDO();
BeanUtils.copyProperties(newCustomer, d);
newCustomer.setId(null);
//被合并的客户联系人,默认为非默认 //被合并的客户联系人,默认为非默认
d.setIsDefault(0); newCustomer.setIsDefault(0);
d.setUpdateTime(new Date()); // 设置被合并客户的联系人
d.setUpdater(String.valueOf(loginUserId)); newCustomer.setCustomerId(customerDOSaved.getId());
customerContactsService.updateById(d); customerContactsService.save(newCustomer);
// 2、删除被合并客户的联系人
customerContactsService.deleteCustomerContacts(d.getId());
} catch (Exception e) {
log.error("合并客户联系人失败", e);
}
} }
} }
} }
......
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