Min 1 年之前
父节点
当前提交
9bfb0f0e87

+ 17 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/DingDingServiceImpl.java

@@ -36,6 +36,7 @@ import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.LocalDateTime;
+import java.time.LocalTime;
 import java.time.ZoneOffset;
 import java.time.format.DateTimeFormatter;
 import java.util.*;
@@ -1860,7 +1861,7 @@ public class DingDingServiceImpl implements DingDingService {
                     cardTime.setDingdingUserid(user.getDingdingUserid());
                     LocalDateTime onDutyEarleast = null;
                     LocalDateTime offDutyLatest = null;
-
+                    LocalDate check=LocalDate.now();
                     for (int i=0;i<attendanceList.size(); i++) {
                         JSONObject attItem = attendanceList.getJSONObject(i);
                         String checkType = attItem.getString("check_type");
@@ -1870,6 +1871,7 @@ public class DingDingServiceImpl implements DingDingService {
                         //计算周几
                         cardTime.setWeekDay(cardTime.getWorkDate().getDayOfWeek().getValue());
                         cardTime.setWeekDayTxt(DateTimeUtil.getWeekDayTxt(cardTime.getWeekDay()));
+                        check=dateTime.toLocalDate();
                         if ("OnDuty".equals(checkType)) {
                             //上班时间
                             cardTime.setStartTime(mmDtf.format(dateTime));
@@ -1881,6 +1883,11 @@ public class DingDingServiceImpl implements DingDingService {
                         }
                     }
                     if (onDutyEarleast != null && offDutyLatest != null) {
+                        //下班打卡时间在第二天的情况下设置为前一天的23:59
+                        if(offDutyLatest.getSecond()<onDutyEarleast.getSecond()){
+                            LocalDateTime localDateTime = check.atTime(LocalTime.MAX);
+                            onDutyEarleast=localDateTime;
+                        }
                         long seconds = (offDutyLatest.getSecond()- onDutyEarleast.getSecond());
                         float hours = (offDutyLatest.getHour() - onDutyEarleast.getHour()) + seconds*1.0f/3600;
                         cardTime.setWorkHours(hours);
@@ -2180,11 +2187,13 @@ public class DingDingServiceImpl implements DingDingService {
                         if (findOff.isPresent()) {
                             offDutyLatest = findOff.get();
                         }
+                        LocalDate check=LocalDate.now();
                         if (onDutyEarleast != null) {
                             timeItem.setDingdingCorpid(onDutyEarleast.getCorpId());
                             timeItem.setDingdingUserid(onDutyEarleast.getUserId());
                             timeItem.setUserId(uid);
                             LocalDateTime sLt = LocalDateTime.ofEpochSecond(onDutyEarleast.getUserCheckTime()/1000, 0, ZoneOffset.ofHours(8));
+                            check=sLt.toLocalDate();
                             timeItem.setStartTime(hmFormat.format(sLt));
                             //计算周几
                             timeItem.setWeekDay(workDate.getDayOfWeek().getValue());
@@ -2193,9 +2202,16 @@ public class DingDingServiceImpl implements DingDingService {
                         if (offDutyLatest != null) {
                             LocalDateTime oLt = LocalDateTime.ofEpochSecond(offDutyLatest.getUserCheckTime()/1000, 0, ZoneOffset.ofHours(8));
                             timeItem.setEndTime(hmFormat.format(oLt));
+                            check=oLt.toLocalDate();
                         }
                         timeItem.setCompanyId(dingding.getCompanyId());
                         if (onDutyEarleast != null && offDutyLatest != null) {
+                            //下班打卡时间在第二天的情况下设置为前一天的23:59
+                            if(offDutyLatest.getUserCheckTime() <onDutyEarleast.getUserCheckTime()){
+                                LocalDateTime localDateTime = check.atTime(LocalTime.MAX);
+                                long timeInSeconds = localDateTime.toEpochSecond(ZoneOffset.UTC);
+                                onDutyEarleast.setUserCheckTime(timeInSeconds*1000);
+                            }
                             long seconds = (offDutyLatest.getUserCheckTime() - onDutyEarleast.getUserCheckTime())/1000;
                             float hours = seconds*1.0f/3600;
                             timeItem.setWorkHours(hours);

+ 4 - 0
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/WxCorpInfoServiceImpl.java

@@ -988,6 +988,10 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
                     userCorpwxTime.setCreateDate(date);
                     userCorpwxTime.setWeekDay(date.getDayOfWeek().getValue());
                     userCorpwxTime.setWeekDayTxt(DateTimeUtil.getWeekDayTxt(userCorpwxTime.getWeekDay()));
+                    //下班打卡时间在第二天的情况下设置为前一天的23:59
+                    if(LocalTime.parse(maxTime,df).isBefore(LocalTime.parse(minTime,df))){
+                        maxTime="23:59";
+                    }
                     BigDecimal bigDecimal=new BigDecimal(Duration.between(LocalTime.parse(minTime,df).plusHours(8),LocalTime.parse(maxTime,df).plusHours(8)).toMinutes());
 
                     //开始时间在上午,结束时间在下午,要减去午休时长