|
@@ -18,7 +18,10 @@ import api.common.pojo.po.model.VehiclePO;
|
|
|
import api.common.pojo.po.project.*;
|
|
|
import api.common.pojo.po.scene.ScenePackagePO;
|
|
|
import api.common.pojo.vo.project.*;
|
|
|
-import api.common.util.*;
|
|
|
+import api.common.util.JsonUtil;
|
|
|
+import api.common.util.ObjectUtil;
|
|
|
+import api.common.util.StringUtil;
|
|
|
+import api.common.util.TimeUtil;
|
|
|
import com.css.simulation.resource.algorithm.mapper.AlgorithmMapper;
|
|
|
import com.css.simulation.resource.algorithm.service.AlgorithmService;
|
|
|
import com.css.simulation.resource.common.utils.AuthUtil;
|
|
@@ -44,7 +47,6 @@ import feign.Response;
|
|
|
import lombok.SneakyThrows;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.scheduling.support.CronExpression;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
@@ -58,8 +60,8 @@ import java.math.RoundingMode;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.*;
|
|
|
import java.util.List;
|
|
|
+import java.util.*;
|
|
|
import java.util.zip.ZipEntry;
|
|
|
import java.util.zip.ZipOutputStream;
|
|
|
|
|
@@ -67,31 +69,27 @@ import java.util.zip.ZipOutputStream;
|
|
|
@Slf4j
|
|
|
public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
|
|
|
- @Autowired
|
|
|
- private SimulationProjectMapper simulationProjectMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private SimulationAutomaticProjectMapper simulationAutomaticProjectMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private SimulationProjectTaskMapper simulationProjectTaskMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private SimulationAutomaticSubProjectMapper simulationAutomaticSubProjectMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private SimulationMptFirstTargetScoreMapper simulationMptFirstTargetScoreMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private SimulationMptLastTargetScoreMapper simulationMptLastTargetScoreMapper;
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private AlgorithmMapper algorithmMapper;
|
|
|
-
|
|
|
@Resource
|
|
|
- private KafkaService kafkaService;
|
|
|
-
|
|
|
- @Autowired
|
|
|
+ SimulationProjectMapper simulationProjectMapper;
|
|
|
+ @Resource
|
|
|
+ ManualProjectMapper manualProjectMapper;
|
|
|
+ @Resource
|
|
|
+ AutoSubProjectMapper autoSubProjectMapper;
|
|
|
+ @Resource
|
|
|
+ SimulationAutomaticProjectMapper simulationAutomaticProjectMapper;
|
|
|
+ @Resource
|
|
|
+ SimulationProjectTaskMapper simulationProjectTaskMapper;
|
|
|
+ @Resource
|
|
|
+ SimulationAutomaticSubProjectMapper simulationAutomaticSubProjectMapper;
|
|
|
+ @Resource
|
|
|
+ SimulationMptFirstTargetScoreMapper simulationMptFirstTargetScoreMapper;
|
|
|
+ @Resource
|
|
|
+ SimulationMptLastTargetScoreMapper simulationMptLastTargetScoreMapper;
|
|
|
+ @Resource
|
|
|
+ AlgorithmMapper algorithmMapper;
|
|
|
+ @Resource
|
|
|
+ KafkaService kafkaService;
|
|
|
+ @Resource
|
|
|
DictService dictService;
|
|
|
|
|
|
@Resource
|
|
@@ -3242,35 +3240,37 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResponseBodyVO saveEvaluationLevel(SimulationManualProjectParam param) {
|
|
|
+ public ResponseBodyVO<String> saveEvaluationLevel(SimulationManualProjectParam param) {
|
|
|
|
|
|
- String id = param.getId();
|
|
|
- if (StringUtil.isEmpty(id)) {
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "工作id不能为空");
|
|
|
- }
|
|
|
- if (isEmpty(param.getProjectType())) {
|
|
|
- param.setProjectType("1");//默认
|
|
|
+ String projectId = param.getId();
|
|
|
+
|
|
|
+ //1 根据 projectId 获取类型 projectType
|
|
|
+ String projectType = null;
|
|
|
+ SchedulerProjectPO manualProjectPO = manualProjectMapper.selectById(projectId);
|
|
|
+ SchedulerProjectPO autoSubProjectPO = autoSubProjectMapper.selectById(projectId);
|
|
|
+ if (manualProjectPO != null) {
|
|
|
+ projectType = DictConstants.PROJECT_TYPE_MANUAL;
|
|
|
+ } else if (autoSubProjectPO != null) {
|
|
|
+ projectType = DictConstants.PROJECT_TYPE_AUTO_SUB;
|
|
|
}
|
|
|
|
|
|
- String scene = "";
|
|
|
- //手动运行
|
|
|
- if ("1".equals(param.getProjectType())) {
|
|
|
|
|
|
- SimulationManualProjectPo po = simulationProjectMapper.selectProjectBaseById(param);
|
|
|
- if (po == null) {
|
|
|
+ String scene = "";
|
|
|
+ // 手动运行
|
|
|
+ if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
|
+ SimulationManualProjectPo simulationManualProjectPo = simulationProjectMapper.selectProjectBaseById(param);
|
|
|
+ if (simulationManualProjectPo == null) {
|
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "没有查到工作信息");
|
|
|
}
|
|
|
- scene = po.getScene();
|
|
|
-
|
|
|
+ scene = simulationManualProjectPo.getScene();
|
|
|
}
|
|
|
- //自动运行
|
|
|
- else if ("2".equals(param.getProjectType())) {
|
|
|
- SimulationManualProjectVo pv = simulationAutomaticSubProjectMapper.selectProjectInfo(param);
|
|
|
- if (pv == null) {
|
|
|
+ // 自动运行
|
|
|
+ else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
|
+ SimulationManualProjectVo simulationManualProjectVo = simulationAutomaticSubProjectMapper.selectProjectInfo(param);
|
|
|
+ if (simulationManualProjectVo == null) {
|
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "没有查到工作信息");
|
|
|
}
|
|
|
- scene = pv.getScene();
|
|
|
-
|
|
|
+ scene = simulationManualProjectVo.getScene();
|
|
|
}
|
|
|
|
|
|
//TODO 该段代码可优化,有时间再优化
|
|
@@ -3279,9 +3279,9 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
String evaluationLevelReport = "";
|
|
|
|
|
|
if (!isEmpty(scenePackageSubListVOS)) {
|
|
|
- Double totalScore = 0D;
|
|
|
+ double totalScore = 0D;
|
|
|
for (ScenePackageSubListVO v : scenePackageSubListVOS) {
|
|
|
- Double weightDouble = Double.valueOf(v.getWeight());
|
|
|
+ double weightDouble = Double.parseDouble(v.getWeight());
|
|
|
//单个二级指标得分
|
|
|
SimulationMptFirstTargetScorePo simulationMptFirstTargetScorePo = new SimulationMptFirstTargetScorePo();
|
|
|
simulationMptFirstTargetScorePo.setPId(param.getId()); //直接(子)任务表id
|
|
@@ -3298,11 +3298,11 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
}
|
|
|
|
|
|
SimulationManualProjectPo simulationManualProjectPo = new SimulationManualProjectPo();
|
|
|
- simulationManualProjectPo.setId(id);
|
|
|
+ simulationManualProjectPo.setId(projectId);
|
|
|
simulationManualProjectPo.setEvaluationLevel(evaluationLevelReport);
|
|
|
simulationProjectMapper.saveEvaluationLevel(simulationManualProjectPo);
|
|
|
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
}
|
|
|
|
|
|
@Override
|