From eea92f23bf8ead897f346ae6ccc8603ac039e566 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期二, 30 七月 2024 09:48:47 +0800
Subject: [PATCH] 修复bug

---
 server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java
index cd7243c..6bee11b 100644
--- a/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java
+++ b/server/dmvisit_service/src/main/java/com/doumee/service/business/impl/VisitsServiceImpl.java
@@ -167,7 +167,6 @@
             this.createFk(visits,true);
     }
 
-    @Transactional(propagation = Propagation.NOT_SUPPORTED)
     void saveInterfaceLog(Object param, String path, String result, Integer type) {
         InterfaceLog interfaceLog=new InterfaceLog();
         interfaceLog.setType(type);
@@ -587,9 +586,16 @@
         }
         if(visits.getSourceType().equals(Constants.ZERO)){
             String code = systemDictDataBiz.queryByCode(Constants.VISIT_CONFIG,Constants.VALIDATE_VISIT).getCode();
+            int codenum =0;
+            try {
+                codenum = Integer.parseInt(code);
+            }catch (Exception e){
+
+            }
             if(StringUtils.isNotBlank(code)&&!StringUtils.equals(code,"0")){
-                Integer betweenDays = Math.toIntExact(cn.hutool.core.date.DateUtil.between(visits.getEndtime(), visits.getStarttime(), DateUnit.DAY));
-                if(Integer.compare(betweenDays,Integer.valueOf(code))>0){
+//                Integer betweenDays = Math.toIntExact(cn.hutool.core.date.DateUtil.between(visits.getEndtime(), visits.getStarttime(), DateUnit.DAY));
+                int betweenDays = DateUtil.daysBetweenDates11(visits.getEndtime(), visits.getStarttime())+1;
+                if( betweenDays > codenum){
                     throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝棰勭害鎬诲ぉ鏁颁笉鑳借秴杩嘯"+code+"澶锛�");
                 }
             }
@@ -604,9 +610,9 @@
                 ){
             throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝淇℃伅濉啓涓嶆纭紒");
         }
-        if(visits.getStarttime().getTime() < System.currentTimeMillis()){
-            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝棰勭害寮�濮嬫椂闂村繀椤诲ぇ浜庡綋鍓嶆椂闂达紒");//
-        }
+//        if(visits.getStarttime().getTime() < System.currentTimeMillis()){
+//            throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝棰勭害寮�濮嬫椂闂村繀椤诲ぇ浜庡綋鍓嶆椂闂达紒");//
+//        }
         if(visits.getEndtime().getTime() <= visits.getStarttime().getTime()){
             throw  new BusinessException(ResponseStatus.BAD_REQUEST.getCode(), "瀵逛笉璧凤紝棰勭害缁撴潫鏃堕棿蹇呴』澶т簬寮�濮嬫椂闂达紒");//
         }
@@ -857,12 +863,15 @@
         //鏍规嵁鎵嬫満鍙峰拰韬唤璇佸彿鐮佹煡璇� 褰撳墠棰勭害鐨勬椂闂存槸鍚︿笌鍏朵粬棰勭害璁板綍鏈夊啿绐�
         if (visitsMapper.selectCount(new QueryWrapper<Visits>().lambda()
                         .notIn(Visits::getStatus,Constants.VisitStatus.cancel,Constants.VisitStatus.noPass,Constants.VisitStatus.xfFail,Constants.VisitStatus.signout,Constants.VisitStatus.invalid)
-                .eq(Visits::getIdcardDecode, Constants.getTuominStr(cardno))
+//                .eq(Visits::getIdcardDecode, Constants.getTuominStr(cardno))
                 .and(ms -> ms.eq(Visits::getPhone, visits.getPhone())
                         .or().eq(Visits::getIdcardDecode, Constants.getTuominStr(cardno)))
                 .and(ms -> ms.apply(" visits.STARTTIME <= '" + DateUtil.DateToStr(visits.getStarttime(),"yyyy-MM-dd HH:mm:ss") + "' and visits.ENDTIME >= '" + DateUtil.DateToStr(visits.getStarttime(),"yyyy-MM-dd HH:mm:ss") + "' ")
                         .or().apply(" visits.STARTTIME <= '" + DateUtil.DateToStr(visits.getEndtime(),"yyyy-MM-dd HH:mm:ss") + "' and visits.ENDTIME >= '" + DateUtil.DateToStr(visits.getEndtime(),"yyyy-MM-dd HH:mm:ss") + "' ")
-                )) > Constants.ZERO) {
+                        .or().apply(" visits.STARTTIME >= '" + DateUtil.DateToStr(visits.getStarttime(),"yyyy-MM-dd HH:mm:ss") + "' and visits.ENDTIME <= '" + DateUtil.DateToStr(visits.getEndtime(),"yyyy-MM-dd HH:mm:ss") + "' ")
+                        .or().apply(" visits.STARTTIME <=  '" + DateUtil.DateToStr(visits.getStarttime(),"yyyy-MM-dd HH:mm:ss") + "' and visits.ENDTIME >= '" + DateUtil.DateToStr(visits.getEndtime(),"yyyy-MM-dd HH:mm:ss") + "' ")
+                )
+        ) > Constants.ZERO) {
             throw  new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "瀵逛笉璧凤紝鎵嬫満鍙枫��"+member.getPhone()+"銆戞垨韬唤璇併��"+ member.getIdcardDecode() +"銆戝瓨鍦ㄩ绾︽椂闂村啿绐侊紝鏃犳硶鐢宠鍝︼紒");
         }
         return  member;

--
Gitblit v1.9.3