inspect-server/src/main/resources/static/staff_attendance_month_template.xlsxBinary files differ
inspect-server/src/main/resources/static/staff_attendance_year_template.xlsxBinary files differ
performance-server/src/main/java/com/ruoyi/performance/controller/PerformanceShiftController.java
@@ -1,37 +1,19 @@ package com.ruoyi.performance.controller; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.domain.Result; import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.performance.dto.PerformanceShiftAddDto; import com.ruoyi.performance.pojo.PerformanceShift; import com.ruoyi.performance.service.PerformanceShiftService; import com.ruoyi.performance.utils.StyleMonthUtils; import com.ruoyi.performance.utils.StyleYearUtils; import com.ruoyi.system.service.ISysDictTypeService; import com.ruoyi.system.service.UserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.constraints.NotNull; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.LocalTime; import java.time.temporal.TemporalAdjusters; import java.time.temporal.WeekFields; import java.util.Collection; import java.util.List; import java.util.Locale; import java.util.Map; import java.util.stream.Collectors; /** @@ -49,12 +31,6 @@ @Autowired private PerformanceShiftService performanceShiftService; @Resource private ISysDictTypeService dictTypeService; @Resource private UserService userService; @ApiOperation(value = "ç¼è¾æ¹æ³¨å 容") @PostMapping("editAnnotationText") @@ -83,7 +59,7 @@ @ApiOperation(value = "å¹´åº¦çæ¬¡æ¥è¯¢") @GetMapping("pageYear") public Result<?> performanceShiftPageYear(String time, String userName, String laboratory) { public Result<?> performanceShiftPageYear(@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime time, String userName, String laboratory) { return Result.success(performanceShiftService.performanceShiftPageYear(time, userName, laboratory)); } @@ -96,67 +72,8 @@ @ApiOperation(value = "导åº") @GetMapping("export") public void exportToExcel(@NotNull(message = "æ¶é´ä¸è½ä¸ºç©ºï¼") String time, String userName, String laboratory, Boolean isMonth, HttpServletResponse response) throws Exception { Map<Object, Object> data; response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); response.setHeader("requestType","excel"); response.setHeader("Access-Control-Expose-Headers", "requestType"); if (!isMonth) { data = performanceShiftService.exportToYearExcel(time, userName, laboratory); // 设置åå æ ¼æ ·å¼ HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(StyleYearUtils.getHeadStyle(), StyleYearUtils.getContentStyle()); // ä¿åå°ç¬¬ä¸ä¸ªsheetä¸ EasyExcel.write(response.getOutputStream()) .head((List<List<String>>) data.get("header")) .registerWriteHandler(new LongestMatchColumnWidthStyleStrategy()) // èªéåºå宽 .registerWriteHandler(horizontalCellStyleStrategy) .sheet("年度") .doWrite((Collection<?>) data.get("data")); } else { data = performanceShiftService.exportToMonthExcel(time, userName, laboratory); // 设置åå æ ¼æ ·å¼ HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(StyleMonthUtils.getHeadStyle(), StyleMonthUtils.getContentStyle()); EasyExcel.write(response.getOutputStream()) .head((List<List<String>>) data.get("header")) .registerWriteHandler(horizontalCellStyleStrategy) .sheet("æåº¦") .doWrite((Collection<?>) data.get("data")); } public void exportToExcel(@NotNull(message = "æ¶é´ä¸è½ä¸ºç©ºï¼") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") LocalDateTime time, String userName, String laboratory, Boolean isMonth, HttpServletResponse response) throws Exception { performanceShiftService.exportToExcel(time,userName,laboratory,isMonth,response); } @ApiOperation(value = "ä¸´æ¶æ¥å£-æ·»å 7æä»½8æä»½çæ°æ®") @GetMapping("temporaryInterface") public void temporaryInterface() { // TODO ç»æ¯ä¸ªäººé½è¿è¡æç(é»è®¤æ©ç) PerformanceShiftAddDto performanceShiftAddDto = new PerformanceShiftAddDto(); //çæ¬¡--æ©(æ¥è¯¢åå ¸) List<SysDictData> shiftType = dictTypeService.selectDictDataByName("çæ¬¡ç±»å"); List<String> collect = shiftType.stream().filter(enums -> enums.getDictLabel().equals("æ©")).map(enums -> enums.getDictValue()).collect(Collectors.toList()); performanceShiftAddDto.setShift(collect.get(0)); //人å--ææäºº String userIds = userService.list().stream().map(user -> user.getId().toString()).distinct().collect(Collectors.joining(",")); performanceShiftAddDto.setUserId(userIds); //卿¬¡--å½æææ // è·åå½åæ¥æ LocalDate today = LocalDate.of(2024, 8, 15); // è·åæ¬æç第ä¸å¤©åæåä¸å¤© LocalDate firstDayOfMonth = today.with(TemporalAdjusters.firstDayOfMonth()); LocalDate lastDayOfMonth = today.with(TemporalAdjusters.lastDayOfMonth()); // è·åå¨å段信æ¯ï¼æ ¹æ®åºåè®¾ç½®ï¼ WeekFields weekFields = WeekFields.of(Locale.getDefault()); // è·åæ¬æç¬¬ä¸å¤©çå¨ä¸ LocalDate startOfWeek = firstDayOfMonth.with(TemporalAdjusters.previousOrSame(weekFields.getFirstDayOfWeek())); // éåæ¬æææå¤©æ°ï¼æ¾åºæ¯å¨ç第ä¸å¤©åæåä¸å¤© LocalDate endOfWeek; while (startOfWeek.isBefore(firstDayOfMonth.plusMonths(1))) { endOfWeek = startOfWeek.plusDays(6); LocalDateTime startDateTime = LocalDateTime.of(startOfWeek, LocalTime.MIDNIGHT); LocalDateTime endDateTime = LocalDateTime.of(endOfWeek, LocalTime.MIDNIGHT); performanceShiftAddDto.setStartWeek(startDateTime); performanceShiftAddDto.setEndWeek(endDateTime); performanceShiftService.performanceShiftAdd(performanceShiftAddDto); startOfWeek = startOfWeek.plusWeeks(1); } } } performance-server/src/main/java/com/ruoyi/performance/controller/StaffAttendanceController.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/controller/StaffAttendanceController.java ÐÞ¸Ä @@ -1,15 +1,11 @@ package com.ruoyi.inspect.controller; package com.ruoyi.performance.controller; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.core.domain.Result; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.inspect.dto.StaffAttendanceDTO; import com.ruoyi.inspect.pojo.StaffAttendanceTrackingRecord; import com.ruoyi.inspect.service.StaffAttendanceTrackingRecordService; import com.ruoyi.performance.dto.AuxiliaryOriginalHoursLookDto; import com.ruoyi.performance.dto.StaffAttendanceDTO; import com.ruoyi.performance.pojo.StaffAttendanceTrackingRecord; import com.ruoyi.performance.service.StaffAttendanceTrackingRecordService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.ObjectUtils; performance-server/src/main/java/com/ruoyi/performance/controller/StaffCompetencyInspectItemConfigController.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/controller/StaffCompetencyInspectItemConfigController.java ÐÞ¸Ä @@ -1,12 +1,11 @@ package com.ruoyi.inspect.controller; package com.ruoyi.performance.controller; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.Result; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.inspect.pojo.StaffCompetencyInspectItemConfig; import com.ruoyi.inspect.service.StaffCompetencyInspectItemConfigService; import com.ruoyi.performance.pojo.StaffCompetencyInspectItemConfig; import com.ruoyi.performance.service.StaffCompetencyInspectItemConfigService; import io.swagger.annotations.Api; import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired; performance-server/src/main/java/com/ruoyi/performance/controller/StaffCompetencyLevelEvaluateRecordController.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/controller/StaffCompetencyLevelEvaluateRecordController.java ÐÞ¸Ä @@ -1,8 +1,8 @@ package com.ruoyi.inspect.controller; package com.ruoyi.performance.controller; import com.ruoyi.common.core.domain.Result; import com.ruoyi.inspect.dto.StaffCompetencyLevelEvaluateRecordDTO; import com.ruoyi.inspect.service.StaffCompetencyLevelEvaluateRecordService; import com.ruoyi.performance.dto.StaffCompetencyLevelEvaluateRecordDTO; import com.ruoyi.performance.service.StaffCompetencyLevelEvaluateRecordService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiModelProperty; import org.springframework.beans.factory.annotation.Autowired; performance-server/src/main/java/com/ruoyi/performance/dto/PerformanceShiftAddDto.java
@@ -5,6 +5,7 @@ import javax.validation.constraints.NotNull; import java.time.LocalDateTime; import java.util.List; @Data public class PerformanceShiftAddDto { @@ -14,14 +15,14 @@ private String shift; @NotNull(message = "è¯·éæ©åå·¥") @ApiModelProperty("åå·¥id") private String userId; @ApiModelProperty("åå·¥idå表") private List<Integer> userIdList; @NotNull(message = "è¯·éæ©å¨æ¬¡") @ApiModelProperty("å¼å§å¨æ¬¡") @ApiModelProperty("卿¬¡å¼å§æ¶é´") private LocalDateTime startWeek; @NotNull(message = "è¯·éæ©å¨æ¬¡") @ApiModelProperty("ç»æå¨æ¬¡") @ApiModelProperty("卿¬¡ç»ææ¶é´") private LocalDateTime endWeek; } performance-server/src/main/java/com/ruoyi/performance/dto/PerformanceShiftMapDto.java
@@ -28,10 +28,13 @@ private Integer monthNum; @ApiModelProperty("æåº¦ç次ç»è®¡") private Map<String, Object> monthlyAttendance = new HashMap<>(); private Map<String, Long> monthlyAttendance = new HashMap<>(); @ApiModelProperty("æåº¦ç次ç»è®¡å符串") private String monthlyAttendanceStr; @ApiModelProperty("å¹´åº¦çæ¬¡ç»è®¡") private Map<String, Object> sidebarAnnualAttendance = new HashMap<>();; private Map<String, Long> sidebarAnnualAttendance = new HashMap<>();; @ApiModelProperty("çæ¬¡è¯¦æ ") private List<PerformanceShiftMapDto> list = new ArrayList<>(); performance-server/src/main/java/com/ruoyi/performance/dto/StaffAttendanceDTO.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/dto/StaffAttendanceDTO.java ÐÞ¸Ä @@ -1,10 +1,9 @@ package com.ruoyi.inspect.dto; package com.ruoyi.performance.dto; import com.fasterxml.jackson.annotation.JsonFormat; import com.ruoyi.inspect.pojo.StaffAttendanceTrackingRecord; import com.ruoyi.performance.pojo.StaffAttendanceTrackingRecord; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.NonNull; import org.springframework.format.annotation.DateTimeFormat; import java.time.LocalDate; performance-server/src/main/java/com/ruoyi/performance/dto/StaffCompetencyLevelEvaluateRecordDTO.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/dto/StaffCompetencyLevelEvaluateRecordDTO.java ÐÞ¸Ä @@ -1,6 +1,6 @@ package com.ruoyi.inspect.dto; package com.ruoyi.performance.dto; import com.ruoyi.inspect.pojo.StaffCompetencyLevelEvaluateRecord; import com.ruoyi.performance.pojo.StaffCompetencyLevelEvaluateRecord; import io.swagger.annotations.ApiModelProperty; import lombok.Data; performance-server/src/main/java/com/ruoyi/performance/excel/StaffAttendanceAnnotationTextExcelData.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/excel/StaffAttendanceAnnotationTextExcelData.java ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.ruoyi.inspect.excel; package com.ruoyi.performance.excel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; performance-server/src/main/java/com/ruoyi/performance/excel/StaffAttendanceExcelData.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/excel/StaffAttendanceExcelData.java ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.ruoyi.inspect.excel; package com.ruoyi.performance.excel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -73,6 +73,12 @@ private Integer sickLeaveCount; /** * 产åå¤©æ° */ @ApiModelProperty("产å天æ°") private Integer maternityLeaveCount; /** * åºå¤å¤©æ° */ @ApiModelProperty("åºå¤å¤©æ°") performance-server/src/main/java/com/ruoyi/performance/excel/handler/attendance/CommentWriteHandler.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/excel/handler/CommentWriteHandler.java ÐÞ¸Ä @@ -1,10 +1,10 @@ package com.ruoyi.inspect.excel.handler; package com.ruoyi.performance.excel.handler.attendance; import com.alibaba.excel.util.BooleanUtils; import com.alibaba.excel.write.handler.RowWriteHandler; import com.alibaba.excel.write.handler.context.RowWriteHandlerContext; import com.ruoyi.inspect.excel.StaffAttendanceAnnotationTextExcelData; import com.ruoyi.inspect.excel.StaffAttendanceExcelData; import com.ruoyi.performance.excel.StaffAttendanceAnnotationTextExcelData; import com.ruoyi.performance.excel.StaffAttendanceExcelData; import org.apache.commons.lang3.StringUtils; import org.apache.poi.ss.usermodel.Cell; import org.apache.poi.ss.usermodel.CellStyle; performance-server/src/main/java/com/ruoyi/performance/excel/handler/attendance/StaffAttendanceHeaderWriteHandler.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/excel/handler/StaffAttendanceHeaderWriteHandler.java ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.ruoyi.inspect.excel.handler; package com.ruoyi.performance.excel.handler.attendance; import com.alibaba.excel.write.handler.SheetWriteHandler; import com.alibaba.excel.write.handler.context.SheetWriteHandlerContext; performance-server/src/main/java/com/ruoyi/performance/mapper/PerformanceShiftMapper.java
@@ -31,11 +31,8 @@ @Param("laboratory") String laboratory ); List<Map<String, Object>> performanceShiftYearPage(@Param("time") String time, @Param("userName") String userName, @Param("laboratory") String laboratory); List<PerformanceShiftMapDto> performanceShiftYear(@Param("time") String time, @Param("userName") String userName, @Param("laboratory") String laboratory); List<PerformanceShiftMapDto> performanceShiftYear(@Param("startDateTime") LocalDateTime startDateTime, @Param("endDateTime") LocalDateTime endDateTime, @Param("userName") String userName, @Param("laboratory") String laboratory); List<Map<String, Object>> performanceShiftYearList(@Param("time") String time, @Param("userName") String userName, @Param("laboratory") String laboratory); performance-server/src/main/java/com/ruoyi/performance/mapper/StaffAttendanceTrackingRecordMapper.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/mapper/StaffAttendanceTrackingRecordMapper.java ÐÞ¸Ä @@ -1,7 +1,7 @@ package com.ruoyi.inspect.mapper; package com.ruoyi.performance.mapper; import com.ruoyi.inspect.pojo.StaffAttendanceTrackingRecord; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.performance.pojo.StaffAttendanceTrackingRecord; import java.util.List; performance-server/src/main/java/com/ruoyi/performance/mapper/StaffCompetencyInspectItemConfigMapper.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/mapper/StaffCompetencyInspectItemConfigMapper.java ÐÞ¸Ä @@ -1,9 +1,9 @@ package com.ruoyi.inspect.mapper; package com.ruoyi.performance.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.inspect.pojo.StaffCompetencyInspectItemConfig; import com.ruoyi.inspect.vo.StaffCompetencyInspectItemConfigVO; import com.ruoyi.inspect.vo.StaffConfigHeaderVO; import com.ruoyi.performance.pojo.StaffCompetencyInspectItemConfig; import com.ruoyi.performance.vo.StaffCompetencyInspectItemConfigVO; import com.ruoyi.performance.vo.StaffConfigHeaderVO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; performance-server/src/main/java/com/ruoyi/performance/mapper/StaffCompetencyLevelEvaluateRecordMapper.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/mapper/StaffCompetencyLevelEvaluateRecordMapper.java ÐÞ¸Ä @@ -1,11 +1,10 @@ package com.ruoyi.inspect.mapper; package com.ruoyi.performance.mapper; import com.ruoyi.common.core.domain.entity.User; import com.ruoyi.inspect.dto.StaffCompetencyLevelEvaluateRecordDTO; import com.ruoyi.inspect.pojo.StaffCompetencyLevelEvaluateRecord; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.inspect.vo.StaffCompetencyLevelEvaluateRecordVO; import com.ruoyi.inspect.vo.TestUserVO; import com.ruoyi.performance.dto.StaffCompetencyLevelEvaluateRecordDTO; import com.ruoyi.performance.pojo.StaffCompetencyLevelEvaluateRecord; import com.ruoyi.performance.vo.StaffCompetencyLevelEvaluateRecordVO; import com.ruoyi.performance.vo.TestUserVO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; performance-server/src/main/java/com/ruoyi/performance/pojo/PerformanceShift.java
@@ -55,4 +55,11 @@ @ApiModelProperty("æ¹æ³¨å 容") private String annotationText; public PerformanceShift() { } public PerformanceShift(Integer userId, LocalDateTime workTime) { this.userId = userId; this.workTime = workTime; } } performance-server/src/main/java/com/ruoyi/performance/pojo/StaffAttendanceTrackingRecord.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/pojo/StaffAttendanceTrackingRecord.java ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.ruoyi.inspect.pojo; package com.ruoyi.performance.pojo; import com.baomidou.mybatisplus.annotation.*; performance-server/src/main/java/com/ruoyi/performance/pojo/StaffCompetencyInspectItemConfig.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/pojo/StaffCompetencyInspectItemConfig.java ÐÞ¸Ä @@ -1,11 +1,10 @@ package com.ruoyi.inspect.pojo; package com.ruoyi.performance.pojo; import com.baomidou.mybatisplus.annotation.*; import lombok.Data; import java.io.Serializable; import java.time.LocalDateTime; import java.util.Date; import lombok.Data; /** * 人åè½å-æ£éªé¡¹é 置表 performance-server/src/main/java/com/ruoyi/performance/pojo/StaffCompetencyLevelEvaluateRecord.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/pojo/StaffCompetencyLevelEvaluateRecord.java ÐÞ¸Ä @@ -1,11 +1,10 @@ package com.ruoyi.inspect.pojo; package com.ruoyi.performance.pojo; import com.baomidou.mybatisplus.annotation.*; import lombok.Data; import java.io.Serializable; import java.time.LocalDateTime; import java.util.Date; import lombok.Data; /** * 人åè½åç级è¯å®è¡¨ performance-server/src/main/java/com/ruoyi/performance/service/PerformanceShiftService.java
@@ -6,6 +6,9 @@ import com.ruoyi.performance.dto.PerformanceShiftAddDto; import com.ruoyi.performance.pojo.PerformanceShift; import javax.servlet.http.HttpServletResponse; import javax.validation.constraints.NotNull; import java.time.LocalDateTime; import java.util.List; import java.util.Map; @@ -25,11 +28,9 @@ void performanceShiftUpdate(PerformanceShift performanceShift); List<Map<String, Object>> performanceShiftPageYear(String time, String userName, String laboratory); Map<Object, Object> exportToYearExcel(String time, String userName, String laboratory) throws Exception; Map<Object, Object> exportToMonthExcel(String time, String userName, String laboratory); List<Map<String, Object>> performanceShiftPageYear(LocalDateTime time, String userName, String laboratory); boolean editAnnotationText(PerformanceShift performanceShift); void exportToExcel(LocalDateTime time, String userName, String laboratory, Boolean isMonth, HttpServletResponse response); } performance-server/src/main/java/com/ruoyi/performance/service/StaffAttendanceTrackingRecordService.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/service/StaffAttendanceTrackingRecordService.java ÐÞ¸Ä @@ -1,12 +1,12 @@ package com.ruoyi.inspect.service; package com.ruoyi.performance.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.inspect.dto.StaffAttendanceDTO; import com.ruoyi.inspect.pojo.StaffAttendanceTrackingRecord; import com.ruoyi.inspect.vo.StaffAttendanceVO; import com.ruoyi.performance.dto.PerformanceShiftMapDto; import com.ruoyi.performance.dto.StaffAttendanceDTO; import com.ruoyi.performance.pojo.StaffAttendanceTrackingRecord; import com.ruoyi.performance.vo.StaffAttendanceVO; import javax.servlet.http.HttpServletResponse; import java.time.LocalDateTime; @@ -21,6 +21,8 @@ boolean syncAttendanceRecord(LocalDateTime startDate, LocalDateTime endDate); List<StaffAttendanceVO> getAttendanceRecord(List<PerformanceShiftMapDto> performanceShifts, StaffAttendanceDTO staffAttendanceDTO); IPage<StaffAttendanceVO> pageAttendanceRecord(Page<StaffAttendanceTrackingRecord> page, StaffAttendanceDTO staffAttendanceDTO); List<StaffAttendanceTrackingRecord> getClockInRecord(StaffAttendanceDTO staffAttendanceDTO); performance-server/src/main/java/com/ruoyi/performance/service/StaffCompetencyInspectItemConfigService.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/service/StaffCompetencyInspectItemConfigService.java ÐÞ¸Ä @@ -1,7 +1,7 @@ package com.ruoyi.inspect.service; package com.ruoyi.performance.service; import com.ruoyi.inspect.pojo.StaffCompetencyInspectItemConfig; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.performance.pojo.StaffCompetencyInspectItemConfig; import java.util.List; performance-server/src/main/java/com/ruoyi/performance/service/StaffCompetencyLevelEvaluateRecordService.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/service/StaffCompetencyLevelEvaluateRecordService.java ÐÞ¸Ä @@ -1,8 +1,8 @@ package com.ruoyi.inspect.service; package com.ruoyi.performance.service; import com.ruoyi.inspect.dto.StaffCompetencyLevelEvaluateRecordDTO; import com.ruoyi.inspect.pojo.StaffCompetencyLevelEvaluateRecord; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.performance.dto.StaffCompetencyLevelEvaluateRecordDTO; import com.ruoyi.performance.pojo.StaffCompetencyLevelEvaluateRecord; import javax.servlet.http.HttpServletResponse; import java.util.List; performance-server/src/main/java/com/ruoyi/performance/service/impl/PerformanceShiftServiceImpl.java
@@ -2,29 +2,48 @@ import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.core.metadata.IPage; import cn.hutool.core.util.ObjectUtil; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelWriter; import com.alibaba.excel.support.ExcelTypeEnum; import com.alibaba.excel.write.metadata.WriteSheet; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.google.common.util.concurrent.AtomicDouble; import com.ruoyi.common.core.domain.entity.SysDictData; import com.ruoyi.common.core.domain.entity.User; import com.ruoyi.common.utils.JackSonUtil; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.performance.dto.PerformanceShiftAddDto; import com.ruoyi.performance.dto.PerformanceShiftMapDto; import com.ruoyi.performance.dto.StaffAttendanceDTO; import com.ruoyi.performance.excel.PerformanceShiftAnnotationTextExcelData; import com.ruoyi.performance.excel.PerformanceShiftExcelData; import com.ruoyi.performance.excel.handler.performance.CommentWriteHandler; import com.ruoyi.performance.mapper.PerformanceShiftMapper; import com.ruoyi.performance.pojo.PerformanceShift; import com.ruoyi.performance.pojo.StaffAttendanceTrackingRecord; import com.ruoyi.performance.service.PerformanceShiftService; import com.ruoyi.performance.service.StaffAttendanceTrackingRecordService; import com.ruoyi.performance.vo.StaffAttendanceVO; import com.ruoyi.system.mapper.UserMapper; import com.ruoyi.system.service.ISysDictTypeService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.apache.ibatis.annotations.Param; import org.apache.poi.ss.usermodel.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import org.springframework.util.ObjectUtils; import java.math.BigDecimal; import javax.servlet.http.HttpServletResponse; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.LocalDateTime; @@ -33,6 +52,7 @@ import java.time.temporal.TemporalAdjusters; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Collectors; /** @@ -43,11 +63,15 @@ * @author æ±èéµ·éç½ç»ç§ææéå ¬å¸ * @since 2024-05-08 09:12:04 */ @Slf4j @Service public class PerformanceShiftServiceImpl extends ServiceImpl<PerformanceShiftMapper, PerformanceShift> implements PerformanceShiftService { @Autowired private ISysDictTypeService dictTypeService; @Autowired private StaffAttendanceTrackingRecordService trackingRecordService; @Autowired UserMapper userMapper; @@ -56,67 +80,51 @@ private DateTimeFormatter yyyyMMddHHmmss = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); private DateTimeFormatter yyyMMStr = DateTimeFormatter.ofPattern("yyyyå¹´MMæddæ¥"); private final int LIST_MAX_COUNT = 1000; private static final String morningShiftKeyword = "æ©";//æ©ççæ¬¡å ³é®å private static final String dayShiftKeyword = "ä¸";//ä¸ççæ¬¡å ³é®å private static final String nightShiftKeyword = "å¤";//å¤ççæ¬¡å ³é®å private static final String holidayLeaveKeyword = "ä¼";//ä¼åï¼è°ä¼åçæ¬¡å ³é®å private static final String officialTripKeyword = "å ¬";//å ¬å·®çæ¬¡å ³é®å private static final String personalLeaveKeyword = "äº";//äºåçæ¬¡å ³é®å private static final String sickLeaveKeyword = "ç ";//ç åçæ¬¡å ³é®å private static final String annualLeaveKeyword = "å¹´";//å¹´åçæ¬¡å ³é®å private static final String marriageLeaveKeyword = "å©";//å©åçæ¬¡å ³é®å private static final String maternityLeaveKeyword = "产";//产åçæ¬¡å ³é®å private static final String bereavementLeaveKeyword = "丧";//丧åçæ¬¡å ³é®å private static final List<String> shiftSoreList = Arrays.asList("æ©","ä¸","å¤","ä¼","å ¬","äº","ç ","å¹´","å©","产","丧"); @Transactional(rollbackFor = Exception.class) @Override public void performanceShiftAdd(PerformanceShiftAddDto performanceShiftAddDto) { List<PerformanceShift> list = new ArrayList<>(); LocalDateTime startWeek = performanceShiftAddDto.getStartWeek(); LocalDateTime endWeek = performanceShiftAddDto.getEndWeek(); String formattedDateTime = performanceShiftAddDto.getStartWeek().format(yyyyMMdd); String[] splitUserId = performanceShiftAddDto.getUserId().split(","); for (String userId : splitUserId) { //夿æ¯å¦è·¨æ boolean isMonth = startWeek.getMonthValue() != endWeek.getMonthValue(); if (isMonth){ //å¦æè·¨æ,å两个æé½å¤æä¸ä¸çæ°æ®åºæ¯åªä¸ªæä»½çæ°æ®æ²¡æ boolean exists1 = baseMapper.exists(Wrappers.<PerformanceShift>lambdaQuery() .eq(PerformanceShift::getWorkTime, startWeek) .eq(PerformanceShift::getUserId, userId)); boolean exists2 = baseMapper.exists(Wrappers.<PerformanceShift>lambdaQuery() .eq(PerformanceShift::getWorkTime, endWeek) .eq(PerformanceShift::getUserId, userId)); if (!exists1 && !exists2){ //两个æé½ä¸å卿°æ® list = saveMonth(performanceShiftAddDto.getStartWeek(), userId, list); list = saveMonth(performanceShiftAddDto.getEndWeek(), userId, list); }else if (!exists1 && exists2){ //å¼å§çæä»½ä¸å卿°æ® list = saveMonth(performanceShiftAddDto.getStartWeek(), userId, list); }else if (exists1 && !exists2){ //ç»æçæä»½ä¸å卿°æ® list = saveMonth(performanceShiftAddDto.getEndWeek(), userId, list); //1.æ¥è¯¢æé卿¬¡æ¶é´èå´å å·²æççæ°æ® List<PerformanceShift> shiftList = baseMapper.selectList(Wrappers.<PerformanceShift>lambdaQuery() .between(ObjectUtils.allNotNull(performanceShiftAddDto.getStartWeek(), performanceShiftAddDto.getEndWeek()), PerformanceShift::getWorkTime, performanceShiftAddDto.getStartWeek(), performanceShiftAddDto.getEndWeek()) .in(!performanceShiftAddDto.getUserIdList().isEmpty(), PerformanceShift::getUserId, performanceShiftAddDto.getUserIdList()) ); List<LocalDateTime> timeList = getLocalDateTimesBetween(performanceShiftAddDto.getStartWeek(), performanceShiftAddDto.getEndWeek()); //å¤çéä¸äººå List<PerformanceShift> newShiftList = new ArrayList<>(); performanceShiftAddDto.getUserIdList().forEach(userId->{ List<PerformanceShift> oldShifts = shiftList.stream().filter(f -> Objects.equals(f.getUserId(), userId)).collect(Collectors.toList()); timeList.forEach(time->{ PerformanceShift performanceShift = oldShifts.stream().filter(f -> f.getWorkTime().isEqual(time)).findFirst().orElse(new PerformanceShift(userId, time)); if(Objects.isNull(performanceShift.getId())||StringUtils.isBlank(performanceShift.getShift())){ performanceShift.setShift(performanceShiftAddDto.getShift()); newShiftList.add(performanceShift); } }else { //ä¸è·¨æ boolean exists = baseMapper.exists(Wrappers.<PerformanceShift>lambdaQuery() .in(PerformanceShift::getWorkTime, formattedDateTime) .eq(PerformanceShift::getUserId, userId)); // 妿ä¸å卿·»å æ°æ® if (!exists) { list = saveMonth(performanceShiftAddDto.getEndWeek(), userId, list); } }); if(newShiftList.size()>LIST_MAX_COUNT){ this.saveBatch(newShiftList); newShiftList.clear(); } } if (!list.isEmpty()) { baseMapper.insertBatchSomeColumn(list); list.clear(); } // 忬¡æ´æ° List<LocalDateTime> datesBetween = getLocalDateTimesBetween(performanceShiftAddDto.getStartWeek(), performanceShiftAddDto.getEndWeek()); for (LocalDateTime date : datesBetween) { for (String s : splitUserId) { PerformanceShift performanceShift = new PerformanceShift(); performanceShift.setShift(performanceShiftAddDto.getShift()); performanceShift.setUserId(Integer.valueOf(s)); performanceShift.setWorkTime(date); String formatterDateTime = date.format(yyyyMMdd); baseMapper.update(new PerformanceShift(), Wrappers.<PerformanceShift>lambdaUpdate() .set(PerformanceShift::getShift, performanceShiftAddDto.getShift()) .eq(PerformanceShift::getUserId, s) .eq(PerformanceShift::getWorkTime, formatterDateTime)); } } }); if(!newShiftList.isEmpty())this.saveOrUpdateBatch(newShiftList); } private List<PerformanceShift> saveMonth (LocalDateTime week,String userId,List<PerformanceShift> list){ @@ -139,21 +147,9 @@ @Override public Map<String, Object> performanceShift( String time, String userName, String laboratory) { //æ¥è¯¢å½åç»å½äººåçæ¶æ Integer userId = SecurityUtils.getUserId().intValue(); //å¤æå ¨é¨,个人,ç»ç»çæé User user = userMapper.selectById(userId);//å½åç»å½ç人 //è·åå½å人æå±å®éªå®¤id String departLimsId = user.getDepartLimsId(); if (com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isNotEmpty(departLimsId) && !departLimsId.isEmpty()) { String[] split = departLimsId.split(","); //æ¥è¯¢å¯¹åºæ¶æåç§°(éä¿¡å®éªå®¤,çµåå®éªå®¤,æ£æµå) String departLims = baseMapper.seldepLimsId(Integer.parseInt(split[split.length - 1])); if (departLims.contains("å®éªå®¤")) { laboratory = departLims; } } // List<SysDictData> shiftType = dictTypeService.selectDictDataByName("çæ¬¡ç±»å"); //æ¥è¯¢äººåæ¶æ List<User> userList = userMapper.selectUserListByPerformance(false); List<Integer> userIdList = userList.stream().map(User::getId).collect(Collectors.toList()); //çæ¬¡æ¶é´èå´ä¸ºä¸ä¸ªæç26å·å°æ¬æç25å· LocalDateTime localDateTime = LocalDateTime.parse(time, yyyyMMddHHmmss); LocalDate firstDayOfMonth = localDateTime.toLocalDate().minusMonths(1L).withDayOfMonth(26); @@ -166,65 +162,70 @@ PerformanceShiftMapDto shiftMapDto = new PerformanceShiftMapDto(); List<PerformanceShiftMapDto> shiftMapDtos = groupByUserId.get(key); //ç»è®¡åçæ¬¡å¤©æ° countShift(shiftMapDto.getMonthlyAttendance(),shiftMapDtos); Map<String, Long> countShift = countShift(shiftMapDtos); shiftMapDto.setMonthlyAttendance(countShift); shiftMapDto.setMonthlyAttendanceStr(formateMap(countShift)); shiftMapDto.setList(shiftMapDtos); shiftMapDto.setUserName(shiftMapDtos.isEmpty()?"":shiftMapDtos.get(0).getUserName()); shiftMapDto.setUserId(key); newRecords.add(shiftMapDto); }); newRecords.sort(Comparator.comparing(r->userIdList.indexOf(r.getUserId()))); Map<String, Object> resultMap = new HashMap<>(); resultMap.put("page", newRecords); resultMap.put("headerList", getYearHeaderTimeList(firstDayOfMonth,lastDayOfMonth)); return resultMap; } /** * ç»è®¡ç次 * @param targetMap ç»æå¯¹è±¡ * @param shiftMapDtos çæ¬¡å表 */ private void countShift(Map<String,Object> targetMap,List<PerformanceShiftMapDto> shiftMapDtos){ //æ±æ»æ©çãä¸çãå¤çã伿¯ã请åãåºå·®ç天æ°ï¼ä»¥åæ»åºå¤å¤©æ° Map<String, List<PerformanceShiftMapDto>> groupByShift = shiftMapDtos.stream().collect(Collectors.groupingBy(PerformanceShift::getShift)); AtomicInteger morningShift = new AtomicInteger(0);//æ©ç AtomicInteger swingShift = new AtomicInteger(0);//ä¸ç AtomicInteger nightShift = new AtomicInteger(0);//æç AtomicInteger holidayShift = new AtomicInteger(0);//ä¼ AtomicInteger leaveShift = new AtomicInteger(0);//请å groupByShift.keySet().forEach(shiftKey->{ switch (shiftKey){ case "0"://æ©12 case "2"://æ©ç8 case "6"://æ©10 morningShift.addAndGet(groupByShift.get(shiftKey).size()); break; case "3"://ä¸ç8 swingShift.addAndGet(groupByShift.get(shiftKey).size()); break; case "1"://å¤12 case "4"://å¤ç8 nightShift.addAndGet(groupByShift.get(shiftKey).size()); break; case "5"://ä¼ holidayShift.addAndGet(groupByShift.get(shiftKey).size()); break; case "7"://äº case "8"://ç case "9"://å¹´ case "10"://å© case "11"://è°ä¼ case "12"://产 case "13"://丧 leaveShift.addAndGet(groupByShift.get(shiftKey).size()); break; public String formateMap(Map<String, Long> map){ List<String> stringList = new ArrayList<>(); map.forEach((k,v)->{ if(shiftSoreList.contains(k)){ stringList.add(k+":"+v); } }); targetMap.put("morningShift",morningShift.get()); targetMap.put("swingShift",swingShift.get()); targetMap.put("nightShift",nightShift.get()); targetMap.put("holidayShift",holidayShift.get()); targetMap.put("leaveShift",leaveShift.get()); return String.join(",",stringList); } /** * ç»è®¡ç次 * @param shiftMapDtos çæ¬¡å表 */ private Map<String,Long> countShift(List<PerformanceShiftMapDto> shiftMapDtos){ TreeMap<String, Long> targetMap = new TreeMap<>(Comparator.comparing(shiftSoreList::indexOf)); //æ±æ»æ©çãä¸çãå¤çã伿¯ã请åãåºå·®ç天æ°ï¼ä»¥åæ»åºå¤å¤©æ° Map<String, Long> groupByShiftName = shiftMapDtos.stream().filter(f-> StringUtils.isNotBlank(f.getShiftName())).collect(Collectors.groupingBy(PerformanceShiftMapDto::getShiftName,Collectors.counting())); AtomicLong morningShiftCount = new AtomicLong(0);//æ©ç AtomicLong dayShiftCount = new AtomicLong(0);//ä¸ç AtomicLong nightShiftCount = new AtomicLong(0);//æç AtomicLong holidayShiftCount = new AtomicLong(0);//ä¼ AtomicLong totalCount = new AtomicLong(0);//æ»åºå¤å¤©æ° groupByShiftName.keySet().forEach(key->{ if(key.contains(morningShiftKeyword)){ morningShiftCount.getAndAdd(groupByShiftName.get(key)); totalCount.getAndAdd(groupByShiftName.get(key)); }else if(key.contains(dayShiftKeyword)){ dayShiftCount.getAndAdd(groupByShiftName.get(key)); totalCount.getAndAdd(groupByShiftName.get(key)); }else if(key.contains(nightShiftKeyword)){ nightShiftCount.getAndAdd(groupByShiftName.get(key)); totalCount.getAndAdd(groupByShiftName.get(key)); }else if(key.contains(holidayLeaveKeyword)){ holidayShiftCount.getAndAdd(groupByShiftName.get(key)); }else if(key.contains(officialTripKeyword)){ targetMap.put(key,groupByShiftName.get(key)); totalCount.getAndAdd(groupByShiftName.get(key)); }else{ targetMap.put(key,groupByShiftName.get(key)); } }); targetMap.put("æ©",morningShiftCount.get()); targetMap.put("ä¸",dayShiftCount.get()); targetMap.put("å¤",nightShiftCount.get()); targetMap.put("ä¼",holidayShiftCount.get()); targetMap.put("totalCount",totalCount.get()); return targetMap; } /** @@ -254,23 +255,16 @@ } @Override public List<Map<String, Object>> performanceShiftPageYear(String time, String userName, String laboratory) { //æ¥è¯¢å½åç»å½äººåçæ¶æ Integer userId = SecurityUtils.getUserId().intValue(); //å¤æå ¨é¨,个人,ç»ç»çæé User user = userMapper.selectById(userId);//å½åç»å½ç人 //è·åå½å人æå±å®éªå®¤id String departLimsId = user.getDepartLimsId(); if (StringUtils.isNotEmpty(departLimsId) && !departLimsId.equals("")) { String[] split = departLimsId.split(","); //æ¥è¯¢å¯¹åºæ¶æåç§°(éä¿¡å®éªå®¤,çµåå®éªå®¤,æ£æµå) String departLims = baseMapper.seldepLimsId(Integer.parseInt(split[split.length - 1])); if (departLims.contains("å®éªå®¤")) { laboratory = departLims; } public List<Map<String, Object>> performanceShiftPageYear(LocalDateTime time, String userName, String laboratory) { //æ¥è¯¢äººåæ¶æ List<User> userList = userMapper.selectUserListByPerformance(false); List<Integer> userIdList = userList.stream().map(User::getId).collect(Collectors.toList()); if(ObjectUtil.isEmpty(time)){ throw new RuntimeException("æ¥è¯¢æ¥æä¸è½ä¸ºç©º"); } // List<SysDictData> shiftType = dictTypeService.selectDictDataByName("çæ¬¡ç±»å"); List<PerformanceShiftMapDto> shiftYearList = baseMapper.performanceShiftYear(time, userName, laboratory); LocalDateTime startDateTime = time.minusMonths(1L).withDayOfMonth(26); LocalDateTime endDateTime = time.plusMonths(11L).withDayOfMonth(25); List<PerformanceShiftMapDto> shiftYearList = baseMapper.performanceShiftYear(startDateTime,endDateTime, userName, laboratory); //æäººååç»ï¼ç»è®¡æ¯ä¸ªäººçå¹´åº¦çæ¬¡ Map<Integer, List<PerformanceShiftMapDto>> groupByUserId = shiftYearList.stream().collect(Collectors.groupingBy(PerformanceShift::getUserId)); List<Map<String,Object>> returnList = new ArrayList<>(); @@ -278,195 +272,287 @@ //ææä»½åç»ï¼ç»è®¡æ¯ä¸ªæççæ¬¡è¯¦æ Map<String, Object> returnMap = new HashMap<>(); List<PerformanceShiftMapDto> shiftMapDtos = groupByUserId.get(userIdKey); Map<String, Object> sidebarAnnualAttendance = new HashMap<>(); countShift(sidebarAnnualAttendance,shiftMapDtos);//å¹´åº¦çæ¬¡ç»è®¡ List<Map<String,Object>> monthlyAttendance = new ArrayList<>(); Map<String, Long> sidebarAnnualAttendance = countShift(shiftMapDtos);//å¹´åº¦çæ¬¡ç»è®¡ List<Map<String, Object>> monthlyAttendances = new ArrayList<>(); if(!shiftMapDtos.isEmpty()){ returnMap.put("userName",shiftMapDtos.get(0).getUserName()); returnMap.put("userId",shiftMapDtos.get(0).getUserId()); Map<Integer, List<PerformanceShiftMapDto>> groupByMonthNum = shiftMapDtos.stream().collect(Collectors.groupingBy(PerformanceShiftMapDto::getMonthNum)); //éå12个æççæ¬¡ä¿¡æ¯ for (int i = 1; i <= 12; i++) { List<PerformanceShiftMapDto> monthShiftDtos = groupByMonthNum.get(i); for (int i = 0; i < 11; i++) { LocalDateTime firstDayOfMonth = startDateTime.plusMonths(i); LocalDateTime lastDayOfMonth = firstDayOfMonth.plusMonths(1L).withDayOfMonth(25); Map<String, Object> monthlyAttendanceMap = new HashMap<>(); List<PerformanceShiftMapDto> monthShiftDtos = shiftMapDtos.stream().filter(f->!f.getWorkTime().isBefore(firstDayOfMonth)&&!f.getWorkTime().isAfter(lastDayOfMonth)).collect(Collectors.toList()); if(CollectionUtils.isEmpty(monthShiftDtos)){ countShift(monthlyAttendanceMap,new ArrayList<>());//æåº¦ç次ç»è®¡ monthlyAttendanceMap.put("monthlyAttendanceStr",formateMap(countShift(new ArrayList<>())));//æåº¦ç次ç»è®¡ monthlyAttendanceMap.put("monthlyAttendance",countShift(new ArrayList<>()));//æåº¦ç次ç»è®¡ }else{ countShift(monthlyAttendanceMap,monthShiftDtos);//æåº¦ç次ç»è®¡ monthlyAttendanceMap.put("monthlyAttendanceStr",formateMap(countShift(monthShiftDtos)));//æåº¦ç次ç»è®¡ monthlyAttendanceMap.put("monthlyAttendance",countShift(monthShiftDtos));//æåº¦ç次ç»è®¡ } monthlyAttendance.add(monthlyAttendanceMap); monthlyAttendances.add(monthlyAttendanceMap); } returnMap.put("monthlyAttendance",monthlyAttendance); returnMap.put("monthlyAttendances",monthlyAttendances); returnMap.put("sidebarAnnualAttendance",sidebarAnnualAttendance); returnMap.put("sidebarAnnualAttendanceStr",formateMap(sidebarAnnualAttendance)); } returnList.add(returnMap); }); returnList.sort(Comparator.comparing(r->userIdList.indexOf(Integer.parseInt(r.get("userId").toString())))); return returnList; } // å¹´å页ä¸å¯¼åºå ±åä½¿ç¨ public List<Map<String, Object>> annualAttendanceProcessing(List<Map<String, Object>> mapYearList, List<SysDictData> shiftType) { for (Map<String, Object> map : mapYearList) { Map<String, Object> resultMap = new LinkedHashMap<>(); Map<String, Object> hashMapYear = new LinkedHashMap<>(); double totalYearAttendance = 0; // ä¸å¹´12个æ for (int i = 1; i < 13; i++) { Map<String, Object> hashMapMonth = new LinkedHashMap<>(); double totalMonthAttendance = 0; for (SysDictData shift : shiftType) { // åå§åèµå¼ if (!hashMapYear.containsKey(shift.getDictLabel())) { hashMapYear.put(shift.getDictLabel(), 0); } // æ if (!ObjectUtils.isEmpty(map.get("month_str"))) { String charArray = map.get("month_str").toString(); int count = countOccurrences(charArray, i + "ï¼" + shift.getDictValue()); hashMapMonth.put(shift.getDictLabel(), count); hashMapYear.put(shift.getDictLabel(), new BigDecimal(hashMapYear.get(shift.getDictLabel()).toString()).add(new BigDecimal(count))); // æ©ï¼ä¸ï¼å¤ï¼å·® if (shift.getDictValue().equals("0") || shift.getDictValue().equals("1") || shift.getDictValue().equals("2") || shift.getDictValue().equals("6")) { totalMonthAttendance += count; totalYearAttendance += count; } // åï¼å¦å¤å天ç®ç»æ© if (shift.getDictValue().equals("5")) { BigDecimal multiply = new BigDecimal("0.5").multiply(new BigDecimal(count)).setScale(1, BigDecimal.ROUND_CEILING); hashMapMonth.put(shiftType.get(0).getDictLabel(), new BigDecimal(hashMapMonth.get(shiftType.get(0).getDictLabel()).toString()).add(multiply)); hashMapYear.put(shiftType.get(0).getDictLabel(), new BigDecimal(hashMapYear.get(shiftType.get(0).getDictLabel()).toString()).add(multiply)); totalMonthAttendance += multiply.doubleValue(); totalYearAttendance += multiply.doubleValue(); } } // ç©ºæ°æ® else { map.put("work_time", i); hashMapMonth.put(shift.getDictLabel(), 0); } } hashMapMonth.put("totalMonthAttendance", totalMonthAttendance); hashMapYear.put("totalYearAttendance", totalYearAttendance); resultMap.put(i + "", hashMapMonth); } map.remove("month_str"); map.remove("year_str"); map.put("year", hashMapYear); map.put("month", resultMap); } return mapYearList; } public static int countOccurrences(String str, String target) { int count = 0; int index = 0; while ((index = str.indexOf(target, index)) != -1) { count++; index += target.length(); } return count; } public List<List<Object>> dataRequiredForProcessingIntoExcel(List<Map<String, Object>> list, List<SysDictData> enums) throws Exception { List<List<Object>> data = new ArrayList<>(); for (int i = 0; i < list.size(); i++) { List<Object> excelRowList = new ArrayList<>(); excelRowList.add(i + 1); excelRowList.add(list.get(i).get("account")); excelRowList.add(list.get(i).get("name")); Map<String, Object> year = JackSonUtil.unmarshal(JackSonUtil.marshal(list.get(i).get("year")), Map.class); excelRowList.add(year.get("totalYearAttendance")); enums.forEach(j -> { if (!j.getDictValue().equals("5")) { excelRowList.add(year.get(j.getDictLabel())); } }); Map<String, Map<String, Object>> month = JackSonUtil.unmarshal(JackSonUtil.marshal(list.get(i).get("month")), Map.class); for (int j = 1; j < 13; j++) { Object totalMonthAttendance = month.get(j + "").get("totalMonthAttendance"); excelRowList.add(totalMonthAttendance); for (SysDictData anEnum : enums) { if (!anEnum.getDictValue().equals("5")) { excelRowList.add(month.get(j + "").get(anEnum.getDictLabel())); } } } data.add(excelRowList); } return data; } @Override public Map<Object, Object> exportToYearExcel(String time, String userName, String laboratory) throws Exception { Map<Object, Object> map = new HashMap<>(); List<SysDictData> shiftType = dictTypeService.selectDictDataByName("çæ¬¡ç±»å"); DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); // å°å符串æ¶é´è½¬æ¢ä¸º LocalDateTime ç±»åæ¶é´ LocalDateTime localDateTime = LocalDateTime.parse(time, formatters); map.put("header", getYearHeader(localDateTime.getYear() + " å¹´", shiftType)); List<Map<String, Object>> mapYearList = baseMapper.performanceShiftYearList(time, userName, laboratory); annualAttendanceProcessing(mapYearList, shiftType); List<List<Object>> lists = dataRequiredForProcessingIntoExcel(mapYearList, shiftType); map.put("data", lists); return map; } @Override public Map<Object, Object> exportToMonthExcel(String time, String userName, String laboratory) { List<SysDictData> shiftType = dictTypeService.selectDictDataByName("çæ¬¡ç±»å"); List<PerformanceShiftMapDto> mapIPage = baseMapper.performanceShiftList(time, userName, laboratory); mapIPage.forEach(i -> { String[] shiftTimes = i.getShiftTime().split(";"); double totalAttendance = 0; List<Map<String, Object>> map = new ArrayList<>(); // å岿¥æ for (String shiftTime : shiftTimes) { Map<String, Object> hashMap = new HashMap<>(); String[] shiftTimeAndShift = shiftTime.split("ï¼"); for (SysDictData enums : shiftType) { if (!i.getMonthlyAttendance().containsKey(enums.getDictLabel())) { i.getMonthlyAttendance().put(enums.getDictLabel(), 0); } if (enums.getDictValue().equals(shiftTimeAndShift[1])) { BigDecimal bigDecimal = new BigDecimal(i.getMonthlyAttendance().get(enums.getDictLabel()).toString()); i.getMonthlyAttendance().put(enums.getDictLabel(), bigDecimal.add(new BigDecimal("1"))); } // åï¼å¦å¤å天ç®ç»æ© if (shiftTimeAndShift[1].equals("5") && enums.getDictValue().equals("0")) { BigDecimal bigDecimal = new BigDecimal(i.getMonthlyAttendance().get(enums.getDictLabel()).toString()); i.getMonthlyAttendance().put(enums.getDictLabel(), bigDecimal.add(new BigDecimal("0.5"))); } } // æ©ï¼ä¸ï¼å¤ï¼å·® if (shiftTimeAndShift[1].equals("1") || shiftTimeAndShift[1].equals("2") || shiftTimeAndShift[1].equals("0") || shiftTimeAndShift[1].equals("6")) { i.getMonthlyAttendance().put("totalAttendance", totalAttendance += 1); } // å if (shiftTimeAndShift[1].equals("5")) { i.getMonthlyAttendance().put("totalAttendance", totalAttendance += 0.5); } hashMap.put("id", shiftTimeAndShift[3]); hashMap.put("shift", shiftTimeAndShift[1]); hashMap.put("time", shiftTimeAndShift[0]); hashMap.put("annotationText", shiftTimeAndShift[2]); map.add(hashMap); } // i.setList(map); i.setShiftTime(null); }); Map<Object, Object> map = new HashMap<>(); DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); // å°å符串æ¶é´è½¬æ¢ä¸º LocalDateTime ç±»åæ¶é´ LocalDateTime localDateTime = LocalDateTime.parse(time, formatters); map.put("header", getMonthHeader(localDateTime, shiftType)); List<List<Object>> lists = dataRequiredForProcessingIntoExcelMonth(mapIPage, shiftType); map.put("data", lists); return map; } @Override public boolean editAnnotationText(PerformanceShift performanceShift) { return this.updateById(performanceShift); } @Override public void exportToExcel(LocalDateTime time, String userName, String laboratory, Boolean isMonth, HttpServletResponse response) { response.reset(); try{ String fileName = "ä¸å¤©èä¸è´¨éé¨ç次信æ¯"+ ExcelTypeEnum.XLSX; fileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.toString()); response.setContentType("application/vnd.ms-excel"); response.setHeader("Cache-Control", "no-cache"); response.setHeader("Content-Disposition", "attachment;filename=" + fileName); response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); Map<Object, Object> data; LocalDateTime startDate; LocalDateTime endDate; if(!isMonth){ //年度ç»è®¡ï¼æ¶é´åºé´å䏿´å¹´ startDate = time.minusMonths(1L).withDayOfMonth(26); endDate = time.plusMonths(11L).withDayOfMonth(25); }else{ //æåº¦ç»è®¡ï¼æ¶é´åºé´åä¸ä¸ªæ26å·å°æ¬æ25å· startDate = time.minusMonths(1L).withDayOfMonth(26); endDate = time.withDayOfMonth(25); } List<LocalDate> performanceShiftDateList = buildPerformanceShiftDateList(startDate,endDate,isMonth); //æ¹æ³¨ä¿¡æ¯åæ ä¿¡æ¯ List<PerformanceShiftAnnotationTextExcelData> annotationTextList = new ArrayList<>(); // æ¥è¯¢ç次 List<PerformanceShiftMapDto> performanceShifts = baseMapper.selectListByWorkTime(startDate, endDate, userName); //è·åè夿°æ® StaffAttendanceDTO staffAttendanceDTO = new StaffAttendanceDTO(); staffAttendanceDTO.setStartDate(startDate); staffAttendanceDTO.setEndDate(endDate); staffAttendanceDTO.setKeyword(userName); List<StaffAttendanceVO> attendanceRecords = trackingRecordService.getAttendanceRecord(performanceShifts,staffAttendanceDTO); //ç»è£ å¯¼åºæ°æ® List<PerformanceShiftExcelData> excelData = new ArrayList<>(); Map<Integer, List<PerformanceShiftMapDto>> groupByUserId = performanceShifts.stream().collect(Collectors.groupingBy(PerformanceShiftMapDto::getUserId)); List<Integer> userIdKeys = groupByUserId.keySet().stream().sorted().collect(Collectors.toList()); for (int i = 0; i < userIdKeys.size(); i++) { List<PerformanceShiftMapDto> shiftMapDtos = groupByUserId.get(userIdKeys.get(i)); PerformanceShiftExcelData performanceShiftExcelData = new PerformanceShiftExcelData(); List<String> shiftList = new ArrayList<>(); performanceShiftExcelData.setPersonName(shiftMapDtos.get(0).getUserName()); performanceShiftExcelData.setExcelIndex(i+1); AtomicInteger morningShiftCount = new AtomicInteger(0);//æ©çå¤©æ° AtomicInteger dayShiftCount = new AtomicInteger(0);//ä¸çå¤©æ° AtomicInteger nightShiftCount = new AtomicInteger(0);//å¤çå¤©æ° AtomicInteger holidayCount = new AtomicInteger(0);//伿¯å¤©æ° AtomicInteger personalLeaveCount = new AtomicInteger(0);//äºåå¤©æ° AtomicInteger annualLeaveCount = new AtomicInteger(0);//å¹´åå¤©æ° AtomicInteger officialTripCount = new AtomicInteger(0);//å ¬å·®å¤©æ° AtomicInteger marriageLeaveCount = new AtomicInteger(0);//å©åå¤©æ° AtomicInteger bereavementLeaveCount = new AtomicInteger(0);//丧åå¤©æ° AtomicInteger sickLeaveCount = new AtomicInteger(0);//ç åå¤©æ° AtomicInteger maternityLeaveCount = new AtomicInteger(0);//产åå¤©æ° AtomicInteger totalCount = new AtomicInteger(0);//åºå¤å¤©æ° AtomicDouble attendanceWorkHourCount = new AtomicDouble(0D);//åºå¤æ»æ¶é´ for (int j = 0; j < shiftMapDtos.size(); j++) { PerformanceShiftMapDto shiftMapDto = shiftMapDtos.get(j); //ç»è®¡åçæ¬¡çå¤©æ° if(StringUtils.contains(shiftMapDto.getShiftName(),morningShiftKeyword)){ morningShiftCount.getAndIncrement(); totalCount.getAndIncrement(); }else if(StringUtils.contains(shiftMapDto.getShiftName(),dayShiftKeyword)){ dayShiftCount.getAndIncrement(); totalCount.getAndIncrement(); }else if(StringUtils.contains(shiftMapDto.getShiftName(),nightShiftKeyword)){ nightShiftCount.getAndIncrement(); totalCount.getAndIncrement(); }else if(StringUtils.contains(shiftMapDto.getShiftName(),holidayLeaveKeyword)){ holidayCount.getAndIncrement(); }else if(StringUtils.contains(shiftMapDto.getShiftName(),personalLeaveKeyword)){ personalLeaveCount.getAndIncrement(); }else if(StringUtils.contains(shiftMapDto.getShiftName(),annualLeaveKeyword)){ annualLeaveCount.getAndIncrement(); }else if(StringUtils.contains(shiftMapDto.getShiftName(),officialTripKeyword)){ officialTripCount.getAndIncrement(); totalCount.getAndIncrement(); }else if(StringUtils.contains(shiftMapDto.getShiftName(),marriageLeaveKeyword)){ marriageLeaveCount.getAndIncrement(); }else if(StringUtils.contains(shiftMapDto.getShiftName(),bereavementLeaveKeyword)){ bereavementLeaveCount.getAndIncrement(); }else if(StringUtils.contains(shiftMapDto.getShiftName(),sickLeaveKeyword)){ sickLeaveCount.getAndIncrement(); }else if(StringUtils.contains(shiftMapDto.getShiftName(),maternityLeaveKeyword)){ maternityLeaveCount.getAndIncrement(); } shiftList.add(shiftMapDto.getShiftName()); if(!StringUtils.isAllBlank(shiftMapDto.getStartTime(),shiftMapDto.getEndTime())){ //è¿æ»¤å½å人åççæ¬¡ä¿¡æ¯ StaffAttendanceVO vo = attendanceRecords.stream().filter(f-> StringUtils.isNotBlank(f.getPersonCode())).filter(f -> StringUtils.equals(f.getPersonCode(), shiftMapDto.getPersonCode()) && f.getSwingDate().isEqual(shiftMapDto.getWorkTime())).findFirst().orElse(null); if(ObjectUtils.isNotEmpty(vo)){ String actualWorkHours = Objects.toString(vo.getActualWorkHours(), ""); if (StringUtils.isNotBlank(actualWorkHours)) { attendanceWorkHourCount.getAndAdd(Double.parseDouble(actualWorkHours)); } } } //æåº¦ç»è®¡ææå ¥æ¹æ³¨æ°æ® if(isMonth){ if(StringUtils.isNotBlank(shiftMapDto.getAnnotationText())){ annotationTextList.add(new PerformanceShiftAnnotationTextExcelData(i,j,shiftMapDto.getAnnotationText())); } } } if(isMonth){ performanceShiftExcelData.setShiftNameList(shiftList); } performanceShiftExcelData.setTotalCount(totalCount.get()); //çæ¬¡èå¤å¤©æ° performanceShiftExcelData.setMorningShiftCount(morningShiftCount.get()); performanceShiftExcelData.setDayShiftCount(dayShiftCount.get()); performanceShiftExcelData.setNightShiftCount(nightShiftCount.get()); performanceShiftExcelData.setHolidayLeaveCount(holidayCount.get()); performanceShiftExcelData.setPersonalLeaveCount(personalLeaveCount.get()); performanceShiftExcelData.setAnnualLeaveCount(annualLeaveCount.get()); performanceShiftExcelData.setOfficialTripCount(officialTripCount.get()); performanceShiftExcelData.setMarriageLeaveCount(marriageLeaveCount.get()); performanceShiftExcelData.setBereavementLeaveCount(bereavementLeaveCount.get()); performanceShiftExcelData.setSickLeaveCount(sickLeaveCount.get()); performanceShiftExcelData.setMaternityLeaveCount(maternityLeaveCount.get()); performanceShiftExcelData.setTotalWorkHourCount(attendanceWorkHourCount.get()); excelData.add(performanceShiftExcelData); } //å¯¼åº InputStream resourceAsStream = buildPerformanceShiftTemplate(performanceShiftDateList,isMonth); try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(resourceAsStream).registerWriteHandler(new CommentWriteHandler(excelData, annotationTextList)).relativeHeadRowIndex(4).build()) { WriteSheet writeSheet = EasyExcel.writerSheet().build(); excelWriter.fill(excelData, writeSheet); if(!isMonth){ String startDateStr = startDate.format(yyyMMStr); String endDateStr = endDate.format(yyyMMStr); Map<String, String> dateMap = new HashMap<>(); dateMap.put("startDate",startDateStr); dateMap.put("endDate",endDateStr); excelWriter.fill(dateMap, writeSheet); } } }catch (Exception e){ throw new RuntimeException("çæ¬¡å¯¼åºå¼å¸¸"); } } private InputStream buildPerformanceShiftTemplate(List<LocalDate> attendanceDateList,Boolean isMonth) throws IOException { String templateName = "/static/performance_shift_month_template.xlsx"; if(!isMonth){ templateName = "/static/performance_shift_year_template.xlsx"; } try (InputStream templateStream = this.getClass().getResourceAsStream(templateName)) { assert templateStream != null; try (Workbook workbook = WorkbookFactory.create(templateStream); ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { Sheet sheet = workbook.getSheetAt(0); if(isMonth){ fillPerformanceShiftHeader(sheet, attendanceDateList); } workbook.write(outputStream); return new ByteArrayInputStream(outputStream.toByteArray()); } } catch (Exception e) { throw new IOException("æå»ºçæ¬¡å¯¼åºæ¨¡æ¿å¤±è´¥", e); } } private void fillPerformanceShiftHeader(Sheet sheet, List<LocalDate> attendanceDateList) { if (sheet == null || attendanceDateList == null || attendanceDateList.isEmpty()) { return; } Row titleRow = sheet.getRow(1); if (titleRow != null) { Cell titleCell = titleRow.getCell(0); if (titleCell != null) { titleCell.setCellValue(attendanceDateList.get(attendanceDateList.size() - 1).format(DateTimeFormatter.ofPattern("yyyyå¹´Mæ"))); } } Row weekRow = sheet.getRow(2); Row dayRow = sheet.getRow(3); if (weekRow == null || dayRow == null) { return; } final int startColumnIndex = 2; final int maxDateColumnCount = 31; for (int i = 0; i < maxDateColumnCount; i++) { Cell weekCell = getOrCreateCell(weekRow, startColumnIndex + i, startColumnIndex); Cell dayCell = getOrCreateCell(dayRow, startColumnIndex + i, startColumnIndex); if (i < attendanceDateList.size()) { LocalDate currentDate = attendanceDateList.get(i); weekCell.setCellValue(resolveWeekOfYear(currentDate)); dayCell.setCellValue(currentDate.getDayOfMonth()); } else { weekCell.setBlank(); dayCell.setBlank(); } } } private Cell getOrCreateCell(Row row, int cellIndex, int templateCellIndex) { Cell cell = row.getCell(cellIndex); if (cell != null) { return cell; } Cell templateCell = row.getCell(templateCellIndex); cell = row.createCell(cellIndex); if (templateCell != null && templateCell.getCellStyle() != null) { cell.setCellStyle(templateCell.getCellStyle()); } return cell; } private String resolveWeekOfYear(LocalDate date) { switch (date.getDayOfWeek()) { case MONDAY: return "ä¸"; case TUESDAY: return "äº"; case WEDNESDAY: return "ä¸"; case THURSDAY: return "å"; case FRIDAY: return "äº"; case SATURDAY: return "å "; case SUNDAY: return "æ¥"; default: return ""; } } private List<LocalDate> buildPerformanceShiftDateList(LocalDateTime startDateTime,LocalDateTime endDateTime,Boolean isMonth) { if (startDateTime == null || endDateTime == null) { throw new IllegalArgumentException("å¯¼åºæ¶é´èå´ä¸è½ä¸ºç©º"); } LocalDate startDate = startDateTime.toLocalDate(); LocalDate endDate = endDateTime.toLocalDate(); if (startDate.isAfter(endDate)) { throw new IllegalArgumentException("å¼å§æ¶é´ä¸è½æäºç»ææ¶é´"); } List<LocalDate> attendanceDateList = new ArrayList<>(); for (LocalDate currentDate = startDate; !currentDate.isAfter(endDate); currentDate = currentDate.plusDays(1)) { attendanceDateList.add(currentDate); } if (attendanceDateList.size() > 31 && isMonth) { throw new IllegalArgumentException("å¯¼åºæ¶é´èå´ä¸è½è¶ è¿31天"); } return attendanceDateList; } // è·å两个localDateTimeçæ¯ä¸å¤© @@ -589,15 +675,7 @@ excelRowList.add(list.get(i).getMonthlyAttendance().get(enums.get(1).getDictLabel())); // ä¸ excelRowList.add(list.get(i).getMonthlyAttendance().get(enums.get(2).getDictLabel())); // å¤ excelRowList.add(list.get(i).getMonthlyAttendance().get(enums.get(6).getDictLabel())); // å·® // for (Map<String, Object> o : list.get(i).getList()) { // String enumLabel = ""; // for (SysDictData anEnum : enums) { // if (anEnum.getDictValue().equals(o.get("shift"))) { // enumLabel = anEnum.getDictLabel(); // } // } // excelRowList.add(ObjectUtils.isEmpty(enumLabel) ? "-" : enumLabel); // } data.add(excelRowList); } return data; performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffAttendanceTrackingRecordServiceImpl.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/service/impl/StaffAttendanceTrackingRecordServiceImpl.java ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.ruoyi.inspect.service.impl; package com.ruoyi.performance.service.impl; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.ObjectUtil; @@ -12,27 +12,30 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.google.common.util.concurrent.AtomicDouble; import com.ruoyi.common.core.domain.entity.User; import com.ruoyi.common.enums.ClockInState; import com.ruoyi.common.enums.EnterOrExitType; import com.ruoyi.common.enums.StaffAttendanceReportType; import com.ruoyi.common.enums.CalendarType; import com.ruoyi.common.enums.SyncStatus; import com.ruoyi.common.utils.api.icc.IccApiUtil; import com.ruoyi.common.utils.api.icc.model.GetResultPageRequest; import com.ruoyi.common.utils.api.icc.model.GetResultPageResponse; import com.ruoyi.inspect.dto.StaffAttendanceDTO; import com.ruoyi.inspect.excel.StaffAttendanceAnnotationTextExcelData; import com.ruoyi.inspect.excel.StaffAttendanceExcelData; import com.ruoyi.inspect.excel.handler.CommentWriteHandler; import com.ruoyi.inspect.mapper.StaffAttendanceTrackingRecordMapper; import com.ruoyi.inspect.pojo.StaffAttendanceTrackingRecord; import com.ruoyi.inspect.service.StaffAttendanceTrackingRecordService; import com.ruoyi.inspect.util.HourDiffCalculator; import com.ruoyi.inspect.util.TimeDiffCalculator; import com.ruoyi.inspect.vo.StaffAttendanceVO; import com.ruoyi.performance.dto.StaffAttendanceDTO; import com.ruoyi.performance.excel.StaffAttendanceAnnotationTextExcelData; import com.ruoyi.performance.excel.StaffAttendanceExcelData; import com.ruoyi.performance.excel.handler.attendance.CommentWriteHandler; import com.ruoyi.performance.mapper.StaffAttendanceTrackingRecordMapper; import com.ruoyi.performance.pojo.StaffAttendanceTrackingRecord; import com.ruoyi.performance.service.StaffAttendanceTrackingRecordService; import com.ruoyi.performance.dto.PerformanceShiftMapDto; import com.ruoyi.performance.mapper.PerformanceShiftMapper; import com.ruoyi.performance.mapper.ShiftTimeMapper; import com.ruoyi.performance.pojo.ShiftTime; import com.ruoyi.performance.utils.HourDiffCalculator; import com.ruoyi.performance.utils.TimeDiffCalculator; import com.ruoyi.performance.vo.StaffAttendanceVO; import com.ruoyi.system.mapper.UserMapper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; @@ -77,6 +80,9 @@ private PerformanceShiftMapper performanceShiftMapper; @Autowired private UserMapper userMapper; @Autowired private ShiftTimeMapper shiftTimeMapper; private DateTimeFormatter yyyMMdd = DateTimeFormatter.ofPattern("yyyy-MM-dd"); @@ -102,6 +108,7 @@ private static final String marriageLeaveKeyword = "å©";//å©åçæ¬¡å ³é®å private static final String bereavementLeaveKeyword = "丧";//丧åçæ¬¡å ³é®å private static final String sickLeaveKeyword = "ç ";//ç åçæ¬¡å ³é®å private static final String maternityLeaveKeyword = "产";//产åçæ¬¡å ³é®å /** * 忥çé¨ç¦è®¾å¤å表 @@ -175,7 +182,8 @@ * @param staffAttendanceDTO è夿¥è¯¢æ¡ä»¶ * @return */ public List<StaffAttendanceVO> getAttendanceRecord(List<PerformanceShiftMapDto> performanceShifts,StaffAttendanceDTO staffAttendanceDTO) { @Override public List<StaffAttendanceVO> getAttendanceRecord(List<PerformanceShiftMapDto> performanceShifts, StaffAttendanceDTO staffAttendanceDTO) { // æ¥è¯¢æå¡è®°å½ Wrapper<StaffAttendanceTrackingRecord> queryWrapper = Wrappers.<StaffAttendanceTrackingRecord>lambdaQuery() .eq(StaffAttendanceTrackingRecord::getEnableReport, Boolean.TRUE) @@ -283,6 +291,7 @@ vo.setShiftId(p.getShift()); vo.setPersonCode(p.getPersonCode()); vo.setPersonName(p.getUserName()); vo.setUserId(p.getUserId()); //åºå¤æ¶é¿ double plannedWorkHours = Math.abs(hourDiff); vo.setDiffHour(hourDiff); @@ -435,6 +444,7 @@ AtomicInteger marriageLeaveCount = new AtomicInteger(0);//å©åå¤©æ° AtomicInteger bereavementLeaveCount = new AtomicInteger(0);//丧åå¤©æ° AtomicInteger sickLeaveCount = new AtomicInteger(0);//ç åå¤©æ° AtomicInteger maternityLeaveCount = new AtomicInteger(0);//产åå¤©æ° AtomicInteger attendanceDayCount = new AtomicInteger(0);//åºå¤å¤©æ° AtomicDouble attendanceWorkHourCount = new AtomicDouble(0D);//åºå¤æ»æ¶é´ for (int j = 0; j < shiftMapDtos.size(); j++) { @@ -454,6 +464,8 @@ bereavementLeaveCount.getAndIncrement(); }else if(StringUtils.contains(shiftMapDto.getShiftName(),sickLeaveKeyword)){ sickLeaveCount.getAndIncrement(); }else if(StringUtils.contains(shiftMapDto.getShiftName(),maternityLeaveKeyword)){ maternityLeaveCount.getAndIncrement(); } if(StringUtils.isAllBlank(shiftMapDto.getStartTime(),shiftMapDto.getEndTime())){ shiftList.add(shiftMapDto.getShiftName()); @@ -475,13 +487,13 @@ } } //æåº¦ç»è®¡ææå ¥æ¹æ³¨æ°æ® if(StringUtils.isNoneBlank(staffAttendanceDTO.getAttendanceReportType()) && StringUtils.equals(staffAttendanceDTO.getAttendanceReportType(), StaffAttendanceReportType.MONTH.name())){ if(StringUtils.isNoneBlank(staffAttendanceDTO.getAttendanceReportType()) && StringUtils.equals(staffAttendanceDTO.getAttendanceReportType(), CalendarType.MONTH.name())){ if(StringUtils.isNotBlank(shiftMapDto.getAnnotationText())){ annotationTextList.add(new StaffAttendanceAnnotationTextExcelData(i,j,shiftMapDto.getAnnotationText())); } } } if(StringUtils.isNoneBlank(staffAttendanceDTO.getAttendanceReportType()) && StringUtils.equals(staffAttendanceDTO.getAttendanceReportType(), StaffAttendanceReportType.MONTH.name())){ if(StringUtils.isNoneBlank(staffAttendanceDTO.getAttendanceReportType()) && StringUtils.equals(staffAttendanceDTO.getAttendanceReportType(), CalendarType.MONTH.name())){ attendanceExcelData.setShiftList(shiftList); } attendanceExcelData.setAttendanceDayCount(attendanceDayCount.get()); @@ -494,6 +506,7 @@ attendanceExcelData.setMarriageLeaveCount(marriageLeaveCount.get()); attendanceExcelData.setBereavementLeaveCount(bereavementLeaveCount.get()); attendanceExcelData.setSickLeaveCount(sickLeaveCount.get()); attendanceExcelData.setMaternityLeaveCount(maternityLeaveCount.get()); excelData.add(attendanceExcelData); } //å¯¼åº @@ -507,7 +520,7 @@ try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(resourceAsStream).registerWriteHandler(new CommentWriteHandler(excelData, annotationTextList)).relativeHeadRowIndex(4).build()) { WriteSheet writeSheet = EasyExcel.writerSheet().build(); excelWriter.fill(excelData, writeSheet); if(StringUtils.equals(staffAttendanceDTO.getAttendanceReportType(),StaffAttendanceReportType.YEAR.name())){ if(StringUtils.equals(staffAttendanceDTO.getAttendanceReportType(), CalendarType.YEAR.name())){ String startDate = staffAttendanceDTO.getStartDate().format(yyyMMStr); String endDate = staffAttendanceDTO.getEndDate().format(yyyMMStr); Map<String, String> dateMap = new HashMap<>(); @@ -534,7 +547,7 @@ for (LocalDate currentDate = startDate; !currentDate.isAfter(endDate); currentDate = currentDate.plusDays(1)) { attendanceDateList.add(currentDate); } if (attendanceDateList.size() > 31 && StringUtils.equals(staffAttendanceDTO.getAttendanceReportType(),StaffAttendanceReportType.MONTH.name())) { if (attendanceDateList.size() > 31 && StringUtils.equals(staffAttendanceDTO.getAttendanceReportType(), CalendarType.MONTH.name())) { throw new IllegalArgumentException("å¯¼åºæ¶é´èå´ä¸è½è¶ è¿31天"); } return attendanceDateList; @@ -542,7 +555,7 @@ private InputStream buildAttendanceTemplate(List<LocalDate> attendanceDateList,String attendanceReportType) throws IOException { String templateName = "/static/staff_attendance_month_template.xlsx"; if(StringUtils.equals(attendanceReportType,StaffAttendanceReportType.YEAR.name())){ if(StringUtils.equals(attendanceReportType, CalendarType.YEAR.name())){ templateName = "/static/staff_attendance_year_template.xlsx"; } try (InputStream templateStream = this.getClass().getResourceAsStream(templateName)) { @@ -550,7 +563,7 @@ try (Workbook workbook = WorkbookFactory.create(templateStream); ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { Sheet sheet = workbook.getSheetAt(0); if(StringUtils.equals(attendanceReportType,StaffAttendanceReportType.MONTH.name())){ if(StringUtils.equals(attendanceReportType, CalendarType.MONTH.name())){ fillAttendanceHeader(sheet, attendanceDateList); } workbook.write(outputStream); performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffCompetencyInspectItemConfigServiceImpl.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/service/impl/StaffCompetencyInspectItemConfigServiceImpl.java ÐÞ¸Ä @@ -1,15 +1,14 @@ package com.ruoyi.inspect.service.impl; package com.ruoyi.performance.service.impl; import cn.hutool.core.util.NumberUtil; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.text.Convert; import com.ruoyi.common.exception.ServiceException; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.inspect.mapper.StaffCompetencyInspectItemConfigMapper; import com.ruoyi.inspect.pojo.StaffCompetencyInspectItemConfig; import com.ruoyi.inspect.service.StaffCompetencyInspectItemConfigService; import com.ruoyi.performance.mapper.StaffCompetencyInspectItemConfigMapper; import com.ruoyi.performance.pojo.StaffCompetencyInspectItemConfig; import com.ruoyi.performance.service.StaffCompetencyInspectItemConfigService; import org.apache.commons.lang3.ObjectUtils; import org.springframework.stereotype.Service; performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffCompetencyLevelEvaluateRecordServiceImpl.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/service/impl/StaffCompetencyLevelEvaluateRecordServiceImpl.java ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.ruoyi.inspect.service.impl; package com.ruoyi.performance.service.impl; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.support.ExcelTypeEnum; @@ -8,14 +8,14 @@ import com.ruoyi.common.utils.excel.EasyExcelUtils; import com.ruoyi.common.utils.excel.FullCustomAutoWidthHandler; import com.ruoyi.common.utils.excel.HeaderContentRowHeightHandler; import com.ruoyi.inspect.dto.StaffCompetencyLevelEvaluateRecordDTO; import com.ruoyi.inspect.mapper.StaffCompetencyInspectItemConfigMapper; import com.ruoyi.inspect.mapper.StaffCompetencyLevelEvaluateRecordMapper; import com.ruoyi.inspect.pojo.StaffCompetencyInspectItemConfig; import com.ruoyi.inspect.pojo.StaffCompetencyLevelEvaluateRecord; import com.ruoyi.inspect.service.StaffCompetencyLevelEvaluateRecordService; import com.ruoyi.inspect.vo.StaffConfigHeaderVO; import com.ruoyi.inspect.vo.TestUserVO; import com.ruoyi.performance.dto.StaffCompetencyLevelEvaluateRecordDTO; import com.ruoyi.performance.mapper.StaffCompetencyInspectItemConfigMapper; import com.ruoyi.performance.mapper.StaffCompetencyLevelEvaluateRecordMapper; import com.ruoyi.performance.pojo.StaffCompetencyInspectItemConfig; import com.ruoyi.performance.pojo.StaffCompetencyLevelEvaluateRecord; import com.ruoyi.performance.service.StaffCompetencyLevelEvaluateRecordService; import com.ruoyi.performance.vo.StaffConfigHeaderVO; import com.ruoyi.performance.vo.TestUserVO; import org.apache.commons.lang3.ObjectUtils; import org.apache.poi.ss.usermodel.IndexedColors; import org.springframework.beans.factory.annotation.Autowired; @@ -66,7 +66,7 @@ List<StaffCompetencyLevelEvaluateRecord> recordVos = baseMapper.selectList(Wrappers.<StaffCompetencyLevelEvaluateRecord>lambdaQuery().in(!userIds.isEmpty(),StaffCompetencyLevelEvaluateRecord::getUserId,userIds)); if(testUserList.isEmpty())return Collections.emptyList(); testUserList.forEach(u->{ HashMap<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>(); map.put("userName",u.getUserName()); map.put("userId",u.getUserId()); map.put("account",u.getAccount()); performance-server/src/main/java/com/ruoyi/performance/task/SyncStaffAttendanceRecordSchedule.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/task/SyncStaffAttendanceRecordSchedule.java ÐÞ¸Ä @@ -1,7 +1,7 @@ package com.ruoyi.inspect.task; package com.ruoyi.performance.task; import com.ruoyi.inspect.service.StaffAttendanceTrackingRecordService; import com.ruoyi.performance.service.StaffAttendanceTrackingRecordService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; performance-server/src/main/java/com/ruoyi/performance/utils/HourDiffCalculator.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/util/HourDiffCalculator.java ÐÞ¸Ä @@ -1,10 +1,9 @@ package com.ruoyi.inspect.util; package com.ruoyi.performance.utils; import java.math.BigDecimal; import java.math.RoundingMode; import java.time.LocalDateTime; import java.time.temporal.ChronoUnit; import java.util.Objects; import java.util.regex.Pattern; /** performance-server/src/main/java/com/ruoyi/performance/utils/TimeDiffCalculator.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/util/TimeDiffCalculator.java ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.ruoyi.inspect.util; package com.ruoyi.performance.utils; import java.math.BigDecimal; import java.math.RoundingMode; performance-server/src/main/java/com/ruoyi/performance/vo/StaffAttendanceVO.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffAttendanceVO.java ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.ruoyi.inspect.vo; package com.ruoyi.performance.vo; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; @@ -104,4 +104,9 @@ */ private Double diffHour; /** * ç¨æ·id */ private Integer userId; } performance-server/src/main/java/com/ruoyi/performance/vo/StaffClockInVO.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffClockInVO.java ÐÞ¸Ä @@ -1,6 +1,6 @@ package com.ruoyi.inspect.vo; package com.ruoyi.performance.vo; import com.ruoyi.inspect.pojo.StaffAttendanceTrackingRecord; import com.ruoyi.performance.pojo.StaffAttendanceTrackingRecord; import lombok.Data; /** performance-server/src/main/java/com/ruoyi/performance/vo/StaffCompetencyInspectItemConfigVO.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffCompetencyInspectItemConfigVO.java ÐÞ¸Ä @@ -1,6 +1,6 @@ package com.ruoyi.inspect.vo; package com.ruoyi.performance.vo; import com.ruoyi.inspect.pojo.StaffCompetencyInspectItemConfig; import com.ruoyi.performance.pojo.StaffCompetencyInspectItemConfig; import io.swagger.annotations.ApiModelProperty; import lombok.Data; performance-server/src/main/java/com/ruoyi/performance/vo/StaffCompetencyLevelEvaluateRecordVO.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffCompetencyLevelEvaluateRecordVO.java ÐÞ¸Ä @@ -1,6 +1,6 @@ package com.ruoyi.inspect.vo; package com.ruoyi.performance.vo; import com.ruoyi.inspect.pojo.StaffCompetencyLevelEvaluateRecord; import com.ruoyi.performance.pojo.StaffCompetencyLevelEvaluateRecord; import io.swagger.annotations.ApiModelProperty; import lombok.Data; performance-server/src/main/java/com/ruoyi/performance/vo/StaffConfigHeaderVO.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffConfigHeaderVO.java ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.ruoyi.inspect.vo; package com.ruoyi.performance.vo; import lombok.Data; performance-server/src/main/java/com/ruoyi/performance/vo/TestUserVO.java
ÎļþÃû´Ó inspect-server/src/main/java/com/ruoyi/inspect/vo/TestUserVO.java ÐÞ¸Ä @@ -1,4 +1,4 @@ package com.ruoyi.inspect.vo; package com.ruoyi.performance.vo; import io.swagger.annotations.ApiModelProperty; import lombok.Data; performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursMapper.xml
@@ -140,29 +140,36 @@ </if> </select> <select id="selectAuxiliaryAllByMonth" resultType="com.ruoyi.performance.dto.AuxiliaryAllDto"> select sum(aowh.work_time) yieldHour, u.name userName, aowh.`check` userId, #{dto.month} month from (SELECT ao.*, ip.cable_tag FROM auxiliary_output_working_hours ao left join ins_product ip on ip.id = ao.ins_product_id GROUP BY CASE WHEN ao.man_hour_group IS NOT NULL AND ao.man_hour_group != '' THEN ao.man_hour_group ELSE ao.id END, CASE WHEN ao.man_hour_group IS NOT NULL AND ao.man_hour_group != '' THEN ao.sample_id ELSE ao.id END, CASE WHEN ao.man_hour_group IS NOT NULL AND ao.man_hour_group != '' THEN ip.radius ELSE ao.id END, CASE WHEN ao.man_hour_group IS NOT NULL AND ao.man_hour_group != '' THEN ip.cable_tag ELSE ao.id END, CASE WHEN ao.man_hour_group IS NOT NULL AND ao.man_hour_group != '' THEN ao.order_id ELSE ao.id END) aowh left join user u on u.id = aowh.`check` where aowh.date_time between #{dto.beginDate} and #{dto.endDate} SELECT IFNULL(SUM(aowh.work_time), 0) AS yieldHour, u.name AS userName, u.id AS userId, #{dto.month} AS month FROM `user` u LEFT JOIN ( SELECT ao.*, ip.cable_tag FROM auxiliary_output_working_hours ao LEFT JOIN ins_product ip ON ip.id = ao.ins_product_id GROUP BY CASE WHEN ao.man_hour_group IS NOT NULL AND ao.man_hour_group != '' THEN ao.man_hour_group ELSE ao.id END, CASE WHEN ao.man_hour_group IS NOT NULL AND ao.man_hour_group != '' THEN ao.sample_id ELSE ao.id END, CASE WHEN ao.man_hour_group IS NOT NULL AND ao.man_hour_group != '' THEN ip.radius ELSE ao.id END, CASE WHEN ao.man_hour_group IS NOT NULL AND ao.man_hour_group != '' THEN ip.cable_tag ELSE ao.id END, CASE WHEN ao.man_hour_group IS NOT NULL AND ao.man_hour_group != '' THEN ao.order_id ELSE ao.id END ) aowh ON u.id = aowh.`check` AND aowh.date_time BETWEEN #{dto.beginDate} and #{dto.endDate} inner join sys_user_role sur on sur.user_id = u.id AND sur.role_id=4 WHERE u.status='0' AND u.del_flag='0' AND u.dept_id=124 <if test="userIds !=null and userIds.size() > 0"> and aowh.`check` in <foreach collection="userIds" index="index" open="(" separator="," close=")" item="val"> #{val} </foreach> </if> group by aowh.`check` GROUP BY u.id, u.name ORDER BY u.sort </select> <select id="selectSubsidiaryAllByMonth" resultType="com.ruoyi.performance.dto.AuxiliaryAllDto"> select sum(awhd.reviewer_nonproductive_time) subsidiaryHour, performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
@@ -19,9 +19,11 @@ s.shift, s.work_time, s.annotation_text, sd.dict_label AS shift_name, u2.name AS user_name, u2.id user_id FROM performance_shift s left join sys_dict_data sd on s.shift = sd.dict_value and sd.dict_type='sys_class_type' LEFT JOIN (SELECT distinct u.* from user u left join department_lims dl on FIND_IN_SET(dl.id,u.depart_lims_id) @@ -40,32 +42,7 @@ and u2.name like concat('%', #{userName}, '%') </if> </where> order by s.create_time </select> <select id="performanceShiftYearPage" resultType="map"> SELECT s.user_id, s.shift FROM performance_shift s LEFT JOIN (SELECT u.* from user u left join department_lims dl on FIND_IN_SET(dl.id,u.depart_lims_id) where status = '0' and del_flag = '0' <if test="laboratory != null and laboratory != ''"> and dl.name=#{laboratory} </if> ) u2 on u2.id = s.user_id where s.shift is not NULL and s.shift != '' and name is not null <if test="time != null and time != ''"> and DATE_FORMAT(s.work_time, '%Y') = DATE_FORMAT(#{time}, '%Y' ) </if> <if test="userName != null and userName != ''"> and u2.name like concat('%', #{userName}, '%') </if> order by s.create_time order by s.work_time </select> <select id="performanceShiftYear" resultMap="performanceShiftMap"> @@ -73,10 +50,12 @@ u2.name AS user_name, s.user_id, u2.account, DATE_FORMAT(s.work_time, '%c') month_num, sd.dict_label AS shift_name, s.work_time, s.shift, s.id FROM performance_shift s left join sys_dict_data sd on s.shift = sd.dict_value and sd.dict_type='sys_class_type' LEFT JOIN (SELECT u.* from user u left join department_lims dl on FIND_IN_SET(dl.id,u.depart_lims_id) @@ -89,13 +68,13 @@ where s.shift is not NULL and s.shift != '' and name is not null <if test="time != null and time != ''"> and DATE_FORMAT(s.work_time, '%Y') = DATE_FORMAT(#{time}, '%Y' ) <if test="startDateTime != null and endDateTime != null"> and s.work_time between #{startDateTime} and #{endDateTime} </if> <if test="userName != null and userName != ''"> and u2.name like concat('%', #{userName}, '%') </if> order by s.create_time order by s.work_time </select> <select id="performanceShiftYearList" resultType="map"> @@ -169,6 +148,6 @@ AND (u.account like concat('%',#{keyword},'%') OR u.name like concat('%',#{keyword},'%')) </if> </where> ORDER BY ps.work_time,ps.user_id ORDER BY ps.work_time,u.sort </select> </mapper> performance-server/src/main/resources/mapper/StaffAttendanceTrackingRecordMapper.xml
ÎļþÃû´Ó inspect-server/src/main/resources/mapper/StaffAttendanceTrackingRecordMapper.xml ÐÞ¸Ä @@ -2,9 +2,9 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.ruoyi.inspect.mapper.StaffAttendanceTrackingRecordMapper"> <mapper namespace="com.ruoyi.performance.mapper.StaffAttendanceTrackingRecordMapper"> <resultMap id="BaseResultMap" type="com.ruoyi.inspect.pojo.StaffAttendanceTrackingRecord"> <resultMap id="BaseResultMap" type="com.ruoyi.performance.pojo.StaffAttendanceTrackingRecord"> <id property="id" column="id" jdbcType="BIGINT"/> <result property="iccId" column="icc_id" jdbcType="BIGINT"/> <result property="swingTime" column="swing_time" jdbcType="TIMESTAMP"/> performance-server/src/main/resources/mapper/StaffCompetencyInspectItemConfigMapper.xml
ÎļþÃû´Ó inspect-server/src/main/resources/mapper/StaffCompetencyInspectItemConfigMapper.xml ÐÞ¸Ä @@ -2,9 +2,9 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.ruoyi.inspect.mapper.StaffCompetencyInspectItemConfigMapper"> <mapper namespace="com.ruoyi.performance.mapper.StaffCompetencyInspectItemConfigMapper"> <resultMap id="BaseResultMap" type="com.ruoyi.inspect.pojo.StaffCompetencyInspectItemConfig"> <resultMap id="BaseResultMap" type="com.ruoyi.performance.pojo.StaffCompetencyInspectItemConfig"> <id property="id" column="id" jdbcType="BIGINT"/> <result property="parentId" column="parent_id" jdbcType="BIGINT"/> <result property="ancestors" column="ancestors" jdbcType="VARCHAR"/> @@ -74,7 +74,7 @@ #{item.id} </foreach> </update> <select id="selectConfigList" resultType="com.ruoyi.inspect.pojo.StaffCompetencyInspectItemConfig"> <select id="selectConfigList" resultType="com.ruoyi.performance.pojo.StaffCompetencyInspectItemConfig"> <include refid="selectConfigVo"/> where 1 = 1 <if test="config.id != null and config.id != 0"> @@ -91,13 +91,13 @@ </if> order by sort </select> <select id="selectConfigById" resultType="com.ruoyi.inspect.vo.StaffCompetencyInspectItemConfigVO"> <select id="selectConfigById" resultType="com.ruoyi.performance.vo.StaffCompetencyInspectItemConfigVO"> select <include refid="Base_Column_List"/>, (select item_name from staff_competency_inspect_item_config where id = parent_id) parent_name from staff_competency_inspect_item_config where id = #{configId} </select> <select id="checkDeptNameUnique" resultType="com.ruoyi.inspect.pojo.StaffCompetencyInspectItemConfig"> <select id="checkDeptNameUnique" resultType="com.ruoyi.performance.pojo.StaffCompetencyInspectItemConfig"> <include refid="selectConfigVo"/> where item_name=#{itemName} <choose> @@ -110,7 +110,7 @@ </choose> limit 1 </select> <select id="selectChildrenConfigById" resultType="com.ruoyi.inspect.pojo.StaffCompetencyInspectItemConfig"> <select id="selectChildrenConfigById" resultType="com.ruoyi.performance.pojo.StaffCompetencyInspectItemConfig"> select * from staff_competency_inspect_item_config where find_in_set(#{configId}, ancestors) </select> <select id="hasChildByConfigId" resultType="java.lang.Integer"> @@ -120,7 +120,7 @@ <select id="selectNormalChildrenConfigById" resultType="java.lang.Integer"> select count(*) from staff_competency_inspect_item_config where is_enable = 1 and find_in_set(#{configId}, ancestors) </select> <select id="selectConfigHeader" resultType="com.ruoyi.inspect.vo.StaffConfigHeaderVO"> <select id="selectConfigHeader" resultType="com.ruoyi.performance.vo.StaffConfigHeaderVO"> select c2.item_name AS item_name, c1.item_name AS children_item_name, performance-server/src/main/resources/mapper/StaffCompetencyLevelEvaluateRecordMapper.xml
ÎļþÃû´Ó inspect-server/src/main/resources/mapper/StaffCompetencyLevelEvaluateRecordMapper.xml ÐÞ¸Ä @@ -2,9 +2,9 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.ruoyi.inspect.mapper.StaffCompetencyLevelEvaluateRecordMapper"> <mapper namespace="com.ruoyi.performance.mapper.StaffCompetencyLevelEvaluateRecordMapper"> <resultMap id="BaseResultMap" type="com.ruoyi.inspect.pojo.StaffCompetencyLevelEvaluateRecord"> <resultMap id="BaseResultMap" type="com.ruoyi.performance.pojo.StaffCompetencyLevelEvaluateRecord"> <id property="id" column="id" jdbcType="BIGINT"/> <result property="userId" column="user_id" jdbcType="INTEGER"/> <result property="itemConfigId" column="item_config_id" jdbcType="BIGINT"/> @@ -20,10 +20,10 @@ level,create_user,create_time, update_user,update_time </sql> <select id="selectCompetencyLevelEvaluateRecord" resultType="com.ruoyi.inspect.vo.StaffCompetencyLevelEvaluateRecordVO"> <select id="selectCompetencyLevelEvaluateRecord" resultType="com.ruoyi.performance.vo.StaffCompetencyLevelEvaluateRecordVO"> </select> <select id="selectTestUserList" resultType="com.ruoyi.inspect.vo.TestUserVO"> <select id="selectTestUserList" resultType="com.ruoyi.performance.vo.TestUserVO"> select u.id AS user_id, u.account AS account, @@ -42,5 +42,6 @@ <if test="dto.keyword!=null and dto.keyword!=''"> AND (u.name like concat('%',#{dto.keyword},'%') or u.account like concat('%',#{dto.keyword},'%')) </if> ORDER BY u.sort </select> </mapper> performance-server/src/main/resources/static/staff_attendance_month_template.xlsxBinary files differ
performance-server/src/main/resources/static/staff_attendance_year_template.xlsxBinary files differ
ruoyi-admin-ztns/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
@@ -1,21 +1,5 @@ package com.ruoyi.web.controller.system; import java.util.List; import java.util.stream.Collectors; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -31,6 +15,16 @@ import com.ruoyi.system.service.ISysPostService; import com.ruoyi.system.service.ISysRoleService; import com.ruoyi.system.service.ISysUserService; import org.apache.commons.lang3.ArrayUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.util.List; import java.util.stream.Collectors; /** * ç¨æ·ä¿¡æ¯ ruoyi-admin-ztns/src/main/java/com/ruoyi/web/controller/system/UserController.java
@@ -3,14 +3,19 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.core.domain.Result; import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.entity.User; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.system.service.UserService; import com.ruoyi.web.controller.dto.UpdateUserDto; import io.swagger.annotations.ApiOperation; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; import java.util.Map; @@ -37,6 +42,12 @@ @GetMapping("/selectUserCondition") public Result selectUserCondition(User user, String type, Integer departmentId) { return Result.success(userService.selectUserCondition(user, type, departmentId)); } @ApiOperation(value = "è·åç¨æ·å表-ç»©ææ¨¡åç¨") @GetMapping("/selectUserListByPerformance") public Result selectUserListByPerformance(@RequestParam(required = false,defaultValue = "false") Boolean isTestUser){ return Result.success(userService.selectUserListByPerformance(isTestUser)); } /** @@ -77,5 +88,14 @@ return Result.success(userService.list(Wrappers.<User>lambdaQuery().eq(User::getStatus,0))); } /** * æ´æ°ç¨æ·æåº */ @Log(title = "ç¨æ·ç®¡ç", businessType = BusinessType.UPDATE) @PostMapping("/updateUserSort") public Result updateUserSort(@RequestBody List<User> sysUserList){ return Result.success(userService.updateBatchById(sysUserList)); } } ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
@@ -25,6 +25,9 @@ @Excel(name = "ç¨æ·åºå·", type = Type.EXPORT, cellType = ColumnType.NUMERIC, prompt = "ç¨æ·ç¼å·") private Long userId; /** æåºä¸æ */ private Integer sort; /** é¨é¨ID */ @Excel(name = "é¨é¨ç¼å·", type = Type.IMPORT) private Long deptId; @@ -124,6 +127,14 @@ this.userId = userId; } public Integer getSort() { return sort; } public void setSort(Integer sort) { this.sort = sort; } public boolean isAdmin() { return isAdmin(this.userId); ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/User.java
@@ -20,6 +20,9 @@ @TableId(type = IdType.AUTO) private Integer id; @ApiModelProperty(value = "æåºä¸æ ") private Integer sort; @ApiModelProperty(value = "é¨é¨ID") private Integer deptId; ruoyi-common/src/main/java/com/ruoyi/common/enums/CalendarType.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,11 @@ package com.ruoyi.common.enums; /** * æ¥æç±»åæä¸¾(year/month) */ public enum CalendarType { YEAR, MONTH } ruoyi-common/src/main/java/com/ruoyi/common/enums/StaffAttendanceReportType.java
ÎļþÒÑɾ³ý ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java
@@ -67,5 +67,6 @@ */ List<User> selectUserByDepartmentId(@Param("departmentId") Integer departmentId); List<User> selectUserListByPerformance(@Param("isTestUser")Boolean isTestUser); } ruoyi-system/src/main/java/com/ruoyi/system/service/UserService.java
@@ -50,5 +50,7 @@ * @return */ int delUserDepardLimsId(Integer id); List<User> selectUserListByPerformance(Boolean isTestUser); } ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
@@ -1,15 +1,5 @@ package com.ruoyi.system.service.impl; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; import javax.validation.Validator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import com.ruoyi.common.annotation.DataScope; import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.core.domain.entity.SysRole; @@ -22,14 +12,21 @@ import com.ruoyi.system.domain.SysPost; import com.ruoyi.system.domain.SysUserPost; import com.ruoyi.system.domain.SysUserRole; import com.ruoyi.system.mapper.SysPostMapper; import com.ruoyi.system.mapper.SysRoleMapper; import com.ruoyi.system.mapper.SysUserMapper; import com.ruoyi.system.mapper.SysUserPostMapper; import com.ruoyi.system.mapper.SysUserRoleMapper; import com.ruoyi.system.mapper.*; import com.ruoyi.system.service.ISysConfigService; import com.ruoyi.system.service.ISysDeptService; import com.ruoyi.system.service.ISysUserService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import javax.validation.Validator; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; /** * ç¨æ· ä¸å¡å±å¤ç @@ -261,6 +258,7 @@ public int insertUser(SysUser user) { // æ°å¢ç¨æ·ä¿¡æ¯ user.setSort(Integer.MAX_VALUE); int rows = userMapper.insertUser(user); // æ°å¢ç¨æ·å²ä½å ³è insertUserPost(user); ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserServiceImpl.java
@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service; import java.time.LocalDateTime; import java.util.Collections; import java.util.List; /** @@ -103,5 +104,10 @@ public int delUserDepardLimsId(Integer id) { return baseMapper.update(null, Wrappers.<User>lambdaUpdate().eq(User::getId, id).set(User::getDepartLimsId, null).set(User::getUpdateTime, LocalDateTime.now()).set(User::getUpdateBy, SecurityUtils.getUsername())); } @Override public List<User> selectUserListByPerformance(Boolean isTestUser) { return baseMapper.selectUserListByPerformance(isTestUser); } } ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
@@ -6,6 +6,7 @@ <resultMap type="SysUser" id="SysUserResult"> <id property="userId" column="id" /> <result property="sort" column="sort" /> <result property="deptId" column="dept_id" /> <result property="userName" column="account" /> <result property="nickName" column="name" /> @@ -63,6 +64,7 @@ <select id="selectUserList" parameterType="SysUser" resultMap="SysUserResult"> select u.id, u.sort, u.dept_id, u.name, u.account, @@ -112,6 +114,7 @@ group by u.id <!-- æ°æ®èå´è¿æ»¤ --> ${params.dataScope} ORDER BY u.sort </select> <select id="selectAllocatedList" parameterType="SysUser" resultMap="SysUserResult"> @@ -174,6 +177,7 @@ <insert id="insertUser" parameterType="SysUser" useGeneratedKeys="true" keyProperty="userId"> insert into user( <if test="userId != null and userId != 0">id,</if> <if test="sort != null and sort != ''">sort,</if> <if test="deptId != null and deptId != 0">dept_id,</if> <if test="userName != null and userName != ''">account,</if> <if test="nickName != null and nickName != ''">`name`,</if> @@ -191,6 +195,7 @@ create_time )values( <if test="userId != null and userId != ''">#{userId},</if> <if test="sort != null and sort != ''">#{sort},</if> <if test="deptId != null and deptId != ''">#{deptId},</if> <if test="userName != null and userName != ''">#{userName},</if> <if test="nickName != null and nickName != ''">#{nickName},</if> @@ -246,7 +251,7 @@ update user set password = #{password} where account = #{userName} </update> <delete id="deleteUserById" parameterType="Long"> <delete id="deleteUserById" parameterType="Long"> update user set del_flag = '2' where id = #{userId} </delete> ruoyi-system/src/main/resources/mapper/system/UserMapper.xml
@@ -125,5 +125,16 @@ and depart_lims_id != '' and FIND_IN_SET(#{departmentId}, depart_lims_id) </select> <select id="selectUserListByPerformance" resultType="com.ruoyi.common.core.domain.entity.User"> select * from user u <if test="isTestUser!=null and isTestUser"> inner join sys_user_role sur on u.id = sur.user_id AND sur.role_id=4 </if> where u.status = '0' and u.del_flag = '0' and u.dept_id=124 ORDER BY u.sort </select> </mapper>