Przeglądaj źródła

Merge remote-tracking branch 'origin/master' into master

yejian 2 lat temu
rodzic
commit
cadb2b1cfd

+ 8 - 3
imcs-admin-boot/imcs-authority-server/src/main/java/com/github/zuihou/interceptor/TokenHandlerInterceptor.java

@@ -29,6 +29,8 @@ import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import java.util.Date;
+
 import static com.github.zuihou.context.BaseContextConstants.BASIC_HEADER_KEY;
 import static com.github.zuihou.context.BaseContextConstants.BEARER_HEADER_KEY;
 import static com.github.zuihou.context.BaseContextConstants.JWT_KEY_TENANT;
@@ -108,12 +110,15 @@ public class TokenHandlerInterceptor extends HandlerInterceptorAdapter {
             log.debug("TokenHandlerInterceptor token="+token);
 
             //添加测试环境的特殊token
-            if (isDev() && (StrPool.TEST_TOKEN.equalsIgnoreCase(token) || StrPool.TEST.equalsIgnoreCase(token))) {
-                authInfo = new AuthInfo().setAccount("zuihou").setUserId(3L).setTokenType(BEARER_HEADER_KEY).setName("平台管理员");
-            }
+//            if (isDev() && (StrPool.TEST_TOKEN.equalsIgnoreCase(token) || StrPool.TEST.equalsIgnoreCase(token))) {
+//                authInfo = new AuthInfo().setAccount("zuihou").setUserId(3L).setTokenType(BEARER_HEADER_KEY).setName("平台管理员");
+//            }
             // 4, 解析 并 验证 token
             if (authInfo == null) {
                 authInfo = tokenUtil.getAuthInfo(token);
+            }else if(authInfo.getExpiration().before(new Date())){
+                //过期自动给token续期
+                authInfo = tokenUtil.parseRefreshToken(token);
             }
 
             // 5,验证 是否在其他设备登录或被挤下线

+ 9 - 18
imcs-admin-boot/imcs-authority-server/src/main/java/com/github/zuihou/job/DashboardJob.java

@@ -2,15 +2,12 @@ package com.github.zuihou.job;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.collection.CollectionUtil;
 import cn.hutool.core.util.ReflectUtil;
 import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fasterxml.jackson.databind.ObjectMapper;
-import com.github.zuihou.authority.entity.auth.User;
 import com.github.zuihou.base.request.PageParams;
 import com.github.zuihou.business.operationManagementCenter.entity.Order;
 import com.github.zuihou.business.operationManagementCenter.entity.Plan;
@@ -19,13 +16,11 @@ import com.github.zuihou.business.operationManagementCenter.service.PlanService;
 import com.github.zuihou.business.operationManagementCenter.service.TaskService;
 import com.github.zuihou.business.productionReadyCenter.dao.AAutoNodeLogMapper;
 import com.github.zuihou.business.productionReadyCenter.entity.AAutoNodeLog;
-import com.github.zuihou.business.productionReadyCenter.service.AAutoNodeLogService;
 import com.github.zuihou.business.productionResourceCenter.entity.Repair;
 import com.github.zuihou.business.productionResourceCenter.entity.ZZone;
 import com.github.zuihou.business.productionResourceCenter.service.RepairService;
 import com.github.zuihou.business.productionResourceCenter.service.ZZoneService;
 import com.github.zuihou.business.websocket.WebSocketServer;
-import com.github.zuihou.common.util.DateUtil;
 import com.github.zuihou.common.util.StringUtil;
 import com.github.zuihou.context.BaseContextConstants;
 import com.github.zuihou.context.BaseContextHandler;
@@ -33,10 +28,7 @@ import com.github.zuihou.database.mybatis.auth.DataScope;
 import com.github.zuihou.database.mybatis.conditions.Wraps;
 import com.github.zuihou.database.mybatis.conditions.query.LbqWrapper;
 import com.github.zuihou.database.mybatis.conditions.query.QueryWrap;
-import com.github.zuihou.exception.BizException;
-import com.github.zuihou.exception.code.ExceptionCode;
-import com.github.zuihou.jwt.utils.JwtUtil;
-import com.github.zuihou.security.model.SysUser;
+import com.github.zuihou.jwt.TokenUtil;
 import com.github.zuihou.utils.Charsets;
 import com.github.zuihou.utils.DateUtils;
 import com.google.common.collect.Maps;
@@ -46,18 +38,15 @@ import io.jsonwebtoken.Jwts;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.scheduling.annotation.Scheduled;
-
 import org.springframework.stereotype.Component;
 import org.springframework.web.client.RestTemplate;
 
 import javax.annotation.Resource;
 import javax.websocket.Session;
-
 import java.lang.reflect.Field;
 import java.lang.reflect.ParameterizedType;
 import java.util.*;
@@ -93,6 +82,9 @@ public class DashboardJob {
     @Autowired
     private AAutoNodeLogMapper aAutoNodeLogMapper;
 
+    @Autowired
+    private TokenUtil tokenUtil;
+
     @Value("${zuihou.database.tenantDatabasePrefix}")
     private String database;
 
@@ -118,8 +110,6 @@ public class DashboardJob {
         String pushMsg = null;
         try {
             DataScope datascope = new DataScope();
-            datascope.setUserId(Long.parseLong(userid));
-
             Map<String, Map<String, Object>> dataScreenMap = new HashMap<String, Map<String, Object>>();
             Map zoneData = Maps.newHashMap();
             zoneData.put("resourceStatus", "1");
@@ -167,16 +157,16 @@ public class DashboardJob {
             orderMap.put("orderData", orderData);
             dataScreenMap.put("orderMap", orderMap);
 
-            QueryWrap repairWrap = this.handlerWrapper(null, params);
-            LbqWrapper repairWrapper = orderWrap.lambda();
-
-            IPage<Repair> repairData = repairService.pageList(new Page<Repair>(), wrapper);
+            Page<Repair> repairPage = new Page<Repair>(1L, 5);
+            repairPage.setSearchCount(false);
+            IPage<Repair> repairData = repairService.pageList(repairPage, new LbqWrapper<Repair>());
 
             Map repairMap = Maps.newHashMap();
             repairMap.put("repairData", repairData);
             dataScreenMap.put("repairMap", repairMap);
 
             //警报数据
+            datascope.setUserId(Long.parseLong(userid));
             QueryWrap<AAutoNodeLog> warnWrap = this.handlerWrapper(null, params);
             LbqWrapper<AAutoNodeLog> warnWrapper = warnWrap.lambda();
             //Date start = new Date();
@@ -264,4 +254,5 @@ public class DashboardJob {
             }
         }
     }
+
 }

+ 1 - 1
imcs-admin-boot/imcs-business-biz/src/main/resources/mapper_business/base/productionResourceCenter/RepairMapper.xml

@@ -20,7 +20,7 @@
     <!-- 通用查询结果列 -->
     <sql id="Base_Column_List">
         id,create_time,create_user,update_time,update_user,
-        productionresource_id,repair_end_time,repair_status,status,remark,code,productionresourceName,GROUP_CONCAT(lineDesc) AS lineDesc,process,downTime,operationName,expireFlag,GROUP_CONCAT(org_id) AS org_id
+        productionresource_id,repair_end_time,repair_status,status,remark,code,productionresourceName, lineDesc,process,downTime,operationName,expireFlag,org_id
     </sql>
 
     <!-- 分页 -->