提交 1d94d078 编写于 作者: wangxinxu's avatar wangxinxu

医生身份证加密存储

上级 392f2bc9
流水线 #30705 已失败 于阶段
in 0 second
......@@ -155,7 +155,7 @@
<dependency>
<groupId>com.pica.cloud.foundation</groupId>
<artifactId>pica-cloud-encryption-client</artifactId>
<version>1.0.2</version>
<version>1.0.5</version>
<exclusions>
<exclusion>
<groupId>com.pica.cloud.foundation</groupId>
......@@ -222,6 +222,12 @@
</exclusions>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.73</version>
</dependency>
</dependencies>
......
......@@ -2,11 +2,15 @@ package com.pica.cloud.account.account.server.controller;
import com.pica.cloud.account.account.server.entity.Account;
import com.pica.cloud.account.account.server.service.AccountService;
import com.pica.cloud.foundation.encryption.common.constants.EncryptConstants;
import com.pica.cloud.foundation.encryption.util.EncryptUtils;
import com.pica.cloud.foundation.entity.PicaResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import sun.swing.StringUIClientPropertyKey;
import java.util.Map;
......@@ -27,6 +31,9 @@ public class AccountStatusController extends AccountBaseController {
public PicaResponse<Account> getStatus() {
long doctorId = super.getDoctorIdByToken();
Account account = accountService.getById(doctorId);
if (!StringUtils.isEmpty(account) && !StringUtils.isEmpty(account.getCard())) {
account.setCard(EncryptUtils.decryptContent(account.getCard(), EncryptConstants.ENCRYPT_TYPE_DOCTOR_IDNO, EncryptConstants.ENCRYPT_DECRYPT_KEY));
}
return PicaResponse.toResponse(account);
}
......
......@@ -13,6 +13,7 @@ import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.service.starter.interceptor.EnabledLoginValidate;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -46,6 +47,9 @@ public class DoctorController extends AccountBaseController {
String dencrypt = EncryptUtils.decryptContent(mobilePhone, EncryptConstants.ENCRYPT_TYPE_MOBILE, super.getToken());
mobilePhone = dencrypt.substring(0, 3) + "****" + dencrypt.substring(7, 11);
doctorInfo.setMobilePhone(mobilePhone);
if (StringUtils.isNotBlank(doctorInfo.getCard())) {
doctorInfo.setCard(EncryptUtils.decryptContent(doctorInfo.getCard(), EncryptConstants.ENCRYPT_TYPE_DOCTOR_IDNO, EncryptConstants.ENCRYPT_DECRYPT_KEY));
}
return PicaResponse.toResponse(doctorInfo);
}
......
......@@ -100,6 +100,9 @@ public class AccountServiceImpl implements AccountService {
}else {
accountInfo.setRegisterSource(AccountTypeEnum.DEVICE_TYPE_H5.getCode());
}
if (StringUtils.isNotBlank(accountInfo.getIdCard())) {
accountInfo.setIdCard(EncryptUtils.encryptContent(accountInfo.getIdCard(), EncryptConstants.ENCRYPT_TYPE_DOCTOR_IDNO));
}
accountInfoDetailMapper.insertSelective(accountInfo);
Integer acctId = accountInfo.getId();
//doctor表,存入用户id
......@@ -118,6 +121,9 @@ public class AccountServiceImpl implements AccountService {
account.setModifyTime(currentTime);
account.setFirstLoginTime(currentTime);
account.setLastLoginTime(currentTime);
if (StringUtils.isNotBlank(account.getCard())) {
account.setCard(EncryptUtils.encryptContent(account.getCard(), EncryptConstants.ENCRYPT_TYPE_DOCTOR_IDNO));
}
accountMapper.insertSelective(account);
}
}
......
......@@ -10,6 +10,8 @@ import com.pica.cloud.account.account.server.mapper.*;
import com.pica.cloud.account.account.server.service.DoctorService;
import com.pica.cloud.account.account.server.util.AESUtil;
import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.foundation.encryption.common.constants.EncryptConstants;
import com.pica.cloud.foundation.encryption.util.EncryptUtils;
import com.pica.cloud.foundation.utils.entity.PicaDoctor;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
......@@ -73,6 +75,9 @@ public class DoctorServiceImpl implements DoctorService {
}
doctor.setMobilePhone(AESUtil.encryptV0(mobilePhone));
doctor.setModifyTime(new Date());
if (StringUtils.isNotBlank(doctor.getCard())) {
doctor.setCard(EncryptUtils.encryptContent(doctor.getCard(), EncryptConstants.ENCRYPT_TYPE_DOCTOR_IDNO));
}
doctorMapper.updateByPrimaryKeySelective(doctor);
Integer acctId = entity.getAcctId();
AccountInfoEntity accountInfoEntity = new AccountInfoEntity();
......@@ -139,6 +144,7 @@ public class DoctorServiceImpl implements DoctorService {
entity.setDeleteFlag(1);
entity.setSex(doctor.getSex());
entity.setName(doctor.getName());
doctor.setCard(EncryptUtils.encryptContent(doctor.getCard(), EncryptConstants.ENCRYPT_TYPE_DOCTOR_IDNO));
entity.setIdCard(doctor.getCard());
entity.setAge(doctor.getAge());
entity.setBirthday(doctor.getBirthday());
......
......@@ -153,11 +153,11 @@ public class AESUtil {
* @return
*/
public static String encryptV0(String data) {
return EncryptCreateUtil.encrypt(data);
return EncryptUtils.encryptContent(data, EncryptConstants.ENCRYPT_TYPE_MOBILE);
}
public static String decryptV0(String data) {
return EncryptCreateUtil.dencrypt(data);
return EncryptUtils.decryptContent(data, EncryptConstants.ENCRYPT_TYPE_MOBILE, EncryptConstants.ENCRYPT_DECRYPT_KEY);
}
public static String decrypt(String sSrc, String sKey, String siv) throws Exception {
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册