“linengliang”
2023-09-06 8b825a12d64065dd9d8054e5247e374f6cec5390
lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/InspectionCycleController.java
@@ -21,6 +21,7 @@
import org.jeecg.common.util.DateUtils;
import org.jeecg.modules.eam.entity.*;
import org.jeecg.modules.eam.mapper.InspectionCycleMapper;
import org.jeecg.modules.eam.service.IInspectionCycleService;
import org.jeecg.modules.eam.service.IInspectionProjectService;
@@ -55,6 +56,9 @@
    @Autowired
    private ISysBaseAPI sysBaseApi;
    @Autowired
    private InspectionCycleMapper inspectionCycleMapper;
//
//
//    @Autowired
@@ -125,6 +129,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();
        inspectionCycle.setCode(num);
        inspectionCycleService.save(inspectionCycle);
        return Result.OK("添加成功!");
    }
@@ -342,6 +348,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("版本升级成功!");
@@ -376,8 +384,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("编辑成功!");