zhangherong
2025-07-08 3bc2339aa32cb6c3704bdb3a244c99b8d93ff39d
art:技术状态鉴定规范-相关接口提交
已修改4个文件
125 ■■■■ 文件已修改
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationStandardController.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamTechnicalStatusEvaluationStandardService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardServiceImpl.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-eam-common/src/main/java/org/jeecg/modules/eam/constant/BusinessCodeConst.java
@@ -26,7 +26,9 @@
    //设备调拨编码规则
    String TRANSFER_CODE_RULE = "EquipmentTransferCodeRule";
    //设备调拨编码规则
        String SCRAP_CODE_RULE = "EquipmentScrapCodeRule";
    String SCRAP_CODE_RULE = "EquipmentScrapCodeRule";
    //技术状态鉴定规范编码规则
    String TECHNICAL_STATUS_EVALUATION_STANDARD_CODE_RULE = "TechnicalStatusStandardCodeRule";
    /**
     * 备件请购单状态 1:已创建 2:已提交 3:已通过 4:已驳回 5:已完成
     */
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/EamTechnicalStatusEvaluationStandardController.java
@@ -8,8 +8,11 @@
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.TechnicalStatusEvaluationStandardEnum;
import org.jeecg.modules.eam.entity.EamMaintenanceStandard;
import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandard;
import org.jeecg.modules.eam.request.EamTechnicalStatusEvaluationStandardRequest;
import org.jeecg.modules.eam.service.IEamTechnicalStatusEvaluationStandardService;
@@ -19,7 +22,6 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
/**
 * @Description: 技术状态鉴定规范
@@ -71,7 +73,7 @@
        if (CollectionUtil.isEmpty(request.getTableDetailList())) {
            return Result.error("检查项不能为空!");
        }
        String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.MAINTENANCE_STANDARD_CODE_RULE);
        String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.TECHNICAL_STATUS_EVALUATION_STANDARD_CODE_RULE);
        request.setStandardCode(codeSeq);
        boolean b = eamTechnicalStatusEvaluationStandardService.addEamTechnicalStatusEvaluationStandard(request);
        if (!b) {
@@ -104,31 +106,28 @@
    }
    /**
     * 通过id删除
     * 升版
     *
     * @param id
     * @param request
     * @return
     */
    @AutoLog(value = "技术状态鉴定规范-通过id删除")
    @ApiOperation(value = "技术状态鉴定规范-通过id删除", notes = "技术状态鉴定规范-通过id删除")
    @DeleteMapping(value = "/delete")
    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
        eamTechnicalStatusEvaluationStandardService.removeById(id);
        return Result.OK("删除成功!");
    }
    /**
     * 批量删除
     *
     * @param ids
     * @return
     */
    @AutoLog(value = "技术状态鉴定规范-批量删除")
    @ApiOperation(value = "技术状态鉴定规范-批量删除", notes = "技术状态鉴定规范-批量删除")
    @DeleteMapping(value = "/deleteBatch")
    public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
        this.eamTechnicalStatusEvaluationStandardService.removeByIds(Arrays.asList(ids.split(",")));
        return Result.OK("批量删除成功!");
    @AutoLog(value = "技术状态鉴定规范-升版")
    @ApiOperation(value = "技术状态鉴定规范-升版", notes = "技术状态鉴定规范-升版")
    @PutMapping(value = "/upgrade")
    public Result<?> upgrade(@RequestBody EamTechnicalStatusEvaluationStandardRequest request) {
        if (request == null) {
            return Result.error("添加的对象不能为空!");
        }
        if (CollectionUtil.isEmpty(request.getTableDetailList())) {
            return Result.error("保养项不能为空!");
        }
        String codeSeq = businessCodeRuleService.generateBusinessCodeSeq(BusinessCodeConst.TECHNICAL_STATUS_EVALUATION_STANDARD_CODE_RULE);
        request.setStandardCode(codeSeq);
        boolean b = eamTechnicalStatusEvaluationStandardService.upgrade(request);
        if (!b) {
            return Result.error("升版失败!");
        }
        return Result.OK("升版成功!");
    }
    /**
@@ -146,6 +145,23 @@
    }
    /**
     * 提交
     * @param id
     * @return
     */
    @AutoLog(value = "技术状态鉴定规范-提交")
    @ApiOperation(value = "技术状态鉴定规范-提交", notes = "技术状态鉴定规范-提交")
    @GetMapping(value = "/submit")
    public Result<?> submit(@RequestParam(name = "id", required = true) String id) {
        EamTechnicalStatusEvaluationStandard entity = eamTechnicalStatusEvaluationStandardService.getById(id);
        if (entity != null) {
            entity.setStandardStatus(TechnicalStatusEvaluationStandardEnum.ENABLE.name());
            eamTechnicalStatusEvaluationStandardService.updateById(entity);
        }
        return Result.OK("删除成功!");
    }
    /**
     * 通过excel导入数据
     *
     * @param request
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IEamTechnicalStatusEvaluationStandardService.java
@@ -43,4 +43,11 @@
     * @return
     */
    boolean editEamTechnicalStatusEvaluationStandard(EamTechnicalStatusEvaluationStandardRequest request);
    /**
     * 升版
     * @param request
     * @return
     */
    boolean upgrade(EamTechnicalStatusEvaluationStandardRequest request);
}
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/EamTechnicalStatusEvaluationStandardServiceImpl.java
@@ -6,6 +6,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.constant.CommonConstant;
@@ -16,10 +17,7 @@
import org.jeecg.modules.eam.base.entity.BaseFactoryUser;
import org.jeecg.modules.eam.base.service.IBaseFactoryService;
import org.jeecg.modules.eam.base.service.IBaseFactoryUserService;
import org.jeecg.modules.eam.constant.MaintenanceStandardStatusEnum;
import org.jeecg.modules.eam.constant.TechnicalStatusEvaluationStandardEnum;
import org.jeecg.modules.eam.entity.EamMaintenanceStandard;
import org.jeecg.modules.eam.entity.EamMaintenanceStandardDetail;
import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandard;
import org.jeecg.modules.eam.entity.EamTechnicalStatusEvaluationStandardDetail;
import org.jeecg.modules.eam.mapper.EamTechnicalStatusEvaluationStandardMapper;
@@ -29,8 +27,6 @@
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
@@ -183,4 +179,48 @@
        }
        return true;
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean upgrade(EamTechnicalStatusEvaluationStandardRequest request) {
        EamTechnicalStatusEvaluationStandard entity = this.getBaseMapper().selectById(request.getId());
        if(entity == null){
            throw new JeecgBootException("升版的数据已删除,请刷新重试!");
        }
        //新增一个版本
        EamTechnicalStatusEvaluationStandard newEntity = new EamTechnicalStatusEvaluationStandard();
        newEntity.setStandardCode(request.getStandardCode());
        newEntity.setStandardName(request.getStandardName());
        newEntity.setEvaluationPeriod(request.getEvaluationPeriod());
        newEntity.setStandardStatus(TechnicalStatusEvaluationStandardEnum.ENABLE.name());
        //版本递增
        newEntity.setStandardVersion(SimpleVersionGenerateUtil.addVersion(entity.getStandardVersion()));
        //设备处理
        newEntity.setEquipmentId(request.getEquipmentId());
        //删除标记
        newEntity.setDelFlag(CommonConstant.DEL_FLAG_0);
        //重复性校验
        EamTechnicalStatusEvaluationStandard exist = checkDuplicate(newEntity.getEquipmentId(), entity.getId());
        if(exist != null){
            throw new JeecgBootException("鉴定规范已存在,不能重复添加!");
        }
        this.getBaseMapper().insert(newEntity);
        //处理明细数据
        if(CollectionUtil.isNotEmpty(request.getTableDetailList())) {
            request.getTableDetailList().forEach(tableDetail -> {
                tableDetail.setId(null);
                tableDetail.setCreateBy(null);
                tableDetail.setUpdateBy(null);
                tableDetail.setCreateTime(null);
                tableDetail.setUpdateTime(null);
                tableDetail.setStandardId(newEntity.getId());
            });
            standardDetailService.saveBatch(request.getTableDetailList());
        }
        //禁用原来的版本
        entity.setStandardStatus(TechnicalStatusEvaluationStandardEnum.DISABLE.name());
        this.getBaseMapper().updateById(entity);
        return true;
    }
}