2023-12-06 16:37:42 +08:00
|
|
|
|
package com.engine.salary.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
|
|
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
|
import com.engine.salary.entity.employeedeclare.dto.EmployeeDeclareListDTO;
|
2023-12-13 17:52:51 +08:00
|
|
|
|
import com.engine.salary.entity.employeedeclare.param.EmployeeDeclareImportParam;
|
2023-12-06 16:37:42 +08:00
|
|
|
|
import com.engine.salary.entity.employeedeclare.param.EmployeeDeclareListQueryParam;
|
|
|
|
|
|
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
|
2023-12-13 17:52:51 +08:00
|
|
|
|
import com.engine.salary.enums.employeedeclare.CardTypeEnum;
|
|
|
|
|
|
import com.engine.salary.enums.employeedeclare.EmploymentStatusEnum;
|
|
|
|
|
|
import com.engine.salary.enums.employeedeclare.EmploymentTypeEnum;
|
2023-12-06 16:37:42 +08:00
|
|
|
|
import com.engine.salary.service.EmployeeDeclareExcelService;
|
|
|
|
|
|
import com.engine.salary.service.EmployeeDeclareService;
|
|
|
|
|
|
import com.engine.salary.service.SalaryEmployeeService;
|
|
|
|
|
|
import com.engine.salary.service.TaxAgentService;
|
2023-12-13 17:52:51 +08:00
|
|
|
|
import com.engine.salary.util.SalaryEnumUtil;
|
|
|
|
|
|
import com.engine.salary.util.SalaryI18nUtil;
|
|
|
|
|
|
import com.engine.salary.util.excel.ExcelSheetData;
|
2023-12-06 16:37:42 +08:00
|
|
|
|
import com.engine.salary.util.excel.ExcelUtil;
|
2023-12-13 17:52:51 +08:00
|
|
|
|
import com.google.common.base.Joiner;
|
|
|
|
|
|
import com.google.common.collect.Lists;
|
2023-12-06 16:37:42 +08:00
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
2023-12-13 17:52:51 +08:00
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2023-12-06 16:37:42 +08:00
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
2023-12-13 17:52:51 +08:00
|
|
|
|
import weaver.general.Util;
|
2023-12-06 16:37:42 +08:00
|
|
|
|
import weaver.hrm.User;
|
|
|
|
|
|
|
2023-12-13 17:52:51 +08:00
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
import java.util.Collections;
|
2023-12-06 16:37:42 +08:00
|
|
|
|
import java.util.List;
|
2023-12-13 17:52:51 +08:00
|
|
|
|
import java.util.Objects;
|
|
|
|
|
|
import java.util.stream.Collectors;
|
2023-12-06 16:37:42 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
2023-12-13 17:52:51 +08:00
|
|
|
|
* 人员报送(人员)导入导出
|
|
|
|
|
|
* <p>Copyright: Copyright (c) 2023</p>
|
|
|
|
|
|
* <p>Company: 泛微软件</p>
|
|
|
|
|
|
*
|
|
|
|
|
|
* @author qiantao
|
|
|
|
|
|
* @version 1.0
|
|
|
|
|
|
**/
|
2023-12-06 16:37:42 +08:00
|
|
|
|
@Slf4j
|
|
|
|
|
|
public class EmployeeDeclareExcelServiceImpl extends Service implements EmployeeDeclareExcelService {
|
|
|
|
|
|
|
|
|
|
|
|
private EmployeeDeclareService getEmployeeDeclareService(User user) {
|
|
|
|
|
|
return ServiceUtil.getService(EmployeeDeclareServiceImpl.class, user);
|
|
|
|
|
|
}
|
2023-12-13 17:52:51 +08:00
|
|
|
|
|
2023-12-06 16:37:42 +08:00
|
|
|
|
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
|
|
|
|
|
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
|
|
|
|
|
}
|
|
|
|
|
|
// private ExtEmployeeService extEmployeeService;
|
|
|
|
|
|
|
|
|
|
|
|
private TaxAgentService getTaxAgentService(User user) {
|
|
|
|
|
|
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-12-13 17:52:51 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public XSSFWorkbook exportTemplate(EmployeeDeclareImportParam importParam) {
|
|
|
|
|
|
// 查询人员
|
|
|
|
|
|
List<EmployeeDeclarePO> employeeDeclares = Collections.emptyList();
|
|
|
|
|
|
if (StringUtils.equalsIgnoreCase(importParam.getExportData(), "true")) {
|
|
|
|
|
|
employeeDeclares = getEmployeeDeclareService(user).listByParam(importParam);
|
|
|
|
|
|
}
|
|
|
|
|
|
String yesI18 = SalaryI18nUtil.getI18nLabel(84967, "是");
|
|
|
|
|
|
String noI18 = SalaryI18nUtil.getI18nLabel(84968, "否");
|
|
|
|
|
|
List<List<Object>> rows = Lists.newArrayList();
|
|
|
|
|
|
for (EmployeeDeclarePO employeeDeclare : employeeDeclares) {
|
|
|
|
|
|
EmploymentStatusEnum employmentStatusEnum = SalaryEnumUtil.enumMatchByValue(employeeDeclare.getEmploymentStatus(), EmploymentStatusEnum.class);
|
|
|
|
|
|
EmploymentTypeEnum employmentTypeEnum = SalaryEnumUtil.enumMatchByValue(employeeDeclare.getEmploymentType(), EmploymentTypeEnum.class);
|
|
|
|
|
|
List<Object> row = Lists.newArrayList();
|
|
|
|
|
|
row.add(employeeDeclare.getJobNum());
|
|
|
|
|
|
row.add(employeeDeclare.getEmployeeName());
|
|
|
|
|
|
row.add(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel());
|
|
|
|
|
|
row.add(employeeDeclare.getCardNum());
|
|
|
|
|
|
row.add(employmentStatusEnum == null ? "" : employmentStatusEnum.getDefaultLabel());
|
|
|
|
|
|
row.add(employmentTypeEnum == null ? "" : employmentTypeEnum.getDefaultLabel());
|
|
|
|
|
|
row.add(employeeDeclare.getEmploymentFirstYear());
|
|
|
|
|
|
row.add(employeeDeclare.getMobile());
|
|
|
|
|
|
row.add(Util.null2String(employeeDeclare.getEmploymentDate()));
|
|
|
|
|
|
row.add(Util.null2String(employeeDeclare.getDismissDate()));
|
|
|
|
|
|
row.add(Objects.equals(employeeDeclare.getDisability(), 1) ? yesI18 : noI18);
|
|
|
|
|
|
row.add(employeeDeclare.getDisabilityCardNo());
|
|
|
|
|
|
row.add(Objects.equals(employeeDeclare.getMartyrDependents(), 1) ? yesI18 : noI18);
|
|
|
|
|
|
row.add(employeeDeclare.getMartyrDependentsCardNo());
|
|
|
|
|
|
row.add(Objects.equals(employeeDeclare.getLonelyOld(), 1) ? yesI18 : noI18);
|
|
|
|
|
|
row.add(Objects.equals(employeeDeclare.getDeductExpenses(), 1) ? yesI18 : noI18);
|
|
|
|
|
|
rows.add(row);
|
|
|
|
|
|
}
|
|
|
|
|
|
// 组装excel导出数据
|
|
|
|
|
|
ExcelSheetData excelSheetData = new ExcelSheetData();
|
|
|
|
|
|
excelSheetData.setSheetName(SalaryI18nUtil.getI18nLabel(156425, "人员信息采集"));
|
|
|
|
|
|
excelSheetData.setHeaders(getImportHeader());
|
|
|
|
|
|
excelSheetData.setRows(rows);
|
|
|
|
|
|
return ExcelUtil.genWorkbook(excelSheetData);
|
|
|
|
|
|
}
|
2023-12-06 16:37:42 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public XSSFWorkbook export(EmployeeDeclareListQueryParam queryParam) {
|
|
|
|
|
|
// 查询需要报送的人员
|
|
|
|
|
|
List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).listByParam(queryParam);
|
|
|
|
|
|
// 转换成dto
|
|
|
|
|
|
List<EmployeeDeclareListDTO> dtoList = getEmployeeDeclareService(user).convert(employeeDeclares);
|
|
|
|
|
|
// 需要导出的数据
|
2023-12-08 18:15:56 +08:00
|
|
|
|
List<List<Object>> excelSheetData = ExcelUtil.getExcelSheetData(EmployeeDeclareListDTO.class, dtoList);
|
2023-12-06 16:37:42 +08:00
|
|
|
|
|
|
|
|
|
|
return ExcelUtil.genWorkbookV2(excelSheetData, "人员信息采集");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public XSSFWorkbook export4Add(EmployeeDeclareAddListQueryParam queryParam) {
|
|
|
|
|
|
// String tenantKey = simpleEmployee.getTenantKey();
|
|
|
|
|
|
// Long currentEmployeeId = simpleEmployee.getEmployeeId();
|
|
|
|
|
|
// // 查询需要报送的人员
|
|
|
|
|
|
// List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).list4AddByParam(queryParam);
|
|
|
|
|
|
// // 转换成dto
|
|
|
|
|
|
// List<EmployeeDeclareListDTO> dtoList = getEmployeeDeclareService(user).convert(employeeDeclares);
|
|
|
|
|
|
// // 需要导出的数据
|
|
|
|
|
|
// ExcelSheetData excelSheetData = getExcelSheetData(EmployeeDeclareListDTO.class, dtoList);
|
|
|
|
|
|
// CustomExportUtil.customColumnsBuild(false, queryParam.getCustomColumns(), excelSheetData);
|
|
|
|
|
|
// ExportExcelInfo exportExcelInfo = ExportExcelInfo.builder()
|
|
|
|
|
|
// .fileName(SalaryI18nUtil.getI18nLabel(156426, "人员信息采集本月新增") + "-" + SalaryDateUtil.getFormatLocalDate(LocalDateTime.now()))
|
|
|
|
|
|
// .dataType(SalaryI18nUtil.getI18nLabel(156426, "人员信息采集本月新增"))
|
|
|
|
|
|
// .function(excelExportParam.getFunction())
|
|
|
|
|
|
// .handlerName("exportEmployeeDeclare4Add")
|
|
|
|
|
|
// .flag(true)
|
|
|
|
|
|
// .bizId(excelExportParam.getBiz())
|
|
|
|
|
|
// .module(excelExportParam.getModule())
|
|
|
|
|
|
// .userId(simpleEmployee.getEmployeeId())
|
|
|
|
|
|
// .tenantKey(simpleEmployee.getTenantKey())
|
|
|
|
|
|
// .operator(simpleEmployee.getUsername())
|
|
|
|
|
|
// .eteamsId(TenantRpcContext.getEteamsId())
|
|
|
|
|
|
// .build();
|
|
|
|
|
|
// return salaryBatchService.simpleExportExcel(exportExcelInfo, Collections.singletonList(excelSheetData));
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// @BatchExportHandler("exportEmployeeDeclare4Add")
|
|
|
|
|
|
// private void exportEmployeeDeclare4Add() {
|
|
|
|
|
|
// BatchCallbackMessage message = BatchExportContext.getBatchCallbackMessage();
|
|
|
|
|
|
// log.info("导出结束:{}", JsonUtil.toJsonString(message));
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public XSSFWorkbook export4Update(EmployeeDeclareListQueryParam queryParam) {
|
|
|
|
|
|
// String tenantKey = simpleEmployee.getTenantKey();
|
|
|
|
|
|
// Long currentEmployeeId = simpleEmployee.getEmployeeId();
|
|
|
|
|
|
// // 查询需要报送的人员
|
|
|
|
|
|
// List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).list4UpdateByParam(queryParam);
|
|
|
|
|
|
// // 转换成dto
|
|
|
|
|
|
// List<EmployeeDeclareListDTO> dtoList = getEmployeeDeclareService(user).convert(employeeDeclares);
|
|
|
|
|
|
// // 需要导出的数据
|
|
|
|
|
|
// ExcelSheetData excelSheetData = getExcelSheetData(EmployeeDeclareListDTO.class, dtoList);
|
|
|
|
|
|
// CustomExportUtil.customColumnsBuild(false, queryParam.getCustomColumns(), excelSheetData);
|
|
|
|
|
|
// ExportExcelInfo exportExcelInfo = ExportExcelInfo.builder()
|
|
|
|
|
|
// .fileName(SalaryI18nUtil.getI18nLabel(156427, "人员信息采集本月信息变动") + "-" + SalaryDateUtil.getFormatLocalDate(LocalDateTime.now()))
|
|
|
|
|
|
// .dataType(SalaryI18nUtil.getI18nLabel(156427, "人员信息采集本月信息变动"))
|
|
|
|
|
|
// .function(excelExportParam.getFunction())
|
|
|
|
|
|
// .handlerName("exportEmployeeDeclare4Update")
|
|
|
|
|
|
// .flag(true)
|
|
|
|
|
|
// .bizId(excelExportParam.getBiz())
|
|
|
|
|
|
// .module(excelExportParam.getModule())
|
|
|
|
|
|
// .userId(simpleEmployee.getEmployeeId())
|
|
|
|
|
|
// .tenantKey(simpleEmployee.getTenantKey())
|
|
|
|
|
|
// .operator(simpleEmployee.getUsername())
|
|
|
|
|
|
// .eteamsId(TenantRpcContext.getEteamsId())
|
|
|
|
|
|
// .build();
|
|
|
|
|
|
// return salaryBatchService.simpleExportExcel(exportExcelInfo, Collections.singletonList(excelSheetData));
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// @BatchExportHandler("exportEmployeeDeclare4Update")
|
|
|
|
|
|
// private void exportEmployeeDeclare4Update() {
|
|
|
|
|
|
// BatchCallbackMessage message = BatchExportContext.getBatchCallbackMessage();
|
|
|
|
|
|
// log.info("导出结束:{}", JsonUtil.toJsonString(message));
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// @Override
|
|
|
|
|
|
// public XSSFWorkbook export4Fail(EmployeeDeclareFailListQueryParam queryParam) {
|
|
|
|
|
|
// String tenantKey = simpleEmployee.getTenantKey();
|
|
|
|
|
|
// Long currentEmployeeId = simpleEmployee.getEmployeeId();
|
|
|
|
|
|
// // 查询需要报送的人员
|
|
|
|
|
|
// List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).list4FailByParam(queryParam);
|
|
|
|
|
|
// // 转换成dto
|
|
|
|
|
|
// List<EmployeeDeclareFailListDTO> dtos = getEmployeeDeclareService(user).convert2FailListDTO(employeeDeclares);
|
|
|
|
|
|
// // 需要导出的数据
|
|
|
|
|
|
// ExcelSheetData excelSheetData = getExcelSheetData(EmployeeDeclareFailListDTO.class, dtos);
|
|
|
|
|
|
// ExportExcelInfo exportExcelInfo = ExportExcelInfo.builder()
|
|
|
|
|
|
// .fileName(SalaryI18nUtil.getI18nLabel(156428, "人员信息采集本月报送失败") + "-" + SalaryDateUtil.getFormatLocalDate(LocalDateTime.now()))
|
|
|
|
|
|
// .dataType(SalaryI18nUtil.getI18nLabel(156428, "人员信息采集本月报送失败"))
|
|
|
|
|
|
// .function(excelExportParam.getFunction())
|
|
|
|
|
|
// .handlerName("exportEmployeeDeclare4Fail")
|
|
|
|
|
|
// .flag(true)
|
|
|
|
|
|
// .bizId(excelExportParam.getBiz())
|
|
|
|
|
|
// .module(excelExportParam.getModule())
|
|
|
|
|
|
// .userId(simpleEmployee.getEmployeeId())
|
|
|
|
|
|
// .tenantKey(simpleEmployee.getTenantKey())
|
|
|
|
|
|
// .operator(simpleEmployee.getUsername())
|
|
|
|
|
|
// .eteamsId(TenantRpcContext.getEteamsId())
|
|
|
|
|
|
// .build();
|
|
|
|
|
|
// return salaryBatchService.simpleExportExcel(exportExcelInfo, Collections.singletonList(excelSheetData));
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// public Map<String, Object> importEmployeeDeclare(EmployeeDeclareImportEmployeeParam param) {
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// try {
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// Date now = new Date();
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// // 个税扣缴义务人id
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// Long taxAgentId = param.getTaxAgentId();
|
|
|
|
|
|
// TaxAgentPO taxAgent = getTaxAgentService(user).getById(taxAgentId);
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// if (taxAgent == null) {
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(111111, "参数错误,无法找到个税扣缴义务人"));
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// }
|
|
|
|
|
|
// // 税款所属期
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// Date taxCycle = param.getTaxCycle();
|
|
|
|
|
|
// if (taxCycle == null) {
|
|
|
|
|
|
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(111111, "参数错误,税款所属期参数格式错误"));
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// }
|
|
|
|
|
|
//
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// InputStream fileInputStream = null;
|
|
|
|
|
|
// fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId()));
|
|
|
|
|
|
//
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// // 导出模板中的表头
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// List<String> headerList = getImportHeader();
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// // 查询所有的人员
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ALL);
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// // 查询人员报送表的人员
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).listByTaxCycleAndTaxAgentId(taxCycle, taxAgentId);
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// // 校验字段
|
|
|
|
|
|
// String checkType = Util.null2String(paramMap.getOrDefault("checkType", "jobNum"));
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// Map<String, DataCollectionEmployee> simpleEmployeeMap = Maps.newHashMap();
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// Map<String, EmployeeDeclarePO> employeeDeclareMap = Maps.newHashMapWithExpectedSize(employeeDeclares.size());
|
|
|
|
|
|
// if (Objects.equals(checkType, "jobNum")) {
|
|
|
|
|
|
// simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, SimpleEmployee::getJobNum);
|
|
|
|
|
|
// employeeDeclareMap = SalaryEntityUtil.convert2Map(employeeDeclares, EmployeeDeclarePO::getJobNum);
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// // 查询所有人员的个人信息
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// List<EmployeeDeclarePO> simpleUserInfos = getSalaryEmployeeService(user).listByEmployeeIds(orgEmployeeIds);
|
|
|
|
|
|
// Map<Long, EmployeeDeclarePO> idKeySimpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, SimpleEmployee::getId);
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// for (SimpleUserInfo simpleUserInfo : simpleUserInfos) {
|
|
|
|
|
|
// if (idKeySimpleEmployeeMap.containsKey(simpleUserInfo.getEmployeeId())) {
|
|
|
|
|
|
// simpleEmployeeMap.put(simpleUserInfo.getIdNo(), idKeySimpleEmployeeMap.get(simpleUserInfo.getEmployeeId()));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// employeeDeclareMap = SalaryEntityUtil.convert2Map(employeeDeclares, EmployeeDeclarePO::getCardNum);
|
|
|
|
|
|
//
|
|
|
|
|
|
// }
|
|
|
|
|
|
// // 需要新增的报送人员
|
|
|
|
|
|
// List<EmployeeDeclarePO> needAddEmployeeDeclares = Lists.newArrayList();
|
|
|
|
|
|
// // 需要更新的报送人员
|
|
|
|
|
|
// List<EmployeeDeclarePO> needUpdateEmployeeDeclares = Lists.newArrayList();
|
|
|
|
|
|
// // 索引(用于计算进度)
|
|
|
|
|
|
// int index = 0;
|
|
|
|
|
|
// // 失败的数量
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// int errorCount = 0;
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// // 成功的数量
|
|
|
|
|
|
// int successCount = 0;
|
|
|
|
|
|
// // 错误行的索引
|
|
|
|
|
|
// int failRowIndex = 1;
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// // 错误提示
|
|
|
|
|
|
// List<Map<String, String>> excelComments = new ArrayList<>();
|
|
|
|
|
|
// // 错误excel内容
|
|
|
|
|
|
// List<Map> errorData = new ArrayList<>();
|
|
|
|
|
|
//
|
|
|
|
|
|
// Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
|
|
|
|
|
|
// // 表头
|
|
|
|
|
|
// List<String> headers = ExcelSupport.getSheetHeader(sheet, 0);
|
|
|
|
|
|
//
|
|
|
|
|
|
// // 检查表头
|
|
|
|
|
|
// String isValidHeader = checkHeader(headers, headerList);
|
|
|
|
|
|
// if (StringUtils.isNotBlank(isValidHeader)) {
|
|
|
|
|
|
// Map<String, Object> apidatas = new HashMap<String, Object>();
|
|
|
|
|
|
// apidatas.put("successCount", successCount);
|
|
|
|
|
|
// apidatas.put("errorCount", errorCount);
|
|
|
|
|
|
//
|
|
|
|
|
|
// Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
// errorMessageMap.put("message", isValidHeader);
|
|
|
|
|
|
// excelComments.add(errorMessageMap);
|
|
|
|
|
|
// apidatas.put("errorData", excelComments);
|
|
|
|
|
|
// return apidatas;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// // 数据
|
|
|
|
|
|
// List<EmployeeDeclareExcelDTO> data = ExcelParseHelper.parse2Map(fileInputStream, EmployeeDeclareExcelDTO.class, 0, 1, 14, "1.xlsx");
|
|
|
|
|
|
// if (CollectionUtils.isEmpty(data)) {
|
|
|
|
|
|
// Map<String, Object> apidatas = new HashMap<String, Object>();
|
|
|
|
|
|
// apidatas.put("successCount", successCount);
|
|
|
|
|
|
// apidatas.put("errorCount", errorCount);
|
|
|
|
|
|
// return apidatas;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// for (int i = 0; i < data.size(); i++) {
|
|
|
|
|
|
// EmployeeDeclareExcelDTO employeeDeclareExcelDTO = data.get(i);
|
|
|
|
|
|
//
|
|
|
|
|
|
// employeeDeclareExcelDTO.getEmployeeName()
|
|
|
|
|
|
//
|
|
|
|
|
|
// //筛选导入人员信息可以在人力资源池中匹配到的人员信息
|
|
|
|
|
|
// List<DataCollectionEmployee> employeeSameIds = getSalaryEmployeeService(user).matchImportEmployee(simpleEmployees, userName, deparmentName, mobile, workcode, null);
|
|
|
|
|
|
//
|
|
|
|
|
|
// if (StringUtils.isBlank(userName) && "0".equals(confValue)) {
|
|
|
|
|
|
// //姓名 不能为空
|
|
|
|
|
|
// //错误消息对象
|
|
|
|
|
|
// Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
// errorMessageMap.put("message", rowIndex + "姓名不能为空");
|
|
|
|
|
|
// errorData.add(errorMessageMap);
|
|
|
|
|
|
// errorSum += 1;
|
|
|
|
|
|
// } else if (CollectionUtils.isEmpty(employeeSameIds)) {
|
|
|
|
|
|
// Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
// errorMessageMap.put("message", rowIndex + "员工信息不存在");
|
|
|
|
|
|
// errorData.add(errorMessageMap);
|
|
|
|
|
|
// errorSum += 1;
|
|
|
|
|
|
// } else if (employeeSameIds.size() > 1) {
|
|
|
|
|
|
// //存在离职和在职状态取在职状态
|
|
|
|
|
|
// employeeSameIds = employeeSameIds.stream()
|
|
|
|
|
|
// .filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus()))
|
|
|
|
|
|
// .collect(Collectors.toList());
|
|
|
|
|
|
// if (employeeSameIds.size() != 1) {
|
|
|
|
|
|
// Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
// errorMessageMap.put("message", rowIndex + "员工信息不存在或者存在多个员工");
|
|
|
|
|
|
// errorData.add(errorMessageMap);
|
|
|
|
|
|
// errorSum += 1;
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// Long employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0).getEmployeeId() : null;
|
|
|
|
|
|
// addUpDeduction.setEmployeeId(employeeId);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// Long employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0).getEmployeeId() : null;
|
|
|
|
|
|
// if (employeeId != null && employeeId > 0) {
|
|
|
|
|
|
// addUpDeduction.setEmployeeId(employeeId);
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// //姓名错误,系统内不存在该姓名
|
|
|
|
|
|
// Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
// errorMessageMap.put("message", rowIndex + "姓名错误,系统内不存在该姓名");
|
|
|
|
|
|
// errorData.add(errorMessageMap);
|
|
|
|
|
|
// errorSum += 1;
|
|
|
|
|
|
// }
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// }
|
2023-12-13 17:52:51 +08:00
|
|
|
|
//
|
|
|
|
|
|
//
|
|
|
|
|
|
// // 数据是否存在错误
|
|
|
|
|
|
// boolean isError = false;
|
|
|
|
|
|
// if (StringUtils.equals(employeeDeclareExcelDTO.getJobNum(), SalaryI18nUtil.getI18nLabel(86317, "工号"))) {
|
|
|
|
|
|
// if (StringUtils.isEmpty(employeeDeclareExcelDTO.getJobNum()) ) {
|
|
|
|
|
|
// isError = true;
|
|
|
|
|
|
//
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(136250, "工号不能为空"), failRowIndex, failRowIndex, j, j);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// employeeDeclareExcel.setJobNum(dataValue);
|
|
|
|
|
|
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(85429, "姓名"))) {
|
|
|
|
|
|
// if (StringUtils.isEmpty(dataValue)) {
|
|
|
|
|
|
// isError = true;
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(102838, "姓名不能为空"), failRowIndex, failRowIndex, j, j);
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// employeeDeclareExcel.setEmployeeName(dataValue);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(105139, "证件类型"))) {
|
|
|
|
|
|
// employeeDeclareExcel.setCardType(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getValue());
|
|
|
|
|
|
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(86318, "证件号码"))) {
|
|
|
|
|
|
// if (StringUtils.isEmpty(dataValue)) {
|
|
|
|
|
|
// isError = true;
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(156386, "证件号码不能为空"), failRowIndex, failRowIndex, j, j);
|
|
|
|
|
|
// } else if (!SalaryCardUtil.checkIdNum(dataValue)) {
|
|
|
|
|
|
// isError = true;
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(156429, "证件号码格式不正确"), failRowIndex, failRowIndex, j, j);
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// employeeDeclareExcel.setCardNum(dataValue);
|
|
|
|
|
|
// employeeDeclareExcel.setGender(SalaryCardUtil.judgeGender(dataValue).getValue());
|
|
|
|
|
|
// employeeDeclareExcel.setBirthday(SalaryCardUtil.judgeBirthday(dataValue));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(156394, "人员状态"))) {
|
|
|
|
|
|
// boolean legalDataValue = false;
|
|
|
|
|
|
// for (EmploymentStatusEnum employmentStatusEnum : EmploymentStatusEnum.values()) {
|
|
|
|
|
|
// if (StringUtils.equals(dataValue, employmentStatusEnum.getDefaultLabel())) {
|
|
|
|
|
|
// legalDataValue = true;
|
|
|
|
|
|
// employeeDeclareExcel.setEmploymentStatus(employmentStatusEnum.getValue());
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (!legalDataValue) {
|
|
|
|
|
|
// isError = true;
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(156430, "人员状态只能填写正常或非正常"), failRowIndex, failRowIndex, j, j);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(156396, "任职受雇从业类型"))) {
|
|
|
|
|
|
// boolean legalDataValue = false;
|
|
|
|
|
|
// for (EmploymentTypeEnum employmentTypeEnum : EmploymentTypeEnum.values()) {
|
|
|
|
|
|
// if (StringUtils.equals(dataValue, employmentTypeEnum.getDefaultLabel())) {
|
|
|
|
|
|
// legalDataValue = true;
|
|
|
|
|
|
// employeeDeclareExcel.setEmploymentType(employmentTypeEnum.getValue());
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (!legalDataValue) {
|
|
|
|
|
|
// isError = true;
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(156431, "任职受雇从业类型填写错误"), failRowIndex, failRowIndex, j, j);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(187374, "入职年度就业情形"))) {
|
|
|
|
|
|
// employeeDeclareExcel.setEmploymentFirstYear(dataValue);
|
|
|
|
|
|
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(98621, "手机号码"))) {
|
|
|
|
|
|
// if (StringUtils.isEmpty(dataValue)) {
|
|
|
|
|
|
// isError = true;
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(106429, "手机号码不能为空"), failRowIndex, failRowIndex, j, j);
|
|
|
|
|
|
// } else if (!SalaryCardUtil.checkMobile(dataValue)) {
|
|
|
|
|
|
// isError = true;
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(160510, "手机号码格式不正确"), failRowIndex, failRowIndex, j, j);
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// employeeDeclareExcel.setMobile(dataValue);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(156409, "任职受雇从业日期"))) {
|
|
|
|
|
|
// if (StringUtils.isEmpty(dataValue)) {
|
|
|
|
|
|
// if (!Objects.equals(employeeDeclareExcel.getEmploymentType(), EmploymentTypeEnum.OTHER.getValue())) {
|
|
|
|
|
|
// isError = true;
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(160511, "任职受雇从业类型不为「其他」时,任职受雇从业日期为必填"), failRowIndex, failRowIndex, j, j);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// if (!SalaryDateUtil.checkDay(dataValue)) {
|
|
|
|
|
|
// isError = true;
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(156432, "日期格式不正确"), failRowIndex, failRowIndex, j, j);
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// employeeDeclareExcel.setEmploymentDate(LocalDate.parse(dataValue));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(95228, "离职日期"))) {
|
|
|
|
|
|
// if (StringUtils.isEmpty(dataValue)) {
|
|
|
|
|
|
// if (Objects.equals(employeeDeclareExcel.getEmploymentStatus(), EmploymentStatusEnum.ABNORMAL.getValue())) {
|
|
|
|
|
|
// isError = true;
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(160512, "人员状态为非正常时,离职日期必填"), failRowIndex, failRowIndex, j, j);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// if (!SalaryDateUtil.checkDay(dataValue)) {
|
|
|
|
|
|
// isError = true;
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(156432, "日期格式不正确"), failRowIndex, failRowIndex, j, j);
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// employeeDeclareExcel.setDismissDate(LocalDate.parse(dataValue));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(156399, "是否残疾"))) {
|
|
|
|
|
|
// if (StringUtils.equals(dataValue, SalaryOnOffEnum.ON.getDefaultLabel())) {
|
|
|
|
|
|
// employeeDeclareExcel.setDisability(SalaryOnOffEnum.ON.getValue());
|
|
|
|
|
|
// } else if (StringUtils.equals(dataValue, SalaryOnOffEnum.OFF.getDefaultLabel())) {
|
|
|
|
|
|
// employeeDeclareExcel.setDisability(SalaryOnOffEnum.OFF.getValue());
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// isError = true;
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(156433, "是否残疾只能填写是与否"), failRowIndex, failRowIndex, j, j);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(156412, "残疾证号"))) {
|
|
|
|
|
|
// if (StringUtils.isEmpty(dataValue)) {
|
|
|
|
|
|
// if (Objects.equals(employeeDeclareExcel.getDisability(), SalaryOnOffEnum.ON.getValue())) {
|
|
|
|
|
|
// isError = true;
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(160513, "「是否残疾」填「是」时,残疾证号必填"), failRowIndex, failRowIndex, j, j);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// employeeDeclareExcel.setDisabilityCardNo(dataValue);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(187385, "是否烈属"))) {
|
|
|
|
|
|
// if (StringUtils.equals(dataValue, SalaryOnOffEnum.ON.getDefaultLabel())) {
|
|
|
|
|
|
// employeeDeclareExcel.setMartyrDependents(SalaryOnOffEnum.ON.getValue());
|
|
|
|
|
|
// } else if (StringUtils.equals(dataValue, SalaryOnOffEnum.OFF.getDefaultLabel())) {
|
|
|
|
|
|
// employeeDeclareExcel.setMartyrDependents(SalaryOnOffEnum.OFF.getValue());
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// isError = true;
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(156433, "是否烈属只能填写是与否"), failRowIndex, failRowIndex, j, j);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(156413, "烈属证号"))) {
|
|
|
|
|
|
// if (StringUtils.isEmpty(dataValue)) {
|
|
|
|
|
|
// if (Objects.equals(employeeDeclareExcel.getMartyrDependents(), SalaryOnOffEnum.ON.getValue())) {
|
|
|
|
|
|
// isError = true;
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(160514, "「是否烈属」填「是」时,烈属证号必填"), failRowIndex, failRowIndex, j, j);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// employeeDeclareExcel.setMartyrDependentsCardNo(dataValue);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(156400, "是否孤老"))) {
|
|
|
|
|
|
// if (StringUtils.equals(dataValue, SalaryOnOffEnum.ON.getDefaultLabel())) {
|
|
|
|
|
|
// employeeDeclareExcel.setLonelyOld(SalaryOnOffEnum.ON.getValue());
|
|
|
|
|
|
// } else if (StringUtils.equals(dataValue, SalaryOnOffEnum.OFF.getDefaultLabel())) {
|
|
|
|
|
|
// employeeDeclareExcel.setLonelyOld(SalaryOnOffEnum.OFF.getValue());
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// isError = true;
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(156434, "是否孤老只能填写是与否"), failRowIndex, failRowIndex, j, j);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// } else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(156402, "是否扣除减除费用"))) {
|
|
|
|
|
|
// if (StringUtils.equals(dataValue, SalaryOnOffEnum.ON.getDefaultLabel())) {
|
|
|
|
|
|
// employeeDeclareExcel.setDeductExpenses(SalaryOnOffEnum.ON.getValue());
|
|
|
|
|
|
// } else if (StringUtils.equals(dataValue, SalaryOnOffEnum.OFF.getDefaultLabel())) {
|
|
|
|
|
|
// employeeDeclareExcel.setDeductExpenses(SalaryOnOffEnum.OFF.getValue());
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// isError = true;
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(156435, "是否扣除减除费用只能填写是与否"), failRowIndex, failRowIndex, j, j);
|
|
|
|
|
|
// }
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// }
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// if (!isError) {
|
|
|
|
|
|
// if (StringUtils.equals(checkType, "jobNum")) {
|
|
|
|
|
|
// EmployeeDeclarePO employeeDeclare = employeeDeclareMap.get(employeeDeclareExcel.getJobNum());
|
|
|
|
|
|
// if (employeeDeclare == null) {
|
|
|
|
|
|
// ExtEmployeePO extEmployee = extEmployeeMap.get(employeeDeclareExcel.getJobNum());
|
|
|
|
|
|
// SimpleEmployee simpleEmployee = simpleEmployeeMap.get(employeeDeclareExcel.getJobNum());
|
|
|
|
|
|
// if (extEmployee == null && simpleEmployee == null) {
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// isError = true;
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// String jobNumI18 = SalaryI18nUtil.getI18nLabel(86317, "工号");
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(156436, "系统内的人员不存在该工号"), failRowIndex, failRowIndex, headers.indexOf(jobNumI18), headers.indexOf(jobNumI18));
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// } else {
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// needAddEmployeeDeclares.add(buildEmployeeDeclare(extEmployee, simpleEmployee,
|
|
|
|
|
|
// employeeDeclareExcel, taxAgentId, taxCycle, now, employeeId));
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// }
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// } else {
|
|
|
|
|
|
// EmployeeDeclarePO newEmployeeDeclare = new EmployeeDeclarePO();
|
|
|
|
|
|
// BeanUtils.copyProperties(employeeDeclare, newEmployeeDeclare);
|
|
|
|
|
|
// BeanUtils.copyProperties(employeeDeclareExcel, newEmployeeDeclare);
|
|
|
|
|
|
// newEmployeeDeclare.setNewEmployeeInfo(StringUtils.equals(employeeDeclare.toCompareString(), newEmployeeDeclare.toCompareString()) ? 0 : 1)
|
|
|
|
|
|
// .setUpdateTime(now);
|
|
|
|
|
|
// needUpdateEmployeeDeclares.add(newEmployeeDeclare);
|
|
|
|
|
|
// if (Objects.equals(newEmployeeDeclare.getNewEmployeeInfo(), 1)) {
|
|
|
|
|
|
// newEmployeeDeclare.setDeclareStatus(DeclareStatusEnum.NOT_DECLARE.getValue());
|
|
|
|
|
|
// newEmployeeDeclare.setDeclareErrorMsg("");
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// }
|
|
|
|
|
|
// }
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// } else {
|
|
|
|
|
|
// EmployeeDeclarePO employeeDeclare = employeeDeclareMap.get(employeeDeclareExcel.getCardNum());
|
|
|
|
|
|
// if (employeeDeclare == null) {
|
|
|
|
|
|
// ExtEmployeePO extEmployee = extEmployeeMap.get(employeeDeclareExcel.getCardNum());
|
|
|
|
|
|
// SimpleEmployee simpleEmployee = simpleEmployeeMap.get(employeeDeclareExcel.getCardNum());
|
|
|
|
|
|
// if (extEmployee == null && simpleEmployee == null) {
|
|
|
|
|
|
// isError = true;
|
|
|
|
|
|
// String cardNoI18 = SalaryI18nUtil.getI18nLabel(86318, "证件号码");
|
|
|
|
|
|
// salaryBatchService.createExcelComment(excelComments, SalaryI18nUtil.getI18nLabel(156437, "系统内的人员不存在该证件号码"), failRowIndex, failRowIndex, headers.indexOf(cardNoI18), headers.indexOf(cardNoI18));
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// } else {
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// needAddEmployeeDeclares.add(buildEmployeeDeclare(extEmployee, simpleEmployee,
|
|
|
|
|
|
// employeeDeclareExcel, taxAgentId, taxCycle, now, employeeId));
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// }
|
|
|
|
|
|
// } else {
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// EmployeeDeclarePO newEmployeeDeclare = new EmployeeDeclarePO();
|
|
|
|
|
|
// BeanUtils.copyProperties(employeeDeclare, newEmployeeDeclare);
|
|
|
|
|
|
// BeanUtils.copyProperties(employeeDeclareExcel, newEmployeeDeclare);
|
|
|
|
|
|
// newEmployeeDeclare.setNewEmployeeInfo(StringUtils.equals(employeeDeclare.toCompareString(), newEmployeeDeclare.toCompareString()) ? 0 : 1)
|
|
|
|
|
|
// .setUpdateTime(now);
|
|
|
|
|
|
// if (Objects.equals(newEmployeeDeclare.getNewEmployeeInfo(), 1)) {
|
|
|
|
|
|
// newEmployeeDeclare.setDeclareStatus(DeclareStatusEnum.NOT_DECLARE.getValue());
|
|
|
|
|
|
// newEmployeeDeclare.setDeclareErrorMsg("");
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// }
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// needUpdateEmployeeDeclares.add(newEmployeeDeclare);
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// if (isError) {
|
|
|
|
|
|
// errorCount++;
|
|
|
|
|
|
// failRowIndex++;
|
|
|
|
|
|
// errorData.add(map);
|
|
|
|
|
|
// continue;
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// }
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// successCount++;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// // 如果sheet包含错误数据
|
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(errorData)) {
|
|
|
|
|
|
// salaryBatchService.createErrorExcelSheet(excelSheet.getHeader(), errorData, excelSheet.getName(), excelComments, errorExcelSheets);
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// }
|
2023-12-13 17:52:51 +08:00
|
|
|
|
//
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// if (CollectionUtils.isNotEmpty(needAddEmployeeDeclares)) {
|
|
|
|
|
|
// getEmployeeDeclareService(user).saveBatch(needAddEmployeeDeclares);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(needUpdateEmployeeDeclares)) {
|
|
|
|
|
|
// getEmployeeDeclareService(user).updateBatchById(needUpdateEmployeeDeclares);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// // 发送导入回调信息
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// salaryBatchService.sendImportCallBackInfo(message, successCount, errorCount, errorExcelSheets);
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
|
// log.error("人员报送信息导入失败:{}", e.getMessage(), e);
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// salaryBatchService.sendImportCallBackInfo(message, SalaryI18nUtil.getI18nLabel(156438, "人员报送信息导入失败:") + e.getMessage());
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// private EmployeeDeclarePO buildEmployeeDeclare(ExtEmployeePO extEmployee,
|
|
|
|
|
|
// EmployeeDeclareExcelDTO employeeDeclareExcel, Long taxAgentId,
|
2023-12-13 17:52:51 +08:00
|
|
|
|
// String taxCycle, LocalDateTime now, Long String tenantKey) {
|
2023-12-06 16:37:42 +08:00
|
|
|
|
// EmployeeDeclarePO employeeDeclare = new EmployeeDeclarePO()
|
|
|
|
|
|
// .setId(IdGenerator.generate())
|
|
|
|
|
|
// .setTaxAgentId(taxAgentId)
|
|
|
|
|
|
// .setTaxCycle(taxCycle)
|
|
|
|
|
|
// .setTenantKey(tenantKey)
|
|
|
|
|
|
// .setCreator(employeeId)
|
|
|
|
|
|
// .setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue())
|
|
|
|
|
|
// .setCreateTime(now)
|
|
|
|
|
|
// .setUpdateTime(now);
|
|
|
|
|
|
// BeanUtils.copyProperties(employeeDeclareExcel, employeeDeclare);
|
|
|
|
|
|
// if (extEmployee != null) {
|
|
|
|
|
|
// employeeDeclare.setEmployeeId(extEmployee.getId())
|
|
|
|
|
|
// .setEmployeeType(EmployeeTypeEnum.EXT_EMPLOYEE.getValue());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if (simpleEmployee != null) {
|
|
|
|
|
|
// employeeDeclare.setEmployeeId(simpleEmployee.getEmployeeId())
|
|
|
|
|
|
// .setEmployeeType(EmployeeTypeEnum.ORGANIZATION.getValue());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// return employeeDeclare;
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
2023-12-13 17:52:51 +08:00
|
|
|
|
private List<Object> getImportHeader() {
|
|
|
|
|
|
List<Object> headers = new ArrayList<>();
|
2023-12-08 18:15:56 +08:00
|
|
|
|
|
2023-12-13 17:52:51 +08:00
|
|
|
|
headers.add(SalaryI18nUtil.getI18nLabel(86317, "工号"));
|
|
|
|
|
|
headers.add(SalaryI18nUtil.getI18nLabel(85429, "姓名"));
|
|
|
|
|
|
headers.add(SalaryI18nUtil.getI18nLabel(105139, "证件类型"));
|
|
|
|
|
|
headers.add(SalaryI18nUtil.getI18nLabel(86318, "证件号码"));
|
|
|
|
|
|
headers.add(SalaryI18nUtil.getI18nLabel(156394, "人员状态"));
|
|
|
|
|
|
headers.add(SalaryI18nUtil.getI18nLabel(156396, "任职受雇从业类型"));
|
|
|
|
|
|
headers.add(SalaryI18nUtil.getI18nLabel(187374, "入职年度就业情形"));
|
|
|
|
|
|
headers.add(SalaryI18nUtil.getI18nLabel(98621, "手机号码"));
|
|
|
|
|
|
headers.add(SalaryI18nUtil.getI18nLabel(156409, "任职受雇从业日期"));
|
|
|
|
|
|
headers.add(SalaryI18nUtil.getI18nLabel(95228, "离职日期"));
|
|
|
|
|
|
headers.add(SalaryI18nUtil.getI18nLabel(156399, "是否残疾"));
|
|
|
|
|
|
headers.add(SalaryI18nUtil.getI18nLabel(156412, "残疾证号"));
|
|
|
|
|
|
headers.add(SalaryI18nUtil.getI18nLabel(187385, "是否烈属"));
|
|
|
|
|
|
headers.add(SalaryI18nUtil.getI18nLabel(156413, "烈属证号"));
|
|
|
|
|
|
headers.add(SalaryI18nUtil.getI18nLabel(156400, "是否孤老"));
|
|
|
|
|
|
headers.add(SalaryI18nUtil.getI18nLabel(156402, "是否扣除减除费用"));
|
2023-12-06 16:37:42 +08:00
|
|
|
|
|
2023-12-13 17:52:51 +08:00
|
|
|
|
return headers;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 检查表头
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param headers
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
private String checkHeader(List<String> headers, List<String> headerList) {
|
|
|
|
|
|
// 缺少的列
|
|
|
|
|
|
List<String> lackHeaders = headerList.stream()
|
|
|
|
|
|
.filter(header -> !headers.contains(header))
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(lackHeaders)) {
|
|
|
|
|
|
// 发送导入回调信息
|
|
|
|
|
|
return SalaryI18nUtil.getI18nLabel(101850, "缺少如下列,请检查:") + Joiner.on(",").join((Iterable<?>) lackHeaders);
|
|
|
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
2023-12-06 16:37:42 +08:00
|
|
|
|
}
|