| | |
| | | import me.zhengjie.modules.system.service.mapstruct.UserLoginMapper; |
| | | import me.zhengjie.modules.system.service.mapstruct.UserMapper; |
| | | import me.zhengjie.modules.task.domain.TaskDaliy; |
| | | import me.zhengjie.modules.task.domain.TaskDaliyMongo; |
| | | import me.zhengjie.modules.task.domain.TaskMongo; |
| | | import me.zhengjie.modules.task.repository.TaskDaliyRepository; |
| | | import me.zhengjie.modules.task.service.TaskDaliyService; |
| | |
| | | Long duration = (Duration.between(user.getSysRostering().getWorkStartTime(), user.getSysRostering().getWorkEndTime())).toHours(); |
| | | |
| | | //查询日志表 |
| | | List<TaskDaliy> taskDaliyList = taskDaliyRepository.findAllByUserAndDate(userId, startDate, endDate); |
| | | for (TaskDaliy taskDaliy : taskDaliyList) { |
| | | CalendarVo daily = new CalendarVo(); |
| | | daily.setDate(taskDaliy.getFillDate().toString()); |
| | | if (dateList.contains(taskDaliy.getFillDate().toString())) { |
| | | dateList.remove(taskDaliy.getFillDate().toString()); |
| | | List<TaskDaliyMongo> taskDaliyList = mongoTemplate.find(Query.query(new Criteria("userId").is(userId).and("fillDate").gte(startDate).lte(endDate)), TaskDaliyMongo.class); |
| | | Map<String,Double> map = new HashMap<>(); |
| | | for (TaskDaliyMongo taskDaliy : taskDaliyList) { |
| | | if (map.get(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.0").format(taskDaliy.getFillDate())) != null) { |
| | | // 如果已经有了 |
| | | Double todayHours = map.get(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.0").format(taskDaliy.getFillDate())); |
| | | todayHours += taskDaliy.getConsumedHours(); |
| | | map.put(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.0").format(taskDaliy.getFillDate()),todayHours); |
| | | } else { |
| | | map.put(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.0").format(taskDaliy.getFillDate()),taskDaliy.getConsumedHours()); |
| | | } |
| | | daily.setIsOk(taskDaliy.getConsumedHours().compareTo(new Double(duration - 1)) >= 0 ? true : false); |
| | | daily.setTitle(taskDaliy.getConsumedHours().compareTo(new Double(duration - 1)) >= 0 ? "工时: " + taskDaliy.getConsumedHours().toString() : "已填工时:" + taskDaliy.getConsumedHours().toString() + " 不满8小时,请补充日报"); |
| | | daily.setType(2); |
| | | calendarInfo.add(daily); |
| | | } |
| | | for (Map.Entry<String, Double> entry : map.entrySet()) { |
| | | CalendarVo calendarVo = new CalendarVo(); |
| | | if (entry.getValue() >= 8) { |
| | | calendarVo.setDate(entry.getKey()); |
| | | calendarVo.setIsOk(true); |
| | | calendarVo.setTitle("工时:"+entry.getValue()); |
| | | calendarVo.setType(2); |
| | | } else { |
| | | calendarVo.setDate(entry.getKey()); |
| | | calendarVo.setIsOk(false); |
| | | calendarVo.setTitle("已填工时:"+entry.getValue()+" 不足8小时,请补充日报"); |
| | | calendarVo.setType(2); |
| | | } |
| | | calendarInfo.add(calendarVo); |
| | | } |
| | | |
| | | for (String date : dateList) { |
| | | String type1 = ""; |
| | | String type2 = ""; |
| | | CalendarVo dailyVo = new CalendarVo(); |
| | | dailyVo.setDate(date); |
| | | for (Attendance attendanceRecord : attendanceList) { |
| | | type1 = attendanceRecord.getStartClockResults(); |
| | | type2 = attendanceRecord.getEndClockResults(); |
| | | date = date.substring(0, 10); |
| | | if (date.equals(df.format(attendanceRecord.getAttendanceDate())) && type1.equals(Constant.ATTENDANCE_STATE_LEAVE) && type2.equals(Constant.ATTENDANCE_STATE_LEAVE)) { |
| | | dailyVo.setTitle("请假"); |
| | | dailyVo.setIsOk(true); |
| | | } else if (date.equals(df.format(attendanceRecord.getAttendanceDate())) && type1.equals(Constant.ATTENDANCE_STATE_BUSINESS) && type2.equals(Constant.ATTENDANCE_STATE_BUSINESS)) { |
| | | dailyVo.setTitle("出差"); |
| | | dailyVo.setIsOk(true); |
| | | } else if (date.equals(df.format(attendanceRecord.getAttendanceDate())) && type1.equals(Constant.ATTENDANCE_STATE_REST) && type2.equals(Constant.ATTENDANCE_STATE_REST)) { |
| | | dailyVo.setTitle("休息"); |
| | | dailyVo.setIsOk(true); |
| | | } else if (date.equals(df.format(attendanceRecord.getAttendanceDate()))) { |
| | | dailyVo.setTitle("日报未填写,请补充日报"); |
| | | dailyVo.setIsOk(false); |
| | | for (String date : dateList) { |
| | | String type1 = ""; |
| | | String type2 = ""; |
| | | System.out.println(date); |
| | | CalendarVo dailyVo = new CalendarVo(); |
| | | if (map.get(date) != null) { |
| | | // 如果在map中找到了它的值,说明用户填写过日报 |
| | | break; |
| | | } |
| | | dailyVo.setDate(date); |
| | | for (Attendance attendanceRecord : attendanceList) { |
| | | type1 = attendanceRecord.getStartClockResults(); |
| | | type2 = attendanceRecord.getEndClockResults(); |
| | | date = date.substring(0, 10); |
| | | if (date.equals(df.format(attendanceRecord.getAttendanceDate())) && type1.equals(Constant.ATTENDANCE_STATE_LEAVE) && type2.equals(Constant.ATTENDANCE_STATE_LEAVE)) { |
| | | dailyVo.setTitle("请假"); |
| | | dailyVo.setIsOk(true); |
| | | } else if (date.equals(df.format(attendanceRecord.getAttendanceDate())) && type1.equals(Constant.ATTENDANCE_STATE_BUSINESS) && type2.equals(Constant.ATTENDANCE_STATE_BUSINESS)) { |
| | | dailyVo.setTitle("出差"); |
| | | dailyVo.setIsOk(true); |
| | | } else if (date.equals(df.format(attendanceRecord.getAttendanceDate())) && type1.equals(Constant.ATTENDANCE_STATE_REST) && type2.equals(Constant.ATTENDANCE_STATE_REST)) { |
| | | dailyVo.setTitle("休息"); |
| | | dailyVo.setIsOk(true); |
| | | } else if (date.equals(df.format(attendanceRecord.getAttendanceDate()))) { |
| | | dailyVo.setTitle("日报未填写,请补充日报"); |
| | | dailyVo.setIsOk(false); |
| | | } |
| | | } |
| | | dailyVo.setType(2); |
| | | calendarInfo.add(dailyVo); |
| | | } |
| | | dailyVo.setType(2); |
| | | calendarInfo.add(dailyVo); |
| | | } |
| | | return calendarInfo; |
| | | } |
| | | |
| | |
| | | TaskDaliyQueryCriteria taskDaliyQueryCriteria = new TaskDaliyQueryCriteria(); |
| | | taskDaliyQueryCriteria.setUserId(userId); |
| | | taskDaliyQueryCriteria.setTargetYearMonth(sdfDate.substring(0, 7)); |
| | | taskDaliyQueryCriteria.setTargetYearMonth(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(yearMonth)); |
| | | // 查询某月已完成工时 |
| | | Double completedWork = taskDaliyService.queryCompletedWork(taskDaliyQueryCriteria, true); |
| | | // 月初到今天绩效时长 |