薪酬系统-福利台账,社保调差项公司支出费用统计功能优化,对于已存在调差项,给出提示,并且不进行计算

This commit is contained in:
sy 2022-11-30 14:07:28 +08:00
parent a0bda933a1
commit ee7309ffd1
3 changed files with 40 additions and 12 deletions

View File

@ -16,5 +16,7 @@ public interface InsuranceCompensationMapper {
List<InsuranceCompensationPO> queryByBillMonthAndPayOrg(String billMonth, Long paymentOrganization);
InsuranceCompensationPO getOneByBillMonthPayOrgEmpId(InsuranceCompensationPO insuranceCompensationPO);
void deleteById(Long id);
}

View File

@ -210,6 +210,17 @@
AND t.delete_type = 0
</select>
<!-- 根据账单月份、个税扣缴义务人、人员id获取单条记录 -->
<select id="getOneByBillMonthPayOrgEmpId" resultMap="BaseResultMap" parameterType="com.engine.salary.entity.siaccount.po.InsuranceCompensationPO">
SELECT
<include refid="baseColumns"/>
FROM hrsa_compensation_log t
WHERE t.bill_month = #{billMonth}
AND t.payment_organization = #{paymentOrganization}
AND t.employee_id = #{employeeId}
AND t.delete_type = 0
</select>
<delete id="deleteById">
UPDATE hrsa_compensation_log
SET delete_type = 1

View File

@ -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<String> 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<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 (categoryTypeList.contains(insuranceId)) {
total = total.add(new BigDecimal(num));
//处理调差数据
BigDecimal total = new BigDecimal("0");
List<String> categoryTypeList = Arrays.asList(compensation.getCategoryType().split(","));
if (nowCompensation == null && 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 (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();