|
|
@@ -9,9 +9,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.vo.EvalExamInfoDTO;
|
|
|
-import com.seecoder.dataanalysis.vo.EvalExamRecordDTO;
|
|
|
-import com.seecoder.dataanalysis.vo.SimpleLog;
|
|
|
+import com.seecoder.dataanalysis.vo.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -64,16 +62,8 @@ public class LogParsingServiceImpl implements LogParsingService {
|
|
|
Class clazz = Class.forName(className);
|
|
|
Object data = JsonUtil.toObject(simpleLog.getData(), clazz);
|
|
|
|
|
|
- if (!save) {
|
|
|
- return (T) data;
|
|
|
- }
|
|
|
-
|
|
|
- if (className.equals(EvalExamInfoDTO.class.getName())) {
|
|
|
- EvalExamInfo info = LogConvertor.convertToEvalExamInfoEntity((EvalExamInfoDTO) data);
|
|
|
- evalExamInfoDao.save(info);
|
|
|
- } else if (className.equals(EvalExamRecordDTO.class.getName())) {
|
|
|
- EvalExamRecord record = LogConvertor.convertToEvalExamRecordEntity((EvalExamRecordDTO) data);
|
|
|
- evalExamRecordDao.save(record);
|
|
|
+ if (save) {
|
|
|
+ saveToDb(data, className);
|
|
|
}
|
|
|
return (T) data;
|
|
|
} catch (ClassNotFoundException|ClassCastException e){
|
|
|
@@ -100,5 +90,25 @@ public class LogParsingServiceImpl implements LogParsingService {
|
|
|
opTypesTable.put(0, EvalExamInfoDTO.class.getName()); //试卷数据
|
|
|
opTypesTable.put(1, EvalExamInfoDTO.class.getName()); //诗句更新数据
|
|
|
opTypesTable.put(2, EvalExamRecordDTO.class.getName()); //学生提交试卷
|
|
|
+
|
|
|
+ opTypesTable.put(100, BugInfoDTO.class.getName()); //修改缺陷信息
|
|
|
+ opTypesTable.put(101, CommitInfoDTO.class.getName()); //用户进行commit
|
|
|
+ opTypesTable.put(102, TestInfoDTO.class.getName()); //用户创建并执行接口测试
|
|
|
+ opTypesTable.put(103, PipelineCreationDTO.class.getName()); //用户创建流水线
|
|
|
+ opTypesTable.put(104, PipelineDeletionDTO.class.getName()); //用户删除流水线
|
|
|
+ opTypesTable.put(105, PipelineDeployDTO.class.getName()); //用户部署流水线
|
|
|
+ opTypesTable.put(106, TreeNodeInfoDTO.class.getName()); //用户插入/更新节点
|
|
|
+ opTypesTable.put(107, TreeNodeDeletionDTO.class.getName()); //用户删除节点
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void saveToDb(Object data, String className) {
|
|
|
+ if (className.equals(EvalExamInfoDTO.class.getName())) {
|
|
|
+ EvalExamInfo info = LogConvertor.convertToEvalExamInfoEntity((EvalExamInfoDTO) data);
|
|
|
+ evalExamInfoDao.save(info);
|
|
|
+ } else if (className.equals(EvalExamRecordDTO.class.getName())) {
|
|
|
+ EvalExamRecord record = LogConvertor.convertToEvalExamRecordEntity((EvalExamRecordDTO) data);
|
|
|
+ evalExamRecordDao.save(record);
|
|
|
+ }
|
|
|
}
|
|
|
}
|