| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.concurrent.atomic.AtomicInteger; |
| | | |
| | | /** |
| | | * @Description: 周保工单 |
| | |
| | | @DeleteMapping(value = "/abolish") |
| | | public Result<?> abolish(@RequestParam(name = "id", required = true) String id) { |
| | | EamWeekMaintenanceOrder entity = eamWeekMaintenanceOrderService.getById(id); |
| | | if(entity == null) { |
| | | if (entity == null) { |
| | | return Result.error("要作废的数据不存在,请刷新重试!"); |
| | | } |
| | | if(!WeekMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())) { |
| | | if (!WeekMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())) { |
| | | return Result.error("该状态的数据不允许进行作废!"); |
| | | } |
| | | entity.setMaintenanceStatus(WeekMaintenanceStatusEnum.ABOLISH.name()); |
| | |
| | | @GetMapping(value = "/collect") |
| | | public Result<?> collect(@RequestParam(name = "id", required = true) String id) { |
| | | boolean b = eamWeekMaintenanceOrderService.collect(id); |
| | | if(!b) { |
| | | if (!b) { |
| | | Result.OK("领取失败!"); |
| | | } |
| | | return Result.OK("领取成功!"); |
| | |
| | | @DeleteMapping(value = "/abolishBatch") |
| | | public Result<?> abolishBatch(@RequestParam(name = "ids", required = true) String ids) { |
| | | List<String> list = Arrays.asList(ids.split(",")); |
| | | AtomicInteger i = new AtomicInteger(); |
| | | list.forEach(id -> { |
| | | EamWeekMaintenanceOrder entity = eamWeekMaintenanceOrderService.getById(id); |
| | | if (entity != null && WeekMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())) { |
| | | entity.setMaintenanceStatus(WeekMaintenanceStatusEnum.ABOLISH.name()); |
| | | eamWeekMaintenanceOrderService.updateById(entity); |
| | | i.getAndIncrement(); |
| | | } |
| | | }); |
| | | return Result.OK("批量作废成功!"); |
| | | return Result.OK("批量作废成功 " + i.get() + " 条工单!"); |
| | | } |
| | | |
| | | /** |
| | | * 通过id批量领取 |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "周保工单-批量领取") |
| | | @ApiOperation(value = "周保工单-批量领取", notes = "周保工单-批量领取") |
| | | @DeleteMapping(value = "/collectBatch") |
| | | public Result<?> collectBatch(@RequestParam(name = "ids", required = true) String ids) { |
| | | List<String> list = Arrays.asList(ids.split(",")); |
| | | AtomicInteger i = new AtomicInteger(); |
| | | list.forEach(id -> { |
| | | EamWeekMaintenanceOrder entity = eamWeekMaintenanceOrderService.getById(id); |
| | | if (entity != null && WeekMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())) { |
| | | boolean b = eamWeekMaintenanceOrderService.collect(id); |
| | | if (b) { |
| | | i.getAndIncrement(); |
| | | } |
| | | } |
| | | }); |
| | | return Result.OK("批量领取成功 " + i.get() + " 条工单!"); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * 我的待办,审批动作 |
| | | * |
| | | * @param request |
| | | * @return |
| | | */ |
| | |
| | | return Result.error("审批任务错误或不存在!"); |
| | | } |
| | | EamWeekMaintenanceOrder b = eamWeekMaintenanceOrderService.approval(request); |
| | | if(b == null) { |
| | | if (b == null) { |
| | | return Result.error("操作失败!"); |
| | | } |
| | | return Result.ok("操作成功!"); |