zhangherong
2025-04-08 ebf906dbd401fac43a1ea25a1b1a9fef57830cb6
art: 设备管理-周保-作废,批量作废
已修改1个文件
48 ■■■■■ 文件已修改
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamWeekMaintenanceOrderController.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamWeekMaintenanceOrderController.java
@@ -8,8 +8,12 @@
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.eam.constant.BusinessCodeConst;
import org.jeecg.modules.eam.constant.MaintenanceStandardStatusEnum;
import org.jeecg.modules.eam.constant.MaintenanceStatusEnum;
import org.jeecg.modules.eam.entity.EamMaintenanceStandard;
import org.jeecg.modules.eam.entity.EamWeekMaintenanceOrder;
import org.jeecg.modules.eam.request.EamWeekMaintenanceQuery;
import org.jeecg.modules.eam.request.EamWeekMaintenanceRequest;
@@ -20,6 +24,7 @@
import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;
/**
 * @Description: 周保工单
@@ -121,6 +126,28 @@
    }
    /**
     * 通过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(!MaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())) {
            return Result.error("该状态的数据不允许进行作废!");
        }
        entity.setMaintenanceStatus(MaintenanceStatusEnum.ABOLISH.name());
        eamWeekMaintenanceOrderService.updateById(entity);
        return Result.OK("作废成功!");
    }
    /**
     * 批量删除
     *
     * @param ids
@@ -135,6 +162,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 && MaintenanceStatusEnum.WAIT_MAINTENANCE.name().equals(entity.getMaintenanceStatus())) {
                entity.setMaintenanceStatus(MaintenanceStatusEnum.ABOLISH.name());
                eamWeekMaintenanceOrderService.updateById(entity);
            }
        });
        return Result.OK("批量作废成功!");
    }
    /**
     * 通过id查询
     *
     * @param id