From 51e18e190dafdec70dc1f4a3a9ecd76fb2116726 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期六, 12 十月 2024 16:25:08 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java |   56 +++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 39 insertions(+), 17 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java
index 202db3a..0047699 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java
@@ -414,7 +414,7 @@
                 member.setLastVisitDate(updateVistis.getInDate());
                 member.setId(visits.getMemberId());
                 memberMapper.updateById(member);
-            }else  if (Constants.formatIntegerNum(request.getEventType()) == HKConstants.EventTypes.VISIT_SIGN_ICCM_OUT.getKey())  {
+            }else if (Constants.formatIntegerNum(request.getEventType()) == HKConstants.EventTypes.VISIT_SIGN_ICCM_OUT.getKey())  {
                 //濡傛灉鏄瀹㈢绂讳簨浠�
                 updateVistis.setStatus(Constants.VisitStatus.signout);
                 updateVistis.setInDate(DateUtil.getISO8601DateByStr(data.getBeginTime()));
@@ -427,7 +427,6 @@
             updateVistis.setEditDate(new Date());
             //鏇存柊璁垮鏉ヨ鎴栬�呯绂绘椂闂翠俊鎭�
             visitsMapper.updateById(updateVistis) ;
-
         }
     }
     private Retention getRetentionModelByVisitRequest(Visits visits, String happentTime,String srcType) {
@@ -888,9 +887,11 @@
                         .selectAll(PlatformJob.class)
                         .selectAs(Platform::getName,PlatformJob::getPlatformName)
                         .leftJoin(Platform.class,Platform::getId,PlatformJob::getPlatformId)
-                        .eq(StringUtils.equals(status.getStockStatus(),"front"),PlatformJob::getCarCodeFront,status.getPlateNo() )//鍓嶈溅鐗屽彿
-                        .eq(!StringUtils.equals(status.getStockStatus(),"front"),PlatformJob::getCarCodeBack,status.getPlateNo() )//鍚庤溅鐗屽彿
+//                        .eq(StringUtils.equals(status.getStockStatus(),"front"),PlatformJob::getCarCodeFront,status.getPlateNo() )//鍓嶈溅鐗屽彿
+//                        .eq(!StringUtils.equals(status.getStockStatus(),"front"),PlatformJob::getCarCodeBack,status.getPlateNo() )//鍚庤溅鐗屽彿
                         .eq(PlatformJob::getIsdeleted,Constants.ZERO )
+                        .eq(PlatformJob::getPlatformId,model.getPlatformId() )
+                        .orderByDesc(PlatformJob::getCallDate)
                         .last("limit 1 "));
                 if(job == null){
                     continue;//濡傛灉浣滀笟涓虹┖锛岃烦杩囧鐞�
@@ -915,16 +916,36 @@
                     //濡傛灉鏄鍦ㄤ綔涓氱殑鐘舵�侊紝鏍囪浣滀笟宸插畬鎴�
                     update.setStatus(Constants.PlatformJobStatus.DONE.getKey());//浣滀笟宸插畬鎴�
                     update.setDoneDate(update.getEditDate());*/
+                    if(Constants.equalsInteger(job.getStatus(),Constants.PlatformJobStatus.DONE.getKey()) ||
+                            Constants.equalsInteger(job.getStatus(),Constants.PlatformJobStatus.AUTHED_LEAVE.getKey())){
+                        if(((StringUtils.equals(status.getStockStatus(),"front") && StringUtils.equals(job.getCarCodeFront(),status.getPlateNo()))
+                                ||(!StringUtils.equals(status.getStockStatus(),"front") && StringUtils.equals(job.getCarCodeBack(),status.getPlateNo()))
+                        )){
+                            //璇存槑杞﹁締杩涢敊鏈堝彴 鎴栬�呰繕鏈彨鍙风姸鎬侊紝鍙戣捣璀﹀憡
+//                          dealCarsInErrorPlatformBiz(job,status);
+                            update.setInOut(Constants.ZERO);//杞﹁締宸茬粡绂诲紑
+                            platformJobMapper.updateById(update);
+                        }
+                    }
                 }else  if(StringUtils.equals(status.getMotionStatus(),"enter")){
                     //濡傛灉鏄溅杈嗚繘鍏�
-                    if(job ==null || !Constants.equalsInteger(job.getStatus(),Constants.PlatformJobStatus.CALLED.getKey())){
-                        //璇存槑杞﹁締杩涢敊鏈堝彴 鎴栬�呰繕鏈彨鍙风姸鎬侊紝鍙戣捣璀﹀憡
-                        dealCarsInErrorPlatformBiz(job,status);
+                    if(Constants.equalsInteger(job.getStatus(),Constants.PlatformJobStatus.CALLED.getKey())){
+                        if(!((StringUtils.equals(status.getStockStatus(),"front") && StringUtils.equals(job.getCarCodeFront(),status.getPlateNo()))
+                                ||(!StringUtils.equals(status.getStockStatus(),"front") && StringUtils.equals(job.getCarCodeBack(),status.getPlateNo()))
+                        )){
+                            //璇存槑杞﹁締杩涢敊鏈堝彴 鎴栬�呰繕鏈彨鍙风姸鎬侊紝鍙戣捣璀﹀憡
+                            dealCarsInErrorPlatformBiz(job,status);
+                        }else{
+                            //杞﹁締宸茬粡杩涘叆
+                            update.setInOut(Constants.ONE);//杞﹁締宸茬粡杩涘叆
+                            platformJobMapper.updateById(update);
+                        }
                     }
-                    if(job.getStartDate() == null){
+                    /*if(job.getStartDate() == null){
                         update.setStartDate(update.getEditDate());
                     }
                     update.setStatus(Constants.PlatformJobStatus.WORKING.getKey());//寮�濮嬩綔涓�
+                    */
                 }else{
                     continue;//鍏朵粬鐘舵�佷笉澶勭悊锛岃烦杩�
                 }
@@ -1053,29 +1074,29 @@
             return;
         }
         String content =Constants.PlatformLedContent.WRONG_IN.getInfo();
-        content = content.replace("${param}",model.getPlatformName());
-        content = content.replace("${param2}",model.getCarCodeFront());
+        content = content.replace("${param2}",model.getPlatformName());
+        content = content.replace("${param}",status.getPlateNo());
         List<String> broadcastList = new ArrayList<>();
         List<String> ledList = new ArrayList<>();
         String bNames = "";
         List<PlatformBroadcastLog> logList = new ArrayList<>();
         for(PlatformDevice device : deviceList){
-            if(StringUtils.isNotBlank(device.getHkId())){
+            if(StringUtils.isBlank(device.getHkId())){
                 continue;
             }
             if(Constants.equalsInteger(device.getType(),Constants.ZERO)){
                 //濡傛灉鏄疞ED
-                PlatformBroadcastLog log = dealLedContentBiz(device.getHkNo(),device.getName(),content,speed,1);
+                PlatformBroadcastLog log = dealLedContentBiz(model.getId(),device.getHkNo(),device.getName(),content,speed,1);
                 logList.add(log);
                 ledList.add(device.getHkId());
-            }else  if(Constants.equalsInteger(device.getType(),Constants.ZERO)){
+            }else  if(Constants.equalsInteger(device.getType(),Constants.TWO)){
                 //濡傛灉鏄箍鎾偣
                 bNames += device.getName()+";";
                 broadcastList.add(device.getHkId());
             }
         }
         if(broadcastList.size()>0){
-            PlatformBroadcastLog log = dealBroadcastBiz(model,broadcastList,bNames,Constants.PlatformBroadcastContent.WRONG_IN.getInfo());
+            PlatformBroadcastLog log = dealBroadcastBiz(model,broadcastList,bNames,Constants.PlatformBroadcastContent.WRONG_IN.getInfo().replace("${param}",status.getPlateNo()));
             logList.add(log);
         }
         if(logList.size()>0){
@@ -1094,7 +1115,7 @@
     public static PlatformBroadcastLog dealBroadcastBiz(PlatformJob model, List<String> broadcastList,String bNames , String content1) {
         PlatformBroadcastLog log = new PlatformBroadcastLog();
         content1 = content1.replace("${param}",model.getCarCodeFront());
-
+        log.setObjId(model.getId().toString());
         log.setCreateDate(new Date());
         log.setBizType(Constants.ONE);
         log.setHkDate(new Date());
@@ -1118,12 +1139,12 @@
             log.setHkInfo("璇锋眰鎴愬姛");
             log.setHkStatus(Constants.TWO);
         }
-        log.setDeviceType(Constants.ONE);
+        log.setDeviceType(Constants.ZERO);
         log.setName("鍙戦�佸箍鎾挱鎶ュ唴瀹�");
         return  log;
     }
 
-    public static PlatformBroadcastLog dealLedContentBiz(String hkNo,String hkName, String content,int speed,int color) {
+    public static PlatformBroadcastLog dealLedContentBiz(Integer platformId,String hkNo,String hkName, String content,int speed,int color) {
         PlatformBroadcastLog log = new PlatformBroadcastLog();
         log.setCreateDate(new Date());
         log.setBizType(Constants.ONE);
@@ -1133,6 +1154,7 @@
         log.setRemark(hkName);
         log.setInfo(content);
         log.setNum(Constants.ONE);
+        log.setObjId(platformId.toString());
 
         TransparentChannelBodyRequest body = new TransparentChannelBodyRequest();
         TransparentChannelHeadRequest head = new TransparentChannelHeadRequest();

--
Gitblit v1.9.3