手机号、车牌号加密存储
This commit is contained in:
parent
fa0109a910
commit
a210d5734d
|
|
@ -221,6 +221,9 @@ public class SM4Utils {
|
||||||
* @date 2024/9/12 10:37
|
* @date 2024/9/12 10:37
|
||||||
*/
|
*/
|
||||||
public static String encryptData(String data) {
|
public static String encryptData(String data) {
|
||||||
|
if(StringUtils.isBlank(data)){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
String lm = "щ";
|
String lm = "щ";
|
||||||
String value = decryptData_CBC(data);
|
String value = decryptData_CBC(data);
|
||||||
if(StringUtils.isBlank(value) || Objects.equals(lm,value)){
|
if(StringUtils.isBlank(value) || Objects.equals(lm,value)){
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,8 @@ public class HumanServiceImpl implements HumanService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
vo.setIdNumber(AesCbcUtils.encrypt(vo.getIdNumber()));
|
vo.setIdNumber(SM4Utils.encryptData_CBC(vo.getIdNumber()));
|
||||||
|
vo.setPhone(SM4Utils.encryptData_CBC(vo.getPhone()));
|
||||||
// 保存人员数据
|
// 保存人员数据
|
||||||
mapper.addOrUpdatePersonnel(vo);
|
mapper.addOrUpdatePersonnel(vo);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -160,7 +161,7 @@ public class HumanServiceImpl implements HumanService {
|
||||||
public Boolean userIsExist(List<Map<String, String>> list, String idNumber) {
|
public Boolean userIsExist(List<Map<String, String>> list, String idNumber) {
|
||||||
for (Map<String, String> map : list) {
|
for (Map<String, String> map : list) {
|
||||||
String value = map.get("value");
|
String value = map.get("value");
|
||||||
String decryptValue = AesCbcUtils.decrypt(value);
|
String decryptValue = SM4Utils.decryptData_CBC(value);
|
||||||
if (decryptValue == null) {
|
if (decryptValue == null) {
|
||||||
if (Objects.equals(idNumber, value)) {
|
if (Objects.equals(idNumber, value)) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -179,10 +180,7 @@ public class HumanServiceImpl implements HumanService {
|
||||||
HumanManageVo vo = new HumanManageVo();
|
HumanManageVo vo = new HumanManageVo();
|
||||||
try {
|
try {
|
||||||
vo = mapper.getPersonnelById(dto);
|
vo = mapper.getPersonnelById(dto);
|
||||||
String decryptIdNumber = AesCbcUtils.decrypt(vo.getIdNumber());
|
vo.setIdNumber(SM4Utils.encryptData(vo.getIdNumber()));
|
||||||
if(decryptIdNumber != null){
|
|
||||||
vo.setIdNumber(decryptIdNumber);
|
|
||||||
}
|
|
||||||
List<ResourceFileVo> resourceFileVos = mapper.getFiles(vo.getUserId());
|
List<ResourceFileVo> resourceFileVos = mapper.getFiles(vo.getUserId());
|
||||||
if (CollectionUtils.isNotEmpty(resourceFileVos)) {
|
if (CollectionUtils.isNotEmpty(resourceFileVos)) {
|
||||||
List<HumanManageVo.FileData> list = new ArrayList<>();
|
List<HumanManageVo.FileData> list = new ArrayList<>();
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ public class TeamServiceImpl implements TeamService {
|
||||||
public Boolean teamIsExist(List<Map<String, String>> list, String idNumber) {
|
public Boolean teamIsExist(List<Map<String, String>> list, String idNumber) {
|
||||||
for (Map<String, String> map : list) {
|
for (Map<String, String> map : list) {
|
||||||
String value = map.get("value");
|
String value = map.get("value");
|
||||||
String decryptValue = AesCbcUtils.decrypt(value);
|
String decryptValue = SM4Utils.decryptData_CBC(value);
|
||||||
if (decryptValue == null) {
|
if (decryptValue == null) {
|
||||||
if (Objects.equals(idNumber, value)) {
|
if (Objects.equals(idNumber, value)) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue