From 76b05e3d3897e46a38191ab996cadb854868c501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 31 May 2022 09:59:32 +0800 Subject: [PATCH 1/4] fix --- .../engine/salary/mapper/datacollection/EmployMapper.xml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml index 10898e736..424d8c80e 100644 --- a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml @@ -16,13 +16,8 @@ e.lastname as username, e.status as status, e.workcode as workcode, - d.departmentname as departmentName, - d.id as departmentId, - c.jobtitlename as jobtitleName, - c.id as jobtitleId, e.companystartdate as companystartdate, - e.mobile as mobile, - b.dismissdate as dismissdate + e.mobile as mobile from hrmresource e where e.status not in (7) From 72d1b48126529634d8e0aae30adac6ed0d9bf8f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 31 May 2022 11:03:56 +0800 Subject: [PATCH 2/4] fix --- .../impl/SalaryAcctEmployeeServiceImpl.java | 4 +- .../engine/salary/util/SalaryDateUtil.java | 46 +++++++++++++------ 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java index 13a5d502e..6a777042d 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java @@ -323,7 +323,7 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct @Override public void batchSave(Collection salaryAcctEmployeePOS) { - if(CollectionUtils.isEmpty(salaryAcctEmployeePOS)){ + if (CollectionUtils.isEmpty(salaryAcctEmployeePOS)) { return; } List> partition = Lists.partition((List) salaryAcctEmployeePOS, 100); @@ -396,11 +396,13 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct SalarySobCycleDTO salarySobCycleDTO = getSalarySobService(user).getSalarySobCycle(salaryAcctRecordPO.getSalarySobId(), SalaryDateUtil.localDate2YearMonth(salaryAcctRecordPO.getSalaryMonth())); // 根据薪资账套的"核算人员范围"过滤入职日期大于薪资周期止的人员 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) .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) .collect(Collectors.toList()); diff --git a/src/com/engine/salary/util/SalaryDateUtil.java b/src/com/engine/salary/util/SalaryDateUtil.java index 014a5d111..37536ed53 100644 --- a/src/com/engine/salary/util/SalaryDateUtil.java +++ b/src/com/engine/salary/util/SalaryDateUtil.java @@ -99,6 +99,7 @@ public class SalaryDateUtil { return StringUtils.EMPTY; } } + public static String getFormatLocalDate(LocalDate localDate) { if (localDate == null) { return StringUtils.EMPTY; @@ -165,6 +166,7 @@ public class SalaryDateUtil { ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault()); return Date.from(zonedDateTime.toInstant()); } + public static Date localDateTimeToDate(LocalDateTime localDateTime) { if (null == localDateTime) { return null; @@ -323,23 +325,23 @@ public class SalaryDateUtil { } - /** * LocalDate转YearMonth + * * @param localDate * @return */ - public static YearMonth toYearMonth(LocalDate localDate){ + public static YearMonth toYearMonth(LocalDate localDate) { Objects.requireNonNull(localDate, "localDate"); return YearMonth.of(localDate.getYear(), localDate.getMonthValue()); } - /** * YearMonth转Date * 注意dayOfMonth范围:1到31之间,最大值根据月份确定特殊情况,如2月闰年29,非闰年28 * 如果要转换为当月最后一天,可以使用下面方法:toDateEndOfMonth(YearMonth) + * * @param yearMonth * @param dayOfMonth * @return @@ -351,6 +353,7 @@ public class SalaryDateUtil { /** * YearMonth转Date,转换为当月第一天 + * * @param yearMonth * @return */ @@ -360,6 +363,7 @@ public class SalaryDateUtil { /** * YearMonth转Date,转换为当月最后一天 + * * @param yearMonth * @return */ @@ -373,6 +377,7 @@ public class SalaryDateUtil { * YearMonth转LocalDate * 注意dayOfMonth范围:1到31之间,最大值根据月份确定特殊情况,如2月闰年29,非闰年28 * 如果要转换为当月最后一天,可以使用下面方法:toLocalDateEndOfMonth(YearMonth) + * * @param yearMonth * @param dayOfMonth * @return @@ -384,6 +389,7 @@ public class SalaryDateUtil { /** * YearMonth转LocalDate,转换为当月第一天 + * * @param yearMonth * @return */ @@ -393,6 +399,7 @@ public class SalaryDateUtil { /** * YearMonth转LocalDate,转换为当月最后一天 + * * @param yearMonth * @return */ @@ -403,6 +410,7 @@ public class SalaryDateUtil { /** * String转Date + * * @param date * @return */ @@ -420,16 +428,7 @@ public class SalaryDateUtil { } public static Date stringToDate(String date) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - Date parse = null; - if (date != null) { - try { - parse = sdf.parse(date); - } catch (ParseException e) { - throw new RuntimeException(e); - } - } - return parse; + return dateStrToLocalDate(date); } //格式化日期 @@ -443,4 +442,25 @@ public class SalaryDateUtil { String str = new SimpleDateFormat("yyyy-MM").format(date);//再将时间转换为对应格式字符串 return str; } + + private static Date dateStrToLocalDate(String date) { + Date localDate = null; + try { + date = date.substring(0, 10); + if (date.contains("/")) { + SimpleDateFormat format = new SimpleDateFormat("yyyy/MM/dd"); + localDate = format.parse(date); + } else if (date.contains("-")) { + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); + localDate = format.parse(date); + } + } catch (Exception e) { + log.error("日期解析异常,{}", date); + localDate = null; + } + + return localDate; + } } + + From 3471783d65412b62eb1bbc98e973bfd13f402605 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 31 May 2022 13:53:57 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=96=AA=E9=85=AC=E8=BF=98=E5=8E=9F?= =?UTF-8?q?=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/sql/薪资还原脚本.sql | 116 ++++++++++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 resource/sql/薪资还原脚本.sql diff --git a/resource/sql/薪资还原脚本.sql b/resource/sql/薪资还原脚本.sql new file mode 100644 index 000000000..c9d63fe64 --- /dev/null +++ b/resource/sql/薪资还原脚本.sql @@ -0,0 +1,116 @@ +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_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 From 3f958d2886df0a53a573509b6b212319aee4e194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 31 May 2022 18:27:33 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../datacollection/dto/AddUpDeductionDTO.java | 2 +- .../taxdeclaration/bo/TaxDeclarationBO.java | 29 +++++++++++++++---- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionDTO.java b/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionDTO.java index 78b0d8676..d2b923a3e 100644 --- a/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionDTO.java +++ b/src/com/engine/salary/entity/datacollection/dto/AddUpDeductionDTO.java @@ -23,7 +23,7 @@ import lombok.NoArgsConstructor; @Builder @NoArgsConstructor @AllArgsConstructor -@SalaryTable(pageId = "a4f85287-e3f9-4275-adn9-7d06e54y6rj8", tableType = WeaTableType.CHECKBOX, operates = { +@SalaryTable(pageId = "a4f85287-e3f9-4275-adn9-7d06e54y67j8", tableType = WeaTableType.CHECKBOX, operates = { @SalaryTableOperate(text = "查看明细") }) public class AddUpDeductionDTO { diff --git a/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationBO.java b/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationBO.java index 5bfe09b17..6afae5f96 100644 --- a/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationBO.java +++ b/src/com/engine/salary/entity/taxdeclaration/bo/TaxDeclarationBO.java @@ -16,11 +16,12 @@ import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.page.PageInfo; import com.google.common.collect.Lists; -import com.google.common.collect.Maps; import dm.jdbc.util.IdGenerator; import lombok.Data; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.math.NumberUtils; import weaver.hrm.User; + import java.math.BigDecimal; import java.time.LocalDateTime; import java.util.*; @@ -157,7 +158,8 @@ public class TaxDeclarationBO { // 核算结果按照人员id分类 Map> acctResultMap = SalaryEntityUtil.group2Map(salaryAcctResults, SalaryAcctResultPO::getEmployeeId); acctResultMap.forEach((k, v) -> { - Map valueMap = Maps.newHashMapWithExpectedSize(32); + Long employeeId = k; + Map valueMap = new HashMap<>(); Map> resultMap = SalaryEntityUtil.group2Map(v, SalaryAcctResultPO::getSalaryItemId); // 收入 BigDecimal income = SalaryEntityUtil.reduce(resultMap.get(salaryItemMap.getOrDefault("income", 0L)), e -> SalaryEntityUtil.empty2Zero(e.getResultValue())); @@ -204,6 +206,9 @@ public class TaxDeclarationBO { // 累计收入 BigDecimal addUpIncome = findAddUpValue("addUpIncome", resultMap, salaryItemMap); valueMap.put("addUpIncome", addUpIncome); + // 累计免税收入 + BigDecimal addUpTaxFreeIncome = findAddUpValue("addUpTaxFreeIncome", resultMap, salaryItemMap); + valueMap.put("addUpTaxFreeIncome", addUpTaxFreeIncome); // 累计减除费用 BigDecimal addUpSubtraction = findAddUpValue("addUpSubtraction", resultMap, salaryItemMap); valueMap.put("addUpSubtraction", addUpSubtraction); @@ -225,6 +230,12 @@ public class TaxDeclarationBO { // 累计赡养老人 BigDecimal addUpSupportElderly = findAddUpValue("addUpSupportElderly", resultMap, salaryItemMap); valueMap.put("addUpSupportElderly", addUpSupportElderly); + // 累计大病医疗 + BigDecimal addUpIllnessMedical = findAddUpValue("addUpIllnessMedical", resultMap, salaryItemMap); + valueMap.put("addUpIllnessMedical", addUpIllnessMedical); + // 累计婴幼儿照护 + BigDecimal addUpInfantCare = findAddUpValue("addUpInfantCare", resultMap, salaryItemMap); + valueMap.put("addUpInfantCare", addUpInfantCare); // 累计其他扣除 BigDecimal addUpOtherDeduction = findAddUpValue("addUpOtherDeduction", resultMap, salaryItemMap); valueMap.put("addUpOtherDeduction", addUpOtherDeduction); @@ -249,6 +260,9 @@ public class TaxDeclarationBO { // 减免税额 BigDecimal addUpTaxDeduction = BigDecimal.ZERO; valueMap.put("addUpTaxDeduction", addUpTaxDeduction); + // 减免税额 + BigDecimal taxDeduction = findValue("taxDeduction", resultMap, salaryItemMap); + valueMap.put("taxDeduction", taxDeduction); // 应补缴税额 BigDecimal refundedOrSupplementedTax = SalaryEntityUtil.reduce(resultMap.get(salaryItemMap.getOrDefault("refundedOrSupplementedTax", 0L)), e -> SalaryEntityUtil.empty2Zero(e.getResultValue())); @@ -281,9 +295,9 @@ public class TaxDeclarationBO { // 更新累计情况 AddUpSituation accumulatedSituation = AddUpSituation.builder() .id(IdGenerator.generate()) - .employeeId(k) + .employeeId(employeeId) .taxAgentId(taxDeclaration.getTaxAgentId()) - .taxYearMonth((taxDeclaration.getSalaryMonth())) + .taxYearMonth(taxDeclaration.getSalaryMonth()) .year(taxDeclaration.getSalaryMonth().getYear()) .addUpIncome(addUpIncome.toPlainString()) .addUpSocialSecurityTotal(addUpSocialSecurityTotal.toPlainString()) @@ -295,15 +309,18 @@ public class TaxDeclarationBO { .addUpHousingLoanInterest(addUpHousingLoanInterest.toPlainString()) .addUpHousingRent(addUpHousingRent.toPlainString()) .addUpSupportElderly(addUpSupportElderly.toPlainString()) + .addUpIllnessMedical(addUpIllnessMedical.toPlainString()) + .addUpInfantCare(addUpInfantCare.toPlainString()) .addUpOtherDeduction(addUpOtherDeduction.toPlainString()) - .addUpTaxExemptIncome("0") + .addUpTaxExemptIncome(addUpTaxFreeIncome.toPlainString()) .addUpAllowedDonation(addUpAllowedDonation.toPlainString()) .addUpAdvanceTax(addUpTaxPayable.toPlainString()) +// .addUpTaxSavings(taxDeduction.toPlainString()) .creator(taxDeclaration.getCreator()) .createTime(taxDeclaration.getCreateTime()) .updateTime(taxDeclaration.getUpdateTime()) .tenantKey(taxDeclaration.getTenantKey()) - .deleteType(0) + .deleteType(NumberUtils.INTEGER_ZERO) .build(); result.getNeedInsertAccumulatedSituations().add(accumulatedSituation); });