|
|
@ -215,11 +215,20 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity |
|
|
|
@Transactional |
|
|
|
@Transactional |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean saveCustomerPersonal(CustomerPersonalTOI customerPersonalTOI) { |
|
|
|
public boolean saveCustomerPersonal(CustomerPersonalTOI customerPersonalTOI) { |
|
|
|
|
|
|
|
if (customerPersonalTOI.getName() != null && customerPersonalTOI.getName().length() != 0) { |
|
|
|
|
|
|
|
// 客户姓名判重
|
|
|
|
|
|
|
|
List<String> names = customerDao.listCustomerName(0); // 个人类型客户名称
|
|
|
|
|
|
|
|
for (String name : names) { |
|
|
|
|
|
|
|
if (customerPersonalTOI.getName().equals(name)) { |
|
|
|
|
|
|
|
ExceptionCast.cast(CrmsCode.CUSTOMER_NAME_REPETITION); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
CustomerEntity customerEntity = new CustomerEntity(); |
|
|
|
CustomerEntity customerEntity = new CustomerEntity(); |
|
|
|
PersonalCustomerEntity personalCustomerEntity = new PersonalCustomerEntity(); |
|
|
|
PersonalCustomerEntity personalCustomerEntity = new PersonalCustomerEntity(); |
|
|
|
BeanUtils.copyProperties(customerPersonalTOI, customerEntity); |
|
|
|
BeanUtils.copyProperties(customerPersonalTOI, customerEntity); |
|
|
|
BeanUtils.copyProperties(customerPersonalTOI, personalCustomerEntity); |
|
|
|
BeanUtils.copyProperties(customerPersonalTOI, personalCustomerEntity); |
|
|
|
//TODO 设置客户编号
|
|
|
|
// 设置客户编号
|
|
|
|
String code = customerDao.getCodeByType(CrmsConstant.CustomerType.PERSONAL_CUSTOMER.getType()); |
|
|
|
String code = customerDao.getCodeByType(CrmsConstant.CustomerType.PERSONAL_CUSTOMER.getType()); |
|
|
|
if (code == null || code.length() == 0) { |
|
|
|
if (code == null || code.length() == 0) { |
|
|
|
code = PromptSuccess.PERSONAL_START_CODE; |
|
|
|
code = PromptSuccess.PERSONAL_START_CODE; |
|
|
@ -263,12 +272,25 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity |
|
|
|
return customer && company; |
|
|
|
return customer && company; |
|
|
|
} |
|
|
|
} |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 更新个人类型客户信息 |
|
|
|
* 更新个人类型客户信息 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Transactional |
|
|
|
@Transactional |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean updateCustomerPersonal(CustomerPersonalTOU customerPersonalTOU) { |
|
|
|
public boolean updateCustomerPersonal(CustomerPersonalTOU customerPersonalTOU) { |
|
|
|
|
|
|
|
// 客户名称判重,注意判断是否与原来相同
|
|
|
|
|
|
|
|
if (customerPersonalTOU.getName() != null && customerPersonalTOU.getName().length() != 0) { |
|
|
|
|
|
|
|
String customerName = customerDao.getNameByCustomerId(customerPersonalTOU.getId()); |
|
|
|
|
|
|
|
if (!customerPersonalTOU.getName().equals(customerName)) { |
|
|
|
|
|
|
|
List<String> names = customerDao.listCustomerName(0); |
|
|
|
|
|
|
|
for (String name : names) { |
|
|
|
|
|
|
|
if (customerPersonalTOU.getName().equals(name)) { |
|
|
|
|
|
|
|
ExceptionCast.cast(CrmsCode.CUSTOMER_NAME_REPETITION); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
CustomerEntity customerEntity = new CustomerEntity(); |
|
|
|
CustomerEntity customerEntity = new CustomerEntity(); |
|
|
|
PersonalCustomerEntity personalCustomerEntity = new PersonalCustomerEntity(); |
|
|
|
PersonalCustomerEntity personalCustomerEntity = new PersonalCustomerEntity(); |
|
|
|
BeanUtils.copyProperties(customerPersonalTOU, customerEntity); |
|
|
|
BeanUtils.copyProperties(customerPersonalTOU, customerEntity); |
|
|
@ -568,6 +590,15 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Transactional |
|
|
|
@Transactional |
|
|
|
public boolean insertCompany(CompanyCustomerRequest companyCustomerReq) { |
|
|
|
public boolean insertCompany(CompanyCustomerRequest companyCustomerReq) { |
|
|
|
|
|
|
|
// 客户名称判重
|
|
|
|
|
|
|
|
if (companyCustomerReq.getName() != null && companyCustomerReq.getName().length() != 0) { |
|
|
|
|
|
|
|
List<String> names = customerDao.listCustomerName(1); // 企业类型客户名称
|
|
|
|
|
|
|
|
for (String name : names) { |
|
|
|
|
|
|
|
if (companyCustomerReq.getName().equals(name)) { |
|
|
|
|
|
|
|
ExceptionCast.cast(CrmsCode.CUSTOMER_NAME_REPETITION); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
CustomerEntity customerEntity = new CustomerEntity(); |
|
|
|
CustomerEntity customerEntity = new CustomerEntity(); |
|
|
|
CompanyCustomerEntity companyCustomerEntity = new CompanyCustomerEntity(); |
|
|
|
CompanyCustomerEntity companyCustomerEntity = new CompanyCustomerEntity(); |
|
|
|
BeanUtils.copyProperties(companyCustomerReq, customerEntity); |
|
|
|
BeanUtils.copyProperties(companyCustomerReq, customerEntity); |
|
|
@ -612,6 +643,18 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Transactional |
|
|
|
@Transactional |
|
|
|
public boolean updateCompanyNew(CompanyCustomerRequest companyCustomerReq) { |
|
|
|
public boolean updateCompanyNew(CompanyCustomerRequest companyCustomerReq) { |
|
|
|
|
|
|
|
// 客户名称判重,注意判断是否与原来相同
|
|
|
|
|
|
|
|
if (companyCustomerReq.getName() != null && companyCustomerReq.getName().length() != 0) { |
|
|
|
|
|
|
|
String customerName = customerDao.getNameByCustomerId(companyCustomerReq.getId()); |
|
|
|
|
|
|
|
if (!companyCustomerReq.getName().equals(customerName)) { |
|
|
|
|
|
|
|
List<String> names = customerDao.listCustomerName(1); |
|
|
|
|
|
|
|
for (String name : names) { |
|
|
|
|
|
|
|
if (companyCustomerReq.getName().equals(name)) { |
|
|
|
|
|
|
|
ExceptionCast.cast(CrmsCode.CUSTOMER_NAME_REPETITION); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
CustomerEntity customerEntity = new CustomerEntity(); |
|
|
|
CustomerEntity customerEntity = new CustomerEntity(); |
|
|
|
CompanyCustomerEntity companyCustomerEntity = new CompanyCustomerEntity(); |
|
|
|
CompanyCustomerEntity companyCustomerEntity = new CompanyCustomerEntity(); |
|
|
|
BeanUtils.copyProperties(companyCustomerReq, customerEntity); |
|
|
|
BeanUtils.copyProperties(companyCustomerReq, customerEntity); |
|
|
|