查询工商登记开业信息

This commit is contained in:
ZZM 2025-09-17 18:35:53 +08:00
parent 8dc69d4870
commit e8808e805c
18 changed files with 366 additions and 58 deletions

View File

@ -181,13 +181,11 @@ private static Object decryptValue(String key, Object value) {
return SensitiveDataMaskUtil.maskName(value);
}else if ("address".equals(key)) {
return SensitiveDataMaskUtil.maskAddress(value);
}else if ("telephone".equals(key)) {
return SensitiveDataMaskUtil.maskPhone(value);
}else if ("name".equals(key)) {
}else if ("telephone".equals(key)) { //详情页联系人姓名
return SensitiveDataMaskUtil.maskName(value);
}else if ("fliedKjhmgc".equals(key)) {
return SensitiveDataMaskUtil.maskAddress(value);
}else if ("fieldCbiasz".equals(key)) {
} else if ("name".equals(key)) { //联系人模块中的联系人姓名
return SensitiveDataMaskUtil.maskName(value);
}
return value;
@ -204,6 +202,12 @@ private static Object decryptValue(String key, Object value) {
return true;
}
}
if ("fieldDomqff".equals(fieldName)) {
return true;
}
if ("fieldAcqnin".equals(fieldName)) {
return true;
}
return false;
}
}

View File

@ -0,0 +1,39 @@
package com.kakarote.crm.controller;
import com.kakarote.core.common.R;
import com.kakarote.core.common.Result;
import com.kakarote.crm.entity.PO.CrmDjzclx;
import com.kakarote.crm.service.ICrmDjzclxService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/CrmDjzclx")
@Api(tags = "登记注册类型")
public class CrmDjzclxController {
@Autowired
private ICrmDjzclxService crmDjzclxService;
@PostMapping("/queryByDjzclxDm/{djzclxDm}")
public Result<CrmDjzclx> queryByDjzclxDm(@PathVariable("djzclxDm") String djzclxDm) {
CrmDjzclx crmDjzclx = crmDjzclxService.queryByDjzclxDm(djzclxDm);
return R.ok(crmDjzclx);
}
@PostMapping("/insert")
public Result<Integer> insert(@RequestBody CrmDjzclx crmDjzclx) {
return R.ok(crmDjzclxService.insert(crmDjzclx));
}
@PostMapping("/delete")
public Result<Integer> delete(@RequestBody CrmDjzclx crmDjzclx) {
return R.ok(crmDjzclxService.delete(crmDjzclx));
}
@PostMapping("/update")
public Result<Integer> update(@RequestBody CrmDjzclx crmDjzclx) {
return R.ok(crmDjzclxService.update(crmDjzclx));
}
}

View File

@ -3,6 +3,7 @@ package com.kakarote.crm.controller;
import com.kakarote.core.common.R;
import com.kakarote.core.common.Result;
import com.kakarote.core.entity.BasePage;
import com.kakarote.crm.entity.DTO.CrmQueryGsdjxxDTO;
import com.kakarote.crm.entity.PO.CrmGsdjxx;
import com.kakarote.crm.entity.VO.CrmQueryGsdjxxVO;
@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/crmGsdjxx")
@ -34,4 +36,11 @@ public class CrmGsdjxxController {
List<CrmGsdjxx> crmGsdjxxList = iCrmGsdjxxService.queryByNsrmc(nsrmc);
return R.ok(crmGsdjxxList);
}
@PostMapping("/queryGsdjxxByDate/{date}")
@ApiOperation("根据日期查询(默认是当天)")
public Result<BasePage<Map<String, Object>>> queryGsdjxxByDate(@PathVariable String date) {
BasePage<Map<String, Object>> basePage = iCrmGsdjxxService.queryGsdjxxByDate(date);
return R.ok(basePage);
}
}

View File

@ -24,6 +24,7 @@ public class CrmQyjbxxController {
private ICrmQyjbxxService crmQyjbxxService;
@PostMapping("/sync")
@ParamAspect
public void syncQyjbxx(){
crmQyjbxxService.syncQyjbxx();
}

View File

@ -13,15 +13,15 @@ public class CrmQueryGsdjxxDTO implements Serializable {
private static final long serialVersionUID = 1L;
// 登记序号
// 月份
private String yf;
private String rq;
// 评价年度
// 行政区划代码
private String xzqhDm;
//地址
// 地址
private String xzqhMc;
@Override

View File

@ -0,0 +1,45 @@
package com.kakarote.crm.entity.PO;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("wk_crm_djzclx")
@ApiModel(value = "CrmDjzclx对象", description = "登记注册类型表")
public class CrmDjzclx implements Serializable {
private static final long serialVersionUID = 1L;
// 登记注册类型代码
private String djzclxDm;
//登记注册类型名称
private String djzclxmc;
//顶类标志
private String dlbz;
//中类标志
private String zlbz;
//小类标志
private String xlbz;
//上级登记注册类型代码
private String sjdjzclxDm;
//选用标志
private String xybz;
//有效标志
private String yxbz;
}

View File

@ -52,7 +52,6 @@ public class CrmGsdjxx implements Serializable {
/**
* 登记注册类型代码
*/
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String djzclxDm; // 对应SQL: djzclx_dm
/**

View File

@ -7,6 +7,7 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.apache.ibatis.type.JdbcType;
import java.io.Serializable;
import java.util.Date;
@ -46,20 +47,20 @@ public class CrmLeads implements Serializable {
@ApiModelProperty(value = "下次联系时间")
private Date nextTime;
@ApiModelProperty(value = "电话")
@TableField(typeHandler = SensitiveDataConverter.class)
@ApiModelProperty(value = "联系人姓名")
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String telephone;
@ApiModelProperty(value = "手机号")
@TableField(typeHandler = SensitiveDataConverter.class)
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String mobile;
@ApiModelProperty(value = "邮箱")
@TableField(typeHandler = SensitiveDataConverter.class)
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String email;
@ApiModelProperty(value = "地址")
@TableField(typeHandler = SensitiveDataConverter.class)
@TableField(typeHandler = SensitiveDataConverter.class, jdbcType = JdbcType.VARCHAR)
private String address;
@ApiModelProperty(value = "备注")

View File

@ -0,0 +1,10 @@
package com.kakarote.crm.mapper;
import com.kakarote.core.servlet.BaseMapper;
import com.kakarote.crm.entity.PO.CrmDjzclx;
import org.mapstruct.Mapper;
@Mapper
public interface CrmDjzclxMapper extends BaseMapper<CrmDjzclx> {
}

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.kakarote.crm.mapper.CrmDjzclxMapper">
<resultMap id="BaseResultMap" type="com.kakarote.crm.entity.PO.CrmDjzclx">
<result column="djzclx_dm" jdbcType="VARCHAR" property="djzclxDm" />
<result column="djzclxmc" jdbcType="VARCHAR" property="djzclxmc" />
<result column="dlbz" jdbcType="VARCHAR" property="dlbz" />
<result column="zlbz" jdbcType="VARCHAR" property="zlbz" />
<result column="xlbz" jdbcType="VARCHAR" property="xlbz" />
<result column="sjdjzclx_dm" jdbcType="VARCHAR" property="sjdjzclxDm" />
<result column="xybz" jdbcType="VARCHAR" property="xybz" />
<result column="yxbz" jdbcType="VARCHAR" property="yxbz" />
</resultMap>
</mapper>

View File

@ -0,0 +1,28 @@
package com.kakarote.crm.service;
import com.kakarote.core.servlet.BaseService;
import com.kakarote.crm.entity.PO.CrmDjzclx;
public interface ICrmDjzclxService extends BaseService<CrmDjzclx> {
/**
* 通过登记注册类型代码查询
*/
CrmDjzclx queryByDjzclxDm(String djzclxDm);
/**
* 更新
*/
int update(CrmDjzclx djzclx);
/**
* 新增
*/
int insert(CrmDjzclx djzclx);
/**
* 删除
*/
int delete(CrmDjzclx djzclx);
}

View File

@ -1,5 +1,7 @@
package com.kakarote.crm.service;
import com.kakarote.core.common.Result;
import com.kakarote.core.entity.BasePage;
import com.kakarote.core.servlet.BaseService;
import com.kakarote.crm.entity.DTO.CrmQueryGsdjxxDTO;
import com.kakarote.crm.entity.PO.CrmGsdjxx;
@ -7,6 +9,7 @@ import com.kakarote.crm.entity.PO.CrmQyxxfp;
import com.kakarote.crm.entity.VO.CrmQueryGsdjxxVO;
import java.util.List;
import java.util.Map;
public interface ICrmGsdjxxService extends BaseService<CrmGsdjxx> {
@ -20,4 +23,9 @@ public interface ICrmGsdjxxService extends BaseService<CrmGsdjxx> {
* @return
*/
List<CrmGsdjxx> queryByNsrmc(String nsrmc);
/**
* 根据日期查询(默认是当天)
*/
BasePage<Map<String, Object>> queryGsdjxxByDate(String date);
}

View File

@ -11,6 +11,7 @@ import com.kakarote.crm.entity.BO.CrmModelSaveBO;
import com.kakarote.crm.entity.BO.CrmSearchBO;
import com.kakarote.crm.entity.BO.CrmUpdateInformationBO;
import com.kakarote.crm.entity.PO.CrmLeads;
import com.kakarote.crm.entity.VO.CrmGetPlaintextVO;
import com.kakarote.crm.entity.VO.CrmInfoNumVO;
import com.kakarote.crm.entity.VO.CrmModelFiledVO;
import org.springframework.web.bind.annotation.RequestBody;
@ -136,4 +137,9 @@ public interface ICrmLeadsService extends BaseService<CrmLeads> {
List<String> eventLeads(CrmEventBO crmEventBO);
BasePage<Map<String, Object>> eventLeadsPageList(QueryEventCrmPageBO eventCrmPageBO);
/**
* 剧哦去铭文
*/
String getLeadsPlaintext(CrmGetPlaintextVO plaintextVO);
}

View File

@ -172,7 +172,6 @@ public class CrmContactsServiceImpl extends BaseServiceImpl<CrmContactsMapper, C
*/
@Override
public CrmModel queryById(Integer id) {
System.out.println("loading......");
CrmModel crmModel;
if (id != null) {
crmModel = getBaseMapper().queryById(id, UserUtil.getUserId());

View File

@ -145,6 +145,12 @@ public class CrmCustomerServiceImpl extends BaseServiceImpl<CrmCustomerMapper, C
@Autowired
private ICrmOpenApiService crmOpenApiService;
@Autowired
private ICrmLeadsService crmLeadsService;
@Autowired
private ICrmDjzclxService crmDjzclxService;
/**
* 查询字段配置
*
@ -391,17 +397,13 @@ public class CrmCustomerServiceImpl extends BaseServiceImpl<CrmCustomerMapper, C
/**
* 数据脱敏
*
* @param crmModel
*/
private CrmModel encryptSensitiveData(CrmModel crmModel) {
//遍历数据
//crmModel.forEach((key, value) -> System.out.println("Key: " + key + ", Value: " + value));
// 获取数据
String contactsMobile = (String) crmModel.get("contactsMobile");
String name = (String) crmModel.get("telephone");//详情页的联系人姓名
String contactsName = (String) crmModel.get("contactsName");
String email = (String) crmModel.get("email");
private CrmModel encryptSensitiveData(CrmModel crmModel){
String contactsMobile = (String)crmModel.get("mobile");
String name = (String)crmModel.get("telephone");//详情页的联系人姓名
String contactsName = (String)crmModel.get("contactsName");
String email = (String)crmModel.get("email");
String fliedKjhmgc = (String) crmModel.get("fliedKjhmgc");//详情页的详细地址
//String contactsAddress = (String) crmModel.get("contactsAddress");
// 脱敏处理
@ -423,7 +425,6 @@ public class CrmCustomerServiceImpl extends BaseServiceImpl<CrmCustomerMapper, C
/**
* 获取客户明文
*
* @param plaintextVO
* @return
*/
@ -458,14 +459,13 @@ public class CrmCustomerServiceImpl extends BaseServiceImpl<CrmCustomerMapper, C
//遍历数据
//crmModel.forEach((key, value) -> System.out.println("Key: " + key + ", Value: " + value));
String plaintext = null;
if (plaintextVO.getField().equals("mobile")) {
if (plaintextVO.getField().equals("mobile")){
plaintext = (String) crmModel.get("mobile");
} else if (plaintextVO.getField().equals("email")) {
} else if (plaintextVO.getField().equals("email")){
plaintext = (String) crmModel.get("email");
} else if (plaintextVO.getField().equals("telephone")) { //详情页联系人姓名
int contactsId = (Integer) crmModel.get("contactsId");
plaintext = crmContactsService.getContactsName(contactsId);
} else if (plaintextVO.getField().equals("fliedKjhmgc")) {
} else if (plaintextVO.getField().equals("telephone")){ //详情页联系人姓名
plaintext = (String) crmModel.get("telephone");
} else if (plaintextVO.getField().equals("fliedKjhmgc")){
plaintext = (String) crmModel.get("fliedKjhmgc");
}
return plaintext;
@ -473,17 +473,18 @@ public class CrmCustomerServiceImpl extends BaseServiceImpl<CrmCustomerMapper, C
/**
* 判断crmType
*
* @param plaintextVO
*/
@Override
public String getPlaintext(CrmGetPlaintextVO plaintextVO) {
public String getPlaintext(CrmGetPlaintextVO plaintextVO){
// 判断类型
String plaintext = null;
if (plaintextVO.getCrmType().equals("customer")) {
plaintext = getCustomerPlaintext(plaintextVO);
} else if (plaintextVO.getCrmType().equals("contacts")) {
plaintext = crmContactsService.getContactsPlaintext(plaintextVO);
} else if (plaintextVO.getCrmType().equals("leads")) {
plaintext = crmLeadsService.getLeadsPlaintext(plaintextVO);
}
return plaintext;
}
@ -625,6 +626,7 @@ public class CrmCustomerServiceImpl extends BaseServiceImpl<CrmCustomerMapper, C
map.put("customerName", crmCustomer.getCustomerName());
return map;
}
public void addCustomerByGsdjxx(CrmGsdjxx gsdjxx) {
CrmBusinessSaveBO crmModel = new CrmBusinessSaveBO();
Map<String, Object> entity = new HashMap<>();
@ -655,6 +657,9 @@ public class CrmCustomerServiceImpl extends BaseServiceImpl<CrmCustomerMapper, C
field.setValue(gsdjxx.getKyrq());
}else if ("客户名称".equals(crmField.getName())){
field.setValue(gsdjxx.getNsrmc());
}else if("登记注册类型".equals(crmField.getName())){
CrmDjzclx crmDjzclx = crmDjzclxService.queryByDjzclxDm(gsdjxx.getDjzclxDm());
field.setValue(crmDjzclx.getDjzclxmc());
}else {
field.setValue("");
}
@ -708,14 +713,14 @@ public class CrmCustomerServiceImpl extends BaseServiceImpl<CrmCustomerMapper, C
fieldZzmdcm.setValue("");
list.add(fieldZzmdcm);
// 所属税务局
CrmModelFiledVO fieldAvfjfa = new CrmModelFiledVO();
fieldAvfjfa.setFieldId(1101925);
fieldAvfjfa.setFieldName("fliedJhsivt");
fieldAvfjfa.setName("所属税务局");
fieldAvfjfa.setFieldType(0);
fieldAvfjfa.setType(3);
fieldAvfjfa.setValue("");
list.add(fieldAvfjfa);
CrmModelFiledVO fliedJhsivt = new CrmModelFiledVO();
fliedJhsivt.setFieldId(1101925);
fliedJhsivt.setFieldName("fliedJhsivt");
fliedJhsivt.setName("所属税务局");
fliedJhsivt.setFieldType(0);
fliedJhsivt.setType(3);
fliedJhsivt.setValue("");
list.add(fliedJhsivt);
//用户标记
CrmModelFiledVO fliedMtfnrf = new CrmModelFiledVO();
fliedMtfnrf.setFieldId(1101920);
@ -788,6 +793,7 @@ public class CrmCustomerServiceImpl extends BaseServiceImpl<CrmCustomerMapper, C
source.setType(3);
source.setValue("");
list.add(source);
//开业日期
// //5 新开票数 fieldYbwemm 1101919
// CrmModelFiledVO fieldYbwemm = new CrmModelFiledVO();
// fieldYbwemm.setFieldId(1101919);

View File

@ -0,0 +1,42 @@
package com.kakarote.crm.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.kakarote.core.servlet.BaseServiceImpl;
import com.kakarote.crm.entity.PO.CrmDjzclx;
import com.kakarote.crm.mapper.CrmDjzclxMapper;
import com.kakarote.crm.service.ICrmDjzclxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@Service
public class CrmDjzclxServiceImpl extends BaseServiceImpl<CrmDjzclxMapper, CrmDjzclx> implements ICrmDjzclxService {
@Autowired
private CrmDjzclxMapper djzclxMapper;
@Override
public CrmDjzclx queryByDjzclxDm(String djzclxDm) {
LambdaQueryWrapper<CrmDjzclx> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CrmDjzclx::getDjzclxDm, djzclxDm);
return djzclxMapper.selectOne(wrapper);
}
@Override
public int update(CrmDjzclx djzclx) {
LambdaQueryWrapper<CrmDjzclx> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CrmDjzclx::getDjzclxDm, djzclx.getDjzclxDm());
return djzclxMapper.update(djzclx,wrapper);
}
@Override
public int insert(CrmDjzclx djzclx) {
return djzclxMapper.insert(djzclx);
}
@Override
public int delete(CrmDjzclx djzclx) {
LambdaQueryWrapper<CrmDjzclx> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CrmDjzclx::getDjzclxDm, djzclx.getDjzclxDm());
return djzclxMapper.delete(wrapper);
}
}

View File

@ -5,14 +5,18 @@ import cn.hutool.log.LogFactory;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.fasterxml.jackson.core.type.TypeReference;
import com.kakarote.core.common.Result;
import com.kakarote.core.entity.BasePage;
import com.kakarote.core.servlet.BaseServiceImpl;
import com.kakarote.crm.constant.CrmTaxServiceIdEnum;
import com.kakarote.crm.entity.BO.CrmSearchBO;
import com.kakarote.crm.entity.DTO.CrmQueryGsdjxxDTO;
import com.kakarote.crm.entity.DTO.CrmWebServiceResponseDTO;
import com.kakarote.crm.entity.PO.CrmGsdjxx;
import com.kakarote.crm.entity.VO.CrmQueryGsdjxxVO;
import com.kakarote.crm.mapper.CrmGsdjxxMapper;
import com.kakarote.crm.service.ICrmCustomerPoolService;
import com.kakarote.crm.service.ICrmCustomerService;
import com.kakarote.crm.service.ICrmGsdjxxService;
import com.kakarote.crm.util.JsonUtil;
@ -21,11 +25,8 @@ import com.kakarote.crm.webService.config.TaxWebServiceConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.*;
import java.util.Objects;
import java.util.stream.Collectors;
@Service
@ -40,6 +41,9 @@ public class CrmGsdjxxServiceImpl extends BaseServiceImpl<CrmGsdjxxMapper,CrmGsd
@Autowired
private ICrmCustomerService customerService;
@Autowired
private ICrmCustomerPoolService crmCustomerPoolService;
private static final Log log = LogFactory.get();
@Override
@ -68,6 +72,10 @@ public class CrmGsdjxxServiceImpl extends BaseServiceImpl<CrmGsdjxxMapper,CrmGsd
List<CrmGsdjxx> crmGsdjxxList = responseDTO.getData();
if (crmGsdjxxList == null || crmGsdjxxList.isEmpty()) {
log.info("未查询到数据!");
return Collections.emptyList();
}
return processAndSaveData(crmGsdjxxList, crmQueryGsdjxxDTO);
}
@ -145,4 +153,29 @@ public class CrmGsdjxxServiceImpl extends BaseServiceImpl<CrmGsdjxxMapper,CrmGsd
return convertListToVO(crmGsdjxxesNew);
}
@Override
public BasePage<Map<String, Object>> queryGsdjxxByDate(String date) {
System.out.println(date);
List<String> values = new ArrayList<>();
values.add(date);
CrmSearchBO.Search search = new CrmSearchBO.Search();
search.setFormType("text");
search.setName("website");
search.setValues(values);
search.setSearchEnum(CrmSearchBO.FieldSearchEnum.IS);
List<CrmSearchBO.Search> searchList = new ArrayList<>();
searchList.add(search);
CrmSearchBO searchBO = new CrmSearchBO();
searchBO.setPoolId(34557);
searchBO.setSearch("");
searchBO.setSearchList(searchList);
BasePage<Map<String, Object>> basePage = crmCustomerPoolService.queryPageList(searchBO, false);
return basePage;
}
}

View File

@ -22,6 +22,7 @@ import com.kakarote.core.feign.crm.entity.CrmEventBO;
import com.kakarote.core.feign.crm.entity.QueryEventCrmPageBO;
import com.kakarote.core.feign.crm.entity.SimpleCrmEntity;
import com.kakarote.core.field.FieldService;
import com.kakarote.core.security.util.SensitiveDataMaskUtil;
import com.kakarote.core.servlet.ApplicationContextHolder;
import com.kakarote.core.servlet.BaseServiceImpl;
import com.kakarote.core.servlet.upload.FileEntity;
@ -40,6 +41,7 @@ import com.kakarote.crm.entity.BO.CrmSearchBO;
import com.kakarote.crm.entity.BO.CrmUpdateInformationBO;
import com.kakarote.crm.entity.PO.*;
import com.kakarote.crm.entity.VO.CrmFieldSortVO;
import com.kakarote.crm.entity.VO.CrmGetPlaintextVO;
import com.kakarote.crm.entity.VO.CrmInfoNumVO;
import com.kakarote.crm.entity.VO.CrmModelFiledVO;
import com.kakarote.crm.mapper.CrmLeadsMapper;
@ -235,10 +237,9 @@ public class CrmLeadsServiceImpl extends BaseServiceImpl<CrmLeadsMapper, CrmLead
} else {
crmModel = new CrmModel(CrmEnum.LEADS.getType());
}
// 数据脱敏
return encryptSensitiveData(crmModel);
}
/**
* 解密线索敏感数据
* @param model 线索数据模型
@ -258,7 +259,7 @@ public class CrmLeadsServiceImpl extends BaseServiceImpl<CrmLeadsMapper, CrmLead
}
}
}
/**
* 数据脱敏
* @param crmModel 线索数据模型
@ -267,16 +268,16 @@ public class CrmLeadsServiceImpl extends BaseServiceImpl<CrmLeadsMapper, CrmLead
private CrmModel encryptSensitiveData(CrmModel crmModel) {
// 获取数据
String mobile = (String)crmModel.get("mobile");
String telephone = (String)crmModel.get("telephone");
String telephone = (String)crmModel.get("telephone");//联系人姓名
String email = (String)crmModel.get("email");
String address = (String)crmModel.get("address");
// 脱敏处理
String maskMobile = mobile != null ? SensitiveDataMaskUtil.maskPhone(mobile) : null;
String maskTelephone = telephone != null ? SensitiveDataMaskUtil.maskPhone(telephone) : null;
String maskTelephone = telephone != null ? SensitiveDataMaskUtil.maskName(telephone) : null;
String maskEmail = email != null ? SensitiveDataMaskUtil.maskEmail(email) : null;
String maskAddress = address != null ? SensitiveDataMaskUtil.maskAddress(address) : null;
// 重新组装crmModel
if (maskMobile != null) {
crmModel.replace("mobile", maskMobile);
@ -290,10 +291,25 @@ public class CrmLeadsServiceImpl extends BaseServiceImpl<CrmLeadsMapper, CrmLead
if (maskAddress != null) {
crmModel.replace("address", maskAddress);
}
return crmModel;
}
@Override
public String getLeadsPlaintext(CrmGetPlaintextVO plaintextVO) {
CrmLeads leads = lambdaQuery().eq(CrmLeads::getLeadsId, plaintextVO.getId()).one();
String plaintext = null;
if (plaintextVO.getField().equals("mobile")){
plaintext = leads.getMobile();
} else if (plaintextVO.getField().equals("email")){
plaintext = leads.getEmail();
} else if (plaintextVO.getField().equals("telephone")){ //详情页联系人姓名
plaintext = leads.getTelephone();
} else if (plaintextVO.getField().equals("address")){
plaintext = leads.getAddress();
}
return plaintext;
}
/**
* 保存或新增信息
@ -406,6 +422,49 @@ public class CrmLeadsServiceImpl extends BaseServiceImpl<CrmLeadsMapper, CrmLead
updateField(map, leadsIds);
}
/**
* 将字段中的下划线去掉并且将下划线后面的字母大写
* @param str
* @return
*/
private String removeUnderscoresAndCapitalize(String str) {
if (str == null || str.isEmpty()) {
return str;
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < str.length(); i++) {
char currentChar = str.charAt(i);
if (currentChar == '_') {
// 跳过下划线并将下一个字符大写
i++;
if (i < str.length()) {
sb.append(Character.toUpperCase(str.charAt(i)));
}
} else {
sb.append(currentChar);
}
}
return sb.toString();
}
// 不加密直接返回
private CrmModel fetchById(Integer id) {
CrmModel crmModel;
if (id != null) {
crmModel = getBaseMapper().queryById(id, UserUtil.getUserId());
crmModel.setLabel(CrmEnum.LEADS.getType());
crmModel.setOwnerUserName(UserCacheUtil.getUserName(crmModel.getOwnerUserId()));
crmLeadsDataService.setDataByBatchId(crmModel);
List<String> stringList = ApplicationContextHolder.getBean(ICrmRoleFieldService.class).queryNoAuthField(crmModel.getLabel());
stringList.forEach(crmModel::remove);
// 解密敏感数据
decryptSensitiveData(crmModel);
} else {
crmModel = new CrmModel(CrmEnum.LEADS.getType());
}
return crmModel;
}
@Override
@ -414,7 +473,7 @@ public class CrmLeadsServiceImpl extends BaseServiceImpl<CrmLeadsMapper, CrmLead
List<Integer> customerIds = new ArrayList<>();
Map<Integer, CrmModelSaveBO> crmModelSaveBoMap = new HashMap<>(8);
for (Integer leadsId : leadsIds) {
CrmModel leadsMap = queryById(leadsId);
CrmModel leadsMap = fetchById(leadsId);
CrmLeads crmLeads = BeanUtil.copyProperties(leadsMap,CrmLeads.class);
if (crmLeads.getIsTransform() == 1) {
throw new CrmException(CrmCodeEnum.CRM_LEADS_TRANSFER_ERROR);
@ -430,7 +489,8 @@ public class CrmLeadsServiceImpl extends BaseServiceImpl<CrmLeadsMapper, CrmLead
crmCustomer.setCreateTime(new Date());
crmCustomer.setUpdateTime(new Date());
crmCustomer.setReceiveTime(new Date());
crmCustomer.setDetailAddress(crmLeads.getAddress());
//crmCustomer.setDetailAddress(crmLeads.getAddress());
crmCustomer.setDetailAddress("");
crmCustomer.setLocation("");
crmCustomer.setAddress("");
crmCustomer.setLng("");
@ -442,16 +502,19 @@ public class CrmLeadsServiceImpl extends BaseServiceImpl<CrmLeadsMapper, CrmLead
crmCustomer.setLastTime(crmLeads.getLastTime());
String customerBatchId = IdUtil.simpleUUID();
crmCustomer.setBatchId(customerBatchId);
//处理拓展字段
List<CrmField> leadsFields = crmFieldService.list(CrmEnum.LEADS.getType(), false);
List<CrmField> customerFields = crmFieldService.list(CrmEnum.CUSTOMER.getType(), true);
List<CrmCustomerData> customerDataList = new ArrayList<>();
List<CrmCustomerData> customerDataList = new ArrayList<>(); //CrmCustomerData客户拓展字段数据表
Map<String, Object> customerExtraMap = new HashMap<>();
for (CrmField leadsField : leadsFields) {
for (CrmField customerField : customerFields) {
Integer isUnique = customerField.getIsUnique();
boolean bol = ("客户来源".equals(customerField.getName()) && "线索来源".equals(leadsField.getName()))
|| ("客户行业".equals(customerField.getName()) && "客户行业".equals(leadsField.getName()))
|| ("客户级别".equals(customerField.getName()) && "客户级别".equals(leadsField.getName()));
|| ("客户级别".equals(customerField.getName()) && "客户级别".equals(leadsField.getName())
|| ("客户详细地址".equals(customerField.getName()) && "地址".equals(leadsField.getName()))
);
if (bol) {
if (isUnique == 1 && crmFieldService.queryCustomerFieldDuplicateByNoFixed(customerField.getName(), leadsMap.get(leadsField.getName())) > 0) {
throw new CrmException(CrmCodeEnum.CRM_FIELD_EXISTED, customerField.getName());
@ -460,7 +523,8 @@ public class CrmLeadsServiceImpl extends BaseServiceImpl<CrmLeadsMapper, CrmLead
crmCustomerData.setValue((String) leadsMap.get(leadsField.getFieldName()));
crmCustomerData.setFieldId(customerField.getFieldId());
crmCustomerData.setName(customerField.getName());
crmCustomerData.setFieldName(customerField.getFieldName());
//crmCustomerData.setFieldName(customerField.getFieldName());
crmCustomerData.setFieldName(removeUnderscoresAndCapitalize(customerField.getFieldName()));
customerDataList.add(crmCustomerData);
continue;
}
@ -796,4 +860,4 @@ public class CrmLeadsServiceImpl extends BaseServiceImpl<CrmLeadsMapper, CrmLead
crmSearchBO.setLimit(eventCrmPageBO.getLimit());
return queryPageList(crmSearchBO);
}
}
}