| | |
| | | public void performanceShiftAdd(PerformanceShiftAddDto performanceShiftAddDto) { |
| | | List<LocalDateTime> datesBetween = getLocalDateTimesBetween(performanceShiftAddDto.getStartWeek(), performanceShiftAddDto.getEndWeek()); |
| | | for (LocalDateTime date : datesBetween) { |
| | | PerformanceShift performanceShift = new PerformanceShift(); |
| | | performanceShift.setShift(performanceShiftAddDto.getShift()); |
| | | performanceShift.setUserId(performanceShiftAddDto.getUserId()); |
| | | performanceShift.setWorkTime(date); |
| | | baseMapper.insert(performanceShift); |
| | | String[] splitUserId = performanceShiftAddDto.getUserId().split(","); |
| | | for (String s : splitUserId) { |
| | | PerformanceShift performanceShift = new PerformanceShift(); |
| | | performanceShift.setShift(performanceShiftAddDto.getShift()); |
| | | performanceShift.setUserId(Integer.valueOf(s)); |
| | | performanceShift.setWorkTime(date); |
| | | baseMapper.insert(performanceShift); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | int totalAttendance = 0; |
| | | Map<Object, Object> map = new HashMap<>(); |
| | | for (Enums enums : shiftType) { |
| | | Integer num = 0; |
| | | int num = 0; |
| | | // 分割日期 |
| | | for (String shiftTime : shiftTimes) { |
| | | Map<Object, Object> hashMap = new HashMap<>(); |
| | | String[] shiftTimeAndShift = shiftTime.split(":"); |
| | | if (enums.getValue().equals(shiftTimeAndShift[1])) { |
| | | num++; |
| | | } |
| | | // 3:休假;4:请假 |
| | | if (!enums.getValue().equals("3") && enums.getValue().equals("4")) { |
| | | totalAttendance++; |
| | | } |
| | | hashMap.put("id", shiftTimeAndShift[2]); |
| | | hashMap.put("shift", shiftTimeAndShift[1]); |
| | |
| | | } |
| | | i.put(enums.getLabel(), num); |
| | | i.put("list", map); |
| | | i.put("totalAttendance", totalAttendance); |
| | | if(!enums.getValue().equals("3") && !enums.getValue().equals("4")) { |
| | | i.put("totalAttendance", totalAttendance += num); |
| | | } |
| | | i.remove("shiftTime"); |
| | | } |
| | | } |