From 1747a613dd8073aa87daf67f1dc3f01dff0f5d0e Mon Sep 17 00:00:00 2001 From: sy Date: Mon, 28 Nov 2022 14:57:29 +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=E6=92=A4=E5=9B=9Ev1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InsuranceAccountDetailMapper.java | 5 ++ .../InsuranceAccountDetailMapper.xml | 16 +++++ .../InsuranceCompensationMapper.java | 4 ++ .../siaccount/InsuranceCompensationMapper.xml | 15 +++++ .../salary/service/SICompensationService.java | 5 ++ .../impl/SICompensationServiceImpl.java | 59 +++++++++++++++++++ .../salary/web/SIAccountController.java | 12 ++++ .../salary/wrapper/SIAccountWrapper.java | 8 +++ 8 files changed, 124 insertions(+) diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java index 030d68d5f..6c2643c6a 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java @@ -168,4 +168,9 @@ public interface InsuranceAccountDetailMapper { * 删除退差数据(账单月份+退差月份+缴纳状态+人员id+个税扣缴义务人) */ void deleteRecessionData(InsuranceAccountDetailPO po); + + /** + * 获取数据(账单月份+缴纳状态+人员id+个税扣缴义务人) + */ + InsuranceAccountDetailPO getOneByBpep(InsuranceAccountDetailPO po); } diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml index 71b1b07c0..182b26111 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml @@ -1195,4 +1195,20 @@ AND supplementary_month = #{supplementaryMonth} AND employee_id = #{employeeId} + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java index a021cc4a9..65015dc3d 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java @@ -10,4 +10,8 @@ public interface InsuranceCompensationMapper { void bathInsert(@Param("collection") Collection insuranceCompensationPOS); void insert(InsuranceCompensationPO insuranceCompensationPO); + + InsuranceCompensationPO getById(Long id); + + 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 dece492ec..1fd899ae5 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml @@ -193,4 +193,19 @@ #{deleteType}, #{tenantKey}) + + + + + + UPDATE hrsa_compensation_log + SET delete_type = 1 + WHERE id = #{id} + AND delete_type = 0 + \ No newline at end of file diff --git a/src/com/engine/salary/service/SICompensationService.java b/src/com/engine/salary/service/SICompensationService.java index 032d21275..fdd8265a2 100644 --- a/src/com/engine/salary/service/SICompensationService.java +++ b/src/com/engine/salary/service/SICompensationService.java @@ -23,4 +23,9 @@ public interface SICompensationService { * 保存社保调差默认配置 */ String compensationConfigSave(List param); + + /** + * 社保调差撤回 + */ + String compensationRevert(InsuranceCompensationDTO param); } diff --git a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java index ccb89bf82..0491ecc45 100644 --- a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java +++ b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java @@ -14,6 +14,7 @@ import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO; import com.engine.salary.entity.siaccount.po.InsuranceCompensationConfigPO; import com.engine.salary.entity.siaccount.po.InsuranceCompensationPO; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; +import com.engine.salary.enums.siaccount.PaymentStatusEnum; import com.engine.salary.enums.sicategory.DeleteTypeEnum; import com.engine.salary.mapper.datacollection.EmployMapper; import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper; @@ -281,4 +282,62 @@ public class SICompensationServiceImpl extends Service implements SICompensation return "配置成功"; } + + /** + * 社保调差撤回 + */ + @Override + public String compensationRevert(InsuranceCompensationDTO param) { + InsuranceCompensationPO insuranceCompensationPO = getInsuranceCompensationMapper().getById(param.getId()); + SalaryAssert.notNull(insuranceCompensationPO, SalaryI18nUtil.getI18nLabel(121112, "当前补差记录不存在")); + InsuranceAccountDetailPO insuranceAccountDetailPO = getInsuranceAccountDetailMapper().getOneByBpep(InsuranceAccountDetailPO.builder() + .billMonth(insuranceCompensationPO.getBillMonth()) + .paymentStatus(PaymentStatusEnum.COMMON.getValue()) + .employeeId(insuranceCompensationPO.getEmployeeId()) + .paymentOrganization(insuranceCompensationPO.getPaymentOrganization()) + .build()); + + SalaryAssert.notNull(insuranceAccountDetailPO, SalaryI18nUtil.getI18nLabel(121108, "补差对象不存在")); + InsuranceAccountDetailPOEncrypt.decryptItem(insuranceAccountDetailPO); + 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 (Objects.equals(String.valueOf(insuranceCompensationPO.getAdjustTo()), insuranceId)) { + BigDecimal adjustmentTo = new BigDecimal(insuranceCompensationPO.getAdjustmentTotal()); + //回退补单位缴纳明细 + BigDecimal insuranceNum = new BigDecimal(num); + insuranceNum = insuranceNum.subtract(adjustmentTo); + socialJson.replace(insuranceId, insuranceNum.toPlainString()); + insuranceAccountDetailPO.setSocialComJson(JSON.toJSONString(socialJson)); + //回退补差单位合计 + BigDecimal comSum = new BigDecimal(insuranceAccountDetailPO.getComSum()); + comSum = comSum.subtract(adjustmentTo); + insuranceAccountDetailPO.setComSum(comSum.toPlainString()); + //回退补差社保单位合计 + BigDecimal socialComSum = new BigDecimal(insuranceAccountDetailPO.getSocialComSum()); + socialComSum = socialComSum.subtract(adjustmentTo); + insuranceAccountDetailPO.setSocialComSum(socialComSum.toPlainString()); + //回退补差社保合计 + BigDecimal socialSum = new BigDecimal(insuranceAccountDetailPO.getSocialSum()); + socialSum = socialSum.subtract(adjustmentTo); + insuranceAccountDetailPO.setSocialSum(socialSum.toPlainString()); + //回退补差合计 + BigDecimal totalSum = new BigDecimal(insuranceAccountDetailPO.getTotal()); + totalSum = totalSum.subtract(adjustmentTo); + insuranceAccountDetailPO.setTotal(totalSum.toPlainString()); + //更新社保补差后的明细 + getInsuranceAccountDetailMapper().updateById(insuranceAccountDetailPO); + //删除补差记录 + getInsuranceCompensationMapper().deleteById(param.getId()); + + } + } + //刷新bill_detail统计数据 + getSIAccountService(user).refreshBillBatch(param.getPaymentOrganization(), param.getBillMonth()); + + } + return "撤回成功"; + } } diff --git a/src/com/engine/salary/web/SIAccountController.java b/src/com/engine/salary/web/SIAccountController.java index 307d69ee5..8257119ce 100644 --- a/src/com/engine/salary/web/SIAccountController.java +++ b/src/com/engine/salary/web/SIAccountController.java @@ -761,5 +761,17 @@ public class SIAccountController { return new ResponseResult, String>(user).run(getSIAccountWrapper(user)::compensationConfigSave, param); } + /** + * 社保调差撤回 + */ + @POST + @Path("/compensationBack") + @Produces(MediaType.APPLICATION_JSON) + public String compensationBack(@Context HttpServletRequest request, @Context HttpServletResponse response, + @RequestBody InsuranceCompensationDTO param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getSIAccountWrapper(user)::compensationBack, param); + } + // **********************************调差 end*********************************/ } diff --git a/src/com/engine/salary/wrapper/SIAccountWrapper.java b/src/com/engine/salary/wrapper/SIAccountWrapper.java index 09bb1e97d..b20840943 100644 --- a/src/com/engine/salary/wrapper/SIAccountWrapper.java +++ b/src/com/engine/salary/wrapper/SIAccountWrapper.java @@ -99,4 +99,12 @@ public class SIAccountWrapper extends Service { return getSICompensationService(user).compensationConfigSave(param); } + + /** + * 社保调差撤回 + */ + public String compensationBack(InsuranceCompensationDTO param) { + + return getSICompensationService(user).compensationRevert(param); + } }