This commit is contained in:
parent
ce525ad955
commit
ae013c0ca2
|
|
@ -1,6 +1,7 @@
|
||||||
package com.kakarote.crm.entity.PO;
|
package com.kakarote.crm.entity.PO;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.kakarote.core.security.converter.SensitiveDataConverter;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
@ -46,15 +47,19 @@ public class CrmLeads implements Serializable {
|
||||||
private Date nextTime;
|
private Date nextTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "电话")
|
@ApiModelProperty(value = "电话")
|
||||||
|
@TableField(typeHandler = SensitiveDataConverter.class)
|
||||||
private String telephone;
|
private String telephone;
|
||||||
|
|
||||||
@ApiModelProperty(value = "手机号")
|
@ApiModelProperty(value = "手机号")
|
||||||
|
@TableField(typeHandler = SensitiveDataConverter.class)
|
||||||
private String mobile;
|
private String mobile;
|
||||||
|
|
||||||
@ApiModelProperty(value = "邮箱")
|
@ApiModelProperty(value = "邮箱")
|
||||||
|
@TableField(typeHandler = SensitiveDataConverter.class)
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
@ApiModelProperty(value = "地址")
|
@ApiModelProperty(value = "地址")
|
||||||
|
@TableField(typeHandler = SensitiveDataConverter.class)
|
||||||
private String address;
|
private String address;
|
||||||
|
|
||||||
@ApiModelProperty(value = "备注")
|
@ApiModelProperty(value = "备注")
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.kakarote.core.common.FieldEnum;
|
import com.kakarote.core.common.FieldEnum;
|
||||||
import com.kakarote.core.common.cache.CrmCacheKey;
|
import com.kakarote.core.common.cache.CrmCacheKey;
|
||||||
import com.kakarote.core.common.log.BehaviorEnum;
|
import com.kakarote.core.common.log.BehaviorEnum;
|
||||||
|
import com.kakarote.core.common.Const;
|
||||||
|
import com.kakarote.core.security.EncryptionService;
|
||||||
|
import com.kakarote.core.security.util.SensitiveDataMaskUtil;
|
||||||
import com.kakarote.core.entity.BasePage;
|
import com.kakarote.core.entity.BasePage;
|
||||||
import com.kakarote.core.exception.CrmException;
|
import com.kakarote.core.exception.CrmException;
|
||||||
import com.kakarote.core.feign.admin.service.AdminFileService;
|
import com.kakarote.core.feign.admin.service.AdminFileService;
|
||||||
|
|
@ -114,6 +117,9 @@ public class CrmLeadsServiceImpl extends BaseServiceImpl<CrmLeadsMapper, CrmLead
|
||||||
@Autowired
|
@Autowired
|
||||||
private ActionRecordUtil actionRecordUtil;
|
private ActionRecordUtil actionRecordUtil;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EncryptionService encryptionService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 大的搜索框的搜索字段
|
* 大的搜索框的搜索字段
|
||||||
|
|
@ -223,9 +229,68 @@ public class CrmLeadsServiceImpl extends BaseServiceImpl<CrmLeadsMapper, CrmLead
|
||||||
crmLeadsDataService.setDataByBatchId(crmModel);
|
crmLeadsDataService.setDataByBatchId(crmModel);
|
||||||
List<String> stringList = ApplicationContextHolder.getBean(ICrmRoleFieldService.class).queryNoAuthField(crmModel.getLabel());
|
List<String> stringList = ApplicationContextHolder.getBean(ICrmRoleFieldService.class).queryNoAuthField(crmModel.getLabel());
|
||||||
stringList.forEach(crmModel::remove);
|
stringList.forEach(crmModel::remove);
|
||||||
|
|
||||||
|
// 解密敏感数据
|
||||||
|
decryptSensitiveData(crmModel);
|
||||||
} else {
|
} else {
|
||||||
crmModel = new CrmModel(CrmEnum.LEADS.getType());
|
crmModel = new CrmModel(CrmEnum.LEADS.getType());
|
||||||
}
|
}
|
||||||
|
// 数据脱敏
|
||||||
|
return encryptSensitiveData(crmModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解密线索敏感数据
|
||||||
|
* @param model 线索数据模型
|
||||||
|
*/
|
||||||
|
private void decryptSensitiveData(CrmModel model) {
|
||||||
|
String[] sensitiveFields = {"mobile", "telephone", "email", "address", "remark"};
|
||||||
|
for (String field : sensitiveFields) {
|
||||||
|
Object value = model.get(field);
|
||||||
|
if (value instanceof String && ((String) value).startsWith(Const.ENCRYPTED_PREFIX)) {
|
||||||
|
try {
|
||||||
|
String decryptedValue = encryptionService.decryptAes(((String) value).substring(Const.ENCRYPTED_PREFIX.length()));
|
||||||
|
model.put(field, decryptedValue);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("解密 {} 字段失败: {}, 原始值: {}", field, model.get("leadsId"), value, e);
|
||||||
|
model.put(field, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据脱敏
|
||||||
|
* @param crmModel 线索数据模型
|
||||||
|
* @return 脱敏后的线索数据模型
|
||||||
|
*/
|
||||||
|
private CrmModel encryptSensitiveData(CrmModel crmModel) {
|
||||||
|
// 获取数据
|
||||||
|
String mobile = (String)crmModel.get("mobile");
|
||||||
|
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 maskEmail = email != null ? SensitiveDataMaskUtil.maskEmail(email) : null;
|
||||||
|
String maskAddress = address != null ? SensitiveDataMaskUtil.maskAddress(address) : null;
|
||||||
|
|
||||||
|
// 重新组装crmModel
|
||||||
|
if (maskMobile != null) {
|
||||||
|
crmModel.replace("mobile", maskMobile);
|
||||||
|
}
|
||||||
|
if (maskTelephone != null) {
|
||||||
|
crmModel.replace("telephone", maskTelephone);
|
||||||
|
}
|
||||||
|
if (maskEmail != null) {
|
||||||
|
crmModel.replace("email", maskEmail);
|
||||||
|
}
|
||||||
|
if (maskAddress != null) {
|
||||||
|
crmModel.replace("address", maskAddress);
|
||||||
|
}
|
||||||
|
|
||||||
return crmModel;
|
return crmModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue