台账核算回滚数据

This commit is contained in:
MustangDeng 2022-06-14 16:05:23 +08:00
parent 811a90f50d
commit 8846346dda
1 changed files with 14 additions and 2 deletions

View File

@ -142,7 +142,19 @@ public class SIAccountBiz extends Service {
// insuranceSchemeContext.setNewValues(build);
// siAccountLoggerTemplate.write(insuranceSchemeContext);
}
account(param, employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, currentUserName);
try {
account(param, employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, currentUserName);
} catch(Exception e) {
// 回滚
List<InsuranceAccountBatchPO> list = Lists.newArrayList(MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(param.getBillMonth(), param.getPaymentOrganization()));
list = SiAccountEncrypt.decryptInsuranceAccountBatchList(list);
if (CollectionUtils.isNotEmpty(list)) {
list.stream().forEach(f -> {
MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).deleteById(f.getId());
});
}
throw new SalaryRunTimeException(e.getMessage());
}
}
@ -157,7 +169,7 @@ public class SIAccountBiz extends Service {
});
}
}
SalaryAssert.notEmpty(employeeIds, "no account data");
SalaryAssert.notEmpty(employeeIds, "没有需要核算的人员");
AccountParam selectParam = new AccountParam();
selectParam.setBillMonth(param.getBillMonth());
selectParam.setPaymentOrganization(param.getPaymentOrganization());