小程序客户模块的认证(数据录入)优化与问题修复

master
river 4 years ago
parent 4703cdfbf5
commit e8c9efca8e
  1. 21
      dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerAppletController.java
  2. 2
      dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerAppletDao.java
  3. 92
      dq-financial-crms/src/main/java/com/daqing/financial/crms/model/request/CompanyAppletRequest.java
  4. 105
      dq-financial-crms/src/main/java/com/daqing/financial/crms/model/request/PersonalAppletRequest.java
  5. 16
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/CustomerAppletService.java
  6. 153
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerAppletServiceImpl.java
  7. 84
      dq-financial-crms/src/main/resources/bootstrap.properties
  8. 7
      dq-financial-crms/src/main/resources/mapper/crms/CustomerAppletDao.xml
  9. 3
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/response/CrmsCode.java

@ -1,7 +1,8 @@
package com.daqing.financial.crms.controller;
import com.daqing.financial.crms.model.request.CompanyAppletRequest;
import com.daqing.financial.crms.model.request.CompanyCustomerRequest;
import com.daqing.financial.crms.model.request.PersonalCustomerRequest;
import com.daqing.financial.crms.model.request.PersonalAppletRequest;
import com.daqing.financial.crms.service.CustomerAppletService;
import com.daqing.framework.domain.crms.ext.CustomerPersonalTOI;
import com.daqing.framework.model.response.ResponseResult;
@ -31,9 +32,9 @@ public class CustomerAppletController {
*/
@PostMapping("/save/personal")
@ApiOperation(value = "个人类型客户数据录入(认证)")
public ResponseResult savePersonal(@RequestBody @Valid CustomerPersonalTOI customerPersonalTOI) {
public ResponseResult savePersonal(@RequestBody @Valid PersonalAppletRequest personalAppletRequest) {
Boolean result = customerAppletService.savePersonal(customerPersonalTOI);
Boolean result = customerAppletService.savePersonal(personalAppletRequest);
return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL();
}
@ -43,9 +44,9 @@ public class CustomerAppletController {
*/
@PostMapping("/save/company")
@ApiOperation(value = "企业类型客户数据录入(认证)")
public ResponseResult saveCompany(@RequestBody @Valid CompanyCustomerRequest companyCustomerRequest) {
public ResponseResult saveCompany(@RequestBody @Valid CompanyAppletRequest companyAppletRequest) {
Boolean result = customerAppletService.saveCompany(companyCustomerRequest);
Boolean result = customerAppletService.saveCompany(companyAppletRequest);
return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL();
}
@ -67,7 +68,7 @@ public class CustomerAppletController {
@ApiOperation(value = "获取已认证的客户信息")
public ResponseResult getCustomer(@RequestParam("type") Integer type) {
return customerAppletService.getCustomer(type);
return ResponseResult.SUCCESS(customerAppletService.getCustomer(type));
}
/**
@ -75,9 +76,9 @@ public class CustomerAppletController {
*/
@ApiOperation(value = "更新个人类型的客户信息")
@PostMapping("/update/personal")
public ResponseResult updatePersonal(@RequestBody @Valid PersonalCustomerRequest personalCustomerRequest) {
public ResponseResult updatePersonal(@RequestBody @Valid PersonalAppletRequest personalAppletRequest) {
Boolean result = customerAppletService.updatePersonal(personalCustomerRequest);
Boolean result = customerAppletService.updatePersonal(personalAppletRequest);
return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL();
}
@ -87,9 +88,9 @@ public class CustomerAppletController {
*/
@PostMapping("/update/company")
@ApiOperation(value = "更新企业类型的客户信息")
public ResponseResult updateCompany(@RequestBody @Valid CompanyCustomerRequest companyCustomerRequest) {
public ResponseResult updateCompany(@RequestBody @Valid CompanyAppletRequest companyAppletRequest) {
Boolean result = customerAppletService.updateCompany(companyCustomerRequest);
Boolean result = customerAppletService.updateCompany(companyAppletRequest);
return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL();
}

@ -21,4 +21,6 @@ public interface CustomerAppletDao extends BaseMapper<CustomerEntity> {
Integer getCustomerId(@Param("userId") Integer userId, @Param("type") Integer type);
Boolean updateCustomer(@Param("customer") CustomerEntity customerEntity);
}

@ -0,0 +1,92 @@
package com.daqing.financial.crms.model.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 小程序客户模块企业类型数据录入(认证)
*
* @auther River
* @date 2021/1/29 11:16
*/
@Data
@ToString
public class CompanyAppletRequest implements Serializable {
@NotNull(message = "客户名称不能为空")
@ApiModelProperty(value = "客户名称")
private String name;
@NotNull(message = "社会统一代码不能为空")
@ApiModelProperty(value = "社会统一代码")
private String socialUnifiedCode;
@NotNull(message = "联系电话不能为空")
@Pattern(regexp = "^[0-9]*$",message = "联系电话格式错误")
@ApiModelProperty(value = "联系电话")
private String phone;
@ApiModelProperty(value = "注册时间")
private Date registerTime;
@Pattern(regexp = "^[0-9]+\\.{0,1}[0-9]{0,2}$",message = "注册资金格式有误")
@NotNull(message = "注册资金不能为空")
@ApiModelProperty(value = "注册资金")
private String registeredCapital;
@Pattern(regexp = "^[0-9]*$",message = "员工人数格式错误")
@NotNull(message = "员工人数不能为空")
@ApiModelProperty(value = "员工人数")
private String empNum;
@ApiModelProperty(value = "注册地址")
private String registerAddr;
@NotNull(message = "联系人不能为空")
@ApiModelProperty(value = "联系人")
private String linkman;
@ApiModelProperty(value = "联系人电话")
private String linkPhone;
@ApiModelProperty(value = "经营地址")
private String businessAddr;
@NotNull(message = "业务来源不能为空")
@ApiModelProperty(value = "业务来源")
private String businessSource;
@ApiModelProperty(value = "经营范围")
private String businessScope;
@ApiModelProperty(value = "法人-姓名")
private String legalName;
@ApiModelProperty(value = "法人-性别 1、男,0、女")
private Integer legalGender;
@ApiModelProperty(value = "法人-身份证号")
private String legalIdNumber;
@ApiModelProperty(value = "法人-户口所在地")
private String legalHukouAddr;
@ApiModelProperty(value = "法人-联系电话")
private String legalPhone;
@ApiModelProperty(value = "法人-家庭住址")
private String legalHomeAddr;
@ApiModelProperty(value = "是否存在关联人 0->否;1->是")
private Integer isExistRelated;
@ApiModelProperty(value = "关联人id")
private List<Integer> relatedId;
}

@ -1,7 +1,5 @@
package com.daqing.financial.crms.model.request;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
@ -16,146 +14,87 @@ import java.io.Serializable;
* 小程序客户模块个人类型数据录入(认证)
*
* @auther River
* @date 2021/1/28 11:44
* @date 2021/1/29 11:04
*/
@Data
@ToString
public class PersonalCustomerRequest implements Serializable {
public class PersonalAppletRequest implements Serializable {
/**
* 主键
*/
@ApiModelProperty(value = "id")
@TableId(value = "id", type = IdType.INPUT)
private Long id;
/**
* 客户编号
*/
@NotNull(message = "客户编号不能为空")
@ApiModelProperty(value = "客户编号")
private String code;
/**
* 客户类型1企业类型0个人类型
*/
@ApiModelProperty(value = "客户类型")
private Integer type;
/**
* 客户的经理人id
*/
@ApiModelProperty(value = "客户经理人id")
private Long manager;
/**
* 客户名称
*/
@NotNull(message = "客户名称不能为空")
@ApiModelProperty(value = "客户名称")
private String name;
/**
* 联系地址
*/
@NotNull(message = "联系地址不能为空")
@ApiModelProperty(value = "联系地址")
private String addr;
/**
* 联系电话
*/
@Pattern(regexp = "^[0-9]*$",message = "联系电话格式错误")
@NotNull(message = "联系电话不能为空")
@ApiModelProperty(value = "联系电话")
private String phone;
/**
* 身份证号
*/
@NotNull(message = "身份证号不能为空")
@ApiModelProperty(value = "身份证号")
private String idCard;
/**
* 年龄
*/
@NotNull(message = "年龄不能为空")
@ApiModelProperty(value = "年龄")
private Integer age;
/**
* 性别10
*/
@Min(value = 0,message = "性别格式有误")
@Max(value = 1,message = "性别格式有误")
@NotNull(message = "性别不能为空")
@ApiModelProperty(value = "性别")
@ApiModelProperty(value = "性别,1、男,0、女")
private Integer gender;
/**
* 婚姻状况,0:未婚,1:已婚,2:离异,3:再婚
*/
@Min(value = 0,message = "婚姻状况格式有误")
@Max(value = 3,message = "婚姻状况格式有误")
@NotNull(message = "婚姻状况不能为空")
@ApiModelProperty(value = "婚姻状况")
@ApiModelProperty(value = "婚姻状况,0:未婚,1:已婚,2:离异,3:再婚")
private Integer maritalStatus;
/**
* 学历,0:本科,1:大专,2:高职,3:中专,4:其他
*/
@Min(value = 0,message = "学历格式有误")
@Max(value = 4,message = "学历格式有误")
@NotNull(message = "学历不能为空")
@ApiModelProperty(value = "学历")
@ApiModelProperty(value = "学历,0:本科,1:大专,2:高职,3:中专,4:其他")
private Integer education;
/**
* 工作单位
*/
@NotNull(message = "工作单位不能为空")
@ApiModelProperty(value = "工作单位")
private String employer;
/**
* 职务
*/
@NotNull(message = "职务不能为空")
@ApiModelProperty(value = "职务")
private String position;
/**
* 工作年限
*/
@NotNull(message = "工作年限不能为空")
@ApiModelProperty(value = "工作年限")
private Integer workingYears;
/**
* 社保账号
*/
@NotNull(message = "社保账号不能为空")
@ApiModelProperty(value = "社保账号")
private String socialSecurityNum;
/**
* 居住情况
*/
@NotNull(message = "居住情况不能为空")
@ApiModelProperty(value = "居住情况")
private String livingSituation;
/**
* 户籍地址
*/
@NotNull(message = "户籍地址不能为空")
@ApiModelProperty(value = "户籍地址")
private String residenceAddr;
/**
* 业务来源
*/
@NotNull(message = "业务来源不能为空")
@ApiModelProperty(value = "业务来源")
private String businessSource;
/**
* 紧急联系人
*/
@NotNull(message = "紧急联系人不能为空")
@ApiModelProperty(value = "紧急联系人")
private String emergencyLinkman;
/**
* 紧急联系人关系
*/
@NotNull(message = "紧急联系人关系不能为空")
@ApiModelProperty(value = "紧急联系人关系")
private String emergencyLinkmanRelationship;
/**
* 紧急联系人电话
*/
@Pattern(regexp = "^[0-9]*$",message = "紧急联系人电话格式错误")
@NotNull(message = "紧急联系人电话不能为空")
@ApiModelProperty(value = "紧急联系人电话")

@ -1,11 +1,9 @@
package com.daqing.financial.crms.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.daqing.financial.crms.model.request.CompanyCustomerRequest;
import com.daqing.financial.crms.model.request.PersonalCustomerRequest;
import com.daqing.financial.crms.model.request.CompanyAppletRequest;
import com.daqing.financial.crms.model.request.PersonalAppletRequest;
import com.daqing.framework.domain.crms.CustomerEntity;
import com.daqing.framework.domain.crms.ext.CustomerPersonalTOI;
import com.daqing.framework.model.response.ResponseResult;
import java.util.Map;
@ -17,15 +15,15 @@ import java.util.Map;
*/
public interface CustomerAppletService extends IService<CustomerEntity> {
Boolean savePersonal(CustomerPersonalTOI customerPersonalTOI);
Boolean savePersonal(PersonalAppletRequest personalAppletRequest);
Boolean saveCompany(CompanyCustomerRequest companyCustomerRequest);
Boolean saveCompany(CompanyAppletRequest companyAppletRequest);
Map getCustomerStatus();
ResponseResult getCustomer(Integer type);
Object getCustomer(Integer type);
Boolean updatePersonal(PersonalCustomerRequest personalCustomerRequest);
Boolean updatePersonal(PersonalAppletRequest personalAppletRequest);
Boolean updateCompany(CompanyCustomerRequest companyCustomerRequest);
Boolean updateCompany(CompanyAppletRequest companyAppletRequest);
}

@ -1,12 +1,15 @@
package com.daqing.financial.crms.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.daqing.financial.crms.dao.CompanyCustomerDao;
import com.daqing.financial.crms.dao.CustomerAppletDao;
import com.daqing.financial.crms.dao.CustomerDao;
import com.daqing.financial.crms.dao.PersonalCustomerDao;
import com.daqing.financial.crms.mapper.CrmsCustomerRelatedMapper;
import com.daqing.financial.crms.model.request.CompanyAppletRequest;
import com.daqing.financial.crms.model.request.CompanyCustomerRequest;
import com.daqing.financial.crms.model.request.PersonalCustomerRequest;
import com.daqing.financial.crms.model.request.PersonalAppletRequest;
import com.daqing.financial.crms.service.CustomerAppletService;
import com.daqing.financial.crms.service.CustomerService;
import com.daqing.financial.crms.service.ICrmsCustomerRelatedService;
@ -15,7 +18,6 @@ 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.CrmsConstant;
import com.daqing.framework.domain.crms.ext.CustomerPersonalTOI;
import com.daqing.framework.domain.crms.ext.CustomerPersonalTOU;
import com.daqing.framework.domain.crms.response.CrmsCode;
import com.daqing.framework.exception.ExceptionCast;
@ -30,6 +32,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.*;
@ -49,34 +52,37 @@ public class CustomerAppletServiceImpl extends ServiceImpl<CustomerAppletDao, Cu
@Autowired
private PersonalCustomerDao personalCustomerDao;
@Autowired
private CustomerService customerService;
@Autowired
private CompanyCustomerDao companyCustomerDao;
@Autowired
private ICrmsCustomerRelatedService crmsCustomerRelatedService;
@Resource
private CrmsCustomerRelatedMapper crmsCustomerRelatedMapper;
/**
* 录入(认证)个人类型客户数据
*/
@Transactional
@Override
public Boolean savePersonal(CustomerPersonalTOI customerPersonalTOI) {
if (customerPersonalTOI.getName() != null && customerPersonalTOI.getName().length() != 0) {
public Boolean savePersonal(PersonalAppletRequest personalAppletRequest) {
if (this.getBaseMapper().getCustomerStatus(Integer.parseInt(this.getUserId()), 0) > 0) {
ExceptionCast.cast(CrmsCode.CUSTOMER_APPLET_EXIST);
}
if (personalAppletRequest.getName() != null && personalAppletRequest.getName().length() != 0) {
// 客户姓名判重
List<String> names = customerDao.listCustomerName(0); // 个人类型客户名称
for (String name : names) {
if (customerPersonalTOI.getName().equals(name)) {
if (personalAppletRequest.getName().equals(name)) {
ExceptionCast.cast(CrmsCode.CUSTOMER_NAME_REPETITION);
}
}
}
CustomerEntity customerEntity = new CustomerEntity();
PersonalCustomerEntity personalCustomerEntity = new PersonalCustomerEntity();
BeanUtils.copyProperties(customerPersonalTOI, customerEntity);
BeanUtils.copyProperties(customerPersonalTOI, personalCustomerEntity);
BeanUtils.copyProperties(personalAppletRequest, customerEntity);
BeanUtils.copyProperties(personalAppletRequest, personalCustomerEntity);
// 设置客户编号
String code = customerDao.getCodeByType(CrmsConstant.CustomerType.PERSONAL_CUSTOMER.getType());
if (code == null || code.length() == 0) {
@ -88,9 +94,8 @@ public class CustomerAppletServiceImpl extends ServiceImpl<CustomerAppletDao, Cu
customerEntity.setMotifyTime(new Date());
customerEntity.setType(CrmsConstant.CustomerType.PERSONAL_CUSTOMER.getType());
boolean customer = customerDao.saveCustomer(customerEntity);
personalCustomerEntity.setCustomerId(customerEntity.getId());
// 将自增的客户id返回给工作台
customerPersonalTOI.setManager(customerEntity.getId());
personalCustomerEntity.setCustomerId(customerEntity.getId());
boolean personal = personalCustomerDao.savePersonalCustomer(personalCustomerEntity);
Boolean user = this.getBaseMapper().saveCustomerIdAndUserId(customerEntity.getId().intValue(), Integer.parseInt(this.getUserId()), 0);
return customer && personal && user;
@ -101,20 +106,23 @@ public class CustomerAppletServiceImpl extends ServiceImpl<CustomerAppletDao, Cu
*/
@Transactional
@Override
public Boolean saveCompany(CompanyCustomerRequest companyCustomerReq) {
public Boolean saveCompany(CompanyAppletRequest companyAppletRequest) {
if (this.getBaseMapper().getCustomerStatus(Integer.parseInt(this.getUserId()), 1) > 0) {
ExceptionCast.cast(CrmsCode.CUSTOMER_APPLET_EXIST);
}
// 客户名称判重
if (companyCustomerReq.getName() != null && companyCustomerReq.getName().length() != 0) {
if (companyAppletRequest.getName() != null && companyAppletRequest.getName().length() != 0) {
List<String> names = customerDao.listCustomerName(1); // 企业类型客户名称
for (String name : names) {
if (companyCustomerReq.getName().equals(name)) {
if (companyAppletRequest.getName().equals(name)) {
ExceptionCast.cast(CrmsCode.CUSTOMER_NAME_REPETITION);
}
}
}
CustomerEntity customerEntity = new CustomerEntity();
CompanyCustomerEntity companyCustomerEntity = new CompanyCustomerEntity();
BeanUtils.copyProperties(companyCustomerReq, customerEntity);
BeanUtils.copyProperties(companyCustomerReq, companyCustomerEntity);
BeanUtils.copyProperties(companyAppletRequest, customerEntity);
BeanUtils.copyProperties(companyAppletRequest, companyCustomerEntity);
// 设置客户编号
String code = customerDao.getCodeByType(CrmsConstant.CustomerType.COMPANY_CUSTOMER.getType());
if (code == null || code.length() == 0) {
@ -124,17 +132,16 @@ public class CustomerAppletServiceImpl extends ServiceImpl<CustomerAppletDao, Cu
customerEntity.setCode(PromptSuccess.COMPANY_CODE + String.format("%04d", (codeNumber + 1)));
customerEntity.setMotifyTime(new Date());
customerEntity.setCreateTime(new Date());
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);
// 绑定客户信息和客户的用户信息
Boolean user = this.getBaseMapper().saveCustomerIdAndUserId(customerEntity.getId().intValue(), Integer.parseInt(this.getUserId()), 1);
if (companyCustomerReq.getIsExistRelated() == 1) {//有关联人的情况下才绑定关联关系
if (companyAppletRequest.getIsExistRelated() == 1) {//有关联人的情况下才绑定关联关系
//绑定关联关系
List<CrmsCustomerRelated> relatedList = new ArrayList<>();
List<Integer> intList = companyCustomerReq.getRelatedId();
List<Integer> intList = companyAppletRequest.getRelatedId();
for (int i = 0; i < intList.size(); i++) {
CrmsCustomerRelated crmsCustomerRelated = new CrmsCustomerRelated();
@ -179,43 +186,120 @@ public class CustomerAppletServiceImpl extends ServiceImpl<CustomerAppletDao, Cu
* 查看认证的详情
*/
@Override
public ResponseResult getCustomer(Integer type) {
public Object getCustomer(Integer type) {
String userId = this.getUserId();
Integer customerId = this.getBaseMapper().getCustomerId(Integer.parseInt(userId), type);
return customerService.queryCustomerById((long) customerId);
if (customerId == null) {
ExceptionCast.cast(CrmsCode.CUSTOMER_APPLET_IS_NULL);
}
// 员工基本信息
CustomerEntity customer = customerDao.queryCustomerById((long) customerId);
// 判断该客户的类型
if (type == 0) {
PersonalAppletRequest personalAppletRequest = new PersonalAppletRequest();
PersonalCustomerEntity personalCustomerEntity = personalCustomerDao.queryPersonalCustomerById((long) customerId);
BeanUtils.copyProperties(customer, personalAppletRequest);
BeanUtils.copyProperties(personalCustomerEntity, personalAppletRequest);
return personalAppletRequest;
}
if (type == 1) {
CompanyAppletRequest companyAppletRequest = new CompanyAppletRequest();
CompanyCustomerEntity companyCustomerEntity = companyCustomerDao.selectOne(new QueryWrapper<CompanyCustomerEntity>()
.eq("customer_id", (long) customerId));
BeanUtils.copyProperties(customer, companyAppletRequest);
BeanUtils.copyProperties(companyCustomerEntity, companyAppletRequest);
return companyAppletRequest;
}
return null;
}
/**
* 修改个人类型的认证信息
*/
@Override
public Boolean updatePersonal(PersonalCustomerRequest personalCustomerRequest) {
public Boolean updatePersonal(PersonalAppletRequest personalAppletRequest) {
Integer customerId = this.getBaseMapper().getCustomerId(Integer.parseInt(this.getUserId()), 0);
if (customerId == null) {
ExceptionCast.cast(CrmsCode.CUSTOMER_APPLET_IS_NULL);
}
personalCustomerRequest.setId((long) customerId);
personalCustomerRequest.setType(0);
CustomerPersonalTOU customerPersonalTOU = new CustomerPersonalTOU();
BeanUtils.copyProperties(personalCustomerRequest, customerPersonalTOU);
return customerService.updateCustomerPersonal(customerPersonalTOU);
// 客户名称判重,注意判断是否与原来相同
if (personalAppletRequest.getName() != null && personalAppletRequest.getName().length() != 0) {
String customerName = customerDao.getNameByCustomerId((long) customerId);
if (!personalAppletRequest.getName().equals(customerName)) {
List<String> names = customerDao.listCustomerName(0);
for (String name : names) {
if (personalAppletRequest.getName().equals(name)) {
ExceptionCast.cast(CrmsCode.CUSTOMER_NAME_REPETITION);
}
}
}
}
CustomerEntity customerEntity = new CustomerEntity();
PersonalCustomerEntity personalCustomerEntity = new PersonalCustomerEntity();
BeanUtils.copyProperties(personalAppletRequest, customerEntity);
BeanUtils.copyProperties(personalAppletRequest, personalCustomerEntity);
customerEntity.setId((long) customerId);
customerEntity.setMotifyTime(new Date());
boolean customer = this.getBaseMapper().updateCustomer(customerEntity);
personalCustomerEntity.setCustomerId(customerEntity.getId());
boolean personal = personalCustomerDao.updatePersonalCustomer(personalCustomerEntity);
return customer && personal;
}
/**
* 修改企业类型的认证信息
*/
@Override
public Boolean updateCompany(CompanyCustomerRequest companyCustomerRequest) {
public Boolean updateCompany(CompanyAppletRequest companyAppletRequest) {
Integer customerId = this.getBaseMapper().getCustomerId(Integer.parseInt(this.getUserId()), 1);
if (customerId == null) {
ExceptionCast.cast(CrmsCode.CUSTOMER_APPLET_IS_NULL);
}
companyCustomerRequest.setId((long) customerId);
companyCustomerRequest.setType(1);
// 客户名称判重,注意判断是否与原来相同
if (companyAppletRequest.getName() != null && companyAppletRequest.getName().length() != 0) {
String customerName = customerDao.getNameByCustomerId((long) customerId);
if (!companyAppletRequest.getName().equals(customerName)) {
List<String> names = customerDao.listCustomerName(1);
for (String name : names) {
if (companyAppletRequest.getName().equals(name)) {
ExceptionCast.cast(CrmsCode.CUSTOMER_NAME_REPETITION);
}
}
}
}
CustomerEntity customerEntity = new CustomerEntity();
CompanyCustomerEntity companyCustomerEntity = new CompanyCustomerEntity();
BeanUtils.copyProperties(companyAppletRequest, customerEntity);
BeanUtils.copyProperties(companyAppletRequest, companyCustomerEntity);
customerEntity.setId((long) customerId);
customerEntity.setMotifyTime(new Date());
boolean customer = this.getBaseMapper().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 = companyAppletRequest.getRelatedId();
return customerService.updateCompanyNew(companyCustomerRequest);
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;
}
return false;
}
@ -229,6 +313,7 @@ public class CustomerAppletServiceImpl extends ServiceImpl<CustomerAppletDao, Cu
if (userId == null || userId.length() == 0) {
ExceptionCast.cast(CommonCode.GET_LOGIN_USER_FAIL);
}
// String userId = "64";
return userId;
}

@ -1,20 +1,20 @@
#服务名称
#spring.application.name=dq-financial-crms
##配置中心地址
#spring.cloud.nacos.config.server-addr=127.0.0.1:8848
#spring.cloud.nacos.config.file-extension=yml
##redis配置
#spring.redis.host=127.0.0.1
#spring.redis.port=6379
#spring.redis.password=
#spring.redis.database=0
#spring.redis.timeout=30000
#spring.redis.jedis.pool.max-active=8
#spring.redis.jedis.pool.max-wait=-1
#spring.redis.jedis.pool.max-idle=8
#spring.redis.jedis.pool.min-idle=0
spring.application.name=dq-financial-crms
#配置中心地址
spring.cloud.nacos.config.server-addr=192.168.31.140:8848
spring.cloud.nacos.config.file-extension=yml
#redis配置
spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.password=
spring.redis.database=0
spring.redis.timeout=30000
spring.redis.jedis.pool.max-active=8
spring.redis.jedis.pool.max-wait=-1
spring.redis.jedis.pool.max-idle=8
spring.redis.jedis.pool.min-idle=0
#本地测试环境
#spring.cloud.nacos.config.namespace=1520c5ea-5f15-4ac1-9eb1-d25924825b99
spring.cloud.nacos.config.namespace=1520c5ea-5f15-4ac1-9eb1-d25924825b99
#线上测试环境
#spring.cloud.nacos.config.namespace=5698e60a-9d0b-433f-a69f-12b0a2d23128
@ -29,30 +29,30 @@ ribbon.ConnectTimeout: 120000
# 正式环境(prod)
#服务名称
spring.application.name=dq-financial-crms
##配置中心地址
spring.cloud.nacos.config.server-addr=120.78.127.12:8848
spring.cloud.nacos.config.namespace=25ce05e2-a0eb-4842-92e4-d8b550a489dd
#spring.cloud.nacos.config.group=prod
spring.cloud.nacos.config.ext-config[0].data-id=datasource.yml
spring.cloud.nacos.config.ext-config[0].group=prod
spring.cloud.nacos.config.ext-config[0].refresh=true
spring.cloud.nacos.config.ext-config[1].data-id=mybatis.yml
spring.cloud.nacos.config.ext-config[1].group=prod
spring.cloud.nacos.config.ext-config[1].refresh=true
spring.cloud.nacos.config.ext-config[2].data-id=other.yml
spring.cloud.nacos.config.ext-config[2].group=prod
spring.cloud.nacos.config.ext-config[2].refresh=true
spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.password=dq123456
spring.redis.database=0
spring.redis.timeout=30000
spring.redis.jedis.pool.max-active=8
spring.redis.jedis.pool.max-wait=-1
spring.redis.jedis.pool.max-idle=8
spring.redis.jedis.pool.min-idle=0
#spring.application.name=dq-financial-crms
###配置中心地址
#spring.cloud.nacos.config.server-addr=120.78.127.12:8848
#spring.cloud.nacos.config.namespace=25ce05e2-a0eb-4842-92e4-d8b550a489dd
##spring.cloud.nacos.config.group=prod
#
#spring.cloud.nacos.config.ext-config[0].data-id=datasource.yml
#spring.cloud.nacos.config.ext-config[0].group=prod
#spring.cloud.nacos.config.ext-config[0].refresh=true
#
#spring.cloud.nacos.config.ext-config[1].data-id=mybatis.yml
#spring.cloud.nacos.config.ext-config[1].group=prod
#spring.cloud.nacos.config.ext-config[1].refresh=true
#
#spring.cloud.nacos.config.ext-config[2].data-id=other.yml
#spring.cloud.nacos.config.ext-config[2].group=prod
#spring.cloud.nacos.config.ext-config[2].refresh=true
#
#spring.redis.host=127.0.0.1
#spring.redis.port=6379
#spring.redis.password=dq123456
#spring.redis.database=0
#spring.redis.timeout=30000
#spring.redis.jedis.pool.max-active=8
#spring.redis.jedis.pool.max-wait=-1
#spring.redis.jedis.pool.max-idle=8
#spring.redis.jedis.pool.min-idle=0

@ -15,4 +15,11 @@
SELECT customer_id FROM crms_customer_user WHERE user_id = #{userId} AND type = #{type}
</select>
<!-- 更新客户基本信息 -->
<update id="updateCustomer" parameterType="com.daqing.framework.domain.crms.CustomerEntity">
UPDATE crms_customer
SET name=#{customer.name},addr=#{customer.addr},phone=#{customer.phone},motify_time=#{customer.motifyTime}
WHERE id = #{customer.id}
</update>
</mapper>

@ -21,7 +21,8 @@ public enum CrmsCode implements ResultCode {
NOT_NULL(false,20004,"上传的文件不能为空"),
CUSTOMER_IS_NULL(false,20005,"导入数据失败,当前员工不存在!"),
CUSTOMER_NAME_REPETITION(false, 20006, "当前客户名称已存在!"),
CUSTOMER_APPLET_IS_NULL(false, 20007,"未查询到你的信息,请先录入(认证)你的信息!");
CUSTOMER_APPLET_IS_NULL(false, 20007,"未查询到你的信息,请先录入(认证)你的信息!"),
CUSTOMER_APPLET_EXIST(false, 20008,"你已认证自己的信息,无需再次认证!");
/**
* 操作是否成功

Loading…
Cancel
Save