From bdbc59fad455abbe7a13c8017e71c3db96420444 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 10 十二月 2024 18:22:58 +0800
Subject: [PATCH] 最新版本541200007

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java |   23 +++++++++++++++++++----
 1 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java
index f8d9293..c184c0e 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/PlatformJobServiceImpl.java
@@ -49,6 +49,7 @@
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -57,6 +58,7 @@
 import java.math.RoundingMode;
 import java.util.*;
 import java.util.Date;
+import java.util.concurrent.TimeUnit;
 import java.util.stream.Collectors;
 
 /**
@@ -116,6 +118,8 @@
     @Autowired
     private EmayService emayService;
 
+    @Autowired
+    private RedisTemplate<String, Object> redisTemplate;
     @Autowired
     private PlatformBroadcastLogMapper platformBroadcastLogMapper;
     @Autowired
@@ -1431,10 +1435,19 @@
         return platformJob;
     }
 
-
-    /**
-     * 瀹屾垚浣滀笟
-     */
+    public PlatformJob getLastWaitJob(String uuid, LoginUserInfo loginUser){
+        String u = (String) redisTemplate.opsForValue().get(Constants.RedisKeys.BIGSCREEN_UUID);
+        if(!StringUtils.equals(u,uuid)){
+            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"瀵逛笉璧凤紝浜岀淮鐮佸凡澶辨晥锛�");
+        }
+        PlatformJob platformJob =  platformJobMapper.selectOne(new QueryWrapper<PlatformJob>().lambda()
+                .eq(PlatformJob::getDrivierPhone,loginUser.getMobile())
+                .eq(PlatformJob::getIsdeleted,Constants.ZERO)
+                .eq(PlatformJob::getStatus,Constants.PlatformJobStatus.WART_SIGN_IN.getKey())
+                .orderByDesc(PlatformJob::getCreateDate)
+                .last(" limit 1 ") );
+            return platformJob;
+    }
     @Override
     @Transactional(rollbackFor = {Exception.class,BusinessException.class})
     public PlatformJob finishWork(JobOperateDTO jobOperateDTO){
@@ -2108,6 +2121,8 @@
             List<PlatformJob> calledList = platformJobList.stream().filter(i->Constants.equalsInteger(i.getStatus(),Constants.PlatformJobStatus.CALLED.getKey())).collect(Collectors.toList());
             largeScreenDataVO.setWaitWorkList(calledList);
         }
+        String u =  UUID.randomUUID().toString();
+        redisTemplate.opsForValue().set(Constants.RedisKeys.BIGSCREEN_UUID,u,3, TimeUnit.MINUTES);
         largeScreenDataVO.setQrCode(systemDictDataBiz.queryByCode(Constants.PLATFORM,Constants.SIGN_IN_QRCODE).getCode());
         return largeScreenDataVO;
 

--
Gitblit v1.9.3