Merge remote-tracking branch 'origin/master'

master
shijie 4 years ago
commit b47dca9fbd
  1. 4
      dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerDao.java
  2. 45
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java
  3. 10
      dq-financial-crms/src/main/resources/mapper/crms/CustomerDao.xml
  4. 2
      dq-framework-common/src/main/java/com/daqing/framework/model/response/ResponseResult.java
  5. 3
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/response/CrmsCode.java
  6. 3
      dq-govern-gateway/src/main/resources/jwt.properties

@ -39,4 +39,8 @@ public interface CustomerDao extends BaseMapper<CustomerEntity> {
List<CustomerEntity> queryCompanyCodeAndName(int type); List<CustomerEntity> queryCompanyCodeAndName(int type);
String getCodeByType(Integer type); String getCodeByType(Integer type);
List<String> listCustomerName(Integer type);
String getNameByCustomerId(Long CustomerId);
} }

@ -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);

@ -100,4 +100,14 @@
<select id="getCodeByType" parameterType="integer" resultType="string"> <select id="getCodeByType" parameterType="integer" resultType="string">
SELECT code FROM crms_customer WHERE type = #{type} AND del_or_not = 0 ORDER BY create_time DESC LIMIT 0,1 SELECT code FROM crms_customer WHERE type = #{type} AND del_or_not = 0 ORDER BY create_time DESC LIMIT 0,1
</select> </select>
<!-- 根据类型获取所有的客户名称 -->
<select id="listCustomerName" parameterType="integer" resultType="string">
SELECT name FROM crms_customer WHERE type = #{type} AND del_or_not = 0
</select>
<!-- 根据客户id查询客户名称 -->
<select id="getNameByCustomerId" parameterType="long" resultType="string">
SELECT name FROM crms_customer WHERE id = #{CustomerId}
</select>
</mapper> </mapper>

@ -57,7 +57,7 @@ public class ResponseResult<T> {
} }
public static ResponseResult FAIL(Object t) { public static ResponseResult FAIL(Object t) {
return new ResponseResult<>(false, 99999, t, "操作失败,请检查文件或者数据格式是否正确!"); return new ResponseResult<>(false, 99999, t, "操作失败,请检查客户名称是否已存在或者文件和数据格式是否正确!");
} }
public ResponseResult SUCCESS_DATA(T t){ public ResponseResult SUCCESS_DATA(T t){

@ -19,7 +19,8 @@ public enum CrmsCode implements ResultCode {
CUSTOMER_EXPORT_EXSIT(false,20002,"导出数据失败,请稍后再试!"), CUSTOMER_EXPORT_EXSIT(false,20002,"导出数据失败,请稍后再试!"),
CUSTOMER_EXPORTTEMPLATE_EXSIT(false,20003,"导出excel模板失败,请稍后再试!"), CUSTOMER_EXPORTTEMPLATE_EXSIT(false,20003,"导出excel模板失败,请稍后再试!"),
NOT_NULL(false,20004,"上传的文件不能为空"), NOT_NULL(false,20004,"上传的文件不能为空"),
CUSTOMER_IS_NULL(false,20005,"导入数据失败,当前员工不存在!"); CUSTOMER_IS_NULL(false,20005,"导入数据失败,当前员工不存在!"),
CUSTOMER_NAME_REPETITION(false, 20006, "当前客户名称已存在!");
/** /**

@ -27,7 +27,8 @@ jwt.ignoreUrlList=/apiHrmsAuth/hrms/auth/userlogin/getBackPwd,\
/api-guarantee/dg-loan-notice/exportLoanNotice,\ /api-guarantee/dg-loan-notice/exportLoanNotice,\
/api-hrms/hrms/user/uploadFile,\ /api-hrms/hrms/user/uploadFile,\
/apiHrmsAuth/hrms/auth/permission/getUserRoles,\ /apiHrmsAuth/hrms/auth/permission/getUserRoles,\
/api-hrms/hrms/permission/getPermission /api-hrms/hrms/permission/getPermission,\
/api-guarantee/guarantee/efficiency/personalEfficiencyListExport

Loading…
Cancel
Save