|
@@ -57,20 +57,33 @@ public class CustomerInfoController {
|
|
List<String> codeList=new ArrayList<>();
|
|
List<String> codeList=new ArrayList<>();
|
|
customerInfoMapperAll.forEach(cu->{
|
|
customerInfoMapperAll.forEach(cu->{
|
|
nameList.add(cu.getCustomerName());
|
|
nameList.add(cu.getCustomerName());
|
|
- codeList.add(cu.getCustomerCode());
|
|
|
|
|
|
+ if(cu.getCustomerCode()!=null){
|
|
|
|
+ codeList.add(cu.getCustomerCode());
|
|
|
|
+ }
|
|
});
|
|
});
|
|
- if(nameList.contains(info.getCustomerName())){
|
|
|
|
- msg.setError("客户名称已存在");
|
|
|
|
- return msg;
|
|
|
|
- }
|
|
|
|
- if(codeList.contains(info.getCustomerCode())){
|
|
|
|
- msg.setError("客户编号已存在");
|
|
|
|
- return msg;
|
|
|
|
- }
|
|
|
|
if (info.getId() == null) {
|
|
if (info.getId() == null) {
|
|
|
|
+ if(nameList.contains(info.getCustomerName())){
|
|
|
|
+ msg.setError("客户名称已存在");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ if(codeList.contains(info.getCustomerCode())){
|
|
|
|
+ msg.setError("客户编号已存在");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
info.setCompanyId(user.getCompanyId());
|
|
info.setCompanyId(user.getCompanyId());
|
|
customerInfoMapper.insert(info);
|
|
customerInfoMapper.insert(info);
|
|
} else {
|
|
} else {
|
|
|
|
+ CustomerInfo customerInfo = customerInfoMapper.selectById(info.getId());
|
|
|
|
+ nameList.remove(customerInfo.getCustomerName());
|
|
|
|
+ codeList.remove(customerInfo.getCustomerCode());
|
|
|
|
+ if(nameList.contains(info.getCustomerName())){
|
|
|
|
+ msg.setError("客户名称已存在");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
|
|
+ if(codeList.contains(info.getCustomerCode())){
|
|
|
|
+ msg.setError("客户编号已存在");
|
|
|
|
+ return msg;
|
|
|
|
+ }
|
|
info.setCompanyId(user.getCompanyId());
|
|
info.setCompanyId(user.getCompanyId());
|
|
customerInfoMapper.updateById(info);
|
|
customerInfoMapper.updateById(info);
|
|
//更新项目表中的客户名称
|
|
//更新项目表中的客户名称
|