薪酬系统-福利台账,退差数据编辑v1

This commit is contained in:
sy 2022-11-18 17:56:21 +08:00
parent 746ab58ed3
commit df76d24a39
6 changed files with 231 additions and 0 deletions

View File

@ -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;
}

View File

@ -157,4 +157,9 @@ public interface InsuranceAccountDetailMapper {
List<InsuranceAccountDetailPO> listAll();
int batchUpdate(@Param("collection") List<InsuranceAccountDetailPO> pos);
/**
* 根据id更新数据
*/
void updateById(InsuranceAccountDetailPO po);
}

View File

@ -1154,4 +1154,34 @@
and t.id = #{id}
</select>
<update id="updateById" parameterType="com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO">
UPDATE hrsa_bill_detail
<set>
<if test="null != socialPerJson and '' != socialPerJson">social_per_json = #{socialPerJson},</if>
<if test="null != socialPerSum and '' != socialPerSum">social_per_sum = #{socialPerSum},</if>
<if test="null != fundPerJson and '' != fundPerJson">fund_per_json = #{fundPerJson},</if>
<if test="null != fundPerSum and '' != fundPerSum">fund_per_sum = #{fundPerSum},</if>
<if test="null != otherPerJson and '' != otherPerJson">other_per_json = #{otherPerJson},</if>
<if test="null != otherPerSum and '' != otherPerSum">other_per_sum = #{otherPerSum},</if>
<if test="null != perSum and '' != perSum">per_sum = #{perSum},</if>
<if test="null != comSum and '' != comSum">com_sum = #{comSum},</if>
<if test="null != socialComJson and '' != socialComJson">social_com_json = #{socialComJson},</if>
<if test="null != socialComSum and '' != socialComSum">social_com_sum = #{socialComSum},</if>
<if test="null != fundComJson and '' != fundComJson">fund_com_json = #{fundComJson},</if>
<if test="null != fundComSum and '' != fundComSum">fund_com_sum = #{fundComSum},</if>
<if test="null != otherComJson and '' != otherComJson">other_com_json = #{otherComJson},</if>
<if test="null != otherComSum and '' != otherComSum">other_com_sum = #{otherComSum},</if>
<if test="null != socialSum and '' != socialSum">social_sum = #{socialSum},</if>
<if test="null != fundSum and '' != fundSum">fund_sum = #{fundSum},</if>
<if test="null != otherSum and '' != otherSum">other_sum = #{otherSum},</if>
<if test="null != total and '' != total">total = #{total},</if>
<if test="null != updateTime">update_time = #{updateTime},</if>
<if test="null != supplementaryMonth and '' != supplementaryMonth">supplementary_month =
#{supplementaryMonth},
</if>
</set>
WHERE id = #{id}
</update>
</mapper>

View File

@ -250,5 +250,10 @@ public interface SIAccountService {
*/
Map<String, Object> getPaymentById(Long id);
/**
* 编辑InsuranceAccountDetailPO中的社保公积金其他福利个人和公司缴纳数据
*/
void editAccount(EditAccountDetailParam param);
}

View File

@ -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<BigDecimal> fundPer = new ArrayList<>();
HashMap<String, String> fundPerson = JSON.parseObject(baseParam.getFundPerJson(), new HashMap<String, String>().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<BigDecimal> fundCom = new ArrayList<>();
HashMap<String, String> fundComMap = JSON.parseObject(baseParam.getFundComJson(), new HashMap<String, String>().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<BigDecimal> otherPer = new ArrayList<>();
HashMap<String, String> otherPerMap = JSON.parseObject(baseParam.getOtherPerJson(), new HashMap<String, String>().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<BigDecimal> otherCom = new ArrayList<>();
HashMap<String, String> otherComMap = JSON.parseObject(baseParam.getOtherComJson(), new HashMap<String, String>().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<BigDecimal> socialPer = new ArrayList<>();
HashMap<String, String> archivesPerson = JSON.parseObject(baseParam.getSocialPerJson(), new HashMap<String, String>().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<BigDecimal> socialCom = new ArrayList<>();
HashMap<String, String> archivesCom = JSON.parseObject(baseParam.getSocialComJson(), new HashMap<String, String>().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;
}
}

View File

@ -671,5 +671,17 @@ public class SIAccountController {
return new ResponseResult<Long, Map<String, Object>>(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<EditAccountDetailParam, String>(user).run(getService(user)::editAccount, param);
}
// **********************************退差 end*********************************/
}