166 lines
12 KiB
Java
166 lines
12 KiB
Java
|
|
//package com.engine.salary.entity.taxdeclaration.bo;
|
|||
|
|
//
|
|||
|
|
//import com.engine.salary.report.enums.IncomeCategoryEnum;
|
|||
|
|
//import com.google.common.collect.Lists;
|
|||
|
|
//import com.google.common.collect.Maps;
|
|||
|
|
//import com.weaver.hrm.salary.entity.employeedeclare.po.EmployeeDeclarePO;
|
|||
|
|
//import com.weaver.hrm.salary.entity.taxdeclaration.po.TaxDeclarationPO;
|
|||
|
|
//import com.weaver.hrm.salary.entity.taxdeclaration.po.TaxDeclarationValuePO;
|
|||
|
|
//import com.weaver.hrm.salary.entity.taxdeclaration.po.TaxReportColumnPO;
|
|||
|
|
//import com.weaver.hrm.salary.enums.employeedeclare.CardTypeEnum;
|
|||
|
|
//import com.weaver.hrm.salary.enums.salaryitem.SalaryDataTypeEnum;
|
|||
|
|
//import com.weaver.hrm.salary.util.SalaryEntityUtil;
|
|||
|
|
//import org.apache.commons.collections4.CollectionUtils;
|
|||
|
|
//import org.apache.commons.lang3.StringUtils;
|
|||
|
|
//import weaver.general.Util;
|
|||
|
|
//
|
|||
|
|
//import java.math.BigDecimal;
|
|||
|
|
//import java.math.RoundingMode;
|
|||
|
|
//import java.util.*;
|
|||
|
|
//
|
|||
|
|
///**
|
|||
|
|
// * @description: 个税申报
|
|||
|
|
// * @author: xiajun
|
|||
|
|
// * @modified By: xiajun
|
|||
|
|
// * @date: Created in 2022/11/2 11:18 AM
|
|||
|
|
// * @version:v1.0
|
|||
|
|
// */
|
|||
|
|
//public class TaxDeclarationRequest {
|
|||
|
|
//
|
|||
|
|
// public static Map<String, Object> convert2RequestParam(List<TaxReportColumnPO> taxReportColumns,
|
|||
|
|
// List<TaxDeclarationPO> taxDeclarations,
|
|||
|
|
// List<TaxDeclarationValuePO> taxDeclarationValues,
|
|||
|
|
// List<EmployeeDeclarePO> employeeDeclares) {
|
|||
|
|
// Map<String, Map<String, Object>> objRequestParam = Maps.newHashMap();
|
|||
|
|
// Map<String, List<Map<String, Object>>> listRequestParam = Maps.newHashMap();
|
|||
|
|
// Map<String, List<TaxReportColumnPO>> taxReportColumnMap = SalaryEntityUtil.group2Map(taxReportColumns, TaxReportColumnPO::getIncomeCategory);
|
|||
|
|
// Map<Long, EmployeeDeclarePO> employeeDeclareMap = SalaryEntityUtil.convert2Map(employeeDeclares, EmployeeDeclarePO::getEmployeeId);
|
|||
|
|
// Map<Long, List<TaxDeclarationValuePO>> taxDeclarationValueMap = SalaryEntityUtil.group2Map(taxDeclarationValues, TaxDeclarationValuePO::getTaxDeclarationId);
|
|||
|
|
// for (TaxDeclarationPO taxDeclaration : taxDeclarations) {
|
|||
|
|
// List<TaxDeclarationValuePO> values = taxDeclarationValueMap.get(taxDeclaration.getId());
|
|||
|
|
// for (TaxDeclarationValuePO taxDeclarationValue : values) {
|
|||
|
|
// EmployeeDeclarePO employeeDeclare = employeeDeclareMap.get(taxDeclarationValue.getEmployeeId());
|
|||
|
|
// IncomeCategoryEnum incomeCategoryEnum = IncomeCategoryEnum.parseByValue(taxDeclaration.getIncomeCategory());
|
|||
|
|
// if (employeeDeclare == null || incomeCategoryEnum == null) {
|
|||
|
|
// continue;
|
|||
|
|
// }
|
|||
|
|
// List<TaxReportColumnPO> taxReportColumnList = taxReportColumnMap.get(Util.null2String(incomeCategoryEnum.getValue()));
|
|||
|
|
// Map<String, Object> employeeRequestParam = convert2RequestParam(incomeCategoryEnum, taxReportColumnList, taxDeclarationValue, employeeDeclare);
|
|||
|
|
// if (incomeCategoryEnum == IncomeCategoryEnum.WAGES_AND_SALARIES) {
|
|||
|
|
// Map<String, Object> paramMap = objRequestParam.computeIfAbsent("zcgzxj", k -> {
|
|||
|
|
// Map<String, Object> param = new HashMap<>();
|
|||
|
|
// // 正常工资薪金列表
|
|||
|
|
// param.put("zcgzxjlb", Lists.newArrayList());
|
|||
|
|
// // 正常工资薪金是否需要专项
|
|||
|
|
// param.put("zcgzxjsfxyzx", 0);
|
|||
|
|
// // 正常工资薪金是否传入专项累计
|
|||
|
|
// param.put("zcgzxjsfcrlj", 1);
|
|||
|
|
// return param;
|
|||
|
|
// });
|
|||
|
|
// List<Map<String, Object>> employeeRequestParams = (List<Map<String, Object>>) paramMap.computeIfAbsent("zcgzxjlb", K -> Lists.newArrayList());
|
|||
|
|
// employeeRequestParams.add(employeeRequestParam);
|
|||
|
|
// } else if (incomeCategoryEnum == IncomeCategoryEnum.ONETIME_ANNUAL_BONUS) {
|
|||
|
|
// // 全年一次性奖金收入
|
|||
|
|
// List<Map<String, Object>> employeeRequestParams = listRequestParam.computeIfAbsent("qnycxjjsslb", k -> Lists.newArrayList());
|
|||
|
|
// employeeRequestParams.add(employeeRequestParam);
|
|||
|
|
// } else if (incomeCategoryEnum == IncomeCategoryEnum.COMPENSATION_FOR_RETIRE) {
|
|||
|
|
// // 内退一次性补偿金
|
|||
|
|
// List<Map<String, Object>> employeeRequestParams = listRequestParam.computeIfAbsent("ntycxbcjlb", k -> Lists.newArrayList());
|
|||
|
|
// employeeRequestParams.add(employeeRequestParam);
|
|||
|
|
// } else if (incomeCategoryEnum == IncomeCategoryEnum.COMPENSATION_FOR_DISMISS) {
|
|||
|
|
// // 解除劳动合同一次性补偿金
|
|||
|
|
// List<Map<String, Object>> employeeRequestParams = listRequestParam.computeIfAbsent("jcldhtycxbcjlb", k -> Lists.newArrayList());
|
|||
|
|
// employeeRequestParams.add(employeeRequestParam);
|
|||
|
|
// } else if (incomeCategoryEnum == IncomeCategoryEnum.INCOME_FOR_INDIVIDUAL_EQUITY_INCENTIVE) {
|
|||
|
|
// // 个人股权激励收入
|
|||
|
|
// List<Map<String, Object>> employeeRequestParams = listRequestParam.computeIfAbsent("grgqjl", k -> Lists.newArrayList());
|
|||
|
|
// employeeRequestParams.add(employeeRequestParam);
|
|||
|
|
// } else if (incomeCategoryEnum == IncomeCategoryEnum.ANNUITY_RECEIPT) {
|
|||
|
|
// // 处理"是否一次性领取"(接口只能传0和1但是接口的错误返回信息告知只能填写是和否,所以需要转一下)
|
|||
|
|
// String sfycxlq = Util.null2String(employeeRequestParam.get("sfycxlq"));
|
|||
|
|
// employeeRequestParam.put("sfycxlq", Objects.equals("是", sfycxlq) ? "1" : "0");
|
|||
|
|
// // 年金领取
|
|||
|
|
// List<Map<String, Object>> employeeRequestParams = listRequestParam.computeIfAbsent("qynj", k -> Lists.newArrayList());
|
|||
|
|
// employeeRequestParams.add(employeeRequestParam);
|
|||
|
|
// } else if (incomeCategoryEnum == IncomeCategoryEnum.REMUNERATION_FOR_LABOR) {
|
|||
|
|
// // 一般劳务报酬所得
|
|||
|
|
// List<Map<String, Object>> employeeRequestParams = listRequestParam.computeIfAbsent("lwbclb", k -> Lists.newArrayList());
|
|||
|
|
// employeeRequestParams.add(employeeRequestParam);
|
|||
|
|
// } else if (incomeCategoryEnum == IncomeCategoryEnum.INCOME_FOR_INSURANCE_SALESMAN) {
|
|||
|
|
// // 保险营销员佣金收入
|
|||
|
|
// Map<String, Object> paramMap = objRequestParam.computeIfAbsent("bxyxy", k -> {
|
|||
|
|
// Map<String, Object> param = new HashMap<>();
|
|||
|
|
// param.put("bxyxylwbclb", Lists.newArrayList());
|
|||
|
|
// return param;
|
|||
|
|
// });
|
|||
|
|
// List<Map<String, Object>> employeeRequestParams = (List<Map<String, Object>>) paramMap.computeIfAbsent("bxyxylwbclb", k -> Lists.newArrayList());
|
|||
|
|
// employeeRequestParams.add(employeeRequestParam);
|
|||
|
|
// } else if (incomeCategoryEnum == IncomeCategoryEnum.INCOME_FOR_SECURITIES_BROKER) {
|
|||
|
|
// // 证券经纪人佣金收入
|
|||
|
|
// Map<String, Object> paramMap = objRequestParam.computeIfAbsent("zqjjr", k -> {
|
|||
|
|
// Map<String, Object> param = new HashMap<>();
|
|||
|
|
// param.put("zqjjrsdlb", Lists.newArrayList());
|
|||
|
|
// return param;
|
|||
|
|
// });
|
|||
|
|
// List<Map<String, Object>> employeeRequestParams = (List<Map<String, Object>>) paramMap.computeIfAbsent("zqjjrsdlb", k -> Lists.newArrayList());
|
|||
|
|
// employeeRequestParams.add(employeeRequestParam);
|
|||
|
|
// } else if (incomeCategoryEnum == IncomeCategoryEnum.REMUNERATION_FOR_OTHER_CONTINUOUS_LABOR) {
|
|||
|
|
// // 其他连续劳务报酬所得
|
|||
|
|
// Map<String, Object> paramMap = objRequestParam.computeIfAbsent("qtlxlwbc", k -> {
|
|||
|
|
// Map<String, Object> param = new HashMap<>();
|
|||
|
|
// param.put("qtlxlwbclb", Lists.newArrayList());
|
|||
|
|
// return param;
|
|||
|
|
// });
|
|||
|
|
// List<Map<String, Object>> employeeRequestParams = (List<Map<String, Object>>) paramMap.computeIfAbsent("qtlxlwbclb", k -> Lists.newArrayList());
|
|||
|
|
// employeeRequestParams.add(employeeRequestParam);
|
|||
|
|
// } else if (incomeCategoryEnum == IncomeCategoryEnum.REMUNERATION_FOR_OTHER_LABOR) {
|
|||
|
|
// // 其他非连续劳务报酬所得
|
|||
|
|
// List<Map<String, Object>> employeeRequestParams = listRequestParam.computeIfAbsent("qtflxlwbc", k -> Lists.newArrayList());
|
|||
|
|
// employeeRequestParams.add(employeeRequestParam);
|
|||
|
|
// } else if (incomeCategoryEnum == IncomeCategoryEnum.REMUNERATION_FOR_AUTHOR) {
|
|||
|
|
// // 稿酬所得
|
|||
|
|
// List<Map<String, Object>> employeeRequestParams = listRequestParam.computeIfAbsent("gcsdlb", k -> Lists.newArrayList());
|
|||
|
|
// employeeRequestParams.add(employeeRequestParam);
|
|||
|
|
// } else if (incomeCategoryEnum == IncomeCategoryEnum.ROYALTIES) {
|
|||
|
|
// // 特许权使用费所得
|
|||
|
|
// List<Map<String, Object>> employeeRequestParams = listRequestParam.computeIfAbsent("txq", k -> Lists.newArrayList());
|
|||
|
|
// employeeRequestParams.add(employeeRequestParam);
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
// }
|
|||
|
|
//
|
|||
|
|
// Map<String, Object> requestParam = Maps.newHashMap();
|
|||
|
|
// requestParam.putAll(objRequestParam);
|
|||
|
|
// requestParam.putAll(listRequestParam);
|
|||
|
|
// return requestParam;
|
|||
|
|
// }
|
|||
|
|
//
|
|||
|
|
// private static Map<String, Object> convert2RequestParam(IncomeCategoryEnum incomeCategoryEnum,
|
|||
|
|
// List<TaxReportColumnPO> taxReportColumns,
|
|||
|
|
// TaxDeclarationValuePO taxDeclarationValue,
|
|||
|
|
// EmployeeDeclarePO employeeDeclare) {
|
|||
|
|
// if (CollectionUtils.isEmpty(taxReportColumns)) {
|
|||
|
|
// return Collections.emptyMap();
|
|||
|
|
// }
|
|||
|
|
// Map<String, Object> requestParam = Maps.newHashMap();
|
|||
|
|
// // 姓名
|
|||
|
|
// requestParam.put("xm", employeeDeclare.getEmployeeName());
|
|||
|
|
// // 证件类型
|
|||
|
|
// requestParam.put("zzlx", CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel());
|
|||
|
|
// // 证件号码
|
|||
|
|
// requestParam.put("zzhm", employeeDeclare.getCardNum());
|
|||
|
|
// // 所得项目
|
|||
|
|
// requestParam.put("sdxm", incomeCategoryEnum.getDefaultLabel());
|
|||
|
|
// for (TaxReportColumnPO taxReportColumn : taxReportColumns) {
|
|||
|
|
// String value = taxDeclarationValue.getResultValue().getOrDefault(taxReportColumn.getReportColumnDataIndex(), StringUtils.EMPTY);
|
|||
|
|
// if (Objects.equals(taxReportColumn.getDataType(), SalaryDataTypeEnum.NUMBER.getValue())) {
|
|||
|
|
// value = Util.getBigDecimalValue(taxDeclarationValue.getResultValue().get(taxReportColumn.getReportColumnDataIndex()), BigDecimal.ZERO).toPlainString();
|
|||
|
|
// } else if (Objects.equals(taxReportColumn.getDataType(), "integer")) {
|
|||
|
|
// value = Util.getBigDecimalValue(taxDeclarationValue.getResultValue().get(taxReportColumn.getReportColumnDataIndex()), BigDecimal.ZERO).setScale(0, RoundingMode.HALF_UP).toPlainString();
|
|||
|
|
// }
|
|||
|
|
// requestParam.put(taxReportColumn.getRequestParamKey(), value);
|
|||
|
|
// }
|
|||
|
|
// return requestParam;
|
|||
|
|
// }
|
|||
|
|
//}
|