From d54fbc9d4f8981fa0f7f613b33a28a8cd4f764ea Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期日, 25 十月 2026 16:29:53 +0800
Subject: [PATCH] feat(system): 优化用户搜索功能并完善ERP和MES模块验证逻辑
---
yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/salary/HrmSocialSecuritySchemeServiceImpl.java | 62 ++++++++++++++++++++++++++++++-
1 files changed, 60 insertions(+), 2 deletions(-)
diff --git a/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/salary/HrmSocialSecuritySchemeServiceImpl.java b/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/salary/HrmSocialSecuritySchemeServiceImpl.java
index 59eef61..72d526b 100644
--- a/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/salary/HrmSocialSecuritySchemeServiceImpl.java
+++ b/yudao-module-hrm/src/main/java/cn/iocoder/yudao/module/hrm/service/salary/HrmSocialSecuritySchemeServiceImpl.java
@@ -1,20 +1,30 @@
package cn.iocoder.yudao.module.hrm.service.salary;
+import cn.hutool.core.collection.CollUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.iocoder.yudao.framework.common.exception.ServiceException;
+import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
+import cn.iocoder.yudao.module.hrm.controller.admin.salary.vo.HrmSocialSecuritySchemeImportExcelVO;
+import cn.iocoder.yudao.module.hrm.controller.admin.salary.vo.HrmSocialSecuritySchemeImportReqVO;
+import cn.iocoder.yudao.module.hrm.controller.admin.salary.vo.HrmSocialSecuritySchemeImportRespVO;
import cn.iocoder.yudao.module.hrm.dal.dataobject.salary.HrmSocialSecuritySchemeDO;
import cn.iocoder.yudao.module.hrm.dal.mysql.salary.HrmSocialSecuritySchemeMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
-import static cn.iocoder.yudao.module.hrm.enums.ErrorCodeConstants.SOCIAL_SECURITY_SCHEME_NOT_EXISTS;
+import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.filterList;
+import static cn.iocoder.yudao.module.hrm.enums.ErrorCodeConstants.*;
/**
* 绀句繚鍏Н閲戞柟妗� Service 瀹炵幇绫�
*
- * @author 鑺嬮亾婧愮爜
+ * @author 瓒呯骇绠$悊鍛�
*/
@Service
@Validated
@@ -57,4 +67,52 @@
}
}
+ @Override
+ public HrmSocialSecuritySchemeImportRespVO importSchemeList(
+ List<HrmSocialSecuritySchemeImportExcelVO> importList, HrmSocialSecuritySchemeImportReqVO importReqVO) {
+ // 1. 鏍¢獙闈炵┖
+ importList = filterList(importList, item -> StrUtil.isNotBlank(item.getName()));
+ if (CollUtil.isEmpty(importList)) {
+ throw exception(SOCIAL_SECURITY_SCHEME_IMPORT_LIST_IS_EMPTY);
+ }
+ // 2. 閫愭潯澶勭悊
+ HrmSocialSecuritySchemeImportRespVO respVO = HrmSocialSecuritySchemeImportRespVO.builder()
+ .createNames(new ArrayList<>())
+ .updateNames(new ArrayList<>())
+ .failureNames(new LinkedHashMap<>())
+ .build();
+ importList.forEach(importScheme -> {
+ try {
+ // 2.1 鍒ゆ柇鏄惁瀛樺湪锛堟寜鍚嶇О鍞竴锛�
+ HrmSocialSecuritySchemeDO existScheme = schemeMapper.selectByName(importScheme.getName());
+ if (existScheme == null) {
+ // 2.1.1 鏂板
+ HrmSocialSecuritySchemeDO scheme = BeanUtils.toBean(importScheme, HrmSocialSecuritySchemeDO.class);
+ if (scheme.getStatus() == null) {
+ scheme.setStatus(0);
+ }
+ schemeMapper.insert(scheme);
+ respVO.getCreateNames().add(importScheme.getName());
+ return;
+ }
+ // 2.1.2 宸插瓨鍦紝鍒ゆ柇鏄惁鍏佽鏇存柊
+ if (!importReqVO.getUpdateSupport()) {
+ respVO.getFailureNames().put(importScheme.getName(),
+ StrUtil.format(SOCIAL_SECURITY_SCHEME_EXISTS.getMsg(), importScheme.getName()));
+ return;
+ }
+ HrmSocialSecuritySchemeDO updateScheme = BeanUtils.toBean(importScheme, HrmSocialSecuritySchemeDO.class)
+ .setId(existScheme.getId());
+ if (updateScheme.getStatus() == null) {
+ updateScheme.setStatus(0);
+ }
+ schemeMapper.updateById(updateScheme);
+ respVO.getUpdateNames().add(importScheme.getName());
+ } catch (ServiceException ex) {
+ respVO.getFailureNames().put(importScheme.getName(), ex.getMessage());
+ }
+ });
+ return respVO;
+ }
+
}
\ No newline at end of file
--
Gitblit v1.9.3