diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index 980d3af62..a4ef201e7 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -1014,7 +1014,20 @@ public class SIAccountBiz extends Service { .paymentOrganization(param.getPaymentOrganization()) .projects(param.getProjects()) .billMonth(param.getBillMonth()) + .supplementType(param.getSupplementType()) .build(); + if ("2".equals(param.getSupplementType())) { + supplementAccountBaseParam.setSocialPaymentBaseString(param.getSocialPaymentBaseString()); + supplementAccountBaseParam.setFundPaymentBaseString(param.getFundPaymentBaseString()); + supplementAccountBaseParam.setOtherPaymentBaseString(param.getOtherPaymentBaseString()); + } else if("3".equals(param.getSupplementType())) { + supplementAccountBaseParam.setSocialPaymentPerString(param.getSocialPaymentPerString()); + supplementAccountBaseParam.setSocialPaymentComString(param.getSocialPaymentComString()); + supplementAccountBaseParam.setFundPaymentPerString(param.getFundPaymentPerString()); + supplementAccountBaseParam.setFundPaymentComString(param.getFundPaymentComString()); + supplementAccountBaseParam.setOtherPaymentPerString(param.getOtherPaymentPerString()); + supplementAccountBaseParam.setOtherPaymentComString(param.getOtherPaymentComString()); + } baseList.add(supplementAccountBaseParam); }); }); @@ -1070,13 +1083,43 @@ public class SIAccountBiz extends Service { //缴纳组织=个税扣缴义务人 insuranceAccountDetailPO.setSocialPayOrg(baseParam.getPaymentOrganization()); if (projects.contains(ProjectTypeEnum.ALL.getValue())) { - accountSocial(insuranceAccountDetailPO, accountPO); - accountFund(insuranceAccountDetailPO, accountPO); - accountOther(insuranceAccountDetailPO, accountPO); + if ("2".equals(baseParam.getSupplementType())) { + if (accountPO.getSocial() != null) { + accountPO.getSocial().setSocialPaymentBaseString(baseParam.getSocialPaymentBaseString()); + } + if (accountPO.getFund() != null) { + accountPO.getFund().setFundPaymentBaseString(baseParam.getFundPaymentBaseString()); + } + if (accountPO.getOther() != null) { + accountPO.getOther().setOtherPaymentBaseString(baseParam.getOtherPaymentBaseString()); + } + accountSocial(insuranceAccountDetailPO, accountPO); + accountFund(insuranceAccountDetailPO, accountPO); + accountOther(insuranceAccountDetailPO, accountPO); + } else if ("3".equals(baseParam.getSupplementType())) { + accountSocialByData(insuranceAccountDetailPO, baseParam); + accountFundByData(insuranceAccountDetailPO, baseParam); + accountOtherByData(insuranceAccountDetailPO, baseParam); + } else { + accountSocial(insuranceAccountDetailPO, accountPO); + accountFund(insuranceAccountDetailPO, accountPO); + accountOther(insuranceAccountDetailPO, accountPO); + } + return account(insuranceAccountDetailPO); } if (projects.contains(ProjectTypeEnum.SOCIAL.getValue())) { - accountSocial(insuranceAccountDetailPO, accountPO); + if ("2".equals(baseParam.getSupplementType())) { + if (accountPO.getSocial() != null) { + accountPO.getSocial().setSocialPaymentBaseString(baseParam.getSocialPaymentBaseString()); + } + accountSocial(insuranceAccountDetailPO, accountPO); + } else if ("3".equals(baseParam.getSupplementType())) { + accountSocialByData(insuranceAccountDetailPO, baseParam); + } else { + accountSocial(insuranceAccountDetailPO, accountPO); + } + } if (!projects.contains(ProjectTypeEnum.SOCIAL.getValue())) { List ids = new ArrayList<>(); @@ -1092,13 +1135,44 @@ public class SIAccountBiz extends Service { .get(); ids.add(insuranceCategoryPO.getId()); } - accountEndowmentInsurance(insuranceAccountDetailPO, accountPO, ids); + if ("2".equals(baseParam.getSupplementType())) { + if (accountPO.getSocial() != null) { + accountPO.getSocial().setSocialPaymentBaseString(baseParam.getSocialPaymentBaseString()); + } + accountEndowmentInsurance(insuranceAccountDetailPO, accountPO, ids); + } else if ("3".equals(baseParam.getSupplementType())) { + accountEndowmentInsuranceByData(insuranceAccountDetailPO, baseParam, ids); + } else { + accountEndowmentInsurance(insuranceAccountDetailPO, accountPO, ids); + } + } if (projects.contains(ProjectTypeEnum.FUND.getValue())) { - accountFund(insuranceAccountDetailPO, accountPO); + if ("2".equals(baseParam.getSupplementType())) { + if (accountPO.getFund() != null) { + accountPO.getFund().setFundPaymentBaseString(baseParam.getFundPaymentBaseString()); + } + accountFund(insuranceAccountDetailPO, accountPO); + } else if ("3".equals(baseParam.getSupplementType())) { + accountFundByData(insuranceAccountDetailPO, baseParam); + } else { + accountFund(insuranceAccountDetailPO, accountPO); + } + } if (projects.contains(ProjectTypeEnum.OTHER.getValue())) { - accountOther(insuranceAccountDetailPO, accountPO); + + if ("2".equals(baseParam.getSupplementType())) { + if (accountPO.getOther() != null) { + accountPO.getOther().setOtherPaymentBaseString(baseParam.getOtherPaymentBaseString()); + } + accountOther(insuranceAccountDetailPO, accountPO); + } else if ("3".equals(baseParam.getSupplementType())) { + accountOtherByData(insuranceAccountDetailPO, baseParam); + } else { + accountOther(insuranceAccountDetailPO, accountPO); + } + } return account(insuranceAccountDetailPO); @@ -1426,11 +1500,17 @@ public class SIAccountBiz extends Service { //需要核算社保的福利id 单位 List needArchivesCom = new ArrayList<>(); if (archivesCom != null) { - archivesCom.forEach((id, value) -> { - if (schemeCom.containsKey(Long.valueOf(id))) { - needArchivesCom.add(Long.valueOf(id)); + categoryIds.forEach(item -> { + if (archivesCom.containsKey(String.valueOf(item)) && schemeCom.containsKey(item)) { + needArchivesCom.add(item); } }); + +// archivesCom.forEach((id, value) -> { +// if (schemeCom.containsKey(Long.valueOf(id))) { +// needArchivesCom.add(Long.valueOf(id)); +// } +// }); } List socialCom = new ArrayList<>(); @@ -1838,4 +1918,144 @@ public class SIAccountBiz extends Service { getInsuranceAccountDetailMapper().updateByEmployeeIdAndBillMonth(insuranceAccountDetailPO); } + public void accountFundByData(InsuranceAccountDetailPO insuranceAccountDetailPO, SupplementAccountBaseParam baseParam) { + //公积金个人 + if (StringUtils.isNotBlank(baseParam.getFundPaymentPerString())) { + List fundPer = new ArrayList<>(); + HashMap fundPerson = JSON.parseObject(baseParam.getFundPaymentPerString(), new HashMap().getClass()); + fundPerson.forEach((k, v) -> { + BigDecimal result = new BigDecimal(v); + fundPer.add(result); + }); + insuranceAccountDetailPO.setFundPerJson(baseParam.getFundPaymentPerString()); + BigDecimal fundPerSum = new BigDecimal("0"); + for (BigDecimal bigDecimal : fundPer) { + fundPerSum = fundPerSum.add(bigDecimal); + } + insuranceAccountDetailPO.setFundPerSum(fundPerSum.toPlainString()); + } + //公积金单位 + if (StringUtils.isNotBlank(baseParam.getFundPaymentComString())) { + List fundCom = new ArrayList<>(); + HashMap fundComMap = JSON.parseObject(baseParam.getFundPaymentComString(), new HashMap().getClass()); + fundComMap.forEach((k, v) -> { + BigDecimal result = new BigDecimal(v); + fundCom.add(result); + }); + insuranceAccountDetailPO.setFundComJson(baseParam.getFundPaymentComString()); + BigDecimal fundComSum = new BigDecimal("0"); + for (BigDecimal bigDecimal : fundCom) { + fundComSum = fundComSum.add(bigDecimal); + } + insuranceAccountDetailPO.setFundComSum(fundComSum.toPlainString()); + } + } + + public void accountOtherByData(InsuranceAccountDetailPO insuranceAccountDetailPO, SupplementAccountBaseParam baseParam) { + //其他福利个人 + if (StringUtils.isNotBlank(baseParam.getOtherPaymentPerString())) { + List otherPer = new ArrayList<>(); + HashMap otherPerMap = JSON.parseObject(baseParam.getOtherPaymentPerString(), new HashMap().getClass()); + otherPerMap.forEach((k, v) -> { + BigDecimal result = new BigDecimal(v); + otherPer.add(result); + }); + insuranceAccountDetailPO.setOtherPerJson(baseParam.getOtherPaymentPerString()); + BigDecimal otherPerSum = new BigDecimal("0"); + for (BigDecimal bigDecimal : otherPer) { + otherPerSum = otherPerSum.add(bigDecimal); + } + insuranceAccountDetailPO.setOtherPerSum(otherPerSum.toPlainString()); + } + //其他福利单位 + if (StringUtils.isNotBlank(baseParam.getOtherPaymentComString())) { + List otherCom = new ArrayList<>(); + HashMap otherComMap = JSON.parseObject(baseParam.getOtherPaymentComString(), new HashMap().getClass()); + otherComMap.forEach((k, v) -> { + BigDecimal result = new BigDecimal(v); + otherCom.add(result); + }); + insuranceAccountDetailPO.setOtherComJson(baseParam.getOtherPaymentComString()); + BigDecimal otherComSum = new BigDecimal("0"); + for (BigDecimal bigDecimal : otherCom) { + otherComSum = otherComSum.add(bigDecimal); + } + insuranceAccountDetailPO.setOtherComSum(otherComSum.toPlainString()); + } + } + + public void accountSocialByData(InsuranceAccountDetailPO insuranceAccountDetailPO, SupplementAccountBaseParam baseParam) { + //社保个人 + if (StringUtils.isNotBlank(baseParam.getSocialPaymentPerString())) { + List socialPer = new ArrayList<>(); + HashMap archivesPerson = JSON.parseObject(baseParam.getSocialPaymentPerString(), new HashMap().getClass()); + archivesPerson.forEach((k, v) -> { + BigDecimal result = new BigDecimal(v); + socialPer.add(result); + }); + insuranceAccountDetailPO.setSocialPerJson(baseParam.getSocialPaymentPerString()); + BigDecimal socialPerSum = new BigDecimal("0"); + for (BigDecimal bigDecimal : socialPer) { + socialPerSum = socialPerSum.add(bigDecimal); + } + insuranceAccountDetailPO.setSocialPerSum(socialPerSum.toPlainString()); + } + //社保单位 + if (StringUtils.isNotBlank(baseParam.getSocialPaymentComString())) { + List socialCom = new ArrayList<>(); + HashMap archivesCom = JSON.parseObject(baseParam.getSocialPaymentComString(), new HashMap().getClass()); + archivesCom.forEach((k, v) -> { + BigDecimal result = new BigDecimal(v); + socialCom.add(result); + }); + insuranceAccountDetailPO.setSocialComJson(baseParam.getSocialPaymentComString()); + BigDecimal socialComSum = new BigDecimal("0"); + for (BigDecimal bigDecimal : socialCom) { + socialComSum = socialComSum.add(bigDecimal); + } + insuranceAccountDetailPO.setSocialComSum(socialComSum.toPlainString()); + } + } + + public void accountEndowmentInsuranceByData(InsuranceAccountDetailPO insuranceAccountDetailPO, SupplementAccountBaseParam baseParam, List ids) { + //社保个人 + if (StringUtils.isNotBlank(baseParam.getSocialPaymentPerString())) { + List socialPer = new ArrayList<>(); + HashMap archivesPerson = JSON.parseObject(baseParam.getSocialPaymentPerString(), new HashMap().getClass()); + HashMap socialPerson = new HashMap<>(); + archivesPerson.forEach((k, v) -> { + if (ids.contains(Long.valueOf(k))) { + socialPerson.put(k, v); + BigDecimal result = new BigDecimal(v); + socialPer.add(result); + } + + }); + insuranceAccountDetailPO.setSocialPerJson(JSON.toJSONString(socialPerson)); + BigDecimal socialPerSum = new BigDecimal("0"); + for (BigDecimal bigDecimal : socialPer) { + socialPerSum = socialPerSum.add(bigDecimal); + } + insuranceAccountDetailPO.setSocialPerSum(socialPerSum.toPlainString()); + } + //社保单位 + if (StringUtils.isNotBlank(baseParam.getSocialPaymentComString())) { + List socialCom = new ArrayList<>(); + HashMap archivesCom = JSON.parseObject(baseParam.getSocialPaymentComString(), new HashMap().getClass()); + HashMap socialComMap = new HashMap<>(); + archivesCom.forEach((k, v) -> { + if (ids.contains(Long.valueOf(k))) { + socialComMap.put(k, v); + BigDecimal result = new BigDecimal(v); + socialCom.add(result); + } + }); + insuranceAccountDetailPO.setSocialComJson(JSON.toJSONString(socialComMap)); + BigDecimal socialComSum = new BigDecimal("0"); + for (BigDecimal bigDecimal : socialCom) { + socialComSum = socialComSum.add(bigDecimal); + } + insuranceAccountDetailPO.setSocialComSum(socialComSum.toPlainString()); + } + } } diff --git a/src/com/engine/salary/biz/SIArchivesBiz.java b/src/com/engine/salary/biz/SIArchivesBiz.java index e8a5dc5eb..22665b1c6 100644 --- a/src/com/engine/salary/biz/SIArchivesBiz.java +++ b/src/com/engine/salary/biz/SIArchivesBiz.java @@ -12,6 +12,7 @@ import com.cloudstore.eccom.pc.table.WeaTable; import com.cloudstore.eccom.pc.table.WeaTableCheckboxpopedom; import com.cloudstore.eccom.pc.table.WeaTableColumn; import com.cloudstore.eccom.result.WeaResultMsg; +import com.engine.common.util.ServiceUtil; import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.encrypt.AESEncryptUtil; import com.engine.salary.encrypt.EncryptUtil; @@ -45,6 +46,7 @@ import com.engine.salary.util.SalaryFormItemUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; +import com.engine.salary.wrapper.TaxAgentWrapper; import com.google.common.collect.Lists; import dm.jdbc.util.IdGenerator; import lombok.Data; @@ -104,6 +106,10 @@ public class SIArchivesBiz { return MapperProxyFactory.getProxy(OtherSchemeMapper.class); } + private TaxAgentWrapper getTaxAgentWrapper(User user) { + return ServiceUtil.getService(TaxAgentWrapper.class, user); + } + /** * @param welfareType * @param employeeId @@ -917,6 +923,8 @@ public class SIArchivesBiz { request.setRunStatuses(param.getRunStatuses()); + request.setTaxAgentId(param.getTaxAgentId()); + apidatas = listPageEmployeePOS(request, operateId); return apidatas; @@ -978,9 +986,9 @@ public class SIArchivesBiz { log.info("buildTableData方法处理福利档案列表数据开始"); sw.start("buildTableData方法处理福利档案列表数据"); if (param.getExportData() != null && param.getExportData()) { - records = buildTableData(page, true); + records = buildTableData(pageInfo.getList(), true); } else { - records = buildTableData(page, false); + records = buildTableData(pageInfo.getList(), false); } sw.stop(); log.info("buildTableData方法处理福利档案列表数据完成!"); @@ -1294,6 +1302,9 @@ public class SIArchivesBiz { .collect(Collectors.toList()) .stream().map(item -> new SearchConditionOption(item.getId().toString(), item.getSchemeName())).collect(Collectors.toList()); + List> taxAgentList = getTaxAgentWrapper(user).selectListAsAdmin(); + List taxAgentOption = taxAgentList.stream().map(item -> new SearchConditionOption(item.get("id").toString(), item.get("content").toString())).collect(Collectors.toList()); + Map apidatas = new HashMap(); ConditionFactory conditionFactory = new ConditionFactory(user); @@ -1412,6 +1423,16 @@ public class SIArchivesBiz { otherSchemeId.setLabel("其它福利方案"); conditionItems.add(otherSchemeId); + SearchConditionItem taxAgentId = conditionFactory.createCondition(ConditionType.SELECT, 502327, "taxAgentId"); + taxAgentId.setInputType("select"); + taxAgentId.setOptions(taxAgentOption); + taxAgentId.setColSpan(2); + taxAgentId.setFieldcol(16); + taxAgentId.setLabelcol(8); + taxAgentId.setIsQuickSearch(true); + taxAgentId.setLabel("个税扣缴义务人"); + conditionItems.add(taxAgentId); + addGroups.add(new SearchConditionGroup("常用条件", true, conditionItems)); apidatas.put("condition", addGroups); return apidatas; diff --git a/src/com/engine/salary/entity/siaccount/param/SaveSupplementaryAccountParam.java b/src/com/engine/salary/entity/siaccount/param/SaveSupplementaryAccountParam.java index 86bda6ad7..097cf94fe 100644 --- a/src/com/engine/salary/entity/siaccount/param/SaveSupplementaryAccountParam.java +++ b/src/com/engine/salary/entity/siaccount/param/SaveSupplementaryAccountParam.java @@ -45,4 +45,54 @@ public class SaveSupplementaryAccountParam { */ @DataCheck(require = true,message = "个税扣缴义务人不能为空") private Long paymentOrganization; + + /** + * 社保补缴基数 + */ + private String socialPaymentBaseString; + + /** + * 公积金补缴基数 + */ + private String fundPaymentBaseString; + + /** + * 其他福利补缴基数 + */ + private String otherPaymentBaseString; + + /** + * 社保补缴金额_个人 + */ + private String socialPaymentPerString; + + /** + * 社保补缴金额_单位 + */ + private String socialPaymentComString; + + /** + * 公积金补缴金额_个人 + */ + private String fundPaymentPerString; + + /** + * 公积金补缴金额_单位 + */ + private String fundPaymentComString; + + /** + * 其他福利补缴金额_个人 + */ + private String otherPaymentPerString; + + /** + * 其他福利补缴金额_单位 + */ + private String otherPaymentComString; + + /** + * 补缴类型 + */ + private String supplementType; } diff --git a/src/com/engine/salary/entity/siaccount/param/SupplementAccountBaseParam.java b/src/com/engine/salary/entity/siaccount/param/SupplementAccountBaseParam.java index eb7198f4d..0125705dd 100644 --- a/src/com/engine/salary/entity/siaccount/param/SupplementAccountBaseParam.java +++ b/src/com/engine/salary/entity/siaccount/param/SupplementAccountBaseParam.java @@ -37,4 +37,54 @@ public class SupplementAccountBaseParam { //补缴项目") private List projects; + + /** + * 社保补缴基数 + */ + private String socialPaymentBaseString; + + /** + * 公积金补缴基数 + */ + private String fundPaymentBaseString; + + /** + * 其他福利补缴基数 + */ + private String otherPaymentBaseString; + + /** + * 社保补缴金额_个人 + */ + private String socialPaymentPerString; + + /** + * 社保补缴金额_单位 + */ + private String socialPaymentComString; + + /** + * 公积金补缴金额_个人 + */ + private String fundPaymentPerString; + + /** + * 公积金补缴金额_单位 + */ + private String fundPaymentComString; + + /** + * 其他福利补缴金额_个人 + */ + private String otherPaymentPerString; + + /** + * 其他福利补缴金额_单位 + */ + private String otherPaymentComString; + + /** + * 补缴类型 + */ + private String supplementType; } diff --git a/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesListParam.java b/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesListParam.java index 2fd3bf1cc..ad05e9702 100644 --- a/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesListParam.java +++ b/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesListParam.java @@ -105,6 +105,8 @@ public class InsuranceArchivesListParam extends BaseQueryParam { private Collection taxAgentEmployeeIds; //个税扣缴义务人 private Collection taxAgentIds; + //个税扣缴义务人id + private Long taxAgentId; //福利执行状态 private List runStatuses; diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml index 745571160..6ec6e1bb1 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml @@ -305,7 +305,8 @@ t.fund_per_json,t.fund_com_json,t.other_per_json, t.other_com_json,t.social_per_sum,t.social_com_sum, t.fund_per_sum,t.fund_com_sum,t.other_per_sum, - t.other_com_sum,t.per_sum,t.com_sum,t.payment_organization + t.other_com_sum,t.per_sum,t.com_sum,t.payment_organization, + t.social_payment_base_string, t.fund_payment_base_string, t.other_payment_base_string FROM hrsa_bill_detail t WHERE t.delete_type = 0 diff --git a/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml b/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml index 329ecfb70..1d3f9f49d 100644 --- a/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml +++ b/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml @@ -421,6 +421,9 @@ AND otherSchemeId = #{param.otherSchemeId} + + AND base.payment_organization = #{param.taxAgentId} + AND base.run_status IN @@ -501,6 +504,9 @@ AND otherSchemeId = #{param.otherSchemeId} + + AND base.payment_organization = #{param.taxAgentId} + AND base.run_status IN @@ -580,6 +586,9 @@ AND otherSchemeId = #{param.otherSchemeId} + + AND base.payment_organization = #{param.taxAgentId} + AND base.run_status IN diff --git a/src/com/engine/salary/service/AddUpDeductionService.java b/src/com/engine/salary/service/AddUpDeductionService.java index 88f7c3898..51498f653 100644 --- a/src/com/engine/salary/service/AddUpDeductionService.java +++ b/src/com/engine/salary/service/AddUpDeductionService.java @@ -109,6 +109,8 @@ public interface AddUpDeductionService { */ List getAccountedEmployeeData(String yearMonth); + List getAccountedEmployeeDataByTaxYearMonth(String yearMonth); + /** * @description 编辑累计专项附加扣除 * @return void diff --git a/src/com/engine/salary/service/SIRepairService.java b/src/com/engine/salary/service/SIRepairService.java new file mode 100644 index 000000000..2b4dacc38 --- /dev/null +++ b/src/com/engine/salary/service/SIRepairService.java @@ -0,0 +1,16 @@ +package com.engine.salary.service; + +import com.engine.salary.entity.siaccount.param.SupplementAccountBaseParam; + +import java.util.List; +import java.util.Map; + +public interface SIRepairService { + + List> getSupplementPaymentForm(SupplementAccountBaseParam param); + + /** + * 获取待编辑的补缴费用相关福利项 + */ + List> getPaymentGroup(SupplementAccountBaseParam param); +} diff --git a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java index 97b8afa01..9d0de576c 100644 --- a/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpDeductionServiceImpl.java @@ -546,7 +546,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction List deleteIds = deleteParam.getIds(); // 已经核算过的不可操作 // 获取已经核算的数据 - List salaryAcctEmployees = getAccountedEmployeeData(declareMonthStr); + List salaryAcctEmployees = getAccountedEmployeeDataByTaxYearMonth(declareMonthStr); // 判断是否有核算过 List deleteList = new ArrayList<>(); for (int i = 0; i < deleteIds.size(); i++) { @@ -604,7 +604,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction // 获取所有想要删除的数据 List list = addUpDeductionBiz.list(queryParam); // 获取已经核算的数据 - List salaryAcctEmployees = getAccountedEmployeeData(declareMonthStr); + List salaryAcctEmployees = getAccountedEmployeeDataByTaxYearMonth(declareMonthStr); for (AddUpDeductionDTO item : list) { if (CollectionUtils.isNotEmpty(salaryAcctEmployees)) { Optional optionalAcctEmp = salaryAcctEmployees.stream().filter(f -> f.getEmployeeId().equals(item.getEmployeeId()) && f.getTaxAgentId().equals(item.getTaxAgentId())).findFirst(); @@ -1176,4 +1176,25 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction return list; } + @Override + public List getAccountedEmployeeDataByTaxYearMonth(String yearMonth) { + List list = Lists.newArrayList(); + YearMonth month = YearMonth.parse(yearMonth); + LocalDate salaryMonthDate = month.atDay(1); + LocalDate salaryMonthEndDate = month.atEndOfMonth(); + List salaryAcctRecords = getSalaryAcctRecordService(user).listByTaxCycle( + LocalDateRange.builder().fromDate(SalaryDateUtil.localDateToDate(salaryMonthDate)) + .endDate(SalaryDateUtil.localDateToDate(salaryMonthEndDate)).build(), + null); + salaryAcctRecords.forEach(e -> { + boolean isAccounted = e.getStatus() > SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue(); + if (isAccounted) { +// list.addAll(getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(Collections.singleton(salaryAcctRecords.get(0).getId()))); + list.addAll(getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(Collections.singleton(e.getId()))); + } + }); + + return list; + } + } diff --git a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java index a26a9c801..622624f21 100644 --- a/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java +++ b/src/com/engine/salary/service/impl/AddUpSituationServiceImpl.java @@ -56,6 +56,7 @@ import java.io.InputStream; import java.text.SimpleDateFormat; import java.time.LocalDate; import java.time.YearMonth; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.stream.Collectors; @@ -200,8 +201,9 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation queryParam.setTaxAgentIds(taxAgentIdsAsAdmin); } List list = getAddUpSituationMapper().list(queryParam); - encryptUtil.decryptList(list, AddUpSituationDTO.class); - return SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, AddUpSituationDTO.class); + PageInfo page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, AddUpSituationDTO.class); + encryptUtil.decryptList(page.getList(), AddUpSituationDTO.class); + return page; } @@ -1026,7 +1028,10 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation List deleteIds = deleteParam.getIds(); // 已经核算过的不可操作 // 获取已经核算的数据 - List salaryAcctEmployees = getAddUpDeductionService(user).getAccountedEmployeeData(declareMonthStr); + LocalDate salaryMonthDate = LocalDate.parse(declareMonthStr + "-01", SalaryDateUtil.DATE_FORMATTER); + salaryMonthDate = salaryMonthDate.plusMonths(1); + String format = salaryMonthDate.atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM")); + List salaryAcctEmployees = getAddUpDeductionService(user).getAccountedEmployeeData(format); // 判断是否有核算过 List deleteList = new ArrayList<>(); for(int i=0; i Objects.equals(t , taxAgentId)); @@ -1085,8 +1090,10 @@ public class AddUpSituationServiceImpl extends Service implements AddUpSituation // 获取所有想要删除的数据 List list = biz.listSome(queryParam); + LocalDate salaryMonthDate = LocalDate.parse(declareMonthStr + "-01", SalaryDateUtil.DATE_FORMATTER); + String format = salaryMonthDate.plusMonths(1).atStartOfDay().format(DateTimeFormatter.ofPattern("yyyy-MM")); // 获取已经核算的数据 - List employees = getAddUpDeductionService(user).getAccountedEmployeeData(declareMonthStr); + List employees = getAddUpDeductionService(user).getAccountedEmployeeData(format); for(AddUpSituation item : list){ if (CollectionUtils.isNotEmpty(employees)) { Optional optionalAcctEmp = employees.stream().filter(f -> f.getEmployeeId().equals(item.getEmployeeId()) && f.getTaxAgentId().equals(item.getTaxAgentId())).findFirst(); diff --git a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java index d3a3c4a36..3130377dc 100644 --- a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java +++ b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java @@ -293,6 +293,17 @@ public class SICompensationServiceImpl extends Service implements SICompensation continue; } + //判断是否已有调差数据(个税扣缴义务人+账单月份+人员id) + InsuranceCompensationPO nowCompensation = getInsuranceCompensationMapper().getOneByBillMonthPayOrgEmpId(InsuranceCompensationPO.builder() + .billMonth(insuranceAccountDetailPO.getBillMonth()) + .paymentOrganization(insuranceAccountDetailPO.getPaymentOrganization()) + .employeeId(insuranceAccountDetailPO.getEmployeeId()) + .build()); + if (nowCompensation != null) { + errorList.add(usernameMap.get(param.getEmployeeId()) + "-调差失败:调差对象在当前月该缴纳组织下已存在调差数据!"); + continue; + } + encryptUtil.decrypt(insuranceAccountDetailPO, InsuranceAccountDetailPO.class); if (StringUtils.isNotBlank(insuranceAccountDetailPO.getSocialComJson())) { Map socialJson = JSON.parseObject(insuranceAccountDetailPO.getSocialComJson(), new HashMap().getClass()); @@ -534,7 +545,13 @@ public class SICompensationServiceImpl extends Service implements SICompensation //设置targetOptions Map targetOptions = new HashMap<>(); targetOptions.put("name", usernameMap.get(configPO.getEmployeeId())); - targetOptions.put("id", detailPOMap.get(configPO.getEmployeeId()).getId().toString()); +// String target = detailPOMap.get(configPO.getEmployeeId()).getId().toString(); + String target = detailPOMap.get(configPO.getEmployeeId()) == null ? null : detailPOMap.get(configPO.getEmployeeId()).getId().toString(); + if (target == null) { + continue; + } else { + targetOptions.put("id", detailPOMap.get(configPO.getEmployeeId()).getId().toString()); + } dto.setTargetOptions(targetOptions); @@ -550,6 +567,18 @@ public class SICompensationServiceImpl extends Service implements SICompensation } dto.setCategoryTypeOptions(categoryTypeOptions); + //设置公司核算金额(单位) + CompensationParam compensationParam = CompensationParam.builder() + .categoryType(dto.getCategoryType()) + .employeeId(dto.getEmployeeId().toString()) + .paymentOrganization(dto.getPaymentOrganization()) + .target(Long.valueOf(dto.getTargetOptions().get("id"))) + .build(); + List paramList = new ArrayList<>(); + paramList.add(compensationParam); + List> comTotalList = compensationComTotal(paramList); + dto.setCompanyTotal(comTotalList.get(0).get("totalNum")); + compensationDTOList.add(dto); } } diff --git a/src/com/engine/salary/service/impl/SIRepairServiceImpl.java b/src/com/engine/salary/service/impl/SIRepairServiceImpl.java new file mode 100644 index 000000000..80794e272 --- /dev/null +++ b/src/com/engine/salary/service/impl/SIRepairServiceImpl.java @@ -0,0 +1,453 @@ +package com.engine.salary.service.impl; + +import com.alibaba.fastjson.JSON; +import com.engine.core.impl.Service; +import com.engine.salary.encrypt.EncryptUtil; +import com.engine.salary.entity.siaccount.param.SaveSupplementaryAccountParam; +import com.engine.salary.entity.siaccount.param.SupplementAccountBaseParam; +import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO; +import com.engine.salary.entity.siarchives.po.*; +import com.engine.salary.entity.sicategory.po.ICategoryPO; +import com.engine.salary.enums.siaccount.ProjectTypeEnum; +import com.engine.salary.enums.sicategory.DataTypeEnum; +import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper; +import com.engine.salary.mapper.siarchives.FundSchemeMapper; +import com.engine.salary.mapper.siarchives.OtherSchemeMapper; +import com.engine.salary.mapper.siarchives.SocialSchemeMapper; +import com.engine.salary.mapper.sicategory.ICategoryMapper; +import com.engine.salary.service.SIRepairService; +import com.engine.salary.util.SalaryEntityUtil; +import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.db.MapperProxyFactory; +import com.google.common.collect.Maps; +import org.apache.commons.lang3.StringUtils; + +import java.util.*; +import java.util.stream.Collectors; + +/** + * @Author: sy + * @Description: 福利台账-补缴实现类 + * @Date: 2022/12/27 + **/ +public class SIRepairServiceImpl extends Service implements SIRepairService { + + private EncryptUtil encryptUtil = new EncryptUtil(); + + private InsuranceAccountDetailMapper getInsuranceAccountDetailMapper() { + return MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class); + } + + private SocialSchemeMapper getSocialSchemeMapper() { + return MapperProxyFactory.getProxy(SocialSchemeMapper.class); + } + + private FundSchemeMapper getFundSchemeMapper() { + return MapperProxyFactory.getProxy(FundSchemeMapper.class); + } + + private OtherSchemeMapper getOtherSchemeMapper() { + return MapperProxyFactory.getProxy(OtherSchemeMapper.class); + } + + /** + * 获取指定月份的福利缴纳基数作为补缴基数 + * @param param + * @return + */ + @Override + public List> getSupplementPaymentForm(SupplementAccountBaseParam param) { + + Long paymentOrganization = param.getPaymentOrganization(); + String billMonth = param.getBillMonth(); + List projects = param.getProjects(); + Long employeeId = param.getEmployeeId(); + + List detailPOList = getInsuranceAccountDetailMapper().queryNormalList(billMonth, paymentOrganization, employeeId); + + if (detailPOList.size() > 1) { + throw new SalaryRunTimeException("该人员本次核算出现多组数据,请删除数据库中多余核算项"); + } else if (detailPOList.size() == 0) { + throw new SalaryRunTimeException("数据不存在"); + } else { + InsuranceAccountDetailPO targetDetailPO = detailPOList.get(0); + encryptUtil.decrypt(targetDetailPO, InsuranceAccountDetailPO.class); + + String socialBaseString = targetDetailPO.getSocialPaymentBaseString(); + String fundBaseString = targetDetailPO.getFundPaymentBaseString(); + String otherBaseString = targetDetailPO.getOtherPaymentBaseString(); + + Map socialBaseMap = JSON.parseObject(socialBaseString, HashMap.class); + Map fundBaseMap = JSON.parseObject(fundBaseString, HashMap.class); + Map otherBaseMap = JSON.parseObject(otherBaseString, HashMap.class); + + Map targetBaseMap = new HashMap<>(); + + List allCategoryList = MapperProxyFactory.getProxy(ICategoryMapper.class).listAll(); + Map categoryNameMap = SalaryEntityUtil.convert2Map(allCategoryList, ICategoryPO::getId, ICategoryPO::getInsuranceName); + Map welfareTypeMap = SalaryEntityUtil.convert2Map(allCategoryList, ICategoryPO::getId, ICategoryPO::getWelfareType); + + if (projects.contains(ProjectTypeEnum.ALL.getValue())) { + if (socialBaseMap != null) { + targetBaseMap.putAll(socialBaseMap); + } + if (fundBaseMap != null) { + targetBaseMap.putAll(fundBaseMap); + } + if (otherBaseMap != null) { + targetBaseMap.putAll(otherBaseMap); + } + + } + if (projects.contains(ProjectTypeEnum.SOCIAL.getValue())) { + if (socialBaseMap != null) { + targetBaseMap.putAll(socialBaseMap); + } + } + if (!projects.contains(ProjectTypeEnum.SOCIAL.getValue())) { + + List list = MapperProxyFactory.getProxy(ICategoryMapper.class).listByDataType(DataTypeEnum.SYSTEM.getValue()); + + if (projects.contains(ProjectTypeEnum.ENDOWMENT_INSURANCE.getValue())) { + ICategoryPO insuranceCategoryPO = list.stream().filter(item -> SalaryI18nUtil.getI18nLabel(93113, "养老保险").equals(item.getInsuranceName())).findFirst() + .get(); + + if (socialBaseMap != null && socialBaseMap.containsKey(insuranceCategoryPO.getId())) { + targetBaseMap.put(insuranceCategoryPO.getId().toString(), socialBaseMap.get(insuranceCategoryPO.getId())); + } + + } + if (projects.contains(ProjectTypeEnum.MEDICAL_INSURANCE.getValue())) { + ICategoryPO insuranceCategoryPO = list.stream().filter(item -> SalaryI18nUtil.getI18nLabel(93114, "医疗保险").equals(item.getInsuranceName())).findFirst() + .get(); + if (socialBaseMap != null && socialBaseMap.containsKey(insuranceCategoryPO.getId())) { + targetBaseMap.put(insuranceCategoryPO.getId().toString(), socialBaseMap.get(insuranceCategoryPO.getId())); + } + } + + + } + if (projects.contains(ProjectTypeEnum.FUND.getValue())) { + if (fundBaseMap != null) { + targetBaseMap.putAll(fundBaseMap); + } + + } + if (projects.contains(ProjectTypeEnum.OTHER.getValue())) { + + if (otherBaseMap != null) { + targetBaseMap.putAll(otherBaseMap); + } + } + + List> resulit = new ArrayList(); + if (targetBaseMap.size() > 0) { + for (Map.Entry entry : targetBaseMap.entrySet()) { + + Map map = new HashMap<>(); + map.put("insuranceId", entry.getKey()); + map.put("insuranceName", categoryNameMap.get(Long.valueOf(entry.getKey()))); + map.put("insuranceBase", entry.getValue()); + + String welfareTypeName = welfareTypeMap.get(Long.valueOf(entry.getKey())) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(entry.getKey())) == 2 ? "公积金" : "企业年金及其它福利" ); + map.put("title", welfareTypeName); + resulit.add(map); + } + } + return resulit; + + } + + + } + + /** + * 获取待编辑的补缴费用相关福利项 + */ + @Override + public List> getPaymentGroup(SupplementAccountBaseParam param) { + + Long paymentOrganization = param.getPaymentOrganization(); + List projects = param.getProjects(); + Long employeeId = param.getEmployeeId(); + InsuranceArchivesSocialSchemePO socialSchemePO = new InsuranceArchivesSocialSchemePO(); + InsuranceArchivesFundSchemePO fundSchemePO = new InsuranceArchivesFundSchemePO(); + InsuranceArchivesOtherSchemePO otherSchemePO = new InsuranceArchivesOtherSchemePO(); + + List socialSchemePOList = getSocialSchemeMapper().getSocialByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder() + .employeeId(employeeId) + .paymentOrganization(paymentOrganization) + .build()); + if (socialSchemePOList.size() > 0) { + encryptUtil.decryptList(socialSchemePOList, InsuranceArchivesSocialSchemePO.class); + socialSchemePO = socialSchemePOList.get(0); + } + + List fundSchemePOList = getFundSchemeMapper().getFundByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder() + .employeeId(employeeId) + .paymentOrganization(paymentOrganization) + .build()); + if (fundSchemePOList.size() > 0) { + encryptUtil.decryptList(fundSchemePOList, InsuranceArchivesFundSchemePO.class); + fundSchemePO = fundSchemePOList.get(0); + } + + List otherSchemePOList = getOtherSchemeMapper().getOtherByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder() + .employeeId(employeeId) + .paymentOrganization(paymentOrganization) + .build()); + if (otherSchemePOList.size() > 0) { + encryptUtil.decryptList(otherSchemePOList, InsuranceArchivesOtherSchemePO.class); + otherSchemePO = otherSchemePOList.get(0); + } + + List allCategoryList = MapperProxyFactory.getProxy(ICategoryMapper.class).listAll(); + Map categoryNameMap = SalaryEntityUtil.convert2Map(allCategoryList, ICategoryPO::getId, ICategoryPO::getInsuranceName); + Map welfareTypeMap = SalaryEntityUtil.convert2Map(allCategoryList, ICategoryPO::getId, ICategoryPO::getWelfareType); + + List> resultList = new ArrayList<>(); + if (projects.contains(ProjectTypeEnum.ALL.getValue())) { + if (socialSchemePO != null && StringUtils.isNotBlank(socialSchemePO.getSocialPaymentBaseString())) { + Map socialMap = JSON.parseObject(socialSchemePO.getSocialPaymentBaseString(), new HashMap().getClass()); + + socialMap.forEach((k, v) -> { + Map perMap = new HashMap<>(); + Map comMap = new HashMap<>(); + + String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" ); + perMap.put("title", welfareTypeName); + comMap.put("title", welfareTypeName); + + perMap.put("insuranceId", k); + perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k))); + perMap.put("paymentScope", "个人"); + + comMap.put("insuranceId", k); + comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k))); + comMap.put("paymentScope", "公司"); + + resultList.add(perMap); + resultList.add(comMap); + }); + + } + if (fundSchemePO != null && StringUtils.isNotBlank(fundSchemePO.getFundPaymentBaseString())) { + Map fundMap = JSON.parseObject(fundSchemePO.getFundPaymentBaseString(), new HashMap().getClass()); + fundMap.forEach((k, v) -> { + Map perMap = new HashMap<>(); + Map comMap = new HashMap<>(); + + String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" ); + perMap.put("title", welfareTypeName); + comMap.put("title", welfareTypeName); + + perMap.put("insuranceId", k); + perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k))); + perMap.put("paymentScope", "个人"); + + comMap.put("insuranceId", k); + comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k))); + comMap.put("paymentScope", "公司"); + + resultList.add(perMap); + resultList.add(comMap); + }); + + } + if (otherSchemePO != null && StringUtils.isNotBlank(otherSchemePO.getOtherPaymentBaseString())) { + Map otherMap = JSON.parseObject(otherSchemePO.getOtherPaymentBaseString(), new HashMap().getClass()); + otherMap.forEach((k, v) -> { + Map perMap = new HashMap<>(); + Map comMap = new HashMap<>(); + + String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" ); + perMap.put("title", welfareTypeName); + comMap.put("title", welfareTypeName); + + perMap.put("insuranceId", k); + perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k))); + perMap.put("paymentScope", "个人"); + + comMap.put("insuranceId", k); + comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k))); + comMap.put("paymentScope", "公司"); + + resultList.add(perMap); + resultList.add(comMap); + }); + } + return resultList; + } + if (projects.contains(ProjectTypeEnum.SOCIAL.getValue())) { + if (socialSchemePO != null && StringUtils.isNotBlank(socialSchemePO.getSocialPaymentBaseString())) { + Map socialMap = JSON.parseObject(socialSchemePO.getSocialPaymentBaseString(), new HashMap().getClass()); + + socialMap.forEach((k, v) -> { + Map perMap = new HashMap<>(); + Map comMap = new HashMap<>(); + + String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" ); + perMap.put("title", welfareTypeName); + comMap.put("title", welfareTypeName); + + perMap.put("insuranceId", k); + perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k))); + perMap.put("paymentScope", "个人"); + + comMap.put("insuranceId", k); + comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k))); + comMap.put("paymentScope", "公司"); + + resultList.add(perMap); + resultList.add(comMap); + }); + + } + } + if ((!projects.contains(ProjectTypeEnum.SOCIAL.getValue())) + && (projects.contains(ProjectTypeEnum.ENDOWMENT_INSURANCE.getValue())) + && (projects.contains(ProjectTypeEnum.MEDICAL_INSURANCE.getValue()))) { + if (socialSchemePO != null && StringUtils.isNotBlank(socialSchemePO.getSocialPaymentBaseString())) { + Map socialMap = JSON.parseObject(socialSchemePO.getSocialPaymentBaseString(), new HashMap().getClass()); + socialMap = socialMap.entrySet().stream().filter(e -> "9001".equals(e.getKey()) || "9002".equals(e.getKey())) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + socialMap.forEach((k, v) -> { + Map perMap = new HashMap<>(); + Map comMap = new HashMap<>(); + + String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" ); + perMap.put("title", welfareTypeName); + comMap.put("title", welfareTypeName); + + perMap.put("insuranceId", k); + perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k))); + perMap.put("paymentScope", "个人"); + + comMap.put("insuranceId", k); + comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k))); + comMap.put("paymentScope", "公司"); + + resultList.add(perMap); + resultList.add(comMap); + }); + + } + } + if ((!projects.contains(ProjectTypeEnum.SOCIAL.getValue())) + && (projects.contains(ProjectTypeEnum.ENDOWMENT_INSURANCE.getValue())) + && (!projects.contains(ProjectTypeEnum.MEDICAL_INSURANCE.getValue()))) { + if (socialSchemePO != null && StringUtils.isNotBlank(socialSchemePO.getSocialPaymentBaseString())) { + Map socialMap = JSON.parseObject(socialSchemePO.getSocialPaymentBaseString(), new HashMap().getClass()); + socialMap = socialMap.entrySet().stream().filter(e -> "9001".equals(e.getKey())) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + + socialMap.forEach((k, v) -> { + Map perMap = new HashMap<>(); + Map comMap = new HashMap<>(); + + String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" ); + perMap.put("title", welfareTypeName); + comMap.put("title", welfareTypeName); + + perMap.put("insuranceId", k); + perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k))); + perMap.put("paymentScope", "个人"); + + comMap.put("insuranceId", k); + comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k))); + comMap.put("paymentScope", "公司"); + + resultList.add(perMap); + resultList.add(comMap); + }); + + } + } + if ((!projects.contains(ProjectTypeEnum.SOCIAL.getValue())) + && (!projects.contains(ProjectTypeEnum.ENDOWMENT_INSURANCE.getValue())) + && (projects.contains(ProjectTypeEnum.MEDICAL_INSURANCE.getValue()))) { + if (socialSchemePO != null && StringUtils.isNotBlank(socialSchemePO.getSocialPaymentBaseString())) { + Map socialMap = JSON.parseObject(socialSchemePO.getSocialPaymentBaseString(), new HashMap().getClass()); + socialMap = socialMap.entrySet().stream().filter(e -> "9002".equals(e.getKey())) + .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); + socialMap.forEach((k, v) -> { + Map perMap = new HashMap<>(); + Map comMap = new HashMap<>(); + + String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" ); + perMap.put("title", welfareTypeName); + comMap.put("title", welfareTypeName); + + perMap.put("insuranceId", k); + perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k))); + perMap.put("paymentScope", "个人"); + + comMap.put("insuranceId", k); + comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k))); + comMap.put("paymentScope", "公司"); + + resultList.add(perMap); + resultList.add(comMap); + }); + + } + } + if (projects.contains(ProjectTypeEnum.FUND.getValue())) { + if (fundSchemePO != null && StringUtils.isNotBlank(fundSchemePO.getFundPaymentBaseString())) { + Map fundMap = JSON.parseObject(fundSchemePO.getFundPaymentBaseString(), new HashMap().getClass()); + + fundMap.forEach((k, v) -> { + Map perMap = new HashMap<>(); + Map comMap = new HashMap<>(); + + String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" ); + perMap.put("title", welfareTypeName); + comMap.put("title", welfareTypeName); + + perMap.put("insuranceId", k); + perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k))); + perMap.put("paymentScope", "个人"); + + comMap.put("insuranceId", k); + comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k))); + comMap.put("paymentScope", "公司"); + + resultList.add(perMap); + resultList.add(comMap); + }); + + } + } + if (projects.contains(ProjectTypeEnum.OTHER.getValue())) { + if (otherSchemePO != null && StringUtils.isNotBlank(otherSchemePO.getOtherPaymentBaseString())) { + Map otherMap = JSON.parseObject(otherSchemePO.getOtherPaymentBaseString(), new HashMap().getClass()); + + otherMap.forEach((k, v) -> { + Map perMap = new HashMap<>(); + Map comMap = new HashMap<>(); + + String welfareTypeName = welfareTypeMap.get(Long.valueOf(k)) == 1 ? "社保" : (welfareTypeMap.get(Long.valueOf(k)) == 2 ? "公积金" : "企业年金及其它福利" ); + perMap.put("title", welfareTypeName); + comMap.put("title", welfareTypeName); + + perMap.put("insuranceId", k); + perMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k))); + perMap.put("paymentScope", "个人"); + + comMap.put("insuranceId", k); + comMap.put("insuranceName", categoryNameMap.get(Long.valueOf(k))); + comMap.put("paymentScope", "公司"); + + resultList.add(perMap); + resultList.add(comMap); + }); + + } + } + + return resultList; + } + + +} diff --git a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java index e04d45b20..713185ddf 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctRecordServiceImpl.java @@ -654,11 +654,14 @@ public class SalaryAcctRecordServiceImpl extends Service implements SalaryAcctRe List needUpdateSalaryAcctRecordIds = selfSalaryAcctRecordPOS.stream().filter(po -> po.getTaxCycle().equals(salaryAcctRecordPO.getTaxCycle())) .map(SalaryAcctRecordPO::getId).collect(Collectors.toList()); if (Objects.equals(salaryAcctRecordPO.getStatus(), SalaryAcctRecordStatusEnum.DECLARED.getValue())) { - // 更新薪资核算记录的状态 - updateStatusByIds(needUpdateSalaryAcctRecordIds, SalaryAcctRecordStatusEnum.ARCHIVED); + if(needUpdateSalaryAcctRecordIds != null && needUpdateSalaryAcctRecordIds.size()>0){ + // 更新薪资核算记录的状态 + updateStatusByIds(needUpdateSalaryAcctRecordIds, SalaryAcctRecordStatusEnum.ARCHIVED); + } + // 删除个税申报表及往期累计情况 + getTaxDeclarationService(user).delete(salaryAcctRecordPO); } - // 删除个税申报表及往期累计情况 - getTaxDeclarationService(user).delete(salaryAcctRecordPO); + // 更新薪资核算记录的状态 salaryAcctRecordPO.setStatus(SalaryAcctRecordStatusEnum.NOT_ARCHIVED.getValue()); salaryAcctRecordPO.setUpdateTime(new Date()); diff --git a/src/com/engine/salary/web/SIAccountController.java b/src/com/engine/salary/web/SIAccountController.java index c7e37490c..2710ac14e 100644 --- a/src/com/engine/salary/web/SIAccountController.java +++ b/src/com/engine/salary/web/SIAccountController.java @@ -878,4 +878,28 @@ public class SIAccountController { return new ResponseResult>(user).run(getService(user)::listBalancePage, insuranceAccountDetailParam); } // **********************************补差 end*********************************/ + + /** + * 取指定月份的福利缴纳基数作为补缴基数 + */ + @POST + @Path("/detail/getSupplementPaymentForm") + @Produces(MediaType.APPLICATION_JSON) + public String getSupplementPaymentForm(@Context HttpServletRequest request, @Context HttpServletResponse response, + @RequestBody SupplementAccountBaseParam param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>>(user).run(getSIAccountWrapper(user)::getSupplementPaymentForm, param); + } + + /** + * 获取待编辑的补缴费用相关福利项 + */ + @POST + @Path("/detail/getPaymentGroup") + @Produces(MediaType.APPLICATION_JSON) + public String getPaymentGroup(@Context HttpServletRequest request, @Context HttpServletResponse response, + @RequestBody SupplementAccountBaseParam param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>>(user).run(getSIAccountWrapper(user)::getPaymentGroup, param); + } } diff --git a/src/com/engine/salary/wrapper/SIAccountWrapper.java b/src/com/engine/salary/wrapper/SIAccountWrapper.java index 092398079..a65e420a9 100644 --- a/src/com/engine/salary/wrapper/SIAccountWrapper.java +++ b/src/com/engine/salary/wrapper/SIAccountWrapper.java @@ -9,12 +9,15 @@ import com.engine.salary.entity.siaccount.dto.InsuranceCompensationDTO; import com.engine.salary.entity.siaccount.param.CompensationParam; import com.engine.salary.entity.siaccount.param.InspectAccountParam; import com.engine.salary.entity.siaccount.param.RecessionParam; +import com.engine.salary.entity.siaccount.param.SupplementAccountBaseParam; import com.engine.salary.service.SIBalanceService; import com.engine.salary.service.SICompensationService; import com.engine.salary.service.SIRecessionService; +import com.engine.salary.service.SIRepairService; import com.engine.salary.service.impl.SIBalanceServiceImpl; import com.engine.salary.service.impl.SICompensationServiceImpl; import com.engine.salary.service.impl.SIRecessionServiceImpl; +import com.engine.salary.service.impl.SIRepairServiceImpl; import com.engine.salary.util.page.PageInfo; import weaver.hrm.User; @@ -41,6 +44,10 @@ public class SIAccountWrapper extends Service { return (SIBalanceService) ServiceUtil.getService(SIBalanceServiceImpl.class, user); } + private SIRepairService getSIRepairService(User user) { + return (SIRepairService) ServiceUtil.getService(SIRepairServiceImpl.class, user); + } + /** * 新增退差数据 * @param param 退差请求体 @@ -130,4 +137,22 @@ public class SIAccountWrapper extends Service { long currentEmployeeId = user.getUID(); getSIBalanceService(user).del(param, currentEmployeeId); } + + /** + * 取指定月份的福利缴纳基数作为补缴基数 + * @param param + * @return + */ + public List> getSupplementPaymentForm(SupplementAccountBaseParam param) { + return getSIRepairService(user).getSupplementPaymentForm(param); + } + + /** + * 获取待编辑的补缴费用相关福利项 + * @param param + * @return + */ + public List> getPaymentGroup(SupplementAccountBaseParam param) { + return getSIRepairService(user).getPaymentGroup(param); + } }