hyingbo
2025-06-06 a3cb768d958e64625786857e0db69335875f5d8e
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/InspectionCycleController.java
@@ -25,7 +25,9 @@
import org.jeecg.modules.eam.service.IInspectionCycleService;
import org.jeecg.modules.eam.service.IInspectionProjectService;
import org.jeecg.modules.eam.service.IdentityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
@@ -59,6 +61,12 @@
    @Autowired
    private InspectionCycleMapper inspectionCycleMapper;
    @Autowired
    @Lazy
    private IdentityService sysIdentityService;
//
//
//    @Autowired
@@ -129,7 +137,8 @@
    public Result<String> addNew(@RequestBody InspectionCycle inspectionCycle) {
        String cycleUnit = sysBaseApi.queryDictTextByKey("cycle_unit", String.valueOf(inspectionCycle.getCycleUnit()));
        inspectionCycle.setName(String.valueOf(inspectionCycle.getCycle()).concat(cycleUnit));
        String num = "DJ" + DateUtils.date2Str(DateUtils.yyyyMMdd.get()) + inspectionCycleMapper.getInspectionCycleNum();
//        String num = "DJ" + DateUtils.date2Str(DateUtils.yyyyMMdd.get()) + inspectionCycleMapper.getInspectionCycleNum();
        String num = sysIdentityService.getNumByTypeAndLength("InspectionCycle", 4);
        inspectionCycle.setCode(num);
        inspectionCycleService.save(inspectionCycle);
        return Result.OK("添加成功!");
@@ -348,6 +357,8 @@
        inspectionCycle.setCreateTime(new Date());
        inspectionCycle.setUpdateBy(null);
        inspectionCycle.setUpdateTime(null);
        inspectionCycle.setLoseEfficacyTime(null);
        inspectionCycle.setTakeEffectTime(null);
        boolean b = inspectionCycleService.save(inspectionCycle);
        if(b){
            return Result.OK("版本升级成功!");
@@ -382,8 +393,10 @@
        List<InspectionCycle> list = inspectionCycleService.lambdaQuery().eq(InspectionCycle::getCode, inspectionCycle.getCode()).eq(InspectionCycle::getVersionStatus, "2").list();
        for (InspectionCycle cycle : list) {
            cycle.setVersionStatus("3");
            cycle.setLoseEfficacyTime(new Date());
            inspectionCycleService.updateById(cycle);
        }
        inspectionCycle.setTakeEffectTime(new Date());
        boolean b = inspectionCycleService.updateById(inspectionCycle);
        if (b){
            return Result.OK("编辑成功!");