|
|
|
|
@ -5,8 +5,10 @@
|
|
|
|
|
//import com.engine.salary.common.LocalDateRange;
|
|
|
|
|
//import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
|
|
|
|
//import com.engine.salary.constant.SalaryItemConstant;
|
|
|
|
|
//import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
|
|
|
|
//import com.engine.salary.entity.salaryarchive.bo.SalaryArchiveBO;
|
|
|
|
|
//import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveDataDTO;
|
|
|
|
|
//import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveInitImportDTO;
|
|
|
|
|
//import com.engine.salary.entity.salaryarchive.dto.SalaryArchiveListDTO;
|
|
|
|
|
//import com.engine.salary.entity.salaryarchive.param.*;
|
|
|
|
|
//import com.engine.salary.entity.salaryarchive.po.SalaryArchiveDimissionPO;
|
|
|
|
|
@ -17,8 +19,11 @@
|
|
|
|
|
//import com.engine.salary.entity.taxrate.TaxAgent;
|
|
|
|
|
//import com.engine.salary.enums.SalaryUserStatusEnum;
|
|
|
|
|
//import com.engine.salary.enums.salaryarchive.SalaryArchiveImportTypeEnum;
|
|
|
|
|
//import com.engine.salary.enums.salaryarchive.SalaryArchiveItemAdjustReasonEnum;
|
|
|
|
|
//import com.engine.salary.enums.salaryarchive.SalaryArchiveTaxAgentAdjustReasonEnum;
|
|
|
|
|
//import com.engine.salary.exception.SalaryRunTimeException;
|
|
|
|
|
//import com.engine.salary.service.SalaryArchiveService;
|
|
|
|
|
//import com.engine.salary.util.SalaryDateUtil;
|
|
|
|
|
//import com.engine.salary.util.SalaryI18nUtil;
|
|
|
|
|
//import com.engine.salary.util.excel.ExcelComment;
|
|
|
|
|
//import com.engine.salary.util.excel.ExcelParseHelper;
|
|
|
|
|
@ -30,14 +35,13 @@
|
|
|
|
|
//import com.google.common.collect.Maps;
|
|
|
|
|
//import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
//import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
//import org.apache.poi.ss.usermodel.Cell;
|
|
|
|
|
//import org.apache.poi.ss.usermodel.Row;
|
|
|
|
|
//import org.apache.poi.ss.usermodel.Sheet;
|
|
|
|
|
//import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
|
//import weaver.file.ExcelSheet;
|
|
|
|
|
//import weaver.file.ImageFileManager;
|
|
|
|
|
//
|
|
|
|
|
//import java.io.InputStream;
|
|
|
|
|
//import java.text.SimpleDateFormat;
|
|
|
|
|
//import java.util.*;
|
|
|
|
|
//import java.util.concurrent.ExecutorService;
|
|
|
|
|
//import java.util.stream.Collectors;
|
|
|
|
|
@ -440,71 +444,50 @@
|
|
|
|
|
//
|
|
|
|
|
// int total = data.size();
|
|
|
|
|
//
|
|
|
|
|
// int index = 0;
|
|
|
|
|
// int successCount = 0;
|
|
|
|
|
// int errorCount = 0;
|
|
|
|
|
// // 错误excel内容
|
|
|
|
|
// List<ExcelSheet> errorExcelSheets = new ArrayList<>();
|
|
|
|
|
// // 用于(初始化导入)的相同employeeId时的处理
|
|
|
|
|
// boolean isInit = importType.equals(SalaryArchiveImportTypeEnum.INIT.getValue());
|
|
|
|
|
// List<SalaryArchiveInitImportDTO> initImportData = Lists.newArrayList();
|
|
|
|
|
// // 用于(调薪和调整个税扣缴义务人)的相同employeeId时取第一条记录,如果是初始化导入则有重复
|
|
|
|
|
// List<Long> allEmployeeIds = Lists.newArrayList();
|
|
|
|
|
// for (ExcelSheet excelSheet : excelSheets) {
|
|
|
|
|
// if (excelSheet.getHeader().size() == 0) {
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// int effectiveTimeIndex = 0;
|
|
|
|
|
// for (int j = 0; j < headers.size(); j++) {
|
|
|
|
|
// Map header = headers.get(j);
|
|
|
|
|
// String key = Optional.ofNullable(header.get("key")).orElse("").toString();
|
|
|
|
|
// if (key.equals(SalaryI18nUtil.getI18nLabel(85904, "生效日期"))) {
|
|
|
|
|
// effectiveTimeIndex = j;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// // 错误sheet数据
|
|
|
|
|
// List<Map<String, Object>> errorData = new ArrayList<>();
|
|
|
|
|
// // 错误提示
|
|
|
|
|
// List<ExcelComment> excelComments = new ArrayList<>();
|
|
|
|
|
//
|
|
|
|
|
// List<Map<String, Object>> data = excelSheet.getData();
|
|
|
|
|
// Map<String, Object> map;
|
|
|
|
|
// if (data == null) {
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// for (int i = 0; i < data.size(); i++) {
|
|
|
|
|
// index += 1;
|
|
|
|
|
// map = data.get(i);
|
|
|
|
|
// // 3.校验行内容
|
|
|
|
|
// boolean isError = singleRowCheck(importType, allEmployeeIds, map, headers, effectiveTimeIndex, excelComments, errorCount, importHandleParam);
|
|
|
|
|
//
|
|
|
|
|
// if (isError) {
|
|
|
|
|
// errorCount += 1;
|
|
|
|
|
// // 添加错误数据
|
|
|
|
|
// errorData.add(map);
|
|
|
|
|
// } else {
|
|
|
|
|
// successCount += 1;
|
|
|
|
|
// }
|
|
|
|
|
// // 初始化导入对重复记录校验
|
|
|
|
|
// if (isInit) {
|
|
|
|
|
// Map<String, Object> validMap = validInitImportData(isError, i, map, excelComments, errorCount, successCount, errorData, initImportData, currentEmployeeId, tenantKey, importHandleParam);
|
|
|
|
|
// errorCount = Integer.parseInt(validMap.getOrDefault("errorCount", errorCount).toString());
|
|
|
|
|
// successCount = Integer.parseInt(validMap.getOrDefault("successCount", successCount).toString());
|
|
|
|
|
// }
|
|
|
|
|
// // 导入进度
|
|
|
|
|
// salaryBatchService.sendImportRate(message.getBizId(), total, index);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// // 如果sheet包含错误数据
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(errorData)) {
|
|
|
|
|
// salaryBatchService.createErrorExcelSheet(headers, errorData, excelSheet.getName(), excelComments, errorExcelSheets);
|
|
|
|
|
// int effectiveTimeIndex = 0;
|
|
|
|
|
// for (int j = 0; j < headers.size(); j++) {
|
|
|
|
|
// if (headers.get(j).equals(SalaryI18nUtil.getI18nLabel(85904, "生效日期"))) {
|
|
|
|
|
// effectiveTimeIndex = j;
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// // 错误sheet数据
|
|
|
|
|
// List<Map<String, Object>> errorData = new ArrayList<>();
|
|
|
|
|
// // 错误提示
|
|
|
|
|
// List<ExcelComment> excelComments = new ArrayList<>();
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// for (int i = 0; i < data.size(); i++) {
|
|
|
|
|
// Map<String, Object> map = data.get(i);
|
|
|
|
|
// // 3.校验行内容
|
|
|
|
|
// boolean isError = singleRowCheck(importType, allEmployeeIds, map, headers, effectiveTimeIndex, excelComments, errorCount, importHandleParam);
|
|
|
|
|
//
|
|
|
|
|
// if (isError) {
|
|
|
|
|
// errorCount += 1;
|
|
|
|
|
// // 添加错误数据
|
|
|
|
|
// errorData.add(map);
|
|
|
|
|
// } else {
|
|
|
|
|
// successCount += 1;
|
|
|
|
|
// }
|
|
|
|
|
// // 初始化导入对重复记录校验
|
|
|
|
|
// if (isInit) {
|
|
|
|
|
// Map<String, Object> validMap = validInitImportData(isError, i, map, excelComments, errorCount, successCount, errorData, initImportData, importHandleParam);
|
|
|
|
|
// errorCount = Integer.parseInt(validMap.getOrDefault("errorCount", errorCount).toString());
|
|
|
|
|
// successCount = Integer.parseInt(validMap.getOrDefault("successCount", successCount).toString());
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// // 4.数据入库处理
|
|
|
|
|
// handleImportData(isInit, tenantKey, importHandleParam);
|
|
|
|
|
// handleImportData(isInit, importHandleParam);
|
|
|
|
|
//
|
|
|
|
|
// // 发送导入回调信息
|
|
|
|
|
// salaryBatchService.sendImportCallBackInfo(message, successCount, errorCount, errorExcelSheets);
|
|
|
|
|
@ -571,7 +554,7 @@
|
|
|
|
|
// * @param tenantKey
|
|
|
|
|
// * @param importHandleParam
|
|
|
|
|
// */
|
|
|
|
|
// private Map<String, Object> validInitImportData(boolean isError, int rowNo, Map<String, Object> map, List<ExcelComment> excelComments, int errorCount, int successCount, List<Map<String, Object>> errorData, List<SalaryArchiveInitImportDTO> initImportData, Long currentEmployeeId, String tenantKey, SalaryArchiveImportHandleParam importHandleParam) {
|
|
|
|
|
// private Map<String, Object> validInitImportData(boolean isError, int rowNo, Map<String, Object> map, List<ExcelComment> excelComments, int errorCount, int successCount, List<Map<String, Object>> errorData, List<SalaryArchiveInitImportDTO> initImportData, SalaryArchiveImportHandleParam importHandleParam) {
|
|
|
|
|
// Long employeeId = Long.valueOf(Optional.ofNullable(map.get("employeeId")).orElse("0").toString());
|
|
|
|
|
// Optional<SalaryArchiveInitImportDTO> optionalInitImport = initImportData.stream().filter(f -> f.getEmployeeId().equals(employeeId)).findFirst();
|
|
|
|
|
//
|
|
|
|
|
@ -653,7 +636,7 @@
|
|
|
|
|
// return validMap;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// /**
|
|
|
|
|
// * 校验单行数据
|
|
|
|
|
// *
|
|
|
|
|
// * @param importType
|
|
|
|
|
@ -662,12 +645,10 @@
|
|
|
|
|
// * @param headers
|
|
|
|
|
// * @param excelComments
|
|
|
|
|
// * @param errorCount
|
|
|
|
|
// * @param currentEmployeeId
|
|
|
|
|
// * @param tenantKey
|
|
|
|
|
// * @param importHandleParam
|
|
|
|
|
// * @return
|
|
|
|
|
// */
|
|
|
|
|
// private boolean singleRowCheck(String importType, List<Long> allEmployeeIds, Map<String, Object> map, List<Map> headers, int effectiveTimeIndex, List<ExcelComment> excelComments, int errorCount, Long currentEmployeeId, String tenantKey, SalaryArchiveImportHandleParam importHandleParam) {
|
|
|
|
|
// private boolean singleRowCheck(String importType, List<Long> allEmployeeIds, Map<String, Object> map, List<String> headers, int effectiveTimeIndex, List<ExcelComment> excelComments, int errorCount, SalaryArchiveImportHandleParam importHandleParam) {
|
|
|
|
|
// boolean isError = false;
|
|
|
|
|
//
|
|
|
|
|
// boolean isInit = importType.equals(SalaryArchiveImportTypeEnum.INIT.getValue());
|
|
|
|
|
@ -682,7 +663,7 @@
|
|
|
|
|
// String userName = Optional.ofNullable(map.get(userNameI18n)).orElse("").toString();
|
|
|
|
|
// String deparmentName = Optional.ofNullable(map.get(SalaryI18nUtil.getI18nLabel(86185, "部门"))).orElse("").toString();
|
|
|
|
|
// List<Long> employeeSameIds = importHandleParam.getEmployees().stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
|
|
|
|
|
// && (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDeparmentName(), deparmentName))).map(SalaryArchiveEmployeePO::getEmployeeId)
|
|
|
|
|
// && (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))).map(DataCollectionEmployee::getEmployeeId)
|
|
|
|
|
// .collect(Collectors.toList());
|
|
|
|
|
// Long employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 && employeeSameIds.get(0) > 0 ? employeeSameIds.get(0) : null;
|
|
|
|
|
// // 调薪和调整个税扣缴义务人的存在相同的取第一条
|
|
|
|
|
@ -700,47 +681,44 @@
|
|
|
|
|
// // 免得失败后,会追加 00:00:00
|
|
|
|
|
// map.put(effectiveTimeI18n, effectiveTimeCellVal);
|
|
|
|
|
// map.put("effectiveTime", effectiveTimeCellVal);
|
|
|
|
|
// LocalDate effectiveTime = SalaryDateUtil.checkDay(effectiveTimeCellVal) ? dateStrToLocalDate(effectiveTimeCellVal) : null;
|
|
|
|
|
// Date effectiveTime = SalaryDateUtil.checkDay(effectiveTimeCellVal) ? dateStrToLocalDate(effectiveTimeCellVal) : null;
|
|
|
|
|
// // 3.个税扣缴义务人
|
|
|
|
|
// String taxAgentCellVal = Optional.ofNullable(map.get(taxAgentI18n)).orElse("").toString();
|
|
|
|
|
// // 用于初始化导入的同一个人的记录校验
|
|
|
|
|
// map.put("taxAgent", taxAgentCellVal);
|
|
|
|
|
// Optional<TaxAgentListDTO> optionalTaxAgent = importHandleParam.getTaxAgentList().stream().filter(m -> m.getName().equals(taxAgentCellVal)).findFirst();
|
|
|
|
|
// Long taxAgentId = optionalTaxAgent.map(TaxAgentListDTO::getId).orElse(null);
|
|
|
|
|
// Optional<TaxAgent> optionalTaxAgent = importHandleParam.getTaxAgentList().stream().filter(m -> m.getName().equals(taxAgentCellVal)).findFirst();
|
|
|
|
|
// Long taxAgentId = optionalTaxAgent.map(TaxAgent::getId).orElse(null);
|
|
|
|
|
// // 4.调整原因
|
|
|
|
|
// String adjustReason = "";
|
|
|
|
|
// if (isTaxAgentAdjust) {
|
|
|
|
|
// // 4.调整原因[个税扣缴义务人]
|
|
|
|
|
// adjustReason = SalaryArchiveTaxAgentAdjustReasonEnum.getValueByDefaultLabel(Optional.ofNullable(map.get(adjustReasonI18n)).orElse("").toString(), currentEmployeeId, tenantKey);
|
|
|
|
|
// adjustReason = SalaryArchiveTaxAgentAdjustReasonEnum.getValueByDefaultLabel(Optional.ofNullable(map.get(adjustReasonI18n)).orElse("").toString());
|
|
|
|
|
// } else if (isSalaryItemAdjust) {
|
|
|
|
|
// // 4.调整原因[薪资项目]
|
|
|
|
|
// adjustReason = SalaryArchiveItemAdjustReasonEnum.getValueByDefaultLabel(Optional.ofNullable(map.get(adjustReasonI18n)).orElse("").toString(), currentEmployeeId, tenantKey);
|
|
|
|
|
// adjustReason = SalaryArchiveItemAdjustReasonEnum.getValueByDefaultLabel(Optional.ofNullable(map.get(adjustReasonI18n)).orElse("").toString());
|
|
|
|
|
// }
|
|
|
|
|
// // 构建薪资档案
|
|
|
|
|
//
|
|
|
|
|
// SalaryArchivePO finalSalaryArchive = buildSalaryArchive(isInit, currentEmployeeId, importHandleParam);
|
|
|
|
|
// SalaryArchivePO finalSalaryArchive = buildSalaryArchive(isInit, employeeId, importHandleParam);
|
|
|
|
|
// for (int j = 0; j < headers.size(); j++) {
|
|
|
|
|
// Map header = headers.get(j);
|
|
|
|
|
// Object key = header.get("key");
|
|
|
|
|
// if (key == null) {
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// String cellVal = Optional.ofNullable(map.get(key.toString())).orElse("").toString();
|
|
|
|
|
// String key = headers.get(j);
|
|
|
|
|
//
|
|
|
|
|
// String cellVal = Optional.ofNullable(map.get(key)).orElse("").toString();
|
|
|
|
|
//
|
|
|
|
|
// boolean isEmpty = StringUtils.isEmpty(cellVal) &&
|
|
|
|
|
// (userNameI18n.equals(key.toString())
|
|
|
|
|
// (userNameI18n.equals(key)
|
|
|
|
|
// // 个税扣缴义务人列判空(初始化导入或调整个税扣缴义务人)
|
|
|
|
|
// || (taxAgentI18n.equals(key.toString()) && (isInit || isTaxAgentAdjust))
|
|
|
|
|
// || effectiveTimeI18n.equals(key.toString())
|
|
|
|
|
// || (taxAgentI18n.equals(key) && (isInit || isTaxAgentAdjust))
|
|
|
|
|
// || effectiveTimeI18n.equals(key)
|
|
|
|
|
// // 调整原因列判空(调薪或调整个税扣缴义务人)
|
|
|
|
|
// || (adjustReasonI18n.equals(key.toString()) && (isTaxAgentAdjust || isSalaryItemAdjust)));
|
|
|
|
|
// || (adjustReasonI18n.equals(key) && (isTaxAgentAdjust || isSalaryItemAdjust)));
|
|
|
|
|
// // 判空
|
|
|
|
|
// if (isEmpty) {
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100577, "不能为空"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
// isError = true;
|
|
|
|
|
// }
|
|
|
|
|
// // 1.姓名列处理
|
|
|
|
|
// if (!isEmpty && userNameI18n.equals(key.toString())) {
|
|
|
|
|
// if (!isEmpty && userNameI18n.equals(key)) {
|
|
|
|
|
// if (CollectionUtils.isEmpty(employeeSameIds) || employeeSameIds.size() > 1) {
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100578, "员工信息不能为空且不可重复(姓名与部门同时确认唯一)"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
// isError = true;
|
|
|
|
|
@ -753,15 +731,14 @@
|
|
|
|
|
// isError = true;
|
|
|
|
|
// }
|
|
|
|
|
// // 2.个税扣缴义务人列处理(初始化导入或调整个税扣缴义务人)
|
|
|
|
|
// } else if (!isEmpty && taxAgentI18n.equals(key.toString()) && (isInit || isTaxAgentAdjust)) {
|
|
|
|
|
// isError = handleTaxAgent(isError, isInit, effectiveTimeIndex, excelComments, errorCount, j, currentEmployeeId, tenantKey,
|
|
|
|
|
// taxAgentId, effectiveTime, finalSalaryArchive, adjustReason, importHandleParam);
|
|
|
|
|
// } else if (!isEmpty && taxAgentI18n.equals(key) && (isInit || isTaxAgentAdjust)) {
|
|
|
|
|
// isError = handleTaxAgent(isError, isInit, effectiveTimeIndex, excelComments, errorCount, j, taxAgentId, effectiveTime, finalSalaryArchive, adjustReason, importHandleParam);
|
|
|
|
|
// // 3.生效时间处理
|
|
|
|
|
// } else if (!isEmpty && effectiveTimeI18n.equals(key.toString()) && effectiveTime == null) {
|
|
|
|
|
// } else if (!isEmpty && effectiveTimeI18n.equals(key) && effectiveTime == null) {
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(102497, "生效日期错误或格式不正确,正确格式示例为'2022-01-01'、'2022/1/1'"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
// isError = true;
|
|
|
|
|
// // 4.调整原因列处理(调薪或调整个税扣缴义务人)
|
|
|
|
|
// } else if (!isEmpty && adjustReasonI18n.equals(key.toString()) && (isTaxAgentAdjust || isSalaryItemAdjust) && StringUtils.isEmpty(adjustReason)) {
|
|
|
|
|
// } else if (!isEmpty && adjustReasonI18n.equals(key) && (isTaxAgentAdjust || isSalaryItemAdjust) && StringUtils.isEmpty(adjustReason)) {
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100591, "调整原因不存在"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
// isError = true;
|
|
|
|
|
// // 5.薪资项目列处理(初始化导入或调薪)
|
|
|
|
|
@ -770,269 +747,265 @@
|
|
|
|
|
// if (effectiveTime == null || finalSalaryArchive == null || !(isInit || isSalaryItemAdjust)) {
|
|
|
|
|
// continue;
|
|
|
|
|
// }
|
|
|
|
|
// isError = handleSalaryItem(isError, isInit, effectiveTimeIndex, excelComments, errorCount, j, currentEmployeeId, tenantKey,
|
|
|
|
|
// effectiveTime, finalSalaryArchive, adjustReason, importHandleParam, key.toString(), cellVal, map);
|
|
|
|
|
// isError = handleSalaryItem(isError, isInit, effectiveTimeIndex, excelComments, errorCount, j,
|
|
|
|
|
// effectiveTime, finalSalaryArchive, adjustReason, importHandleParam, key, cellVal, map);
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return isError;
|
|
|
|
|
// }
|
|
|
|
|
////
|
|
|
|
|
//// private SalaryArchivePO buildSalaryArchive(boolean isInit, Long currentEmployeeId, String tenantKey, Long employeeId, SalaryArchiveImportHandleParam importHandleParam) {
|
|
|
|
|
//// Optional<SalaryArchiveListDTO> optionalSA = importHandleParam.getSalaryArchives().stream().filter(p -> p.getEmployeeId().toString().equals(employeeId != null ? employeeId.toString() : "")).findFirst();
|
|
|
|
|
//// SalaryArchivePO salaryArchive = null;
|
|
|
|
|
//// if (optionalSA.isPresent()) {
|
|
|
|
|
//// // 修改档案
|
|
|
|
|
//// SalaryArchiveListDTO sa = optionalSA.get();
|
|
|
|
|
//// salaryArchive = new SalaryArchivePO();
|
|
|
|
|
//// salaryArchive.setId(sa.getId());
|
|
|
|
|
//// salaryArchive.setEmployeeId(sa.getEmployeeId());
|
|
|
|
|
//// } else if (employeeId != null && isInit) {
|
|
|
|
|
//// // 新增档案
|
|
|
|
|
//// salaryArchive = SalaryArchivePO.builder()
|
|
|
|
|
//
|
|
|
|
|
// private SalaryArchivePO buildSalaryArchive(boolean isInit, Long employeeId, SalaryArchiveImportHandleParam importHandleParam) {
|
|
|
|
|
// Optional<SalaryArchiveListDTO> optionalSA = importHandleParam.getSalaryArchives().stream().filter(p -> p.getEmployeeId().toString().equals(employeeId != null ? employeeId.toString() : "")).findFirst();
|
|
|
|
|
// SalaryArchivePO salaryArchive = null;
|
|
|
|
|
// if (optionalSA.isPresent()) {
|
|
|
|
|
// // 修改档案
|
|
|
|
|
// SalaryArchiveListDTO sa = optionalSA.get();
|
|
|
|
|
// salaryArchive = new SalaryArchivePO();
|
|
|
|
|
// salaryArchive.setId(sa.getId());
|
|
|
|
|
// salaryArchive.setEmployeeId(sa.getEmployeeId());
|
|
|
|
|
// } else if (employeeId != null && isInit) {
|
|
|
|
|
// // 新增档案
|
|
|
|
|
// salaryArchive = SalaryArchivePO.builder()
|
|
|
|
|
//// .id(IdGenerator.generate())
|
|
|
|
|
//// .employeeId(employeeId)
|
|
|
|
|
//// .createTime(importHandleParam.getNowTime())
|
|
|
|
|
//// .updateTime(importHandleParam.getNowTime())
|
|
|
|
|
//// .creator(currentEmployeeId)
|
|
|
|
|
//// .tenantKey(tenantKey)
|
|
|
|
|
//// .build();
|
|
|
|
|
//// importHandleParam.getSalaryArchiveSaves().add(salaryArchive);
|
|
|
|
|
//// }
|
|
|
|
|
//// return salaryArchive;
|
|
|
|
|
//// }
|
|
|
|
|
////
|
|
|
|
|
//// /**
|
|
|
|
|
//// * 个税扣缴义务人处理
|
|
|
|
|
//// *
|
|
|
|
|
//// * @param isError
|
|
|
|
|
//// * @param excelComments
|
|
|
|
|
//// * @param errorCount
|
|
|
|
|
//// * @param j
|
|
|
|
|
//// * @param currentEmployeeId
|
|
|
|
|
//// * @param tenantKey
|
|
|
|
|
//// * @param taxAgentId
|
|
|
|
|
//// * @param effectiveTime
|
|
|
|
|
//// * @param finalSalaryArchive
|
|
|
|
|
//// * @param taxAgentAdjustReason
|
|
|
|
|
//// * @param importHandleParam
|
|
|
|
|
//// * @return
|
|
|
|
|
//// */
|
|
|
|
|
//// private boolean handleTaxAgent(boolean isError, boolean isInit, int effectiveTimeIndex,
|
|
|
|
|
//// List<ExcelComment> excelComments, int errorCount, int j, Long currentEmployeeId, String tenantKey,
|
|
|
|
|
//// Long taxAgentId, LocalDate effectiveTime, SalaryArchivePO finalSalaryArchive, String taxAgentAdjustReason, SalaryArchiveImportHandleParam importHandleParam) {
|
|
|
|
|
//// if (taxAgentId == null) {
|
|
|
|
|
//// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100545, "个税扣缴义务人不存在"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
//// isError = true;
|
|
|
|
|
//// } else if (effectiveTime != null && finalSalaryArchive != null) {
|
|
|
|
|
//// boolean isBeforeError = false;
|
|
|
|
|
//// if (!isInit) {
|
|
|
|
|
//// // 前后调整校验
|
|
|
|
|
//// // 已生效
|
|
|
|
|
//// List<SalaryArchiveTaxAgentPO> effectiveList = importHandleParam.getEffectiveTaxAgentList().stream().filter(i -> finalSalaryArchive.getId().equals(i.getSalaryArchiveId())).collect(Collectors.toList());
|
|
|
|
|
//// // 当前已生效
|
|
|
|
|
//// SalaryArchiveTaxAgentPO effectiveTaxAgent = CollectionUtils.isNotEmpty(effectiveList) && effectiveList.size() > 0 ? effectiveList.get(0) : null;
|
|
|
|
|
//// // 当前已生效的前一次调整
|
|
|
|
|
//// SalaryArchiveTaxAgentPO effectiveBeforeTaxAgent = CollectionUtils.isNotEmpty(effectiveList) && effectiveList.size() > 1 ? effectiveList.get(1) : null;
|
|
|
|
|
//// // 未生效
|
|
|
|
|
//// Optional<SalaryArchiveTaxAgentPO> optionalIneffective = importHandleParam.getIneffectiveTaxAgentList().stream().filter(i -> finalSalaryArchive.getId().equals(i.getSalaryArchiveId())).findFirst();
|
|
|
|
|
//// SalaryArchiveTaxAgentPO ineffectiveTaxAgent = optionalIneffective.orElse(null);
|
|
|
|
|
//// // 1.检验是否可以调整
|
|
|
|
|
//// if (effectiveTaxAgent != null) {
|
|
|
|
|
//// // 当前已经生效的时间
|
|
|
|
|
//// LocalDate currentEffectiveTime = effectiveTaxAgent.getEffectiveTime();
|
|
|
|
|
//// // 1.1 如果早于<当前已生效
|
|
|
|
|
//// if (effectiveTime.isBefore(currentEffectiveTime)) {
|
|
|
|
|
//// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100429, "生效日期不可早于当前已生效的调整日期"), errorCount + 1, errorCount + 1, effectiveTimeIndex, effectiveTimeIndex);
|
|
|
|
|
//// isError = true;
|
|
|
|
|
//// isBeforeError = true;
|
|
|
|
|
//// // 1.2 如果等于当前已生效
|
|
|
|
|
//// } else if (effectiveTime.isEqual(currentEffectiveTime)) {
|
|
|
|
|
//// if (effectiveBeforeTaxAgent != null && effectiveBeforeTaxAgent.getTaxAgentId().equals(taxAgentId)) {
|
|
|
|
|
//// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
//// isError = true;
|
|
|
|
|
//// }
|
|
|
|
|
//// if (ineffectiveTaxAgent != null && ineffectiveTaxAgent.getTaxAgentId().equals(taxAgentId)) {
|
|
|
|
|
//// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
//// isError = true;
|
|
|
|
|
//// }
|
|
|
|
|
//// // 1.3 如果>已经生效且<=今天
|
|
|
|
|
//// } else if (effectiveTime.isAfter(currentEffectiveTime) && !effectiveTime.isAfter(importHandleParam.getToday())) {
|
|
|
|
|
//// if (effectiveTaxAgent.getTaxAgentId().equals(taxAgentId)) {
|
|
|
|
|
//// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
//// isError = true;
|
|
|
|
|
//// }
|
|
|
|
|
//// if (ineffectiveTaxAgent != null && ineffectiveTaxAgent.getTaxAgentId().equals(taxAgentId)) {
|
|
|
|
|
//// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
//// isError = true;
|
|
|
|
|
//// }
|
|
|
|
|
//// // 1.4 如果>今天
|
|
|
|
|
//// } else if (effectiveTime.isAfter(importHandleParam.getToday()) && effectiveTaxAgent.getTaxAgentId().equals(taxAgentId)) {
|
|
|
|
|
//// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
//// isError = true;
|
|
|
|
|
//// }
|
|
|
|
|
//// } else if (ineffectiveTaxAgent != null && ineffectiveTaxAgent.getTaxAgentId().equals(taxAgentId)) {
|
|
|
|
|
//// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
//// isError = true;
|
|
|
|
|
//// }
|
|
|
|
|
//// // 2.数据处理,有的就先删后增
|
|
|
|
|
//// if (effectiveTaxAgent != null && effectiveTime.isEqual(effectiveTaxAgent.getEffectiveTime())) {
|
|
|
|
|
//// importHandleParam.getSalaryArchiveTaxAgentDelTaxAgentIds().add(effectiveTaxAgent.getId());
|
|
|
|
|
//// }
|
|
|
|
|
//// if (ineffectiveTaxAgent != null && effectiveTime.isAfter(importHandleParam.getToday())) {
|
|
|
|
|
//// importHandleParam.getSalaryArchiveTaxAgentDelTaxAgentIds().add(ineffectiveTaxAgent.getId());
|
|
|
|
|
//// }
|
|
|
|
|
//// }
|
|
|
|
|
//// if (!isBeforeError) {
|
|
|
|
|
//// importHandleParam.getSalaryArchiveTaxAgentSaves().add(SalaryArchiveTaxAgentPO.builder()
|
|
|
|
|
// .employeeId(employeeId)
|
|
|
|
|
// .createTime(importHandleParam.getNowTime())
|
|
|
|
|
// .updateTime(importHandleParam.getNowTime())
|
|
|
|
|
// .creator((long) user.getUID())
|
|
|
|
|
// .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
|
|
|
|
// .build();
|
|
|
|
|
// importHandleParam.getSalaryArchiveSaves().add(salaryArchive);
|
|
|
|
|
// }
|
|
|
|
|
// return salaryArchive;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * 个税扣缴义务人处理
|
|
|
|
|
// *
|
|
|
|
|
// * @param isError
|
|
|
|
|
// * @param excelComments
|
|
|
|
|
// * @param errorCount
|
|
|
|
|
// * @param j
|
|
|
|
|
// * @param taxAgentId
|
|
|
|
|
// * @param effectiveTime
|
|
|
|
|
// * @param finalSalaryArchive
|
|
|
|
|
// * @param taxAgentAdjustReason
|
|
|
|
|
// * @param importHandleParam
|
|
|
|
|
// * @return
|
|
|
|
|
// */
|
|
|
|
|
// private boolean handleTaxAgent(boolean isError, boolean isInit, int effectiveTimeIndex,
|
|
|
|
|
// List<ExcelComment> excelComments, int errorCount, int j,
|
|
|
|
|
// Long taxAgentId, Date effectiveTime, SalaryArchivePO finalSalaryArchive, String taxAgentAdjustReason, SalaryArchiveImportHandleParam importHandleParam) {
|
|
|
|
|
// if (taxAgentId == null) {
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100545, "个税扣缴义务人不存在"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
// isError = true;
|
|
|
|
|
// } else if (effectiveTime != null && finalSalaryArchive != null) {
|
|
|
|
|
// boolean isBeforeError = false;
|
|
|
|
|
// if (!isInit) {
|
|
|
|
|
// // 前后调整校验
|
|
|
|
|
// // 已生效
|
|
|
|
|
// List<SalaryArchiveTaxAgentPO> effectiveList = importHandleParam.getEffectiveTaxAgentList().stream().filter(i -> finalSalaryArchive.getId().equals(i.getSalaryArchiveId())).collect(Collectors.toList());
|
|
|
|
|
// // 当前已生效
|
|
|
|
|
// SalaryArchiveTaxAgentPO effectiveTaxAgent = CollectionUtils.isNotEmpty(effectiveList) && effectiveList.size() > 0 ? effectiveList.get(0) : null;
|
|
|
|
|
// // 当前已生效的前一次调整
|
|
|
|
|
// SalaryArchiveTaxAgentPO effectiveBeforeTaxAgent = CollectionUtils.isNotEmpty(effectiveList) && effectiveList.size() > 1 ? effectiveList.get(1) : null;
|
|
|
|
|
// // 未生效
|
|
|
|
|
// Optional<SalaryArchiveTaxAgentPO> optionalIneffective = importHandleParam.getIneffectiveTaxAgentList().stream().filter(i -> finalSalaryArchive.getId().equals(i.getSalaryArchiveId())).findFirst();
|
|
|
|
|
// SalaryArchiveTaxAgentPO ineffectiveTaxAgent = optionalIneffective.orElse(null);
|
|
|
|
|
// // 1.检验是否可以调整
|
|
|
|
|
// if (effectiveTaxAgent != null) {
|
|
|
|
|
// // 当前已经生效的时间
|
|
|
|
|
// Date currentEffectiveTime = effectiveTaxAgent.getEffectiveTime();
|
|
|
|
|
// // 1.1 如果早于<当前已生效
|
|
|
|
|
// if (effectiveTime.before(currentEffectiveTime)) {
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100429, "生效日期不可早于当前已生效的调整日期"), errorCount + 1, errorCount + 1, effectiveTimeIndex, effectiveTimeIndex);
|
|
|
|
|
// isError = true;
|
|
|
|
|
// isBeforeError = true;
|
|
|
|
|
// // 1.2 如果等于当前已生效
|
|
|
|
|
// } else if (effectiveTime.equal(currentEffectiveTime)) {
|
|
|
|
|
// if (effectiveBeforeTaxAgent != null && effectiveBeforeTaxAgent.getTaxAgentId().equals(taxAgentId)) {
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
// isError = true;
|
|
|
|
|
// }
|
|
|
|
|
// if (ineffectiveTaxAgent != null && ineffectiveTaxAgent.getTaxAgentId().equals(taxAgentId)) {
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
// isError = true;
|
|
|
|
|
// }
|
|
|
|
|
// // 1.3 如果>已经生效且<=今天
|
|
|
|
|
// } else if (effectiveTime.after(currentEffectiveTime) && !effectiveTime.after(importHandleParam.getToday())) {
|
|
|
|
|
// if (effectiveTaxAgent.getTaxAgentId().equals(taxAgentId)) {
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
// isError = true;
|
|
|
|
|
// }
|
|
|
|
|
// if (ineffectiveTaxAgent != null && ineffectiveTaxAgent.getTaxAgentId().equals(taxAgentId)) {
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
// isError = true;
|
|
|
|
|
// }
|
|
|
|
|
// // 1.4 如果>今天
|
|
|
|
|
// } else if (effectiveTime.after(importHandleParam.getToday()) && effectiveTaxAgent.getTaxAgentId().equals(taxAgentId)) {
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
// isError = true;
|
|
|
|
|
// }
|
|
|
|
|
// } else if (ineffectiveTaxAgent != null && ineffectiveTaxAgent.getTaxAgentId().equals(taxAgentId)) {
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
// isError = true;
|
|
|
|
|
// }
|
|
|
|
|
// // 2.数据处理,有的就先删后增
|
|
|
|
|
// if (effectiveTaxAgent != null && effectiveTime.equals(effectiveTaxAgent.getEffectiveTime())) {
|
|
|
|
|
// importHandleParam.getSalaryArchiveTaxAgentDelTaxAgentIds().add(effectiveTaxAgent.getId());
|
|
|
|
|
// }
|
|
|
|
|
// if (ineffectiveTaxAgent != null && effectiveTime.after(importHandleParam.getToday())) {
|
|
|
|
|
// importHandleParam.getSalaryArchiveTaxAgentDelTaxAgentIds().add(ineffectiveTaxAgent.getId());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// if (!isBeforeError) {
|
|
|
|
|
// importHandleParam.getSalaryArchiveTaxAgentSaves().add(SalaryArchiveTaxAgentPO.builder()
|
|
|
|
|
//// .id(IdGenerator.generate())
|
|
|
|
|
//// .salaryArchiveId(finalSalaryArchive.getId())
|
|
|
|
|
//// .employeeId(finalSalaryArchive.getEmployeeId())
|
|
|
|
|
//// .taxAgentId(taxAgentId)
|
|
|
|
|
//// .effectiveTime(effectiveTime)
|
|
|
|
|
//// .adjustReason(StringUtils.isEmpty(taxAgentAdjustReason) ? SalaryArchiveTaxAgentAdjustReasonEnum.INIT.getValue() : taxAgentAdjustReason)
|
|
|
|
|
//// .operator(currentEmployeeId)
|
|
|
|
|
//// .operateTime(importHandleParam.getNowTime())
|
|
|
|
|
//// .createTime(importHandleParam.getNowTime())
|
|
|
|
|
//// .updateTime(importHandleParam.getNowTime())
|
|
|
|
|
//// .creator(currentEmployeeId)
|
|
|
|
|
//// .tenantKey(tenantKey)
|
|
|
|
|
//// .build());
|
|
|
|
|
//// }
|
|
|
|
|
//// }
|
|
|
|
|
//// return isError;
|
|
|
|
|
//// }
|
|
|
|
|
////
|
|
|
|
|
//// /**
|
|
|
|
|
//// * 薪资项目处理
|
|
|
|
|
//// *
|
|
|
|
|
//// * @param isError
|
|
|
|
|
//// * @param excelComments
|
|
|
|
|
//// * @param errorCount
|
|
|
|
|
//// * @param j
|
|
|
|
|
//// * @param currentEmployeeId
|
|
|
|
|
//// * @param tenantKey
|
|
|
|
|
//// * @param effectiveTime
|
|
|
|
|
//// * @param finalSalaryArchive
|
|
|
|
|
//// * @param salaryItemAdjustReason
|
|
|
|
|
//// * @param importHandleParam
|
|
|
|
|
//// * @param cellVal
|
|
|
|
|
//// * @return
|
|
|
|
|
//// */
|
|
|
|
|
//// private boolean handleSalaryItem(boolean isError, boolean isInit, int effectiveTimeIndex,
|
|
|
|
|
//// List<ExcelComment> excelComments, int errorCount, int j, Long currentEmployeeId, String tenantKey,
|
|
|
|
|
//// LocalDate effectiveTime, SalaryArchivePO finalSalaryArchive, String salaryItemAdjustReason, SalaryArchiveImportHandleParam importHandleParam,
|
|
|
|
|
//// String key, String cellVal, Map<String, Object> map) {
|
|
|
|
|
//// Optional<SalaryItemPO> optionalSalaryItem = importHandleParam.getSalaryItems().stream().filter(e -> e.getName().equals(key)).findFirst();
|
|
|
|
|
//// if (optionalSalaryItem.isPresent()) {
|
|
|
|
|
//// Long salaryItemId = optionalSalaryItem.get().getId();
|
|
|
|
|
//// boolean isBeforeError = false;
|
|
|
|
|
//// if (!isInit) {
|
|
|
|
|
//// // 已生效
|
|
|
|
|
//// List<SalaryArchiveItemPO> effectiveList = importHandleParam.getEffectiveItemList().stream().filter(i -> finalSalaryArchive.getId().equals(i.getSalaryArchiveId()) && i.getSalaryItemId().equals(salaryItemId)).collect(Collectors.toList());
|
|
|
|
|
//// // 当前已生效
|
|
|
|
|
//// SalaryArchiveItemPO effectiveSalaryItem = CollectionUtils.isNotEmpty(effectiveList) && effectiveList.size() > 0 ? effectiveList.get(0) : null;
|
|
|
|
|
//// // 当前已生效的前一次调整
|
|
|
|
|
//// SalaryArchiveItemPO effectiveBeforeSalaryItem = CollectionUtils.isNotEmpty(effectiveList) && effectiveList.size() > 1 ? effectiveList.get(1) : null;
|
|
|
|
|
//// // 未生效
|
|
|
|
|
//// Optional<SalaryArchiveItemPO> optionalIneffective = importHandleParam.getIneffectiveItemList().stream().filter(i -> finalSalaryArchive.getId().equals(i.getSalaryArchiveId()) && i.getSalaryItemId().equals(salaryItemId)).findFirst();
|
|
|
|
|
//// SalaryArchiveItemPO ineffectiveSalaryItem = optionalIneffective.orElse(null);
|
|
|
|
|
////
|
|
|
|
|
//// // 1.检验是否可以调整
|
|
|
|
|
//// if (effectiveSalaryItem != null) {
|
|
|
|
|
//// // 当前已经生效的时间
|
|
|
|
|
//// LocalDate currentEffectiveTime = effectiveSalaryItem.getEffectiveTime();
|
|
|
|
|
//// // 1.1 如果早于<当前已生效
|
|
|
|
|
//// if (effectiveTime.isBefore(currentEffectiveTime)) {
|
|
|
|
|
//// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100429, "生效日期不可早于当前已生效的调整日期"), errorCount + 1, errorCount + 1, effectiveTimeIndex, effectiveTimeIndex);
|
|
|
|
|
//// isError = true;
|
|
|
|
|
//// isBeforeError = true;
|
|
|
|
|
//// // 1.2 如果等于当前已生效
|
|
|
|
|
//// } else if (effectiveTime.isEqual(currentEffectiveTime)) {
|
|
|
|
|
//// if (effectiveBeforeSalaryItem != null && effectiveBeforeSalaryItem.getItemValue().equals(cellVal)) {
|
|
|
|
|
//// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
//// isError = true;
|
|
|
|
|
//// }
|
|
|
|
|
//// if (ineffectiveSalaryItem != null && ineffectiveSalaryItem.getItemValue().equals(cellVal)) {
|
|
|
|
|
//// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
//// isError = true;
|
|
|
|
|
//// }
|
|
|
|
|
//// // 1.3 如果>已经生效且<=今天
|
|
|
|
|
//// } else if (effectiveTime.isAfter(currentEffectiveTime) && !effectiveTime.isAfter(importHandleParam.getToday())) {
|
|
|
|
|
//// if (effectiveSalaryItem.getItemValue().equals(cellVal)) {
|
|
|
|
|
//// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
//// isError = true;
|
|
|
|
|
//// }
|
|
|
|
|
//// if (ineffectiveSalaryItem != null && ineffectiveSalaryItem.getItemValue().equals(cellVal)) {
|
|
|
|
|
//// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
//// isError = true;
|
|
|
|
|
//// }
|
|
|
|
|
//// // 1.4 如果>今天
|
|
|
|
|
//// } else if (effectiveTime.isAfter(importHandleParam.getToday()) && effectiveSalaryItem.getItemValue().equals(cellVal)) {
|
|
|
|
|
//// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
//// isError = true;
|
|
|
|
|
//// }
|
|
|
|
|
//// } else if (ineffectiveSalaryItem != null && ineffectiveSalaryItem.getItemValue().equals(cellVal)) {
|
|
|
|
|
//// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
//// isError = true;
|
|
|
|
|
//// }
|
|
|
|
|
//// // 2.数据处理
|
|
|
|
|
//// if (effectiveSalaryItem != null && effectiveTime.isEqual(effectiveSalaryItem.getEffectiveTime())) {
|
|
|
|
|
//// importHandleParam.getSalaryArchiveItemDelSalaryItemIds().add(effectiveSalaryItem.getId());
|
|
|
|
|
//// }
|
|
|
|
|
//// if (ineffectiveSalaryItem != null && effectiveTime.isAfter(importHandleParam.getToday())) {
|
|
|
|
|
//// importHandleParam.getSalaryArchiveItemDelSalaryItemIds().add(ineffectiveSalaryItem.getId());
|
|
|
|
|
//// }
|
|
|
|
|
//// }
|
|
|
|
|
//// if (!isBeforeError) {
|
|
|
|
|
//// importHandleParam.getSalaryArchiveItemSaves().add(SalaryArchiveItemPO.builder()
|
|
|
|
|
//// .id(IdGenerator.generate())
|
|
|
|
|
//// .salaryArchiveId(finalSalaryArchive.getId())
|
|
|
|
|
//// .employeeId(finalSalaryArchive.getEmployeeId())
|
|
|
|
|
//// .effectiveTime(effectiveTime)
|
|
|
|
|
//// .adjustReason(StringUtils.isEmpty(salaryItemAdjustReason) ? SalaryArchiveItemAdjustReasonEnum.INIT.getValue() : salaryItemAdjustReason)
|
|
|
|
|
//// .salaryItemId(salaryItemId)
|
|
|
|
|
//// .itemValue(cellVal)
|
|
|
|
|
//// .description("")
|
|
|
|
|
//// .operator(currentEmployeeId)
|
|
|
|
|
//// .operateTime(importHandleParam.getNowTime())
|
|
|
|
|
//// .createTime(importHandleParam.getNowTime())
|
|
|
|
|
//// .updateTime(importHandleParam.getNowTime())
|
|
|
|
|
//// .creator(currentEmployeeId)
|
|
|
|
|
//// .tenantKey(tenantKey)
|
|
|
|
|
//// .build());
|
|
|
|
|
//// }
|
|
|
|
|
//// // 用于初始化导入,同一个人的多行记录之间的薪资项目是否调整
|
|
|
|
|
//// map.put("salaryItemVal", Optional.ofNullable(map.get("salaryItemVal")).orElse("").toString() + salaryItemId + cellVal);
|
|
|
|
|
//// }
|
|
|
|
|
//// return isError;
|
|
|
|
|
//// }
|
|
|
|
|
////
|
|
|
|
|
//// /**
|
|
|
|
|
//// * 字符串转日期
|
|
|
|
|
//// * 兼容/和-
|
|
|
|
|
//// *
|
|
|
|
|
//// * @param effectiveTime
|
|
|
|
|
//// * @return
|
|
|
|
|
//// */
|
|
|
|
|
//// private LocalDate dateStrToLocalDate(String effectiveTime) {
|
|
|
|
|
//// LocalDate localDate = null;
|
|
|
|
|
//// try {
|
|
|
|
|
//// if (effectiveTime.contains("/")) {
|
|
|
|
|
//// String[] strs = effectiveTime.split("/");
|
|
|
|
|
//// localDate = LocalDate.of(Integer.parseInt(strs[0]), Integer.parseInt(strs[1]), Integer.parseInt(strs[2]));
|
|
|
|
|
//// } else if (effectiveTime.contains("-")) {
|
|
|
|
|
//// String[] strs = effectiveTime.replaceAll("-0", "-").split("-");
|
|
|
|
|
//// // localDate = LocalDate.parse(effectiveTime, DateTimeFormatter.ofPattern("yyyy-MM-dd")); // 月份日期超过最大会被改为最大
|
|
|
|
|
//// localDate = LocalDate.of(Integer.parseInt(strs[0]), Integer.parseInt(strs[1]), Integer.parseInt(strs[2]));
|
|
|
|
|
//// }
|
|
|
|
|
//// } catch (Exception e) {
|
|
|
|
|
//// localDate = null;
|
|
|
|
|
//// }
|
|
|
|
|
////
|
|
|
|
|
//// return localDate;
|
|
|
|
|
//// }
|
|
|
|
|
////
|
|
|
|
|
// .salaryArchiveId(finalSalaryArchive.getId())
|
|
|
|
|
// .employeeId(finalSalaryArchive.getEmployeeId())
|
|
|
|
|
// .taxAgentId(taxAgentId)
|
|
|
|
|
// .effectiveTime(effectiveTime)
|
|
|
|
|
// .adjustReason(StringUtils.isEmpty(taxAgentAdjustReason) ? SalaryArchiveTaxAgentAdjustReasonEnum.INIT.getValue() : taxAgentAdjustReason)
|
|
|
|
|
// .operator((long) user.getUID())
|
|
|
|
|
// .operateTime(importHandleParam.getNowTime())
|
|
|
|
|
// .createTime(importHandleParam.getNowTime())
|
|
|
|
|
// .updateTime(importHandleParam.getNowTime())
|
|
|
|
|
// .creator((long) user.getUID())
|
|
|
|
|
// .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
|
|
|
|
// .build());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// return isError;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * 薪资项目处理
|
|
|
|
|
// *
|
|
|
|
|
// * @param isError
|
|
|
|
|
// * @param excelComments
|
|
|
|
|
// * @param errorCount
|
|
|
|
|
// * @param j
|
|
|
|
|
// * @param effectiveTime
|
|
|
|
|
// * @param finalSalaryArchive
|
|
|
|
|
// * @param salaryItemAdjustReason
|
|
|
|
|
// * @param importHandleParam
|
|
|
|
|
// * @param cellVal
|
|
|
|
|
// * @return
|
|
|
|
|
// */
|
|
|
|
|
// private boolean handleSalaryItem(boolean isError, boolean isInit, int effectiveTimeIndex,
|
|
|
|
|
// List<ExcelComment> excelComments, int errorCount, int j,
|
|
|
|
|
// Date effectiveTime, SalaryArchivePO finalSalaryArchive, String salaryItemAdjustReason, SalaryArchiveImportHandleParam importHandleParam,
|
|
|
|
|
// String key, String cellVal, Map<String, Object> map) {
|
|
|
|
|
// Optional<SalaryItemPO> optionalSalaryItem = importHandleParam.getSalaryItems().stream().filter(e -> e.getName().equals(key)).findFirst();
|
|
|
|
|
// if (optionalSalaryItem.isPresent()) {
|
|
|
|
|
// Long salaryItemId = optionalSalaryItem.get().getId();
|
|
|
|
|
// boolean isBeforeError = false;
|
|
|
|
|
// if (!isInit) {
|
|
|
|
|
// // 已生效
|
|
|
|
|
// List<SalaryArchiveItemPO> effectiveList = importHandleParam.getEffectiveItemList().stream().filter(i -> finalSalaryArchive.getId().equals(i.getSalaryArchiveId()) && i.getSalaryItemId().equals(salaryItemId)).collect(Collectors.toList());
|
|
|
|
|
// // 当前已生效
|
|
|
|
|
// SalaryArchiveItemPO effectiveSalaryItem = CollectionUtils.isNotEmpty(effectiveList) && effectiveList.size() > 0 ? effectiveList.get(0) : null;
|
|
|
|
|
// // 当前已生效的前一次调整
|
|
|
|
|
// SalaryArchiveItemPO effectiveBeforeSalaryItem = CollectionUtils.isNotEmpty(effectiveList) && effectiveList.size() > 1 ? effectiveList.get(1) : null;
|
|
|
|
|
// // 未生效
|
|
|
|
|
// Optional<SalaryArchiveItemPO> optionalIneffective = importHandleParam.getIneffectiveItemList().stream().filter(i -> finalSalaryArchive.getId().equals(i.getSalaryArchiveId()) && i.getSalaryItemId().equals(salaryItemId)).findFirst();
|
|
|
|
|
// SalaryArchiveItemPO ineffectiveSalaryItem = optionalIneffective.orElse(null);
|
|
|
|
|
//
|
|
|
|
|
// // 1.检验是否可以调整
|
|
|
|
|
// if (effectiveSalaryItem != null) {
|
|
|
|
|
// // 当前已经生效的时间
|
|
|
|
|
// Date currentEffectiveTime = effectiveSalaryItem.getEffectiveTime();
|
|
|
|
|
// // 1.1 如果早于<当前已生效
|
|
|
|
|
// if (effectiveTime.before(currentEffectiveTime)) {
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100429, "生效日期不可早于当前已生效的调整日期"), errorCount + 1, errorCount + 1, effectiveTimeIndex, effectiveTimeIndex);
|
|
|
|
|
// isError = true;
|
|
|
|
|
// isBeforeError = true;
|
|
|
|
|
// // 1.2 如果等于当前已生效
|
|
|
|
|
// } else if (effectiveTime.equals(currentEffectiveTime)) {
|
|
|
|
|
// if (effectiveBeforeSalaryItem != null && effectiveBeforeSalaryItem.getItemValue().equals(cellVal)) {
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
// isError = true;
|
|
|
|
|
// }
|
|
|
|
|
// if (ineffectiveSalaryItem != null && ineffectiveSalaryItem.getItemValue().equals(cellVal)) {
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
// isError = true;
|
|
|
|
|
// }
|
|
|
|
|
// // 1.3 如果>已经生效且<=今天
|
|
|
|
|
// } else if (effectiveTime.isAfter(currentEffectiveTime) && !effectiveTime.isAfter(importHandleParam.getToday())) {
|
|
|
|
|
// if (effectiveSalaryItem.getItemValue().equals(cellVal)) {
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
// isError = true;
|
|
|
|
|
// }
|
|
|
|
|
// if (ineffectiveSalaryItem != null && ineffectiveSalaryItem.getItemValue().equals(cellVal)) {
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
// isError = true;
|
|
|
|
|
// }
|
|
|
|
|
// // 1.4 如果>今天
|
|
|
|
|
// } else if (effectiveTime.isAfter(importHandleParam.getToday()) && effectiveSalaryItem.getItemValue().equals(cellVal)) {
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100432, "调整前后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
// isError = true;
|
|
|
|
|
// }
|
|
|
|
|
// } else if (ineffectiveSalaryItem != null && ineffectiveSalaryItem.getItemValue().equals(cellVal)) {
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(100434, "与未生效的调整后不可相同"), errorCount + 1, errorCount + 1, j, j);
|
|
|
|
|
// isError = true;
|
|
|
|
|
// }
|
|
|
|
|
// // 2.数据处理
|
|
|
|
|
// if (effectiveSalaryItem != null && effectiveTime.isEqual(effectiveSalaryItem.getEffectiveTime())) {
|
|
|
|
|
// importHandleParam.getSalaryArchiveItemDelSalaryItemIds().add(effectiveSalaryItem.getId());
|
|
|
|
|
// }
|
|
|
|
|
// if (ineffectiveSalaryItem != null && effectiveTime.isAfter(importHandleParam.getToday())) {
|
|
|
|
|
// importHandleParam.getSalaryArchiveItemDelSalaryItemIds().add(ineffectiveSalaryItem.getId());
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// if (!isBeforeError) {
|
|
|
|
|
// importHandleParam.getSalaryArchiveItemSaves().add(SalaryArchiveItemPO.builder()
|
|
|
|
|
// .id(IdGenerator.generate())
|
|
|
|
|
// .salaryArchiveId(finalSalaryArchive.getId())
|
|
|
|
|
// .employeeId(finalSalaryArchive.getEmployeeId())
|
|
|
|
|
// .effectiveTime(effectiveTime)
|
|
|
|
|
// .adjustReason(StringUtils.isEmpty(salaryItemAdjustReason) ? SalaryArchiveItemAdjustReasonEnum.INIT.getValue() : salaryItemAdjustReason)
|
|
|
|
|
// .salaryItemId(salaryItemId)
|
|
|
|
|
// .itemValue(cellVal)
|
|
|
|
|
// .description("")
|
|
|
|
|
// .operator(currentEmployeeId)
|
|
|
|
|
// .operateTime(importHandleParam.getNowTime())
|
|
|
|
|
// .createTime(importHandleParam.getNowTime())
|
|
|
|
|
// .updateTime(importHandleParam.getNowTime())
|
|
|
|
|
// .creator(currentEmployeeId)
|
|
|
|
|
// .tenantKey(tenantKey)
|
|
|
|
|
// .build());
|
|
|
|
|
// }
|
|
|
|
|
// // 用于初始化导入,同一个人的多行记录之间的薪资项目是否调整
|
|
|
|
|
// map.put("salaryItemVal", Optional.ofNullable(map.get("salaryItemVal")).orElse("").toString() + salaryItemId + cellVal);
|
|
|
|
|
// }
|
|
|
|
|
// return isError;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// /**
|
|
|
|
|
// * 字符串转日期
|
|
|
|
|
// * 兼容/和-
|
|
|
|
|
// *
|
|
|
|
|
// * @param effectiveTime
|
|
|
|
|
// * @return
|
|
|
|
|
// */
|
|
|
|
|
// private Date dateStrToLocalDate(String effectiveTime) {
|
|
|
|
|
// Date localDate = null;
|
|
|
|
|
// try {
|
|
|
|
|
// if (effectiveTime.contains("/")) {
|
|
|
|
|
// SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd");
|
|
|
|
|
// localDate = format.parse(effectiveTime);
|
|
|
|
|
// } else if (effectiveTime.contains("-")) {
|
|
|
|
|
// SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
// localDate = format.parse(effectiveTime);
|
|
|
|
|
// }
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// localDate = null;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// return localDate;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// private List<SalaryArchiveItemPO> getEffectiveItemList(Collection<Long> salaryItemIds) {
|
|
|
|
|
// // 没有薪资项目时,给个不存在的,否则加载所有不合理
|
|
|
|
|
// salaryItemIds = CollectionUtils.isEmpty(salaryItemIds) ? Collections.singletonList(0L) : salaryItemIds;
|
|
|
|
|
@ -1157,61 +1130,56 @@
|
|
|
|
|
// return isValid;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
//// /**
|
|
|
|
|
//// * 数据落库处理
|
|
|
|
|
//// *
|
|
|
|
|
//// * @param importHandleParam
|
|
|
|
|
//// */
|
|
|
|
|
//// private void handleImportData(boolean isInit, String tenantKey, SalaryArchiveImportHandleParam importHandleParam) {
|
|
|
|
|
////
|
|
|
|
|
//// List<SalaryArchivePO> salaryArchiveSaves = importHandleParam.getSalaryArchiveSaves();
|
|
|
|
|
//// List<SalaryArchiveTaxAgentPO> salaryArchiveTaxAgentSaves = importHandleParam.getSalaryArchiveTaxAgentSaves();
|
|
|
|
|
//// List<SalaryArchiveItemPO> salaryArchiveItemSaves = importHandleParam.getSalaryArchiveItemSaves();
|
|
|
|
|
//// List<Long> salaryArchiveTaxAgentDelTaxAgentIds = importHandleParam.getSalaryArchiveTaxAgentDelTaxAgentIds();
|
|
|
|
|
//// List<Long> salaryArchiveItemDelSalaryItemIds = importHandleParam.getSalaryArchiveItemDelSalaryItemIds();
|
|
|
|
|
//// // 初始化导入
|
|
|
|
|
//// if (isInit) {
|
|
|
|
|
//// List<Long> salaryArchiveTaxAgentIds = importHandleParam.getSalaryArchiveTaxAgentSaves().stream().map(SalaryArchiveTaxAgentPO::getSalaryArchiveId).distinct().collect(Collectors.toList());
|
|
|
|
|
//// List<Long> salaryArchiveItemIds = importHandleParam.getSalaryArchiveItemSaves().stream().map(SalaryArchiveItemPO::getSalaryArchiveId).distinct().collect(Collectors.toList());
|
|
|
|
|
//// List<Long> salaryArchiveIds = salaryArchiveTaxAgentIds.stream().filter(item -> salaryArchiveItemIds.contains(item)).collect(Collectors.toList());
|
|
|
|
|
//// if (CollectionUtils.isNotEmpty(salaryArchiveIds)) {
|
|
|
|
|
//// List<List<Long>> partition = Lists.partition(salaryArchiveIds, 1000);
|
|
|
|
|
//// for (List<Long> p : partition) {
|
|
|
|
|
//// new LambdaUpdateChainWrapper<>(salaryArchiveTaxAgentMapper)
|
|
|
|
|
//// .eq(SalaryArchiveTaxAgentPO::getDeleteType, 0)
|
|
|
|
|
//// .eq(SalaryArchiveTaxAgentPO::getTenantKey, tenantKey)
|
|
|
|
|
//// .in(SalaryArchiveTaxAgentPO::getSalaryArchiveId, p)
|
|
|
|
|
//// .set(SalaryArchiveTaxAgentPO::getDeleteType, 1)
|
|
|
|
|
//// .update();
|
|
|
|
|
//// new LambdaUpdateChainWrapper<>(salaryArchiveItemMapper)
|
|
|
|
|
//// .eq(SalaryArchiveItemPO::getDeleteType, 0)
|
|
|
|
|
//// .eq(SalaryArchiveItemPO::getTenantKey, tenantKey)
|
|
|
|
|
//// .in(SalaryArchiveItemPO::getSalaryArchiveId, p)
|
|
|
|
|
//// .set(SalaryArchiveItemPO::getDeleteType, 1)
|
|
|
|
|
//// .update();
|
|
|
|
|
//// }
|
|
|
|
|
//// }
|
|
|
|
|
//// } else {
|
|
|
|
|
//// if (CollectionUtils.isNotEmpty(salaryArchiveTaxAgentDelTaxAgentIds)) {
|
|
|
|
|
//// salaryArchiveTaxAgentMapper.deleteBatchIds(salaryArchiveTaxAgentDelTaxAgentIds);
|
|
|
|
|
//// }
|
|
|
|
|
//// if (CollectionUtils.isNotEmpty(salaryArchiveItemDelSalaryItemIds)) {
|
|
|
|
|
//// salaryArchiveItemMapper.deleteBatchIds(salaryArchiveItemDelSalaryItemIds);
|
|
|
|
|
//// }
|
|
|
|
|
//// }
|
|
|
|
|
////
|
|
|
|
|
//// // 新增薪资档案
|
|
|
|
|
//// if (CollectionUtils.isNotEmpty(salaryArchiveSaves)) {
|
|
|
|
|
//// // 薪资档案
|
|
|
|
|
//// mapper.batchInsert(salaryArchiveSaves);
|
|
|
|
|
//// }
|
|
|
|
|
//// // 薪资档案-个税扣缴义务人
|
|
|
|
|
//// if (CollectionUtils.isNotEmpty(salaryArchiveTaxAgentSaves)) {
|
|
|
|
|
//// salaryArchiveTaxAgentMapper.batchInsert(salaryArchiveTaxAgentSaves);
|
|
|
|
|
//// }
|
|
|
|
|
//// // 薪资档案-薪资项目
|
|
|
|
|
//// if (CollectionUtils.isNotEmpty(salaryArchiveItemSaves)) {
|
|
|
|
|
//// salaryArchiveItemMapper.batchInsert(salaryArchiveItemSaves);
|
|
|
|
|
//// }
|
|
|
|
|
//// }
|
|
|
|
|
// /**
|
|
|
|
|
// * 数据落库处理
|
|
|
|
|
// *
|
|
|
|
|
// * @param importHandleParam
|
|
|
|
|
// */
|
|
|
|
|
// private void handleImportData(boolean isInit, SalaryArchiveImportHandleParam importHandleParam) {
|
|
|
|
|
//
|
|
|
|
|
// List<SalaryArchivePO> salaryArchiveSaves = importHandleParam.getSalaryArchiveSaves();
|
|
|
|
|
// List<SalaryArchiveTaxAgentPO> salaryArchiveTaxAgentSaves = importHandleParam.getSalaryArchiveTaxAgentSaves();
|
|
|
|
|
// List<SalaryArchiveItemPO> salaryArchiveItemSaves = importHandleParam.getSalaryArchiveItemSaves();
|
|
|
|
|
// List<Long> salaryArchiveTaxAgentDelTaxAgentIds = importHandleParam.getSalaryArchiveTaxAgentDelTaxAgentIds();
|
|
|
|
|
// List<Long> salaryArchiveItemDelSalaryItemIds = importHandleParam.getSalaryArchiveItemDelSalaryItemIds();
|
|
|
|
|
// // 初始化导入
|
|
|
|
|
// if (isInit) {
|
|
|
|
|
// List<Long> salaryArchiveTaxAgentIds = importHandleParam.getSalaryArchiveTaxAgentSaves().stream().map(SalaryArchiveTaxAgentPO::getSalaryArchiveId).distinct().collect(Collectors.toList());
|
|
|
|
|
// List<Long> salaryArchiveItemIds = importHandleParam.getSalaryArchiveItemSaves().stream().map(SalaryArchiveItemPO::getSalaryArchiveId).distinct().collect(Collectors.toList());
|
|
|
|
|
// List<Long> salaryArchiveIds = salaryArchiveTaxAgentIds.stream().filter(item -> salaryArchiveItemIds.contains(item)).collect(Collectors.toList());
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(salaryArchiveIds)) {
|
|
|
|
|
// List<List<Long>> partitionSalaryArchiveIds = Lists.partition(salaryArchiveIds, 1000);
|
|
|
|
|
// for (List<Long> partitions : partitionSalaryArchiveIds) {
|
|
|
|
|
// salaryArchiveTaxAgentMapper.deleteBySalaryArchiveId(partitions);
|
|
|
|
|
// new LambdaUpdateChainWrapper<>(salaryArchiveItemMapper)
|
|
|
|
|
// .eq(SalaryArchiveItemPO::getDeleteType, 0)
|
|
|
|
|
// .eq(SalaryArchiveItemPO::getTenantKey, tenantKey)
|
|
|
|
|
// .in(SalaryArchiveItemPO::getSalaryArchiveId, p)
|
|
|
|
|
// .set(SalaryArchiveItemPO::getDeleteType, 1)
|
|
|
|
|
// .update();
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(salaryArchiveTaxAgentDelTaxAgentIds)) {
|
|
|
|
|
// salaryArchiveTaxAgentMapper.deleteBatchIds(salaryArchiveTaxAgentDelTaxAgentIds);
|
|
|
|
|
// }
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(salaryArchiveItemDelSalaryItemIds)) {
|
|
|
|
|
// salaryArchiveItemMapper.deleteBatchIds(salaryArchiveItemDelSalaryItemIds);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// // 新增薪资档案
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(salaryArchiveSaves)) {
|
|
|
|
|
// // 薪资档案
|
|
|
|
|
// mapper.batchInsert(salaryArchiveSaves);
|
|
|
|
|
// }
|
|
|
|
|
// // 薪资档案-个税扣缴义务人
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(salaryArchiveTaxAgentSaves)) {
|
|
|
|
|
// salaryArchiveTaxAgentMapper.batchInsert(salaryArchiveTaxAgentSaves);
|
|
|
|
|
// }
|
|
|
|
|
// // 薪资档案-薪资项目
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(salaryArchiveItemSaves)) {
|
|
|
|
|
// salaryArchiveItemMapper.batchInsert(salaryArchiveItemSaves);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|