diff --git a/resource/ecology9/WEB-INF/prop/hrmSalary.properties b/resource/ecology9/WEB-INF/prop/hrmSalary.properties index e86a9caab..125e28ea0 100644 --- a/resource/ecology9/WEB-INF/prop/hrmSalary.properties +++ b/resource/ecology9/WEB-INF/prop/hrmSalary.properties @@ -1,8 +1,5 @@ -#�Ƿ��ӡ��־ log=ture -#��������Ȩ�� isPermission=false -#н�����Ա��ɫ -salaryAdminRoleId=28 -#是否开启默认关闭非标-开启后,默认不启用非标,在应用中心非标中进行开启 +chiefAdminRoleId=28 defaultCloseNonStandard149=true +AESEncryptScrect=990EB004A1C862721C1513AE90038C9E \ No newline at end of file diff --git a/resource/sql/薪资还原脚本.sql b/resource/sql/薪资还原脚本.sql index c9d63fe64..1d04b52a6 100644 --- a/resource/sql/薪资还原脚本.sql +++ b/resource/sql/薪资还原脚本.sql @@ -1,116 +1,132 @@ delete from hrsa_acct_result_temp where 1=1 -GO +; delete from hrsa_add_up_deduction where 1=1 -GO +; delete from hrsa_add_up_situation where 1=1 -GO +; delete from hrsa_attend_quote where 1=1 -GO +; delete from hrsa_attend_quote_data where 1=1 -GO +; delete from hrsa_attend_quote_data_value where 1=1 -GO +; delete from hrsa_attend_quote_field where 1=1 -GO +; delete from hrsa_attend_quote_sync_set where 1=1 -GO +; delete from hrsa_bill_batch where 1=1 -GO -delete from hrsa_bill_batch_encdata where 1=1 -GO +; + delete from hrsa_bill_detail where 1=1 -GO +; delete from hrsa_bill_detail_temp where 1=1 -GO +; delete from hrsa_bill_inspect where 1=1 -GO +; delete from hrsa_check_result where 1=1 -GO +; delete from hrsa_check_result_record where 1=1 -GO +; delete from hrsa_ck_result_detail_temp where 1=1 -GO +; delete from hrsa_excel_acct_result where 1=1 -GO +; delete from hrsa_fund_archives where 1=1 -GO +; delete from hrsa_other_archives where 1=1 -GO +; delete from hrsa_other_deduction where 1=1 -GO +; delete from hrsa_salary_acct_emp where 1=1 -GO +; delete from hrsa_salary_acct_record where 1=1 -GO +; delete from hrsa_salary_acct_result where 1=1 -GO +; delete from hrsa_salary_archive where 1=1 -GO +; delete from hrsa_salary_archive_dimission where 1=1 -GO +; delete from hrsa_salary_archive_item where 1=1 -GO +; delete from hrsa_salary_archive_tax_agent where 1=1 -GO +; delete from hrsa_salary_item where 1=1 -GO +; delete from hrsa_salary_send where 1=1 -GO +; delete from hrsa_salary_send_info where 1=1 -GO +; delete from hrsa_salary_sob where 1=1 -GO +; delete from hrsa_salary_sob_adjust_rule where 1=1 -GO +; delete from hrsa_salary_sob_emp_field where 1=1 -GO +; delete from hrsa_salary_sob_item where 1=1 -GO +; delete from hrsa_salary_sob_item_group where 1=1 -GO +; delete from hrsa_salary_sob_range where 1=1 -GO +; delete from hrsa_salary_template where 1=1 -GO +; delete from hrsa_scheme_detail where 1=1 -GO +; delete from hrsa_social_archives where 1=1 -GO -delete from hrsa_social_archives_encdata where 1=1 -GO +; + delete from hrsa_social_security_scheme where 1=1 -GO +; delete from hrsa_sys_tax_rate_base where 1=1 -GO +; delete from hrsa_sys_tax_rate_detail where 1=1 -GO +; delete from hrsa_tax_agent where 1=1 -GO +; +delete from hrsa_tax_agent_emp where 1=1 +; +delete from hrsa_tax_agent_emp_change where 1=1 +; +delete from hrsa_tax_agent_admin where 1=1 +; +delete from hrsa_tax_agent_manage_range where 1=1 +; +delete from hrsa_tax_agent_base where 1=1 +; +delete from hrsa_tax_agent_sub_admin where 1=1 +; +delete from hrsa_tax_agent_sub_admin_emp where 1=1 +; + delete from hrsa_tax_declaration where 1=1 -GO +; delete from hrsa_tax_declaration_detail where 1=1 -GO +; delete from hrsa_tax_rate_base where 1=1 -GO +; delete from hrsa_tax_rate_detail where 1=1 -GO +; delete from hrsa_insurance_category where 1=1 -GO +; INSERT INTO hrsa_insurance_category (id, insurance_name, welfare_type, is_use, payment_scope, data_type, create_time, update_time, creator, delete_type, tenant_key) VALUES (9001, '养老保险', 1, 1, '1,2', 1, '2022-02-22 10:46:02', '2022-02-22 10:46:02', 0, 0, 'all_teams') - GO + ; INSERT INTO hrsa_insurance_category (id, insurance_name, welfare_type, is_use, payment_scope, data_type, create_time, update_time, creator, delete_type, tenant_key) VALUES (9002, '医疗保险', 1, 1, '1,2', 1, '2022-02-22 10:46:02', '2022-02-22 10:46:02', 0, 0, 'all_teams') - GO + ; INSERT INTO hrsa_insurance_category (id, insurance_name, welfare_type, is_use, payment_scope, data_type, create_time, update_time, creator, delete_type, tenant_key) VALUES (9003, '工伤保险', 1, 1, '1,2', 1, '2022-02-22 10:46:02', '2022-02-22 10:46:02', 0, 0, 'all_teams') - GO + ; INSERT INTO hrsa_insurance_category (id, insurance_name, welfare_type, is_use, payment_scope, data_type, create_time, update_time, creator, delete_type, tenant_key) VALUES (9004, '失业保险', 1, 1, '1,2', 1, '2022-02-22 10:46:02', '2022-02-22 10:46:02', 0, 0, 'all_teams') - GO + ; INSERT INTO hrsa_insurance_category (id, insurance_name, welfare_type, is_use, payment_scope, data_type, create_time, update_time, creator, delete_type, tenant_key) VALUES (9005, '生育保险', 1, 1, '1,2', 1, '2022-02-22 10:46:02', '2022-02-22 10:46:02', 0, 0, 'all_teams') - GO + ; INSERT INTO hrsa_insurance_category (id, insurance_name, welfare_type, is_use, payment_scope, data_type, create_time, update_time, creator, delete_type, tenant_key) VALUES (9006, '住房公积金', 2, 1, '1,2', 1, '2022-02-22 10:46:02', '2022-02-22 10:46:02', 0, 0, 'all_teams') - GO + ; INSERT INTO hrsa_insurance_category (id, insurance_name, welfare_type, is_use, payment_scope, data_type, create_time, update_time, creator, delete_type, tenant_key) VALUES (9007, '企业年金', 3, 1, '1,2', 1, '2022-02-22 10:46:02', '2022-02-22 10:46:02', 0, 0, 'all_teams') - GO + ; INSERT INTO hrsa_insurance_category (id, insurance_name, welfare_type, is_use, payment_scope, data_type, create_time, update_time, creator, delete_type, tenant_key) VALUES (9008, '补充住房公积金', 2, 1, '1,2', 1, '2022-02-22 10:46:02', '2022-02-22 10:46:02', 0, 0, 'all_teams') - GO \ No newline at end of file + ; + + +INSERT INTO hrsa_tax_agent_base(id, devolution_status, create_time, update_time, creator, delete_type, tenant_key) VALUES (1653303537239, 0, '2022-05-23 18:58:53', '2022-05-23 19:12:12', 1, 0, 'all_teams'); diff --git a/src/com/engine/salary/cmd/datacollection/AttendQuoteListCmd.java b/src/com/engine/salary/cmd/datacollection/AttendQuoteListCmd.java deleted file mode 100644 index 05abe648d..000000000 --- a/src/com/engine/salary/cmd/datacollection/AttendQuoteListCmd.java +++ /dev/null @@ -1,100 +0,0 @@ -package com.engine.salary.cmd.datacollection; - -import com.cloudstore.eccom.result.WeaResultMsg; -import com.engine.common.biz.AbstractCommonCommand; -import com.engine.common.entity.BizLogContext; -import com.engine.core.interceptor.CommandContext; -import com.engine.salary.component.SalaryWeaTable; -import com.engine.salary.entity.datacollection.dto.AttendQuoteListDTO; -import com.engine.salary.entity.datacollection.param.AttendQuoteQueryParam; -import org.apache.commons.collections4.CollectionUtils; -import weaver.hrm.User; - -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.stream.Collectors; - -public class AttendQuoteListCmd extends AbstractCommonCommand> { - - public AttendQuoteListCmd(Map params, User user) { - this.user = user; - this.params = params; - } - - @Override - public BizLogContext getLogContext() { - return null; - } - - @Override - public Map execute(CommandContext commandContext) { - - AttendQuoteQueryParam queryParam = (AttendQuoteQueryParam) params.get("queryParam"); - List declareMonth = queryParam.getSalaryYearMonth(); - if (CollectionUtils.isNotEmpty(declareMonth)) { - queryParam.setSalaryYearMonth(declareMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); - } - - - String fields = " t1.id," + - " t1.salary_year_month," + - " t1.salary_sob_id," + - " t2.name AS salary_sob_name," + - " t1.source_type," + - " t1.attend_cycle," + - " t1.salary_cycle," + - " t1.description," + - " e.lastname AS creator," + - " t1.salary_accounting_status"; - - String fromSql = " FROM" + - " hrsa_attend_quote t1" + - " LEFT JOIN hrsa_salary_sob t2 ON t1.salary_sob_id = t2.id" + - " LEFT JOIN hrmresource e ON e.id = t1.creator"; - - SalaryWeaTable table = new SalaryWeaTable(user, AttendQuoteListDTO.class); - table.setBackfields(fields); - table.setSqlform(fromSql); - table.setSqlwhere(makeSqlWhere()); - table.setSqlorderby("t1.id DESC"); - table.setSqlprimarykey("t1.id"); - table.setSqlisdistinct("false"); - - WeaResultMsg result = new WeaResultMsg(false); - result.putAll(table.makeDataResult()); - result.success(); - return result.getResultMap(); - } - - - private String makeSqlWhere() { - - AttendQuoteQueryParam queryParam = (AttendQuoteQueryParam) params.get("queryParam"); - //薪资所属月 - List salaryYearMonth = queryParam.getSalaryYearMonth(); - if (CollectionUtils.isNotEmpty(salaryYearMonth)) { - queryParam.setSalaryYearMonth(salaryYearMonth.stream().map(e -> e + "-01 00:00:00").collect(Collectors.toList())); - } - - String sqlWhere = "t1.delete_type = 0 AND t2.delete_type = 0"; - Collection ids = queryParam.getIds(); - if (CollectionUtils.isNotEmpty(ids)) { - String idsStr = ids.stream().map(String::valueOf).collect(Collectors.joining(",")); - sqlWhere += " AND t1.id IN (" + idsStr + ")"; - } - // 申报月份 - List months = queryParam.getSalaryYearMonth(); - if (CollectionUtils.isNotEmpty(months)) { - if (months.size() == 1) { - sqlWhere += " AND t1.salary_year_month = '" + months.get(0) + "'"; - } - if (months.size() == 2) { - sqlWhere += " AND (t1.salary_year_month BETWEEN '" + months.get(0) + "' AND '" + months.get(1) + "')"; - } - } - - - return sqlWhere; - } -} diff --git a/src/com/engine/salary/entity/salaryformula/ExpressFormula.java b/src/com/engine/salary/entity/salaryformula/ExpressFormula.java index 1733eeb77..442af9c76 100644 --- a/src/com/engine/salary/entity/salaryformula/ExpressFormula.java +++ b/src/com/engine/salary/entity/salaryformula/ExpressFormula.java @@ -5,6 +5,7 @@ import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import net.minidev.json.annotate.JsonIgnore; import java.util.Date; import java.util.List; @@ -29,22 +30,27 @@ public class ExpressFormula { /** * 模块 */ + @JsonIgnore private String module; /** * 用途 */ + @JsonIgnore private String useFor; /** * 引用类型,formula,sql */ + @JsonIgnore private String referenceType; /** * 返回类型,number,string */ + @JsonIgnore private String returnType; /** * 校验类型,number,string */ + @JsonIgnore private String validateType; /** * 扩展参数 @@ -68,18 +74,22 @@ public class ExpressFormula { /** * 创建人 */ + @JsonIgnore private Long creator; /** * 是否删除0否1是 */ + @JsonIgnore private Integer deleteType; /** * 创建时间 */ + @JsonIgnore private Date createTime; /** * 修改时间 */ + @JsonIgnore private Date updateTime; diff --git a/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationBO.java b/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationBO.java index 6afae5f96..59ac0ea38 100644 --- a/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationBO.java +++ b/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationBO.java @@ -45,19 +45,19 @@ public class TaxDeclarationBO { Map taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgent::getId, TaxAgent::getName); Map employeeNameMap = SalaryEntityUtil.convert2Map(simpleEmployees, DataCollectionEmployee::getEmployeeId, DataCollectionEmployee::getUsername); return taxDeclarations.stream().map(e -> TaxDeclarationListDTO.builder() - .id(e.getId()) - .salaryMonth(e.getSalaryMonth()) - .taxAgentId(e.getTaxAgentId()) - .taxAgentName(taxAgentNameMap.getOrDefault(e.getTaxAgentId(), "")) - .taxCycle(e.getTaxCycle()) - .operateEmployeeId(e.getCreator()) - .operateEmployeeName(employeeNameMap.getOrDefault(e.getCreator(), "")) - .operateTime(SalaryDateUtil.getFormatLocalDateTime(e.getCreateTime())) - .description(e.getDescription()) - .build()).collect(Collectors.toList()); + .id(e.getId()) + .salaryMonth(e.getSalaryMonth()) + .taxAgentId(e.getTaxAgentId()) + .taxAgentName(taxAgentNameMap.getOrDefault(e.getTaxAgentId(), "")) + .taxCycle(e.getTaxCycle()) + .operateEmployeeId(e.getCreator()) + .operateEmployeeName(employeeNameMap.getOrDefault(e.getCreator(), "")) + .operateTime(SalaryDateUtil.getFormatLocalDateTime(e.getCreateTime())) + .description(e.getDescription()) + .build()).collect(Collectors.toList()); } - public static void buildDetailListDTO(Long taxDeclarationId, + public static void buildDetailListDTO(Long taxDeclarationId, PageInfo page, List taxDeclarationDetails, List simpleEmployees) { @@ -75,43 +75,43 @@ public class TaxDeclarationBO { dto.setSeq(++index); dto.setEmployeeId(simpleEmployee.getEmployeeId()); dto.setEmployeeName(simpleEmployee.getUsername()); - dto.setIdCardType(SalaryI18nUtil.getI18nLabel(101696,"身份证")); + dto.setIdCardType(SalaryI18nUtil.getI18nLabel(101696, "身份证")); dto.setIdCardNo(""); dto.setTaxpayerIdNo(""); - dto.setResidentType(SalaryI18nUtil.getI18nLabel(101697,"居民")); - dto.setIncomeType(SalaryI18nUtil.getI18nLabel(101698,"工资、薪金")); - dto.setIncome(valueMap.getOrDefault("income","")); + dto.setResidentType(SalaryI18nUtil.getI18nLabel(101697, "居民")); + dto.setIncomeType(SalaryI18nUtil.getI18nLabel(101698, "工资、薪金")); + dto.setIncome(valueMap.getOrDefault("income", "")); dto.setFee(valueMap.getOrDefault("fee", "")); dto.setTaxFreeIncome(valueMap.getOrDefault("taxFreeIncome", "")); dto.setSubtraction(valueMap.getOrDefault("subtraction", "")); dto.setEndowmentInsurance(valueMap.getOrDefault("endowmentInsurance", "")); - dto.setMedicalInsurance(valueMap.getOrDefault("medicalInsurance","")); - dto.setUnemploymentInsurance(valueMap.getOrDefault("unemploymentInsurance","")); - dto.setHousingProvidentFund(valueMap.getOrDefault("housingProvidentFund","")); - dto.setAnnuity(valueMap.getOrDefault("annuity","")); - dto.setCommercialHealthInsurance(valueMap.getOrDefault("commercialHealthInsurance","")); - dto.setTaxDeferredEndowmentInsurance(valueMap.getOrDefault("taxDeferredEndowmentInsurance","")); - dto.setOriginalValueOfProperty(valueMap.getOrDefault("originalValueOfProperty","")); - dto.setDeductedTax(valueMap.getOrDefault("deductedTax","")); - dto.setOther(valueMap.getOrDefault("other","")); - dto.setAddUpIncome(valueMap.getOrDefault("addUpIncome","")); - dto.setAddUpSubtraction(valueMap.getOrDefault("addUpSubtraction","")); - dto.setAddUpSpecialDeduction(valueMap.getOrDefault("addUpSpecialDeduction","")); - dto.setAddUpChildEducation(valueMap.getOrDefault("addUpChildEducation","")); - dto.setAddUpContinuingEducation(valueMap.getOrDefault("addUpContinuingEducation","")); - dto.setAddUpHousingLoanInterest(valueMap.getOrDefault("addUpHousingLoanInterest","")); - dto.setAddUpHousingRent(valueMap.getOrDefault("addUpHousingRent","")); - dto.setAddUpSupportElderly(valueMap.getOrDefault("addUpSupportElderly","")); - dto.setAddUpOther(valueMap.getOrDefault("addUpOtherDeduction","")); - dto.setLessTaxProportion(valueMap.getOrDefault("lessTaxProportion","")); - dto.setAllowedDonation(valueMap.getOrDefault("addUpAllowedDonation","")); - dto.setTaxableIncome(valueMap.getOrDefault("addUpTaxableIncome","")); - dto.setTaxRate(valueMap.getOrDefault("taxRate","")); - dto.setQuickDeductionFactor(valueMap.getOrDefault("quickDeductionFactor","")); - dto.setTaxPayable(valueMap.getOrDefault("addUpTaxPayable","")); - dto.setTaxSavings(valueMap.getOrDefault("addUpTaxDeduction","")); - dto.setTaxWithheld(valueMap.getOrDefault("taxWithheld","")); - dto.setRefundedOrSupplementedTax(valueMap.getOrDefault("refundedOrSupplementedTax","")); + dto.setMedicalInsurance(valueMap.getOrDefault("medicalInsurance", "")); + dto.setUnemploymentInsurance(valueMap.getOrDefault("unemploymentInsurance", "")); + dto.setHousingProvidentFund(valueMap.getOrDefault("housingProvidentFund", "")); + dto.setAnnuity(valueMap.getOrDefault("annuity", "")); + dto.setCommercialHealthInsurance(valueMap.getOrDefault("commercialHealthInsurance", "")); + dto.setTaxDeferredEndowmentInsurance(valueMap.getOrDefault("taxDeferredEndowmentInsurance", "")); + dto.setOriginalValueOfProperty(valueMap.getOrDefault("originalValueOfProperty", "")); + dto.setDeductedTax(valueMap.getOrDefault("deductedTax", "")); + dto.setOther(valueMap.getOrDefault("other", "")); + dto.setAddUpIncome(valueMap.getOrDefault("addUpIncome", "")); + dto.setAddUpSubtraction(valueMap.getOrDefault("addUpSubtraction", "")); + dto.setAddUpSpecialDeduction(valueMap.getOrDefault("addUpSpecialDeduction", "")); + dto.setAddUpChildEducation(valueMap.getOrDefault("addUpChildEducation", "")); + dto.setAddUpContinuingEducation(valueMap.getOrDefault("addUpContinuingEducation", "")); + dto.setAddUpHousingLoanInterest(valueMap.getOrDefault("addUpHousingLoanInterest", "")); + dto.setAddUpHousingRent(valueMap.getOrDefault("addUpHousingRent", "")); + dto.setAddUpSupportElderly(valueMap.getOrDefault("addUpSupportElderly", "")); + dto.setAddUpOther(valueMap.getOrDefault("addUpOtherDeduction", "")); + dto.setLessTaxProportion(valueMap.getOrDefault("lessTaxProportion", "")); + dto.setAllowedDonation(valueMap.getOrDefault("addUpAllowedDonation", "")); + dto.setTaxableIncome(valueMap.getOrDefault("addUpTaxableIncome", "")); + dto.setTaxRate(valueMap.getOrDefault("taxRate", "")); + dto.setQuickDeductionFactor(valueMap.getOrDefault("quickDeductionFactor", "")); + dto.setTaxPayable(valueMap.getOrDefault("addUpTaxPayable", "")); + dto.setTaxSavings(valueMap.getOrDefault("addUpTaxDeduction", "")); + dto.setTaxWithheld(valueMap.getOrDefault("taxWithheld", "")); + dto.setRefundedOrSupplementedTax(valueMap.getOrDefault("refundedOrSupplementedTax", "")); dtos.add(dto); } page.setList(dtos); @@ -123,7 +123,7 @@ public class TaxDeclarationBO { List salaryItems, List salarySobs, List salaryAcctResults - ) { + ) { Result result = new Result(); if (CollectionUtils.isEmpty(salaryAcctResults)) { return result; @@ -140,7 +140,7 @@ public class TaxDeclarationBO { Map> taxAgentIdKeyAcctResultMap = SalaryEntityUtil.group2Map(salaryAcctResults, SalaryAcctResultPO::getTaxAgentId); taxAgentIdKeyAcctResultMap.forEach((k, v) -> { // 新增的个税申报表 - TaxDeclarationPO taxDeclaration = convert2PO(saveParam,user, taxCycle, k); + TaxDeclarationPO taxDeclaration = convert2PO(saveParam, user, taxCycle, k); result.getNeedInsertTaxDeclarations().add(taxDeclaration); // 处理个税申报明细以及累计情况 handleTaxDeclarationDetail(result, taxDeclaration, v, salaryItemMap); @@ -294,11 +294,11 @@ public class TaxDeclarationBO { BigDecimal addUpEnterpriseAndOther = findAddUpValue("addUpEnterpriseAndOther", resultMap, salaryItemMap); // 更新累计情况 AddUpSituation accumulatedSituation = AddUpSituation.builder() - .id(IdGenerator.generate()) +// .id(IdGenerator.generate()) .employeeId(employeeId) .taxAgentId(taxDeclaration.getTaxAgentId()) - .taxYearMonth(taxDeclaration.getSalaryMonth()) - .year(taxDeclaration.getSalaryMonth().getYear()) + .taxYearMonth(taxDeclaration.getTaxCycle()) + .year(SalaryDateUtil.date2Year(taxDeclaration.getTaxCycle())) .addUpIncome(addUpIncome.toPlainString()) .addUpSocialSecurityTotal(addUpSocialSecurityTotal.toPlainString()) .addUpAccumulationFundTotal(addUpAccumulationFundTotal.toPlainString()) @@ -326,9 +326,9 @@ public class TaxDeclarationBO { }); } - private static TaxDeclarationPO convert2PO(TaxDeclarationSaveParam saveParam, User user,Date taxCycle, Long taxAgentId) { + private static TaxDeclarationPO convert2PO(TaxDeclarationSaveParam saveParam, User user, Date taxCycle, Long taxAgentId) { LocalDateTime now = LocalDateTime.now(); - if(saveParam.getDescription()==null){ + if (saveParam.getDescription() == null) { saveParam.setDescription(""); } return TaxDeclarationPO.builder() @@ -337,7 +337,7 @@ public class TaxDeclarationBO { .salaryMonth(SalaryDateUtil.localDateToDate(saveParam.getSalaryMonth().atDay(1))) .taxCycle(taxCycle) .description(saveParam.getDescription()) - .creator((long)user.getUID()) + .creator((long) user.getUID()) .createTime(SalaryDateUtil.localDateTimeToDate(now)) .updateTime(SalaryDateUtil.localDateTimeToDate(now)) .deleteType(0) diff --git a/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.java b/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.java index 87a55592e..300f9de40 100644 --- a/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.java +++ b/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.java @@ -7,6 +7,7 @@ import com.engine.salary.entity.datacollection.param.AddUpSituationQueryParam; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; +import java.util.Collection; import java.util.List; @Mapper @@ -59,4 +60,6 @@ public interface AddUpSituationMapper { void deleteSome(@Param("param") AddUpSituation params); void deleteByTaxYearMonthAndTaxAgentIds(@Param("param") AddUpSituation params); + + void deleteByIds(@Param("ids") Collection ids); } \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.xml b/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.xml index ccac40848..710f26c1c 100644 --- a/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/AddUpSituationMapper.xml @@ -699,9 +699,9 @@ - + UPDATE hrsa_add_up_situation - SET delete_type=1 + SET delete_type = 1 WHERE delete_type = 0 AND tax_year_month = #{param.taxYearMonth} @@ -710,12 +710,12 @@ #{employeeId} - + - + UPDATE hrsa_add_up_situation - SET delete_type=1 + SET delete_type = 1 WHERE delete_type = 0 AND tax_year_month = #{param.taxYearMonth} @@ -724,6 +724,16 @@ #{taxAgentId} - + + + + UPDATE hrsa_add_up_situation + SET delete_type = 1 + WHERE delete_type = 0 + AND id IN + + #{id} + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml index 41406d770..506b41b80 100644 --- a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml @@ -122,6 +122,12 @@ #{targetId} + + e.subcompanyid1 IN + + #{targetId} + + AND e.status IN diff --git a/src/com/engine/salary/service/AddUpSituationService.java b/src/com/engine/salary/service/AddUpSituationService.java index 6b0e88867..4abc26751 100644 --- a/src/com/engine/salary/service/AddUpSituationService.java +++ b/src/com/engine/salary/service/AddUpSituationService.java @@ -10,6 +10,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook; import java.time.YearMonth; import java.util.Collection; +import java.util.Date; import java.util.List; import java.util.Map; @@ -63,11 +64,10 @@ public interface AddUpSituationService { /** * 删除累计情况 * - * @param taxYearMonth * @param employeeIds * @return */ - boolean deleteAddUpSituationList(YearMonth taxYearMonth, List employeeIds); + boolean deleteAddUpSituationList(Date taxCycle, List employeeIds); XSSFWorkbook downloadTemplate(AddUpSituationQueryParam queryParam); diff --git a/src/com/engine/salary/service/AttendQuoteService.java b/src/com/engine/salary/service/AttendQuoteService.java index a61705e7b..7e06ec6e5 100644 --- a/src/com/engine/salary/service/AttendQuoteService.java +++ b/src/com/engine/salary/service/AttendQuoteService.java @@ -6,14 +6,8 @@ import com.engine.salary.util.page.PageInfo; import java.time.YearMonth; import java.util.Collection; -import java.util.Map; public interface AttendQuoteService { - /** - * AttendQuoteDataService - * 数据采集-考勤引用列表 - */ - Map list(Map params); /** * 数据采集-考勤引用列表(分页) diff --git a/src/com/engine/salary/service/TaxDeclarationService.java b/src/com/engine/salary/service/TaxDeclarationService.java index 352a142b1..43039fc9e 100644 --- a/src/com/engine/salary/service/TaxDeclarationService.java +++ b/src/com/engine/salary/service/TaxDeclarationService.java @@ -1,5 +1,6 @@ package com.engine.salary.service; +import com.engine.salary.entity.salaryacct.po.SalaryAcctRecordPO; import com.engine.salary.entity.taxdeclaration.TaxDeclaration; import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationListQueryParam; import com.engine.salary.entity.taxdeclaration.param.TaxDeclarationSaveParam; @@ -7,7 +8,6 @@ import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationPO; import com.engine.salary.entity.taxrate.TaxAgent; import com.engine.salary.util.page.PageInfo; -import java.time.YearMonth; import java.util.Collection; import java.util.List; import java.util.Map; @@ -34,8 +34,7 @@ public interface TaxDeclarationService { /** * 删除个税申报表 * - * @param salaryMonth */ - void deleteBySalaryMonth(YearMonth salaryMonth); + void deleteBySalaryMonth(SalaryAcctRecordPO salaryAcctRecordPO); } diff --git a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java index cb2d79b94..954c75f6d 100644 --- a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java @@ -25,6 +25,7 @@ import com.engine.salary.service.AddUpSituationService; 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.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelComment; @@ -223,14 +224,15 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation } @Override - public boolean deleteAddUpSituationList(YearMonth taxYearMonth, List employeeIds) { - if (taxYearMonth == null) { + public boolean deleteAddUpSituationList(Date taxCycle, List employeeIds) { + if (taxCycle == null) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100353, "参数有误:税款所属期必传")); } AddUpSituationBiz biz = new AddUpSituationBiz(); - String formatLocalDate = SalaryDateUtil.getFormatLocalDate(SalaryDateUtil.toDateStartOfMonth(taxYearMonth)); - Date date = SalaryDateUtil.localDateToDate(LocalDate.parse(formatLocalDate, SalaryDateUtil.DATE_FORMATTER)); - biz.deleteSome(AddUpSituation.builder().employeeIds(employeeIds).taxYearMonth(date).build()); + List addUpSituations = biz.listSome(AddUpSituation.builder().employeeIds(employeeIds).taxYearMonth(taxCycle).build()); + Set properties = SalaryEntityUtil.properties(addUpSituations, AddUpSituation::getId); + getAddUpSituationMapper().deleteByIds(properties); + return Boolean.TRUE; } diff --git a/src/com/engine/salary/service/impl/AttendQuoteServiceImpl.java b/src/com/engine/salary/service/impl/AttendQuoteServiceImpl.java index bda66290d..4139202c9 100644 --- a/src/com/engine/salary/service/impl/AttendQuoteServiceImpl.java +++ b/src/com/engine/salary/service/impl/AttendQuoteServiceImpl.java @@ -5,7 +5,6 @@ import com.engine.core.impl.Service; import com.engine.salary.biz.AttendQuoteBiz; import com.engine.salary.biz.AttendQuoteDataBiz; import com.engine.salary.biz.AttendQuoteDataValueBiz; -import com.engine.salary.cmd.datacollection.AttendQuoteListCmd; import com.engine.salary.entity.datacollection.dto.AttendQuoteListDTO; import com.engine.salary.entity.datacollection.param.AttendQuoteDataQueryParam; import com.engine.salary.entity.datacollection.param.AttendQuoteQueryParam; @@ -30,7 +29,10 @@ import weaver.hrm.User; import java.time.LocalDate; import java.time.YearMonth; -import java.util.*; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Set; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @@ -56,11 +58,6 @@ public class AttendQuoteServiceImpl extends Service implements AttendQuoteServic return ServiceUtil.getService(TaxAgentServiceImpl.class, user); } - @Override - public Map list(Map params) { - return commandExecutor.execute(new AttendQuoteListCmd(params, user)); - } - @Override public PageInfo listPage(AttendQuoteQueryParam queryParam) { long currentEmployeeId = user.getUID(); diff --git a/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java b/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java index 7f3aa3b71..ab3a54edb 100644 --- a/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java +++ b/src/com/engine/salary/service/impl/FormulaRunServiceImpl.java @@ -82,7 +82,6 @@ public class FormulaRunServiceImpl extends Service implements FormulaRunService } }); String formula = expressFormula.getFormulaRunScript(); - log.info("formula run {}", formula); return runner.execute(formula, context, null, true, false); } } diff --git a/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java index 3740a43ef..a8fa2b854 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java @@ -394,17 +394,19 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct } // 根据薪资账套查询薪资周期 SalarySobCycleDTO salarySobCycleDTO = getSalarySobService(user).getSalarySobCycle(salaryAcctRecordPO.getSalarySobId(), SalaryDateUtil.localDate2YearMonth(salaryAcctRecordPO.getSalaryMonth())); + + List finalSalaryEmployees = new ArrayList<>(); // 根据薪资账套的"核算人员范围"过滤入职日期大于薪资周期止的人员 salaryEmployees = salaryEmployees.stream() - .filter(salaryEmployee -> SalaryDateUtil.stringToDate(salaryEmployee.getCompanystartdate()) != null) .filter(salaryEmployee -> StringUtils.isBlank(salaryEmployee.getCompanystartdate()) - || SalaryDateUtil.stringToDate(salaryEmployee.getCompanystartdate()).compareTo(salarySobCycleDTO.getSalaryCycle().getEndDate()) <= 0) + || (SalaryDateUtil.stringToDate(salaryEmployee.getCompanystartdate()) != null && SalaryDateUtil.stringToDate(salaryEmployee.getCompanystartdate()).compareTo(salarySobCycleDTO.getSalaryCycle().getEndDate()) <= 0)) .collect(Collectors.toList()); + + // 根据薪资账套的"核算人员范围"过滤离职日期小于薪资周期起的人员 salaryEmployees = salaryEmployees.stream() - .filter(salaryEmployee -> SalaryDateUtil.stringToDate(salaryEmployee.getCompanystartdate()) != null) .filter(salaryEmployee -> StringUtils.isBlank(salaryEmployee.getDismissdate()) - || SalaryDateUtil.stringToDate(salaryEmployee.getDismissdate()).compareTo(salarySobCycleDTO.getSalaryCycle().getEndDate()) >= 0) + || (SalaryDateUtil.stringToDate(salaryEmployee.getCompanystartdate()) != null && SalaryDateUtil.stringToDate(salaryEmployee.getDismissdate()).compareTo(salarySobCycleDTO.getSalaryCycle().getEndDate()) > 0)) .collect(Collectors.toList()); // TODO: 2/9/22 过滤离职人员 diff --git a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java index 7b3ef09bd..d173a906d 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java @@ -434,7 +434,7 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe //撤回工资单 getSalarySendService(user).revokeSalaryBill(salaryAcctRecordId); //删除个税申报表(个税申报表、个税申报表详情、往期累计情况) - getTaxDeclarationService(user).deleteBySalaryMonth(SalaryDateUtil.localDate2YearMonth(salaryAcctRecordPO.getSalaryMonth())); + getTaxDeclarationService(user).deleteBySalaryMonth(salaryAcctRecordPO); // 记录日志 // String targetName = getLogTargetNameById(salaryAcctRecordPO.getId(), tenantKey); // LoggerContext loggerContext = new LoggerContext<>(); diff --git a/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java b/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java index d188eb498..73320db86 100644 --- a/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxDeclarationServiceImpl.java @@ -7,6 +7,7 @@ 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.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; @@ -32,7 +33,6 @@ import org.apache.ibatis.session.SqlSession; import weaver.conn.mybatis.MyBatisFactory; import weaver.hrm.User; -import java.time.YearMonth; import java.util.*; public class TaxDeclarationServiceImpl extends Service implements TaxDeclarationService { @@ -137,9 +137,9 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration } @Override - public void deleteBySalaryMonth(YearMonth salaryMonth) { + public void deleteBySalaryMonth(SalaryAcctRecordPO salaryAcctRecordPO) { // 薪资所属月的日期范围 - LocalDateRange salaryMonthDateRange = SalaryDateUtil.localDate2Range(SalaryDateUtil.localDateToDate(salaryMonth.atDay(1))); + LocalDateRange salaryMonthDateRange = SalaryDateUtil.localDate2Range(salaryAcctRecordPO.getSalaryMonth()); if (Objects.isNull(salaryMonthDateRange)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); } @@ -153,7 +153,7 @@ public class TaxDeclarationServiceImpl extends Service implements TaxDeclaration // 删除个税申报表详情 getTaxDeclarationDetailService(user).deleteByTaxDeclarationIds(taxDeclarationIds); // 删除往期累计情况 - getAddUpSituationService(user).deleteAddUpSituationList(salaryMonth, Collections.emptyList()); + getAddUpSituationService(user).deleteAddUpSituationList(salaryAcctRecordPO.getTaxCycle(), Collections.emptyList()); } public List listBySalaryMonth(LocalDateRange salaryMonthDateRange) { diff --git a/src/com/engine/salary/util/SalaryDateUtil.java b/src/com/engine/salary/util/SalaryDateUtil.java index e622321b1..8c52c97fd 100644 --- a/src/com/engine/salary/util/SalaryDateUtil.java +++ b/src/com/engine/salary/util/SalaryDateUtil.java @@ -201,6 +201,16 @@ public class SalaryDateUtil { return YearMonth.parse(localDate); } + public static Integer date2Year(Date localDate) { + if (localDate == null) { + return null; + } + Calendar c = Calendar.getInstance(); + c.setTime(localDate); + int year = c.get(Calendar.YEAR); + return year ; + } + public static LocalDateRange localDate2Range(Date localDate) { if (localDate == null) { return null;