diff --git a/src/com/engine/salary/entity/taxdeclaration/TaxDeclaration.java b/src/com/engine/salary/entity/taxdeclaration/TaxDeclaration.java deleted file mode 100644 index 6f55346c1..000000000 --- a/src/com/engine/salary/entity/taxdeclaration/TaxDeclaration.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.engine.salary.entity.taxdeclaration; - -import com.fasterxml.jackson.annotation.JsonFormat; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.Date; - -/** - * 个税申报表 - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class TaxDeclaration { - /** - * 创建时间 - */ - private Date createTime; - /** - * 创建人 - */ - private Long creator; - /** - * 是否已删除。0:未删除、1:已删除 - */ - private Integer deleteType; - /** - * 备注 - */ - private String description; - /** - * 主键id - */ - private Long id; - /** - * 薪资所属月 - */ - @JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8") - private Date salaryMonth; - /** - * 个税扣缴义务人id - */ - private Long taxAgentId; - /** - * 税款所属期 - */ - private Date taxCycle; - /** - * 租户ID - */ - private String tenantKey; - /** - * 更新时间 - */ - private Date updateTime; - - /** - * 应税项目。1:正常工资薪金所得 - */ - private Integer incomeCategory; - -} \ No newline at end of file diff --git a/src/com/engine/salary/entity/taxdeclaration/TaxDeclarationDetail.java b/src/com/engine/salary/entity/taxdeclaration/TaxDeclarationDetail.java deleted file mode 100644 index 371c5c524..000000000 --- a/src/com/engine/salary/entity/taxdeclaration/TaxDeclarationDetail.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.engine.salary.entity.taxdeclaration; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -import java.util.Date; - -/** - * 个税申报表详情 - */ -@Data -@Builder -@NoArgsConstructor -@AllArgsConstructor -public class TaxDeclarationDetail { - /** - * 创建时间 - */ - private Date createTime; - /** - * 创建人 - */ - private Long creator; - /** - * 是否已删除。0:未删除、1:已删除 - */ - private Integer deleteType; - /** - * 人员id - */ - private Long employeeId; - /** - * 字段code - */ - private String fieldCode; - /** - * 字段的值 - */ - private String fieldValue; - /** - * 主键id - */ - private Long id; - /** - * 个税申报记录的id - */ - private Long taxDeclarationId; - /** - * 租户ID - */ - private String tenantKey; - /** - * 更新时间 - */ - private Date updateTime; - -} \ No newline at end of file diff --git a/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationBO.java b/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationBO.java index 8fe70c828..41283a0fb 100644 --- a/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationBO.java +++ b/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationBO.java @@ -630,7 +630,7 @@ public class TaxDeclarationBO { TaxDeclarationDetailPO taxDeclarationDetailPO = TaxDeclarationDetailPO.builder() .id(IdGenerator.generate()) .taxDeclarationId(taxDeclaration.getId()) -// .employeeType(employeeType) + .employeeType(employeeType) .employeeId(employeeId) .fieldCode(fieldCode) .fieldValue(fieldValue) diff --git a/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationDetailBO.java b/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationDetailBO.java index 65dbef9e1..18e8815d8 100644 --- a/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationDetailBO.java +++ b/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationDetailBO.java @@ -15,12 +15,13 @@ import org.apache.commons.lang3.StringUtils; import java.util.*; /** - * @description: 个税申报表详情 - * @author: xiajun - * @modified By: xiajun - * @date: 2022/3/14 18:31 - * @version:v1.0 - */ + * 个税申报表详情 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ public class TaxDeclarationDetailBO { /** @@ -43,28 +44,28 @@ public class TaxDeclarationDetailBO { for (TaxDeclarationEmployeeDTO dto : taxDeclarationEmployeeDTOS) { Map fieldCodeKeyFieldValueMap = SalaryEntityUtil.convert2Map(employeeIdKeyTaxDeclarationDetailPOMap.get(dto.getEmployeeType() + "_" + dto.getEmployeeId()), TaxDeclarationDetailPO::getFieldCode, TaxDeclarationDetailPO::getFieldValue); - TaxDeclarationWageListDTO taxDeclarationWageListDTO = new TaxDeclarationWageListDTO() - .setCardType(SalaryI18nUtil.getI18nLabel(105564, "居民身份证")) - .setIncome(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.INCOME)) - .setTaxFreeIncome(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.TAX_FREE_INCOME)) - .setEndowmentInsurance(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ENDOWMENT_INSURANCE)) - .setMedicalInsurance(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.MEDICAL_INSURANCE)) - .setUnemploymentInsurance(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.UNEMPLOYMENT_INSURANCE)) - .setHousingProvidentFund(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.HOUSING_PROVIDENT_FUND)) - .setAddUpChildEducation(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ADD_UP_CHILD_EDUCATION)) - .setAddUpHousingLoanInterest(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ADD_UP_HOUSING_LOAN_INTEREST)) - .setAddUpHousingRent(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ADD_UP_HOUSING_RENT)) - .setAddUpContinuingEducation(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ADD_UP_CONTINUING_EDUCATION)) - .setAddUpSupportElderly(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ADD_UP_SUPPORT_ELDERLY)) - .setAddUpIllnessMedical(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ADD_UP_ILLNESS_MEDICAL)) - .setAddUpInfantCare(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ADD_UP_INFANT_CARE)) - .setAnnuity(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ANNUITY)) - .setCommercialHealthInsurance(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.COMMERCIAL_HEALTH_INSURANCE)) - .setTaxDeferredEndowmentInsurance(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.TAX_DEFERRED_ENDOWMENT_INSURANCE)) - .setOther(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.OTHER)) - .setAllowedDonation(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ALLOWED_DONATION)) - .setTaxDeduction(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.TAX_DEDUCTION)) - .setDescription(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.DESCRIPTION)); + TaxDeclarationWageListDTO taxDeclarationWageListDTO = TaxDeclarationWageListDTO.builder() + .cardType(SalaryI18nUtil.getI18nLabel(105564, "居民身份证")) + .income(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.INCOME)) + .taxFreeIncome(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.TAX_FREE_INCOME)) + .endowmentInsurance(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ENDOWMENT_INSURANCE)) + .medicalInsurance(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.MEDICAL_INSURANCE)) + .unemploymentInsurance(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.UNEMPLOYMENT_INSURANCE)) + .housingProvidentFund(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.HOUSING_PROVIDENT_FUND)) + .addUpChildEducation(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ADD_UP_CHILD_EDUCATION)) + .addUpHousingLoanInterest(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ADD_UP_HOUSING_LOAN_INTEREST)) + .addUpHousingRent(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ADD_UP_HOUSING_RENT)) + .addUpContinuingEducation(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ADD_UP_CONTINUING_EDUCATION)) + .addUpSupportElderly(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ADD_UP_SUPPORT_ELDERLY)) + .addUpIllnessMedical(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ADD_UP_ILLNESS_MEDICAL)) + .addUpInfantCare(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ADD_UP_INFANT_CARE)) + .annuity(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ANNUITY)) + .commercialHealthInsurance(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.COMMERCIAL_HEALTH_INSURANCE)) + .taxDeferredEndowmentInsurance(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.TAX_DEFERRED_ENDOWMENT_INSURANCE)) + .other(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.OTHER)) + .allowedDonation(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.ALLOWED_DONATION)) + .taxDeduction(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.TAX_DEDUCTION)) + .description(fieldCodeKeyFieldValueMap.get(TaxDeclarationDataIndexConstant.DESCRIPTION)).build(); if (dto.getEmployeeType() == null || Objects.equals(dto.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())) { DataCollectionEmployee simpleEmployee = simpleEmployeeMap.get(dto.getEmployeeId()); taxDeclarationWageListDTO.setId(simpleEmployee.getEmployeeId()) diff --git a/src/com/engine/salary/entity/taxdeclaration/dto/TaxDeclarationWageListDTO.java b/src/com/engine/salary/entity/taxdeclaration/dto/TaxDeclarationWageListDTO.java index b231dbec0..b6aaac452 100644 --- a/src/com/engine/salary/entity/taxdeclaration/dto/TaxDeclarationWageListDTO.java +++ b/src/com/engine/salary/entity/taxdeclaration/dto/TaxDeclarationWageListDTO.java @@ -1,6 +1,13 @@ package com.engine.salary.entity.taxdeclaration.dto; +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 lombok.AllArgsConstructor; +import lombok.Builder; import lombok.Data; +import lombok.NoArgsConstructor; import lombok.experimental.Accessors; /** @@ -12,84 +19,113 @@ import lombok.experimental.Accessors; * @version 1.0 **/ @Data +@Builder +@NoArgsConstructor +@AllArgsConstructor @Accessors(chain = true) +@SalaryTable(pageId = "a4f85287-e3f9-6612-adn9-7d34564y6rj8", tableType = WeaTableType.CHECKBOX) public class TaxDeclarationWageListDTO { - //主键id") + + //主键id private Long id; - //人员id") + //人员id private Long employeeId; - //"工号") + @SalaryTableColumn(text = "工号", width = "10%", column = "jobNum") + @TableTitle(title = "工号", dataIndex = "jobNum", key = "jobNum") private String jobNum; - //"姓名") + @SalaryTableColumn(text = "姓名", width = "10%", column = "username") + @TableTitle(title = "工号", dataIndex = "jobNum", key = "jobNum") private String username; - //证件类型") + @SalaryTableColumn(text = "证件类型", width = "10%", column = "cardType") + @TableTitle(title = "工号", dataIndex = "jobNum", key = "jobNum") private String cardType; - //证件号码") + @SalaryTableColumn(text = "证件号码", width = "10%", column = "cardNum") + private String cardNum; - //本期收入") + @SalaryTableColumn(text = "本期收入", width = "10%", column = "income") + @TableTitle(title = "本期收入", dataIndex = "income", key = "income") private String income; - //本期免税收入") + @SalaryTableColumn(text = "本期免税收入", width = "10%", column = "taxFreeIncome") + @TableTitle(title = "本期免税收入", dataIndex = "taxFreeIncome", key = "taxFreeIncome") private String taxFreeIncome; - //"基本养老保险费") + @SalaryTableColumn(text = "基本养老保险费", width = "10%", column = "endowmentInsurance") + @TableTitle(title = "基本养老保险费", dataIndex = "endowmentInsurance", key = "endowmentInsurance") private String endowmentInsurance; - //"基本医疗保险费") + @SalaryTableColumn(text = "基本医疗保险费", width = "10%", column = "medicalInsurance") + @TableTitle(title = "基本医疗保险费", dataIndex = "medicalInsurance", key = "medicalInsurance") private String medicalInsurance; - //失业保险费") + @SalaryTableColumn(text = "失业保险费", width = "10%", column = "unemploymentInsurance") + @TableTitle(title = "失业保险费", dataIndex = "unemploymentInsurance", key = "unemploymentInsurance") private String unemploymentInsurance; - //住房公积金") + @SalaryTableColumn(text = "住房公积金", width = "10%", column = "housingProvidentFund") + @TableTitle(title = "住房公积金", dataIndex = "housingProvidentFund", key = "housingProvidentFund") private String housingProvidentFund; - //"累计子女教育") + @SalaryTableColumn(text = "累计子女教育", width = "10%", column = "addUpChildEducation") + @TableTitle(title = "累计子女教育", dataIndex = "addUpChildEducation", key = "addUpChildEducation") private String addUpChildEducation; - //累计住房贷款利息") + @SalaryTableColumn(text = "累计住房贷款利息", width = "10%", column = "addUpHousingLoanInterest") + @TableTitle(title = "累计住房贷款利息", dataIndex = "addUpHousingLoanInterest", key = "addUpHousingLoanInterest") private String addUpHousingLoanInterest; - //"累计住房租金") + @SalaryTableColumn(text = "累计住房租金", width = "10%", column = "addUpHousingRent") + @TableTitle(title = "累计住房租金", dataIndex = "addUpHousingRent", key = "addUpHousingRent") private String addUpHousingRent; - //累计继续教育") + @SalaryTableColumn(text = "累计继续教育", width = "10%", column = "addUpContinuingEducation") + @TableTitle(title = "累计继续教育", dataIndex = "addUpContinuingEducation", key = "addUpContinuingEducation") private String addUpContinuingEducation; - //"累计赡养老人") + @SalaryTableColumn(text = "累计赡养老人", width = "10%", column = "addUpSupportElderly") + @TableTitle(title = "累计赡养老人", dataIndex = "addUpSupportElderly", key = "addUpSupportElderly") private String addUpSupportElderly; - //"累计大病医疗") + @SalaryTableColumn(text = "累计大病医疗", width = "10%", column = "addUpIllnessMedical") + @TableTitle(title = "累计大病医疗", dataIndex = "addUpIllnessMedical", key = "addUpIllnessMedical") private String addUpIllnessMedical; - //累计婴幼儿照护") + @SalaryTableColumn(text = "累计婴幼儿照护", width = "10%", column = "addUpInfantCare") + @TableTitle(title = "累计婴幼儿照护", dataIndex = "addUpInfantCare", key = "addUpInfantCare") private String addUpInfantCare; - //"企业(职业)年金") + @SalaryTableColumn(text = "企业(职业)年金", width = "10%", column = "annuity") + @TableTitle(title = "企业(职业)年金", dataIndex = "annuity", key = "annuity") private String annuity; - //商业健康保险") + @SalaryTableColumn(text = "商业健康保险", width = "10%", column = "commercialHealthInsurance") + @TableTitle(title = "商业健康保险", dataIndex = "commercialHealthInsurance", key = "commercialHealthInsurance") private String commercialHealthInsurance; - //"税延养老保险") + @SalaryTableColumn(text = "税延养老保险", width = "10%", column = "taxDeferredEndowmentInsurance") + @TableTitle(title = "税延养老保险", dataIndex = "taxDeferredEndowmentInsurance", key = "taxDeferredEndowmentInsurance") private String taxDeferredEndowmentInsurance; - //"其他") + @SalaryTableColumn(text = "其他", width = "10%", column = "other") + @TableTitle(title = "其他", dataIndex = "other", key = "other") private String other; - //"准允扣除的捐赠额") + @SalaryTableColumn(text = "准予扣除的捐赠额", width = "10%", column = "allowedDonation") + @TableTitle(title = "准予扣除的捐赠额", dataIndex = "allowedDonation", key = "allowedDonation") private String allowedDonation; - //"减免税额") + @SalaryTableColumn(text = "减免税额", width = "10%", column = "taxDeduction") + @TableTitle(title = "减免税额", dataIndex = "taxDeduction", key = "taxDeduction") private String taxDeduction; - //"备注") + @SalaryTableColumn(text = "备注", width = "10%", column = "description") + @TableTitle(title = "备注", dataIndex = "description", key = "description") private String description; } diff --git a/src/com/engine/salary/entity/taxdeclaration/po/TaxDeclarationDetailPO.java b/src/com/engine/salary/entity/taxdeclaration/po/TaxDeclarationDetailPO.java index 4fb6fecf9..90787406d 100644 --- a/src/com/engine/salary/entity/taxdeclaration/po/TaxDeclarationDetailPO.java +++ b/src/com/engine/salary/entity/taxdeclaration/po/TaxDeclarationDetailPO.java @@ -37,6 +37,11 @@ public class TaxDeclarationDetailPO { */ private Long employeeId; + /** + * 人员类型 + */ + private Integer employeeType; + /** * 申报表字段code */ @@ -73,8 +78,11 @@ public class TaxDeclarationDetailPO { */ private Date updateTime; - /** - * 应税项目。1:正常工资薪金所得 - */ - private Integer incomeCategory; + + + +// /** +// * 应税项目。1:正常工资薪金所得 +// */ +// private Integer incomeCategory; } diff --git a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml index 506b41b80..da7125274 100644 --- a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml @@ -15,6 +15,7 @@ - SELECT - - FROM hrsa_tax_declaration_detail t + + + + + + + - - + SELECT DISTINCT employee_type, employee_id + FROM hrsa_tax_declaration_detail + WHERE delete_type = 0 + AND tax_declaration_id = #{taxDeclarationId} + - - - INSERT INTO hrsa_tax_declaration_detail - - create_time, - creator, - delete_type, - employee_id, - field_code, - field_value, - id, - tax_declaration_id, - tenant_key, - update_time, - - - #{createTime}, - #{creator}, - #{deleteType}, - #{employeeId}, - #{fieldCode}, - #{fieldValue}, - #{id}, - #{taxDeclarationId}, - #{tenantKey}, - #{updateTime}, - - - - - - select hrsa_tax_declaration_detail_id.currval from dual - - INSERT INTO hrsa_tax_declaration_detail - - create_time, - creator, - delete_type, - employee_id, - field_code, - field_value, - id, - tax_declaration_id, - tenant_key, - update_time, - - - #{createTime}, - #{creator}, - #{deleteType}, - #{employeeId}, - #{fieldCode}, - #{fieldValue}, - #{id}, - #{taxDeclarationId}, - #{tenantKey}, - #{updateTime}, - - - - - - INSERT INTO hrsa_tax_declaration_detail - - - - create_time, - - - creator, - - - delete_type, - - - employee_id, - - - field_code, - - - field_value, - - - id, - - - tax_declaration_id, - - - tenant_key, - - - update_time, - - - - - #{createTime}, - - - #{creator}, - - - #{deleteType}, - - - #{employeeId}, - - - #{fieldCode}, - - - #{fieldValue}, - - - #{id}, - - - #{taxDeclarationId}, - - - #{tenantKey}, - - - #{updateTime}, - - - - - - - select hrsa_tax_declaration_detail_id.currval from dual - - INSERT INTO hrsa_tax_declaration_detail - - - - create_time, - - - creator, - - - delete_type, - - - employee_id, - - - field_code, - - - field_value, - - - id, - - - tax_declaration_id, - - - tenant_key, - - - update_time, - - - - - #{createTime}, - - - #{creator}, - - - #{deleteType}, - - - #{employeeId}, - - - #{fieldCode}, - - - #{fieldValue}, - - - #{id}, - - - #{taxDeclarationId}, - - - #{tenantKey}, - - - #{updateTime}, - - - - INSERT INTO hrsa_tax_declaration_detail (id, tax_declaration_id, employee_id, field_code, field_value, creator, - create_time, update_time, delete_type, tenant_key) + create_time, update_time, delete_type, tenant_key, employee_type) VALUES ( @@ -297,7 +96,8 @@ #{item.createTime}, #{item.updateTime}, #{item.deleteType}, - #{item.tenantKey} + #{item.tenantKey}, + #{item.employeeType} ) @@ -305,7 +105,7 @@ INSERT INTO hrsa_tax_declaration_detail (id, tax_declaration_id, employee_id, field_code, field_value, creator, - create_time, update_time, delete_type, tenant_key) + create_time, update_time, delete_type, tenant_key, employee_type) select @@ -318,7 +118,8 @@ #{item.createTime}, #{item.updateTime}, #{item.deleteType}, - #{item.tenantKey} + #{item.tenantKey}, + #{item.employeeType} from dual @@ -326,7 +127,7 @@ INSERT INTO hrsa_tax_declaration_detail (id,tax_declaration_id, employee_id, field_code, field_value, creator, - create_time, update_time, delete_type, tenant_key) + create_time, update_time, delete_type, tenant_key, employee_type) VALUES ( #{item.id}, @@ -338,73 +139,12 @@ #{item.createTime}, #{item.updateTime}, #{item.deleteType}, - #{item.tenantKey} + #{item.tenantKey}, + #{item.employeeType} ) - - - UPDATE hrsa_tax_declaration_detail - - create_time=#{createTime}, - creator=#{creator}, - delete_type=#{deleteType}, - employee_id=#{employeeId}, - field_code=#{fieldCode}, - field_value=#{fieldValue}, - tax_declaration_id=#{taxDeclarationId}, - tenant_key=#{tenantKey}, - update_time=#{updateTime}, - - WHERE id = #{id} AND delete_type = 0 - - - - - - UPDATE hrsa_tax_declaration_detail - - - create_time=#{createTime}, - - - creator=#{creator}, - - - delete_type=#{deleteType}, - - - employee_id=#{employeeId}, - - - field_code=#{fieldCode}, - - - field_value=#{fieldValue}, - - - tax_declaration_id=#{taxDeclarationId}, - - - tenant_key=#{tenantKey}, - - - update_time=#{updateTime}, - - - WHERE id = #{id} AND delete_type = 0 - - - - - - UPDATE hrsa_tax_declaration_detail - SET delete_type=1 - WHERE id = #{id} - AND delete_type = 0 - - UPDATE hrsa_tax_declaration_detail diff --git a/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationMapper.java b/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationMapper.java index fbba364cd..c2d89bed6 100644 --- a/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationMapper.java +++ b/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationMapper.java @@ -1,6 +1,5 @@ package com.engine.salary.mapper.taxdeclaration; -import com.engine.salary.entity.taxdeclaration.TaxDeclaration; import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -18,7 +17,7 @@ public interface TaxDeclarationMapper { * @param id 主键 * @return 返回记录,没有返回null */ - TaxDeclaration getById(Long id); + TaxDeclarationPO getById(Long id); /** diff --git a/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationMapper.xml b/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationMapper.xml index ad45c91fa..beaddd9c4 100644 --- a/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationMapper.xml +++ b/src/com/engine/salary/mapper/taxdeclaration/TaxDeclarationMapper.xml @@ -1,7 +1,7 @@ - + diff --git a/src/com/engine/salary/service/SalaryEmployeeService.java b/src/com/engine/salary/service/SalaryEmployeeService.java index e7b87144a..a1c15cc0a 100644 --- a/src/com/engine/salary/service/SalaryEmployeeService.java +++ b/src/com/engine/salary/service/SalaryEmployeeService.java @@ -33,6 +33,8 @@ public interface SalaryEmployeeService { DataCollectionEmployee getEmployeeById(Long employeeId); + List getEmployeeByIds(List simpleEmployeeIds); + /** * 获取当前登录人的信息 * @param employeeId diff --git a/src/com/engine/salary/service/TaxDeclarationDetailService.java b/src/com/engine/salary/service/TaxDeclarationDetailService.java index 6c529e96b..f552bea50 100644 --- a/src/com/engine/salary/service/TaxDeclarationDetailService.java +++ b/src/com/engine/salary/service/TaxDeclarationDetailService.java @@ -1,6 +1,7 @@ package com.engine.salary.service; import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationDetailListDTO; +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.param.TaxDeclarationDetailListQueryParam; @@ -8,14 +9,16 @@ import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO; import com.engine.salary.util.page.PageInfo; import java.util.Collection; +import java.util.List; /** - * @description: 个税申报表明细 - * @author: xiajun - * @modified By: xiajun - * @date: Created in 1/23/22 4:28 PM - * @version:v1.0 - */ + * 个税申报表明细 + *

Copyright: Copyright (c) 2022

+ *

Company: 泛微软件

+ * + * @author qiantao + * @version 1.0 + **/ public interface TaxDeclarationDetailService { /** @@ -23,19 +26,17 @@ public interface TaxDeclarationDetailService { * * @param taxDeclarationId 个税申报表id * @param employeeIds 人员id - * @param tenantKey 租户key * @return */ - //List listByTaxDeclarationIdAndEmployeeIds(Long taxDeclarationId, Collection employeeIds, String tenantKey); + List listByTaxDeclarationIdAndEmployeeIds(Long taxDeclarationId, Collection employeeIds); /** * 根据列表查询条件查询个税申报列表明细中的人员 * * @param queryParam 列表查询条件 - * @param tenantKey 租户key * @return */ - //Page listPage4EmployeeIdByParam(TaxDeclarationDetailListQueryParam queryParam, String tenantKey); + PageInfo listPage4EmployeeIdByParam(TaxDeclarationDetailListQueryParam queryParam); /** * 根据列表查询条件查询个税申报列表明细 diff --git a/src/com/engine/salary/service/TaxDeclarationService.java b/src/com/engine/salary/service/TaxDeclarationService.java index 7bb1578b6..d50a9701e 100644 --- a/src/com/engine/salary/service/TaxDeclarationService.java +++ b/src/com/engine/salary/service/TaxDeclarationService.java @@ -2,7 +2,6 @@ package com.engine.salary.service; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; -import com.engine.salary.entity.taxdeclaration.TaxDeclaration; import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam; import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam; import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO; @@ -19,7 +18,7 @@ public interface TaxDeclarationService { List countByTaxDeclarationId(Collection taxAgentIds); //表单 - TaxDeclaration getById(Long id); + TaxDeclarationPO getById(Long id); Map getForm(Map params); diff --git a/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java b/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java index 822736551..de5530a4f 100644 --- a/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryEmployeeServiceImpl.java @@ -7,13 +7,16 @@ import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.salarysob.bo.SalarySobRangeBO; import com.engine.salary.entity.salarysob.param.SalarySobRangeEmpQueryParam; import com.engine.salary.entity.salarysob.po.SalarySobRangePO; +import com.engine.salary.mapper.datacollection.EmployMapper; import com.engine.salary.service.SalaryEmployeeService; import com.engine.salary.service.SalarySobRangeService; import com.engine.salary.util.SalaryEntityUtil; +import com.engine.salary.util.db.MapperProxyFactory; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.math.NumberUtils; import weaver.hrm.User; +import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Set; @@ -35,6 +38,10 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee return (SalarySobRangeService) ServiceUtil.getService(SalarySobRangeServiceImpl.class, user); } + private EmployMapper getEmployMapper() { + return MapperProxyFactory.getProxy(EmployMapper.class); + } + @Override public List listAll() { return employBiz.listEmployee(); @@ -80,4 +87,13 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee public DataCollectionEmployee getEmployeeById(Long employeeId) { return employBiz.getEmployeeById(employeeId); } + + @Override + public List getEmployeeByIds(List simpleEmployeeIds) { + if(CollectionUtils.isEmpty(simpleEmployeeIds)){ + return new ArrayList<>(); + } + return getEmployMapper().getEmployeeByIds(simpleEmployeeIds); + + } } diff --git a/src/com/engine/salary/service/impl/TaxDeclarationDetailServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclarationDetailServiceImpl.java index 3c74a8470..f30ab7b9e 100644 --- a/src/com/engine/salary/service/impl/TaxDeclarationDetailServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclarationDetailServiceImpl.java @@ -3,23 +3,33 @@ package com.engine.salary.service.impl; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.entity.datacollection.DataCollectionEmployee; +import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationBO; +import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationDetailBO; import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationDetailListDTO; +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.param.TaxDeclarationDetailListQueryParam; import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO; +import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO; +import com.engine.salary.enums.salaryaccounting.EmployeeTypeEnum; import com.engine.salary.mapper.taxdeclaration.TaxDeclarationDetailMapper; import com.engine.salary.service.SalaryEmployeeService; +import com.engine.salary.service.TaxAgentService; import com.engine.salary.service.TaxDeclarationDetailService; +import com.engine.salary.service.TaxDeclarationService; +import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; +import com.engine.salary.util.page.SalaryPageUtil; import com.google.common.collect.Lists; -import com.mzlion.core.lang.CollectionUtils; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.BooleanUtils; +import weaver.hrm.User; -import java.util.Collection; -import java.util.Collections; -import java.util.List; +import java.util.*; +import java.util.stream.Collectors; /** * @description: 个税申报表明细 @@ -35,30 +45,37 @@ public class TaxDeclarationDetailServiceImpl extends Service implements TaxDecla } private SalaryEmployeeService getSalaryEmployeeService() { + return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user); + } + + private TaxDeclarationService getTaxDeclarationService(User user) { + return ServiceUtil.getService(TaxDeclarationServiceImpl.class, user); + } + + private TaxAgentService getTaxAgentService(User user) { + return ServiceUtil.getService(TaxAgentServiceImpl.class, user); + } + + private SalaryEmployeeService getSalaryEmployeeService(User user) { return (SalaryEmployeeService) ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user); } - /*@Override - public List listByTaxDeclarationIdAndEmployeeIds(Long taxDeclarationId, Collection employeeIds, String tenantKey) { + @Override + public List listByTaxDeclarationIdAndEmployeeIds(Long taxDeclarationId, Collection employeeIds) { if (CollectionUtils.isEmpty(employeeIds)) { return Collections.emptyList(); } - return new LambdaQueryChainWrapper<>(taxDeclarationDetailMapper) - .eq(TaxDeclarationDetailPO::getTenantKey, tenantKey) - .eq(TaxDeclarationDetailPO::getDeleteType, 0) - .eq(TaxDeclarationDetailPO::getTaxDeclarationId, taxDeclarationId) - .in(TaxDeclarationDetailPO::getEmployeeId, employeeIds) - .list(); + + return getTaxDeclarationDetailMapper().listByTaxDeclarationIdAndEmployeeIds(taxDeclarationId, employeeIds); } @Override - public Page listPage4EmployeeIdByParam(TaxDeclarationDetailListQueryParam queryParam, String tenantKey) { - // 分页参数 - Page page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize()); - // 查询个税申报表明细中的人员(分页) - return taxDeclarationDetailMapper.listEmployeeId(page, queryParam.getTaxDeclarationId(), tenantKey); + public PageInfo listPage4EmployeeIdByParam(TaxDeclarationDetailListQueryParam queryParam) { + SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); + List taxDeclarationEmployeeDTOS = getTaxDeclarationDetailMapper().listPage4EmployeeId(queryParam.getTaxDeclarationId()); + return new PageInfo<>(taxDeclarationEmployeeDTOS, TaxDeclarationEmployeeDTO.class); } -*/ + @Override public PageInfo listDtoPageByParam(TaxDeclarationDetailListQueryParam queryParam) { // 查询个税申报表明细的人员 @@ -83,12 +100,99 @@ public class TaxDeclarationDetailServiceImpl extends Service implements TaxDecla @Override public PageInfo listDtoPageByParam4Labor(TaxDeclarationDetailListQueryParam queryParam) { + return null; } + /** + * 根据权限范围过滤 + * + * @param taxDeclarationPO + * @param taxDeclarationEmployeeDTOS + * @return + */ + private List filterByAuthority(TaxDeclarationPO taxDeclarationPO, List taxDeclarationEmployeeDTOS) { + long employeeId = user.getUID(); + if (CollectionUtils.isEmpty(taxDeclarationEmployeeDTOS)) { + return Collections.emptyList(); + } + // 判断是否开启了分权 + Boolean openDevolution = getTaxAgentService(user).isOpenDevolution(); + // 是否是总管理员 + Boolean isChief = getTaxAgentService(user).isChief(employeeId); + if (BooleanUtils.isFalse(openDevolution) || isChief) { + return taxDeclarationEmployeeDTOS; + } + // 查询权限范围内的人员 + List taxAgentEmployeeDTOS = getTaxAgentService(user).listTaxAgentAndEmployee(employeeId); + Set simpleEmployeeKeySet = SalaryEntityUtil.properties(taxAgentEmployeeDTOS, taxAgentEmployeeDTO -> taxAgentEmployeeDTO.getEmployeeId() + "-" + taxAgentEmployeeDTO.getTaxAgentId()); + // 查询权限范围内的外部人员 +// List extEmployeePOS = extEmployeeService.listCanUseByEmployeeId(employeeId, tenantKey); +// Set extEmployeeKeySet = SalaryEntityUtil.properties(extEmployeePOS, extEmployeePO -> extEmployeePO.getId() + "-" + extEmployeePO.getTaxAgentId()); + // 根据权限范围过滤 + return taxDeclarationEmployeeDTOS.stream().filter(taxDeclarationEmployeeDTO -> { + if (taxDeclarationEmployeeDTO.getEmployeeType() == null || Objects.equals(taxDeclarationEmployeeDTO.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue()) + && simpleEmployeeKeySet.contains(taxDeclarationEmployeeDTO.getEmployeeId() + "-" + taxDeclarationPO.getTaxAgentId())) { + return true; + } +// if (Objects.equals(taxDeclarationEmployeeDTO.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue()) +// && extEmployeeKeySet.contains(taxDeclarationEmployeeDTO.getEmployeeId() + "-" + taxDeclarationPO.getTaxAgentId())) { +// return true; +// } + return false; + }).collect(Collectors.toList()); + } + + @Override public PageInfo listDtoPageByParam4Wage(TaxDeclarationDetailListQueryParam queryParam) { - return null; + + // 查询个税申报主表 + TaxDeclarationPO taxDeclarationPO = getTaxDeclarationService(user).getById(queryParam.getTaxDeclarationId()); + // 查询个税申报表明细的人员 + PageInfo employeeIdPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize()); + // 判断是否开启了分权 + Boolean openDevolution = getTaxAgentService(user).isOpenDevolution(); + // 是否是总管理员 + Boolean isChief = getTaxAgentService(user).isChief((long) user.getUID()); + if (BooleanUtils.isTrue(openDevolution) && !isChief) { + List taxDeclarationEmployeeDTOS = getTaxDeclarationDetailMapper().list4EmployeeId(queryParam.getTaxDeclarationId()); + // 根据权限过滤 + taxDeclarationEmployeeDTOS = filterByAuthority(taxDeclarationPO, taxDeclarationEmployeeDTOS); + employeeIdPage.setTotal(taxDeclarationEmployeeDTOS.size()); + employeeIdPage.setList(SalaryPageUtil.subList((int) employeeIdPage.getPageNum(), (int) employeeIdPage.getPageSize(), taxDeclarationEmployeeDTOS)); + } else { + employeeIdPage = listPage4EmployeeIdByParam(queryParam); + } + PageInfo dtoPage = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),TaxDeclarationWageListDTO.class); + dtoPage.setTotal(employeeIdPage.getTotal()); + if (CollectionUtils.isNotEmpty(employeeIdPage.getList())) { + List list = employeeIdPage.getList(); + // 查询个税申报表明细 + Set employeeIds = SalaryEntityUtil.properties(list, TaxDeclarationEmployeeDTO::getEmployeeId); + List taxDeclarationDetailPOS = listByTaxDeclarationIdAndEmployeeIds(queryParam.getTaxDeclarationId(), + employeeIds); + // 查询人员信息 + List simpleEmployeeIds = list.stream() + .filter(taxDeclarationEmployeeDTO -> Objects.equals(taxDeclarationEmployeeDTO.getEmployeeType(), EmployeeTypeEnum.ORGANIZATION.getValue())) + .map(TaxDeclarationEmployeeDTO::getEmployeeId) + .collect(Collectors.toList()); + List simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIds(simpleEmployeeIds); + // 查询人员薪资(身份证号码等) +// List simpleUserInfos = salaryEmployeeService.listByEmployeeIds(simpleEmployeeIds, tenantKey); + // 查询外部人员 +// Set extEmployeeIds = employeeIdPage.getRecords().stream() +// .filter(taxDeclarationEmployeeDTO -> Objects.equals(taxDeclarationEmployeeDTO.getEmployeeType(), EmployeeTypeEnum.EXT_EMPLOYEE.getValue())) +// .map(TaxDeclarationEmployeeDTO::getEmployeeId) +// .collect(Collectors.toSet()); +// List extEmployees = extEmployeeService.listByIds(extEmployeeIds, tenantKey); + // 转换成列表dto + List taxDeclarationWageListDTOS = TaxDeclarationDetailBO.convert2ListDTO4Wage(taxDeclarationDetailPOS, + employeeIdPage.getList(), simpleEmployees); + dtoPage.setList(taxDeclarationWageListDTOS); + } + return dtoPage; + } @Override @@ -104,12 +208,7 @@ public class TaxDeclarationDetailServiceImpl extends Service implements TaxDecla return Collections.emptyList(); } -// return new LambdaQueryChainWrapper<>(taxDeclarationDetailMapper) -// .eq(TaxDeclarationDetailPO::getTenantKey, tenantKey) -// .eq(TaxDeclarationDetailPO::getDeleteType, 0) -// .eq(TaxDeclarationDetailPO::getTaxDeclarationId, taxDeclarationId) -// .in(TaxDeclarationDetailPO::getEmployeeId, employeeIds) -// .list(); + return getTaxDeclarationDetailMapper().listByTaxDeclarationIdAndEmployeeIds(taxDeclarationId, employeeIds); } diff --git a/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java index ad76e3fe7..379f97326 100644 --- a/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java @@ -7,28 +7,35 @@ import com.engine.salary.cmd.taxDeclaration.TaxDeclarationGetFormCmd; import com.engine.salary.cmd.taxDeclaration.TaxDeclarationGetTaxDeclarationInfoCmd; import com.engine.salary.cmd.taxDeclaration.TaxDeclarationUpdateCmd; import com.engine.salary.common.LocalDateRange; +import com.engine.salary.entity.datacollection.AddUpSituation; import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; +import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO; +import com.engine.salary.entity.salaryitem.po.SalaryItemPO; +import com.engine.salary.entity.salarysob.po.SalarySobPO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; -import com.engine.salary.entity.taxdeclaration.TaxDeclaration; +import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationBO; import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam; import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam; import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO; +import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.mapper.datacollection.AddUpSituationMapper; +import com.engine.salary.mapper.salaryacct.SalaryAcctRecordMapper; import com.engine.salary.mapper.taxdeclaration.TaxDeclarationMapper; -import com.engine.salary.service.AddUpSituationService; -import com.engine.salary.service.TaxAgentService; -import com.engine.salary.service.TaxDeclarationDetailService; -import com.engine.salary.service.TaxDeclarationService; +import com.engine.salary.service.*; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; +import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.BooleanUtils; import weaver.hrm.User; import java.util.*; +import java.util.stream.Collectors; public class TaxDeclarationServiceImpl extends Service implements TaxDeclarationService { @@ -36,6 +43,14 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration return MapperProxyFactory.getProxy(TaxDeclarationMapper.class); } + private SalaryAcctRecordMapper getSalaryAcctRecordMapper() { + return MapperProxyFactory.getProxy(SalaryAcctRecordMapper.class); + } + + private AddUpSituationMapper getAddUpSituationMapper() { + return MapperProxyFactory.getProxy(AddUpSituationMapper.class); + } + private TaxDeclarationDetailService getTaxDeclarationDetailService(User user) { return ServiceUtil.getService(TaxDeclarationDetailServiceImpl.class, user); } @@ -48,6 +63,21 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration return ServiceUtil.getService(TaxAgentServiceImpl.class, user); } + private SalarySobService getSalarySobService(User user) { + return ServiceUtil.getService(SalarySobServiceImpl.class, user); + } + + private SalaryAcctResultService getSalaryAcctResultService(User user) { + return ServiceUtil.getService(SalaryAcctResultServiceImpl.class, user); + } + + private SalaryItemService getSalaryItemService(User user) { + return ServiceUtil.getService(SalaryItemServiceImpl.class, user); + } + + private SalaryAcctRecordService getSalaryAcctRecordService(User user) { + return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user); + } @Override public PageInfo listPageByParam(TaxDeclarationListQueryParam queryParam) { @@ -80,7 +110,7 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration // 查询个税申报表 SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List taxDeclarationPOS = getTaxDeclarationMapper().listSome(po); - return new PageInfo<>(taxDeclarationPOS,TaxDeclarationPO.class); + return new PageInfo<>(taxDeclarationPOS, TaxDeclarationPO.class); } @@ -95,7 +125,7 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration //根据id获取TaxDeclaration @Override - public TaxDeclaration getById(Long id) { + public TaxDeclarationPO getById(Long id) { return getTaxDeclarationMapper().getById(id); } @@ -111,8 +141,97 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration @Override public void save(TaxDeclarationSaveParam saveParam) { - //return commandExecutor.execute(new TaxDeclarationSaveCmd(saveParam)); - return; + long currentEmployeeId = user.getUID(); + + // 个税扣缴义务人id + Set taxAgentIds; + Boolean openDevolution = getTaxAgentService(user).isOpenDevolution(); + if (BooleanUtils.isFalse(openDevolution)) { + taxAgentIds = SalaryEntityUtil.properties(getTaxAgentService(user).listAll(), TaxAgentPO::getId); + } else { + taxAgentIds = SalaryEntityUtil.properties(getTaxAgentService(user).listAllTaxAgentsAsAdmin(currentEmployeeId), TaxAgentPO::getId); + } + + // 检查是否具有权限 + if (CollectionUtils.isEmpty(taxAgentIds)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "对不起,您不具备任何个税扣缴义务人的管理权限")); + } + + // 查询个税扣缴义务人 + List taxAgentPOS = getTaxAgentService(user).listByIds(taxAgentIds); + Map taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgentPOS, TaxAgentPO::getId, TaxAgentPO::getName); + + // 薪资所属月的日期范围 + LocalDateRange salaryMonthDateRange = SalaryDateUtil.localDate2Range(SalaryDateUtil.localDateToDate(saveParam.getSalaryMonth().atDay(1))); + if (Objects.isNull(salaryMonthDateRange)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "薪资所属月参数错误")); + } + + // 查询薪资所属月个税扣缴义务人已经生成过的个税申报表 + List taxDeclarationPOS = listBySalaryMonthTax(TaxDeclarationPO.builder().salaryMonths(salaryMonthDateRange).taxAgentIds(taxAgentNameMap.keySet()).build()); + // 已经生成过个税申报表,不允许再次生成个税申报表 + if (CollectionUtils.isNotEmpty(taxDeclarationPOS)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(107986, "{0}在{1}已经生成过个税申报表,不允许再次生成") + .replace("{0}", taxAgentNameMap.get(taxDeclarationPOS.get(0).getTaxAgentId())) + .replace("{1}", saveParam.getSalaryMonth().toString())); + } + // 查询薪资所属月的薪资核算记录 + List salaryAcctRecordPOS = listBySalaryMonth(SalaryAcctRecordPO.builder().salaryMonths(salaryMonthDateRange).build()); + // 无薪资核算记录,不允许生成个税申报表 + if (CollectionUtils.isEmpty(salaryAcctRecordPOS)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98874, "{0}无申报数据").replace("{0}", saveParam.getSalaryMonth().toString())); + } + // 查询薪资核算结果 + List salaryAcctResultPOS = getSalaryAcctResultService(user) + .listBySalaryAcctRecordIdsAndTaxAgentIds(SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getId), taxAgentIds); + + // 无薪资核算结果,不允许生成个税申报表 + if (CollectionUtils.isEmpty(salaryAcctResultPOS)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110093, "{0}无可申报数据") + .replace("{0}", saveParam.getSalaryMonth().toString())); + } + + Set salaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctResultPOS, SalaryAcctResultPO::getSalaryAcctRecordId); + salaryAcctRecordPOS = salaryAcctRecordPOS.stream().filter(salaryAcctRecordPO -> salaryAcctRecordIds.contains(salaryAcctRecordPO.getId())).collect(Collectors.toList()); + // 如果存在未归档的,也不允许生成个税申报表 + boolean notArchived = salaryAcctRecordPOS.stream().anyMatch(salaryAcctRecordPO -> !Objects.equals(salaryAcctRecordPO.getStatus(), SalaryAcctRecordStatusEnum.ARCHIVED.getValue())); + if (notArchived) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98875, "{0}有未归档数据,请全部归档后再申报") + .replace("{0}", saveParam.getSalaryMonth().toString())); + } + // 如果当前薪资所属月下存在不同的税款所属期,属于异常业务场景,不允许生成个税申报表 + 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}", saveParam.getSalaryMonth().toString())); + } + // 查询薪资账套 + Set salarySobIds = SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getSalarySobId); + List salarySobPOS = getSalarySobService(user).listByIds(salarySobIds); + + // 查询所有薪资项目 + List salaryItemPOS = getSalaryItemService(user).listAll(); + + + // 处理要保存的数据 + TaxDeclarationBO.Result result = TaxDeclarationBO.handle(saveParam, taxCycle, user, salaryItemPOS, salarySobPOS, salaryAcctResultPOS); + // 保存个税申报表 + if (CollectionUtils.isNotEmpty(result.getNeedInsertTaxDeclarations())) { + getTaxDeclarationMapper().batchInsert(result.getNeedInsertTaxDeclarations()); + } + // 保存个税申报表明细 + if (CollectionUtils.isNotEmpty(result.getNeedInsertTaxDeclarationDetails())) { + getTaxDeclarationDetailService(user).batchSave(result.getNeedInsertTaxDeclarationDetails()); + } + // 保存累计情况 + if (CollectionUtils.isNotEmpty(result.getNeedInsertAddUpSituations())) { + getAddUpSituationService(user).deleteByTaxYearMonthAndTaxAgentIds(SalaryDateUtil.localDate2YearMonth(taxCycle), taxAgentIds); + List> partition = Lists.partition((List) result.getNeedInsertAddUpSituations(), 100); + partition.forEach(getAddUpSituationMapper()::insertData); + } + // 更新薪资核算记录的状态 + getSalaryAcctRecordService(user).updateStatusByIds(salaryAcctRecordIds, SalaryAcctRecordStatusEnum.DECLARED); } @Override @@ -149,4 +268,13 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration return getTaxDeclarationMapper().listSome(TaxDeclarationPO.builder().salaryMonths(salaryMonthDateRange).build()); } + + public List listBySalaryMonthTax(TaxDeclarationPO build) { + return getTaxDeclarationMapper().listSome(build); + } + + public List listBySalaryMonth(SalaryAcctRecordPO po) { + return getSalaryAcctRecordMapper().listSome(po); + } + } diff --git a/src/com/engine/salary/web/TaxDeclarationController.java b/src/com/engine/salary/web/TaxDeclarationController.java index 9c0ae1f5b..42313f6af 100644 --- a/src/com/engine/salary/web/TaxDeclarationController.java +++ b/src/com/engine/salary/web/TaxDeclarationController.java @@ -33,7 +33,6 @@ import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.text.ParseException; import java.time.LocalDate; -import java.util.Map; @Slf4j @@ -103,7 +102,7 @@ public class TaxDeclarationController { public String listTaxDeclarationDetail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody TaxDeclarationDetailListQueryParam param) { User user = HrmUserVarify.getUser(request, response); param.setTaxDeclarationId(Long.parseLong(param.getTaxDeclarationIdStr())); - return new ResponseResult>(user).run(getTaxDeclarationDetailWrapper(user)::listPage, param); + return new ResponseResult(user).run(getTaxDeclarationDetailWrapper(user)::listPage, param); } //个税申报表相关信息 diff --git a/src/com/engine/salary/wrapper/TaxDeclarationDetailWrapper.java b/src/com/engine/salary/wrapper/TaxDeclarationDetailWrapper.java index b6d787b78..8b8c6e066 100644 --- a/src/com/engine/salary/wrapper/TaxDeclarationDetailWrapper.java +++ b/src/com/engine/salary/wrapper/TaxDeclarationDetailWrapper.java @@ -1,67 +1,64 @@ package com.engine.salary.wrapper; -import com.cloudstore.eccom.pc.table.WeaTableColumn; -import com.cloudstore.eccom.result.WeaResultMsg; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; -import com.engine.salary.component.SalaryWeaTable; -import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationDetailListColumn; -import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationDetailListDTO; +import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationWageListDTO; import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationDetailListQueryParam; +import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO; import com.engine.salary.service.TaxDeclarationDetailService; +import com.engine.salary.service.TaxDeclarationService; import com.engine.salary.service.impl.TaxDeclarationDetailServiceImpl; +import com.engine.salary.service.impl.TaxDeclarationServiceImpl; import com.engine.salary.util.page.PageInfo; import lombok.extern.slf4j.Slf4j; import weaver.hrm.User; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -/** @description: 个税申报表明细 +/** + * @description: 个税申报表明细 * @author: xiajun * @modified By: xiajun * @date: Created in 1/23/22 6:07 PM - * @version:v1.0*/ + * @version:v1.0 + */ @Slf4j public class TaxDeclarationDetailWrapper extends Service { private TaxDeclarationDetailService getTaxDeclarationDetailService(User user) { - return (TaxDeclarationDetailService) ServiceUtil.getService(TaxDeclarationDetailServiceImpl.class, user); + return ServiceUtil.getService(TaxDeclarationDetailServiceImpl.class, user); } + private TaxDeclarationService getTaxDeclarationService(User user) { + return ServiceUtil.getService(TaxDeclarationServiceImpl.class, user); + } - /** 个税申报表明细列表 + /** + * 个税申报表明细列表 * * @param queryParam 列表查询条件 - * @return*/ + * @return + */ - public Map listPage(TaxDeclarationDetailListQueryParam queryParam) { - PageInfo dtoPage = getTaxDeclarationDetailService(user).listDtoPageByParam(queryParam); - // 列表的表头 - List weaTableColumns = TaxDeclarationDetailListColumn.listTableColumn().stream() - .map(weaTableColumnWapper -> (WeaTableColumn) weaTableColumnWapper) - .collect(Collectors.toList()); - SalaryWeaTable table = new SalaryWeaTable(user, TaxDeclarationDetailListDTO.class); - table.setColumns(weaTableColumns); + public PageInfo listPage(TaxDeclarationDetailListQueryParam queryParam) { - dtoPage.setTotal(dtoPage.getPageSize()); - dtoPage.setPageNum(queryParam.getCurrent()); - dtoPage.setPageSize(queryParam.getPageSize()); + TaxDeclarationPO taxDeclarationPO = getTaxDeclarationService(user).getById(queryParam.getTaxDeclarationId()); - WeaResultMsg result = new WeaResultMsg(false); - result.putAll(table.makeDataResult()); - result.success(); - Map datas = new HashMap<>(); - datas.put("pageInfo", dtoPage); - datas.put("dataKey",result.getResultMap()); - datas.put("pageUid", "taxDeclarationDetailList"); - return datas; + // 正常工资薪金所得 +// if (Objects.equals(taxDeclarationPO.getIncomeCategory(), IncomeCategoryEnum.WAGES_AND_SALARIES.getValue())) { + PageInfo dtoPage = getTaxDeclarationDetailService(user).listDtoPageByParam4Wage(queryParam); +// weaTable = SalaryFormatUtil.getInstance().buildTable(TaxDeclarationWageListDTO.class, dtoPage); +// } +// // 劳务报酬所得 +// if (Objects.equals(taxDeclarationPO.getIncomeCategory(), IncomeCategoryEnum.REMUNERATION_FOR_LABOR.getValue())) { +// Page dtoPage = taxDeclarationDetailService.listDtoPageByParam4Labor(queryParam, employeeId, tenantKey); +// weaTable = SalaryFormatUtil.getInstance().buildTable(TaxDeclarationLaborListDTO.class, dtoPage); +// } + + + return dtoPage; } } diff --git a/src/com/engine/salary/wrapper/TaxDeclarationWrapper.java b/src/com/engine/salary/wrapper/TaxDeclarationWrapper.java index 50c5c5ecf..df7acfb9a 100644 --- a/src/com/engine/salary/wrapper/TaxDeclarationWrapper.java +++ b/src/com/engine/salary/wrapper/TaxDeclarationWrapper.java @@ -3,16 +3,9 @@ package com.engine.salary.wrapper; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.biz.EmployBiz; -import com.engine.salary.common.LocalDateRange; import com.engine.salary.component.WeaFormOption; -import com.engine.salary.entity.datacollection.AddUpSituation; import com.engine.salary.entity.datacollection.DataCollectionEmployee; -import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; -import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO; -import com.engine.salary.entity.salaryitem.po.SalaryItemPO; -import com.engine.salary.entity.salarysob.po.SalarySobPO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; -import com.engine.salary.entity.taxdeclaration.TaxDeclaration; import com.engine.salary.entity.taxdeclaration.bo.TaxDeclarationBO; import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationFormDTO; import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationInfoDTO; @@ -20,22 +13,17 @@ import com.engine.salary.entity.taxdeclaration.dto.TaxDeclarationListDTO; import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam; import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam; import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO; -import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; import com.engine.salary.exception.SalaryRunTimeException; -import com.engine.salary.mapper.datacollection.AddUpSituationMapper; -import com.engine.salary.mapper.salaryacct.SalaryAcctRecordMapper; -import com.engine.salary.mapper.taxdeclaration.TaxDeclarationMapper; -import com.engine.salary.service.*; -import com.engine.salary.service.impl.*; +import com.engine.salary.service.TaxAgentService; +import com.engine.salary.service.TaxDeclarationService; +import com.engine.salary.service.impl.TaxAgentServiceImpl; +import com.engine.salary.service.impl.TaxDeclarationServiceImpl; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; -import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.lang3.BooleanUtils; -import org.springframework.transaction.annotation.Transactional; import weaver.hrm.User; import java.text.SimpleDateFormat; @@ -60,42 +48,6 @@ public class TaxDeclarationWrapper extends Service { return ServiceUtil.getService(TaxAgentServiceImpl.class, user); } - private TaxDeclarationDetailService getTaxDeclarationDetailService(User user) { - return ServiceUtil.getService(TaxDeclarationDetailServiceImpl.class, user); - } - - private SalaryAcctRecordService getSalaryAcctRecordService(User user) { - return ServiceUtil.getService(SalaryAcctRecordServiceImpl.class, user); - } - - private TaxDeclarationMapper getTaxDeclarationMapper() { - return MapperProxyFactory.getProxy(TaxDeclarationMapper.class); - } - - private SalaryAcctRecordMapper getSalaryAcctRecordMapper() { - return MapperProxyFactory.getProxy(SalaryAcctRecordMapper.class); - } - - private AddUpSituationMapper getAddUpSituationMapper() { - return MapperProxyFactory.getProxy(AddUpSituationMapper.class); - } - - private AddUpSituationService getAddUpSituationService(User user) { - return ServiceUtil.getService(AddUpSituationServiceImpl.class, user); - } - - private SalarySobService getSalarySobService(User user) { - return ServiceUtil.getService(SalarySobServiceImpl.class, user); - } - - private SalaryAcctResultService getSalaryAcctResultService(User user) { - return ServiceUtil.getService(SalaryAcctResultServiceImpl.class, user); - } - private SalaryItemService getSalaryItemService(User user) { - return (SalaryItemService) ServiceUtil.getService(SalaryItemServiceImpl.class, user); - } - - /** * 个税申报表列表 * @@ -130,7 +82,7 @@ public class TaxDeclarationWrapper extends Service { TaxDeclarationFormDTO formDTO = new TaxDeclarationFormDTO(); if (Objects.nonNull(id)) { // 查询个税申报表 - TaxDeclaration taxDeclaration = getTaxDeclarationService(user).getById(id); + TaxDeclarationPO taxDeclaration = getTaxDeclarationService(user).getById(id); if (Objects.isNull(taxDeclaration)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98877, "个税申报表不存在或已删除")); } @@ -173,7 +125,7 @@ public class TaxDeclarationWrapper extends Service { */ public TaxDeclarationInfoDTO getTaxDeclarationInfoById(Long id) { // 查询个税申报表 - TaxDeclaration taxDeclaration = getTaxDeclarationService(user).getById(id); + TaxDeclarationPO taxDeclaration = getTaxDeclarationService(user).getById(id); if (Objects.isNull(taxDeclaration)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98877, "个税申报表不存在或已删除")); } @@ -190,107 +142,11 @@ public class TaxDeclarationWrapper extends Service { * * @param saveParam 保存参数 */ - @Transactional(rollbackFor = Exception.class) public void save(TaxDeclarationSaveParam saveParam) { - long currentEmployeeId = user.getUID(); - - // 个税扣缴义务人id - Set taxAgentIds; - Boolean openDevolution = getTaxAgentService(user).isOpenDevolution(); - if (BooleanUtils.isFalse(openDevolution)) { - taxAgentIds = SalaryEntityUtil.properties(getTaxAgentService(user).listAll(), TaxAgentPO::getId); - } else { - taxAgentIds = SalaryEntityUtil.properties(getTaxAgentService(user).listAllTaxAgentsAsAdmin(currentEmployeeId), TaxAgentPO::getId); - } - - // 检查是否具有权限 - if (CollectionUtils.isEmpty(taxAgentIds)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "对不起,您不具备任何个税扣缴义务人的管理权限")); - } - - // 查询个税扣缴义务人 - List taxAgentPOS = getTaxAgentService(user).listByIds(taxAgentIds); - Map taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgentPOS, TaxAgentPO::getId, TaxAgentPO::getName); - - // 薪资所属月的日期范围 - LocalDateRange salaryMonthDateRange = SalaryDateUtil.localDate2Range(SalaryDateUtil.localDateToDate(saveParam.getSalaryMonth().atDay(1))); - if (Objects.isNull(salaryMonthDateRange)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "薪资所属月参数错误")); - } - - // 查询薪资所属月个税扣缴义务人已经生成过的个税申报表 - List taxDeclarationPOS = listBySalaryMonthTax(TaxDeclarationPO.builder().salaryMonths(salaryMonthDateRange).taxAgentIds(taxAgentNameMap.keySet()).build()); - // 已经生成过个税申报表,不允许再次生成个税申报表 - if (CollectionUtils.isNotEmpty(taxDeclarationPOS)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(107986, "{0}在{1}已经生成过个税申报表,不允许再次生成") - .replace("{0}", taxAgentNameMap.get(taxDeclarationPOS.get(0).getTaxAgentId())) - .replace("{1}", saveParam.getSalaryMonth().toString())); - } - // 查询薪资所属月的薪资核算记录 - List salaryAcctRecordPOS = listBySalaryMonth(SalaryAcctRecordPO.builder().salaryMonths(salaryMonthDateRange).build()); - // 无薪资核算记录,不允许生成个税申报表 - if (CollectionUtils.isEmpty(salaryAcctRecordPOS)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98874, "{0}无申报数据").replace("{0}", saveParam.getSalaryMonth().toString())); - } - // 查询薪资核算结果 - List salaryAcctResultPOS = getSalaryAcctResultService(user) - .listBySalaryAcctRecordIdsAndTaxAgentIds(SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getId), taxAgentIds); - - // 无薪资核算结果,不允许生成个税申报表 - if (CollectionUtils.isEmpty(salaryAcctResultPOS)) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(110093, "{0}无可申报数据") - .replace("{0}", saveParam.getSalaryMonth().toString())); - } - - Set salaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctResultPOS, SalaryAcctResultPO::getSalaryAcctRecordId); - salaryAcctRecordPOS = salaryAcctRecordPOS.stream().filter(salaryAcctRecordPO -> salaryAcctRecordIds.contains(salaryAcctRecordPO.getId())).collect(Collectors.toList()); - // 如果存在未归档的,也不允许生成个税申报表 - boolean notArchived = salaryAcctRecordPOS.stream().anyMatch(salaryAcctRecordPO -> !Objects.equals(salaryAcctRecordPO.getStatus(), SalaryAcctRecordStatusEnum.ARCHIVED.getValue())); - if (notArchived) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98875, "{0}有未归档数据,请全部归档后再申报") - .replace("{0}", saveParam.getSalaryMonth().toString())); - } - // 如果当前薪资所属月下存在不同的税款所属期,属于异常业务场景,不允许生成个税申报表 - 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}", saveParam.getSalaryMonth().toString())); - } - // 查询薪资账套 - Set salarySobIds = SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getSalarySobId); - List salarySobPOS = getSalarySobService(user).listByIds(salarySobIds); - - // 查询所有薪资项目 - List salaryItemPOS = getSalaryItemService(user).listAll(); - - - // 处理要保存的数据 - TaxDeclarationBO.Result result = TaxDeclarationBO.handle(saveParam, taxCycle, user, salaryItemPOS, salarySobPOS, salaryAcctResultPOS); - // 保存个税申报表 - if (CollectionUtils.isNotEmpty(result.getNeedInsertTaxDeclarations())) { - getTaxDeclarationMapper().batchInsert(result.getNeedInsertTaxDeclarations()); - } - // 保存个税申报表明细 - if (CollectionUtils.isNotEmpty(result.getNeedInsertTaxDeclarationDetails())) { - getTaxDeclarationDetailService(user).batchSave(result.getNeedInsertTaxDeclarationDetails()); - } - // 保存累计情况 - if (CollectionUtils.isNotEmpty(result.getNeedInsertAddUpSituations())) { - getAddUpSituationService(user).deleteByTaxYearMonthAndTaxAgentIds(SalaryDateUtil.localDate2YearMonth(taxCycle), taxAgentIds); - List> partition = Lists.partition((List) result.getNeedInsertAddUpSituations(), 100); - partition.forEach(getAddUpSituationMapper()::insertData); - } - // 更新薪资核算记录的状态 - getSalaryAcctRecordService(user).updateStatusByIds(salaryAcctRecordIds, SalaryAcctRecordStatusEnum.DECLARED); + getTaxDeclarationService(user).save(saveParam); } - public List listBySalaryMonthTax(TaxDeclarationPO build) { - return getTaxDeclarationMapper().listSome(build); - } - public List listBySalaryMonth(SalaryAcctRecordPO po) { - return getSalaryAcctRecordMapper().listSome(po); - } + }