| | |
| | | |
| | | @ApiOperation(value = "绩效管理-班次-分页查询") |
| | | @PostMapping("page") |
| | | public Result<?> performanceShiftPage(Integer size, Integer current, LocalDateTime time, String userName, String laboratory) { |
| | | public Result<?> performanceShiftPage(Integer size, Integer current, String time, String userName, String laboratory) { |
| | | return Result.success(performanceShiftService.performanceShiftPage(new Page<>(current, size), time, userName, laboratory)); |
| | | } |
| | | |
| | |
| | | package com.yuanchu.mom.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.yuanchu.mom.pojo.PerformanceShift; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.springframework.data.repository.query.Param; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | |
| | | IPage<Map<String, Object>> performanceShiftPage( |
| | | Page<Object> page, |
| | | @Param("time") LocalDateTime time, |
| | | @Param("time") String time, |
| | | @Param("userName") String userName, |
| | | @Param("laboratory") String laboratory |
| | | ); |
| | |
| | | import com.yuanchu.mom.dto.PerformanceShiftAddDto; |
| | | import com.yuanchu.mom.pojo.PerformanceShift; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | |
| | | |
| | | void performanceShiftAdd(PerformanceShiftAddDto performanceShiftAddDto); |
| | | |
| | | IPage<Map<String, Object>> performanceShiftPage(Page<Object> page, LocalDateTime time, String userName, String laboratory); |
| | | IPage<Map<String, Object>> performanceShiftPage(Page<Object> page, String time, String userName, String laboratory); |
| | | |
| | | void performanceShiftUpdate(String shift, Integer id); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public IPage<Map<String, Object>> performanceShiftPage(Page<Object> page, LocalDateTime time, String userName, String laboratory) { |
| | | public IPage<Map<String, Object>> performanceShiftPage(Page<Object> page, String time, String userName, String laboratory) { |
| | | IPage<Map<String, Object>> mapIPage = baseMapper.performanceShiftPage(page, time, userName, laboratory); |
| | | List<Enums> shiftType = enumService.selectEnumByCategory("班次类型"); |
| | | for (Map<String, Object> i : mapIPage.getRecords()) { |
| | | String[] shiftTimes = i.get("shiftTime").toString().split(";"); |
| | | int totalAttendance = 0; |
| | | Map<Object, Object> map = new HashMap<>(); |
| | | for (Enums enums : shiftType) { |
| | | int num = 0; |
| | | // 分割日期 |
| | | for (String shiftTime : shiftTimes) { |
| | | Map<Object, Object> hashMap = new HashMap<>(); |
| | | String[] shiftTimeAndShift = shiftTime.split(":"); |
| | | List<Object> map = new ArrayList<>(); |
| | | // 分割日期 |
| | | for (String shiftTime : shiftTimes) { |
| | | Map<Object, Object> hashMap = new HashMap<>(); |
| | | String[] shiftTimeAndShift = shiftTime.split(":"); |
| | | for (Enums enums : shiftType) { |
| | | int num = 0; |
| | | if (enums.getValue().equals(shiftTimeAndShift[1])) { |
| | | num++; |
| | | } |
| | | hashMap.put("id", shiftTimeAndShift[2]); |
| | | hashMap.put("shift", shiftTimeAndShift[1]); |
| | | hashMap.put("weekly", DateUtil.weekOfYear(DateUtil.parse(shiftTimeAndShift[0]))); |
| | | hashMap.put("time", shiftTimeAndShift[0]); |
| | | map.put(getWeek(shiftTimeAndShift[0]), hashMap); |
| | | i.put(enums.getLabel(), num); |
| | | if (!enums.getValue().equals("3") && !enums.getValue().equals("4")) { |
| | | i.put("totalAttendance", totalAttendance += num); |
| | | } |
| | | } |
| | | i.put(enums.getLabel(), num); |
| | | i.put("list", map); |
| | | if(!enums.getValue().equals("3") && !enums.getValue().equals("4")) { |
| | | i.put("totalAttendance", totalAttendance += num); |
| | | } |
| | | i.remove("shiftTime"); |
| | | hashMap.put("id", shiftTimeAndShift[2]); |
| | | hashMap.put("shift", shiftTimeAndShift[1]); |
| | | hashMap.put("weekly", DateUtil.weekOfYear(DateUtil.parse(shiftTimeAndShift[0]))); |
| | | hashMap.put("time", shiftTimeAndShift[0]); |
| | | hashMap.put("headerTime", getWeek(shiftTimeAndShift[0])); |
| | | map.add(hashMap); |
| | | } |
| | | i.put("list", map); |
| | | i.remove("shiftTime"); |
| | | } |
| | | return mapIPage; |
| | | } |
| | |
| | | GROUP_CONCAT(s.work_time, ':', s.shift, ':', s.id SEPARATOR ';') AS shiftTime |
| | | FROM performance_shift s |
| | | LEFT JOIN user u on u.id = s.user_id |
| | | GROUP BY u.id |
| | | <where> |
| | | <if test="time != null and time != ''"> |
| | | and s.work_time in DATE_FORMAT(#{time}, '%Y-%m-%d') |
| | | and DATE_FORMAT(s.work_time, '%Y-%m') = DATE_FORMAT(#{time}, '%Y-%m' ) |
| | | </if> |
| | | <if test="userName != null and userName != ''"> |
| | | and s.name concat('%', #{userName}, '%') |
| | | and u.name like concat('%', #{userName}, '%') |
| | | </if> |
| | | <if test="laboratory != null and laboratory != ''"></if> |
| | | <if test="laboratory != null and laboratory != ''"> |
| | | </if> |
| | | </where> |
| | | GROUP BY u.id |
| | | </select> |
| | | </mapper> |