Commit 17525a14 authored by AfirSraftGarrier's avatar AfirSraftGarrier

发送成功消息

parent 062405e6
...@@ -7,6 +7,8 @@ import iot.sixiang.license.mapper.PmsUseLogMapper; ...@@ -7,6 +7,8 @@ import iot.sixiang.license.mapper.PmsUseLogMapper;
import iot.sixiang.license.model.PageInfoModel; import iot.sixiang.license.model.PageInfoModel;
import iot.sixiang.license.model.dto.ReportErrorMsgDTO; import iot.sixiang.license.model.dto.ReportErrorMsgDTO;
import iot.sixiang.license.service.PmsUseService; import iot.sixiang.license.service.PmsUseService;
import iot.sixiang.license.util.CommonUtil;
import org.owasp.esapi.ESAPI;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -45,7 +47,20 @@ public class PmsUseServiceImpl implements PmsUseService { ...@@ -45,7 +47,20 @@ public class PmsUseServiceImpl implements PmsUseService {
PmsUseLog pmsUseLog = new PmsUseLog(); PmsUseLog pmsUseLog = new PmsUseLog();
pmsUseLog.setId(reportErrorMsgDTO.getId()); pmsUseLog.setId(reportErrorMsgDTO.getId());
pmsUseLog.setStatus(1); pmsUseLog.setStatus(1);
if (reportErrorMsgDTO.getErrorMsg() != null) {
String[] successMessage = reportErrorMsgDTO.getErrorMsg().split(",");
if (successMessage.length == 2) {
// 身份证脱敏
String idCardString = ESAPI.encoder().encodeForDN(CommonUtil.idCardEncrypt(successMessage[1]));
// 姓名脱敏
String nameString = ESAPI.encoder().encodeForDN(CommonUtil.nameDesensitization(CommonUtil.unicodeToStr(successMessage[0])));
pmsUseLog.setMessage(nameString + "," + idCardString);
} else {
pmsUseLog.setMessage(reportErrorMsgDTO.getErrorMsg()); pmsUseLog.setMessage(reportErrorMsgDTO.getErrorMsg());
}
}
pmsUseLogMapper.updateById(pmsUseLog); pmsUseLogMapper.updateById(pmsUseLog);
} }
......
...@@ -14,7 +14,12 @@ import java.security.NoSuchAlgorithmException; ...@@ -14,7 +14,12 @@ import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom; import java.security.SecureRandom;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.Calendar;
import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -301,7 +306,7 @@ public class CommonUtil { ...@@ -301,7 +306,7 @@ public class CommonUtil {
return myName; return myName;
} }
//身份证前三后四脱敏 // 身份证前三后四脱敏
public static String idCardEncrypt(String idcard) { public static String idCardEncrypt(String idcard) {
if (idcard == null || idcard.length() == 0 || idcard.contains("*")) { if (idcard == null || idcard.length() == 0 || idcard.contains("*")) {
return idcard; return idcard;
...@@ -386,4 +391,21 @@ public class CommonUtil { ...@@ -386,4 +391,21 @@ public class CommonUtil {
} }
).collect(Collectors.toList()); ).collect(Collectors.toList());
} }
/**
* UNICODE转字符串
*
* @param unicode
* @return
*/
public static String unicodeToStr(String unicode) {
StringBuilder sb = new StringBuilder();
String[] hex = unicode.split("\\\\u");
for (int i = 1; i < hex.length; i++) {
int index = Integer.parseInt(hex[i], 16);
sb.append((char) index);
}
return sb.toString();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment