From ca6e546a02c7c168263ba057ea51369ba44eb3cc Mon Sep 17 00:00:00 2001
From: ZengTao <2773468879@qq.com>
Date: 星期二, 06 八月 2024 11:01:01 +0800
Subject: [PATCH] Merge branch 'master' of http://bore.pub:10439/r/HangZhouMes

---
 hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java |   29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java
index adf8d51..2877e21 100644
--- a/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java
+++ b/hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/job/Downpush.java
@@ -2,13 +2,18 @@
 
 import cn.hutool.json.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.mes.common.config.Const;
+import com.mes.common.utils.RedisUtil;
 import com.mes.downglassinfo.entity.DownGlassInfo;
+import com.mes.downglassinfo.entity.request.DownGlassInfoRequest;
 import com.mes.downglassinfo.service.DownGlassInfoService;
 import com.mes.downstorage.service.DownStorageCageService;
 import com.mes.downworkstation.entity.DownWorkstation;
 import com.mes.downworkstation.service.DownWorkstationService;
 import com.mes.tools.WebSocketServer;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
@@ -28,6 +33,9 @@
     private DownStorageCageService downStorageCageService;
     @Autowired
     private DownGlassInfoService downGlassInfoService;
+
+    @Autowired
+    private RedisUtil redisUtil;
 
     @Scheduled(fixedDelay = 2000)
     public void sendDownWorkstations() {
@@ -101,13 +109,26 @@
 
     @Scheduled(fixedDelay = 2000)
     public void sendDownGlassInfo() {
+        DownGlassInfoRequest request = redisUtil.getCacheObject("downGlassRequest");
+        if (null == request) {
+            request = new DownGlassInfoRequest();
+        }
         log.info("鍙戦�佸綋鍓嶆鍦ㄦ墽琛屽伐绋嬪凡钀芥灦鐨勭幓鐠冧俊鎭�");
-        List<DownGlassInfo> downGlassInfos = downGlassInfoService.list(new LambdaQueryWrapper<DownGlassInfo>()
-                .inSql(DownGlassInfo::getEngineerId, "select engineer_id from engineering where state = 1"));
+        LambdaQueryWrapper<DownGlassInfo> wrapper = new LambdaQueryWrapper<DownGlassInfo>()
+                .between(null != request.getBeginDate(), DownGlassInfo::getGmtCreate, request.getBeginDate(), request.getEndDate())
+                .eq(StringUtils.isNotBlank(request.getEngineerId()), DownGlassInfo::getEngineerId, request.getEngineerId());
+        if (null == request.getWorkStationId() || 0 == request.getWorkStationId()) {
+            wrapper.in(DownGlassInfo::getWorkStationId, Const.WORK_STATION_ALL);
+        } else {
+            wrapper.eq(DownGlassInfo::getWorkStationId, request.getWorkStationId());
+        }
+        List<DownGlassInfo> downGlassInfos = downGlassInfoService.list(wrapper);
         Map<Integer, List<DownGlassInfo>> listMap = downGlassInfos.stream().collect(Collectors.groupingBy(DownGlassInfo::getWorkStationId));
+        List<Object> engineerIdListTemp = downGlassInfoService.listObjs(new QueryWrapper<DownGlassInfo>().select("distinct engineer_id"));
+        List<String> engineerIdList = engineerIdListTemp.stream().map(String::valueOf).collect(Collectors.toList());
         JSONObject jsonObject4 = new JSONObject();
-        List<Map<String, Object>> list = downStorageCageService.selectDownStorageCages();
-        jsonObject4.append("sendDownGlass", listMap);
+        jsonObject4.append("downGlassInfos", listMap);
+        jsonObject4.append("engineerIdList", engineerIdList);
         ArrayList<WebSocketServer> sendwServer4 = WebSocketServer.sessionMap.get("unloadglass");
         if (sendwServer4 != null) {
             for (WebSocketServer webserver : sendwServer4) {

--
Gitblit v1.8.0