深圳光达顺撤回部分工资单计算
This commit is contained in:
parent
fb239f34ed
commit
fac31d4898
|
|
@ -218,7 +218,7 @@
|
|||
AND send_status = #{sendStatus}
|
||||
</if>
|
||||
<if test="salaryAcctType != null and salaryAcctType != ''">
|
||||
AND salary_acct_type = #{salaryAcctTypec}
|
||||
AND salary_acct_type = #{salaryAcctType}
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
AND creator = #{creator}
|
||||
|
|
|
|||
|
|
@ -247,6 +247,9 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
|
|||
if (CollectionUtils.isEmpty(acctRecords)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100498, "核算记录不存在"));
|
||||
}
|
||||
SalaryAcctRecordPO salaryAcctRecord = acctRecords.get(0);
|
||||
// 工资单模板类型:0,正常核算,1是回算,todo 后续可能还有别的算,需要改这里
|
||||
Integer templateType = salaryAcctRecord.getBackCalcStatus();
|
||||
|
||||
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIds(Collections.singletonList(salaryAccountingId));
|
||||
|
|
@ -288,12 +291,20 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
|
|||
.collect(Collectors.toSet());
|
||||
salaryAcctEmployees = salaryAcctEmployees.stream().filter(se -> salaryAcctEmployeeIds.contains(se.getId())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 将未冻结的给冻结掉
|
||||
if (salarySend != null) {
|
||||
salarySend.setSendStatus(NumberUtils.INTEGER_ONE);
|
||||
mapper.updateById(salarySend);
|
||||
}
|
||||
sendPO = new SalarySendPO();
|
||||
sendPO.setDeleteType(0);
|
||||
sendPO.setSalaryAccountingId(salaryAccountingId);
|
||||
sendPO.setSalaryAcctType(templateType);
|
||||
List<SalarySendPO> salarySendPOS = mapper.listSome(sendPO);
|
||||
if (CollectionUtils.isNotEmpty(salarySendPOS)) {
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100499, "工资单已生成过,不可再重复生成"));
|
||||
return "";
|
||||
}
|
||||
// 2.正常核算
|
||||
} else {
|
||||
SalarySendPO sendPO = new SalarySendPO();
|
||||
|
|
@ -301,15 +312,14 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
|
|||
sendPO.setSalaryAccountingId(salaryAccountingId);
|
||||
List<SalarySendPO> salarySends = mapper.listSome(sendPO);
|
||||
if (CollectionUtils.isNotEmpty(salarySends)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100499, "工资单已生成过,不可再重复生成"));
|
||||
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100499, "工资单已生成过,不可再重复生成"));
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Long salarySendId = IdGenerator.generate();
|
||||
SalaryAcctRecordPO salaryAcctRecord = acctRecords.get(0);
|
||||
// 工资单模板类型:0,正常核算,1是回算,todo 后续可能还有别的算,需要改这里
|
||||
Integer templateType = salaryAcctRecord.getBackCalcStatus();
|
||||
|
||||
|
||||
// 构建工资单发放数据
|
||||
List<SalarySendInfoPO> salarySendInfos = salaryAcctEmployees.stream().map(m ->
|
||||
|
|
@ -407,24 +417,27 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
|
|||
.sendStatus(SalarySendStatusEnum.ALREADYSEND.getValue())
|
||||
.salaryAcctType(NumberUtils.INTEGER_ZERO).build();
|
||||
List<SalarySendInfoPO> salarySendInfos = getSalarySendInfoMapper().listSome(sendInfo);
|
||||
if ((salarySend.getSendNum() > 0 || CollectionUtils.isNotEmpty(salarySendInfos)) && Objects.equals(salarySend.getSalaryAcctType(), NumberUtils.INTEGER_ONE)) {
|
||||
if ((salarySend.getSendNum() > 0 || CollectionUtils.isNotEmpty(salarySendInfos)) && Objects.equals(salarySend.getSalaryAcctType(), NumberUtils.INTEGER_ONE) && salarySend.getSendNum().equals(salarySend.getSendTotal())) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100507, "补发工资单已经发放,不可进行回算"));
|
||||
} else if (salarySend.getSendNum() > 0 || CollectionUtils.isNotEmpty(salarySendInfos)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100507, "工资单已经发放,不可撤销,可以进行回算"));
|
||||
} else if (salarySend.getSendNum() > 0 && salarySend.getSendNum().equals(salarySend.getSendTotal())) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100507, "工资单已经全部发放,不可撤销,请先撤回至少一条工资单"));
|
||||
}
|
||||
// 所有工资单都被撤回
|
||||
if (salarySend.getSendNum() == 0 || CollectionUtils.isEmpty(salarySendInfos)) {
|
||||
// 删除工资单
|
||||
SalarySendPO salarySendPO = SalarySendPO.builder()
|
||||
.id(salarySend.getId())
|
||||
.sendNum(0)
|
||||
.deleteType(1)
|
||||
.build();
|
||||
getSalarySendMapper().updateIgnoreNull(salarySendPO);
|
||||
// 删除工资单发放
|
||||
SalarySendInfoPO infoPO = SalarySendInfoPO.builder()
|
||||
.salarySendId(salarySend.getId())
|
||||
.deleteType(1)
|
||||
.build();
|
||||
getSalarySendInfoMapper().updateGrantWithdraw(infoPO, salarySend.getId(), null, null);
|
||||
}
|
||||
// 删除工资单
|
||||
SalarySendPO salarySendPO = SalarySendPO.builder()
|
||||
.id(salarySend.getId())
|
||||
.sendNum(0)
|
||||
.deleteType(1)
|
||||
.build();
|
||||
getSalarySendMapper().updateIgnoreNull(salarySendPO);
|
||||
// 删除工资单发放
|
||||
SalarySendInfoPO infoPO = SalarySendInfoPO.builder()
|
||||
.salarySendId(salarySend.getId())
|
||||
.deleteType(1)
|
||||
.build();
|
||||
getSalarySendInfoMapper().updateGrantWithdraw(infoPO, salarySend.getId(), null, null);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue