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

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. 35
      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);
Long getCompanyIdByCustomerId(Long customerId);
Integer getCompanyId(Integer customerId);
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> listCompanyCustomerIds();
List<CustomerEntity> queryCompanyCodeAndName(int type);
String getCodeByType(Integer type);

@ -291,25 +291,28 @@ public class CustomerAppletServiceImpl extends ServiceImpl<CustomerAppletDao, Cu
companyCustomerEntity.setCustomerId(customerEntity.getId());
int company = companyCustomerDao.update(companyCustomerEntity, new QueryWrapper<CompanyCustomerEntity>()
.eq("customer_id", companyCustomerEntity.getCustomerId()));
// 添加关联人
Long companyId = this.getBaseMapper().getCompanyIdByCustomerId((long)customerId);
if (null != companyId) {
companyCustomerEntity.setId(companyId);
//根据企业id删除关联关系
crmsCustomerRelatedMapper.delete(new QueryWrapper<CrmsCustomerRelated>().eq("customer_id", companyCustomerEntity.getId()));
//根据企业id删除关联关系
crmsCustomerRelatedMapper.delete(new QueryWrapper<CrmsCustomerRelated>().eq("customer_id", companyCustomerEntity.getId()));
//绑定关联关系
List<CrmsCustomerRelated> relatedList = new ArrayList<>();
List<Integer> intList = companyAppletRequest.getRelatedId();
//绑定关联关系
List<CrmsCustomerRelated> relatedList = new ArrayList<>();
List<Integer> intList = companyAppletRequest.getRelatedId();
for (int i = 0; i < intList.size(); i++) {
CrmsCustomerRelated crmsCustomerRelated = new CrmsCustomerRelated();
Integer integer = intList.get(i);
crmsCustomerRelated.setCustomerId(companyCustomerEntity.getId().intValue());//企业id
crmsCustomerRelated.setRelatedId(integer);//关联人/企业id
relatedList.add(crmsCustomerRelated);
}
if (relatedList.size() > 0) {
crmsCustomerRelatedService.insertCustomerRelated(relatedList);
for (int i = 0; i < intList.size(); i++) {
CrmsCustomerRelated crmsCustomerRelated = new CrmsCustomerRelated();
Integer integer = intList.get(i);
crmsCustomerRelated.setCustomerId(companyCustomerEntity.getId().intValue());//企业id
crmsCustomerRelated.setRelatedId(integer);//关联人/企业id
relatedList.add(crmsCustomerRelated);
}
if (relatedList.size() > 0) {
crmsCustomerRelatedService.insertCustomerRelated(relatedList);
}
}
if (customer && company > 0) {
return true;
}

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

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

@ -91,6 +91,14 @@
WHERE del_or_not = 0;
</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 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("客户名称")
private String name;
@ExcelProperty(value = "逾期金额", index = 2)
@ExcelProperty(value = "逾期金额(元)", index = 2)
@ApiModelProperty("逾期金额")
private BigDecimal overdueAmount;
@ExcelProperty(value = "逾期利息", index = 3)
@ExcelProperty(value = "逾期利息(元)", index = 3)
@ApiModelProperty("逾期利息")
private BigDecimal overdueInterest;
@ExcelProperty(value = "其他费用", index = 4)
@ExcelProperty(value = "其他费用(元)", index = 4)
@ApiModelProperty("其他费用")
private BigDecimal otherExpenses;

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

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

Loading…
Cancel
Save