Merge branch 'feature/艾志-正常申报补足年终奖人员' into custom/艾志工业-个税申报

This commit is contained in:
钱涛 2023-12-28 21:00:15 +08:00
commit 4e46d632e4
72 changed files with 2550 additions and 392 deletions

View File

@ -0,0 +1,10 @@
ALTER TABLE hrsa_tax_declaration_value add (
source number
);
/
ALTER TABLE declare_request_id add (
declare_request_id varchar2(100)
);
/

View File

@ -0,0 +1,3 @@
update hrsa_tax_declaration_value set source = 0;
/

View File

@ -0,0 +1,10 @@
ALTER TABLE hrsa_tax_declaration_value add (
source number
);
/
ALTER TABLE declare_request_id add (
declare_request_id varchar2(100)
);
/

View File

@ -0,0 +1,3 @@
update hrsa_tax_declaration_value set source = 0;
/

View File

@ -0,0 +1,10 @@
ALTER TABLE hrsa_tax_declaration_value add (
source number
);
/
ALTER TABLE declare_request_id add (
declare_request_id varchar2(100)
);
/

View File

@ -0,0 +1,3 @@
update hrsa_tax_declaration_value set source = 0;
/

View File

@ -0,0 +1,3 @@
ALTER TABLE hrsa_tax_declaration_value ADD COLUMN source int(0) NULL ;
ALTER TABLE hrsa_tax_declare_record ADD COLUMN declare_request_id varchar(100) NULL ;

View File

@ -0,0 +1 @@
update hrsa_tax_declaration_value set source = 0;

View File

@ -0,0 +1,9 @@
ALTER TABLE hrsa_tax_declaration_value add (
source number
)
/
ALTER TABLE declare_request_id add (
declare_request_id varchar2(100)
)
/

View File

@ -0,0 +1,2 @@
update hrsa_tax_declaration_value set source = 0;
/

View File

@ -1,3 +1,3 @@
ALTER TABLE hrsa_tax_declaration ADD COLUMN income_category int NOT NULL ;
ALTER TABLE hrsa_tax_declaration ADD COLUMN income_category int ;
ALTER TABLE hrsa_tax_declaration_detail ADD COLUMN employee_type int NOT NULL ;
ALTER TABLE hrsa_tax_declaration_detail ADD COLUMN employee_type int ;

View File

@ -0,0 +1,3 @@
ALTER TABLE hrsa_tax_declaration_value ADD COLUMN source int NULL ;
ALTER TABLE hrsa_salary_template ADD COLUMN declare_request_id varchar(200) NULL;

View File

@ -0,0 +1 @@
update hrsa_tax_declaration_value set source = 0;

View File

@ -0,0 +1,5 @@
ALTER TABLE hrsa_tax_declaration_value ADD source int NULL
GO
ALTER TABLE hrsa_tax_declare_record ADD declare_request_id varchar(100) NULL
GO

View File

@ -0,0 +1,2 @@
update hrsa_tax_declaration_value set source = 0
GO

View File

@ -0,0 +1,10 @@
ALTER TABLE hrsa_tax_declaration_value add (
source number
);
/
ALTER TABLE declare_request_id add (
declare_request_id varchar2(100)
);
/

View File

@ -0,0 +1,3 @@
update hrsa_tax_declaration_value set source = 0;
/

View File

@ -0,0 +1,46 @@
package com.engine.salary.entity.employeedeclare.bo;
import com.engine.salary.entity.employeedeclare.dto.EmployeeDeclareExcelDTO;
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
import com.engine.salary.enums.employeedeclare.CardTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryI18nUtil;
import org.apache.commons.lang3.StringUtils;
/**
* @author Harryxzy
* @ClassName EmployeeDeclareBO
* @date 2023/12/27 14:13
* @description
*/
public class EmployeeDeclareBO {
public static EmployeeDeclarePO convert2PO(EmployeeDeclareExcelDTO dto) {
if (dto == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "参数错误"));
}
EmployeeDeclarePO po = EmployeeDeclarePO.builder()
.jobNum(dto.getJobNum())
.employeeName(dto.getEmployeeName())
.cardType(dto.getCardType() == null ? null :CardTypeEnum.RESIDENT_IDENTITY_CARDS.getValue())
.cardNum(dto.getCardNum())
.employmentStatus(StringUtils.isBlank(dto.getEmploymentStatus()) ? null : new Integer(dto.getEmploymentStatus()))
.employmentType(StringUtils.isBlank(dto.getEmploymentType()) ? null : new Integer(dto.getEmploymentType()))
.employmentFirstYear(dto.getEmploymentFirstYear())
.mobile(dto.getMobile())
.employmentDate(StringUtils.isBlank(dto.getEmploymentDate()) ? null : SalaryDateUtil.stringToDate(dto.getEmploymentDate()) )
.dismissDate(StringUtils.isBlank(dto.getDismissDate()) ? null : SalaryDateUtil.stringToDate(dto.getDismissDate()))
.disability(dto.getDisability())
.disabilityCardNo(dto.getDisabilityCardNo())
.martyrDependents(dto.getMartyrDependents())
.martyrDependentsCardNo(dto.getMartyrDependentsCardNo())
.lonelyOld(dto.getLonelyOld())
.deductExpenses(dto.getDeductExpenses())
.gender(StringUtils.isBlank(dto.getGender()) ? null : new Integer(dto.getGender()))
.birthday(StringUtils.isBlank(dto.getBirthday()) ? null : SalaryDateUtil.stringToDate(dto.getBirthday()))
.build();
return po;
}
}

View File

@ -104,12 +104,33 @@ public class EmployeeDeclareExcelDTO {
@TableTitle(title = "任职受雇从业日期", dataIndex = "employmentDate", key = "employmentDate")
private String employmentDate;
// 入职年度就业情形
private String employmentFirstYear;
// 离职日期
@SalaryTableColumn(text = "离职日期", width = "10%", column = "dismissDate")
@TableTitle(title = "离职日期", dataIndex = "dismissDate", key = "dismissDate")
private String dismissDate;
// 是否残疾
private Integer disability;
// 残疾证号
private String disabilityCardNo;
// 是否孤老
private Integer lonelyOld;
// 是否是烈属
private Integer martyrDependents;
// 烈属证号
private String martyrDependentsCardNo;
// 是否扣除减除费用
private Integer deductExpenses;
// 申报状态
private DeclareStatusEnum declareStatus;

View File

@ -15,4 +15,14 @@ public class EmployeeDeclareImportParam extends EmployeeDeclareListQueryParam {
@ApiModelProperty("是否导出现有数据")
private String exportData;
//上传文件id
String imageId;
// 校验字段
private String checkType;
// 个税扣义务人id
private Long taxAgentId;
}

View File

@ -48,6 +48,7 @@ public class EmployeeDeclareListQueryParam extends BaseQueryParam {
// 员工姓名/编号
private String keyword;
private Long employeeId;
// 部门
private Collection<Long> departmentIds;

View File

@ -167,6 +167,8 @@ public class SalaryTemplateBO {
.id(String.valueOf(e.getSalaryItemId()))
.salaryItemId(String.valueOf(e.getSalaryItemId()))
.name(e.getName())
.salaryItemShowName(e.getName())
.originName(e.getName())
.sortedIndex(e.getSortedIndex())
.build()
);

View File

@ -14,11 +14,13 @@ import com.engine.salary.entity.taxdeclaration.po.TaxReportColumnPO;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
import com.engine.salary.enums.taxdeclaration.SourceEnum;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import dm.jdbc.util.IdGenerator;
import org.apache.commons.lang3.StringUtils;
import java.lang.reflect.Field;
import java.math.BigDecimal;
@ -41,11 +43,9 @@ public class TaxDeclarationCommon implements TaxDeclarationStrategy {
public TaxDeclarationGenerateResult generate(TaxDeclareContext taxDeclareContext, Long employeeId) {
Date now = new Date();
// 薪资核算结果按照薪资核算人员id聚合分类
Map<Long, List<SalaryAcctResultPO>> salaryAcctResultValueMap = SalaryEntityUtil.group2Map(
taxDeclareContext.getSalaryAcctResultValues(), SalaryAcctResultPO::getSalaryAcctEmpId);
Map<Long, List<SalaryAcctResultPO>> salaryAcctResultValueMap = SalaryEntityUtil.group2Map(taxDeclareContext.getSalaryAcctResultValues(), SalaryAcctResultPO::getSalaryAcctEmpId);
// 薪资核算人员按照人员id聚合分类
Map<Long, List<SalaryAcctEmployeePO>> employeeIdKeyMap = SalaryEntityUtil.group2Map(
taxDeclareContext.getSalaryAcctEmployees(), SalaryAcctEmployeePO::getEmployeeId);
Map<Long, List<SalaryAcctEmployeePO>> employeeIdKeyMap = SalaryEntityUtil.group2Map(taxDeclareContext.getSalaryAcctEmployees(), SalaryAcctEmployeePO::getEmployeeId);
List<TaxDeclarationValuePO> taxDeclarationValues = Lists.newArrayListWithExpectedSize(employeeIdKeyMap.size());
for (Map.Entry<Long, List<SalaryAcctEmployeePO>> employeeIdEntry : employeeIdKeyMap.entrySet()) {
@ -63,8 +63,7 @@ public class TaxDeclarationCommon implements TaxDeclarationStrategy {
SalarySobTaxReportRulePO salarySobTaxReportRule = taxDeclareContext.getSalarySobTaxReportRuleMap()
.get(lastSalaryAcctEmployee.getSalarySobId() + "-" + taxReportColumn.getReportColumnDataIndex());
List<SalaryAcctResultPO> salaryAcctResultValue = salaryAcctResultValueMap.get(lastSalaryAcctEmployee.getId());
String defaultValue = Objects.equals(taxReportColumn.getDataType(), SalaryDataTypeEnum.NUMBER.getValue()) ? "0" : "";
String value = defaultValue;
String value = "";
if (salarySobTaxReportRule != null && salaryAcctResultValue != null) {
value = salaryAcctResultValue.stream()
.filter(result -> result.getSalaryItemId().equals(salarySobTaxReportRule.getSalaryItemId()))
@ -72,6 +71,7 @@ public class TaxDeclarationCommon implements TaxDeclarationStrategy {
.orElse(new SalaryAcctResultPO())
.getResultValue();
}
value = StringUtils.isNotBlank(value) ? value : Objects.equals(taxReportColumn.getDataType(), SalaryDataTypeEnum.NUMBER.getValue()) ? "0.00" : "";
valueMap.put(taxReportColumn.getReportColumnDataIndex(), value);
}
TaxDeclarationValuePO taxDeclarationValue = TaxDeclarationValuePO.builder()
@ -86,6 +86,7 @@ public class TaxDeclarationCommon implements TaxDeclarationStrategy {
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.createTime(now)
.updateTime(now)
.source(SourceEnum.ACCT.getValue())
.build();
taxDeclarationValues.add(taxDeclarationValue);
}

View File

@ -2,11 +2,9 @@ package com.engine.salary.entity.taxdeclaration.bo;
import com.engine.salary.constant.TaxDeclarationDataIndexConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationAnnualListDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationEmployeeDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationLaborListDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationWageListDTO;
import com.engine.salary.entity.taxdeclaration.dto.*;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO;
import com.engine.salary.entity.taxdeclaration.po.TaxReportColumnPO;
import com.engine.salary.enums.salaryaccounting.EmployeeTypeEnum;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
@ -15,6 +13,7 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* 个税申报表详情
@ -177,4 +176,23 @@ public class TaxDeclarationDetailBO {
}
return taxDeclarationLaborListDTOS;
}
public static List<TaxDeclareRecordDetailFormDTO.TaxReportColumn> convert2ListTaxReportColumn(List<TaxReportColumnPO> pos) {
if (CollectionUtils.isEmpty(pos)) {
return Collections.emptyList();
}
List<TaxDeclareRecordDetailFormDTO.TaxReportColumn> collect = pos.stream().map(po -> {
TaxDeclareRecordDetailFormDTO.TaxReportColumn taxReportColumn = new TaxDeclareRecordDetailFormDTO.TaxReportColumn();
taxReportColumn.setReportColumnName(po.getReportColumnName());
taxReportColumn.setReportColumnDataIndex(po.getReportColumnDataIndex());
taxReportColumn.setTaxReportType(po.getTaxReportType());
taxReportColumn.setIncomeCategory(po.getIncomeCategory());
taxReportColumn.setDataType(po.getDataType());
return taxReportColumn;
}).collect(Collectors.toList());
return collect;
}
}

View File

@ -2,6 +2,7 @@ package com.engine.salary.entity.taxdeclaration.dto;
import com.engine.salary.annotation.TableTitle;
import com.engine.salary.enums.employeedeclare.DeclareStatusEnum;
import com.engine.salary.util.excel.ExcelHead;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
@ -32,18 +33,22 @@ public class AbnormalEmployeeListDTO {
//姓名")
@TableTitle(title = "姓名",dataIndex = "employeeName",key = "employeeName")
@ExcelHead(title = "姓名",dataIndex = "employeeName")
private String employeeName;
//工号")
@TableTitle(title = "工号",dataIndex = "jobNum",key = "jobNum")
@ExcelHead(title = "工号",dataIndex = "jobNum")
private String jobNum;
//证件类型")
@TableTitle(title = "证件类型",dataIndex = "cardType",key = "cardType")
@ExcelHead(title = "证件类型",dataIndex = "cardType")
private String cardType;
//证件号码")
@TableTitle(title = "证件号码",dataIndex = "cardNum",key = "cardNum")
@ExcelHead(title = "证件号码",dataIndex = "cardNum")
private String cardNum;
//报送状态")
@ -51,5 +56,6 @@ public class AbnormalEmployeeListDTO {
//报送状态")
@TableTitle(title = "报送状态",dataIndex = "declareStatusDesc",key = "declareStatusDesc")
@ExcelHead(title = "报送状态",dataIndex = "declareStatusDesc")
private String declareStatusDesc;
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.taxdeclaration.dto;
import com.engine.salary.annotation.TableTitle;
import com.engine.salary.util.excel.ExcelHead;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
@ -23,7 +24,8 @@ public class FailEmployeeListDTO {
private Long id;
//姓名
@TableTitle(title = "姓名",dataIndex = "employeeName",key = "employeeName")
@TableTitle(title = "姓名", dataIndex = "employeeName", key = "employeeName")
@ExcelHead(title = "姓名", dataIndex = "employeeName")
private String employeeName;
//个税扣缴义务人id
@ -31,18 +33,22 @@ public class FailEmployeeListDTO {
private Long taxAgentId;
//个税扣缴义务人名称
@TableTitle(title = "个税扣缴义务人名称",dataIndex = "taxAgentName",key = "taxAgentName")
@TableTitle(title = "个税扣缴义务人名称", dataIndex = "taxAgentName", key = "taxAgentName")
@ExcelHead(title = "个税扣缴义务人名称", dataIndex = "taxAgentName")
private String taxAgentName;
//证件号码
@TableTitle(title = "证件号码",dataIndex = "cardNum",key = "cardNum")
@TableTitle(title = "证件号码", dataIndex = "cardNum", key = "cardNum")
@ExcelHead(title = "证件号码", dataIndex = "cardNum")
private String cardNum;
//失败原因
@TableTitle(title = "失败原因",dataIndex = "errorMsg",key = "errorMsg")
@TableTitle(title = "失败原因", dataIndex = "errorMsg", key = "errorMsg")
@ExcelHead(title = "失败原因", dataIndex = "errorMsg")
private String errorMsg;
//所得项目
@TableTitle(title = "所得项目",dataIndex = "incomeCategory",key = "incomeCategory")
@TableTitle(title = "所得项目", dataIndex = "incomeCategory", key = "incomeCategory")
@ExcelHead(title = "所得项目", dataIndex = "incomeCategory")
private String incomeCategory;
}

View File

@ -2,6 +2,7 @@ package com.engine.salary.entity.taxdeclaration.dto;
import com.engine.salary.annotation.SalaryTableColumn;
import com.engine.salary.annotation.TableTitle;
import com.engine.salary.util.excel.ExcelHead;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
@ -31,59 +32,69 @@ public class TaxDeclarationAnnualListDTO {
text = "工号", width = "10%", column = "jobNum"
)
@TableTitle(title ="工号",dataIndex = "jobNum",key = "jobNum")
@ExcelHead(title ="工号",dataIndex = "jobNum")
private String jobNum;
@SalaryTableColumn(
text = "姓名", width = "10%", column = "username"
)
@TableTitle(title ="姓名",dataIndex = "username",key = "username")
@ExcelHead(title ="姓名",dataIndex = "username")
private String username;
@SalaryTableColumn(
text = "证件类型", width = "10%", column = "cardType"
)
@TableTitle(title ="证件类型",dataIndex = "cardType",key = "cardType")
@ExcelHead(title ="证件类型",dataIndex = "cardType")
private String cardType;
@SalaryTableColumn(
text = "证件号码", width = "10%", column = "cardNum"
)
@TableTitle(title ="证件号码",dataIndex = "cardNum",key = "cardNum")
@ExcelHead(title ="证件号码",dataIndex = "cardNum")
private String cardNum;
@SalaryTableColumn(
text = "全年一次性奖金额", width = "10%", column = "annualIncome"
)
@TableTitle(title ="全年一次性奖金额",dataIndex = "annualIncome",key = "annualIncome")
@ExcelHead(title ="全年一次性奖金额",dataIndex = "annualIncome")
private String annualIncome;
@SalaryTableColumn(
text = "免税收入", width = "10%", column = "annualTaxFreeIncome"
)
@TableTitle(title ="免税收入",dataIndex = "annualTaxFreeIncome",key = "annualTaxFreeIncome")
@ExcelHead(title ="免税收入",dataIndex = "annualTaxFreeIncome")
private String annualTaxFreeIncome;
@SalaryTableColumn(
text = "其他", width = "10%", column = "annualOther"
)
@TableTitle(title ="其他",dataIndex = "annualOther",key = "annualOther")
@ExcelHead(title ="其他",dataIndex = "annualOther")
private String annualOther;
@SalaryTableColumn(
text = "准予扣除的捐赠额", width = "10%", column = "annualDonateTax"
)
@TableTitle(title ="准予扣除的捐赠额",dataIndex = "annualDonateTax",key = "annualDonateTax")
@ExcelHead(title ="准予扣除的捐赠额",dataIndex = "annualDonateTax")
private String annualDonateTax;
@SalaryTableColumn(
text = "减免税额", width = "10%", column = "annualTaxSavings"
)
@TableTitle(title ="减免税额",dataIndex = "annualTaxSavings",key = "annualTaxSavings")
@ExcelHead(title ="减免税额",dataIndex = "annualTaxSavings")
private String annualTaxSavings;
@SalaryTableColumn(
text = "备注", width = "10%", column = "annualRemark"
)
@TableTitle(title ="备注",dataIndex = "annualRemark",key = "annualRemark")
@ExcelHead(title ="备注",dataIndex = "annualRemark")
private String annualRemark;
}

View File

@ -29,11 +29,11 @@ public class TaxDeclarationInfoDTO {
@ApiModelProperty("薪资所属月")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8")
private Date salaryMonth;
@ApiModelProperty("税款所属期")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8")
private Date taxCycle;
@ApiModelProperty("个税扣缴义务人id")

View File

@ -2,6 +2,7 @@ package com.engine.salary.entity.taxdeclaration.dto;
import com.engine.salary.annotation.SalaryTableColumn;
import com.engine.salary.annotation.TableTitle;
import com.engine.salary.util.excel.ExcelHead;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
@ -30,78 +31,91 @@ public class TaxDeclarationLaborListDTO {
@SalaryTableColumn(
text = "工号", width = "10%", column = "jobNum"
)
@TableTitle(title ="工号",dataIndex = "jobNum",key = "jobNum")
@TableTitle(title = "工号", dataIndex = "jobNum", key = "jobNum")
@ExcelHead(title = "工号", dataIndex = "jobNum")
private String jobNum;
@SalaryTableColumn(
text = "姓名", width = "10%", column = "username"
)
@TableTitle(title ="姓名",dataIndex = "username",key = "username")
@TableTitle(title = "姓名", dataIndex = "username", key = "username")
@ExcelHead(title = "姓名", dataIndex = "username")
private String username;
@SalaryTableColumn(
text = "证件类型", width = "10%", column = "cardType"
)
@TableTitle(title ="证件类型",dataIndex = "cardType",key = "cardType")
@TableTitle(title = "证件类型", dataIndex = "cardType", key = "cardType")
@ExcelHead(title = "证件类型", dataIndex = "cardType")
private String cardType;
@SalaryTableColumn(
text = "证件号码", width = "10%", column = "cardNum"
)
@TableTitle(title ="证件号码",dataIndex = "cardNum",key = "cardNum")
@TableTitle(title = "证件号码", dataIndex = "cardNum", key = "cardNum")
@ExcelHead(title = "证件号码", dataIndex = "cardNum")
private String cardNum;
@SalaryTableColumn(
text = "所得项目", width = "10%", column = "incomeItems"
)
@TableTitle(title ="所得项目",dataIndex = "incomeItems",key = "incomeItems")
@TableTitle(title = "所得项目", dataIndex = "incomeItems", key = "incomeItems")
@ExcelHead(title = "所得项目", dataIndex = "incomeItems")
private String incomeItems;
@SalaryTableColumn(
text = "劳务收入", width = "10%", column = "laborIncome"
)
@TableTitle(title ="劳务收入",dataIndex = "laborIncome",key = "laborIncome")
@TableTitle(title = "劳务收入", dataIndex = "laborIncome", key = "laborIncome")
@ExcelHead(title = "劳务收入", dataIndex = "laborIncome")
private String laborIncome;
@SalaryTableColumn(
text = "劳务免税收入", width = "10%", column = "laborTaxFreeIncome"
)
@TableTitle(title ="劳务免税收入",dataIndex = "laborTaxFreeIncome",key = "laborTaxFreeIncome")
@TableTitle(title = "劳务免税收入", dataIndex = "laborTaxFreeIncome", key = "laborTaxFreeIncome")
@ExcelHead(title = "劳务免税收入", dataIndex = "laborTaxFreeIncome")
private String laborTaxFreeIncome;
@SalaryTableColumn(
text = "商业健康保险", width = "10%", column = "commercialHealthInsurance"
)
@TableTitle(title ="商业健康保险",dataIndex = "commercialHealthInsurance",key = "commercialHealthInsurance")
@TableTitle(title = "商业健康保险", dataIndex = "commercialHealthInsurance", key = "commercialHealthInsurance")
@ExcelHead(title = "商业健康保险", dataIndex = "commercialHealthInsurance")
private String commercialHealthInsurance;
@SalaryTableColumn(
text = "税延养老保险", width = "10%", column = "taxDeferredEndowmentInsurance"
)
@TableTitle(title ="税延养老保险",dataIndex = "taxDeferredEndowmentInsurance",key = "taxDeferredEndowmentInsurance")
@TableTitle(title = "税延养老保险", dataIndex = "taxDeferredEndowmentInsurance", key = "taxDeferredEndowmentInsurance")
@ExcelHead(title = "税延养老保险", dataIndex = "taxDeferredEndowmentInsurance")
private String taxDeferredEndowmentInsurance;
@SalaryTableColumn(
text = "其他", width = "10%", column = "other"
)
@TableTitle(title ="其他",dataIndex = "other",key = "other")
@TableTitle(title = "其他", dataIndex = "other", key = "other")
@ExcelHead(title = "其他", dataIndex = "other")
private String other;
@SalaryTableColumn(
text = "准予扣除的捐赠额", width = "10%", column = "allowedDonation"
)
@TableTitle(title ="准予扣除的捐赠额",dataIndex = "allowedDonation",key = "allowedDonation")
@TableTitle(title = "准予扣除的捐赠额", dataIndex = "allowedDonation", key = "allowedDonation")
@ExcelHead(title = "准予扣除的捐赠额", dataIndex = "allowedDonation")
private String allowedDonation;
@SalaryTableColumn(
text = "减免税额", width = "10%", column = "taxDeduction"
)
@TableTitle(title ="减免税额",dataIndex = "taxDeduction",key = "taxDeduction")
@TableTitle(title = "减免税额", dataIndex = "taxDeduction", key = "taxDeduction")
@ExcelHead(title = "减免税额", dataIndex = "taxDeduction")
private String taxDeduction;
@SalaryTableColumn(
text = "备注", width = "10%", column = "description"
)
@TableTitle(title ="备注",dataIndex = "description",key = "description")
@TableTitle(title = "备注", dataIndex = "description", key = "description")
@ExcelHead(title = "备注", dataIndex = "description")
private String description;
}

View File

@ -4,6 +4,7 @@ import com.cloudstore.eccom.pc.table.WeaTableType;
import com.engine.salary.annotation.SalaryTable;
import com.engine.salary.annotation.SalaryTableColumn;
import com.engine.salary.annotation.TableTitle;
import com.engine.salary.util.excel.ExcelHead;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -35,101 +36,126 @@ public class TaxDeclarationWageListDTO {
@SalaryTableColumn(text = "工号", width = "10%", column = "jobNum")
@TableTitle(title = "工号", dataIndex = "jobNum", key = "jobNum")
@ExcelHead(title = "工号", dataIndex = "jobNum")
private String jobNum;
@SalaryTableColumn(text = "姓名", width = "10%", column = "username")
@TableTitle(title = "姓名", dataIndex = "username", key = "username")
@ExcelHead(title = "姓名", dataIndex = "username")
private String username;
@SalaryTableColumn(text = "证件类型", width = "10%", column = "cardType")
@TableTitle(title = "证件类型", dataIndex = "cardType", key = "cardType")
@ExcelHead(title = "证件类型", dataIndex = "cardType")
private String cardType;
@SalaryTableColumn(text = "证件号码", width = "10%", column = "cardNum")
@TableTitle(title = "证件号码", dataIndex = "cardNum", key = "cardNum")
@ExcelHead(title = "证件号码", dataIndex = "cardNum")
private String cardNum;
@SalaryTableColumn(text = "本期收入", width = "10%", column = "income")
@TableTitle(title = "本期收入", dataIndex = "income", key = "income")
@ExcelHead(title = "本期收入", dataIndex = "income")
private String income;
@SalaryTableColumn(text = "本期免税收入", width = "10%", column = "taxFreeIncome")
@TableTitle(title = "本期免税收入", dataIndex = "taxFreeIncome", key = "taxFreeIncome")
@ExcelHead(title = "本期免税收入", dataIndex = "taxFreeIncome")
private String taxFreeIncome;
@SalaryTableColumn(text = "基本养老保险费", width = "10%", column = "endowmentInsurance")
@TableTitle(title = "基本养老保险费", dataIndex = "endowmentInsurance", key = "endowmentInsurance")
@ExcelHead(title = "基本养老保险费", dataIndex = "endowmentInsurance")
private String endowmentInsurance;
@SalaryTableColumn(text = "基本医疗保险费", width = "10%", column = "medicalInsurance")
@TableTitle(title = "基本医疗保险费", dataIndex = "medicalInsurance", key = "medicalInsurance")
@ExcelHead(title = "基本医疗保险费", dataIndex = "medicalInsurance")
private String medicalInsurance;
@SalaryTableColumn(text = "失业保险费", width = "10%", column = "unemploymentInsurance")
@TableTitle(title = "失业保险费", dataIndex = "unemploymentInsurance", key = "unemploymentInsurance")
@ExcelHead(title = "失业保险费", dataIndex = "unemploymentInsurance")
private String unemploymentInsurance;
@SalaryTableColumn(text = "住房公积金", width = "10%", column = "housingProvidentFund")
@TableTitle(title = "住房公积金", dataIndex = "housingProvidentFund", key = "housingProvidentFund")
@ExcelHead(title = "住房公积金", dataIndex = "housingProvidentFund")
private String housingProvidentFund;
@SalaryTableColumn(text = "累计子女教育", width = "10%", column = "addUpChildEducation")
@TableTitle(title = "累计子女教育", dataIndex = "addUpChildEducation", key = "addUpChildEducation")
@ExcelHead(title = "累计子女教育", dataIndex = "addUpChildEducation")
private String addUpChildEducation;
@SalaryTableColumn(text = "累计住房贷款利息", width = "10%", column = "addUpHousingLoanInterest")
@TableTitle(title = "累计住房贷款利息", dataIndex = "addUpHousingLoanInterest", key = "addUpHousingLoanInterest")
@ExcelHead(title = "累计住房贷款利息", dataIndex = "addUpHousingLoanInterest")
private String addUpHousingLoanInterest;
@SalaryTableColumn(text = "累计住房租金", width = "10%", column = "addUpHousingRent")
@TableTitle(title = "累计住房租金", dataIndex = "addUpHousingRent", key = "addUpHousingRent")
@ExcelHead(title = "累计住房租金", dataIndex = "addUpHousingRent")
private String addUpHousingRent;
@SalaryTableColumn(text = "累计继续教育", width = "10%", column = "addUpContinuingEducation")
@TableTitle(title = "累计继续教育", dataIndex = "addUpContinuingEducation", key = "addUpContinuingEducation")
@ExcelHead(title = "累计继续教育", dataIndex = "addUpContinuingEducation")
private String addUpContinuingEducation;
@SalaryTableColumn(text = "累计赡养老人", width = "10%", column = "addUpSupportElderly")
@TableTitle(title = "累计赡养老人", dataIndex = "addUpSupportElderly", key = "addUpSupportElderly")
@ExcelHead(title = "累计赡养老人", dataIndex = "addUpSupportElderly")
private String addUpSupportElderly;
@SalaryTableColumn(text = "累计大病医疗", width = "10%", column = "addUpIllnessMedical")
@TableTitle(title = "累计大病医疗", dataIndex = "addUpIllnessMedical", key = "addUpIllnessMedical")
@ExcelHead(title = "累计大病医疗", dataIndex = "addUpIllnessMedical")
private String addUpIllnessMedical;
@SalaryTableColumn(text = "累计3岁以下婴幼儿照护", width = "10%", column = "addUpInfantCare")
@TableTitle(title = "累计3岁以下婴幼儿照护", dataIndex = "addUpInfantCare", key = "addUpInfantCare")
@ExcelHead(title = "累计3岁以下婴幼儿照护", dataIndex = "addUpInfantCare")
private String addUpInfantCare;
@SalaryTableColumn(text = "累计个人养老金", width = "10%", column = "addUpPrivatePension")
@TableTitle(title = "累计个人养老金", dataIndex = "addUpPrivatePension", key = "addUpPrivatePension")
@ExcelHead(title = "累计个人养老金", dataIndex = "addUpPrivatePension")
private String addUpPrivatePension;
@SalaryTableColumn(text = "企业(职业)年金", width = "10%", column = "annuity")
@TableTitle(title = "企业(职业)年金", dataIndex = "annuity", key = "annuity")
@ExcelHead(title = "企业(职业)年金", dataIndex = "annuity")
private String annuity;
@SalaryTableColumn(text = "商业健康保险", width = "10%", column = "commercialHealthInsurance")
@TableTitle(title = "商业健康保险", dataIndex = "commercialHealthInsurance", key = "commercialHealthInsurance")
@ExcelHead(title = "商业健康保险", dataIndex = "commercialHealthInsurance")
private String commercialHealthInsurance;
@SalaryTableColumn(text = "税延养老保险", width = "10%", column = "taxDeferredEndowmentInsurance")
@TableTitle(title = "税延养老保险", dataIndex = "taxDeferredEndowmentInsurance", key = "taxDeferredEndowmentInsurance")
@ExcelHead(title = "税延养老保险", dataIndex = "taxDeferredEndowmentInsurance")
private String taxDeferredEndowmentInsurance;
@SalaryTableColumn(text = "其他", width = "10%", column = "other")
@TableTitle(title = "其他", dataIndex = "other", key = "other")
@ExcelHead(title = "其他", dataIndex = "other")
private String other;
@SalaryTableColumn(text = "准予扣除的捐赠额", width = "10%", column = "allowedDonation")
@TableTitle(title = "准予扣除的捐赠额", dataIndex = "allowedDonation", key = "allowedDonation")
@ExcelHead(title = "准予扣除的捐赠额", dataIndex = "allowedDonation")
private String allowedDonation;
@SalaryTableColumn(text = "减免税额", width = "10%", column = "taxDeduction")
@TableTitle(title = "减免税额", dataIndex = "taxDeduction", key = "taxDeduction")
@ExcelHead(title = "减免税额", dataIndex = "taxDeduction")
private String taxDeduction;
@SalaryTableColumn(text = "备注", width = "10%", column = "description")
@TableTitle(title = "备注", dataIndex = "description", key = "description")
@ExcelHead(title = "备注", dataIndex = "description")
private String description;
}

View File

@ -0,0 +1,87 @@
package com.engine.salary.entity.taxdeclaration.dto;
import com.engine.salary.annotation.TableTitle;
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
import java.util.Map;
/**
* 个税申报明细新增表单
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class TaxDeclareRecordDetailFormDTO {
/**
* 个税申报表id
*/
private Long taxDeclarationId;
//主键id
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
//人员id
@JsonSerialize(using = ToStringSerializer.class)
private Long employeeId;
private Integer employeeType;
@TableTitle(title = "工号", dataIndex = "jobNum", key = "jobNum")
private String jobNum;
@TableTitle(title = "姓名", dataIndex = "username", key = "username")
private String username;
@TableTitle(title = "证件类型", dataIndex = "cardType", key = "cardType")
private String cardType;
@TableTitle(title = "证件号码", dataIndex = "cardNum", key = "cardNum")
private String cardNum;
/**
* 收入所得项目
*/
private String incomeCategory;
/**
* 人员报送下拉选择
*/
private List<EmployeeDeclarePO> employeeDeclares;
/**
* 当前申报类型可编辑字段
*/
private List<TaxReportColumn> taxReportColumns;
private Map<String, String> resultValue;
@Data
@NoArgsConstructor
@AllArgsConstructor
public static class TaxReportColumn {
//报表类型
private String taxReportType;
//所得项目
private String incomeCategory;
//申报表列索引
private String reportColumnDataIndex ;
//申报表的列名
private String reportColumnName;
//数值类型
private String dataType;
}
}

View File

@ -0,0 +1,18 @@
package com.engine.salary.entity.taxdeclaration.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
public class DeclareTaxResultFeedbackQueryParam {
Long id;
String requestId;
}

View File

@ -0,0 +1,26 @@
package com.engine.salary.entity.taxdeclaration.param;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class DownloadTemplateParam {
/**
* 申报表id下载模板
*/
@DataCheck(require = true,message = "imageId为空")
Long taxDeclarationId;
/**
* 导入文件id
*/
String imageId;
}

View File

@ -0,0 +1,21 @@
package com.engine.salary.entity.taxdeclaration.param;
import lombok.Data;
/**
* 个税申报明细保存
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
public class TaxDeclareRecordDetailFormParam {
/**
* 个税申报表id
*/
private Long taxDeclarationId;
}

View File

@ -0,0 +1,34 @@
package com.engine.salary.entity.taxdeclaration.param;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
import java.util.Map;
/**
* 个税申报明细保存
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
public class TaxDeclareRecordDetailSaveParam {
//主键id
@JsonSerialize(using = ToStringSerializer.class)
private Long id;
//个税申报表id
private Long taxDeclarationId;
//人员id
@JsonSerialize(using = ToStringSerializer.class)
private Long employeeId;
private Integer employeeType;
private Map<String,String> taxReportColumnValues;
}

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.taxdeclaration.po;
import com.engine.salary.annotation.Encrypt;
import com.engine.salary.enums.taxdeclaration.SourceEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -88,6 +89,12 @@ public class TaxDeclarationValuePO implements Serializable {
*/
private Date updateTime;
/**
* 数据来源
* @see SourceEnum
*/
private Integer source;
private Collection<Long> ids;
private Collection<Long> taxDeclarationIds;

View File

@ -1,5 +1,6 @@
package com.engine.salary.entity.taxdeclaration.po;
import com.engine.salary.enums.taxdeclaration.TaxDeclareStatusEnum;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -50,6 +51,7 @@ public class TaxDeclareRecordPO implements Serializable {
private Integer taxDeclareType;
/**
* 申报状态
* @see TaxDeclareStatusEnum
*/
private Integer taxDeclareStatus;
/**
@ -60,6 +62,10 @@ public class TaxDeclareRecordPO implements Serializable {
* 请求的requestId
*/
private String requestId;
/**
* 申报的requestId用于下载申报过程
*/
private String declareRequestId;
/**
* 备注
*/

View File

@ -20,34 +20,34 @@ import java.util.Date;
@Builder
@AllArgsConstructor
@NoArgsConstructor
//hrsa_tax_report_column")
//hrsa_tax_report_column
public class TaxReportColumnPO {
//name = "主键id")
//name = 主键id
private Long id;
//name = "报表类型")
//name = 报表类型
private String taxReportType;
//name = "所得项目")
//name = 所得项目
private String incomeCategory;
//name = "申报表的列名")
//name = 申报表的列名
private String reportColumnName;
//name = "申报表的列名多语言标签")
//name = 申报表的列名多语言标签
private Integer reportColumnLabel;
//name = "申报表的列索引")
//name = 申报表的列索引
private String reportColumnDataIndex;
//name = "数值类型")
//name = 数值类型
private String dataType;
//name = "个税对接时的参数key")
//name = 个税对接时的参数key
private String requestParamKey;
//name = "租户key", ignore = true)
//name = 租户key
private String tenantKey;
//name = "创建人id", ignore = true)
//name = 创建人id
private Long creator;
//name = "是否删除", ignore = true)
//name = 是否删除
private Integer deleteType;
//name = "创建时间", ignore = true)
//name = 创建时间
private Date createTime;
//name = "更新时间", ignore = true)
//name = 更新时间
private Date updateTime;
Collection<Long> ids;

View File

@ -2,6 +2,8 @@ package com.engine.salary.enums.employeedeclare;
import com.engine.salary.enums.BaseEnum;
import java.util.Arrays;
/**
* 人员状态
* <p>Copyright: Copyright (c) 2023</p>
@ -41,4 +43,17 @@ public enum EmploymentStatusEnum implements BaseEnum<Integer> {
public Integer getLabelId() {
return labelId;
}
public static Integer getValueByDefaultLabel(String defaultLabel) {
if (defaultLabel == null) {
return null;
}
EmploymentStatusEnum[] enumAry = EmploymentStatusEnum.values();
for(int i = 0; i < Arrays.asList(enumAry).size(); i++){
if (enumAry[i].getDefaultLabel().equals(defaultLabel)) {
return enumAry[i].getValue();
}
}
return null;
}
}

View File

@ -2,6 +2,8 @@ package com.engine.salary.enums.employeedeclare;
import com.engine.salary.enums.BaseEnum;
import java.util.Arrays;
/**
* 任职受雇从业类型
* <p>Copyright: Copyright (c) 2023</p>
@ -44,4 +46,17 @@ public enum EmploymentTypeEnum implements BaseEnum<Integer> {
public Integer getLabelId() {
return labelId;
}
public static Integer getValueByDefaultLabel(String defaultLabel) {
if (defaultLabel == null) {
return null;
}
EmploymentTypeEnum[] enumAry = EmploymentTypeEnum.values();
for(int i = 0; i < Arrays.asList(enumAry).size(); i++){
if (enumAry[i].getDefaultLabel().equals(defaultLabel)) {
return enumAry[i].getValue();
}
}
return null;
}
}

View File

@ -2,6 +2,8 @@ package com.engine.salary.enums.employeedeclare;
import com.engine.salary.enums.BaseEnum;
import java.util.Arrays;
/**
* 性别
* <p>Copyright: Copyright (c) 2023</p>
@ -41,4 +43,17 @@ public enum GenderEnum implements BaseEnum<Integer> {
public Integer getLabelId() {
return labelId;
}
public static Integer getValueByDefaultLabel(String defaultLabel) {
if (defaultLabel == null) {
return null;
}
GenderEnum[] enumAry = GenderEnum.values();
for(int i = 0; i < Arrays.asList(enumAry).size(); i++){
if (enumAry[i].getDefaultLabel().equals(defaultLabel)) {
return enumAry[i].getValue();
}
}
return null;
}
}

View File

@ -1,13 +1,12 @@
package com.engine.salary.enums.salarysob;
import com.engine.salary.enums.BaseEnum;
import com.engine.salary.remote.tax.response.employee.GetDeclareTaxResultFeedbackResponse;
import com.engine.salary.util.excel.ExcelUtil;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.*;
/**
* 应税项目
@ -20,19 +19,123 @@ import java.util.Objects;
public enum IncomeCategoryEnum implements BaseEnum<Integer> {
// todo 多语言
WAGES_AND_SALARIES(1, "0101", "正常工资薪金", 160487),
REMUNERATION_FOR_LABOR(4, "0400", "一般劳务报酬所得", 160488),
ONETIME_ANNUAL_BONUS(2, "0103", "全年一次性奖金收入", 160489),
COMPENSATION_FOR_RETIRE(107, "0107", "内退一次性补偿金", 181936),
COMPENSATION_FOR_DISMISS(108, "0108", "解除劳动合同一次性补偿金", 181937),
INCOME_FOR_INDIVIDUAL_EQUITY_INCENTIVE(109, "0109", "个人股权激励收入", 181938),
ANNUITY_RECEIPT(110, "0110", "年金领取", 181939),
INCOME_FOR_INSURANCE_SALESMAN(402, "0402", "保险营销员佣金收入", 181940),
INCOME_FOR_SECURITIES_BROKER(403, "0403", "证券经纪人佣金收入", 181942),
REMUNERATION_FOR_OTHER_CONTINUOUS_LABOR(489, "0489", "其他连续劳务报酬所得", 181943),
REMUNERATION_FOR_OTHER_LABOR(499, "0499", "其他非连续劳务报酬所得", 175330),
REMUNERATION_FOR_AUTHOR(500, "0500", "稿酬所得", 181944),
ROYALTIES(600, "0600", "特许权使用费所得", 181945),
WAGES_AND_SALARIES(1, "0101", "正常工资薪金", 160487) {
@Override
public Map<String, List<List<Object>>> parseGetDeclareTaxResultFeedbackResponse(Map<String, List<List<Object>>> result, GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse) {
List<GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw> zhsd = declareTaxResultFeedbackResponse.getBody().getZhsd().getZcgzxj().getSscglb();
List<List<Object>> zhsdSheetData = ExcelUtil.getExcelSheetData(GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw.class, zhsd);
result.put(this.getDefaultLabel(), zhsdSheetData);
return result;
}
},
REMUNERATION_FOR_LABOR(4, "0400", "一般劳务报酬所得", 160488) {
@Override
public Map<String, List<List<Object>>> parseGetDeclareTaxResultFeedbackResponse(Map<String, List<List<Object>>> result, GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse) {
List<GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw> zhsd = declareTaxResultFeedbackResponse.getBody().getZhsd().getLwbclb().getSscglb();
List<List<Object>> zhsdSheetData = ExcelUtil.getExcelSheetData(GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw.class, zhsd);
result.put(this.getDefaultLabel(), zhsdSheetData);
return result;
}
},
ONETIME_ANNUAL_BONUS(2, "0103", "全年一次性奖金收入", 160489) {
@Override
public Map<String, List<List<Object>>> parseGetDeclareTaxResultFeedbackResponse(Map<String, List<List<Object>>> result, GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse) {
List<GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw> zhsd = declareTaxResultFeedbackResponse.getBody().getZhsd().getQnycxjjsslb().getSscglb();
List<List<Object>> zhsdSheetData = ExcelUtil.getExcelSheetData(GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw.class, zhsd);
result.put(this.getDefaultLabel(), zhsdSheetData);
return result;
}
},
COMPENSATION_FOR_RETIRE(107, "0107", "内退一次性补偿金", 181936) {
@Override
public Map<String, List<List<Object>>> parseGetDeclareTaxResultFeedbackResponse(Map<String, List<List<Object>>> result, GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse) {
List<GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw> zhsd = declareTaxResultFeedbackResponse.getBody().getZhsd().getNtycxbcjlb().getSscglb();
List<List<Object>> zhsdSheetData = ExcelUtil.getExcelSheetData(GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw.class, zhsd);
result.put(this.getDefaultLabel(), zhsdSheetData);
return result;
}
},
COMPENSATION_FOR_DISMISS(108, "0108", "解除劳动合同一次性补偿金", 181937) {
@Override
public Map<String, List<List<Object>>> parseGetDeclareTaxResultFeedbackResponse(Map<String, List<List<Object>>> result, GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse) {
List<GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw> zhsd = declareTaxResultFeedbackResponse.getBody().getZhsd().getJcldhtycxbcjlb().getSscglb();
List<List<Object>> zhsdSheetData = ExcelUtil.getExcelSheetData(GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw.class, zhsd);
result.put(this.getDefaultLabel(), zhsdSheetData);
return result;
}
},
INCOME_FOR_INDIVIDUAL_EQUITY_INCENTIVE(109, "0109", "个人股权激励收入", 181938) {
@Override
public Map<String, List<List<Object>>> parseGetDeclareTaxResultFeedbackResponse(Map<String, List<List<Object>>> result, GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse) {
List<GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw> zhsd = declareTaxResultFeedbackResponse.getBody().getZhsd().getGrgqjl().getSscglb();
List<List<Object>> zhsdSheetData = ExcelUtil.getExcelSheetData(GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw.class, zhsd);
result.put(this.getDefaultLabel(), zhsdSheetData);
return result;
}
},
ANNUITY_RECEIPT(110, "0110", "年金领取", 181939) {
@Override
public Map<String, List<List<Object>>> parseGetDeclareTaxResultFeedbackResponse(Map<String, List<List<Object>>> result, GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse) {
List<GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw> zhsd = declareTaxResultFeedbackResponse.getBody().getZhsd().getQynj().getSscglb();
List<List<Object>> zhsdSheetData = ExcelUtil.getExcelSheetData(GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw.class, zhsd);
result.put(this.getDefaultLabel(), zhsdSheetData);
return result;
}
},
INCOME_FOR_INSURANCE_SALESMAN(402, "0402", "保险营销员佣金收入", 181940) {
@Override
public Map<String, List<List<Object>>> parseGetDeclareTaxResultFeedbackResponse(Map<String, List<List<Object>>> result, GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse) {
List<GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw> zhsd = declareTaxResultFeedbackResponse.getBody().getZhsd().getBxyxy().getSscglb();
List<List<Object>> zhsdSheetData = ExcelUtil.getExcelSheetData(GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw.class, zhsd);
result.put(this.getDefaultLabel(), zhsdSheetData);
return result;
}
},
INCOME_FOR_SECURITIES_BROKER(403, "0403", "证券经纪人佣金收入", 181942) {
@Override
public Map<String, List<List<Object>>> parseGetDeclareTaxResultFeedbackResponse(Map<String, List<List<Object>>> result, GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse) {
List<GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw> zhsd = declareTaxResultFeedbackResponse.getBody().getZhsd().getZqjjr().getSscglb();
List<List<Object>> zhsdSheetData = ExcelUtil.getExcelSheetData(GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw.class, zhsd);
result.put(this.getDefaultLabel(), zhsdSheetData);
return result;
}
},
REMUNERATION_FOR_OTHER_CONTINUOUS_LABOR(489, "0489", "其他连续劳务报酬所得", 181943) {
@Override
public Map<String, List<List<Object>>> parseGetDeclareTaxResultFeedbackResponse(Map<String, List<List<Object>>> result, GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse) {
List<GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw> zhsd = declareTaxResultFeedbackResponse.getBody().getZhsd().getQtlxlwbc().getSscglb();
List<List<Object>> zhsdSheetData = ExcelUtil.getExcelSheetData(GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw.class, zhsd);
result.put(this.getDefaultLabel(), zhsdSheetData);
return result;
}
},
REMUNERATION_FOR_OTHER_LABOR(499, "0499", "其他非连续劳务报酬所得", 175330) {
@Override
public Map<String, List<List<Object>>> parseGetDeclareTaxResultFeedbackResponse(Map<String, List<List<Object>>> result, GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse) {
List<GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw> zhsd = declareTaxResultFeedbackResponse.getBody().getZhsd().getQtflxlwbc().getSscglb();
List<List<Object>> zhsdSheetData = ExcelUtil.getExcelSheetData(GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw.class, zhsd);
result.put(this.getDefaultLabel(), zhsdSheetData);
return result;
}
},
REMUNERATION_FOR_AUTHOR(500, "0500", "稿酬所得", 181944) {
@Override
public Map<String, List<List<Object>>> parseGetDeclareTaxResultFeedbackResponse(Map<String, List<List<Object>>> result, GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse) {
List<GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw> zhsd = declareTaxResultFeedbackResponse.getBody().getZhsd().getGcsdlb().getSscglb();
List<List<Object>> zhsdSheetData = ExcelUtil.getExcelSheetData(GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw.class, zhsd);
result.put(this.getDefaultLabel(), zhsdSheetData);
return result;
}
},
ROYALTIES(600, "0600", "特许权使用费所得", 181945) {
@Override
public Map<String, List<List<Object>>> parseGetDeclareTaxResultFeedbackResponse(Map<String, List<List<Object>>> result, GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse) {
List<GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw> zhsd = declareTaxResultFeedbackResponse.getBody().getZhsd().getTxq().getSscglb();
List<List<Object>> zhsdSheetData = ExcelUtil.getExcelSheetData(GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw.class, zhsd);
result.put(this.getDefaultLabel(), zhsdSheetData);
return result;
}
},
;
@ -51,6 +154,8 @@ public enum IncomeCategoryEnum implements BaseEnum<Integer> {
this.labelId = labelId;
}
public abstract Map<String, List<List<Object>>> parseGetDeclareTaxResultFeedbackResponse(Map<String, List<List<Object>>> result, GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse);
@Override
public Integer getValue() {
return value;
@ -79,6 +184,7 @@ public enum IncomeCategoryEnum implements BaseEnum<Integer> {
}
return null;
}
public static List<IncomeCategoryEnum> parseByValue(Collection<Integer> values) {
if (CollectionUtils.isEmpty(values)) {
return Collections.emptyList();

View File

@ -0,0 +1,48 @@
package com.engine.salary.enums.taxdeclaration;
import com.engine.salary.enums.BaseEnum;
/**
* 作废申报
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public enum SourceEnum implements BaseEnum<Integer> {
ACCT(0, "薪资核算", 160490),
AUTO(1, "自动补充", 160490),
ADD(2, "界面新增", 160491),
EDIT(3, "界面新增", 160491),
IMP(4, "界面导入", 160491);
SourceEnum(int value, String defaultLabel, int labelId) {
this.value = value;
this.defaultLabel = defaultLabel;
this.labelId = labelId;
}
private int value;
private String defaultLabel;
private int labelId;
@Override
public Integer getValue() {
return value;
}
@Override
public String getDefaultLabel() {
return defaultLabel;
}
@Override
public Integer getLabelId() {
return labelId;
}
}

View File

@ -452,8 +452,7 @@
update_time
)
VALUES
(
<foreach collection="collection" item="item" separator=",">
<foreach collection="collection" item="item" separator=",">(
#{item.birthday},
#{item.cardNum},
#{item.cardType},
@ -486,8 +485,8 @@
#{item.taxCycle},
#{item.tenantKey},
#{item.updateTime}
</foreach>
)
</foreach>
</insert>
@ -838,6 +837,9 @@
<if test="param.declareStatus != null">
AND declare_status = #{param.declareStatus.value}
</if>
<if test="param.employeeId != null">
AND employee_id=#{param.employeeId}
</if>
<if test="param.employmentStatus != null">
AND employment_status = #{param.employmentStatus.value}
</if>

View File

@ -956,7 +956,7 @@
#{tenantKey},
</if>
<if test="smsSetting != null">
#{sms_setting},
#{smsSetting},
</if>
</trim>
</insert>

View File

@ -38,6 +38,31 @@
</if>
</sql>
<sql id="paramSql" databaseId="oracle">
<if test="param.ids != null and param.ids.size()>0">
AND id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.name != null and param.name != ''">
AND name like '%'||#{param.name}||'%'
</if>
</sql>
<sql id="paramSql" databaseId="sqlserver">
<if test="param.ids != null and param.ids.size()>0">
AND id IN
<foreach collection="param.ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</if>
<if test="param.name != null and param.name != ''">
AND name like '%'+#{param.name}+'%'
</if>
</sql>
<!-- 查询 -->
<select id="listBySome" resultMap="BaseResultMap">
SELECT

View File

@ -75,6 +75,12 @@
<if test="taxCycle != null">
AND tax_cycle = #{taxCycle}
</if>
<if test="taxDeclareRecordId != null">
AND tax_declare_record_id = #{taxDeclareRecordId}
</if>
<if test="incomeCategory != null">
AND income_category = #{incomeCategory}
</if>
ORDER BY id DESC
</select>
<insert id="batchInsert">

View File

@ -120,4 +120,9 @@ public interface TaxDeclarationValueMapper {
*/
void batchInsert(@Param("collection") Collection<TaxDeclarationValuePO> taxDeclarationValues);
List<Long> queryNotWagesEmpIds(@Param("taxDeclareRecordId")Long taxDeclareRecordId);
List<Long> queryWagesEmpIds(@Param("taxDeclareRecordId")Long taxDeclareRecordId);
}

View File

@ -13,6 +13,7 @@
<result column="employee_type" property="employeeType"/>
<result column="employee_id" property="employeeId"/>
<result column="result_value_json" property="resultValueJson"/>
<result column="source" property="source"/>
</resultMap>
<!-- 表字段 -->
@ -30,6 +31,7 @@
, t.employee_type
, t.employee_id
, t.result_value_json
, t.source
</sql>
<!-- 查询全部 -->
@ -88,6 +90,9 @@
<if test="resultValueJson != null">
AND result_value_json = #{resultValueJson}
</if>
<if test="source != null">
AND source = #{source}
</if>
<if test="ids != null and ids.size()>0">
AND id IN
<foreach collection="ids" open="(" item="id" separator="," close=")">
@ -142,6 +147,9 @@
<if test="resultValueJson != null">
result_value_json,
</if>
<if test="source != null">
source,
</if>
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
<if test="id != null">
@ -177,6 +185,9 @@
<if test="resultValueJson != null">
#{resultValueJson},
</if>
<if test="source != null">
#{source},
</if>
</trim>
</insert>
@ -195,7 +206,8 @@
tax_declaration_id,
employee_type,
employee_id,
result_value_json
result_value_json,
source
)
VALUES
(
@ -210,7 +222,8 @@
#{item.taxDeclarationId},
#{item.employeeType},
#{item.employeeId},
#{item.resultValueJson}
#{item.resultValueJson},
#{item.source}
</foreach>
)
</insert>
@ -228,7 +241,8 @@
tax_declaration_id,
employee_type,
employee_id,
result_value_json
result_value_json,
source
)
<foreach collection="collection" item="item" separator="union all">
@ -243,7 +257,8 @@
#{item.taxDeclarationId,jdbcType=DOUBLE},
#{item.employeeType,jdbcType=INTEGER},
#{item.employeeId,jdbcType=DOUBLE},
#{item.resultValueJson,jdbcType=VARCHAR}
#{item.resultValueJson,jdbcType=VARCHAR},
#{item.source,jdbcType=INTEGER}
from dual
</foreach>
</insert>
@ -262,7 +277,8 @@
tax_declaration_id,
employee_type,
employee_id,
result_value_json
result_value_json,
source
)
VALUES
(
@ -276,7 +292,8 @@
#{item.taxDeclarationId},
#{item.employeeType},
#{item.employeeId},
#{item.resultValueJson}
#{item.resultValueJson},
#{item.source}
)
</foreach>
</insert>
@ -295,6 +312,7 @@
employee_type=#{employeeType},
employee_id=#{employeeId},
result_value_json=#{resultValueJson},
source=#{source},
</set>
WHERE id = #{id} AND delete_type = 0
</update>
@ -334,6 +352,9 @@
<if test="resultValueJson != null">
result_value_json=#{resultValueJson},
</if>
<if test="source != null">
source=#{source},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
@ -428,4 +449,24 @@
<include refid="NoValueSql"/>
</select>
<select id="queryNotWagesEmpIds" resultType="Long">
select b.employee_id
from hrsa_tax_declaration a
left join hrsa_tax_declaration_value b on a.id = b.tax_declaration_id
where a.delete_type = 0
and b.delete_type = 0
and a.income_category = 2
and a.tax_declare_record_id = #{taxDeclareRecordId}
</select>
<select id="queryWagesEmpIds" resultType="Long">
select b.employee_id
from hrsa_tax_declaration a
left join hrsa_tax_declaration_value b on a.id = b.tax_declaration_id
where a.delete_type = 0
and b.delete_type = 0
and a.income_category = 1
and a.tax_declare_record_id = #{taxDeclareRecordId}
</select>
</mapper>

View File

@ -13,6 +13,7 @@
<result column="tax_cycle" property="taxCycle"/>
<result column="remark" property="remark"/>
<result column="request_id" property="requestId"/>
<result column="declare_request_id" property="declareRequestId"/>
<result column="tax_declare_type" property="taxDeclareType"/>
<result column="tax_declare_status" property="taxDeclareStatus"/>
<result column="display_update_icon" property="displayUpdateIcon"/>
@ -38,6 +39,7 @@
, t.tax_cycle
, t.remark
, t.request_id
, t.declare_request_id
, t.tax_declare_type
, t.tax_declare_status
, t.display_update_icon
@ -105,6 +107,9 @@
<if test="requestId != null">
AND request_id = #{requestId}
</if>
<if test="declareRequestId != null">
AND declare_request_id = #{declareRequestId}
</if>
<if test="taxDeclareType != null">
AND tax_declare_type = #{taxDeclareType}
</if>
@ -189,6 +194,9 @@
<if test="requestId != null">
request_id,
</if>
<if test="declareRequestId != null">
declare_request_id,
</if>
<if test="taxDeclareType != null">
tax_declare_type,
</if>
@ -248,6 +256,9 @@
<if test="requestId != null">
#{requestId},
</if>
<if test="declareRequestId != null">
#{declareRequestId},
</if>
<if test="taxDeclareType != null">
#{taxDeclareType},
</if>
@ -291,6 +302,7 @@
tax_cycle,
remark,
request_id,
declare_request_id,
tax_declare_type,
tax_declare_status,
display_update_icon,
@ -314,6 +326,7 @@
#{item.taxCycle},
#{item.remark},
#{item.requestId},
#{item.declareRequestId},
#{item.taxDeclareType},
#{item.taxDeclareStatus},
#{item.displayUpdateIcon},
@ -340,6 +353,7 @@
tax_cycle,
remark,
request_id,
declare_request_id,
tax_declare_type,
tax_declare_status,
display_update_icon,
@ -363,6 +377,7 @@
#{item.taxCycle,jdbcType=DATE},
#{item.remark,jdbcType=VARCHAR},
#{item.requestId,jdbcType=DOUBLE},
#{item.declareRequestId,jdbcType=VARCHAR},
#{item.taxDeclareType,jdbcType=INTEGER},
#{item.taxDeclareStatus,jdbcType=INTEGER},
#{item.displayUpdateIcon,jdbcType=INTEGER},
@ -390,6 +405,7 @@
tax_cycle,
remark,
request_id,
declare_request_id,
tax_declare_type,
tax_declare_status,
display_update_icon,
@ -412,6 +428,7 @@
#{item.taxCycle},
#{item.remark},
#{item.requestId},
#{item.declareRequestId},
#{item.taxDeclareType},
#{item.taxDeclareStatus},
#{item.displayUpdateIcon},
@ -438,6 +455,7 @@
tax_cycle=#{taxCycle},
remark=#{remark},
request_id=#{requestId},
declare_request_id=#{declareRequestId},
tax_declare_type=#{taxDeclareType},
tax_declare_status=#{taxDeclareStatus},
display_update_icon=#{displayUpdateIcon},
@ -485,6 +503,9 @@
<if test="requestId != null">
request_id=#{requestId},
</if>
<if test="declareRequestId != null">
declare_request_id=#{declareRequestId},
</if>
<if test="taxDeclareType != null">
tax_declare_type=#{taxDeclareType},
</if>

View File

@ -58,10 +58,11 @@ public class GetDeclareTaxResultFeedbackResponse extends BaseResponse {
// * 限售股所得 必填 见限售股所得计算结果
// */
// private 对象 xsgsd;
// /**
// * 人员申报失败列表 必填 参考人员代报结果对象
// */
// private 数组 rysbsblb;
/**
* 人员申报失败列表 必填 参考人员代报结果对象
*/
private List<rydbjgdx> rysbsblb;
@Data
public static class zhsd {
@ -73,66 +74,66 @@ public class GetDeclareTaxResultFeedbackResponse extends BaseResponse {
* 正常工资薪金算税结果对象 参考综合所得算税结果对象
*/
private zcgzxj zcgzxj;
// /**
// * 全年一次性奖金收入算税结果对象 参考综合所得算税结果对象
// */
// private 对象 qnycxjjsslb;
// /**
// * 稿酬所得算税结果对象 参考综合所得算税结果对象
// */
// private 对象 gcsdlb;
// /**
// * 一般劳务报酬算税结果对象 参考综合所得算税结果对象
// */
// private 对象 lwbclb;
// /**
// * 解除劳动合同一次性补偿金列表 参考综合所得算税结果对象
// */
// private 对象 jcldhtycxbcjlb;
// /**
// * 保险营销员薪金算税结果对象 参考综合所得算税结果对象
// */
// private 对象 bxyxy;
// /**
// * 证券经纪人薪金算税结果对象 参考综合所得算税结果对象
// */
// private 对象 zqjjr;
// /**
// * 特许权算税结果对象 参考综合所得算税结果对象
// */
// private 对象 txq;
// /**
// * 个人股权激励结果对象 参考综合所得算税结果对象
// */
// private 对象 grgqjl;
// /**
// * 企业年金结果对象 参考综合所得算税结果对象
// */
// private 对象 qynj;
// /**
// * 内退一次性补偿金 参考综合所得算税结果对象
// */
// private 对象 ntycxbcjlb;
// /**
// * 其他连续劳务报酬 参考综合所得算税结果对象
// */
// private 对象 qtlxlwbc;
// /**
// * 其他非连续劳务报酬 参考综合所得算税结果对象
// */
// private 对象 qtflxlwbc;
// /**
// * 提前退休一次性补贴 参考综合所得算税结果对象
// */
// private 对象 tqtxycxbt;
// /**
// * 央企负责人绩效薪金延期兑现收入和任期奖励 参考综合所得算税结果对象
// */
// private 对象 yqfzrsrhjl;
// /**
// * 法律援助劳务报酬 参考综合所得算税结果对象
// */
// private 对象 flyzlwbclb;
/**
* 全年一次性奖金收入算税结果对象 参考综合所得算税结果对象
*/
private zcgzxj qnycxjjsslb;
/**
* 稿酬所得算税结果对象 参考综合所得算税结果对象
*/
private zcgzxj gcsdlb;
/**
* 一般劳务报酬算税结果对象 参考综合所得算税结果对象
*/
private zcgzxj lwbclb;
/**
* 解除劳动合同一次性补偿金列表 参考综合所得算税结果对象
*/
private zcgzxj jcldhtycxbcjlb;
/**
* 保险营销员薪金算税结果对象 参考综合所得算税结果对象
*/
private zcgzxj bxyxy;
/**
* 证券经纪人薪金算税结果对象 参考综合所得算税结果对象
*/
private zcgzxj zqjjr;
/**
* 特许权算税结果对象 参考综合所得算税结果对象
*/
private zcgzxj txq;
/**
* 个人股权激励结果对象 参考综合所得算税结果对象
*/
private zcgzxj grgqjl;
/**
* 企业年金结果对象 参考综合所得算税结果对象
*/
private zcgzxj qynj;
/**
* 内退一次性补偿金 参考综合所得算税结果对象
*/
private zcgzxj ntycxbcjlb;
/**
* 其他连续劳务报酬 参考综合所得算税结果对象
*/
private zcgzxj qtlxlwbc;
/**
* 其他非连续劳务报酬 参考综合所得算税结果对象
*/
private zcgzxj qtflxlwbc;
/**
* 提前退休一次性补贴 参考综合所得算税结果对象
*/
private zcgzxj tqtxycxbt;
/**
* 央企负责人绩效薪金延期兑现收入和任期奖励 参考综合所得算税结果对象
*/
private zcgzxj yqfzrsrhjl;
/**
* 法律援助劳务报酬 参考综合所得算税结果对象
*/
private zcgzxj flyzlwbclb;
/**
@ -234,7 +235,6 @@ public class GetDeclareTaxResultFeedbackResponse extends BaseResponse {
/**
* 是否明细申报 必填 是或者否
*/
@SalaryTableColumn(text = "是否明细申报", width = "10%", column = "sfmxsb")
private String sfmxsb;
/**
* 姓名 必填null 如果是汇总申报返回空
@ -264,133 +264,143 @@ public class GetDeclareTaxResultFeedbackResponse extends BaseResponse {
/**
* 当期收入额 必填 不填写默认为0
*/
@SalaryTableColumn(text = "当期收入额", width = "10%", column = "sre")
@SalaryTableColumn(text = "本期收入", width = "10%", column = "sre")
private BigDecimal sre;
/**
* 当期免税收入 必填null
*/
@SalaryTableColumn(text = "期免税收入", width = "10%", column = "mssd")
@SalaryTableColumn(text = "期免税收入", width = "10%", column = "mssd")
private BigDecimal mssd;
/**
* 基本养老保险 必填null
*/
@SalaryTableColumn(text = "基本养老保险", width = "10%", column = "jbylaobxf")
@SalaryTableColumn(text = "本期基本养老保险", width = "10%", column = "jbylaobxf")
private BigDecimal jbylaobxf;
/**
* 基本医疗保险 必填null
*/
@SalaryTableColumn(text = "基本医疗保险", width = "10%", column = "jbylbxf")
@SalaryTableColumn(text = "本期基本医疗保险", width = "10%", column = "jbylbxf")
private BigDecimal jbylbxf;
/**
* 失业保险 必填null
*/
@SalaryTableColumn(text = "失业保险", width = "10%", column = "sybxf")
@SalaryTableColumn(text = "本期失业保险", width = "10%", column = "sybxf")
private BigDecimal sybxf;
/**
* 住房公积金 必填null
*/
@SalaryTableColumn(text = "住房公积金", width = "10%", column = "zfgjj")
@SalaryTableColumn(text = "本期住房公积金", width = "10%", column = "zfgjj")
private BigDecimal zfgjj;
/**
* 子女教育支出 必填null
*/
@SalaryTableColumn(text = "子女教育支出", width = "10%", column = "znjyzc")
private BigDecimal znjyzc;
/**
* 赡养老人支出 必填null
*/
@SalaryTableColumn(text = "赡养老人支出", width = "10%", column = "sylrzc")
private BigDecimal sylrzc;
/**
* 住房贷款利息支出 必填null
*/
@SalaryTableColumn(text = "住房贷款利息支出", width = "10%", column = "zfdklxzc")
private BigDecimal zfdklxzc;
/**
* 住房租金支出 必填null
*/
@SalaryTableColumn(text = "住房租金支出", width = "10%", column = "zfzjzc")
private BigDecimal zfzjzc;
/**
* 继续教育支出 必填null
*/
@SalaryTableColumn(text = "继续教育支出", width = "10%", column = "jxjyzc")
private BigDecimal jxjyzc;
/**
* 非学历继续教育支出 必填null
*/
@SalaryTableColumn(text = "非学历继续教育支出", width = "10%", column = "fxljxjyzc")
private BigDecimal fxljxjyzc;
/**
* 3岁以下婴幼儿照护支出 必填null
*/
@SalaryTableColumn(text = "3岁以下婴幼儿照护支出", width = "10%", column = "yyezhzc")
private BigDecimal yyezhzc;
/**
* 年金 必填null
*/
@SalaryTableColumn(text = "年金", width = "10%", column = "nj")
@SalaryTableColumn(text = "本期企业(职业)年金", width = "10%", column = "nj")
private BigDecimal nj;
/**
* 商业健康保险 必填null
*/
@SalaryTableColumn(text = "商业健康保险", width = "10%", column = "syjkbx")
@SalaryTableColumn(text = "本期商业健康保险费", width = "10%", column = "syjkbx")
private BigDecimal syjkbx;
/**
* 税延养老保险 必填null
*/
@SalaryTableColumn(text = "税延养老保险", width = "10%", column = "syylbx")
@SalaryTableColumn(text = "本期税延养老保险费", width = "10%", column = "syylbx")
private BigDecimal syylbx;
/**
* 其他 必填null 按法律规定可以在税前扣除的项目
*/
@SalaryTableColumn(text = "其他", width = "10%", column = "qt")
@SalaryTableColumn(text = "本期其他扣除(其他)", width = "10%", column = "qt")
private BigDecimal qt;
/**
* 准予扣除的捐赠 必填null
* 累计收入额 必填null
*/
@SalaryTableColumn(text = "准予扣除的捐赠", width = "10%", column = "zykcjze")
private BigDecimal zykcjze;
@SalaryTableColumn(text = "累计收入额", width = "10%", column = "ljsre")
private BigDecimal ljsre;
/**
* 减免税 必填null
* 累计免税收入额 必填null
*/
@SalaryTableColumn(text = "减免税额", width = "10%", column = "jmse")
private BigDecimal jmse;
@SalaryTableColumn(text = "累计免税收入", width = "10%", column = "ljmssd")
private BigDecimal ljmssd;
/**
* 备注 必填null
* 累计减除费用额 必填null 正常工资薪金累计减除费用 对应保险营销员证券经纪人累计费用
*/
@SalaryTableColumn(text = "备注", width = "10%", column = "bz")
private String bz;
@SalaryTableColumn(text = "累计减除费用", width = "10%", column = "ljjcfye")
private BigDecimal ljjcfye;
/**
* 减除费用 必填null 正常工资薪金的减除费用 对应保险营销员证券经纪人的费用
* 累计专项扣除额 必填null 三险一金合计
*/
@SalaryTableColumn(text = "减除费用", width = "10%", column = "jcfy")
private BigDecimal jcfy;
@SalaryTableColumn(text = "累计专项扣除", width = "10%", column = "ljzxkce")
private BigDecimal ljzxkce;
/**
* 其他扣除合计 必填null
* 累计子女教育支出 必填null
*/
@SalaryTableColumn(text = "其他扣除合计", width = "10%", column = "qtckhj")
private BigDecimal qtckhj;
@SalaryTableColumn(text = "累计子女教育支出扣除", width = "10%", column = "ljznjyzc")
private BigDecimal ljznjyzc;
/**
* 应纳税所得额 必填null 正常工资薪金返回Null
* 累计继续教育支出 必填null
*/
@SalaryTableColumn(text = "应纳税所得额", width = "10%", column = "ynssde")
private BigDecimal ynssde;
@SalaryTableColumn(text = "累计继续教育支出扣除", width = "10%", column = "ljjxjyzc")
private BigDecimal ljjxjyzc;
/**
* 应纳税额 必填null 正常工资薪金返回Null
* 累计非学历继续教育支持 必填null
*/
@SalaryTableColumn(text = "应纳税额", width = "10%", column = "ynse")
private BigDecimal ynse;
private BigDecimal ljfxljxjyzc;
/**
* 已缴税额 必填null 正常工资薪金返回Null
* 累计学历继续教育支持 必填null
*/
@SalaryTableColumn(text = "已缴税额", width = "10%", column = "ykjse")
private BigDecimal ykjse;
private BigDecimal ljxljxjyzc;
/**
* 应扣缴税额 必填null 正常工资薪金返回Null
* 累计住房租金支出 必填null
*/
@SalaryTableColumn(text = "应扣缴税额", width = "10%", column = "yingkjse")
private BigDecimal yingkjse;
@SalaryTableColumn(text = "累计住房租金支出扣除", width = "10%", column = "ljzfzjzc")
private BigDecimal ljzfzjzc;
/**
* 累计房屋贷款支出 必填null
*/
@SalaryTableColumn(text = "累计房屋贷款支出扣除", width = "10%", column = "ljzfdklxzc")
private BigDecimal ljzfdklxzc;
/**
* 累计赡养老人支出 必填null
*/
@SalaryTableColumn(text = "累计赡养老人支出扣除", width = "10%", column = "ljsylrzc")
private BigDecimal ljsylrzc;
/**
* 累计3岁以下婴幼儿照护支出 必填null
*/
@SalaryTableColumn(text = "累计3岁以下婴幼儿照护", width = "10%", column = "ljyyezhzc")
private BigDecimal ljyyezhzc;
/**
* 累计个人养老金 必填null
*/
@SalaryTableColumn(text = "累计个人养老金", width = "10%", column = "ljgrylj")
private BigDecimal ljgrylj;
/**
* 累计其他扣除额 必填null
*/
@SalaryTableColumn(text = "累计其他扣除", width = "10%", column = "ljqtkce")
private BigDecimal ljqtkce;
/**
* 累计准予扣除的捐赠额 必填null
*/
@SalaryTableColumn(text = "累计准予扣除的捐赠", width = "10%", column = "ljzykcjze")
private BigDecimal ljzykcjze;
/**
* 累计应纳税所得额 必填null
*/
@SalaryTableColumn(text = "累计应纳税所得额", width = "10%", column = "ljynssde")
private BigDecimal ljynssde;
/**
* 税率 必填null
*/
@ -401,81 +411,19 @@ public class GetDeclareTaxResultFeedbackResponse extends BaseResponse {
*/
@SalaryTableColumn(text = "速算扣除数", width = "10%", column = "sskcs")
private BigDecimal sskcs;
/**
* 所得项目名称 必填 正常工资薪金全年一次性奖金收入稿酬所得劳务报酬
*/
@SalaryTableColumn(text = "所得项目名称", width = "10%", column = "sdxm")
private String sdxm;
/**
* 应补退税额 必填null 应补退税额=累计应扣缴税额-累计已缴税额
*/
@SalaryTableColumn(text = "应补退税额", width = "10%", column = "ybtse")
private BigDecimal ybtse;
/**
* 累计收入额 必填null
*/
@SalaryTableColumn(text = "累计收入额", width = "10%", column = "ljsre")
private BigDecimal ljsre;
/**
* 累计免税收入额 必填null
*/
@SalaryTableColumn(text = "累计免税收入额", width = "10%", column = "ljmssd")
private BigDecimal ljmssd;
/**
* 累计专项扣除额 必填null 三险一金合计
*/
@SalaryTableColumn(text = "累计专项扣除额", width = "10%", column = "ljzxkce")
private BigDecimal ljzxkce;
/**
* 累计专项附加扣除额 必填null 专项附加合计
*/
@SalaryTableColumn(text = "累计专项附加扣除额", width = "10%", column = "ljzxfjkce")
private BigDecimal ljzxfjkce;
/**
* 累计其他扣除额 必填null
*/
@SalaryTableColumn(text = "累计其他扣除额", width = "10%", column = "ljqtkce")
private BigDecimal ljqtkce;
/**
* 累计减免税额 必填null
*/
@SalaryTableColumn(text = "累计减免税额", width = "10%", column = "ljjmse")
private BigDecimal ljjmse;
/**
* 累计减除费用额 必填null 正常工资薪金累计减除费用 对应保险营销员证券经纪人累计费用
*/
@SalaryTableColumn(text = "累计减除费用额", width = "10%", column = "ljjcfye")
private BigDecimal ljjcfye;
/**
* 累计月减除费用 必填null 保险营销员证券经纪人其他连续劳务报酬的减除费用
*/
@SalaryTableColumn(text = "累计月减除费用", width = "10%", column = "ljyjcfy")
private BigDecimal ljyjcfy;
/**
* 允许扣除税费 必填null 保险营销员证券经纪人
*/
@SalaryTableColumn(text = "允许扣除税费", width = "10%", column = "yxkcsf")
private BigDecimal yxkcsf;
/**
* 展业成本 必填null 保险营销员证券经纪人
*/
@SalaryTableColumn(text = "展业成本", width = "10%", column = "zycb")
private BigDecimal zycb;
/**
* 月减除费用 必填null 保险营销员证券经纪人其他连续劳务报酬的减除费用
*/
@SalaryTableColumn(text = "月减除费用", width = "10%", column = "yjcfy")
private BigDecimal yjcfy;
/**
* 累计应纳税所得额 必填null
*/
@SalaryTableColumn(text = "累计应纳税所得额", width = "10%", column = "ljynssde")
private BigDecimal ljynssde;
/**
* 累计应纳税额 必填null
*/
@SalaryTableColumn(text = "累计应纳税额", width = "10%", column = "ljynse")
private BigDecimal ljynse;
/**
* 累计减免税额 必填null
*/
@SalaryTableColumn(text = "累计减免税额", width = "10%", column = "ljjmse")
private BigDecimal ljjmse;
/**
* 累计应扣缴税额 必填null 累计应扣缴税额 = 累计应纳税额 - 累计减免税额
*/
@ -487,59 +435,114 @@ public class GetDeclareTaxResultFeedbackResponse extends BaseResponse {
@SalaryTableColumn(text = "累计已缴税额", width = "10%", column = "ljykjse")
private BigDecimal ljykjse;
/**
* 累计子女教育支出 必填null
* 已缴税额 必填null 正常工资薪金返回Null
*/
@SalaryTableColumn(text = "累计子女教育支出", width = "10%", column = "ljznjyzc")
private BigDecimal ljznjyzc;
@SalaryTableColumn(text = "已缴税额", width = "10%", column = "ykjse")
private BigDecimal ykjse;
/**
* 累计继续教育支出 必填null
* 累计专项附加扣除额 必填null 专项附加合计
*/
@SalaryTableColumn(text = "累计继续教育支出", width = "10%", column = "ljjxjyzc")
private BigDecimal ljjxjyzc;
@SalaryTableColumn(text = "累计专项附加扣除额", width = "10%", column = "ljzxfjkce")
private BigDecimal ljzxfjkce;
/**
* 累计非学历继续教育支持 必填null
* 应补退税额 必填null 应补退税额=累计应扣缴税额-累计已缴税额
*/
@SalaryTableColumn(text = "累计非学历继续教育支持", width = "10%", column = "ljfxljxjyzc")
private BigDecimal ljfxljxjyzc;
@SalaryTableColumn(text = "应补退税额", width = "10%", column = "ybtse")
private BigDecimal ybtse;
/**
* 累计学历继续教育支持 必填null
* 备注 必填null
*/
@SalaryTableColumn(text = "累计学历继续教育支持", width = "10%", column = "ljxljxjyzc")
private BigDecimal ljxljxjyzc;
@SalaryTableColumn(text = "备注", width = "10%", column = "bz")
private String bz;
/**
* 累计住房租金支出 必填null
* 子女教育支出 必填null
*/
@SalaryTableColumn(text = "累计住房租金支出", width = "10%", column = "ljzfzjzc")
private BigDecimal ljzfzjzc;
private BigDecimal znjyzc;
/**
* 累计房屋贷款支出 必填null
* 赡养老人支出 必填null
*/
@SalaryTableColumn(text = "累计房屋贷款支出", width = "10%", column = "ljzfdklxzc")
private BigDecimal ljzfdklxzc;
private BigDecimal sylrzc;
/**
* 累计赡养老人支出 必填null
* 住房贷款利息支出 必填null
*/
@SalaryTableColumn(text = "累计赡养老人支出", width = "10%", column = "ljsylrzc")
private BigDecimal ljsylrzc;
private BigDecimal zfdklxzc;
/**
* 累计3岁以下婴幼儿照护支出 必填null
* 住房租金支出 必填null
*/
@SalaryTableColumn(text = "累计3岁以下婴幼儿照护支出", width = "10%", column = "ljyyezhzc")
private BigDecimal ljyyezhzc;
private BigDecimal zfzjzc;
/**
* 累计准予扣除的捐赠额 必填null
* 继续教育支出 必填null
*/
@SalaryTableColumn(text = "累计准予扣除的捐赠额", width = "10%", column = "ljzykcjze")
private BigDecimal ljzykcjze;
private BigDecimal jxjyzc;
/**
* 累计个人养老金 必填null
* 非学历继续教育支出 必填null
*/
@SalaryTableColumn(text = "累计个人养老金", width = "10%", column = "ljgrylj")
private BigDecimal ljgrylj;
private BigDecimal fxljxjyzc;
/**
* 3岁以下婴幼儿照护支出 必填null
*/
private BigDecimal yyezhzc;
/**
* 准予扣除的捐赠额 必填null
*/
private BigDecimal zykcjze;
/**
* 减免税额 必填null
*/
private BigDecimal jmse;
/**
* 减除费用 必填null 正常工资薪金的减除费用 对应保险营销员证券经纪人的费用
*/
private BigDecimal jcfy;
/**
* 其他扣除合计 必填null
*/
private BigDecimal qtckhj;
/**
* 应纳税所得额 必填null 正常工资薪金返回Null
*/
private BigDecimal ynssde;
/**
* 应纳税额 必填null 正常工资薪金返回Null
*/
private BigDecimal ynse;
/**
* 应扣缴税额 必填null 正常工资薪金返回Null
*/
private BigDecimal yingkjse;
/**
* 所得项目名称 必填 正常工资薪金全年一次性奖金收入稿酬所得劳务报酬
*/
private String sdxm;
/**
* 累计月减除费用 必填null 保险营销员证券经纪人其他连续劳务报酬的减除费用
*/
private BigDecimal ljyjcfy;
/**
* 允许扣除税费 必填null 保险营销员证券经纪人
*/
private BigDecimal yxkcsf;
/**
* 展业成本 必填null 保险营销员证券经纪人
*/
private BigDecimal zycb;
/**
* 月减除费用 必填null 保险营销员证券经纪人其他连续劳务报酬的减除费用
*/
private BigDecimal yjcfy;
/**
* 累计个人养老金校验码 必填null
*/
@SalaryTableColumn(text = "累计个人养老金校验码", width = "10%", column = "ljgryljjym")
private String ljgryljjym;
/**
* 企业上月是否已申报 必填null 仅在两个月算税场景时使用当前月分为N月
@ -547,34 +550,28 @@ public class GetDeclareTaxResultFeedbackResponse extends BaseResponse {
* 1表示N-1月上月已申报
* 2表示N-2月上上个月未申报
*/
@SalaryTableColumn(text = "企业上月是否已申报", width = "10%", column = "qysysfysb")
private String qysysfysb;
/**
* 员工在税局累计已扣缴的税额 必填null 当前月分为N,如果N-1上月已申报则返回N-1月员工在税局累计已扣缴的税额;
* 如果N-1月未申报则返回N-2月工在税局累计已扣缴的税额;
*/
@SalaryTableColumn(text = "员工在税局累计已扣缴的税额", width = "10%", column = "ygzsjljykjse")
private BigDecimal ygzsjljykjse;
/**
* 本月已累计扣除税额 必填null 针对一月多次算税的场景字段
*/
@SalaryTableColumn(text = "本月已累计扣除税额", width = "10%", column = "byyljkjse")
private BigDecimal byyljkjse;
/**
* 本次应扣缴税额 必填null 针对一月多次算税的场景字段本次应扣缴税额=本月应扣缴税额-本月已累计税额
*/
@SalaryTableColumn(text = "本次应扣缴税额", width = "10%", column = "bcykjse")
private BigDecimal bcykjse;
/**
* 分摊年度数 必填null
*/
@SalaryTableColumn(text = "分摊年度数", width = "10%", column = "ftnds")
private Integer ftnds;
/**
* 年减除费用 必填null 默认为60000
*/
@SalaryTableColumn(text = "年减除费用", width = "10%", column = "njcfy")
private BigDecimal njcfy;
}
@ -622,6 +619,44 @@ public class GetDeclareTaxResultFeedbackResponse extends BaseResponse {
}
/**
* 4.4.1.3.1.1人员代报结果对象
*/
@Data
public static class rydbjgdx {
/**
* 人员ID
*/
private Integer ygid;
/**
* 人员名称
*/
private String xm;
/**
* 证件类型 见证件类型字典
*/
private String zzlx;
/**
* 证件号码
*/
private String zzhm;
/**
* 错误码
*/
private String cwm;
/**
* 错误信息
*/
private String cwxx;
/**
* 所得税的code
*/
private String sdxmdm;
/**
* 所得税的名称
*/
private String sdxmmc;
}
}

View File

@ -497,7 +497,7 @@ public class SalaryStatisticsReportServiceImpl extends Service implements Salary
Arrays.asList(salaryReportConditions.split(",")).forEach(paramMd5 -> {
if (StringUtils.isNotBlank(paramMd5)) {
//条件对应的结果
getSalaryCacheService(user).remove(SalaryCacheKey.SALARY_REPORT_DATA + paramMd5);
getSalaryCacheService(user).remove(SalaryCacheKey.SALARY_REPORT_DATA + id + "_" + paramMd5);
}
}
);

View File

@ -216,6 +216,7 @@ public class SalaryStatisticsReportWrapper extends Service {
/**
* 复制薪资账套
*
* @param id
*/
public void duplicate(Long id) {
@ -322,7 +323,7 @@ public class SalaryStatisticsReportWrapper extends Service {
//报表中缓存的条件
salaryReportConditions = Utils.null2String(getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_CONDITIONS + id));
if (StringUtils.isNotBlank(salaryReportConditions) && salaryReportConditions.contains(paramMd5)) {
return getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_DATA + paramMd5);
return getSalaryCacheService(user).get(SalaryCacheKey.SALARY_REPORT_DATA + id + "_" + paramMd5);
}
}
@ -344,9 +345,10 @@ public class SalaryStatisticsReportWrapper extends Service {
resultMap.put("reportId", id);
//设置报表缓存
getSalaryCacheService(user).set(SalaryCacheKey.SALARY_REPORT_IDS, salaryReportIds + "," + id);
getSalaryCacheService(user).set(SalaryCacheKey.SALARY_REPORT_CONDITIONS + id, salaryReportConditions + "," + paramMd5);
getSalaryCacheService(user).set(SalaryCacheKey.SALARY_REPORT_DATA + paramMd5, resultMap);
getSalaryCacheService(user).set(SalaryCacheKey.SALARY_REPORT_DATA + id + "_" + paramMd5, resultMap);
return resultMap;

View File

@ -4,6 +4,8 @@ import com.engine.salary.entity.employeedeclare.param.EmployeeDeclareImportParam
import com.engine.salary.entity.employeedeclare.param.EmployeeDeclareListQueryParam;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.Map;
/**
* @description: 人员报送人员导入导出
* @author: xiajun
@ -21,6 +23,21 @@ public interface EmployeeDeclareExcelService {
*/
XSSFWorkbook exportTemplate(EmployeeDeclareImportParam importParam);
/**
* 导入预览
* @param param
* @return
*/
Map<String, Object> preview(EmployeeDeclareImportParam param);
/**
* 导入人员报送数据
* @param param
* @return
*/
Map<String, Object> importData(EmployeeDeclareImportParam param);
/**
* 导出人员信息采集-全部
*

View File

@ -182,4 +182,6 @@ public interface EmployeeDeclareService{
* @return
*/
String syncEmploymentDate(EmployeeDeclareSyncStartDateParam param);
void batchInsert(List<EmployeeDeclarePO> insertList);
}

View File

@ -1,9 +1,12 @@
package com.engine.salary.service;
import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.DownloadTemplateParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationValueListQueryParam;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.Map;
/**
* 个税申报表导出
* <p>Copyright: Copyright (c) 2022</p>
@ -45,4 +48,16 @@ public interface TaxDeclarationExcelService {
* @return
*/
XSSFWorkbook exportEmployee4Fail(AbnormalEmployeeListQueryParam queryParam);
XSSFWorkbook downloadTemplate(DownloadTemplateParam param);
/**
* 预览
*/
Map<String, Object> preview(DownloadTemplateParam importParam);
/**
* 导入数据
*/
Map<String, Object> importData(DownloadTemplateParam importParam);
}

View File

@ -23,6 +23,9 @@ public interface TaxDeclarationService {
*/
List<TaxDeclarationPO> listByTaxCycleAndTaxAgentIds(YearMonth salaryMonth, Collection<Long> taxAgentIds);
List<TaxDeclarationPO> listByTaxDeclareRecordId(Long taxDeclareRecordId);
List<TaxDeclarationPO> listByTaxDeclareRecordId(Long taxDeclareRecordId,Integer incomeCategory);
PageInfo<TaxDeclarationPO> listPageByParam(TaxDeclarationListQueryParam queryParam);
List<TaxAgentPO> countByTaxDeclarationId(Collection<Long> taxAgentIds);
@ -33,7 +36,6 @@ public interface TaxDeclarationService {
/**
* 删除个税申报表
*
*/
void delete(SalaryAcctRecordPO salaryAcctRecordPO);
@ -48,6 +50,7 @@ public interface TaxDeclarationService {
/**
* 撤回个税申报单
*
* @param taxDeclarationId
*/
void withDrawTaxDeclaration(Long taxDeclarationId);

View File

@ -2,8 +2,10 @@ package com.engine.salary.service;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationValueListDTO;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationValueListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclareRecordDetailSaveParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationValuePO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO;
import com.engine.salary.util.page.PageInfo;
import java.util.Collection;
@ -34,6 +36,7 @@ public interface TaxDeclarationValueService {
* @return
*/
List<TaxDeclarationValuePO> listByTaxDeclarationIds(Collection<Long> taxDeclarationIds);
List<TaxDeclarationValuePO> listByTaxDeclarationId(Long taxDeclarationIds);
/**
* 查询个税申报表明细
@ -57,6 +60,12 @@ public interface TaxDeclarationValueService {
* @param taxDeclarationValues
*/
void batchSave(List<TaxDeclarationValuePO> taxDeclarationValues);
void batchEdit(List<TaxDeclarationValuePO> taxDeclarationValues);
void save(TaxDeclareRecordDetailSaveParam param);
void edit(TaxDeclareRecordDetailSaveParam param);
TaxDeclarationValuePO getById(Long id);
/**
* 删除个税申报表明细
@ -64,4 +73,13 @@ public interface TaxDeclarationValueService {
* @param taxDeclareRecordIds
*/
void deleteByTaxDeclareRecordIds(Collection<Long> taxDeclareRecordIds);
/**
* 因为单独申报年终奖不可行
* 需要补充正常工资薪金的申报按0申报
* @param po
*/
void autoAddWagesDeclare(TaxDeclareRecordPO po);
}

View File

@ -2,6 +2,7 @@ package com.engine.salary.service;
import com.engine.salary.common.YearMonthRange;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationRateDTO;
import com.engine.salary.entity.taxdeclaration.param.DeclareTaxResultFeedbackQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
@ -140,7 +141,7 @@ public interface TaxDeclareRecordService {
*/
Object getDeclareTaxResultFeedback(Long id);
XSSFWorkbook exportGetDeclareTaxResultFeedback(Long id,String requestId);
XSSFWorkbook exportGetDeclareTaxResultFeedback(DeclareTaxResultFeedbackQueryParam param);
/**
* 作废
*

View File

@ -2,36 +2,62 @@ package com.engine.salary.service.impl;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.employeedeclare.bo.EmployeeDeclareBO;
import com.engine.salary.entity.employeedeclare.dto.EmployeeDeclareExcelDTO;
import com.engine.salary.entity.employeedeclare.dto.EmployeeDeclareListDTO;
import com.engine.salary.entity.employeedeclare.param.EmployeeDeclareImportParam;
import com.engine.salary.entity.employeedeclare.param.EmployeeDeclareListQueryParam;
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.SalaryOnOffEnum;
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
import com.engine.salary.enums.employeedeclare.CardTypeEnum;
import com.engine.salary.enums.employeedeclare.DeclareStatusEnum;
import com.engine.salary.enums.employeedeclare.EmploymentStatusEnum;
import com.engine.salary.enums.employeedeclare.EmploymentTypeEnum;
import com.engine.salary.enums.salaryaccounting.EmployeeTypeEnum;
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.employeedeclare.EmployeeDeclareMapper;
import com.engine.salary.service.EmployeeDeclareExcelService;
import com.engine.salary.service.EmployeeDeclareService;
import com.engine.salary.service.SalaryEmployeeService;
import com.engine.salary.service.TaxAgentService;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryEnumUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.excel.ExcelSheetData;
import com.engine.salary.util.excel.ExcelUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.excel.*;
import com.engine.salary.util.valid.SalaryCardUtil;
import com.google.common.base.Joiner;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import dm.jdbc.util.IdGenerator;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.BeanWrapperImpl;
import weaver.file.ExcelSheet;
import weaver.file.ImageFileManager;
import weaver.general.Util;
import weaver.hrm.User;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.beans.PropertyDescriptor;
import java.io.InputStream;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
import static com.engine.salary.util.excel.ExcelSupport.EXCEL_TYPE_XLSX;
/**
* 人员报送人员导入导出
* <p>Copyright: Copyright (c) 2023</p>
@ -56,6 +82,10 @@ public class EmployeeDeclareExcelServiceImpl extends Service implements Employee
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
private EmployeeDeclareMapper getEmployeeDeclareMapper() {
return MapperProxyFactory.getProxy(EmployeeDeclareMapper.class);
}
@Override
public XSSFWorkbook exportTemplate(EmployeeDeclareImportParam importParam) {
// 查询人员
@ -75,11 +105,11 @@ public class EmployeeDeclareExcelServiceImpl extends Service implements Employee
row.add(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getDefaultLabel());
row.add(employeeDeclare.getCardNum());
row.add(employmentStatusEnum == null ? "" : employmentStatusEnum.getDefaultLabel());
row.add(employmentTypeEnum == null ? "" : employmentTypeEnum.getDefaultLabel());
row.add(employmentTypeEnum == null ? EmploymentTypeEnum.EMPLOYEE.getDefaultLabel() : employmentTypeEnum.getDefaultLabel());
row.add(employeeDeclare.getEmploymentFirstYear());
row.add(employeeDeclare.getMobile());
row.add(Util.null2String(employeeDeclare.getEmploymentDate()));
row.add(Util.null2String(employeeDeclare.getDismissDate()));
row.add(SalaryDateUtil.getFormatDate(employeeDeclare.getEmploymentDate()));
row.add(SalaryDateUtil.getFormatDate(employeeDeclare.getDismissDate()));
row.add(Objects.equals(employeeDeclare.getDisability(), 1) ? yesI18 : noI18);
row.add(employeeDeclare.getDisabilityCardNo());
row.add(Objects.equals(employeeDeclare.getMartyrDependents(), 1) ? yesI18 : noI18);
@ -96,6 +126,436 @@ public class EmployeeDeclareExcelServiceImpl extends Service implements Employee
return ExcelUtil.genWorkbook(excelSheetData);
}
@Override
public Map<String, Object> preview(EmployeeDeclareImportParam param) {
//1参数校验
String imageId = param.getImageId();
if (StringUtils.isBlank(imageId)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "文件id为空"));
}
Map<String, Object> map = new HashMap<>();
InputStream fileInputStream = null;
try {
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId()));
Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
List<String> headers = ExcelSupport.getSheetHeader(sheet, 0);
map.put("headers", headers);
map.put("list", ExcelParseHelper.parse2List(sheet, 1));
return map;
} finally {
IOUtils.closeQuietly(fileInputStream);
}
}
@Override
public Map<String, Object> importData(EmployeeDeclareImportParam param) {
Map<String, Object> apidatas = new HashMap<>();
InputStream fileInputStream = null;
try {
Date now = new Date();
// 个税扣缴义务人id
Long taxAgentId = param.getTaxAgentId();
TaxAgentPO taxAgent = getTaxAgentService(user).getById(taxAgentId);
if (taxAgent == null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "参数错误,无法找到个税扣缴义务人"));
}
// 税款所属期
String taxCycle = SalaryDateUtil.getFormatDate(param.getTaxCycle());
Date taxCycleDate = param.getTaxCycle();
// 导出模板中的表头
List<String> headerList = getImportHeader().stream().map(header -> header.toString()).collect(Collectors.toList());
// 查询所有的人员
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ORG);
// 查询所有的外部人员
List<DataCollectionEmployee> extEmployees = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.EXT);
// 查询人员报送表的人员
List<EmployeeDeclarePO> employeeDeclares = getEmployeeDeclareService(user).listByTaxCycleAndTaxAgentId(SalaryDateUtil.dateStrToLocalDate(taxCycle), taxAgentId);
// 校验字段
String checkType = param.getCheckType();
Map<String, DataCollectionEmployee> extEmployeeMap = Maps.newHashMap();
Map<String, DataCollectionEmployee> simpleEmployeeMap = Maps.newHashMap();
Map<String, EmployeeDeclarePO> employeeDeclareMap = Maps.newHashMapWithExpectedSize(employeeDeclares.size());
if (Objects.equals(checkType, "jobNum")) {
extEmployeeMap = Collections.emptyMap();
simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getWorkcode);
employeeDeclareMap = SalaryEntityUtil.convert2Map(employeeDeclares, EmployeeDeclarePO::getJobNum);
} else {
// 查询所有人员的个人信息
simpleEmployeeMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getIdNo);
extEmployeeMap = SalaryEntityUtil.convert2Map(extEmployees, DataCollectionEmployee::getIdNo);
employeeDeclareMap = SalaryEntityUtil.convert2Map(employeeDeclares, EmployeeDeclarePO::getCardNum);
}
// 需要新增的报送人员
List<EmployeeDeclarePO> needAddEmployeeDeclares = Lists.newArrayList();
// 需要更新的报送人员
List<EmployeeDeclarePO> needUpdateEmployeeDeclares = Lists.newArrayList();
// 索引(用于计算进度)
int index = 0;
// 失败的数量
int failCount = 0;
// 成功的数量
int successCount = 0;
// 错误行的索引
int failRowIndex = 1;
// 包含错误提示信息的sheet页
List<ExcelSheet> errorExcelSheets = Lists.newArrayList();
String imageId = Util.null2String(param.getImageId());
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId));
Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
// 表头
List<String> headers = ExcelSupport.getSheetHeader(sheet, 0);
// 检查表头
String isCorrectHeader = checkHeader(headers, headerList);
if (isCorrectHeader != null) {
throw new SalaryRunTimeException(isCorrectHeader);
}
// 数据
List<Map<String, Object>> data = ExcelParseHelper.parse2Map(sheet, 1);
if (CollectionUtils.isEmpty(data)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "导入数据不能为空"));
}
// 错误提示信息
List<ExcelComment> excelComments = Lists.newArrayList();
List<Map> errorData = new ArrayList<>();
for (int i = 0; i < data.size(); i++) {
//行号
String rowIndex = String.format("第%s行", i + 2);
Map<String, Object> map = data.get(i);
// 数据是否存在错误
boolean isError = false;
EmployeeDeclareExcelDTO employeeDeclareExcel = new EmployeeDeclareExcelDTO();
for (String dataKey : headerList) {
String dataValue = Util.null2String(map.get(dataKey));
if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel( 0, "工号"))) {
if (StringUtils.equals(checkType, "jobNum") && StringUtils.isEmpty(dataValue)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "工号不能为空"));
errorData.add(errorMessageMap);
}
employeeDeclareExcel.setJobNum(dataValue);
} else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(0, "姓名"))) {
if (StringUtils.isEmpty(dataValue)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "姓名不能为空"));
errorData.add(errorMessageMap);
} else {
employeeDeclareExcel.setEmployeeName(dataValue);
}
} else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(0, "证件类型"))) {
employeeDeclareExcel.setCardType(CardTypeEnum.RESIDENT_IDENTITY_CARDS.getValue().toString());
} else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(0, "证件号码"))) {
if (StringUtils.isEmpty(dataValue)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "证件号码不能为空"));
errorData.add(errorMessageMap);
} else if (!SalaryCardUtil.checkIdNum(dataValue)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "证件号码格式不正确"));
errorData.add(errorMessageMap);
} else {
// 身份证号全部转为大写
employeeDeclareExcel.setCardNum(dataValue.toUpperCase());
employeeDeclareExcel.setGender(SalaryCardUtil.judgeGender(dataValue).getValue().toString());
employeeDeclareExcel.setBirthday(SalaryCardUtil.judgeBirthday(dataValue).toString());
}
} else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(0, "人员状态"))) {
boolean legalDataValue = false;
for (EmploymentStatusEnum employmentStatusEnum : EmploymentStatusEnum.values()) {
if (StringUtils.equals(dataValue, employmentStatusEnum.getDefaultLabel())) {
legalDataValue = true;
employeeDeclareExcel.setEmploymentStatus(employmentStatusEnum.getValue().toString());
break;
}
}
if (!legalDataValue) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "人员状态只能填写正常或非正常"));
errorData.add(errorMessageMap);
}
} else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(0, "任职受雇从业类型"))) {
boolean legalDataValue = false;
for (EmploymentTypeEnum employmentTypeEnum : EmploymentTypeEnum.values()) {
if (StringUtils.equals(dataValue, employmentTypeEnum.getDefaultLabel())) {
legalDataValue = true;
employeeDeclareExcel.setEmploymentType(employmentTypeEnum.getValue().toString());
break;
}
}
if (!legalDataValue) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "任职受雇从业类型填写错误"));
errorData.add(errorMessageMap);
}
} else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(0, "入职年度就业情形"))) {
employeeDeclareExcel.setEmploymentFirstYear(dataValue);
} else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(0, "手机号码"))) {
if (StringUtils.isEmpty(dataValue)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "手机号码不能为空"));
errorData.add(errorMessageMap);
} else if (!SalaryCardUtil.checkMobile(dataValue)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "手机号码格式不正确"));
errorData.add(errorMessageMap);
} else {
employeeDeclareExcel.setMobile(dataValue);
}
} else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(0, "任职受雇从业日期"))) {
if (StringUtils.isEmpty(dataValue)) {
if (!Objects.equals(employeeDeclareExcel.getEmploymentType(), EmploymentTypeEnum.OTHER.getValue())) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "任职受雇从业类型不为「其他」时,任职受雇从业日期为必填"));
errorData.add(errorMessageMap);
}
} else {
if (StringUtils.isNotBlank(dataValue) && dataValue.length() >= 10) {
dataValue = dataValue.substring(0,10);
}
if (!SalaryDateUtil.checkDay(dataValue)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "日期格式不正确"));
errorData.add(errorMessageMap);
} else {
employeeDeclareExcel.setEmploymentDate(LocalDate.parse(dataValue).toString());
}
}
} else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(0, "离职日期"))) {
if (StringUtils.isEmpty(dataValue)) {
if (Objects.equals(employeeDeclareExcel.getEmploymentStatus(), EmploymentStatusEnum.ABNORMAL.getValue())) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "人员状态为非正常时,离职日期必填"));
errorData.add(errorMessageMap);
}
} else {
if (!SalaryDateUtil.checkDay(dataValue)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "日期格式不正确"));
errorData.add(errorMessageMap);
} else {
employeeDeclareExcel.setDismissDate(LocalDate.parse(dataValue).toString());
}
}
} else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(0, "是否残疾"))) {
if (StringUtils.equals(dataValue, SalaryOnOffEnum.ON.getDefaultLabel())) {
employeeDeclareExcel.setDisability(SalaryOnOffEnum.ON.getValue());
} else if (StringUtils.equals(dataValue, SalaryOnOffEnum.OFF.getDefaultLabel())) {
employeeDeclareExcel.setDisability(SalaryOnOffEnum.OFF.getValue());
} else {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "是否残疾只能填写是与否"));
errorData.add(errorMessageMap);
}
} else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(0, "残疾证号"))) {
if (StringUtils.isEmpty(dataValue)) {
if (Objects.equals(employeeDeclareExcel.getDisability(), SalaryOnOffEnum.ON.getValue())) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "「是否残疾」填「是」时,残疾证号必填"));
errorData.add(errorMessageMap);
}
} else {
employeeDeclareExcel.setDisabilityCardNo(dataValue);
}
} else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(0, "是否烈属"))) {
if (StringUtils.equals(dataValue, SalaryOnOffEnum.ON.getDefaultLabel())) {
employeeDeclareExcel.setMartyrDependents(SalaryOnOffEnum.ON.getValue());
} else if (StringUtils.equals(dataValue, SalaryOnOffEnum.OFF.getDefaultLabel())) {
employeeDeclareExcel.setMartyrDependents(SalaryOnOffEnum.OFF.getValue());
} else {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "是否烈属只能填写是与否"));
errorData.add(errorMessageMap);
}
} else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(0, "烈属证号"))) {
if (StringUtils.isEmpty(dataValue)) {
if (Objects.equals(employeeDeclareExcel.getMartyrDependents(), SalaryOnOffEnum.ON.getValue())) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "「是否烈属」填「是」时,烈属证号必填"));
errorData.add(errorMessageMap);
}
} else {
employeeDeclareExcel.setMartyrDependentsCardNo(dataValue);
}
} else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(0, "是否孤老"))) {
if (StringUtils.equals(dataValue, SalaryOnOffEnum.ON.getDefaultLabel())) {
employeeDeclareExcel.setLonelyOld(SalaryOnOffEnum.ON.getValue());
} else if (StringUtils.equals(dataValue, SalaryOnOffEnum.OFF.getDefaultLabel())) {
employeeDeclareExcel.setLonelyOld(SalaryOnOffEnum.OFF.getValue());
} else {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "是否孤老只能填写是与否"));
errorData.add(errorMessageMap);
}
} else if (StringUtils.equals(dataKey, SalaryI18nUtil.getI18nLabel(0, "是否扣除减除费用"))) {
if (StringUtils.equals(dataValue, SalaryOnOffEnum.ON.getDefaultLabel())) {
employeeDeclareExcel.setDeductExpenses(SalaryOnOffEnum.ON.getValue());
} else if (StringUtils.equals(dataValue, SalaryOnOffEnum.OFF.getDefaultLabel())) {
employeeDeclareExcel.setDeductExpenses(SalaryOnOffEnum.OFF.getValue());
} else {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "是否扣除减除费用只能填写是与否"));
errorData.add(errorMessageMap);
}
}
}
if (!isError) {
if (StringUtils.equals(checkType, "jobNum")) {
EmployeeDeclarePO employeeDeclare = employeeDeclareMap.get(employeeDeclareExcel.getJobNum());
if (employeeDeclare == null) {
DataCollectionEmployee extEmployee = extEmployeeMap.get(employeeDeclareExcel.getJobNum());
DataCollectionEmployee simpleEmployee = simpleEmployeeMap.get(employeeDeclareExcel.getJobNum());
if (extEmployee == null && simpleEmployee == null) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "系统内的人员不存在该工号"));
errorData.add(errorMessageMap);
} else {
needAddEmployeeDeclares.add(buildEmployeeDeclare(extEmployee, simpleEmployee,
employeeDeclareExcel, taxAgentId, taxCycleDate, now));
}
} else {
EmployeeDeclarePO newEmployeeDeclare = new EmployeeDeclarePO();
BeanUtils.copyProperties(employeeDeclare, newEmployeeDeclare);
EmployeeDeclarePO employeeDeclarePO = EmployeeDeclareBO.convert2PO(employeeDeclareExcel);
BeanUtils.copyProperties(employeeDeclarePO, newEmployeeDeclare, getNullPropertyNames(employeeDeclarePO));
newEmployeeDeclare.setNewEmployeeInfo(StringUtils.equals(employeeDeclare.toCompareString(), newEmployeeDeclare.toCompareString()) ? 0 : 1);
newEmployeeDeclare.setUpdateTime(now);
needUpdateEmployeeDeclares.add(newEmployeeDeclare);
if (Objects.equals(newEmployeeDeclare.getNewEmployeeInfo(), 1)) {
newEmployeeDeclare.setDeclareStatus(DeclareStatusEnum.NOT_DECLARE.getValue());
newEmployeeDeclare.setDeclareErrorMsg("");
}
}
} else {
EmployeeDeclarePO employeeDeclare = employeeDeclareMap.get(employeeDeclareExcel.getCardNum());
if (employeeDeclare == null) {
DataCollectionEmployee extEmployee = extEmployeeMap.get(employeeDeclareExcel.getCardNum());
DataCollectionEmployee simpleEmployee = simpleEmployeeMap.get(employeeDeclareExcel.getCardNum());
if (extEmployee == null && simpleEmployee == null) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(0, "系统内的人员不存在该证件号码"));
errorData.add(errorMessageMap);
} else {
needAddEmployeeDeclares.add(buildEmployeeDeclare(extEmployee, simpleEmployee,
employeeDeclareExcel, taxAgentId, taxCycleDate, now));
}
} else {
EmployeeDeclarePO newEmployeeDeclare = new EmployeeDeclarePO();
BeanUtils.copyProperties(employeeDeclare, newEmployeeDeclare);
EmployeeDeclarePO employeeDeclarePO = EmployeeDeclareBO.convert2PO(employeeDeclareExcel);
BeanUtils.copyProperties(employeeDeclarePO, newEmployeeDeclare, getNullPropertyNames(employeeDeclarePO));
newEmployeeDeclare.setNewEmployeeInfo(StringUtils.equals(employeeDeclare.toCompareString(), newEmployeeDeclare.toCompareString()) ? 0 : 1);
newEmployeeDeclare.setUpdateTime(now);
if (Objects.equals(newEmployeeDeclare.getNewEmployeeInfo(), 1)) {
newEmployeeDeclare.setDeclareStatus(DeclareStatusEnum.NOT_DECLARE.getValue());
newEmployeeDeclare.setDeclareErrorMsg("");
}
needUpdateEmployeeDeclares.add(newEmployeeDeclare);
}
}
}
if (isError) {
failCount++;
failRowIndex++;
continue;
}
successCount++;
}
if (CollectionUtils.isNotEmpty(needAddEmployeeDeclares)) {
getEmployeeDeclareService(user).batchInsert(needAddEmployeeDeclares);
}
if (CollectionUtils.isNotEmpty(needUpdateEmployeeDeclares)) {
needUpdateEmployeeDeclares.stream().forEach(getEmployeeDeclareMapper()::update);
}
apidatas.put("successCount", successCount);
apidatas.put("errorCount", failCount);
apidatas.put("errorData", errorData);
// 发送导入回调信息
// salaryBatchService.sendImportCallBackInfo(message, successCount, errorCount, errorExcelSheets);
} catch (Exception e) {
log.error("人员报送信息导入失败:{}", e.getMessage(), e);
} finally {
IOUtils.closeQuietly(fileInputStream);
}
return apidatas;
}
public static String[] getNullPropertyNames (Object source) {
final BeanWrapper src = new BeanWrapperImpl(source);
PropertyDescriptor[] pds = src.getPropertyDescriptors();
Set<String> emptyNames = new HashSet<>();
for(PropertyDescriptor pd : pds) {
Object srcValue = src.getPropertyValue(pd.getName());
// 此处判断可根据需求修改
if (srcValue == null) {
emptyNames.add(pd.getName());
}
}
String[] result = new String[emptyNames.size()];
return emptyNames.toArray(result);
}
private EmployeeDeclarePO buildEmployeeDeclare(DataCollectionEmployee extEmployee, DataCollectionEmployee simpleEmployee,
EmployeeDeclareExcelDTO employeeDeclareExcel, Long taxAgentId,
Date taxCycle, Date now) {
EmployeeDeclarePO employeeDeclare = EmployeeDeclarePO.builder()
.id(IdGenerator.generate())
.taxAgentId(taxAgentId)
.taxCycle(taxCycle)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.creator(Long.valueOf(user.getUID()))
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.createTime(now)
.updateTime(now).build();
EmployeeDeclarePO employeeDeclarePO = EmployeeDeclareBO.convert2PO(employeeDeclareExcel);
BeanUtils.copyProperties(employeeDeclarePO, employeeDeclare, getNullPropertyNames(employeeDeclarePO));
if (extEmployee != null) {
employeeDeclare.setEmployeeId(extEmployee.getEmployeeId());
employeeDeclare.setEmployeeType(EmployeeTypeEnum.EXT_EMPLOYEE.getValue());
}
if (simpleEmployee != null) {
employeeDeclare.setEmployeeId(simpleEmployee.getEmployeeId());
employeeDeclare.setEmployeeType(EmployeeTypeEnum.ORGANIZATION.getValue());
}
return employeeDeclare;
}
@Override
public XSSFWorkbook export(EmployeeDeclareListQueryParam queryParam) {
// 查询需要报送的人员

View File

@ -737,4 +737,13 @@ public class EmployeeDeclareServiceImpl extends Service implements EmployeeDecla
return "执行完毕";
}
@Override
public void batchInsert(List<EmployeeDeclarePO> insertList) {
if (CollectionUtils.isEmpty(insertList)) {
return;
}
List<List<EmployeeDeclarePO>> partition = Lists.partition(insertList, 100);
partition.forEach(getEmployeeDeclareMapper()::batchInsert);
}
}

View File

@ -1,30 +1,53 @@
package com.engine.salary.service.impl;
import com.api.formmode.mybatis.util.SqlProxyHandle;
import com.cloudstore.eccom.pc.table.WeaTableColumn;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.annotation.SalaryTableColumn;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.taxdeclaration.dto.AbnormalEmployeeListDTO;
import com.engine.salary.entity.taxdeclaration.dto.FailEmployeeListDTO;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationValueListDTO;
import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.DownloadTemplateParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationValueListQueryParam;
import com.engine.salary.entity.taxdeclaration.po.*;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.salaryaccounting.EmployeeTypeEnum;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
import com.engine.salary.enums.taxdeclaration.SourceEnum;
import com.engine.salary.mapper.sys.SalarySysConfMapper;
import com.engine.salary.service.*;
import com.engine.salary.sys.entity.po.SalarySysConfPO;
import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.excel.ExcelParseHelper;
import com.engine.salary.util.excel.ExcelSheetData;
import com.engine.salary.util.excel.ExcelSupport;
import com.engine.salary.util.excel.ExcelUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import dm.jdbc.util.IdGenerator;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.util.IOUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import weaver.file.ImageFileManager;
import weaver.general.Util;
import weaver.hrm.User;
import java.lang.reflect.Field;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.io.InputStream;
import java.util.*;
import java.util.stream.Collectors;
import static com.engine.salary.util.excel.ExcelSupport.EXCEL_TYPE_XLSX;
/**
* 个税申报表导出
@ -57,6 +80,19 @@ public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclar
return ServiceUtil.getService(TaxDeclareFailServiceImpl.class, user);
}
private TaxReportColumnService getTaxReportColumnService(User user) {
return ServiceUtil.getService(TaxReportColumnServiceImpl.class, user);
}
private SalarySysConfMapper getSalarySysConfMapper() {
return SqlProxyHandle.getProxy(SalarySysConfMapper.class);
}
private SalaryEmployeeService getSalaryEmployeeService(User user) {
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
@Override
public XSSFWorkbook exportTaxDeclarationValue(TaxDeclarationValueListQueryParam queryParam) {
// 查询个税申报表
@ -140,7 +176,7 @@ public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclar
// 导出的表头
List<Object> headerList = Lists.newArrayList();
List<String> dataIndexList = Lists.newArrayList();
parseHeader(clazz, headerList, dataIndexList);
ExcelUtil.parseHeader(clazz, headerList, dataIndexList);
// 导出的数据
List<List<Object>> rows = Lists.newArrayListWithExpectedSize(dtoList.size());
dtoList.forEach(dto -> {
@ -157,23 +193,222 @@ public class TaxDeclarationExcelServiceImpl extends Service implements TaxDeclar
return excelSheetData;
}
/**
* 解析表头
*
* @param clazz
* @param headerList
* @param dataIndexList
* @param <T>
*/
private <T> void parseHeader(Class<T> clazz, List<Object> headerList, List<String> dataIndexList) {
Field[] declaredFields = clazz.getDeclaredFields();
for (Field declaredField : declaredFields) {
if (!declaredField.isAnnotationPresent(SalaryTableColumn.class)) {
continue;
}
SalaryTableColumn annotation = declaredField.getAnnotation(SalaryTableColumn.class);
headerList.add(SalaryI18nUtil.getI18nLabel(annotation.labelId(), annotation.text()));
dataIndexList.add(declaredField.getName());
@Override
public XSSFWorkbook downloadTemplate(DownloadTemplateParam param) {
TaxDeclarationPO declarationPO = getTaxDeclarationService(user).getById(param.getTaxDeclarationId());
IncomeCategoryEnum incomeCategoryEnum = IncomeCategoryEnum.parseByValue(declarationPO.getIncomeCategory());
List<TaxReportColumnPO> taxReportColumnPOS = getTaxReportColumnService(user).listByIncomeCategory(incomeCategoryEnum);
List<Object> heads = new ArrayList<>();
heads.add(SalaryI18nUtil.getI18nLabel(85429, "姓名"));
heads.add(SalaryI18nUtil.getI18nLabel(86185, "部门"));
heads.add(SalaryI18nUtil.getI18nLabel(86186, "手机号"));
heads.add(SalaryI18nUtil.getI18nLabel(86317, "工号"));
heads.addAll(SalaryEntityUtil.properties(taxReportColumnPOS, TaxReportColumnPO::getReportColumnName, Collectors.toList()));
List<List<Object>> rowList = new ArrayList<>();
rowList.add(heads);
XSSFWorkbook book = ExcelUtil.genWorkbookV2(rowList, incomeCategoryEnum.getDefaultLabel());
return book;
}
@Override
public Map<String, Object> preview(DownloadTemplateParam importParam) {
//excel文件id
String imageId = Util.null2String(importParam.getImageId());
Validate.notBlank(imageId, "imageId为空");
InputStream fileInputStream = null;
Map<String, Object> map = new HashMap<>();
try {
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(importParam.getImageId()));
Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
map.put("headers", ExcelSupport.getSheetHeader(sheet, 0));
map.put("list", ExcelParseHelper.parse2List(sheet, 1, 0));
return map;
} finally {
IOUtils.closeQuietly(fileInputStream);
}
}
@Override
public Map<String, Object> importData(DownloadTemplateParam param) {
Map<String, Object> apidatas = new HashMap<>();
//查询对于人员信息导入筛选的全局配置
SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode");
String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0";
// 租户下所有的人员
List<DataCollectionEmployee> salaryEmployees = getSalaryEmployeeService(user).listAllForReport();
TaxDeclarationPO declarationPO = getTaxDeclarationService(user).getById(param.getTaxDeclarationId());
IncomeCategoryEnum incomeCategoryEnum = IncomeCategoryEnum.parseByValue(declarationPO.getIncomeCategory());
List<TaxReportColumnPO> taxReportColumnPOS = getTaxReportColumnService(user).listByIncomeCategory(incomeCategoryEnum);
List<String> taxReportColumnNames = SalaryEntityUtil.properties(taxReportColumnPOS, TaxReportColumnPO::getReportColumnName, Collectors.toList());
List<TaxDeclarationValuePO> taxDeclarationValuePOS = getTaxDeclarationValueService(user).listByTaxDeclarationId(declarationPO.getId());
Map<Long, TaxDeclarationValuePO> empDeclarationValueMap = SalaryEntityUtil.convert2Map(taxDeclarationValuePOS, TaxDeclarationValuePO::getEmployeeId);
// 失败的数量
int errorCount = 0;
// 成功的数量
int successCount = 0;
Date now = new Date();
List<TaxDeclarationValuePO> addList = Lists.newArrayList();
List<TaxDeclarationValuePO> editList = Lists.newArrayList();
InputStream fileInputStream = null;
try {
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId()));
Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
// 错误提示信息
List<Map> excelComments = Lists.newArrayList();
// 存在错误的那行数据
List<Map<String, Object>> errorDatas = Lists.newArrayList();
// 表头
List<String> headers = ExcelSupport.getSheetHeader(sheet, 0);
List<Map<String, Object>> data = ExcelParseHelper.parse2Map(sheet, 1, 0);
if (CollectionUtils.isEmpty(headers)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", "表头为空");
excelComments.add(errorMessageMap);
apidatas.put("successCount", successCount);
apidatas.put("errorCount", errorCount);
apidatas.put("errorData", excelComments);
return apidatas;
}
if (CollectionUtils.isEmpty(data)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", "无数据");
excelComments.add(errorMessageMap);
apidatas.put("successCount", successCount);
apidatas.put("errorCount", errorCount);
apidatas.put("errorData", excelComments);
return apidatas;
}
Optional<String> first = taxReportColumnNames.stream().filter(name -> !headers.contains(name)).findFirst();
if (first.isPresent()) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", "申报模板异常,缺失" + first.get() + "列,请检查是否为" + incomeCategoryEnum.getDefaultLabel() + "申报模板");
excelComments.add(errorMessageMap);
apidatas.put("successCount", successCount);
apidatas.put("errorCount", errorCount);
apidatas.put("errorData", excelComments);
return apidatas;
}
for (int i = 0; i < data.size(); i++) {
String row = "" + (i + 2) + "";
boolean isError = false;
Map<String, Object> map = data.get(i);
Long employeeId = 0L;
String username = (String) map.getOrDefault("姓名", "");
String deparmentName = (String) map.getOrDefault("部门", "");
String mobile = (String) map.getOrDefault("手机号", "");
String workcode = (String) map.getOrDefault("工号", "");
if (StringUtils.isEmpty(username) && "0".equals(confValue)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(102838, "姓名不能为空"));
excelComments.add(errorMessageMap);
} else {
//筛选导入人员信息可以在人力资源池中匹配到的人员信息
List<DataCollectionEmployee> employeeSameIds = getSalaryEmployeeService(user).matchImportEmployee(salaryEmployees, username, deparmentName, mobile, workcode, null);
if (CollectionUtils.isEmpty(employeeSameIds)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "姓名错误,系统内不存在该姓名"));
excelComments.add(errorMessageMap);
} else if (employeeSameIds.size() > 1) {
//存在离职和在职状态取在职状态
employeeSameIds = employeeSameIds.stream()
.filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus()))
.collect(Collectors.toList());
if (employeeSameIds.size() != 1) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + "员工信息不存在或者存在多个员工");
excelComments.add(errorMessageMap);
} else {
employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0).getEmployeeId() : null;
}
} else {
employeeId = employeeSameIds.get(0).getEmployeeId();
}
}
if (isError) {
errorCount++;
errorDatas.add(map);
continue;
}
successCount++;
Map<String, String> valueMap = Maps.newHashMap();
for (TaxReportColumnPO taxReportColumn : taxReportColumnPOS) {
String value = (String) map.getOrDefault(taxReportColumn.getReportColumnName(), "");
valueMap.put(taxReportColumn.getReportColumnDataIndex(), StringUtils.isNotBlank(value) ? value.toString() : Objects.equals(taxReportColumn.getDataType(), SalaryDataTypeEnum.NUMBER.getValue()) ? "0.00" : "");
}
if (empDeclarationValueMap.containsKey(employeeId)) {
TaxDeclarationValuePO taxDeclarationValue = empDeclarationValueMap.get(employeeId);
taxDeclarationValue.setResultValue(valueMap);
taxDeclarationValue.setResultValueJson(JsonUtil.toJsonString(valueMap));
taxDeclarationValue.setUpdateTime(new Date());
taxDeclarationValue.setSource(SourceEnum.IMP.getValue());
editList.add(taxDeclarationValue);
} else {
//新增
TaxDeclarationValuePO taxDeclarationValue = TaxDeclarationValuePO.builder()
.id(IdGenerator.generate())
.taxDeclareRecordId(declarationPO.getTaxDeclareRecordId())
.taxDeclarationId(declarationPO.getId())
.employeeType(EmployeeTypeEnum.ORGANIZATION.getValue())
.employeeId(employeeId)
.resultValue(valueMap)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.creator(employeeId)
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.createTime(now)
.updateTime(now)
.source(SourceEnum.IMP.getValue())
.build();
addList.add(taxDeclarationValue);
}
}
getTaxDeclarationValueService(user).batchSave(addList);
getTaxDeclarationValueService(user).batchEdit(editList);
if (incomeCategoryEnum == IncomeCategoryEnum.ONETIME_ANNUAL_BONUS) {
TaxDeclareRecordPO declareRecordPO = getTaxDeclareRecordService(user).getById(declarationPO.getTaxDeclareRecordId());
getTaxDeclarationValueService(user).autoAddWagesDeclare(declareRecordPO);
}
apidatas.put("successCount", successCount);
apidatas.put("errorCount", errorCount);
apidatas.put("errorData", excelComments);
} finally {
IOUtils.closeQuietly(fileInputStream);
}
return apidatas;
}
}

View File

@ -94,6 +94,24 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration
return taxDeclarationPOS;
}
@Override
public List<TaxDeclarationPO> listByTaxDeclareRecordId(Long taxDeclareRecordId) {
if (Objects.isNull(taxDeclareRecordId)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
}
TaxDeclarationPO po = TaxDeclarationPO.builder().taxDeclareRecordId(taxDeclareRecordId).build();
return getTaxDeclarationMapper().listSome(po);
}
@Override
public List<TaxDeclarationPO> listByTaxDeclareRecordId(Long taxDeclareRecordId,Integer incomeCategory) {
if (Objects.isNull(taxDeclareRecordId)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
}
TaxDeclarationPO po = TaxDeclarationPO.builder().taxDeclareRecordId(taxDeclareRecordId).incomeCategory(incomeCategory).build();
return getTaxDeclarationMapper().listSome(po);
}
@Override
public PageInfo<TaxDeclarationPO> listPageByParam(TaxDeclarationListQueryParam queryParam) {
long currentEmployeeId = user.getUID();
@ -205,7 +223,7 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration
// 无薪资核算结果不允许生成个税申报表
if (CollectionUtils.isEmpty(salaryAcctResultPOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110093, "{0}无可申报数据")
.replace("{0}", SalaryDateUtil.getFormatYearMonth(saveParam.getSalaryMonth())));
.replace("{0}", SalaryDateUtil.getFormatYearMonth(saveParam.getSalaryMonth())));
}
Set<Long> salaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctResultPOS, SalaryAcctResultPO::getSalaryAcctRecordId);
@ -214,14 +232,14 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration
boolean notArchived = salaryAcctRecordPOS.stream().anyMatch(salaryAcctRecordPO -> Objects.equals(salaryAcctRecordPO.getStatus(), SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue()));
if (notArchived) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98875, "{0}有未归档数据,请全部归档后再申报")
.replace("{0}", SalaryDateUtil.getFormatYearMonth(saveParam.getSalaryMonth())));
.replace("{0}", SalaryDateUtil.getFormatYearMonth(saveParam.getSalaryMonth())));
}
// 如果当前薪资所属月下存在不同的税款所属期属于异常业务场景不允许生成个税申报表
Date taxCycle = salaryAcctRecordPOS.get(0).getTaxCycle();
boolean differentTaxCycle = salaryAcctRecordPOS.stream().anyMatch(salaryAcctRecordPO -> salaryAcctRecordPO.getTaxCycle().compareTo(taxCycle) != 0);
if (differentTaxCycle) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98876, "{0}存在不同的税款所属期,无法正常生成个税申报表,请调整账套设置,重新核算后再生成个税申报表")
.replace("{0}", SalaryDateUtil.getFormatYearMonth(saveParam.getSalaryMonth())));
.replace("{0}", SalaryDateUtil.getFormatYearMonth(saveParam.getSalaryMonth())));
}
// 查询薪资账套
Set<Long> salarySobIds = SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getSalarySobId);

View File

@ -3,6 +3,7 @@ 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.constant.SalaryDefaultTenantConstant;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
@ -10,12 +11,19 @@ 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;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclareRecordDetailSaveParam;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationValuePO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclareRecordPO;
import com.engine.salary.entity.taxdeclaration.po.TaxReportColumnPO;
import com.engine.salary.enums.salaryaccounting.EmployeeTypeEnum;
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
import com.engine.salary.enums.taxdeclaration.SourceEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationValueMapper;
import com.engine.salary.mapper.taxdeclaration.TaxDeclareRecordMapper;
import com.engine.salary.service.*;
import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.SalaryEntityUtil;
@ -24,6 +32,8 @@ import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import dm.jdbc.util.IdGenerator;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import weaver.hrm.User;
@ -47,6 +57,10 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
return MapperProxyFactory.getProxy(TaxDeclarationValueMapper.class);
}
private TaxDeclareRecordMapper getTaxDeclareRecordMapper() {
return MapperProxyFactory.getProxy(TaxDeclareRecordMapper.class);
}
private SalaryEmployeeService getSalaryEmployeeService(User user) {
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
@ -63,6 +77,10 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
return ServiceUtil.getService(TaxReportColumnServiceImpl.class, user);
}
private TaxDeclarationService getTaxDeclarationService(User user) {
return ServiceUtil.getService(TaxDeclarationServiceImpl.class, user);
}
@Override
public PageInfo<TaxDeclarationValuePO> listPageByTaxDeclarationIds(TaxDeclarationValueListQueryParam queryParam, Collection<Long> taxDeclarationIds) {
List<TaxDeclarationValuePO> taxDeclarationValuePOS = getTaxDeclarationValueMapper().listSome(TaxDeclarationValuePO.builder().taxDeclarationIds(taxDeclarationIds).build());
@ -76,6 +94,12 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
return decryptBatch(taxDeclarationValues);
}
@Override
public List<TaxDeclarationValuePO> listByTaxDeclarationId(Long taxDeclarationId) {
List<TaxDeclarationValuePO> taxDeclarationValues = getTaxDeclarationValueMapper().listSome(TaxDeclarationValuePO.builder().taxDeclarationId(taxDeclarationId).build());
return decryptBatch(taxDeclarationValues);
}
@Override
public List<TaxDeclarationValuePO> listByTaxDeclarationIdsNoDecrypt(Collection<Long> taxDeclarationIds) {
return getTaxDeclarationValueMapper().listSome(TaxDeclarationValuePO.builder().taxDeclarationIds(taxDeclarationIds).build());
@ -126,11 +150,85 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
List<List<TaxDeclarationValuePO>> partition = Lists.partition(taxDeclarationValues, 100);
for (List<TaxDeclarationValuePO> subTaxDeclarationValues : partition) {
subTaxDeclarationValues.forEach(getTaxDeclarationValueMapper()::insertIgnoreNull);
// getTaxDeclarationValueMapper().batchInsert(subTaxDeclarationValues);
}
}
}
@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);
}
}
}
@Override
public void save(TaxDeclareRecordDetailSaveParam param) {
TaxDeclarationPO taxDeclaration = getTaxDeclarationService(user).getById(param.getTaxDeclarationId());
if (taxDeclaration == null) {
throw new SalaryRunTimeException("个税申报表不存在!");
}
Long taxDeclareRecordId = taxDeclaration.getTaxDeclareRecordId();
TaxDeclareRecordPO declareRecordPO = getTaxDeclareRecordMapper().getById(taxDeclareRecordId);
if (declareRecordPO == null) {
throw new SalaryRunTimeException("个税申报记录不存在!");
}
TaxDeclarationValuePO po = TaxDeclarationValuePO.builder()
.id(IdGenerator.generate())
.taxDeclarationId(param.getTaxDeclarationId())
.taxDeclareRecordId(taxDeclareRecordId)
.employeeId(param.getEmployeeId())
.employeeType(param.getEmployeeType())
.resultValue(param.getTaxReportColumnValues())
.resultValueJson(JsonUtil.toJsonString(param.getTaxReportColumnValues()))
.createTime(new Date())
.updateTime(new Date())
.source(SourceEnum.ADD.getValue())
.creator((long) user.getUID())
.deleteType(0)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build();
encryptUtil.encrypt(po, TaxDeclarationValuePO.class);
getTaxDeclarationValueMapper().insertIgnoreNull(po);
//新增年终奖
if (IncomeCategoryEnum.ONETIME_ANNUAL_BONUS.getValue().equals(taxDeclaration.getIncomeCategory())) {
autoAddWagesDeclare(declareRecordPO);
}
}
@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());
po.setSource(SourceEnum.EDIT.getValue());
encryptUtil.encrypt(po, TaxDeclarationValuePO.class);
getTaxDeclarationValueMapper().updateIgnoreNull(po);
}
@Override
public TaxDeclarationValuePO getById(Long id) {
TaxDeclarationValuePO po = getTaxDeclarationValueMapper().getById(id);
if (po == null) {
throw new SalaryRunTimeException("个税申报明细不存在!");
}
encryptUtil.decrypt(po, TaxDeclarationValuePO.class);
po.setResultValue(JsonUtil.parseMap(po.getResultValueJson(), String.class));
return po;
}
@Override
public void deleteByTaxDeclareRecordIds(Collection<Long> taxDeclareRecordIds) {
if (CollectionUtils.isEmpty(taxDeclareRecordIds)) {
@ -150,4 +248,84 @@ public class TaxDeclarationValueServiceImpl extends Service implements TaxDeclar
});
return taxDeclarationValues;
}
@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;
}
//正常薪资的表头
List<TaxReportColumnPO> taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(IncomeCategoryEnum.WAGES_AND_SALARIES);
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);
}
}

View File

@ -26,6 +26,7 @@ import com.engine.salary.entity.taxapiflow.po.TaxDeclarationApiFlowRecordPO;
import com.engine.salary.entity.taxdeclaration.bo.*;
import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationRateDTO;
import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.DeclareTaxResultFeedbackQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam;
import com.engine.salary.entity.taxdeclaration.po.*;
@ -35,6 +36,7 @@ import com.engine.salary.entity.taxdeclaration.response.DeclareTaxResponse;
import com.engine.salary.entity.taxdeclaration.response.UpdateDeclareResponse;
import com.engine.salary.enums.employeedeclare.DeclareStatusEnum;
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
import com.engine.salary.enums.taxagent.TaxAgentTaxReturnStatusEnum;
import com.engine.salary.enums.taxdeclaration.*;
@ -307,6 +309,12 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
}
}
//补充正常工资薪金的申报人员
newTaxDeclareRecords.forEach(taxDeclareRecordPO -> {
getTaxDeclarationValueService(user).autoAddWagesDeclare(taxDeclareRecordPO);
});
//更新核算记录状态
getSalaryAcctRecordService(user).updateStatusByIds(salaryAcctRecordIds, SalaryAcctRecordStatusEnum.DECLARED);
// // 记录日志
@ -375,6 +383,9 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
}
}
//补充正常工资薪金的申报人员
getTaxDeclarationValueService(user).autoAddWagesDeclare(taxDeclareRecord);
//更新核算记录状态
getSalaryAcctRecordService(user).updateStatusByIds(salaryAcctRecordIds, SalaryAcctRecordStatusEnum.DECLARED);
}
@ -414,7 +425,15 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
// 薪资核算结果
Set<Long> salaryAcctEmployeeIdSet = SalaryEntityUtil.properties(incomeCategoryEntry.getValue(), SalaryAcctEmployeePO::getId);
List<List<SalaryAcctResultPO>> resultValues = salaryAcctEmployeeIdSet.stream().map(salaryAcctResultValueMap::get).filter(Objects::nonNull).collect(Collectors.toList());
TaxDeclareContext taxDeclareContext = new TaxDeclareContext().setSalaryAcctRecordMap(salaryAcctRecordMap).setSalaryAcctEmployees(incomeCategoryEntry.getValue()).setSalaryAcctResultValues(salaryAcctResultValues).setTaxDeclaration(taxDeclaration).setSalarySobTaxReportRuleMap(salarySobTaxReportRuleMap).setSalarySobAddUpRuleMap(salarySobAddUpRuleMap).setTaxReportColumns(taxReportColumnMap.get(incomeCategoryEntry.getKey())).setSalaryItems(salaryItems);
TaxDeclareContext taxDeclareContext = new TaxDeclareContext()
.setSalaryAcctRecordMap(salaryAcctRecordMap)
.setSalaryAcctEmployees(incomeCategoryEntry.getValue())
.setSalaryAcctResultValues(salaryAcctResultValues)
.setTaxDeclaration(taxDeclaration)
.setSalarySobTaxReportRuleMap(salarySobTaxReportRuleMap)
.setSalarySobAddUpRuleMap(salarySobAddUpRuleMap)
.setTaxReportColumns(taxReportColumnMap.get(incomeCategoryEntry.getKey()))
.setSalaryItems(salaryItems);
TaxDeclarationStrategy taxDeclarationStrategy = new TaxDeclarationCommon();
TaxDeclarationGenerateResult generateResult = taxDeclarationStrategy.generate(taxDeclareContext, (long) user.getUID());
taxDeclarationValues.addAll(generateResult.getTaxDeclarationValues());
@ -760,6 +779,7 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
// 申报类型
taxDeclareRecord.setTaxPayAmount(Util.null2String(declareTaxFeedbackResponse.getBody().get("ykjse")));
taxDeclareRecord.setPersonNum(Integer.parseInt(Optional.ofNullable(declareTaxFeedbackResponse.getBody().get("nsrc")).orElse("0").toString()));
taxDeclareRecord.setDeclareRequestId(taxDeclareRecord.getRequestId());
taxDeclareRecord.setRequestId("");
taxDeclareRecord.setUpdateTime(new Date());
BigDecimal purePaidAmount = SalaryEntityUtil.empty2Zero(taxDeclareRecord.getTaxPurePaidAmount());
@ -924,22 +944,23 @@ public class TaxDeclareRecordServiceImpl extends Service implements TaxDeclareRe
TaxDeclareRecordPO taxDeclareRecord = taxDeclareRequest.getTaxDeclareRecord();
DeclareClient declareClient = new DeclareClient(taxDeclareRecord.getTaxAgentId());
return declareClient.getDeclareTaxResultFeedback(taxDeclareRecord.getRequestId());
return declareClient.getDeclareTaxResultFeedback(taxDeclareRecord.getDeclareRequestId());
}
@Override
public XSSFWorkbook exportGetDeclareTaxResultFeedback(Long id, String requestId) {
public XSSFWorkbook exportGetDeclareTaxResultFeedback(DeclareTaxResultFeedbackQueryParam param) {
Long id = param.getId();
String requestId = param.getRequestId();
TaxDeclareRequest taxDeclareRequest = buildTaxDeclareRequest(id);
TaxDeclareRecordPO taxDeclareRecord = taxDeclareRequest.getTaxDeclareRecord();
DeclareClient declareClient = new DeclareClient(taxDeclareRecord.getTaxAgentId());
GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse = declareClient.getDeclareTaxResultFeedback(StringUtils.isEmpty(requestId) ? taxDeclareRecord.getRequestId() : requestId);
List<GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw> sscglb = declareTaxResultFeedbackResponse.getBody().getZhsd().getZcgzxj().getSscglb();
GetDeclareTaxResultFeedbackResponse declareTaxResultFeedbackResponse = declareClient.getDeclareTaxResultFeedback(StringUtils.isEmpty(requestId) ? taxDeclareRecord.getDeclareRequestId() : requestId);
// 需要导出的数据
List<List<Object>> excelSheetData = ExcelUtil.getExcelSheetData(GetDeclareTaxResultFeedbackResponse.Body.zhsd.zcgzxj.zhsdscjgbw.class, sscglb);
return ExcelUtil.genWorkbookV2(excelSheetData, "申报内置算税结果");
Map<String, List<List<Object>>> map = new HashMap<>();
List<TaxDeclarationPO> list = getTaxDeclarationService(user).listByTaxDeclareRecordId(id);
list.stream().map(TaxDeclarationPO::getIncomeCategory).map(IncomeCategoryEnum::parseByValue).forEach(e -> e.parseGetDeclareTaxResultFeedbackResponse(map, declareTaxResultFeedbackResponse));
return ExcelUtil.genWorkbookV2(map);
}

View File

@ -0,0 +1,32 @@
package com.engine.salary.util.excel;
import java.util.Arrays;
import java.util.Objects;
public enum DataTypeEnum {
string("string", "字符类型"),
number("string", "数字类型"),
date("string", "日期类型");
private String value;
private String name;
DataTypeEnum(String value, String name) {
this.value = value;
this.name = name;
}
public String getValue() {
return value;
}
public String getName() {
return name;
}
public static DataTypeEnum parseByValue(String value) {
return Arrays.stream(DataTypeEnum.values()).filter(typeEnum -> Objects.equals(typeEnum.getValue(), value)).findFirst().orElse(null);
}
}

View File

@ -0,0 +1,28 @@
package com.engine.salary.util.excel;
import java.lang.annotation.*;
/**
* 数据列表表头
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Target({ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface ExcelHead {
String title() default "";
String dataIndex() default "";
DataTypeEnum dataType() default DataTypeEnum.string;
int labelId() default -1;
String width() default "";
}

View File

@ -4,6 +4,7 @@ import com.engine.salary.annotation.SalaryTableColumn;
import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.SalaryDateUtil;
import com.google.common.collect.Lists;
import com.engine.salary.util.SalaryI18nUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.FillPatternType;
@ -14,6 +15,8 @@ import org.apache.poi.xssf.usermodel.*;
import java.awt.*;
import java.lang.reflect.Field;
import java.util.*;
import java.lang.reflect.Field;
import java.util.Date;
import java.util.List;
public class ExcelUtil {
@ -272,6 +275,71 @@ public class ExcelUtil {
return workbook;
}
public static XSSFWorkbook genWorkbookV2(Map<String, List<List<Object>>> map) {
XSSFWorkbook workbook = new XSSFWorkbook();
map.entrySet().forEach(en->{
String sheetName = en.getKey();
List<List<Object>> rowList = en.getValue();
// 设置title样式
XSSFCellStyle titleCellStyle = workbook.createCellStyle();
XSSFFont titleFont = workbook.createFont();
titleFont.setFontName("仿宋");
titleFont.setFontHeightInPoints((short) 15);
titleCellStyle.setFont(titleFont);
titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
titleCellStyle.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex());//背景色
titleCellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
// 设置主体样式
XSSFCellStyle cellStyle = workbook.createCellStyle();
XSSFFont font = workbook.createFont();
font.setFontName("宋体");
font.setFontHeightInPoints((short) 10);// 设置字体大小
cellStyle.setFont(font);// 选择需要用到的字体格式
cellStyle.setWrapText(true);
XSSFSheet sheet = workbook.createSheet(sheetName);
//自适应宽度
sheet.autoSizeColumn(0, true);
//默认列宽
sheet.setDefaultColumnWidth(20);
//默认行高
sheet.setDefaultRowHeightInPoints(18);
for (int rowIndex = 0; rowIndex < rowList.size(); rowIndex++) {
List<Object> infoList = rowList.get(rowIndex);
XSSFRow row = sheet.createRow(rowIndex);
for (int cellIndex = 0; cellIndex < infoList.size(); cellIndex++) {
XSSFCell cell = row.createCell(cellIndex);
if (rowIndex == 0) {
cell.setCellStyle(titleCellStyle);
} else {
cell.setCellStyle(cellStyle);
}
Object o = infoList.get(cellIndex);
if (o instanceof String) {
cell.setCellType(CellType.STRING);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof Boolean) {
cell.setCellType(CellType.BOOLEAN);
cell.setCellValue(String.valueOf(o));
} else if (o instanceof Date) {
cell.setCellType(CellType.STRING);
cell.setCellValue(SalaryDateUtil.getFormatLocalDate((Date) o));
} else {
cell.setCellType(CellType.STRING);
cell.setCellValue(o == null ? "" : o.toString());
}
}
}
});
return workbook;
}
public static XSSFWorkbook genWorkbook(ExcelSheetData excelSheetData) {
List<List<Object>> list = new ArrayList<>();
list.add(excelSheetData.getHeaders());
@ -314,4 +382,24 @@ public class ExcelUtil {
return rows;
}
/**
* 解析表头
*
* @param clazz
* @param headerList
* @param dataIndexList
* @param <T>
*/
public static <T> void parseHeader(Class<T> clazz, List<Object> headerList, List<String> dataIndexList) {
Field[] declaredFields = clazz.getDeclaredFields();
for (Field declaredField : declaredFields) {
if (!declaredField.isAnnotationPresent(ExcelHead.class)) {
continue;
}
ExcelHead annotation = declaredField.getAnnotation(ExcelHead.class);
headerList.add(SalaryI18nUtil.getI18nLabel(annotation.labelId(), annotation.title()));
dataIndexList.add(declaredField.getName());
}
}
}

View File

@ -305,12 +305,41 @@ public class EmployeeDeclareController {
}
/**
* 人员报送-出全部人员
* 人员报送-入预览
*
* @param queryParam 导出参数
* @return
*/
@POST
@Path("/preview")
@Produces(MediaType.APPLICATION_JSON)
public String preview(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeDeclareImportParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<EmployeeDeclareImportParam, Map<String, Object>>(user).run(getEmployeeDeclareWrapper(user)::preview, queryParam);
}
/**
* 人员报送-导入
*
* @param queryParam 导出参数
* @return
*/
@POST
@Path("/importData")
@Produces(MediaType.APPLICATION_JSON)
public String importData(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeDeclareImportParam queryParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<EmployeeDeclareImportParam, Map<String, Object>>(user).run(getEmployeeDeclareWrapper(user)::importData, queryParam);
}
/**
* 人员报送-导出全部人员
*
* @param param 导出参数
* @return
*/
@POST
@Path("/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response export(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody EmployeeDeclareListQueryParam param) {

View File

@ -222,14 +222,14 @@ public class TaxDeclarationController {
*
* @return
*/
@GET
@POST
@Path("/exportGetDeclareTaxResultFeedback")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportGetDeclareTaxResultFeedback(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id, @QueryParam(value = "requestId") String requestId) {
public Response exportGetDeclareTaxResultFeedback(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody DeclareTaxResultFeedbackQueryParam param) {
try {
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getTaxDeclareRecordWrapper(user).exportGetDeclareTaxResultFeedback(id ,requestId);
XSSFWorkbook workbook = getTaxDeclareRecordWrapper(user).exportGetDeclareTaxResultFeedback(param);
String fileName = "申报内置算税结果-" + LocalDate.now();
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
@ -334,6 +334,70 @@ public class TaxDeclarationController {
return new ResponseResult<Long, String>(user).run(getTaxDeclareRecordWrapper(user)::refreshData, taxDeclareRecordParam.getTaxDeclareRecordId());
}
/**
* 新增表单
*
* @param param
* @return
*/
@POST
@Path("/getAddForm")
@Produces(MediaType.APPLICATION_JSON)
public String getAddForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclareRecordDetailFormParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<TaxDeclareRecordDetailFormParam, TaxDeclareRecordDetailFormDTO>(user).run(getTaxDeclareRecordWrapper(user)::getAddForm, param);
}
/**
* 新增
*
* @param request
* @param response
* @param param
* @return
*/
@POST
@Path("/add")
@Produces(MediaType.APPLICATION_JSON)
public String add(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclareRecordDetailSaveParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<TaxDeclareRecordDetailSaveParam, String>(user).run(getTaxDeclareRecordWrapper(user)::add, param);
}
/**
* 编辑
*
* @param request
* @param response
* @param param
* @return
*/
@POST
@Path("/edit")
@Produces(MediaType.APPLICATION_JSON)
public String edit(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclareRecordDetailSaveParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<TaxDeclareRecordDetailSaveParam, String>(user).run(getTaxDeclareRecordWrapper(user)::edit, param);
}
/**
* 获取详细详细
*
* @param request
* @param response
* @param id
* @return
*/
@GET
@Path("/detailInfo")
@Produces(MediaType.APPLICATION_JSON)
public String edit(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "id") Long id) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<Long, TaxDeclareRecordDetailFormDTO>(user).run(getTaxDeclareRecordWrapper(user)::detailInfo, id);
}
/**
* 个税申报表详情列表
*
@ -378,9 +442,7 @@ public class TaxDeclarationController {
};
response.setContentType("application/octet-stream");
return Response.ok(output)
.header("Content-disposition", "attachment;filename=" + fileName)
.header("Cache-Control", "no-cache").build();
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
} catch (Exception e) {
log.error("个税申报表明细导出异常", e);
throw e;
@ -515,9 +577,7 @@ public class TaxDeclarationController {
};
response.setContentType("application/octet-stream");
return Response.ok(output)
.header("Content-disposition", "attachment;filename=" + fileName)
.header("Cache-Control", "no-cache").build();
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
} catch (Exception e) {
log.error("未报送的人员导出异常", e);
throw e;
@ -552,9 +612,7 @@ public class TaxDeclarationController {
};
response.setContentType("application/octet-stream");
return Response.ok(output)
.header("Content-disposition", "attachment;filename=" + fileName)
.header("Cache-Control", "no-cache").build();
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
} catch (Exception e) {
log.error("缺少申报数据的人员导出异常", e);
throw e;
@ -588,13 +646,57 @@ public class TaxDeclarationController {
};
response.setContentType("application/octet-stream");
return Response.ok(output)
.header("Content-disposition", "attachment;filename=" + fileName)
.header("Cache-Control", "no-cache").build();
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
} catch (Exception e) {
log.error("申报失败人员导出异常", e);
throw e;
}
}
@POST
@Path("/downloadTemplate")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response downloadTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody DownloadTemplateParam param) {
try {
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getTaxDeclareRecordWrapper(user).downloadTemplate(param);
String fileName = "申报表导入模板" + LocalDate.now();
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {
log.error(e.getMessage(), e);
}
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();
} catch (Exception e) {
log.error("申报表导入模板导出异常", e);
throw e;
}
}
@POST
@Path("/preview")
@Produces(MediaType.APPLICATION_JSON)
public String preview(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody DownloadTemplateParam importParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<DownloadTemplateParam, Map<String, Object>>(user).run(getTaxDeclareRecordWrapper(user)::preview, importParam);
}
@POST
@Path("/importData")
@Produces(MediaType.APPLICATION_JSON)
public String importAddUpDeduction(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody DownloadTemplateParam importParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<DownloadTemplateParam, Map<String, Object>>(user).run(getTaxDeclareRecordWrapper(user)::importData, importParam);
}
}

View File

@ -567,6 +567,26 @@ public class EmployeeDeclareWrapper extends Service {
return getEmployeeDeclareExcelService(user).exportTemplate(param);
}
/**
* 人员报送-导入数据
*
* @param param
* @return
*/
public Map<String, Object> preview(EmployeeDeclareImportParam param) {
return getEmployeeDeclareExcelService(user).preview(param);
}
/**
* 人员报送-导入数据
*
* @param param
* @return
*/
public Map<String, Object> importData(EmployeeDeclareImportParam param) {
return getEmployeeDeclareExcelService(user).importData(param);
}
/**
* 人员报送-导出本月全部的人员
*

View File

@ -4,13 +4,16 @@ import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.cache.SalaryCacheKey;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.employeedeclare.param.EmployeeDeclareListQueryParam;
import com.engine.salary.entity.employeedeclare.po.EmployeeDeclarePO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationDetailBO;
import com.engine.salary.entity.taxdeclaration.dto.*;
import com.engine.salary.entity.taxdeclaration.param.AbnormalEmployeeListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam;
import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationValueListQueryParam;
import com.engine.salary.entity.taxdeclaration.param.*;
import com.engine.salary.entity.taxdeclaration.po.*;
import com.engine.salary.enums.employeedeclare.CardTypeEnum;
import com.engine.salary.enums.employeedeclare.DeclareStatusEnum;
import com.engine.salary.enums.employeedeclare.EmploymentStatusEnum;
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
import com.engine.salary.enums.taxdeclaration.TaxDeclareStatusEnum;
import com.engine.salary.enums.taxdeclaration.TaxDeclareTypeEnum;
@ -33,7 +36,6 @@ import org.apache.commons.compress.utils.Lists;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.stereotype.Component;
import weaver.general.Util;
import weaver.hrm.User;
@ -49,7 +51,6 @@ import java.util.stream.Collectors;
* @version 1.0
**/
@Slf4j
@Component
public class TaxDeclareRecordWrapper extends Service {
@ -89,6 +90,15 @@ public class TaxDeclareRecordWrapper extends Service {
return ServiceUtil.getService(TaxDeclareFailServiceImpl.class, user);
}
private TaxReportColumnService getTaxReportColumnService(User user) {
return ServiceUtil.getService(TaxReportColumnServiceImpl.class, user);
}
private EmployeeDeclareService getEmployeeDeclareService(User user) {
return ServiceUtil.getService(EmployeeDeclareServiceImpl.class, user);
}
/**
* 个税申报记录列表
*
@ -463,12 +473,12 @@ public class TaxDeclareRecordWrapper extends Service {
public Object getDeclareTaxResultFeedback(Long id) {
return getTaxDeclareRecordService(user).getDeclareTaxResultFeedback(id);
return getTaxDeclareRecordService(user).getDeclareTaxResultFeedback(id);
}
public XSSFWorkbook exportGetDeclareTaxResultFeedback(Long id,String requestId) {
return getTaxDeclareRecordService(user).exportGetDeclareTaxResultFeedback(id, requestId);
public XSSFWorkbook exportGetDeclareTaxResultFeedback(DeclareTaxResultFeedbackQueryParam param) {
return getTaxDeclareRecordService(user).exportGetDeclareTaxResultFeedback(param);
}
/**
@ -660,4 +670,101 @@ public class TaxDeclareRecordWrapper extends Service {
return getTaxDeclarationExcelService(user).exportEmployee4Fail(queryParam);
}
public TaxDeclareRecordDetailFormDTO getAddForm(TaxDeclareRecordDetailFormParam param) {
TaxDeclarationPO taxDeclaration = getTaxDeclarationService(user).getById(param.getTaxDeclarationId());
if (taxDeclaration == null) {
throw new SalaryRunTimeException("申报表不存在!");
}
// 查询个税申报表列
List<TaxReportColumnPO> taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(IncomeCategoryEnum.parseByValue(taxDeclaration.getIncomeCategory()));
//当前税款所属期报送成功且状态正常的人员
List<EmployeeDeclarePO> employeeDeclarePOS = getEmployeeDeclareService(user).listByParam(
EmployeeDeclareListQueryParam
.builder()
.taxCycle(taxDeclaration.getTaxCycle())
.taxAgentId(taxDeclaration.getTaxAgentId())
.declareStatus(DeclareStatusEnum.DECLARE_SUCCESS)
.employmentStatus(EmploymentStatusEnum.NORMAL)
.build()
);
//过滤申报表中已存在的人员
List<TaxDeclarationValuePO> taxDeclarationValuePOS = getTaxDeclarationValueService(user).listByTaxDeclarationIds(Collections.singletonList(param.getTaxDeclarationId()));
Set<Long> empIds = SalaryEntityUtil.properties(taxDeclarationValuePOS, TaxDeclarationValuePO::getEmployeeId);
employeeDeclarePOS = employeeDeclarePOS.stream().filter(emp -> !empIds.contains(emp.getEmployeeId())).collect(Collectors.toList());
return TaxDeclareRecordDetailFormDTO.builder()
.taxReportColumns(TaxDeclarationDetailBO.convert2ListTaxReportColumn(taxReportColumns))
.employeeDeclares(employeeDeclarePOS)
.taxDeclarationId(taxDeclaration.getTaxAgentId())
.build();
}
/**
* 新增
*
* @param param
*/
public void add(TaxDeclareRecordDetailSaveParam param) {
getTaxDeclarationValueService(user).save(param);
}
/**
* 编辑
*
* @param param
*/
public void edit(TaxDeclareRecordDetailSaveParam param) {
getTaxDeclarationValueService(user).edit(param);
}
public TaxDeclareRecordDetailFormDTO detailInfo(Long id) {
TaxDeclarationValuePO declarationValuePO = getTaxDeclarationValueService(user).getById(id);
TaxDeclarationPO taxDeclarationPO = getTaxDeclarationService(user).getById(declarationValuePO.getTaxDeclarationId());
List<EmployeeDeclarePO> employeeDeclarePOS = getEmployeeDeclareService(user).listByParam(
EmployeeDeclareListQueryParam
.builder()
.taxCycle(taxDeclarationPO.getTaxCycle())
.taxAgentId(taxDeclarationPO.getTaxAgentId())
.employeeId(declarationValuePO.getEmployeeId())
.build()
);
if (CollectionUtils.isEmpty(employeeDeclarePOS)) {
throw new SalaryRunTimeException("当前人员未报送!");
}
EmployeeDeclarePO employeeDeclarePO = employeeDeclarePOS.get(0);
// 查询个税申报表列
List<TaxReportColumnPO> taxReportColumns = getTaxReportColumnService(user).listByIncomeCategory(IncomeCategoryEnum.parseByValue(taxDeclarationPO.getIncomeCategory()));
return TaxDeclareRecordDetailFormDTO
.builder()
.id(id)
.employeeId(employeeDeclarePO.getEmployeeId())
.employeeType(employeeDeclarePO.getEmployeeType())
.taxDeclarationId(taxDeclarationPO.getId())
.incomeCategory(IncomeCategoryEnum.parseByValue(taxDeclarationPO.getIncomeCategory()).getDefaultLabel())
.cardNum(employeeDeclarePO.getCardNum())
.cardType(SalaryEnumUtil.enumMatchByValue(employeeDeclarePO.getCardType(), CardTypeEnum.class).getDefaultLabel())
.username(employeeDeclarePO.getEmployeeName())
.jobNum(employeeDeclarePO.getJobNum())
.taxReportColumns(TaxDeclarationDetailBO.convert2ListTaxReportColumn(taxReportColumns))
.resultValue(declarationValuePO.getResultValue())
.build();
}
public XSSFWorkbook downloadTemplate(DownloadTemplateParam param) {
return getTaxDeclarationExcelService(user).downloadTemplate(param);
}
public Map<String, Object> preview(DownloadTemplateParam param) {
return getTaxDeclarationExcelService(user).preview(param);
}
public Map<String, Object> importData(DownloadTemplateParam param) {
return getTaxDeclarationExcelService(user).importData(param);
}
}