客户资源管理系统修改关联关系

master
shijie 4 years ago
parent 05443256b7
commit 9e04aa68be
  1. 4
      dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CrmsCompanyPersonalController.java
  2. 7
      dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CrmsCustomerRelatedController.java
  3. 2
      dq-financial-crms/src/main/java/com/daqing/financial/crms/mapper/CrmsCustomerRelatedMapper.java
  4. 5
      dq-financial-crms/src/main/java/com/daqing/financial/crms/model/request/CompanyCustomerRequest.java
  5. 2
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/ICrmsCustomerRelatedService.java
  6. 5
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CrmsCustomerRelatedServiceImpl.java
  7. 49
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java
  8. 10
      dq-financial-crms/src/main/resources/mapper/crms/CrmsCustomerRelatedMapper.xml
  9. 4
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/feign/CrmsFeignService.java
  10. 3
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/BusinessApplicationRequest.java
  11. 74
      dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgApplyAmountInfoServiceImpl.java
  12. 7
      dq-financial-guarantee/src/main/resources/bootstrap.properties
  13. 6
      dq-financial-hrms/src/main/resources/bootstrap.properties
  14. 2
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/CompanyCustomerEntity.java
  15. 6
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/CrmsCustomerRelated.java
  16. 4
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/CustomerEntity.java

@ -56,8 +56,10 @@ public class CrmsCompanyPersonalController {
CrmsCustomerRelated crmsCustomerRelated = new CrmsCustomerRelated();
crmsCustomerRelated.setRelatedId(crmsCompanyPersonal.getId().intValue());//关联人Id
crmsCustomerRelated.setCustomerId(crmsCompanyPersonal.getRelatedCompanyId());//企业id
boolean bindRelated = crmsCustomerRelatedService.save(crmsCustomerRelated);
if(crmsCustomerRelated.getRelatedId()!=null && crmsCustomerRelated.getCustomerId()!=null){
boolean bindRelated = crmsCustomerRelatedService.save(crmsCustomerRelated);
}
return result ? ResponseResult.SUCCESS("返回的关联人id="+crmsCompanyPersonal.getId()) : ResponseResult.FAIL();
}

@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;
/**
* <p>
@ -38,9 +39,7 @@ public class CrmsCustomerRelatedController {
*/
@PostMapping("/insertCustomerRelated")
@ApiOperation(value = "新增关联关系")
public ResponseResult insertCustomerRelated(@RequestBody @Valid CrmsCustomerRelated crmsCustomerRelated) {
boolean result = crmsCustomerRelatedService.save(crmsCustomerRelated);
return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL();
public ResponseResult insertCustomerRelated(@RequestBody List<CrmsCustomerRelated> relatedList) {
return new ResponseResult<>().SUCCESS(crmsCustomerRelatedService.insertCustomerRelated(relatedList));
}
}

@ -19,4 +19,6 @@ import java.util.List;
public interface CrmsCustomerRelatedMapper extends BaseMapper<CrmsCustomerRelated> {
boolean deleteByIds(@Param("ids") List<Long> ids);
boolean insertCustomerRelated(@Param("relatedList")List<CrmsCustomerRelated> relatedList);
}

@ -34,7 +34,7 @@ public class CompanyCustomerRequest implements Serializable {
@NotNull(message = "客户经理人不能为空")
@ApiModelProperty(value = "客户经理人ids")
private String[] manager;
private Long manager;
@NotNull(message = "客户名称不能为空")
@ApiModelProperty(value = "客户名称")
@ -101,4 +101,7 @@ public class CompanyCustomerRequest implements Serializable {
@ApiModelProperty(value = "是否存在关联人 0->否;1->是")
private Integer isExistRelated;
@ApiModelProperty(value = "关联人id")
private List<Integer> relatedId;
}

@ -16,4 +16,6 @@ import java.util.List;
public interface ICrmsCustomerRelatedService extends IService<CrmsCustomerRelated> {
boolean deleteByRelateIds(List<Long> asList);
boolean insertCustomerRelated(List<CrmsCustomerRelated> relatedList);
}

@ -23,4 +23,9 @@ public class CrmsCustomerRelatedServiceImpl extends ServiceImpl<CrmsCustomerRela
public boolean deleteByRelateIds(List<Long> ids) {
return this.getBaseMapper().deleteByIds(ids);
}
@Override
public boolean insertCustomerRelated(List<CrmsCustomerRelated> relatedList) {
return this.getBaseMapper().insertCustomerRelated(relatedList);
}
}

@ -8,9 +8,12 @@ import com.daqing.financial.crms.dao.CompanyCustomerDao;
import com.daqing.financial.crms.dao.CustomerDao;
import com.daqing.financial.crms.dao.PersonalCustomerDao;
import com.daqing.financial.crms.feign.HrmsFeignService;
import com.daqing.financial.crms.mapper.CrmsCustomerRelatedMapper;
import com.daqing.financial.crms.model.request.CompanyCustomerRequest;
import com.daqing.financial.crms.service.CustomerService;
import com.daqing.financial.crms.service.ICrmsCustomerRelatedService;
import com.daqing.framework.domain.crms.CompanyCustomerEntity;
import com.daqing.framework.domain.crms.CrmsCustomerRelated;
import com.daqing.framework.domain.crms.CustomerEntity;
import com.daqing.framework.domain.crms.PersonalCustomerEntity;
import com.daqing.framework.domain.crms.ext.*;
@ -18,13 +21,13 @@ import com.daqing.framework.domain.crms.request.CustomerRequest;
import com.daqing.framework.domain.crms.request.DgApplyAmountInfoRequest;
import com.daqing.framework.domain.crms.response.CompanyCustomerResponse;
import com.daqing.framework.domain.crms.response.CrmsCode;
import com.daqing.framework.domain.hrms.EmployeeEntity;
import com.daqing.framework.domain.hrms.ext.EmployeeTO;
import com.daqing.framework.domain.hrms.ext.EmployeeVO;
import com.daqing.framework.exception.ExceptionCast;
import com.daqing.framework.model.response.CommonCode;
import com.daqing.framework.model.response.PromptSuccess;
import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.util.ArraysUtil;
import com.daqing.framework.utils.PageUtils;
import com.daqing.framework.utils.excel.ExcelUtil;
import org.springframework.beans.BeanUtils;
@ -33,6 +36,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.text.SimpleDateFormat;
import java.util.*;
@ -52,6 +56,11 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
@Autowired
private HrmsFeignService hrmsFeignService;
@Resource
private ICrmsCustomerRelatedService crmsCustomerRelatedService;
@Resource
private CrmsCustomerRelatedMapper crmsCustomerRelatedMapper;
/**
* 查询客户列表(所有)根据创建时间筛选根据客户类型筛选根据客户编号或者名称搜索
@ -135,7 +144,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
*/
public ResponseResult getCustomerById(Long id) {
/* if (id == null){
if (id == null){
return new ResponseResult(CommonCode.INVALID_PARAM);
}
// 员工基本信息
@ -164,8 +173,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
return new ResponseResult<CustomerCompanyVO>().SUCCESS(customerCompanyVO);
}else {
return new ResponseResult(CommonCode.INEXISTENCE);
}*/
return new ResponseResult(CommonCode.INEXISTENCE);
}
}
/**
@ -553,11 +561,24 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
customerEntity.setCode(((int)(Math.random()*100+1))+"");
customerEntity.setMotifyTime(new Date());
customerEntity.setCreateTime(new Date());
customerEntity.setManager(ArraysUtil.toString(companyCustomerReq.getManager()));
customerEntity.setManager(companyCustomerReq.getManager());
customerEntity.setType(CrmsConstant.CustomerType.COMPANY_CUSTOMER.getType());
boolean customer = customerDao.saveCustomer(customerEntity);
companyCustomerEntity.setCustomerId(customerEntity.getId());
int company = companyCustomerDao.insert(companyCustomerEntity);
//绑定关联关系
List<CrmsCustomerRelated> relatedList = new ArrayList<>();
List<Integer> intList = companyCustomerReq.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);
}
crmsCustomerRelatedService.insertCustomerRelated(relatedList);
if(customer==true && company>0){
return true;
}
@ -574,11 +595,27 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
BeanUtils.copyProperties(companyCustomerReq,customerEntity);
BeanUtils.copyProperties(companyCustomerReq,companyCustomerEntity);
customerEntity.setMotifyTime(new Date());
customerEntity.setManager(ArraysUtil.toString(companyCustomerReq.getManager()));
customerEntity.setManager(companyCustomerReq.getManager());
boolean customer = customerDao.updateCustomer(customerEntity);
companyCustomerEntity.setCustomerId(customerEntity.getId());
int company = companyCustomerDao.update(companyCustomerEntity, new QueryWrapper<CompanyCustomerEntity>()
.eq("customer_id",companyCustomerEntity.getCustomerId()));
//根据企业id删除关联关系
crmsCustomerRelatedMapper.delete(new QueryWrapper<CrmsCustomerRelated>().eq("customer_id",companyCustomerEntity.getId()));
//绑定关联关系
List<CrmsCustomerRelated> relatedList = new ArrayList<>();
List<Integer> intList = companyCustomerReq.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);
}
crmsCustomerRelatedService.insertCustomerRelated(relatedList);
if(customer==true && company>0){
return true;
}

@ -7,7 +7,6 @@
<id column="id" property="id" />
<result column="customer_id" property="customerId" />
<result column="related_id" property="relatedId" />
<result column="related_type" property="relatedType" />
</resultMap>
<delete id="deleteByIds" >
@ -17,4 +16,13 @@
</foreach>
</delete>
<insert id="insertCustomerRelated">
INSERT INTO crms_customer_related
(customer_id,related_id)
VALUES
<foreach collection="relatedList" item="item" separator=",">
(#{item.customerId},#{item.relatedId})
</foreach>
</insert>
</mapper>

@ -10,6 +10,8 @@ import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* 这是一个声明式的远程调用
@ -27,7 +29,7 @@ public interface CrmsFeignService {
* 新增个人/企业关联人
*/
@PostMapping("/crms-customer-related/insertCustomerRelated")
ResponseResult insertCustomerRelated(@RequestBody CrmsCustomerRelated crmsCustomerRelated);
ResponseResult insertCustomerRelated(@RequestBody List<CrmsCustomerRelated> relatedList);
/**
* 编辑是否存在关联人

@ -9,6 +9,7 @@ import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
@Data
@ToString
@ -194,7 +195,7 @@ public class BusinessApplicationRequest implements Serializable {
* 关联人id
*/
@ApiModelProperty(value = "关联人id")
private Integer relatedId;
private List<Integer> relatedId;
/**
* 是否存在关联人

@ -1,5 +1,6 @@
package com.daqing.financial.guarantee.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -18,13 +19,17 @@ import com.daqing.financial.guarantee.util.ArraysUtil;
import com.daqing.financial.guarantee.util.AuditProcessUtil;
import com.daqing.framework.domain.crms.CrmsCustomerRelated;
import com.daqing.framework.domain.crms.request.DgApplyAmountInfoRequest;
import com.daqing.framework.domain.crms.response.CrmsCode;
import com.daqing.framework.domain.guarantee.*;
import com.daqing.framework.domain.guarantee.response.EmployeeMessageResponse;
import com.daqing.framework.exception.ExceptionCast;
import com.daqing.framework.model.StatusCode;
import com.daqing.framework.model.response.PromptSuccess;
import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.util.RandomUtil;
import com.daqing.framework.util.RedisUtil;
import com.daqing.framework.utils.PageUtils;
import com.daqing.framework.utils.excel.ExcelUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
@ -99,7 +104,7 @@ public class DgApplyAmountInfoServiceImpl extends ServiceImpl<DgApplyAmountInfoM
//申请贷款相关信息
DgApplyAmountInfo dgApplyAmountInfo = new DgApplyAmountInfo();
dgApplyAmountInfo.setCompanyId(businessApplication.getCompanyId());
dgApplyAmountInfo.setPresenterId(Integer.parseInt(userId));
dgApplyAmountInfo.setPresenterId(5);//Integer.parseInt(userId)
dgApplyAmountInfo.setApplyAmount(businessApplication.getApplyAmount());//申请额度
dgApplyAmountInfo.setApplyTime(businessApplication.getApplyTime());//申请期限
dgApplyAmountInfo.setBank(businessApplication.getBank());//贷款银行
@ -115,8 +120,8 @@ public class DgApplyAmountInfoServiceImpl extends ServiceImpl<DgApplyAmountInfoM
//新增到业务列表
DgApplyAmountList dgApplyAmountList = new DgApplyAmountList();
dgApplyAmountList.setBusinessId(dgApplyAmountInfo.getId());
dgApplyAmountList.setPresenterId(Integer.parseInt(userId));
dgApplyAmountList.setEmpId(Integer.parseInt(userId));
dgApplyAmountList.setPresenterId(5);//Integer.parseInt(userId)
dgApplyAmountList.setEmpId(5);//Integer.parseInt(userId)
dgApplyAmountList.setRoleId(PromptSuccess.DB_YWY_ID);
dgApplyAmountList.setType(1);//类型为担保业务员
@ -134,10 +139,19 @@ public class DgApplyAmountInfoServiceImpl extends ServiceImpl<DgApplyAmountInfoM
crmsFeignService.updateIsExistRelated(dgApplyAmountInfo.getCompanyId(),businessApplication.getIsExistRelated());
//绑定关联关系
/* List<CrmsCustomerRelated> relatedList = new ArrayList<>();
List<Integer> intList = businessApplication.getRelatedId();
for(int i=0;i<intList.size();i++){
CrmsCustomerRelated crmsCustomerRelated = new CrmsCustomerRelated();
Integer integer = intList.get(i);
crmsCustomerRelated.setCustomerId(dgApplyAmountInfo.getCompanyId());//企业id
crmsCustomerRelated.setRelatedId(businessApplication.getRelatedId());//关联人/企业id
crmsFeignService.insertCustomerRelated(crmsCustomerRelated);
crmsCustomerRelated.setRelatedId(integer);//关联人/企业id
relatedList.add(crmsCustomerRelated);
}*/
//此处在新增关联企业/个人的时候就做了绑定,不需要重复绑定
//crmsFeignService.insertCustomerRelated(relatedList);
//上传附件信息
DgEnclosureInfo dgEnclosureInfo = new DgEnclosureInfo();
@ -327,13 +341,6 @@ public class DgApplyAmountInfoServiceImpl extends ServiceImpl<DgApplyAmountInfoM
//修改是否存在关联人
crmsFeignService.updateIsExistRelated(businessApplication.getCompanyId(),businessApplication.getIsExistRelated());
//绑定关联关系
CrmsCustomerRelated crmsCustomerRelated = new CrmsCustomerRelated();
crmsCustomerRelated.setCustomerId(dgApplyAmountInfo.getCompanyId());//企业id
crmsCustomerRelated.setRelatedId(businessApplication.getRelatedId());//关联人/企业id
crmsFeignService.insertCustomerRelated(crmsCustomerRelated);
//上传附件信息
DgEnclosureInfo dgEnclosureInfo = new DgEnclosureInfo();
dgEnclosureInfo.setBusinessId(businessApplication.getBusinessId());//业务id
@ -395,29 +402,32 @@ public class DgApplyAmountInfoServiceImpl extends ServiceImpl<DgApplyAmountInfoM
@Transactional
@Override
public Boolean excelExport(List<String> ids, HttpServletResponse response) {
/* //根据ids查询业务申请列表信息
//根据ids查询业务申请列表信息
List<BusinessApplicationListResponse>applyList = this.baseMapper.selectListByIds(ids);
System.out.println("applyList==========================="+applyList);
List<Integer>list2= new ArrayList<>();
List<BusinessApplicationListResponse> list = this.getBaseMapper().excelList();
for (BusinessApplicationListResponse res:applyList) {
//list2.add(res.getPresenterId());
//根据userId获取用户名以及部门名称
ResponseResult<EmployeeMessageResponse> employeeMessage = hrmsFeignService.getAccountAndDeptNameById(res.getPresenterId().longValue());
//for (BusinessApplicationListResponse businessList:list) {
if(employeeMessage.getData()!= null){
if(res.getPresenterId().equals(employeeMessage.getData().getId())){//如果userId相同情况下,就往对象里面赋值
res.setAccount(employeeMessage.getData().getAccount());
res.setDeptName(employeeMessage.getData().getDeptName());
}
if(applyList != null){
if(applyList.size()>0){
List<Integer> arr = new ArrayList<>();
for (BusinessApplicationListResponse res : applyList) {
arr.add(res.getPresenterId());
}
//}
//根据提单人id查询其部门名称
ResponseResult responseResult = hrmsFeignService.getAccountAndDeptNameById(arr);
List<LinkedHashMap> employeeMessage = null;
if(responseResult.getData() != null){
employeeMessage = (List<LinkedHashMap>) responseResult.getData();
}
//根据userId获取用户名以及部门名称
//ResponseResult<EmployeeMessageResponse> employeeMessage = hrmsFeignService.getAccountAndDeptNameById(5l);
for (BusinessApplicationListResponse response2:applyList) {
for(LinkedHashMap res : employeeMessage){
if(response2.getPresenterId().equals(res.get("id"))){//如果提单人id相同情况下,就往对象里面赋值
response2.setAccount(JSONObject.toJSONString(res.get("account")).replace("\"",""));
response2.setDeptName(JSONObject.toJSONString(res.get("deptName")).replace("\"",""));
}
}
}
}
}
try {
ExcelUtil.writeExcelWithSheets(response, applyList, "业务贷款一览表", "businessApplication", new BusinessApplicationListResponse())
@ -426,8 +436,7 @@ public class DgApplyAmountInfoServiceImpl extends ServiceImpl<DgApplyAmountInfoM
} catch (Exception e) {
ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORT_EXSIT);
return false;
}*/
return false;
}
}
@Transactional
@ -514,7 +523,6 @@ public class DgApplyAmountInfoServiceImpl extends ServiceImpl<DgApplyAmountInfoM
AuditProcessUtil.save(dgApplyAmountList1.getBusinessId(),account,"担保部经理",remark,1);
}
return 1;
}

@ -27,6 +27,13 @@ spring.redis.jedis.pool.max-wait=-1
spring.redis.jedis.pool.max-idle=8
spring.redis.jedis.pool.min-idle=0
#请求处理的超时时间
ribbon.ReadTimeout: 120000
#请求连接的超时时间
ribbon.ConnectTimeout: 120000
# 上传文件总的最大值
spring.servlet.multipart.max-request-size=10MB
# 单个文件的最大值

@ -27,6 +27,12 @@ spring.redis.jedis.pool.max-wait=-1
spring.redis.jedis.pool.max-idle=8
spring.redis.jedis.pool.min-idle=0
#请求处理的超时时间
ribbon.ReadTimeout: 120000
#请求连接的超时时间
ribbon.ConnectTimeout: 30000
spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=10MB

@ -29,7 +29,7 @@ public class CompanyCustomerEntity implements Serializable {
*/
//@Pattern(regexp = "^\\\\d+$",message = "成立年限只能为整形数字")
@ApiModelProperty(value = "id")
@TableId(value = "id", type = IdType.INPUT)
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 注册资金

@ -40,10 +40,4 @@ public class CrmsCustomerRelated implements Serializable {
*/
@ApiModelProperty(value = "关联人id")
private Integer relatedId;
/**
* 关联客户类型1->企业类型0->个人类型
*/
@ApiModelProperty(value = "关联客户类型:1->企业类型;0->个人类型")
private Integer relatedType;
}

@ -28,7 +28,7 @@ public class CustomerEntity implements Serializable {
*/
@NotNull(message = "id不能为空")
@ApiModelProperty(value = "id")
@TableId(value = "id", type = IdType.INPUT)
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/**
* 客户编号
@ -46,7 +46,7 @@ public class CustomerEntity implements Serializable {
* 客户的经理人id
*/
@ApiModelProperty(value = "客户经理人id")
private String manager;
private Long manager;
/**
* 客户名称
*/

Loading…
Cancel
Save