Просмотр исходного кода

打卡管理-周结算判断条件1和条件5天数差计算+1

ZhangWenQiang 5 лет назад
Родитель
Сommit
7b95cd4f24

+ 5 - 4
happy-job-module-hpjob/src/main/java/com/jeeplus/modules/wspunch/service/WsSettlementService.java

@@ -223,7 +223,7 @@ public class WsSettlementService extends CrudService<WsSettlementMapper, WsCompa
      */
     public WsPunchClock weekSettlement(WsPunchClock wsPunchClockDto) {
         /**
-         * 条件一:入职时间——>lastDate >=7?
+         * 条件一:入职时间——>lastDate >=7(自然日)?
          * 条件二:入职时间——>lastDate  的总计duration >=60?
          * 条件三:判断这周是否跨月(结算周期月)
          * 条件四:ws_staff表是否有值,譬如cardNumber 是否有值
@@ -273,7 +273,8 @@ public class WsSettlementService extends CrudService<WsSettlementMapper, WsCompa
         //入职时间——>lastDate的天数差
         LocalDate localDateEnd = date2LocalDate(lastDate);
         LocalDate localDateStart = date2LocalDate(onaboardingDate);
-        int lastDayInt = (int) (localDateEnd.toEpochDay() - localDateStart.toEpochDay());
+        //+1包含入职当天
+        int lastDayInt = (int) (localDateEnd.toEpochDay() - localDateStart.toEpochDay()) + 1;
         /**
          * 条件二
          */
@@ -296,8 +297,8 @@ public class WsSettlementService extends CrudService<WsSettlementMapper, WsCompa
             //上周最后一天
             LocalDate lastWeekEndDate = date2LocalDate(wsPunchClockDto.getStartDate()).minusDays(1);
             Date lastWeekEndDay = localDate2Date(lastWeekEndDate);
-            //入职时间——>上周最后一天的天数差
-            int lastDayInt1 = (int) (lastWeekEndDate.toEpochDay() - localDateStart.toEpochDay());
+            //入职时间——>上周最后一天的天数差(包含入职当天)
+            int lastDayInt1 = (int) (lastWeekEndDate.toEpochDay() - localDateStart.toEpochDay()) + 1;
             //入职时间——>上周最后一天的总小时
             int countDuration1 = mapper.getCountDurationForJudge(onaboardingDate, lastWeekEndDay, wsPunchClockDto.getMemberId());
             boolean isSecondWeek = lastDayInt1 >= wsSetting.getMinWorkDay() && countDuration1 >= wsSetting.getMinWorkHour();