联调问题
This commit is contained in:
parent
6bd10c86fa
commit
c02c8aaaf9
|
|
@ -59,8 +59,12 @@ public class PersonnelController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
//人员所属下拉
|
||||
//0:运检站1:项目部
|
||||
/**
|
||||
* 人员所属下拉
|
||||
* 0:运检站1:项目部
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getInspectionStationSelect")
|
||||
public AjaxResult getInspectionStationSelect(InspectionStationVo vo) {
|
||||
try {
|
||||
|
|
@ -72,8 +76,12 @@ public class PersonnelController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
//人员性质/人员分类/岗位下拉
|
||||
// 0:人员分类1:人员性质2:岗位列表
|
||||
/**
|
||||
* 人员性质/人员分类/岗位下拉
|
||||
* 0:人员分类1:人员性质2:岗位列表
|
||||
* @param vo
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getPersonnelClassificationSelect")
|
||||
public AjaxResult getPersonnelClassificationSelect(InspectionStationVo vo) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -28,7 +28,19 @@ public interface PersonnelService {
|
|||
*/
|
||||
int updatePersonnel(PersonnelVo personnelVo);
|
||||
|
||||
/**
|
||||
* 人员所属下拉
|
||||
* 0:运检站1:项目部
|
||||
* @param category
|
||||
* @return
|
||||
*/
|
||||
List<SelectDto> getInspectionStationSelect(String category);
|
||||
|
||||
/**
|
||||
* 人员性质/人员分类/岗位下拉
|
||||
* 0:人员分类1:人员性质2:岗位列表
|
||||
* @param category
|
||||
* @return
|
||||
*/
|
||||
List<SelectDto> getPersonnelClassificationSelect(String category);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.bonus.digital.service.impl;
|
||||
|
||||
import com.bonus.common.utils.AesUtil;
|
||||
import com.bonus.common.utils.SecurityUtils;
|
||||
import com.bonus.common.utils.StringUtils;
|
||||
import com.bonus.digital.dao.PersonnelVo;
|
||||
|
|
@ -30,7 +31,11 @@ public class PersonnelServiceImpl implements PersonnelService {
|
|||
*/
|
||||
@Override
|
||||
public List<PersonnelVo> getPersonnelList(PersonnelVo personnelVo) {
|
||||
return personnelMapper.getPersonnelList(personnelVo);
|
||||
List<PersonnelVo> personnelList = personnelMapper.getPersonnelList(personnelVo);
|
||||
for (PersonnelVo personnel : personnelList) {
|
||||
personnel.setPhone(AesUtil.encrypt(personnel.getPhone()));
|
||||
}
|
||||
return personnelList;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -70,11 +75,23 @@ public class PersonnelServiceImpl implements PersonnelService {
|
|||
return personnelMapper.updatePersonnel(personnelVo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 人员所属下拉
|
||||
* 0:运检站1:项目部
|
||||
* @param category
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SelectDto> getInspectionStationSelect(String category) {
|
||||
return personnelMapper.getInspectionStationSelect(category);
|
||||
}
|
||||
|
||||
/**
|
||||
* 人员性质/人员分类/岗位下拉
|
||||
* 0:人员分类1:人员性质2:岗位列表
|
||||
* @param category
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SelectDto> getPersonnelClassificationSelect(String category) {
|
||||
return personnelMapper.getPersonnelClassificationSelect(category);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,110 @@
|
|||
package com.bonus.common.utils;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Base64;
|
||||
|
||||
/**
|
||||
* AES 加解密工具类
|
||||
*/
|
||||
public class AesUtil {
|
||||
|
||||
// 默认密钥和向量(应与前端保持一致)
|
||||
private static final String DEFAULT_KEY = "0123456789abcdef0123456789abcdef";
|
||||
private static final String DEFAULT_IV = "0123456789abcdef";
|
||||
|
||||
// 算法/模式/填充
|
||||
private static final String ALGORITHM = "AES";
|
||||
private static final String TRANSFORMATION = "AES/CBC/PKCS5Padding";
|
||||
|
||||
/**
|
||||
* 加密
|
||||
* @param data 要加密的数据
|
||||
* @param key 密钥(可选,默认使用类常量)
|
||||
* @param iv 初始向量(可选,默认使用类常量)
|
||||
* @return Base64编码的加密字符串
|
||||
*/
|
||||
public static String encrypt(String data, String key, String iv) {
|
||||
try {
|
||||
if (key == null) key = DEFAULT_KEY;
|
||||
if (iv == null) iv = DEFAULT_IV;
|
||||
|
||||
// 检查密钥长度
|
||||
if (key.length() != 16 && key.length() != 24 && key.length() != 32) {
|
||||
throw new IllegalArgumentException("密钥长度必须为16、24或32位");
|
||||
}
|
||||
|
||||
SecretKeySpec secretKey = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), ALGORITHM);
|
||||
IvParameterSpec ivParameter = new IvParameterSpec(iv.getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
Cipher cipher = Cipher.getInstance(TRANSFORMATION);
|
||||
cipher.init(Cipher.ENCRYPT_MODE, secretKey, ivParameter);
|
||||
|
||||
byte[] encrypted = cipher.doFinal(data.getBytes(StandardCharsets.UTF_8));
|
||||
return Base64.getEncoder().encodeToString(encrypted);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("加密失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解密
|
||||
* @param encryptedData Base64编码的加密字符串
|
||||
* @param key 密钥(可选,默认使用类常量)
|
||||
* @param iv 初始向量(可选,默认使用类常量)
|
||||
* @return 解密后的原文
|
||||
*/
|
||||
public static String decrypt(String encryptedData, String key, String iv) {
|
||||
try {
|
||||
if (key == null) key = DEFAULT_KEY;
|
||||
if (iv == null) iv = DEFAULT_IV;
|
||||
|
||||
SecretKeySpec secretKey = new SecretKeySpec(key.getBytes(StandardCharsets.UTF_8), ALGORITHM);
|
||||
IvParameterSpec ivParameter = new IvParameterSpec(iv.getBytes(StandardCharsets.UTF_8));
|
||||
|
||||
Cipher cipher = Cipher.getInstance(TRANSFORMATION);
|
||||
cipher.init(Cipher.DECRYPT_MODE, secretKey, ivParameter);
|
||||
|
||||
byte[] decoded = Base64.getDecoder().decode(encryptedData);
|
||||
byte[] decrypted = cipher.doFinal(decoded);
|
||||
return new String(decrypted, StandardCharsets.UTF_8);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("解密失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用默认密钥和向量加密
|
||||
*/
|
||||
public static String encrypt(String data) {
|
||||
return encrypt(data, DEFAULT_KEY, DEFAULT_IV);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用默认密钥和向量解密
|
||||
*/
|
||||
public static String decrypt(String encryptedData) {
|
||||
return decrypt(encryptedData, DEFAULT_KEY, DEFAULT_IV);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成随机密钥
|
||||
* @param length 密钥长度(16/24/32)
|
||||
* @return 随机密钥
|
||||
*/
|
||||
public static String generateKey(int length) {
|
||||
if (length != 16 && length != 24 && length != 32) {
|
||||
throw new IllegalArgumentException("密钥长度必须为16、24或32");
|
||||
}
|
||||
|
||||
String chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < length; i++) {
|
||||
int index = (int) (Math.random() * chars.length());
|
||||
sb.append(chars.charAt(index));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.validation.Validator;
|
||||
|
||||
import com.bonus.common.utils.AesUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -33,7 +35,7 @@ import com.bonus.system.service.ISysUserService;
|
|||
|
||||
/**
|
||||
* 用户 业务层处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
|
|
@ -67,7 +69,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 根据条件分页查询用户列表
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
|
|
@ -75,12 +77,16 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
@DataScope(deptAlias = "d", userAlias = "u")
|
||||
public List<SysUser> selectUserList(SysUser user)
|
||||
{
|
||||
return userMapper.selectUserList(user);
|
||||
List<SysUser> sysUserList = userMapper.selectUserList(user);
|
||||
for (SysUser sysUser : sysUserList){
|
||||
sysUser.setPhonenumber(AesUtil.encrypt(sysUser.getPhonenumber()));
|
||||
}
|
||||
return sysUserList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件分页查询已分配用户角色列表
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
|
|
@ -93,7 +99,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 根据条件分页查询未分配用户角色列表
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 用户信息集合信息
|
||||
*/
|
||||
|
|
@ -106,7 +112,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 通过用户名查询用户
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
|
|
@ -118,7 +124,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 通过用户ID查询用户
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 用户对象信息
|
||||
*/
|
||||
|
|
@ -130,7 +136,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 查询用户所属角色组
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -147,7 +153,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 查询用户所属岗位组
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -164,7 +170,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 校验用户名称是否唯一
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -218,7 +224,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 校验用户是否允许操作
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -232,7 +238,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 校验用户是否有数据权限
|
||||
*
|
||||
*
|
||||
* @param userId 用户id
|
||||
*/
|
||||
@Override
|
||||
|
|
@ -252,7 +258,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 新增保存用户信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -271,7 +277,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 注册用户信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -283,7 +289,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 修改保存用户信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -305,7 +311,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 用户授权角色
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param roleIds 角色组
|
||||
*/
|
||||
|
|
@ -319,7 +325,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 修改用户状态
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -331,7 +337,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 修改用户基本信息
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -343,7 +349,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 修改用户头像
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param avatar 头像地址
|
||||
* @return 结果
|
||||
|
|
@ -356,7 +362,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
*
|
||||
* @param user 用户信息
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -368,7 +374,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 重置用户密码
|
||||
*
|
||||
*
|
||||
* @param userName 用户名
|
||||
* @param password 密码
|
||||
* @return 结果
|
||||
|
|
@ -381,7 +387,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 新增用户角色信息
|
||||
*
|
||||
*
|
||||
* @param user 用户对象
|
||||
*/
|
||||
public void insertUserRole(SysUser user)
|
||||
|
|
@ -391,7 +397,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 新增用户岗位信息
|
||||
*
|
||||
*
|
||||
* @param user 用户对象
|
||||
*/
|
||||
public void insertUserPost(SysUser user)
|
||||
|
|
@ -414,7 +420,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 新增用户角色信息
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @param roleIds 角色组
|
||||
*/
|
||||
|
|
@ -437,7 +443,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 通过用户ID删除用户
|
||||
*
|
||||
*
|
||||
* @param userId 用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -454,7 +460,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 批量删除用户信息
|
||||
*
|
||||
*
|
||||
* @param userIds 需要删除的用户ID
|
||||
* @return 结果
|
||||
*/
|
||||
|
|
@ -476,7 +482,7 @@ public class SysUserServiceImpl implements ISysUserService
|
|||
|
||||
/**
|
||||
* 导入用户数据
|
||||
*
|
||||
*
|
||||
* @param userList 用户数据列表
|
||||
* @param isUpdateSupport 是否更新支持,如果已存在,则进行更新数据
|
||||
* @param operName 操作用户
|
||||
|
|
|
|||
12
pom.xml
12
pom.xml
|
|
@ -3,7 +3,7 @@
|
|||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
<groupId>com.bonus</groupId>
|
||||
<artifactId>gs_eval_system</artifactId>
|
||||
<version>3.8.9</version>
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
<name>ruoyi</name>
|
||||
<url>http://www.ruoyi.vip</url>
|
||||
<description>若依管理系统</description>
|
||||
|
||||
|
||||
<properties>
|
||||
<ruoyi.version>3.8.9</ruoyi.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
|
@ -213,6 +213,12 @@
|
|||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 加密工具-->
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.15</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
|
|
@ -265,4 +271,4 @@
|
|||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
</project>
|
||||
</project>
|
||||
|
|
|
|||
Loading…
Reference in New Issue