Merge remote-tracking branch 'origin/master'

master
shijie 4 years ago
commit 19182357c6
  1. 4
      dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerDao.java
  2. 21
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java
  3. 2
      dq-financial-crms/src/main/resources/mapper/crms/CustomerAppletDao.xml
  4. 14
      dq-financial-crms/src/main/resources/mapper/crms/CustomerDao.xml

@ -45,4 +45,8 @@ public interface CustomerDao extends BaseMapper<CustomerEntity> {
List<String> listCustomerName(Integer type); List<String> listCustomerName(Integer type);
String getNameByCustomerId(Long CustomerId); String getNameByCustomerId(Long CustomerId);
String getSocialUnifiedCodeByCustomerId(Long customerId);
List<String> listSocialUnifiedCode();
} }

@ -616,6 +616,15 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
} }
} }
} }
// 客户社会统一代码判重
if (companyCustomerReq.getSocialUnifiedCode() != null && companyCustomerReq.getSocialUnifiedCode().length() != 0) {
List<String> socialUnifiedCodes = customerDao.listSocialUnifiedCode();
for (String socialUnifiedCode : socialUnifiedCodes) {
if (companyCustomerReq.getSocialUnifiedCode().equals(socialUnifiedCode)) {
ExceptionCast.cast(CrmsCode.CUSTOMER_SOCIAL_UNIFIED_CODE_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);
@ -674,6 +683,18 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
} }
} }
} }
// 社会统一代码判重,注意判断是否与原来相同
if (companyCustomerReq.getSocialUnifiedCode() != null && companyCustomerReq.getSocialUnifiedCode().length() != 0) {
String newSocialUnifiedCode = customerDao.getSocialUnifiedCodeByCustomerId(companyCustomerReq.getId());
if (!companyCustomerReq.getSocialUnifiedCode().equals(newSocialUnifiedCode)) {
List<String> socialUnifiedCodes = customerDao.listSocialUnifiedCode();
for (String socialUnifiedCode : socialUnifiedCodes) {
if (companyCustomerReq.getSocialUnifiedCode().equals(socialUnifiedCode)) {
ExceptionCast.cast(CrmsCode.CUSTOMER_SOCIAL_UNIFIED_CODE_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);

@ -59,7 +59,7 @@
<if test="status == 1 or status == 2 or status == 3 or status == 4 or status == 5"> <if test="status == 1 or status == 2 or status == 3 or status == 4 or status == 5">
AND l.status = #{status} AND l.status = #{status}
</if> </if>
AND l.role_id = 58 AND l.type = 1
</select> </select>
<!-- 获取已申请成功的额度 --> <!-- 获取已申请成功的额度 -->

@ -118,4 +118,18 @@
<select id="getNameByCustomerId" parameterType="long" resultType="string"> <select id="getNameByCustomerId" parameterType="long" resultType="string">
SELECT name FROM crms_customer WHERE id = #{CustomerId} SELECT name FROM crms_customer WHERE id = #{CustomerId}
</select> </select>
<!-- 查询所有的社会统一代码 -->
<select id="listSocialUnifiedCode" resultType="string">
SELECT social_unified_code FROM crms_company_customer AS cc
INNER JOIN crms_customer AS c
ON cc.customer_id = c.id
WHERE c.del_or_not = 0
</select>
<!-- 查询当前客户的社会统一代码 -->
<select id="getSocialUnifiedCodeByCustomerId" parameterType="long" resultType="string">
SELECT social_unified_code FROM crms_company_customer WHERE customer_id = #{customerId}
</select>
</mapper> </mapper>
Loading…
Cancel
Save