zhangherong
2025-04-23 6be893ccb873b171c3e6cf3c9dd83955dcaaf368
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamWeekMaintenanceOrderController.java
@@ -29,6 +29,7 @@
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
/**
 * @Description: 周保工单
@@ -145,10 +146,10 @@
    @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());
@@ -167,7 +168,7 @@
    @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("领取成功!");
@@ -198,14 +199,40 @@
    @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() + " 条工单!");
    }
    /**
@@ -241,6 +268,7 @@
    /**
     * 我的待办,审批动作
     *
     * @param request
     * @return
     */
@@ -258,7 +286,7 @@
            return Result.error("审批任务错误或不存在!");
        }
        EamWeekMaintenanceOrder b = eamWeekMaintenanceOrderService.approval(request);
        if(b == null) {
        if (b == null) {
            return Result.error("操作失败!");
        }
        return Result.ok("操作成功!");