Просмотр исходного кода

fix: 若存在没有部署就进行功能测试完成、重新打开的操作导致空指针

370774330@qq.com 5 лет назад
Родитель
Сommit
abcb0c6355

+ 1 - 0
web/src/main/java/cn/seecoder/web/model/po/func_test/FuncTestRecordPO.java

@@ -23,6 +23,7 @@ public class FuncTestRecordPO {
 
     /**
      * 关联的流水线部署信息id
+     *  若还没进行过部署,插入值为-1
      */
     Integer pipelineRecordId;
 

+ 2 - 2
web/src/main/java/cn/seecoder/web/service/impl/func_test/FuncFuncTestServiceImpl.java

@@ -85,7 +85,7 @@ public class FuncFuncTestServiceImpl implements FuncTestService {
         funcTestRecordMapper.insert(FuncTestRecordPO.builder()
                 .timestamp(new Timestamp(System.currentTimeMillis()))
                 .operationType(FuncTestOperatorEnum.FINISH)
-                .pipelineRecordId(latestRecord.getId())
+                .pipelineRecordId(latestRecord==null?-1:latestRecord.getId())
                 .build(),"id");
     }
 
@@ -101,7 +101,7 @@ public class FuncFuncTestServiceImpl implements FuncTestService {
         funcTestRecordMapper.insert(FuncTestRecordPO.builder()
                 .timestamp(new Timestamp(System.currentTimeMillis()))
                 .operationType(FuncTestOperatorEnum.REOPEN)
-                .pipelineRecordId(latestRecord.getId())
+                .pipelineRecordId(latestRecord==null?-1:latestRecord.getId())
                 .build(),"id");
     }