Просмотр исходного кода

Merge remote-tracking branch 'origin/master'

ouyj 6 месяцев назад
Родитель
Сommit
010c5ba349

+ 9 - 3
ygtx-admin/src/main/java/com/ygtx/web/controller/monitor/CacheController.java

@@ -24,7 +24,7 @@ import com.ygtx.system.domain.SysCache;
 
 /**
  * 缓存监控
- * 
+ *
  * @author ruoyi
  */
 @RestController
@@ -43,6 +43,7 @@ public class CacheController
         caches.add(new SysCache(CacheConstants.REPEAT_SUBMIT_KEY, "防重提交"));
         caches.add(new SysCache(CacheConstants.RATE_LIMIT_KEY, "限流处理"));
         caches.add(new SysCache(CacheConstants.PWD_ERR_CNT_KEY, "密码错误次数"));
+        caches.add(new SysCache(CacheConstants.NOTIFY_KEY, "通知数量"));
     }
 
     @PreAuthorize("@ss.hasPermi('monitor:cache:list')")
@@ -88,8 +89,13 @@ public class CacheController
     @GetMapping("/getValue/{cacheName}/{cacheKey}")
     public AjaxResult getCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey)
     {
-        String cacheValue = redisTemplate.opsForValue().get(cacheKey);
-        SysCache sysCache = new SysCache(cacheName, cacheKey, cacheValue);
+        SysCache sysCache;
+        if(cacheName.equals("NOTIFY:")){
+            sysCache = new SysCache(cacheName, cacheKey, redisTemplate.opsForList().index(cacheKey, 0));
+        }else{
+            String cacheValue = redisTemplate.opsForValue().get(cacheKey);
+            sysCache = new SysCache(cacheName, cacheKey, cacheValue);
+        }
         return AjaxResult.success(sysCache);
     }
 

+ 4 - 1
ygtx-common/src/main/java/com/ygtx/common/constant/CacheConstants.java

@@ -2,7 +2,7 @@ package com.ygtx.common.constant;
 
 /**
  * 缓存的key 常量
- * 
+ *
  * @author ruoyi
  */
 public class CacheConstants
@@ -41,4 +41,7 @@ public class CacheConstants
      * 登录账户密码错误次数 redis key
      */
     public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:";
+
+    public static final String NOTIFY_KEY = "NOTIFY:";
+    public static final String NOTIFY_STORAGE_KEY= "NOTIFY:STORAGE:USER_TASK_";
 }

+ 0 - 3
ygtx-common/src/main/java/com/ygtx/common/constant/UserConstants.java

@@ -89,7 +89,4 @@ public class UserConstants
     public static final String MESSAGE_STATUS_PROCEED = "PROCEED";//已处理
 
     public static final String NO = "N";
-
-    public static final String NOTIFY_KEY="NOTIFY:USER_TASK_";
-    public static final String NOTIFY_STORAGE_KEY="NOTIFY:STORAGE:USER_TASK_";
 }

+ 8 - 1
ygtx-gxt/src/main/java/com/ygtx/gxt/controller/GxtRepairOrderController.java

@@ -8,9 +8,11 @@ import java.util.List;
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
 
+import com.github.pagehelper.util.StringUtil;
 import com.ygtx.common.utils.DictUtils;
 import com.ygtx.gxt.domain.GxtOrderData;
 import com.ygtx.gxt.service.IGxtWorkOrderService;
+import com.ygtx.system.service.ISysConfigService;
 import com.ygtx.system.strategy.AutoCodeUtil;
 import org.springframework.core.io.Resource;
 import org.springframework.core.io.ResourceLoader;
@@ -52,6 +54,8 @@ public class GxtRepairOrderController extends BaseController
     private AutoCodeUtil autoCodeUtil;
     @Autowired
     private IGxtWorkOrderService gxtWorkOrderService;
+    @Autowired
+    private ISysConfigService configService;
 
     /**
      * 查询维修工单列表
@@ -337,9 +341,12 @@ public class GxtRepairOrderController extends BaseController
         result.setRepairPending(gxtRepairOrderService.getUnfinishedOrder());
         result.setWorkPending(gxtWorkOrderService.getUnfinishedOrder());
         result.setHasCenter(gxtWorkOrderService.hasCenter());
+        String num = configService.selectConfigByKey("gxt.order.timeout");
         GxtRepairOrder gxtRepairOrder = new GxtRepairOrder();
         gxtRepairOrder.setWorkOrderStatus("assigned");
-        gxtRepairOrder.setOutTimeParam(30);
+        if (StringUtil.isNotEmpty(num)) {
+            gxtRepairOrder.setOutTimeParam(Integer.valueOf(num));
+        }
         List<GxtRepairOrder> orders = gxtRepairOrderService.selectGxtRepairOrderList(gxtRepairOrder);
         result.setTimeOutNum(orders.size());
         return success(result);

+ 13 - 17
ygtx-gxt/src/main/java/com/ygtx/gxt/controller/mobile/GxtMobileNotifyController.java

@@ -1,24 +1,15 @@
 package com.ygtx.gxt.controller.mobile;
 
-import cn.hutool.json.JSONUtil;
-import com.alibaba.druid.support.json.JSONUtils;
-import com.ygtx.common.annotation.Log;
-import com.ygtx.common.constant.UserConstants;
+import com.ygtx.common.constant.CacheConstants;
 import com.ygtx.common.core.controller.BaseController;
 import com.ygtx.common.core.domain.AjaxResult;
-import com.ygtx.common.core.page.TableDataInfo;
 import com.ygtx.common.core.redis.RedisCache;
-import com.ygtx.common.enums.BusinessType;
 import com.ygtx.common.utils.DateUtils;
 import com.ygtx.gxt.domain.GxtNotifyMessage;
 import com.ygtx.gxt.domain.GxtRepairOrder;
 import com.ygtx.gxt.domain.GxtWorkOrder;
 import com.ygtx.gxt.domain.OrderScoreInfo;
-import com.ygtx.gxt.service.IGxtOrderScoreService;
-import com.ygtx.gxt.service.IGxtRepairOrderService;
-import com.ygtx.gxt.service.IGxtWorkOrderService;
-import io.lettuce.core.dynamic.annotation.Param;
-import io.swagger.models.auth.In;
+import com.ygtx.gxt.service.IGxtOrderMineService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -34,7 +25,7 @@ import java.util.List;
 public class GxtMobileNotifyController extends BaseController
 {
     @Autowired
-    private IGxtOrderScoreService gxtOrderScoreService;
+    private IGxtOrderMineService qxtOrderMineService;
     @Autowired
     private RedisCache redisCache;
     /**
@@ -47,30 +38,35 @@ public class GxtMobileNotifyController extends BaseController
             System.out.println("请求" + DateUtils.getTime());
             if(id != null){
                 GxtRepairOrder repairOrder = new GxtRepairOrder();
-                repairOrder.setWorkOrderStatus("assigned,to_finish,to_approve,suspended");
                 GxtWorkOrder workOrder = new GxtWorkOrder();
-                workOrder.setWorkOrderStatus("assigned,to_finish,to_approve,suspended");
-                List<OrderScoreInfo> orderScoreInfos = gxtOrderScoreService.selectMobileUnionOrderList(id, repairOrder,workOrder, null);
+                List<OrderScoreInfo> orderScoreInfos= qxtOrderMineService.selectUnionOrderListMyTodo(repairOrder, workOrder);
                 boolean isSend = false;
+                boolean isSendBadge = true;
                 int taskNum = 0;
                 if(!orderScoreInfos.isEmpty()){
                     taskNum = orderScoreInfos.size();
-                    Object taskNumStr = redisCache.lGet(UserConstants.NOTIFY_STORAGE_KEY, id);
+                    Object taskNumStr = redisCache.lGet(CacheConstants.NOTIFY_STORAGE_KEY, id);
                     if(taskNumStr!=null){
                         int prevTaskNum = Integer.parseInt(taskNumStr.toString());
                         if(taskNum < prevTaskNum){
                             isSend = true;
                         }
+                        if(taskNum == prevTaskNum){
+                            isSendBadge = false;
+                        }
                     }else{
                         isSend = true;
                     }
-                    redisCache.lPush(UserConstants.NOTIFY_STORAGE_KEY,id, taskNum+"");
+                    redisCache.lPush(CacheConstants.NOTIFY_STORAGE_KEY,id, taskNum+"");
                 }
                 GxtNotifyMessage notifyMessage = new GxtNotifyMessage();
                 if(isSend) {
                     notifyMessage.setTitle(DateUtils.getHourTime() + "收到消息");
                     notifyMessage.setDesc("您有" + taskNum + "个任务待处理");
                 }
+                if(!isSendBadge){
+                    taskNum = -1;
+                }
                 notifyMessage.setNum(taskNum);
                 return success(notifyMessage);
             }

BIN
ygtx-ui/src/assets/images/gxt-release.png


+ 4 - 4
ygtx-ui/src/views/gxt/repairOrder/index.vue

@@ -2394,7 +2394,7 @@ function parseRouteParams(route) {
     // 解密参数
     const decryptedParams = decryptParams(route.query.data);
     if (decryptedParams.timeOutNum !== undefined) {
-      queryParams.value.timeOutNum = decryptedParams.timeOutNum;
+      queryParams.value.outTimeParam = decryptedParams.timeOutNum;
     }
     if (decryptedParams.workOrderStatus !== undefined) {
       queryParams.value.workOrderStatus = decryptedParams.workOrderStatus;
@@ -2405,7 +2405,7 @@ function parseRouteParams(route) {
   } else {
     // 为了向后兼容,也支持原始的参数传递方式
     if (route.query.timeOutNum !== undefined) {
-      queryParams.value.timeOutNum = route.query.timeOutNum;
+      queryParams.value.outTimeParam = route.query.timeOutNum;
     }
     if (route.query.workOrderStatus !== undefined) {
       queryParams.value.workOrderStatus = route.query.workOrderStatus;
@@ -2622,8 +2622,8 @@ function cancel() {
 }
 
 function resetTimeOutOrder() {
-  if (queryParams.value.timeOutNum != null) {
-    queryParams.value.timeOutNum = null;
+  if (queryParams.value.outTimeParam != null) {
+    queryParams.value.outTimeParam = null;
     queryParams.value.workOrderStatus = null;
     queryParams.value.userType = null;
   }

+ 32 - 10
ygtx-ui/src/views/index4.vue

@@ -470,6 +470,7 @@ import { selectHomePageData } from '@/api/gxt/repairOrder';
 import { listAllEquipment } from '@/api/gxt/equipment';
 import { listMyTodo } from '@/api/gxt/orderMine';
 import { encryptParams } from '@/utils/encrypt';
+import { getConfigKey } from '@/api/system/config';
 
 export default {
   name: 'Index4',
@@ -1424,17 +1425,38 @@ export default {
     },
     toRoute(num) {
       if(num==0) {
-        // 加密参数并传递到目标路由页面
-        const params = {
-          timeOutNum: 30,
-          workOrderStatus: 'assigned'
-        };
-        const encryptedParams = encryptParams(params);
-        this.$router.push({
-          path: "/workOrder/repairOrder",
-          query: {
-            data: encryptedParams
+        // 获取系统配置中的超时时间参数
+        getConfigKey("gxt.order.timeout").then(response => {
+          let timeoutValue = 30; // 默认值
+          if (response && response.msg) {
+            timeoutValue = parseInt(response.msg) || 30;
           }
+          
+          // 加密参数并传递到目标路由页面
+          const params = {
+            timeOutNum: timeoutValue,
+            workOrderStatus: 'assigned'
+          };
+          const encryptedParams = encryptParams(params);
+          this.$router.push({
+            path: "/workOrder/repairOrder",
+            query: {
+              data: encryptedParams
+            }
+          });
+        }).catch(() => {
+          // 如果获取配置失败,使用默认值
+          const params = {
+            timeOutNum: 30,
+            workOrderStatus: 'assigned'
+          };
+          const encryptedParams = encryptParams(params);
+          this.$router.push({
+            path: "/workOrder/repairOrder",
+            query: {
+              data: encryptedParams
+            }
+          });
         });
       }else if(num==1) {
         /*if(this.homePageData.repairPending>0 && this.homePageData.workPending==0) {