|
|
@@ -11,6 +11,7 @@ import com.seecoder.dataanalysis.logic.parser.LogParsingService;
|
|
|
import com.seecoder.dataanalysis.logic.parser.ParsingException;
|
|
|
import com.seecoder.dataanalysis.logic.parser.convertor.LogConvertor;
|
|
|
import com.seecoder.dataanalysis.util.JsonUtil;
|
|
|
+import com.seecoder.dataanalysis.util.Messages;
|
|
|
import com.seecoder.dataanalysis.vo.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -110,7 +111,7 @@ public class LogParsingServiceImpl implements LogParsingService {
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void saveToDb(Object data, String className) {
|
|
|
+ private void saveToDb(Object data, String className) throws ParsingException {
|
|
|
if (className.equals(EvalExamInfoDTO.class.getName())) {
|
|
|
EvalExamInfo info = LogConvertor.convertToEvalExamInfoEntity((EvalExamInfoDTO) data);
|
|
|
evalExamInfoDao.save(info);
|
|
|
@@ -121,8 +122,11 @@ public class LogParsingServiceImpl implements LogParsingService {
|
|
|
|
|
|
} else if (className.equals(BugInfoDTO.class.getName())) {
|
|
|
BugInfoDTO bugInfoDTO = (BugInfoDTO) data;
|
|
|
- BugInfo info = LogConvertor.convertToBugInfoEntity(bugInfoDTO);
|
|
|
+ if (bugInfoDTO.getProjectId() == null) {
|
|
|
+ throw new ParsingException(Messages.PROJECT_ID_NOT_FOUND, 3, data.toString());
|
|
|
+ }
|
|
|
|
|
|
+ BugInfo info = LogConvertor.convertToBugInfoEntity(bugInfoDTO);
|
|
|
Optional<DevcloudInfo> devcloudInfo = devcloudInfoDao.findById(bugInfoDTO.getProjectId());
|
|
|
DevcloudInfo devcloudInfoEntity = devcloudInfo.orElseGet(() -> createDevCloudInfo(bugInfoDTO.getProjectId()));
|
|
|
devcloudInfoEntity.getBugList().add(info);
|
|
|
@@ -130,8 +134,11 @@ public class LogParsingServiceImpl implements LogParsingService {
|
|
|
|
|
|
} else if (className.equals(CommitInfoDTO.class.getName())) {
|
|
|
CommitInfoDTO commitInfoDTO = (CommitInfoDTO) data;
|
|
|
- CommitInfo info = LogConvertor.convertToCommitInfoEntity(commitInfoDTO);
|
|
|
+ if (commitInfoDTO.getProjectId() == null) {
|
|
|
+ throw new ParsingException(Messages.PROJECT_ID_NOT_FOUND, 3, data.toString());
|
|
|
+ }
|
|
|
|
|
|
+ CommitInfo info = LogConvertor.convertToCommitInfoEntity(commitInfoDTO);
|
|
|
Optional<DevcloudInfo> devcloudInfo = devcloudInfoDao.findById(commitInfoDTO.getProjectId());
|
|
|
DevcloudInfo devcloudInfoEntity = devcloudInfo.orElseGet(() -> createDevCloudInfo(commitInfoDTO.getProjectId()));
|
|
|
devcloudInfoEntity.getCommitList().add(info);
|
|
|
@@ -139,8 +146,11 @@ public class LogParsingServiceImpl implements LogParsingService {
|
|
|
|
|
|
} else if (className.equals(TestInfoDTO.class.getName())) {
|
|
|
TestInfoDTO testInfoDTO = (TestInfoDTO) data;
|
|
|
- TestInfo info = LogConvertor.convertToTestInfoEntity(testInfoDTO);
|
|
|
+ if (testInfoDTO.getProjectId() == null) {
|
|
|
+ throw new ParsingException(Messages.PROJECT_ID_NOT_FOUND, 3, data.toString());
|
|
|
+ }
|
|
|
|
|
|
+ TestInfo info = LogConvertor.convertToTestInfoEntity(testInfoDTO);
|
|
|
Optional<DevcloudInfo> devcloudInfo = devcloudInfoDao.findById(testInfoDTO.getProjectId());
|
|
|
DevcloudInfo devcloudInfoEntity = devcloudInfo.orElseGet(() -> createDevCloudInfo(testInfoDTO.getProjectId()));
|
|
|
devcloudInfoEntity.getTestList().add(info);
|
|
|
@@ -148,9 +158,12 @@ public class LogParsingServiceImpl implements LogParsingService {
|
|
|
|
|
|
} else if (className.equals(PipelineCreationDTO.class.getName())) {
|
|
|
PipelineCreationDTO creationDTO = (PipelineCreationDTO) data;
|
|
|
+ if (creationDTO.getProjectId() == null) {
|
|
|
+ throw new ParsingException(Messages.PROJECT_ID_NOT_FOUND, 3, data.toString());
|
|
|
+ }
|
|
|
+
|
|
|
Optional<DevcloudInfo> devcloudInfo = devcloudInfoDao.findById(creationDTO.getProjectId());
|
|
|
DevcloudInfo devcloudInfoEntity = devcloudInfo.orElseGet(() -> createDevCloudInfo(creationDTO.getProjectId()));
|
|
|
-
|
|
|
PipelineInfo pipelineInfo = new PipelineInfo();
|
|
|
pipelineInfo.setPipelineId(creationDTO.getPipelineId());
|
|
|
devcloudInfoEntity.getPipelineList().add(pipelineInfo);
|
|
|
@@ -185,8 +198,11 @@ public class LogParsingServiceImpl implements LogParsingService {
|
|
|
|
|
|
} else if (className.equals(TreeNodeInfoDTO.class.getName())) {
|
|
|
TreeNodeInfoDTO nodeInfoDTO = (TreeNodeInfoDTO) data;
|
|
|
- TreeNodeInfo info = LogConvertor.convertToTreeNodeInfoEntity(nodeInfoDTO);
|
|
|
+ if (nodeInfoDTO.getProjectId() == null) {
|
|
|
+ throw new ParsingException(Messages.PROJECT_ID_NOT_FOUND, 3, data.toString());
|
|
|
+ }
|
|
|
|
|
|
+ TreeNodeInfo info = LogConvertor.convertToTreeNodeInfoEntity(nodeInfoDTO);
|
|
|
Optional<DevcloudInfo> devcloudInfo = devcloudInfoDao.findById(nodeInfoDTO.getProjectId());
|
|
|
DevcloudInfo devcloudInfoEntity = devcloudInfo.orElseGet(() -> createDevCloudInfo(nodeInfoDTO.getProjectId()));
|
|
|
devcloudInfoEntity.getTreeNodeList().add(info);
|