2022-04-18 20:24:43 +08:00
|
|
|
package com.engine.salary.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
2022-08-09 16:54:29 +08:00
|
|
|
import com.engine.common.util.ServiceUtil;
|
2022-04-18 20:24:43 +08:00
|
|
|
import com.engine.core.impl.Service;
|
|
|
|
|
import com.engine.salary.biz.SIAccountBiz;
|
2022-05-24 09:23:17 +08:00
|
|
|
import com.engine.salary.encrypt.siaccount.InsuranceAccountDetailPOEncrypt;
|
|
|
|
|
import com.engine.salary.encrypt.siexport.AccountExportPOEncrypt;
|
2022-04-18 20:24:43 +08:00
|
|
|
import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO;
|
|
|
|
|
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
|
|
|
|
|
import com.engine.salary.entity.sicategory.po.ICategoryPO;
|
|
|
|
|
import com.engine.salary.entity.siexport.param.InsuranceExportParam;
|
|
|
|
|
import com.engine.salary.entity.siexport.po.AccountExportPO;
|
2022-08-09 16:54:29 +08:00
|
|
|
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
2022-04-18 20:24:43 +08:00
|
|
|
import com.engine.salary.enums.siaccount.BillStatusEnum;
|
|
|
|
|
import com.engine.salary.enums.siaccount.PaymentStatusEnum;
|
|
|
|
|
import com.engine.salary.enums.siaccount.ResourceFromEnum;
|
|
|
|
|
import com.engine.salary.enums.sicategory.DataTypeEnum;
|
|
|
|
|
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
|
|
|
|
|
import com.engine.salary.mapper.InsuranceExportMapper;
|
|
|
|
|
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
|
|
|
|
|
import com.engine.salary.mapper.sicategory.ICategoryMapper;
|
2022-08-09 16:54:29 +08:00
|
|
|
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
|
2022-04-18 20:24:43 +08:00
|
|
|
import com.engine.salary.service.SIExportService;
|
|
|
|
|
import com.engine.salary.service.SISchemeService;
|
|
|
|
|
import com.engine.salary.util.SalaryAssert;
|
|
|
|
|
import com.engine.salary.util.SalaryEnumUtil;
|
|
|
|
|
import com.engine.salary.util.SalaryI18nUtil;
|
|
|
|
|
import com.engine.salary.util.db.MapperProxyFactory;
|
|
|
|
|
import com.engine.salary.util.excel.ExcelUtil;
|
|
|
|
|
import org.apache.commons.collections4.MapUtils;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
2022-08-17 11:46:35 +08:00
|
|
|
import weaver.general.BaseBean;
|
2022-04-18 20:24:43 +08:00
|
|
|
import weaver.hrm.User;
|
|
|
|
|
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.function.Function;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
2022-04-21 15:04:35 +08:00
|
|
|
import static com.engine.salary.enums.UserStatusEnum.getDefaultLabelByValue;
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
/**
|
|
|
|
|
* @Author weaver_cl
|
2022-07-13 11:45:16 +08:00
|
|
|
* @Description:
|
2022-04-18 20:24:43 +08:00
|
|
|
* @Date 2022/4/18
|
|
|
|
|
* @Version V1.0
|
|
|
|
|
**/
|
2022-07-21 17:28:47 +08:00
|
|
|
public class SIExportServiceImpl extends Service implements SIExportService {
|
2022-04-18 20:24:43 +08:00
|
|
|
|
2022-08-17 11:46:35 +08:00
|
|
|
BaseBean bs = new BaseBean();
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
private SIAccountBiz siAccountBiz = new SIAccountBiz();
|
|
|
|
|
|
|
|
|
|
private SISchemeService getSISchemeService(User user) {
|
2022-07-21 17:28:47 +08:00
|
|
|
return ServiceUtil.getService(SISchemeServiceImpl.class, user);
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
|
2022-08-17 11:46:35 +08:00
|
|
|
private InsuranceAccountDetailMapper getInsuranceAccountDetailMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private TaxAgentMapper getTaxAgentMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private InsuranceExportMapper getInsuranceExportMapper() {
|
|
|
|
|
return MapperProxyFactory.getProxy(InsuranceExportMapper.class);
|
|
|
|
|
}
|
2022-04-18 20:24:43 +08:00
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public XSSFWorkbook exportOverView(InsuranceExportParam queryParam) {
|
2022-08-17 11:46:35 +08:00
|
|
|
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = getInsuranceAccountDetailMapper().selectList(queryParam.getBillMonth(), StringUtils.isBlank(queryParam.getPaymentOrganization()) ? null : Long.valueOf(queryParam.getPaymentOrganization()));
|
2022-05-24 09:23:17 +08:00
|
|
|
InsuranceAccountDetailPOEncrypt.decryptInsuranceAccountDetailPOList(insuranceAccountDetailPOS);
|
2022-04-18 20:24:43 +08:00
|
|
|
|
|
|
|
|
//获取扣缴义务人信息
|
2022-08-17 11:46:35 +08:00
|
|
|
List<TaxAgentPO> paymentList =getTaxAgentMapper().listAll();
|
2022-07-21 17:28:47 +08:00
|
|
|
SalaryAssert.notEmpty(paymentList, SalaryI18nUtil.getI18nLabel(100341, "该租户无扣缴义务人"));
|
2022-08-09 16:54:29 +08:00
|
|
|
Map<Long, TaxAgentPO> paymentMap = paymentList.stream().collect(Collectors.toMap(TaxAgentPO::getId, Function.identity()));
|
2022-04-18 20:24:43 +08:00
|
|
|
List<InsuranceAccountViewListDTO> insuranceAccountViewListDTOS = siAccountBiz.buildRecords(insuranceAccountDetailPOS, paymentMap);
|
|
|
|
|
|
|
|
|
|
List<List<Object>> excelSheetData = new ArrayList<>();
|
|
|
|
|
// 1.工作簿名称
|
|
|
|
|
String sheetName = SalaryI18nUtil.getI18nLabel(85368, "社保福利档案");
|
|
|
|
|
// 2.表头
|
|
|
|
|
String[] header = {
|
2022-08-04 15:09:40 +08:00
|
|
|
SalaryI18nUtil.getI18nLabel(93270, "个税扣缴义务人"),
|
2022-07-21 17:28:47 +08:00
|
|
|
SalaryI18nUtil.getI18nLabel(93272, "社保人数"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(93273, "公积金人数"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(93274, "其他福利人数"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(93275, "社保缴费合计"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(93276, "公积金缴费合计"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(93277, "其他福利缴费合计"),
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(93278, "合计")};
|
2022-04-21 15:04:35 +08:00
|
|
|
excelSheetData.add(Arrays.asList(header));
|
2022-04-18 20:24:43 +08:00
|
|
|
|
|
|
|
|
//工作簿数据
|
|
|
|
|
List<List<Object>> rows = new LinkedList<>();
|
|
|
|
|
for (InsuranceAccountViewListDTO dto : insuranceAccountViewListDTOS) {
|
|
|
|
|
List<Object> row = new LinkedList<>();
|
|
|
|
|
row.add(dto.getPayOrg());
|
|
|
|
|
row.add(dto.getSocialNum());
|
|
|
|
|
row.add(dto.getFundNum());
|
|
|
|
|
row.add(dto.getOtherNum());
|
|
|
|
|
row.add(dto.getSocialPaySum());
|
|
|
|
|
row.add(dto.getFundPaySum());
|
|
|
|
|
row.add(dto.getOtherPaySum());
|
|
|
|
|
row.add(dto.getSum());
|
|
|
|
|
rows.add(row);
|
|
|
|
|
}
|
|
|
|
|
excelSheetData.addAll(rows);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ExcelUtil.genWorkbookV2(excelSheetData, sheetName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public XSSFWorkbook exportAccount(Integer paymentStatus, InsuranceExportParam param) {
|
2022-08-17 11:46:35 +08:00
|
|
|
List<AccountExportPO> accountExportPOS = getInsuranceExportMapper().exportAccount(paymentStatus, param.getBillMonth(), param.getPaymentOrganization());
|
2022-05-24 09:23:17 +08:00
|
|
|
AccountExportPOEncrypt.decryptAccountExportPOList(accountExportPOS);
|
2022-04-18 20:24:43 +08:00
|
|
|
List<WeaTableColumn> columns = new ArrayList<>();
|
|
|
|
|
List<Map<String, Object>> records = new ArrayList<>();
|
|
|
|
|
if (PaymentStatusEnum.COMMON.getValue() == paymentStatus) {
|
|
|
|
|
columns = buildCommonColumns(accountExportPOS, false);
|
|
|
|
|
}
|
|
|
|
|
if (PaymentStatusEnum.REPAIR.getValue() == paymentStatus) {
|
2022-07-21 17:28:47 +08:00
|
|
|
columns = buildCommonColumns(accountExportPOS, true);
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
records = buildCommonRecords(accountExportPOS);
|
|
|
|
|
List<List<Object>> excelSheetData = new ArrayList<>();
|
|
|
|
|
//工作簿名称
|
2022-08-17 11:46:35 +08:00
|
|
|
String sheetName = SalaryI18nUtil.getI18nLabel(85368, "社保福利档案");
|
2022-04-21 15:04:35 +08:00
|
|
|
excelSheetData.add(Arrays.asList(columns.stream().map(WeaTableColumn::getText).toArray(String[]::new)));
|
2022-04-18 20:24:43 +08:00
|
|
|
//工作簿数据
|
|
|
|
|
List<List<Object>> rows = new LinkedList<>();
|
|
|
|
|
for (Map<String, Object> recordData : records) {
|
|
|
|
|
List<Object> row = new LinkedList<>();
|
|
|
|
|
for (WeaTableColumn column : columns) {
|
|
|
|
|
row.add(recordData.get(column.getColumn()));
|
|
|
|
|
}
|
|
|
|
|
rows.add(row);
|
|
|
|
|
}
|
|
|
|
|
excelSheetData.addAll(rows);
|
|
|
|
|
return ExcelUtil.genWorkbookV2(excelSheetData, sheetName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<Map<String, Object>> buildCommonRecords(List<AccountExportPO> list) {
|
|
|
|
|
List<Map<String, Object>> result = new ArrayList<>();
|
|
|
|
|
|
2022-08-09 16:54:29 +08:00
|
|
|
List<TaxAgentPO> paymentList = MapperProxyFactory.getProxy(TaxAgentMapper.class).listAll();
|
2022-07-21 17:28:47 +08:00
|
|
|
SalaryAssert.notEmpty(paymentList, SalaryI18nUtil.getI18nLabel(100341, "该租户无扣缴义务人"));
|
2022-04-18 20:24:43 +08:00
|
|
|
Map<Long, String> schemeIdNameMap = getSISchemeService(user).getSchemeIdNameMap();
|
2022-08-09 16:54:29 +08:00
|
|
|
Map<Long, TaxAgentPO> paymentMap = paymentList.stream().collect(Collectors.toMap(TaxAgentPO::getId, Function.identity()));
|
2022-04-18 20:24:43 +08:00
|
|
|
list.forEach(item -> {
|
|
|
|
|
Map<String, Object> record = new HashMap<>();
|
|
|
|
|
record.put("billMonth", item.getBillMonth());
|
|
|
|
|
record.put("billStatus", SalaryEnumUtil.enumMatchByValue(item.getBillStatus(), BillStatusEnum.values(), BillStatusEnum.class));
|
|
|
|
|
record.put("userName", item.getUserName());
|
|
|
|
|
record.put("department", item.getDepartmentName());
|
|
|
|
|
record.put("supplementaryMonth", item.getSupplementaryMonth());
|
|
|
|
|
record.put("mobile", item.getTelephone());
|
2022-04-21 15:04:35 +08:00
|
|
|
record.put("employeeStatus", item.getUserStatus() == null ? "" : getDefaultLabelByValue(item.getUserStatus()));
|
2022-04-18 20:24:43 +08:00
|
|
|
ResourceFromEnum from = SalaryEnumUtil.enumMatchByValue(item.getResourceFrom(), ResourceFromEnum.values(), ResourceFromEnum.class);
|
2022-07-21 17:28:47 +08:00
|
|
|
record.put("sourceFrom", SalaryI18nUtil.getI18nLabel(from.getLabelId(), from.getDefaultLabel()));
|
2022-04-18 20:24:43 +08:00
|
|
|
record.put("socialPayOrg", paymentMap.get(item.getSocialPayOrg()) == null ? "" : paymentMap.get(item.getSocialPayOrg()).getName());
|
|
|
|
|
record.put("socialAccount", item.getSocialAccount());
|
|
|
|
|
record.put("socialSchemeName", schemeIdNameMap.get(item.getSocialSchemeId()));
|
|
|
|
|
if (StringUtils.isNotEmpty(item.getSocialPaymentBaseString())) {
|
|
|
|
|
Map<String, Object> socialJson = JSON.parseObject(item.getSocialPaymentBaseString(), new HashMap<String, Object>().getClass());
|
2022-07-21 17:28:47 +08:00
|
|
|
if (socialJson != null) {
|
|
|
|
|
socialJson.forEach((k, v) -> {
|
|
|
|
|
record.put(k + "socialBase", v);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
record.put("fundPayOrg", paymentMap.get(item.getSocialPayOrg()) == null ? "" : paymentMap.get(item.getSocialPayOrg()).getName());
|
|
|
|
|
record.put("fundAccount", item.getFundAccount());
|
|
|
|
|
record.put("fundSchemeName", schemeIdNameMap.get(item.getFundSchemeId()));
|
|
|
|
|
record.put("supplementFundAccount", item.getSupplementFundAccount());
|
|
|
|
|
if (StringUtils.isNotEmpty(item.getFundPaymentBaseString())) {
|
|
|
|
|
Map<String, Object> socialJson = JSON.parseObject(item.getFundPaymentBaseString(), new HashMap<String, Object>().getClass());
|
2022-07-21 17:28:47 +08:00
|
|
|
if (socialJson != null) {
|
|
|
|
|
socialJson.forEach((k, v) -> {
|
|
|
|
|
record.put(k + "fundBase", v);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
record.put("otherPayOrg", paymentMap.get(item.getOtherPayOrg()) == null ? "" : paymentMap.get(item.getOtherPayOrg()).getName());
|
|
|
|
|
record.put("otherSchemeName", schemeIdNameMap.get(item.getOtherSchemeId()));
|
|
|
|
|
if (StringUtils.isNotEmpty(item.getOtherPaymentBaseString())) {
|
|
|
|
|
Map<String, Object> socialJson = JSON.parseObject(item.getOtherPaymentBaseString(), new HashMap<String, Object>().getClass());
|
2022-07-21 17:28:47 +08:00
|
|
|
if (socialJson != null) {
|
|
|
|
|
socialJson.forEach((k, v) -> {
|
|
|
|
|
record.put(k + "otherBase", v);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotEmpty(item.getSocialPerJson())) {
|
|
|
|
|
Map<String, Object> socialJson = JSON.parseObject(item.getSocialPerJson(), new HashMap<String, Object>().getClass());
|
2022-07-21 17:28:47 +08:00
|
|
|
if (socialJson != null) {
|
|
|
|
|
socialJson.forEach((k, v) -> {
|
|
|
|
|
record.put(k + "socialPer", v);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
record.put("socialPerSum", item.getSocialPerSum());
|
|
|
|
|
if (StringUtils.isNotEmpty(item.getFundPerJson())) {
|
|
|
|
|
Map<String, Object> fundPerJson = JSON.parseObject(item.getFundPerJson(), new HashMap<String, Object>().getClass());
|
2022-07-21 17:28:47 +08:00
|
|
|
if (fundPerJson != null) {
|
|
|
|
|
fundPerJson.forEach((k, v) -> {
|
|
|
|
|
record.put(k + "fundPer", v);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
record.put("fundPerSum", item.getFundPerSum());
|
|
|
|
|
if (StringUtils.isNotEmpty(item.getOtherPerJson())) {
|
|
|
|
|
Map<String, Object> fundPerJson = JSON.parseObject(item.getOtherPerJson(), new HashMap<String, Object>().getClass());
|
2022-07-21 17:28:47 +08:00
|
|
|
if (fundPerJson != null) {
|
|
|
|
|
fundPerJson.forEach((k, v) -> {
|
|
|
|
|
record.put(k + "otherPer", v);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
record.put("otherPerSum", item.getOtherPerSum());
|
|
|
|
|
record.put("perSum", item.getPerSum());
|
|
|
|
|
if (StringUtils.isNotEmpty(item.getSocialComJson())) {
|
|
|
|
|
Map<String, Object> fundPerJson = JSON.parseObject(item.getSocialComJson(), new HashMap<String, Object>().getClass());
|
2022-07-21 17:28:47 +08:00
|
|
|
if (fundPerJson != null) {
|
|
|
|
|
fundPerJson.forEach((k, v) -> {
|
|
|
|
|
record.put(k + "socialCom", v);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
record.put("socialComSum", item.getSocialComSum());
|
|
|
|
|
if (StringUtils.isNotEmpty(item.getFundComJson())) {
|
|
|
|
|
Map<String, Object> fundPerJson = JSON.parseObject(item.getFundComJson(), new HashMap<String, Object>().getClass());
|
2022-07-21 17:28:47 +08:00
|
|
|
if (fundPerJson != null) {
|
|
|
|
|
fundPerJson.forEach((k, v) -> {
|
|
|
|
|
record.put(k + "fundCom", v);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
record.put("fundComSum", item.getFundComSum());
|
|
|
|
|
if (StringUtils.isNotEmpty(item.getOtherPerJson())) {
|
|
|
|
|
Map<String, Object> fundPerJson = JSON.parseObject(item.getOtherPerJson(), new HashMap<String, Object>().getClass());
|
2022-07-21 17:28:47 +08:00
|
|
|
if (fundPerJson != null) {
|
|
|
|
|
fundPerJson.forEach((k, v) -> {
|
|
|
|
|
record.put(k + "otherCom", v);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
record.put("otherComSum", item.getOtherComSum());
|
|
|
|
|
record.put("comSum", item.getComSum());
|
|
|
|
|
record.put("socialSum", item.getSocialSum());
|
|
|
|
|
record.put("fundSum", item.getFundSum());
|
|
|
|
|
record.put("otherSum", item.getOtherSum());
|
|
|
|
|
record.put("total", item.getTotal());
|
|
|
|
|
result.add(record);
|
|
|
|
|
});
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Map<Integer, Map<String, String>> buildComTitle(List<AccountExportPO> pos, Map<String, String> categoryIdNameMap) {
|
|
|
|
|
Set<String> socailIds = new HashSet<>();
|
|
|
|
|
Set<String> fundIds = new HashSet<>();
|
|
|
|
|
Set<String> otherIds = new HashSet<>();
|
|
|
|
|
Map<Integer, Map<String, String>> result = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
pos.stream().forEach(item -> {
|
|
|
|
|
if (StringUtils.isNotBlank(item.getSocialComJson())) {
|
|
|
|
|
Map<String, String> socialJson = JSON.parseObject(item.getSocialComJson(), new HashMap<String, String>().getClass());
|
2022-07-21 17:28:47 +08:00
|
|
|
if (socialJson != null) {
|
|
|
|
|
socialJson.forEach((k, v) -> {
|
|
|
|
|
socailIds.add(k);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(item.getFundComJson())) {
|
|
|
|
|
Map<String, String> fundJson = JSON.parseObject(item.getFundComJson(), new HashMap<String, String>().getClass());
|
2022-07-21 17:28:47 +08:00
|
|
|
if (fundJson != null) {
|
|
|
|
|
fundJson.forEach((k, v) -> {
|
|
|
|
|
fundIds.add(k);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(item.getOtherComJson())) {
|
|
|
|
|
Map<String, String> otherJson = JSON.parseObject(item.getOtherComJson(), new HashMap<String, String>().getClass());
|
2022-07-21 17:28:47 +08:00
|
|
|
if (otherJson != null) {
|
|
|
|
|
otherJson.forEach((k, v) -> {
|
|
|
|
|
otherIds.add(k);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
Map<String, String> socialColumns = new HashMap<>();
|
|
|
|
|
Map<String, String> fundColumns = new HashMap<>();
|
|
|
|
|
Map<String, String> otherColumns = new HashMap<>();
|
|
|
|
|
socailIds.stream().forEach(social -> {
|
|
|
|
|
if (categoryIdNameMap.containsKey(social)) {
|
|
|
|
|
socialColumns.put(
|
2022-07-21 17:28:47 +08:00
|
|
|
categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(100289, "单位"),
|
2022-04-18 20:24:43 +08:00
|
|
|
social + "socialCom");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
fundIds.stream().forEach(social -> {
|
|
|
|
|
if (categoryIdNameMap.containsKey(social)) {
|
2022-07-21 17:28:47 +08:00
|
|
|
fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(100289, "单位"),
|
2022-04-18 20:24:43 +08:00
|
|
|
social + "fundCom");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
otherIds.stream().forEach(social -> {
|
|
|
|
|
if (categoryIdNameMap.containsKey(social)) {
|
2022-07-21 17:28:47 +08:00
|
|
|
otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(100289, "单位"),
|
2022-04-18 20:24:43 +08:00
|
|
|
social + "otherCom");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialColumns);
|
|
|
|
|
result.put(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), fundColumns);
|
|
|
|
|
result.put(WelfareTypeEnum.OTHER.getValue(), otherColumns);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Map<Integer, Map<String, String>> buildPersonalTitle(List<AccountExportPO> pos, Map<String, String> categoryIdNameMap) {
|
|
|
|
|
Set<String> socailIds = new HashSet<>();
|
|
|
|
|
Set<String> fundIds = new HashSet<>();
|
|
|
|
|
Set<String> otherIds = new HashSet<>();
|
|
|
|
|
Map<Integer, Map<String, String>> result = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
pos.stream().forEach(item -> {
|
|
|
|
|
if (StringUtils.isNotBlank(item.getSocialPerJson())) {
|
|
|
|
|
Map<String, String> socialJson = JSON.parseObject(item.getSocialPerJson(), new HashMap<String, String>().getClass());
|
2022-07-21 17:28:47 +08:00
|
|
|
if (socialJson != null) {
|
|
|
|
|
socialJson.forEach((k, v) -> {
|
|
|
|
|
socailIds.add(k);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(item.getFundPerJson())) {
|
|
|
|
|
Map<String, String> fundJson = JSON.parseObject(item.getFundPerJson(), new HashMap<String, String>().getClass());
|
2022-07-21 17:28:47 +08:00
|
|
|
if (fundJson != null) {
|
|
|
|
|
fundJson.forEach((k, v) -> {
|
|
|
|
|
fundIds.add(k);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(item.getOtherPerJson())) {
|
|
|
|
|
Map<String, String> otherJson = JSON.parseObject(item.getOtherPerJson(), new HashMap<String, String>().getClass());
|
2022-07-21 17:28:47 +08:00
|
|
|
if (otherJson != null) {
|
|
|
|
|
otherJson.forEach((k, v) -> {
|
|
|
|
|
otherIds.add(k);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
Map<String, String> socialColumns = new HashMap<>();
|
|
|
|
|
Map<String, String> fundColumns = new HashMap<>();
|
|
|
|
|
Map<String, String> otherColumns = new HashMap<>();
|
|
|
|
|
socailIds.stream().forEach(social -> {
|
|
|
|
|
if (categoryIdNameMap.containsKey(social)) {
|
2022-07-21 17:28:47 +08:00
|
|
|
socialColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(87159, "个人"),
|
2022-04-18 20:24:43 +08:00
|
|
|
social + "socialPer");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
fundIds.stream().forEach(social -> {
|
|
|
|
|
if (categoryIdNameMap.containsKey(social)) {
|
2022-07-21 17:28:47 +08:00
|
|
|
fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(87159, "个人"),
|
2022-04-18 20:24:43 +08:00
|
|
|
social + "fundPer");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
otherIds.stream().forEach(social -> {
|
|
|
|
|
if (categoryIdNameMap.containsKey(social)) {
|
2022-07-21 17:28:47 +08:00
|
|
|
otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(87159, "个人"),
|
2022-04-18 20:24:43 +08:00
|
|
|
social + "otherPer");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialColumns);
|
|
|
|
|
result.put(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), fundColumns);
|
|
|
|
|
result.put(WelfareTypeEnum.OTHER.getValue(), otherColumns);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private List<WeaTableColumn> buildCommonColumns(List<AccountExportPO> pos, boolean flag) {
|
|
|
|
|
List<WeaTableColumn> list = new ArrayList<>();
|
|
|
|
|
Map<String, String> categoryIdNameMap = categoryIdNameMap();
|
|
|
|
|
Map<Integer, Map<String, String>> columns = buildPaymentTitle(pos, categoryIdNameMap);
|
|
|
|
|
Map<Integer, Map<String, String>> personColumns = buildPersonalTitle(pos, categoryIdNameMap);
|
|
|
|
|
Map<Integer, Map<String, String>> comColumns = buildComTitle(pos, categoryIdNameMap);
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(85429, "姓名"), "userName"));
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86185, "部门"), "department"));
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86186, "手机号"), "mobile"));
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(86187, "员工状态"), "employeeStatus"));
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100377, "数据来源"), "sourceFrom"));
|
2022-04-18 20:24:43 +08:00
|
|
|
if (flag) {
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100379, "补缴月份"), "supplementaryMonth"));
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
2022-08-04 15:09:40 +08:00
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91325, "个税扣缴义务人"), "socialPayOrg"));
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91324, "社保账号"), "socialAccount"));
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91323, "社保方案名称"), "socialSchemeName"));
|
2022-04-18 20:24:43 +08:00
|
|
|
//组装社保基数
|
|
|
|
|
columns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> {
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", k, v));
|
2022-04-18 20:24:43 +08:00
|
|
|
});
|
2022-08-04 15:09:40 +08:00
|
|
|
// list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91488, "公积金缴纳组织"), "fundPayOrg"));
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91486, "公积金账号"), "fundAccount"));
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称"), "fundSchemeName"));
|
2022-04-18 20:24:43 +08:00
|
|
|
//组装公积金基数
|
|
|
|
|
columns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", k, v));
|
2022-04-18 20:24:43 +08:00
|
|
|
});
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91487, "补充公积金账号"), "supplementFundAccount"));
|
2022-08-04 15:09:40 +08:00
|
|
|
// list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91497, "其他福利缴纳组织"), "otherPayOrg"));
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"), "otherSchemeName"));
|
2022-04-18 20:24:43 +08:00
|
|
|
columns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> {
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", k, v));
|
2022-04-18 20:24:43 +08:00
|
|
|
});
|
|
|
|
|
personColumns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> {
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", k, v));
|
2022-04-18 20:24:43 +08:00
|
|
|
});
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100388, "社保个人合计"), "socialPerSum"));
|
2022-04-18 20:24:43 +08:00
|
|
|
personColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", k, v));
|
2022-04-18 20:24:43 +08:00
|
|
|
});
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100390, "公积金个人合计"), "fundPerSum"));
|
2022-04-18 20:24:43 +08:00
|
|
|
personColumns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> {
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", k, v));
|
2022-04-18 20:24:43 +08:00
|
|
|
});
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100392, "其他福利个人合计"), "otherPerSum"));
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100393, "个人合计"), "perSum"));
|
2022-04-18 20:24:43 +08:00
|
|
|
comColumns.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> {
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", k, v));
|
2022-04-18 20:24:43 +08:00
|
|
|
});
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100394, "社保单位合计"), "socialComSum"));
|
2022-04-18 20:24:43 +08:00
|
|
|
comColumns.get(WelfareTypeEnum.ACCUMULATION_FUND.getValue()).forEach((k, v) -> {
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", k, v));
|
2022-04-18 20:24:43 +08:00
|
|
|
});
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100395, "公积金单位合计"), "fundComSum"));
|
2022-04-18 20:24:43 +08:00
|
|
|
comColumns.get(WelfareTypeEnum.OTHER.getValue()).forEach((k, v) -> {
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", k, v));
|
2022-04-18 20:24:43 +08:00
|
|
|
});
|
2022-08-17 11:46:35 +08:00
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100396, "其他福利单位合计"), "otherComSum"));
|
2022-07-21 17:28:47 +08:00
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100397, "单位合计"), "comSum"));
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100398, "社保合计"), "socialSum"));
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100399, "公积金合计"), "fundSum"));
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(100400, "其他福利合计"), "otherSum"));
|
|
|
|
|
list.add(new WeaTableColumn("150px", SalaryI18nUtil.getI18nLabel(93278, "合计"), "total"));
|
2022-04-18 20:24:43 +08:00
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Map<String, String> categoryIdNameMap() {
|
|
|
|
|
//系统福利类型
|
|
|
|
|
Map<Long, String> systemMap = MapperProxyFactory.getProxy(ICategoryMapper.class).listByDataType(DataTypeEnum.SYSTEM.getValue()).stream()
|
|
|
|
|
.collect(Collectors.toMap(ICategoryPO::getId, ICategoryPO::getInsuranceName));
|
|
|
|
|
Map<Long, String> customMap = MapperProxyFactory.getProxy(ICategoryMapper.class).listAll()
|
|
|
|
|
.stream().collect(Collectors.toMap(ICategoryPO::getId, ICategoryPO::getInsuranceName));
|
|
|
|
|
HashMap<Long, String> total = new HashMap<>();
|
|
|
|
|
if (MapUtils.isNotEmpty(systemMap)) {
|
|
|
|
|
total.putAll(systemMap);
|
|
|
|
|
}
|
|
|
|
|
if (MapUtils.isNotEmpty(customMap)) {
|
|
|
|
|
total.putAll(customMap);
|
|
|
|
|
}
|
|
|
|
|
HashMap<String, String> result = new HashMap<>();
|
|
|
|
|
total.forEach((k, v) -> {
|
|
|
|
|
result.put(String.valueOf(k), v);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Map<Integer, Map<String, String>> buildPaymentTitle(List<AccountExportPO> pos, Map<String, String> categoryIdNameMap) {
|
|
|
|
|
Set<String> socailIds = new HashSet<>();
|
|
|
|
|
Set<String> fundIds = new HashSet<>();
|
|
|
|
|
Set<String> otherIds = new HashSet<>();
|
|
|
|
|
Map<Integer, Map<String, String>> result = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
pos.stream().forEach(item -> {
|
|
|
|
|
if (StringUtils.isNotBlank(item.getSocialPaymentBaseString())) {
|
|
|
|
|
Map<String, String> socialJson = JSON.parseObject(item.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
|
2022-07-21 17:28:47 +08:00
|
|
|
if (socialJson != null) {
|
|
|
|
|
socialJson.forEach((k, v) -> {
|
|
|
|
|
socailIds.add(k);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(item.getFundPaymentBaseString())) {
|
|
|
|
|
Map<String, String> fundJson = JSON.parseObject(item.getFundPaymentBaseString(), new HashMap<String, String>().getClass());
|
2022-07-21 17:28:47 +08:00
|
|
|
if (fundJson != null) {
|
|
|
|
|
fundJson.forEach((k, v) -> {
|
|
|
|
|
fundIds.add(k);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotBlank(item.getOtherPaymentBaseString())) {
|
|
|
|
|
Map<String, String> otherJson = JSON.parseObject(item.getOtherPaymentBaseString(), new HashMap<String, String>().getClass());
|
2022-07-21 17:28:47 +08:00
|
|
|
if (otherJson != null) {
|
|
|
|
|
otherJson.forEach((k, v) -> {
|
|
|
|
|
otherIds.add(k);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
Map<String, String> socialColumns = new HashMap<>();
|
|
|
|
|
Map<String, String> fundColumns = new HashMap<>();
|
|
|
|
|
Map<String, String> otherColumns = new HashMap<>();
|
|
|
|
|
socailIds.stream().forEach(social -> {
|
|
|
|
|
if (categoryIdNameMap.containsKey(social)) {
|
2022-07-21 17:28:47 +08:00
|
|
|
socialColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(100293, "申报基数"), social + "socialBase");
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
fundIds.stream().forEach(social -> {
|
|
|
|
|
if (categoryIdNameMap.containsKey(social)) {
|
2022-07-21 17:28:47 +08:00
|
|
|
fundColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(100293, "申报基数"), social + "fundBase");
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
otherIds.stream().forEach(social -> {
|
|
|
|
|
if (categoryIdNameMap.containsKey(social)) {
|
2022-07-21 17:28:47 +08:00
|
|
|
otherColumns.put(categoryIdNameMap.get(social) + SalaryI18nUtil.getI18nLabel(100293, "申报基数"), social + "otherBase");
|
2022-04-18 20:24:43 +08:00
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
result.put(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), socialColumns);
|
|
|
|
|
result.put(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), fundColumns);
|
|
|
|
|
result.put(WelfareTypeEnum.OTHER.getValue(), otherColumns);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|