bug修复
This commit is contained in:
parent
cd2f9a8070
commit
9cb63601d5
|
|
@ -172,7 +172,7 @@ public class OrganizationalServiceImpl implements OrganizationalService {
|
||||||
//新增
|
//新增
|
||||||
bean.setDataSource("2");
|
bean.setDataSource("2");
|
||||||
OrganizationalBean his = mapper.getDataDetails(bean);
|
OrganizationalBean his = mapper.getDataDetails(bean);
|
||||||
if (!his.getIdCard().equals(bean.getIdCard())) {
|
if (his.getIdCard() != null && !his.getIdCard().equals(bean.getIdCard())) {
|
||||||
int userNum = mapper.getUserNum(bean);
|
int userNum = mapper.getUserNum(bean);
|
||||||
if (userNum > 0) {
|
if (userNum > 0) {
|
||||||
ar.setFailMsg("该人员已存在");
|
ar.setFailMsg("该人员已存在");
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,7 @@ import com.bonus.gs.sub.evaluate.evaluate.beans.*;
|
||||||
import com.bonus.gs.sub.evaluate.evaluate.dao.OutsourcerEvaluateDao;
|
import com.bonus.gs.sub.evaluate.evaluate.dao.OutsourcerEvaluateDao;
|
||||||
import com.bonus.gs.sub.evaluate.manager.utils.AjaxRes;
|
import com.bonus.gs.sub.evaluate.manager.utils.AjaxRes;
|
||||||
import com.bonus.gs.sub.evaluate.manager.utils.UserUtil;
|
import com.bonus.gs.sub.evaluate.manager.utils.UserUtil;
|
||||||
import com.sun.java.browser.plugin2.DOM;
|
|
||||||
import lombok.val;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.aspectj.weaver.loadtime.Aj;
|
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -17,7 +14,6 @@ import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.lang.reflect.Array;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.bonus.gs.sub.evaluate.manager.config;
|
package com.bonus.gs.sub.evaluate.manager.config;
|
||||||
|
|
||||||
|
import com.bonus.gs.sub.evaluate.manager.filter.DecryptionFilter;
|
||||||
import com.bonus.gs.sub.evaluate.manager.filter.TokenFilter;
|
import com.bonus.gs.sub.evaluate.manager.filter.TokenFilter;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
|
@ -61,6 +62,7 @@ public class BnsSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||||
http.headers().frameOptions().disable();
|
http.headers().frameOptions().disable();
|
||||||
http.headers().cacheControl();
|
http.headers().cacheControl();
|
||||||
|
|
||||||
|
http.addFilterBefore(new DecryptionFilter(),UsernamePasswordAuthenticationFilter.class);
|
||||||
http.addFilterBefore(tokenFilter, UsernamePasswordAuthenticationFilter.class);
|
http.addFilterBefore(tokenFilter, UsernamePasswordAuthenticationFilter.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,31 @@
|
||||||
|
package com.bonus.gs.sub.evaluate.manager.filter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:liang.chao
|
||||||
|
* @Date:2025/5/17 - 11:26
|
||||||
|
*/
|
||||||
|
|
||||||
|
import javax.servlet.*;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public class DecryptionFilter implements Filter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||||
|
throws IOException, ServletException {
|
||||||
|
|
||||||
|
HttpServletRequest httpRequest = (HttpServletRequest) request;
|
||||||
|
|
||||||
|
if (httpRequest.getRequestURI().endsWith("/login")
|
||||||
|
&& "POST".equalsIgnoreCase(httpRequest.getMethod())) {
|
||||||
|
// 处理登录请求
|
||||||
|
DecryptionRequestWrapper wrappedRequest = new DecryptionRequestWrapper(httpRequest);
|
||||||
|
chain.doFilter(wrappedRequest, response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
chain.doFilter(request, response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.bonus.gs.sub.evaluate.manager.filter;
|
||||||
|
|
||||||
|
import com.bonus.gs.sub.evaluate.manager.utils.AesCbcUtils;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletRequestWrapper;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Enumeration;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author:liang.chao
|
||||||
|
* @Date:2025/5/17 - 11:31
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class DecryptionRequestWrapper extends HttpServletRequestWrapper {
|
||||||
|
private static final String SECRET_KEY = "zhgd@bonus@zhgd@bonus@1234567890";
|
||||||
|
private final Map<String, String[]> decryptedParams = new HashMap<>();
|
||||||
|
|
||||||
|
public DecryptionRequestWrapper(HttpServletRequest request) {
|
||||||
|
super(request);
|
||||||
|
|
||||||
|
// 1. 复制原始参数(不直接修改原始 Map)
|
||||||
|
Map<String, String[]> originalParams = new HashMap<>(request.getParameterMap());
|
||||||
|
|
||||||
|
// 2. 仅解密 username 和 password
|
||||||
|
try {
|
||||||
|
if (originalParams.containsKey("username")) {
|
||||||
|
String encryptedUsername = originalParams.get("username")[0];
|
||||||
|
String decryptedUsername = AesCbcUtils.decryptCode(encryptedUsername);
|
||||||
|
originalParams.put("username", new String[]{decryptedUsername});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (originalParams.containsKey("password")) {
|
||||||
|
String encryptedPassword = originalParams.get("password")[0];
|
||||||
|
String decryptedPassword = AesCbcUtils.decryptCode(encryptedPassword);
|
||||||
|
originalParams.put("password", new String[]{decryptedPassword});
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("解密失败", e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 最终使用解密后的参数
|
||||||
|
this.decryptedParams.putAll(originalParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------- 重写方法(保持原样)------------
|
||||||
|
@Override
|
||||||
|
public String getParameter(String name) {
|
||||||
|
return decryptedParams.containsKey(name) ? decryptedParams.get(name)[0] : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, String[]> getParameterMap() {
|
||||||
|
return Collections.unmodifiableMap(decryptedParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Enumeration<String> getParameterNames() {
|
||||||
|
return Collections.enumeration(decryptedParams.keySet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getParameterValues(String name) {
|
||||||
|
return decryptedParams.get(name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,7 @@ package com.bonus.gs.sub.evaluate.manager.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.bonus.gs.sub.evaluate.manager.utils.AesCbcUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException;
|
import org.springframework.security.authentication.AuthenticationCredentialsNotFoundException;
|
||||||
|
|
@ -29,29 +30,29 @@ import com.bonus.gs.sub.evaluate.manager.service.UserService;
|
||||||
@Service
|
@Service
|
||||||
public class UserDetailsServiceImpl implements UserDetailsService {
|
public class UserDetailsServiceImpl implements UserDetailsService {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private PermissionDao permissionDao;
|
private PermissionDao permissionDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
|
||||||
SysUser sysUser = userService.findByPhone(username);
|
SysUser sysUser = userService.findByPhone(username);
|
||||||
if (sysUser == null) {
|
if (sysUser == null) {
|
||||||
throw new AuthenticationCredentialsNotFoundException("用户名不存在");
|
throw new AuthenticationCredentialsNotFoundException("用户名不存在");
|
||||||
} else if (sysUser.getStatus() == Status.LOCKED) {
|
} else if (sysUser.getStatus() == Status.LOCKED) {
|
||||||
throw new LockedException("用户被锁定,请联系管理员");
|
throw new LockedException("用户被锁定,请联系管理员");
|
||||||
} else if (sysUser.getStatus() == Status.DISABLED) {
|
} else if (sysUser.getStatus() == Status.DISABLED) {
|
||||||
throw new DisabledException("用户已作废");
|
throw new DisabledException("用户已作废");
|
||||||
}
|
}
|
||||||
|
|
||||||
LoginUser loginUser = new LoginUser();
|
LoginUser loginUser = new LoginUser();
|
||||||
BeanUtils.copyProperties(sysUser, loginUser);
|
BeanUtils.copyProperties(sysUser, loginUser);
|
||||||
|
|
||||||
List<Permission> permissions = permissionDao.listByUserId(sysUser.getId());
|
List<Permission> permissions = permissionDao.listByUserId(sysUser.getId());
|
||||||
loginUser.setPermissions(permissions);
|
loginUser.setPermissions(permissions);
|
||||||
loginUser.setDeptId(sysUser.getDeptId());
|
loginUser.setDeptId(sysUser.getDeptId());
|
||||||
return loginUser;
|
return loginUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,7 @@ import javax.crypto.Cipher;
|
||||||
import javax.crypto.spec.IvParameterSpec;
|
import javax.crypto.spec.IvParameterSpec;
|
||||||
import javax.crypto.spec.SecretKeySpec;
|
import javax.crypto.spec.SecretKeySpec;
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.security.Security;
|
import java.security.Security;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -40,7 +41,7 @@ public class AesCbcUtils {
|
||||||
* AES要求密钥长度为128位或192位或256位,java默认限制AES密钥长度最多128位
|
* AES要求密钥长度为128位或192位或256位,java默认限制AES密钥长度最多128位
|
||||||
*/
|
*/
|
||||||
public static String sKey = "zhgd@bonus@zhgd@bonus@1234567890";
|
public static String sKey = "zhgd@bonus@zhgd@bonus@1234567890";
|
||||||
|
private static final String IV = sKey.substring(0, 16);
|
||||||
/**
|
/**
|
||||||
* 编码格式导出
|
* 编码格式导出
|
||||||
*/
|
*/
|
||||||
|
|
@ -139,4 +140,17 @@ public class AesCbcUtils {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static String decryptCode(String encryptedData) throws Exception {
|
||||||
|
SecretKeySpec keySpec = new SecretKeySpec(sKey.getBytes(StandardCharsets.UTF_8), KEY_ALGORITHM);
|
||||||
|
IvParameterSpec ivSpec = new IvParameterSpec(IV.getBytes(StandardCharsets.UTF_8));
|
||||||
|
|
||||||
|
Cipher cipher = Cipher.getInstance(CIPHER_ALGORITHM);
|
||||||
|
cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec);
|
||||||
|
|
||||||
|
byte[] decodedBytes = Base64.decodeBase64(encryptedData);
|
||||||
|
byte[] decryptedBytes = cipher.doFinal(decodedBytes);
|
||||||
|
return new String(decryptedBytes, StandardCharsets.UTF_8);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@
|
||||||
pt.config_name like concat('%', #{keyWord},
|
pt.config_name like concat('%', #{keyWord},
|
||||||
'%'))
|
'%'))
|
||||||
</if>
|
</if>
|
||||||
|
group by per.evaluate_id
|
||||||
order by per.create_time desc
|
order by per.create_time desc
|
||||||
</select>
|
</select>
|
||||||
<select id="getOrgSelect" resultType="com.bonus.gs.sub.evaluate.evaluate.beans.InitiateEvaluateBean">
|
<select id="getOrgSelect" resultType="com.bonus.gs.sub.evaluate.evaluate.beans.InitiateEvaluateBean">
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,8 @@ var Base64 = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
var filePreviewPath = "http://36.33.26.201:21624/GsSubEvaluate/statics/";
|
// var filePreviewPath = "http://36.33.26.201:21624/GsSubEvaluate/statics/";
|
||||||
|
var filePreviewPath = "http://192.168.0.14:1803/GsSubEvaluate/statics/"; // 测试环境
|
||||||
|
|
||||||
|
|
||||||
// var filePreviewPath = "http://127.0.0.1:1803/GsSubEvaluate/statics/";
|
// var filePreviewPath = "http://127.0.0.1:1803/GsSubEvaluate/statics/";
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@
|
||||||
<script src="js/libs/jquery-2.1.1.min.js"></script>
|
<script src="js/libs/jquery-2.1.1.min.js"></script>
|
||||||
<script src="js/publicJs.js"></script>
|
<script src="js/publicJs.js"></script>
|
||||||
<script src="layui/layui.js"></script>
|
<script src="layui/layui.js"></script>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/crypto-js/4.1.1/crypto-js.min.js"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// if (top != self) {
|
// if (top != self) {
|
||||||
|
|
@ -108,7 +109,16 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
// AES加密函数
|
||||||
|
function encryptData(data, key) {
|
||||||
|
const keyHex = CryptoJS.enc.Utf8.parse(key);
|
||||||
|
const ivHex = CryptoJS.enc.Utf8.parse(key.substring(0, 16)); // 使用密钥前16位作为IV
|
||||||
|
return CryptoJS.AES.encrypt(data, keyHex, {
|
||||||
|
iv: ivHex,
|
||||||
|
mode: CryptoJS.mode.CBC,
|
||||||
|
padding: CryptoJS.pad.Pkcs7
|
||||||
|
}).toString();
|
||||||
|
}
|
||||||
function login(obj) {
|
function login(obj) {
|
||||||
$(obj).attr("disabled", true);
|
$(obj).attr("disabled", true);
|
||||||
|
|
||||||
|
|
@ -118,10 +128,19 @@
|
||||||
$("#info").html('用户名或者密码不能为空');
|
$("#info").html('用户名或者密码不能为空');
|
||||||
$(obj).attr("disabled", false);
|
$(obj).attr("disabled", false);
|
||||||
} else {
|
} else {
|
||||||
|
// 加密密钥(需与后端一致)
|
||||||
|
var secretKey = "zhgd@bonus@zhgd@bonus@1234567890";
|
||||||
|
|
||||||
|
// 加密用户名和密码
|
||||||
|
var encryptedData = {
|
||||||
|
username: encryptData(username, secretKey),
|
||||||
|
password: encryptData(password, secretKey),
|
||||||
|
};
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type : 'post',
|
type : 'post',
|
||||||
url : ctxPath + '/login',
|
url : ctxPath + '/login',
|
||||||
data : {username:username,password:password},
|
data : encryptedData,
|
||||||
success : function(data) {
|
success : function(data) {
|
||||||
// debugger;
|
// debugger;
|
||||||
localStorage.setItem("token", data.token);
|
localStorage.setItem("token", data.token);
|
||||||
|
|
|
||||||
|
|
@ -168,13 +168,13 @@
|
||||||
lay-affix="clear" autocomplete="off" maxlength="30">
|
lay-affix="clear" autocomplete="off" maxlength="30">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="layui-form-item">
|
<!-- <div class="layui-form-item">
|
||||||
<label class="layui-form-label"><span class="required_icon">*</span>身份证号码</label>
|
<label class="layui-form-label"><span class="required_icon">*</span>身份证号码</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input class="layui-input" id="idCard" name="idCard" lay-verify="required\|idCard"
|
<input class="layui-input" id="idCard" name="idCard" lay-verify="required\|idCard"
|
||||||
lay-affix="clear" autocomplete="off" maxlength="30" readonly>
|
lay-affix="clear" autocomplete="off" maxlength="30" readonly>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>-->
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label"><span class="required_icon">*</span>性别</label>
|
<label class="layui-form-label"><span class="required_icon">*</span>性别</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
|
|
@ -188,7 +188,7 @@
|
||||||
<label class="layui-form-label"><span class="required_icon">*</span>联系电话</label>
|
<label class="layui-form-label"><span class="required_icon">*</span>联系电话</label>
|
||||||
<div class="layui-input-inline">
|
<div class="layui-input-inline">
|
||||||
<input class="layui-input" id="userPhone" name="userPhone" lay-verify="required\|phone"
|
<input class="layui-input" id="userPhone" name="userPhone" lay-verify="required\|phone"
|
||||||
lay-affix="clear" autocomplete="off" maxlength="30" readonly>
|
lay-affix="clear" autocomplete="off" maxlength="30">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@
|
||||||
style="color: red">*</span>所属项目/部门:</label>
|
style="color: red">*</span>所属项目/部门:</label>
|
||||||
<div class="layui-input-inline" style="width: 60%">
|
<div class="layui-input-inline" style="width: 60%">
|
||||||
<select id="deptId" name="deptId" class="layui-select" lay-filter="changeOrg" lay-search
|
<select id="deptId" name="deptId" class="layui-select" lay-filter="changeOrg" lay-search
|
||||||
lay-verify="required" style="height: 360px;"></select>
|
lay-verify="required" style="height: 360px;" disabled></select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue