Przeglądaj źródła

流程申请允许周天到周一

wanxl 1 rok temu
rodzic
commit
570b1ae001

+ 7 - 3
src/main/java/com/template/controller/ApplicationProcedureTemporaryController.java

@@ -76,6 +76,7 @@ public class ApplicationProcedureTemporaryController implements ApplicationProce
                 .ne("status", "0"));
                 .ne("status", "0"));
         String startDto=applicationProcedureDto.getStartTime();
         String startDto=applicationProcedureDto.getStartTime();
         String endDto=applicationProcedureDto.getEndTime();
         String endDto=applicationProcedureDto.getEndTime();
+        //周日-周1为上周
         int dtoCount=this.checkWeek(startDto,endDto);
         int dtoCount=this.checkWeek(startDto,endDto);
         if(dtoCount==-1||dtoCount>countConfig){
         if(dtoCount==-1||dtoCount>countConfig){
             return CommonResult.fail("申请日期不能跨周,一周不能超过"+countConfig+"天,请重新申请");
             return CommonResult.fail("申请日期不能跨周,一周不能超过"+countConfig+"天,请重新申请");
@@ -83,7 +84,8 @@ public class ApplicationProcedureTemporaryController implements ApplicationProce
         //筛选同一周数据
         //筛选同一周数据
         if (!list.isEmpty()){
         if (!list.isEmpty()){
             String[] arr =TimeExchange.getCurrentWeekTimeFrame(startDto);
             String[] arr =TimeExchange.getCurrentWeekTimeFrame(startDto);
-            list=list.stream().filter(a -> a.getStartTime().compareTo(arr[0])>=0&&a.getEndTime().compareTo(arr[1])<=0)
+            //开始时间为本周
+            list=list.stream().filter(a -> a.getStartTime().compareTo(arr[0])>=0&&a.getStartTime().compareTo(arr[1])<=0)
                     .collect(Collectors.toList());
                     .collect(Collectors.toList());
         }
         }
         if (!list.isEmpty()) {
         if (!list.isEmpty()) {
@@ -94,8 +96,8 @@ public class ApplicationProcedureTemporaryController implements ApplicationProce
                     return CommonResult.fail("相同日期已有待审批申请,请勿重复申请");
                     return CommonResult.fail("相同日期已有待审批申请,请勿重复申请");
                 }
                 }
                  aa=this.checkWeek(apt.getStartTime(),apt.getEndTime())+aa;
                  aa=this.checkWeek(apt.getStartTime(),apt.getEndTime())+aa;
-
-               if(countConfig-dtoCount<=aa){
+                //已申请+本次大于配置数量则不能申请
+               if(countConfig<aa+dtoCount){
                    return CommonResult.fail("总申请天数超过本周限额");
                    return CommonResult.fail("总申请天数超过本周限额");
                }
                }
 
 
@@ -491,6 +493,8 @@ public class ApplicationProcedureTemporaryController implements ApplicationProce
         }
         }
         if(year==year1&&week==week1){
         if(year==year1&&week==week1){
             return day1-day;
             return day1-day;
+        }else if (year==year1&&week+1==week1&&day1==1){
+            return day-day1;
         }else{
         }else{
             return -1;
             return -1;
         }
         }