From d3df1630ad3e1c71b61d177ee818d5c5c94e97c0 Mon Sep 17 00:00:00 2001
From: wangfei <3597712270@qq.com>
Date: 星期六, 11 十月 2025 18:45:29 +0800
Subject: [PATCH] Merge branch 'master' of http://10.153.19.25:10105/r/YiWuProject

---
 hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java |   53 +++++++++++++++++++++++++++++++++--------------------
 1 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
index 2de2d63..1a8c6d6 100644
--- a/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
+++ b/hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
@@ -35,6 +35,7 @@
 import freemarker.template.Version;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -97,6 +98,12 @@
     }
 
     @Override
+    public Boolean priorityHollowSwitch(Boolean flag) {
+        redisUtil.setCacheObject("priorityHollowSwitch", flag);
+        return redisUtil.getCacheObject("priorityHollowSwitch");
+    }
+
+    @Override
     public List<String> hollowTaskList(int cell) {
         //鏌ヨ浠诲姟琛ㄤ腑鏈潯绾挎墍鏈夋湭瀹屾垚鐨勪换鍔′俊鎭�
         List<HollowGlassOutRelationInfo> list = this.list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
@@ -109,44 +116,44 @@
     }
 
     @Override
-    public List<HollowGlassQueueInfo> appointHollowTaskDetails(String flowCardId, int cell) {
+    public Map<String, List<HollowGlassQueueInfo>> appointHollowTaskDetails(int cell) {
         //鎸夌収娴佺▼鍗″強璺嚎锛屾煡鎵惧搴旂殑浠诲姟淇℃伅
-        HollowGlassOutRelationInfo hollowGlassOutRelationInfo = this.getOne(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
+        List<HollowGlassOutRelationInfo> hollowGlassOutRelationInfos = this.list(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
                 .in(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_NEW, Const.HOLLOW_FLOW_CARD_START, Const.HOLLOW_FLOW_CARD_PAUSE)
-                .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId)
-                .eq(HollowGlassOutRelationInfo::getCell, cell).last("limit 1"));
-        if (null == hollowGlassOutRelationInfo) {
-            return new ArrayList<HollowGlassQueueInfo>();
+                .eq(HollowGlassOutRelationInfo::getCell, cell));
+        if (CollectionUtil.isEmpty(hollowGlassOutRelationInfos)) {
+            return null;
         }
+        List<Long> ids = hollowGlassOutRelationInfos.stream()
+                .map(HollowGlassOutRelationInfo::getId) // 鎻愬彇姣忎釜鍏冪礌鐨刬d
+                .collect(Collectors.toList());
         //鎸夌収浠诲姟id鏌ヨ瀵瑰垪琛ㄤ腑鐨勯槦鍒椾俊鎭�
-        return hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>()
-                .eq(HollowGlassQueueInfo::getRelationId, hollowGlassOutRelationInfo.getId()));
+        List<HollowGlassQueueInfo> hollowGlassQueueInfos = hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>()
+                .in(HollowGlassQueueInfo::getRelationId, ids)
+                .orderByAsc(HollowGlassQueueInfo::getId));
+        Map<String, List<HollowGlassQueueInfo>> groupedByFlowCardId = hollowGlassQueueInfos.stream()
+                .collect(Collectors.groupingBy(
+                        HollowGlassQueueInfo::getFlowCardId,
+                        LinkedHashMap::new,
+                        Collectors.toList()
+                ));
+        return groupedByFlowCardId;
     }
 
     @Override
-    public Boolean startTask(String flowCardId, int cell) {
-        log.info("鏌ョ湅璇ユ祦绋嬪崱鏄惁鐢辨鍦ㄦ墽琛岀殑浠诲姟锛屾祦绋嬪崱锛歿}", flowCardId);
-        int taskCount = this.count(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
-                .in(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_NEW, Const.HOLLOW_FLOW_CARD_START, Const.HOLLOW_FLOW_CARD_PAUSE)
-                .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId));
-        if (taskCount == 0 || taskCount > 1) {
-            log.info("璇ユ祦绋嬪崱涓嶅瓨鍦ㄤ换鍔℃垨鑰呮湁姝e湪鎵ц涓紝鏃犳硶鍐嶆鎵ц");
-            return Boolean.FALSE;
-        }
+    public Boolean startTask(int cell) {
         //鏇存柊浠诲姟鐘舵�佷负寮�濮�
         return this.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>()
                 .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
-                .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId)
                 .ne(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_SUCCESS)
                 .eq(HollowGlassOutRelationInfo::getCell, cell));
     }
 
     @Override
-    public Boolean pauseTask(String flowCardId, int cell) {
+    public Boolean pauseTask(int cell) {
 //        鏇存柊浠诲姟鐘舵�佷负鏆傚仠
         return this.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>()
                 .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_PAUSE)
-                .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId)
                 .ne(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_SUCCESS)
                 .eq(HollowGlassOutRelationInfo::getCell, cell));
     }
@@ -336,6 +343,12 @@
         return this.page(page, wrapper);
     }
 
+    @Override
+    @Cacheable(value = "orderDetails", key = "#flowCardId")
+    public OrderDetailsDTO queryProductNameByFlowCardId(String flowCardId) {
+        log.info("鏌ヨ鏁版嵁搴撲竴娆★細{}", flowCardId);
+        return baseMapper.queryProductNameByFlowCardId(flowCardId);
+    }
 
     private HollowGlassOutRelationInfo childrenTask(HollowTaskRequest request, int isForce) {
         GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getFlowCardId, request.getFlowCardId()).last("limit 1"));

--
Gitblit v1.8.0