Lius
2025-04-10 2be0d59a05f526ced8f0401126015deeea486663
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamWeekMaintenanceOrderController.java
@@ -10,6 +10,7 @@
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.eam.constant.BusinessCodeConst;
import org.jeecg.modules.eam.constant.WeekMaintenanceStatusEnum;
import org.jeecg.modules.eam.entity.EamWeekMaintenanceOrder;
import org.jeecg.modules.eam.request.EamWeekMaintenanceQuery;
import org.jeecg.modules.eam.request.EamWeekMaintenanceRequest;
@@ -20,6 +21,7 @@
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;
/**
 * @Description: 周保工单
@@ -53,7 +55,7 @@
                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
                                   HttpServletRequest req) {
//        QueryWrapper<EamWeekMaintenanceOrder> queryWrapper = QueryGenerator.initQueryWrapper(eamWeekMaintenanceOrder, req.getParameterMap());
        Page<EamWeekMaintenanceOrder> page = new Page<EamWeekMaintenanceOrder>(pageNo, pageSize);
        Page<EamWeekMaintenanceOrder> page = new Page<>(pageNo, pageSize);
        IPage<EamWeekMaintenanceOrder> pageList = eamWeekMaintenanceOrderService.queryPageList(page, query);
        return Result.OK(pageList);
    }
@@ -121,6 +123,45 @@
    }
    /**
     * 通过id作废
     *
     * @param id
     * @return
     */
    @AutoLog(value = "周保工单-作废")
    @ApiOperation(value = "周保工单-作废", notes = "周保工单-作废")
    @DeleteMapping(value = "/abolish")
    public Result<?> abolish(@RequestParam(name = "id", required = true) String id) {
        EamWeekMaintenanceOrder entity = eamWeekMaintenanceOrderService.getById(id);
        if(entity == null) {
            return Result.error("要作废的数据不存在,请刷新重试!");
        }
        if(!WeekMaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())) {
            return Result.error("该状态的数据不允许进行作废!");
        }
        entity.setMaintenanceStatus(WeekMaintenanceStatusEnum.ABOLISH.name());
        eamWeekMaintenanceOrderService.updateById(entity);
        return Result.OK("作废成功!");
    }
    /**
     * 通过id领取
     *
     * @param id
     * @return
     */
    @AutoLog(value = "周保工单-领取")
    @ApiOperation(value = "周保工单-领取", notes = "周保工单-领取")
    @GetMapping(value = "/collect")
    public Result<?> collect(@RequestParam(name = "id", required = true) String id) {
        boolean b = eamWeekMaintenanceOrderService.collect(id);
        if(!b) {
            Result.OK("领取失败!");
        }
        return Result.OK("领取成功!");
    }
    /**
     * 批量删除
     *
     * @param ids
@@ -135,6 +176,27 @@
    }
    /**
     * 通过id批量作废
     *
     * @param ids
     * @return
     */
    @AutoLog(value = "周保工单-批量作废")
    @ApiOperation(value = "周保工单-批量作废", notes = "周保工单-批量作废")
    @DeleteMapping(value = "/abolishBatch")
    public Result<?> abolishBatch(@RequestParam(name = "ids", required = true) String ids) {
        List<String> list = Arrays.asList(ids.split(","));
        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);
            }
        });
        return Result.OK("批量作废成功!");
    }
    /**
     * 通过id查询
     *
     * @param id