zouyu
2026-04-20 1fb4735cf75f6b98b8d81611a95ccea395cba323
绩效模块调整
已添加3个文件
已重命名33个文件
已修改19个文件
已删除3个文件
1310 ■■■■ 文件已修改
inspect-server/src/main/resources/static/staff_attendance_month_template.xlsx 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/static/staff_attendance_year_template.xlsx 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/controller/PerformanceShiftController.java 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/controller/StaffAttendanceController.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/controller/StaffCompetencyInspectItemConfigController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/controller/StaffCompetencyLevelEvaluateRecordController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/dto/PerformanceShiftAddDto.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/dto/PerformanceShiftMapDto.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/dto/StaffAttendanceDTO.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/dto/StaffCompetencyLevelEvaluateRecordDTO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/excel/StaffAttendanceAnnotationTextExcelData.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/excel/StaffAttendanceExcelData.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/excel/handler/attendance/CommentWriteHandler.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/excel/handler/attendance/StaffAttendanceHeaderWriteHandler.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/mapper/PerformanceShiftMapper.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/mapper/StaffAttendanceTrackingRecordMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/mapper/StaffCompetencyInspectItemConfigMapper.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/mapper/StaffCompetencyLevelEvaluateRecordMapper.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/pojo/PerformanceShift.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/pojo/StaffAttendanceTrackingRecord.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/pojo/StaffCompetencyInspectItemConfig.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/pojo/StaffCompetencyLevelEvaluateRecord.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/service/PerformanceShiftService.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/service/StaffAttendanceTrackingRecordService.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/service/StaffCompetencyInspectItemConfigService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/service/StaffCompetencyLevelEvaluateRecordService.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/service/impl/PerformanceShiftServiceImpl.java 710 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffAttendanceTrackingRecordServiceImpl.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffCompetencyInspectItemConfigServiceImpl.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffCompetencyLevelEvaluateRecordServiceImpl.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/task/SyncStaffAttendanceRecordSchedule.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/utils/HourDiffCalculator.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/utils/TimeDiffCalculator.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/vo/StaffAttendanceVO.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/vo/StaffClockInVO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/vo/StaffCompetencyInspectItemConfigVO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/vo/StaffCompetencyLevelEvaluateRecordVO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/vo/StaffConfigHeaderVO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/java/com/ruoyi/performance/vo/TestUserVO.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursMapper.xml 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml 41 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/resources/mapper/StaffAttendanceTrackingRecordMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/resources/mapper/StaffCompetencyInspectItemConfigMapper.xml 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/resources/mapper/StaffCompetencyLevelEvaluateRecordMapper.xml 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/resources/static/staff_attendance_month_template.xlsx 补丁 | 查看 | 原始文档 | blame | 历史
performance-server/src/main/resources/static/staff_attendance_year_template.xlsx 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin-ztns/src/main/java/com/ruoyi/web/controller/system/SysUserController.java 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin-ztns/src/main/java/com/ruoyi/web/controller/system/UserController.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/User.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/enums/CalendarType.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/enums/StaffAttendanceReportType.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/UserService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/UserMapper.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
inspect-server/src/main/resources/static/staff_attendance_month_template.xlsx
Binary files differ
inspect-server/src/main/resources/static/staff_attendance_year_template.xlsx
Binary 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.xlsx
Binary files differ
performance-server/src/main/resources/static/staff_attendance_year_template.xlsx
Binary 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>