From ee7309ffd15adf91bb28a9aec98e27327c5ce2ff Mon Sep 17 00:00:00 2001 From: sy Date: Wed, 30 Nov 2022 14:07:28 +0800 Subject: [PATCH] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-=E7=A6=8F?= =?UTF-8?q?=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E7=A4=BE=E4=BF=9D=E8=B0=83?= =?UTF-8?q?=E5=B7=AE=E9=A1=B9=E5=85=AC=E5=8F=B8=E6=94=AF=E5=87=BA=E8=B4=B9?= =?UTF-8?q?=E7=94=A8=E7=BB=9F=E8=AE=A1=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= =?UTF-8?q?=EF=BC=8C=E5=AF=B9=E4=BA=8E=E5=B7=B2=E5=AD=98=E5=9C=A8=E8=B0=83?= =?UTF-8?q?=E5=B7=AE=E9=A1=B9=EF=BC=8C=E7=BB=99=E5=87=BA=E6=8F=90=E7=A4=BA?= =?UTF-8?q?=EF=BC=8C=E5=B9=B6=E4=B8=94=E4=B8=8D=E8=BF=9B=E8=A1=8C=E8=AE=A1?= =?UTF-8?q?=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InsuranceCompensationMapper.java | 2 + .../siaccount/InsuranceCompensationMapper.xml | 11 ++++++ .../impl/SICompensationServiceImpl.java | 39 +++++++++++++------ 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java index 2ee45f10d..fe0caa3f3 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java @@ -16,5 +16,7 @@ public interface InsuranceCompensationMapper { List queryByBillMonthAndPayOrg(String billMonth, Long paymentOrganization); + InsuranceCompensationPO getOneByBillMonthPayOrgEmpId(InsuranceCompensationPO insuranceCompensationPO); + void deleteById(Long id); } diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml index 2a62fcc5e..8cdd6992f 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml @@ -210,6 +210,17 @@ AND t.delete_type = 0 + + + UPDATE hrsa_compensation_log SET delete_type = 1 diff --git a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java index 4f8e34e60..ac2d22b84 100644 --- a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java +++ b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java @@ -163,23 +163,37 @@ public class SICompensationServiceImpl extends Service implements SICompensation InsuranceAccountDetailPO insuranceAccountDetailPO = getInsuranceAccountDetailMapper().getById(compensation.getTarget()); if (insuranceAccountDetailPO == null) { temp.put("error", SalaryI18nUtil.getI18nLabel(121038, "当前月在该缴纳组织下没有核算记录")); - } - InsuranceAccountDetailPOEncrypt.decryptItem(insuranceAccountDetailPO); - BigDecimal total = new BigDecimal("0"); - List categoryTypeList = Arrays.asList(compensation.getCategoryType().split(",")); + temp.put("totalNum", "0"); + } else { + InsuranceAccountDetailPOEncrypt.decryptItem(insuranceAccountDetailPO); + //判断是否已有调差数据(个税扣缴义务人+账单月份+人员id) + InsuranceCompensationPO nowCompensation = getInsuranceCompensationMapper().getOneByBillMonthPayOrgEmpId(InsuranceCompensationPO.builder() + .billMonth(insuranceAccountDetailPO.getBillMonth()) + .paymentOrganization(insuranceAccountDetailPO.getPaymentOrganization()) + .employeeId(insuranceAccountDetailPO.getEmployeeId()) + .build()); + if (nowCompensation != null) { + temp.put("error", SalaryI18nUtil.getI18nLabel(121039, "当前月在该缴纳组织下已存在调差数据")); + } - if (StringUtils.isNotBlank(insuranceAccountDetailPO.getSocialComJson())) { - Map socialJson = JSON.parseObject(insuranceAccountDetailPO.getSocialComJson(), new HashMap().getClass()); - for (Map.Entry entry : socialJson.entrySet()) { - String insuranceId = entry.getKey(); - String num = entry.getValue(); - if (categoryTypeList.contains(insuranceId)) { - total = total.add(new BigDecimal(num)); + //处理调差数据 + BigDecimal total = new BigDecimal("0"); + List categoryTypeList = Arrays.asList(compensation.getCategoryType().split(",")); + + if (nowCompensation == null && StringUtils.isNotBlank(insuranceAccountDetailPO.getSocialComJson())) { + Map socialJson = JSON.parseObject(insuranceAccountDetailPO.getSocialComJson(), new HashMap().getClass()); + for (Map.Entry entry : socialJson.entrySet()) { + String insuranceId = entry.getKey(); + String num = entry.getValue(); + if (categoryTypeList.contains(insuranceId)) { + total = total.add(new BigDecimal(num)); + } } } + + temp.put("totalNum", total.toPlainString()); } - temp.put("totalNum", total.toPlainString()); } resultList.add(temp); }); @@ -263,6 +277,7 @@ public class SICompensationServiceImpl extends Service implements SICompensation totalSum = totalSum.add(adjustmentTo); insuranceAccountDetailPO.setTotal(totalSum.toPlainString()); //更新社保调差后的明细 + InsuranceAccountDetailPOEncrypt.encryptItem(insuranceAccountDetailPO); getInsuranceAccountDetailMapper().updateById(insuranceAccountDetailPO); //新建调差记录 InsuranceCompensationPO insuranceCompensationPO = new InsuranceCompensationPO();