From d48f6131e09706798f7b1e342199bc7b889b2e7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 14 Jan 2025 09:15:09 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salary/service/impl/OtherDeductionServiceImpl.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java index 8d838f3ed..09853cdbb 100644 --- a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java @@ -2549,6 +2549,12 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction getFreeIncomeMapper().updateIgnoreNull(po); } + + List freeIncomePOS = getFreeIncomeMapper().listSome(FreeIncomePO.builder().mainId(mainId).build()); + String sum = freeIncomePOS.stream().filter(po -> NumberUtil.isNumber(po.getFreeAmount())).map(po -> new BigDecimal(po.getFreeAmount())).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString(); + deductionPO.setFreeIncome(sum); +// getOtherDeductionMapper().updateData(); + } @Override From 0bb2abc28155e40bc3b619c58b90a43efbbb4fea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 14 Jan 2025 14:56:36 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=9A=82=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../OtherDeductionDetailDeleteParam.java | 2 + .../salary/service/OtherDeductionService.java | 41 +++++++ .../impl/OtherDeductionServiceImpl.java | 112 +++++++++++++++++- 3 files changed, 150 insertions(+), 5 deletions(-) diff --git a/src/com/engine/salary/entity/datacollection/param/OtherDeductionDetailDeleteParam.java b/src/com/engine/salary/entity/datacollection/param/OtherDeductionDetailDeleteParam.java index 447c04b87..c97a0b9a7 100644 --- a/src/com/engine/salary/entity/datacollection/param/OtherDeductionDetailDeleteParam.java +++ b/src/com/engine/salary/entity/datacollection/param/OtherDeductionDetailDeleteParam.java @@ -23,4 +23,6 @@ public class OtherDeductionDetailDeleteParam { // 主键id private List ids; + + private Long mainId; } diff --git a/src/com/engine/salary/service/OtherDeductionService.java b/src/com/engine/salary/service/OtherDeductionService.java index c8e72bb1e..c02d4a948 100644 --- a/src/com/engine/salary/service/OtherDeductionService.java +++ b/src/com/engine/salary/service/OtherDeductionService.java @@ -3,6 +3,7 @@ package com.engine.salary.service; import com.engine.salary.entity.datacollection.dto.*; import com.engine.salary.entity.datacollection.param.*; import com.engine.salary.entity.datacollection.po.*; +import com.engine.salary.enums.datacollection.TaxFreeTypeEnum; import com.engine.salary.util.page.PageInfo; import org.apache.poi.xssf.usermodel.XSSFWorkbook; @@ -125,35 +126,75 @@ public interface OtherDeductionService { String extendToLastMonth(OtherDeductionExtendLastParam param); PageInfo freeIncomeList(OtherDeductionDetailQueryParam param); + PageInfo derateDeductionList(OtherDeductionDetailQueryParam param); + PageInfo endowmentInsuranceList(OtherDeductionDetailQueryParam param); + PageInfo grantDonationList(OtherDeductionDetailQueryParam param); + PageInfo healthInsuranceList(OtherDeductionDetailQueryParam param); + PageInfo otherDerateDeductionList(OtherDeductionDetailQueryParam param); + PageInfo personalPensionList(OtherDeductionDetailQueryParam param); List queryFreeIncomes(OtherDeductionFreeListQueryParam param); + List queryDerateDeductions(OtherDeductionFreeListQueryParam param); + List queryEndowmentInsurances(OtherDeductionFreeListQueryParam param); + List queryGrantDonations(OtherDeductionFreeListQueryParam param); + List queryHealthInsurances(OtherDeductionFreeListQueryParam param); + List queryOtherDerateDeductions(OtherDeductionFreeListQueryParam param); + List queryPersonalPensions(OtherDeductionFreeListQueryParam param); void saveFreeIncome(FreeIncomeSaveParam param); + void saveEndowmentInsurance(EndowmentInsuranceSaveParam param); + void saveGrantDonation(GrantDonationSaveParam param); + void saveHealthInsurance(HealthInsuranceSaveParam param); + void saveOtherDerateDeduction(OtherDerateDeductionSaveParam param); + void saveDerateDeduction(DerateDeductionSaveParam param); + void savePersonalPension(PersonalPensionSaveParam param); void deleteFreeIncome(OtherDeductionDetailDeleteParam param); + void deleteEndowmentInsurance(OtherDeductionDetailDeleteParam param); + void deleteGrantDonation(OtherDeductionDetailDeleteParam param); + void deleteHealthInsurance(OtherDeductionDetailDeleteParam param); + void deleteOtherDerateDeduction(OtherDeductionDetailDeleteParam param); + void deleteDerateDeduction(OtherDeductionDetailDeleteParam param); + void deletePersonalPension(OtherDeductionDetailDeleteParam param); + void syncMain(Long mainId, List taxFreeTypes); + + void syncFreeIncome(OtherDeductionPO mainPO); + + void syncEndowmentInsurance(OtherDeductionPO mainPO); + + void syncGrantDonation(OtherDeductionPO mainPO); + + void syncHealthInsurance(OtherDeductionPO mainPO); + + void syncOtherDerateDeduction(OtherDeductionPO mainPO); + + void syncDerateDeduction(OtherDeductionPO mainPO); + + void syncPersonalPension(OtherDeductionPO mainPO); + } diff --git a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java index 09853cdbb..387d4ffd9 100644 --- a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java @@ -21,6 +21,7 @@ import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.OperateTypeEnum; import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.enums.datacollection.DataCollectionEmployeeTypeEnum; +import com.engine.salary.enums.datacollection.TaxFreeTypeEnum; import com.engine.salary.enums.sicategory.DeleteTypeEnum; import com.engine.salary.exception.SalaryRunTimeException; import com.engine.salary.mapper.datacollection.*; @@ -2550,11 +2551,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction getFreeIncomeMapper().updateIgnoreNull(po); } - List freeIncomePOS = getFreeIncomeMapper().listSome(FreeIncomePO.builder().mainId(mainId).build()); - String sum = freeIncomePOS.stream().filter(po -> NumberUtil.isNumber(po.getFreeAmount())).map(po -> new BigDecimal(po.getFreeAmount())).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString(); - deductionPO.setFreeIncome(sum); -// getOtherDeductionMapper().updateData(); - + syncMain(mainId, Collections.singletonList(TaxFreeTypeEnum.FREE_INCOME)); } @Override @@ -2606,6 +2603,8 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction getEndowmentInsuranceMapper().updateIgnoreNull(po); } + + syncMain(mainId, Collections.singletonList(TaxFreeTypeEnum.ENDOWMENT_INSURANCE)); } @Override @@ -2659,6 +2658,8 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction getGrantDonationMapper().updateIgnoreNull(po); } + + syncMain(mainId, Collections.singletonList(TaxFreeTypeEnum.GRANT_DONATION)); } @Override @@ -2708,6 +2709,8 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction getHealthInsuranceMapper().updateIgnoreNull(po); } + + syncMain(mainId, Collections.singletonList(TaxFreeTypeEnum.HEALTH_INSURANCE)); } @Override @@ -2751,6 +2754,8 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction getOtherDerateDeductionMapper().updateIgnoreNull(po); } + + syncMain(mainId, Collections.singletonList(TaxFreeTypeEnum.OTHER_DERATE_DEDUCTION)); } @Override @@ -2796,6 +2801,8 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction getDerateDeductionMapper().updateIgnoreNull(po); } + + syncMain(mainId, Collections.singletonList(TaxFreeTypeEnum.DERATE_DEDUCTION)); } @Override @@ -2841,41 +2848,136 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction getPersonalPensionMapper().updateIgnoreNull(po); } + + syncMain(mainId, Collections.singletonList(TaxFreeTypeEnum.PERSONAL_PENSION)); } @Override public void deleteFreeIncome(OtherDeductionDetailDeleteParam param) { getFreeIncomeMapper().deleteByIds(param.getIds()); + syncMain(param.getMainId(), Collections.singletonList(TaxFreeTypeEnum.FREE_INCOME)); } @Override public void deleteEndowmentInsurance(OtherDeductionDetailDeleteParam param) { getEndowmentInsuranceMapper().deleteByIds(param.getIds()); + syncMain(param.getMainId(), Collections.singletonList(TaxFreeTypeEnum.ENDOWMENT_INSURANCE)); } @Override public void deleteGrantDonation(OtherDeductionDetailDeleteParam param) { getGrantDonationMapper().deleteByIds(param.getIds()); + syncMain(param.getMainId(), Collections.singletonList(TaxFreeTypeEnum.GRANT_DONATION)); } @Override public void deleteHealthInsurance(OtherDeductionDetailDeleteParam param) { getHealthInsuranceMapper().deleteByIds(param.getIds()); + syncMain(param.getMainId(), Collections.singletonList(TaxFreeTypeEnum.HEALTH_INSURANCE)); } @Override public void deleteOtherDerateDeduction(OtherDeductionDetailDeleteParam param) { getOtherDerateDeductionMapper().deleteByIds(param.getIds()); + syncMain(param.getMainId(), Collections.singletonList(TaxFreeTypeEnum.OTHER_DERATE_DEDUCTION)); } @Override public void deleteDerateDeduction(OtherDeductionDetailDeleteParam param) { getDerateDeductionMapper().deleteByIds(param.getIds()); + syncMain(param.getMainId(), Collections.singletonList(TaxFreeTypeEnum.DERATE_DEDUCTION)); } @Override public void deletePersonalPension(OtherDeductionDetailDeleteParam param) { getPersonalPensionMapper().deleteByIds(param.getIds()); + syncMain(param.getMainId(), Collections.singletonList(TaxFreeTypeEnum.PERSONAL_PENSION)); + } + + @Override + public void syncMain(Long mainId,List taxFreeTypes) { + OtherDeductionPO deductionPO = getById(mainId); + if (deductionPO == null) { + throw new SalaryRunTimeException("主表不存在!"); + } + + if(taxFreeTypes.contains(TaxFreeTypeEnum.FREE_INCOME)){ + syncFreeIncome(deductionPO); + } + if(taxFreeTypes.contains(TaxFreeTypeEnum.HEALTH_INSURANCE)){ + syncEndowmentInsurance(deductionPO); + } + if(taxFreeTypes.contains(TaxFreeTypeEnum.ENDOWMENT_INSURANCE)){ + syncGrantDonation(deductionPO); + } + if(taxFreeTypes.contains(TaxFreeTypeEnum.GRANT_DONATION)){ + syncHealthInsurance(deductionPO); + } + if(taxFreeTypes.contains(TaxFreeTypeEnum.DERATE_DEDUCTION)){ + syncDerateDeduction(deductionPO); + } + if(taxFreeTypes.contains(TaxFreeTypeEnum.OTHER_DERATE_DEDUCTION)){ + syncOtherDerateDeduction(deductionPO); + } + if(taxFreeTypes.contains(TaxFreeTypeEnum.PERSONAL_PENSION)){ + syncPersonalPension(deductionPO); + } + } + + @Override + public void syncFreeIncome(OtherDeductionPO mainPO) { + List freeIncomePOS = getFreeIncomeMapper().listSome(FreeIncomePO.builder().mainId(mainPO.getId()).build()); + String sum = freeIncomePOS.stream().filter(po -> NumberUtil.isNumber(po.getFreeAmount())).map(po -> new BigDecimal(po.getFreeAmount())).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString(); + mainPO.setFreeIncome(sum); + getOtherDeductionMapper().updateData(Collections.singletonList(mainPO)); + } + + @Override + public void syncEndowmentInsurance(OtherDeductionPO mainPO) { + List endowmentInsurancePOS = getEndowmentInsuranceMapper().listSome(EndowmentInsurancePO.builder().mainId(mainPO.getId()).build()); + String sum = endowmentInsurancePOS.stream().filter(po -> NumberUtil.isNumber(po.getCurrentDeduction())).map(po -> new BigDecimal(po.getCurrentDeduction())).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString(); + mainPO.setTaxDelayEndowmentInsurance(sum); + getOtherDeductionMapper().updateData(Collections.singletonList(mainPO)); + } + + @Override + public void syncGrantDonation(OtherDeductionPO mainPO) { + List grantDonationPOS = getGrantDonationMapper().listSome(GrantDonationPO.builder().mainId(mainPO.getId()).build()); + String sum = grantDonationPOS.stream().filter(po -> NumberUtil.isNumber(po.getActualDeduction())).map(po -> new BigDecimal(po.getActualDeduction())).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString(); + mainPO.setDeductionAllowedDonation(sum); + getOtherDeductionMapper().updateData(Collections.singletonList(mainPO)); + } + + @Override + public void syncHealthInsurance(OtherDeductionPO mainPO) { + List healthInsurancePOS = getHealthInsuranceMapper().listSome(HealthInsurancePO.builder().mainId(mainPO.getId()).build()); + String sum = healthInsurancePOS.stream().filter(po -> NumberUtil.isNumber(po.getCurrentDeduction())).map(po -> new BigDecimal(po.getCurrentDeduction())).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString(); + mainPO.setBusinessHealthyInsurance(sum); + getOtherDeductionMapper().updateData(Collections.singletonList(mainPO)); + } + + @Override + public void syncOtherDerateDeduction(OtherDeductionPO mainPO) { + List otherDerateDeductionPOS = getOtherDerateDeductionMapper().listSome(OtherDerateDeductionPO.builder().mainId(mainPO.getId()).build()); + String sum = otherDerateDeductionPOS.stream().filter(po -> NumberUtil.isNumber(po.getOtherDeduction())).map(po -> new BigDecimal(po.getOtherDeduction())).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString(); + mainPO.setOtherDeduction(sum); + getOtherDeductionMapper().updateData(Collections.singletonList(mainPO)); + } + + @Override + public void syncDerateDeduction(OtherDeductionPO mainPO) { + List derateDeductionPOS = getDerateDeductionMapper().listSome(DerateDeductionPO.builder().mainId(mainPO.getId()).build()); + String sum = derateDeductionPOS.stream().filter(po -> NumberUtil.isNumber(po.getDerateAmount())).map(po -> new BigDecimal(po.getDerateAmount())).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString(); + mainPO.setDerateDeduction(sum); + getOtherDeductionMapper().updateData(Collections.singletonList(mainPO)); + } + + @Override + public void syncPersonalPension(OtherDeductionPO mainPO) { + List personalPensionPOS = getPersonalPensionMapper().listSome(PersonalPensionPO.builder().mainId(mainPO.getId()).build()); + String sum = personalPensionPOS.stream().filter(po -> NumberUtil.isNumber(po.getPayAmount())).map(po -> new BigDecimal(po.getPayAmount())).reduce(BigDecimal.ZERO, BigDecimal::add).toPlainString(); + mainPO.setPrivatePension(sum); + getOtherDeductionMapper().updateData(Collections.singletonList(mainPO)); } } From aea27897b76b5da0deaca0fc9303ce10355cfc36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 14 Jan 2025 17:05:31 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=B8=BB=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/OtherDeductionServiceImpl.java | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java index 387d4ffd9..c27802d5f 100644 --- a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java @@ -1560,6 +1560,14 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction l.setMainId(po.getId()); getPersonalPensionMapper().insertIgnoreNull(l); }); + + syncMain(po.getId(), Arrays.asList(TaxFreeTypeEnum.FREE_INCOME, + TaxFreeTypeEnum.HEALTH_INSURANCE, + TaxFreeTypeEnum.ENDOWMENT_INSURANCE, + TaxFreeTypeEnum.GRANT_DONATION, + TaxFreeTypeEnum.DERATE_DEDUCTION, + TaxFreeTypeEnum.OTHER_DERATE_DEDUCTION, + TaxFreeTypeEnum.PERSONAL_PENSION)); }); return apidatas; @@ -2895,31 +2903,31 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction } @Override - public void syncMain(Long mainId,List taxFreeTypes) { + public void syncMain(Long mainId, List taxFreeTypes) { OtherDeductionPO deductionPO = getById(mainId); if (deductionPO == null) { throw new SalaryRunTimeException("主表不存在!"); } - if(taxFreeTypes.contains(TaxFreeTypeEnum.FREE_INCOME)){ + if (taxFreeTypes.contains(TaxFreeTypeEnum.FREE_INCOME)) { syncFreeIncome(deductionPO); } - if(taxFreeTypes.contains(TaxFreeTypeEnum.HEALTH_INSURANCE)){ + if (taxFreeTypes.contains(TaxFreeTypeEnum.HEALTH_INSURANCE)) { syncEndowmentInsurance(deductionPO); } - if(taxFreeTypes.contains(TaxFreeTypeEnum.ENDOWMENT_INSURANCE)){ + if (taxFreeTypes.contains(TaxFreeTypeEnum.ENDOWMENT_INSURANCE)) { syncGrantDonation(deductionPO); } - if(taxFreeTypes.contains(TaxFreeTypeEnum.GRANT_DONATION)){ + if (taxFreeTypes.contains(TaxFreeTypeEnum.GRANT_DONATION)) { syncHealthInsurance(deductionPO); } - if(taxFreeTypes.contains(TaxFreeTypeEnum.DERATE_DEDUCTION)){ + if (taxFreeTypes.contains(TaxFreeTypeEnum.DERATE_DEDUCTION)) { syncDerateDeduction(deductionPO); } - if(taxFreeTypes.contains(TaxFreeTypeEnum.OTHER_DERATE_DEDUCTION)){ + if (taxFreeTypes.contains(TaxFreeTypeEnum.OTHER_DERATE_DEDUCTION)) { syncOtherDerateDeduction(deductionPO); } - if(taxFreeTypes.contains(TaxFreeTypeEnum.PERSONAL_PENSION)){ + if (taxFreeTypes.contains(TaxFreeTypeEnum.PERSONAL_PENSION)) { syncPersonalPension(deductionPO); } } From 7a58e92fc7372ec86f3523a09f22ad8373ade176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Wed, 15 Jan 2025 16:11:34 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=90=8C=E6=AD=A5=E4=B8=BB=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/OtherDeductionServiceImpl.java | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java index c27802d5f..a5a76dd77 100644 --- a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java @@ -2232,9 +2232,51 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction public XSSFWorkbook downloadDetailTemplate(OtherDeductionQueryParam param) { + List freeIncomeList= new ArrayList<>(); + List endowmentInsurancePOS =new ArrayList<>(); + List grantDonationPOS =new ArrayList<>(); + List healthInsurancePOS =new ArrayList<>(); + List otherDerateDeductionPOS =new ArrayList<>(); + List derateDeductionPOS =new ArrayList<>(); + List personalPensionPOS =new ArrayList<>(); + if (param.isHasData()) { + long employeeId = user.getUID(); + //排序配置 + OrderRuleVO orderRule = getSalarySysConfService(user).orderRule(); + param.setOrderRule(orderRule); + + List list = getOtherDeductionMapper().list(param); + encryptUtil.decryptList(list, OtherDeductionListDTO.class); + SalaryI18nUtil.i18nList(list); + // 开启分权并且不是薪酬模块总管理员 + if (getTaxAgentService(user).isOpenDevolution() && !getTaxAgentService(user).isChief(employeeId)) { + List taxAgentIdsAsAdmin = getTaxAgentService(user).listAllTaxAgentsAsAdmin(employeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList()); + list = list.stream().filter(f -> + // 作为管理员 + taxAgentIdsAsAdmin.contains(f.getTaxAgentId()) + ).collect(Collectors.toList()); + } + list.forEach(dto -> { + freeIncomeList.addAll(getFreeIncomeMapper().listSome(FreeIncomePO.builder().mainId(dto.getId()).build())); + endowmentInsurancePOS.addAll(getEndowmentInsuranceMapper().listSome(EndowmentInsurancePO.builder().mainId(dto.getId()).build())); + grantDonationPOS.addAll( getGrantDonationMapper().listSome(GrantDonationPO.builder().mainId(dto.getId()).build())); + healthInsurancePOS.addAll( getHealthInsuranceMapper().listSome(HealthInsurancePO.builder().mainId(dto.getId()).build())); + otherDerateDeductionPOS.addAll(getOtherDerateDeductionMapper().listSome(OtherDerateDeductionPO.builder().mainId(dto.getId()).build())); + derateDeductionPOS.addAll(getDerateDeductionMapper().listSome(DerateDeductionPO.builder().mainId(dto.getId()).build())); + personalPensionPOS.addAll(getPersonalPensionMapper().listSome(PersonalPensionPO.builder().mainId(dto.getId()).build())); + }); + } + + + Map>> map = new LinkedHashMap<>(); List freeIncomeTitle = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "免税事项", "免税性质", "免税金额"); + List> freeIncomeRowList = new ArrayList<>(); + freeIncomeList.forEach(po->{ + List row = new ArrayList<>(); + row.add(Util.null2String(po.get())); + }); map.put("免税收入", Arrays.asList(freeIncomeTitle)); List healthInsuranceTitle = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "税优识别码", "保单生效日期", "年度保费", "月度保费", "本期扣除金额"); map.put("商业健康保险", Arrays.asList(healthInsuranceTitle)); @@ -2249,7 +2291,6 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction List personalPensionTitle = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "凭证类型", "凭证编码", "缴费金额"); map.put("个人养老金", Arrays.asList(personalPensionTitle)); - XSSFWorkbook book = ExcelUtil.genWorkbookV2(map); return book; } From f2cbbbe18a9f523f3207eada1cae69b0a2252597 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Thu, 16 Jan 2025 13:41:17 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E9=99=84=E8=A1=A8?= =?UTF-8?q?=E6=98=8E=E7=BB=86=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/OtherDeductionServiceImpl.java | 236 +++++++++++++++--- 1 file changed, 199 insertions(+), 37 deletions(-) diff --git a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java index a5a76dd77..d6fcf058e 100644 --- a/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java +++ b/src/com/engine/salary/service/impl/OtherDeductionServiceImpl.java @@ -54,6 +54,7 @@ import org.apache.commons.lang3.Validate; import org.apache.poi.ss.usermodel.Sheet; import org.apache.poi.util.IOUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; +import org.jetbrains.annotations.NotNull; import org.springframework.beans.BeanUtils; import weaver.file.ImageFileManager; import weaver.general.Util; @@ -2232,15 +2233,15 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction public XSSFWorkbook downloadDetailTemplate(OtherDeductionQueryParam param) { - List freeIncomeList= new ArrayList<>(); - List endowmentInsurancePOS =new ArrayList<>(); - List grantDonationPOS =new ArrayList<>(); - List healthInsurancePOS =new ArrayList<>(); - List otherDerateDeductionPOS =new ArrayList<>(); - List derateDeductionPOS =new ArrayList<>(); - List personalPensionPOS =new ArrayList<>(); + List freeIncomeList = new ArrayList<>(); + List healthInsuranceList = new ArrayList<>(); + List endowmentInsuranceList = new ArrayList<>(); + List grantDonationList = new ArrayList<>(); + List derateDeductionList = new ArrayList<>(); + List otherDerateDeductionList = new ArrayList<>(); + List personalPensionList = new ArrayList<>(); if (param.isHasData()) { - long employeeId = user.getUID(); + long employeeId = user.getUID(); //排序配置 OrderRuleVO orderRule = getSalarySysConfService(user).orderRule(); param.setOrderRule(orderRule); @@ -2257,39 +2258,158 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction ).collect(Collectors.toList()); } list.forEach(dto -> { - freeIncomeList.addAll(getFreeIncomeMapper().listSome(FreeIncomePO.builder().mainId(dto.getId()).build())); - endowmentInsurancePOS.addAll(getEndowmentInsuranceMapper().listSome(EndowmentInsurancePO.builder().mainId(dto.getId()).build())); - grantDonationPOS.addAll( getGrantDonationMapper().listSome(GrantDonationPO.builder().mainId(dto.getId()).build())); - healthInsurancePOS.addAll( getHealthInsuranceMapper().listSome(HealthInsurancePO.builder().mainId(dto.getId()).build())); - otherDerateDeductionPOS.addAll(getOtherDerateDeductionMapper().listSome(OtherDerateDeductionPO.builder().mainId(dto.getId()).build())); - derateDeductionPOS.addAll(getDerateDeductionMapper().listSome(DerateDeductionPO.builder().mainId(dto.getId()).build())); - personalPensionPOS.addAll(getPersonalPensionMapper().listSome(PersonalPensionPO.builder().mainId(dto.getId()).build())); + List freeIncomeListDTOS = freeIncomePO2DTO(getFreeIncomeMapper().listSome(FreeIncomePO.builder().mainId(dto.getId()).build())); + freeIncomeList.addAll(freeIncomeListDTOS); + List endowmentInsuranceListDTOS = endowmentInsurancePO2DTO(getEndowmentInsuranceMapper().listSome(EndowmentInsurancePO.builder().mainId(dto.getId()).build())); + endowmentInsuranceList.addAll(endowmentInsuranceListDTOS); + List grantDonationListDTOS = grantDonationPO2DTO(getGrantDonationMapper().listSome(GrantDonationPO.builder().mainId(dto.getId()).build())); + grantDonationList.addAll(grantDonationListDTOS); + List healthInsuranceListDTOS = healthInsurancePO2DTO(getHealthInsuranceMapper().listSome(HealthInsurancePO.builder().mainId(dto.getId()).build())); + healthInsuranceList.addAll(healthInsuranceListDTOS); + List otherDerateDeductionListDTOS = otherDerateDeductionPO2DTO(getOtherDerateDeductionMapper().listSome(OtherDerateDeductionPO.builder().mainId(dto.getId()).build())); + otherDerateDeductionList.addAll(otherDerateDeductionListDTOS); + List derateDeductionListDTOS = derateDeductionPO2DTO(getDerateDeductionMapper().listSome(DerateDeductionPO.builder().mainId(dto.getId()).build())); + derateDeductionList.addAll(derateDeductionListDTOS); + List personalPensionListDTOS = personalPensionPO2DTO(getPersonalPensionMapper().listSome(PersonalPensionPO.builder().mainId(dto.getId()).build())); + personalPensionList.addAll(personalPensionListDTOS); }); } - - Map>> map = new LinkedHashMap<>(); - List freeIncomeTitle = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "免税事项", "免税性质", "免税金额"); List> freeIncomeRowList = new ArrayList<>(); - freeIncomeList.forEach(po->{ + List freeIncomeTitle = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "免税事项", "免税性质", "免税金额"); + freeIncomeRowList.add(freeIncomeTitle); + freeIncomeList.forEach(dto -> { List row = new ArrayList<>(); - row.add(Util.null2String(po.get())); + row.add(dto.getUsername()); + row.add(dto.getTaxAgentName()); + row.add(dto.getDepartmentName()); + row.add(dto.getMobile()); + row.add(dto.getJobNum()); + row.add(dto.getIdNo()); + row.add(dto.getFreeItem()); + row.add(dto.getFreeProperty()); + row.add(dto.getFreeAmount()); + freeIncomeRowList.add(row); }); - map.put("免税收入", Arrays.asList(freeIncomeTitle)); + map.put("免税收入", freeIncomeRowList); + + List> healthInsuranceRowList = new ArrayList<>(); List healthInsuranceTitle = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "税优识别码", "保单生效日期", "年度保费", "月度保费", "本期扣除金额"); - map.put("商业健康保险", Arrays.asList(healthInsuranceTitle)); + healthInsuranceRowList.add(healthInsuranceTitle); + healthInsuranceList.forEach(dto -> { + List row = new ArrayList<>(); + row.add(dto.getUsername()); + row.add(dto.getTaxAgentName()); + row.add(dto.getDepartmentName()); + row.add(dto.getMobile()); + row.add(dto.getJobNum()); + row.add(dto.getIdNo()); + row.add(dto.getIdentificationNumber()); + row.add(dto.getEffectiveDate()); + row.add(dto.getYearPremium()); + row.add(dto.getMonthPremium()); + row.add(dto.getCurrentDeduction()); + healthInsuranceRowList.add(row); + }); + map.put("商业健康保险", healthInsuranceRowList); + + + List> endowmentInsuranceRowList = new ArrayList<>(); List endowmentInsuranceTitle = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "税延养老账户编号", "报税校验码", "年度保费", "月度保费", "本期扣除金额"); - map.put("税延养老保险", Arrays.asList(endowmentInsuranceTitle)); + endowmentInsuranceRowList.add(endowmentInsuranceTitle); + endowmentInsuranceList.forEach(dto -> { + List row = new ArrayList<>(); + row.add(dto.getUsername()); + row.add(dto.getTaxAgentName()); + row.add(dto.getDepartmentName()); + row.add(dto.getMobile()); + row.add(dto.getJobNum()); + row.add(dto.getIdNo()); + row.add(dto.getAccountNumber()); + row.add(dto.getCheckCode()); + row.add(dto.getYearPremium()); + row.add(dto.getMonthPremium()); + row.add(dto.getCurrentDeduction()); + endowmentInsuranceRowList.add(row); + }); + map.put("税延养老保险", endowmentInsuranceRowList); + + List> grantDonationRowList = new ArrayList<>(); List grantDonationTitle = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "受赠单位名称", "受赠单位纳税人识别号", "凭证号", "捐赠日期", "捐赠金额", "扣除比例", "实际扣除金额"); - map.put("准予扣除的捐赠额", Arrays.asList(grantDonationTitle)); + grantDonationRowList.add(grantDonationTitle); + grantDonationList.forEach(dto -> { + List row = new ArrayList<>(); + row.add(dto.getUsername()); + row.add(dto.getTaxAgentName()); + row.add(dto.getDepartmentName()); + row.add(dto.getMobile()); + row.add(dto.getJobNum()); + row.add(dto.getIdNo()); + row.add(dto.getRecipientName()); + row.add(dto.getTaxCode()); + row.add(dto.getDonationNumber()); + row.add(dto.getDonateDate()); + row.add(dto.getDonateAmount()); + row.add(dto.getDeductionProportion()); + row.add(dto.getActualDeduction()); + grantDonationRowList.add(row); + }); + map.put("准予扣除的捐赠额", grantDonationRowList); + + List> derateDeductionRowList = new ArrayList<>(); List derateDeductionTitle = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "减免事项", "减免性质", "减免金额"); - map.put("减免税额", Arrays.asList(derateDeductionTitle)); + derateDeductionRowList.add(derateDeductionTitle); + derateDeductionList.forEach(dto -> { + List row = new ArrayList<>(); + row.add(dto.getUsername()); + row.add(dto.getTaxAgentName()); + row.add(dto.getDepartmentName()); + row.add(dto.getMobile()); + row.add(dto.getJobNum()); + row.add(dto.getIdNo()); + row.add(dto.getDerateItem()); + row.add(dto.getDerateProperty()); + row.add(dto.getDerateAmount()); + derateDeductionRowList.add(row); + }); + map.put("减免税额", derateDeductionRowList); + + List> otherDerateDeductionRowList = new ArrayList<>(); List otherDerateDeductionTitle = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "其他免税扣除金额", "备注"); - map.put("其他", Arrays.asList(otherDerateDeductionTitle)); + otherDerateDeductionRowList.add(otherDerateDeductionTitle); + otherDerateDeductionList.forEach(dto -> { + List row = new ArrayList<>(); + row.add(dto.getUsername()); + row.add(dto.getTaxAgentName()); + row.add(dto.getDepartmentName()); + row.add(dto.getMobile()); + row.add(dto.getJobNum()); + row.add(dto.getIdNo()); + row.add(dto.getOtherDeduction()); + row.add(dto.getRemark()); + otherDerateDeductionRowList.add(row); + }); + map.put("其他", otherDerateDeductionRowList); + + List> personalPensionRowList = new ArrayList<>(); List personalPensionTitle = Arrays.asList("姓名", "个税扣缴义务人", "部门", "手机号", "工号", "证件号码", "凭证类型", "凭证编码", "缴费金额"); - map.put("个人养老金", Arrays.asList(personalPensionTitle)); + personalPensionRowList.add(personalPensionTitle); + personalPensionList.forEach(dto -> { + List row = new ArrayList<>(); + row.add(dto.getUsername()); + row.add(dto.getTaxAgentName()); + row.add(dto.getDepartmentName()); + row.add(dto.getMobile()); + row.add(dto.getJobNum()); + row.add(dto.getIdNo()); + row.add(dto.getVoucherTypeName()); + row.add(dto.getVoucherNo()); + row.add(dto.getPayAmount()); + personalPensionRowList.add(row); + }); + map.put("个人养老金", personalPensionRowList); XSSFWorkbook book = ExcelUtil.genWorkbookV2(map); return book; @@ -2306,6 +2426,12 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction } List pos = getFreeIncomeMapper().listSome(build); + List listDTOS = freeIncomePO2DTO(pos); + return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, FreeIncomeListDTO.class); + } + + @NotNull + private List freeIncomePO2DTO(List pos) { List empIds = SalaryEntityUtil.properties(pos, FreeIncomePO::getEmployeeId, Collectors.toList()); List employeeList = getSalaryEmployeeService(user).listByIds(empIds); Map employeeMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId); @@ -2324,7 +2450,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction dto.setIdNo(employee.getIdNo()); return dto; }).collect(Collectors.toList()); - return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, FreeIncomeListDTO.class); + return listDTOS; } @Override @@ -2337,6 +2463,11 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction } List pos = getDerateDeductionMapper().listSome(build); + List listDTOS = derateDeductionPO2DTO(pos); + return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, DerateDeductionListDTO.class); + } + + private List derateDeductionPO2DTO(List pos) { List empIds = SalaryEntityUtil.properties(pos, DerateDeductionPO::getEmployeeId, Collectors.toList()); List employeeList = getSalaryEmployeeService(user).listByIds(empIds); Map employeeMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId); @@ -2355,7 +2486,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction dto.setIdNo(employee.getIdNo()); return dto; }).collect(Collectors.toList()); - return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, DerateDeductionListDTO.class); + return listDTOS; } @Override @@ -2368,6 +2499,13 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction } List pos = getEndowmentInsuranceMapper().listSome(build); + + List listDTOS = endowmentInsurancePO2DTO(pos); + return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, EndowmentInsuranceListDTO.class); + } + + @NotNull + private List endowmentInsurancePO2DTO(List pos) { List empIds = SalaryEntityUtil.properties(pos, EndowmentInsurancePO::getEmployeeId, Collectors.toList()); List employeeList = getSalaryEmployeeService(user).listByIds(empIds); Map employeeMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId); @@ -2386,7 +2524,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction dto.setIdNo(employee.getIdNo()); return dto; }).collect(Collectors.toList()); - return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, EndowmentInsuranceListDTO.class); + return listDTOS; } @Override @@ -2399,6 +2537,12 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction } List pos = getGrantDonationMapper().listSome(build); + List listDTOS = grantDonationPO2DTO(pos); + return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, GrantDonationListDTO.class); + } + + @NotNull + private List grantDonationPO2DTO(List pos) { List empIds = SalaryEntityUtil.properties(pos, GrantDonationPO::getEmployeeId, Collectors.toList()); List employeeList = getSalaryEmployeeService(user).listByIds(empIds); Map employeeMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId); @@ -2417,7 +2561,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction dto.setIdNo(employee.getIdNo()); return dto; }).collect(Collectors.toList()); - return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, GrantDonationListDTO.class); + return listDTOS; } @Override @@ -2430,6 +2574,12 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction } List pos = getHealthInsuranceMapper().listSome(build); + List listDTOS = healthInsurancePO2DTO(pos); + return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, HealthInsuranceListDTO.class); + } + + @NotNull + private List healthInsurancePO2DTO(List pos) { List empIds = SalaryEntityUtil.properties(pos, HealthInsurancePO::getEmployeeId, Collectors.toList()); List employeeList = getSalaryEmployeeService(user).listByIds(empIds); Map employeeMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId); @@ -2448,7 +2598,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction dto.setIdNo(employee.getIdNo()); return dto; }).collect(Collectors.toList()); - return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, HealthInsuranceListDTO.class); + return listDTOS; } @Override @@ -2461,6 +2611,12 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction } List pos = getOtherDerateDeductionMapper().listSome(build); + List listDTOS = otherDerateDeductionPO2DTO(pos); + return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, OtherDerateDeductionListDTO.class); + } + + @NotNull + private List otherDerateDeductionPO2DTO(List pos) { List empIds = SalaryEntityUtil.properties(pos, OtherDerateDeductionPO::getEmployeeId, Collectors.toList()); List employeeList = getSalaryEmployeeService(user).listByIds(empIds); Map employeeMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId); @@ -2479,7 +2635,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction dto.setIdNo(employee.getIdNo()); return dto; }).collect(Collectors.toList()); - return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, OtherDerateDeductionListDTO.class); + return listDTOS; } @Override @@ -2492,6 +2648,12 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction } List pos = getPersonalPensionMapper().listSome(build); + List listDTOS = personalPensionPO2DTO(pos); + return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, PersonalPensionListDTO.class); + } + + @NotNull + private List personalPensionPO2DTO(List pos) { List empIds = SalaryEntityUtil.properties(pos, PersonalPensionPO::getEmployeeId, Collectors.toList()); List employeeList = getSalaryEmployeeService(user).listByIds(empIds); Map employeeMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId); @@ -2510,7 +2672,7 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction dto.setIdNo(employee.getIdNo()); return dto; }).collect(Collectors.toList()); - return SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), listDTOS, PersonalPensionListDTO.class); + return listDTOS; } @Override @@ -2954,13 +3116,13 @@ public class OtherDeductionServiceImpl extends Service implements OtherDeduction syncFreeIncome(deductionPO); } if (taxFreeTypes.contains(TaxFreeTypeEnum.HEALTH_INSURANCE)) { - syncEndowmentInsurance(deductionPO); + syncHealthInsurance(deductionPO); } if (taxFreeTypes.contains(TaxFreeTypeEnum.ENDOWMENT_INSURANCE)) { - syncGrantDonation(deductionPO); + syncEndowmentInsurance(deductionPO); } if (taxFreeTypes.contains(TaxFreeTypeEnum.GRANT_DONATION)) { - syncHealthInsurance(deductionPO); + syncGrantDonation(deductionPO); } if (taxFreeTypes.contains(TaxFreeTypeEnum.DERATE_DEDUCTION)) { syncDerateDeduction(deductionPO);