From 1fb4735cf75f6b98b8d81611a95ccea395cba323 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期一, 20 四月 2026 16:35:04 +0800
Subject: [PATCH] 绩效模块调整
---
performance-server/src/main/java/com/ruoyi/performance/pojo/StaffCompetencyLevelEvaluateRecord.java | 5
performance-server/src/main/java/com/ruoyi/performance/controller/StaffAttendanceController.java | 14
performance-server/src/main/java/com/ruoyi/performance/utils/HourDiffCalculator.java | 3
performance-server/src/main/java/com/ruoyi/performance/vo/StaffAttendanceVO.java | 7
performance-server/src/main/java/com/ruoyi/performance/mapper/PerformanceShiftMapper.java | 7
performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml | 41 -
performance-server/src/main/resources/mapper/StaffCompetencyLevelEvaluateRecordMapper.xml | 9
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java | 11
ruoyi-system/src/main/java/com/ruoyi/system/service/UserService.java | 2
performance-server/src/main/java/com/ruoyi/performance/controller/PerformanceShiftController.java | 91 ---
performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffAttendanceTrackingRecordServiceImpl.java | 51 +
performance-server/src/main/java/com/ruoyi/performance/mapper/StaffCompetencyInspectItemConfigMapper.java | 8
performance-server/src/main/java/com/ruoyi/performance/task/SyncStaffAttendanceRecordSchedule.java | 4
performance-server/src/main/java/com/ruoyi/performance/service/StaffCompetencyInspectItemConfigService.java | 4
performance-server/src/main/java/com/ruoyi/performance/service/StaffCompetencyLevelEvaluateRecordService.java | 6
performance-server/src/main/resources/mapper/StaffCompetencyInspectItemConfigMapper.xml | 14
performance-server/src/main/java/com/ruoyi/performance/pojo/PerformanceShift.java | 7
performance-server/src/main/java/com/ruoyi/performance/vo/StaffCompetencyInspectItemConfigVO.java | 4
performance-server/src/main/java/com/ruoyi/performance/mapper/StaffAttendanceTrackingRecordMapper.java | 4
performance-server/src/main/java/com/ruoyi/performance/service/PerformanceShiftService.java | 11
performance-server/src/main/resources/static/staff_attendance_year_template.xlsx | 0
ruoyi-common/src/main/java/com/ruoyi/common/enums/CalendarType.java | 11
performance-server/src/main/java/com/ruoyi/performance/controller/StaffCompetencyInspectItemConfigController.java | 7
performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffCompetencyInspectItemConfigServiceImpl.java | 9
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserServiceImpl.java | 6
ruoyi-admin-ztns/src/main/java/com/ruoyi/web/controller/system/SysUserController.java | 26
ruoyi-system/src/main/resources/mapper/system/UserMapper.xml | 11
performance-server/src/main/java/com/ruoyi/performance/service/StaffAttendanceTrackingRecordService.java | 10
performance-server/src/main/java/com/ruoyi/performance/utils/TimeDiffCalculator.java | 2
performance-server/src/main/java/com/ruoyi/performance/dto/PerformanceShiftAddDto.java | 9
ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml | 7
ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/User.java | 3
performance-server/src/main/java/com/ruoyi/performance/mapper/StaffCompetencyLevelEvaluateRecordMapper.java | 11
performance-server/src/main/java/com/ruoyi/performance/excel/handler/attendance/StaffAttendanceHeaderWriteHandler.java | 2
performance-server/src/main/resources/mapper/StaffAttendanceTrackingRecordMapper.xml | 4
performance-server/src/main/java/com/ruoyi/performance/vo/StaffCompetencyLevelEvaluateRecordVO.java | 4
performance-server/src/main/java/com/ruoyi/performance/vo/StaffClockInVO.java | 4
performance-server/src/main/java/com/ruoyi/performance/pojo/StaffCompetencyInspectItemConfig.java | 5
performance-server/src/main/java/com/ruoyi/performance/dto/StaffAttendanceDTO.java | 5
performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffCompetencyLevelEvaluateRecordServiceImpl.java | 20
performance-server/src/main/resources/static/staff_attendance_month_template.xlsx | 0
performance-server/src/main/java/com/ruoyi/performance/vo/StaffConfigHeaderVO.java | 2
performance-server/src/main/java/com/ruoyi/performance/controller/StaffCompetencyLevelEvaluateRecordController.java | 6
performance-server/src/main/java/com/ruoyi/performance/dto/StaffCompetencyLevelEvaluateRecordDTO.java | 4
performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursMapper.xml | 41 +
/dev/null | 12
performance-server/src/main/java/com/ruoyi/performance/excel/StaffAttendanceExcelData.java | 8
performance-server/src/main/java/com/ruoyi/performance/service/impl/PerformanceShiftServiceImpl.java | 710 +++++++++++++++++--------------
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java | 28
ruoyi-admin-ztns/src/main/java/com/ruoyi/web/controller/system/UserController.java | 20
performance-server/src/main/java/com/ruoyi/performance/dto/PerformanceShiftMapDto.java | 7
ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java | 1
performance-server/src/main/java/com/ruoyi/performance/pojo/StaffAttendanceTrackingRecord.java | 2
performance-server/src/main/java/com/ruoyi/performance/excel/StaffAttendanceAnnotationTextExcelData.java | 2
performance-server/src/main/java/com/ruoyi/performance/excel/handler/attendance/CommentWriteHandler.java | 6
performance-server/src/main/java/com/ruoyi/performance/vo/TestUserVO.java | 2
56 files changed, 683 insertions(+), 627 deletions(-)
diff --git a/inspect-server/src/main/resources/static/staff_attendance_month_template.xlsx b/inspect-server/src/main/resources/static/staff_attendance_month_template.xlsx
deleted file mode 100644
index 1872cea..0000000
--- a/inspect-server/src/main/resources/static/staff_attendance_month_template.xlsx
+++ /dev/null
Binary files differ
diff --git a/inspect-server/src/main/resources/static/staff_attendance_year_template.xlsx b/inspect-server/src/main/resources/static/staff_attendance_year_template.xlsx
deleted file mode 100644
index c31fd9e..0000000
--- a/inspect-server/src/main/resources/static/staff_attendance_year_template.xlsx
+++ /dev/null
Binary files differ
diff --git a/performance-server/src/main/java/com/ruoyi/performance/controller/PerformanceShiftController.java b/performance-server/src/main/java/com/ruoyi/performance/controller/PerformanceShiftController.java
index ab52560..2fa075f 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/controller/PerformanceShiftController.java
+++ b/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());
- // 淇濆瓨鍒扮涓�涓猻heet涓�
- 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);
- }
-
- }
}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/StaffAttendanceController.java b/performance-server/src/main/java/com/ruoyi/performance/controller/StaffAttendanceController.java
similarity index 88%
rename from inspect-server/src/main/java/com/ruoyi/inspect/controller/StaffAttendanceController.java
rename to performance-server/src/main/java/com/ruoyi/performance/controller/StaffAttendanceController.java
index 5a367e6..af0662d 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/controller/StaffAttendanceController.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/StaffCompetencyInspectItemConfigController.java b/performance-server/src/main/java/com/ruoyi/performance/controller/StaffCompetencyInspectItemConfigController.java
similarity index 94%
rename from inspect-server/src/main/java/com/ruoyi/inspect/controller/StaffCompetencyInspectItemConfigController.java
rename to performance-server/src/main/java/com/ruoyi/performance/controller/StaffCompetencyInspectItemConfigController.java
index b8d1cab..90f9481 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/controller/StaffCompetencyInspectItemConfigController.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/controller/StaffCompetencyLevelEvaluateRecordController.java b/performance-server/src/main/java/com/ruoyi/performance/controller/StaffCompetencyLevelEvaluateRecordController.java
similarity index 87%
rename from inspect-server/src/main/java/com/ruoyi/inspect/controller/StaffCompetencyLevelEvaluateRecordController.java
rename to performance-server/src/main/java/com/ruoyi/performance/controller/StaffCompetencyLevelEvaluateRecordController.java
index cc82bb9..15b3010 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/controller/StaffCompetencyLevelEvaluateRecordController.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
diff --git a/performance-server/src/main/java/com/ruoyi/performance/dto/PerformanceShiftAddDto.java b/performance-server/src/main/java/com/ruoyi/performance/dto/PerformanceShiftAddDto.java
index a1811b9..c074fa0 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/dto/PerformanceShiftAddDto.java
+++ b/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;
}
diff --git a/performance-server/src/main/java/com/ruoyi/performance/dto/PerformanceShiftMapDto.java b/performance-server/src/main/java/com/ruoyi/performance/dto/PerformanceShiftMapDto.java
index 6af2f1e..8f88276 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/dto/PerformanceShiftMapDto.java
+++ b/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<>();
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/StaffAttendanceDTO.java b/performance-server/src/main/java/com/ruoyi/performance/dto/StaffAttendanceDTO.java
similarity index 94%
rename from inspect-server/src/main/java/com/ruoyi/inspect/dto/StaffAttendanceDTO.java
rename to performance-server/src/main/java/com/ruoyi/performance/dto/StaffAttendanceDTO.java
index 231c94e..a3b94bb 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/dto/StaffAttendanceDTO.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/dto/StaffCompetencyLevelEvaluateRecordDTO.java b/performance-server/src/main/java/com/ruoyi/performance/dto/StaffCompetencyLevelEvaluateRecordDTO.java
similarity index 81%
rename from inspect-server/src/main/java/com/ruoyi/inspect/dto/StaffCompetencyLevelEvaluateRecordDTO.java
rename to performance-server/src/main/java/com/ruoyi/performance/dto/StaffCompetencyLevelEvaluateRecordDTO.java
index 63d2b22..246af02 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/dto/StaffCompetencyLevelEvaluateRecordDTO.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/excel/StaffAttendanceAnnotationTextExcelData.java b/performance-server/src/main/java/com/ruoyi/performance/excel/StaffAttendanceAnnotationTextExcelData.java
similarity index 93%
rename from inspect-server/src/main/java/com/ruoyi/inspect/excel/StaffAttendanceAnnotationTextExcelData.java
rename to performance-server/src/main/java/com/ruoyi/performance/excel/StaffAttendanceAnnotationTextExcelData.java
index 9e8d4eb..bdbe986 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/excel/StaffAttendanceAnnotationTextExcelData.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/excel/StaffAttendanceExcelData.java b/performance-server/src/main/java/com/ruoyi/performance/excel/StaffAttendanceExcelData.java
similarity index 90%
rename from inspect-server/src/main/java/com/ruoyi/inspect/excel/StaffAttendanceExcelData.java
rename to performance-server/src/main/java/com/ruoyi/performance/excel/StaffAttendanceExcelData.java
index 7a418bc..71900d6 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/excel/StaffAttendanceExcelData.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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("鍑哄嫟澶╂暟")
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/excel/handler/CommentWriteHandler.java b/performance-server/src/main/java/com/ruoyi/performance/excel/handler/attendance/CommentWriteHandler.java
similarity index 95%
rename from inspect-server/src/main/java/com/ruoyi/inspect/excel/handler/CommentWriteHandler.java
rename to performance-server/src/main/java/com/ruoyi/performance/excel/handler/attendance/CommentWriteHandler.java
index 6a469f5..a28838a 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/excel/handler/CommentWriteHandler.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/excel/handler/attendance/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;
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/excel/handler/StaffAttendanceHeaderWriteHandler.java b/performance-server/src/main/java/com/ruoyi/performance/excel/handler/attendance/StaffAttendanceHeaderWriteHandler.java
similarity index 97%
rename from inspect-server/src/main/java/com/ruoyi/inspect/excel/handler/StaffAttendanceHeaderWriteHandler.java
rename to performance-server/src/main/java/com/ruoyi/performance/excel/handler/attendance/StaffAttendanceHeaderWriteHandler.java
index cd086d5..731d3c4 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/excel/handler/StaffAttendanceHeaderWriteHandler.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/excel/handler/attendance/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;
diff --git a/performance-server/src/main/java/com/ruoyi/performance/mapper/PerformanceShiftMapper.java b/performance-server/src/main/java/com/ruoyi/performance/mapper/PerformanceShiftMapper.java
index 69c6bf5..e595092 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/mapper/PerformanceShiftMapper.java
+++ b/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);
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/StaffAttendanceTrackingRecordMapper.java b/performance-server/src/main/java/com/ruoyi/performance/mapper/StaffAttendanceTrackingRecordMapper.java
similarity index 81%
rename from inspect-server/src/main/java/com/ruoyi/inspect/mapper/StaffAttendanceTrackingRecordMapper.java
rename to performance-server/src/main/java/com/ruoyi/performance/mapper/StaffAttendanceTrackingRecordMapper.java
index 362737e..375a3c1 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/StaffAttendanceTrackingRecordMapper.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/StaffCompetencyInspectItemConfigMapper.java b/performance-server/src/main/java/com/ruoyi/performance/mapper/StaffCompetencyInspectItemConfigMapper.java
similarity index 86%
rename from inspect-server/src/main/java/com/ruoyi/inspect/mapper/StaffCompetencyInspectItemConfigMapper.java
rename to performance-server/src/main/java/com/ruoyi/performance/mapper/StaffCompetencyInspectItemConfigMapper.java
index 8c3ff96..c4239b0 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/StaffCompetencyInspectItemConfigMapper.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/StaffCompetencyLevelEvaluateRecordMapper.java b/performance-server/src/main/java/com/ruoyi/performance/mapper/StaffCompetencyLevelEvaluateRecordMapper.java
similarity index 69%
rename from inspect-server/src/main/java/com/ruoyi/inspect/mapper/StaffCompetencyLevelEvaluateRecordMapper.java
rename to performance-server/src/main/java/com/ruoyi/performance/mapper/StaffCompetencyLevelEvaluateRecordMapper.java
index aded2f0..6e0a897 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/mapper/StaffCompetencyLevelEvaluateRecordMapper.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
diff --git a/performance-server/src/main/java/com/ruoyi/performance/pojo/PerformanceShift.java b/performance-server/src/main/java/com/ruoyi/performance/pojo/PerformanceShift.java
index a0c9075..fc86264 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/pojo/PerformanceShift.java
+++ b/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;
+ }
}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/StaffAttendanceTrackingRecord.java b/performance-server/src/main/java/com/ruoyi/performance/pojo/StaffAttendanceTrackingRecord.java
similarity index 98%
rename from inspect-server/src/main/java/com/ruoyi/inspect/pojo/StaffAttendanceTrackingRecord.java
rename to performance-server/src/main/java/com/ruoyi/performance/pojo/StaffAttendanceTrackingRecord.java
index 9b1a6dd..00a2370 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/StaffAttendanceTrackingRecord.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/pojo/StaffAttendanceTrackingRecord.java
@@ -1,4 +1,4 @@
-package com.ruoyi.inspect.pojo;
+package com.ruoyi.performance.pojo;
import com.baomidou.mybatisplus.annotation.*;
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/StaffCompetencyInspectItemConfig.java b/performance-server/src/main/java/com/ruoyi/performance/pojo/StaffCompetencyInspectItemConfig.java
similarity index 95%
rename from inspect-server/src/main/java/com/ruoyi/inspect/pojo/StaffCompetencyInspectItemConfig.java
rename to performance-server/src/main/java/com/ruoyi/performance/pojo/StaffCompetencyInspectItemConfig.java
index 9aab1f3..3c87d80 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/StaffCompetencyInspectItemConfig.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
/**
* 浜哄憳鑳藉姏-妫�楠岄」閰嶇疆琛�
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/StaffCompetencyLevelEvaluateRecord.java b/performance-server/src/main/java/com/ruoyi/performance/pojo/StaffCompetencyLevelEvaluateRecord.java
similarity index 95%
rename from inspect-server/src/main/java/com/ruoyi/inspect/pojo/StaffCompetencyLevelEvaluateRecord.java
rename to performance-server/src/main/java/com/ruoyi/performance/pojo/StaffCompetencyLevelEvaluateRecord.java
index 6a96b39..58bd003 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/pojo/StaffCompetencyLevelEvaluateRecord.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
/**
* 浜哄憳鑳藉姏绛夌骇璇勫畾琛�
diff --git a/performance-server/src/main/java/com/ruoyi/performance/service/PerformanceShiftService.java b/performance-server/src/main/java/com/ruoyi/performance/service/PerformanceShiftService.java
index 129285f..f15edb5 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/service/PerformanceShiftService.java
+++ b/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);
}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/StaffAttendanceTrackingRecordService.java b/performance-server/src/main/java/com/ruoyi/performance/service/StaffAttendanceTrackingRecordService.java
similarity index 77%
rename from inspect-server/src/main/java/com/ruoyi/inspect/service/StaffAttendanceTrackingRecordService.java
rename to performance-server/src/main/java/com/ruoyi/performance/service/StaffAttendanceTrackingRecordService.java
index 0008f3f..e8d71c4 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/StaffAttendanceTrackingRecordService.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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);
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/StaffCompetencyInspectItemConfigService.java b/performance-server/src/main/java/com/ruoyi/performance/service/StaffCompetencyInspectItemConfigService.java
similarity index 89%
rename from inspect-server/src/main/java/com/ruoyi/inspect/service/StaffCompetencyInspectItemConfigService.java
rename to performance-server/src/main/java/com/ruoyi/performance/service/StaffCompetencyInspectItemConfigService.java
index fb9b4ab..39010ef 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/StaffCompetencyInspectItemConfigService.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/StaffCompetencyLevelEvaluateRecordService.java b/performance-server/src/main/java/com/ruoyi/performance/service/StaffCompetencyLevelEvaluateRecordService.java
similarity index 77%
rename from inspect-server/src/main/java/com/ruoyi/inspect/service/StaffCompetencyLevelEvaluateRecordService.java
rename to performance-server/src/main/java/com/ruoyi/performance/service/StaffCompetencyLevelEvaluateRecordService.java
index a65125c..d04d8fe 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/StaffCompetencyLevelEvaluateRecordService.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
diff --git a/performance-server/src/main/java/com/ruoyi/performance/service/impl/PerformanceShiftServiceImpl.java b/performance-server/src/main/java/com/ruoyi/performance/service/impl/PerformanceShiftServiceImpl.java
index 80f0230..4b003f0 100644
--- a/performance-server/src/main/java/com/ruoyi/performance/service/impl/PerformanceShiftServiceImpl.java
+++ b/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骞碝M鏈坉d鏃�");
+
+ 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骞碝鏈�")));
+ }
+ }
+ 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;
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/StaffAttendanceTrackingRecordServiceImpl.java b/performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffAttendanceTrackingRecordServiceImpl.java
similarity index 95%
rename from inspect-server/src/main/java/com/ruoyi/inspect/service/impl/StaffAttendanceTrackingRecordServiceImpl.java
rename to performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffAttendanceTrackingRecordServiceImpl.java
index 6dbf68b..d848646 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/StaffAttendanceTrackingRecordServiceImpl.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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);
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/StaffCompetencyInspectItemConfigServiceImpl.java b/performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffCompetencyInspectItemConfigServiceImpl.java
similarity index 94%
rename from inspect-server/src/main/java/com/ruoyi/inspect/service/impl/StaffCompetencyInspectItemConfigServiceImpl.java
rename to performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffCompetencyInspectItemConfigServiceImpl.java
index 77d0028..608573c 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/StaffCompetencyInspectItemConfigServiceImpl.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/StaffCompetencyLevelEvaluateRecordServiceImpl.java b/performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffCompetencyLevelEvaluateRecordServiceImpl.java
similarity index 92%
rename from inspect-server/src/main/java/com/ruoyi/inspect/service/impl/StaffCompetencyLevelEvaluateRecordServiceImpl.java
rename to performance-server/src/main/java/com/ruoyi/performance/service/impl/StaffCompetencyLevelEvaluateRecordServiceImpl.java
index da24625..72d6036 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/StaffCompetencyLevelEvaluateRecordServiceImpl.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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());
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/task/SyncStaffAttendanceRecordSchedule.java b/performance-server/src/main/java/com/ruoyi/performance/task/SyncStaffAttendanceRecordSchedule.java
similarity index 90%
rename from inspect-server/src/main/java/com/ruoyi/inspect/task/SyncStaffAttendanceRecordSchedule.java
rename to performance-server/src/main/java/com/ruoyi/performance/task/SyncStaffAttendanceRecordSchedule.java
index 1c5e560..0ed7ee4 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/task/SyncStaffAttendanceRecordSchedule.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/util/HourDiffCalculator.java b/performance-server/src/main/java/com/ruoyi/performance/utils/HourDiffCalculator.java
similarity index 98%
rename from inspect-server/src/main/java/com/ruoyi/inspect/util/HourDiffCalculator.java
rename to performance-server/src/main/java/com/ruoyi/performance/utils/HourDiffCalculator.java
index 425c559..c81384a 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/util/HourDiffCalculator.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/utils/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;
/**
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/util/TimeDiffCalculator.java b/performance-server/src/main/java/com/ruoyi/performance/utils/TimeDiffCalculator.java
similarity index 97%
rename from inspect-server/src/main/java/com/ruoyi/inspect/util/TimeDiffCalculator.java
rename to performance-server/src/main/java/com/ruoyi/performance/utils/TimeDiffCalculator.java
index a7e0e83..9455768 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/util/TimeDiffCalculator.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/utils/TimeDiffCalculator.java
@@ -1,4 +1,4 @@
-package com.ruoyi.inspect.util;
+package com.ruoyi.performance.utils;
import java.math.BigDecimal;
import java.math.RoundingMode;
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffAttendanceVO.java b/performance-server/src/main/java/com/ruoyi/performance/vo/StaffAttendanceVO.java
similarity index 94%
rename from inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffAttendanceVO.java
rename to performance-server/src/main/java/com/ruoyi/performance/vo/StaffAttendanceVO.java
index cc2176e..7d0403a 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffAttendanceVO.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
+
}
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffClockInVO.java b/performance-server/src/main/java/com/ruoyi/performance/vo/StaffClockInVO.java
similarity index 61%
rename from inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffClockInVO.java
rename to performance-server/src/main/java/com/ruoyi/performance/vo/StaffClockInVO.java
index f615b1e..e661c65 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffClockInVO.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
/**
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffCompetencyInspectItemConfigVO.java b/performance-server/src/main/java/com/ruoyi/performance/vo/StaffCompetencyInspectItemConfigVO.java
similarity index 73%
rename from inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffCompetencyInspectItemConfigVO.java
rename to performance-server/src/main/java/com/ruoyi/performance/vo/StaffCompetencyInspectItemConfigVO.java
index b4afea0..d387ebb 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffCompetencyInspectItemConfigVO.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffCompetencyLevelEvaluateRecordVO.java b/performance-server/src/main/java/com/ruoyi/performance/vo/StaffCompetencyLevelEvaluateRecordVO.java
similarity index 77%
rename from inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffCompetencyLevelEvaluateRecordVO.java
rename to performance-server/src/main/java/com/ruoyi/performance/vo/StaffCompetencyLevelEvaluateRecordVO.java
index 30dcbd2..3e686a9 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffCompetencyLevelEvaluateRecordVO.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffConfigHeaderVO.java b/performance-server/src/main/java/com/ruoyi/performance/vo/StaffConfigHeaderVO.java
similarity index 88%
rename from inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffConfigHeaderVO.java
rename to performance-server/src/main/java/com/ruoyi/performance/vo/StaffConfigHeaderVO.java
index a4d5098..8146547 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/vo/StaffConfigHeaderVO.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/vo/StaffConfigHeaderVO.java
@@ -1,4 +1,4 @@
-package com.ruoyi.inspect.vo;
+package com.ruoyi.performance.vo;
import lombok.Data;
diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/vo/TestUserVO.java b/performance-server/src/main/java/com/ruoyi/performance/vo/TestUserVO.java
similarity index 93%
rename from inspect-server/src/main/java/com/ruoyi/inspect/vo/TestUserVO.java
rename to performance-server/src/main/java/com/ruoyi/performance/vo/TestUserVO.java
index 85b4166..42870a8 100644
--- a/inspect-server/src/main/java/com/ruoyi/inspect/vo/TestUserVO.java
+++ b/performance-server/src/main/java/com/ruoyi/performance/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;
diff --git a/performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursMapper.xml b/performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursMapper.xml
index a82faab..9e0a0e1 100644
--- a/performance-server/src/main/resources/mapper/AuxiliaryOutputWorkingHoursMapper.xml
+++ b/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,
diff --git a/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml b/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
index 8fa884c..cf3d451 100644
--- a/performance-server/src/main/resources/mapper/PerformanceShiftMapper.xml
+++ b/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>
diff --git a/inspect-server/src/main/resources/mapper/StaffAttendanceTrackingRecordMapper.xml b/performance-server/src/main/resources/mapper/StaffAttendanceTrackingRecordMapper.xml
similarity index 94%
rename from inspect-server/src/main/resources/mapper/StaffAttendanceTrackingRecordMapper.xml
rename to performance-server/src/main/resources/mapper/StaffAttendanceTrackingRecordMapper.xml
index bd826ca..db4dcfb 100644
--- a/inspect-server/src/main/resources/mapper/StaffAttendanceTrackingRecordMapper.xml
+++ b/performance-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"/>
diff --git a/inspect-server/src/main/resources/mapper/StaffCompetencyInspectItemConfigMapper.xml b/performance-server/src/main/resources/mapper/StaffCompetencyInspectItemConfigMapper.xml
similarity index 89%
rename from inspect-server/src/main/resources/mapper/StaffCompetencyInspectItemConfigMapper.xml
rename to performance-server/src/main/resources/mapper/StaffCompetencyInspectItemConfigMapper.xml
index fa8242f..886a92c 100644
--- a/inspect-server/src/main/resources/mapper/StaffCompetencyInspectItemConfigMapper.xml
+++ b/performance-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,
diff --git a/inspect-server/src/main/resources/mapper/StaffCompetencyLevelEvaluateRecordMapper.xml b/performance-server/src/main/resources/mapper/StaffCompetencyLevelEvaluateRecordMapper.xml
similarity index 82%
rename from inspect-server/src/main/resources/mapper/StaffCompetencyLevelEvaluateRecordMapper.xml
rename to performance-server/src/main/resources/mapper/StaffCompetencyLevelEvaluateRecordMapper.xml
index b2eb5c0..eb0cc3c 100644
--- a/inspect-server/src/main/resources/mapper/StaffCompetencyLevelEvaluateRecordMapper.xml
+++ b/performance-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>
diff --git a/performance-server/src/main/resources/static/staff_attendance_month_template.xlsx b/performance-server/src/main/resources/static/staff_attendance_month_template.xlsx
new file mode 100644
index 0000000..00a1aba
--- /dev/null
+++ b/performance-server/src/main/resources/static/staff_attendance_month_template.xlsx
Binary files differ
diff --git a/performance-server/src/main/resources/static/staff_attendance_year_template.xlsx b/performance-server/src/main/resources/static/staff_attendance_year_template.xlsx
new file mode 100644
index 0000000..9112254
--- /dev/null
+++ b/performance-server/src/main/resources/static/staff_attendance_year_template.xlsx
Binary files differ
diff --git a/ruoyi-admin-ztns/src/main/java/com/ruoyi/web/controller/system/SysUserController.java b/ruoyi-admin-ztns/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
index a6b0865..af39801 100644
--- a/ruoyi-admin-ztns/src/main/java/com/ruoyi/web/controller/system/SysUserController.java
+++ b/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;
/**
* 鐢ㄦ埛淇℃伅
diff --git a/ruoyi-admin-ztns/src/main/java/com/ruoyi/web/controller/system/UserController.java b/ruoyi-admin-ztns/src/main/java/com/ruoyi/web/controller/system/UserController.java
index 66e322a..7c81c07 100644
--- a/ruoyi-admin-ztns/src/main/java/com/ruoyi/web/controller/system/UserController.java
+++ b/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));
+ }
+
}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
index 39d9db3..61421ff 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/SysUser.java
+++ b/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);
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/User.java b/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/User.java
index eb50fe3..acda68e 100644
--- a/ruoyi-common/src/main/java/com/ruoyi/common/core/domain/entity/User.java
+++ b/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;
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/CalendarType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/CalendarType.java
new file mode 100644
index 0000000..2fc82e6
--- /dev/null
+++ b/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
+
+}
diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/enums/StaffAttendanceReportType.java b/ruoyi-common/src/main/java/com/ruoyi/common/enums/StaffAttendanceReportType.java
deleted file mode 100644
index d58fec3..0000000
--- a/ruoyi-common/src/main/java/com/ruoyi/common/enums/StaffAttendanceReportType.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.ruoyi.common.enums;
-
-/**
- * 浜哄憳鑰冨嫟瀵煎嚭缁村害鏋氫妇(year/month)
- */
-public enum StaffAttendanceReportType {
-
- YEAR,
-
- MONTH
-
-}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java b/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java
index 518c43c..22f673b 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/mapper/UserMapper.java
+++ b/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);
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/UserService.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/UserService.java
index 4960d18..46ef52f 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/UserService.java
+++ b/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);
}
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
index 8927ada..5a38be8 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/SysUserServiceImpl.java
+++ b/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);
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserServiceImpl.java
index 557a42b..d0989d1 100644
--- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/UserServiceImpl.java
+++ b/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);
+ }
}
diff --git a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
index ce30170..f42cd75 100644
--- a/ruoyi-system/src/main/resources/mapper/system/SysUserMapper.xml
+++ b/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>
diff --git a/ruoyi-system/src/main/resources/mapper/system/UserMapper.xml b/ruoyi-system/src/main/resources/mapper/system/UserMapper.xml
index 84e48f4..645504c 100644
--- a/ruoyi-system/src/main/resources/mapper/system/UserMapper.xml
+++ b/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>
--
Gitblit v1.9.3