撤回功能
This commit is contained in:
parent
89f4f166c1
commit
a403ec5405
|
|
@ -1328,6 +1328,42 @@ public class LeaseTaskServiceImpl implements ILeaseTaskService {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AjaxResult revoke(LeaseApplyInfo leaseApplyInfo) {
|
||||
try {
|
||||
// 1. 参数校验
|
||||
if (leaseApplyInfo.getTaskId() == null) {
|
||||
return AjaxResult.error("撤回失败, 请选择任务");
|
||||
}
|
||||
// 2. 查询 workflow record
|
||||
LeaseApplyInfo recordInfo = mapper.getRecordIdByTaskId(leaseApplyInfo);
|
||||
if (recordInfo != null && recordInfo.getRecordId() != null) {
|
||||
// 3. 根据 recordId 查询 informationId 列表
|
||||
List<LeaseApplyInfo> infoList = mapper.getInformationIdByRecordId(recordInfo.getRecordId());
|
||||
for (LeaseApplyInfo info : infoList) {
|
||||
if (info.getInformationId() != null) {
|
||||
// 3.1 删除 sys_information_people
|
||||
mapper.deleteInformationPeople(info.getInformationId());
|
||||
// 3.2 删除 sys_information
|
||||
mapper.deleteInformation(info.getInformationId());
|
||||
}
|
||||
}
|
||||
// 4. 删除 workflow 相关记录
|
||||
mapper.deleteRecordHistory(recordInfo.getRecordId());
|
||||
mapper.deleteRecord(recordInfo.getRecordId());
|
||||
}
|
||||
// 5. 修改任务状态为待提交
|
||||
tmTaskMapper.updateTaskStatus(String.valueOf(leaseApplyInfo.getTaskId()), 5);
|
||||
return AjaxResult.success("撤回成功");
|
||||
} catch (Exception e) {
|
||||
log.error("领用撤销失败:", e);
|
||||
// 手动回滚事务
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error("撤回失败, 请联系管理员");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成发布批次任务
|
||||
* @param thisMonthMaxOrder
|
||||
|
|
|
|||
Loading…
Reference in New Issue