用户新增传输过程加密
This commit is contained in:
+23
-15
@@ -2,6 +2,7 @@ package com.jero.modules.system.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.RandomUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@@ -144,15 +145,17 @@ public class SysUserController {
|
||||
SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class);
|
||||
|
||||
try {
|
||||
//1:先用私钥解密数据
|
||||
String email = CommonUtils.decryptBtRsaPriKey(user.getEmail(), rsaPrivateKey);
|
||||
String phone = CommonUtils.decryptBtRsaPriKey(user.getPhone(), rsaPrivateKey);
|
||||
if (StrUtil.isNotEmpty(user.getEmail())){
|
||||
String email = CommonUtils.decryptBtRsaPriKey(user.getEmail(), rsaPrivateKey);
|
||||
// email = PasswordUtil.encrypt(email);
|
||||
user.setEmail(email);
|
||||
}
|
||||
|
||||
//3:把数据加密在放回来
|
||||
email = PasswordUtil.encrypt(email);
|
||||
phone = PasswordUtil.encrypt(phone);
|
||||
user.setEmail(email);
|
||||
user.setPhone(phone);
|
||||
if (StrUtil.isNotEmpty(user.getPhone())){
|
||||
String phone = CommonUtils.decryptBtRsaPriKey(user.getPhone(), rsaPrivateKey);
|
||||
// phone = PasswordUtil.encrypt(phone);
|
||||
user.setPhone(phone);
|
||||
}
|
||||
|
||||
// 密码加盐
|
||||
String password = CommonUtils.decryptBtRsaPriKey(user.getPassword(), rsaPrivateKey);
|
||||
@@ -192,18 +195,23 @@ public class SysUserController {
|
||||
result.error500("未找到对应实体");
|
||||
}else {
|
||||
SysUser user = JSON.parseObject(jsonObject.toJSONString(), SysUser.class);
|
||||
String email;
|
||||
String phone;
|
||||
String email = null;
|
||||
String phone = null;
|
||||
try {
|
||||
//1:先用私钥解密数据
|
||||
email = CommonUtils.decryptBtRsaPriKey(user.getEmail(), rsaPrivateKey);
|
||||
phone = CommonUtils.decryptBtRsaPriKey(user.getPhone(), rsaPrivateKey);
|
||||
if (StrUtil.isNotEmpty(user.getEmail())){
|
||||
email = CommonUtils.decryptBtRsaPriKey(user.getEmail(), rsaPrivateKey);
|
||||
}
|
||||
|
||||
if (StrUtil.isNotEmpty(user.getPhone())){
|
||||
phone = CommonUtils.decryptBtRsaPriKey(user.getPhone(), rsaPrivateKey);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new JeroBootException("解密失败!", e);
|
||||
}
|
||||
//3:把数据加密在放回来
|
||||
email = PasswordUtil.encrypt(email);
|
||||
phone = PasswordUtil.encrypt(phone);
|
||||
// 3:把数据加密在放回来
|
||||
// email = PasswordUtil.encrypt(email);
|
||||
// phone = PasswordUtil.encrypt(phone);
|
||||
user.setEmail(email);
|
||||
user.setPhone(phone);
|
||||
user.setUpdateTime(new Date());
|
||||
|
||||
+1
@@ -175,4 +175,5 @@ public class SysUser implements Serializable {
|
||||
|
||||
/**设备id uniapp推送用*/
|
||||
private String clientId;
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -35,7 +35,7 @@
|
||||
</select>
|
||||
|
||||
<!--根据parent_id查询下级部门-->
|
||||
<select id="queryTreeListByPid" parameterType="Object" resultType="org.jeecg.modules.system.entity.SysDepart">
|
||||
<select id="queryTreeListByPid" parameterType="Object" resultType="com.jero.modules.system.entity.SysDepart">
|
||||
SELECT * FROM sys_depart where del_flag = '0'
|
||||
<choose>
|
||||
<when test="parentId != null and parentId != ''">
|
||||
@@ -49,7 +49,7 @@
|
||||
</select>
|
||||
|
||||
<!-- 根据OrgCod查询公司信息 -->
|
||||
<select id="queryCompByOrgCode" resultType="org.jeecg.modules.system.entity.SysDepart">
|
||||
<select id="queryCompByOrgCode" resultType="com.jero.modules.system.entity.SysDepart">
|
||||
select * from sys_depart where del_flag = '0' and org_category='1' and org_code= #{orgCode,jdbcType=VARCHAR}
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user