From 2c4ea94474ce8f9eb48b71fb9960a7da45320282 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期二, 06 五月 2025 13:58:46 +0800
Subject: [PATCH] 代码初始化

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java |   71 +++++++++++++++++++++++++++++------
 1 files changed, 58 insertions(+), 13 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java
index d69678e..8cf3245 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java
@@ -128,6 +128,8 @@
     @Autowired
     private InoutDayCountMapper inoutDayCountMapper;
     @Autowired
+    private InoutRecordMapper inoutRecordMapper;
+    @Autowired
     private CarEventMapper carEventMapper;
 
     @Autowired
@@ -1530,8 +1532,24 @@
 
 
     @Override
+    @Transactional(rollbackFor = {BusinessException.class,Exception.class})
+    public  void  visitLevelForCarOut(Visits visits){
+        visits.setRemark("璺熼殢璁垮杞﹁締绂诲洯鑷姩绛剧");
+        visitLevelBiz(visits);
+    }
+    @Override
+    @Transactional(rollbackFor = {BusinessException.class,Exception.class})
     public void  visitLevel(Integer visitId){
         Visits visits = visitsMapper.selectById(visitId);
+        visits.setRemark("骞冲彴绠$悊鍛樻墜鍔ㄧ绂绘垚鍔�");
+        visitLevelBiz(visits);
+        //浜у嚭鍦ㄥ満浜哄憳淇℃伅
+        retentionMapper.delete(new UpdateWrapper<Retention>().lambda()
+                .eq(Retention::getType,Constants.memberType.visitor)
+                .eq(Retention::getMemberId,visits.getMemberId()));
+    }
+
+    private void visitLevelBiz(Visits visits) {
         if(Objects.isNull(visits)){
             throw new BusinessException(ResponseStatus.DATA_EMPTY);
         }
@@ -1542,14 +1560,16 @@
         request.setOrderId(visits.getHkId());
         //璋冪敤娴峰悍寮哄埗绛剧
         BaseResponse response =  HKService.iccmSignoff(request);
-//        BaseResponse response =  HKService.outVisitAppiontment(request);
-        visitsMapper.update(null,new UpdateWrapper<Visits>().lambda().set(Visits::getStatus,Constants.VisitStatus.signout)
-                .eq(Visits::getId,visitId));
-        //浜у嚭鍦ㄥ満浜哄憳淇℃伅
-        retentionMapper.delete(new UpdateWrapper<Retention>().lambda()
-                .eq(Retention::getType,Constants.memberType.visitor)
-                .eq(Retention::getMemberId,visits.getMemberId()));
+        if(response!=null &&StringUtils.isNotBlank(response.getCode()) && StringUtils.equals(response.getCode(),HKConstants.RESPONSE_SUCCEE)){
+            visitsMapper.update(null,new UpdateWrapper<Visits>().lambda()
+                    .set(Visits::getStatus,Constants.VisitStatus.signout)
+                    .set(Visits::getRemark,visits.getRemark())
+                    .eq(Visits::getId,visits.getId()));
+        }else{
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"璁垮绛剧澶辫触锛岃鍒锋柊閲嶈瘯");
+        }
     }
+
     @Override
     public void  visitCancel(Integer visitId){
         Visits visits = visitsMapper.selectById(visitId);
@@ -1791,10 +1811,14 @@
                     .apply(" DATE(TIME_INFO) = CURDATE()  ")
                     .last(" limit 1 ")
             );
-
+ 
             //浠婃棩鍦ㄥ洯浜烘暟
             pcWorkPlatformDataVO.setTodayInParkUserNum(
-                    retentionList.stream().filter(i->!Constants.equalsInteger(i.getType(),Constants.THREE)).count()
+                    inoutRecordMapper.selectCount(new QueryWrapper<InoutRecord>().lambda()
+                            .isNotNull(InoutRecord::getMemberPhone)
+                            .isNull(InoutRecord::getCarCode)
+                            .apply( " DATE(TIME_INFO) = CURDATE() " ))
+                    //retentionList.stream().filter(i->!Constants.equalsInteger(i.getType(),Constants.THREE)).count()
             );
 
             pcWorkPlatformDataVO.setTodayInUserNum(Constants.ZERO);
@@ -1802,8 +1826,13 @@
 
             //鍦ㄥ洯闀挎湡鐩稿叧鏂逛汉鏁�
             pcWorkPlatformDataVO.setInParkLwUserNum(
-                    retentionList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.TWO)
-                            && Constants.equalsInteger(i.getCompanyType(),Constants.ZERO)).count()
+                    inoutRecordMapper.selectCount(new QueryWrapper<InoutRecord>().lambda()
+                            .eq(InoutRecord::getMemberType,Constants.TWO)
+                            .isNotNull(InoutRecord::getMemberPhone)
+                            .isNull(InoutRecord::getCarCode)
+                            .apply( " DATE(TIME_INFO) = CURDATE() " ))
+//                    retentionList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.TWO)
+//                            && Constants.equalsInteger(i.getCompanyType(),Constants.ZERO)).count()
             );
             pcWorkPlatformDataVO.setLwUserInNum(Constants.ZERO);
             pcWorkPlatformDataVO.setLwUserOutNum(Constants.ZERO);
@@ -1811,14 +1840,30 @@
 
             //鍦ㄥ洯璁垮鏁伴噺
             pcWorkPlatformDataVO.setInParkVisitUserNum(
-                    retentionList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&Objects.isNull(i.getCompanyType())).count()
+                    inoutRecordMapper.selectCount(new QueryWrapper<InoutRecord>().lambda()
+                            .eq(InoutRecord::getMemberType,Constants.ZERO)
+                            .isNotNull(InoutRecord::getMemberPhone)
+                            .isNull(InoutRecord::getCarCode)
+                            .apply( " DATE(TIME_INFO) = CURDATE() " ))
+                    //retentionList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.ONE)&&Objects.isNull(i.getCompanyType())).count()
             );
             pcWorkPlatformDataVO.setVisitUserNum(Constants.ZERO);
             pcWorkPlatformDataVO.setSignLevelNum(Constants.ZERO);
 
+            //鍦ㄥ洯璐ц繍杞﹁締鍙告満
+            pcWorkPlatformDataVO.setInParkDriverUserNum(inoutRecordMapper.selectCount(new QueryWrapper<InoutRecord>().lambda()
+                    .eq(InoutRecord::getMemberType,Constants.THREE)
+                    .isNotNull(InoutRecord::getMemberPhone)
+                    .isNull(InoutRecord::getCarCode)
+                    .apply( " DATE(TIME_INFO) = CURDATE() " )));
+
             //鍦ㄥ洯杞﹁締
             pcWorkPlatformDataVO.setTodayInParkCarNum(
-                    retentionList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.THREE)).count()
+                    inoutRecordMapper.selectCount(new QueryWrapper<InoutRecord>().lambda()
+                            .isNotNull(InoutRecord::getCarCode)
+                            .isNull(InoutRecord::getMemberPhone)
+                            .apply( " DATE(TIME_INFO) = CURDATE() " ))
+                    //retentionList.stream().filter(i->Constants.equalsInteger(i.getType(),Constants.THREE)).count()
             );
             pcWorkPlatformDataVO.setTodayInCarNum(Constants.ZERO);
             pcWorkPlatformDataVO.setTodayOutCarNum(Constants.ZERO);

--
Gitblit v1.9.3