Browse Source

Merge branch 'master' of http://git.elinkit.com.cn:7070/r/epmet-cloud into wxz_oper_access

master
wangxianzhang 3 years ago
parent
commit
98c37e767e
  1. 6
      epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperMenuDao.xml
  2. 26
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java

6
epmet-module/oper-access/oper-access-server/src/main/resources/mapper/OperMenuDao.xml

@ -26,9 +26,9 @@
<select id="getUserMenuList" resultType="com.epmet.entity.OperMenuEntity">
select t3.*, (select lang.field_value from oper_language lang where lang.table_name='oper_menu' and lang.field_name='name'
and lang.table_id=t3.id and lang.language=#{language}) as name from oper_role_user t1
left join oper_role_menu t2 on t1.role_id = t2.role_id
left join oper_menu t3 on t2.menu_id = t3.id
where t1.user_id = #{userId} and t3.del_flag = 0
left join oper_role_menu t2 on (t1.role_id = t2.role_id AND t2.del_flag = 0)
left join oper_menu t3 on (t2.menu_id = t3.id and t3.del_flag = 0)
where t1.user_id = #{userId} AND t1.del_flag = 0
<if test="type != null">
and t3.type = #{type}
</if>

26
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/OperUserController.java

@ -19,6 +19,7 @@ package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
@ -80,12 +81,16 @@ public class OperUserController {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
//解密密码
if (dto.getPassword().length() > 50) {
if (StringUtils.isNotBlank(dto.getPassword()) && dto.getPassword().length() > NumConstant.FIFTY) {
String password = RSASignature.decryptByPrivateKey(dto.getPassword(), privateKey);
String email = RSASignature.decryptByPrivateKey(dto.getEmail(), privateKey);
String phone = RSASignature.decryptByPrivateKey(dto.getPhone(), privateKey);
dto.setPassword(password);
}
if (StringUtils.isNotBlank(dto.getEmail()) && dto.getEmail().length() > NumConstant.FIFTY) {
String email = RSASignature.decryptByPrivateKey(dto.getEmail(), privateKey);
dto.setEmail(email);
}
if (StringUtils.isNotBlank(dto.getPhone()) && dto.getPhone().length() > NumConstant.FIFTY) {
String phone = RSASignature.decryptByPrivateKey(dto.getPhone(), privateKey);
dto.setPhone(phone);
}
operUserService.save(dto);
@ -93,9 +98,22 @@ public class OperUserController {
}
@PutMapping
public Result update(@RequestBody OperUserDTO dto) {
public Result update(@RequestBody OperUserDTO dto) throws Exception {
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
//解密密码
if (StringUtils.isNotBlank(dto.getPassword()) && dto.getPassword().length() > NumConstant.FIFTY) {
String password = RSASignature.decryptByPrivateKey(dto.getPassword(), privateKey);
dto.setPassword(password);
}
if (StringUtils.isNotBlank(dto.getEmail()) && dto.getEmail().length() > NumConstant.FIFTY) {
String email = RSASignature.decryptByPrivateKey(dto.getEmail(), privateKey);
dto.setEmail(email);
}
if (StringUtils.isNotBlank(dto.getPhone()) && dto.getPhone().length() > NumConstant.FIFTY) {
String phone = RSASignature.decryptByPrivateKey(dto.getPhone(), privateKey);
dto.setPhone(phone);
}
operUserService.update(dto);
return new Result();
}

Loading…
Cancel
Save