|
|
@@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -57,15 +58,29 @@ public class OutCommon {
|
|
|
// 创建客户,获取编码和主键UuId
|
|
|
Map<String, Object> codeMap = commonService.getUniqueNoteCode(Constant.docNameConstant.CUSTOMER.getName(), true);
|
|
|
Customer customer = new Customer();
|
|
|
+ // 增加跟进人,用于权限分配
|
|
|
+ List<String> followStaffs = new ArrayList<>();
|
|
|
+ followStaffs.add(outboundVO.getMakeStaff());
|
|
|
customer.setCusId(codeMap.get("outId").toString()).setCusCode(codeMap.get("outNote").toString()).setCusName(outboundVO.getCusName())
|
|
|
.setCusPhone(outboundVO.getCusPhone()).setAddressArea(outboundVO.getAddressArea()).setAddressName(outboundVO.getAddressName())
|
|
|
.setAddressNo(outboundVO.getAddressNo()).setAddressGcj02(outboundVO.getAddressGcj02()).setAddressFull(outboundVO.getAddressFull())
|
|
|
.setContactName(outboundVO.getContactName()).setContactPhone(outboundVO.getContactPhone()).setCusFrom(outboundVO.getCusFrom())
|
|
|
.setChannelId(outboundVO.getSalesChannel()).setOrgId(outboundVO.getOrgId()).setStaffId(outboundVO.getStaffId())
|
|
|
+ .setFollowStaffs(followStaffs)
|
|
|
.setReportStaff(outboundVO.getMakeStaff()).setSaleStatus(Constant.SaleStatus.CHENGJIAO.getName()).setCpId(outboundVO.getCpId());
|
|
|
customerMapper.insert(customer);
|
|
|
outboundVO.setCusId(customer.getCusId());
|
|
|
}else {
|
|
|
+ // 如果当前跟进人
|
|
|
+ Customer cus = customerMapper.selectByIdForUpdate(outboundVO.getCusId());
|
|
|
+ List<String> followStaffs = cus.getFollowStaffs();
|
|
|
+ if(followStaffs == null ){
|
|
|
+ followStaffs.add(outboundVO.getMakeStaff());
|
|
|
+ }else{
|
|
|
+ if(!followStaffs.contains(outboundVO.getMakeStaff())){
|
|
|
+ followStaffs.add(outboundVO.getMakeStaff());
|
|
|
+ }
|
|
|
+ }
|
|
|
//编辑客户
|
|
|
Customer customer = new Customer();
|
|
|
customer.setCusName(outboundVO.getCusName()).setCusId(outboundVO.getCusId())
|
|
|
@@ -73,6 +88,7 @@ public class OutCommon {
|
|
|
.setAddressNo(outboundVO.getAddressNo()).setAddressGcj02(outboundVO.getAddressGcj02()).setAddressFull(outboundVO.getAddressFull())
|
|
|
.setContactName(outboundVO.getContactName()).setContactPhone(outboundVO.getContactPhone()).setCusFrom(outboundVO.getCusFrom())
|
|
|
.setChannelId(outboundVO.getSalesChannel()).setOrgId(outboundVO.getOrgId()).setStaffId(outboundVO.getStaffId())
|
|
|
+ .setFollowStaffs(followStaffs)
|
|
|
.setSaleStatus(Constant.SaleStatus.CHENGJIAO.getName());
|
|
|
customerService.updateByUuid(customer);
|
|
|
}
|