|
@@ -985,25 +985,32 @@ public class WxCorpInfoServiceImpl extends ServiceImpl<WxCorpInfoMapper, WxCorpI
|
|
|
}
|
|
|
Integer min = Collections.min(upList);
|
|
|
Integer max = Collections.max(downList);
|
|
|
+
|
|
|
String minTime = DateTimeUtil.getTimeFromSeconds(min);
|
|
|
String maxTime = DateTimeUtil.getTimeFromSeconds(max);
|
|
|
DateTimeFormatter df = DateTimeFormatter.ofPattern("HH:mm");
|
|
|
- userCorpwxTime.setStartTime(LocalTime.parse(minTime,df).plusHours(8).format(df));
|
|
|
- userCorpwxTime.setEndTime(LocalTime.parse(maxTime,df).plusHours(8).format(df));
|
|
|
+ LocalTime startCardTime = LocalTime.parse(minTime,df).plusHours(8);
|
|
|
+ LocalTime endCardTime = LocalTime.parse(maxTime,df).plusHours(8);
|
|
|
+ if (showLog) System.out.println("min=" + min + ",max=" + max+", startTime="+startCardTime.format(df)
|
|
|
+ +"endTime="+endCardTime.format(df));
|
|
|
+ userCorpwxTime.setStartTime(startCardTime.format(df));
|
|
|
+ userCorpwxTime.setEndTime(endCardTime.format(df));
|
|
|
userCorpwxTime.setWxCorpid(corpInfo.getCorpid());
|
|
|
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";
|
|
|
+ if(endCardTime.isBefore(startCardTime)){
|
|
|
+ maxTime="15:59";//23:59减去8小时的偏差
|
|
|
+ endCardTime.withHour(23).withMinute(59).withSecond(0).withNano(0);
|
|
|
}
|
|
|
- BigDecimal bigDecimal=new BigDecimal(Duration.between(LocalTime.parse(minTime,df).plusHours(8),LocalTime.parse(maxTime,df).plusHours(8)).toMinutes());
|
|
|
-
|
|
|
+ BigDecimal bigDecimal = new BigDecimal(Duration.between(startCardTime,endCardTime).toMinutes());
|
|
|
+ if (showLog) System.out.println("打卡时长(分钟):" + bigDecimal);
|
|
|
//开始时间在上午,结束时间在下午,要减去午休时长
|
|
|
- if (LocalTime.parse(minTime,df).plusHours(8).compareTo(LocalTime.parse(baseMorningEnd,df)) <= 0 && LocalTime.parse(maxTime,df).plusHours(8).compareTo(LocalTime.parse(baseAfternoonStart,df)) >= 0) {
|
|
|
+ if (startCardTime.compareTo(LocalTime.parse(baseMorningEnd,df)) <= 0 && endCardTime.compareTo(LocalTime.parse(baseAfternoonStart,df)) >= 0) {
|
|
|
//重新计算打卡工时时,需要减去中间午休时间
|
|
|
bigDecimal = bigDecimal.divide(BigDecimal.valueOf(60),1,BigDecimal.ROUND_HALF_UP).subtract(new BigDecimal(restTime));
|
|
|
+ if (showLog) System.out.println("午休时间:"+restTime+", 减去后,工作时长="+bigDecimal);
|
|
|
} else {
|
|
|
bigDecimal = bigDecimal.divide(BigDecimal.valueOf(60),1,BigDecimal.ROUND_HALF_UP);
|
|
|
}
|