薪酬接口

This commit is contained in:
18895359881@163.com 2022-04-18 18:56:17 +08:00
parent a5b73098c9
commit 6fce8cdf4c
14 changed files with 1153 additions and 61 deletions

View File

@ -5,6 +5,7 @@ import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.salarysob.po.SalarySobPO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationDetailListDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationListDTO;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO;
@ -13,6 +14,8 @@ import com.engine.salary.entity.taxrate.TaxAgent;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.page.PageInfo;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import dm.jdbc.util.IdGenerator;
@ -54,17 +57,17 @@ public class TaxDeclarationBO {
.build()).collect(Collectors.toList());
}
/*public static void buildDetailListDTO(Long taxDeclarationId,
Page<TaxDeclarationDetailListDTO> page,
public static void buildDetailListDTO(Long taxDeclarationId,
PageInfo<TaxDeclarationDetailListDTO> page,
List<TaxDeclarationDetailPO> taxDeclarationDetails,
List<SimpleEmployee> simpleEmployees) {
List<DataCollectionEmployee> simpleEmployees) {
if (CollectionUtils.isEmpty(taxDeclarationDetails)) {
return;
}
int index = (int) ((page.getCurrent() - 1) * page.getSize());
int index = (page.getNextPage() - 1) * page.getSize();
List<TaxDeclarationDetailListDTO> dtos = Lists.newArrayListWithExpectedSize(simpleEmployees.size());
Map<Long, List<TaxDeclarationDetailPO>> taxDeclarationDetailMap = SalaryEntityUtil.group2Map(taxDeclarationDetails, TaxDeclarationDetailPO::getEmployeeId);
for (SimpleEmployee simpleEmployee : simpleEmployees) {
for (DataCollectionEmployee simpleEmployee : simpleEmployees) {
Map<String, String> valueMap = SalaryEntityUtil.convert2Map(taxDeclarationDetailMap.get(simpleEmployee.getEmployeeId()), TaxDeclarationDetailPO::getFieldCode, TaxDeclarationDetailPO::getFieldValue);
TaxDeclarationDetailListDTO dto = new TaxDeclarationDetailListDTO();
dto.setId(simpleEmployee.getEmployeeId());
@ -111,8 +114,8 @@ public class TaxDeclarationBO {
dto.setRefundedOrSupplementedTax(valueMap.getOrDefault("refundedOrSupplementedTax",""));
dtos.add(dto);
}
page.setRecords(dtos);
}*/
page.setList(dtos);
}
public static Result handle(TaxDeclarationSaveParam saveParam,
Date taxCycle,

View File

@ -0,0 +1,870 @@
package com.engine.salary.entity.taxdeclaration.bo;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.google.common.collect.Lists;
import java.util.List;
/**
* @description: 个税申报表明细的表头
* @author: xiajun
* @modified By: xiajun
* @date: Created in 12/15/21 11:31 AM
* @version:v1.0
*/
public class TaxDeclarationDetailListColumn {
private static final String COLUMN = " [\n" +
" {\n" +
" title: '序号',\n" +
" titleLabelId: 84162,\n" +
" dataIndex: 'seq_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '1',\n" +
" dataIndex: 'seq',\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '姓名',\n" +
" titleLabelId: 85429,\n" +
" dataIndex: 'employeeName_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '2',\n" +
" dataIndex: 'employeeName'\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '身份证件类型',\n" +
" titleLabelId: 102781,\n" +
" dataIndex: 'idCardType_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '3',\n" +
" dataIndex: 'idCardType'\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '身份证件号码',\n" +
" titleLabelId: 102782,\n" +
" dataIndex: 'idCardNo_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '4',\n" +
" dataIndex: 'idCardNo'\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '纳税人识别号',\n" +
" titleLabelId: 102783,\n" +
" dataIndex: 'taxpayerIdNo_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '5',\n" +
" dataIndex: 'taxpayerIdNo'\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '是否为非居民个人',\n" +
" titleLabelId: 102785,\n" +
" dataIndex: 'isPersonal_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '6',\n" +
" dataIndex: 'isPersonal'\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '所得项目',\n" +
" titleLabelId: 102786,\n" +
" dataIndex: 'incomeType_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '7',\n" +
" dataIndex: 'incomeType'\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '本月(次)情况',\n" +
" titleLabelId: 102787,\n" +
" dataIndex: 'condition_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" children : [\n" +
" {\n" +
" title: '收入额计算',\n" +
" titleLabelId: 102788,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'income_calc_p',\n" +
" children : [\n" +
" {\n" +
" title: '收入',\n" +
" titleLabelId: 96689,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'income_p',\n" +
" children : [\n" +
" {\n" +
" title: '8',\n" +
" dataIndex: 'income'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '费用',\n" +
" titleLabelId: 102789,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'fee_p',\n" +
" children : [\n" +
" {\n" +
" title: '9',\n" +
" dataIndex: 'fee'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '免税收入',\n" +
" titleLabelId: 102790,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'taxFreeIncome_p',\n" +
" children : [\n" +
" {\n" +
" title: '10',\n" +
" dataIndex: 'taxFreeIncome'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '减除费用',\n" +
" titleLabelId: 102791,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'subtraction_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '11',\n" +
" dataIndex: 'subtraction'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '专项扣除',\n" +
" titleLabelId: 85829,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'special_deduction_p',\n" +
" children : [\n" +
" {\n" +
" title: '基本养老保险费',\n" +
" titleLabelId: 102792,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'endowment_insurance_p',\n" +
" children : [\n" +
" {\n" +
" title: '12',\n" +
" dataIndex: 'endowmentInsurance'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '基本医疗保险费',\n" +
" titleLabelId: 102793,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'medical_insurance_p',\n" +
" children : [\n" +
" {\n" +
" title: '13',\n" +
" dataIndex: 'medicalInsurance'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '失业保险费',\n" +
" titleLabelId: 102794,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'unemployment_insurance_p',\n" +
" children : [\n" +
" {\n" +
" title: '14',\n" +
" dataIndex: 'unemploymentInsurance'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '住房公积金',\n" +
" titleLabelId: 102795,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'housing_fund_p',\n" +
" children : [\n" +
" {\n" +
" title: '15',\n" +
" dataIndex: 'housingProvidentFund'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '其他扣除',\n" +
" titleLabelId: 85831,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'other_deduction_p',\n" +
" children : [\n" +
" {\n" +
" title: '年金',\n" +
" titleLabelId: 102796,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'annuity_p',\n" +
" children : [\n" +
" {\n" +
" title: '16',\n" +
" dataIndex: 'annuity'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '商业健康保险',\n" +
" titleLabelId: 91238,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'commercial_health_insurance_p',\n" +
" children : [\n" +
" {\n" +
" title: '17',\n" +
" dataIndex: 'commercialHealthInsurance'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '税延养老保险',\n" +
" titleLabelId: 91239,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'tax_deferred_endowment_insurance_p',\n" +
" children : [\n" +
" {\n" +
" title: '18',\n" +
" dataIndex: 'taxDeferredEndowmentInsurance'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '财产原值',\n" +
" titleLabelId: 102797,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'originalValueOfProperty_p',\n" +
" children : [\n" +
" {\n" +
" title: '19',\n" +
" dataIndex: 'originalValueOfProperty'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '允许扣除的税费',\n" +
" titleLabelId: 102798,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'deductedTax_p',\n" +
" children : [\n" +
" {\n" +
" title: '20',\n" +
" dataIndex: 'deductedTax'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '其他',\n" +
" titleLabelId: 102799,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'other_p',\n" +
" children : [\n" +
" {\n" +
" title: '21',\n" +
" dataIndex: 'other'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
"\n" +
" {\n" +
" title: '累计情况(工资、薪金)',\n" +
" titleLabelId: 87521,\n" +
" dataIndex: 'cumsituation_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" children : [\n" +
" {\n" +
" title: '累计收入额',\n" +
" titleLabelId: 86712,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'addUpIncome_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '22',\n" +
" dataIndex: 'addUpIncome'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '累计减除费用',\n" +
" titleLabelId: 86711,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'addUpSubtraction_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '23',\n" +
" dataIndex: 'addUpSubtraction'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '累计专项扣除',\n" +
" titleLabelId: 102800,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'addUpSpecialDeduction_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '24',\n" +
" dataIndex: 'addUpSpecialDeduction'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
"\n" +
"\n" +
" {\n" +
" title: '累计专项附加扣除',\n" +
" titleLabelId: 85380,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'income_calc_p',\n" +
" children : [\n" +
" {\n" +
" title: '子女教育',\n" +
" titleLabelId: 102801,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'addUpChildEducation_p',\n" +
" children : [\n" +
" {\n" +
" title: '25',\n" +
" dataIndex: 'addUpChildEducation'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '赡养老人',\n" +
" titleLabelId: 102802,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'addUpSupportElderly_p',\n" +
" children : [\n" +
" {\n" +
" title: '26',\n" +
" dataIndex: 'addUpSupportElderly'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '住房贷款利息',\n" +
" titleLabelId: 102803,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'addUpHousingLoanInterest_p',\n" +
" children : [\n" +
" {\n" +
" title: '27',\n" +
" dataIndex: 'addUpHousingLoanInterest'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '住房租金',\n" +
" titleLabelId: 102804,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'addUpHousingRent_p',\n" +
" children : [\n" +
" {\n" +
" title: '28',\n" +
" dataIndex: 'addUpHousingRent'\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '继续教育',\n" +
" titleLabelId: 102805,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'addUpContinuingEducation_p',\n" +
" children : [\n" +
" {\n" +
" title: '29',\n" +
" dataIndex: 'addUpContinuingEducation'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '累计其他扣除',\n" +
" titleLabelId: 90569,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'addUpOther_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '30',\n" +
" dataIndex: 'addUpOther'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
"\n" +
" ]\n" +
" },\n" +
"\n" +
" {\n" +
" title: '减按计税比例',\n" +
" titleLabelId: 102806,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'lessTaxProportion_p',\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '31',\n" +
" dataIndex: 'lessTaxProportion'\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
"\n" +
" {\n" +
" title: '准予扣除的捐赠额',\n" +
" titleLabelId: 91240,\n" +
" dataIndex: 'allowedDonation_p',\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '32',\n" +
" dataIndex: 'allowedDonation'\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
"\n" +
" {\n" +
" title: '税款计算',\n" +
" titleLabelId: 102807,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'cumsituation_p',\n" +
" children : [\n" +
" {\n" +
" title: '应纳税所得额',\n" +
" titleLabelId: 96693,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'taxableIncome_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '33',\n" +
" dataIndex: 'taxableIncome'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '税率/预扣率',\n" +
" titleLabelId: 102808,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'taxRate_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '34',\n" +
" dataIndex: 'taxRate'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '速算扣除数',\n" +
" titleLabelId: 84228,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'quickDeductionFactor_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '35',\n" +
" dataIndex: 'quickDeductionFactor'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '应纳税额',\n" +
" titleLabelId: 102809,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'taxPayable_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '36',\n" +
" dataIndex: 'taxPayable'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '减免税额',\n" +
" titleLabelId: 102810,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'taxSavings_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '37',\n" +
" dataIndex: 'taxSavings'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '已扣缴税额',\n" +
" titleLabelId: 102811,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'taxWithheld_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '38',\n" +
" dataIndex: 'taxWithheld'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" {\n" +
" title: '应补(退)税额',\n" +
" titleLabelId: 102812,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'refundedOrSupplementedTax_p',\n" +
" rowSpan : 2,\n" +
" children : [\n" +
" {\n" +
" className: \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '39',\n" +
" dataIndex: 'refundedOrSupplementedTax'\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
"\n" +
"\n" +
" {\n" +
" title: '备注',\n" +
" titleLabelId: 84961,\n" +
" ellipsis : false,\n" +
" newLine : true,\n" +
" dataIndex: 'description_p',\n" +
" rowSpan : 3,\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" className : \"weapp-salary-hide\",\n" +
" children : [\n" +
" {\n" +
" title: '40',\n" +
" dataIndex: 'description'\n" +
" }\n" +
" ]\n" +
" }\n" +
" ]\n" +
" },\n" +
" ]\n" +
" },\n" +
" ]";
/**
* 个税申报表导出的表头
*
* @return
*/
public static String[] listHeader() {
return new String[]{
SalaryI18nUtil.getI18nLabel(84162, "序号"),
SalaryI18nUtil.getI18nLabel(85429, "姓名"),
SalaryI18nUtil.getI18nLabel(102781, "身份证件类型"),
SalaryI18nUtil.getI18nLabel(102782, "身份证件号码"),
SalaryI18nUtil.getI18nLabel(102783, "纳税人识别号"),
SalaryI18nUtil.getI18nLabel(102785, "是否为非居民个人"),
SalaryI18nUtil.getI18nLabel(102786, "所得项目"),
SalaryI18nUtil.getI18nLabel(96689, "收入"),
SalaryI18nUtil.getI18nLabel(102789, "费用"),
SalaryI18nUtil.getI18nLabel(102790, "免税收入"),
SalaryI18nUtil.getI18nLabel(102791, "减除费用"),
SalaryI18nUtil.getI18nLabel(102792, "基本养老保险费"),
SalaryI18nUtil.getI18nLabel(102793, "基本医疗保险费"),
SalaryI18nUtil.getI18nLabel(102794, "失业保险费"),
SalaryI18nUtil.getI18nLabel(102795, "住房公积金"),
SalaryI18nUtil.getI18nLabel(102796, "年金"),
SalaryI18nUtil.getI18nLabel(91238, "商业健康保险"),
SalaryI18nUtil.getI18nLabel(91239, "税延养老保险"),
SalaryI18nUtil.getI18nLabel(102797, "财产原值"),
SalaryI18nUtil.getI18nLabel(102798, "允许扣除的税费"),
SalaryI18nUtil.getI18nLabel(102799, "其他"),
SalaryI18nUtil.getI18nLabel(86712, "累计收入额"),
SalaryI18nUtil.getI18nLabel(86711, "累计减除费用"),
SalaryI18nUtil.getI18nLabel(102800, "累计专项扣除"),
SalaryI18nUtil.getI18nLabel(102801, "子女教育"),
SalaryI18nUtil.getI18nLabel(102802, "赡养老人"),
SalaryI18nUtil.getI18nLabel(102803, "住房贷款利息"),
SalaryI18nUtil.getI18nLabel(102804, "住房租金"),
SalaryI18nUtil.getI18nLabel(102805, "继续教育"),
SalaryI18nUtil.getI18nLabel(90569, "累计其他扣除"),
SalaryI18nUtil.getI18nLabel(102806, "减按计税比例"),
SalaryI18nUtil.getI18nLabel(91240, "准予扣除的捐赠额"),
SalaryI18nUtil.getI18nLabel(96693, "应纳税所得额"),
SalaryI18nUtil.getI18nLabel(102808, "税率/预扣率"),
SalaryI18nUtil.getI18nLabel(84228, "速算扣除数"),
SalaryI18nUtil.getI18nLabel(102809, "应纳税额"),
SalaryI18nUtil.getI18nLabel(102810, "减免税额"),
SalaryI18nUtil.getI18nLabel(102811, "已扣缴税额"),
SalaryI18nUtil.getI18nLabel(102812, "应补(退)税额"),
SalaryI18nUtil.getI18nLabel(84961, "备注")};
}
/**
* 解析个税申报表的标头
*
* @return
*/
public static List<WeaTableColumn> listTableColumn() {
List<WeaTableColumn> weaTableColumns = Lists.newArrayList(JsonUtil.parseList(TaxDeclarationDetailListColumn.COLUMN, WeaTableColumn.class));
// for (WeaTableColumn weaTableColumn : weaTableColumns) {
// buildTitle(weaTableColumn);
// }
return weaTableColumns;
}
/**
* 个税申报表表头多语言
*
* @param weaTableColumn
*/
// private static void buildTitle(WeaTableColumn weaTableColumn) {
// weaTableColumn.setTitle(SalaryI18nUtil.getI18nLabel(weaTableColumn.getTitleLabelId(), weaTableColumn.getTitle()));
// if (CollectionUtils.isNotEmpty(weaTableColumn.getChildren())) {
// for (WeaTableColumnWapper weaTableColumnWapper : weaTableColumn.getChildren()) {
// buildTitle(weaTableColumnWapper);
// }
// }
// }
}

View File

@ -1,10 +1,7 @@
package com.engine.salary.entity.taxdeclaration.param;
import com.engine.salary.common.BaseQueryParam;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.*;
import java.time.YearMonth;

View File

@ -2,6 +2,8 @@ package com.engine.salary.mapper.taxdeclaration;
import com.engine.salary.entity.taxdeclaration.TaxDeclarationDetail;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO;
import com.engine.salary.util.page.PageInfo;
import com.fapiao.neon.model.in.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -73,4 +75,31 @@ public interface TaxDeclarationDetailMapper {
* @param taxDeclarationDetails
*/
void batchInsert(@Param("collection") Collection<TaxDeclarationDetailPO> taxDeclarationDetails);
/**
* 统计一共多少人员
*
* @param taxDeclarationId
* @param tenantKey
* @return
*/
int countEmployeeId(@Param("taxDeclarationId") Long taxDeclarationId);
/**
* 分页查询人员id
*
* @param page
* @param taxDeclarationId
* @param tenantKey
* @return
*/
PageInfo<Long> listEmployeeId(@Param("taxDeclarationId") Long taxDeclarationId);
/**
* 查询个税申报表明细
*
* @param page
* @param taxDeclarationId
* @param employeeIds
* @return
*/
List<TaxDeclarationDetailPO> listByTaxDeclarationIdAndEmployeeIds(Long taxDeclarationId, Collection<Long> employeeIds);
}

View File

@ -45,6 +45,22 @@
FROM hrsa_tax_declaration_detail t
WHERE id = #{id} AND delete_type = 0
</select>
<select id="countEmployeeId" resultType="int">
SELECT count(DISTINCT employee_id)
FROM hrsa_tax_declaration_detail
WHERE delete_type = 0
AND tax_declaration_id = #{taxDeclarationId}
</select>
<select id="listEmployeeId" resultType="long">
SELECT DISTINCT employee_id
FROM hrsa_tax_declaration_detail
WHERE delete_type = 0
AND tax_declaration_id = #{taxDeclarationId}
</select>
<select id="listByTaxDeclarationIdAndEmployeeIds"
resultType="com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO">
</select>
<!-- 插入全部字段 -->
<insert id="insert" parameterType="com.engine.salary.entity.taxdeclaration.TaxDeclarationDetail"

View File

@ -50,11 +50,11 @@
<include refid="baseColumns"/>
FROM hrsa_tax_declaration t
WHERE delete_type = 0
<if test="salaryMonths != null and salaryMonths.fromSalaryMonth != null">
AND salary_month <![CDATA[ >= ]]> #{salaryMonths.fromSalaryMonth}
<if test="salaryMonths != null and salaryMonths.fromDate != null">
AND salary_month <![CDATA[ >= ]]> #{salaryMonths.fromDate}
</if>
<if test="salaryMonths != null and salaryMonths.endSalaryMonth != null">
AND salary_month <![CDATA[ <= ]]> #{salaryMonths.endSalaryMonth}
<if test="salaryMonths != null and salaryMonths.endDate != null">
AND salary_month <![CDATA[ <= ]]> #{salaryMonths.endDate}
</if>
ORDER BY id DESC
</select>

View File

@ -1,5 +1,6 @@
package com.engine.salary.service;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationDetailListDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationWageListDTO;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationDetailListQueryParam;
@ -44,7 +45,7 @@ public interface TaxDeclarationDetailService {
* @param tenantKey 租户key
* @return
*/
// Page<TaxDeclarationDetailListDTO> listDtoPageByParam(TaxDeclarationDetailListQueryParam queryParam, String tenantKey);
PageInfo<TaxDeclarationDetailListDTO> listDtoPageByParam(TaxDeclarationDetailListQueryParam queryParam);
/**
* 根据列表查询条件查询个税申报列表明细劳务报酬所得

View File

@ -0,0 +1,23 @@
package com.engine.salary.service;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.Map;
/**
* @description: 个税申报表导出
* @author: xiajun
* @modified By: xiajun
* @date: Created in 1/4/22 4:09 PM
* @version:v1.0
*/
public interface TaxDeclarationExcelService {
/**
* 导出个税申报表
*
* @param taxDeclarationId
* @param tenantKey
*/
XSSFWorkbook exportTaxDeclaration(Long taxDeclarationId);
}

View File

@ -1,16 +1,34 @@
package com.engine.salary.service.impl;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.biz.EmployBiz;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationBO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationDetailListDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationWageListDTO;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationDetailListQueryParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationDetailMapper;
import com.engine.salary.service.SalaryEmployeeService;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.service.TaxDeclarationDetailService;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.fapiao.neon.model.in.Page;
import com.mzlion.core.lang.CollectionUtils;
import weaver.hrm.User;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import static com.engine.salary.entity.siaccount.param.DSTenantKeyThreadVar.tenantKey;
/**
* @description: 个税申报表明细
@ -21,10 +39,12 @@ import java.util.Collection;
*/
public class TaxDeclarationDetailServiceImpl extends Service implements TaxDeclarationDetailService {
@Resource
private TaxDeclarationDetailMapper taxDeclarationDetailMapper;
//@Resource
//private HrmCommonEmployeeService hrmCommonEmployeeService;
private TaxDeclarationDetailMapper getTaxDeclarationDetailMapper(User user) {
return MapperProxyFactory.getProxy(TaxDeclarationDetailMapper.class);
}
private SalaryEmployeeService getSalaryEmployeeService() {
return (SalaryEmployeeService) ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
/*@Override
public List<TaxDeclarationDetailPO> listByTaxDeclarationIdAndEmployeeIds(Long taxDeclarationId, Collection<Long> employeeIds, String tenantKey) {
@ -46,23 +66,26 @@ public class TaxDeclarationDetailServiceImpl extends Service implements TaxDecla
// 查询个税申报表明细中的人员分页
return taxDeclarationDetailMapper.listEmployeeId(page, queryParam.getTaxDeclarationId(), tenantKey);
}
*/
@Override
public Page<TaxDeclarationDetailListDTO> listDtoPageByParam(TaxDeclarationDetailListQueryParam queryParam, String tenantKey) {
public PageInfo<TaxDeclarationDetailListDTO> listDtoPageByParam(TaxDeclarationDetailListQueryParam queryParam) {
// 查询个税申报表明细的人员
Page<Long> employeeIdPage = listPage4EmployeeIdByParam(queryParam, tenantKey);
Page<TaxDeclarationDetailListDTO> dtoPage = new Page<>(employeeIdPage.getCurrent(), employeeIdPage.getSize(), employeeIdPage.getTotal(), employeeIdPage.isSearchCount());
if (CollectionUtils.isNotEmpty(employeeIdPage.getRecords())) {
PageInfo<Long> employeeIdPage = getTaxDeclarationDetailMapper(user).listEmployeeId(queryParam.getTaxDeclarationId());
PageInfo<TaxDeclarationDetailListDTO> dtoPage = new PageInfo<TaxDeclarationDetailListDTO>(TaxDeclarationDetailListDTO.class);
dtoPage.setPageNum(queryParam.getCurrent());
dtoPage.setPageSize(queryParam.getPageSize());
List<Long> list = employeeIdPage.getList();
if (CollectionUtils.isNotEmpty(list)) {
// 查询个税申报表明细
List<TaxDeclarationDetailPO> taxDeclarationDetailPOS = listByTaxDeclarationIdAndEmployeeIds(queryParam.getTaxDeclarationId(),
employeeIdPage.getRecords(), tenantKey);
// 查询人员信息
List<SimpleEmployee> simpleEmployees = hrmCommonEmployeeService.getEmployeeByIds(employeeIdPage.getRecords(), tenantKey);
List<TaxDeclarationDetailPO> taxDeclarationDetailPOS = listByTaxDeclarationIdAndEmployeeIds(queryParam.getTaxDeclarationId(), employeeIdPage.getList());
// 查询人员
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService().listByIds(employeeIdPage.getList());
// List<SimpleEmployee> simpleEmployees = hrmCommonEmployeeService.getEmployeeByIds(employeeIdPage.getRecords(), tenantKey);
// 转换成列表dto
TaxDeclarationBO.buildDetailListDTO(queryParam.getTaxDeclarationId(), dtoPage, taxDeclarationDetailPOS, simpleEmployees);
}
return dtoPage;
}*/
}
@Override
public PageInfo<TaxDeclarationLaborListDTO> listDtoPageByParam4Labor(TaxDeclarationDetailListQueryParam queryParam) {
@ -76,6 +99,19 @@ public class TaxDeclarationDetailServiceImpl extends Service implements TaxDecla
@Override
public void batchSave(Collection<TaxDeclarationDetailPO> taxDeclarationDetailPOS) {
taxDeclarationDetailMapper.batchInsert(taxDeclarationDetailPOS);
getTaxDeclarationDetailMapper(user).batchInsert(taxDeclarationDetailPOS);
}
public List<TaxDeclarationDetailPO> listByTaxDeclarationIdAndEmployeeIds(Long taxDeclarationId, Collection<Long> employeeIds) {
if (CollectionUtils.isEmpty(employeeIds)) {
return Collections.emptyList();
}
// return new LambdaQueryChainWrapper<>(taxDeclarationDetailMapper)
// .eq(TaxDeclarationDetailPO::getTenantKey, tenantKey)
// .eq(TaxDeclarationDetailPO::getDeleteType, 0)
// .eq(TaxDeclarationDetailPO::getTaxDeclarationId, taxDeclarationId)
// .in(TaxDeclarationDetailPO::getEmployeeId, employeeIds)
// .list();
return getTaxDeclarationDetailMapper(user).listByTaxDeclarationIdAndEmployeeIds(taxDeclarationId,employeeIds);
}
}

View File

@ -0,0 +1,78 @@
package com.engine.salary.service.impl;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationDetailListColumn;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationDetailListDTO;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationDetailListQueryParam;
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationDetailMapper;
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationMapper;
import com.engine.salary.service.TaxDeclarationDetailService;
import com.engine.salary.service.TaxDeclarationExcelService;
import com.engine.salary.service.TaxDeclarationService;
import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.excel.ExcelUtil;
import com.engine.salary.util.page.PageInfo;
import com.fapiao.neon.model.in.Page;
import com.google.common.collect.Lists;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.User;
import java.time.LocalDateTime;
import java.util.*;
/**
* @description: 个税申报表导出
* @author: xiajun
* @modified By: xiajun
* @date: Created in 1/4/22 4:17 PM
* @version:v1.0
*/
@Slf4j
public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclarationExcelService {
private TaxDeclarationDetailService getTaxDeclarationDetailService(User user) {
return (TaxDeclarationDetailService) ServiceUtil.getService(TaxDeclarationDetailServiceImpl.class, user);
}
private TaxDeclarationDetailMapper getTaxDeclarationDetailMapper(User user) {
return MapperProxyFactory.getProxy(TaxDeclarationDetailMapper.class);
}
@Override
public XSSFWorkbook exportTaxDeclaration(Long taxDeclarationId) {
// 1.工作簿名称
String sheetName = SalaryI18nUtil.getI18nLabel(85368, "个税申报表");
//表头字段
String[] headers = TaxDeclarationDetailListColumn.listHeader();
// 解析表头
List<WeaTableColumn> weaTableColumns = TaxDeclarationDetailListColumn.listTableColumn();
List<Object> headerList = new ArrayList<>(Arrays.asList(headers));
// 查询当前个税申报表一共有多少人员
int count = getTaxDeclarationDetailMapper(user).countEmployeeId(taxDeclarationId);
// 以1000个人员一页一共有多少页
int totalPages = (count % 1000 == 0) ? (count / 1000) : (count / 1000 + 1); //总页数
// excel导出的数据
List<List<Object>> rows = Lists.newArrayListWithExpectedSize(count);
rows.add(headerList);
for (int i = 0; i < totalPages; i++) {
TaxDeclarationDetailListQueryParam queryParam = new TaxDeclarationDetailListQueryParam().setTaxDeclarationId(taxDeclarationId);
queryParam.setCurrent(i);
queryParam.setPageSize(1000);
PageInfo<TaxDeclarationDetailListDTO> dtoPage = getTaxDeclarationDetailService(user).listDtoPageByParam(queryParam);
for (Object taxDeclarationDetailListDTO : dtoPage.getList()) {
List<Object> row = Lists.newArrayListWithExpectedSize(headerList.size());
Map<String, Object> map = JsonUtil.parseMap(taxDeclarationDetailListDTO, Object.class);
for (Object weaTableColumn : headerList) {
row.add(map.get(weaTableColumn));
}
rows.add(row);
}
}
return ExcelUtil.genWorkbookV2(rows, sheetName);
}
}

View File

@ -13,12 +13,10 @@ import com.engine.salary.mapper.TaxAgentMapper;
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationMapper;
import com.engine.salary.service.TaxDeclarationService;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.PageUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;

View File

@ -401,5 +401,18 @@ public class SalaryDateUtil {
return yearMonth.atEndOfMonth();
}
/**
* String转Date
* @param date
* @return
*/
public static Date stringToDate(String date) throws ParseException {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
Date parse = null;
if (date != null) {
parse = sdf.parse(date);
}
return parse;
}
}

View File

@ -6,14 +6,16 @@ import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationInfoDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationListDTO;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam;
import com.engine.salary.service.TaxDeclarationExcelService;
import com.engine.salary.service.TaxDeclarationService;
import com.engine.salary.service.impl.TaxDeclarationExcelServiceImpl;
import com.engine.salary.service.impl.TaxDeclarationServiceImpl;
import com.engine.salary.util.ResponseResult;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.wrapper.TaxDeclarationWrapper;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import weaver.general.BaseBean;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
@ -22,6 +24,11 @@ import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.*;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.StreamingOutput;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.ParseException;
public class TaxDeclarationController {
@ -35,6 +42,9 @@ public class TaxDeclarationController {
private TaxDeclarationWrapper getTaxDeclarationWrapper(User user) {
return ServiceUtil.getService(TaxDeclarationWrapper.class, user);
}
private TaxDeclarationExcelService getTaxDeclarationExcelService(User user) {
return (TaxDeclarationExcelService)ServiceUtil.getService(TaxDeclarationExcelServiceImpl.class, user);
}
/* private TaxDeclarationDetailWrapper getTaxDeclarationDetailWrapper(User user) {
return ServiceUtil.getService(TaxDeclarationDetailWrapper.class, user);
}*/
@ -44,10 +54,10 @@ public class TaxDeclarationController {
@POST
@Path("/listPage")
@Produces(MediaType.APPLICATION_JSON)
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody TaxDeclarationListQueryParam queryParam) {
public String list(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody TaxDeclarationListQueryParam queryParam) throws ParseException {
User user = HrmUserVarify.getUser(request, response);
queryParam.setFromSalaryMonth(SalaryDateUtil.String2YearMonth(queryParam.getFromSalaryMonthStr()));
queryParam.setEndSalaryMonth(SalaryDateUtil.String2YearMonth(queryParam.getEndSalaryMonthStr()));
queryParam.setFromSalaryMonth(SalaryDateUtil.String2YearMonth(queryParam.getFromSalaryMonthStr()==null?"":queryParam.getFromSalaryMonthStr()));
queryParam.setEndSalaryMonth(SalaryDateUtil.String2YearMonth(queryParam.getEndSalaryMonthStr()==null?"":queryParam.getEndSalaryMonthStr()));
return new ResponseResult<TaxDeclarationListQueryParam, PageInfo<TaxDeclarationListDTO>>().run(getTaxDeclarationWrapper(user)::listPage, queryParam);
}
@ -85,13 +95,27 @@ public class TaxDeclarationController {
return new ResponseResult<TaxDeclarationDetailListQueryParam, Long>().run(getTaxDeclarationDetailWrapper(user)::listPage, param);
}*/
// @PostMapping("/export")
// @ApiOperation("个税申报表相关信息")
// @WeaPermission
// public WeaResult<Map<String, Object>> exportTaxDeclaration(@RequestParam(value = "taxDeclarationId") Long taxDeclarationId) {
// Map<String, Object> map = taxDeclarationExcelService.exportTaxDeclaration(taxDeclarationId, TenantContext.getCurrentTenantKey());
// return WeaResult.success(map);
// }
//个税申报表相关信息
@GET
@Path("/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportTaxDeclaration(@Context HttpServletRequest request, @Context HttpServletResponse response,@QueryParam(value = "taxDeclarationId") Long taxDeclarationId) {
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getTaxDeclarationExcelService(user).exportTaxDeclaration(taxDeclarationId);
String fileName = "个税申报表";
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
StreamingOutput output = outputStream -> {
workbook.write(outputStream);
outputStream.flush();
};
response.setContentType("application/octet-stream");
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
}
}

View File

@ -27,14 +27,15 @@ import com.engine.salary.mapper.datacollection.AddUpSituationMapper;
import com.engine.salary.mapper.salaryacct.SalaryAcctRecordMapper;
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationMapper;
import com.engine.salary.service.*;
import com.engine.salary.service.impl.TaxAgentServiceImpl;
import com.engine.salary.service.impl.TaxDeclarationServiceImpl;
import com.engine.salary.service.impl.*;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.google.common.collect.Lists;
import com.google.j2objc.annotations.AutoreleasePool;
import com.weaverboot.frame.ioc.anno.fieldAnno.WeaAutowired;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
@ -54,6 +55,9 @@ import java.util.stream.Collectors;
@Component
public class TaxDeclarationWrapper extends Service {
public TaxDeclarationWrapper() {
}
private TaxDeclarationService getTaxDeclarationService(User user) {
return (TaxDeclarationService) ServiceUtil.getService(TaxDeclarationServiceImpl.class, user);
}
@ -69,11 +73,11 @@ public class TaxDeclarationWrapper extends Service {
return MapperProxyFactory.getProxy(SalaryAcctRecordMapper.class);
}
@Resource
private TaxAgentBiz taxAgentBiz;
// @Resource
private TaxAgentBiz taxAgentBiz = new TaxAgentBiz();
@Resource
private SalaryItemBiz salaryItemBiz;
@Resource
@WeaAutowired
private TaxDeclarationDetailService taxDeclarationDetailService;
@Resource
private SalaryAcctResultService salaryAcctResultService;
@ -107,8 +111,8 @@ public class TaxDeclarationWrapper extends Service {
List<DataCollectionEmployee> employeeComInfos = employBiz.getEmployeeByIdsAll(employeeIds);
// 查询个税扣缴义务人
Set<Long> taxAgentIds = SalaryEntityUtil.properties(list, TaxDeclarationPO::getTaxAgentId);
List<TaxAgent> taxAgentPOS = taxAgentBiz.listByIds(taxAgentIds);
//List<TaxAgent> taxAgentPOS = getTaxDeclarationService(user).countByTaxDeclarationId(taxAgentIds);
//List<TaxAgent> taxAgentPOS = new TaxAgentBiz().listByIds(taxAgentIds);
List<TaxAgent> taxAgentPOS = getTaxDeclarationService(user).countByTaxDeclarationId(taxAgentIds);
// 转换成列表dto
List<TaxDeclarationListDTO> taxDeclarationListDTOS = TaxDeclarationBO.convert2ListDTO(list, employeeComInfos, taxAgentPOS);
dtoPage.setList(taxDeclarationListDTOS);
@ -126,7 +130,7 @@ public class TaxDeclarationWrapper extends Service {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98877, "个税申报表不存在或已删除"));
}
// 查询个税扣缴义务人
TaxAgent taxAgent = taxAgentBiz.getById(id);
TaxAgent taxAgent = new TaxAgentBiz().getById(id);
// 转换成个税申报表详情dto
formDTO = TaxDeclarationFormDTO.builder()
.salaryMonth(SalaryDateUtil.localDate2YearMonth(taxDeclaration.getSalaryMonth()))
@ -139,7 +143,7 @@ public class TaxDeclarationWrapper extends Service {
// WeaForm weaForm = SalaryFormatUtil.<TaxDeclarationFormDTO>getInstance().buildForm(TaxDeclarationFormDTO.class, formDTO);
// 查询租户所有的个税扣缴义务人
Collection<TaxAgent> taxAgentListDTOS = taxAgentBiz.listAll();
Collection<TaxAgent> taxAgentListDTOS = new TaxAgentBiz().listAll();
// 表单中个税扣缴义务人的可选项
List<WeaFormOption> weaFormOptions = Lists.newArrayListWithExpectedSize(taxAgentListDTOS.size());
for (TaxAgent taxAgent : taxAgentListDTOS) {
@ -172,7 +176,7 @@ public class TaxDeclarationWrapper extends Service {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98877, "个税申报表不存在或已删除"));
}
// 查询个税扣缴义务人
TaxAgent taxAgentPO = taxAgentBiz.getById(taxDeclaration.getTaxAgentId());
TaxAgent taxAgentPO = new TaxAgentBiz().getById(taxDeclaration.getTaxAgentId());
return TaxDeclarationInfoDTO.builder()
.salaryMonth(SalaryDateUtil.localDate2YearMonth(taxDeclaration.getSalaryMonth()))
.taxAgentId(taxDeclaration.getTaxAgentId())
@ -223,7 +227,7 @@ public class TaxDeclarationWrapper extends Service {
}
// 查询薪资核算结果
Set<Long> salaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getId);
List<SalaryAcctResultPO> salaryAcctResultPOS = salaryAcctResultService.listBySalaryAcctRecordIds(salaryAcctRecordIds);
List<SalaryAcctResultPO> salaryAcctResultPOS = new SalaryAcctResultServiceImpl().listBySalaryAcctRecordIds(salaryAcctRecordIds);
// 无薪资核算结果不允许生成个税申报表
if (CollectionUtils.isEmpty(salaryAcctResultPOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98874, "{0}无申报数据")
@ -231,24 +235,24 @@ public class TaxDeclarationWrapper extends Service {
}
// 查询薪资账套
Set<Long> salarySobIds = SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getSalarySobId);
List<SalarySobPO> salarySobPOS = salarySobService.listByIds(salarySobIds);
List<SalarySobPO> salarySobPOS = new SalarySobServiceImpl().listByIds(salarySobIds);
//查询DataCollectionEmployee
//DataCollectionEmployee employeeId =
// 查询所有薪资项目
List<SalaryItemPO> salaryItemPOS = salaryItemBiz.listAll();
List<SalaryItemPO> salaryItemPOS = new SalaryItemBiz().listAll();
// 处理要保存的数据
TaxDeclarationBO.Result result = TaxDeclarationBO.handle(saveParam, taxCycle, salaryItemPOS, salarySobPOS,salaryAcctResultPOS);
// 保存个税申报表
if (CollectionUtils.isNotEmpty(result.getNeedInsertTaxDeclarations())) {
taxDeclarationMapper.batchInsert(result.getNeedInsertTaxDeclarations());
getTaxDeclarationMapper().batchInsert(result.getNeedInsertTaxDeclarations());
}
// 保存个税申报表明细
if (CollectionUtils.isNotEmpty(result.getNeedInsertTaxDeclarationDetails())) {
taxDeclarationDetailService.batchSave(result.getNeedInsertTaxDeclarationDetails());
new TaxDeclarationDetailServiceImpl().batchSave(result.getNeedInsertTaxDeclarationDetails());
}
// 保存累计情况
if (CollectionUtils.isNotEmpty(result.getNeedInsertAccumulatedSituations())) {
@ -256,10 +260,10 @@ public class TaxDeclarationWrapper extends Service {
// addUpSituationMapper.insertData(Lists.newArrayList(result.getNeedInsertAccumulatedSituations()));
}
// 更新薪资核算记录的状态
salaryAcctRecordService.updateStatusByIds(salaryAcctRecordIds, SalaryAcctRecordStatusEnum.DECLARED);
new SalaryAcctRecordServiceImpl().updateStatusByIds(salaryAcctRecordIds, SalaryAcctRecordStatusEnum.DECLARED);
// 查询个税扣缴义务人
Set<Long> taxAgentIds = SalaryEntityUtil.properties(result.getNeedInsertTaxDeclarations(), TaxDeclarationPO::getTaxAgentId);
List<TaxAgent> taxAgentPOS = taxAgentBiz.listByIds(taxAgentIds);
List<TaxAgent> taxAgentPOS = new TaxAgentBiz().listByIds(taxAgentIds);
Map<Long, String> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgentPOS, TaxAgent::getId, TaxAgent::getName);
// 记录日志
/*for (TaxDeclarationPO taxDeclarationPO : result.getNeedInsertTaxDeclarations()) {