紧急任务修改

This commit is contained in:
秦鸿展
2026-07-17 15:32:11 +08:00
parent 2373be59e6
commit 9ed1797b59
@@ -496,25 +496,20 @@ public class ShiftManageDomainService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean revokeAudit(ShiftManageDO shiftManageDO) { public Boolean revokeAudit(ShiftManageDO shiftManageDO) {
LoginUser loginUser = SecurityUtils.getLoginUser(); LoginUser loginUser = SecurityUtils.getLoginUser();
List<Long> shiftManageIds = shiftManageDO.getShiftManageIds(); Long shiftManageId = shiftManageDO.getShiftManageId();
if (CollectionUtils.isEmpty(shiftManageIds)) { if (shiftManageId == null) {
throw new ServiceException("移位单id不能为空"); throw new ServiceException("移位单id不能为空");
} }
List<ShiftManage> shiftManageList = shiftManageService.listByIds(shiftManageIds); ShiftManage shiftManage = shiftManageService.getById(shiftManageId);
if (CollectionUtils.isEmpty(shiftManageList)) { if (shiftManage == null) {
throw new ServiceException("移位单不存在"); throw new ServiceException("移位单不存在");
} }
for (ShiftManage shiftManage : shiftManageList) {
if (!Integer.valueOf(2).equals(shiftManage.getShiftStatus())) { if (!Integer.valueOf(2).equals(shiftManage.getShiftStatus())) {
throw new ServiceException("移位单【" + shiftManage.getShiftNumber() + "】状态不为待移位,不可撤回"); throw new ServiceException("移位单【" + shiftManage.getShiftNumber() + "】状态不为待移位,不可撤回");
} }
}
// 删除生成的配送任务(taskType=5trackingNumber=shiftNumber // 删除生成的配送任务(taskType=5trackingNumber=shiftNumber
List<String> shiftNumbers = shiftManageList.stream()
.map(ShiftManage::getShiftNumber)
.collect(Collectors.toList());
deliveTaskService.remove(new QueryWrapper<DeliveTask>().lambda() deliveTaskService.remove(new QueryWrapper<DeliveTask>().lambda()
.in(DeliveTask::getTrackingNumber, shiftNumbers) .eq(DeliveTask::getTrackingNumber, shiftManage.getShiftNumber())
.eq(DeliveTask::getTaskType, 5)); .eq(DeliveTask::getTaskType, 5));
// 回退:shiftStatus=1(已创建),taskDistribution=2(未下发),auditStatus=1(未审核) // 回退:shiftStatus=1(已创建),taskDistribution=2(未下发),auditStatus=1(未审核)
shiftManageService.update(null, new UpdateWrapper<ShiftManage>().lambda() shiftManageService.update(null, new UpdateWrapper<ShiftManage>().lambda()
@@ -524,7 +519,7 @@ public class ShiftManageDomainService {
.set(ShiftManage::getUpdateBy, loginUser.getUserid()) .set(ShiftManage::getUpdateBy, loginUser.getUserid())
.set(ShiftManage::getUpdateByName, loginUser.getUsername()) .set(ShiftManage::getUpdateByName, loginUser.getUsername())
.set(ShiftManage::getUpdateTime, new Date()) .set(ShiftManage::getUpdateTime, new Date())
.in(ShiftManage::getShiftManageId, shiftManageIds)); .eq(ShiftManage::getShiftManageId, shiftManageId));
return true; return true;
} }