2022-03-07 22:22:09 +08:00
|
|
|
|
package com.engine.salary.service.impl;
|
|
|
|
|
|
|
2022-05-06 16:58:01 +08:00
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
|
import com.alibaba.fastjson.TypeReference;
|
2022-09-16 15:03:48 +08:00
|
|
|
|
import com.api.formmode.mybatis.util.SqlProxyHandle;
|
2022-05-06 16:58:01 +08:00
|
|
|
|
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
|
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
2022-03-07 22:22:09 +08:00
|
|
|
|
import com.engine.core.impl.Service;
|
2022-05-09 11:18:54 +08:00
|
|
|
|
import com.engine.salary.biz.EmployBiz;
|
2022-06-15 10:23:39 +08:00
|
|
|
|
import com.engine.salary.biz.SIArchivesBiz;
|
2022-03-10 15:09:44 +08:00
|
|
|
|
import com.engine.salary.biz.SISchemeBiz;
|
2022-03-09 09:42:10 +08:00
|
|
|
|
import com.engine.salary.cmd.sischeme.*;
|
2022-05-24 09:23:17 +08:00
|
|
|
|
import com.engine.salary.encrypt.AESEncryptUtil;
|
2022-05-31 16:02:41 +08:00
|
|
|
|
import com.engine.salary.encrypt.siarchives.InsuranceArchivesFundSchemePOEncrypt;
|
|
|
|
|
|
import com.engine.salary.encrypt.siarchives.InsuranceArchivesOtherSchemePOEncrypt;
|
|
|
|
|
|
import com.engine.salary.encrypt.siarchives.InsuranceArchivesSocialSchemePOEncrypt;
|
|
|
|
|
|
import com.engine.salary.encrypt.sischeme.InsuranceSchemeDetailPOEncrypt;
|
2022-05-09 11:18:54 +08:00
|
|
|
|
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
2022-05-06 16:58:01 +08:00
|
|
|
|
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
|
2022-05-09 11:18:54 +08:00
|
|
|
|
import com.engine.salary.entity.siarchives.po.*;
|
2022-04-22 15:17:31 +08:00
|
|
|
|
import com.engine.salary.entity.sicategory.po.ICategoryPO;
|
|
|
|
|
|
import com.engine.salary.entity.sischeme.dto.InsuranceSchemeListDTO;
|
|
|
|
|
|
import com.engine.salary.entity.sischeme.param.InsuranceSchemeParam;
|
2022-05-09 11:18:54 +08:00
|
|
|
|
import com.engine.salary.entity.sischeme.param.SISchemaImportParam;
|
2022-03-10 15:09:44 +08:00
|
|
|
|
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
|
2022-04-18 20:24:43 +08:00
|
|
|
|
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
|
2022-06-06 16:55:02 +08:00
|
|
|
|
import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO;
|
2022-07-06 16:42:13 +08:00
|
|
|
|
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeDTO;
|
2022-06-06 16:55:02 +08:00
|
|
|
|
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
2022-06-01 19:13:20 +08:00
|
|
|
|
import com.engine.salary.enums.UserStatusEnum;
|
2022-05-06 16:58:01 +08:00
|
|
|
|
import com.engine.salary.enums.sicategory.*;
|
|
|
|
|
|
import com.engine.salary.mapper.siarchives.FundSchemeMapper;
|
|
|
|
|
|
import com.engine.salary.mapper.siarchives.OtherSchemeMapper;
|
|
|
|
|
|
import com.engine.salary.mapper.siarchives.SocialSchemeMapper;
|
2022-04-22 15:17:31 +08:00
|
|
|
|
import com.engine.salary.mapper.sicategory.ICategoryMapper;
|
|
|
|
|
|
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
|
2022-04-18 20:24:43 +08:00
|
|
|
|
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
|
2022-09-16 15:03:48 +08:00
|
|
|
|
import com.engine.salary.mapper.sys.SalarySysConfMapper;
|
2022-08-02 17:57:29 +08:00
|
|
|
|
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
|
2022-09-21 15:49:55 +08:00
|
|
|
|
import com.engine.salary.service.*;
|
2022-09-16 15:03:48 +08:00
|
|
|
|
import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
2022-05-06 16:58:01 +08:00
|
|
|
|
import com.engine.salary.util.*;
|
2022-04-18 20:24:43 +08:00
|
|
|
|
import com.engine.salary.util.db.MapperProxyFactory;
|
2022-05-09 11:18:54 +08:00
|
|
|
|
import com.engine.salary.util.excel.ExcelParseHelper;
|
|
|
|
|
|
import com.engine.salary.util.excel.ExcelSupport;
|
2022-05-06 16:58:01 +08:00
|
|
|
|
import com.engine.salary.util.excel.ExcelUtil;
|
2022-04-22 15:17:31 +08:00
|
|
|
|
import com.engine.salary.util.page.PageInfo;
|
2022-06-06 10:26:31 +08:00
|
|
|
|
import com.engine.salary.util.page.SalaryPageUtil;
|
2022-05-09 11:18:54 +08:00
|
|
|
|
import com.engine.salary.util.valid.ValidUtil;
|
2022-06-22 13:45:26 +08:00
|
|
|
|
import com.google.common.collect.Lists;
|
2022-05-09 11:18:54 +08:00
|
|
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
|
import dm.jdbc.util.IdGenerator;
|
2022-04-18 20:24:43 +08:00
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
2022-04-22 15:17:31 +08:00
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2022-07-29 17:18:38 +08:00
|
|
|
|
import org.apache.commons.lang3.math.NumberUtils;
|
2022-05-09 11:18:54 +08:00
|
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
|
|
|
import org.apache.poi.util.IOUtils;
|
2022-05-06 16:58:01 +08:00
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
2022-05-09 11:18:54 +08:00
|
|
|
|
import weaver.file.ImageFileManager;
|
2022-09-15 15:31:34 +08:00
|
|
|
|
import weaver.hrm.User;
|
2022-03-07 22:22:09 +08:00
|
|
|
|
|
2022-05-09 11:18:54 +08:00
|
|
|
|
import java.io.InputStream;
|
2022-04-22 15:17:31 +08:00
|
|
|
|
import java.util.*;
|
2022-05-06 16:58:01 +08:00
|
|
|
|
import java.util.function.Function;
|
2022-04-18 20:24:43 +08:00
|
|
|
|
import java.util.stream.Collectors;
|
2022-03-07 22:22:09 +08:00
|
|
|
|
|
2022-05-09 11:18:54 +08:00
|
|
|
|
import static com.engine.salary.util.excel.ExcelSupport.EXCEL_TYPE_XLSX;
|
|
|
|
|
|
|
2022-03-07 22:22:09 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* @Author weaver_cl
|
2022-07-13 11:45:16 +08:00
|
|
|
|
* @Description:
|
2022-03-07 22:22:09 +08:00
|
|
|
|
* @Date 2022/3/7
|
|
|
|
|
|
* @Version V1.0
|
|
|
|
|
|
**/
|
|
|
|
|
|
public class SISchemeServiceImpl extends Service implements SISchemeService {
|
2022-05-06 16:58:01 +08:00
|
|
|
|
private SocialSchemeMapper getSocialSchemeMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(SocialSchemeMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private FundSchemeMapper getFundSchemeMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(FundSchemeMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private OtherSchemeMapper getOtherSchemeMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(OtherSchemeMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private InsuranceSchemeMapper getInsuranceSchemeMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(InsuranceSchemeMapper.class);
|
|
|
|
|
|
}
|
2022-08-24 12:03:04 +08:00
|
|
|
|
|
2022-08-02 17:57:29 +08:00
|
|
|
|
private TaxAgentMapper getTaxAgentMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
|
|
|
|
|
|
}
|
2022-05-06 16:58:01 +08:00
|
|
|
|
|
|
|
|
|
|
private ICategoryMapper getICategoryMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(ICategoryMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private SISchemeService getSiSchemeService() {
|
|
|
|
|
|
return ServiceUtil.getService(SISchemeServiceImpl.class, user);
|
|
|
|
|
|
}
|
2022-03-07 22:22:09 +08:00
|
|
|
|
|
2022-05-09 11:18:54 +08:00
|
|
|
|
|
2022-05-31 21:05:59 +08:00
|
|
|
|
private TaxAgentService getTaxAgentService() {
|
|
|
|
|
|
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
|
2022-05-09 11:18:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private InsuranceSchemeDetailMapper getInsuranceSchemeDetailMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private SIImportService getSIImportService() {
|
|
|
|
|
|
return ServiceUtil.getService(SIImportServiceImpl.class, user);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private EmployBiz employeeBiz = new EmployBiz();
|
|
|
|
|
|
|
2022-06-15 10:23:39 +08:00
|
|
|
|
private SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
|
|
|
|
|
|
|
2022-09-21 15:49:55 +08:00
|
|
|
|
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
|
|
|
|
|
return (SalaryEmployeeService) ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
2022-09-15 15:31:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-16 15:03:48 +08:00
|
|
|
|
private SalarySysConfMapper getSalarySysConfMapper() {
|
|
|
|
|
|
return SqlProxyHandle.getProxy(SalarySysConfMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-03-07 22:22:09 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> getForm(Map<String, Object> params) {
|
2022-06-13 17:05:36 +08:00
|
|
|
|
return commandExecutor.execute(new SISchemeGetFormCmd(params, user));
|
2022-03-07 22:22:09 +08:00
|
|
|
|
}
|
2022-03-09 09:42:10 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> insertScheme(Map<String, Object> params) {
|
2022-06-13 17:05:36 +08:00
|
|
|
|
return commandExecutor.execute(new SISchemeInsertCmd(params, user));
|
2022-03-09 09:42:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> update(Map<String, Object> params) {
|
2022-06-13 17:05:36 +08:00
|
|
|
|
return commandExecutor.execute(new SISchemeUpdateCmd(params, user));
|
2022-03-09 09:42:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> delete(Map<String, Object> params) {
|
2022-06-13 17:05:36 +08:00
|
|
|
|
return commandExecutor.execute(new SISchemeDeleteCmd(params, user));
|
2022-03-09 09:42:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> copyScheme(Map<String, Object> params) {
|
2022-06-13 17:05:36 +08:00
|
|
|
|
return commandExecutor.execute(new SISchemeCopyCmd(params, user));
|
2022-03-09 09:42:10 +08:00
|
|
|
|
}
|
2022-03-10 15:09:44 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public List<InsuranceSchemeDetailPO> queryListByInsuranceIdIsPayment(Long insuranceId, Integer isPayment) {
|
2022-06-13 17:05:36 +08:00
|
|
|
|
return new SISchemeBiz().queryListByInsuranceIdIsPayment(insuranceId, isPayment);
|
2022-03-10 15:09:44 +08:00
|
|
|
|
}
|
2022-03-10 18:23:31 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> listPage(Map<String, Object> params) {
|
2022-06-13 17:05:36 +08:00
|
|
|
|
return commandExecutor.execute(new SISchemeListCmd(params, user));
|
2022-03-10 18:23:31 +08:00
|
|
|
|
}
|
2022-04-18 20:24:43 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<Long, String> getSchemeIdNameMap() {
|
|
|
|
|
|
Map<Long, String> result = new HashMap<>();
|
2022-08-24 12:03:04 +08:00
|
|
|
|
List<InsuranceSchemePO> insuranceSchemePOS = getInsuranceSchemeMapper().listAll();
|
2022-04-18 20:24:43 +08:00
|
|
|
|
if (CollectionUtils.isNotEmpty(insuranceSchemePOS)) {
|
|
|
|
|
|
result = insuranceSchemePOS.stream().collect(Collectors.toMap(InsuranceSchemePO::getId, InsuranceSchemePO::getSchemeName));
|
|
|
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
2022-04-22 15:17:31 +08:00
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public PageInfo<InsuranceSchemeListDTO> list(InsuranceSchemeParam queryParam) {
|
2022-06-13 17:05:36 +08:00
|
|
|
|
SalaryAssert.notNull(queryParam.getWelfareTypeEnum(), SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
|
2022-08-24 12:03:04 +08:00
|
|
|
|
Long currentEmployeeId = (long) user.getUID();
|
|
|
|
|
|
List<InsuranceSchemePO> insuranceSchemePOS;
|
|
|
|
|
|
Boolean needAuth = getTaxAgentService().isNeedAuth(currentEmployeeId);
|
|
|
|
|
|
if (needAuth) {
|
|
|
|
|
|
insuranceSchemePOS = getInsuranceSchemeMapper().listByWelfareType(queryParam.getWelfareTypeEnum().getValue());
|
|
|
|
|
|
//分权
|
|
|
|
|
|
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService().listAllTaxAgents(currentEmployeeId);
|
|
|
|
|
|
List<Long> authTaxAgentIds = SalaryEntityUtil.properties(taxAgentPOS, TaxAgentPO::getId, Collectors.toList());
|
|
|
|
|
|
insuranceSchemePOS = insuranceSchemePOS.stream().filter(po -> {
|
|
|
|
|
|
String taxAgentIdsStr = po.getTaxAgentIds();
|
|
|
|
|
|
List<Long> taxAgentIds = new ArrayList<>();
|
|
|
|
|
|
if (StringUtils.isNotBlank(taxAgentIdsStr)) {
|
|
|
|
|
|
taxAgentIds = Arrays.stream(taxAgentIdsStr.split(",")).map(Long::valueOf).collect(Collectors.toList());
|
|
|
|
|
|
}
|
|
|
|
|
|
return StringUtils.isBlank(po.getSharedType()) || SharedTypeEnum.PUBLIC.getValue().equals(po.getSharedType()) || (SharedTypeEnum.PRIVATE.getValue().equals(po.getSharedType()) && SalaryEntityUtil.judgeIntersection(authTaxAgentIds, taxAgentIds));
|
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
insuranceSchemePOS = getInsuranceSchemeMapper().listByWelfareType(queryParam.getWelfareTypeEnum().getValue());
|
|
|
|
|
|
}
|
2022-05-18 16:37:23 +08:00
|
|
|
|
|
|
|
|
|
|
PageInfo<InsuranceSchemeListDTO> dtoPage = new PageInfo<>(InsuranceSchemeListDTO.class);
|
|
|
|
|
|
dtoPage.setPageNum(queryParam.getCurrent());
|
|
|
|
|
|
dtoPage.setPageSize(queryParam.getPageSize());
|
2022-08-24 12:03:04 +08:00
|
|
|
|
dtoPage.setTotal(insuranceSchemePOS.size());
|
|
|
|
|
|
//分页
|
|
|
|
|
|
insuranceSchemePOS = SalaryPageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), insuranceSchemePOS);
|
|
|
|
|
|
List<InsuranceSchemeListDTO> collect = insuranceSchemePOS.stream().map(item -> InsuranceSchemeListDTO.builder().id(item.getId()).paymentType(SalaryI18nUtil.getI18nLabel(buildPaymentTypeEnum(item.getPaymentType()).getLabelId(), buildPaymentTypeEnum(item.getPaymentType()).getDefaultLabel())).schemeName(item.getSchemeName()).paymentArea(item.getPaymentArea()).paymentScope(buildPaymentScope(item.getId())).remarks(item.getRemarks()).build()).collect(Collectors.toList());
|
2022-05-18 16:37:23 +08:00
|
|
|
|
dtoPage.setList(collect);
|
|
|
|
|
|
return dtoPage;
|
2022-04-22 15:17:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-05-06 16:58:01 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public List<InsuranceArchivesEmployeePO> listPageEmployeePOS(InsuranceArchivesListParam param) {
|
2022-06-06 16:55:02 +08:00
|
|
|
|
long currentEmployeeId = user.getUID();
|
|
|
|
|
|
Boolean needAuth = getTaxAgentService().isNeedAuth(currentEmployeeId);
|
|
|
|
|
|
if (needAuth) {
|
|
|
|
|
|
List<TaxAgentEmployeeDTO> taxAgentEmployeeDTOS = getTaxAgentService().listTaxAgentAndEmployee(currentEmployeeId);
|
2022-08-23 14:16:20 +08:00
|
|
|
|
// Set<Long> employeeIds = SalaryEntityUtil.properties(taxAgentEmployeeDTOS, TaxAgentEmployeeDTO::getEmployeeId);
|
|
|
|
|
|
Set<Long> taxAgentIds = SalaryEntityUtil.properties(taxAgentEmployeeDTOS, TaxAgentEmployeeDTO::getTaxAgentId);
|
2022-06-06 16:55:02 +08:00
|
|
|
|
List<InsuranceArchivesEmployeePO> list = getSocialSchemeMapper().queryEmployeeList(param);
|
2022-08-23 14:16:20 +08:00
|
|
|
|
return list.stream().filter(f -> taxAgentIds.contains(f.getPaymentOrganization())).collect(Collectors.toList());
|
2022-06-06 16:55:02 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-05-06 16:58:01 +08:00
|
|
|
|
return getSocialSchemeMapper().queryEmployeeList(param);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public List<Map<String, Object>> buildTableData(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS) {
|
|
|
|
|
|
List<Map<String, Object>> records = new ArrayList<>();
|
2022-08-02 17:57:29 +08:00
|
|
|
|
List<TaxAgentPO> taxAgentPOS = getTaxAgentMapper().listAll();
|
|
|
|
|
|
Map<Long, TaxAgentPO> longTaxAgentPOMap = SalaryEntityUtil.convert2Map(taxAgentPOS, TaxAgentPO::getId);
|
2022-05-06 16:58:01 +08:00
|
|
|
|
List<Long> employeeIds = insuranceArchivesEmployeePOS.stream().map(InsuranceArchivesEmployeePO::getEmployeeId).collect(Collectors.toList());
|
|
|
|
|
|
if (CollectionUtils.isEmpty(employeeIds)) {
|
|
|
|
|
|
return records;
|
|
|
|
|
|
}
|
2022-05-30 17:31:29 +08:00
|
|
|
|
List<InsuranceArchivesSocialSchemePO> socialList = new ArrayList<>();
|
|
|
|
|
|
List<InsuranceArchivesFundSchemePO> fundList = new ArrayList<>();
|
|
|
|
|
|
List<InsuranceArchivesOtherSchemePO> otherList = new ArrayList<>();
|
|
|
|
|
|
|
2022-06-13 17:05:36 +08:00
|
|
|
|
for (int i = 0; i < employeeIds.size(); i += 1000) {
|
2022-05-30 17:31:29 +08:00
|
|
|
|
int end = i + 1000;
|
2022-06-13 17:05:36 +08:00
|
|
|
|
if (i + 1000 >= employeeIds.size()) {
|
2022-05-30 17:31:29 +08:00
|
|
|
|
end = employeeIds.size();
|
|
|
|
|
|
}
|
|
|
|
|
|
List<Long> ids = employeeIds.subList(i, end);
|
2022-06-15 10:23:39 +08:00
|
|
|
|
socialList.addAll(InsuranceArchivesSocialSchemePOEncrypt.decryptList(siArchivesBiz.getSocialByEmployeeIds(ids)));
|
|
|
|
|
|
fundList.addAll(InsuranceArchivesFundSchemePOEncrypt.decryptList(siArchivesBiz.getFundByEmployeeIds(ids)));
|
|
|
|
|
|
otherList.addAll(InsuranceArchivesOtherSchemePOEncrypt.decryptList(siArchivesBiz.getOtherByEmployeeIds(ids)));
|
2022-05-30 17:31:29 +08:00
|
|
|
|
}
|
2022-05-06 16:58:01 +08:00
|
|
|
|
|
2022-08-24 12:03:04 +08:00
|
|
|
|
Map<Long, InsuranceArchivesSocialSchemePO> socialSchemePOMap = socialList.stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getEmployeeId, Function.identity()));
|
|
|
|
|
|
Map<Long, InsuranceArchivesFundSchemePO> fundSchemePOMap = fundList.stream().collect(Collectors.toMap(InsuranceArchivesFundSchemePO::getEmployeeId, Function.identity()));
|
|
|
|
|
|
Map<Long, InsuranceArchivesOtherSchemePO> otherSchemePOMap = otherList.stream().collect(Collectors.toMap(InsuranceArchivesOtherSchemePO::getEmployeeId, Function.identity()));
|
2022-05-06 16:58:01 +08:00
|
|
|
|
insuranceArchivesEmployeePOS.forEach(item -> {
|
|
|
|
|
|
InsuranceArchivesSocialSchemePO socialItem = socialSchemePOMap.get(item.getEmployeeId());
|
|
|
|
|
|
InsuranceArchivesFundSchemePO fundItem = fundSchemePOMap.get(item.getEmployeeId());
|
|
|
|
|
|
InsuranceArchivesOtherSchemePO otherItem = otherSchemePOMap.get(item.getEmployeeId());
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
map.put("employeeName", item.getUserName());
|
|
|
|
|
|
map.put("employeeId", item.getEmployeeId());
|
|
|
|
|
|
map.put("departmentName", item.getDepartmentName());
|
|
|
|
|
|
map.put("departmentId", item.getDepartmentId());
|
|
|
|
|
|
map.put("jobNum", item.getJobNum());
|
2022-08-02 17:57:29 +08:00
|
|
|
|
map.put("paymentOrganizationName", longTaxAgentPOMap.get(item.getPaymentOrganization()) != null ? longTaxAgentPOMap.get(item.getPaymentOrganization()).getName() : "");
|
2022-05-06 16:58:01 +08:00
|
|
|
|
map.put("mobile", item.getTelephone());
|
2022-06-23 14:08:55 +08:00
|
|
|
|
map.put("status", item.getUserStatus() == null ? "" : UserStatusEnum.getDefaultLabelByValue(item.getUserStatus()));
|
2022-05-06 16:58:01 +08:00
|
|
|
|
if (socialItem != null) {
|
|
|
|
|
|
map.put("socialName", getSiSchemeService().querySchemeName(socialItem.getSocialSchemeId()));
|
|
|
|
|
|
Map<String, Object> socialJson = JSON.parseObject(socialItem.getSocialPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
|
|
|
|
|
});
|
|
|
|
|
|
if (socialJson != null) {
|
2022-08-02 17:57:29 +08:00
|
|
|
|
map.putAll(socialJson);
|
2022-08-24 12:03:04 +08:00
|
|
|
|
// SalaryEntityUtil.thousandthConvert(socialJson, map);
|
2022-05-06 16:58:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
map.put("socialAccount", socialItem.getSocialAccount());
|
|
|
|
|
|
map.put("socialStartTime", socialItem.getSocialStartTime());
|
|
|
|
|
|
map.put("socialEndTime", socialItem.getSocialEndTime());
|
|
|
|
|
|
}
|
|
|
|
|
|
if (fundItem != null) {
|
|
|
|
|
|
map.put("fundName", getSiSchemeService().querySchemeName(fundItem.getFundSchemeId()));
|
|
|
|
|
|
map.put("fundAccount", fundItem.getFundAccount());
|
|
|
|
|
|
Map<String, Object> fundJson = JSON.parseObject(fundItem.getFundPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
|
|
|
|
|
});
|
|
|
|
|
|
if (fundJson != null) {
|
2022-08-02 17:57:29 +08:00
|
|
|
|
map.putAll(fundJson);
|
2022-08-24 12:03:04 +08:00
|
|
|
|
// SalaryEntityUtil.thousandthConvert(fundJson, map);
|
2022-05-06 16:58:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
map.put("supplementFundAccount", fundItem.getSupplementFundAccount());
|
|
|
|
|
|
map.put("fundStartTime", fundItem.getFundStartTime());
|
|
|
|
|
|
map.put("fundEndTime", fundItem.getFundEndTime());
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
if (otherItem != null) {
|
|
|
|
|
|
map.put("otherName", getSiSchemeService().querySchemeName(otherItem.getOtherSchemeId()));
|
|
|
|
|
|
Map<String, Object> otherJson = JSON.parseObject(otherItem.getOtherPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
|
|
|
|
|
});
|
|
|
|
|
|
if (otherJson != null) {
|
2022-08-02 17:57:29 +08:00
|
|
|
|
map.putAll(otherJson);
|
|
|
|
|
|
//SalaryEntityUtil.thousandthConvert(otherJson, map);
|
2022-05-06 16:58:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
map.put("otherStartTime", otherItem.getOtherStartTime());
|
|
|
|
|
|
map.put("otherEndTime", otherItem.getOtherEndTime());
|
|
|
|
|
|
}
|
|
|
|
|
|
records.add(map);
|
|
|
|
|
|
});
|
|
|
|
|
|
return records;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public XSSFWorkbook export(InsuranceArchivesListParam param) {
|
|
|
|
|
|
InsuranceArchivesListParam request = InsuranceArchivesListParam.builder().build();
|
|
|
|
|
|
if (param.getHireDate() != null && param.getHireDate().length == 2) {
|
|
|
|
|
|
param.setHiredateStart(param.getHireDate()[0]);
|
|
|
|
|
|
param.setHiredateEnd(param.getHireDate()[1]);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (param.getDimissionDate() != null && param.getDimissionDate().length == 2) {
|
|
|
|
|
|
param.setDimissionDateStart(param.getDimissionDate()[0]);
|
|
|
|
|
|
param.setDimissionDateEnd(param.getDimissionDate()[1]);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (Objects.equals("fromQuickSearch", param.getDataSource())) {
|
|
|
|
|
|
request.setStatuses(param.getStatuses());
|
|
|
|
|
|
request.setKeyword(param.getUserName());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
request = param;
|
|
|
|
|
|
}
|
|
|
|
|
|
request.setPageSize(null);
|
|
|
|
|
|
request.setStartNum(null);
|
|
|
|
|
|
List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS = listPageEmployeePOS(request);
|
|
|
|
|
|
if (insuranceArchivesEmployeePOS == null) {
|
|
|
|
|
|
insuranceArchivesEmployeePOS = new ArrayList<>();
|
|
|
|
|
|
}
|
|
|
|
|
|
List<Map<String, Object>> records = buildTableData(insuranceArchivesEmployeePOS);
|
|
|
|
|
|
List<WeaTableColumn> columns = buildWeaTableColumns(insuranceArchivesEmployeePOS, (long) user.getUID());
|
|
|
|
|
|
|
|
|
|
|
|
//工作簿list
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//工作簿数据
|
|
|
|
|
|
List<List<String>> rows = new LinkedList<>();
|
|
|
|
|
|
List<String> collect = columns.stream().map(WeaTableColumn::getText).collect(Collectors.toList());
|
|
|
|
|
|
rows.add(collect);
|
|
|
|
|
|
for (Map<String, Object> recordData : records) {
|
|
|
|
|
|
List<String> row = new LinkedList<>();
|
|
|
|
|
|
for (WeaTableColumn column : columns) {
|
|
|
|
|
|
try {
|
|
|
|
|
|
Object o = recordData.get(column.getColumn());
|
|
|
|
|
|
row.add(o.toString());
|
2022-06-13 17:05:36 +08:00
|
|
|
|
} catch (Exception e) {
|
2022-05-06 16:58:01 +08:00
|
|
|
|
row.add("");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
rows.add(row);
|
|
|
|
|
|
}
|
|
|
|
|
|
// return salaryBatchService.simpleExportExcel(ExportExcelInfo.builder()
|
|
|
|
|
|
// .bizId(exportMap.get("biz"))
|
|
|
|
|
|
// .flag(true)
|
|
|
|
|
|
// .userId(employeeId)
|
|
|
|
|
|
// .eteamsId(eteamsId)
|
|
|
|
|
|
// .tenantKey(tenantKey)
|
|
|
|
|
|
// .operator(operator)
|
|
|
|
|
|
// .module(exportMap.get("module"))
|
|
|
|
|
|
// .fileName(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 94629, "社保福利档案") + SalaryDateUtil.getFormatLocalDateTime(LocalDateTime.now()))
|
|
|
|
|
|
// .handlerName("insuranceArchivesExportHandler")
|
|
|
|
|
|
// .dataType(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 99915, "档案"))
|
|
|
|
|
|
// .function(exportMap.get("function")).build(), sheetList);
|
|
|
|
|
|
//获取excel
|
2022-06-13 17:05:36 +08:00
|
|
|
|
return ExcelUtil.genWorkbook(rows, "福利档案");
|
2022-05-06 16:58:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-22 15:17:31 +08:00
|
|
|
|
|
|
|
|
|
|
public PaymentTypeEnum buildPaymentTypeEnum(Integer value) {
|
|
|
|
|
|
return SalaryEnumUtil.enumMatchByValue(value, PaymentTypeEnum.values(), PaymentTypeEnum.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 组装社保福利方案列表页【缴纳范围】
|
|
|
|
|
|
* 1、到福利方案明细表查询该方案id下面有哪些福利
|
|
|
|
|
|
* 2、去重(福利是分个人和公司的,明细表中查询出来的福利id会重复)
|
|
|
|
|
|
* 3、根据查询出来的福利id,去福利表里面查询福利的名称
|
|
|
|
|
|
* 4、组装,以“、”分割
|
|
|
|
|
|
*
|
2022-06-13 17:05:36 +08:00
|
|
|
|
* @param id 福利方案主表id
|
2022-04-22 15:17:31 +08:00
|
|
|
|
* @return result
|
|
|
|
|
|
*/
|
|
|
|
|
|
public String buildPaymentScope(Long id) {
|
2022-08-24 12:03:04 +08:00
|
|
|
|
List<String> collect = queryInsuranceSchemeDetailList(id).stream().map(InsuranceSchemeDetailPO::getInsuranceId).distinct().collect(Collectors.toList()).stream().map(this::queryInsuranceName).collect(Collectors.toList());
|
2022-04-22 15:17:31 +08:00
|
|
|
|
return StringUtils.join(collect, "、");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Collection<InsuranceSchemeDetailPO> queryInsuranceSchemeDetailList(Long id) {
|
|
|
|
|
|
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class).queryInsuranceSchemeDetailList(id, IsPaymentEnum.YES.getValue());
|
2022-05-31 16:02:41 +08:00
|
|
|
|
return InsuranceSchemeDetailPOEncrypt.decryptList(insuranceSchemeDetailPOS);
|
2022-04-22 15:17:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public String queryInsuranceName(Long id) {
|
|
|
|
|
|
ICategoryPO insuranceCategoryPO = MapperProxyFactory.getProxy(ICategoryMapper.class).getById(id);
|
|
|
|
|
|
return insuranceCategoryPO == null ? "" : Objects.isNull(insuranceCategoryPO.getInsuranceName()) ? "" : insuranceCategoryPO.getInsuranceName();
|
|
|
|
|
|
}
|
2022-05-06 16:58:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public String querySchemeName(Long schemeId) {
|
|
|
|
|
|
if (schemeId == null) {
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
2022-08-24 12:03:04 +08:00
|
|
|
|
InsuranceSchemePO insuranceSchemePO = getInsuranceSchemeMapper().getById(schemeId);
|
2022-05-06 16:58:01 +08:00
|
|
|
|
if (insuranceSchemePO == null) {
|
|
|
|
|
|
return "";
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return insuranceSchemePO.getSchemeName();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public List<WeaTableColumn> buildWeaTableColumns(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS, Long employeeId) {
|
|
|
|
|
|
Map<Integer, Map<String, String>> titleMap = buildColumnTitle(insuranceArchivesEmployeePOS, employeeId);
|
|
|
|
|
|
List<WeaTableColumn> list = new ArrayList<>();
|
2022-06-13 17:05:36 +08:00
|
|
|
|
WeaTableColumn nameColumn = new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(85429, "姓名"), "employeeName");
|
2022-05-06 16:58:01 +08:00
|
|
|
|
nameColumn.setFixed("left");
|
|
|
|
|
|
list.add(nameColumn);
|
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86185, "部门"), "departmentName"));
|
2022-06-13 17:05:36 +08:00
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86186, "手机号"), "mobile"));
|
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86187, "员工状态"), "status"));
|
2022-08-02 17:57:29 +08:00
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(93910, "个税扣缴义务人"), "paymentOrganizationName"));
|
2022-06-13 17:05:36 +08:00
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91323, "社保方案名称"), "socialName"));
|
2022-05-06 16:58:01 +08:00
|
|
|
|
titleMap.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> list.add(new WeaTableColumn("150px", v, k)));
|
2022-06-13 17:05:36 +08:00
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91324, "社保账号"), "socialAccount"));
|
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91319, "社保起始缴纳月"), "socialStartTime"));
|
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91320, "社保最后缴纳月"), "socialEndTime"));
|
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称"), "fundName"));
|
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91486, "公积金账号"), "fundAccount"));
|
2022-05-06 16:58:01 +08:00
|
|
|
|
titleMap.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> list.add(new WeaTableColumn("150px", v, k)));
|
2022-06-13 17:05:36 +08:00
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91487, "补充公积金账号"), "supplementFundAccount"));
|
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91483, "公积金起始缴纳月"), "fundStartTime"));
|
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91484, "公积金最后缴纳月"), "fundEndTime"));
|
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"), "otherName"));
|
2022-05-06 16:58:01 +08:00
|
|
|
|
titleMap.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> list.add(new WeaTableColumn("150px", v, k)));
|
2022-06-13 17:05:36 +08:00
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91490, "其他福利起始缴纳月"), "otherStartTime"));
|
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91494, "其他福利最后缴纳月"), "otherEndTime"));
|
2022-05-06 16:58:01 +08:00
|
|
|
|
return list;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-05-09 11:18:54 +08:00
|
|
|
|
|
2022-05-06 16:58:01 +08:00
|
|
|
|
public Map<Integer, Map<String, String>> buildColumnTitle(List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS, Long employeeId) {
|
|
|
|
|
|
Map<Integer, Map<String, String>> result = new HashMap<>();
|
|
|
|
|
|
Set<String> socialSet = new HashSet<>();
|
|
|
|
|
|
Set<String> fundSet = new HashSet<>();
|
|
|
|
|
|
Set<String> otherSet = new HashSet<>();
|
|
|
|
|
|
insuranceArchivesEmployeePOS.forEach(item -> {
|
2022-06-15 10:23:39 +08:00
|
|
|
|
List<InsuranceArchivesSocialSchemePO> socialByEmployeeId = siArchivesBiz.getSocialByEmployeeIds(new ArrayList<Long>() {{
|
2022-05-06 16:58:01 +08:00
|
|
|
|
add(item.getEmployeeId());
|
|
|
|
|
|
}});
|
2022-05-31 16:02:41 +08:00
|
|
|
|
InsuranceArchivesSocialSchemePOEncrypt.decryptList(socialByEmployeeId);
|
2022-05-06 16:58:01 +08:00
|
|
|
|
InsuranceArchivesSocialSchemePO socialItem = null;
|
2022-06-13 17:05:36 +08:00
|
|
|
|
if (socialByEmployeeId.size() > 0) {
|
2022-05-06 16:58:01 +08:00
|
|
|
|
socialItem = socialByEmployeeId.get(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
InsuranceArchivesFundSchemePO fundItem = null;
|
|
|
|
|
|
|
2022-06-15 10:23:39 +08:00
|
|
|
|
List<InsuranceArchivesFundSchemePO> fundByEmployeeId = siArchivesBiz.getFundByEmployeeIds(new ArrayList<Long>() {{
|
2022-05-06 16:58:01 +08:00
|
|
|
|
add(item.getEmployeeId());
|
|
|
|
|
|
}});
|
2022-05-31 16:02:41 +08:00
|
|
|
|
InsuranceArchivesFundSchemePOEncrypt.decryptList(fundByEmployeeId);
|
|
|
|
|
|
|
2022-06-13 17:05:36 +08:00
|
|
|
|
if (fundByEmployeeId.size() > 0) {
|
2022-05-06 16:58:01 +08:00
|
|
|
|
fundItem = fundByEmployeeId.get(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
InsuranceArchivesOtherSchemePO otherItem = null;
|
|
|
|
|
|
|
2022-06-15 10:23:39 +08:00
|
|
|
|
List<InsuranceArchivesOtherSchemePO> otherByEmployeeId = siArchivesBiz.getOtherByEmployeeIds(new ArrayList<Long>() {{
|
2022-05-06 16:58:01 +08:00
|
|
|
|
add(item.getEmployeeId());
|
|
|
|
|
|
}});
|
2022-05-31 16:02:41 +08:00
|
|
|
|
InsuranceArchivesOtherSchemePOEncrypt.decryptList(otherByEmployeeId);
|
2022-06-13 17:05:36 +08:00
|
|
|
|
if (otherByEmployeeId.size() > 0) {
|
2022-05-06 16:58:01 +08:00
|
|
|
|
otherItem = otherByEmployeeId.get(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (socialItem != null) {
|
|
|
|
|
|
Map<String, Object> socialJson = JSON.parseObject(socialItem.getSocialPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
|
|
|
|
|
});
|
|
|
|
|
|
if (socialJson != null) {
|
|
|
|
|
|
socialJson.forEach((k, v) -> socialSet.add(k));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (fundItem != null) {
|
|
|
|
|
|
Map<String, Object> fundJson = JSON.parseObject(fundItem.getFundPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
|
|
|
|
|
});
|
|
|
|
|
|
if (fundJson != null) {
|
|
|
|
|
|
fundJson.forEach((k, v) -> fundSet.add(k));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (otherItem != null) {
|
|
|
|
|
|
Map<String, Object> otherJson = JSON.parseObject(otherItem.getOtherPaymentBaseString(), new TypeReference<Map<String, Object>>() {
|
|
|
|
|
|
});
|
|
|
|
|
|
if (otherJson != null) {
|
|
|
|
|
|
otherJson.forEach((k, v) -> otherSet.add(k));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
Map<String, String> socialMap = new HashMap<>();
|
|
|
|
|
|
Map<Long, ICategoryPO> socialCollect = new HashMap<>();
|
2022-08-24 12:03:04 +08:00
|
|
|
|
Map<Long, ICategoryPO> customSocial = getICategoryMapper().listByWelfareType(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), null).stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
|
2022-05-06 16:58:01 +08:00
|
|
|
|
|
2022-08-24 12:03:04 +08:00
|
|
|
|
Map<Long, ICategoryPO> sysSocial = getICategoryMapper().listByWelfareType(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), DataTypeEnum.SYSTEM.getValue()).stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
|
2022-05-06 16:58:01 +08:00
|
|
|
|
socialCollect.putAll(customSocial);
|
|
|
|
|
|
socialCollect.putAll(sysSocial);
|
|
|
|
|
|
socialSet.forEach(item -> {
|
|
|
|
|
|
if (socialCollect.containsKey(Long.valueOf(item))) {
|
2022-06-13 17:05:36 +08:00
|
|
|
|
socialMap.put(item, socialCollect.get(Long.valueOf(item)).getInsuranceName() + SalaryI18nUtil.getI18nLabel(100293, "申报基数"));
|
2022-05-06 16:58:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
Map<String, String> fundMap = new HashMap<>();
|
|
|
|
|
|
Map<Long, ICategoryPO> fundCollect = new HashMap<>();
|
2022-08-24 12:03:04 +08:00
|
|
|
|
Map<Long, ICategoryPO> customFund = getICategoryMapper().listByWelfareType(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), null).stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
|
|
|
|
|
|
Map<Long, ICategoryPO> sysFund = getICategoryMapper().listByWelfareType(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), DataTypeEnum.SYSTEM.getValue()).stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
|
2022-05-06 16:58:01 +08:00
|
|
|
|
fundCollect.putAll(customFund);
|
|
|
|
|
|
fundCollect.putAll(sysFund);
|
|
|
|
|
|
fundSet.forEach(item -> {
|
|
|
|
|
|
if (fundCollect.containsKey(Long.valueOf(item))) {
|
2022-06-13 17:05:36 +08:00
|
|
|
|
fundMap.put(item, fundCollect.get(Long.valueOf(item)).getInsuranceName() + SalaryI18nUtil.getI18nLabel(100293, "申报基数"));
|
2022-05-06 16:58:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
Map<String, String> otherMap = new HashMap<>();
|
|
|
|
|
|
Map<Long, ICategoryPO> otherCollect = new HashMap<>();
|
2022-08-24 12:03:04 +08:00
|
|
|
|
Map<Long, ICategoryPO> customOther = getICategoryMapper().listByWelfareType(WelfareTypeEnum.OTHER.getValue(), null).stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
|
|
|
|
|
|
Map<Long, ICategoryPO> sysOther = getICategoryMapper().listByWelfareType(WelfareTypeEnum.OTHER.getValue(), DataTypeEnum.SYSTEM.getValue()).stream().collect(Collectors.toMap(ICategoryPO::getId, Function.identity()));
|
2022-05-06 16:58:01 +08:00
|
|
|
|
otherCollect.putAll(customOther);
|
|
|
|
|
|
otherCollect.putAll(sysOther);
|
|
|
|
|
|
otherSet.forEach(item -> {
|
|
|
|
|
|
if (otherCollect.containsKey(Long.valueOf(item))) {
|
2022-06-13 17:05:36 +08:00
|
|
|
|
otherMap.put(item, otherCollect.get(Long.valueOf(item)).getInsuranceName() + SalaryI18nUtil.getI18nLabel(100293, "申报基数"));
|
2022-05-06 16:58:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialMap);
|
|
|
|
|
|
result.put(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), fundMap);
|
|
|
|
|
|
result.put(WelfareTypeEnum.OTHER.getValue(), otherMap);
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
2022-05-09 11:18:54 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 导入的数据插入到数据库中
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> preview(SISchemaImportParam param) {
|
|
|
|
|
|
ValidUtil.doValidator(param);
|
|
|
|
|
|
InputStream fileInputStream = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId()));
|
|
|
|
|
|
Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
|
|
|
|
|
|
Map<String, Object> apidatas = new HashMap<String, Object>();
|
|
|
|
|
|
apidatas.put("headers", ExcelSupport.getSheetHeader(sheet, 0));
|
|
|
|
|
|
apidatas.put("list", ExcelParseHelper.parse2List(sheet, 1));
|
|
|
|
|
|
return apidatas;
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
IOUtils.closeQuietly(fileInputStream);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 导入的数据插入到数据库中
|
|
|
|
|
|
*/
|
|
|
|
|
|
public Map<String, Object> batchImportEbatch(SISchemaImportParam param) {
|
|
|
|
|
|
ValidUtil.doValidator(param);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// List<ExcelSheet> excelSheets = message.getBatchFile().getExcelSheets();
|
|
|
|
|
|
// 租户key
|
|
|
|
|
|
// String tenantKey = message.getTenantKey().toLowerCase();
|
|
|
|
|
|
//操作员id
|
|
|
|
|
|
Long creator = (long) user.getUID();
|
|
|
|
|
|
//获取所有福利类型的id-name结合
|
|
|
|
|
|
Map<String, Long> schemeNameIdMap = schemeNameIdMap();
|
|
|
|
|
|
Map<Long, String> welfareMap = welfareMap();
|
|
|
|
|
|
// 获取所有个税扣缴义务人的名称和id的map
|
2022-07-06 16:42:13 +08:00
|
|
|
|
Map<String, Long> paymentNameIdMap;
|
|
|
|
|
|
//分权
|
|
|
|
|
|
Boolean openDevolution = getTaxAgentService().isOpenDevolution();
|
|
|
|
|
|
if (openDevolution) {
|
|
|
|
|
|
paymentNameIdMap = getTaxAgentService().listAllTaxAgentsAsAdmin((long) user.getUID()).stream().collect(Collectors.toMap(TaxAgentPO::getName, TaxAgentPO::getId));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
paymentNameIdMap = getTaxAgentService().listAll().stream().collect(Collectors.toMap(TaxAgentPO::getName, TaxAgentPO::getId));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//获取所以个税扣缴义务人树型
|
|
|
|
|
|
List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeTree = getTaxAgentService().listTaxAgentAndEmployeeTree();
|
|
|
|
|
|
|
2022-05-09 11:18:54 +08:00
|
|
|
|
// 获取所有人员信息
|
|
|
|
|
|
List<DataCollectionEmployee> employeeByIds = employeeBiz.listEmployee();
|
|
|
|
|
|
int total = 0;
|
|
|
|
|
|
|
|
|
|
|
|
int index = 0;
|
|
|
|
|
|
int successCount = 0;
|
|
|
|
|
|
int errorCount = 0;
|
|
|
|
|
|
|
|
|
|
|
|
// 待导入数据
|
|
|
|
|
|
List<InsuranceArchivesAccountPO> insuranceArchivesAccountPOS = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
// 待导入数据
|
|
|
|
|
|
InputStream fileInputStream = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId()));
|
|
|
|
|
|
Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
|
|
|
|
|
|
// 表头
|
|
|
|
|
|
List<String> headers = ExcelSupport.getSheetHeader(sheet, 0);
|
|
|
|
|
|
// 错误sheet数据
|
|
|
|
|
|
List<Map<String, Object>> errorData = new LinkedList<>();
|
|
|
|
|
|
// 错误提示
|
|
|
|
|
|
List<Map<String, String>> excelComments = new LinkedList<>();
|
|
|
|
|
|
|
|
|
|
|
|
// 处理数值
|
|
|
|
|
|
List<Map<String, Object>> data = ExcelParseHelper.parse2Map(sheet, 1);
|
|
|
|
|
|
total = data.size();
|
|
|
|
|
|
|
|
|
|
|
|
//当前sheel的单行记录
|
|
|
|
|
|
Map<String, Object> map;
|
|
|
|
|
|
for (int i = 0; i < data.size(); i++) {
|
|
|
|
|
|
index += 1;
|
|
|
|
|
|
map = data.get(i);
|
|
|
|
|
|
boolean isError;
|
|
|
|
|
|
List<Map<String, Object>> singleAccount = new ArrayList<>();
|
|
|
|
|
|
for (int j = 0; j < headers.size(); j++) {
|
|
|
|
|
|
//组装单条数据基础数据
|
|
|
|
|
|
String key = headers.get(j);
|
|
|
|
|
|
if (key == null) {
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
Map<String, Object> cellData = new HashMap<>();
|
|
|
|
|
|
cellData.put(key.toString(), Optional.ofNullable(map.get(key.toString())).orElse("").toString());
|
|
|
|
|
|
cellData.put("index", j);
|
|
|
|
|
|
singleAccount.add(cellData);
|
|
|
|
|
|
}
|
2022-06-01 19:13:20 +08:00
|
|
|
|
|
2022-08-24 12:03:04 +08:00
|
|
|
|
isError = singleAccountCheck(singleAccount, welfareMap, insuranceArchivesAccountPOS, employeeByIds, excelComments, errorCount + 1, schemeNameIdMap, paymentNameIdMap, creator, i + 2, openDevolution, taxAgentManageRangeEmployeeTree);
|
2022-05-09 11:18:54 +08:00
|
|
|
|
if (isError) {
|
|
|
|
|
|
errorCount += 1;
|
|
|
|
|
|
// 添加错误数据
|
|
|
|
|
|
errorData.add(map);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
successCount += 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
// salaryBatchService.sendImportRate(message.getBizId(), total, index);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 如果sheet包含错误数据
|
|
|
|
|
|
// if (CollectionUtils.isNotEmpty(errorData)) {
|
|
|
|
|
|
// salaryBatchService.createErrorExcelSheet(headers, errorData, excelSheet.getName(), excelComments, errorExcelSheets);
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
2022-06-06 10:23:19 +08:00
|
|
|
|
// 数据入库处理
|
|
|
|
|
|
handleImportData(insuranceArchivesAccountPOS);
|
2022-05-09 11:18:54 +08:00
|
|
|
|
|
2022-06-06 10:23:19 +08:00
|
|
|
|
// 发送导入回调信息
|
2022-05-09 11:18:54 +08:00
|
|
|
|
// salaryBatchService.sendImportCallBackInfo(message, successCount, errorCount, errorExcelSheets);
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> apidatas = new HashMap<String, Object>();
|
|
|
|
|
|
apidatas.put("successCount", successCount);
|
|
|
|
|
|
apidatas.put("errorCount", errorCount);
|
|
|
|
|
|
apidatas.put("errorData", excelComments);
|
|
|
|
|
|
return apidatas;
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
IOUtils.closeQuietly(fileInputStream);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Map<String, Long> schemeNameIdMap() {
|
|
|
|
|
|
Map<String, Long> schemeMap = new HashMap<>();
|
|
|
|
|
|
List<InsuranceSchemePO> schemeList = getInsuranceSchemeMapper().listAll();
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(schemeList)) {
|
|
|
|
|
|
schemeMap = schemeList.stream().collect(Collectors.toMap(InsuranceSchemePO::getSchemeName, InsuranceSchemePO::getId));
|
|
|
|
|
|
}
|
|
|
|
|
|
return schemeMap;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Map<Long, String> welfareMap() {
|
|
|
|
|
|
return getICategoryMapper().listAll().stream().collect(Collectors.toMap(ICategoryPO::getId, ICategoryPO::getInsuranceName));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-06-01 19:13:20 +08:00
|
|
|
|
private String userStateExchange(String userState) {
|
|
|
|
|
|
UserStatusEnum[] values = UserStatusEnum.values();
|
|
|
|
|
|
for (UserStatusEnum value : values) {
|
2022-06-15 09:29:43 +08:00
|
|
|
|
if (value.getValue().equals(Integer.valueOf(userState))) {
|
2022-07-27 16:56:13 +08:00
|
|
|
|
return value.getDefaultLabel() + "";
|
2022-06-01 19:13:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return userState;
|
|
|
|
|
|
}
|
2022-05-09 11:18:54 +08:00
|
|
|
|
|
2022-08-24 12:03:04 +08:00
|
|
|
|
public boolean singleAccountCheck(List<Map<String, Object>> singleAccount, Map<Long, String> welfareMap, List<InsuranceArchivesAccountPO> insuranceArchivesAccountPOS, List<DataCollectionEmployee> employeeByIds, List<Map<String, String>> excelComments, int i, Map<String, Long> schemeNameIdMap, Map<String, Long> paymentNameIdMap, Long creator, int index, Boolean openDevolution, List<TaxAgentManageRangeEmployeeDTO> taxAgentManageRangeEmployeeTree) {
|
2022-05-09 11:18:54 +08:00
|
|
|
|
boolean isError = false;
|
|
|
|
|
|
String userName = (String) singleAccount.get(0).get(SalaryI18nUtil.getI18nLabel(85429, "姓名"));
|
|
|
|
|
|
String deparmentName = (String) singleAccount.get(1).get(SalaryI18nUtil.getI18nLabel(86185, "部门"));
|
2022-09-15 15:31:34 +08:00
|
|
|
|
String mobile = (String) singleAccount.get(2).get(SalaryI18nUtil.getI18nLabel(86186, "手机号"));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
String userStatus = (String) singleAccount.get(3).get(SalaryI18nUtil.getI18nLabel(86187, "员工状态"));
|
2022-09-15 15:31:34 +08:00
|
|
|
|
String workcode = (String) singleAccount.get(4).get(SalaryI18nUtil.getI18nLabel(86317, "工号"));
|
|
|
|
|
|
|
2022-09-16 15:03:48 +08:00
|
|
|
|
//查询对于人员信息导入筛选的全局配置
|
|
|
|
|
|
SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode");
|
2022-09-19 15:11:27 +08:00
|
|
|
|
String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0";
|
2022-09-16 15:03:48 +08:00
|
|
|
|
|
2022-06-01 19:13:20 +08:00
|
|
|
|
String rowIndex = "第" + index + "行";
|
2022-09-16 15:03:48 +08:00
|
|
|
|
//仅在全局人员筛选配置为“0”时,才对用户名、部门名称、手机号有要求
|
2022-09-19 15:11:27 +08:00
|
|
|
|
if (StringUtils.isBlank(userName) && StringUtils.isBlank(deparmentName) && StringUtils.isBlank(mobile) && "0".equals(confValue)) {
|
2022-05-09 11:18:54 +08:00
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
2022-09-16 15:03:48 +08:00
|
|
|
|
errorMessageMap.put("message", rowIndex + " 用户名、部门名称、手机号" + SalaryI18nUtil.getI18nLabel(100303, "不能同时为空"));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
}
|
2022-09-15 15:31:34 +08:00
|
|
|
|
//筛选导入人员信息可以在人力资源池中匹配到的人员信息
|
2022-09-21 15:49:55 +08:00
|
|
|
|
List<DataCollectionEmployee> employees = getSalaryEmployeeService(user).matchImportEmployee(employeeByIds, userName, deparmentName, mobile, workcode, null);
|
2022-09-15 15:31:34 +08:00
|
|
|
|
|
2022-06-13 17:05:36 +08:00
|
|
|
|
if (CollectionUtils.isEmpty(employees)) {
|
2022-05-09 11:18:54 +08:00
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
2022-06-13 17:05:36 +08:00
|
|
|
|
errorMessageMap.put("message", rowIndex + "员工信息不存在");
|
2022-05-09 11:18:54 +08:00
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
isError = true;
|
2022-07-07 18:29:52 +08:00
|
|
|
|
return isError;
|
2022-06-13 17:05:36 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
//含在职和离职,选在职数据
|
|
|
|
|
|
if (employees.size() > 1) {
|
|
|
|
|
|
employees = employees.stream()
|
|
|
|
|
|
.filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus()))
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
if (employees.size() != 1) {
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100304, "员工信息不存在或者存在多个员工"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
isError = true;
|
2022-08-31 17:19:12 +08:00
|
|
|
|
return isError;
|
2022-06-13 17:05:36 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-05-09 11:18:54 +08:00
|
|
|
|
}
|
2022-06-13 17:05:36 +08:00
|
|
|
|
|
2022-07-06 16:42:13 +08:00
|
|
|
|
Long employeeId = employees.get(0).getEmployeeId();
|
2022-05-09 11:18:54 +08:00
|
|
|
|
InsuranceArchivesAccountPO insuranceArchivesAccountPO = new InsuranceArchivesAccountPO();
|
|
|
|
|
|
InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO = null;
|
|
|
|
|
|
InsuranceArchivesFundSchemePO insuranceArchivesFundSchemePO = null;
|
|
|
|
|
|
InsuranceArchivesOtherSchemePO insuranceArchivesOtherSchemePO = null;
|
|
|
|
|
|
Map<String, Object> socialMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91323, "社保方案名称"));
|
2022-08-01 14:35:07 +08:00
|
|
|
|
Map<String, Object> paymentMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
Map<String, Object> fundMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称"));
|
|
|
|
|
|
Map<String, Object> otherMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"));
|
|
|
|
|
|
Map<String, Object> socialStartTimeMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91319, "社保起始缴纳月"));
|
|
|
|
|
|
Map<String, Object> socialEndTimeMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91320, "社保最后缴纳月"));
|
|
|
|
|
|
Map<String, Object> fundStartTimeMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91483, "公积金起始缴纳月"));
|
|
|
|
|
|
Map<String, Object> fundEndTimeMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91484, "公积金最后缴纳月"));
|
|
|
|
|
|
Map<String, Object> otherStartTimeMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91490, "其他福利起始缴纳月"));
|
|
|
|
|
|
Map<String, Object> otherEndTimeMap = findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91494, "其他福利最后缴纳月"));
|
2022-08-24 12:03:04 +08:00
|
|
|
|
if (StringUtils.isBlank((String) socialMap.get(SalaryI18nUtil.getI18nLabel(91323, "社保方案名称"))) && StringUtils.isBlank((String) fundMap.get(SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称"))) && StringUtils.isBlank((String) otherMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称")))) {
|
2022-05-09 11:18:54 +08:00
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
2022-06-01 19:13:20 +08:00
|
|
|
|
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100312, "社保,公积金,其他福利方案名称不可同时为空"));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
}
|
2022-06-01 19:13:20 +08:00
|
|
|
|
|
2022-07-06 16:42:13 +08:00
|
|
|
|
//社保缴纳组织=个税扣缴义务人
|
2022-08-01 14:35:07 +08:00
|
|
|
|
String paymentOrg = (String) paymentMap.get("个税扣缴义务人");
|
2022-07-07 18:29:52 +08:00
|
|
|
|
if (StringUtils.isBlank(paymentOrg)) {
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
2022-08-01 14:35:07 +08:00
|
|
|
|
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100579, "个税扣缴义务人不允许为空"));
|
2022-07-07 18:29:52 +08:00
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
isError = true;
|
2022-08-24 12:03:04 +08:00
|
|
|
|
} else if (!paymentNameIdMap.containsKey(paymentOrg)) {
|
2022-07-06 16:42:13 +08:00
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100312, "社保缴纳组织应和个税扣缴义务人名称一致,社保缴纳组织不存在或不在权限范围内"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-07-07 18:29:52 +08:00
|
|
|
|
if (openDevolution && !isError) {
|
2022-07-06 16:42:13 +08:00
|
|
|
|
Long paymentOrgId = paymentNameIdMap.get(paymentOrg);
|
|
|
|
|
|
TaxAgentManageRangeEmployeeDTO taxAgentManageRangeEmployeeDTO = taxAgentManageRangeEmployeeTree.stream().filter(tax -> tax.getTaxAgentId().equals(paymentOrgId)).findFirst().get();
|
|
|
|
|
|
Optional<Long> o = taxAgentManageRangeEmployeeDTO.getEmployeeList().stream().map(TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee::getEmployeeId).filter(e -> e.equals(employeeId)).findFirst();
|
2022-08-24 12:03:04 +08:00
|
|
|
|
if (!o.isPresent()) {
|
2022-07-06 16:42:13 +08:00
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100312, "该条数据不在个税扣缴义务人人员范围内,不可导入"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-06-01 19:13:20 +08:00
|
|
|
|
String socialStartMonth = (String) socialStartTimeMap.get(SalaryI18nUtil.getI18nLabel(91319, "社保起始缴纳月"));
|
2022-08-03 17:27:44 +08:00
|
|
|
|
// if (StringUtils.isNotBlank(socialStartMonth) && socialStartMonth.length() > 7) {
|
|
|
|
|
|
// socialStartMonth = socialStartMonth.substring(0, 7);
|
|
|
|
|
|
// }
|
|
|
|
|
|
if (StringUtils.isNotBlank(socialStartMonth) && (!SalaryDateUtil.checkYearMonth(socialStartMonth) || socialStartMonth.length() != 7)) {
|
2022-05-09 11:18:54 +08:00
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
2022-06-01 19:13:20 +08:00
|
|
|
|
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100315, "社保起始缴纳时间格式错误,正确格式为YYYY-MM"));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
}
|
2022-06-01 19:13:20 +08:00
|
|
|
|
|
|
|
|
|
|
String socialEndMonth = (String) socialEndTimeMap.get(SalaryI18nUtil.getI18nLabel(91320, "社保最后缴纳月"));
|
2022-08-03 17:27:44 +08:00
|
|
|
|
// if (StringUtils.isNotBlank(socialEndMonth) && socialEndMonth.length() > 7) {
|
|
|
|
|
|
// socialEndMonth = socialEndMonth.substring(0, 7);
|
|
|
|
|
|
// }
|
|
|
|
|
|
if (StringUtils.isNotBlank(socialEndMonth) && (!SalaryDateUtil.checkYearMonth(socialEndMonth) || socialEndMonth.length() != 7)) {
|
2022-05-09 11:18:54 +08:00
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
2022-06-01 19:13:20 +08:00
|
|
|
|
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100316, "社保最后缴纳时间格式错误,正确格式为YYYY-MM"));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
}
|
2022-06-01 19:13:20 +08:00
|
|
|
|
|
|
|
|
|
|
String fundStartMonth = (String) fundStartTimeMap.get(SalaryI18nUtil.getI18nLabel(91483, "公积金起始缴纳月"));
|
2022-08-03 17:27:44 +08:00
|
|
|
|
// if (StringUtils.isNotBlank(fundStartMonth) && fundStartMonth.length() > 7) {
|
|
|
|
|
|
// fundStartMonth = fundStartMonth.substring(0, 7);
|
|
|
|
|
|
// }
|
|
|
|
|
|
if (StringUtils.isNotBlank(fundStartMonth) && (!SalaryDateUtil.checkYearMonth(fundStartMonth) || fundStartMonth.length() != 7)) {
|
2022-05-09 11:18:54 +08:00
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
2022-06-01 19:13:20 +08:00
|
|
|
|
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100317, "公积金起始缴纳时间格式错误,正确格式为YYYY-MM"));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
}
|
2022-06-01 19:13:20 +08:00
|
|
|
|
|
|
|
|
|
|
String fundEndMonth = (String) fundEndTimeMap.get(SalaryI18nUtil.getI18nLabel(91484, "公积金最后缴纳月"));
|
2022-08-03 17:27:44 +08:00
|
|
|
|
// if (StringUtils.isNotBlank(fundEndMonth) && fundEndMonth.length() > 7) {
|
|
|
|
|
|
// fundEndMonth = fundEndMonth.substring(0, 7);
|
|
|
|
|
|
// }
|
|
|
|
|
|
if (StringUtils.isNotBlank(fundEndMonth) && (!SalaryDateUtil.checkYearMonth(fundEndMonth) || fundEndMonth.length() != 7)) {
|
2022-05-09 11:18:54 +08:00
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
2022-06-01 19:13:20 +08:00
|
|
|
|
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100319, "公积金最后缴纳时间格式错误,正确格式为YYYY-MM"));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
}
|
2022-06-01 19:13:20 +08:00
|
|
|
|
|
|
|
|
|
|
String otherStartMonth = (String) otherStartTimeMap.get(SalaryI18nUtil.getI18nLabel(91490, "其他福利起始缴纳月"));
|
2022-08-03 17:27:44 +08:00
|
|
|
|
// if (StringUtils.isNotBlank(otherStartMonth) && otherStartMonth.length() > 7) {
|
|
|
|
|
|
// otherStartMonth = otherStartMonth.substring(0, 7);
|
|
|
|
|
|
// }
|
|
|
|
|
|
if (StringUtils.isNotBlank(otherStartMonth) && (!SalaryDateUtil.checkYearMonth(otherStartMonth) || otherStartMonth.length() != 7)) {
|
2022-05-09 11:18:54 +08:00
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
2022-06-01 19:13:20 +08:00
|
|
|
|
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100320, "其他福利起始缴纳时间格式错误,正确格式为YYYY-MM"));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
}
|
2022-06-01 19:13:20 +08:00
|
|
|
|
|
|
|
|
|
|
String otherEndMonth = (String) otherEndTimeMap.get(SalaryI18nUtil.getI18nLabel(91494, "其他福利最后缴纳月"));
|
2022-08-03 17:27:44 +08:00
|
|
|
|
// if (StringUtils.isNotBlank(otherEndMonth) && otherEndMonth.length() > 7) {
|
|
|
|
|
|
// otherEndMonth = otherEndMonth.substring(0, 7);
|
|
|
|
|
|
// }
|
|
|
|
|
|
if (StringUtils.isNotBlank(otherEndMonth) && (!SalaryDateUtil.checkYearMonth(otherEndMonth) || otherEndMonth.length() != 7)) {
|
2022-05-09 11:18:54 +08:00
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
2022-06-01 19:13:20 +08:00
|
|
|
|
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100321, "其他福利最后缴纳时间格式错误,正确格式为YYYY-MM"));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
}
|
2022-08-24 12:03:04 +08:00
|
|
|
|
if (StringUtils.isNotBlank((String) socialMap.get(SalaryI18nUtil.getI18nLabel(91323, "社保方案名称"))) && schemeNameIdMap.get((String) socialMap.get(SalaryI18nUtil.getI18nLabel(91323, "社保方案名称"))) == null) {
|
2022-05-09 11:18:54 +08:00
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
2022-08-24 12:03:04 +08:00
|
|
|
|
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100322, "社保方案不存在"));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
insuranceArchivesSocialSchemePO = buildSocialPO(employeeId, welfareMap, singleAccount, schemeNameIdMap, paymentNameIdMap, creator);
|
|
|
|
|
|
}
|
2022-08-24 12:03:04 +08:00
|
|
|
|
if (StringUtils.isNotBlank((String) fundMap.get(SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称"))) && schemeNameIdMap.get((String) fundMap.get(SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称"))) == null) {
|
2022-05-09 11:18:54 +08:00
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
2022-06-01 19:13:20 +08:00
|
|
|
|
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100323, "公积金方案不存在"));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
insuranceArchivesFundSchemePO = buildFundPO(employeeId, welfareMap, singleAccount, schemeNameIdMap, paymentNameIdMap, creator);
|
|
|
|
|
|
}
|
2022-08-24 12:03:04 +08:00
|
|
|
|
if (StringUtils.isNotBlank((String) fundMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"))) && schemeNameIdMap.get((String) fundMap.get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"))) == null) {
|
2022-05-09 11:18:54 +08:00
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
2022-06-01 19:13:20 +08:00
|
|
|
|
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100324, "其他福利方案不存在"));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
insuranceArchivesOtherSchemePO = buildOtherPO(employeeId, welfareMap, singleAccount, schemeNameIdMap, paymentNameIdMap, creator);
|
|
|
|
|
|
}
|
2022-07-29 17:18:38 +08:00
|
|
|
|
/**************校验申报基数**************/
|
|
|
|
|
|
for (Map.Entry<Long, String> entry : welfareMap.entrySet()) {
|
2022-08-24 12:03:04 +08:00
|
|
|
|
String keyName = entry.getValue() + SalaryI18nUtil.getI18nLabel(100293, "申报基数");
|
|
|
|
|
|
String numberVlue = findElement(singleAccount, keyName).get(keyName) == null ? "" : findElement(singleAccount, keyName).get(keyName).toString();
|
|
|
|
|
|
if (!"".equals(numberVlue) && !NumberUtils.isParsable(numberVlue)) {
|
2022-07-29 17:18:38 +08:00
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
2022-08-24 12:03:04 +08:00
|
|
|
|
errorMessageMap.put("message", rowIndex + keyName + SalaryI18nUtil.getI18nLabel(100581, "请输入数字"));
|
2022-07-29 17:18:38 +08:00
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-05-09 11:18:54 +08:00
|
|
|
|
if (!isError) {
|
|
|
|
|
|
insuranceArchivesAccountPO.setSocial(insuranceArchivesSocialSchemePO);
|
|
|
|
|
|
insuranceArchivesAccountPO.setFund(insuranceArchivesFundSchemePO);
|
|
|
|
|
|
insuranceArchivesAccountPO.setOther(insuranceArchivesOtherSchemePO);
|
|
|
|
|
|
insuranceArchivesAccountPOS.add(insuranceArchivesAccountPO);
|
|
|
|
|
|
}
|
|
|
|
|
|
return isError;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Map<String, Object> findElement(List<Map<String, Object>> singleAccount, String target) {
|
|
|
|
|
|
for (Map<String, Object> e : singleAccount) {
|
|
|
|
|
|
if (e.containsKey(target)) {
|
|
|
|
|
|
return e;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return new HashMap<>();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-24 12:03:04 +08:00
|
|
|
|
public InsuranceArchivesSocialSchemePO buildSocialPO(Long employeeId, Map<Long, String> welfareMap, List<Map<String, Object>> singleAccount, Map<String, Long> schemeNameIdMap, Map<String, Long> paymentNameIdMap, Long creator) {
|
2022-05-09 11:18:54 +08:00
|
|
|
|
|
|
|
|
|
|
if (employeeId == null) {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO = new InsuranceArchivesSocialSchemePO();
|
|
|
|
|
|
insuranceArchivesSocialSchemePO.setId(IdGenerator.generate());
|
2022-08-24 12:03:04 +08:00
|
|
|
|
insuranceArchivesSocialSchemePO.setSocialAccount((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91324, "社保账号")).get(SalaryI18nUtil.getI18nLabel(91324, "社保账号")));
|
|
|
|
|
|
insuranceArchivesSocialSchemePO.setSocialSchemeId(schemeNameIdMap.get((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91323, "社保方案名称")).get(SalaryI18nUtil.getI18nLabel(91323, "社保方案名称"))));
|
|
|
|
|
|
String socialStartDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91319, "社保起始缴纳月")).get(SalaryI18nUtil.getI18nLabel(91319, "社保起始缴纳月"));
|
2022-06-13 17:05:36 +08:00
|
|
|
|
if (StringUtils.isNotBlank(socialStartDate) && socialStartDate.length() > 7) {
|
2022-06-01 19:13:20 +08:00
|
|
|
|
socialStartDate = socialStartDate.substring(0, 7);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceArchivesSocialSchemePO.setSocialStartTime(socialStartDate);
|
2022-08-24 12:03:04 +08:00
|
|
|
|
String socialEndDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91320, "社保最后缴纳月")).get(SalaryI18nUtil.getI18nLabel(91320, "社保最后缴纳月"));
|
2022-06-13 17:05:36 +08:00
|
|
|
|
if (StringUtils.isNotBlank(socialEndDate) && socialEndDate.length() > 7) {
|
2022-06-01 19:13:20 +08:00
|
|
|
|
socialEndDate = socialEndDate.substring(0, 7);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceArchivesSocialSchemePO.setSocialEndTime(socialEndDate);
|
2022-05-09 11:18:54 +08:00
|
|
|
|
insuranceArchivesSocialSchemePO.setTenantKey("");
|
|
|
|
|
|
insuranceArchivesSocialSchemePO.setWelfareType(WelfareTypeEnum.SOCIAL_SECURITY.getValue());
|
|
|
|
|
|
insuranceArchivesSocialSchemePO.setUpdateTime(new Date());
|
2022-08-24 12:03:04 +08:00
|
|
|
|
insuranceArchivesSocialSchemePO.setPaymentOrganization(paymentNameIdMap.get((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91325, "个税扣缴义务人")).get(SalaryI18nUtil.getI18nLabel(91325, "个税扣缴义务人"))));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
insuranceArchivesSocialSchemePO.setNonPayment(NonPaymentEnum.YES.getValue());
|
|
|
|
|
|
insuranceArchivesSocialSchemePO.setCreator(creator);
|
|
|
|
|
|
insuranceArchivesSocialSchemePO.setCreateTime(new Date());
|
|
|
|
|
|
insuranceArchivesSocialSchemePO.setUpdateTime(new Date());
|
|
|
|
|
|
insuranceArchivesSocialSchemePO.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue());
|
|
|
|
|
|
insuranceArchivesSocialSchemePO.setEmployeeId(employeeId);
|
2022-07-20 14:25:01 +08:00
|
|
|
|
insuranceArchivesSocialSchemePO.setUnderTake(UndertakerEnum.SCOPE_PERSON.getValue());
|
2022-08-24 12:03:04 +08:00
|
|
|
|
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().queryListBySchemeId(insuranceArchivesSocialSchemePO.getSocialSchemeId());
|
2022-05-31 16:02:41 +08:00
|
|
|
|
InsuranceSchemeDetailPOEncrypt.decryptList(insuranceSchemeDetailPOS);
|
2022-05-09 11:18:54 +08:00
|
|
|
|
if (CollectionUtils.isNotEmpty(insuranceSchemeDetailPOS)) {
|
|
|
|
|
|
List<Long> insuranceIds = insuranceSchemeDetailPOS.stream().map(InsuranceSchemeDetailPO::getInsuranceId).collect(Collectors.toList());
|
|
|
|
|
|
HashMap<String, String> socialPaymentBase = new HashMap<>();
|
|
|
|
|
|
for (Long insuranceId : insuranceIds) {
|
|
|
|
|
|
if (StringUtils.isBlank(welfareMap.get(insuranceId))) {
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (findElement(singleAccount, welfareMap.get(insuranceId) + SalaryI18nUtil.getI18nLabel(100293, "申报基数")) != null) {
|
2022-08-24 12:03:04 +08:00
|
|
|
|
socialPaymentBase.put(String.valueOf(insuranceId), (String) findElement(singleAccount, welfareMap.get(insuranceId) + SalaryI18nUtil.getI18nLabel(100293, "申报基数")).get(welfareMap.get(insuranceId) + SalaryI18nUtil.getI18nLabel(100293, "申报基数")));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceArchivesSocialSchemePO.setSocialPaymentBaseString(JSON.toJSONString(socialPaymentBase));
|
|
|
|
|
|
}
|
|
|
|
|
|
return insuranceArchivesSocialSchemePO;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-24 12:03:04 +08:00
|
|
|
|
public InsuranceArchivesFundSchemePO buildFundPO(Long employeeId, Map<Long, String> welfareMap, List<Map<String, Object>> singleAccount, Map<String, Long> schemeNameIdMap, Map<String, Long> paymentNameIdMap, Long creator) {
|
2022-05-09 11:18:54 +08:00
|
|
|
|
|
|
|
|
|
|
if (employeeId == null) {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
InsuranceArchivesFundSchemePO insuranceArchivesFundSchemePO = new InsuranceArchivesFundSchemePO();
|
|
|
|
|
|
insuranceArchivesFundSchemePO.setId(IdGenerator.generate());
|
|
|
|
|
|
insuranceArchivesFundSchemePO.setCreator(creator);
|
|
|
|
|
|
insuranceArchivesFundSchemePO.setTenantKey("");
|
|
|
|
|
|
insuranceArchivesFundSchemePO.setCreateTime(new Date());
|
|
|
|
|
|
insuranceArchivesFundSchemePO.setUpdateTime(new Date());
|
2022-08-24 12:03:04 +08:00
|
|
|
|
insuranceArchivesFundSchemePO.setFundSchemeId(schemeNameIdMap.get((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称")).get(SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称"))));
|
|
|
|
|
|
insuranceArchivesFundSchemePO.setFundAccount((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91486, "公积金账号")).get(SalaryI18nUtil.getI18nLabel(91486, "公积金账号")));
|
|
|
|
|
|
insuranceArchivesFundSchemePO.setSupplementFundAccount((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91487, "补充公积金账号")).get(SalaryI18nUtil.getI18nLabel(91487, "补充公积金账号")));
|
|
|
|
|
|
String fundStartDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91483, "公积金起始缴纳月")).get(SalaryI18nUtil.getI18nLabel(91483, "公积金起始缴纳月"));
|
2022-06-13 17:05:36 +08:00
|
|
|
|
if (StringUtils.isNotBlank(fundStartDate) && fundStartDate.length() > 7) {
|
2022-06-01 19:13:20 +08:00
|
|
|
|
fundStartDate = fundStartDate.substring(0, 7);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceArchivesFundSchemePO.setFundStartTime(fundStartDate);
|
|
|
|
|
|
|
2022-08-24 12:03:04 +08:00
|
|
|
|
String fundEndDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91484, "公积金最后缴纳月")).get(SalaryI18nUtil.getI18nLabel(91484, "公积金最后缴纳月"));
|
2022-06-13 17:05:36 +08:00
|
|
|
|
if (StringUtils.isNotBlank(fundEndDate) && fundEndDate.length() > 7) {
|
2022-06-01 19:13:20 +08:00
|
|
|
|
fundEndDate = fundEndDate.substring(0, 7);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceArchivesFundSchemePO.setFundEndTime(fundEndDate);
|
2022-05-09 11:18:54 +08:00
|
|
|
|
insuranceArchivesFundSchemePO.setWelfareType(WelfareTypeEnum.ACCUMULATION_FUND.getValue());
|
2022-08-24 12:03:04 +08:00
|
|
|
|
insuranceArchivesFundSchemePO.setPaymentOrganization(paymentNameIdMap.get((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91488, "个税扣缴义务人")).get(SalaryI18nUtil.getI18nLabel(91488, "个税扣缴义务人"))));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
insuranceArchivesFundSchemePO.setNonPayment(NonPaymentEnum.YES.getValue());
|
|
|
|
|
|
insuranceArchivesFundSchemePO.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue());
|
2022-07-20 14:25:01 +08:00
|
|
|
|
insuranceArchivesFundSchemePO.setUnderTake(UndertakerEnum.SCOPE_PERSON.getValue());
|
2022-05-09 11:18:54 +08:00
|
|
|
|
insuranceArchivesFundSchemePO.setEmployeeId(employeeId);
|
|
|
|
|
|
|
|
|
|
|
|
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().queryListBySchemeId(insuranceArchivesFundSchemePO.getFundSchemeId());
|
2022-05-31 16:02:41 +08:00
|
|
|
|
InsuranceSchemeDetailPOEncrypt.decryptList(insuranceSchemeDetailPOS);
|
2022-05-09 11:18:54 +08:00
|
|
|
|
if (CollectionUtils.isNotEmpty(insuranceSchemeDetailPOS)) {
|
|
|
|
|
|
List<Long> insuranceIds = insuranceSchemeDetailPOS.stream().map(InsuranceSchemeDetailPO::getInsuranceId).collect(Collectors.toList());
|
|
|
|
|
|
HashMap<String, String> socialPaymentBase = new HashMap<>();
|
|
|
|
|
|
for (Long insuranceId : insuranceIds) {
|
|
|
|
|
|
if (StringUtils.isBlank(welfareMap.get(insuranceId))) {
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (findElement(singleAccount, welfareMap.get(insuranceId) + SalaryI18nUtil.getI18nLabel(100293, "申报基数")) != null) {
|
2022-08-24 12:03:04 +08:00
|
|
|
|
socialPaymentBase.put(String.valueOf(insuranceId), (String) findElement(singleAccount, welfareMap.get(insuranceId) + SalaryI18nUtil.getI18nLabel(100293, "申报基数")).get(welfareMap.get(insuranceId) + SalaryI18nUtil.getI18nLabel(100293, "申报基数")));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceArchivesFundSchemePO.setFundPaymentBaseString(JSON.toJSONString(socialPaymentBase));
|
|
|
|
|
|
}
|
|
|
|
|
|
return insuranceArchivesFundSchemePO;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-24 12:03:04 +08:00
|
|
|
|
public InsuranceArchivesOtherSchemePO buildOtherPO(Long employeeId, Map<Long, String> welfareMap, List<Map<String, Object>> singleAccount, Map<String, Long> schemeNameIdMap, Map<String, Long> paymentNameIdMap, Long creator) {
|
2022-05-09 11:18:54 +08:00
|
|
|
|
|
|
|
|
|
|
if (employeeId == null) {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
InsuranceArchivesOtherSchemePO insuranceArchivesOtherSchemePO = new InsuranceArchivesOtherSchemePO();
|
|
|
|
|
|
insuranceArchivesOtherSchemePO.setId(IdGenerator.generate());
|
|
|
|
|
|
insuranceArchivesOtherSchemePO.setCreator(creator);
|
|
|
|
|
|
insuranceArchivesOtherSchemePO.setTenantKey("");
|
|
|
|
|
|
insuranceArchivesOtherSchemePO.setCreateTime(new Date());
|
|
|
|
|
|
insuranceArchivesOtherSchemePO.setUpdateTime(new Date());
|
2022-08-24 12:03:04 +08:00
|
|
|
|
insuranceArchivesOtherSchemePO.setOtherSchemeId(schemeNameIdMap.get((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称")).get(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"))));
|
|
|
|
|
|
String otherStartDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91490, "其他福利起始缴纳月")).get(SalaryI18nUtil.getI18nLabel(91490, "其他福利起始缴纳月"));
|
2022-06-13 17:05:36 +08:00
|
|
|
|
if (StringUtils.isNotBlank(otherStartDate) && otherStartDate.length() > 7) {
|
2022-06-01 19:13:20 +08:00
|
|
|
|
otherStartDate = otherStartDate.substring(0, 7);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceArchivesOtherSchemePO.setOtherStartTime(otherStartDate);
|
2022-08-24 12:03:04 +08:00
|
|
|
|
String otherEndDate = (String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91494, "其他福利最后缴纳月")).get(SalaryI18nUtil.getI18nLabel(91494, "其他福利最后缴纳月"));
|
2022-06-13 17:05:36 +08:00
|
|
|
|
if (StringUtils.isNotBlank(otherEndDate) && otherEndDate.length() > 7) {
|
2022-06-01 19:13:20 +08:00
|
|
|
|
otherEndDate = otherEndDate.substring(0, 7);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceArchivesOtherSchemePO.setOtherEndTime(otherEndDate);
|
2022-08-24 12:03:04 +08:00
|
|
|
|
insuranceArchivesOtherSchemePO.setPaymentOrganization(paymentNameIdMap.get((String) findElement(singleAccount, SalaryI18nUtil.getI18nLabel(91497, "个税扣缴义务人")).get(SalaryI18nUtil.getI18nLabel(91497, "个税扣缴义务人"))));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
insuranceArchivesOtherSchemePO.setWelfareType(WelfareTypeEnum.OTHER.getValue());
|
|
|
|
|
|
insuranceArchivesOtherSchemePO.setNonPayment(NonPaymentEnum.YES.getValue());
|
|
|
|
|
|
insuranceArchivesOtherSchemePO.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue());
|
2022-07-20 14:25:01 +08:00
|
|
|
|
insuranceArchivesOtherSchemePO.setUnderTake(UndertakerEnum.SCOPE_PERSON.getValue());
|
2022-05-09 11:18:54 +08:00
|
|
|
|
insuranceArchivesOtherSchemePO.setEmployeeId(employeeId);
|
|
|
|
|
|
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().queryListBySchemeId(insuranceArchivesOtherSchemePO.getOtherSchemeId());
|
2022-05-31 16:02:41 +08:00
|
|
|
|
InsuranceSchemeDetailPOEncrypt.decryptList(insuranceSchemeDetailPOS);
|
2022-05-09 11:18:54 +08:00
|
|
|
|
if (CollectionUtils.isNotEmpty(insuranceSchemeDetailPOS)) {
|
|
|
|
|
|
List<Long> insuranceIds = insuranceSchemeDetailPOS.stream().map(InsuranceSchemeDetailPO::getInsuranceId).collect(Collectors.toList());
|
|
|
|
|
|
HashMap<String, String> socialPaymentBase = new HashMap<>();
|
|
|
|
|
|
for (Long insuranceId : insuranceIds) {
|
|
|
|
|
|
if (StringUtils.isBlank(welfareMap.get(insuranceId))) {
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (findElement(singleAccount, welfareMap.get(insuranceId) + SalaryI18nUtil.getI18nLabel(100293, "申报基数")) != null) {
|
2022-08-24 12:03:04 +08:00
|
|
|
|
socialPaymentBase.put(String.valueOf(insuranceId), (String) findElement(singleAccount, welfareMap.get(insuranceId) + SalaryI18nUtil.getI18nLabel(100293, "申报基数")).get(welfareMap.get(insuranceId) + SalaryI18nUtil.getI18nLabel(100293, "申报基数")));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceArchivesOtherSchemePO.setOtherPaymentBaseString(JSON.toJSONString(socialPaymentBase));
|
|
|
|
|
|
}
|
|
|
|
|
|
return insuranceArchivesOtherSchemePO;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void handleImportData(List<InsuranceArchivesAccountPO> insuranceArchivesAccountPOS) {
|
|
|
|
|
|
//导入社保档案
|
2022-08-24 12:03:04 +08:00
|
|
|
|
List<InsuranceArchivesSocialSchemePO> socialSchemePOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getSocial).collect(Collectors.toList());
|
2022-05-09 11:18:54 +08:00
|
|
|
|
if (CollectionUtils.isNotEmpty(socialSchemePOS)) {
|
2022-08-24 12:03:04 +08:00
|
|
|
|
socialSchemePOS = socialSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesSocialSchemePO::getEmployeeId))), ArrayList::new));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
List<Long> socialEmployeeIds = socialSchemePOS.stream().map(InsuranceArchivesSocialSchemePO::getEmployeeId).collect(Collectors.toList());
|
2022-06-22 13:45:26 +08:00
|
|
|
|
List<List<Long>> socialEmployeeIdPartition = Lists.partition(socialEmployeeIds, 100);
|
|
|
|
|
|
socialEmployeeIdPartition.forEach(getSocialSchemeMapper()::batchDeleteByEmployeeIds);
|
|
|
|
|
|
List<InsuranceArchivesSocialSchemePO> insuranceArchivesSocialSchemePOS = InsuranceArchivesSocialSchemePOEncrypt.encryptList(socialSchemePOS);
|
|
|
|
|
|
List<List<InsuranceArchivesSocialSchemePO>> partition = Lists.partition(insuranceArchivesSocialSchemePOS, 100);
|
|
|
|
|
|
partition.forEach(getSocialSchemeMapper()::batchSave);
|
2022-05-09 11:18:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
//导入公积金档案
|
2022-08-24 12:03:04 +08:00
|
|
|
|
List<InsuranceArchivesFundSchemePO> fundSchemePOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getFund).collect(Collectors.toList());
|
2022-05-09 11:18:54 +08:00
|
|
|
|
if (CollectionUtils.isNotEmpty(fundSchemePOS)) {
|
2022-08-24 12:03:04 +08:00
|
|
|
|
fundSchemePOS = fundSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesFundSchemePO::getEmployeeId))), ArrayList::new));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
List<Long> fundEmployeeIds = fundSchemePOS.stream().map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList());
|
2022-06-22 13:45:26 +08:00
|
|
|
|
List<List<Long>> fundEmployeeIdsPartition = Lists.partition(fundEmployeeIds, 100);
|
|
|
|
|
|
fundEmployeeIdsPartition.forEach(getFundSchemeMapper()::batchDeleteByEmployeeIds);
|
|
|
|
|
|
List<InsuranceArchivesFundSchemePO> insuranceArchivesFundSchemePOS = InsuranceArchivesFundSchemePOEncrypt.encryptList(fundSchemePOS);
|
|
|
|
|
|
List<List<InsuranceArchivesFundSchemePO>> partition = Lists.partition(insuranceArchivesFundSchemePOS, 100);
|
|
|
|
|
|
partition.forEach(getFundSchemeMapper()::batchSave);
|
2022-05-09 11:18:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
//导入其他福利档案
|
2022-08-24 12:03:04 +08:00
|
|
|
|
List<InsuranceArchivesOtherSchemePO> otherSchemePOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getOther).collect(Collectors.toList());
|
2022-05-09 11:18:54 +08:00
|
|
|
|
if (CollectionUtils.isNotEmpty(otherSchemePOS)) {
|
2022-08-24 12:03:04 +08:00
|
|
|
|
otherSchemePOS = otherSchemePOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesOtherSchemePO::getEmployeeId))), ArrayList::new));
|
2022-05-09 11:18:54 +08:00
|
|
|
|
List<Long> otherEmployeeIds = otherSchemePOS.stream().map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList());
|
2022-06-22 13:45:26 +08:00
|
|
|
|
List<List<Long>> otherEmployeeIdsPartition = Lists.partition(otherEmployeeIds, 100);
|
|
|
|
|
|
otherEmployeeIdsPartition.forEach(getOtherSchemeMapper()::batchDeleteByEmployeeIds);
|
|
|
|
|
|
List<InsuranceArchivesOtherSchemePO> insuranceArchivesOtherSchemePOS = InsuranceArchivesOtherSchemePOEncrypt.encryptList(otherSchemePOS);
|
|
|
|
|
|
List<List<InsuranceArchivesOtherSchemePO>> partition = Lists.partition(insuranceArchivesOtherSchemePOS, 100);
|
|
|
|
|
|
partition.forEach(getOtherSchemeMapper()::batchSave);
|
2022-05-09 11:18:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 导出档案导入所需要的模板,可根据开关选择是否导出现有的档案数据
|
|
|
|
|
|
*
|
2022-06-13 17:05:36 +08:00
|
|
|
|
* @param param 是否导出带档案数据的模板
|
2022-05-09 11:18:54 +08:00
|
|
|
|
*/
|
|
|
|
|
|
public XSSFWorkbook exportTemplate(InsuranceArchivesListParam param) {
|
|
|
|
|
|
return getSIImportService().exportTemplate(param);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-05-24 09:23:17 +08:00
|
|
|
|
private List<InsuranceSchemeDetailPO> decryptSchemeDetailList(List<InsuranceSchemeDetailPO> encryptList) {
|
|
|
|
|
|
encryptList.forEach(item -> {
|
|
|
|
|
|
item.setUpperLimit(AESEncryptUtil.decrypt(item.getUpperLimit()));
|
|
|
|
|
|
item.setFixedCost(AESEncryptUtil.decrypt(item.getFixedCost()));
|
|
|
|
|
|
item.setLowerLimit(AESEncryptUtil.decrypt(item.getLowerLimit()));
|
|
|
|
|
|
});
|
|
|
|
|
|
return encryptList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-03-07 22:22:09 +08:00
|
|
|
|
}
|