|
@@ -87,7 +87,7 @@ public class UserFvTimeController {
|
|
|
TimeType allDay = timeTypeMapper.selectOne(new QueryWrapper<TimeType>().eq("company_id", compId));
|
|
|
List<User> allUserList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", compId));
|
|
|
//获取休息设置
|
|
|
- TimeAutoExclude timeAutoExclude = timeAutoExcludeMapper.selectOne(new QueryWrapper<TimeAutoExclude>().eq("company_id", compId));
|
|
|
+ List<TimeAutoExclude> excludeTimeList = timeAutoExcludeMapper.selectList(new QueryWrapper<TimeAutoExclude>().eq("company_id", compId));
|
|
|
//Todo: 获取考勤打卡数据
|
|
|
HttpRespMsg workDataMsg = dockWithMLD.getResult("http://10.1.10.51:20175/api/cube/restful/interface/getModeDataPageList/getWorkData", jsonString);
|
|
|
List<Map<String,Object>> workDataList= (List<Map<String, Object>>) workDataMsg.data;
|
|
@@ -101,6 +101,8 @@ public class UserFvTimeController {
|
|
|
List<User> userList = userMapper.selectList(new QueryWrapper<User>().in("job_number", userIds));
|
|
|
List<LocalDateTime> dateTimeList = getDays(yesterday, yesterday.plusDays(2));
|
|
|
for (User user : userList) {
|
|
|
+ //按当前填报人所属部门或者全公司来匹配
|
|
|
+ excludeTimeList = excludeTimeList.stream().filter(ex->ex.getDId() == null || ex.getDId().equals(user.getDepartmentId())).collect(Collectors.toList());
|
|
|
for (LocalDateTime localDateTime : dateTimeList) {
|
|
|
LocalDate workDate=localDateTime.toLocalDate();
|
|
|
//当天的考勤记录
|
|
@@ -147,14 +149,16 @@ public class UserFvTimeController {
|
|
|
userFvTime.setCompanyId(user.getCompanyId());
|
|
|
userFvTime.setUserId(user.getId());
|
|
|
long workHours = between.toHours();
|
|
|
- long restHours;
|
|
|
- if(startTime.isBefore(LocalTime.parse(timeAutoExclude.getStartTime(),dtf2))
|
|
|
- &&endTime.isAfter(LocalTime.parse(timeAutoExclude.getEndTime(),dtf2))){
|
|
|
- Duration bt = Duration.between(LocalTime.parse(timeAutoExclude.getStartTime(),dtf2), LocalTime.parse(timeAutoExclude.getEndTime(),dtf2));
|
|
|
- restHours=bt.toHours();
|
|
|
- }else {
|
|
|
- restHours=0;
|
|
|
+ long restHours = 0;
|
|
|
+ //处理排除时间段
|
|
|
+ for (TimeAutoExclude timeAutoExclude : excludeTimeList) {
|
|
|
+ if(startTime.isBefore(LocalTime.parse(timeAutoExclude.getStartTime(),dtf2))
|
|
|
+ &&endTime.isAfter(LocalTime.parse(timeAutoExclude.getEndTime(),dtf2))){
|
|
|
+ Duration bt = Duration.between(LocalTime.parse(timeAutoExclude.getStartTime(),dtf2), LocalTime.parse(timeAutoExclude.getEndTime(),dtf2));
|
|
|
+ restHours += bt.toHours();
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
userFvTime.setWorkHours(BigDecimal.valueOf(workHours).subtract(BigDecimal.valueOf(restHours)).floatValue());
|
|
|
Optional<UserFvTime> first = oldUserFvTimeList.stream().filter(ol -> ol.getWorkDate().isEqual(userFvTime.getWorkDate()) && ol.getUserId().equals(userFvTime.getUserId())).findFirst();
|
|
|
if(first.isPresent()){
|