薪酬系统-福利台账,社保调差撤回v1

This commit is contained in:
sy 2022-11-28 14:57:29 +08:00
parent 49466f9f3b
commit 1747a613dd
8 changed files with 124 additions and 0 deletions

View File

@ -168,4 +168,9 @@ public interface InsuranceAccountDetailMapper {
* 删除退差数据(账单月份+退差月份+缴纳状态+人员id+个税扣缴义务人)
*/
void deleteRecessionData(InsuranceAccountDetailPO po);
/**
* 获取数据(账单月份+缴纳状态+人员id+个税扣缴义务人)
*/
InsuranceAccountDetailPO getOneByBpep(InsuranceAccountDetailPO po);
}

View File

@ -1195,4 +1195,20 @@
AND supplementary_month = #{supplementaryMonth}
AND employee_id = #{employeeId}
</delete>
<select id="getOneByBpep" resultMap="BaseResultMap">
SELECT
t.id,t.employee_id,t.social_per_json,t.social_com_json,
t.fund_per_json,t.fund_com_json,t.other_per_json,
t.other_com_json,t.social_per_sum,t.social_com_sum,
t.fund_per_sum,t.fund_com_sum,t.other_per_sum,
t.other_com_sum,t.per_sum,t.com_sum,t.payment_organization,t.total
FROM
hrsa_bill_detail t
WHERE t.delete_type = 0
AND t.bill_month = #{billMonth}
AND t.payment_status = #{paymentStatus}
AND t.payment_organization = #{paymentOrganization}
AND t.employee_id = #{employeeId}
</select>
</mapper>

View File

@ -10,4 +10,8 @@ public interface InsuranceCompensationMapper {
void bathInsert(@Param("collection") Collection<InsuranceCompensationPO> insuranceCompensationPOS);
void insert(InsuranceCompensationPO insuranceCompensationPO);
InsuranceCompensationPO getById(Long id);
void deleteById(Long id);
}

View File

@ -193,4 +193,19 @@
#{deleteType},
#{tenantKey})
</insert>
<!-- 根据主键获取单条记录 -->
<select id="getById" resultMap="BaseResultMap" parameterType="Long">
SELECT
<include refid="baseColumns"/>
FROM hrsa_compensation_log t
WHERE id = #{id} AND delete_type = 0
</select>
<delete id="deleteById">
UPDATE hrsa_compensation_log
SET delete_type = 1
WHERE id = #{id}
AND delete_type = 0
</delete>
</mapper>

View File

@ -23,4 +23,9 @@ public interface SICompensationService {
* 保存社保调差默认配置
*/
String compensationConfigSave(List<InsuranceCompensationDTO> param);
/**
* 社保调差撤回
*/
String compensationRevert(InsuranceCompensationDTO param);
}

View File

@ -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<String, String> socialJson = JSON.parseObject(insuranceAccountDetailPO.getSocialComJson(), new HashMap<String, String>().getClass());
for (Map.Entry<String, String> 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 "撤回成功";
}
}

View File

@ -761,5 +761,17 @@ public class SIAccountController {
return new ResponseResult<List<InsuranceCompensationDTO>, 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<InsuranceCompensationDTO, String>(user).run(getSIAccountWrapper(user)::compensationBack, param);
}
// **********************************调差 end*********************************/
}

View File

@ -99,4 +99,12 @@ public class SIAccountWrapper extends Service {
return getSICompensationService(user).compensationConfigSave(param);
}
/**
* 社保调差撤回
*/
public String compensationBack(InsuranceCompensationDTO param) {
return getSICompensationService(user).compensationRevert(param);
}
}