取消待办

This commit is contained in:
Harryxzy 2023-03-28 10:10:54 +08:00
parent 1ab7fcc7b8
commit 2dc40a7b91
2 changed files with 40 additions and 11 deletions

View File

@ -607,7 +607,8 @@
<update id="deleteSuspendTodo" parameterType="com.engine.salary.entity.salaryarchive.po.SalaryArchivePO">
UPDATE hrsa_salary_archive
<set>
run_status='FIXED'
run_status='FIXED',
pay_end_date= null
</set>
WHERE run_status = 'SUSPEND'
and id IN

View File

@ -1119,17 +1119,45 @@ public class SalaryArchiveServiceImpl extends Service implements SalaryArchiveSe
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
}
List<SalaryArchivePO> oldList = listSome(SalaryArchivePO.builder()
.ids(ids)
.runStatus(SalaryArchiveStatusEnum.SUSPEND.getValue())
.build());
List<SalaryArchivePO> unableList = oldList.stream().filter(f -> Objects.nonNull(f.getPayEndDate()) && !f.getPayEndDate().after(new Date())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(unableList)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(115789, "最后发薪日必须晚于今天"));
}
// List<SalaryArchivePO> oldList = listSome(SalaryArchivePO.builder()
// .ids(ids)
// .runStatus(SalaryArchiveStatusEnum.SUSPEND.getValue())
// .build());
// List<SalaryArchivePO> unableList = oldList.stream().filter(f -> Objects.nonNull(f.getPayEndDate()) && !f.getPayEndDate().after(new Date())).collect(Collectors.toList());
// if (CollectionUtils.isNotEmpty(unableList)) {
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(115789, "最后发薪日必须晚于今天"));
// }
//
// // 从待停薪到定薪
// getSalaryArchiveMapper().deleteSuspendTodo(ids);
// return StringUtils.EMPTY;
// 从待停薪到定薪
getSalaryArchiveMapper().deleteSuspendTodo(ids);
// 获取所有个税扣缴义务人
Collection<TaxAgentManageRangeEmployeeDTO> taxAgentList = getTaxAgentService(user).listTaxAgentAndEmployeeTree(Long.valueOf(user.getUID()));
// 获取删除待停薪信息
List<SalaryArchiveListDTO> list = getSalaryArchiveMapper().list(SalaryArchiveQueryParam.builder().ids(ids).build());
if(list.size() != ids.size()){
throw new SalaryRunTimeException("薪资档案不存在,删除失败!");
}
Map<Long, TaxAgentManageRangeEmployeeDTO> taxAgentMap = SalaryEntityUtil.convert2Map(taxAgentList, TaxAgentManageRangeEmployeeDTO::getTaxAgentId);
// 判断删除待停薪代办的人是否在个税扣缴义务人的人员范围中
for(SalaryArchiveListDTO dto : list){
TaxAgentManageRangeEmployeeDTO taxAgentManageRangeEmployeeDTO = taxAgentMap.get(dto.getTaxAgentId());
if(Objects.nonNull(taxAgentManageRangeEmployeeDTO)){
boolean canDelete = taxAgentManageRangeEmployeeDTO.getEmployeeList().stream()
.map(TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee::getEmployeeId)
.anyMatch(id -> Objects.equals(id, dto.getEmployeeId()));
if(!canDelete){
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内,删除失败!");
}
}else{
throw new SalaryRunTimeException("个税扣缴义务人不存在或不在权限范围内,删除失败!");
}
}
// 删除最后发薪日期设置状态为发薪
if(CollectionUtils.isNotEmpty(list)){
getSalaryArchiveMapper().deleteSuspendTodo(list.stream().map(SalaryArchiveListDTO::getId).collect(Collectors.toList()));
}
return StringUtils.EMPTY;
}