diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CrmsCompanyPersonalController.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CrmsCompanyPersonalController.java
index 35769148..2cae92ac 100644
--- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CrmsCompanyPersonalController.java
+++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CrmsCompanyPersonalController.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();
}
diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CrmsCustomerRelatedController.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CrmsCustomerRelatedController.java
index 4da79e82..0132d420 100644
--- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CrmsCustomerRelatedController.java
+++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CrmsCustomerRelatedController.java
@@ -16,6 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.Valid;
+import java.util.List;
/**
*
@@ -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 relatedList) {
+ return new ResponseResult<>().SUCCESS(crmsCustomerRelatedService.insertCustomerRelated(relatedList));
}
}
diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/mapper/CrmsCustomerRelatedMapper.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/mapper/CrmsCustomerRelatedMapper.java
index e3690807..e69ec6d9 100644
--- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/mapper/CrmsCustomerRelatedMapper.java
+++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/mapper/CrmsCustomerRelatedMapper.java
@@ -19,4 +19,6 @@ import java.util.List;
public interface CrmsCustomerRelatedMapper extends BaseMapper {
boolean deleteByIds(@Param("ids") List ids);
+
+ boolean insertCustomerRelated(@Param("relatedList")List relatedList);
}
diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/model/request/CompanyCustomerRequest.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/model/request/CompanyCustomerRequest.java
index eafbc4be..18bfa20c 100644
--- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/model/request/CompanyCustomerRequest.java
+++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/model/request/CompanyCustomerRequest.java
@@ -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 relatedId;
}
diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/ICrmsCustomerRelatedService.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/ICrmsCustomerRelatedService.java
index a1696555..2989a5e2 100644
--- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/ICrmsCustomerRelatedService.java
+++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/ICrmsCustomerRelatedService.java
@@ -16,4 +16,6 @@ import java.util.List;
public interface ICrmsCustomerRelatedService extends IService {
boolean deleteByRelateIds(List asList);
+
+ boolean insertCustomerRelated(List relatedList);
}
diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CrmsCustomerRelatedServiceImpl.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CrmsCustomerRelatedServiceImpl.java
index 1bf9796b..e19ebb30 100644
--- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CrmsCustomerRelatedServiceImpl.java
+++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CrmsCustomerRelatedServiceImpl.java
@@ -23,4 +23,9 @@ public class CrmsCustomerRelatedServiceImpl extends ServiceImpl ids) {
return this.getBaseMapper().deleteByIds(ids);
}
+
+ @Override
+ public boolean insertCustomerRelated(List relatedList) {
+ return this.getBaseMapper().insertCustomerRelated(relatedList);
+ }
}
diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java
index af4aa7bc..7115e4ee 100644
--- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java
+++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java
@@ -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().SUCCESS(customerCompanyVO);
}else {
return new ResponseResult(CommonCode.INEXISTENCE);
- }*/
- return new ResponseResult(CommonCode.INEXISTENCE);
+ }
}
/**
@@ -553,11 +561,24 @@ public class CustomerServiceImpl extends ServiceImpl relatedList = new ArrayList<>();
+ List intList = companyCustomerReq.getRelatedId();
+
+ for(int i=0;i0){
return true;
}
@@ -574,11 +595,27 @@ public class CustomerServiceImpl extends ServiceImpl()
.eq("customer_id",companyCustomerEntity.getCustomerId()));
+
+ //根据企业id删除关联关系
+ crmsCustomerRelatedMapper.delete(new QueryWrapper().eq("customer_id",companyCustomerEntity.getId()));
+
+ //绑定关联关系
+ List relatedList = new ArrayList<>();
+ List intList = companyCustomerReq.getRelatedId();
+
+ for(int i=0;i0){
return true;
}
diff --git a/dq-financial-crms/src/main/resources/mapper/crms/CrmsCustomerRelatedMapper.xml b/dq-financial-crms/src/main/resources/mapper/crms/CrmsCustomerRelatedMapper.xml
index 2b0cda30..e9b0495c 100644
--- a/dq-financial-crms/src/main/resources/mapper/crms/CrmsCustomerRelatedMapper.xml
+++ b/dq-financial-crms/src/main/resources/mapper/crms/CrmsCustomerRelatedMapper.xml
@@ -7,7 +7,6 @@
-
@@ -17,4 +16,13 @@
+
+ INSERT INTO crms_customer_related
+ (customer_id,related_id)
+ VALUES
+
+ (#{item.customerId},#{item.relatedId})
+
+
+
diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/feign/CrmsFeignService.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/feign/CrmsFeignService.java
index f6d770ec..6cd77a4e 100644
--- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/feign/CrmsFeignService.java
+++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/feign/CrmsFeignService.java
@@ -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 relatedList);
/**
* 编辑是否存在关联人
diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/BusinessApplicationRequest.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/BusinessApplicationRequest.java
index f6d4312f..b675274e 100644
--- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/BusinessApplicationRequest.java
+++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/model/request/BusinessApplicationRequest.java
@@ -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 relatedId;
/**
* 是否存在关联人
diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgApplyAmountInfoServiceImpl.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgApplyAmountInfoServiceImpl.java
index 3d09f134..e6096b16 100644
--- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgApplyAmountInfoServiceImpl.java
+++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgApplyAmountInfoServiceImpl.java
@@ -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 relatedList = new ArrayList<>();
+ List intList = businessApplication.getRelatedId();
+
+ for(int i=0;i ids, HttpServletResponse response) {
- /* //根据ids查询业务申请列表信息
+ //根据ids查询业务申请列表信息
ListapplyList = this.baseMapper.selectListByIds(ids);
System.out.println("applyList==========================="+applyList);
- Listlist2= new ArrayList<>();
- List list = this.getBaseMapper().excelList();
- for (BusinessApplicationListResponse res:applyList) {
- //list2.add(res.getPresenterId());
-
- //根据userId获取用户名以及部门名称
- ResponseResult 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 arr = new ArrayList<>();
+ for (BusinessApplicationListResponse res : applyList) {
+ arr.add(res.getPresenterId());
+ }
+ //根据提单人id查询其部门名称
+ ResponseResult responseResult = hrmsFeignService.getAccountAndDeptNameById(arr);
+ List employeeMessage = null;
+ if(responseResult.getData() != null){
+ employeeMessage = (List) responseResult.getData();
+ }
+
+ 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("\"",""));
+ }
}
}
- //}
+ }
}
- //根据userId获取用户名以及部门名称
- //ResponseResult employeeMessage = hrmsFeignService.getAccountAndDeptNameById(5l);
-
try {
ExcelUtil.writeExcelWithSheets(response, applyList, "业务贷款一览表", "businessApplication", new BusinessApplicationListResponse())
@@ -426,8 +436,7 @@ public class DgApplyAmountInfoServiceImpl extends ServiceImpl企业类型;0->个人类型
- */
- @ApiModelProperty(value = "关联客户类型:1->企业类型;0->个人类型")
- private Integer relatedType;
}
diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/CustomerEntity.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/CustomerEntity.java
index b2f49d34..55ddb96e 100644
--- a/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/CustomerEntity.java
+++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/CustomerEntity.java
@@ -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;
/**
* 客户名称
*/