提交 64c7a5f0 编写于 作者: xinxu.wang's avatar xinxu.wang

加解密

上级 ced1f707
流水线 #14063 已失败 于阶段
in 0 second
......@@ -119,6 +119,17 @@
<artifactId>spymemcached</artifactId>
<version>2.12.3</version>
</dependency>
<dependency>
<groupId>com.pica.cloud.foundation</groupId>
<artifactId>pica-cloud-encryption-client</artifactId>
<version>1.0.2</version>
<exclusions>
<exclusion>
<groupId>com.pica.cloud.foundation</groupId>
<artifactId>pica-cloud-entity</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<dependencyManagement>
......
......@@ -4,6 +4,8 @@ import com.pica.cloud.account.account.server.entity.Account;
import com.pica.cloud.account.account.server.req.AccountReq;
import com.pica.cloud.account.account.server.service.AccountService;
import com.pica.cloud.account.account.server.service.CaptchaService;
import com.pica.cloud.foundation.encryption.common.constants.EncryptConstants;
import com.pica.cloud.foundation.encryption.util.EncryptUtils;
import com.pica.cloud.foundation.entity.PicaException;
import com.pica.cloud.foundation.entity.PicaResponse;
import com.pica.cloud.foundation.entity.PicaResultCode;
......@@ -11,7 +13,6 @@ import com.pica.cloud.foundation.redis.ICacheClient;
import com.pica.cloud.foundation.utils.constants.CommonConstants;
import com.pica.cloud.foundation.utils.entity.PicaUser;
import com.pica.cloud.foundation.utils.utils.CommonUtil;
import com.pica.cloud.foundation.utils.utils.EncryptCreateUtil;
import com.pica.cloud.foundation.utils.utils.ValidateUtils;
import com.pica.cloud.foundation.utils.utils.json.Object2Map;
import io.swagger.annotations.Api;
......@@ -178,7 +179,7 @@ public class AccountController extends AccountBaseController {
//获取验证码redis key
private String getAuthCodeKey(String mobilePhone, String flag) {
return AUTH_CODE_PREFIX + flag + "-" + EncryptCreateUtil.encrypt(mobilePhone);
return AUTH_CODE_PREFIX + flag + "-" + EncryptUtils.encryptContent(mobilePhone, EncryptConstants.Encrypt_type_mobile_1);
}
//校验验证码
......@@ -223,7 +224,7 @@ public class AccountController extends AccountBaseController {
picaUser.setToken(newToken);
picaUser.setId(account.getId().intValue());
picaUser.setMobile(account.getMobilePhone());
picaUser.setName(EncryptCreateUtil.dencrypt(account.getMobilePhone()).replaceAll("(\\d{3})\\d{4}(\\w{4})","$1****$2"));
picaUser.setName(EncryptUtils.decryptContent(account.getMobilePhone(), EncryptConstants.Encrypt_type_mobile_1, EncryptConstants.encrypt_decrypt_key).replaceAll("(\\d{3})\\d{4}(\\w{4})","$1****$2"));
picaUser.setCreated_time(account.getCreatTime());
Map<String, String> data = Object2Map.objectToMapString("yyyy-MM-dd HH:mm:ss", picaUser, new String[0]);
data.put("sysCode", "h5");
......
......@@ -3,8 +3,9 @@ package com.pica.cloud.account.account.server.service.impl;
import com.pica.cloud.account.account.server.entity.Account;
import com.pica.cloud.account.account.server.mapper.AccountMapper;
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.redis.ICacheClient;
import com.pica.cloud.foundation.utils.utils.EncryptCreateUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
......@@ -43,7 +44,7 @@ public class AccountServiceImpl implements AccountService {
//根据手机号获取账号
@Override
public Account getByMobilePhone(String mobilePhone) {
String encryptMobilePhone = EncryptCreateUtil.encrypt(mobilePhone);
String encryptMobilePhone = EncryptUtils.encryptContent(mobilePhone, EncryptConstants.Encrypt_type_mobile_1);
return accountMapper.getByMobilePhone(encryptMobilePhone);
}
......@@ -57,7 +58,7 @@ public class AccountServiceImpl implements AccountService {
@Transactional
public void createAccount(Account account) {
Date currentTime = new Date();
account.setMobilePhone(EncryptCreateUtil.encrypt(account.getMobilePhone())); //手机号加密
account.setMobilePhone(EncryptUtils.encryptContent(account.getMobilePhone(), EncryptConstants.Encrypt_type_mobile_1)); //手机号加密
account.setDeleteFlag(1);
account.setCreatId(0L);
account.setModifyId(0L);
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册