From 4e2e52b766d87fc528d02bdebc1757c3dda8c596 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期三, 26 二月 2025 09:22:24 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java |   89 ++++++++++++++++++++++++++++++++++++++------
 1 files changed, 76 insertions(+), 13 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 a4f79cd..f356c7c 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
@@ -19,28 +19,21 @@
 import com.doumee.core.utils.DateUtil;
 import com.doumee.core.utils.Utils;
 import com.doumee.dao.business.*;
+import com.doumee.dao.business.dao.MemberMapper;
 import com.doumee.dao.business.join.VisitsJoinMapper;
 import com.doumee.dao.business.model.*;
+import com.doumee.dao.business.model.Member;
 import com.doumee.dao.web.reqeust.SavePlatformWarnEventDTO;
-import com.doumee.service.business.PlatformJobService;
 import com.doumee.service.business.impl.PlatformWarnEventServiceImpl;
 import com.github.yulichang.wrapper.MPJLambdaWrapper;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
-import org.apache.http.HttpEntity;
-import org.apache.http.HttpResponse;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.impl.client.HttpClientBuilder;
-import org.apache.http.util.EntityUtils;
-import org.checkerframework.checker.units.qual.C;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
 import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -467,7 +460,6 @@
      *  鏍规嵁璁垮鎺ㄩ�佽瀹㈣褰曠紪鐮侊紝澶勭悊璁垮璁板綍銆佸湪鍦轰汉鍛樼瓑淇℃伅
      */
     private void dealVisitDataByRequstIccm(EventVisitIccmInfoRequest request, List<Integer> delRetentionLis, List<Retention> retentionList,  InoutDayCount inoutDayCount) {
-
         EventVisitIccmDataRequest model = request.getData();
         EventVisitIccmInvoiceParamRequest data =  request.getData().getVisitorInvoices();
         MPJLambdaWrapper<Visits> queryWrapper = new MPJLambdaWrapper<>();
@@ -486,7 +478,7 @@
             updateVistis.setId(visits.getId());
             if (Constants.formatIntegerNum(request.getEventType()) == HKConstants.EventTypes.VISIT_SIGN_ICCM_IN.getKey()) {
                 //濡傛灉鏄瀹㈢櫥璁帮紝褰曞叆浜哄憳鐨勫湪鍦烘暟鎹褰�
-//                retentionList.add(getRetentionModelByVisitRequest(visits, request.getHappenTime(),request.getSrcType()));
+                //retentionList.add(getRetentionModelByVisitRequest(visits, request.getHappenTime(),request.getSrcType()));
                 //鏉ヨ鏃堕棿
                 if(Constants.equalsInteger(visits.getStatus(),Constants.VisitStatus.xfSuccess)){
                     inoutDayCount.setSigninVisitorNum(Constants.formatIntegerNum(inoutDayCount.getSigninVisitorNum())+1);
@@ -509,6 +501,7 @@
                     updateVistis.setOutType(Constants.ZERO);
                     updateVistis.setOutInfo("璁垮姝e父绛剧");
                 }
+                delRetentionLis.add(visits.getMemberId());
             }else{
                 //濡傛灉浜哄憳淇℃伅瀛樺湪锛屽垏鏄瀹㈤�氳锛屽垯鍒犻櫎涔嬪墠鐨勬墍鏈夎繘鍦烘暟鎹紙鏃犺姝ゆ鎺ㄩ�佹槸杩涘巶杩樻槸鍑哄満鎺ㄩ�佷簨浠讹級
                 delRetentionLis.add(visits.getMemberId());
@@ -568,6 +561,15 @@
         event.setCreateDate(DateUtil.getISO8601DateByStr2(request.getHappenTime()));
         if(event.getCreateDate() == null){
             event.setCreateDate(new Date());
+        }
+        if (Constants.formatIntegerNum(request.getEventType()) == HKConstants.EventTypes.VISIT_SIGN_ICCM_PASS.getKey())  {
+            //濡傛灉鏄瀹㈤�氳浜嬩欢,杩涘叆杩涘嚭浜嬩欢
+            if(request.getData()!=null&&request.getData().getParamValues()!=null &&
+                    StringUtils.equals(request.getData().getParamValues().getInOrOut(),"0")){
+                event.setInOrOut("0");//杩�
+            }else{
+                event.setInOrOut("1");//鍑�
+            }
         }
         event.setVisitorWorkUint(detail.getUnit());
         event.setVisitorId(detail.getVisitorId());
@@ -823,7 +825,7 @@
         event.setEventCmd(request.getData().getEventCmd());
         event.setCardNo(request.getData().getCardNo());
         event.setCarAttributeName(request.getData().getCarAttributeName());
-
+        event.setCarType(Constants.RetentionCarType.unknown);//榛樿鏈櫥璁拌溅杈�
         if(request.getData().getInResult()!=null && request.getData().getInResult().getRlsResult() !=null ){
             //鏀捐鏂瑰紡
             event.setReleaseWay(request.getData().getInResult().getRlsResult().getReleaseWay());
@@ -1083,13 +1085,24 @@
                         .selectAs(Platform::getName,PlatformJob::getPlatformName)
                         .selectAs(Platform::getLedContent,PlatformJob::getLedContent)
                         .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(PlatformJob::getIsdeleted,Constants.ZERO )
                         .eq(PlatformJob::getPlatformId,model.getPlatformId() )
                         .orderByDesc(PlatformJob::getCallDate)
                         .last("limit 1 "));
                 if(job == null){
+                    if(StringUtils.equals(status.getMotionStatus(),"enter")){
+                        //濡傛灉鏈堝彴褰撳墠娌′綔涓氾紝鐩存帴鎻愮ず杞﹁締鍋滈敊
+                        Platform platform = platformMapper.selectJoinOne(Platform.class, new MPJLambdaWrapper<Platform>()
+                                .selectAll(Platform.class)
+                                .eq(Platform::getIsdeleted,Constants.ZERO )
+                                .eq(PlatformJob::getId,model.getPlatformId() )
+                                .last("limit 1 "));
+                        if(platform!=null){
+                            dealCarsAndPlatformErrorBiz(platform,status);
+                        }
+                    }
                     continue;//濡傛灉浣滀笟涓虹┖锛岃烦杩囧鐞�
                 }
                 PlatformJob update = new PlatformJob();
@@ -1337,6 +1350,56 @@
             platformBroadcastLogMapper.insert(logList);
         }
     }
+    private void dealCarsAndPlatformErrorBiz( Platform model, EventPlatformCarsStatusInfoRequest status) {
+        //澶勭悊杞﹁締杩涘叆閿欒鏈堝彴涓氬姟閫昏緫
+        SavePlatformWarnEventDTO savePlatformWarnEventDTO = new SavePlatformWarnEventDTO();
+        savePlatformWarnEventDTO.setPlatformJobId(model.getId());
+        savePlatformWarnEventDTO.setPlatformId(model.getId());
+        savePlatformWarnEventDTO.setCarCode(status.getPlateNo());
+        savePlatformWarnEventDTO.setEventType(Constants.PlatformWarnEvent.STOP_ERROR.getKey());
+        platformWarnEventService.savePlatformWarnEvent(savePlatformWarnEventDTO);
+
+        int speed = 13;
+        try {
+            speed = Integer.parseInt(systemDictDataBiz.queryByCode(Constants.HK_PARAM,Constants.LED_CONTENT_SPEED).getCode());
+        }catch (Exception e){
+
+        }
+        List<PlatformDevice> deviceList = platformDeviceMapper.selectList(new QueryWrapper<PlatformDevice>().lambda()
+                .eq(PlatformDevice::getPlatformId,model.getId())
+                .eq(PlatformDevice::getIsdeleted,Constants.ZERO));
+        if(deviceList ==null || deviceList.size() == 0){
+            return;
+        }
+        String content =Constants.PlatformLedContent.WRONG_IN.getInfo();
+        content = content.replace("${param2}",model.getName());
+        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.isBlank(device.getHkId())){
+                continue;
+            }
+            if(Constants.equalsInteger(device.getType(),Constants.TWO)){
+                //濡傛灉鏄箍鎾偣
+                bNames += device.getName()+";";
+                broadcastList.add(device.getHkId());
+            }
+        }
+        if(broadcastList.size()>0){
+            PlatformJob job = new PlatformJob();
+            job.setId(-1);
+            job.setCarCodeFront(status.getPlateNo());
+            job.setPlatformId(model.getId());
+            PlatformBroadcastLog log = dealBroadcastBiz(job,broadcastList,bNames,Constants.PlatformBroadcastContent.WRONG_IN.getInfo().replace("${param}",status.getPlateNo()));
+            logList.add(log);
+        }
+        if(logList.size()>0){
+            platformBroadcastLogMapper.insert(logList);
+        }
+    }
 
     /**
      * 骞挎挱閫氱煡

--
Gitblit v1.9.3