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. 27
      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);
String getNameByCustomerId(Long CustomerId);
String getSocialUnifiedCodeByCustomerId(Long customerId);
List<String> listSocialUnifiedCode();
}

@ -360,7 +360,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
}
}
}
ExcelUtil.writeExcelWithSheets(response, companyList,"客户资源信息一览表","企业类型", new CustomerCompanyVO())
ExcelUtil.writeExcelWithSheets(response, companyList, "客户资源信息一览表", "企业类型", new CustomerCompanyVO())
.finish();
} catch (Exception e) {
ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORT_EXSIT);
@ -378,7 +378,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
ExcelUtil.writeExcelWithSheets(response, personalTemplates, "客户资源信息表模板", "个人类型", new PersonalTemplate())
.write(companyTemplates, "企业类型", new CompanyTemplate())
.finish();*/
ExcelUtil.writeExcelWithSheets(response, companyTemplates,"客户资源信息表模板","企业类型", new CompanyTemplate())
ExcelUtil.writeExcelWithSheets(response, companyTemplates, "客户资源信息表模板", "企业类型", new CompanyTemplate())
.finish();
} catch (Exception e) {
ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORTTEMPLATE_EXSIT);
@ -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();
CompanyCustomerEntity companyCustomerEntity = new CompanyCustomerEntity();
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();
CompanyCustomerEntity companyCustomerEntity = new CompanyCustomerEntity();
BeanUtils.copyProperties(companyCustomerReq, customerEntity);
@ -692,7 +713,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
companyCustomerEntity.setCustomerId(entity.getId());
//根据企业id删除关联关系
crmsCustomerRelatedMapper.delete(new QueryWrapper<CrmsCustomerRelated>().eq("customer_id",entity.getId()));//companyCustomerEntity.getId()
crmsCustomerRelatedMapper.delete(new QueryWrapper<CrmsCustomerRelated>().eq("customer_id", entity.getId()));//companyCustomerEntity.getId()
//绑定关联关系
List<CrmsCustomerRelated> relatedList = new ArrayList<>();

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

@ -118,4 +118,18 @@
<select id="getNameByCustomerId" parameterType="long" resultType="string">
SELECT name FROM crms_customer WHERE id = #{CustomerId}
</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>
Loading…
Cancel
Save