From 17efddc6a667670dca682bf36b51a43e99615e6d Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期三, 16 十月 2024 15:59:38 +0800
Subject: [PATCH] 代码初始化

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/hksync/HkSyncPushServiceImpl.java |   60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 55 insertions(+), 5 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 db4a384..7143ee1 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
@@ -29,11 +29,11 @@
 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.util.ArrayList;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * 璁垮鏉冮檺缁勪俊鎭〃Service瀹炵幇
@@ -494,7 +494,7 @@
                 delRetentionLis.add(visits.getMemberId());
                 //濡傛灉鏄瀹㈤�氳
                 if(request.getData()!=null&&request.getData().getParamValues()!=null &&
-                        StringUtils.equals(request.getData().getParamValues().getInOrOut(),"1")){
+                        StringUtils.equals(request.getData().getParamValues().getInOrOut(),"0")){
                     //濡傛灉鏄瀹㈢櫥璁帮紝褰曞叆浜哄憳鐨勫湪鍦烘暟鎹褰�
                     Retention r = getRetentionModelByVisitRequest(visits, request.getHappenTime(),request.getSrcType());
                     r.setCarNo(request.getData().getParamValues().getPlateNos());
@@ -505,7 +505,7 @@
                     inoutDayCount.setInVisitorNum(Constants.formatIntegerNum(inoutDayCount.getInVisitorNum())+1);
                 }
                 if(request.getData()!=null&&request.getData().getParamValues()!=null &&
-                         StringUtils.equals(request.getData().getParamValues().getInOrOut(),"2")){
+                         !StringUtils.equals(request.getData().getParamValues().getInOrOut(),"0")){
                     inoutDayCount.setOutVisitorNum(Constants.formatIntegerNum(inoutDayCount.getOutVisitorNum())+1);
                 }
             }
@@ -571,6 +571,7 @@
         event.setPhotoUrl(getHkImgUrl(detail.getFacePic()));
         event.setPersonName(detail.getVisitorName());
         event.setCarNo(detail.getPlateNo());
+        event.setRemark(JSONObject.toJSONString(request));
         event.setInvoicesNo(request.getData().getVisitorInvoices().getInvoicesNo());//璁垮鍗曞彿
         event.setIdType(detail.getCertType());
         String idnum = detail.getCertNo();
@@ -821,6 +822,55 @@
                     .last("limit 1" ));
             if(cars!=null){
                 event.setMemberId(cars.getMemberId());
+                //鑷湁杞�  鏌ヨ褰撳墠鏄惁鏈夊緟绛惧埌鐨勪换鍔�
+                if(carsMapper.selectCount(new QueryWrapper<Cars>()
+                        .lambda().eq(Cars::getCode,event.getPlateNos())
+                        .eq(Cars::getType,Constants.ONE)
+                        .eq(Cars::getIsdeleted,Constants.ZERO)
+                )>Constants.ZERO){
+                    //鏌ヨ杞﹁締褰撳墠鏄惁瀛樺湪杩涜涓殑浠诲姟
+                    if( platformJobMapper.selectCount(new QueryWrapper<PlatformJob>().lambda()
+                            .eq(PlatformJob::getCarCodeFront,event.getPlateNos())
+                            .eq(PlatformJob::getIsdeleted,Constants.ZERO)
+                            .in(PlatformJob::getStatus,
+                                    Constants.PlatformJobStatus.IN_WAIT.getKey(),
+                                    Constants.PlatformJobStatus.CALLED.getKey(),
+                                    Constants.PlatformJobStatus.WORKING.getKey(),
+                                    Constants.PlatformJobStatus.DONE.getKey(),
+                                    Constants.PlatformJobStatus.TRANSFERING.getKey(),
+                                    Constants.PlatformJobStatus.EXCEPTION.getKey(),
+                                    Constants.PlatformJobStatus.AUTHED_LEAVE.getKey()
+                            )
+                    )<Constants.ZERO){
+                        PlatformJob platformJob = platformJobMapper.selectOne(new QueryWrapper<PlatformJob>().lambda()
+                                .eq(PlatformJob::getCarCodeFront,event.getPlateNos())
+                                .eq(PlatformJob::getIsdeleted,Constants.ZERO)
+                                .in(PlatformJob::getStatus,
+                                        Constants.PlatformJobStatus.WAIT_CONFIRM.getKey(),
+                                        Constants.PlatformJobStatus.WART_SIGN_IN.getKey()
+                                )
+                                .orderByAsc(PlatformJob::getCreateDate)
+                                .last(" limit 1")
+                        );
+                        if(Objects.nonNull(platformJob)){
+                            platformJob.setStatus(Constants.PlatformJobStatus.WAIT_CALL.getKey());
+                            platformJob.setArriveDate(new Date());
+                            platformJob.setSingType(Constants.TWO);
+                            platformJob.setSignDate(new Date());
+                            List<PlatformJob> signList = platformJobMapper.selectList(new QueryWrapper<PlatformJob>().lambda().apply(" DATE(SIGN_DATE) = DATE(NOW()) and sign_date is not null  "));
+                            if(CollectionUtils.isEmpty(signList)){
+                                platformJob.setSignNum(Constants.ONE);
+                            } else{
+                                int maxNumber = Collections.max(signList.stream().map(i->i.getSignNum()).collect(Collectors.toList()));
+                                platformJob.setSignNum(maxNumber + Constants.ONE);
+                            }
+                            platformJobMapper.updateById(platformJob);
+                        }
+                    }
+                };
+
+
+
             }else{
                 Visits visits =  visitsMapper.selectOne(new QueryWrapper<Visits>().lambda()
                         .eq(Visits::getCarNos,event.getPlateNos())

--
Gitblit v1.9.3