微调
This commit is contained in:
@@ -1110,7 +1110,7 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> i
|
||||
*/
|
||||
private XWPFTable generateTableBodyZJ(XWPFTable table,List<RawResultDataVO> rawResultDataVOS, DicDataEnum enumByCode) {
|
||||
// 组装数据
|
||||
getTableBodyDataZJ(rawResultDataVOS, enumByCode)
|
||||
getTableBodyDataZJ(rawResultDataVOS, enumByCode);
|
||||
return table;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
@Slf4j
|
||||
@Api(tags = "检测相关配置")
|
||||
@RestController
|
||||
@RequestMapping("/sysTestConfig")
|
||||
@RequestMapping("/sysTestConfig")
|
||||
@RequiredArgsConstructor
|
||||
public class SysTestConfigController extends BaseController {
|
||||
private final ISysTestConfigService sysTestConfigService;
|
||||
@@ -71,5 +71,15 @@ public class SysTestConfigController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@ApiOperation("获取当前场景")
|
||||
@GetMapping("/getCurrentScene")
|
||||
public HttpResult<String> getCurrentScene() {
|
||||
String methodDescribe = getMethodDescribe("getCurrentScene");
|
||||
LogUtil.njcnDebug(log, "{},获取当前场景", methodDescribe);
|
||||
String currrentScene = sysTestConfigService.getCurrrentScene();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, currrentScene, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,8 +48,9 @@ public class LogAdvice implements ApplicationListener<ContextRefreshedEvent> {
|
||||
|
||||
private BlockingQueue<SysLogAudit> logQueue = new LinkedBlockingDeque<>();
|
||||
|
||||
@Pointcut(value = "execution(* com.njcn.gather..controller.*(..))")
|
||||
//@Pointcut(value = "execution(* com.njcn.gather..controller.*.*(..)) && !execution(* com.njcn.gather..controller.AuthController.*(..))")
|
||||
// @Pointcut(value = "execution(* com.njcn.gather..controller.*(..))")
|
||||
// @Pointcut(value = "execution(* com.njcn.gather..controller.*.*(..)) && !execution(* com.njcn.gather..controller.AuthController.*(..))")
|
||||
@Pointcut(value = "execution(* com.njcn.gather..controller.*.*(..))")
|
||||
public void logPointcut() {
|
||||
}
|
||||
|
||||
|
||||
@@ -87,11 +87,5 @@ public interface SystemValidMessage {
|
||||
|
||||
String AUTO_GENERATE_FORMAT_ERROR = "是否自动生成格式错误,请检查autoGenerate参数";
|
||||
|
||||
String TOKEN_VALID_ERROR = "非法的token";
|
||||
|
||||
String TOKEN_EXPIRED = "token已过期,请重新登录";
|
||||
|
||||
String ACCESS_TOKEN_EXPIRED = "access-token已过期";
|
||||
|
||||
String USER_ID_FORMAT_ERROR = "用户id格式错误,请检查userId参数";
|
||||
}
|
||||
|
||||
@@ -31,6 +31,12 @@
|
||||
<version>2.3.12</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.83</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -43,4 +43,10 @@ public interface UserValidMessage {
|
||||
String PARAM_FORMAT_ERROR = "参数值非法";
|
||||
|
||||
String LOGIN_FAILED = "登录失败,用户名或密码错误";
|
||||
|
||||
String TOKEN_VALID_ERROR = "非法的token";
|
||||
|
||||
String TOKEN_EXPIRED = "token已过期,请重新登录";
|
||||
|
||||
String ACCESS_TOKEN_EXPIRED = "access-token已过期";
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.gather.system.auth.controller;
|
||||
package com.njcn.gather.user.user.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
@@ -13,31 +13,20 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.JwtUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.gather.system.auth.pojo.Token;
|
||||
import com.njcn.gather.system.config.pojo.po.SysTestConfig;
|
||||
import com.njcn.gather.system.config.service.ISysTestConfigService;
|
||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||
import com.njcn.gather.system.log.pojo.enums.LogOperationTypeEnum;
|
||||
import com.njcn.gather.system.log.pojo.po.SysLogAudit;
|
||||
import com.njcn.gather.system.log.service.ISysLogAuditService;
|
||||
import com.njcn.gather.user.pojo.constant.UserValidMessage;
|
||||
import com.njcn.gather.user.user.pojo.param.SysUserParam;
|
||||
import com.njcn.gather.user.user.pojo.po.SysUser;
|
||||
import com.njcn.gather.user.user.pojo.po.Token;
|
||||
import com.njcn.gather.user.user.service.ISysUserService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.HttpResultUtil;
|
||||
import com.njcn.web.utils.HttpServletUtil;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.logging.log4j.util.Strings;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -50,8 +39,6 @@ import java.util.Map;
|
||||
public class AuthController extends BaseController {
|
||||
|
||||
private final ISysUserService sysUserService;
|
||||
private final ISysLogAuditService sysLogAuditService;
|
||||
private final ISysTestConfigService sysTestConfigService;
|
||||
|
||||
// @RequestMapping("/login")
|
||||
// public HttpResult<Token> login() {
|
||||
@@ -97,7 +84,7 @@ public class AuthController extends BaseController {
|
||||
CustomCacheUtil customCacheUtil = SpringUtil.getBean(CustomCacheUtil.CACHE_NAME);
|
||||
customCacheUtil.putWithExpireTime(accessToken, JSON.toJSONString(user), DateUnit.DAY.getMillis() * 2);
|
||||
|
||||
sysLogAuditService.saveAuthLog(user.getName(), 1);
|
||||
//sysLogAuditService.saveAuthLog(user.getName(), 1);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, token, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -115,7 +102,7 @@ public class AuthController extends BaseController {
|
||||
|
||||
Map<String, Object> map = JwtUtil.parseToken(accessToken);
|
||||
SysUser user = sysUserService.getById((String) map.get(SecurityConstants.USER_ID));
|
||||
sysLogAuditService.saveAuthLog(user.getName(), 2);
|
||||
//sysLogAuditService.saveAuthLog(user.getName(), 2);
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
@@ -151,13 +138,5 @@ public class AuthController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@ApiOperation("获取当前场景")
|
||||
@GetMapping("/getCurrentScene")
|
||||
public HttpResult<String> getCurrentScene() {
|
||||
String methodDescribe = getMethodDescribe("getCurrentScene");
|
||||
LogUtil.njcnDebug(log, "{},获取当前场景", methodDescribe);
|
||||
String currrentScene= sysTestConfigService.getCurrrentScene();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, currrentScene, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.njcn.gather.system.auth.filter;
|
||||
package com.njcn.gather.user.user.filter;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.njcn.common.pojo.constant.SecurityConstants;
|
||||
import com.njcn.common.utils.JwtUtil;
|
||||
import com.njcn.gather.system.pojo.constant.SystemValidMessage;
|
||||
import com.njcn.gather.user.pojo.constant.UserValidMessage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.Ordered;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -55,24 +55,24 @@ public class AuthGlobalFilter implements Filter, Ordered {
|
||||
String accessTokenStr = req.getHeader(SecurityConstants.AUTHORIZATION_KEY);
|
||||
String isRefreshToken = req.getHeader(SecurityConstants.IS_REFRESH_TOKEN);
|
||||
if (StrUtil.isBlank(accessTokenStr) || !accessTokenStr.startsWith(SecurityConstants.AUTHORIZATION_PREFIX)) {
|
||||
res.getWriter().write("{\"code\": 4001, \"message\":\"" + SystemValidMessage.TOKEN_VALID_ERROR + "\"}"); //前端重定向到登录页面
|
||||
res.getWriter().write("{\"code\": 4001, \"message\":\"" + UserValidMessage.TOKEN_VALID_ERROR + "\"}"); //前端重定向到登录页面
|
||||
return;
|
||||
}
|
||||
String accessToken = accessTokenStr.substring(SecurityConstants.AUTHORIZATION_PREFIX.length());
|
||||
try {
|
||||
if (StrUtil.isBlank(accessToken) || !JwtUtil.verifyToken(accessToken)) {
|
||||
res.getWriter().write("{\"code\": 4001, \"message\":\"" + SystemValidMessage.TOKEN_VALID_ERROR + "\"}"); //前端重定向到登录页面
|
||||
res.getWriter().write("{\"code\": 4001, \"message\":\"" + UserValidMessage.TOKEN_VALID_ERROR + "\"}"); //前端重定向到登录页面
|
||||
} else if (JwtUtil.isExpired(accessToken)) {
|
||||
if ("true".equals(isRefreshToken)) {
|
||||
res.getWriter().write("{\"code\": 4001, \"message\":\"" + SystemValidMessage.TOKEN_EXPIRED + "\"}"); //前端重定向到登录页面
|
||||
res.getWriter().write("{\"code\": 4001, \"message\":\"" + UserValidMessage.TOKEN_EXPIRED + "\"}"); //前端重定向到登录页面
|
||||
} else {
|
||||
res.getWriter().write("{\"code\": 401, \"message\":\"" + SystemValidMessage.ACCESS_TOKEN_EXPIRED + "\"}"); //前端发起refreshToken请求
|
||||
res.getWriter().write("{\"code\": 401, \"message\":\"" + UserValidMessage.ACCESS_TOKEN_EXPIRED + "\"}"); //前端发起refreshToken请求
|
||||
}
|
||||
} else {
|
||||
filterChain.doFilter(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
res.getWriter().write("{\"code\": 4001, \"message\":\"" + SystemValidMessage.TOKEN_VALID_ERROR + "\"}");
|
||||
res.getWriter().write("{\"code\": 4001, \"message\":\"" + UserValidMessage.TOKEN_VALID_ERROR + "\"}");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.njcn.gather.system.auth.pojo;
|
||||
package com.njcn.gather.user.user.pojo.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
Reference in New Issue
Block a user