From 481d8165f26fc7e37f0e87f6444ac0340bb563a3 Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期二, 03 十一月 2026 18:53:22 +0800
Subject: [PATCH] fix: 移植长辉已验证的四类接口 500/体验问题(不含物料颜色字段)
---
yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/controller/admin/salary/HrmEmployeeSocialSecurityController.java | 37 ++++++++++++++++++++++++++++++++-----
1 files changed, 32 insertions(+), 5 deletions(-)
diff --git a/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/controller/admin/salary/HrmEmployeeSocialSecurityController.java b/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/controller/admin/salary/HrmEmployeeSocialSecurityController.java
index db54d53..3587ccc 100644
--- a/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/controller/admin/salary/HrmEmployeeSocialSecurityController.java
+++ b/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/controller/admin/salary/HrmEmployeeSocialSecurityController.java
@@ -4,6 +4,10 @@
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
+import cn.iocoder.yudao.module.hrm.controller.admin.salary.vo.HrmEmployeeSocialSecurityImportExcelVO;
+import cn.iocoder.yudao.module.hrm.controller.admin.salary.vo.HrmEmployeeSocialSecurityImportReqVO;
+import cn.iocoder.yudao.module.hrm.controller.admin.salary.vo.HrmEmployeeSocialSecurityImportRespVO;
import cn.iocoder.yudao.module.hrm.controller.admin.salary.vo.HrmEmployeeSocialSecurityPageReqVO;
import cn.iocoder.yudao.module.hrm.controller.admin.salary.vo.HrmEmployeeSocialSecurityRespVO;
import cn.iocoder.yudao.module.hrm.controller.admin.salary.vo.HrmEmployeeSocialSecuritySaveReqVO;
@@ -19,11 +23,15 @@
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
+import jakarta.servlet.http.HttpServletResponse;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
+import java.io.IOException;
+import java.math.BigDecimal;
+import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
@@ -73,7 +81,6 @@
@GetMapping("/get")
@Operation(summary = "鑾峰彇鍛樺伐绀句繚鍏Н閲戞。妗�")
@Parameter(name = "id", description = "妗fID", required = true)
- @PreAuthorize("@ss.hasPermission('hrm:social-security:query')")
public CommonResult<HrmEmployeeSocialSecurityRespVO> getEmployeeSocialSecurity(@RequestParam("id") Long id) {
HrmEmployeeSocialSecurityDO socialSecurity = employeeSocialSecurityService.getEmployeeSocialSecurity(id);
if (socialSecurity == null) {
@@ -88,7 +95,6 @@
@GetMapping("/page")
@Operation(summary = "鑾峰彇鍛樺伐绀句繚鍏Н閲戞。妗堝垎椤�")
- @PreAuthorize("@ss.hasPermission('hrm:social-security:query')")
public CommonResult<PageResult<HrmEmployeeSocialSecurityRespVO>> getEmployeeSocialSecurityPage(
@Valid HrmEmployeeSocialSecurityPageReqVO pageReqVO) {
PageResult<HrmEmployeeSocialSecurityDO> pageResult = employeeSocialSecurityService.getEmployeeSocialSecurityPage(pageReqVO);
@@ -157,7 +163,6 @@
@GetMapping("/list-by-user")
@Operation(summary = "鑾峰彇鍛樺伐绀句繚鍏Н閲戞。妗堝巻鍙插垪琛�")
@Parameter(name = "userId", description = "绯荤粺鐢ㄦ埛ID", required = true)
- @PreAuthorize("@ss.hasPermission('hrm:social-security:query')")
public CommonResult<List<HrmEmployeeSocialSecurityRespVO>> getEmployeeSocialSecurityList(
@RequestParam("userId") Long userId) {
List<HrmEmployeeSocialSecurityDO> list = employeeSocialSecurityService.getEmployeeSocialSecurityList(userId);
@@ -174,7 +179,6 @@
@GetMapping("/get-latest")
@Operation(summary = "鑾峰彇鍛樺伐鏈�鏂扮敓鏁堢殑绀句繚鍏Н閲戞。妗�")
@Parameter(name = "userId", description = "绯荤粺鐢ㄦ埛ID", required = true)
- @PreAuthorize("@ss.hasPermission('hrm:social-security:query')")
public CommonResult<HrmEmployeeSocialSecurityRespVO> getLatestEmployeeSocialSecurity(
@RequestParam("userId") Long userId) {
HrmEmployeeSocialSecurityDO socialSecurity = employeeSocialSecurityService.getLatestEmployeeSocialSecurity(userId);
@@ -217,4 +221,27 @@
}
}
-}
\ No newline at end of file
+ @GetMapping("/get-import-template")
+ @Operation(summary = "鑾峰緱瀵煎叆鍛樺伐绀句繚鍏Н閲戞。妗堟ā鏉�")
+ public void importTemplate(HttpServletResponse response) throws IOException {
+ // 鎵嬪姩鍒涘缓瀵煎嚭 demo
+ List<HrmEmployeeSocialSecurityImportExcelVO> list = Arrays.asList(
+ HrmEmployeeSocialSecurityImportExcelVO.builder().employeeName("寮犱笁").schemeName("鏍囧噯绀句繚鏂规")
+ .socialSecurityBase(new BigDecimal("5000")).housingFundBase(new BigDecimal("5000"))
+ .effectiveDate(LocalDate.of(2026, 1, 1)).status(0).remark("").build()
+ );
+ // 杈撳嚭
+ ExcelUtils.writeTemplate(response, "鍛樺伐绀句繚鍏Н閲戞。妗堝鍏ユā鏉�.xls", "鍛樺伐绀句繚鍏Н閲戞。妗堝垪琛�",
+ HrmEmployeeSocialSecurityImportExcelVO.class, list);
+ }
+
+ @PostMapping("/import")
+ @Operation(summary = "瀵煎叆鍛樺伐绀句繚鍏Н閲戞。妗�")
+ @PreAuthorize("@ss.hasPermission('hrm:employee-social-security:import')")
+ public CommonResult<HrmEmployeeSocialSecurityImportRespVO> importExcel(
+ @Valid HrmEmployeeSocialSecurityImportReqVO importReqVO) throws Exception {
+ List<HrmEmployeeSocialSecurityImportExcelVO> list = ExcelUtils.read(importReqVO.getFile(), HrmEmployeeSocialSecurityImportExcelVO.class);
+ return success(employeeSocialSecurityService.importEmployeeSocialSecurityList(list, importReqVO));
+ }
+
+}
--
Gitblit v1.9.3