weaver-hrm-salary/src/com/engine/salary/service/impl/TaxDeclarationValueServiceI...

447 lines
24 KiB
Java
Raw Normal View History

2023-08-11 14:20:14 +08:00
package com.engine.salary.service.impl;
2023-08-14 20:07:29 +08:00
import com.cloudstore.eccom.pc.table.WeaTableColumn;
2023-08-17 19:04:20 +08:00
import com.engine.common.util.ServiceUtil;
2023-08-11 14:20:14 +08:00
import com.engine.core.impl.Service;
2023-12-14 17:55:48 +08:00
import com.engine.salary.constant.SalaryDefaultTenantConstant;
2023-08-17 19:04:20 +08:00
import com.engine.salary.encrypt.EncryptUtil;
2023-08-14 20:07:29 +08:00
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
import com.engine.salary.entity.extemp.po.ExtEmpPO;
import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationValueList;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationValueListDTO;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationValueListQueryParam;
2023-12-14 17:55:48 +08:00
import com.engine.salary.entity.taxdeclaration.param.TaxDeclareRecordDetailSaveParam;
2023-08-14 20:07:29 +08:00
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
2023-08-11 14:20:14 +08:00
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationValuePO;
2023-12-27 17:33:53 +08:00
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO;
2023-08-14 20:07:29 +08:00
import com.engine.salary.entity.taxdeclaration.po.TaxReportColumnPO;
import com.engine.salary.enums.salaryaccounting.EmployeeTypeEnum;
2023-12-27 17:33:53 +08:00
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
2023-08-14 20:07:29 +08:00
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
2023-12-27 17:33:53 +08:00
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
import com.engine.salary.enums.taxdeclaration.SourceEnum;
2023-12-14 17:55:48 +08:00
import com.engine.salary.exception.SalaryRunTimeException;
2023-08-14 20:07:29 +08:00
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationValueMapper;
2023-12-28 15:36:27 +08:00
import com.engine.salary.mapper.taxdeclaration.TaxDeclareRecordMapper;
2024-01-08 09:52:04 +08:00
import com.engine.salary.remote.tax.client.DeclareClient;
import com.engine.salary.remote.tax.response.employee.GetDeclareTaxResultFeedbackResponse;
2023-08-14 20:07:29 +08:00
import com.engine.salary.service.*;
2023-08-17 19:04:20 +08:00
import com.engine.salary.util.JsonUtil;
2023-08-14 20:07:29 +08:00
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryEnumUtil;
2023-08-17 19:04:20 +08:00
import com.engine.salary.util.db.MapperProxyFactory;
2024-01-08 16:00:15 +08:00
import com.engine.salary.util.excel.ExcelUtil;
2023-08-11 14:20:14 +08:00
import com.engine.salary.util.page.PageInfo;
2023-08-14 20:07:29 +08:00
import com.engine.salary.util.page.SalaryPageUtil;
2023-08-17 19:04:20 +08:00
import com.google.common.collect.Lists;
2023-12-27 17:33:53 +08:00
import com.google.common.collect.Maps;
2023-12-14 17:55:48 +08:00
import dm.jdbc.util.IdGenerator;
2023-08-11 14:20:14 +08:00
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
2024-01-08 09:52:04 +08:00
import org.apache.commons.lang3.StringUtils;
2023-08-17 19:04:20 +08:00
import weaver.hrm.User;
2023-08-11 14:20:14 +08:00
import java.util.*;
import java.util.stream.Collectors;
/**
2023-09-07 15:15:59 +08:00
* 个税申报表
2023-08-23 16:49:45 +08:00
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
2023-08-11 14:20:14 +08:00
@Slf4j
public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclarationValueService {
2023-08-17 19:04:20 +08:00
public EncryptUtil encryptUtil = new EncryptUtil();
2023-08-11 14:20:14 +08:00
2023-08-17 19:04:20 +08:00
private TaxDeclarationValueMapper getTaxDeclarationValueMapper() {
return MapperProxyFactory.getProxy(TaxDeclarationValueMapper.class);
}
2023-08-20 14:03:43 +08:00
2023-12-28 15:36:27 +08:00
private TaxDeclareRecordMapper getTaxDeclareRecordMapper() {
return MapperProxyFactory.getProxy(TaxDeclareRecordMapper.class);
}
2023-08-17 19:04:20 +08:00
private SalaryEmployeeService getSalaryEmployeeService(User user) {
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
2023-08-20 14:03:43 +08:00
2023-08-17 19:04:20 +08:00
private ExtEmpService getExtEmpService(User user) {
return ServiceUtil.getService(ExtEmpServiceImpl.class, user);
}
2023-08-20 14:03:43 +08:00
2023-08-17 19:04:20 +08:00
private EmployeeDeclareService getEmployeeDeclareService(User user) {
return ServiceUtil.getService(EmployeeDeclareServiceImpl.class, user);
}
2023-08-20 14:03:43 +08:00
2023-08-17 19:04:20 +08:00
private TaxReportColumnService getTaxReportColumnService(User user) {
return ServiceUtil.getService(TaxReportColumnServiceImpl.class, user);
}
2023-08-20 14:03:43 +08:00
2023-12-14 17:55:48 +08:00
private TaxDeclarationService getTaxDeclarationService(User user) {
return ServiceUtil.getService(TaxDeclarationServiceImpl.class, user);
}
2023-08-11 14:20:14 +08:00
@Override
2023-08-14 20:07:29 +08:00
public PageInfo<TaxDeclarationValuePO> listPageByTaxDeclarationIds(TaxDeclarationValueListQueryParam queryParam, Collection<Long> taxDeclarationIds) {
2023-08-17 19:04:20 +08:00
List<TaxDeclarationValuePO> taxDeclarationValuePOS = getTaxDeclarationValueMapper().listSome(TaxDeclarationValuePO.builder().taxDeclarationIds(taxDeclarationIds).build());
2023-08-20 14:03:43 +08:00
taxDeclarationValuePOS = decryptBatch(taxDeclarationValuePOS);
2023-08-14 20:07:29 +08:00
return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), taxDeclarationValuePOS, TaxDeclarationValuePO.class);
2023-08-11 14:20:14 +08:00
}
@Override
public List<TaxDeclarationValuePO> listByTaxDeclarationIds(Collection<Long> taxDeclarationIds) {
2023-08-17 19:04:20 +08:00
List<TaxDeclarationValuePO> taxDeclarationValues = getTaxDeclarationValueMapper().listSome(TaxDeclarationValuePO.builder().taxDeclarationIds(taxDeclarationIds).build());
2023-08-11 14:20:14 +08:00
return decryptBatch(taxDeclarationValues);
}
2023-12-28 18:12:38 +08:00
@Override
public List<TaxDeclarationValuePO> listByTaxDeclarationId(Long taxDeclarationId) {
List<TaxDeclarationValuePO> taxDeclarationValues = getTaxDeclarationValueMapper().listSome(TaxDeclarationValuePO.builder().taxDeclarationId(taxDeclarationId).build());
return decryptBatch(taxDeclarationValues);
}
2023-08-11 14:20:14 +08:00
@Override
public List<TaxDeclarationValuePO> listByTaxDeclarationIdsNoDecrypt(Collection<Long> taxDeclarationIds) {
2023-08-17 19:04:20 +08:00
return getTaxDeclarationValueMapper().listSome(TaxDeclarationValuePO.builder().taxDeclarationIds(taxDeclarationIds).build());
2023-08-11 14:20:14 +08:00
}
@Override
public TaxDeclarationValueListDTO convert2List(TaxDeclarationPO taxDeclaration, List<TaxDeclarationValuePO> taxDeclarationValues) {
// 查询个税申报表表头
IncomeCategoryEnum incomeCategoryEnum = SalaryEnumUtil.enumMatchByValue(taxDeclaration.getIncomeCategory(), IncomeCategoryEnum.class);
2024-01-04 15:35:23 +08:00
List<TaxReportColumnPO> taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(incomeCategoryEnum, 0);
2023-08-11 14:20:14 +08:00
// 人员id
Set<Long> employeeIds = SalaryEntityUtil.properties(taxDeclarationValues, TaxDeclarationValuePO::getEmployeeId);
// 查询报送的人员
2023-08-17 19:04:20 +08:00
List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).listByTaxCycleAndTaxAgentIdAndEmployeeIds(taxDeclaration.getTaxCycle(), taxDeclaration.getTaxAgentId(), employeeIds);
2023-08-11 14:20:14 +08:00
// 查询人员信息
List<Long> simpleEmployeeIds = taxDeclarationValues.stream()
2023-09-07 15:15:59 +08:00
.filter(taxDeclarationValue -> taxDeclarationValue.getEmployeeType() == null || Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue()))
2023-08-11 14:20:14 +08:00
.map(TaxDeclarationValuePO::getEmployeeId)
.distinct()
.collect(Collectors.toList());
2023-08-17 19:04:20 +08:00
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds);
2023-08-11 14:20:14 +08:00
// 查询人员薪资(身份证号码等)
2023-08-17 19:04:20 +08:00
List<DataCollectionEmployee> simpleUserInfos = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds);
2023-08-11 14:20:14 +08:00
// 查询外部人员
2023-08-14 20:07:29 +08:00
List<Long> extEmployeeIds = taxDeclarationValues.stream()
2023-08-11 14:20:14 +08:00
.filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue()))
.map(TaxDeclarationValuePO::getEmployeeId)
2023-08-14 20:07:29 +08:00
.collect(Collectors.toList());
2023-08-17 19:04:20 +08:00
List<ExtEmpPO> extEmployees = getExtEmpService(user).getExtEmpByIds(extEmployeeIds);
2023-08-11 14:20:14 +08:00
// 列表表头
List<WeaTableColumn> weaTableColumns = TaxDeclarationValueList.buildTableColumns(taxReportColumns);
// 列表数据
List<Map<String, Object>> data = TaxDeclarationValueList.buildTableData(incomeCategoryEnum, taxReportColumns, taxDeclarationValues,
2024-01-08 09:52:04 +08:00
employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees, false);
2023-08-11 14:20:14 +08:00
return new TaxDeclarationValueListDTO().setColumns(weaTableColumns).setData(data);
}
@Override
public void batchSave(List<TaxDeclarationValuePO> taxDeclarationValues) {
if (CollectionUtils.isNotEmpty(taxDeclarationValues)) {
2023-08-17 19:04:20 +08:00
// 加密
taxDeclarationValues.forEach(taxDeclarationValue ->
taxDeclarationValue.setResultValueJson(JsonUtil.toJsonString(taxDeclarationValue.getResultValue())));
taxDeclarationValues = encryptUtil.encryptList(taxDeclarationValues, TaxDeclarationValuePO.class);
// 分批保存
List<List<TaxDeclarationValuePO>> partition = Lists.partition(taxDeclarationValues, 100);
for (List<TaxDeclarationValuePO> subTaxDeclarationValues : partition) {
2023-08-20 14:03:43 +08:00
subTaxDeclarationValues.forEach(getTaxDeclarationValueMapper()::insertIgnoreNull);
2023-12-28 18:12:38 +08:00
}
}
}
@Override
public void batchEdit(List<TaxDeclarationValuePO> taxDeclarationValues) {
if (CollectionUtils.isNotEmpty(taxDeclarationValues)) {
// 加密
taxDeclarationValues.forEach(taxDeclarationValue ->
taxDeclarationValue.setResultValueJson(JsonUtil.toJsonString(taxDeclarationValue.getResultValue())));
taxDeclarationValues = encryptUtil.encryptList(taxDeclarationValues, TaxDeclarationValuePO.class);
// 分批保存
List<List<TaxDeclarationValuePO>> partition = Lists.partition(taxDeclarationValues, 100);
for (List<TaxDeclarationValuePO> subTaxDeclarationValues : partition) {
subTaxDeclarationValues.forEach(getTaxDeclarationValueMapper()::updateIgnoreNull);
2023-08-17 19:04:20 +08:00
}
2023-08-11 14:20:14 +08:00
}
}
2023-12-14 17:55:48 +08:00
@Override
public void save(TaxDeclareRecordDetailSaveParam param) {
TaxDeclarationPO taxDeclaration = getTaxDeclarationService(user).getById(param.getTaxDeclarationId());
2023-12-27 17:33:53 +08:00
if (taxDeclaration == null) {
2023-12-14 17:55:48 +08:00
throw new SalaryRunTimeException("个税申报表不存在!");
}
2023-12-28 15:36:27 +08:00
Long taxDeclareRecordId = taxDeclaration.getTaxDeclareRecordId();
TaxDeclareRecordPO declareRecordPO = getTaxDeclareRecordMapper().getById(taxDeclareRecordId);
if (declareRecordPO == null) {
throw new SalaryRunTimeException("个税申报记录不存在!");
}
2023-12-14 17:55:48 +08:00
TaxDeclarationValuePO po = TaxDeclarationValuePO.builder()
.id(IdGenerator.generate())
.taxDeclarationId(param.getTaxDeclarationId())
2023-12-28 15:36:27 +08:00
.taxDeclareRecordId(taxDeclareRecordId)
2023-12-14 17:55:48 +08:00
.employeeId(param.getEmployeeId())
.employeeType(param.getEmployeeType())
.resultValue(param.getTaxReportColumnValues())
.resultValueJson(JsonUtil.toJsonString(param.getTaxReportColumnValues()))
.createTime(new Date())
.updateTime(new Date())
2023-12-27 17:33:53 +08:00
.source(SourceEnum.ADD.getValue())
2023-12-14 17:55:48 +08:00
.creator((long) user.getUID())
.deleteType(0)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
encryptUtil.encrypt(po, TaxDeclarationValuePO.class);
getTaxDeclarationValueMapper().insertIgnoreNull(po);
2023-12-28 15:36:27 +08:00
//新增年终奖
if (IncomeCategoryEnum.ONETIME_ANNUAL_BONUS.getValue().equals(taxDeclaration.getIncomeCategory())) {
autoAddWagesDeclare(declareRecordPO);
}
2023-12-14 17:55:48 +08:00
}
@Override
public void edit(TaxDeclareRecordDetailSaveParam param) {
TaxDeclarationValuePO po = getById(param.getId());
po.setResultValue(param.getTaxReportColumnValues());
po.setResultValueJson(JsonUtil.toJsonString(param.getTaxReportColumnValues()));
po.setUpdateTime(new Date());
2023-12-27 17:33:53 +08:00
po.setSource(SourceEnum.EDIT.getValue());
2023-12-14 17:55:48 +08:00
encryptUtil.encrypt(po, TaxDeclarationValuePO.class);
getTaxDeclarationValueMapper().updateIgnoreNull(po);
}
@Override
public TaxDeclarationValuePO getById(Long id) {
TaxDeclarationValuePO po = getTaxDeclarationValueMapper().getById(id);
2023-12-27 17:33:53 +08:00
if (po == null) {
2023-12-14 17:55:48 +08:00
throw new SalaryRunTimeException("个税申报明细不存在!");
}
2023-12-27 17:33:53 +08:00
encryptUtil.decrypt(po, TaxDeclarationValuePO.class);
2023-12-14 17:55:48 +08:00
po.setResultValue(JsonUtil.parseMap(po.getResultValueJson(), String.class));
return po;
}
2023-08-11 14:20:14 +08:00
@Override
public void deleteByTaxDeclareRecordIds(Collection<Long> taxDeclareRecordIds) {
if (CollectionUtils.isEmpty(taxDeclareRecordIds)) {
return;
}
2023-08-17 19:04:20 +08:00
getTaxDeclarationValueMapper().deleteBytaxDeclareRecordIds(taxDeclareRecordIds);
2023-08-11 14:20:14 +08:00
}
private List<TaxDeclarationValuePO> decryptBatch(List<TaxDeclarationValuePO> taxDeclarationValues) {
if (CollectionUtils.isEmpty(taxDeclarationValues)) {
return Collections.emptyList();
}
2023-08-17 19:04:20 +08:00
// 解密
taxDeclarationValues = encryptUtil.decryptList(taxDeclarationValues, TaxDeclarationValuePO.class);
taxDeclarationValues.forEach(salaryAcctResultValue -> {
salaryAcctResultValue.setResultValue(JsonUtil.parseMap(salaryAcctResultValue.getResultValueJson(), String.class));
});
2023-08-11 14:20:14 +08:00
return taxDeclarationValues;
}
2023-12-27 17:33:53 +08:00
@Override
public void autoAddWagesDeclare(TaxDeclareRecordPO taxDeclareRecord) {
Long taxDeclareRecordId = taxDeclareRecord.getId();
Date now = new Date();
//非正常薪资的人员
List<Long> notWagesEmpIds = getTaxDeclarationValueMapper().queryNotWagesEmpIds(taxDeclareRecordId);
if (CollectionUtils.isEmpty(notWagesEmpIds)) {
return;
}
//正常薪资人员
List<Long> wagesEmpIds = getTaxDeclarationValueMapper().queryWagesEmpIds(taxDeclareRecordId);
//比较差异
List<Long> autoAddIds = notWagesEmpIds.stream().filter(id -> !wagesEmpIds.contains(id)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(autoAddIds)) {
return;
}
//正常薪资的表头
2024-01-04 15:35:23 +08:00
List<TaxReportColumnPO> taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(IncomeCategoryEnum.WAGES_AND_SALARIES, 0);
2023-12-27 17:33:53 +08:00
Map<String, String> valueMap = Maps.newHashMap();
for (TaxReportColumnPO taxReportColumn : taxReportColumns) {
String value = Objects.equals(taxReportColumn.getDataType(), SalaryDataTypeEnum.NUMBER.getValue()) ? "0.00" : "";
valueMap.put(taxReportColumn.getReportColumnDataIndex(), value);
}
//当前申报表是否含正常申报
List<TaxDeclarationPO> list = getTaxDeclarationService(user).listByTaxDeclareRecordId(taxDeclareRecordId, IncomeCategoryEnum.WAGES_AND_SALARIES.getValue());
TaxDeclarationPO taxDeclarationPO;
if (CollectionUtils.isNotEmpty(list)) {
if (list.size() > 1) {
throw new SalaryRunTimeException("存在多条正常工资薪金申报表数据");
}
taxDeclarationPO = list.get(0);
} else {
taxDeclarationPO = TaxDeclarationPO
.builder()
.id(IdGenerator.generate())
.taxDeclareRecordId(taxDeclareRecordId)
.incomeCategory(IncomeCategoryEnum.WAGES_AND_SALARIES.getValue())
.taxAgentId(taxDeclareRecord.getTaxAgentId())
.salaryMonth(taxDeclareRecord.getSalaryMonth())
.taxCycle(taxDeclareRecord.getTaxCycle())
.description(taxDeclareRecord.getRemark())
.controlView(0)
.creator((long) user.getUID())
.createTime(now)
.updateTime(now)
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
List<TaxDeclarationPO> taxList = new ArrayList<>();
getTaxDeclarationService(user).saveBatch(taxList);
}
//组装数据,自动补足
List<TaxDeclarationValuePO> autoAddValuePOs = autoAddIds.stream().map((empId -> {
TaxDeclarationValuePO taxDeclarationValue = TaxDeclarationValuePO.builder()
.id(IdGenerator.generate())
.taxDeclareRecordId(taxDeclarationPO.getTaxDeclareRecordId())
.taxDeclarationId(taxDeclarationPO.getId())
.employeeType(0)
.employeeId(empId)
.resultValue(valueMap)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.creator((long) user.getUID())
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.createTime(now)
.updateTime(now)
.source(SourceEnum.AUTO.getValue())
.build();
return taxDeclarationValue;
})).collect(Collectors.toList());
batchSave(autoAddValuePOs);
}
2024-01-04 15:35:23 +08:00
2024-01-08 09:52:04 +08:00
@Override
public void contrast(Long taxDeclareRecordId) {
TaxDeclareRecordPO taxDeclareRecordPO = getTaxDeclareRecordMapper().getById(taxDeclareRecordId);
if (taxDeclareRecordPO == null) {
throw new SalaryRunTimeException("申报记录不存在!");
}
List<TaxDeclarationPO> taxDeclarations = getTaxDeclarationService(user).listByTaxDeclareRecordId(taxDeclareRecordId);
if (CollectionUtils.isEmpty(taxDeclarations)) {
2024-01-04 15:35:23 +08:00
throw new SalaryRunTimeException("无申报表");
}
2024-01-08 09:52:04 +08:00
Map<String, List<Map<String, Object>>> localData = new HashMap<>();
for (TaxDeclarationPO taxDeclaration : taxDeclarations) {
List<TaxDeclarationValuePO> taxDeclarationValues = listByTaxDeclarationId(taxDeclaration.getId());
// 查询个税申报表表头
IncomeCategoryEnum incomeCategoryEnum = SalaryEnumUtil.enumMatchByValue(taxDeclaration.getIncomeCategory(), IncomeCategoryEnum.class);
List<TaxReportColumnPO> taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(incomeCategoryEnum);
// 人员id
Set<Long> employeeIds = SalaryEntityUtil.properties(taxDeclarationValues, TaxDeclarationValuePO::getEmployeeId);
// 查询报送的人员
List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).listByTaxCycleAndTaxAgentIdAndEmployeeIds(taxDeclaration.getTaxCycle(), taxDeclaration.getTaxAgentId(), employeeIds);
// 查询人员信息
List<Long> simpleEmployeeIds = taxDeclarationValues.stream()
.filter(taxDeclarationValue -> taxDeclarationValue.getEmployeeType() == null || Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue()))
.map(TaxDeclarationValuePO::getEmployeeId)
.distinct()
.collect(Collectors.toList());
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds);
// 查询人员薪资(身份证号码等)
List<DataCollectionEmployee> simpleUserInfos = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds);
// 查询外部人员
List<Long> extEmployeeIds = taxDeclarationValues.stream()
.filter(taxDeclarationValue -> Objects.equals(taxDeclarationValue.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue()))
.map(TaxDeclarationValuePO::getEmployeeId)
.collect(Collectors.toList());
List<ExtEmpPO> extEmployees = getExtEmpService(user).getExtEmpByIds(extEmployeeIds);
// 列表数据
List<Map<String, Object>> data = TaxDeclarationValueList.buildTableData(incomeCategoryEnum, taxReportColumns, taxDeclarationValues,
employeeDeclares, simpleEmployees, simpleUserInfos, extEmployees, true);
localData.put(incomeCategoryEnum.getDefaultLabel(), data);
}
2024-01-04 15:56:42 +08:00
2024-01-08 09:52:04 +08:00
DeclareClient declareClient = new DeclareClient(taxDeclareRecordPO.getTaxAgentId());
GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse = declareClient.getDeclareTaxResultFeedback(taxDeclareRecordPO.getDeclareRequestId());
Map<String, List<List<Object>>> onlineDataMap = new HashMap<>();
List<TaxDeclarationPO> list = getTaxDeclarationService(user).listByTaxDeclareRecordId(taxDeclareRecordPO.getId());
list.stream().map(TaxDeclarationPO::getIncomeCategory).map(IncomeCategoryEnum::parseByValue).forEach(e -> e.parseGetDeclareTaxResultFeedbackResponse(onlineDataMap, declareTaxResultFeedbackResponse));
for (String incomeCategory : localData.keySet()) {
2024-01-08 16:00:15 +08:00
List<Map<String, Object>> localList = localData.get(incomeCategory);
Map<String, Map<String, Object>> localMap = new HashMap<>();
for (Map<String, Object> map : localList) {
String no = map.getOrDefault("证件号码", "").toString();
localMap.put(no, map);
}
2024-01-08 09:52:04 +08:00
List<List<Object>> onlineData = onlineDataMap.get(incomeCategory);
List<Object> heads = onlineData.get(0);
List<List<Object>> data = onlineData.subList(1, onlineData.size());
List<Map<String, Object>> onlineMap = new ArrayList<>();
for (int i = 0; i < data.size(); i++) {
List<Object> row = data.get(i);
Map<String, Object> m = new HashMap<>();
for (int j = 0; j < heads.size(); j++) {
String key = heads.get(j).toString();
m.put(key, row.get(j));
}
onlineMap.add(m);
}
2024-01-08 16:00:15 +08:00
Map<String, Map<String, Object>> onlineNoMap = new HashMap<>();
for (Map<String, Object> map : onlineMap) {
String no = map.getOrDefault("证件号码", "").toString();
onlineNoMap.put(no, map);
}
Map<String, List<Object>> header = ExcelUtil.getHeader(GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw.class);
List<Object> list1 = header.get(header);
List<Map<String, Object>> resultList = new ArrayList<>();
for (Map<String, Object> map : localList) {
String no = map.getOrDefault("证件号码", "").toString();
Map<String, Object> d1 = localMap.get(no);
Map<String, Object> d2 = onlineNoMap.get(no);
}
2024-01-08 09:52:04 +08:00
}
}
2024-01-04 15:56:42 +08:00
2024-01-08 09:52:04 +08:00
public static void main(String[] args) {
2024-01-08 16:00:15 +08:00
String a = "姓名, 证件类型, 证件号码, 本期收入, 本期免税收入, 基本养老保险费 , 基本医疗保险费, 失业保险费, 住房公积金, 企业(职业)年金, 商业健康保险, 税延养老保险, 累计收入额, 累计免税收入 , 累计减除费用, 累计专项扣除, 累计子女教育支出扣除, 累计继续教育 累计住房租金, ,累计住房贷款利息 ,累计赡养老人 , 累计3岁以下婴幼儿照护, 累计个人养老金, 累计其他扣除, 累计准予扣除的捐赠,累计应纳税所得额 ,税率, 速算扣除数, 累计应纳税额, 累计减免税额, 累计应扣缴税额, 已缴税额, 备注, incomeCategory, 证件号码, 累计子女教育, id, 减免税额, jobNum, , employeeId, 其他, 应补(退)税额, 准予扣除的捐赠额 ";
2024-01-08 09:52:04 +08:00
String b = "姓名, 证件类型, 证件号码, 任职受雇日期, 离职日期, 本期收入, 本期免税收入, 本期基本养老保险费, 本期基本医疗保险费, 本期失业保险费, 本期住房公积金, 本期企业(职业)年金, 本期商业健康保险费, 本期税延养老保险费, 本期其他扣除(其他), 累计收入额, 累计免税收入, 累计减除费用, 累计专项扣除, 累计子女教育支出扣除, 累计继续教育支出扣除, 累计住房租金支出扣除, 累计房屋贷款支出扣除, 累计赡养老人支出扣除, 累计3岁以下婴幼儿照护, 累计个人养老金, 累计其他扣除, 累计准予扣除的捐赠, 累计应纳税所得额, 税率, 速算扣除数, 累计应纳税额, 累计减免税额, 累计应扣缴税额, 累计已缴税额, 已缴税额, 累计专项附加扣除额, 应补退税额, 备注";
2024-01-04 15:35:23 +08:00
2024-01-08 09:52:04 +08:00
List c = Arrays.stream(StringUtils.split(a, ",")).sorted(String::compareTo).collect(Collectors.toList());
List d = Arrays.stream(StringUtils.split(b, ",")).sorted(String::compareTo).collect(Collectors.toList());
2024-01-04 15:35:23 +08:00
2024-01-08 09:52:04 +08:00
System.out.println(c);
System.out.println(d);
2024-01-04 15:35:23 +08:00
}
2023-08-11 14:20:14 +08:00
}