客户小程序修改认证信息时新增关联人空指针

master
river 4 years ago
parent c0e7a67444
commit 22ae6c4539
  1. 2
      dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerAppletDao.java
  2. 2
      dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerDao.java
  3. 7
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerAppletServiceImpl.java
  4. 33
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java
  5. 5
      dq-financial-crms/src/main/resources/mapper/crms/CustomerAppletDao.xml
  6. 8
      dq-financial-crms/src/main/resources/mapper/crms/CustomerDao.xml
  7. 6
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/AlCollectionListResponse.java
  8. 6
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/response/AlCollectionResponse.java
  9. 6
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerCompanyVO.java

@ -29,6 +29,8 @@ public interface CustomerAppletDao extends BaseMapper<CustomerEntity> {
Boolean updateCustomer(@Param("customer") CustomerEntity customerEntity); Boolean updateCustomer(@Param("customer") CustomerEntity customerEntity);
Long getCompanyIdByCustomerId(Long customerId);
Integer getCompanyId(Integer customerId); Integer getCompanyId(Integer customerId);
IPage<ApplicationRecordPO> getApplicationRecord(Page page, @Param("companyId")Integer companyId, @Param("status")Integer status); IPage<ApplicationRecordPO> getApplicationRecord(Page page, @Param("companyId")Integer companyId, @Param("status")Integer status);

@ -36,6 +36,8 @@ public interface CustomerDao extends BaseMapper<CustomerEntity> {
List<Long> listCustomerId(); List<Long> listCustomerId();
List<Long> listCompanyCustomerIds();
List<CustomerEntity> queryCompanyCodeAndName(int type); List<CustomerEntity> queryCompanyCodeAndName(int type);
String getCodeByType(Integer type); String getCodeByType(Integer type);

@ -291,7 +291,10 @@ public class CustomerAppletServiceImpl extends ServiceImpl<CustomerAppletDao, Cu
companyCustomerEntity.setCustomerId(customerEntity.getId()); companyCustomerEntity.setCustomerId(customerEntity.getId());
int company = companyCustomerDao.update(companyCustomerEntity, new QueryWrapper<CompanyCustomerEntity>() int company = companyCustomerDao.update(companyCustomerEntity, new QueryWrapper<CompanyCustomerEntity>()
.eq("customer_id", companyCustomerEntity.getCustomerId())); .eq("customer_id", companyCustomerEntity.getCustomerId()));
// 添加关联人
Long companyId = this.getBaseMapper().getCompanyIdByCustomerId((long)customerId);
if (null != companyId) {
companyCustomerEntity.setId(companyId);
//根据企业id删除关联关系 //根据企业id删除关联关系
crmsCustomerRelatedMapper.delete(new QueryWrapper<CrmsCustomerRelated>().eq("customer_id", companyCustomerEntity.getId())); crmsCustomerRelatedMapper.delete(new QueryWrapper<CrmsCustomerRelated>().eq("customer_id", companyCustomerEntity.getId()));
@ -309,7 +312,7 @@ public class CustomerAppletServiceImpl extends ServiceImpl<CustomerAppletDao, Cu
if (relatedList.size() > 0) { if (relatedList.size() > 0) {
crmsCustomerRelatedService.insertCustomerRelated(relatedList); crmsCustomerRelatedService.insertCustomerRelated(relatedList);
} }
}
if (customer && company > 0) { if (customer && company > 0) {
return true; return true;
} }

@ -77,7 +77,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
// 时间参数校验 // 时间参数校验
this.timeCheckout(customerRequest.getCreateTime(), customerRequest.getStartTime(), customerRequest.getEndTime(), customerRequest); this.timeCheckout(customerRequest.getCreateTime(), customerRequest.getStartTime(), customerRequest.getEndTime(), customerRequest);
// 分页参数校验 // 分页参数校验
if (page == null || size == null) { if (page == null || page < 1 || size == null || size < 1) {
page = 1; page = 1;
size = 10; size = 10;
} }
@ -336,7 +336,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
//TODO 查询所有的客户详细信息,并按照类型封装,后续有待优化,消耗时间太长 //TODO 查询所有的客户详细信息,并按照类型封装,后续有待优化,消耗时间太长
try { try {
List<CustomerCompanyVO> companyList = new ArrayList<>(); List<CustomerCompanyVO> companyList = new ArrayList<>();
List<CustomerPersonalVO> personalList = new ArrayList<>(); /*List<CustomerPersonalVO> personalList = new ArrayList<>();
List<Long> longList = customerDao.listCustomerId(); List<Long> longList = customerDao.listCustomerId();
if (longList != null) { if (longList != null) {
for (Long id : longList) { for (Long id : longList) {
@ -350,6 +350,17 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
} }
ExcelUtil.writeExcelWithSheets(response, personalList, "客户资源信息一览表", "个人类型", new CustomerPersonalVO()) ExcelUtil.writeExcelWithSheets(response, personalList, "客户资源信息一览表", "个人类型", new CustomerPersonalVO())
.write(companyList, "企业类型", new CustomerCompanyVO()) .write(companyList, "企业类型", new CustomerCompanyVO())
.finish();*/
List<Long> longList = customerDao.listCompanyCustomerIds();
if (null != longList) {
for (Long id : longList) {
ResponseResult responseResult = this.getCustomerById(id);
if (null != responseResult) {
companyList.add((CustomerCompanyVO) responseResult.getData());
}
}
}
ExcelUtil.writeExcelWithSheets(response, companyList,"客户资源信息一览表","企业类型", new CustomerCompanyVO())
.finish(); .finish();
} catch (Exception e) { } catch (Exception e) {
ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORT_EXSIT); ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORT_EXSIT);
@ -363,9 +374,11 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
public void excelTemplate(HttpServletResponse response) { public void excelTemplate(HttpServletResponse response) {
try { try {
List<CompanyTemplate> companyTemplates = new ArrayList<>(); List<CompanyTemplate> companyTemplates = new ArrayList<>();
List<PersonalTemplate> personalTemplates = new ArrayList<>(); /*List<PersonalTemplate> personalTemplates = new ArrayList<>();
ExcelUtil.writeExcelWithSheets(response, personalTemplates, "客户资源信息表模板", "个人类型", new PersonalTemplate()) ExcelUtil.writeExcelWithSheets(response, personalTemplates, "客户资源信息表模板", "个人类型", new PersonalTemplate())
.write(companyTemplates, "企业类型", new CompanyTemplate()) .write(companyTemplates, "企业类型", new CompanyTemplate())
.finish();*/
ExcelUtil.writeExcelWithSheets(response, companyTemplates,"客户资源信息表模板","企业类型", new CompanyTemplate())
.finish(); .finish();
} catch (Exception e) { } catch (Exception e) {
ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORTTEMPLATE_EXSIT); ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORTTEMPLATE_EXSIT);
@ -385,17 +398,17 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
ExceptionCast.cast(CrmsCode.NOT_NULL); ExceptionCast.cast(CrmsCode.NOT_NULL);
} }
try { try {
List<Object> personalList = ExcelUtil.readExcel(excel, new PersonalTemplate(), 1); List<Object> companyList = ExcelUtil.readExcel(excel, new CompanyTemplate(), 1);
List<Object> companyList = ExcelUtil.readExcel(excel, new CompanyTemplate(), 2); /*List<Object> personalList = ExcelUtil.readExcel(excel, new PersonalTemplate(), 1);
/*List<EmployeeVO> nameList = hrmsFeignService.listEmployeeName().getData();*/ List<EmployeeVO> nameList = hrmsFeignService.listEmployeeName().getData();
CustomerPersonalTOI customerPersonalTOI; CustomerPersonalTOI customerPersonalTOI;
/*ManagerName manager; // 客户名称*/ ManagerName manager; // 客户名称
// 个人类型 // 个人类型
for (Object personal : personalList) { for (Object personal : personalList) {
customerPersonalTOI = new CustomerPersonalTOI(); customerPersonalTOI = new CustomerPersonalTOI();
customerPersonalTOI.setType(0); customerPersonalTOI.setType(0);
BeanUtils.copyProperties(personal, customerPersonalTOI); BeanUtils.copyProperties(personal, customerPersonalTOI);
/*manager = new ManagerName(); manager = new ManagerName();
BeanUtils.copyProperties(personal, manager); BeanUtils.copyProperties(personal, manager);
// 根据客户经理名称找到对应的员工id // 根据客户经理名称找到对应的员工id
if (nameList != null && manager.getManager() != null) { if (nameList != null && manager.getManager() != null) {
@ -407,9 +420,9 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
if (customerPersonalTOI.getManager() == null) { if (customerPersonalTOI.getManager() == null) {
return new ResponseResult<String>().FAIL("导入数据失败,员工" + manager.getManager() + "不存在"); return new ResponseResult<String>().FAIL("导入数据失败,员工" + manager.getManager() + "不存在");
} }
}*/
this.saveCustomerPersonal(customerPersonalTOI);
} }
this.saveCustomerPersonal(customerPersonalTOI);
}*/
// 企业类型 // 企业类型
for (Object company : companyList) { for (Object company : companyList) {
CompanyCustomerRequest companyCustomerRequest = new CompanyCustomerRequest(); CompanyCustomerRequest companyCustomerRequest = new CompanyCustomerRequest();

@ -30,6 +30,11 @@
WHERE id = #{customer.id} WHERE id = #{customer.id}
</update> </update>
<!-- 根据客户id获取企业类型客户id -->
<select id="getCompanyIdByCustomerId" parameterType="long" resultType="long">
SELECT id FROM crms_company_customer WHERE customer_id = #{customerId}
</select>
<!-- 获取企业类型客户的id --> <!-- 获取企业类型客户的id -->
<select id="getCompanyId" parameterType="integer" resultType="integer"> <select id="getCompanyId" parameterType="integer" resultType="integer">
SELECT id FROM crms_company_customer WHERE customer_id = #{customerId} SELECT id FROM crms_company_customer WHERE customer_id = #{customerId}

@ -91,6 +91,14 @@
WHERE del_or_not = 0; WHERE del_or_not = 0;
</select> </select>
<!-- 查询所有的企业类型的客户信息(导出) -->
<select id="listCompanyCustomerIds" resultType="long">
SELECT id
FROM crms_customer
WHERE del_or_not = 0
AND type = 1
</select>
<!-- 获取所有客户编号和客户名称 --> <!-- 获取所有客户编号和客户名称 -->
<select id="queryCompanyCodeAndName" parameterType="int" resultMap="customerMap"> <select id="queryCompanyCodeAndName" parameterType="int" resultMap="customerMap">
SELECT code,`name` from crms_customer where `type` =#{type} and del_or_not = 0 and status = 0 SELECT code,`name` from crms_customer where `type` =#{type} and del_or_not = 0 and status = 0

@ -34,15 +34,15 @@ public class AlCollectionListResponse extends BaseRowModel implements Serializab
@ApiModelProperty("客户名称") @ApiModelProperty("客户名称")
private String name; private String name;
@ExcelProperty(value = "逾期金额", index = 2) @ExcelProperty(value = "逾期金额(元)", index = 2)
@ApiModelProperty("逾期金额") @ApiModelProperty("逾期金额")
private BigDecimal overdueAmount; private BigDecimal overdueAmount;
@ExcelProperty(value = "逾期利息", index = 3) @ExcelProperty(value = "逾期利息(元)", index = 3)
@ApiModelProperty("逾期利息") @ApiModelProperty("逾期利息")
private BigDecimal overdueInterest; private BigDecimal overdueInterest;
@ExcelProperty(value = "其他费用", index = 4) @ExcelProperty(value = "其他费用(元)", index = 4)
@ApiModelProperty("其他费用") @ApiModelProperty("其他费用")
private BigDecimal otherExpenses; private BigDecimal otherExpenses;

@ -41,7 +41,7 @@ public class AlCollectionResponse extends BaseRowModel implements Serializable {
@ApiModelProperty("业务类别") @ApiModelProperty("业务类别")
private String type; private String type;
@ExcelProperty(value = "担保额度", index = 4) @ExcelProperty(value = "担保额度(元)", index = 4)
@ApiModelProperty("担保额度") @ApiModelProperty("担保额度")
private BigDecimal amount; private BigDecimal amount;
@ -49,11 +49,11 @@ public class AlCollectionResponse extends BaseRowModel implements Serializable {
@ApiModelProperty("逾期期数") @ApiModelProperty("逾期期数")
private Integer overduePeriods; private Integer overduePeriods;
@ExcelProperty(value = "逾期额度", index = 6) @ExcelProperty(value = "逾期额度(元)", index = 6)
@ApiModelProperty("逾期额度") @ApiModelProperty("逾期额度")
private BigDecimal overdueAmount; private BigDecimal overdueAmount;
@ExcelProperty(value = "逾期利息", index = 7) @ExcelProperty(value = "逾期利息(元)", index = 7)
@ApiModelProperty("逾期利息") @ApiModelProperty("逾期利息")
private BigDecimal overdueInterest; private BigDecimal overdueInterest;

@ -45,10 +45,10 @@ public class CustomerCompanyVO extends BaseRowModel implements Serializable {
@ExcelProperty(value = "注册时间", index = 5) @ExcelProperty(value = "注册时间", index = 5)
private Date registerTime; private Date registerTime;
@ExcelProperty(value = "注册资金", index = 6) @ExcelProperty(value = "注册资金(万元)", index = 6)
private String registeredCapital; private String registeredCapital;
@ExcelProperty(value = "员工人数", index = 7) @ExcelProperty(value = "员工人数(人)", index = 7)
private String empNum; private String empNum;
@ExcelProperty(value = "注册地址", index = 8) @ExcelProperty(value = "注册地址", index = 8)
@ -81,7 +81,7 @@ public class CustomerCompanyVO extends BaseRowModel implements Serializable {
@ExcelProperty(value = "法人-家庭住址",index = 17) @ExcelProperty(value = "法人-家庭住址",index = 17)
private String legalHomeAddr; private String legalHomeAddr;
@ExcelProperty(value = "法人-性别 1、男,0、女",index = 18) @ExcelProperty(value = "法人-性别 1:男,0:女",index = 18)
private Integer legalGender; private Integer legalGender;
@ExcelProperty(value = "法人-姓名",index = 19) @ExcelProperty(value = "法人-姓名",index = 19)

Loading…
Cancel
Save