From f3dc63244f983e2d9b295772e7a8d3d344277d78 Mon Sep 17 00:00:00 2001 From: sy Date: Fri, 11 Nov 2022 11:15:33 +0800 Subject: [PATCH] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-=E7=A6=8F?= =?UTF-8?q?=E5=88=A9=E6=A1=A3=E6=A1=88=EF=BC=8C=E7=A6=8F=E5=88=A9=E6=A1=A3?= =?UTF-8?q?=E6=A1=88=E6=96=B0=E5=A2=9E=E6=8E=A5=E5=8F=A3v3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/SIArchiveActionAPIController.java | 14 ++++ .../service/impl/SISchemeServiceImpl.java | 68 +++++++++++++------ 2 files changed, 63 insertions(+), 19 deletions(-) create mode 100644 src/com/api/salary/web/SIArchiveActionAPIController.java diff --git a/src/com/api/salary/web/SIArchiveActionAPIController.java b/src/com/api/salary/web/SIArchiveActionAPIController.java new file mode 100644 index 000000000..c130f6a8b --- /dev/null +++ b/src/com/api/salary/web/SIArchiveActionAPIController.java @@ -0,0 +1,14 @@ +package com.api.salary.web; + +import com.engine.salary.process.siArchives.SIArchiveActionAPI; + +import javax.ws.rs.Path; + +/** + * @Author: sy + * @Description: + * @Date: 2022/11/11 + **/ +@Path("/bs/hrmsalary/siArchiveAction") +public class SIArchiveActionAPIController extends SIArchiveActionAPI { +} diff --git a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java index 4977ee678..11e7cff72 100644 --- a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java @@ -712,26 +712,48 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { public boolean singleAccountCheck(List> singleAccount, Map welfareMap, List insuranceArchivesAccountPOS, List employeeByIds, List> excelComments, int i, Map schemeNameIdMap, Map paymentNameIdMap, Long creator, int index, Boolean openDevolution, List taxAgentManageRangeEmployeeTree, String runStatus) { boolean isError = false; - String userName = (String) singleAccount.get(0).get(SalaryI18nUtil.getI18nLabel(85429, "姓名")); - String deparmentName = (String) singleAccount.get(1).get(SalaryI18nUtil.getI18nLabel(86185, "部门")); - String mobile = (String) singleAccount.get(2).get(SalaryI18nUtil.getI18nLabel(86186, "手机号")); - String userStatus = (String) singleAccount.get(3).get(SalaryI18nUtil.getI18nLabel(86187, "员工状态")); - String workcode = (String) singleAccount.get(4).get(SalaryI18nUtil.getI18nLabel(86317, "工号")); +// String userName = (String) singleAccount.get(0).get(SalaryI18nUtil.getI18nLabel(85429, "姓名")); +// String deparmentName = (String) singleAccount.get(1).get(SalaryI18nUtil.getI18nLabel(86185, "部门")); +// String mobile = (String) singleAccount.get(2).get(SalaryI18nUtil.getI18nLabel(86186, "手机号")); +// String userStatus = (String) singleAccount.get(3).get(SalaryI18nUtil.getI18nLabel(86187, "员工状态")); +// String workcode = (String) singleAccount.get(4).get(SalaryI18nUtil.getI18nLabel(86317, "工号")); + + Map userNameMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(85429, "姓名")); + Map deparmentNameMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(86185, "部门")); + Map mobileMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(86186, "手机号")); + Map userStatusMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(86187, "员工状态")); + Map workcodeMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(86317, "工号")); + Map employeeIdMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(86187, "员工id")); + + + String userName = (String) userNameMap.get(SalaryI18nUtil.getI18nLabel(85429, "姓名")); + String deparmentName = (String) deparmentNameMap.get(SalaryI18nUtil.getI18nLabel(86185, "部门")); + String mobile = (String) mobileMap.get(SalaryI18nUtil.getI18nLabel(86186, "手机号")); + String userStatus = (String) userStatusMap.get(SalaryI18nUtil.getI18nLabel(86187, "员工状态")); + String workcode = (String) workcodeMap.get(SalaryI18nUtil.getI18nLabel(86317, "工号")); + Long addEmployeeId = (Long) employeeIdMap.get(SalaryI18nUtil.getI18nLabel(86187, "员工id")); //查询对于人员信息导入筛选的全局配置 SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode"); String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0"; String rowIndex = "第" + index + "行"; - //仅在全局人员筛选配置为“0”时,才对用户名、部门名称、手机号有要求 - if (StringUtils.isBlank(userName) && StringUtils.isBlank(deparmentName) && StringUtils.isBlank(mobile) && "0".equals(confValue)) { - Map errorMessageMap = Maps.newHashMap(); - errorMessageMap.put("message", rowIndex + " 用户名、部门名称、手机号" + SalaryI18nUtil.getI18nLabel(100303, "不能同时为空")); - excelComments.add(errorMessageMap); - isError = true; + List employees = new ArrayList<>(); + //当新增数据中包含员工id信息时,直接根据员工id获取员工信息 + if (addEmployeeId == null) { + //仅在全局人员筛选配置为“0”时,才对用户名、部门名称、手机号有要求 + if (StringUtils.isBlank(userName) && StringUtils.isBlank(deparmentName) && StringUtils.isBlank(mobile) && "0".equals(confValue)) { + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", rowIndex + " 用户名、部门名称、手机号" + SalaryI18nUtil.getI18nLabel(100303, "不能同时为空")); + excelComments.add(errorMessageMap); + isError = true; + } + //筛选导入人员信息可以在人力资源池中匹配到的人员信息 + employees = getSalaryEmployeeService(user).matchImportEmployee(employeeByIds, userName, deparmentName, mobile, workcode, null); + } else { + employees = employeeByIds.stream().filter(f -> f.getEmployeeId().equals(addEmployeeId)).collect(Collectors.toList()); } - //筛选导入人员信息可以在人力资源池中匹配到的人员信息 - List employees = getSalaryEmployeeService(user).matchImportEmployee(employeeByIds, userName, deparmentName, mobile, workcode, null); + if (CollectionUtils.isEmpty(employees)) { Map errorMessageMap = Maps.newHashMap(); @@ -1321,17 +1343,24 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { // 待导入数据 InputStream fileInputStream = null; try { - fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId())); - Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX); // 表头 - List headers = ExcelSupport.getSheetHeader(sheet, 0); + List headers = new ArrayList<>(); + if (param.getImportDatas().size() > 0) { + Map getHeadersMap = param.getImportDatas().get(0); + for (Map.Entry entry : getHeadersMap.entrySet()){ + headers.add(entry.getKey()); + } + } else { + throw new SalaryRunTimeException("新增福利档案数据为空!"); + } + // 错误sheet数据 List> errorData = new LinkedList<>(); // 错误提示 List> excelComments = new LinkedList<>(); // 处理数值 - List> data = ExcelParseHelper.parse2Map(sheet, 1); + List> data = param.getImportDatas(); total = data.size(); //当前sheel的单行记录 @@ -1370,8 +1399,9 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { // } // 数据入库处理 - handleImportData(insuranceArchivesAccountPOS); - + if (param.isAddData()) { + handleImportData(insuranceArchivesAccountPOS); + } // 发送导入回调信息 // salaryBatchService.sendImportCallBackInfo(message, successCount, errorCount, errorExcelSheets);