diff --git a/src/com/engine/salary/entity/siaccount/param/EditAccountDetailParam.java b/src/com/engine/salary/entity/siaccount/param/EditAccountDetailParam.java new file mode 100644 index 000000000..735da0f7d --- /dev/null +++ b/src/com/engine/salary/entity/siaccount/param/EditAccountDetailParam.java @@ -0,0 +1,32 @@ +package com.engine.salary.entity.siaccount.param; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author: sy + * @Description: 编辑福利报表 + * @Date: 2022/11/18 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class EditAccountDetailParam { + + private Long id; + + private String socialPerJson; + + private String socialComJson; + + private String fundPerJson; + + private String fundComJson; + + private String otherPerJson; + + private String otherComJson; +} diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java index 360511fee..25f1ed64b 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java @@ -157,4 +157,9 @@ public interface InsuranceAccountDetailMapper { List listAll(); int batchUpdate(@Param("collection") List pos); + + /** + * 根据id更新数据 + */ + void updateById(InsuranceAccountDetailPO po); } diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml index 09dcdab8e..5f2bce3dd 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml @@ -1154,4 +1154,34 @@ and t.id = #{id} + + UPDATE hrsa_bill_detail + + + social_per_json = #{socialPerJson}, + social_per_sum = #{socialPerSum}, + fund_per_json = #{fundPerJson}, + fund_per_sum = #{fundPerSum}, + other_per_json = #{otherPerJson}, + other_per_sum = #{otherPerSum}, + per_sum = #{perSum}, + com_sum = #{comSum}, + social_com_json = #{socialComJson}, + social_com_sum = #{socialComSum}, + fund_com_json = #{fundComJson}, + fund_com_sum = #{fundComSum}, + other_com_json = #{otherComJson}, + other_com_sum = #{otherComSum}, + social_sum = #{socialSum}, + fund_sum = #{fundSum}, + other_sum = #{otherSum}, + total = #{total}, + update_time = #{updateTime}, + supplementary_month = + #{supplementaryMonth}, + + + + WHERE id = #{id} + \ No newline at end of file diff --git a/src/com/engine/salary/service/SIAccountService.java b/src/com/engine/salary/service/SIAccountService.java index 710b5f8cb..162537f93 100644 --- a/src/com/engine/salary/service/SIAccountService.java +++ b/src/com/engine/salary/service/SIAccountService.java @@ -250,5 +250,10 @@ public interface SIAccountService { */ Map getPaymentById(Long id); + /** + * 编辑InsuranceAccountDetailPO中的社保、公积金、其他福利个人和公司缴纳数据 + */ + void editAccount(EditAccountDetailParam param); + } diff --git a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java index 49077b9fb..e9735eec1 100644 --- a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java @@ -2202,4 +2202,151 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { addGroups.add(new SearchConditionGroup(welfareType + groupType +"缴纳", true, inputItems)); } + /** + * 编辑InsuranceAccountDetailPO中的社保、公积金、其他福利个人和公司缴纳数据 + */ + @Override + public void editAccount(EditAccountDetailParam param) { + InsuranceAccountDetailPO insuranceAccountDetailPO = getInsuranceAccountDetailMapper().getById(param.getId()); + if (insuranceAccountDetailPO == null) { + throw new SalaryRunTimeException("该条核算数据不存在!"); + } + InsuranceAccountDetailPOEncrypt.decryptItem(insuranceAccountDetailPO); + + accountSocialByData(insuranceAccountDetailPO, param); + accountFundByData(insuranceAccountDetailPO, param); + accountOtherByData(insuranceAccountDetailPO, param); + account(insuranceAccountDetailPO); + + InsuranceAccountDetailPOEncrypt.encryptItem(insuranceAccountDetailPO); + getInsuranceAccountDetailMapper().updateById(insuranceAccountDetailPO); + } + + public void accountFundByData(InsuranceAccountDetailPO insuranceAccountDetailPO, EditAccountDetailParam baseParam) { + //公积金个人 + if (StringUtils.isNotBlank(baseParam.getFundPerJson())) { + List fundPer = new ArrayList<>(); + HashMap fundPerson = JSON.parseObject(baseParam.getFundPerJson(), new HashMap().getClass()); + fundPerson.forEach((k, v) -> { + BigDecimal result = new BigDecimal(v); + fundPer.add(result); + }); + insuranceAccountDetailPO.setFundPerJson(baseParam.getFundPerJson()); + BigDecimal fundPerSum = new BigDecimal("0"); + for (BigDecimal bigDecimal : fundPer) { + fundPerSum = fundPerSum.add(bigDecimal); + } + insuranceAccountDetailPO.setFundPerSum(fundPerSum.toPlainString()); + } + //公积金单位 + if (StringUtils.isNotBlank(baseParam.getFundComJson())) { + List fundCom = new ArrayList<>(); + HashMap fundComMap = JSON.parseObject(baseParam.getFundComJson(), new HashMap().getClass()); + fundComMap.forEach((k, v) -> { + BigDecimal result = new BigDecimal(v); + fundCom.add(result); + }); + insuranceAccountDetailPO.setFundComJson(baseParam.getFundComJson()); + BigDecimal fundComSum = new BigDecimal("0"); + for (BigDecimal bigDecimal : fundCom) { + fundComSum = fundComSum.add(bigDecimal); + } + insuranceAccountDetailPO.setFundComSum(fundComSum.toPlainString()); + } + } + + public void accountOtherByData(InsuranceAccountDetailPO insuranceAccountDetailPO, EditAccountDetailParam baseParam) { + //其他福利个人 + if (StringUtils.isNotBlank(baseParam.getOtherPerJson())) { + List otherPer = new ArrayList<>(); + HashMap otherPerMap = JSON.parseObject(baseParam.getOtherPerJson(), new HashMap().getClass()); + otherPerMap.forEach((k, v) -> { + BigDecimal result = new BigDecimal(v); + otherPer.add(result); + }); + insuranceAccountDetailPO.setOtherPerJson(baseParam.getOtherPerJson()); + BigDecimal otherPerSum = new BigDecimal("0"); + for (BigDecimal bigDecimal : otherPer) { + otherPerSum = otherPerSum.add(bigDecimal); + } + insuranceAccountDetailPO.setOtherPerSum(otherPerSum.toPlainString()); + } + //其他福利单位 + if (StringUtils.isNotBlank(baseParam.getOtherComJson())) { + List otherCom = new ArrayList<>(); + HashMap otherComMap = JSON.parseObject(baseParam.getOtherComJson(), new HashMap().getClass()); + otherComMap.forEach((k, v) -> { + BigDecimal result = new BigDecimal(v); + otherCom.add(result); + }); + insuranceAccountDetailPO.setOtherComJson(baseParam.getOtherComJson()); + BigDecimal otherComSum = new BigDecimal("0"); + for (BigDecimal bigDecimal : otherCom) { + otherComSum = otherComSum.add(bigDecimal); + } + insuranceAccountDetailPO.setOtherComSum(otherComSum.toPlainString()); + } + } + + public void accountSocialByData(InsuranceAccountDetailPO insuranceAccountDetailPO, EditAccountDetailParam baseParam) { + //社保个人 + if (StringUtils.isNotBlank(baseParam.getSocialPerJson())) { + List socialPer = new ArrayList<>(); + HashMap archivesPerson = JSON.parseObject(baseParam.getSocialPerJson(), new HashMap().getClass()); + archivesPerson.forEach((k, v) -> { + BigDecimal result = new BigDecimal(v); + socialPer.add(result); + }); + insuranceAccountDetailPO.setSocialPerJson(baseParam.getSocialPerJson()); + BigDecimal socialPerSum = new BigDecimal("0"); + for (BigDecimal bigDecimal : socialPer) { + socialPerSum = socialPerSum.add(bigDecimal); + } + insuranceAccountDetailPO.setSocialPerSum(socialPerSum.toPlainString()); + } + //社保单位 + if (StringUtils.isNotBlank(baseParam.getSocialComJson())) { + List socialCom = new ArrayList<>(); + HashMap archivesCom = JSON.parseObject(baseParam.getSocialComJson(), new HashMap().getClass()); + archivesCom.forEach((k, v) -> { + BigDecimal result = new BigDecimal(v); + socialCom.add(result); + }); + insuranceAccountDetailPO.setSocialComJson(baseParam.getSocialComJson()); + BigDecimal socialComSum = new BigDecimal("0"); + for (BigDecimal bigDecimal : socialCom) { + socialComSum = socialComSum.add(bigDecimal); + } + insuranceAccountDetailPO.setSocialComSum(socialComSum.toPlainString()); + } + } + + public InsuranceAccountDetailPO account(InsuranceAccountDetailPO insuranceAccountDetailPO) { + //个人合计 + BigDecimal socialPerson = + StringUtils.isBlank(insuranceAccountDetailPO.getSocialPerSum()) ? new BigDecimal("0") : new BigDecimal(insuranceAccountDetailPO.getSocialPerSum()); + BigDecimal fundPerson = + StringUtils.isBlank(insuranceAccountDetailPO.getFundPerSum()) ? new BigDecimal("0") : new BigDecimal(insuranceAccountDetailPO.getFundPerSum()); + BigDecimal otherPerson = + StringUtils.isBlank(insuranceAccountDetailPO.getOtherPerSum()) ? new BigDecimal("0") : new BigDecimal(insuranceAccountDetailPO.getOtherPerSum()); + BigDecimal perSum = socialPerson.add(fundPerson).add(otherPerson); + insuranceAccountDetailPO.setPerSum(perSum.toPlainString()); + //单位合计 + BigDecimal socialCom = + StringUtils.isBlank(insuranceAccountDetailPO.getSocialComSum()) ? new BigDecimal("0") : new BigDecimal(insuranceAccountDetailPO.getSocialComSum()); + BigDecimal fundCom = StringUtils.isBlank(insuranceAccountDetailPO.getFundComSum()) ? new BigDecimal("0") : new BigDecimal(insuranceAccountDetailPO.getFundComSum()); + BigDecimal otherCom = + StringUtils.isBlank(insuranceAccountDetailPO.getOtherComSum()) ? new BigDecimal("0") : new BigDecimal(insuranceAccountDetailPO.getOtherComSum()); + BigDecimal comSum = socialCom.add(fundCom).add(otherCom); + insuranceAccountDetailPO.setComSum(comSum.toPlainString()); + //社保合计 + insuranceAccountDetailPO.setSocialSum(socialPerson.add(socialCom).toPlainString()); + //公积金合计 + insuranceAccountDetailPO.setFundSum(fundPerson.add(fundCom).toPlainString()); + //其他福利合计 + insuranceAccountDetailPO.setOtherSum(otherPerson.add(otherCom).toPlainString()); + //合计 + insuranceAccountDetailPO.setTotal(perSum.add(comSum).toPlainString()); + return insuranceAccountDetailPO; + } } diff --git a/src/com/engine/salary/web/SIAccountController.java b/src/com/engine/salary/web/SIAccountController.java index cbd8da06f..a8ef40f02 100644 --- a/src/com/engine/salary/web/SIAccountController.java +++ b/src/com/engine/salary/web/SIAccountController.java @@ -671,5 +671,17 @@ public class SIAccountController { return new ResponseResult>(user).run(getService(user)::getPaymentById, id); } + /** + * 编辑InsuranceAccountDetailPO中的社保、公积金、其他福利个人和公司缴纳数据 + */ + @POST + @Path("/editAccount") + @Produces(MediaType.APPLICATION_JSON) + public String editAccount(@Context HttpServletRequest request, @Context HttpServletResponse response, + @RequestBody EditAccountDetailParam param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getService(user)::editAccount, param); + } + // **********************************退差 end*********************************/ }