|
@@ -73,5321 +73,5324 @@ import java.util.zip.ZipOutputStream;
|
|
@Slf4j
|
|
@Slf4j
|
|
public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
|
|
|
- @Resource
|
|
|
|
- private SimulationProjectMapper simulationProjectMapper;
|
|
|
|
- @Resource
|
|
|
|
- private ManualProjectMapper manualProjectMapper;
|
|
|
|
- @Resource
|
|
|
|
- private AutoSubProjectMapper autoSubProjectMapper;
|
|
|
|
- @Resource
|
|
|
|
- private SimulationAutomaticProjectMapper simulationAutomaticProjectMapper;
|
|
|
|
- @Resource
|
|
|
|
- private SimulationProjectTaskMapper simulationProjectTaskMapper;
|
|
|
|
- @Resource
|
|
|
|
- private SimulationAutomaticSubProjectMapper simulationAutomaticSubProjectMapper;
|
|
|
|
- @Resource
|
|
|
|
- private SimulationMptFirstTargetScoreMapper simulationMptFirstTargetScoreMapper;
|
|
|
|
- @Resource
|
|
|
|
- private SimulationMptLastTargetScoreMapper simulationMptLastTargetScoreMapper;
|
|
|
|
- @Resource
|
|
|
|
- private AlgorithmMapper algorithmMapper;
|
|
|
|
- @Resource
|
|
|
|
- private KafkaTemplate<String, String> kafkaTemplate;
|
|
|
|
- @Resource
|
|
|
|
- private DictService dictService;
|
|
|
|
- @Resource
|
|
|
|
- private AlgoPlatformService algoPlatformService;
|
|
|
|
- @Resource
|
|
|
|
- private FileDownService fileDownService;
|
|
|
|
- @Resource
|
|
|
|
- private AlgorithmService algorithmService;
|
|
|
|
- @Resource
|
|
|
|
- private MonitorService monitorService;
|
|
|
|
- @Resource
|
|
|
|
- private ProjectUtil projectUtil;
|
|
|
|
- @Resource
|
|
|
|
- private VehicleMapper vehicleMapper;
|
|
|
|
-
|
|
|
|
- // * -------------------------------- Comment --------------------------------
|
|
|
|
-
|
|
|
|
- private final String[] dateFmtArr = new String[]{"yyyyMMdd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd"};
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<String> addOrUpdateProject(SimulationManualProjectParam param) {
|
|
|
|
-
|
|
|
|
- if (isEmpty(param.getProjectName())) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "工作名称不能为空。");
|
|
|
|
- }
|
|
|
|
- SimulationManualProjectPo po = convertParamToPo(param);
|
|
|
|
-
|
|
|
|
- if (isEmpty(param.getId())) {
|
|
|
|
- // 工作名称一样的的不能创建
|
|
|
|
- List<SimulationManualProjectPo> simulationManualProjectPos = simulationProjectMapper.selectProjectByName(param);
|
|
|
|
- if (!isEmpty(simulationManualProjectPos)) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "工作名称已经存在,请修改后再保存。");
|
|
|
|
- }
|
|
|
|
- po.createPo(AuthUtil.getCurrentUserId());
|
|
|
|
- // 生成id
|
|
|
|
- createProjectId(po);
|
|
|
|
- int add = simulationProjectMapper.add(po);
|
|
|
|
- if (add > 0) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, ResponseBodyVO.Response.SUCCESS.getMessage(), po.getId());
|
|
|
|
- }
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "添加失败");
|
|
|
|
- } else {
|
|
|
|
- // 取工作状态,仅未开始的才可以修改信息
|
|
|
|
- SimulationManualProjectPo simulationManualProjectPo = simulationProjectMapper.selectProjectById(param);
|
|
|
|
- if (!ProjectRunStateEnum.NOT_START.getCode().equals(simulationManualProjectPo.getNowRunState())) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "当前状态不支持修改。");
|
|
|
|
- }
|
|
|
|
- po.updatePo(AuthUtil.getCurrentUserId());
|
|
|
|
- int update = simulationProjectMapper.update(po);
|
|
|
|
- if (update > 0) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, ResponseBodyVO.Response.SUCCESS.getMessage(), po.getId());
|
|
|
|
- }
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "修改失败。");
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private SimulationProjectMapper simulationProjectMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private ManualProjectMapper manualProjectMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private AutoSubProjectMapper autoSubProjectMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private SimulationAutomaticProjectMapper simulationAutomaticProjectMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private SimulationProjectTaskMapper simulationProjectTaskMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private SimulationAutomaticSubProjectMapper simulationAutomaticSubProjectMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private SimulationMptFirstTargetScoreMapper simulationMptFirstTargetScoreMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private SimulationMptLastTargetScoreMapper simulationMptLastTargetScoreMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private AlgorithmMapper algorithmMapper;
|
|
|
|
+ @Resource
|
|
|
|
+ private KafkaTemplate<String, String> kafkaTemplate;
|
|
|
|
+ @Resource
|
|
|
|
+ private DictService dictService;
|
|
|
|
+ @Resource
|
|
|
|
+ private AlgoPlatformService algoPlatformService;
|
|
|
|
+ @Resource
|
|
|
|
+ private FileDownService fileDownService;
|
|
|
|
+ @Resource
|
|
|
|
+ private AlgorithmService algorithmService;
|
|
|
|
+ @Resource
|
|
|
|
+ private MonitorService monitorService;
|
|
|
|
+ @Resource
|
|
|
|
+ private ProjectUtil projectUtil;
|
|
|
|
+ @Resource
|
|
|
|
+ private VehicleMapper vehicleMapper;
|
|
|
|
+
|
|
|
|
+ // * -------------------------------- Comment --------------------------------
|
|
|
|
+
|
|
|
|
+ private final String[] dateFmtArr = new String[]{"yyyyMMdd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd"};
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<String> addOrUpdateProject(SimulationManualProjectParam param) {
|
|
|
|
+
|
|
|
|
+ if (isEmpty(param.getProjectName())) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "工作名称不能为空。");
|
|
|
|
+ }
|
|
|
|
+ SimulationManualProjectPo po = convertParamToPo(param);
|
|
|
|
+
|
|
|
|
+ if (isEmpty(param.getId())) {
|
|
|
|
+ // 工作名称一样的的不能创建
|
|
|
|
+ List<SimulationManualProjectPo> simulationManualProjectPos = simulationProjectMapper.selectProjectByName(param);
|
|
|
|
+ if (!isEmpty(simulationManualProjectPos)) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "工作名称已经存在,请修改后再保存。");
|
|
|
|
+ }
|
|
|
|
+ po.createPo(AuthUtil.getCurrentUserId());
|
|
|
|
+ // 生成id
|
|
|
|
+ createProjectId(po);
|
|
|
|
+ int add = simulationProjectMapper.add(po);
|
|
|
|
+ if (add > 0) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, ResponseBodyVO.Response.SUCCESS.getMessage(), po.getId());
|
|
|
|
+ }
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "添加失败");
|
|
|
|
+ } else {
|
|
|
|
+ // 取工作状态,仅未开始的才可以修改信息
|
|
|
|
+ SimulationManualProjectPo simulationManualProjectPo = simulationProjectMapper.selectProjectById(param);
|
|
|
|
+ if (!ProjectRunStateEnum.NOT_START.getCode().equals(simulationManualProjectPo.getNowRunState())) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "当前状态不支持修改。");
|
|
|
|
+ }
|
|
|
|
+ po.updatePo(AuthUtil.getCurrentUserId());
|
|
|
|
+ int update = simulationProjectMapper.update(po);
|
|
|
|
+ if (update > 0) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, ResponseBodyVO.Response.SUCCESS.getMessage(), po.getId());
|
|
|
|
+ }
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "修改失败。");
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<PageInfo<SimulationManualProjectVo>> selectProject(SimulationManualProjectParam param) {
|
|
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<PageInfo<SimulationManualProjectVo>> selectProject(SimulationManualProjectParam param) {
|
|
|
|
|
|
+ // 设置当前用户id
|
|
|
|
+ param.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
|
|
+ if (!isEmpty(param.getCreateStartDate())) {
|
|
|
|
+ String createStartDate = param.getCreateStartDate();
|
|
|
|
+ Date startDate = getDate(createStartDate + " 00:00:00", 1);
|
|
|
|
+ if (startDate == null) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
+ }
|
|
|
|
+ param.setCreateTimeStart(startDate);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(param.getCreateEndDate())) {
|
|
|
|
+ String createEndDate = param.getCreateEndDate();
|
|
|
|
+ Date endDate = getDate(createEndDate + " 23:59:59", 1);
|
|
|
|
+ if (endDate == null) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
+ }
|
|
|
|
+ param.setCreateTimeEnd(endDate);
|
|
|
|
+ }
|
|
|
|
|
|
- // 设置当前用户id
|
|
|
|
- param.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
|
|
- if (!isEmpty(param.getCreateStartDate())) {
|
|
|
|
- String createStartDate = param.getCreateStartDate();
|
|
|
|
- Date startDate = getDate(createStartDate + " 00:00:00", 1);
|
|
|
|
- if (startDate == null) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
- }
|
|
|
|
- param.setCreateTimeStart(startDate);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(param.getCreateEndDate())) {
|
|
|
|
- String createEndDate = param.getCreateEndDate();
|
|
|
|
- Date endDate = getDate(createEndDate + " 23:59:59", 1);
|
|
|
|
- if (endDate == null) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
- }
|
|
|
|
- param.setCreateTimeEnd(endDate);
|
|
|
|
- }
|
|
|
|
|
|
+ if (!isEmpty(param.getFinishDateStart())) {
|
|
|
|
+ String finishDateStart = param.getFinishDateStart();
|
|
|
|
+ Date startDate = getDate(finishDateStart + " 00:00:00", 1);
|
|
|
|
+ if (startDate == null) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
+ }
|
|
|
|
+ param.setFinishTimeStart(startDate);
|
|
|
|
|
|
- if (!isEmpty(param.getFinishDateStart())) {
|
|
|
|
- String finishDateStart = param.getFinishDateStart();
|
|
|
|
- Date startDate = getDate(finishDateStart + " 00:00:00", 1);
|
|
|
|
- if (startDate == null) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
- }
|
|
|
|
- param.setFinishTimeStart(startDate);
|
|
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(param.getFinishDateEnd())) {
|
|
|
|
+ String finishDateEnd = param.getFinishDateEnd();
|
|
|
|
+ Date endDate = getDate(finishDateEnd + " 23:59:59", 1);
|
|
|
|
+ if (endDate == null) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
+ }
|
|
|
|
+ param.setFinishTimeEnd(endDate);
|
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(param.getFinishDateEnd())) {
|
|
|
|
- String finishDateEnd = param.getFinishDateEnd();
|
|
|
|
- Date endDate = getDate(finishDateEnd + " 23:59:59", 1);
|
|
|
|
- if (endDate == null) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
- }
|
|
|
|
- param.setFinishTimeEnd(endDate);
|
|
|
|
- }
|
|
|
|
|
|
+ // 查询有效数据
|
|
|
|
+ param.setIsDeleted("0");
|
|
|
|
+ setPage(param.getCurrentPage() == null ? 1 : param.getCurrentPage(), param.getPageSize() == null ? 10 : param.getPageSize());
|
|
|
|
+ List<SimulationManualProjectVo> vos = simulationProjectMapper.selectProjectList(param); // 查出来的 algorithm
|
|
|
|
+ // 字段内容是算法 id
|
|
|
|
+ PageInfo<SimulationManualProjectVo> pageInfo = new PageInfo<>(vos);
|
|
|
|
|
|
- // 查询有效数据
|
|
|
|
- param.setIsDeleted("0");
|
|
|
|
- setPage(param.getCurrentPage() == null ? 1 : param.getCurrentPage(), param.getPageSize() == null ? 10 : param.getPageSize());
|
|
|
|
- List<SimulationManualProjectVo> vos = simulationProjectMapper.selectProjectList(param); // 查出来的 algorithm
|
|
|
|
- // 字段内容是算法 id
|
|
|
|
- PageInfo<SimulationManualProjectVo> pageInfo = new PageInfo<>(vos);
|
|
|
|
|
|
+ for (SimulationManualProjectVo simulationManualProjectVo : pageInfo.getList()) {
|
|
|
|
+ convertPoToVo(simulationManualProjectVo, false); // 同时将算法 id 转换成算法名称
|
|
|
|
+ }
|
|
|
|
|
|
- for (SimulationManualProjectVo simulationManualProjectVo : pageInfo.getList()) {
|
|
|
|
- convertPoToVo(simulationManualProjectVo, false); // 同时将算法 id 转换成算法名称
|
|
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, pageInfo);
|
|
}
|
|
}
|
|
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, pageInfo);
|
|
|
|
- }
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<SimulationManualProjectSingleVo> selectProjectById(SimulationManualProjectParam param) {
|
|
|
|
+ if (isEmpty(param.getId())) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
+ }
|
|
|
|
+ SimulationManualProjectPo po = simulationProjectMapper.selectProjectById(param);
|
|
|
|
+ if (po == null) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "没有获取到数据。");
|
|
|
|
+ }
|
|
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<SimulationManualProjectSingleVo> selectProjectById(SimulationManualProjectParam param) {
|
|
|
|
- if (isEmpty(param.getId())) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
- }
|
|
|
|
- SimulationManualProjectPo po = simulationProjectMapper.selectProjectById(param);
|
|
|
|
- if (po == null) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "没有获取到数据。");
|
|
|
|
- }
|
|
|
|
|
|
+ SimulationManualProjectSingleVo vo = new SimulationManualProjectSingleVo();
|
|
|
|
+ convertPoToVo(po, vo);
|
|
|
|
+ if (ObjectUtil.isNotNull(po.getAlgorithmArray())) {
|
|
|
|
+ vo.setAlgorithmArrayS(po.getAlgorithmArray().split(","));
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.isNotNull(po.getVehicleArray())) {
|
|
|
|
+ vo.setVehicleArrayS(po.getVehicleArray().split(","));
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.isNotNull(po.getSceneArray())) {
|
|
|
|
+ vo.setSceneArrayS(po.getSceneArray().split(","));
|
|
|
|
+ }
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, vo);
|
|
|
|
|
|
- SimulationManualProjectSingleVo vo = new SimulationManualProjectSingleVo();
|
|
|
|
- convertPoToVo(po, vo);
|
|
|
|
- if (ObjectUtil.isNotNull(po.getAlgorithmArray())) {
|
|
|
|
- vo.setAlgorithmArrayS(po.getAlgorithmArray().split(","));
|
|
|
|
}
|
|
}
|
|
- if (ObjectUtil.isNotNull(po.getVehicleArray())) {
|
|
|
|
- vo.setVehicleArrayS(po.getVehicleArray().split(","));
|
|
|
|
- }
|
|
|
|
- if (ObjectUtil.isNotNull(po.getSceneArray())) {
|
|
|
|
- vo.setSceneArrayS(po.getSceneArray().split(","));
|
|
|
|
- }
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, vo);
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<String> deleteProjectByids(SimulationManualProjectParam param) {
|
|
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<String> deleteProjectByids(SimulationManualProjectParam param) {
|
|
|
|
|
|
+ String ids = param.getIds();
|
|
|
|
+ if (isEmpty(ids)) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
+ }
|
|
|
|
|
|
- String ids = param.getIds();
|
|
|
|
- if (isEmpty(ids)) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
- }
|
|
|
|
|
|
+ String[] idArr = ids.split(",");
|
|
|
|
|
|
- String[] idArr = ids.split(",");
|
|
|
|
|
|
+ // 仅有执行中的不能删除
|
|
|
|
+ List<SimulationManualProjectPo> pos = simulationProjectMapper.selectProjectNowRunState(idArr);
|
|
|
|
+ for (SimulationManualProjectPo p : pos) {
|
|
|
|
+ if (ProjectRunStateEnum.EXECUTION.getCode().equals(p.getNowRunState())) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "数据不支持删除。");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- // 仅有执行中的不能删除
|
|
|
|
- List<SimulationManualProjectPo> pos = simulationProjectMapper.selectProjectNowRunState(idArr);
|
|
|
|
- for (SimulationManualProjectPo p : pos) {
|
|
|
|
- if (ProjectRunStateEnum.EXECUTION.getCode().equals(p.getNowRunState())) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "数据不支持删除。");
|
|
|
|
- }
|
|
|
|
|
|
+ int i = simulationProjectMapper.deleteProject(idArr);
|
|
|
|
+ if (i > 0) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
|
+ }
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "删除失败。");
|
|
}
|
|
}
|
|
|
|
|
|
- int i = simulationProjectMapper.deleteProject(idArr);
|
|
|
|
- if (i > 0) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
|
- }
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "删除失败。");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 修改手动运行项目状态
|
|
|
|
- */
|
|
|
|
- @SneakyThrows
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<String> updateProjectNowRunState(SimulationManualProjectParam param) {
|
|
|
|
-
|
|
|
|
- // 1 查询项目详细信息
|
|
|
|
- SimulationManualProjectPo po = projectUtil.getProjectInfo(param);
|
|
|
|
- // 2 项目终止信息直接推送
|
|
|
|
- if (DictConstants.PROJECT_TERMINATED.equals(param.getNowRunState())) {
|
|
|
|
- projectStopToKafka(po);
|
|
|
|
- simulationProjectMapper.updateProjectNowRunState(param);
|
|
|
|
- } else {
|
|
|
|
- // 3 校验项目的信息是否可用
|
|
|
|
- projectUtil.checkProject(po.getAlgorithm(), po.getVehicle(), po.getScene());
|
|
|
|
- // 已经完成的项目再次运行
|
|
|
|
- if (DictConstants.PROJECT_COMPLETED.equals(po.getNowRunState())) {
|
|
|
|
- po.createPo(AuthUtil.getCurrentUserId());
|
|
|
|
- // 生成id
|
|
|
|
- createProjectId(po);
|
|
|
|
- // 初始化数据
|
|
|
|
- po.setNowRunState(param.getNowRunState());
|
|
|
|
- po.setEvaluationLevel("");
|
|
|
|
- po.setStartTime(new Date());
|
|
|
|
- po.setFinishTime(null);
|
|
|
|
- int add = simulationProjectMapper.add(po);
|
|
|
|
- if (add <= 0) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "生成新工作失败。");
|
|
|
|
- }
|
|
|
|
- // 查询项目详情信息并保存,固定项目最原始的运行数据
|
|
|
|
- String projectId = po.getId();
|
|
|
|
- ProjectDetailsVo info = selectProjectDetailsByIdBackUp(SimulationManualProjectParam.builder().id(projectId).projectType(DictConstants.PROJECT_TYPE_MANUAL).build()).getInfo();
|
|
|
|
- String infoJson = JsonUtil.beanToJson(info);
|
|
|
|
- // 保存項目詳情信息
|
|
|
|
- simulationProjectMapper.updateDetailsById(projectId, infoJson);
|
|
|
|
- // Kafka推送消息
|
|
|
|
- projectRunToKafka(po);
|
|
|
|
- } else { // 创建新的项目或者重新运行被终止的项目
|
|
|
|
- // 查询项目详情信息并保存
|
|
|
|
- String projectId = param.getId();
|
|
|
|
- ProjectDetailsVo info = selectProjectDetailsByIdBackUp(SimulationManualProjectParam.builder().id(projectId).projectType(DictConstants.PROJECT_TYPE_MANUAL).build()).getInfo();
|
|
|
|
- String infoJson = JsonUtil.beanToJson(info);
|
|
|
|
- log.info("项目 " + projectId + " 的详情信息为:" + infoJson);
|
|
|
|
- // 保存項目詳情信息
|
|
|
|
- simulationProjectMapper.updateDetailsById(projectId, infoJson);
|
|
|
|
- if ("20".equals(param.getNowRunState())) {
|
|
|
|
- // 设置开始时间
|
|
|
|
- param.setStartTime(new Date());
|
|
|
|
- // Kafka推送消息
|
|
|
|
- projectRunToKafka(po);
|
|
|
|
- } else if ("30".equals(param.getNowRunState())) {
|
|
|
|
- // 设置完成时间
|
|
|
|
- param.setFinishTime(new Date());
|
|
|
|
- }
|
|
|
|
- simulationProjectMapper.updateProjectNowRunState(param);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void projectRunToKafka(SimulationManualProjectPo po) {
|
|
|
|
- try {
|
|
|
|
- log.info("准备发送项目消息:" + po);
|
|
|
|
- SimulationManualProjectKafkaParam kafkaParam = new SimulationManualProjectKafkaParam();
|
|
|
|
- kafkaParam.setProjectId(po.getId());
|
|
|
|
- kafkaParam.setAlgorithmId(po.getAlgorithm());
|
|
|
|
- kafkaParam.setVehicleConfigId(po.getVehicle());
|
|
|
|
- kafkaParam.setScenePackageId(po.getScene());
|
|
|
|
- kafkaParam.setMaxSimulationTime(po.getMaxSimulationTime());
|
|
|
|
- kafkaParam.setParallelism(Integer.valueOf(po.getParallelism()));
|
|
|
|
- kafkaParam.setType(DictConstants.PROJECT_TYPE_MANUAL);
|
|
|
|
- kafkaParam.setModelType(vehicleMapper.selectParameterTypeById(po.getVehicle()));
|
|
|
|
- KafkaParameter kafkaParameter = new KafkaParameter();
|
|
|
|
- kafkaParameter.setTopic(ProjectConstants.RUN_TASK_TOPIC);
|
|
|
|
- String data = JsonUtil.beanToJson(kafkaParam);
|
|
|
|
- kafkaParameter.setData(data);
|
|
|
|
- log.info("推送项目运行消息到kafka:" + data);
|
|
|
|
- kafkaTemplate.send(kafkaParameter.getTopic(), kafkaParameter.getData()).addCallback(success -> {
|
|
|
|
- // 消息发送到的topic
|
|
|
|
- String topic = success.getRecordMetadata().topic();
|
|
|
|
- // 消息发送到的分区
|
|
|
|
- int partition = success.getRecordMetadata().partition();
|
|
|
|
- // 消息在分区内的offset
|
|
|
|
- long offset = success.getRecordMetadata().offset();
|
|
|
|
- log.info("发送消息成功,主题 topic 为:" + topic + ",分区 partition 为:" + partition + ",偏移量为:" + offset + ",消息体为:" + kafkaParameter.getData());
|
|
|
|
- }, failure -> log.error("发送消息失败:" + failure.getMessage()));
|
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
- throw new RuntimeException(e);
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 修改手动运行项目状态
|
|
|
|
+ */
|
|
|
|
+ @SneakyThrows
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<String> updateProjectNowRunState(SimulationManualProjectParam param) {
|
|
|
|
+
|
|
|
|
+ // 1 查询项目详细信息
|
|
|
|
+ SimulationManualProjectPo po = projectUtil.getProjectInfo(param);
|
|
|
|
+ // 2 项目终止信息直接推送
|
|
|
|
+ if (DictConstants.PROJECT_TERMINATED.equals(param.getNowRunState())) {
|
|
|
|
+ projectStopToKafka(po);
|
|
|
|
+ simulationProjectMapper.updateProjectNowRunState(param);
|
|
|
|
+ } else {
|
|
|
|
+ // 3 校验项目的信息是否可用
|
|
|
|
+ projectUtil.checkProject(po.getAlgorithm(), po.getVehicle(), po.getScene());
|
|
|
|
+ // 已经完成的项目再次运行
|
|
|
|
+ if (DictConstants.PROJECT_COMPLETED.equals(po.getNowRunState())) {
|
|
|
|
+ po.createPo(AuthUtil.getCurrentUserId());
|
|
|
|
+ // 生成id
|
|
|
|
+ createProjectId(po);
|
|
|
|
+ // 初始化数据
|
|
|
|
+ po.setNowRunState(param.getNowRunState());
|
|
|
|
+ po.setEvaluationLevel("");
|
|
|
|
+ po.setStartTime(new Date());
|
|
|
|
+ po.setFinishTime(null);
|
|
|
|
+ int add = simulationProjectMapper.add(po);
|
|
|
|
+ if (add <= 0) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "生成新工作失败。");
|
|
|
|
+ }
|
|
|
|
+ // 查询项目详情信息并保存,固定项目最原始的运行数据
|
|
|
|
+ String projectId = po.getId();
|
|
|
|
+ ProjectDetailsVo info = selectProjectDetailsByIdBackUp(SimulationManualProjectParam.builder().id(projectId).projectType(DictConstants.PROJECT_TYPE_MANUAL).build()).getInfo();
|
|
|
|
+ String infoJson = JsonUtil.beanToJson(info);
|
|
|
|
+ // 保存項目詳情信息
|
|
|
|
+ simulationProjectMapper.updateDetailsById(projectId, infoJson);
|
|
|
|
+ // Kafka推送消息
|
|
|
|
+ projectRunToKafka(po);
|
|
|
|
+ } else { // 创建新的项目或者重新运行被终止的项目
|
|
|
|
+ // 查询项目详情信息并保存
|
|
|
|
+ String projectId = param.getId();
|
|
|
|
+ ProjectDetailsVo info = selectProjectDetailsByIdBackUp(SimulationManualProjectParam.builder().id(projectId).projectType(DictConstants.PROJECT_TYPE_MANUAL).build()).getInfo();
|
|
|
|
+ String infoJson = JsonUtil.beanToJson(info);
|
|
|
|
+ log.info("项目 " + projectId + " 的详情信息为:" + infoJson);
|
|
|
|
+ // 保存项目详情信息
|
|
|
|
+ simulationProjectMapper.updateDetailsById(projectId, infoJson);
|
|
|
|
+// if (DictConstants.PROJECT_TERMINATED.equals(info.getNowRunState())) {
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+ if ("20".equals(param.getNowRunState())) {
|
|
|
|
+ // 设置开始时间
|
|
|
|
+ param.setStartTime(new Date());
|
|
|
|
+ // Kafka推送消息
|
|
|
|
+ projectRunToKafka(po);
|
|
|
|
+ } else if ("30".equals(param.getNowRunState())) {
|
|
|
|
+ // 设置完成时间
|
|
|
|
+ param.setFinishTime(new Date());
|
|
|
|
+ }
|
|
|
|
+ simulationProjectMapper.updateProjectNowRunState(param);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- private void projectStopToKafka(SimulationManualProjectPo po) {
|
|
|
|
- SimulationManualProjectKafkaParam kafkaParam = new SimulationManualProjectKafkaParam();
|
|
|
|
- kafkaParam.setProjectId(po.getId());
|
|
|
|
- kafkaParam.setType(DictConstants.PROJECT_TYPE_MANUAL);
|
|
|
|
- KafkaParameter kafkaParameter = new KafkaParameter();
|
|
|
|
- kafkaParameter.setTopic(ProjectConstants.STOP_TASK_TOPIC);
|
|
|
|
- String data = JsonUtil.beanToJson(kafkaParam);
|
|
|
|
- kafkaParameter.setData(data);
|
|
|
|
- log.info("推送项目中止消息到kafka:" + data);
|
|
|
|
- kafkaTemplate.send(kafkaParameter.getTopic(), kafkaParameter.getData()).addCallback(success -> {
|
|
|
|
- // 消息发送到的topic
|
|
|
|
- String topic = success.getRecordMetadata().topic();
|
|
|
|
- // 消息发送到的分区
|
|
|
|
- int partition = success.getRecordMetadata().partition();
|
|
|
|
- // 消息在分区内的offset
|
|
|
|
- long offset = success.getRecordMetadata().offset();
|
|
|
|
- log.info("------- 发送消息成功:主题 topic 为:" + topic + "分区 partition 为:" + partition + "偏移量为:" + offset + "消息体为:" + kafkaParameter.getData());
|
|
|
|
- }, failure -> log.error("发送消息失败:" + failure.getMessage()));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void autoProjectStopToKafka(SimulationAutomaticSubProjectPo po) {
|
|
|
|
- SimulationManualProjectKafkaParam kafkaParam = new SimulationManualProjectKafkaParam();
|
|
|
|
- kafkaParam.setProjectId(po.getId());
|
|
|
|
- kafkaParam.setType(DictConstants.PROJECT_TYPE_AUTO_SUB);
|
|
|
|
- KafkaParameter kafkaParameter = new KafkaParameter();
|
|
|
|
- kafkaParameter.setTopic(ProjectConstants.STOP_TASK_TOPIC);
|
|
|
|
- String data = JsonUtil.beanToJson(kafkaParam);
|
|
|
|
- kafkaParameter.setData(data);
|
|
|
|
- log.info("推送自动项目中止消息到kafka:" + data);
|
|
|
|
- // kafkaService.send(kafkaParameter);
|
|
|
|
- kafkaTemplate.send(kafkaParameter.getTopic(), kafkaParameter.getData()).addCallback(success -> {
|
|
|
|
- // 消息发送到的topic
|
|
|
|
- String topic = success.getRecordMetadata().topic();
|
|
|
|
- // 消息发送到的分区
|
|
|
|
- int partition = success.getRecordMetadata().partition();
|
|
|
|
- // 消息在分区内的offset
|
|
|
|
- long offset = success.getRecordMetadata().offset();
|
|
|
|
- log.info("------- 发送消息成功:\n" + "主题 topic 为:" + topic + "\n" + "分区 partition 为:" + partition + "\n" + "偏移量为:" + offset + "\n" + "消息体为:" + kafkaParameter.getData());
|
|
|
|
- }, failure -> log.error("发送消息失败:" + failure.getMessage()));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- @SneakyThrows
|
|
|
|
- public ResponseBodyVO<ProjectDetailsVo> selectProjectDetailsById(SimulationManualProjectParam param) {
|
|
|
|
-
|
|
|
|
- ProjectDetailsVo projectDetailsVo = null;
|
|
|
|
- if (DictConstants.PROJECT_TYPE_MANUAL.equals(param.getProjectType())) { // 手动运行任务
|
|
|
|
- SimulationManualProjectPo po = simulationProjectMapper.selectProjectById(param);
|
|
|
|
- projectDetailsVo = JsonUtil.jsonToBean(po.getDetails(), ProjectDetailsVo.class);
|
|
|
|
- projectDetailsVo.setEvaluationLevel(getDictName(DictConstants.EVALUATION_LEVEL, po.getEvaluationLevel()));
|
|
|
|
- projectDetailsVo.setStartTime(getRqStr(po.getStartTime(), 1));
|
|
|
|
- projectDetailsVo.setFinishTime(getRqStr(po.getFinishTime(), 1));
|
|
|
|
- projectDetailsVo.setNowRunState(po.getNowRunState());
|
|
|
|
- projectDetailsVo.setNowRunStateName(getDictName(DictConstants.PROJECT_RUN_STATE, po.getNowRunState()));
|
|
|
|
- } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(param.getProjectType())) {
|
|
|
|
- SimulationManualProjectVo po = simulationAutomaticSubProjectMapper.selectProjectInfo(param);
|
|
|
|
- projectDetailsVo = JsonUtil.jsonToBean(po.getDetails(), ProjectDetailsVo.class);
|
|
|
|
- projectDetailsVo.setEvaluationLevel(getDictName(DictConstants.EVALUATION_LEVEL, po.getEvaluationLevel()));
|
|
|
|
- projectDetailsVo.setStartTime(getRqStr(po.getStartTime(), 1));
|
|
|
|
- projectDetailsVo.setFinishTime(getRqStr(po.getFinishTime(), 1));
|
|
|
|
- projectDetailsVo.setNowRunState(po.getNowRunState());
|
|
|
|
- projectDetailsVo.setNowRunStateName(getDictName(DictConstants.PROJECT_RUN_STATE, po.getNowRunState()));
|
|
|
|
|
|
|
|
|
|
+ private void projectRunToKafka(SimulationManualProjectPo po) {
|
|
|
|
+ try {
|
|
|
|
+ log.info("准备发送项目消息:" + po);
|
|
|
|
+ SimulationManualProjectKafkaParam kafkaParam = new SimulationManualProjectKafkaParam();
|
|
|
|
+ kafkaParam.setProjectId(po.getId());
|
|
|
|
+ kafkaParam.setAlgorithmId(po.getAlgorithm());
|
|
|
|
+ kafkaParam.setVehicleConfigId(po.getVehicle());
|
|
|
|
+ kafkaParam.setScenePackageId(po.getScene());
|
|
|
|
+ kafkaParam.setMaxSimulationTime(po.getMaxSimulationTime());
|
|
|
|
+ kafkaParam.setParallelism(Integer.valueOf(po.getParallelism()));
|
|
|
|
+ kafkaParam.setType(DictConstants.PROJECT_TYPE_MANUAL);
|
|
|
|
+ kafkaParam.setModelType(vehicleMapper.selectParameterTypeById(po.getVehicle()));
|
|
|
|
+ KafkaParameter kafkaParameter = new KafkaParameter();
|
|
|
|
+ kafkaParameter.setTopic(ProjectConstants.RUN_TASK_TOPIC);
|
|
|
|
+ String data = JsonUtil.beanToJson(kafkaParam);
|
|
|
|
+ kafkaParameter.setData(data);
|
|
|
|
+ log.info("推送项目运行消息到kafka:" + data);
|
|
|
|
+ kafkaTemplate.send(kafkaParameter.getTopic(), kafkaParameter.getData()).addCallback(success -> {
|
|
|
|
+ // 消息发送到的topic
|
|
|
|
+ String topic = success.getRecordMetadata().topic();
|
|
|
|
+ // 消息发送到的分区
|
|
|
|
+ int partition = success.getRecordMetadata().partition();
|
|
|
|
+ // 消息在分区内的offset
|
|
|
|
+ long offset = success.getRecordMetadata().offset();
|
|
|
|
+ log.info("发送消息成功,主题 topic 为:" + topic + ",分区 partition 为:" + partition + ",偏移量为:" + offset + ",消息体为:" + kafkaParameter.getData());
|
|
|
|
+ }, failure -> log.error("发送消息失败:" + failure.getMessage()));
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void projectStopToKafka(SimulationManualProjectPo po) {
|
|
|
|
+ SimulationManualProjectKafkaParam kafkaParam = new SimulationManualProjectKafkaParam();
|
|
|
|
+ kafkaParam.setProjectId(po.getId());
|
|
|
|
+ kafkaParam.setType(DictConstants.PROJECT_TYPE_MANUAL);
|
|
|
|
+ KafkaParameter kafkaParameter = new KafkaParameter();
|
|
|
|
+ kafkaParameter.setTopic(ProjectConstants.STOP_TASK_TOPIC);
|
|
|
|
+ String data = JsonUtil.beanToJson(kafkaParam);
|
|
|
|
+ kafkaParameter.setData(data);
|
|
|
|
+ log.info("推送项目中止消息到kafka:" + data);
|
|
|
|
+ kafkaTemplate.send(kafkaParameter.getTopic(), kafkaParameter.getData()).addCallback(success -> {
|
|
|
|
+ // 消息发送到的topic
|
|
|
|
+ String topic = success.getRecordMetadata().topic();
|
|
|
|
+ // 消息发送到的分区
|
|
|
|
+ int partition = success.getRecordMetadata().partition();
|
|
|
|
+ // 消息在分区内的offset
|
|
|
|
+ long offset = success.getRecordMetadata().offset();
|
|
|
|
+ log.info("------- 发送消息成功:主题 topic 为:" + topic + "分区 partition 为:" + partition + "偏移量为:" + offset + "消息体为:" + kafkaParameter.getData());
|
|
|
|
+ }, failure -> log.error("发送消息失败:" + failure.getMessage()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void autoProjectStopToKafka(SimulationAutomaticSubProjectPo po) {
|
|
|
|
+ SimulationManualProjectKafkaParam kafkaParam = new SimulationManualProjectKafkaParam();
|
|
|
|
+ kafkaParam.setProjectId(po.getId());
|
|
|
|
+ kafkaParam.setType(DictConstants.PROJECT_TYPE_AUTO_SUB);
|
|
|
|
+ KafkaParameter kafkaParameter = new KafkaParameter();
|
|
|
|
+ kafkaParameter.setTopic(ProjectConstants.STOP_TASK_TOPIC);
|
|
|
|
+ String data = JsonUtil.beanToJson(kafkaParam);
|
|
|
|
+ kafkaParameter.setData(data);
|
|
|
|
+ log.info("推送自动项目中止消息到kafka:" + data);
|
|
|
|
+ // kafkaService.send(kafkaParameter);
|
|
|
|
+ kafkaTemplate.send(kafkaParameter.getTopic(), kafkaParameter.getData()).addCallback(success -> {
|
|
|
|
+ // 消息发送到的topic
|
|
|
|
+ String topic = success.getRecordMetadata().topic();
|
|
|
|
+ // 消息发送到的分区
|
|
|
|
+ int partition = success.getRecordMetadata().partition();
|
|
|
|
+ // 消息在分区内的offset
|
|
|
|
+ long offset = success.getRecordMetadata().offset();
|
|
|
|
+ log.info("------- 发送消息成功:\n" + "主题 topic 为:" + topic + "\n" + "分区 partition 为:" + partition + "\n" + "偏移量为:" + offset + "\n" + "消息体为:" + kafkaParameter.getData());
|
|
|
|
+ }, failure -> log.error("发送消息失败:" + failure.getMessage()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ @SneakyThrows
|
|
|
|
+ public ResponseBodyVO<ProjectDetailsVo> selectProjectDetailsById(SimulationManualProjectParam param) {
|
|
|
|
+
|
|
|
|
+ ProjectDetailsVo projectDetailsVo = null;
|
|
|
|
+ if (DictConstants.PROJECT_TYPE_MANUAL.equals(param.getProjectType())) { // 手动运行任务
|
|
|
|
+ SimulationManualProjectPo po = simulationProjectMapper.selectProjectById(param);
|
|
|
|
+ projectDetailsVo = JsonUtil.jsonToBean(po.getDetails(), ProjectDetailsVo.class);
|
|
|
|
+ projectDetailsVo.setEvaluationLevel(getDictName(DictConstants.EVALUATION_LEVEL, po.getEvaluationLevel()));
|
|
|
|
+ projectDetailsVo.setStartTime(getRqStr(po.getStartTime(), 1));
|
|
|
|
+ projectDetailsVo.setFinishTime(getRqStr(po.getFinishTime(), 1));
|
|
|
|
+ projectDetailsVo.setNowRunState(po.getNowRunState());
|
|
|
|
+ projectDetailsVo.setNowRunStateName(getDictName(DictConstants.PROJECT_RUN_STATE, po.getNowRunState()));
|
|
|
|
+ } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(param.getProjectType())) {
|
|
|
|
+ SimulationManualProjectVo po = simulationAutomaticSubProjectMapper.selectProjectInfo(param);
|
|
|
|
+ projectDetailsVo = JsonUtil.jsonToBean(po.getDetails(), ProjectDetailsVo.class);
|
|
|
|
+ projectDetailsVo.setEvaluationLevel(getDictName(DictConstants.EVALUATION_LEVEL, po.getEvaluationLevel()));
|
|
|
|
+ projectDetailsVo.setStartTime(getRqStr(po.getStartTime(), 1));
|
|
|
|
+ projectDetailsVo.setFinishTime(getRqStr(po.getFinishTime(), 1));
|
|
|
|
+ projectDetailsVo.setNowRunState(po.getNowRunState());
|
|
|
|
+ projectDetailsVo.setNowRunStateName(getDictName(DictConstants.PROJECT_RUN_STATE, po.getNowRunState()));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ // 获取测试得分列表
|
|
|
|
+ List<AlgorithmScoreVo> firstTargetScore = getFirstTargetScore(param.getId());
|
|
|
|
+ projectDetailsVo.setAlgorithmScoreList(firstTargetScore);
|
|
|
|
+ // 任务运行状态统计
|
|
|
|
+ List<ProjectRunStateNumVo> states = null;
|
|
|
|
+
|
|
|
|
+ // 任务运行结果统计
|
|
|
|
+ List<ProjectRunResultRatioNumVo> resultScoreList = null;
|
|
|
|
+
|
|
|
|
+ // 任务信息
|
|
|
|
+ ProjectTaskParam projectTaskParam = new ProjectTaskParam();
|
|
|
|
+ projectTaskParam.setPId(param.getId());
|
|
|
|
+ List<ProjectRunResultRatioNumVo> projectRunResultRatioNumVos = null;
|
|
|
|
+ Integer size = simulationProjectTaskMapper.selectProjectTaskNumByProjectId(projectTaskParam);
|
|
|
|
+ if (size > 0) {
|
|
|
|
+ states = simulationProjectTaskMapper.selectRunStateCount(param.getId());
|
|
|
|
+ taskRunState(states, size);
|
|
|
|
+ projectRunResultRatioNumVos = simulationProjectTaskMapper.selectRunResultCount(param.getId());
|
|
|
|
+ taskResultState(projectRunResultRatioNumVos, size);
|
|
|
|
+
|
|
|
|
+ resultScoreList = simulationProjectTaskMapper.selectScoreCount(param.getId());
|
|
|
|
+
|
|
|
|
+ // 未完成得分为”“的改为0
|
|
|
|
+ if (!isEmpty(resultScoreList) && resultScoreList.size() == 1 && isEmpty(resultScoreList.get(0).getResultName())) {
|
|
|
|
+ ProjectRunResultRatioNumVo projectRunResultRatioNumVo = resultScoreList.get(0);
|
|
|
|
+ projectRunResultRatioNumVo.setResultName("0");
|
|
|
|
+ }
|
|
|
|
+ taskScore(resultScoreList, size);
|
|
|
|
+ }
|
|
|
|
+ projectDetailsVo.setResultList(projectRunResultRatioNumVos);
|
|
|
|
+ projectDetailsVo.setResultScoreList(resultScoreList);
|
|
|
|
+ // 汉化
|
|
|
|
+ if (CollectionUtil.isNotEmpty(states)) {
|
|
|
|
+ states.forEach(state -> {
|
|
|
|
+ if (StateConstant.Aborted.getEnglish().equals(state.getStateName())) {
|
|
|
|
+ state.setStateName(StateConstant.Aborted.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.PendingAnalysis.getEnglish().equals(state.getStateName())) {
|
|
|
|
+ state.setStateName(StateConstant.PendingAnalysis.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Running.getEnglish().equals(state.getStateName())) {
|
|
|
|
+ state.setStateName(StateConstant.Running.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Analysing.getEnglish().equals(state.getStateName())) {
|
|
|
|
+ state.setStateName(StateConstant.Analysing.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Completed.getEnglish().equals(state.getStateName())) {
|
|
|
|
+ state.setStateName(StateConstant.Completed.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Terminated.getEnglish().equals(state.getStateName())) {
|
|
|
|
+ state.setStateName(StateConstant.Terminated.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Terminating.getEnglish().equals(state.getStateName())) {
|
|
|
|
+ state.setStateName(StateConstant.Terminating.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Pending.getEnglish().equals(state.getStateName())) {
|
|
|
|
+ state.setStateName(StateConstant.Pending.getChinese());
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ projectDetailsVo.setStateList(states);
|
|
|
|
+
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, projectDetailsVo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private ResponseBodyVO<ProjectDetailsVo> selectProjectDetailsByIdBackUp(SimulationManualProjectParam param) {
|
|
|
|
+
|
|
|
|
+ if (isEmpty(param.getId())) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (isEmpty(param.getProjectType())) {
|
|
|
|
+ param.setProjectType("1");// 默认
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ProjectDetailsVo projectDetailsVo = new ProjectDetailsVo();
|
|
|
|
+
|
|
|
|
+ // 封装要使用到的数据
|
|
|
|
+ SimulationManualProjectPo poParam = new SimulationManualProjectPo();
|
|
|
|
+
|
|
|
|
+ if (DictConstants.PROJECT_TYPE_MANUAL.equals(param.getProjectType())) { // 手动运行任务
|
|
|
|
+ // 项目基本信息
|
|
|
|
+ SimulationManualProjectPo po = simulationProjectMapper.selectProjectById(param);
|
|
|
|
+ if (po == null) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "没有获取到数据");
|
|
|
|
+ }
|
|
|
|
+ poParam = po;
|
|
|
|
+ } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(param.getProjectType())) {
|
|
|
|
+ SimulationManualProjectVo po = simulationAutomaticSubProjectMapper.selectProjectInfo(param);
|
|
|
|
+ if (po == null) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "没有获取到数据");
|
|
|
|
+ }
|
|
|
|
+ BeanUtils.copyProperties(po, poParam);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 获取场景包信息
|
|
|
|
+ ScenePackagePO scenePackagePO = simulationProjectMapper.selectScenePackageInfoById(poParam.getScene());
|
|
|
|
+
|
|
|
|
+ projectDetailsVo.setPackageName(scenePackagePO.getPackageName());
|
|
|
|
+
|
|
|
|
+ // 算法配置
|
|
|
|
+ AlgorithmPO algorithmBaseInfoVo = getAlgorithmInfo(poParam);
|
|
|
|
+ // 获取测试得分列表
|
|
|
|
+ List<AlgorithmScoreVo> firstTargetScore = getFirstTargetScore(param.getId());
|
|
|
|
+ projectDetailsVo.setAlgorithmScoreList(firstTargetScore);
|
|
|
|
+
|
|
|
|
+ // 车辆配置
|
|
|
|
+ VehiclePO vehicleBaseInfoVo = null;
|
|
|
|
+ String vehicleConfigId = poParam.getVehicle();
|
|
|
|
+
|
|
|
|
+ ConfigPO configPO = new ConfigPO();
|
|
|
|
+ configPO.setId(vehicleConfigId);
|
|
|
|
+ List<ConfigPO> configVehicleVOS = simulationProjectMapper.selectConfigVehicle(configPO);
|
|
|
|
+ if (!isEmpty(configVehicleVOS)) {
|
|
|
|
+ ConfigPO configVehicleVO = configVehicleVOS.get(0);
|
|
|
|
+ List<VehiclePO> vehiclePOS = simulationProjectMapper.selectVehicleBaseInfoById(configVehicleVO.getVehicleId());
|
|
|
|
+ if (!isEmpty(vehiclePOS)) {
|
|
|
|
+ vehicleBaseInfoVo = vehiclePOS.get(0);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ /*
|
|
|
|
+ * String vehicleImage = vehicleBaseInfoVo.getVehicleImage();
|
|
|
|
+ * if(!isEmpty(vehicleImage)){
|
|
|
|
+ * vehicleBaseInfoVo.setVehicleImage(vehicleImage.replaceFirst("Front side"
|
|
|
|
+ * ,"Top"));
|
|
|
|
+ * }
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ List<ConfigSensorPO> vehicleSensorVos = simulationProjectMapper.selectVehicleSensor(vehicleConfigId);
|
|
|
|
+
|
|
|
|
+ List<SensorBaseInfoVo> sensorCameraList = new ArrayList<>();
|
|
|
|
+ List<SensorBaseInfoVo> sensorOgtList = new ArrayList<>();
|
|
|
|
+ List<SensorBaseInfoVo> sensorLidarList = new ArrayList<>();
|
|
|
|
+ List<SensorBaseInfoVo> sensorRadarList = new ArrayList<>();
|
|
|
|
+ List<SensorBaseInfoVo> sensorGpsList = new ArrayList<>();
|
|
|
|
+ for (ConfigSensorPO vs : vehicleSensorVos) {
|
|
|
|
+ String sensorType = vs.getSensorType();
|
|
|
|
+ String sensorId = vs.getSensorId();
|
|
|
|
+ if (DictConstants.SENSOR_CAMERA.equals(sensorType)) {
|
|
|
|
+ // 摄像头
|
|
|
|
+ SensorBaseInfoVo sensorBaseInfoVo = simulationProjectMapper.selectSensorCamera(sensorId);
|
|
|
|
+ if (ObjectUtil.isNotNull(sensorBaseInfoVo) && sensorBaseInfoVo.getShare().equals("0")) {
|
|
|
|
+ sensorBaseInfoVo.setSensorName("私有/" + sensorBaseInfoVo.getSensorName());
|
|
|
|
+ } else if (ObjectUtil.isNotNull(sensorBaseInfoVo) && sensorBaseInfoVo.getShare().equals("1")) {
|
|
|
|
+ sensorBaseInfoVo.setSensorName("公有/" + sensorBaseInfoVo.getSensorName());
|
|
|
|
+ }
|
|
|
|
+ setVehicleConfig(sensorBaseInfoVo, vs);
|
|
|
|
+ sensorCameraList.add(sensorBaseInfoVo);
|
|
|
|
+ } else if (DictConstants.SENSOR_OGT.equals(sensorType)) {
|
|
|
|
+ // 完美传感器
|
|
|
|
+ SensorBaseInfoVo sensorBaseInfoVo = simulationProjectMapper.selectSensorOgt(sensorId);
|
|
|
|
+ if (ObjectUtil.isNotNull(sensorBaseInfoVo) && sensorBaseInfoVo.getShare().equals("0")) {
|
|
|
|
+ sensorBaseInfoVo.setSensorName("私有/" + sensorBaseInfoVo.getSensorName());
|
|
|
|
+ } else if (ObjectUtil.isNotNull(sensorBaseInfoVo) && sensorBaseInfoVo.getShare().equals("1")) {
|
|
|
|
+ sensorBaseInfoVo.setSensorName("公有/" + sensorBaseInfoVo.getSensorName());
|
|
|
|
+ }
|
|
|
|
+ setVehicleConfig(sensorBaseInfoVo, vs);
|
|
|
|
+ sensorOgtList.add(sensorBaseInfoVo);
|
|
|
|
+ } else if (DictConstants.SENSOR_LIDAR.equals(sensorType)) {
|
|
|
|
+ // 激光雷达
|
|
|
|
+ SensorBaseInfoVo sensorBaseInfoVo = simulationProjectMapper.selectSensorLidar(sensorId);
|
|
|
|
+ if (ObjectUtil.isNotNull(sensorBaseInfoVo) && sensorBaseInfoVo.getShare().equals("0")) {
|
|
|
|
+ sensorBaseInfoVo.setSensorName("私有/" + sensorBaseInfoVo.getSensorName());
|
|
|
|
+ } else if (ObjectUtil.isNotNull(sensorBaseInfoVo) && sensorBaseInfoVo.getShare().equals("1")) {
|
|
|
|
+ sensorBaseInfoVo.setSensorName("公有/" + sensorBaseInfoVo.getSensorName());
|
|
|
|
+ }
|
|
|
|
+ setVehicleConfig(sensorBaseInfoVo, vs);
|
|
|
|
+ sensorLidarList.add(sensorBaseInfoVo);
|
|
|
|
+ } else if (DictConstants.SENSOR_RADAR.equals(sensorType)) {
|
|
|
|
+ // 毫米波雷达
|
|
|
|
+ SensorBaseInfoVo sensorBaseInfoVo = simulationProjectMapper.selectSensorRadar(sensorId);
|
|
|
|
+ if (ObjectUtil.isNotNull(sensorBaseInfoVo) && sensorBaseInfoVo.getShare().equals("0")) {
|
|
|
|
+ sensorBaseInfoVo.setSensorName("私有/" + sensorBaseInfoVo.getSensorName());
|
|
|
|
+ } else if (ObjectUtil.isNotNull(sensorBaseInfoVo) && sensorBaseInfoVo.getShare().equals("1")) {
|
|
|
|
+ sensorBaseInfoVo.setSensorName("公有/" + sensorBaseInfoVo.getSensorName());
|
|
|
|
+ }
|
|
|
|
+ setVehicleConfig(sensorBaseInfoVo, vs);
|
|
|
|
+ sensorRadarList.add(sensorBaseInfoVo);
|
|
|
|
+ } else if (DictConstants.SENSOR_GPS.equals(sensorType)) {
|
|
|
|
+ // gps
|
|
|
|
+ SensorBaseInfoVo sensorBaseInfoVo = simulationProjectMapper.selectSensorGps(sensorId);
|
|
|
|
+ setVehicleConfig(sensorBaseInfoVo, vs);
|
|
|
|
+ sensorGpsList.add(sensorBaseInfoVo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 任务信息
|
|
|
|
+ ProjectTaskParam projectTaskParam = new ProjectTaskParam();
|
|
|
|
+ projectTaskParam.setPId(poParam.getId());
|
|
|
|
+ List<ProjectRunResultRatioNumVo> projectRunResultRatioNumVos = null;
|
|
|
|
+
|
|
|
|
+ // 任务运行状态统计
|
|
|
|
+ List<ProjectRunStateNumVo> projectRunStateNumVos = null;
|
|
|
|
+
|
|
|
|
+ // 任务运行结果统计
|
|
|
|
+ List<ProjectRunResultRatioNumVo> resultScoreList = null;
|
|
|
|
+
|
|
|
|
+ Integer size = simulationProjectTaskMapper.selectProjectTaskNumByProjectId(projectTaskParam);
|
|
|
|
+ if (size > 0) {
|
|
|
|
+ projectRunStateNumVos = simulationProjectTaskMapper.selectRunStateCount(poParam.getId());
|
|
|
|
+ taskRunState(projectRunStateNumVos, size);
|
|
|
|
+
|
|
|
|
+ projectRunResultRatioNumVos = simulationProjectTaskMapper.selectRunResultCount(poParam.getId());
|
|
|
|
+ taskResultState(projectRunResultRatioNumVos, size);
|
|
|
|
+
|
|
|
|
+ resultScoreList = simulationProjectTaskMapper.selectScoreCount(poParam.getId());
|
|
|
|
+
|
|
|
|
+ // 未完成得分为”“的改为0
|
|
|
|
+ if (!isEmpty(resultScoreList) && resultScoreList.size() == 1 && isEmpty(resultScoreList.get(0).getResultName())) {
|
|
|
|
+ ProjectRunResultRatioNumVo projectRunResultRatioNumVo = resultScoreList.get(0);
|
|
|
|
+ projectRunResultRatioNumVo.setResultName("0");
|
|
|
|
+ }
|
|
|
|
+ taskScore(resultScoreList, size);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ projectDetailsVo.setProjectId(poParam.getProjectId());
|
|
|
|
+ projectDetailsVo.setProjectName(poParam.getProjectName());
|
|
|
|
+ projectDetailsVo.setProjectDescribe(poParam.getProjectDescribe());
|
|
|
|
+ projectDetailsVo.setStartTime(getRqStr(poParam.getStartTime(), 1));
|
|
|
|
+ projectDetailsVo.setFinishTime(getRqStr(poParam.getFinishTime(), 1));
|
|
|
|
+ projectDetailsVo.setNowRunState(poParam.getNowRunState());
|
|
|
|
+ projectDetailsVo.setNowRunStateName(getDictName(DictConstants.PROJECT_RUN_STATE, poParam.getNowRunState()));
|
|
|
|
+ projectDetailsVo.setEvaluationLevel(getDictName(DictConstants.EVALUATION_LEVEL, poParam.getEvaluationLevel()));
|
|
|
|
+ // projectDetailsVo.setEvaluationLevel(s);
|
|
|
|
+ if (algorithmBaseInfoVo != null) {
|
|
|
|
+ projectDetailsVo.setAlgorithmName(algorithmBaseInfoVo.getAlgorithmName());
|
|
|
|
+ projectDetailsVo.setAlgorithmDescribe(algorithmBaseInfoVo.getDescription());
|
|
|
|
+ }
|
|
|
|
+ if (vehicleBaseInfoVo != null) {
|
|
|
|
+ projectDetailsVo.setVehicleName(vehicleBaseInfoVo.getVehicleName());
|
|
|
|
+ projectDetailsVo.setVehicleDescribe(vehicleBaseInfoVo.getDescription());
|
|
|
|
+ projectDetailsVo.setVehicleTopView(vehicleBaseInfoVo.getVehicleFrontView());
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ projectDetailsVo.setSensorCameraList(sensorCameraList);
|
|
|
|
+ projectDetailsVo.setSensorOgtList(sensorOgtList);
|
|
|
|
+ projectDetailsVo.setSensorLidarList(sensorLidarList);
|
|
|
|
+ projectDetailsVo.setSensorRadarList(sensorRadarList);
|
|
|
|
+ projectDetailsVo.setSensorGpsList(sensorGpsList);
|
|
|
|
+ projectDetailsVo.setStateList(projectRunStateNumVos);
|
|
|
|
+ projectDetailsVo.setResultList(projectRunResultRatioNumVos);
|
|
|
|
+ projectDetailsVo.setResultScoreList(resultScoreList);
|
|
|
|
+
|
|
|
|
+ projectDetailsVo.setParallelism(poParam.getParallelism());
|
|
|
|
+ projectDetailsVo.setMaxSimulationTime(poParam.getMaxSimulationTime());
|
|
|
|
+ String isChoiceGpu = poParam.getIsChoiceGpu();
|
|
|
|
+ String g = "";
|
|
|
|
+ if ("0".equals(isChoiceGpu)) {
|
|
|
|
+ g = "是";
|
|
|
|
+ } else if ("1".equals(isChoiceGpu)) {
|
|
|
|
+ g = "否";
|
|
|
|
+ }
|
|
|
|
+ projectDetailsVo.setIsChoiceGpu(g);
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * //是否生成报告
|
|
|
|
+ * boolean isCreateReport = true;
|
|
|
|
+ * String nowRunState = projectDetailsVo.getNowRunState();
|
|
|
|
+ * if(!ProjectRunStateEnum.FINISH.getCode().equals(nowRunState)){
|
|
|
|
+ * isCreateReport = false;
|
|
|
|
+ * }else{
|
|
|
|
+ * //查询任务是否存在aborted
|
|
|
|
+ * SimulationMptSceneScorePo sPo = new SimulationMptSceneScorePo();
|
|
|
|
+ * sPo.setPId(param.getId());
|
|
|
|
+ * SceneScoreVo sceneScoreVo =
|
|
|
|
+ * simulationProjectTaskMapper.selectRunStateByAborted(sPo);
|
|
|
|
+ * if(sceneScoreVo != null && sceneScoreVo.getNum() > 0){
|
|
|
|
+ * isCreateReport = false;
|
|
|
|
+ * }
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * projectDetailsVo.setCreateReport(isCreateReport);
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, projectDetailsVo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 运行状态统计
|
|
|
|
+ private void taskRunState(List<ProjectRunStateNumVo> vos, Integer size) {
|
|
|
|
+ for (ProjectRunStateNumVo pv : vos) {
|
|
|
|
+ Integer num = pv.getNum();
|
|
|
|
+ Double d = (double) num / size;
|
|
|
|
+ d = saveTwoDecimalPlaces(d);
|
|
|
|
+ pv.setRatio(d);
|
|
|
|
+ }
|
|
|
|
+ // 补全没有的
|
|
|
|
+ Map<String, String> dict = getDictByType(ProjectConstants.TASK_RUN_STATE);
|
|
|
|
+ for (String key : dict.keySet()) {
|
|
|
|
+ boolean b = false;
|
|
|
|
+ for (ProjectRunStateNumVo pv : vos) {
|
|
|
|
+ if (pv.getStateName().equals(dict.get(key))) {
|
|
|
|
+ b = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (!b) {
|
|
|
|
+ ProjectRunStateNumVo vo = new ProjectRunStateNumVo();
|
|
|
|
+ vo.setStateName(dict.get(key));
|
|
|
|
+ vo.setNum(0);
|
|
|
|
+ vo.setRatio(0D);
|
|
|
|
+ vos.add(vo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- // 获取测试得分列表
|
|
|
|
- List<AlgorithmScoreVo> firstTargetScore = getFirstTargetScore(param.getId());
|
|
|
|
- projectDetailsVo.setAlgorithmScoreList(firstTargetScore);
|
|
|
|
- // 任务运行状态统计
|
|
|
|
- List<ProjectRunStateNumVo> states = null;
|
|
|
|
-
|
|
|
|
- // 任务运行结果统计
|
|
|
|
- List<ProjectRunResultRatioNumVo> resultScoreList = null;
|
|
|
|
-
|
|
|
|
- // 任务信息
|
|
|
|
- ProjectTaskParam projectTaskParam = new ProjectTaskParam();
|
|
|
|
- projectTaskParam.setPId(param.getId());
|
|
|
|
- List<ProjectRunResultRatioNumVo> projectRunResultRatioNumVos = null;
|
|
|
|
- Integer size = simulationProjectTaskMapper.selectProjectTaskNumByProjectId(projectTaskParam);
|
|
|
|
- if (size > 0) {
|
|
|
|
- states = simulationProjectTaskMapper.selectRunStateCount(param.getId());
|
|
|
|
- taskRunState(states, size);
|
|
|
|
- projectRunResultRatioNumVos = simulationProjectTaskMapper.selectRunResultCount(param.getId());
|
|
|
|
- taskResultState(projectRunResultRatioNumVos, size);
|
|
|
|
-
|
|
|
|
- resultScoreList = simulationProjectTaskMapper.selectScoreCount(param.getId());
|
|
|
|
-
|
|
|
|
- // 未完成得分为”“的改为0
|
|
|
|
- if (!isEmpty(resultScoreList) && resultScoreList.size() == 1 && isEmpty(resultScoreList.get(0).getResultName())) {
|
|
|
|
- ProjectRunResultRatioNumVo projectRunResultRatioNumVo = resultScoreList.get(0);
|
|
|
|
- projectRunResultRatioNumVo.setResultName("0");
|
|
|
|
- }
|
|
|
|
- taskScore(resultScoreList, size);
|
|
|
|
|
|
+
|
|
|
|
+ // 运行结果统计
|
|
|
|
+ private void taskResultState(List<ProjectRunResultRatioNumVo> vos, Integer size) {
|
|
|
|
+ // 结果状态统计
|
|
|
|
+ for (ProjectRunResultRatioNumVo rv : vos) {
|
|
|
|
+ Integer num = rv.getNum();
|
|
|
|
+ Double d = (double) num / size;
|
|
|
|
+ d = saveTwoDecimalPlaces(d);
|
|
|
|
+ rv.setRatio(d);
|
|
|
|
+ }
|
|
|
|
+ // 补全没有的
|
|
|
|
+ Map<String, String> dict = getDictByType(ProjectConstants.TASK_RESULT_STATE);
|
|
|
|
+ for (String key : dict.keySet()) {
|
|
|
|
+ boolean b = false;
|
|
|
|
+ for (ProjectRunResultRatioNumVo pv : vos) {
|
|
|
|
+ if (dict.get(key).equals(pv.getResultName())) {
|
|
|
|
+ b = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (!b) {
|
|
|
|
+ ProjectRunResultRatioNumVo vo = new ProjectRunResultRatioNumVo();
|
|
|
|
+ vo.setResultName(dict.get(key));
|
|
|
|
+ vo.setNum(0);
|
|
|
|
+ vo.setRatio(0D);
|
|
|
|
+ vos.add(vo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- projectDetailsVo.setResultList(projectRunResultRatioNumVos);
|
|
|
|
- projectDetailsVo.setResultScoreList(resultScoreList);
|
|
|
|
- // 汉化
|
|
|
|
- if (CollectionUtil.isNotEmpty(states)) {
|
|
|
|
- states.forEach(state -> {
|
|
|
|
- if (StateConstant.Aborted.getEnglish().equals(state.getStateName())) {
|
|
|
|
- state.setStateName(StateConstant.Aborted.getChinese());
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 得分统计
|
|
|
|
+ */
|
|
|
|
+ private void taskScore(List<ProjectRunResultRatioNumVo> vos, Integer size) {
|
|
|
|
+ for (ProjectRunResultRatioNumVo rv : vos) {
|
|
|
|
+ Integer num = rv.getNum();
|
|
|
|
+ Double d = (double) num / size;
|
|
|
|
+ d = saveTwoDecimalPlaces(d);
|
|
|
|
+ rv.setRatio(d);
|
|
}
|
|
}
|
|
- if (StateConstant.PendingAnalysis.getEnglish().equals(state.getStateName())) {
|
|
|
|
- state.setStateName(StateConstant.PendingAnalysis.getChinese());
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setVehicleConfig(SensorBaseInfoVo vo, ConfigSensorPO vs) {
|
|
|
|
+ vo.setConfigId(vs.getConfigId());
|
|
|
|
+ vo.setSensorId(vs.getSensorId());
|
|
|
|
+ vo.setSensorType(vs.getSensorType());
|
|
|
|
+ if (StringUtil.isNotEmpty(vs.getSensorX())) {
|
|
|
|
+ vo.setSensorX(saveTwoDecimalPlaces(vs.getSensorX().doubleValue()));
|
|
}
|
|
}
|
|
- if (StateConstant.Running.getEnglish().equals(state.getStateName())) {
|
|
|
|
- state.setStateName(StateConstant.Running.getChinese());
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(vs.getSensorY())) {
|
|
|
|
+ vo.setSensorY(saveTwoDecimalPlaces(vs.getSensorY().doubleValue()));
|
|
}
|
|
}
|
|
- if (StateConstant.Analysing.getEnglish().equals(state.getStateName())) {
|
|
|
|
- state.setStateName(StateConstant.Analysing.getChinese());
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(vs.getSensorZ())) {
|
|
|
|
+ vo.setSensorZ(saveTwoDecimalPlaces(vs.getSensorZ().doubleValue()));
|
|
}
|
|
}
|
|
- if (StateConstant.Completed.getEnglish().equals(state.getStateName())) {
|
|
|
|
- state.setStateName(StateConstant.Completed.getChinese());
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(vs.getSensorH())) {
|
|
|
|
+ vo.setSensorH(saveTwoDecimalPlaces(vs.getSensorH().doubleValue()));
|
|
}
|
|
}
|
|
- if (StateConstant.Terminated.getEnglish().equals(state.getStateName())) {
|
|
|
|
- state.setStateName(StateConstant.Terminated.getChinese());
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(vs.getSensorP())) {
|
|
|
|
+ vo.setSensorP(saveTwoDecimalPlaces(vs.getSensorP().doubleValue()));
|
|
}
|
|
}
|
|
- if (StateConstant.Terminating.getEnglish().equals(state.getStateName())) {
|
|
|
|
- state.setStateName(StateConstant.Terminating.getChinese());
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(vs.getSensorR())) {
|
|
|
|
+ vo.setSensorR(saveTwoDecimalPlaces(vs.getSensorR().doubleValue()));
|
|
}
|
|
}
|
|
- if (StateConstant.Pending.getEnglish().equals(state.getStateName())) {
|
|
|
|
- state.setStateName(StateConstant.Pending.getChinese());
|
|
|
|
|
|
+ if (StringUtil.isNotEmpty(vs.getSensorPort())) {
|
|
|
|
+ vo.setSensorPort(vs.getSensorPort());
|
|
}
|
|
}
|
|
- });
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
- projectDetailsVo.setStateList(states);
|
|
|
|
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, projectDetailsVo);
|
|
|
|
- }
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<ProjectReportVo> selectProjectReportById(SimulationManualProjectParam param) {
|
|
|
|
+ String projectType = param.getProjectType();
|
|
|
|
+ // 封装要使用到的数据
|
|
|
|
+ SimulationManualProjectPo poParam = new SimulationManualProjectPo();
|
|
|
|
|
|
- private ResponseBodyVO<ProjectDetailsVo> selectProjectDetailsByIdBackUp(SimulationManualProjectParam param) {
|
|
|
|
|
|
+ if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
|
|
+ // 项目基本信息
|
|
|
|
+ poParam = simulationProjectMapper.selectProjectBaseById(param);
|
|
|
|
+ } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
|
|
+ SimulationManualProjectVo po = simulationAutomaticSubProjectMapper.selectProjectInfo(param);
|
|
|
|
+ BeanUtils.copyProperties(po, poParam);
|
|
|
|
+ }
|
|
|
|
|
|
- if (isEmpty(param.getId())) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
- }
|
|
|
|
|
|
+ // 算法配置
|
|
|
|
+ AlgorithmPO algorithmBaseInfoVo = getAlgorithmInfo(poParam);
|
|
|
|
+ ProjectReportVo projectReportVo = new ProjectReportVo();
|
|
|
|
+ projectReportVo.setProjectId(poParam.getProjectId());
|
|
|
|
+ projectReportVo.setProjectName(poParam.getProjectName());
|
|
|
|
+ projectReportVo.setAlgorithmName(algorithmBaseInfoVo.getAlgorithmName());
|
|
|
|
+ projectReportVo.setAlgorithmDescribe(algorithmBaseInfoVo.getDescription());
|
|
|
|
|
|
- if (isEmpty(param.getProjectType())) {
|
|
|
|
- param.setProjectType("1");// 默认
|
|
|
|
- }
|
|
|
|
|
|
+ // 添加开始时间
|
|
|
|
+ SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+ if (poParam.getStartTime() != null) {
|
|
|
|
+ projectReportVo.setStartTime(dateFormat.format(poParam.getStartTime()));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String sceneNames;
|
|
|
|
+
|
|
|
|
+ // 算法测试得分表
|
|
|
|
+ /*
|
|
|
|
+ * 汇总测试得分计算方法:(每一项一级指标的测试得分*测试权重)累加
|
|
|
|
+ * 得分率计算方法:每一项一级指标的所有场景得分不为0的数量/每一项一级指标的场景数量
|
|
|
|
+ * 汇总得分率计算方法:(每一项一级指标的所有场景得分不为0的数量_累加/每一项一级指标的场景数量_累加)换成(得分累加取平均值)
|
|
|
|
+ */
|
|
|
|
|
|
- ProjectDetailsVo projectDetailsVo = new ProjectDetailsVo();
|
|
|
|
-
|
|
|
|
- // 封装要使用到的数据
|
|
|
|
- SimulationManualProjectPo poParam = new SimulationManualProjectPo();
|
|
|
|
-
|
|
|
|
- if ("1".equals(param.getProjectType())) { // 手动运行任务
|
|
|
|
- // 项目基本信息
|
|
|
|
- SimulationManualProjectPo po = simulationProjectMapper.selectProjectById(param);
|
|
|
|
- if (po == null) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "没有获取到数据");
|
|
|
|
- }
|
|
|
|
- poParam = po;
|
|
|
|
- } else if ("2".equals(param.getProjectType())) {
|
|
|
|
- SimulationManualProjectVo po = simulationAutomaticSubProjectMapper.selectProjectInfo(param);
|
|
|
|
- if (po == null) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "没有获取到数据");
|
|
|
|
- }
|
|
|
|
- BeanUtils.copyProperties(po, poParam);
|
|
|
|
|
|
+ // 获取得分表一级指标信息
|
|
|
|
+ SimulationMptFirstTargetScorePo par = new SimulationMptFirstTargetScorePo();
|
|
|
|
+ par.setPId(poParam.getId());
|
|
|
|
+ List<SimulationMptFirstTargetScorePo> pos = simulationMptFirstTargetScoreMapper.selectFirstTargetByPid(par);
|
|
|
|
|
|
|
|
+ List<AlgorithmScoreVo> algorithmScoreVoList = new ArrayList<>();
|
|
|
|
+ String evaluationLevelReport;
|
|
|
|
+
|
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
+
|
|
|
|
+ // 汇总数据初始化
|
|
|
|
+ int totalSceneNum = 0;
|
|
|
|
+ double totalScore = 0D;
|
|
|
|
+ double totalScoreRatio = 0D;
|
|
|
|
+ int totalSceneScoreNum = 0;
|
|
|
|
+
|
|
|
|
+ // 根据一级指标表结果获取平分细则
|
|
|
|
+ for (SimulationMptFirstTargetScorePo firstTargetScorePo : pos) {
|
|
|
|
+ // 获取指标信息
|
|
|
|
+ int sceneNum = firstTargetScorePo.getSceneNum(); // 一级指标包含场景数量
|
|
|
|
+ String weight = firstTargetScorePo.getWeight(); // 一级指标权重
|
|
|
|
+ double weightDouble = Double.parseDouble(weight);
|
|
|
|
+ // 单个二级指标得分
|
|
|
|
+ Double score = firstTargetScorePo.getScore();
|
|
|
|
+ totalScore += BigDecimal.valueOf(score).multiply(BigDecimal.valueOf(weightDouble).divide(BigDecimal.valueOf(100))).doubleValue();
|
|
|
|
+ // 获取得分不为 0 的场景数量
|
|
|
|
+ Integer scoreNum = getSetScoreNum(firstTargetScorePo.getSublistId(), poParam.getId());
|
|
|
|
+ totalSceneScoreNum += scoreNum;
|
|
|
|
+
|
|
|
|
+ totalScoreRatio += Double.valueOf(scoreNum) / Double.valueOf(sceneNum) * 100;
|
|
|
|
+
|
|
|
|
+ AlgorithmScoreVo algorithmScoreVo = new AlgorithmScoreVo();
|
|
|
|
+ algorithmScoreVo.setProjectName(firstTargetScorePo.getSublistName());
|
|
|
|
+ algorithmScoreVo.setSceneNum(sceneNum);
|
|
|
|
+ algorithmScoreVo.setWeight(weight);
|
|
|
|
+ algorithmScoreVo.setScore(saveTwoDecimalPlaces(score));
|
|
|
|
+ algorithmScoreVo.setScoreRatio(saveTwoDecimalPlaces(Double.valueOf(scoreNum) / Double.valueOf(sceneNum) * 100));
|
|
|
|
+
|
|
|
|
+ algorithmScoreVoList.add(algorithmScoreVo);
|
|
|
|
+
|
|
|
|
+ // 其他操作
|
|
|
|
+ stringBuilder.append(firstTargetScorePo.getSublistName()).append("、");
|
|
|
|
+ totalSceneNum += sceneNum;
|
|
|
|
+ }
|
|
|
|
+ // 汇总
|
|
|
|
+ AlgorithmScoreVo algorithmScoreVo = new AlgorithmScoreVo();
|
|
|
|
+ algorithmScoreVo.setProjectName("汇总");
|
|
|
|
+ algorithmScoreVo.setSceneNum(totalSceneNum);
|
|
|
|
+ // 指标权重总和默认是100%
|
|
|
|
+ algorithmScoreVo.setWeight("100");
|
|
|
|
+ algorithmScoreVo.setScore(saveTwoDecimalPlaces(totalScore));
|
|
|
|
+
|
|
|
|
+ totalScoreRatio = Double.valueOf(totalSceneScoreNum) / Double.valueOf(totalSceneNum) * 100;
|
|
|
|
+ // 汇总得分率计算方式修改
|
|
|
|
+ // algorithmScoreVo.setScoreRatio(saveTwoDecimalPlaces(totalScoreRatio));
|
|
|
|
+ algorithmScoreVo.setScoreRatio(NumberUtil.cut(totalScoreRatio, 2));
|
|
|
|
+ algorithmScoreVoList.add(algorithmScoreVo);
|
|
|
|
+ projectReportVo.setScoreRatio(saveTwoDecimalPlaces(totalScoreRatio));
|
|
|
|
+ projectReportVo.setAlgorithmScore(saveTwoDecimalPlaces(totalScore));
|
|
|
|
+ evaluationLevelReport = poParam.getEvaluationLevel();
|
|
|
|
+ if (DictConstants.EVALUATION_LEVEL_G.equals(evaluationLevelReport)) {
|
|
|
|
+ projectReportVo.setEvaluationLevel(DictConstants.EVALUATION_LEVEL_G_DESCRIPTION);
|
|
|
|
+ projectReportVo.setEvaluationGrade(DictConstants.EVALUATION_LEVEL_G_DESCRIPTION);
|
|
|
|
+ } else if (DictConstants.EVALUATION_LEVEL_A.equals(evaluationLevelReport)) {
|
|
|
|
+ projectReportVo.setEvaluationLevel(DictConstants.EVALUATION_LEVEL_A_DESCRIPTION);
|
|
|
|
+ projectReportVo.setEvaluationGrade(DictConstants.EVALUATION_LEVEL_A_DESCRIPTION);
|
|
|
|
+ } else if (DictConstants.EVALUATION_LEVEL_M.equals(evaluationLevelReport)) {
|
|
|
|
+ projectReportVo.setEvaluationLevel(DictConstants.EVALUATION_LEVEL_M_DESCRIPTION);
|
|
|
|
+ projectReportVo.setEvaluationGrade(DictConstants.EVALUATION_LEVEL_M_DESCRIPTION);
|
|
|
|
+ } else if (DictConstants.EVALUATION_LEVEL_P.equals(evaluationLevelReport)) {
|
|
|
|
+ projectReportVo.setEvaluationLevel(DictConstants.EVALUATION_LEVEL_P_DESCRIPTION);
|
|
|
|
+ projectReportVo.setEvaluationGrade(DictConstants.EVALUATION_LEVEL_P_DESCRIPTION);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ sceneNames = stringBuilder.substring(0, stringBuilder.lastIndexOf("、"));
|
|
|
|
+ projectReportVo.setAlgorithmEvaluation(algorithmBaseInfoVo.getAlgorithmName() + "经测试获得" + projectReportVo.getEvaluationLevel() + "级评价," + "(" + sceneNames + ")得分率达到了" + projectReportVo.getScoreRatio() + "%。");
|
|
|
|
+ projectReportVo.setAlgorithmScoreList(algorithmScoreVoList);
|
|
|
|
+ // 指标得分列表
|
|
|
|
+ Map<String, Object> stringObjectMap = selectScenePackageSubListAndSetScore(poParam.getScene(), poParam.getId());
|
|
|
|
+ projectReportVo.setSubListScoreLiTitle((List<Map>) stringObjectMap.get("headerList"));
|
|
|
|
+ projectReportVo.setSubListScoreLi((List<SubScListVo>) stringObjectMap.get("result"));
|
|
|
|
+
|
|
|
|
+ // 场景得分列表
|
|
|
|
+ Map<String, Object> maps = selectSceneScore2(poParam.getScene(), poParam.getId(), null, projectReportVo);
|
|
|
|
+ projectReportVo.setSceneScoreLiTitle((List<Map>) maps.get("headerList"));
|
|
|
|
+ projectReportVo.setSceneScoreLi((List<SceneScListVo>) maps.get("result"));
|
|
|
|
+
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, projectReportVo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private AlgorithmPO getAlgorithmInfo(SimulationManualProjectPo po) {
|
|
|
|
+ AlgorithmPO algorithmBaseInfoVo = null;
|
|
|
|
+ String algorithmId = po.getAlgorithm();
|
|
|
|
+ String algorithmType = po.getAlgorithmType();
|
|
|
|
+ // 第三方算法平台
|
|
|
|
+ if ("3".equals(algorithmType)) {
|
|
|
|
+ String sort = "algorithmId-desc";
|
|
|
|
+ int page = 1;
|
|
|
|
+ int size = 1;// 全部
|
|
|
|
+
|
|
|
|
+ String urlParam = "&algorithmId" + algorithmId + "&page=" + page + "&size=" + size + "&sort=" + sort;
|
|
|
|
+ List<DropDownVo> otherAlgorithmInfo = getOtherAlgorithmInfo(urlParam);
|
|
|
|
+ if (StringUtil.isNotEmpty(otherAlgorithmInfo)) {
|
|
|
|
+ DropDownVo dropDownVo = otherAlgorithmInfo.get(0);
|
|
|
|
+ algorithmBaseInfoVo = new AlgorithmPO();
|
|
|
|
+ algorithmBaseInfoVo.setAlgorithmName(dropDownVo.getName());
|
|
|
|
+ algorithmBaseInfoVo.setDescription(dropDownVo.getDescription());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else {
|
|
|
|
+ algorithmBaseInfoVo = simulationProjectMapper.selectAlgorithmById(algorithmId);
|
|
|
|
+ }
|
|
|
|
+ return algorithmBaseInfoVo;
|
|
}
|
|
}
|
|
|
|
|
|
- // 获取场景包信息
|
|
|
|
- ScenePackagePO scenePackagePO = simulationProjectMapper.selectScenePackageInfoById(poParam.getScene());
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取添加工作时需要的下拉选项
|
|
|
|
+ * 0. 算法列表
|
|
|
|
+ * 1. 车辆列表
|
|
|
|
+ * 2. 场景列表
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<List<DropDownTypeVo>> selectDropDownByType(SimulationManualProjectParam param) {
|
|
|
|
+ List<DropDownTypeVo> result = new ArrayList<>();
|
|
|
|
+ if (isEmpty(param.getDropDownType())) {
|
|
|
|
+ // 获取全部(算法,车辆,场景)
|
|
|
|
+ setAlgorithmDropDown(result, param.getAlgorithmType());
|
|
|
|
+ setVehicleDropDown(result, null);
|
|
|
|
+ setScenePackageDropDown(result);
|
|
|
|
+ } else if ("1".equals(param.getDropDownType())) {
|
|
|
|
+ setAlgorithmDropDown(result, param.getAlgorithmType());
|
|
|
|
+ } else if ("2".equals(param.getDropDownType())) {
|
|
|
|
+ setVehicleDropDown(result, null);
|
|
|
|
+ } else if ("3".equals(param.getDropDownType())) {
|
|
|
|
+ setScenePackageDropDown(result);
|
|
|
|
+ }
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取添加工作时需要的下拉选项
|
|
|
|
+ * 0. 算法列表
|
|
|
|
+ * 1. 车辆列表
|
|
|
|
+ * 2. 场景列表
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<List<DropDownTypeNewVo>> selectDropDownByTypeNew(SimulationManualProjectParam param) {
|
|
|
|
+ List<DropDownTypeNewVo> result = new ArrayList<>();
|
|
|
|
+ if (isEmpty(param.getDropDownType())) {
|
|
|
|
+ // 获取全部(算法,车辆,场景)
|
|
|
|
+ setAlgorithmDropDownNew(result, param.getAlgorithmType());
|
|
|
|
+ setVehicleDropDownNew(result);
|
|
|
|
+ setScenePackageDropDownNew(result);
|
|
|
|
+ } else if ("1".equals(param.getDropDownType())) {
|
|
|
|
+ setAlgorithmDropDownNew(result, param.getAlgorithmType());
|
|
|
|
+ } else if ("2".equals(param.getDropDownType())) {
|
|
|
|
+ setVehicleDropDownNew(result);
|
|
|
|
+ } else if ("3".equals(param.getDropDownType())) {
|
|
|
|
+ setScenePackageDropDownNew(result);
|
|
|
|
+ }
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<ProjectTaskDetailsVo> selectProjectTaskById(SimulationManualProjectParam param) {
|
|
|
|
+ ProjectTaskDetailsVo resultVo = new ProjectTaskDetailsVo();
|
|
|
|
+ // 1 获取参数
|
|
|
|
+ Optional.ofNullable(param).orElseThrow(() -> new RuntimeException("参数不能为空。"));
|
|
|
|
+ Optional.ofNullable(param.getId()).orElseThrow(() -> new RuntimeException("项目 id 不能为空。"));
|
|
|
|
+ Optional.ofNullable(param.getTaskId()).orElseThrow(() -> new RuntimeException("任务 id 不能为空。"));
|
|
|
|
+ Optional.ofNullable(param.getProjectType()).orElseThrow(() -> new RuntimeException("项目类型不能为空。"));
|
|
|
|
+ String id = param.getId();
|
|
|
|
+ String taskId = param.getTaskId();
|
|
|
|
+ String projectType = param.getProjectType(); // 2
|
|
|
|
+ // 2 查询任务信息,手动项目和自动项目共用一个任务表
|
|
|
|
+ ProjectTaskParam projectTaskParam = new ProjectTaskParam();
|
|
|
|
+ projectTaskParam.setPId(id);
|
|
|
|
+ projectTaskParam.setId(taskId);
|
|
|
|
+ List<ManualProjectTaskPo> pos = simulationProjectTaskMapper.selectProjectTask(projectTaskParam);
|
|
|
|
+ if (CollectionUtil.isEmpty(pos)) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "没有获取到任务信息。");
|
|
|
|
+ }
|
|
|
|
+ ManualProjectTaskPo po = pos.get(0);
|
|
|
|
+ resultVo.setTaskId(po.getId());
|
|
|
|
+ String sceneId = po.getSceneId();
|
|
|
|
+ String sceneType = po.getSceneType(); // 4
|
|
|
|
+ SceneBaseInfoVo sceneBaseInfoVo = getSceneNameAndOther(sceneId, sceneType); // ACC_2-5-1
|
|
|
|
+ resultVo.setSceneName(sceneBaseInfoVo.getCommonSceneName()); // ACC_2-5-1
|
|
|
|
+ resultVo.setRunStartTime(getRqStr(po.getRunStartTime(), 1)); // 2022-07-27 09:52:04
|
|
|
|
+ resultVo.setRunEndTime(getRqStr(po.getRunEndTime(), 1)); // 2022-07-27 09:53:14
|
|
|
|
+ resultVo.setRunState(po.getRunState()); // Completed
|
|
|
|
+ resultVo.setFinishState(po.getRunResult()); // Completed
|
|
|
|
+ resultVo.setSceneDescribe(""); // 场景描述设置为空
|
|
|
|
+ // -------------------------------- 获取任务得分详情 --------------------------------
|
|
|
|
+ SimulationManualProjectPo poParam = new SimulationManualProjectPo();
|
|
|
|
+ if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
|
|
+ SimulationManualProjectPo spo = simulationProjectMapper.selectProjectBaseById(param);
|
|
|
|
+ Optional.ofNullable(spo).orElseThrow(() -> new RuntimeException("没有获取到数据。"));
|
|
|
|
+ poParam = spo;
|
|
|
|
+ } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
|
|
+ SimulationManualProjectVo spo = simulationAutomaticSubProjectMapper.selectProjectInfo(param);
|
|
|
|
+ Optional.ofNullable(spo).orElseThrow(() -> new RuntimeException("没有获取到数据。"));
|
|
|
|
+ BeanUtils.copyProperties(spo, poParam);
|
|
|
|
+ }
|
|
|
|
+ Map<String, Object> stringObjectMap = selectSceneScore(poParam.getScene(), poParam.getId(), taskId);
|
|
|
|
+ resultVo.setSceneScoreLiTitle((List<Map>) stringObjectMap.get("headerList"));
|
|
|
|
+ resultVo.setSceneScoreLi((List<SceneScListVo>) stringObjectMap.get("result"));
|
|
|
|
+ // 1.获取仿真结果文件
|
|
|
|
+ InputStream fileInputStream = null;
|
|
|
|
+ InputStreamReader inputStreamReader = null;
|
|
|
|
+ BufferedReader bufferedReader = null;
|
|
|
|
+ try {
|
|
|
|
+ // 2.解析仿真文件
|
|
|
|
+ // time
|
|
|
|
+ List<Double> time_list = new ArrayList<>();
|
|
|
|
+ // velocity
|
|
|
|
+ List<Double> velocity_list = new ArrayList<>();
|
|
|
|
+ List<Double> lateral_velocity_list = new ArrayList<>();// 横 时间
|
|
|
|
+ List<Double> longitudinal_velocity_list = new ArrayList<>();// 纵 速度
|
|
|
|
+ // acceleration
|
|
|
|
+ // List<Double> acceleration_list = new ArrayList<>();
|
|
|
|
+ // List<Double> acceleration_list_longitudinal = new ArrayList<>();
|
|
|
|
+ List<Double> lateral_acceleration_list = new ArrayList<>(); // 横向加速度
|
|
|
|
+ List<Double> longitudinal_acceleration_list = new ArrayList<>(); // 纵向加速度
|
|
|
|
+ // lane_offset
|
|
|
|
+ List<Double> lane_offset_list = new ArrayList<>();
|
|
|
|
+ /// TODO brake
|
|
|
|
+ List<Double> brake_list = new ArrayList<>();
|
|
|
|
+ // steeting_wheel
|
|
|
|
+ List<Double> steeting_wheel_list = new ArrayList<>();
|
|
|
|
+ /// TODO throttle
|
|
|
|
+ List<Double> throttle_list = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ List<Double> yawrate_list = new ArrayList<>();// 摆角速度
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * File file = new File("E:\\仿真云平台\\任务详情界面数据\\Ego(1).csv");
|
|
|
|
+ * fileInputStream = new FileInputStream(file);
|
|
|
|
+ * inputStreamReader = new InputStreamReader(fileInputStream,"utf-8");
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ MinioParameter minioParameter = new MinioParameter();
|
|
|
|
+ minioParameter.setObjectName(po.getRunResultFilePath() + "/Ego.csv");
|
|
|
|
+ // minioParameter.setObjectName("test/ego.csv");
|
|
|
|
+ Response download = fileDownService.download(minioParameter);
|
|
|
|
+ Response.Body body = download.body();
|
|
|
|
+ fileInputStream = body.asInputStream();
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * String path = "/temp" + StringUtil.getRandomCode();
|
|
|
|
+ * FileUtil.writeInputStreamToLocalFile(body.asInputStream(),path);
|
|
|
|
+ * file = new File(path);
|
|
|
|
+ * fileInputStream = new FileInputStream(file);
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ inputStreamReader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8);
|
|
|
|
+
|
|
|
|
+ bufferedReader = new BufferedReader(inputStreamReader);
|
|
|
|
+ String line;
|
|
|
|
+ int lineIndex = 0;
|
|
|
|
+ while ((line = bufferedReader.readLine()) != null) {
|
|
|
|
+ lineIndex++;
|
|
|
|
+ if (lineIndex == 1) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ String[] split = line.split(",");
|
|
|
|
+
|
|
|
|
+ //// 添加异常捕获,非正常数据默认为0
|
|
|
|
+ // 1时间 6横向速度 7纵向速度 8横向加速度 9纵向加速度 12steering_angle 13yawrate 27lane_center_offset
|
|
|
|
+ // 时间
|
|
|
|
+ try {
|
|
|
|
+ double aDouble = Double.parseDouble(split[1]);
|
|
|
|
+ if (Double.isNaN(aDouble)) {
|
|
|
|
+ time_list.add(0D);
|
|
|
|
+ } else {
|
|
|
|
+ time_list.add(Double.valueOf(split[1]));
|
|
|
|
+ }
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ time_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 横向速度
|
|
|
|
+ try {
|
|
|
|
+ double aDouble = Double.parseDouble(split[6]);
|
|
|
|
+ if (Double.isNaN(aDouble)) {
|
|
|
|
+ lateral_velocity_list.add(0D);
|
|
|
|
+ } else {
|
|
|
|
+ lateral_velocity_list.add(Double.valueOf(split[6]));
|
|
|
|
+ }
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ lateral_velocity_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 纵向速度
|
|
|
|
+ try {
|
|
|
|
+ double aDouble = Double.parseDouble(split[7]);
|
|
|
|
+ if (Double.isNaN(aDouble)) {
|
|
|
|
+ longitudinal_velocity_list.add(0D);
|
|
|
|
+ } else {
|
|
|
|
+ longitudinal_velocity_list.add(Double.valueOf(split[7]));
|
|
|
|
+ }
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ longitudinal_velocity_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 横向加速度
|
|
|
|
+ try {
|
|
|
|
+ double aDouble = Double.parseDouble(split[8]);
|
|
|
|
+ if (Double.isNaN(aDouble)) {
|
|
|
|
+ lateral_acceleration_list.add(0D);
|
|
|
|
+ } else {
|
|
|
|
+ lateral_acceleration_list.add(Double.valueOf(split[8]));
|
|
|
|
+ }
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ lateral_acceleration_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 纵向加速度
|
|
|
|
+ try {
|
|
|
|
+ double aDouble = Double.parseDouble(split[9]);
|
|
|
|
+ if (Double.isNaN(aDouble)) {
|
|
|
|
+ longitudinal_acceleration_list.add(0D);
|
|
|
|
+ } else {
|
|
|
|
+ longitudinal_acceleration_list.add(Double.valueOf(split[9]));
|
|
|
|
+ }
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ longitudinal_acceleration_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // steering_angle
|
|
|
|
+ try {
|
|
|
|
+ double aDouble = Double.parseDouble(split[12]);
|
|
|
|
+ if (Double.isNaN(aDouble)) {
|
|
|
|
+ steeting_wheel_list.add(0D);
|
|
|
|
+ } else {
|
|
|
|
+ steeting_wheel_list.add(Double.valueOf(split[12]));// steering_angle
|
|
|
|
+ }
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ steeting_wheel_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ double aDouble = Double.parseDouble(split[13]);
|
|
|
|
+ if (Double.isNaN(aDouble)) {
|
|
|
|
+ yawrate_list.add(0D);
|
|
|
|
+ } else {
|
|
|
|
+ yawrate_list.add(Double.valueOf(split[13]));
|
|
|
|
+ }
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ yawrate_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ double aDouble = Double.parseDouble(split[27]);
|
|
|
|
+ if (Double.isNaN(aDouble)) {
|
|
|
|
+ lane_offset_list.add(0D);
|
|
|
|
+ } else {
|
|
|
|
+ lane_offset_list.add(Double.valueOf(split[27]));// lane_center_offset
|
|
|
|
+ }
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ lane_offset_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // brake_list.add(Double.valueOf(split[])); ///TODO 没有
|
|
|
|
+ // throttle_list.add(Double.valueOf(split[]));///TODO 没有
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ // 里程
|
|
|
|
+ double lc = 0.0;
|
|
|
|
+ for (int i = 0; i < time_list.size(); i++) {
|
|
|
|
+ if (i == 0) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ lc += (time_list.get(i) - time_list.get(i - 1)) * longitudinal_velocity_list.get(i - 1);
|
|
|
|
|
|
- projectDetailsVo.setPackageName(scenePackagePO.getPackageName());
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- // 算法配置
|
|
|
|
- AlgorithmPO algorithmBaseInfoVo = getAlgorithmInfo(poParam);
|
|
|
|
- // 获取测试得分列表
|
|
|
|
- List<AlgorithmScoreVo> firstTargetScore = getFirstTargetScore(param.getId());
|
|
|
|
- projectDetailsVo.setAlgorithmScoreList(firstTargetScore);
|
|
|
|
|
|
+ // 平均速度
|
|
|
|
+ Double pjsd = lc / time_list.get(time_list.size() - 1);
|
|
|
|
+ pjsd = saveTwoDecimalPlaces(pjsd, 4);
|
|
|
|
+
|
|
|
|
+ Double zdsd = Collections.max(longitudinal_velocity_list); // 最大速度
|
|
|
|
+ Double zxsd = Collections.min(longitudinal_velocity_list); // 最小速度
|
|
|
|
+ Double maxLateralAcceleration = Collections.max(lateral_acceleration_list); // 最大横向加速度
|
|
|
|
+ Double minLateralAcceleration = Collections.min(lateral_acceleration_list); // 最小横向加速度(最大横向减速度)
|
|
|
|
+ Double maxLongitudinalAcceleration = Collections.max(longitudinal_acceleration_list); // 最大纵向加速度
|
|
|
|
+ Double minLongitudinalAcceleration = Collections.min(longitudinal_acceleration_list); // 最小纵向加速度
|
|
|
|
+ Double zdbjsd = Collections.max(yawrate_list); // 最大摆角速度
|
|
|
|
+
|
|
|
|
+ // 自车速度方差
|
|
|
|
+ Double zcsdfc = 0D;
|
|
|
|
+ for (Double d : longitudinal_velocity_list) {
|
|
|
|
+ zcsdfc += Math.pow(d - pjsd, 2);
|
|
|
|
+ }
|
|
|
|
+ zcsdfc = zcsdfc / longitudinal_velocity_list.size();
|
|
|
|
+ zcsdfc = saveTwoDecimalPlaces(zcsdfc, 4);
|
|
|
|
+
|
|
|
|
+ // 自车横摆角速度均方根
|
|
|
|
+ Double zchbjsdjfg = 0D;
|
|
|
|
+ for (Double d : yawrate_list) {
|
|
|
|
+ // zchbjsdjfg += Math.pow(d-pjsd,2);
|
|
|
|
+ zchbjsdjfg += Math.pow(d, 2);
|
|
|
|
+ }
|
|
|
|
+ zchbjsdjfg = Math.sqrt(zchbjsdjfg / yawrate_list.size());
|
|
|
|
+ zchbjsdjfg = saveTwoDecimalPlaces(zchbjsdjfg, 4);
|
|
|
|
+
|
|
|
|
+ // for (int i = 0; i < lateral_acceleration.size(); i++) {
|
|
|
|
+ // Double aDouble = lateral_acceleration.get(i);
|
|
|
|
+ // Double aDouble1 = longitudinal_acceleration_list.get(i);
|
|
|
|
+ // double d = Math.pow(aDouble, 2) + Math.pow(aDouble1, 2);
|
|
|
|
+ // acceleration_list.add(Math.sqrt(d));
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < lateral_velocity_list.size(); i++) {
|
|
|
|
+ Double aDouble = lateral_velocity_list.get(i);
|
|
|
|
+ Double aDouble1 = longitudinal_velocity_list.get(i);
|
|
|
|
+ double d = Math.pow(aDouble, 2) + Math.pow(aDouble1, 2);
|
|
|
|
+ velocity_list.add(Math.sqrt(d) * 3.6);
|
|
|
|
+ }
|
|
|
|
|
|
- // 车辆配置
|
|
|
|
- VehiclePO vehicleBaseInfoVo = null;
|
|
|
|
- String vehicleConfigId = poParam.getVehicle();
|
|
|
|
|
|
+ // 获取视频预览路径
|
|
|
|
+ List<String> list1 = new ArrayList<>();
|
|
|
|
+ String runResultFilePath = po.getRunResultFilePath();
|
|
|
|
+ MinioParameter minioParameter1 = new MinioParameter();
|
|
|
|
+ minioParameter1.setObjectName(runResultFilePath);
|
|
|
|
+ ResponseBodyVO<List<String>> list = fileDownService.list(minioParameter1);
|
|
|
|
+ List<String> info = list.getInfo();
|
|
|
|
+ for (String s : info) {
|
|
|
|
+ String substring = s.substring(s.lastIndexOf(".") + 1);
|
|
|
|
+ if ("mp4".equals(substring)) {
|
|
|
|
+ // mp4视频文件
|
|
|
|
+ minioParameter1.setObjectName(s);
|
|
|
|
+ ResponseBodyVO<String> preview = fileDownService.getPreviewUrl(minioParameter1);
|
|
|
|
+ list1.add(preview.getInfo());
|
|
|
|
+ }
|
|
|
|
|
|
- ConfigPO configPO = new ConfigPO();
|
|
|
|
- configPO.setId(vehicleConfigId);
|
|
|
|
- List<ConfigPO> configVehicleVOS = simulationProjectMapper.selectConfigVehicle(configPO);
|
|
|
|
- if (!isEmpty(configVehicleVOS)) {
|
|
|
|
- ConfigPO configVehicleVO = configVehicleVOS.get(0);
|
|
|
|
- List<VehiclePO> vehiclePOS = simulationProjectMapper.selectVehicleBaseInfoById(configVehicleVO.getVehicleId());
|
|
|
|
- if (!isEmpty(vehiclePOS)) {
|
|
|
|
- vehicleBaseInfoVo = vehiclePOS.get(0);
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ // 任务详情信息
|
|
|
|
+ resultVo.setMileage(Double.toString(lc));
|
|
|
|
+ resultVo.setAverageVelocity(saveTwoDecimalPlaces(pjsd * 3.6, 4).toString());
|
|
|
|
+ resultVo.setMaximunSpeed(zdsd.toString()); // 最大速度
|
|
|
|
+ resultVo.setMinimunVelocity(zxsd.toString()); // 最小速度
|
|
|
|
+ resultVo.setMaximumAcceleration(maxLateralAcceleration.toString()); // 最大横向加速度
|
|
|
|
+ resultVo.setMaximumDeceleration(minLateralAcceleration.toString()); // 最大横向减速度
|
|
|
|
+ resultVo.setMaxLongitudinalAcceleration(maxLongitudinalAcceleration.toString()); // 最大纵向加速度
|
|
|
|
+ resultVo.setMinLongitudinalAcceleration(minLongitudinalAcceleration.toString()); // 最小纵向加速度
|
|
|
|
+ resultVo.setMaximumSwingSpeed(zdbjsd.toString());
|
|
|
|
+ resultVo.setSpeedVariance(zcsdfc);
|
|
|
|
+ // resultVo.setSpeedComfortLevel(po.getSpeedComfortLevel());
|
|
|
|
+
|
|
|
|
+ resultVo.setSwingSpeedMeanSquareRoot(zchbjsdjfg);
|
|
|
|
+ // resultVo.setSwingComfortLevel(po.getSwingComfortLevel());
|
|
|
|
+ resultVo.setVideoUrl(list1);
|
|
|
|
+
|
|
|
|
+ HashMap<String, List<Double>> CurveData = new HashMap<>();
|
|
|
|
+ CurveData.put("time", time_list);
|
|
|
|
+ CurveData.put("acceleration", lateral_acceleration_list);
|
|
|
|
+ CurveData.put("acceleration_longitudinal", longitudinal_acceleration_list);
|
|
|
|
+ CurveData.put("lane_offset", lane_offset_list);
|
|
|
|
+ CurveData.put("brake", brake_list);
|
|
|
|
+ CurveData.put("steeting", steeting_wheel_list);
|
|
|
|
+ CurveData.put("throttle", throttle_list);
|
|
|
|
+ CurveData.put("yaw_rate", yawrate_list);
|
|
|
|
+ CurveData.put("velocity", velocity_list); // 速度变化曲线
|
|
|
|
+ resultVo.setCurveData(CurveData);
|
|
|
|
+
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+
|
|
|
|
+ } finally {
|
|
|
|
+ try {
|
|
|
|
+ if (fileInputStream != null) {
|
|
|
|
+ fileInputStream.close();
|
|
|
|
+ }
|
|
|
|
+ if (inputStreamReader != null) {
|
|
|
|
+ inputStreamReader.close();
|
|
|
|
+ }
|
|
|
|
+ if (bufferedReader != null) {
|
|
|
|
+ bufferedReader.close();
|
|
|
|
+ }
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, resultVo);
|
|
}
|
|
}
|
|
- /*
|
|
|
|
- * String vehicleImage = vehicleBaseInfoVo.getVehicleImage();
|
|
|
|
- * if(!isEmpty(vehicleImage)){
|
|
|
|
- * vehicleBaseInfoVo.setVehicleImage(vehicleImage.replaceFirst("Front side"
|
|
|
|
- * ,"Top"));
|
|
|
|
- * }
|
|
|
|
- */
|
|
|
|
|
|
|
|
- List<ConfigSensorPO> vehicleSensorVos = simulationProjectMapper.selectVehicleSensor(vehicleConfigId);
|
|
|
|
-
|
|
|
|
- List<SensorBaseInfoVo> sensorCameraList = new ArrayList<>();
|
|
|
|
- List<SensorBaseInfoVo> sensorOgtList = new ArrayList<>();
|
|
|
|
- List<SensorBaseInfoVo> sensorLidarList = new ArrayList<>();
|
|
|
|
- List<SensorBaseInfoVo> sensorRadarList = new ArrayList<>();
|
|
|
|
- List<SensorBaseInfoVo> sensorGpsList = new ArrayList<>();
|
|
|
|
- for (ConfigSensorPO vs : vehicleSensorVos) {
|
|
|
|
- String sensorType = vs.getSensorType();
|
|
|
|
- String sensorId = vs.getSensorId();
|
|
|
|
- if (DictConstants.SENSOR_CAMERA.equals(sensorType)) {
|
|
|
|
- // 摄像头
|
|
|
|
- SensorBaseInfoVo sensorBaseInfoVo = simulationProjectMapper.selectSensorCamera(sensorId);
|
|
|
|
- if (ObjectUtil.isNotNull(sensorBaseInfoVo) && sensorBaseInfoVo.getShare().equals("0")) {
|
|
|
|
- sensorBaseInfoVo.setSensorName("私有/" + sensorBaseInfoVo.getSensorName());
|
|
|
|
- } else if (ObjectUtil.isNotNull(sensorBaseInfoVo) && sensorBaseInfoVo.getShare().equals("1")) {
|
|
|
|
- sensorBaseInfoVo.setSensorName("公有/" + sensorBaseInfoVo.getSensorName());
|
|
|
|
- }
|
|
|
|
- setVehicleConfig(sensorBaseInfoVo, vs);
|
|
|
|
- sensorCameraList.add(sensorBaseInfoVo);
|
|
|
|
- } else if (DictConstants.SENSOR_OGT.equals(sensorType)) {
|
|
|
|
- // 完美传感器
|
|
|
|
- SensorBaseInfoVo sensorBaseInfoVo = simulationProjectMapper.selectSensorOgt(sensorId);
|
|
|
|
- if (ObjectUtil.isNotNull(sensorBaseInfoVo) && sensorBaseInfoVo.getShare().equals("0")) {
|
|
|
|
- sensorBaseInfoVo.setSensorName("私有/" + sensorBaseInfoVo.getSensorName());
|
|
|
|
- } else if (ObjectUtil.isNotNull(sensorBaseInfoVo) && sensorBaseInfoVo.getShare().equals("1")) {
|
|
|
|
- sensorBaseInfoVo.setSensorName("公有/" + sensorBaseInfoVo.getSensorName());
|
|
|
|
- }
|
|
|
|
- setVehicleConfig(sensorBaseInfoVo, vs);
|
|
|
|
- sensorOgtList.add(sensorBaseInfoVo);
|
|
|
|
- } else if (DictConstants.SENSOR_LIDAR.equals(sensorType)) {
|
|
|
|
- // 激光雷达
|
|
|
|
- SensorBaseInfoVo sensorBaseInfoVo = simulationProjectMapper.selectSensorLidar(sensorId);
|
|
|
|
- if (ObjectUtil.isNotNull(sensorBaseInfoVo) && sensorBaseInfoVo.getShare().equals("0")) {
|
|
|
|
- sensorBaseInfoVo.setSensorName("私有/" + sensorBaseInfoVo.getSensorName());
|
|
|
|
- } else if (ObjectUtil.isNotNull(sensorBaseInfoVo) && sensorBaseInfoVo.getShare().equals("1")) {
|
|
|
|
- sensorBaseInfoVo.setSensorName("公有/" + sensorBaseInfoVo.getSensorName());
|
|
|
|
- }
|
|
|
|
- setVehicleConfig(sensorBaseInfoVo, vs);
|
|
|
|
- sensorLidarList.add(sensorBaseInfoVo);
|
|
|
|
- } else if (DictConstants.SENSOR_RADAR.equals(sensorType)) {
|
|
|
|
- // 毫米波雷达
|
|
|
|
- SensorBaseInfoVo sensorBaseInfoVo = simulationProjectMapper.selectSensorRadar(sensorId);
|
|
|
|
- if (ObjectUtil.isNotNull(sensorBaseInfoVo) && sensorBaseInfoVo.getShare().equals("0")) {
|
|
|
|
- sensorBaseInfoVo.setSensorName("私有/" + sensorBaseInfoVo.getSensorName());
|
|
|
|
- } else if (ObjectUtil.isNotNull(sensorBaseInfoVo) && sensorBaseInfoVo.getShare().equals("1")) {
|
|
|
|
- sensorBaseInfoVo.setSensorName("公有/" + sensorBaseInfoVo.getSensorName());
|
|
|
|
- }
|
|
|
|
- setVehicleConfig(sensorBaseInfoVo, vs);
|
|
|
|
- sensorRadarList.add(sensorBaseInfoVo);
|
|
|
|
- } else if (DictConstants.SENSOR_GPS.equals(sensorType)) {
|
|
|
|
- // gps
|
|
|
|
- SensorBaseInfoVo sensorBaseInfoVo = simulationProjectMapper.selectSensorGps(sensorId);
|
|
|
|
- setVehicleConfig(sensorBaseInfoVo, vs);
|
|
|
|
- sensorGpsList.add(sensorBaseInfoVo);
|
|
|
|
- }
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public String getDictName(String type, String code) {
|
|
|
|
+ Map<String, String> stringStringMap = getDictByType(type);
|
|
|
|
+ if (stringStringMap != null && stringStringMap.size() > 0) {
|
|
|
|
+ return stringStringMap.get(code);
|
|
|
|
+ }
|
|
|
|
+ return "";
|
|
}
|
|
}
|
|
|
|
|
|
- // 任务信息
|
|
|
|
- ProjectTaskParam projectTaskParam = new ProjectTaskParam();
|
|
|
|
- projectTaskParam.setPId(poParam.getId());
|
|
|
|
- List<ProjectRunResultRatioNumVo> projectRunResultRatioNumVos = null;
|
|
|
|
|
|
+ private Map<String, String> getDictByType(String type) {
|
|
|
|
+ DictParam dictParam = new DictParam();
|
|
|
|
+ dictParam.setDictTypes(type);
|
|
|
|
+ Map<String, Map<String, String>> dictMapsByTypes = dictService.getDictMapsByTypes(dictParam);
|
|
|
|
+ Map<String, String> stringStringMap = dictMapsByTypes.get(type);
|
|
|
|
+ if (stringStringMap != null && stringStringMap.size() > 0) {
|
|
|
|
+ return stringStringMap;
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
|
|
- // 任务运行状态统计
|
|
|
|
- List<ProjectRunStateNumVo> projectRunStateNumVos = null;
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- // 任务运行结果统计
|
|
|
|
- List<ProjectRunResultRatioNumVo> resultScoreList = null;
|
|
|
|
|
|
+ @Override
|
|
|
|
+ @SneakyThrows
|
|
|
|
+ public ResponseBodyVO<String> analysisVehicleCoord() {
|
|
|
|
+ analysisCsvFile("E:\\仿真云平台\\三维还原视频说明\\360ogt.csv", new int[]{6, 7, 9});
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
|
|
|
- Integer size = simulationProjectTaskMapper.selectProjectTaskNumByProjectId(projectTaskParam);
|
|
|
|
- if (size > 0) {
|
|
|
|
- projectRunStateNumVos = simulationProjectTaskMapper.selectRunStateCount(poParam.getId());
|
|
|
|
- taskRunState(projectRunStateNumVos, size);
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- projectRunResultRatioNumVos = simulationProjectTaskMapper.selectRunResultCount(poParam.getId());
|
|
|
|
- taskResultState(projectRunResultRatioNumVos, size);
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<PageInfo<ManualProjectTaskVo>> selectProjectTaskList(SimulationManualProjectParam param) {
|
|
|
|
+ // 查询任务信息
|
|
|
|
+ ProjectTaskParam projectTaskParam = new ProjectTaskParam();
|
|
|
|
+ projectTaskParam.setPId(param.getId());
|
|
|
|
+ setPage(param.getCurrentPage() == null ? 1 : param.getCurrentPage(), param.getPageSize() == null ? 10 : param.getPageSize());
|
|
|
|
+ List<ManualProjectTaskVo> tasks = simulationProjectTaskMapper.selectProjectTaskByProjectId(projectTaskParam);
|
|
|
|
+ tasks.forEach(task -> {
|
|
|
|
+ if (StateConstant.Aborted.getEnglish().equals(task.getRunState())) {
|
|
|
|
+ task.setRunState(StateConstant.Aborted.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.PendingAnalysis.getEnglish().equals(task.getRunState())) {
|
|
|
|
+ task.setRunState(StateConstant.PendingAnalysis.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Running.getEnglish().equals(task.getRunState())) {
|
|
|
|
+ task.setRunState(StateConstant.Running.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Analysing.getEnglish().equals(task.getRunState())) {
|
|
|
|
+ task.setRunState(StateConstant.Analysing.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Completed.getEnglish().equals(task.getRunState())) {
|
|
|
|
+ task.setRunState(StateConstant.Completed.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Terminated.getEnglish().equals(task.getRunState())) {
|
|
|
|
+ task.setRunState(StateConstant.Terminated.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Terminating.getEnglish().equals(task.getRunState())) {
|
|
|
|
+ task.setRunState(StateConstant.Terminating.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Pending.getEnglish().equals(task.getRunState())) {
|
|
|
|
+ task.setRunState(StateConstant.Pending.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Success.getEnglish().equals(task.getRunResult())) {
|
|
|
|
+ task.setRunResult(StateConstant.Success.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Failed.getEnglish().equals(task.getRunResult())) {
|
|
|
|
+ task.setRunResult(StateConstant.Failed.getChinese());
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
|
|
- resultScoreList = simulationProjectTaskMapper.selectScoreCount(poParam.getId());
|
|
|
|
|
|
+ PageInfo<ManualProjectTaskVo> pageInfo = new PageInfo<>(tasks);
|
|
|
|
|
|
- // 未完成得分为”“的改为0
|
|
|
|
- if (!isEmpty(resultScoreList) && resultScoreList.size() == 1 && isEmpty(resultScoreList.get(0).getResultName())) {
|
|
|
|
- ProjectRunResultRatioNumVo projectRunResultRatioNumVo = resultScoreList.get(0);
|
|
|
|
- projectRunResultRatioNumVo.setResultName("0");
|
|
|
|
- }
|
|
|
|
- taskScore(resultScoreList, size);
|
|
|
|
|
|
+ if (pageInfo.getList() != null) {
|
|
|
|
+ for (ManualProjectTaskVo task : pageInfo.getList()) {
|
|
|
|
+ task.setRunStartTimeFmt(getRqStr(task.getRunStartTime(), 1));
|
|
|
|
+ task.setRunEndTimeFmt(getRqStr(task.getRunEndTime(), 1));
|
|
|
|
+ setUpSceneInfo(task);
|
|
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, pageInfo);
|
|
}
|
|
}
|
|
|
|
|
|
- projectDetailsVo.setProjectId(poParam.getProjectId());
|
|
|
|
- projectDetailsVo.setProjectName(poParam.getProjectName());
|
|
|
|
- projectDetailsVo.setProjectDescribe(poParam.getProjectDescribe());
|
|
|
|
- projectDetailsVo.setStartTime(getRqStr(poParam.getStartTime(), 1));
|
|
|
|
- projectDetailsVo.setFinishTime(getRqStr(poParam.getFinishTime(), 1));
|
|
|
|
- projectDetailsVo.setNowRunState(poParam.getNowRunState());
|
|
|
|
- projectDetailsVo.setNowRunStateName(getDictName(DictConstants.PROJECT_RUN_STATE, poParam.getNowRunState()));
|
|
|
|
- projectDetailsVo.setEvaluationLevel(getDictName(DictConstants.EVALUATION_LEVEL, poParam.getEvaluationLevel()));
|
|
|
|
- // projectDetailsVo.setEvaluationLevel(s);
|
|
|
|
- if (algorithmBaseInfoVo != null) {
|
|
|
|
- projectDetailsVo.setAlgorithmName(algorithmBaseInfoVo.getAlgorithmName());
|
|
|
|
- projectDetailsVo.setAlgorithmDescribe(algorithmBaseInfoVo.getDescription());
|
|
|
|
|
|
+ private void analysisCsvFile(String filePath, int[] analysisFields) throws Exception {
|
|
|
|
+
|
|
|
|
+ File file = new File(filePath);
|
|
|
|
+ InputStream fileInputStream = Files.newInputStream(file.toPath());
|
|
|
|
+ InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
|
|
|
|
+ BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
|
|
|
|
+ String line;
|
|
|
|
+ while ((line = bufferedReader.readLine()) != null) {
|
|
|
|
+ String[] split = line.split(",");
|
|
|
|
+ for (int fs : analysisFields) {
|
|
|
|
+ System.out.println(split[fs]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (vehicleBaseInfoVo != null) {
|
|
|
|
- projectDetailsVo.setVehicleName(vehicleBaseInfoVo.getVehicleName());
|
|
|
|
- projectDetailsVo.setVehicleDescribe(vehicleBaseInfoVo.getDescription());
|
|
|
|
- projectDetailsVo.setVehicleTopView(vehicleBaseInfoVo.getVehicleFrontView());
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 根据场景id和场景类型获取场景名
|
|
|
|
+ *
|
|
|
|
+ * @return 场景名称
|
|
|
|
+ */
|
|
|
|
+ private SceneBaseInfoVo getSceneNameAndOther(String sceneId, String sceneType) {
|
|
|
|
+ SceneBaseInfoVo resultVo = new SceneBaseInfoVo();
|
|
|
|
+ if (DictConstants.SCENE_NATURAL.equals(sceneType)) {
|
|
|
|
+ SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneNatural(sceneId);
|
|
|
|
+ if (sceneBaseInfoVo != null) {
|
|
|
|
+ resultVo.setCommonSceneName(sceneBaseInfoVo.getNaturalName());
|
|
|
|
+ }
|
|
|
|
+ } else if (DictConstants.SCENE_STANDARD.equals(sceneType)) {
|
|
|
|
+ SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneStandardsRegulations(sceneId);
|
|
|
|
+ if (sceneBaseInfoVo != null) {
|
|
|
|
+ resultVo.setCommonSceneName(sceneBaseInfoVo.getSceneName());
|
|
|
|
+ }
|
|
|
|
+ } else if (DictConstants.SCENE_ACCIDENT.equals(sceneType)) {
|
|
|
|
+ SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneAccidentById(sceneId);
|
|
|
|
+ if (sceneBaseInfoVo != null) {
|
|
|
|
+ resultVo.setCommonSceneName(sceneBaseInfoVo.getSceneName());
|
|
|
|
+ }
|
|
|
|
+ } else if (DictConstants.SCENE_GENERAL.equals(sceneType)) {
|
|
|
|
+ SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneGeneralDataById(sceneId);
|
|
|
|
+ if (sceneBaseInfoVo != null) {
|
|
|
|
+ resultVo.setCommonSceneName(sceneBaseInfoVo.getSceneName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return resultVo;
|
|
}
|
|
}
|
|
- projectDetailsVo.setSensorCameraList(sensorCameraList);
|
|
|
|
- projectDetailsVo.setSensorOgtList(sensorOgtList);
|
|
|
|
- projectDetailsVo.setSensorLidarList(sensorLidarList);
|
|
|
|
- projectDetailsVo.setSensorRadarList(sensorRadarList);
|
|
|
|
- projectDetailsVo.setSensorGpsList(sensorGpsList);
|
|
|
|
- projectDetailsVo.setStateList(projectRunStateNumVos);
|
|
|
|
- projectDetailsVo.setResultList(projectRunResultRatioNumVos);
|
|
|
|
- projectDetailsVo.setResultScoreList(resultScoreList);
|
|
|
|
-
|
|
|
|
- projectDetailsVo.setParallelism(poParam.getParallelism());
|
|
|
|
- projectDetailsVo.setMaxSimulationTime(poParam.getMaxSimulationTime());
|
|
|
|
- String isChoiceGpu = poParam.getIsChoiceGpu();
|
|
|
|
- String g = "";
|
|
|
|
- if ("0".equals(isChoiceGpu)) {
|
|
|
|
- g = "是";
|
|
|
|
- } else if ("1".equals(isChoiceGpu)) {
|
|
|
|
- g = "否";
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 查询算法下拉列表
|
|
|
|
+ *
|
|
|
|
+ * @param result
|
|
|
|
+ * @param algorithmType 算法类型
|
|
|
|
+ */
|
|
|
|
+ private void setAlgorithmDropDown(List<DropDownTypeVo> result, String algorithmType) {
|
|
|
|
+ List<DropDownVo> algorithmList = new ArrayList<>();
|
|
|
|
+ if (DictConstants.FILE.equals(algorithmType) || DictConstants.GIT.equals(algorithmType)) {
|
|
|
|
+ AlgorithmPO algorithmPO = new AlgorithmPO();
|
|
|
|
+ algorithmPO.setCreateUserId(AuthUtil.getCurrentUserId()); // 获取当前用户 id
|
|
|
|
+ if (StringUtil.isEmpty(algorithmType)) {
|
|
|
|
+ algorithmPO.setUploadMode("1");
|
|
|
|
+ } else {
|
|
|
|
+ algorithmPO.setUploadMode(algorithmType);
|
|
|
|
+ }
|
|
|
|
+ List<AlgorithmPO> algorithmBaseInfoVo = simulationProjectMapper.selectAlgorithmBaseInfoById(algorithmPO);
|
|
|
|
+
|
|
|
|
+ for (AlgorithmPO v : algorithmBaseInfoVo) {
|
|
|
|
+ DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
+ dropDownVo.setId(v.getId());
|
|
|
|
+ dropDownVo.setName(v.getAlgorithmName());
|
|
|
|
+ dropDownVo.setDescription(v.getDescription());
|
|
|
|
+ dropDownVo.setShare(v.getShare());
|
|
|
|
+ algorithmList.add(dropDownVo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (DictConstants.PLATFORM.equals(algorithmType)) {
|
|
|
|
+ // 第三方算法平台获取(索为)
|
|
|
|
+ String sort = "algorithmId-desc";
|
|
|
|
+ int page = 1;
|
|
|
|
+ int size = 999;// 全部
|
|
|
|
+ String urlParam = "&page=" + page + "&size=" + size + "&sort=" + sort;
|
|
|
|
+ algorithmList = getOtherAlgorithmInfo(urlParam);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ DropDownTypeVo algorithmDropDown = new DropDownTypeVo();
|
|
|
|
+ algorithmDropDown.setDropDownList(algorithmList);
|
|
|
|
+ algorithmDropDown.setType("1");
|
|
|
|
+ result.add(algorithmDropDown);
|
|
|
|
+
|
|
}
|
|
}
|
|
- projectDetailsVo.setIsChoiceGpu(g);
|
|
|
|
|
|
|
|
- /*
|
|
|
|
- * //是否生成报告
|
|
|
|
- * boolean isCreateReport = true;
|
|
|
|
- * String nowRunState = projectDetailsVo.getNowRunState();
|
|
|
|
- * if(!ProjectRunStateEnum.FINISH.getCode().equals(nowRunState)){
|
|
|
|
- * isCreateReport = false;
|
|
|
|
- * }else{
|
|
|
|
- * //查询任务是否存在aborted
|
|
|
|
- * SimulationMptSceneScorePo sPo = new SimulationMptSceneScorePo();
|
|
|
|
- * sPo.setPId(param.getId());
|
|
|
|
- * SceneScoreVo sceneScoreVo =
|
|
|
|
- * simulationProjectTaskMapper.selectRunStateByAborted(sPo);
|
|
|
|
- * if(sceneScoreVo != null && sceneScoreVo.getNum() > 0){
|
|
|
|
- * isCreateReport = false;
|
|
|
|
- * }
|
|
|
|
- * }
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取第三方算法平台的算法信息
|
|
*
|
|
*
|
|
- * projectDetailsVo.setCreateReport(isCreateReport);
|
|
|
|
|
|
+ * @return 第三方算法平台的算法信息
|
|
*/
|
|
*/
|
|
|
|
+ private List<DropDownVo> getOtherAlgorithmInfo(String query) {
|
|
|
|
+
|
|
|
|
+ List<DropDownVo> algorithmList = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ ResponseBodyVO algorithmBody = algoPlatformService.getAlgorithmList(query);
|
|
|
|
+
|
|
|
|
+ // 解析数据
|
|
|
|
+ Map jsonMap = JsonUtil.jsonToMap((String) algorithmBody.getInfo());
|
|
|
|
+ Map<String, Object> dataMap = (Map<String, Object>) jsonMap.get("data");
|
|
|
|
+ List<Map<String, String>> contentList = (List<Map<String, String>>) dataMap.get("content");
|
|
|
|
+ Integer totalElements = (Integer) dataMap.get("totalElements");
|
|
|
|
+ if (totalElements > 0) {
|
|
|
|
+ for (Map<String, String> content : contentList) {
|
|
|
|
+ DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
+ dropDownVo.setId(content.get("algorithmId"));
|
|
|
|
+ dropDownVo.setName(content.get("algorithmName"));
|
|
|
|
+ dropDownVo.setDescription(content.get("description"));
|
|
|
|
+ algorithmList.add(dropDownVo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return algorithmList;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setVehicleDropDown(List<DropDownTypeVo> result, String ConfigId) {
|
|
|
|
+ ConfigPO configPO = new ConfigPO();
|
|
|
|
+ if (StringUtil.isNotEmpty(ConfigId)) {
|
|
|
|
+ configPO.setId(ConfigId);
|
|
|
|
+ }
|
|
|
|
+ configPO.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
|
|
+ List<ConfigPO> vehicleBaseInfoVo = simulationProjectMapper.selectConfigVehicle2(configPO);
|
|
|
|
+ List<DropDownVo> vehicleList = new ArrayList<>();
|
|
|
|
+ for (ConfigPO v : vehicleBaseInfoVo) {
|
|
|
|
+ DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
+ dropDownVo.setId(v.getId());
|
|
|
|
+ dropDownVo.setName(v.getConfigName());
|
|
|
|
+ dropDownVo.setDescription(v.getDescription());
|
|
|
|
+ dropDownVo.setShare(v.getShare());
|
|
|
|
+ // 获取传感器信息
|
|
|
|
+ List<ConfigSensorPO> configSensorVos = simulationProjectMapper.selectConfigSensor(v.getId());
|
|
|
|
+ String sensor = "";
|
|
|
|
+ if (!isEmpty(configSensorVos) && configSensorVos.get(0) != null) {
|
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
+ for (ConfigSensorPO cv : configSensorVos) {
|
|
|
|
+ stringBuilder.append(cv.getSensorType()).append(",");
|
|
|
|
+ }
|
|
|
|
+ sensor = stringBuilder.substring(0, stringBuilder.lastIndexOf(","));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ dropDownVo.setSensor(sensor);
|
|
|
|
+
|
|
|
|
+ vehicleList.add(dropDownVo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ DropDownTypeVo vehicleDropDown = new DropDownTypeVo();
|
|
|
|
+ vehicleDropDown.setDropDownList(vehicleList);
|
|
|
|
+ vehicleDropDown.setType("2");
|
|
|
|
+ result.add(vehicleDropDown);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setScenePackageDropDown(List<DropDownTypeVo> result) {
|
|
|
|
+ ScenePackagePO scenePackagePO = new ScenePackagePO();
|
|
|
|
+ scenePackagePO.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
|
|
+ List<ScenePackagePO> scenePackageBaseVo = simulationProjectMapper.selectScenePackageBaseById(scenePackagePO);
|
|
|
|
+ List<DropDownVo> scenePackageList = new ArrayList<>();
|
|
|
|
+ for (ScenePackagePO v : scenePackageBaseVo) {
|
|
|
|
+ DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
+ dropDownVo.setId(v.getPackageId());
|
|
|
|
+ dropDownVo.setName(v.getPackageName());
|
|
|
|
+ dropDownVo.setSceneNum(String.valueOf(v.getSceneNum()));
|
|
|
|
+ dropDownVo.setShare(v.getShare());
|
|
|
|
+ scenePackageList.add(dropDownVo);
|
|
|
|
+ }
|
|
|
|
+ DropDownTypeVo scenePackageDropDown = new DropDownTypeVo();
|
|
|
|
+ scenePackageDropDown.setDropDownList(scenePackageList);
|
|
|
|
+ scenePackageDropDown.setType("3");
|
|
|
|
+ result.add(scenePackageDropDown);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private SimulationManualProjectPo convertParamToPo(SimulationManualProjectParam param) {
|
|
|
|
+ SimulationManualProjectPo po = new SimulationManualProjectPo();
|
|
|
|
+ po.setId(param.getId());
|
|
|
|
+ po.setProjectName(param.getProjectName());
|
|
|
|
+ po.setProjectDescribe(param.getProjectDescribe());
|
|
|
|
+ po.setAlgorithm(param.getAlgorithm());
|
|
|
|
+ po.setVehicle(param.getVehicle());
|
|
|
|
+ po.setScene(param.getScene());
|
|
|
|
+ // po.setOperationCycle(param.getOperationCycle());
|
|
|
|
+ po.setMaxSimulationTime(param.getMaxSimulationTime());
|
|
|
|
+ po.setParallelism(param.getParallelism());
|
|
|
|
+ // po.setRuleView(param.getRuleView());
|
|
|
|
+ po.setIsChoiceGpu(param.getIsChoiceGpu());
|
|
|
|
+ po.setNowRunState(param.getNowRunState());
|
|
|
|
+ po.setAlgorithmType(param.getAlgorithmType());
|
|
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, projectDetailsVo);
|
|
|
|
- }
|
|
|
|
|
|
+ if (ObjectUtil.isNotNull(param.getVehicleArrayS())) {
|
|
|
|
+ po.setVehicleArray(StringUtils.join(Arrays.asList(param.getVehicleArrayS()), ','));
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.isNotNull(param.getAlgorithmArrayS())) {
|
|
|
|
+ po.setAlgorithmArray(StringUtils.join(Arrays.asList(param.getAlgorithmArrayS()), ','));
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.isNotNull(param.getSceneArrayS())) {
|
|
|
|
+ po.setSceneArray(StringUtils.join(Arrays.asList(param.getSceneArrayS()), ','));
|
|
|
|
+ }
|
|
|
|
+ return po;
|
|
|
|
|
|
- // 运行状态统计
|
|
|
|
- private void taskRunState(List<ProjectRunStateNumVo> vos, Integer size) {
|
|
|
|
- for (ProjectRunStateNumVo pv : vos) {
|
|
|
|
- Integer num = pv.getNum();
|
|
|
|
- Double d = (double) num / size;
|
|
|
|
- d = saveTwoDecimalPlaces(d);
|
|
|
|
- pv.setRatio(d);
|
|
|
|
}
|
|
}
|
|
- // 补全没有的
|
|
|
|
- Map<String, String> dict = getDictByType(ProjectConstants.TASK_RUN_STATE);
|
|
|
|
- for (String key : dict.keySet()) {
|
|
|
|
- boolean b = false;
|
|
|
|
- for (ProjectRunStateNumVo pv : vos) {
|
|
|
|
- if (pv.getStateName().equals(dict.get(key))) {
|
|
|
|
- b = true;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (!b) {
|
|
|
|
- ProjectRunStateNumVo vo = new ProjectRunStateNumVo();
|
|
|
|
- vo.setStateName(dict.get(key));
|
|
|
|
- vo.setNum(0);
|
|
|
|
- vo.setRatio(0D);
|
|
|
|
- vos.add(vo);
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ private void convertPoToVo(SimulationManualProjectVo simulationManualProjectVo, boolean isAuto) {
|
|
|
|
+ // 1 查询算法名称
|
|
|
|
+ String algorithmId = simulationManualProjectVo.getAlgorithm();
|
|
|
|
+ String algorithmType = simulationManualProjectVo.getAlgorithmType();
|
|
|
|
+ String algorithmName;
|
|
|
|
+ if (DictConstants.ALGORITHM_UPLOAD_MODE_PLATFORM.equals(algorithmType)) {
|
|
|
|
+ // 1 获取 token
|
|
|
|
+ algorithmName = algoPlatformService.selectAlgorithmNameByAlgorithmId(algorithmId).getInfo();
|
|
|
|
+ if (StringUtil.isEmpty(algorithmName)) {
|
|
|
|
+ algorithmName = "算法平台已删除该算法";
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ AlgorithmPO algorithmPO = simulationProjectMapper.selectAlgorithmById(algorithmId);
|
|
|
|
+ if (algorithmPO != null && StringUtil.isNotEmpty(algorithmPO.getAlgorithmName())) {
|
|
|
|
+ algorithmName = algorithmPO.getAlgorithmName();
|
|
|
|
+ } else {
|
|
|
|
+ algorithmName = "仿真平台不存在该算法";
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ simulationManualProjectVo.setAlgorithm(algorithmName);
|
|
|
|
+ // 2 是否是自动项目
|
|
|
|
+ if (!isAuto) {
|
|
|
|
+ simulationManualProjectVo.setNowRunStateDict(getDictName(DictConstants.PROJECT_RUN_STATE, simulationManualProjectVo.getNowRunState()));
|
|
|
|
+ simulationManualProjectVo.setEvaluationLevelDict(getDictName(DictConstants.EVALUATION_LEVEL, simulationManualProjectVo.getEvaluationLevel()));
|
|
|
|
+ } else {
|
|
|
|
+ simulationManualProjectVo.setLastRunTimeFmt(getRqStr(simulationManualProjectVo.getLastRunTime(), 1));
|
|
|
|
+ }
|
|
|
|
+ // 3 格式化创建时间字符串
|
|
|
|
+ simulationManualProjectVo.setCreateTimeFmt(getRqStr(simulationManualProjectVo.getCreateTime(), 1));
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- // 运行结果统计
|
|
|
|
- private void taskResultState(List<ProjectRunResultRatioNumVo> vos, Integer size) {
|
|
|
|
- // 结果状态统计
|
|
|
|
- for (ProjectRunResultRatioNumVo rv : vos) {
|
|
|
|
- Integer num = rv.getNum();
|
|
|
|
- Double d = (double) num / size;
|
|
|
|
- d = saveTwoDecimalPlaces(d);
|
|
|
|
- rv.setRatio(d);
|
|
|
|
|
|
+
|
|
|
|
+ private void convertPoToVo(SimulationManualProjectPo po, SimulationManualProjectSingleVo vo) {
|
|
|
|
+ vo.setId(po.getId());
|
|
|
|
+ vo.setProjectName(po.getProjectName());
|
|
|
|
+ vo.setProjectDescribe(po.getProjectDescribe());
|
|
|
|
+ vo.setAlgorithm(po.getAlgorithm());
|
|
|
|
+ vo.setAlgorithmType(po.getAlgorithmType());
|
|
|
|
+ vo.setVehicle(po.getVehicle());
|
|
|
|
+ vo.setScene(po.getScene());
|
|
|
|
+ vo.setMaxSimulationTime(po.getMaxSimulationTime());
|
|
|
|
+ vo.setParallelism(po.getParallelism());
|
|
|
|
+ vo.setIsChoiceGpu(po.getIsChoiceGpu());
|
|
|
|
+
|
|
}
|
|
}
|
|
- // 补全没有的
|
|
|
|
- Map<String, String> dict = getDictByType(ProjectConstants.TASK_RESULT_STATE);
|
|
|
|
- for (String key : dict.keySet()) {
|
|
|
|
- boolean b = false;
|
|
|
|
- for (ProjectRunResultRatioNumVo pv : vos) {
|
|
|
|
- if (dict.get(key).equals(pv.getResultName())) {
|
|
|
|
- b = true;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (!b) {
|
|
|
|
- ProjectRunResultRatioNumVo vo = new ProjectRunResultRatioNumVo();
|
|
|
|
- vo.setResultName(dict.get(key));
|
|
|
|
- vo.setNum(0);
|
|
|
|
- vo.setRatio(0D);
|
|
|
|
- vos.add(vo);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ private void createProjectId(SimulationManualProjectPo po) {
|
|
|
|
+ Integer nowRq = getRq(null, 0);
|
|
|
|
+ po.setProjectDate(nowRq);
|
|
|
|
+ SimulationManualProjectPo po1 = simulationProjectMapper.selectLastProjectId(nowRq);
|
|
|
|
+ if (po1 == null) {
|
|
|
|
+ // 生成新id
|
|
|
|
+ po.setProjectNum(1);
|
|
|
|
+ } else {
|
|
|
|
+ po.setProjectNum(po1.getProjectNum() + 1);
|
|
|
|
+ }
|
|
|
|
+ po.setProjectId(po.getProjectDate() + "-" + po.getProjectNum());
|
|
|
|
+
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 得分统计
|
|
|
|
- */
|
|
|
|
- private void taskScore(List<ProjectRunResultRatioNumVo> vos, Integer size) {
|
|
|
|
- for (ProjectRunResultRatioNumVo rv : vos) {
|
|
|
|
- Integer num = rv.getNum();
|
|
|
|
- Double d = (double) num / size;
|
|
|
|
- d = saveTwoDecimalPlaces(d);
|
|
|
|
- rv.setRatio(d);
|
|
|
|
|
|
+
|
|
|
|
+ private void createProjectId(SimulationAutomaticProjectPo po) {
|
|
|
|
+ Integer nowRq = getRq(null, 0);
|
|
|
|
+ po.setProjectDate(nowRq);
|
|
|
|
+ SimulationAutomaticProjectPo po1 = simulationAutomaticProjectMapper.selectLastProjectId(nowRq);
|
|
|
|
+ if (po1 == null) {
|
|
|
|
+ // 生成新id
|
|
|
|
+ po.setProjectNum(1);
|
|
|
|
+ } else {
|
|
|
|
+ po.setProjectNum(po1.getProjectNum() + 1);
|
|
|
|
+ }
|
|
|
|
+ po.setProjectId(po.getProjectDate() + "-" + po.getProjectNum());
|
|
|
|
+
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- private void setVehicleConfig(SensorBaseInfoVo vo, ConfigSensorPO vs) {
|
|
|
|
- vo.setConfigId(vs.getConfigId());
|
|
|
|
- vo.setSensorId(vs.getSensorId());
|
|
|
|
- vo.setSensorType(vs.getSensorType());
|
|
|
|
- if (StringUtil.isNotEmpty(vs.getSensorX())) {
|
|
|
|
- vo.setSensorX(saveTwoDecimalPlaces(vs.getSensorX().doubleValue()));
|
|
|
|
|
|
+
|
|
|
|
+ private Integer getRq(Date date, int index) {
|
|
|
|
+ return TimeUtil.getRq(date, index);
|
|
}
|
|
}
|
|
- if (StringUtil.isNotEmpty(vs.getSensorY())) {
|
|
|
|
- vo.setSensorY(saveTwoDecimalPlaces(vs.getSensorY().doubleValue()));
|
|
|
|
|
|
+
|
|
|
|
+ private String getRqStr(Date date, int index) {
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat(dateFmtArr[index]);
|
|
|
|
+ if (date == null) {
|
|
|
|
+ return "";
|
|
|
|
+ }
|
|
|
|
+ return sdf.format(date);
|
|
|
|
+
|
|
}
|
|
}
|
|
- if (StringUtil.isNotEmpty(vs.getSensorZ())) {
|
|
|
|
- vo.setSensorZ(saveTwoDecimalPlaces(vs.getSensorZ().doubleValue()));
|
|
|
|
|
|
+
|
|
|
|
+ private Date getDate(String dateFmt, int index) {
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat(dateFmtArr[index]);
|
|
|
|
+ try {
|
|
|
|
+ return sdf.parse(dateFmt);
|
|
|
|
+ } catch (ParseException e) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (StringUtil.isNotEmpty(vs.getSensorH())) {
|
|
|
|
- vo.setSensorH(saveTwoDecimalPlaces(vs.getSensorH().doubleValue()));
|
|
|
|
|
|
+
|
|
|
|
+ private boolean isEmpty(String value) {
|
|
|
|
+ if (value == null) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ value = value.trim();
|
|
|
|
+ if (value.length() == 0) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
- if (StringUtil.isNotEmpty(vs.getSensorP())) {
|
|
|
|
- vo.setSensorP(saveTwoDecimalPlaces(vs.getSensorP().doubleValue()));
|
|
|
|
|
|
+
|
|
|
|
+ private boolean isEmpty(List list) {
|
|
|
|
+ if (list == null || list.size() <= 0) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
- if (StringUtil.isNotEmpty(vs.getSensorR())) {
|
|
|
|
- vo.setSensorR(saveTwoDecimalPlaces(vs.getSensorR().doubleValue()));
|
|
|
|
|
|
+
|
|
|
|
+ private void setPage(Integer pageNum, Integer pageSize) {
|
|
|
|
+ PageVO pageVO = new PageVO();
|
|
|
|
+ pageVO.setCurrentPage(pageNum);
|
|
|
|
+ pageVO.setPageSize(pageSize);
|
|
|
|
+ PageUtil.setPageInfo(pageVO);
|
|
}
|
|
}
|
|
- if (StringUtil.isNotEmpty(vs.getSensorPort())) {
|
|
|
|
- vo.setSensorPort(vs.getSensorPort());
|
|
|
|
|
|
+
|
|
|
|
+ private Double saveTwoDecimalPlaces(Double d) {
|
|
|
|
+ if (d == null) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ return new BigDecimal(d.toString()).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
|
}
|
|
}
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ private Double saveTwoDecimalPlaces(Double d, int num) {
|
|
|
|
+ if (d == null) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ return new BigDecimal(d.toString()).setScale(num, RoundingMode.HALF_UP).doubleValue();
|
|
|
|
+ }
|
|
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<ProjectReportVo> selectProjectReportById(SimulationManualProjectParam param) {
|
|
|
|
- String projectType = param.getProjectType();
|
|
|
|
- // 封装要使用到的数据
|
|
|
|
- SimulationManualProjectPo poParam = new SimulationManualProjectPo();
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 设置场景基本字段
|
|
|
|
+ */
|
|
|
|
+ private void setUpSceneInfo(ManualProjectTaskVo vo) {
|
|
|
|
+ String sceneType = vo.getSceneType();
|
|
|
|
+ String sceneId = vo.getSceneId();
|
|
|
|
+ SceneBaseInfoVo sceneBaseInfoVo;
|
|
|
|
+ if (DictConstants.SCENE_NATURAL.equals(sceneType)) {
|
|
|
|
+ // 自然驾驶
|
|
|
|
+ sceneBaseInfoVo = simulationProjectMapper.selectSceneNatural(sceneId);
|
|
|
|
+ if (sceneBaseInfoVo != null) {
|
|
|
|
+ vo.setSceneName(sceneBaseInfoVo.getNaturalName());
|
|
|
|
+ }
|
|
|
|
+ } else if (DictConstants.SCENE_STANDARD.equals(sceneType)) {
|
|
|
|
+ // 标准法规
|
|
|
|
+ sceneBaseInfoVo = simulationProjectMapper.selectSceneStandardsRegulations(sceneId);
|
|
|
|
+ if (sceneBaseInfoVo != null) {
|
|
|
|
+ vo.setSceneName(sceneBaseInfoVo.getSceneName());
|
|
|
|
+ }
|
|
|
|
+ } else if (DictConstants.SCENE_ACCIDENT.equals(sceneType)) {
|
|
|
|
+ // 交通事故
|
|
|
|
+ sceneBaseInfoVo = simulationProjectMapper.selectSceneAccidentById(sceneId);
|
|
|
|
+ if (sceneBaseInfoVo != null) {
|
|
|
|
+ vo.setSceneName(sceneBaseInfoVo.getSceneName());
|
|
|
|
+ }
|
|
|
|
+ } else if (DictConstants.SCENE_GENERAL.equals(sceneType)) {
|
|
|
|
+ /// TODO 泛化场景暂不支持
|
|
|
|
+ sceneBaseInfoVo = simulationProjectMapper.selectSceneGeneralDataById(sceneId);
|
|
|
|
+ if (sceneBaseInfoVo != null) {
|
|
|
|
+ vo.setSceneName(sceneBaseInfoVo.getSceneName());
|
|
|
|
+ }
|
|
|
|
|
|
- if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
|
|
- // 项目基本信息
|
|
|
|
- poParam = simulationProjectMapper.selectProjectBaseById(param);
|
|
|
|
- } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
|
|
- SimulationManualProjectVo po = simulationAutomaticSubProjectMapper.selectProjectInfo(param);
|
|
|
|
- BeanUtils.copyProperties(po, poParam);
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- // 算法配置
|
|
|
|
- AlgorithmPO algorithmBaseInfoVo = getAlgorithmInfo(poParam);
|
|
|
|
- ProjectReportVo projectReportVo = new ProjectReportVo();
|
|
|
|
- projectReportVo.setProjectId(poParam.getProjectId());
|
|
|
|
- projectReportVo.setProjectName(poParam.getProjectName());
|
|
|
|
- projectReportVo.setAlgorithmName(algorithmBaseInfoVo.getAlgorithmName());
|
|
|
|
- projectReportVo.setAlgorithmDescribe(algorithmBaseInfoVo.getDescription());
|
|
|
|
-
|
|
|
|
- // 添加开始时间
|
|
|
|
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
- if (poParam.getStartTime() != null) {
|
|
|
|
- projectReportVo.setStartTime(dateFormat.format(poParam.getStartTime()));
|
|
|
|
|
|
+ private ManualProjectTaskVo convertManualProjectTaskPoToVo(ManualProjectTaskPo po) {
|
|
|
|
+ ManualProjectTaskVo manualProjectTaskVo = new ManualProjectTaskVo();
|
|
|
|
+ manualProjectTaskVo.setId(po.getId());
|
|
|
|
+ manualProjectTaskVo.setPId(po.getPId());
|
|
|
|
+ manualProjectTaskVo.setSceneId(po.getSceneId());
|
|
|
|
+ // manualProjectTaskVo.setSceneName(po.getSceneName());
|
|
|
|
+ manualProjectTaskVo.setSceneType(po.getSceneType());
|
|
|
|
+ manualProjectTaskVo.setRunStartTimeFmt(getRqStr(po.getRunStartTime(), 2));
|
|
|
|
+ manualProjectTaskVo.setRunEndTimeFmt(getRqStr(po.getRunEndTime(), 2));
|
|
|
|
+ manualProjectTaskVo.setRunState(po.getRunState());
|
|
|
|
+ manualProjectTaskVo.setRunResult(po.getRunResult());
|
|
|
|
+ return manualProjectTaskVo;
|
|
}
|
|
}
|
|
|
|
|
|
- String sceneNames;
|
|
|
|
-
|
|
|
|
- // 算法测试得分表
|
|
|
|
- /*
|
|
|
|
- * 汇总测试得分计算方法:(每一项一级指标的测试得分*测试权重)累加
|
|
|
|
- * 得分率计算方法:每一项一级指标的所有场景得分不为0的数量/每一项一级指标的场景数量
|
|
|
|
- * 汇总得分率计算方法:(每一项一级指标的所有场景得分不为0的数量_累加/每一项一级指标的场景数量_累加)换成(得分累加取平均值)
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 级联获取场景指标得分数据
|
|
|
|
+ *
|
|
|
|
+ * @param parentVoList 首次传null
|
|
|
|
+ * @param isRoot 首次传true
|
|
|
|
+ * @param scenePackageId 场景包id
|
|
|
|
+ * @param pId 项目表id,用于统计得分使用
|
|
|
|
+ * @param level 指标级别
|
|
|
|
+ * @return
|
|
*/
|
|
*/
|
|
|
|
+ private List<ScenePackageSubListVO> selectScenePackageSubListTreeAndSetScore(List<ScenePackageSubListVO> parentVoList, boolean isRoot, String scenePackageId, String pId, Integer level) {
|
|
|
|
|
|
- // 获取得分表一级指标信息
|
|
|
|
- SimulationMptFirstTargetScorePo par = new SimulationMptFirstTargetScorePo();
|
|
|
|
- par.setPId(poParam.getId());
|
|
|
|
- List<SimulationMptFirstTargetScorePo> pos = simulationMptFirstTargetScoreMapper.selectFirstTargetByPid(par);
|
|
|
|
-
|
|
|
|
- List<AlgorithmScoreVo> algorithmScoreVoList = new ArrayList<>();
|
|
|
|
- String evaluationLevelReport;
|
|
|
|
-
|
|
|
|
- StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
-
|
|
|
|
- // 汇总数据初始化
|
|
|
|
- int totalSceneNum = 0;
|
|
|
|
- double totalScore = 0D;
|
|
|
|
- double totalScoreRatio = 0D;
|
|
|
|
- int totalSceneScoreNum = 0;
|
|
|
|
-
|
|
|
|
- // 根据一级指标表结果获取平分细则
|
|
|
|
- for (SimulationMptFirstTargetScorePo firstTargetScorePo : pos) {
|
|
|
|
- // 获取指标信息
|
|
|
|
- int sceneNum = firstTargetScorePo.getSceneNum(); // 一级指标包含场景数量
|
|
|
|
- String weight = firstTargetScorePo.getWeight(); // 一级指标权重
|
|
|
|
- double weightDouble = Double.parseDouble(weight);
|
|
|
|
- // 单个二级指标得分
|
|
|
|
- Double score = firstTargetScorePo.getScore();
|
|
|
|
- totalScore += BigDecimal.valueOf(score).multiply(BigDecimal.valueOf(weightDouble).divide(BigDecimal.valueOf(100))).doubleValue();
|
|
|
|
- // 获取得分不为 0 的场景数量
|
|
|
|
- Integer scoreNum = getSetScoreNum(firstTargetScorePo.getSublistId(), poParam.getId());
|
|
|
|
- totalSceneScoreNum += scoreNum;
|
|
|
|
-
|
|
|
|
- totalScoreRatio += Double.valueOf(scoreNum) / Double.valueOf(sceneNum) * 100;
|
|
|
|
-
|
|
|
|
- AlgorithmScoreVo algorithmScoreVo = new AlgorithmScoreVo();
|
|
|
|
- algorithmScoreVo.setProjectName(firstTargetScorePo.getSublistName());
|
|
|
|
- algorithmScoreVo.setSceneNum(sceneNum);
|
|
|
|
- algorithmScoreVo.setWeight(weight);
|
|
|
|
- algorithmScoreVo.setScore(saveTwoDecimalPlaces(score));
|
|
|
|
- algorithmScoreVo.setScoreRatio(saveTwoDecimalPlaces(Double.valueOf(scoreNum) / Double.valueOf(sceneNum) * 100));
|
|
|
|
-
|
|
|
|
- algorithmScoreVoList.add(algorithmScoreVo);
|
|
|
|
-
|
|
|
|
- // 其他操作
|
|
|
|
- stringBuilder.append(firstTargetScorePo.getSublistName()).append("、");
|
|
|
|
- totalSceneNum += sceneNum;
|
|
|
|
- }
|
|
|
|
- // 汇总
|
|
|
|
- AlgorithmScoreVo algorithmScoreVo = new AlgorithmScoreVo();
|
|
|
|
- algorithmScoreVo.setProjectName("汇总");
|
|
|
|
- algorithmScoreVo.setSceneNum(totalSceneNum);
|
|
|
|
- // 指标权重总和默认是100%
|
|
|
|
- algorithmScoreVo.setWeight("100");
|
|
|
|
- algorithmScoreVo.setScore(saveTwoDecimalPlaces(totalScore));
|
|
|
|
-
|
|
|
|
- totalScoreRatio = Double.valueOf(totalSceneScoreNum) / Double.valueOf(totalSceneNum) * 100;
|
|
|
|
- // 汇总得分率计算方式修改
|
|
|
|
- // algorithmScoreVo.setScoreRatio(saveTwoDecimalPlaces(totalScoreRatio));
|
|
|
|
- algorithmScoreVo.setScoreRatio(NumberUtil.cut(totalScoreRatio, 2));
|
|
|
|
- algorithmScoreVoList.add(algorithmScoreVo);
|
|
|
|
- projectReportVo.setScoreRatio(saveTwoDecimalPlaces(totalScoreRatio));
|
|
|
|
- projectReportVo.setAlgorithmScore(saveTwoDecimalPlaces(totalScore));
|
|
|
|
- evaluationLevelReport = poParam.getEvaluationLevel();
|
|
|
|
- if (DictConstants.EVALUATION_LEVEL_G.equals(evaluationLevelReport)) {
|
|
|
|
- projectReportVo.setEvaluationLevel(DictConstants.EVALUATION_LEVEL_G_DESCRIPTION);
|
|
|
|
- projectReportVo.setEvaluationGrade(DictConstants.EVALUATION_LEVEL_G_DESCRIPTION);
|
|
|
|
- } else if (DictConstants.EVALUATION_LEVEL_A.equals(evaluationLevelReport)) {
|
|
|
|
- projectReportVo.setEvaluationLevel(DictConstants.EVALUATION_LEVEL_A_DESCRIPTION);
|
|
|
|
- projectReportVo.setEvaluationGrade(DictConstants.EVALUATION_LEVEL_A_DESCRIPTION);
|
|
|
|
- } else if (DictConstants.EVALUATION_LEVEL_M.equals(evaluationLevelReport)) {
|
|
|
|
- projectReportVo.setEvaluationLevel(DictConstants.EVALUATION_LEVEL_M_DESCRIPTION);
|
|
|
|
- projectReportVo.setEvaluationGrade(DictConstants.EVALUATION_LEVEL_M_DESCRIPTION);
|
|
|
|
- } else if (DictConstants.EVALUATION_LEVEL_P.equals(evaluationLevelReport)) {
|
|
|
|
- projectReportVo.setEvaluationLevel(DictConstants.EVALUATION_LEVEL_P_DESCRIPTION);
|
|
|
|
- projectReportVo.setEvaluationGrade(DictConstants.EVALUATION_LEVEL_P_DESCRIPTION);
|
|
|
|
- }
|
|
|
|
|
|
+ if (isRoot) {
|
|
|
|
+ // 查找一级节点
|
|
|
|
+ parentVoList = simulationProjectMapper.selectSubSceneByPid(scenePackageId);
|
|
|
|
+ if (!isEmpty(parentVoList)) {
|
|
|
|
+ selectScenePackageSubListTreeAndSetScore(parentVoList, false, null, pId, level);
|
|
|
|
+ }
|
|
|
|
|
|
- sceneNames = stringBuilder.substring(0, stringBuilder.lastIndexOf("、"));
|
|
|
|
- projectReportVo.setAlgorithmEvaluation(algorithmBaseInfoVo.getAlgorithmName() + "经测试获得" + projectReportVo.getEvaluationLevel() + "级评价," + "(" + sceneNames + ")得分率达到了" + projectReportVo.getScoreRatio() + "%。");
|
|
|
|
- projectReportVo.setAlgorithmScoreList(algorithmScoreVoList);
|
|
|
|
- // 指标得分列表
|
|
|
|
- Map<String, Object> stringObjectMap = selectScenePackageSubListAndSetScore(poParam.getScene(), poParam.getId());
|
|
|
|
- projectReportVo.setSubListScoreLiTitle((List<Map>) stringObjectMap.get("headerList"));
|
|
|
|
- projectReportVo.setSubListScoreLi((List<SubScListVo>) stringObjectMap.get("result"));
|
|
|
|
-
|
|
|
|
- // 场景得分列表
|
|
|
|
- Map<String, Object> maps = selectSceneScore2(poParam.getScene(), poParam.getId(), null, projectReportVo);
|
|
|
|
- projectReportVo.setSceneScoreLiTitle((List<Map>) maps.get("headerList"));
|
|
|
|
- projectReportVo.setSceneScoreLi((List<SceneScListVo>) maps.get("result"));
|
|
|
|
-
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, projectReportVo);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private AlgorithmPO getAlgorithmInfo(SimulationManualProjectPo po) {
|
|
|
|
- AlgorithmPO algorithmBaseInfoVo = null;
|
|
|
|
- String algorithmId = po.getAlgorithm();
|
|
|
|
- String algorithmType = po.getAlgorithmType();
|
|
|
|
- // 第三方算法平台
|
|
|
|
- if ("3".equals(algorithmType)) {
|
|
|
|
- String sort = "algorithmId-desc";
|
|
|
|
- int page = 1;
|
|
|
|
- int size = 1;// 全部
|
|
|
|
-
|
|
|
|
- String urlParam = "&algorithmId" + algorithmId + "&page=" + page + "&size=" + size + "&sort=" + sort;
|
|
|
|
- List<DropDownVo> otherAlgorithmInfo = getOtherAlgorithmInfo(urlParam);
|
|
|
|
- if (StringUtil.isNotEmpty(otherAlgorithmInfo)) {
|
|
|
|
- DropDownVo dropDownVo = otherAlgorithmInfo.get(0);
|
|
|
|
- algorithmBaseInfoVo = new AlgorithmPO();
|
|
|
|
- algorithmBaseInfoVo.setAlgorithmName(dropDownVo.getName());
|
|
|
|
- algorithmBaseInfoVo.setDescription(dropDownVo.getDescription());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- algorithmBaseInfoVo = simulationProjectMapper.selectAlgorithmById(algorithmId);
|
|
|
|
- }
|
|
|
|
- return algorithmBaseInfoVo;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 获取添加工作时需要的下拉选项
|
|
|
|
- * 0. 算法列表
|
|
|
|
- * 1. 车辆列表
|
|
|
|
- * 2. 场景列表
|
|
|
|
- */
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<List<DropDownTypeVo>> selectDropDownByType(SimulationManualProjectParam param) {
|
|
|
|
- List<DropDownTypeVo> result = new ArrayList<>();
|
|
|
|
- if (isEmpty(param.getDropDownType())) {
|
|
|
|
- // 获取全部(算法,车辆,场景)
|
|
|
|
- setAlgorithmDropDown(result, param.getAlgorithmType());
|
|
|
|
- setVehicleDropDown(result, null);
|
|
|
|
- setScenePackageDropDown(result);
|
|
|
|
- } else if ("1".equals(param.getDropDownType())) {
|
|
|
|
- setAlgorithmDropDown(result, param.getAlgorithmType());
|
|
|
|
- } else if ("2".equals(param.getDropDownType())) {
|
|
|
|
- setVehicleDropDown(result, null);
|
|
|
|
- } else if ("3".equals(param.getDropDownType())) {
|
|
|
|
- setScenePackageDropDown(result);
|
|
|
|
- }
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, result);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 获取添加工作时需要的下拉选项
|
|
|
|
- * 0. 算法列表
|
|
|
|
- * 1. 车辆列表
|
|
|
|
- * 2. 场景列表
|
|
|
|
- */
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<List<DropDownTypeNewVo>> selectDropDownByTypeNew(SimulationManualProjectParam param) {
|
|
|
|
- List<DropDownTypeNewVo> result = new ArrayList<>();
|
|
|
|
- if (isEmpty(param.getDropDownType())) {
|
|
|
|
- // 获取全部(算法,车辆,场景)
|
|
|
|
- setAlgorithmDropDownNew(result, param.getAlgorithmType());
|
|
|
|
- setVehicleDropDownNew(result);
|
|
|
|
- setScenePackageDropDownNew(result);
|
|
|
|
- } else if ("1".equals(param.getDropDownType())) {
|
|
|
|
- setAlgorithmDropDownNew(result, param.getAlgorithmType());
|
|
|
|
- } else if ("2".equals(param.getDropDownType())) {
|
|
|
|
- setVehicleDropDownNew(result);
|
|
|
|
- } else if ("3".equals(param.getDropDownType())) {
|
|
|
|
- setScenePackageDropDownNew(result);
|
|
|
|
- }
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, result);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<ProjectTaskDetailsVo> selectProjectTaskById(SimulationManualProjectParam param) {
|
|
|
|
- ProjectTaskDetailsVo resultVo = new ProjectTaskDetailsVo();
|
|
|
|
- // 1 获取参数
|
|
|
|
- Optional.ofNullable(param).orElseThrow(() -> new RuntimeException("参数不能为空。"));
|
|
|
|
- Optional.ofNullable(param.getId()).orElseThrow(() -> new RuntimeException("项目 id 不能为空。"));
|
|
|
|
- Optional.ofNullable(param.getTaskId()).orElseThrow(() -> new RuntimeException("任务 id 不能为空。"));
|
|
|
|
- Optional.ofNullable(param.getProjectType()).orElseThrow(() -> new RuntimeException("项目类型不能为空。"));
|
|
|
|
- String id = param.getId();
|
|
|
|
- String taskId = param.getTaskId();
|
|
|
|
- String projectType = param.getProjectType(); // 2
|
|
|
|
- // 2 查询任务信息,手动项目和自动项目共用一个任务表
|
|
|
|
- ProjectTaskParam projectTaskParam = new ProjectTaskParam();
|
|
|
|
- projectTaskParam.setPId(id);
|
|
|
|
- projectTaskParam.setId(taskId);
|
|
|
|
- List<ManualProjectTaskPo> pos = simulationProjectTaskMapper.selectProjectTask(projectTaskParam);
|
|
|
|
- if (CollectionUtil.isEmpty(pos)) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "没有获取到任务信息。");
|
|
|
|
- }
|
|
|
|
- ManualProjectTaskPo po = pos.get(0);
|
|
|
|
- resultVo.setTaskId(po.getId());
|
|
|
|
- String sceneId = po.getSceneId();
|
|
|
|
- String sceneType = po.getSceneType(); // 4
|
|
|
|
- SceneBaseInfoVo sceneBaseInfoVo = getSceneNameAndOther(sceneId, sceneType); // ACC_2-5-1
|
|
|
|
- resultVo.setSceneName(sceneBaseInfoVo.getCommonSceneName()); // ACC_2-5-1
|
|
|
|
- resultVo.setRunStartTime(getRqStr(po.getRunStartTime(), 1)); // 2022-07-27 09:52:04
|
|
|
|
- resultVo.setRunEndTime(getRqStr(po.getRunEndTime(), 1)); // 2022-07-27 09:53:14
|
|
|
|
- resultVo.setRunState(po.getRunState()); // Completed
|
|
|
|
- resultVo.setFinishState(po.getRunResult()); // Completed
|
|
|
|
- resultVo.setSceneDescribe(""); // 场景描述设置为空
|
|
|
|
- // -------------------------------- 获取任务得分详情 --------------------------------
|
|
|
|
- SimulationManualProjectPo poParam = new SimulationManualProjectPo();
|
|
|
|
- if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
|
|
- SimulationManualProjectPo spo = simulationProjectMapper.selectProjectBaseById(param);
|
|
|
|
- Optional.ofNullable(spo).orElseThrow(() -> new RuntimeException("没有获取到数据。"));
|
|
|
|
- poParam = spo;
|
|
|
|
- } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
|
|
- SimulationManualProjectVo spo = simulationAutomaticSubProjectMapper.selectProjectInfo(param);
|
|
|
|
- Optional.ofNullable(spo).orElseThrow(() -> new RuntimeException("没有获取到数据。"));
|
|
|
|
- BeanUtils.copyProperties(spo, poParam);
|
|
|
|
- }
|
|
|
|
- Map<String, Object> stringObjectMap = selectSceneScore(poParam.getScene(), poParam.getId(), taskId);
|
|
|
|
- resultVo.setSceneScoreLiTitle((List<Map>) stringObjectMap.get("headerList"));
|
|
|
|
- resultVo.setSceneScoreLi((List<SceneScListVo>) stringObjectMap.get("result"));
|
|
|
|
- // 1.获取仿真结果文件
|
|
|
|
- InputStream fileInputStream = null;
|
|
|
|
- InputStreamReader inputStreamReader = null;
|
|
|
|
- BufferedReader bufferedReader = null;
|
|
|
|
- try {
|
|
|
|
- // 2.解析仿真文件
|
|
|
|
- // time
|
|
|
|
- List<Double> time_list = new ArrayList<>();
|
|
|
|
- // velocity
|
|
|
|
- List<Double> velocity_list = new ArrayList<>();
|
|
|
|
- List<Double> lateral_velocity_list = new ArrayList<>();// 横 时间
|
|
|
|
- List<Double> longitudinal_velocity_list = new ArrayList<>();// 纵 速度
|
|
|
|
- // acceleration
|
|
|
|
- // List<Double> acceleration_list = new ArrayList<>();
|
|
|
|
- // List<Double> acceleration_list_longitudinal = new ArrayList<>();
|
|
|
|
- List<Double> lateral_acceleration_list = new ArrayList<>(); // 横向加速度
|
|
|
|
- List<Double> longitudinal_acceleration_list = new ArrayList<>(); // 纵向加速度
|
|
|
|
- // lane_offset
|
|
|
|
- List<Double> lane_offset_list = new ArrayList<>();
|
|
|
|
- /// TODO brake
|
|
|
|
- List<Double> brake_list = new ArrayList<>();
|
|
|
|
- // steeting_wheel
|
|
|
|
- List<Double> steeting_wheel_list = new ArrayList<>();
|
|
|
|
- /// TODO throttle
|
|
|
|
- List<Double> throttle_list = new ArrayList<>();
|
|
|
|
-
|
|
|
|
- List<Double> yawrate_list = new ArrayList<>();// 摆角速度
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * File file = new File("E:\\仿真云平台\\任务详情界面数据\\Ego(1).csv");
|
|
|
|
- * fileInputStream = new FileInputStream(file);
|
|
|
|
- * inputStreamReader = new InputStreamReader(fileInputStream,"utf-8");
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- MinioParameter minioParameter = new MinioParameter();
|
|
|
|
- minioParameter.setObjectName(po.getRunResultFilePath() + "/Ego.csv");
|
|
|
|
- // minioParameter.setObjectName("test/ego.csv");
|
|
|
|
- Response download = fileDownService.download(minioParameter);
|
|
|
|
- Response.Body body = download.body();
|
|
|
|
- fileInputStream = body.asInputStream();
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * String path = "/temp" + StringUtil.getRandomCode();
|
|
|
|
- * FileUtil.writeInputStreamToLocalFile(body.asInputStream(),path);
|
|
|
|
- * file = new File(path);
|
|
|
|
- * fileInputStream = new FileInputStream(file);
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- inputStreamReader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8);
|
|
|
|
-
|
|
|
|
- bufferedReader = new BufferedReader(inputStreamReader);
|
|
|
|
- String line;
|
|
|
|
- int lineIndex = 0;
|
|
|
|
- while ((line = bufferedReader.readLine()) != null) {
|
|
|
|
- lineIndex++;
|
|
|
|
- if (lineIndex == 1) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- String[] split = line.split(",");
|
|
|
|
-
|
|
|
|
- //// 添加异常捕获,非正常数据默认为0
|
|
|
|
- // 1时间 6横向速度 7纵向速度 8横向加速度 9纵向加速度 12steering_angle 13yawrate 27lane_center_offset
|
|
|
|
- // 时间
|
|
|
|
- try {
|
|
|
|
- double aDouble = Double.parseDouble(split[1]);
|
|
|
|
- if (Double.isNaN(aDouble)) {
|
|
|
|
- time_list.add(0D);
|
|
|
|
- } else {
|
|
|
|
- time_list.add(Double.valueOf(split[1]));
|
|
|
|
- }
|
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
- time_list.add(0D);
|
|
|
|
- }
|
|
|
|
|
|
+ } else {
|
|
|
|
|
|
- // 横向速度
|
|
|
|
- try {
|
|
|
|
- double aDouble = Double.parseDouble(split[6]);
|
|
|
|
- if (Double.isNaN(aDouble)) {
|
|
|
|
- lateral_velocity_list.add(0D);
|
|
|
|
- } else {
|
|
|
|
- lateral_velocity_list.add(Double.valueOf(split[6]));
|
|
|
|
- }
|
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
- lateral_velocity_list.add(0D);
|
|
|
|
- }
|
|
|
|
|
|
+ // 获取子节点集合
|
|
|
|
+ for (ScenePackageSubListVO pvo : parentVoList) {
|
|
|
|
|
|
- // 纵向速度
|
|
|
|
- try {
|
|
|
|
- double aDouble = Double.parseDouble(split[7]);
|
|
|
|
- if (Double.isNaN(aDouble)) {
|
|
|
|
- longitudinal_velocity_list.add(0D);
|
|
|
|
- } else {
|
|
|
|
- longitudinal_velocity_list.add(Double.valueOf(split[7]));
|
|
|
|
- }
|
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
- longitudinal_velocity_list.add(0D);
|
|
|
|
- }
|
|
|
|
|
|
+ pvo.setLevel(level);
|
|
|
|
|
|
- // 横向加速度
|
|
|
|
- try {
|
|
|
|
- double aDouble = Double.parseDouble(split[8]);
|
|
|
|
- if (Double.isNaN(aDouble)) {
|
|
|
|
- lateral_acceleration_list.add(0D);
|
|
|
|
- } else {
|
|
|
|
- lateral_acceleration_list.add(Double.valueOf(split[8]));
|
|
|
|
- }
|
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
- lateral_acceleration_list.add(0D);
|
|
|
|
|
|
+ // 二级指标获取总分
|
|
|
|
+ if (level == 2) {
|
|
|
|
+ setFirstTargetScore(pvo, pId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<ScenePackageSubListVO> cvoList = simulationProjectMapper.selectSubSceneByPid(pvo.getSublistId());
|
|
|
|
+ if (!isEmpty(cvoList)) {
|
|
|
|
+ // 存入父节点集合中
|
|
|
|
+ pvo.setChildScenePackageSubListVOList(cvoList);
|
|
|
|
+ // 继续查找下一节点
|
|
|
|
+ selectScenePackageSubListTreeAndSetScore(cvoList, false, null, pId, level + 1);
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ // 没有子节点;最后一级,获取指标得分,指标得分说明,和指标下场景得分
|
|
|
|
+ setScore(pvo, pId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- // 纵向加速度
|
|
|
|
- try {
|
|
|
|
- double aDouble = Double.parseDouble(split[9]);
|
|
|
|
- if (Double.isNaN(aDouble)) {
|
|
|
|
- longitudinal_acceleration_list.add(0D);
|
|
|
|
- } else {
|
|
|
|
- longitudinal_acceleration_list.add(Double.valueOf(split[9]));
|
|
|
|
- }
|
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
- longitudinal_acceleration_list.add(0D);
|
|
|
|
|
|
+ return parentVoList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private Map<String, Object> selectSceneScore(String scenePackageId, String projectId, String taskId) {
|
|
|
|
+
|
|
|
|
+ // 1 查询指定项目的所有指标得分结果
|
|
|
|
+ SimulationManualProjectParam query = new SimulationManualProjectParam();
|
|
|
|
+ query.setId(projectId);
|
|
|
|
+ query.setPackageId(scenePackageId);
|
|
|
|
+ List<SublistScoreVo> pos = simulationProjectMapper.selectSubScore2(query);
|
|
|
|
+ // 2 查询指定项目的所有任务得分结果
|
|
|
|
+ ProjectTaskParam param = new ProjectTaskParam();
|
|
|
|
+ param.setPId(projectId);
|
|
|
|
+ if (!isEmpty(taskId)) {
|
|
|
|
+ param.setTaskId(taskId);
|
|
|
|
+ }
|
|
|
|
+ List<ManualProjectTaskVo> taskList = simulationProjectTaskMapper.selectProjectTaskByProjectId(param); // 手动运行项目和自动运行项目使用同一个任务表
|
|
|
|
+
|
|
|
|
+ // 2 拼接场景得分信息
|
|
|
|
+ List<SublistScoreVo> lastSubList = new ArrayList<>();
|
|
|
|
+ for (SublistScoreVo po : pos) {
|
|
|
|
+ if (ObjectUtil.isNotNull(po.getPackageAndRules())) {
|
|
|
|
+ // 获取场景得分信息
|
|
|
|
+ for (ManualProjectTaskVo task : taskList)
|
|
|
|
+ if (task.getLastTargerId().equals(po.getId())) {
|
|
|
|
+ SublistScoreVo sublistScoreVo = new SublistScoreVo();
|
|
|
|
+ BeanUtils.copyProperties(po, sublistScoreVo);
|
|
|
|
+ sublistScoreVo.setRunResult(task.getRunResult());
|
|
|
|
+ sublistScoreVo.setSceneScore(saveTwoDecimalPlaces(task.getScore())); // 得分
|
|
|
|
+ sublistScoreVo.setTargetEvaluate(task.getTargetEvaluate());// 指标评价
|
|
|
|
+ String sceneType = task.getSceneType();
|
|
|
|
+ String sceneId = task.getSceneId();
|
|
|
|
+ String sceneName = "";
|
|
|
|
+ if (DictConstants.SCENE_NATURAL.equals(sceneType)) {
|
|
|
|
+ sublistScoreVo.setSceneType("自然驾驶");
|
|
|
|
+ SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneNatural(sceneId);
|
|
|
|
+ sceneName = sceneBaseInfoVo.getNaturalName();
|
|
|
|
+ } else if (DictConstants.SCENE_STANDARD.equals(sceneType)) {
|
|
|
|
+ sublistScoreVo.setSceneType("标准法规");
|
|
|
|
+ SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneStandardsRegulations(sceneId);
|
|
|
|
+ sceneName = sceneBaseInfoVo.getSceneName();
|
|
|
|
+ } else if (DictConstants.SCENE_ACCIDENT.equals(sceneType)) {
|
|
|
|
+ sublistScoreVo.setSceneType("交通事故");
|
|
|
|
+ SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneAccidentById(sceneId);
|
|
|
|
+ sceneName = sceneBaseInfoVo.getSceneName();
|
|
|
|
+ } else if (DictConstants.SCENE_GENERAL.equals(sceneType)) {
|
|
|
|
+ sublistScoreVo.setSceneType("泛化");
|
|
|
|
+ SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneGeneralDataById(sceneId);
|
|
|
|
+ sceneName = sceneBaseInfoVo.getSceneName();
|
|
|
|
+ }
|
|
|
|
+ sublistScoreVo.setReturnSceneId(sceneName); // 显示场景名称
|
|
|
|
+ lastSubList.add(sublistScoreVo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ int size = 0;
|
|
|
|
+ List<List<String>> result = new ArrayList<>();
|
|
|
|
+ // 新增返回状态
|
|
|
|
+ ArrayList<String> runStateList = new ArrayList<>();
|
|
|
|
+ // 末级指标
|
|
|
|
+ for (SublistScoreVo sp : lastSubList) {
|
|
|
|
+ setParentSub(sp, null, pos);
|
|
|
|
+ String sublistName = sp.getSublistName();
|
|
|
|
+ // 失败的任务没有数据,需要校验
|
|
|
|
+ Double sceneScore = sp.getSceneScore();
|
|
|
|
+ if (sceneScore == null) {
|
|
|
|
+ sceneScore = 0D;
|
|
|
|
+ }
|
|
|
|
+ String targetEvaluate = sp.getTargetEvaluate();
|
|
|
|
+ if (targetEvaluate == null) {
|
|
|
|
+ targetEvaluate = "";
|
|
|
|
+ }
|
|
|
|
+ /*
|
|
|
|
+ * sublistName +=
|
|
|
|
+ * ProjectConstants.SEPARATOR+sp.getReturnSceneId()+ProjectConstants.SEPARATOR+
|
|
|
|
+ * sp.getSceneType()+ProjectConstants.SEPARATOR+
|
|
|
|
+ * sp.getSceneScore()+ProjectConstants.SEPARATOR+sp.getTargetEvaluate()+
|
|
|
|
+ * ProjectConstants.SEPARATOR+sp.getScoreExplain();
|
|
|
|
+ */
|
|
|
|
+ // 测试得分,指标评价,得分说明 --处理
|
|
|
|
+ if (isEmpty(targetEvaluate) || isEmpty(sp.getScoreExplain())) {
|
|
|
|
+ sublistName += ProjectConstants.SEPARATOR + sp.getReturnSceneId() + ProjectConstants.SEPARATOR + sp.getSceneType() + ProjectConstants.SEPARATOR + "--" + ProjectConstants.SEPARATOR + "--" + ProjectConstants.SEPARATOR + "--";
|
|
|
|
+ } else {
|
|
|
|
+ sublistName += ProjectConstants.SEPARATOR + sp.getReturnSceneId() + ProjectConstants.SEPARATOR + sp.getSceneType() + ProjectConstants.SEPARATOR + sceneScore + ProjectConstants.SEPARATOR + targetEvaluate + ProjectConstants.SEPARATOR + sp.getScoreExplain();
|
|
|
|
+ }
|
|
|
|
+ String[] split = sublistName.split(ProjectConstants.SEPARATOR);
|
|
|
|
+ List<String> strings = new LinkedList<>(Arrays.asList(split));
|
|
|
|
+ if (size < strings.size()) {
|
|
|
|
+ size = strings.size();
|
|
|
|
+ }
|
|
|
|
+ result.add(strings);
|
|
|
|
+ runStateList.add(sp.getRunResult());
|
|
|
|
+ }
|
|
|
|
+ List<SceneScListVo> objects = new ArrayList<>();
|
|
|
|
+ // 结果补全
|
|
|
|
+ int r = 0;
|
|
|
|
+ for (List<String> list : result) {
|
|
|
|
+ int start = list.size() - 5;
|
|
|
|
+ SceneScListVo sceneScListVo = new SceneScListVo();
|
|
|
|
+ for (int i = 0; i < start; i++) {
|
|
|
|
+ if (0 == i) {
|
|
|
|
+ sceneScListVo.setSublistName1(list.get(i));
|
|
|
|
+ } else if (1 == i) {
|
|
|
|
+ sceneScListVo.setSublistName2(list.get(i));
|
|
|
|
+ } else if (2 == i) {
|
|
|
|
+ sceneScListVo.setSublistName3(list.get(i));
|
|
|
|
+ } else if (3 == i) {
|
|
|
|
+ sceneScListVo.setSublistName4(list.get(i));
|
|
|
|
+ } else if (4 == i) {
|
|
|
|
+ sceneScListVo.setSublistName5(list.get(i));
|
|
|
|
+ } else if (5 == i) {
|
|
|
|
+ sceneScListVo.setSublistName6(list.get(i));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ sceneScListVo.setSceneId(list.get(start));
|
|
|
|
+ sceneScListVo.setSceneIdType(list.get(start + 1));
|
|
|
|
+ sceneScListVo.setSceneScore(list.get(start + 2));
|
|
|
|
+ sceneScListVo.setTargetEvaluate(list.get(start + 3));
|
|
|
|
+ sceneScListVo.setScoreExplain(list.get(start + 4));
|
|
|
|
+ sceneScListVo.setRunState(runStateList.get(r));
|
|
|
|
+ objects.add(sceneScListVo);
|
|
|
|
+ r++;
|
|
|
|
+ }
|
|
|
|
+ List<Map<Object, Object>> headerList = new ArrayList<>();
|
|
|
|
+ int maxIndex = size - 5;
|
|
|
|
+ for (int i = 0; i < maxIndex; i++) {
|
|
|
|
+ addHeaders(i, headerList);
|
|
|
|
+ }
|
|
|
|
+ headerList.add(ImmutableMap.builder().put("label", "场景名称").put("prop", "sceneId").build());
|
|
|
|
+ headerList.add(ImmutableMap.builder().put("label", "场景类型").put("prop", "sceneIdType").build());
|
|
|
|
+ headerList.add(ImmutableMap.builder().put("label", "测试得分").put("prop", "sceneScore").build());
|
|
|
|
+ headerList.add(ImmutableMap.builder().put("label", "指标评价").put("prop", "targetEvaluate").build());
|
|
|
|
+ headerList.add(ImmutableMap.builder().put("label", "得分说明").put("prop", "scoreExplain").build());
|
|
|
|
+ HashMap<String, Object> hashMap = new HashMap<>();
|
|
|
|
+ hashMap.put("headerList", headerList);
|
|
|
|
+ hashMap.put("result", objects);
|
|
|
|
+ return hashMap;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private Map<String, Object> selectSceneScore2(String scenePackageId, String projectId, String taskId, ProjectReportVo projectReportVo) {
|
|
|
|
+
|
|
|
|
+ // 1 查询指定项目的所有指标得分结果
|
|
|
|
+ SimulationManualProjectParam query = new SimulationManualProjectParam();
|
|
|
|
+ query.setId(projectId);
|
|
|
|
+ query.setPackageId(scenePackageId);
|
|
|
|
+ List<SublistScoreVo> pos = simulationProjectMapper.selectSubScore2(query);
|
|
|
|
+ // 2 查询指定项目的所有任务得分结果
|
|
|
|
+ ProjectTaskParam param = new ProjectTaskParam();
|
|
|
|
+ param.setPId(projectId);
|
|
|
|
+ if (!isEmpty(taskId)) {
|
|
|
|
+ param.setTaskId(taskId);
|
|
|
|
+ }
|
|
|
|
+ List<ManualProjectTaskVo> taskList = simulationProjectTaskMapper.selectProjectTaskByProjectId(param); // 手动运行项目和自动运行项目使用同一个任务表
|
|
|
|
+
|
|
|
|
+ // 2 拼接场景得分信息
|
|
|
|
+ List<SublistScoreVo> lastSubList = new ArrayList<>();
|
|
|
|
+ for (SublistScoreVo po : pos) {
|
|
|
|
+ if (ObjectUtil.isNotNull(po.getPackageAndRules())) {
|
|
|
|
+ // 获取场景得分信息
|
|
|
|
+ for (ManualProjectTaskVo task : taskList)
|
|
|
|
+ if (task.getLastTargerId().equals(po.getId())) {
|
|
|
|
+ SublistScoreVo sublistScoreVo = new SublistScoreVo();
|
|
|
|
+ BeanUtils.copyProperties(po, sublistScoreVo);
|
|
|
|
+ sublistScoreVo.setRunResult(task.getRunResult());
|
|
|
|
+ sublistScoreVo.setSceneScore(saveTwoDecimalPlaces(task.getScore())); // 得分
|
|
|
|
+ sublistScoreVo.setTargetEvaluate(task.getTargetEvaluate());// 指标评价
|
|
|
|
+ String sceneType = task.getSceneType();
|
|
|
|
+ String sceneId = task.getSceneId();
|
|
|
|
+ String sceneName = "";
|
|
|
|
+ if (DictConstants.SCENE_NATURAL.equals(sceneType)) {
|
|
|
|
+ sublistScoreVo.setSceneType("自然驾驶");
|
|
|
|
+ SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneNatural(sceneId);
|
|
|
|
+ sceneName = sceneBaseInfoVo.getNaturalName();
|
|
|
|
+ } else if (DictConstants.SCENE_STANDARD.equals(sceneType)) {
|
|
|
|
+ sublistScoreVo.setSceneType("标准法规");
|
|
|
|
+ SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneStandardsRegulations(sceneId);
|
|
|
|
+ sceneName = sceneBaseInfoVo.getSceneName();
|
|
|
|
+ } else if (DictConstants.SCENE_ACCIDENT.equals(sceneType)) {
|
|
|
|
+ sublistScoreVo.setSceneType("交通事故");
|
|
|
|
+ SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneAccidentById(sceneId);
|
|
|
|
+ sceneName = sceneBaseInfoVo.getSceneName();
|
|
|
|
+ } else if (DictConstants.SCENE_GENERAL.equals(sceneType)) {
|
|
|
|
+ sublistScoreVo.setSceneType("泛化");
|
|
|
|
+ SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneGeneralDataById(sceneId);
|
|
|
|
+ sceneName = sceneBaseInfoVo.getSceneName();
|
|
|
|
+ }
|
|
|
|
+ sublistScoreVo.setReturnSceneId(sceneName); // 显示场景名称
|
|
|
|
+ lastSubList.add(sublistScoreVo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ int size = 0;
|
|
|
|
+ List<List<String>> result = new ArrayList<>();
|
|
|
|
+ // 新增返回状态
|
|
|
|
+ ArrayList<String> runStateList = new ArrayList<>();
|
|
|
|
+ // 末级指标
|
|
|
|
+ for (SublistScoreVo sp : lastSubList) {
|
|
|
|
+ setParentSub(sp, null, pos);
|
|
|
|
+ String sublistName = sp.getSublistName();
|
|
|
|
+ // 失败的任务没有数据,需要校验
|
|
|
|
+ Double sceneScore = sp.getSceneScore();
|
|
|
|
+ if (sceneScore == null) {
|
|
|
|
+ sceneScore = 0D;
|
|
|
|
+ }
|
|
|
|
+ String targetEvaluate = sp.getTargetEvaluate();
|
|
|
|
+ if (targetEvaluate == null) {
|
|
|
|
+ targetEvaluate = "";
|
|
|
|
+ }
|
|
|
|
+ /*
|
|
|
|
+ * sublistName +=
|
|
|
|
+ * ProjectConstants.SEPARATOR+sp.getReturnSceneId()+ProjectConstants.SEPARATOR+
|
|
|
|
+ * sp.getSceneType()+ProjectConstants.SEPARATOR+
|
|
|
|
+ * sp.getSceneScore()+ProjectConstants.SEPARATOR+sp.getTargetEvaluate()+
|
|
|
|
+ * ProjectConstants.SEPARATOR+sp.getScoreExplain();
|
|
|
|
+ */
|
|
|
|
+ // 测试得分,指标评价,得分说明 --处理
|
|
|
|
+ if (isEmpty(targetEvaluate) || isEmpty(sp.getScoreExplain())) {
|
|
|
|
+ sublistName += ProjectConstants.SEPARATOR + sp.getReturnSceneId() + ProjectConstants.SEPARATOR + sp.getSceneType() + ProjectConstants.SEPARATOR + "--" + ProjectConstants.SEPARATOR + "--" + ProjectConstants.SEPARATOR + "--";
|
|
|
|
+ } else {
|
|
|
|
+ sublistName += ProjectConstants.SEPARATOR + sp.getReturnSceneId() + ProjectConstants.SEPARATOR + sp.getSceneType() + ProjectConstants.SEPARATOR + sceneScore + ProjectConstants.SEPARATOR + targetEvaluate + ProjectConstants.SEPARATOR + sp.getScoreExplain();
|
|
|
|
+ }
|
|
|
|
+ String[] split = sublistName.split(ProjectConstants.SEPARATOR);
|
|
|
|
+ List<String> strings = new LinkedList<>(Arrays.asList(split));
|
|
|
|
+ if (size < strings.size()) {
|
|
|
|
+ size = strings.size();
|
|
|
|
+ }
|
|
|
|
+ result.add(strings);
|
|
|
|
+ runStateList.add(sp.getRunResult());
|
|
|
|
+ }
|
|
|
|
+ List<SceneScListVo> objects = new ArrayList<>();
|
|
|
|
+ // 结果补全
|
|
|
|
+ int r = 0;
|
|
|
|
+ for (List<String> list : result) {
|
|
|
|
+ int start = list.size() - 5;
|
|
|
|
+ SceneScListVo sceneScListVo = new SceneScListVo();
|
|
|
|
+ for (int i = 0; i < start; i++) {
|
|
|
|
+ if (0 == i) {
|
|
|
|
+ String s0 = list.get(i);
|
|
|
|
+ if (StringUtil.isNotEmpty(s0)) {
|
|
|
|
+ sceneScListVo.setEachMaxIndex((i + 1) + "");
|
|
|
|
+ }
|
|
|
|
+ sceneScListVo.setSublistName1(s0);
|
|
|
|
+ } else if (1 == i) {
|
|
|
|
+ String s1 = list.get(i);
|
|
|
|
+ if (StringUtil.isNotEmpty(s1)) {
|
|
|
|
+ sceneScListVo.setEachMaxIndex((i + 1) + "");
|
|
|
|
+ }
|
|
|
|
+ sceneScListVo.setSublistName2(list.get(i));
|
|
|
|
+ } else if (2 == i) {
|
|
|
|
+ String s2 = list.get(i);
|
|
|
|
+ if (StringUtil.isNotEmpty(s2)) {
|
|
|
|
+ sceneScListVo.setEachMaxIndex((i + 1) + "");
|
|
|
|
+ }
|
|
|
|
+ sceneScListVo.setSublistName3(list.get(i));
|
|
|
|
+ } else if (3 == i) {
|
|
|
|
+ String s3 = list.get(i);
|
|
|
|
+ if (StringUtil.isNotEmpty(s3)) {
|
|
|
|
+ sceneScListVo.setEachMaxIndex((i + 1) + "");
|
|
|
|
+ }
|
|
|
|
+ sceneScListVo.setSublistName4(list.get(i));
|
|
|
|
+ } else if (4 == i) {
|
|
|
|
+ String s4 = list.get(i);
|
|
|
|
+ if (StringUtil.isNotEmpty(s4)) {
|
|
|
|
+ sceneScListVo.setEachMaxIndex((i + 1) + "");
|
|
|
|
+ }
|
|
|
|
+ sceneScListVo.setSublistName5(list.get(i));
|
|
|
|
+ } else if (5 == i) {
|
|
|
|
+ String s5 = list.get(i);
|
|
|
|
+ if (StringUtil.isNotEmpty(s5)) {
|
|
|
|
+ sceneScListVo.setEachMaxIndex((i + 1) + "");
|
|
|
|
+ }
|
|
|
|
+ sceneScListVo.setSublistName6(list.get(i));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ sceneScListVo.setSceneId(list.get(start));
|
|
|
|
+ sceneScListVo.setSceneIdType(list.get(start + 1));
|
|
|
|
+ sceneScListVo.setSceneScore(list.get(start + 2));
|
|
|
|
+ sceneScListVo.setTargetEvaluate(list.get(start + 3));
|
|
|
|
+ sceneScListVo.setScoreExplain(list.get(start + 4));
|
|
|
|
+ sceneScListVo.setRunState(runStateList.get(r));
|
|
|
|
+ objects.add(sceneScListVo);
|
|
|
|
+ r++;
|
|
|
|
+ }
|
|
|
|
+ List<Map<Object, Object>> headerList = new ArrayList<>();
|
|
|
|
+ int maxIndex = size - 5;
|
|
|
|
+ projectReportVo.setMaxIndex(maxIndex);
|
|
|
|
+ for (int i = 0; i < maxIndex; i++) {
|
|
|
|
+ addHeaders(i, headerList);
|
|
|
|
+ }
|
|
|
|
+ headerList.add(ImmutableMap.builder().put("label", "场景名称").put("prop", "sceneId").build());
|
|
|
|
+ headerList.add(ImmutableMap.builder().put("label", "场景类型").put("prop", "sceneIdType").build());
|
|
|
|
+ headerList.add(ImmutableMap.builder().put("label", "测试得分").put("prop", "sceneScore").build());
|
|
|
|
+ headerList.add(ImmutableMap.builder().put("label", "指标评价").put("prop", "targetEvaluate").build());
|
|
|
|
+ headerList.add(ImmutableMap.builder().put("label", "得分说明").put("prop", "scoreExplain").build());
|
|
|
|
+ HashMap<String, Object> hashMap = new HashMap<>();
|
|
|
|
+ hashMap.put("headerList", headerList);
|
|
|
|
+ hashMap.put("result", objects);
|
|
|
|
+ return hashMap;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * @param po 末级指标
|
|
|
|
+ * @param parentPo 上级指标
|
|
|
|
+ * @param pos 所有指标
|
|
|
|
+ */
|
|
|
|
+ private void setParentSub(SublistScoreVo po, SublistScoreVo parentPo, List<SublistScoreVo> pos) {
|
|
|
|
+ if (parentPo == null) {
|
|
|
|
+ for (SublistScoreVo p : pos) {
|
|
|
|
+ setSc(po, p, po, pos);
|
|
|
|
+ }
|
|
|
|
|
|
- // steering_angle
|
|
|
|
- try {
|
|
|
|
- double aDouble = Double.parseDouble(split[12]);
|
|
|
|
- if (Double.isNaN(aDouble)) {
|
|
|
|
- steeting_wheel_list.add(0D);
|
|
|
|
- } else {
|
|
|
|
- steeting_wheel_list.add(Double.valueOf(split[12]));// steering_angle
|
|
|
|
- }
|
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
- steeting_wheel_list.add(0D);
|
|
|
|
|
|
+ } else {
|
|
|
|
+ for (SublistScoreVo p : pos) {
|
|
|
|
+ setSc(parentPo, p, po, pos);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
- try {
|
|
|
|
- double aDouble = Double.parseDouble(split[13]);
|
|
|
|
- if (Double.isNaN(aDouble)) {
|
|
|
|
- yawrate_list.add(0D);
|
|
|
|
- } else {
|
|
|
|
- yawrate_list.add(Double.valueOf(split[13]));
|
|
|
|
- }
|
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
- yawrate_list.add(0D);
|
|
|
|
|
|
+ /**
|
|
|
|
+ * @param p1 上级指标
|
|
|
|
+ * @param p2 比对指标
|
|
|
|
+ * @param p3 末级指标
|
|
|
|
+ * @param pos 所有指标
|
|
|
|
+ */
|
|
|
|
+ private void setSc(SublistScoreVo p1, SublistScoreVo p2, SublistScoreVo p3, List<SublistScoreVo> pos) {
|
|
|
|
+ // 上级指标
|
|
|
|
+ if (p1.getParentId().equals(p2.getId())) {
|
|
|
|
+
|
|
|
|
+ // 末级指标拼接指标名
|
|
|
|
+ p3.setSublistName(p2.getSublistName() + ProjectConstants.SEPARATOR + p3.getSublistName());
|
|
|
|
+ // 查找上级指标,继续拼接
|
|
|
|
+ setParentSub(p3, p2, pos);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private Map<String, Object> selectScenePackageSubListAndSetScore(String scenePackageId, String projectId) {
|
|
|
|
+
|
|
|
|
+ // 查询场景包所有数据
|
|
|
|
+ SimulationManualProjectParam query = new SimulationManualProjectParam();
|
|
|
|
+ query.setId(projectId);
|
|
|
|
+ query.setPackageId(scenePackageId);
|
|
|
|
+ List<SublistScoreVo> sublistScoreVoList = simulationProjectMapper.selectSubScore2(query);
|
|
|
|
+ HashMap<String, Object> hashMap = new HashMap<>();
|
|
|
|
+ int maxHeaderNumber = 0;
|
|
|
|
+ List<List<String>> result = new ArrayList<>();
|
|
|
|
+ // 递归指标名称得分
|
|
|
|
+ for (SublistScoreVo sublistScoreVo : sublistScoreVoList) {
|
|
|
|
+ if (ObjectUtil.isNotNull(sublistScoreVo.getPackageAndRules()) && (sublistScoreVo.getFirTarget() != null || sublistScoreVo.getLasTarget() != null)) {
|
|
|
|
+ // 末级指标
|
|
|
|
+ setParent(sublistScoreVo, null, sublistScoreVoList, scenePackageId);
|
|
|
|
+ String sublistName = sublistScoreVo.getSublistName();
|
|
|
|
+ Double firScore = sublistScoreVo.getFirScore();
|
|
|
|
+ String firstScore = ""; // first得分
|
|
|
|
+ if (firScore != null) {
|
|
|
|
+ firstScore = saveTwoDecimalPlaces(firScore, 1).toString();
|
|
|
|
+ }
|
|
|
|
+ Double lasScore = sublistScoreVo.getLasScore();
|
|
|
|
+ String LastScore = ""; // last得分
|
|
|
|
+ if (lasScore != null) {
|
|
|
|
+ LastScore = saveTwoDecimalPlaces(lasScore, 1).toString();
|
|
|
|
+ }
|
|
|
|
+ String sceneNum = sublistScoreVo.getSceneNum(); // 场景数量
|
|
|
|
+ String errorSceneNum = sublistScoreVo.getErrorSceneNum(); // 仿真异常场景个数
|
|
|
|
+ String notScoredSceneNum = sublistScoreVo.getNotScoredSceneNum(); // 未参与评分数量
|
|
|
|
+ String notStandardSceneNum = sublistScoreVo.getNotStandardSceneNum(); // 未达标场景数量
|
|
|
|
+ String standardSceneNum = sublistScoreVo.getStandardSceneNum(); // 达标场景数量
|
|
|
|
+
|
|
|
|
+ if (ObjectUtil.isNotNull(sublistName)) {
|
|
|
|
+ sublistName += ProjectConstants.SEPARATOR + sceneNum + ProjectConstants.SEPARATOR + errorSceneNum + ProjectConstants.SEPARATOR + notScoredSceneNum + ProjectConstants.SEPARATOR + notStandardSceneNum + ProjectConstants.SEPARATOR + standardSceneNum + ProjectConstants.SEPARATOR + LastScore + ProjectConstants.SEPARATOR + firstScore;
|
|
|
|
+ String[] split = sublistName.split(ProjectConstants.SEPARATOR);
|
|
|
|
+ maxHeaderNumber = Math.max(maxHeaderNumber, split.length); // 求最大表头数量
|
|
|
|
+ result.add(Arrays.asList(split));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 结果补全
|
|
|
|
+ List<SubScListVo> values = new ArrayList<>();
|
|
|
|
+ int fieldNumber = 7;
|
|
|
|
+ for (List<String> list : result) {
|
|
|
|
+ int start = list.size() - fieldNumber;
|
|
|
|
+ SubScListVo subScListVo = new SubScListVo();
|
|
|
|
+ subScListVo.setSceneNum(list.get(start));
|
|
|
|
+ subScListVo.setErrorSceneNum(list.get(start + 1));
|
|
|
|
+ subScListVo.setNotScoredSceneNum(list.get(start + 2));
|
|
|
|
+ subScListVo.setNotStandardSceneNum(list.get(start + 3));
|
|
|
|
+ subScListVo.setStandardSceneNum(list.get(start + 4));
|
|
|
|
+ subScListVo.setLastScore(list.get(start + 5));
|
|
|
|
+ subScListVo.setFirstScore(list.get(start + 6));
|
|
|
|
+ for (int i = 0; i < start; i++) {
|
|
|
|
+ if (0 == i) {
|
|
|
|
+ subScListVo.setSublistName1(list.get(i));
|
|
|
|
+ } else if (1 == i) {
|
|
|
|
+ subScListVo.setSublistName2(list.get(i));
|
|
|
|
+ } else if (2 == i) {
|
|
|
|
+ subScListVo.setSublistName3(list.get(i));
|
|
|
|
+ } else if (3 == i) {
|
|
|
|
+ subScListVo.setSublistName4(list.get(i));
|
|
|
|
+ } else if (4 == i) {
|
|
|
|
+ subScListVo.setSublistName5(list.get(i));
|
|
|
|
+ } else if (5 == i) {
|
|
|
|
+ subScListVo.setSublistName6(list.get(i));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ values.add(subScListVo);
|
|
|
|
+ }
|
|
|
|
+ List<Map<Object, Object>> headerList = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < maxHeaderNumber - fieldNumber; i++) {
|
|
|
|
+ addHeaders(i, headerList);
|
|
}
|
|
}
|
|
|
|
+ headerList.add(ImmutableMap.builder().put("label", "场景个数").put("prop", "sceneNum").build());
|
|
|
|
+ headerList.add(ImmutableMap.builder().put("label", "仿真异常场景个数").put("prop", "errorSceneNum").build());
|
|
|
|
+ headerList.add(ImmutableMap.builder().put("label", "评分失败场景个数").put("prop", "notScoredSceneNum").build());
|
|
|
|
+ headerList.add(ImmutableMap.builder().put("label", "未达标场景个数").put("prop", "notStandardSceneNum").build());
|
|
|
|
+ headerList.add(ImmutableMap.builder().put("label", "达标场景个数").put("prop", "standardSceneNum").build());
|
|
|
|
+ headerList.add(ImmutableMap.builder().put("label", "得分").put("prop", "lastScore").build());
|
|
|
|
+ headerList.add(ImmutableMap.builder().put("label", "总分").put("prop", "firstScore").build());
|
|
|
|
+ hashMap.put("headerList", headerList);
|
|
|
|
+ hashMap.put("result", values);
|
|
|
|
|
|
- try {
|
|
|
|
- double aDouble = Double.parseDouble(split[27]);
|
|
|
|
- if (Double.isNaN(aDouble)) {
|
|
|
|
- lane_offset_list.add(0D);
|
|
|
|
- } else {
|
|
|
|
- lane_offset_list.add(Double.valueOf(split[27]));// lane_center_offset
|
|
|
|
- }
|
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
- lane_offset_list.add(0D);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // brake_list.add(Double.valueOf(split[])); ///TODO 没有
|
|
|
|
- // throttle_list.add(Double.valueOf(split[]));///TODO 没有
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- // 里程
|
|
|
|
- double lc = 0.0;
|
|
|
|
- for (int i = 0; i < time_list.size(); i++) {
|
|
|
|
- if (i == 0) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- lc += (time_list.get(i) - time_list.get(i - 1)) * longitudinal_velocity_list.get(i - 1);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 平均速度
|
|
|
|
- Double pjsd = lc / time_list.get(time_list.size() - 1);
|
|
|
|
- pjsd = saveTwoDecimalPlaces(pjsd, 4);
|
|
|
|
-
|
|
|
|
- Double zdsd = Collections.max(longitudinal_velocity_list); // 最大速度
|
|
|
|
- Double zxsd = Collections.min(longitudinal_velocity_list); // 最小速度
|
|
|
|
- Double maxLateralAcceleration = Collections.max(lateral_acceleration_list); // 最大横向加速度
|
|
|
|
- Double minLateralAcceleration = Collections.min(lateral_acceleration_list); // 最小横向加速度(最大横向减速度)
|
|
|
|
- Double maxLongitudinalAcceleration = Collections.max(longitudinal_acceleration_list); // 最大纵向加速度
|
|
|
|
- Double minLongitudinalAcceleration = Collections.min(longitudinal_acceleration_list); // 最小纵向加速度
|
|
|
|
- Double zdbjsd = Collections.max(yawrate_list); // 最大摆角速度
|
|
|
|
-
|
|
|
|
- // 自车速度方差
|
|
|
|
- Double zcsdfc = 0D;
|
|
|
|
- for (Double d : longitudinal_velocity_list) {
|
|
|
|
- zcsdfc += Math.pow(d - pjsd, 2);
|
|
|
|
- }
|
|
|
|
- zcsdfc = zcsdfc / longitudinal_velocity_list.size();
|
|
|
|
- zcsdfc = saveTwoDecimalPlaces(zcsdfc, 4);
|
|
|
|
-
|
|
|
|
- // 自车横摆角速度均方根
|
|
|
|
- Double zchbjsdjfg = 0D;
|
|
|
|
- for (Double d : yawrate_list) {
|
|
|
|
- // zchbjsdjfg += Math.pow(d-pjsd,2);
|
|
|
|
- zchbjsdjfg += Math.pow(d, 2);
|
|
|
|
- }
|
|
|
|
- zchbjsdjfg = Math.sqrt(zchbjsdjfg / yawrate_list.size());
|
|
|
|
- zchbjsdjfg = saveTwoDecimalPlaces(zchbjsdjfg, 4);
|
|
|
|
-
|
|
|
|
- // for (int i = 0; i < lateral_acceleration.size(); i++) {
|
|
|
|
- // Double aDouble = lateral_acceleration.get(i);
|
|
|
|
- // Double aDouble1 = longitudinal_acceleration_list.get(i);
|
|
|
|
- // double d = Math.pow(aDouble, 2) + Math.pow(aDouble1, 2);
|
|
|
|
- // acceleration_list.add(Math.sqrt(d));
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- for (int i = 0; i < lateral_velocity_list.size(); i++) {
|
|
|
|
- Double aDouble = lateral_velocity_list.get(i);
|
|
|
|
- Double aDouble1 = longitudinal_velocity_list.get(i);
|
|
|
|
- double d = Math.pow(aDouble, 2) + Math.pow(aDouble1, 2);
|
|
|
|
- velocity_list.add(Math.sqrt(d) * 3.6);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 获取视频预览路径
|
|
|
|
- List<String> list1 = new ArrayList<>();
|
|
|
|
- String runResultFilePath = po.getRunResultFilePath();
|
|
|
|
- MinioParameter minioParameter1 = new MinioParameter();
|
|
|
|
- minioParameter1.setObjectName(runResultFilePath);
|
|
|
|
- ResponseBodyVO<List<String>> list = fileDownService.list(minioParameter1);
|
|
|
|
- List<String> info = list.getInfo();
|
|
|
|
- for (String s : info) {
|
|
|
|
- String substring = s.substring(s.lastIndexOf(".") + 1);
|
|
|
|
- if ("mp4".equals(substring)) {
|
|
|
|
- // mp4视频文件
|
|
|
|
- minioParameter1.setObjectName(s);
|
|
|
|
- ResponseBodyVO<String> preview = fileDownService.getPreviewUrl(minioParameter1);
|
|
|
|
- list1.add(preview.getInfo());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 任务详情信息
|
|
|
|
- resultVo.setMileage(Double.toString(lc));
|
|
|
|
- resultVo.setAverageVelocity(saveTwoDecimalPlaces(pjsd * 3.6, 4).toString());
|
|
|
|
- resultVo.setMaximunSpeed(zdsd.toString()); // 最大速度
|
|
|
|
- resultVo.setMinimunVelocity(zxsd.toString()); // 最小速度
|
|
|
|
- resultVo.setMaximumAcceleration(maxLateralAcceleration.toString()); // 最大横向加速度
|
|
|
|
- resultVo.setMaximumDeceleration(minLateralAcceleration.toString()); // 最大横向减速度
|
|
|
|
- resultVo.setMaxLongitudinalAcceleration(maxLongitudinalAcceleration.toString()); // 最大纵向加速度
|
|
|
|
- resultVo.setMinLongitudinalAcceleration(minLongitudinalAcceleration.toString()); // 最小纵向加速度
|
|
|
|
- resultVo.setMaximumSwingSpeed(zdbjsd.toString());
|
|
|
|
- resultVo.setSpeedVariance(zcsdfc);
|
|
|
|
- // resultVo.setSpeedComfortLevel(po.getSpeedComfortLevel());
|
|
|
|
-
|
|
|
|
- resultVo.setSwingSpeedMeanSquareRoot(zchbjsdjfg);
|
|
|
|
- // resultVo.setSwingComfortLevel(po.getSwingComfortLevel());
|
|
|
|
- resultVo.setVideoUrl(list1);
|
|
|
|
-
|
|
|
|
- HashMap<String, List<Double>> CurveData = new HashMap<>();
|
|
|
|
- CurveData.put("time", time_list);
|
|
|
|
- CurveData.put("acceleration", lateral_acceleration_list);
|
|
|
|
- CurveData.put("acceleration_longitudinal", longitudinal_acceleration_list);
|
|
|
|
- CurveData.put("lane_offset", lane_offset_list);
|
|
|
|
- CurveData.put("brake", brake_list);
|
|
|
|
- CurveData.put("steeting", steeting_wheel_list);
|
|
|
|
- CurveData.put("throttle", throttle_list);
|
|
|
|
- CurveData.put("yaw_rate", yawrate_list);
|
|
|
|
- CurveData.put("velocity", velocity_list); // 速度变化曲线
|
|
|
|
- resultVo.setCurveData(CurveData);
|
|
|
|
-
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
-
|
|
|
|
- } finally {
|
|
|
|
- try {
|
|
|
|
- if (fileInputStream != null) {
|
|
|
|
- fileInputStream.close();
|
|
|
|
- }
|
|
|
|
- if (inputStreamReader != null) {
|
|
|
|
- inputStreamReader.close();
|
|
|
|
- }
|
|
|
|
- if (bufferedReader != null) {
|
|
|
|
- bufferedReader.close();
|
|
|
|
- }
|
|
|
|
- } catch (IOException e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, resultVo);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public String getDictName(String type, String code) {
|
|
|
|
- Map<String, String> stringStringMap = getDictByType(type);
|
|
|
|
- if (stringStringMap != null && stringStringMap.size() > 0) {
|
|
|
|
- return stringStringMap.get(code);
|
|
|
|
- }
|
|
|
|
- return "";
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private Map<String, String> getDictByType(String type) {
|
|
|
|
- DictParam dictParam = new DictParam();
|
|
|
|
- dictParam.setDictTypes(type);
|
|
|
|
- Map<String, Map<String, String>> dictMapsByTypes = dictService.getDictMapsByTypes(dictParam);
|
|
|
|
- Map<String, String> stringStringMap = dictMapsByTypes.get(type);
|
|
|
|
- if (stringStringMap != null && stringStringMap.size() > 0) {
|
|
|
|
- return stringStringMap;
|
|
|
|
- }
|
|
|
|
- return null;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- @SneakyThrows
|
|
|
|
- public ResponseBodyVO<String> analysisVehicleCoord() {
|
|
|
|
- analysisCsvFile("E:\\仿真云平台\\三维还原视频说明\\360ogt.csv", new int[]{6, 7, 9});
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<PageInfo<ManualProjectTaskVo>> selectProjectTaskList(SimulationManualProjectParam param) {
|
|
|
|
- // 查询任务信息
|
|
|
|
- ProjectTaskParam projectTaskParam = new ProjectTaskParam();
|
|
|
|
- projectTaskParam.setPId(param.getId());
|
|
|
|
- setPage(param.getCurrentPage() == null ? 1 : param.getCurrentPage(), param.getPageSize() == null ? 10 : param.getPageSize());
|
|
|
|
- List<ManualProjectTaskVo> tasks = simulationProjectTaskMapper.selectProjectTaskByProjectId(projectTaskParam);
|
|
|
|
- tasks.forEach(task -> {
|
|
|
|
- if (StateConstant.Aborted.getEnglish().equals(task.getRunState())) {
|
|
|
|
- task.setRunState(StateConstant.Aborted.getChinese());
|
|
|
|
- }
|
|
|
|
- if (StateConstant.PendingAnalysis.getEnglish().equals(task.getRunState())) {
|
|
|
|
- task.setRunState(StateConstant.PendingAnalysis.getChinese());
|
|
|
|
- }
|
|
|
|
- if (StateConstant.Running.getEnglish().equals(task.getRunState())) {
|
|
|
|
- task.setRunState(StateConstant.Running.getChinese());
|
|
|
|
- }
|
|
|
|
- if (StateConstant.Analysing.getEnglish().equals(task.getRunState())) {
|
|
|
|
- task.setRunState(StateConstant.Analysing.getChinese());
|
|
|
|
- }
|
|
|
|
- if (StateConstant.Completed.getEnglish().equals(task.getRunState())) {
|
|
|
|
- task.setRunState(StateConstant.Completed.getChinese());
|
|
|
|
- }
|
|
|
|
- if (StateConstant.Terminated.getEnglish().equals(task.getRunState())) {
|
|
|
|
- task.setRunState(StateConstant.Terminated.getChinese());
|
|
|
|
- }
|
|
|
|
- if (StateConstant.Terminating.getEnglish().equals(task.getRunState())) {
|
|
|
|
- task.setRunState(StateConstant.Terminating.getChinese());
|
|
|
|
- }
|
|
|
|
- if (StateConstant.Pending.getEnglish().equals(task.getRunState())) {
|
|
|
|
- task.setRunState(StateConstant.Pending.getChinese());
|
|
|
|
- }
|
|
|
|
- if (StateConstant.Success.getEnglish().equals(task.getRunResult())) {
|
|
|
|
- task.setRunResult(StateConstant.Success.getChinese());
|
|
|
|
- }
|
|
|
|
- if (StateConstant.Failed.getEnglish().equals(task.getRunResult())) {
|
|
|
|
- task.setRunResult(StateConstant.Failed.getChinese());
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- PageInfo<ManualProjectTaskVo> pageInfo = new PageInfo<>(tasks);
|
|
|
|
-
|
|
|
|
- if (pageInfo.getList() != null) {
|
|
|
|
- for (ManualProjectTaskVo task : pageInfo.getList()) {
|
|
|
|
- task.setRunStartTimeFmt(getRqStr(task.getRunStartTime(), 1));
|
|
|
|
- task.setRunEndTimeFmt(getRqStr(task.getRunEndTime(), 1));
|
|
|
|
- setUpSceneInfo(task);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, pageInfo);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void analysisCsvFile(String filePath, int[] analysisFields) throws Exception {
|
|
|
|
-
|
|
|
|
- File file = new File(filePath);
|
|
|
|
- InputStream fileInputStream = Files.newInputStream(file.toPath());
|
|
|
|
- InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
|
|
|
|
- BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
|
|
|
|
- String line;
|
|
|
|
- while ((line = bufferedReader.readLine()) != null) {
|
|
|
|
- String[] split = line.split(",");
|
|
|
|
- for (int fs : analysisFields) {
|
|
|
|
- System.out.println(split[fs]);
|
|
|
|
- }
|
|
|
|
|
|
+ return hashMap;
|
|
|
|
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 根据场景id和场景类型获取场景名
|
|
|
|
- *
|
|
|
|
- * @return 场景名称
|
|
|
|
- */
|
|
|
|
- private SceneBaseInfoVo getSceneNameAndOther(String sceneId, String sceneType) {
|
|
|
|
- SceneBaseInfoVo resultVo = new SceneBaseInfoVo();
|
|
|
|
- if (DictConstants.SCENE_NATURAL.equals(sceneType)) {
|
|
|
|
- SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneNatural(sceneId);
|
|
|
|
- if (sceneBaseInfoVo != null) {
|
|
|
|
- resultVo.setCommonSceneName(sceneBaseInfoVo.getNaturalName());
|
|
|
|
- }
|
|
|
|
- } else if (DictConstants.SCENE_STANDARD.equals(sceneType)) {
|
|
|
|
- SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneStandardsRegulations(sceneId);
|
|
|
|
- if (sceneBaseInfoVo != null) {
|
|
|
|
- resultVo.setCommonSceneName(sceneBaseInfoVo.getSceneName());
|
|
|
|
- }
|
|
|
|
- } else if (DictConstants.SCENE_ACCIDENT.equals(sceneType)) {
|
|
|
|
- SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneAccidentById(sceneId);
|
|
|
|
- if (sceneBaseInfoVo != null) {
|
|
|
|
- resultVo.setCommonSceneName(sceneBaseInfoVo.getSceneName());
|
|
|
|
- }
|
|
|
|
- } else if (DictConstants.SCENE_GENERAL.equals(sceneType)) {
|
|
|
|
- SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneGeneralDataById(sceneId);
|
|
|
|
- if (sceneBaseInfoVo != null) {
|
|
|
|
- resultVo.setCommonSceneName(sceneBaseInfoVo.getSceneName());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return resultVo;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 查询算法下拉列表
|
|
|
|
- *
|
|
|
|
- * @param result
|
|
|
|
- * @param algorithmType 算法类型
|
|
|
|
- */
|
|
|
|
- private void setAlgorithmDropDown(List<DropDownTypeVo> result, String algorithmType) {
|
|
|
|
- List<DropDownVo> algorithmList = new ArrayList<>();
|
|
|
|
- if (DictConstants.FILE.equals(algorithmType) || DictConstants.GIT.equals(algorithmType)) {
|
|
|
|
- AlgorithmPO algorithmPO = new AlgorithmPO();
|
|
|
|
- algorithmPO.setCreateUserId(AuthUtil.getCurrentUserId()); // 获取当前用户 id
|
|
|
|
- if (StringUtil.isEmpty(algorithmType)) {
|
|
|
|
- algorithmPO.setUploadMode("1");
|
|
|
|
- } else {
|
|
|
|
- algorithmPO.setUploadMode(algorithmType);
|
|
|
|
- }
|
|
|
|
- List<AlgorithmPO> algorithmBaseInfoVo = simulationProjectMapper.selectAlgorithmBaseInfoById(algorithmPO);
|
|
|
|
-
|
|
|
|
- for (AlgorithmPO v : algorithmBaseInfoVo) {
|
|
|
|
- DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
- dropDownVo.setId(v.getId());
|
|
|
|
- dropDownVo.setName(v.getAlgorithmName());
|
|
|
|
- dropDownVo.setDescription(v.getDescription());
|
|
|
|
- dropDownVo.setShare(v.getShare());
|
|
|
|
- algorithmList.add(dropDownVo);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if (DictConstants.PLATFORM.equals(algorithmType)) {
|
|
|
|
- // 第三方算法平台获取(索为)
|
|
|
|
- String sort = "algorithmId-desc";
|
|
|
|
- int page = 1;
|
|
|
|
- int size = 999;// 全部
|
|
|
|
- String urlParam = "&page=" + page + "&size=" + size + "&sort=" + sort;
|
|
|
|
- algorithmList = getOtherAlgorithmInfo(urlParam);
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * @param po 末级指标
|
|
|
|
+ * @param pos 场景包下所有指标
|
|
|
|
+ * @param rootId 场景包id,用于判断是否根指标
|
|
|
|
+ */
|
|
|
|
+ private void setParent(SublistScoreVo po, List<SublistScoreVo> pos, String rootId) {
|
|
|
|
+ for (SublistScoreVo p : pos) {
|
|
|
|
+
|
|
|
|
+ if (po.getParentId().equals(p.getId())) {
|
|
|
|
+ // 给一级指标添加末级指标得分,给末级指标添加一级指标得分
|
|
|
|
+ if (p.getParentId().equals(rootId)) {
|
|
|
|
+ p.setLasScore(po.getLasScore());
|
|
|
|
+ po.setFirScore(p.getFirScore());
|
|
|
|
+ }
|
|
|
|
+ po.setSublistName(p.getSublistName() + "," + po.getSublistName());
|
|
|
|
+ setParent(p, pos, rootId);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- DropDownTypeVo algorithmDropDown = new DropDownTypeVo();
|
|
|
|
- algorithmDropDown.setDropDownList(algorithmList);
|
|
|
|
- algorithmDropDown.setType("1");
|
|
|
|
- result.add(algorithmDropDown);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 获取第三方算法平台的算法信息
|
|
|
|
- *
|
|
|
|
- * @return 第三方算法平台的算法信息
|
|
|
|
- */
|
|
|
|
- private List<DropDownVo> getOtherAlgorithmInfo(String query) {
|
|
|
|
-
|
|
|
|
- List<DropDownVo> algorithmList = new ArrayList<>();
|
|
|
|
-
|
|
|
|
- ResponseBodyVO algorithmBody = algoPlatformService.getAlgorithmList(query);
|
|
|
|
-
|
|
|
|
- // 解析数据
|
|
|
|
- Map jsonMap = JsonUtil.jsonToMap((String) algorithmBody.getInfo());
|
|
|
|
- Map<String, Object> dataMap = (Map<String, Object>) jsonMap.get("data");
|
|
|
|
- List<Map<String, String>> contentList = (List<Map<String, String>>) dataMap.get("content");
|
|
|
|
- Integer totalElements = (Integer) dataMap.get("totalElements");
|
|
|
|
- if (totalElements > 0) {
|
|
|
|
- for (Map<String, String> content : contentList) {
|
|
|
|
- DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
- dropDownVo.setId(content.get("algorithmId"));
|
|
|
|
- dropDownVo.setName(content.get("algorithmName"));
|
|
|
|
- dropDownVo.setDescription(content.get("description"));
|
|
|
|
- algorithmList.add(dropDownVo);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return algorithmList;
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ /**
|
|
|
|
+ * @param po 末级指标
|
|
|
|
+ * @param pos 场景包下所有指标
|
|
|
|
+ * @param rootId 场景包id,用于判断是否一级指标
|
|
|
|
+ */
|
|
|
|
+ private void setParent(SublistScoreVo po, SublistScoreVo parentPo, List<SublistScoreVo> pos, String rootId) {
|
|
|
|
+ // 第一次查找
|
|
|
|
+ if (parentPo == null) {
|
|
|
|
+ for (SublistScoreVo p : pos) {
|
|
|
|
+
|
|
|
|
+ setSubSc(po, p, po, pos, rootId);
|
|
|
|
+ /*
|
|
|
|
+ * if(po.getParentId().equals(p.getId())){
|
|
|
|
+ * //根指标给一级指标添加末级指标得分,给末级指标添加一级指标得分
|
|
|
|
+ * if(p.getParentId().equals(rootId)){
|
|
|
|
+ * p.setLasScore(po.getLasScore());
|
|
|
|
+ * po.setFirScore(p.getFirScore());
|
|
|
|
+ * }
|
|
|
|
+ * //末级指标拼接指标名
|
|
|
|
+ * po.setSublistName(p.getSublistName()+","+po.getSublistName());
|
|
|
|
+ * //查找上级指标,继续拼接
|
|
|
|
+ * setParent(po,p, pos, rootId);
|
|
|
|
+ *
|
|
|
|
+ * }
|
|
|
|
+ */
|
|
|
|
+ }
|
|
|
|
|
|
- private void setVehicleDropDown(List<DropDownTypeVo> result, String ConfigId) {
|
|
|
|
- ConfigPO configPO = new ConfigPO();
|
|
|
|
- if (StringUtil.isNotEmpty(ConfigId)) {
|
|
|
|
- configPO.setId(ConfigId);
|
|
|
|
- }
|
|
|
|
- configPO.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
|
|
- List<ConfigPO> vehicleBaseInfoVo = simulationProjectMapper.selectConfigVehicle2(configPO);
|
|
|
|
- List<DropDownVo> vehicleList = new ArrayList<>();
|
|
|
|
- for (ConfigPO v : vehicleBaseInfoVo) {
|
|
|
|
- DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
- dropDownVo.setId(v.getId());
|
|
|
|
- dropDownVo.setName(v.getConfigName());
|
|
|
|
- dropDownVo.setDescription(v.getDescription());
|
|
|
|
- dropDownVo.setShare(v.getShare());
|
|
|
|
- // 获取传感器信息
|
|
|
|
- List<ConfigSensorPO> configSensorVos = simulationProjectMapper.selectConfigSensor(v.getId());
|
|
|
|
- String sensor = "";
|
|
|
|
- if (!isEmpty(configSensorVos) && configSensorVos.get(0) != null) {
|
|
|
|
- StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
- for (ConfigSensorPO cv : configSensorVos) {
|
|
|
|
- stringBuilder.append(cv.getSensorType()).append(",");
|
|
|
|
- }
|
|
|
|
- sensor = stringBuilder.substring(0, stringBuilder.lastIndexOf(","));
|
|
|
|
|
|
+ } else {
|
|
|
|
+ for (SublistScoreVo p : pos) {
|
|
|
|
+
|
|
|
|
+ setSubSc(parentPo, p, po, pos, rootId);
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * //上级指标
|
|
|
|
+ * if(parentPo.getParentId().equals(p.getId())){
|
|
|
|
+ * //根指标给一级指标添加末级指标得分,给末级指标添加一级指标得分
|
|
|
|
+ * if(p.getParentId().equals(rootId)){
|
|
|
|
+ * p.setLasScore(po.getLasScore());
|
|
|
|
+ * po.setFirScore(p.getFirScore());
|
|
|
|
+ * }
|
|
|
|
+ * //末级指标拼接指标名
|
|
|
|
+ * po.setSublistName(p.getSublistName()+","+po.getSublistName());
|
|
|
|
+ * //查找上级指标,继续拼接
|
|
|
|
+ * setParent(po,p, pos, rootId);
|
|
|
|
+ * }
|
|
|
|
+ */
|
|
|
|
|
|
- }
|
|
|
|
- dropDownVo.setSensor(sensor);
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- vehicleList.add(dropDownVo);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- DropDownTypeVo vehicleDropDown = new DropDownTypeVo();
|
|
|
|
- vehicleDropDown.setDropDownList(vehicleList);
|
|
|
|
- vehicleDropDown.setType("2");
|
|
|
|
- result.add(vehicleDropDown);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void setScenePackageDropDown(List<DropDownTypeVo> result) {
|
|
|
|
- ScenePackagePO scenePackagePO = new ScenePackagePO();
|
|
|
|
- scenePackagePO.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
|
|
- List<ScenePackagePO> scenePackageBaseVo = simulationProjectMapper.selectScenePackageBaseById(scenePackagePO);
|
|
|
|
- List<DropDownVo> scenePackageList = new ArrayList<>();
|
|
|
|
- for (ScenePackagePO v : scenePackageBaseVo) {
|
|
|
|
- DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
- dropDownVo.setId(v.getPackageId());
|
|
|
|
- dropDownVo.setName(v.getPackageName());
|
|
|
|
- dropDownVo.setSceneNum(String.valueOf(v.getSceneNum()));
|
|
|
|
- dropDownVo.setShare(v.getShare());
|
|
|
|
- scenePackageList.add(dropDownVo);
|
|
|
|
- }
|
|
|
|
- DropDownTypeVo scenePackageDropDown = new DropDownTypeVo();
|
|
|
|
- scenePackageDropDown.setDropDownList(scenePackageList);
|
|
|
|
- scenePackageDropDown.setType("3");
|
|
|
|
- result.add(scenePackageDropDown);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private SimulationManualProjectPo convertParamToPo(SimulationManualProjectParam param) {
|
|
|
|
- SimulationManualProjectPo po = new SimulationManualProjectPo();
|
|
|
|
- po.setId(param.getId());
|
|
|
|
- po.setProjectName(param.getProjectName());
|
|
|
|
- po.setProjectDescribe(param.getProjectDescribe());
|
|
|
|
- po.setAlgorithm(param.getAlgorithm());
|
|
|
|
- po.setVehicle(param.getVehicle());
|
|
|
|
- po.setScene(param.getScene());
|
|
|
|
- // po.setOperationCycle(param.getOperationCycle());
|
|
|
|
- po.setMaxSimulationTime(param.getMaxSimulationTime());
|
|
|
|
- po.setParallelism(param.getParallelism());
|
|
|
|
- // po.setRuleView(param.getRuleView());
|
|
|
|
- po.setIsChoiceGpu(param.getIsChoiceGpu());
|
|
|
|
- po.setNowRunState(param.getNowRunState());
|
|
|
|
- po.setAlgorithmType(param.getAlgorithmType());
|
|
|
|
-
|
|
|
|
- if (ObjectUtil.isNotNull(param.getVehicleArrayS())) {
|
|
|
|
- po.setVehicleArray(StringUtils.join(Arrays.asList(param.getVehicleArrayS()), ','));
|
|
|
|
- }
|
|
|
|
- if (ObjectUtil.isNotNull(param.getAlgorithmArrayS())) {
|
|
|
|
- po.setAlgorithmArray(StringUtils.join(Arrays.asList(param.getAlgorithmArrayS()), ','));
|
|
|
|
- }
|
|
|
|
- if (ObjectUtil.isNotNull(param.getSceneArrayS())) {
|
|
|
|
- po.setSceneArray(StringUtils.join(Arrays.asList(param.getSceneArrayS()), ','));
|
|
|
|
- }
|
|
|
|
- return po;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void convertPoToVo(SimulationManualProjectVo simulationManualProjectVo, boolean isAuto) {
|
|
|
|
- // 1 查询算法名称
|
|
|
|
- String algorithmId = simulationManualProjectVo.getAlgorithm();
|
|
|
|
- String algorithmType = simulationManualProjectVo.getAlgorithmType();
|
|
|
|
- String algorithmName;
|
|
|
|
- if (DictConstants.ALGORITHM_UPLOAD_MODE_PLATFORM.equals(algorithmType)) {
|
|
|
|
- // 1 获取 token
|
|
|
|
- algorithmName = algoPlatformService.selectAlgorithmNameByAlgorithmId(algorithmId).getInfo();
|
|
|
|
- if (StringUtil.isEmpty(algorithmName)) {
|
|
|
|
- algorithmName = "算法平台已删除该算法";
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- AlgorithmPO algorithmPO = simulationProjectMapper.selectAlgorithmById(algorithmId);
|
|
|
|
- if (algorithmPO != null && StringUtil.isNotEmpty(algorithmPO.getAlgorithmName())) {
|
|
|
|
- algorithmName = algorithmPO.getAlgorithmName();
|
|
|
|
- } else {
|
|
|
|
- algorithmName = "仿真平台不存在该算法";
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ /**
|
|
|
|
+ * @param p1 上级指标
|
|
|
|
+ * @param p2 比对指标
|
|
|
|
+ * @param p3 末级指标
|
|
|
|
+ * @param pos 所有指标
|
|
|
|
+ * @param rootId 场景包id
|
|
|
|
+ */
|
|
|
|
+ private void setSubSc(SublistScoreVo p1, SublistScoreVo p2, SublistScoreVo p3, List<SublistScoreVo> pos, String rootId) {
|
|
|
|
+ // 上级指标
|
|
|
|
+ if (p1.getParentId().equals(p2.getId())) {
|
|
|
|
+ // 根指标给一级指标添加末级指标得分,给末级指标添加一级指标得分
|
|
|
|
+ if (p2.getParentId().equals(rootId)) {
|
|
|
|
+ p2.setLasScore(p3.getLasScore());
|
|
|
|
+ p3.setFirScore(p2.getFirScore());
|
|
|
|
+ }
|
|
|
|
+ // 末级指标拼接指标名
|
|
|
|
+ p3.setSublistName(p2.getSublistName() + ProjectConstants.SEPARATOR + p3.getSublistName());
|
|
|
|
+ // 查找上级指标,继续拼接
|
|
|
|
+ setParent(p3, p2, pos, rootId);
|
|
|
|
+ }
|
|
|
|
|
|
- simulationManualProjectVo.setAlgorithm(algorithmName);
|
|
|
|
- // 2 是否是自动项目
|
|
|
|
- if (!isAuto) {
|
|
|
|
- simulationManualProjectVo.setNowRunStateDict(getDictName(DictConstants.PROJECT_RUN_STATE, simulationManualProjectVo.getNowRunState()));
|
|
|
|
- simulationManualProjectVo.setEvaluationLevelDict(getDictName(DictConstants.EVALUATION_LEVEL, simulationManualProjectVo.getEvaluationLevel()));
|
|
|
|
- } else {
|
|
|
|
- simulationManualProjectVo.setLastRunTimeFmt(getRqStr(simulationManualProjectVo.getLastRunTime(), 1));
|
|
|
|
}
|
|
}
|
|
- // 3 格式化创建时间字符串
|
|
|
|
- simulationManualProjectVo.setCreateTimeFmt(getRqStr(simulationManualProjectVo.getCreateTime(), 1));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void convertPoToVo(SimulationManualProjectPo po, SimulationManualProjectSingleVo vo) {
|
|
|
|
- vo.setId(po.getId());
|
|
|
|
- vo.setProjectName(po.getProjectName());
|
|
|
|
- vo.setProjectDescribe(po.getProjectDescribe());
|
|
|
|
- vo.setAlgorithm(po.getAlgorithm());
|
|
|
|
- vo.setAlgorithmType(po.getAlgorithmType());
|
|
|
|
- vo.setVehicle(po.getVehicle());
|
|
|
|
- vo.setScene(po.getScene());
|
|
|
|
- vo.setMaxSimulationTime(po.getMaxSimulationTime());
|
|
|
|
- vo.setParallelism(po.getParallelism());
|
|
|
|
- vo.setIsChoiceGpu(po.getIsChoiceGpu());
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void createProjectId(SimulationManualProjectPo po) {
|
|
|
|
- Integer nowRq = getRq(null, 0);
|
|
|
|
- po.setProjectDate(nowRq);
|
|
|
|
- SimulationManualProjectPo po1 = simulationProjectMapper.selectLastProjectId(nowRq);
|
|
|
|
- if (po1 == null) {
|
|
|
|
- // 生成新id
|
|
|
|
- po.setProjectNum(1);
|
|
|
|
- } else {
|
|
|
|
- po.setProjectNum(po1.getProjectNum() + 1);
|
|
|
|
- }
|
|
|
|
- po.setProjectId(po.getProjectDate() + "-" + po.getProjectNum());
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void createProjectId(SimulationAutomaticProjectPo po) {
|
|
|
|
- Integer nowRq = getRq(null, 0);
|
|
|
|
- po.setProjectDate(nowRq);
|
|
|
|
- SimulationAutomaticProjectPo po1 = simulationAutomaticProjectMapper.selectLastProjectId(nowRq);
|
|
|
|
- if (po1 == null) {
|
|
|
|
- // 生成新id
|
|
|
|
- po.setProjectNum(1);
|
|
|
|
- } else {
|
|
|
|
- po.setProjectNum(po1.getProjectNum() + 1);
|
|
|
|
- }
|
|
|
|
- po.setProjectId(po.getProjectDate() + "-" + po.getProjectNum());
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ /*
|
|
|
|
+ */
|
|
|
|
|
|
- private Integer getRq(Date date, int index) {
|
|
|
|
- return TimeUtil.getRq(date, index);
|
|
|
|
- }
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 查询所有指标和得分
|
|
|
|
+ *
|
|
|
|
+ * @param
|
|
|
|
+ *//*
|
|
|
|
+ * private void selectScenePackageSubListAndSetScore(String pId, String
|
|
|
|
+ * scenePackageId, List<List<String>> resultArr, List<ScenePackageSubListVO>
|
|
|
|
+ * single){
|
|
|
|
+ *
|
|
|
|
+ * //首次,初始化数据以及赋值
|
|
|
|
+ * if(isEmpty(single)){
|
|
|
|
+ * //单个级联,按最后一级到第一级指标顺序添加
|
|
|
|
+ * single= new ArrayList<>();
|
|
|
|
+ * //查询所有指标最后一级
|
|
|
|
+ * List<ScenePackageSubListVO> vos =
|
|
|
|
+ * simulationProjectMapper.selectSubListByPid(scenePackageId);
|
|
|
|
+ * for(ScenePackageSubListVO vo : vos){
|
|
|
|
+ * selectSceneSubList(vo, pId, single, resultArr);
|
|
|
|
+ * }
|
|
|
|
+ * }
|
|
|
|
+ * //继续添加数据
|
|
|
|
+ * else{
|
|
|
|
+ * //查询父级节点,只有一个
|
|
|
|
+ * ScenePackageSubListVO vo =
|
|
|
|
+ * simulationProjectMapper.selectsublistBySublistId(scenePackageId);
|
|
|
|
+ * //如果是根节点,不再查询,组装返回数据
|
|
|
|
+ * if(vo.getSublistId().equals(scenePackageId)){
|
|
|
|
+ * if(isEmpty(resultArr)){
|
|
|
|
+ * //初始化返回数据
|
|
|
|
+ * resultArr = new ArrayList<>();
|
|
|
|
+ * List<String> singleList = new ArrayList<>();
|
|
|
|
+ * //反转list,正序添加(从一级开始)
|
|
|
|
+ * Collections.reverse(single);
|
|
|
|
+ *
|
|
|
|
+ * for(int i=0;i<single.size();i--){
|
|
|
|
+ * if(i == single.size()-1){
|
|
|
|
+ * singleList.add(String.valueOf(single.get(i).getSceneNum()));
|
|
|
|
+ * singleList.add(String.valueOf(single.get(i).getNotStandardSceneNum()));
|
|
|
|
+ * singleList.add(String.valueOf(single.get(i).getScore()));
|
|
|
|
+ *
|
|
|
|
+ * singleList.add(String.valueOf(single.get(i).getScore()));
|
|
|
|
+ *
|
|
|
|
+ * }
|
|
|
|
+ * singleList.add(single.get(i).getSublistName());
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ *
|
|
|
|
+ *
|
|
|
|
+ *
|
|
|
|
+ *
|
|
|
|
+ *
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * }else{
|
|
|
|
+ * selectSceneSubList(vo, pId, single, resultArr);
|
|
|
|
+ * }
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * };
|
|
|
|
+ */
|
|
|
|
|
|
- private String getRqStr(Date date, int index) {
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat(dateFmtArr[index]);
|
|
|
|
- if (date == null) {
|
|
|
|
- return "";
|
|
|
|
|
|
+ /*
|
|
|
|
+ * private void selectSceneSubList(ScenePackageSubListVO vo, String pId,
|
|
|
|
+ * List<ScenePackageSubListVO> single, List<List<String>> resultArr){
|
|
|
|
+ * //获取未达标个数,得分,总分
|
|
|
|
+ * setScore(vo,pId);
|
|
|
|
+ * //放入集合
|
|
|
|
+ * single.add(vo);
|
|
|
|
+ * //递归查询上级指标
|
|
|
|
+ * selectScenePackageSubListAndSetScore(pId, vo.getParentId(), resultArr,
|
|
|
|
+ * single);
|
|
|
|
+ * }
|
|
|
|
+ */
|
|
|
|
+ private void setScore(ScenePackageSubListVO vo, String pId) {
|
|
|
|
+ setLastTargetScore(vo, pId);
|
|
|
|
+ setSceneScore(vo, pId);
|
|
}
|
|
}
|
|
- return sdf.format(date);
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ private void setSceneScore(ScenePackageSubListVO vo, String pId) {
|
|
|
|
+ String sceneNaturalIds = vo.getSceneNaturalIds();
|
|
|
|
+ String sceneTrafficIds = vo.getSceneTrafficIds();
|
|
|
|
+ String sceneStatueIds = vo.getSceneStatueIds();
|
|
|
|
+ List<SceneScoreVo> sceneScoreVos = new ArrayList<>();
|
|
|
|
+ List<SceneScoreVo> NaturalSceneScoreVos = setSceneScore(vo, sceneNaturalIds, DictConstants.SCENE_NATURAL, pId);
|
|
|
|
+ List<SceneScoreVo> StatueSceneScoreVos = setSceneScore(vo, sceneStatueIds, DictConstants.SCENE_STANDARD, pId);
|
|
|
|
+ List<SceneScoreVo> TrafficSceneScoreVos = setSceneScore(vo, sceneTrafficIds, DictConstants.SCENE_ACCIDENT, pId);
|
|
|
|
+ /// TODO 暂不支持泛化场景
|
|
|
|
+ List<SceneScoreVo> FhSceneScoreVos = setSceneScore(vo, sceneTrafficIds, DictConstants.SCENE_GENERAL, pId);
|
|
|
|
|
|
- private Date getDate(String dateFmt, int index) {
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat(dateFmtArr[index]);
|
|
|
|
- try {
|
|
|
|
- return sdf.parse(dateFmt);
|
|
|
|
- } catch (ParseException e) {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ // 合成一个list
|
|
|
|
+ if (!isEmpty(NaturalSceneScoreVos)) {
|
|
|
|
+ sceneScoreVos.addAll(NaturalSceneScoreVos);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(StatueSceneScoreVos)) {
|
|
|
|
+ sceneScoreVos.addAll(StatueSceneScoreVos);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(TrafficSceneScoreVos)) {
|
|
|
|
+ sceneScoreVos.addAll(TrafficSceneScoreVos);
|
|
|
|
+ }
|
|
|
|
|
|
- private boolean isEmpty(String value) {
|
|
|
|
- if (value == null) {
|
|
|
|
- return true;
|
|
|
|
- }
|
|
|
|
- value = value.trim();
|
|
|
|
- if (value.length() == 0) {
|
|
|
|
- return true;
|
|
|
|
|
|
+ if (!isEmpty(FhSceneScoreVos)) {
|
|
|
|
+ sceneScoreVos.addAll(FhSceneScoreVos);
|
|
|
|
+ }
|
|
|
|
+ vo.setSceneScoreList(sceneScoreVos);
|
|
}
|
|
}
|
|
- return false;
|
|
|
|
- }
|
|
|
|
|
|
|
|
- private boolean isEmpty(List list) {
|
|
|
|
- if (list == null || list.size() <= 0) {
|
|
|
|
- return true;
|
|
|
|
|
|
+ private void setLastTargetScore(ScenePackageSubListVO vo, String pId) {
|
|
|
|
+ SimulationMptLastTargetScorePo poParam = new SimulationMptLastTargetScorePo();
|
|
|
|
+ poParam.setPId(pId);
|
|
|
|
+ poParam.setTarget(vo.getSublistId());
|
|
|
|
+ SimulationMptLastTargetScorePo po = simulationMptLastTargetScoreMapper.selectLastTargetScore(poParam);
|
|
|
|
+ if (po != null) {
|
|
|
|
+ vo.setNotStandardSceneNum(po.getNotStandardSceneNum());
|
|
|
|
+ vo.setScore(po.getScore());
|
|
|
|
+ vo.setScoreExplain(po.getScoreExplain());
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
- return false;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void setPage(Integer pageNum, Integer pageSize) {
|
|
|
|
- PageVO pageVO = new PageVO();
|
|
|
|
- pageVO.setCurrentPage(pageNum);
|
|
|
|
- pageVO.setPageSize(pageSize);
|
|
|
|
- PageUtil.setPageInfo(pageVO);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private Double saveTwoDecimalPlaces(Double d) {
|
|
|
|
- if (d == null) {
|
|
|
|
- return null;
|
|
|
|
|
|
+
|
|
|
|
+ private void setFirstTargetScore(ScenePackageSubListVO vo, String pId) {
|
|
|
|
+ SimulationMptFirstTargetScorePo poParam = new SimulationMptFirstTargetScorePo();
|
|
|
|
+ poParam.setPId(pId);
|
|
|
|
+ poParam.setTarget(vo.getSublistId());
|
|
|
|
+ SimulationMptFirstTargetScorePo po = simulationMptFirstTargetScoreMapper.selectFirstTargetScore(poParam);
|
|
|
|
+ if (po != null) {
|
|
|
|
+ vo.setScore(po.getScore());
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
- return new BigDecimal(d.toString()).setScale(2, RoundingMode.HALF_UP).doubleValue();
|
|
|
|
- }
|
|
|
|
|
|
|
|
- private Double saveTwoDecimalPlaces(Double d, int num) {
|
|
|
|
- if (d == null) {
|
|
|
|
- return null;
|
|
|
|
|
|
+ private List<SceneScoreVo> setSceneScore(ScenePackageSubListVO vo, String sceneIds, String sceneType, String pId) {
|
|
|
|
+ if (isEmpty(sceneIds)) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ String[] sceneIdArr = sceneIds.split(",");
|
|
|
|
+ SceneScoreParam sceneScoreParam = new SceneScoreParam();
|
|
|
|
+ sceneScoreParam.setPId(pId);
|
|
|
|
+ sceneScoreParam.setLastTargerId(vo.getSublistId());
|
|
|
|
+ sceneScoreParam.setSceneType(sceneType);
|
|
|
|
+ sceneScoreParam.setSceneIds(Arrays.asList(sceneIdArr));
|
|
|
|
+ List<SceneScoreVo> sceneScoreVos = simulationProjectTaskMapper.selectSceneScoreByIds(sceneScoreParam);
|
|
|
|
+
|
|
|
|
+ for (SceneScoreVo s : sceneScoreVos) {
|
|
|
|
+ /*
|
|
|
|
+ * if(SceneTypeEnum.SCENE_NATURAL.getCode().equals(sceneType)){
|
|
|
|
+ * SceneBaseInfoVo sceneBaseInfoVo =
|
|
|
|
+ * simulationProjectMapper.selectSceneNatural(s.getSceneId());
|
|
|
|
+ * if(sceneBaseInfoVo != null){
|
|
|
|
+ * s.setSceneName(sceneBaseInfoVo.getNaturalName());
|
|
|
|
+ * }
|
|
|
|
+ * }else if(SceneTypeEnum.SCENE_STANDARD.getCode().equals(sceneType)){
|
|
|
|
+ * SceneBaseInfoVo sceneBaseInfoVo =
|
|
|
|
+ * simulationProjectMapper.selectSceneStandardsRegulations(s.getSceneId());
|
|
|
|
+ * if(sceneBaseInfoVo != null){
|
|
|
|
+ * s.setSceneName(sceneBaseInfoVo.getSceneName());
|
|
|
|
+ * }
|
|
|
|
+ * }else if(SceneTypeEnum.SCENE_ACCIDENT.getCode().equals(sceneType)){
|
|
|
|
+ * SceneBaseInfoVo sceneBaseInfoVo =
|
|
|
|
+ * simulationProjectMapper.selectSceneAccidentById(s.getSceneId());
|
|
|
|
+ * if(sceneBaseInfoVo != null){
|
|
|
|
+ * s.setSceneName(sceneBaseInfoVo.getSceneName());
|
|
|
|
+ * }
|
|
|
|
+ * }else if(SceneTypeEnum.SCENE_GENERAL.getCode().equals(sceneType)){
|
|
|
|
+ * ///TODO 泛化场景暂不支持
|
|
|
|
+ *
|
|
|
|
+ * }
|
|
|
|
+ */
|
|
|
|
+ s.setSceneType(SceneTypeEnum.getState(sceneType));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return sceneScoreVos;
|
|
|
|
+
|
|
}
|
|
}
|
|
- return new BigDecimal(d.toString()).setScale(num, RoundingMode.HALF_UP).doubleValue();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 设置场景基本字段
|
|
|
|
- */
|
|
|
|
- private void setUpSceneInfo(ManualProjectTaskVo vo) {
|
|
|
|
- String sceneType = vo.getSceneType();
|
|
|
|
- String sceneId = vo.getSceneId();
|
|
|
|
- SceneBaseInfoVo sceneBaseInfoVo;
|
|
|
|
- if (DictConstants.SCENE_NATURAL.equals(sceneType)) {
|
|
|
|
- // 自然驾驶
|
|
|
|
- sceneBaseInfoVo = simulationProjectMapper.selectSceneNatural(sceneId);
|
|
|
|
- if (sceneBaseInfoVo != null) {
|
|
|
|
- vo.setSceneName(sceneBaseInfoVo.getNaturalName());
|
|
|
|
- }
|
|
|
|
- } else if (DictConstants.SCENE_STANDARD.equals(sceneType)) {
|
|
|
|
- // 标准法规
|
|
|
|
- sceneBaseInfoVo = simulationProjectMapper.selectSceneStandardsRegulations(sceneId);
|
|
|
|
- if (sceneBaseInfoVo != null) {
|
|
|
|
- vo.setSceneName(sceneBaseInfoVo.getSceneName());
|
|
|
|
- }
|
|
|
|
- } else if (DictConstants.SCENE_ACCIDENT.equals(sceneType)) {
|
|
|
|
- // 交通事故
|
|
|
|
- sceneBaseInfoVo = simulationProjectMapper.selectSceneAccidentById(sceneId);
|
|
|
|
- if (sceneBaseInfoVo != null) {
|
|
|
|
- vo.setSceneName(sceneBaseInfoVo.getSceneName());
|
|
|
|
- }
|
|
|
|
- } else if (DictConstants.SCENE_GENERAL.equals(sceneType)) {
|
|
|
|
- /// TODO 泛化场景暂不支持
|
|
|
|
- sceneBaseInfoVo = simulationProjectMapper.selectSceneGeneralDataById(sceneId);
|
|
|
|
- if (sceneBaseInfoVo != null) {
|
|
|
|
- vo.setSceneName(sceneBaseInfoVo.getSceneName());
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取二级场景下所有得分不为 0 的场景数量
|
|
|
|
+ *
|
|
|
|
+ * @param sublistId
|
|
|
|
+ * @param pId
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private Integer getSetScoreNum(String sublistId, String pId) {
|
|
|
|
+ SceneScoreVo vo = selectScoreNum(null, null, true, pId, sublistId);
|
|
|
|
+ return vo.getNum();
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- private ManualProjectTaskVo convertManualProjectTaskPoToVo(ManualProjectTaskPo po) {
|
|
|
|
- ManualProjectTaskVo manualProjectTaskVo = new ManualProjectTaskVo();
|
|
|
|
- manualProjectTaskVo.setId(po.getId());
|
|
|
|
- manualProjectTaskVo.setPId(po.getPId());
|
|
|
|
- manualProjectTaskVo.setSceneId(po.getSceneId());
|
|
|
|
- // manualProjectTaskVo.setSceneName(po.getSceneName());
|
|
|
|
- manualProjectTaskVo.setSceneType(po.getSceneType());
|
|
|
|
- manualProjectTaskVo.setRunStartTimeFmt(getRqStr(po.getRunStartTime(), 2));
|
|
|
|
- manualProjectTaskVo.setRunEndTimeFmt(getRqStr(po.getRunEndTime(), 2));
|
|
|
|
- manualProjectTaskVo.setRunState(po.getRunState());
|
|
|
|
- manualProjectTaskVo.setRunResult(po.getRunResult());
|
|
|
|
- return manualProjectTaskVo;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 级联获取场景指标得分数据
|
|
|
|
- *
|
|
|
|
- * @param parentVoList 首次传null
|
|
|
|
- * @param isRoot 首次传true
|
|
|
|
- * @param scenePackageId 场景包id
|
|
|
|
- * @param pId 项目表id,用于统计得分使用
|
|
|
|
- * @param level 指标级别
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- private List<ScenePackageSubListVO> selectScenePackageSubListTreeAndSetScore(List<ScenePackageSubListVO> parentVoList, boolean isRoot, String scenePackageId, String pId, Integer level) {
|
|
|
|
-
|
|
|
|
- if (isRoot) {
|
|
|
|
- // 查找一级节点
|
|
|
|
- parentVoList = simulationProjectMapper.selectSubSceneByPid(scenePackageId);
|
|
|
|
- if (!isEmpty(parentVoList)) {
|
|
|
|
- selectScenePackageSubListTreeAndSetScore(parentVoList, false, null, pId, level);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- // 获取子节点集合
|
|
|
|
- for (ScenePackageSubListVO pvo : parentVoList) {
|
|
|
|
-
|
|
|
|
- pvo.setLevel(level);
|
|
|
|
-
|
|
|
|
- // 二级指标获取总分
|
|
|
|
- if (level == 2) {
|
|
|
|
- setFirstTargetScore(pvo, pId);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- List<ScenePackageSubListVO> cvoList = simulationProjectMapper.selectSubSceneByPid(pvo.getSublistId());
|
|
|
|
- if (!isEmpty(cvoList)) {
|
|
|
|
- // 存入父节点集合中
|
|
|
|
- pvo.setChildScenePackageSubListVOList(cvoList);
|
|
|
|
- // 继续查找下一节点
|
|
|
|
- selectScenePackageSubListTreeAndSetScore(cvoList, false, null, pId, level + 1);
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取一级指标下所有得分不为 0 的场景总数
|
|
|
|
+ *
|
|
|
|
+ * @param resultVo 返回值,返回统计数量,首次传null
|
|
|
|
+ * @param parentVoList 首次传null
|
|
|
|
+ * @param isRoot 首次传true
|
|
|
|
+ * @param pId 项目表id,用于统计得分使用
|
|
|
|
+ * @param sublistId 指标id(用户查询指标下的所有场景)
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private SceneScoreVo selectScoreNum(SceneScoreVo resultVo, List<ScenePackageSubListVO> parentVoList, boolean isRoot, String pId, String sublistId) {
|
|
|
|
+ if (isRoot) {
|
|
|
|
+ // 初始化返回值
|
|
|
|
+ resultVo = new SceneScoreVo();
|
|
|
|
+ resultVo.setNum(0);
|
|
|
|
+
|
|
|
|
+ // 查找下一级指标
|
|
|
|
+ parentVoList = simulationProjectMapper.selectSubSceneByPid(sublistId);
|
|
|
|
+ if (!isEmpty(parentVoList)) {
|
|
|
|
+ selectScoreNum(resultVo, parentVoList, false, pId, null);
|
|
|
|
+ } else {
|
|
|
|
+ // 当前指标为最后一级指标,获取当前指标,统计得分场景数
|
|
|
|
+ setScoreNum(sublistId, pId, resultVo);
|
|
|
|
+ }
|
|
|
|
+
|
|
} else {
|
|
} else {
|
|
|
|
|
|
- // 没有子节点;最后一级,获取指标得分,指标得分说明,和指标下场景得分
|
|
|
|
- setScore(pvo, pId);
|
|
|
|
|
|
+ // 获取子节点集合
|
|
|
|
+ for (ScenePackageSubListVO pvo : parentVoList) {
|
|
|
|
+
|
|
|
|
+ List<ScenePackageSubListVO> cvoList = simulationProjectMapper.selectSubSceneByPid(pvo.getSublistId());
|
|
|
|
+ if (!isEmpty(cvoList)) {
|
|
|
|
+ // 存入父节点集合中
|
|
|
|
+ pvo.setChildScenePackageSubListVOList(cvoList);
|
|
|
|
+ // 继续查找下一节点
|
|
|
|
+ selectScoreNum(resultVo, cvoList, false, pId, null);
|
|
|
|
+ } else {
|
|
|
|
+ // 没有子节点;获取最后一级的得分场景数量
|
|
|
|
+ setScoreNum(pvo.getSublistId(), pId, resultVo);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ return resultVo;
|
|
}
|
|
}
|
|
|
|
|
|
- return parentVoList;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private Map<String, Object> selectSceneScore(String scenePackageId, String projectId, String taskId) {
|
|
|
|
-
|
|
|
|
- // 1 查询指定项目的所有指标得分结果
|
|
|
|
- SimulationManualProjectParam query = new SimulationManualProjectParam();
|
|
|
|
- query.setId(projectId);
|
|
|
|
- query.setPackageId(scenePackageId);
|
|
|
|
- List<SublistScoreVo> pos = simulationProjectMapper.selectSubScore2(query);
|
|
|
|
- // 2 查询指定项目的所有任务得分结果
|
|
|
|
- ProjectTaskParam param = new ProjectTaskParam();
|
|
|
|
- param.setPId(projectId);
|
|
|
|
- if (!isEmpty(taskId)) {
|
|
|
|
- param.setTaskId(taskId);
|
|
|
|
- }
|
|
|
|
- List<ManualProjectTaskVo> taskList = simulationProjectTaskMapper.selectProjectTaskByProjectId(param); // 手动运行项目和自动运行项目使用同一个任务表
|
|
|
|
-
|
|
|
|
- // 2 拼接场景得分信息
|
|
|
|
- List<SublistScoreVo> lastSubList = new ArrayList<>();
|
|
|
|
- for (SublistScoreVo po : pos) {
|
|
|
|
- if (ObjectUtil.isNotNull(po.getPackageAndRules())) {
|
|
|
|
- // 获取场景得分信息
|
|
|
|
- for (ManualProjectTaskVo task : taskList)
|
|
|
|
- if (task.getLastTargerId().equals(po.getId())) {
|
|
|
|
- SublistScoreVo sublistScoreVo = new SublistScoreVo();
|
|
|
|
- BeanUtils.copyProperties(po, sublistScoreVo);
|
|
|
|
- sublistScoreVo.setRunResult(task.getRunResult());
|
|
|
|
- sublistScoreVo.setSceneScore(saveTwoDecimalPlaces(task.getScore())); // 得分
|
|
|
|
- sublistScoreVo.setTargetEvaluate(task.getTargetEvaluate());// 指标评价
|
|
|
|
- String sceneType = task.getSceneType();
|
|
|
|
- String sceneId = task.getSceneId();
|
|
|
|
- String sceneName = "";
|
|
|
|
- if (DictConstants.SCENE_NATURAL.equals(sceneType)) {
|
|
|
|
- sublistScoreVo.setSceneType("自然驾驶");
|
|
|
|
- SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneNatural(sceneId);
|
|
|
|
- sceneName = sceneBaseInfoVo.getNaturalName();
|
|
|
|
- } else if (DictConstants.SCENE_STANDARD.equals(sceneType)) {
|
|
|
|
- sublistScoreVo.setSceneType("标准法规");
|
|
|
|
- SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneStandardsRegulations(sceneId);
|
|
|
|
- sceneName = sceneBaseInfoVo.getSceneName();
|
|
|
|
- } else if (DictConstants.SCENE_ACCIDENT.equals(sceneType)) {
|
|
|
|
- sublistScoreVo.setSceneType("交通事故");
|
|
|
|
- SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneAccidentById(sceneId);
|
|
|
|
- sceneName = sceneBaseInfoVo.getSceneName();
|
|
|
|
- } else if (DictConstants.SCENE_GENERAL.equals(sceneType)) {
|
|
|
|
- sublistScoreVo.setSceneType("泛化");
|
|
|
|
- SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneGeneralDataById(sceneId);
|
|
|
|
- sceneName = sceneBaseInfoVo.getSceneName();
|
|
|
|
- }
|
|
|
|
- sublistScoreVo.setReturnSceneId(sceneName); // 显示场景名称
|
|
|
|
- lastSubList.add(sublistScoreVo);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- int size = 0;
|
|
|
|
- List<List<String>> result = new ArrayList<>();
|
|
|
|
- // 新增返回状态
|
|
|
|
- ArrayList<String> runStateList = new ArrayList<>();
|
|
|
|
- // 末级指标
|
|
|
|
- for (SublistScoreVo sp : lastSubList) {
|
|
|
|
- setParentSub(sp, null, pos);
|
|
|
|
- String sublistName = sp.getSublistName();
|
|
|
|
- // 失败的任务没有数据,需要校验
|
|
|
|
- Double sceneScore = sp.getSceneScore();
|
|
|
|
- if (sceneScore == null) {
|
|
|
|
- sceneScore = 0D;
|
|
|
|
- }
|
|
|
|
- String targetEvaluate = sp.getTargetEvaluate();
|
|
|
|
- if (targetEvaluate == null) {
|
|
|
|
- targetEvaluate = "";
|
|
|
|
- }
|
|
|
|
- /*
|
|
|
|
- * sublistName +=
|
|
|
|
- * ProjectConstants.SEPARATOR+sp.getReturnSceneId()+ProjectConstants.SEPARATOR+
|
|
|
|
- * sp.getSceneType()+ProjectConstants.SEPARATOR+
|
|
|
|
- * sp.getSceneScore()+ProjectConstants.SEPARATOR+sp.getTargetEvaluate()+
|
|
|
|
- * ProjectConstants.SEPARATOR+sp.getScoreExplain();
|
|
|
|
- */
|
|
|
|
- // 测试得分,指标评价,得分说明 --处理
|
|
|
|
- if (isEmpty(targetEvaluate) || isEmpty(sp.getScoreExplain())) {
|
|
|
|
- sublistName += ProjectConstants.SEPARATOR + sp.getReturnSceneId() + ProjectConstants.SEPARATOR + sp.getSceneType() + ProjectConstants.SEPARATOR + "--" + ProjectConstants.SEPARATOR + "--" + ProjectConstants.SEPARATOR + "--";
|
|
|
|
- } else {
|
|
|
|
- sublistName += ProjectConstants.SEPARATOR + sp.getReturnSceneId() + ProjectConstants.SEPARATOR + sp.getSceneType() + ProjectConstants.SEPARATOR + sceneScore + ProjectConstants.SEPARATOR + targetEvaluate + ProjectConstants.SEPARATOR + sp.getScoreExplain();
|
|
|
|
- }
|
|
|
|
- String[] split = sublistName.split(ProjectConstants.SEPARATOR);
|
|
|
|
- List<String> strings = new LinkedList<>(Arrays.asList(split));
|
|
|
|
- if (size < strings.size()) {
|
|
|
|
- size = strings.size();
|
|
|
|
- }
|
|
|
|
- result.add(strings);
|
|
|
|
- runStateList.add(sp.getRunResult());
|
|
|
|
- }
|
|
|
|
- List<SceneScListVo> objects = new ArrayList<>();
|
|
|
|
- // 结果补全
|
|
|
|
- int r = 0;
|
|
|
|
- for (List<String> list : result) {
|
|
|
|
- int start = list.size() - 5;
|
|
|
|
- SceneScListVo sceneScListVo = new SceneScListVo();
|
|
|
|
- for (int i = 0; i < start; i++) {
|
|
|
|
- if (0 == i) {
|
|
|
|
- sceneScListVo.setSublistName1(list.get(i));
|
|
|
|
- } else if (1 == i) {
|
|
|
|
- sceneScListVo.setSublistName2(list.get(i));
|
|
|
|
- } else if (2 == i) {
|
|
|
|
- sceneScListVo.setSublistName3(list.get(i));
|
|
|
|
- } else if (3 == i) {
|
|
|
|
- sceneScListVo.setSublistName4(list.get(i));
|
|
|
|
- } else if (4 == i) {
|
|
|
|
- sceneScListVo.setSublistName5(list.get(i));
|
|
|
|
- } else if (5 == i) {
|
|
|
|
- sceneScListVo.setSublistName6(list.get(i));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- sceneScListVo.setSceneId(list.get(start));
|
|
|
|
- sceneScListVo.setSceneIdType(list.get(start + 1));
|
|
|
|
- sceneScListVo.setSceneScore(list.get(start + 2));
|
|
|
|
- sceneScListVo.setTargetEvaluate(list.get(start + 3));
|
|
|
|
- sceneScListVo.setScoreExplain(list.get(start + 4));
|
|
|
|
- sceneScListVo.setRunState(runStateList.get(r));
|
|
|
|
- objects.add(sceneScListVo);
|
|
|
|
- r++;
|
|
|
|
- }
|
|
|
|
- List<Map<Object, Object>> headerList = new ArrayList<>();
|
|
|
|
- int maxIndex = size - 5;
|
|
|
|
- for (int i = 0; i < maxIndex; i++) {
|
|
|
|
- addHeaders(i, headerList);
|
|
|
|
- }
|
|
|
|
- headerList.add(ImmutableMap.builder().put("label", "场景名称").put("prop", "sceneId").build());
|
|
|
|
- headerList.add(ImmutableMap.builder().put("label", "场景类型").put("prop", "sceneIdType").build());
|
|
|
|
- headerList.add(ImmutableMap.builder().put("label", "测试得分").put("prop", "sceneScore").build());
|
|
|
|
- headerList.add(ImmutableMap.builder().put("label", "指标评价").put("prop", "targetEvaluate").build());
|
|
|
|
- headerList.add(ImmutableMap.builder().put("label", "得分说明").put("prop", "scoreExplain").build());
|
|
|
|
- HashMap<String, Object> hashMap = new HashMap<>();
|
|
|
|
- hashMap.put("headerList", headerList);
|
|
|
|
- hashMap.put("result", objects);
|
|
|
|
- return hashMap;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private Map<String, Object> selectSceneScore2(String scenePackageId, String projectId, String taskId, ProjectReportVo projectReportVo) {
|
|
|
|
-
|
|
|
|
- // 1 查询指定项目的所有指标得分结果
|
|
|
|
- SimulationManualProjectParam query = new SimulationManualProjectParam();
|
|
|
|
- query.setId(projectId);
|
|
|
|
- query.setPackageId(scenePackageId);
|
|
|
|
- List<SublistScoreVo> pos = simulationProjectMapper.selectSubScore2(query);
|
|
|
|
- // 2 查询指定项目的所有任务得分结果
|
|
|
|
- ProjectTaskParam param = new ProjectTaskParam();
|
|
|
|
- param.setPId(projectId);
|
|
|
|
- if (!isEmpty(taskId)) {
|
|
|
|
- param.setTaskId(taskId);
|
|
|
|
- }
|
|
|
|
- List<ManualProjectTaskVo> taskList = simulationProjectTaskMapper.selectProjectTaskByProjectId(param); // 手动运行项目和自动运行项目使用同一个任务表
|
|
|
|
-
|
|
|
|
- // 2 拼接场景得分信息
|
|
|
|
- List<SublistScoreVo> lastSubList = new ArrayList<>();
|
|
|
|
- for (SublistScoreVo po : pos) {
|
|
|
|
- if (ObjectUtil.isNotNull(po.getPackageAndRules())) {
|
|
|
|
- // 获取场景得分信息
|
|
|
|
- for (ManualProjectTaskVo task : taskList)
|
|
|
|
- if (task.getLastTargerId().equals(po.getId())) {
|
|
|
|
- SublistScoreVo sublistScoreVo = new SublistScoreVo();
|
|
|
|
- BeanUtils.copyProperties(po, sublistScoreVo);
|
|
|
|
- sublistScoreVo.setRunResult(task.getRunResult());
|
|
|
|
- sublistScoreVo.setSceneScore(saveTwoDecimalPlaces(task.getScore())); // 得分
|
|
|
|
- sublistScoreVo.setTargetEvaluate(task.getTargetEvaluate());// 指标评价
|
|
|
|
- String sceneType = task.getSceneType();
|
|
|
|
- String sceneId = task.getSceneId();
|
|
|
|
- String sceneName = "";
|
|
|
|
- if (DictConstants.SCENE_NATURAL.equals(sceneType)) {
|
|
|
|
- sublistScoreVo.setSceneType("自然驾驶");
|
|
|
|
- SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneNatural(sceneId);
|
|
|
|
- sceneName = sceneBaseInfoVo.getNaturalName();
|
|
|
|
- } else if (DictConstants.SCENE_STANDARD.equals(sceneType)) {
|
|
|
|
- sublistScoreVo.setSceneType("标准法规");
|
|
|
|
- SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneStandardsRegulations(sceneId);
|
|
|
|
- sceneName = sceneBaseInfoVo.getSceneName();
|
|
|
|
- } else if (DictConstants.SCENE_ACCIDENT.equals(sceneType)) {
|
|
|
|
- sublistScoreVo.setSceneType("交通事故");
|
|
|
|
- SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneAccidentById(sceneId);
|
|
|
|
- sceneName = sceneBaseInfoVo.getSceneName();
|
|
|
|
- } else if (DictConstants.SCENE_GENERAL.equals(sceneType)) {
|
|
|
|
- sublistScoreVo.setSceneType("泛化");
|
|
|
|
- SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneGeneralDataById(sceneId);
|
|
|
|
- sceneName = sceneBaseInfoVo.getSceneName();
|
|
|
|
- }
|
|
|
|
- sublistScoreVo.setReturnSceneId(sceneName); // 显示场景名称
|
|
|
|
- lastSubList.add(sublistScoreVo);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- int size = 0;
|
|
|
|
- List<List<String>> result = new ArrayList<>();
|
|
|
|
- // 新增返回状态
|
|
|
|
- ArrayList<String> runStateList = new ArrayList<>();
|
|
|
|
- // 末级指标
|
|
|
|
- for (SublistScoreVo sp : lastSubList) {
|
|
|
|
- setParentSub(sp, null, pos);
|
|
|
|
- String sublistName = sp.getSublistName();
|
|
|
|
- // 失败的任务没有数据,需要校验
|
|
|
|
- Double sceneScore = sp.getSceneScore();
|
|
|
|
- if (sceneScore == null) {
|
|
|
|
- sceneScore = 0D;
|
|
|
|
- }
|
|
|
|
- String targetEvaluate = sp.getTargetEvaluate();
|
|
|
|
- if (targetEvaluate == null) {
|
|
|
|
- targetEvaluate = "";
|
|
|
|
- }
|
|
|
|
- /*
|
|
|
|
- * sublistName +=
|
|
|
|
- * ProjectConstants.SEPARATOR+sp.getReturnSceneId()+ProjectConstants.SEPARATOR+
|
|
|
|
- * sp.getSceneType()+ProjectConstants.SEPARATOR+
|
|
|
|
- * sp.getSceneScore()+ProjectConstants.SEPARATOR+sp.getTargetEvaluate()+
|
|
|
|
- * ProjectConstants.SEPARATOR+sp.getScoreExplain();
|
|
|
|
- */
|
|
|
|
- // 测试得分,指标评价,得分说明 --处理
|
|
|
|
- if (isEmpty(targetEvaluate) || isEmpty(sp.getScoreExplain())) {
|
|
|
|
- sublistName += ProjectConstants.SEPARATOR + sp.getReturnSceneId() + ProjectConstants.SEPARATOR + sp.getSceneType() + ProjectConstants.SEPARATOR + "--" + ProjectConstants.SEPARATOR + "--" + ProjectConstants.SEPARATOR + "--";
|
|
|
|
- } else {
|
|
|
|
- sublistName += ProjectConstants.SEPARATOR + sp.getReturnSceneId() + ProjectConstants.SEPARATOR + sp.getSceneType() + ProjectConstants.SEPARATOR + sceneScore + ProjectConstants.SEPARATOR + targetEvaluate + ProjectConstants.SEPARATOR + sp.getScoreExplain();
|
|
|
|
- }
|
|
|
|
- String[] split = sublistName.split(ProjectConstants.SEPARATOR);
|
|
|
|
- List<String> strings = new LinkedList<>(Arrays.asList(split));
|
|
|
|
- if (size < strings.size()) {
|
|
|
|
- size = strings.size();
|
|
|
|
- }
|
|
|
|
- result.add(strings);
|
|
|
|
- runStateList.add(sp.getRunResult());
|
|
|
|
- }
|
|
|
|
- List<SceneScListVo> objects = new ArrayList<>();
|
|
|
|
- // 结果补全
|
|
|
|
- int r = 0;
|
|
|
|
- for (List<String> list : result) {
|
|
|
|
- int start = list.size() - 5;
|
|
|
|
- SceneScListVo sceneScListVo = new SceneScListVo();
|
|
|
|
- for (int i = 0; i < start; i++) {
|
|
|
|
- if (0 == i) {
|
|
|
|
- String s0 = list.get(i);
|
|
|
|
- if (StringUtil.isNotEmpty(s0)) {
|
|
|
|
- sceneScListVo.setEachMaxIndex((i + 1) + "");
|
|
|
|
- }
|
|
|
|
- sceneScListVo.setSublistName1(s0);
|
|
|
|
- } else if (1 == i) {
|
|
|
|
- String s1 = list.get(i);
|
|
|
|
- if (StringUtil.isNotEmpty(s1)) {
|
|
|
|
- sceneScListVo.setEachMaxIndex((i + 1) + "");
|
|
|
|
- }
|
|
|
|
- sceneScListVo.setSublistName2(list.get(i));
|
|
|
|
- } else if (2 == i) {
|
|
|
|
- String s2 = list.get(i);
|
|
|
|
- if (StringUtil.isNotEmpty(s2)) {
|
|
|
|
- sceneScListVo.setEachMaxIndex((i + 1) + "");
|
|
|
|
- }
|
|
|
|
- sceneScListVo.setSublistName3(list.get(i));
|
|
|
|
- } else if (3 == i) {
|
|
|
|
- String s3 = list.get(i);
|
|
|
|
- if (StringUtil.isNotEmpty(s3)) {
|
|
|
|
- sceneScListVo.setEachMaxIndex((i + 1) + "");
|
|
|
|
- }
|
|
|
|
- sceneScListVo.setSublistName4(list.get(i));
|
|
|
|
- } else if (4 == i) {
|
|
|
|
- String s4 = list.get(i);
|
|
|
|
- if (StringUtil.isNotEmpty(s4)) {
|
|
|
|
- sceneScListVo.setEachMaxIndex((i + 1) + "");
|
|
|
|
- }
|
|
|
|
- sceneScListVo.setSublistName5(list.get(i));
|
|
|
|
- } else if (5 == i) {
|
|
|
|
- String s5 = list.get(i);
|
|
|
|
- if (StringUtil.isNotEmpty(s5)) {
|
|
|
|
- sceneScListVo.setEachMaxIndex((i + 1) + "");
|
|
|
|
- }
|
|
|
|
- sceneScListVo.setSublistName6(list.get(i));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- sceneScListVo.setSceneId(list.get(start));
|
|
|
|
- sceneScListVo.setSceneIdType(list.get(start + 1));
|
|
|
|
- sceneScListVo.setSceneScore(list.get(start + 2));
|
|
|
|
- sceneScListVo.setTargetEvaluate(list.get(start + 3));
|
|
|
|
- sceneScListVo.setScoreExplain(list.get(start + 4));
|
|
|
|
- sceneScListVo.setRunState(runStateList.get(r));
|
|
|
|
- objects.add(sceneScListVo);
|
|
|
|
- r++;
|
|
|
|
- }
|
|
|
|
- List<Map<Object, Object>> headerList = new ArrayList<>();
|
|
|
|
- int maxIndex = size - 5;
|
|
|
|
- projectReportVo.setMaxIndex(maxIndex);
|
|
|
|
- for (int i = 0; i < maxIndex; i++) {
|
|
|
|
- addHeaders(i, headerList);
|
|
|
|
- }
|
|
|
|
- headerList.add(ImmutableMap.builder().put("label", "场景名称").put("prop", "sceneId").build());
|
|
|
|
- headerList.add(ImmutableMap.builder().put("label", "场景类型").put("prop", "sceneIdType").build());
|
|
|
|
- headerList.add(ImmutableMap.builder().put("label", "测试得分").put("prop", "sceneScore").build());
|
|
|
|
- headerList.add(ImmutableMap.builder().put("label", "指标评价").put("prop", "targetEvaluate").build());
|
|
|
|
- headerList.add(ImmutableMap.builder().put("label", "得分说明").put("prop", "scoreExplain").build());
|
|
|
|
- HashMap<String, Object> hashMap = new HashMap<>();
|
|
|
|
- hashMap.put("headerList", headerList);
|
|
|
|
- hashMap.put("result", objects);
|
|
|
|
- return hashMap;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * @param po 末级指标
|
|
|
|
- * @param parentPo 上级指标
|
|
|
|
- * @param pos 所有指标
|
|
|
|
- */
|
|
|
|
- private void setParentSub(SublistScoreVo po, SublistScoreVo parentPo, List<SublistScoreVo> pos) {
|
|
|
|
- if (parentPo == null) {
|
|
|
|
- for (SublistScoreVo p : pos) {
|
|
|
|
- setSc(po, p, po, pos);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- for (SublistScoreVo p : pos) {
|
|
|
|
- setSc(parentPo, p, po, pos);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * @param p1 上级指标
|
|
|
|
- * @param p2 比对指标
|
|
|
|
- * @param p3 末级指标
|
|
|
|
- * @param pos 所有指标
|
|
|
|
- */
|
|
|
|
- private void setSc(SublistScoreVo p1, SublistScoreVo p2, SublistScoreVo p3, List<SublistScoreVo> pos) {
|
|
|
|
- // 上级指标
|
|
|
|
- if (p1.getParentId().equals(p2.getId())) {
|
|
|
|
-
|
|
|
|
- // 末级指标拼接指标名
|
|
|
|
- p3.setSublistName(p2.getSublistName() + ProjectConstants.SEPARATOR + p3.getSublistName());
|
|
|
|
- // 查找上级指标,继续拼接
|
|
|
|
- setParentSub(p3, p2, pos);
|
|
|
|
|
|
+ private void setScoreNum(String sublistId, String pId, SceneScoreVo resultVo) {
|
|
|
|
+ SimulationMptSceneScorePo po = new SimulationMptSceneScorePo();
|
|
|
|
+ po.setPId(pId);
|
|
|
|
+ po.setLastTargerId(sublistId);
|
|
|
|
+ SceneScoreVo sceneScoreVo = simulationProjectTaskMapper.selectSceneScoreNumQuery(po);
|
|
|
|
+ resultVo.setNum(resultVo.getNum() + sceneScoreVo.getNum());
|
|
}
|
|
}
|
|
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private Map<String, Object> selectScenePackageSubListAndSetScore(String scenePackageId, String projectId) {
|
|
|
|
-
|
|
|
|
- // 查询场景包所有数据
|
|
|
|
- SimulationManualProjectParam query = new SimulationManualProjectParam();
|
|
|
|
- query.setId(projectId);
|
|
|
|
- query.setPackageId(scenePackageId);
|
|
|
|
- List<SublistScoreVo> sublistScoreVoList = simulationProjectMapper.selectSubScore2(query);
|
|
|
|
- HashMap<String, Object> hashMap = new HashMap<>();
|
|
|
|
- int maxHeaderNumber = 0;
|
|
|
|
- List<List<String>> result = new ArrayList<>();
|
|
|
|
- // 递归指标名称得分
|
|
|
|
- for (SublistScoreVo sublistScoreVo : sublistScoreVoList) {
|
|
|
|
- if (ObjectUtil.isNotNull(sublistScoreVo.getPackageAndRules()) && (sublistScoreVo.getFirTarget() != null || sublistScoreVo.getLasTarget() != null)) {
|
|
|
|
- // 末级指标
|
|
|
|
- setParent(sublistScoreVo, null, sublistScoreVoList, scenePackageId);
|
|
|
|
- String sublistName = sublistScoreVo.getSublistName();
|
|
|
|
- Double firScore = sublistScoreVo.getFirScore();
|
|
|
|
- String firstScore = ""; // first得分
|
|
|
|
- if (firScore != null) {
|
|
|
|
- firstScore = saveTwoDecimalPlaces(firScore, 1).toString();
|
|
|
|
- }
|
|
|
|
- Double lasScore = sublistScoreVo.getLasScore();
|
|
|
|
- String LastScore = ""; // last得分
|
|
|
|
- if (lasScore != null) {
|
|
|
|
- LastScore = saveTwoDecimalPlaces(lasScore, 1).toString();
|
|
|
|
- }
|
|
|
|
- String sceneNum = sublistScoreVo.getSceneNum(); // 场景数量
|
|
|
|
- String errorSceneNum = sublistScoreVo.getErrorSceneNum(); // 仿真异常场景个数
|
|
|
|
- String notScoredSceneNum = sublistScoreVo.getNotScoredSceneNum(); // 未参与评分数量
|
|
|
|
- String notStandardSceneNum = sublistScoreVo.getNotStandardSceneNum(); // 未达标场景数量
|
|
|
|
- String standardSceneNum = sublistScoreVo.getStandardSceneNum(); // 达标场景数量
|
|
|
|
-
|
|
|
|
- if (ObjectUtil.isNotNull(sublistName)) {
|
|
|
|
- sublistName += ProjectConstants.SEPARATOR + sceneNum + ProjectConstants.SEPARATOR + errorSceneNum + ProjectConstants.SEPARATOR + notScoredSceneNum + ProjectConstants.SEPARATOR + notStandardSceneNum + ProjectConstants.SEPARATOR + standardSceneNum + ProjectConstants.SEPARATOR + LastScore + ProjectConstants.SEPARATOR + firstScore;
|
|
|
|
- String[] split = sublistName.split(ProjectConstants.SEPARATOR);
|
|
|
|
- maxHeaderNumber = Math.max(maxHeaderNumber, split.length); // 求最大表头数量
|
|
|
|
- result.add(Arrays.asList(split));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 计算评测等级
|
|
|
|
+ *
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private String getEvaluationLevel(SimulationManualProjectPo po) {
|
|
|
|
+ /*
|
|
|
|
+ * 汇总测试得分(计算评级)计算方法:(每一项一级指标的测试得分*测试权重)累加
|
|
|
|
+ */
|
|
|
|
+ List<ScenePackageSubListVO> scenePackageSubListVOS = simulationProjectMapper.selectSubSceneByPid(po.getScene());
|
|
|
|
+
|
|
|
|
+ String evaluationLevelReport = "";
|
|
|
|
+ if (!isEmpty(scenePackageSubListVOS)) {
|
|
|
|
+ // 汇总数据初始化
|
|
|
|
+ double totalScore = 0.0;
|
|
|
|
+ for (ScenePackageSubListVO scenePackageSubListVO : scenePackageSubListVOS) {
|
|
|
|
+ double weightDouble = Double.parseDouble(scenePackageSubListVO.getWeight());
|
|
|
|
+ SimulationMptFirstTargetScorePo simulationMptFirstTargetScorePo = new SimulationMptFirstTargetScorePo();
|
|
|
|
+ simulationMptFirstTargetScorePo.setPId(po.getId());
|
|
|
|
+ simulationMptFirstTargetScorePo.setTarget(scenePackageSubListVO.getSublistId());
|
|
|
|
+ // 单个二级指标得分
|
|
|
|
+ SimulationMptFirstTargetScorePo simulationMptFirstTargetScorePo1 = simulationMptFirstTargetScoreMapper.selectFirstTargetScore(simulationMptFirstTargetScorePo);
|
|
|
|
+ if (simulationMptFirstTargetScorePo1 == null) {
|
|
|
|
+ return evaluationLevelReport;
|
|
|
|
+ }
|
|
|
|
+ double score = simulationMptFirstTargetScorePo1.getScore();
|
|
|
|
+ totalScore += score * (weightDouble / 100);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ evaluationLevelReport = ProjectUtil.getEvaluationLevelReport(saveTwoDecimalPlaces(totalScore));
|
|
|
|
+ return evaluationLevelReport;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return evaluationLevelReport;
|
|
|
|
+
|
|
}
|
|
}
|
|
- // 结果补全
|
|
|
|
- List<SubScListVo> values = new ArrayList<>();
|
|
|
|
- int fieldNumber = 7;
|
|
|
|
- for (List<String> list : result) {
|
|
|
|
- int start = list.size() - fieldNumber;
|
|
|
|
- SubScListVo subScListVo = new SubScListVo();
|
|
|
|
- subScListVo.setSceneNum(list.get(start));
|
|
|
|
- subScListVo.setErrorSceneNum(list.get(start + 1));
|
|
|
|
- subScListVo.setNotScoredSceneNum(list.get(start + 2));
|
|
|
|
- subScListVo.setNotStandardSceneNum(list.get(start + 3));
|
|
|
|
- subScListVo.setStandardSceneNum(list.get(start + 4));
|
|
|
|
- subScListVo.setLastScore(list.get(start + 5));
|
|
|
|
- subScListVo.setFirstScore(list.get(start + 6));
|
|
|
|
- for (int i = 0; i < start; i++) {
|
|
|
|
|
|
+
|
|
|
|
+ private void addHeaders(Integer i, List<Map<Object, Object>> header) {
|
|
if (0 == i) {
|
|
if (0 == i) {
|
|
- subScListVo.setSublistName1(list.get(i));
|
|
|
|
|
|
+ header.add(ImmutableMap.builder().put("label", "一级指标").put("prop", "sublistName1").build());
|
|
} else if (1 == i) {
|
|
} else if (1 == i) {
|
|
- subScListVo.setSublistName2(list.get(i));
|
|
|
|
|
|
+ header.add(ImmutableMap.builder().put("label", "二级指标").put("prop", "sublistName2").build());
|
|
} else if (2 == i) {
|
|
} else if (2 == i) {
|
|
- subScListVo.setSublistName3(list.get(i));
|
|
|
|
|
|
+ header.add(ImmutableMap.builder().put("label", "三级指标").put("prop", "sublistName3").build());
|
|
} else if (3 == i) {
|
|
} else if (3 == i) {
|
|
- subScListVo.setSublistName4(list.get(i));
|
|
|
|
|
|
+ header.add(ImmutableMap.builder().put("label", "四级指标").put("prop", "sublistName4").build());
|
|
} else if (4 == i) {
|
|
} else if (4 == i) {
|
|
- subScListVo.setSublistName5(list.get(i));
|
|
|
|
|
|
+ header.add(ImmutableMap.builder().put("label", "五级指标").put("prop", "sublistName5").build());
|
|
} else if (5 == i) {
|
|
} else if (5 == i) {
|
|
- subScListVo.setSublistName6(list.get(i));
|
|
|
|
|
|
+ header.add(ImmutableMap.builder().put("label", "六级指标").put("prop", "sublistName6").build());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 任务运行状态统计-饼图
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<List<Map<String, Object>>> selectRunTaskByState() {
|
|
|
|
+ String key1 = "num";
|
|
|
|
+ String key2 = "runState";
|
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
|
+ params.put("createUserId", AuthUtil.getCurrentUserId());
|
|
|
|
+ List<Map<String, Object>> list = simulationProjectTaskMapper.selectRunTaskByState(params);
|
|
|
|
+ // 汉化
|
|
|
|
+ if (CollectionUtil.isNotEmpty(list)) {
|
|
|
|
+ list.forEach(map -> {
|
|
|
|
+ if (StateConstant.Aborted.getEnglish().equals(map.get(key2))) {
|
|
|
|
+ map.put(key2, StateConstant.Aborted.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.PendingAnalysis.getEnglish().equals(map.get(key2))) {
|
|
|
|
+ map.put(key2, StateConstant.PendingAnalysis.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Running.getEnglish().equals(map.get(key2))) {
|
|
|
|
+ map.put(key2, StateConstant.Running.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Analysing.getEnglish().equals(map.get(key2))) {
|
|
|
|
+ map.put(key2, StateConstant.Analysing.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Completed.getEnglish().equals(map.get(key2))) {
|
|
|
|
+ map.put(key2, StateConstant.Completed.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Terminated.getEnglish().equals(map.get(key2))) {
|
|
|
|
+ map.put(key2, StateConstant.Terminated.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Terminating.getEnglish().equals(map.get(key2))) {
|
|
|
|
+ map.put(key2, StateConstant.Terminating.getChinese());
|
|
|
|
+ }
|
|
|
|
+ if (StateConstant.Pending.getEnglish().equals(map.get(key2))) {
|
|
|
|
+ map.put(key2, StateConstant.Pending.getChinese());
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ // 合并手动终止
|
|
|
|
+ Map<String, Object> newMap = new HashMap<>();
|
|
|
|
+ int numSum = 0;
|
|
|
|
+ final Iterator<Map<String, Object>> iterator = list.iterator();
|
|
|
|
+ while (iterator.hasNext()) {
|
|
|
|
+ final Map<String, Object> map = iterator.next();
|
|
|
|
+ if (StateConstant.Terminated.getChinese().equals(map.get(key2))) {
|
|
|
|
+ numSum += Integer.parseInt(map.get(key1) + "");
|
|
|
|
+ iterator.remove();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ newMap.put(key1, numSum + "");
|
|
|
|
+ newMap.put(key2, StateConstant.Terminated.getChinese());
|
|
|
|
+ list.add(newMap);
|
|
|
|
+ }
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, list);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 项目运行状态统计-饼图
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<List<Map<String, Object>>> selectRunProjectByState() {
|
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
|
+ params.put("createUserId", AuthUtil.getCurrentUserId());
|
|
|
|
+ // 10:未执行,20:执行中,30:执行完成,40:已中止
|
|
|
|
+ List<Map<String, Object>> list = simulationProjectMapper.selectRunProjectByState(params);
|
|
|
|
+ if (list != null && list.size() > 0) {
|
|
|
|
+ for (Map<String, Object> map : list) {
|
|
|
|
+ String nowRunState = map.get("nowRunState").toString();
|
|
|
|
+ map.put("nowRunState", getDictName(DictConstants.PROJECT_RUN_STATE, nowRunState));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
- values.add(subScListVo);
|
|
|
|
- }
|
|
|
|
- List<Map<Object, Object>> headerList = new ArrayList<>();
|
|
|
|
- for (int i = 0; i < maxHeaderNumber - fieldNumber; i++) {
|
|
|
|
- addHeaders(i, headerList);
|
|
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, list);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 评测等级分布-饼图
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<List<Map<String, Object>>> selectEvaluationLevel() {
|
|
|
|
+ String key2 = "evaluationLevel";
|
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
|
+ params.put("createUserId", AuthUtil.getCurrentUserId());
|
|
|
|
+ final List<Map<String, Object>> maps = simulationProjectMapper.selectEvaluationLevel(params);
|
|
|
|
+ final Iterator<Map<String, Object>> iterator = maps.iterator();
|
|
|
|
+ while (iterator.hasNext()) {
|
|
|
|
+ final Map<String, Object> map = iterator.next();
|
|
|
|
+ if (StateConstant.G.getEnglish().equals(map.get(key2))) {
|
|
|
|
+ map.put(key2, StateConstant.G.getChinese());
|
|
|
|
+ } else if (StateConstant.A.getEnglish().equals(map.get(key2))) {
|
|
|
|
+ map.put(key2, StateConstant.A.getChinese());
|
|
|
|
+ } else if (StateConstant.M.getEnglish().equals(map.get(key2))) {
|
|
|
|
+ map.put(key2, StateConstant.M.getChinese());
|
|
|
|
+ } else if (StateConstant.P.getEnglish().equals(map.get(key2))) {
|
|
|
|
+ map.put(key2, StateConstant.P.getChinese());
|
|
|
|
+ } else {
|
|
|
|
+ iterator.remove();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, maps);
|
|
}
|
|
}
|
|
- headerList.add(ImmutableMap.builder().put("label", "场景个数").put("prop", "sceneNum").build());
|
|
|
|
- headerList.add(ImmutableMap.builder().put("label", "仿真异常场景个数").put("prop", "errorSceneNum").build());
|
|
|
|
- headerList.add(ImmutableMap.builder().put("label", "评分失败场景个数").put("prop", "notScoredSceneNum").build());
|
|
|
|
- headerList.add(ImmutableMap.builder().put("label", "未达标场景个数").put("prop", "notStandardSceneNum").build());
|
|
|
|
- headerList.add(ImmutableMap.builder().put("label", "达标场景个数").put("prop", "standardSceneNum").build());
|
|
|
|
- headerList.add(ImmutableMap.builder().put("label", "得分").put("prop", "lastScore").build());
|
|
|
|
- headerList.add(ImmutableMap.builder().put("label", "总分").put("prop", "firstScore").build());
|
|
|
|
- hashMap.put("headerList", headerList);
|
|
|
|
- hashMap.put("result", values);
|
|
|
|
-
|
|
|
|
- return hashMap;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * @param po 末级指标
|
|
|
|
- * @param pos 场景包下所有指标
|
|
|
|
- * @param rootId 场景包id,用于判断是否根指标
|
|
|
|
- */
|
|
|
|
- private void setParent(SublistScoreVo po, List<SublistScoreVo> pos, String rootId) {
|
|
|
|
- for (SublistScoreVo p : pos) {
|
|
|
|
-
|
|
|
|
- if (po.getParentId().equals(p.getId())) {
|
|
|
|
- // 给一级指标添加末级指标得分,给末级指标添加一级指标得分
|
|
|
|
- if (p.getParentId().equals(rootId)) {
|
|
|
|
- p.setLasScore(po.getLasScore());
|
|
|
|
- po.setFirScore(p.getFirScore());
|
|
|
|
- }
|
|
|
|
- po.setSublistName(p.getSublistName() + "," + po.getSublistName());
|
|
|
|
- setParent(p, pos, rootId);
|
|
|
|
- }
|
|
|
|
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * @param po 末级指标
|
|
|
|
- * @param pos 场景包下所有指标
|
|
|
|
- * @param rootId 场景包id,用于判断是否一级指标
|
|
|
|
- */
|
|
|
|
- private void setParent(SublistScoreVo po, SublistScoreVo parentPo, List<SublistScoreVo> pos, String rootId) {
|
|
|
|
- // 第一次查找
|
|
|
|
- if (parentPo == null) {
|
|
|
|
- for (SublistScoreVo p : pos) {
|
|
|
|
-
|
|
|
|
- setSubSc(po, p, po, pos, rootId);
|
|
|
|
- /*
|
|
|
|
- * if(po.getParentId().equals(p.getId())){
|
|
|
|
- * //根指标给一级指标添加末级指标得分,给末级指标添加一级指标得分
|
|
|
|
- * if(p.getParentId().equals(rootId)){
|
|
|
|
- * p.setLasScore(po.getLasScore());
|
|
|
|
- * po.setFirScore(p.getFirScore());
|
|
|
|
- * }
|
|
|
|
- * //末级指标拼接指标名
|
|
|
|
- * po.setSublistName(p.getSublistName()+","+po.getSublistName());
|
|
|
|
- * //查找上级指标,继续拼接
|
|
|
|
- * setParent(po,p, pos, rootId);
|
|
|
|
- *
|
|
|
|
- * }
|
|
|
|
- */
|
|
|
|
- }
|
|
|
|
|
|
+ @Override
|
|
|
|
+ @SneakyThrows
|
|
|
|
+ public void exportProjectReport(SimulationManualProjectParam param) {
|
|
|
|
+ Document document = new Document(PageSize.A4);
|
|
|
|
+ OutputStream os = null;
|
|
|
|
+ try {
|
|
|
|
+ HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
|
|
|
|
|
|
- } else {
|
|
|
|
- for (SublistScoreVo p : pos) {
|
|
|
|
|
|
+ // 获取要生成的数据
|
|
|
|
+ ResponseBodyVO<ProjectReportVo> bodyVO = selectProjectReportById(param);
|
|
|
|
+ ProjectReportVo vo = bodyVO.getInfo();
|
|
|
|
|
|
- setSubSc(parentPo, p, po, pos, rootId);
|
|
|
|
|
|
+ // 下载 or 保存本地
|
|
|
|
+ if (param.getIsCreateLocalPdfFile() != null && param.getIsCreateLocalPdfFile()) {
|
|
|
|
+ File file = new File(param.getLocalPdfFilePath());
|
|
|
|
+ os = new BufferedOutputStream(Files.newOutputStream(file.toPath()));
|
|
|
|
+ } else {
|
|
|
|
+ // String fileName = vo.getProjectId() + "_" + vo.getProjectName();
|
|
|
|
+ String fileName = vo.getAlgorithmName() + "评价报告";
|
|
|
|
+ response.setContentType("application/x-download");
|
|
|
|
+ response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8") + ".pdf");
|
|
|
|
+ os = new BufferedOutputStream(response.getOutputStream());
|
|
|
|
+ }
|
|
|
|
|
|
- /*
|
|
|
|
- * //上级指标
|
|
|
|
- * if(parentPo.getParentId().equals(p.getId())){
|
|
|
|
- * //根指标给一级指标添加末级指标得分,给末级指标添加一级指标得分
|
|
|
|
- * if(p.getParentId().equals(rootId)){
|
|
|
|
- * p.setLasScore(po.getLasScore());
|
|
|
|
- * po.setFirScore(p.getFirScore());
|
|
|
|
- * }
|
|
|
|
- * //末级指标拼接指标名
|
|
|
|
- * po.setSublistName(p.getSublistName()+","+po.getSublistName());
|
|
|
|
- * //查找上级指标,继续拼接
|
|
|
|
- * setParent(po,p, pos, rootId);
|
|
|
|
- * }
|
|
|
|
- */
|
|
|
|
|
|
+ // 监听生成pdf数据
|
|
|
|
+ PdfWriter instance = PdfWriter.getInstance(document, os);
|
|
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ // 设置监听,添加页眉以及设置页面顶部间隔
|
|
|
|
+ PdfBuilder pdfBuilder = new PdfBuilder();
|
|
|
|
+ instance.setPageEvent(pdfBuilder);
|
|
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * @param p1 上级指标
|
|
|
|
- * @param p2 比对指标
|
|
|
|
- * @param p3 末级指标
|
|
|
|
- * @param pos 所有指标
|
|
|
|
- * @param rootId 场景包id
|
|
|
|
- */
|
|
|
|
- private void setSubSc(SublistScoreVo p1, SublistScoreVo p2, SublistScoreVo p3, List<SublistScoreVo> pos, String rootId) {
|
|
|
|
- // 上级指标
|
|
|
|
- if (p1.getParentId().equals(p2.getId())) {
|
|
|
|
- // 根指标给一级指标添加末级指标得分,给末级指标添加一级指标得分
|
|
|
|
- if (p2.getParentId().equals(rootId)) {
|
|
|
|
- p2.setLasScore(p3.getLasScore());
|
|
|
|
- p3.setFirScore(p2.getFirScore());
|
|
|
|
- }
|
|
|
|
- // 末级指标拼接指标名
|
|
|
|
- p3.setSublistName(p2.getSublistName() + ProjectConstants.SEPARATOR + p3.getSublistName());
|
|
|
|
- // 查找上级指标,继续拼接
|
|
|
|
- setParent(p3, p2, pos, rootId);
|
|
|
|
- }
|
|
|
|
|
|
+ // 以下生成PDF
|
|
|
|
+ BaseFont font = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
|
|
|
|
+ document.open();
|
|
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 查询所有指标和得分
|
|
|
|
- *
|
|
|
|
- * @param
|
|
|
|
- *//*
|
|
|
|
- * private void selectScenePackageSubListAndSetScore(String pId, String
|
|
|
|
- * scenePackageId, List<List<String>> resultArr, List<ScenePackageSubListVO>
|
|
|
|
- * single){
|
|
|
|
- *
|
|
|
|
- * //首次,初始化数据以及赋值
|
|
|
|
- * if(isEmpty(single)){
|
|
|
|
- * //单个级联,按最后一级到第一级指标顺序添加
|
|
|
|
- * single= new ArrayList<>();
|
|
|
|
- * //查询所有指标最后一级
|
|
|
|
- * List<ScenePackageSubListVO> vos =
|
|
|
|
- * simulationProjectMapper.selectSubListByPid(scenePackageId);
|
|
|
|
- * for(ScenePackageSubListVO vo : vos){
|
|
|
|
- * selectSceneSubList(vo, pId, single, resultArr);
|
|
|
|
- * }
|
|
|
|
- * }
|
|
|
|
- * //继续添加数据
|
|
|
|
- * else{
|
|
|
|
- * //查询父级节点,只有一个
|
|
|
|
- * ScenePackageSubListVO vo =
|
|
|
|
- * simulationProjectMapper.selectsublistBySublistId(scenePackageId);
|
|
|
|
- * //如果是根节点,不再查询,组装返回数据
|
|
|
|
- * if(vo.getSublistId().equals(scenePackageId)){
|
|
|
|
- * if(isEmpty(resultArr)){
|
|
|
|
- * //初始化返回数据
|
|
|
|
- * resultArr = new ArrayList<>();
|
|
|
|
- * List<String> singleList = new ArrayList<>();
|
|
|
|
- * //反转list,正序添加(从一级开始)
|
|
|
|
- * Collections.reverse(single);
|
|
|
|
- *
|
|
|
|
- * for(int i=0;i<single.size();i--){
|
|
|
|
- * if(i == single.size()-1){
|
|
|
|
- * singleList.add(String.valueOf(single.get(i).getSceneNum()));
|
|
|
|
- * singleList.add(String.valueOf(single.get(i).getNotStandardSceneNum()));
|
|
|
|
- * singleList.add(String.valueOf(single.get(i).getScore()));
|
|
|
|
- *
|
|
|
|
- * singleList.add(String.valueOf(single.get(i).getScore()));
|
|
|
|
- *
|
|
|
|
- * }
|
|
|
|
- * singleList.add(single.get(i).getSublistName());
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- *
|
|
|
|
- *
|
|
|
|
- *
|
|
|
|
- *
|
|
|
|
- *
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * }else{
|
|
|
|
- * selectSceneSubList(vo, pId, single, resultArr);
|
|
|
|
- * }
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * };
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * private void selectSceneSubList(ScenePackageSubListVO vo, String pId,
|
|
|
|
- * List<ScenePackageSubListVO> single, List<List<String>> resultArr){
|
|
|
|
- * //获取未达标个数,得分,总分
|
|
|
|
- * setScore(vo,pId);
|
|
|
|
- * //放入集合
|
|
|
|
- * single.add(vo);
|
|
|
|
- * //递归查询上级指标
|
|
|
|
- * selectScenePackageSubListAndSetScore(pId, vo.getParentId(), resultArr,
|
|
|
|
- * single);
|
|
|
|
- * }
|
|
|
|
- */
|
|
|
|
- private void setScore(ScenePackageSubListVO vo, String pId) {
|
|
|
|
- setLastTargetScore(vo, pId);
|
|
|
|
- setSceneScore(vo, pId);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void setSceneScore(ScenePackageSubListVO vo, String pId) {
|
|
|
|
- String sceneNaturalIds = vo.getSceneNaturalIds();
|
|
|
|
- String sceneTrafficIds = vo.getSceneTrafficIds();
|
|
|
|
- String sceneStatueIds = vo.getSceneStatueIds();
|
|
|
|
- List<SceneScoreVo> sceneScoreVos = new ArrayList<>();
|
|
|
|
- List<SceneScoreVo> NaturalSceneScoreVos = setSceneScore(vo, sceneNaturalIds, DictConstants.SCENE_NATURAL, pId);
|
|
|
|
- List<SceneScoreVo> StatueSceneScoreVos = setSceneScore(vo, sceneStatueIds, DictConstants.SCENE_STANDARD, pId);
|
|
|
|
- List<SceneScoreVo> TrafficSceneScoreVos = setSceneScore(vo, sceneTrafficIds, DictConstants.SCENE_ACCIDENT, pId);
|
|
|
|
- /// TODO 暂不支持泛化场景
|
|
|
|
- List<SceneScoreVo> FhSceneScoreVos = setSceneScore(vo, sceneTrafficIds, DictConstants.SCENE_GENERAL, pId);
|
|
|
|
-
|
|
|
|
- // 合成一个list
|
|
|
|
- if (!isEmpty(NaturalSceneScoreVos)) {
|
|
|
|
- sceneScoreVos.addAll(NaturalSceneScoreVos);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(StatueSceneScoreVos)) {
|
|
|
|
- sceneScoreVos.addAll(StatueSceneScoreVos);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(TrafficSceneScoreVos)) {
|
|
|
|
- sceneScoreVos.addAll(TrafficSceneScoreVos);
|
|
|
|
- }
|
|
|
|
|
|
+ lineFeed(document, 1, 2);
|
|
|
|
+ lineFeed(document, 4, 1);
|
|
|
|
|
|
- if (!isEmpty(FhSceneScoreVos)) {
|
|
|
|
- sceneScoreVos.addAll(FhSceneScoreVos);
|
|
|
|
- }
|
|
|
|
- vo.setSceneScoreList(sceneScoreVos);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void setLastTargetScore(ScenePackageSubListVO vo, String pId) {
|
|
|
|
- SimulationMptLastTargetScorePo poParam = new SimulationMptLastTargetScorePo();
|
|
|
|
- poParam.setPId(pId);
|
|
|
|
- poParam.setTarget(vo.getSublistId());
|
|
|
|
- SimulationMptLastTargetScorePo po = simulationMptLastTargetScoreMapper.selectLastTargetScore(poParam);
|
|
|
|
- if (po != null) {
|
|
|
|
- vo.setNotStandardSceneNum(po.getNotStandardSceneNum());
|
|
|
|
- vo.setScore(po.getScore());
|
|
|
|
- vo.setScoreExplain(po.getScoreExplain());
|
|
|
|
- }
|
|
|
|
|
|
+ // 添加首页
|
|
|
|
+ BaseFont bf = BaseFont.createFont("fonts/simsun.ttc,1", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
|
|
|
|
+ Font f1 = new Font(bf, 48, Font.BOLD);
|
|
|
|
+ Paragraph elm1 = new Paragraph("ICV仿真云平台", f1);
|
|
|
|
+ elm1.setAlignment(Element.ALIGN_CENTER);
|
|
|
|
+ document.add(elm1);
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ lineFeed(document, 1, 1);
|
|
|
|
+ Font f2 = new Font(bf, 72, Font.BOLD);
|
|
|
|
+ Paragraph elm2 = new Paragraph("算法评价报告", f2);
|
|
|
|
+ elm2.setAlignment(Element.ALIGN_CENTER);
|
|
|
|
+ document.add(elm2);
|
|
|
|
|
|
- private void setFirstTargetScore(ScenePackageSubListVO vo, String pId) {
|
|
|
|
- SimulationMptFirstTargetScorePo poParam = new SimulationMptFirstTargetScorePo();
|
|
|
|
- poParam.setPId(pId);
|
|
|
|
- poParam.setTarget(vo.getSublistId());
|
|
|
|
- SimulationMptFirstTargetScorePo po = simulationMptFirstTargetScoreMapper.selectFirstTargetScore(poParam);
|
|
|
|
- if (po != null) {
|
|
|
|
- vo.setScore(po.getScore());
|
|
|
|
- }
|
|
|
|
|
|
+ // 测试时间(开始时间)
|
|
|
|
+ lineFeed(document, 16, 2);
|
|
|
|
+ Font f3 = new Font(bf, 18);
|
|
|
|
+ Paragraph elm3 = new Paragraph(vo.getStartTime(), f3);
|
|
|
|
+ elm3.setAlignment(Element.ALIGN_CENTER);
|
|
|
|
+ document.add(elm3);
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ // 下一页(横板)
|
|
|
|
+ document.setPageSize(PageSize.A4.rotate());
|
|
|
|
+ document.newPage();
|
|
|
|
|
|
- private List<SceneScoreVo> setSceneScore(ScenePackageSubListVO vo, String sceneIds, String sceneType, String pId) {
|
|
|
|
- if (isEmpty(sceneIds)) {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
- String[] sceneIdArr = sceneIds.split(",");
|
|
|
|
- SceneScoreParam sceneScoreParam = new SceneScoreParam();
|
|
|
|
- sceneScoreParam.setPId(pId);
|
|
|
|
- sceneScoreParam.setLastTargerId(vo.getSublistId());
|
|
|
|
- sceneScoreParam.setSceneType(sceneType);
|
|
|
|
- sceneScoreParam.setSceneIds(Arrays.asList(sceneIdArr));
|
|
|
|
- List<SceneScoreVo> sceneScoreVos = simulationProjectTaskMapper.selectSceneScoreByIds(sceneScoreParam);
|
|
|
|
-
|
|
|
|
- for (SceneScoreVo s : sceneScoreVos) {
|
|
|
|
- /*
|
|
|
|
- * if(SceneTypeEnum.SCENE_NATURAL.getCode().equals(sceneType)){
|
|
|
|
- * SceneBaseInfoVo sceneBaseInfoVo =
|
|
|
|
- * simulationProjectMapper.selectSceneNatural(s.getSceneId());
|
|
|
|
- * if(sceneBaseInfoVo != null){
|
|
|
|
- * s.setSceneName(sceneBaseInfoVo.getNaturalName());
|
|
|
|
- * }
|
|
|
|
- * }else if(SceneTypeEnum.SCENE_STANDARD.getCode().equals(sceneType)){
|
|
|
|
- * SceneBaseInfoVo sceneBaseInfoVo =
|
|
|
|
- * simulationProjectMapper.selectSceneStandardsRegulations(s.getSceneId());
|
|
|
|
- * if(sceneBaseInfoVo != null){
|
|
|
|
- * s.setSceneName(sceneBaseInfoVo.getSceneName());
|
|
|
|
- * }
|
|
|
|
- * }else if(SceneTypeEnum.SCENE_ACCIDENT.getCode().equals(sceneType)){
|
|
|
|
- * SceneBaseInfoVo sceneBaseInfoVo =
|
|
|
|
- * simulationProjectMapper.selectSceneAccidentById(s.getSceneId());
|
|
|
|
- * if(sceneBaseInfoVo != null){
|
|
|
|
- * s.setSceneName(sceneBaseInfoVo.getSceneName());
|
|
|
|
- * }
|
|
|
|
- * }else if(SceneTypeEnum.SCENE_GENERAL.getCode().equals(sceneType)){
|
|
|
|
- * ///TODO 泛化场景暂不支持
|
|
|
|
- *
|
|
|
|
- * }
|
|
|
|
- */
|
|
|
|
- s.setSceneType(SceneTypeEnum.getState(sceneType));
|
|
|
|
- }
|
|
|
|
|
|
+ // lineFeed(document, 2, 2);
|
|
|
|
|
|
- return sceneScoreVos;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 获取二级场景下所有得分不为 0 的场景数量
|
|
|
|
- *
|
|
|
|
- * @param sublistId
|
|
|
|
- * @param pId
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- private Integer getSetScoreNum(String sublistId, String pId) {
|
|
|
|
- SceneScoreVo vo = selectScoreNum(null, null, true, pId, sublistId);
|
|
|
|
- return vo.getNum();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 获取一级指标下所有得分不为 0 的场景总数
|
|
|
|
- *
|
|
|
|
- * @param resultVo 返回值,返回统计数量,首次传null
|
|
|
|
- * @param parentVoList 首次传null
|
|
|
|
- * @param isRoot 首次传true
|
|
|
|
- * @param pId 项目表id,用于统计得分使用
|
|
|
|
- * @param sublistId 指标id(用户查询指标下的所有场景)
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- private SceneScoreVo selectScoreNum(SceneScoreVo resultVo, List<ScenePackageSubListVO> parentVoList, boolean isRoot, String pId, String sublistId) {
|
|
|
|
- if (isRoot) {
|
|
|
|
- // 初始化返回值
|
|
|
|
- resultVo = new SceneScoreVo();
|
|
|
|
- resultVo.setNum(0);
|
|
|
|
-
|
|
|
|
- // 查找下一级指标
|
|
|
|
- parentVoList = simulationProjectMapper.selectSubSceneByPid(sublistId);
|
|
|
|
- if (!isEmpty(parentVoList)) {
|
|
|
|
- selectScoreNum(resultVo, parentVoList, false, pId, null);
|
|
|
|
- } else {
|
|
|
|
- // 当前指标为最后一级指标,获取当前指标,统计得分场景数
|
|
|
|
- setScoreNum(sublistId, pId, resultVo);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- // 获取子节点集合
|
|
|
|
- for (ScenePackageSubListVO pvo : parentVoList) {
|
|
|
|
-
|
|
|
|
- List<ScenePackageSubListVO> cvoList = simulationProjectMapper.selectSubSceneByPid(pvo.getSublistId());
|
|
|
|
- if (!isEmpty(cvoList)) {
|
|
|
|
- // 存入父节点集合中
|
|
|
|
- pvo.setChildScenePackageSubListVOList(cvoList);
|
|
|
|
- // 继续查找下一节点
|
|
|
|
- selectScoreNum(resultVo, cvoList, false, pId, null);
|
|
|
|
- } else {
|
|
|
|
- // 没有子节点;获取最后一级的得分场景数量
|
|
|
|
- setScoreNum(pvo.getSublistId(), pId, resultVo);
|
|
|
|
|
|
+ BaseFont bf3 = BaseFont.createFont("fonts/simsun.ttc,1", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
|
|
|
|
+ addElement(document, "算法名称:", vo.getAlgorithmName(), bf3, 15, true, 0, false);
|
|
|
|
+ addElement(document, "算法得分:", vo.getAlgorithmScore().toString(), bf3, 15, true, 30, false);
|
|
|
|
+ addElement(document, "测试等级:", vo.getEvaluationLevel(), bf3, 15, true, 30, false);
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ BaseFont bf4 = BaseFont.createFont("fonts/simhei.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
|
|
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ addElement(document, "1. 算法描述与简评", null, bf4, 16, false, 40, false);
|
|
|
|
+ addElement(document, "1. 1 算法描述:", null, bf3, 15, false, 30, false);
|
|
|
|
+ addElement(document, " " + vo.getAlgorithmDescribe(), null, bf3, 15, false, 30, false);
|
|
|
|
+ addElement(document, "1. 2 算法简评:", null, bf3, 15, false, 30, false);
|
|
|
|
|
|
- return resultVo;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void setScoreNum(String sublistId, String pId, SceneScoreVo resultVo) {
|
|
|
|
- SimulationMptSceneScorePo po = new SimulationMptSceneScorePo();
|
|
|
|
- po.setPId(pId);
|
|
|
|
- po.setLastTargerId(sublistId);
|
|
|
|
- SceneScoreVo sceneScoreVo = simulationProjectTaskMapper.selectSceneScoreNumQuery(po);
|
|
|
|
- resultVo.setNum(resultVo.getNum() + sceneScoreVo.getNum());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 计算评测等级
|
|
|
|
- *
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- private String getEvaluationLevel(SimulationManualProjectPo po) {
|
|
|
|
- /*
|
|
|
|
- * 汇总测试得分(计算评级)计算方法:(每一项一级指标的测试得分*测试权重)累加
|
|
|
|
- */
|
|
|
|
- List<ScenePackageSubListVO> scenePackageSubListVOS = simulationProjectMapper.selectSubSceneByPid(po.getScene());
|
|
|
|
-
|
|
|
|
- String evaluationLevelReport = "";
|
|
|
|
- if (!isEmpty(scenePackageSubListVOS)) {
|
|
|
|
- // 汇总数据初始化
|
|
|
|
- double totalScore = 0.0;
|
|
|
|
- for (ScenePackageSubListVO scenePackageSubListVO : scenePackageSubListVOS) {
|
|
|
|
- double weightDouble = Double.parseDouble(scenePackageSubListVO.getWeight());
|
|
|
|
- SimulationMptFirstTargetScorePo simulationMptFirstTargetScorePo = new SimulationMptFirstTargetScorePo();
|
|
|
|
- simulationMptFirstTargetScorePo.setPId(po.getId());
|
|
|
|
- simulationMptFirstTargetScorePo.setTarget(scenePackageSubListVO.getSublistId());
|
|
|
|
- // 单个二级指标得分
|
|
|
|
- SimulationMptFirstTargetScorePo simulationMptFirstTargetScorePo1 = simulationMptFirstTargetScoreMapper.selectFirstTargetScore(simulationMptFirstTargetScorePo);
|
|
|
|
- if (simulationMptFirstTargetScorePo1 == null) {
|
|
|
|
- return evaluationLevelReport;
|
|
|
|
- }
|
|
|
|
- double score = simulationMptFirstTargetScorePo1.getScore();
|
|
|
|
- totalScore += score * (weightDouble / 100);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- evaluationLevelReport = ProjectUtil.getEvaluationLevelReport(saveTwoDecimalPlaces(totalScore));
|
|
|
|
- return evaluationLevelReport;
|
|
|
|
- }
|
|
|
|
|
|
+ // 此处为了方便直接截取 ”算法简评“ 字段后半段,不再重新获取数据
|
|
|
|
+ String algorithmEvaluation = vo.getAlgorithmEvaluation();
|
|
|
|
+ String s = algorithmEvaluation.substring(algorithmEvaluation.lastIndexOf("级评价,") + 4);
|
|
|
|
+ s = s.replace("(", "");
|
|
|
|
+ s = s.replace(")", "");
|
|
|
|
|
|
- return evaluationLevelReport;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void addHeaders(Integer i, List<Map<Object, Object>> header) {
|
|
|
|
- if (0 == i) {
|
|
|
|
- header.add(ImmutableMap.builder().put("label", "一级指标").put("prop", "sublistName1").build());
|
|
|
|
- } else if (1 == i) {
|
|
|
|
- header.add(ImmutableMap.builder().put("label", "二级指标").put("prop", "sublistName2").build());
|
|
|
|
- } else if (2 == i) {
|
|
|
|
- header.add(ImmutableMap.builder().put("label", "三级指标").put("prop", "sublistName3").build());
|
|
|
|
- } else if (3 == i) {
|
|
|
|
- header.add(ImmutableMap.builder().put("label", "四级指标").put("prop", "sublistName4").build());
|
|
|
|
- } else if (4 == i) {
|
|
|
|
- header.add(ImmutableMap.builder().put("label", "五级指标").put("prop", "sublistName5").build());
|
|
|
|
- } else if (5 == i) {
|
|
|
|
- header.add(ImmutableMap.builder().put("label", "六级指标").put("prop", "sublistName6").build());
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 任务运行状态统计-饼图
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<List<Map<String, Object>>> selectRunTaskByState() {
|
|
|
|
- String key1 = "num";
|
|
|
|
- String key2 = "runState";
|
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
|
- params.put("createUserId", AuthUtil.getCurrentUserId());
|
|
|
|
- List<Map<String, Object>> list = simulationProjectTaskMapper.selectRunTaskByState(params);
|
|
|
|
- // 汉化
|
|
|
|
- if (CollectionUtil.isNotEmpty(list)) {
|
|
|
|
- list.forEach(map -> {
|
|
|
|
- if (StateConstant.Aborted.getEnglish().equals(map.get(key2))) {
|
|
|
|
- map.put(key2, StateConstant.Aborted.getChinese());
|
|
|
|
- }
|
|
|
|
- if (StateConstant.PendingAnalysis.getEnglish().equals(map.get(key2))) {
|
|
|
|
- map.put(key2, StateConstant.PendingAnalysis.getChinese());
|
|
|
|
- }
|
|
|
|
- if (StateConstant.Running.getEnglish().equals(map.get(key2))) {
|
|
|
|
- map.put(key2, StateConstant.Running.getChinese());
|
|
|
|
- }
|
|
|
|
- if (StateConstant.Analysing.getEnglish().equals(map.get(key2))) {
|
|
|
|
- map.put(key2, StateConstant.Analysing.getChinese());
|
|
|
|
- }
|
|
|
|
- if (StateConstant.Completed.getEnglish().equals(map.get(key2))) {
|
|
|
|
- map.put(key2, StateConstant.Completed.getChinese());
|
|
|
|
- }
|
|
|
|
- if (StateConstant.Terminated.getEnglish().equals(map.get(key2))) {
|
|
|
|
- map.put(key2, StateConstant.Terminated.getChinese());
|
|
|
|
- }
|
|
|
|
- if (StateConstant.Terminating.getEnglish().equals(map.get(key2))) {
|
|
|
|
- map.put(key2, StateConstant.Terminating.getChinese());
|
|
|
|
- }
|
|
|
|
- if (StateConstant.Pending.getEnglish().equals(map.get(key2))) {
|
|
|
|
- map.put(key2, StateConstant.Pending.getChinese());
|
|
|
|
- }
|
|
|
|
- });
|
|
|
|
- // 合并手动终止
|
|
|
|
- Map<String, Object> newMap = new HashMap<>();
|
|
|
|
- int numSum = 0;
|
|
|
|
- final Iterator<Map<String, Object>> iterator = list.iterator();
|
|
|
|
- while (iterator.hasNext()) {
|
|
|
|
- final Map<String, Object> map = iterator.next();
|
|
|
|
- if (StateConstant.Terminated.getChinese().equals(map.get(key2))) {
|
|
|
|
- numSum += Integer.parseInt(map.get(key1) + "");
|
|
|
|
- iterator.remove();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- newMap.put(key1, numSum + "");
|
|
|
|
- newMap.put(key2, StateConstant.Terminated.getChinese());
|
|
|
|
- list.add(newMap);
|
|
|
|
- }
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, list);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 项目运行状态统计-饼图
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<List<Map<String, Object>>> selectRunProjectByState() {
|
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
|
- params.put("createUserId", AuthUtil.getCurrentUserId());
|
|
|
|
- // 10:未执行,20:执行中,30:执行完成,40:已中止
|
|
|
|
- List<Map<String, Object>> list = simulationProjectMapper.selectRunProjectByState(params);
|
|
|
|
- if (list != null && list.size() > 0) {
|
|
|
|
- for (Map<String, Object> map : list) {
|
|
|
|
- String nowRunState = map.get("nowRunState").toString();
|
|
|
|
- map.put("nowRunState", getDictName(DictConstants.PROJECT_RUN_STATE, nowRunState));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, list);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 评测等级分布-饼图
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<List<Map<String, Object>>> selectEvaluationLevel() {
|
|
|
|
- String key2 = "evaluationLevel";
|
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
|
- params.put("createUserId", AuthUtil.getCurrentUserId());
|
|
|
|
- final List<Map<String, Object>> maps = simulationProjectMapper.selectEvaluationLevel(params);
|
|
|
|
- final Iterator<Map<String, Object>> iterator = maps.iterator();
|
|
|
|
- while (iterator.hasNext()) {
|
|
|
|
- final Map<String, Object> map = iterator.next();
|
|
|
|
- if (StateConstant.G.getEnglish().equals(map.get(key2))) {
|
|
|
|
- map.put(key2, StateConstant.G.getChinese());
|
|
|
|
- } else if (StateConstant.A.getEnglish().equals(map.get(key2))) {
|
|
|
|
- map.put(key2, StateConstant.A.getChinese());
|
|
|
|
- } else if (StateConstant.M.getEnglish().equals(map.get(key2))) {
|
|
|
|
- map.put(key2, StateConstant.M.getChinese());
|
|
|
|
- } else if (StateConstant.P.getEnglish().equals(map.get(key2))) {
|
|
|
|
- map.put(key2, StateConstant.P.getChinese());
|
|
|
|
- } else {
|
|
|
|
- iterator.remove();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, maps);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- @SneakyThrows
|
|
|
|
- public void exportProjectReport(SimulationManualProjectParam param) {
|
|
|
|
- Document document = new Document(PageSize.A4);
|
|
|
|
- OutputStream os = null;
|
|
|
|
- try {
|
|
|
|
- HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
|
|
|
|
-
|
|
|
|
- // 获取要生成的数据
|
|
|
|
- ResponseBodyVO<ProjectReportVo> bodyVO = selectProjectReportById(param);
|
|
|
|
- ProjectReportVo vo = bodyVO.getInfo();
|
|
|
|
-
|
|
|
|
- // 下载 or 保存本地
|
|
|
|
- if (param.getIsCreateLocalPdfFile() != null && param.getIsCreateLocalPdfFile()) {
|
|
|
|
- File file = new File(param.getLocalPdfFilePath());
|
|
|
|
- os = new BufferedOutputStream(Files.newOutputStream(file.toPath()));
|
|
|
|
- } else {
|
|
|
|
- // String fileName = vo.getProjectId() + "_" + vo.getProjectName();
|
|
|
|
- String fileName = vo.getAlgorithmName() + "评价报告";
|
|
|
|
- response.setContentType("application/x-download");
|
|
|
|
- response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8") + ".pdf");
|
|
|
|
- os = new BufferedOutputStream(response.getOutputStream());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 监听生成pdf数据
|
|
|
|
- PdfWriter instance = PdfWriter.getInstance(document, os);
|
|
|
|
-
|
|
|
|
- // 设置监听,添加页眉以及设置页面顶部间隔
|
|
|
|
- PdfBuilder pdfBuilder = new PdfBuilder();
|
|
|
|
- instance.setPageEvent(pdfBuilder);
|
|
|
|
-
|
|
|
|
- // 以下生成PDF
|
|
|
|
- BaseFont font = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
|
|
|
|
- document.open();
|
|
|
|
-
|
|
|
|
- lineFeed(document, 1, 2);
|
|
|
|
- lineFeed(document, 4, 1);
|
|
|
|
-
|
|
|
|
- // 添加首页
|
|
|
|
- BaseFont bf = BaseFont.createFont("fonts/simsun.ttc,1", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
|
|
|
|
- Font f1 = new Font(bf, 48, Font.BOLD);
|
|
|
|
- Paragraph elm1 = new Paragraph("ICV仿真云平台", f1);
|
|
|
|
- elm1.setAlignment(Element.ALIGN_CENTER);
|
|
|
|
- document.add(elm1);
|
|
|
|
-
|
|
|
|
- lineFeed(document, 1, 1);
|
|
|
|
- Font f2 = new Font(bf, 72, Font.BOLD);
|
|
|
|
- Paragraph elm2 = new Paragraph("算法评价报告", f2);
|
|
|
|
- elm2.setAlignment(Element.ALIGN_CENTER);
|
|
|
|
- document.add(elm2);
|
|
|
|
-
|
|
|
|
- // 测试时间(开始时间)
|
|
|
|
- lineFeed(document, 16, 2);
|
|
|
|
- Font f3 = new Font(bf, 18);
|
|
|
|
- Paragraph elm3 = new Paragraph(vo.getStartTime(), f3);
|
|
|
|
- elm3.setAlignment(Element.ALIGN_CENTER);
|
|
|
|
- document.add(elm3);
|
|
|
|
-
|
|
|
|
- // 下一页(横板)
|
|
|
|
- document.setPageSize(PageSize.A4.rotate());
|
|
|
|
- document.newPage();
|
|
|
|
-
|
|
|
|
- // lineFeed(document, 2, 2);
|
|
|
|
-
|
|
|
|
- BaseFont bf3 = BaseFont.createFont("fonts/simsun.ttc,1", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
|
|
|
|
- addElement(document, "算法名称:", vo.getAlgorithmName(), bf3, 15, true, 0, false);
|
|
|
|
- addElement(document, "算法得分:", vo.getAlgorithmScore().toString(), bf3, 15, true, 30, false);
|
|
|
|
- addElement(document, "测试等级:", vo.getEvaluationLevel(), bf3, 15, true, 30, false);
|
|
|
|
-
|
|
|
|
- BaseFont bf4 = BaseFont.createFont("fonts/simhei.ttf", BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
|
|
|
|
-
|
|
|
|
- addElement(document, "1. 算法描述与简评", null, bf4, 16, false, 40, false);
|
|
|
|
- addElement(document, "1. 1 算法描述:", null, bf3, 15, false, 30, false);
|
|
|
|
- addElement(document, " " + vo.getAlgorithmDescribe(), null, bf3, 15, false, 30, false);
|
|
|
|
- addElement(document, "1. 2 算法简评:", null, bf3, 15, false, 30, false);
|
|
|
|
-
|
|
|
|
- // 此处为了方便直接截取 ”算法简评“ 字段后半段,不再重新获取数据
|
|
|
|
- String algorithmEvaluation = vo.getAlgorithmEvaluation();
|
|
|
|
- String s = algorithmEvaluation.substring(algorithmEvaluation.lastIndexOf("级评价,") + 4);
|
|
|
|
- s = s.replace("(", "");
|
|
|
|
- s = s.replace(")", "");
|
|
|
|
-
|
|
|
|
- addElement(document, " " + vo.getAlgorithmName() + "测试得分为" + vo.getAlgorithmScore() + ",依据图1-1的标准,该算法获得" + vo.getEvaluationLevel() + "级评价," + s, null, bf3, 15, false, 30, false);
|
|
|
|
-
|
|
|
|
- Image image = Image.getInstance("classpath:icon/pjdj_new.png");
|
|
|
|
- image.scaleAbsolute(500, 150);
|
|
|
|
- image.setAlignment(Element.ALIGN_CENTER);
|
|
|
|
- document.add(image);
|
|
|
|
-
|
|
|
|
- addElement(document, "图1-1 评价标准", null, bf3, 15, false, 30, true);
|
|
|
|
-
|
|
|
|
- addElement(document, "2. 测试得分说明", null, bf4, 16, false, 40, false);
|
|
|
|
-
|
|
|
|
- List<AlgorithmScoreVo> algorithmScoreList = vo.getAlgorithmScoreList();
|
|
|
|
-
|
|
|
|
- StringBuilder stringBuilder = new StringBuilder(" " + vo.getAlgorithmName() + "在");
|
|
|
|
- for (AlgorithmScoreVo v : algorithmScoreList) {
|
|
|
|
- if ("汇总".equals(v.getProjectName())) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- stringBuilder.append(v.getProjectName()).append("项目的").append(v.getSceneNum()).append("个场景中,测试得分为").append(v.getScore()).append(",得分率为").append(v.getScoreRatio()).append("%;");
|
|
|
|
- }
|
|
|
|
- String substring = stringBuilder.substring(0, stringBuilder.lastIndexOf(";"));
|
|
|
|
|
|
+ addElement(document, " " + vo.getAlgorithmName() + "测试得分为" + vo.getAlgorithmScore() + ",依据图1-1的标准,该算法获得" + vo.getEvaluationLevel() + "级评价," + s, null, bf3, 15, false, 30, false);
|
|
|
|
|
|
- addElement(document, substring + ",详见表2-1。", null, bf3, 15, false, 30, false);
|
|
|
|
- addElement(document, "表2-1 测试得分表", null, bf3, 15, false, 30, true);
|
|
|
|
|
|
+ Image image = Image.getInstance("classpath:icon/pjdj_new.png");
|
|
|
|
+ image.scaleAbsolute(500, 150);
|
|
|
|
+ image.setAlignment(Element.ALIGN_CENTER);
|
|
|
|
+ document.add(image);
|
|
|
|
|
|
- // 表2-1 测试得分表
|
|
|
|
- setBlankLineSpacing(20, font, document);
|
|
|
|
- PdfPTable pdfPTable = new PdfPTable(5);
|
|
|
|
- pdfPTable.setHeaderRows(1); // 换页每页显示表头
|
|
|
|
- addTitleList(pdfPTable, font, new String[]{"测试项目", "场景数量", "测试权重(%)", "测试得分", "得分率(%)"}, true, 30);
|
|
|
|
|
|
+ addElement(document, "图1-1 评价标准", null, bf3, 15, false, 30, true);
|
|
|
|
|
|
- // 数据
|
|
|
|
- for (AlgorithmScoreVo asv : algorithmScoreList) {
|
|
|
|
- String[] data = new String[]{asv.getProjectName(), String.valueOf(asv.getSceneNum()), asv.getWeight(), String.valueOf(asv.getScore()), String.valueOf(asv.getScoreRatio())};
|
|
|
|
|
|
+ addElement(document, "2. 测试得分说明", null, bf4, 16, false, 40, false);
|
|
|
|
|
|
- addDataList(pdfPTable, font, data, true, 20);
|
|
|
|
- }
|
|
|
|
- document.add(pdfPTable);
|
|
|
|
|
|
+ List<AlgorithmScoreVo> algorithmScoreList = vo.getAlgorithmScoreList();
|
|
|
|
|
|
- addElement(document, "3. 算法测试评分情况", null, bf4, 16, false, 40, false);
|
|
|
|
- addElement(document, " 为排除其他因素的干扰,科学评价算法效果,本报告将测试场景分为仿真异常场景、未参与评分场景、未达标场景和达标场景4类:", null, bf3, 15, false, 30, false);
|
|
|
|
- addElement(document, " 1. 仿真异常场景指的是在仿真过程中报自动终止错误的场景,参与得分权重,测试结果均赋0分;", null, bf3, 15, false, 30, false);
|
|
|
|
- addElement(document, " 2. 评分失败场景是指因为场景与评分规则不匹配导致程序报错无法对仿真结果进行打分的场景,参与得分权重,测试结果均赋0分;", null, bf3, 15, false, 30, false);
|
|
|
|
- addElement(document, " 3. 未达标场景是指仿真测试未得到满分的场景;", null, bf3, 15, false, 30, false);
|
|
|
|
- addElement(document, " 4. 达标场景是指仿真测试得到满分的场景。", null, bf3, 15, false, 30, false);
|
|
|
|
- addElement(document, " 算法在本次场景测试包中的表现见表3-1.", null, bf3, 15, false, 30, false);
|
|
|
|
- addElement(document, "表3-1 算法测试评分细则", null, bf3, 15, false, 30, true);
|
|
|
|
|
|
+ StringBuilder stringBuilder = new StringBuilder(" " + vo.getAlgorithmName() + "在");
|
|
|
|
+ for (AlgorithmScoreVo v : algorithmScoreList) {
|
|
|
|
+ if ("汇总".equals(v.getProjectName())) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ stringBuilder.append(v.getProjectName()).append("项目的").append(v.getSceneNum()).append("个场景中,测试得分为").append(v.getScore()).append(",得分率为").append(v.getScoreRatio()).append("%;");
|
|
|
|
+ }
|
|
|
|
+ String substring = stringBuilder.substring(0, stringBuilder.lastIndexOf(";"));
|
|
|
|
|
|
- // * -------------------------------- 算法评分细则 --------------------------------
|
|
|
|
|
|
+ addElement(document, substring + ",详见表2-1。", null, bf3, 15, false, 30, false);
|
|
|
|
+ addElement(document, "表2-1 测试得分表", null, bf3, 15, false, 30, true);
|
|
|
|
|
|
- setBlankLineSpacing(20, font, document);
|
|
|
|
|
|
+ // 表2-1 测试得分表
|
|
|
|
+ setBlankLineSpacing(20, font, document);
|
|
|
|
+ PdfPTable pdfPTable = new PdfPTable(5);
|
|
|
|
+ pdfPTable.setHeaderRows(1); // 换页每页显示表头
|
|
|
|
+ addTitleList(pdfPTable, font, new String[]{"测试项目", "场景数量", "测试权重(%)", "测试得分", "得分率(%)"}, true, 30);
|
|
|
|
|
|
- List<Map> subListScoreLiTitle = vo.getSubListScoreLiTitle();
|
|
|
|
- int size = subListScoreLiTitle.size();
|
|
|
|
- // 表3-1 算法评分细则
|
|
|
|
- PdfPTable pdfPTable2 = new PdfPTable(size);
|
|
|
|
- pdfPTable2.setHeaderRows(1);
|
|
|
|
- String[] slt = new String[size];
|
|
|
|
- for (int i = 0; i < size; i++) {
|
|
|
|
- slt[i] = subListScoreLiTitle.get(i).get("label").toString();
|
|
|
|
- }
|
|
|
|
- addTitleList(pdfPTable2, font, slt, true, 40);
|
|
|
|
-
|
|
|
|
- List<SubScListVo> subListScoreLi = vo.getSubListScoreLi();
|
|
|
|
-
|
|
|
|
- List<String[]> list = new ArrayList<>();
|
|
|
|
- for (SubScListVo slv : subListScoreLi) {
|
|
|
|
- String[] slsi = new String[size];
|
|
|
|
- for (int i = 0; i < size; i++) {
|
|
|
|
- slsi[i] = "";
|
|
|
|
- }
|
|
|
|
- // 目前最多支持到6级指标
|
|
|
|
- for (int i = 0; i < size - 4; i++) {
|
|
|
|
- if (i == 0) {
|
|
|
|
- if (slv.getSublistName1() != null) {
|
|
|
|
- slsi[i] = slv.getSublistName1();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if (i == 1) {
|
|
|
|
- if (slv.getSublistName2() != null) {
|
|
|
|
- slsi[i] = slv.getSublistName2();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if (i == 2) {
|
|
|
|
- if (slv.getSublistName3() != null) {
|
|
|
|
- slsi[i] = slv.getSublistName3();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if (i == 3) {
|
|
|
|
- if (slv.getSublistName4() != null) {
|
|
|
|
- slsi[i] = slv.getSublistName4();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if (i == 4) {
|
|
|
|
- if (slv.getSublistName5() != null) {
|
|
|
|
- slsi[i] = slv.getSublistName5();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if (i == 5) {
|
|
|
|
- if (slv.getSublistName6() != null) {
|
|
|
|
- slsi[i] = slv.getSublistName6();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- slsi[size - 7] = slv.getSceneNum();
|
|
|
|
- slsi[size - 6] = slv.getErrorSceneNum();
|
|
|
|
- slsi[size - 5] = slv.getNotScoredSceneNum();
|
|
|
|
- slsi[size - 4] = slv.getNotStandardSceneNum();
|
|
|
|
- slsi[size - 3] = slv.getStandardSceneNum();
|
|
|
|
- slsi[size - 2] = slv.getLastScore();
|
|
|
|
- slsi[size - 1] = slv.getFirstScore();
|
|
|
|
-
|
|
|
|
- list.add(slsi);
|
|
|
|
-
|
|
|
|
- // addDataList(pdfPTable2, font, slsi);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Map map = getSubScListCombineCoord(subListScoreLi, size);
|
|
|
|
-
|
|
|
|
- Map<String, Integer> combineCoordList = (Map<String, Integer>) map.get("combineCoordList");
|
|
|
|
- List<String> skipCoordList = (List<String>) map.get("skipCoordList");
|
|
|
|
-
|
|
|
|
- for (int i = 0; i < list.size(); i++) {
|
|
|
|
- String[] strings = list.get(i);
|
|
|
|
- for (int j = 0; j < strings.length; j++) {
|
|
|
|
- String coord = i + "," + j;
|
|
|
|
-
|
|
|
|
- // 是否要跳过
|
|
|
|
- boolean contains = skipCoordList.contains(coord);
|
|
|
|
- if (contains) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- PdfPCell pdfPCell = new PdfPCell(new Paragraph(strings[j], defaultFont(font)));
|
|
|
|
-
|
|
|
|
- // 是否要合并
|
|
|
|
- Integer n = combineCoordList.get(coord);
|
|
|
|
- if (n != null) {
|
|
|
|
- pdfPCell.setRowspan(n);
|
|
|
|
- } else {
|
|
|
|
- pdfPCell.setFixedHeight(20);
|
|
|
|
- }
|
|
|
|
- addCell(pdfPTable2, pdfPCell, true);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- document.add(pdfPTable2);
|
|
|
|
-
|
|
|
|
- // ------- 4.详细得分说明 -------
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * //新的一页,横向显示
|
|
|
|
- * document.setPageSize(PageSize.A4.rotate());
|
|
|
|
- * document.newPage();
|
|
|
|
- */
|
|
|
|
- // lineFeed(document, 2, 2);
|
|
|
|
- List<Map> scoreLiTitle = vo.getSceneScoreLiTitle();
|
|
|
|
- List<SceneScListVo> sceneScoreLi = vo.getSceneScoreLi();
|
|
|
|
- addElement(document, "4. 详细场景得分说明", null, bf4, 16, false, 40, false);
|
|
|
|
- StringBuffer s1 = new StringBuffer(" " + vo.getAlgorithmName());
|
|
|
|
- /*
|
|
|
|
- * boolean b = true;
|
|
|
|
- * for (int i = 0; i < size1; i++) {
|
|
|
|
- * AlgorithmScoreVo v = algorithmScoreList.get(i);
|
|
|
|
- * Double score = v.getScore();
|
|
|
|
- * if (100 > score) {
|
|
|
|
- * b = false;
|
|
|
|
- * break;
|
|
|
|
- * }
|
|
|
|
- * }
|
|
|
|
- */
|
|
|
|
- String substring1 = "";
|
|
|
|
- // StringBuffer stringBuffer2 = new StringBuffer(" ");
|
|
|
|
- // 末级指标
|
|
|
|
- // 先对末级指标进行分组
|
|
|
|
- LinkedHashMap<String, List<SceneScListVo>> map1 = new LinkedHashMap<>();
|
|
|
|
- for (SceneScListVo sc : sceneScoreLi) {
|
|
|
|
- String lastZbName = "";
|
|
|
|
- // 最多支持到6级指标
|
|
|
|
- lastZbName = sc.getSublistName1();
|
|
|
|
- if (StringUtil.isNotEmpty(sc.getSublistName2())) {
|
|
|
|
- lastZbName = sc.getSublistName2();
|
|
|
|
- }
|
|
|
|
- if (StringUtil.isNotEmpty(sc.getSublistName3())) {
|
|
|
|
- lastZbName = sc.getSublistName3();
|
|
|
|
- }
|
|
|
|
- if (StringUtil.isNotEmpty(sc.getSublistName4())) {
|
|
|
|
- lastZbName = sc.getSublistName4();
|
|
|
|
- }
|
|
|
|
- if (StringUtil.isNotEmpty(sc.getSublistName5())) {
|
|
|
|
- lastZbName = sc.getSublistName5();
|
|
|
|
- }
|
|
|
|
- if (StringUtil.isNotEmpty(sc.getSublistName6())) {
|
|
|
|
- lastZbName = sc.getSublistName6();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- List<SceneScListVo> listVos = map1.get(lastZbName);
|
|
|
|
- if (listVos == null) {
|
|
|
|
- listVos = new ArrayList<>();
|
|
|
|
- listVos.add(sc);
|
|
|
|
- map1.put(lastZbName, listVos);
|
|
|
|
- } else {
|
|
|
|
- listVos.add(sc);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- StringBuffer deFenShuoMing = new StringBuffer(" " + vo.getAlgorithmName());
|
|
|
|
- for (String m : map1.keySet()) {
|
|
|
|
- List<SceneScListVo> sceneScListVos = map1.get(m);
|
|
|
|
- int size2 = sceneScListVos.size();
|
|
|
|
- int xy100b = 0;
|
|
|
|
- for (SceneScListVo sc1 : sceneScListVos) {
|
|
|
|
- String sceneScore = sc1.getSceneScore();
|
|
|
|
- BigDecimal score = new BigDecimal("0");
|
|
|
|
- if (sceneScore != null && !"".equals(sceneScore)) {
|
|
|
|
- try {
|
|
|
|
- score = new BigDecimal(sceneScore);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- score = new BigDecimal("0");
|
|
|
|
|
|
+ // 数据
|
|
|
|
+ for (AlgorithmScoreVo asv : algorithmScoreList) {
|
|
|
|
+ String[] data = new String[]{asv.getProjectName(), String.valueOf(asv.getSceneNum()), asv.getWeight(), String.valueOf(asv.getScore()), String.valueOf(asv.getScoreRatio())};
|
|
|
|
+
|
|
|
|
+ addDataList(pdfPTable, font, data, true, 20);
|
|
|
|
+ }
|
|
|
|
+ document.add(pdfPTable);
|
|
|
|
+
|
|
|
|
+ addElement(document, "3. 算法测试评分情况", null, bf4, 16, false, 40, false);
|
|
|
|
+ addElement(document, " 为排除其他因素的干扰,科学评价算法效果,本报告将测试场景分为仿真异常场景、未参与评分场景、未达标场景和达标场景4类:", null, bf3, 15, false, 30, false);
|
|
|
|
+ addElement(document, " 1. 仿真异常场景指的是在仿真过程中报自动终止错误的场景,参与得分权重,测试结果均赋0分;", null, bf3, 15, false, 30, false);
|
|
|
|
+ addElement(document, " 2. 评分失败场景是指因为场景与评分规则不匹配导致程序报错无法对仿真结果进行打分的场景,参与得分权重,测试结果均赋0分;", null, bf3, 15, false, 30, false);
|
|
|
|
+ addElement(document, " 3. 未达标场景是指仿真测试未得到满分的场景;", null, bf3, 15, false, 30, false);
|
|
|
|
+ addElement(document, " 4. 达标场景是指仿真测试得到满分的场景。", null, bf3, 15, false, 30, false);
|
|
|
|
+ addElement(document, " 算法在本次场景测试包中的表现见表3-1.", null, bf3, 15, false, 30, false);
|
|
|
|
+ addElement(document, "表3-1 算法测试评分细则", null, bf3, 15, false, 30, true);
|
|
|
|
+
|
|
|
|
+ // * -------------------------------- 算法评分细则 --------------------------------
|
|
|
|
+
|
|
|
|
+ setBlankLineSpacing(20, font, document);
|
|
|
|
+
|
|
|
|
+ List<Map> subListScoreLiTitle = vo.getSubListScoreLiTitle();
|
|
|
|
+ int size = subListScoreLiTitle.size();
|
|
|
|
+ // 表3-1 算法评分细则
|
|
|
|
+ PdfPTable pdfPTable2 = new PdfPTable(size);
|
|
|
|
+ pdfPTable2.setHeaderRows(1);
|
|
|
|
+ String[] slt = new String[size];
|
|
|
|
+ for (int i = 0; i < size; i++) {
|
|
|
|
+ slt[i] = subListScoreLiTitle.get(i).get("label").toString();
|
|
|
|
+ }
|
|
|
|
+ addTitleList(pdfPTable2, font, slt, true, 40);
|
|
|
|
+
|
|
|
|
+ List<SubScListVo> subListScoreLi = vo.getSubListScoreLi();
|
|
|
|
+
|
|
|
|
+ List<String[]> list = new ArrayList<>();
|
|
|
|
+ for (SubScListVo slv : subListScoreLi) {
|
|
|
|
+ String[] slsi = new String[size];
|
|
|
|
+ for (int i = 0; i < size; i++) {
|
|
|
|
+ slsi[i] = "";
|
|
|
|
+ }
|
|
|
|
+ // 目前最多支持到6级指标
|
|
|
|
+ for (int i = 0; i < size - 4; i++) {
|
|
|
|
+ if (i == 0) {
|
|
|
|
+ if (slv.getSublistName1() != null) {
|
|
|
|
+ slsi[i] = slv.getSublistName1();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (i == 1) {
|
|
|
|
+ if (slv.getSublistName2() != null) {
|
|
|
|
+ slsi[i] = slv.getSublistName2();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (i == 2) {
|
|
|
|
+ if (slv.getSublistName3() != null) {
|
|
|
|
+ slsi[i] = slv.getSublistName3();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (i == 3) {
|
|
|
|
+ if (slv.getSublistName4() != null) {
|
|
|
|
+ slsi[i] = slv.getSublistName4();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (i == 4) {
|
|
|
|
+ if (slv.getSublistName5() != null) {
|
|
|
|
+ slsi[i] = slv.getSublistName5();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (i == 5) {
|
|
|
|
+ if (slv.getSublistName6() != null) {
|
|
|
|
+ slsi[i] = slv.getSublistName6();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ slsi[size - 7] = slv.getSceneNum();
|
|
|
|
+ slsi[size - 6] = slv.getErrorSceneNum();
|
|
|
|
+ slsi[size - 5] = slv.getNotScoredSceneNum();
|
|
|
|
+ slsi[size - 4] = slv.getNotStandardSceneNum();
|
|
|
|
+ slsi[size - 3] = slv.getStandardSceneNum();
|
|
|
|
+ slsi[size - 2] = slv.getLastScore();
|
|
|
|
+ slsi[size - 1] = slv.getFirstScore();
|
|
|
|
+
|
|
|
|
+ list.add(slsi);
|
|
|
|
+
|
|
|
|
+ // addDataList(pdfPTable2, font, slsi);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map map = getSubScListCombineCoord(subListScoreLi, size);
|
|
|
|
+
|
|
|
|
+ Map<String, Integer> combineCoordList = (Map<String, Integer>) map.get("combineCoordList");
|
|
|
|
+ List<String> skipCoordList = (List<String>) map.get("skipCoordList");
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < list.size(); i++) {
|
|
|
|
+ String[] strings = list.get(i);
|
|
|
|
+ for (int j = 0; j < strings.length; j++) {
|
|
|
|
+ String coord = i + "," + j;
|
|
|
|
+
|
|
|
|
+ // 是否要跳过
|
|
|
|
+ boolean contains = skipCoordList.contains(coord);
|
|
|
|
+ if (contains) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ PdfPCell pdfPCell = new PdfPCell(new Paragraph(strings[j], defaultFont(font)));
|
|
|
|
+
|
|
|
|
+ // 是否要合并
|
|
|
|
+ Integer n = combineCoordList.get(coord);
|
|
|
|
+ if (n != null) {
|
|
|
|
+ pdfPCell.setRowspan(n);
|
|
|
|
+ } else {
|
|
|
|
+ pdfPCell.setFixedHeight(20);
|
|
|
|
+ }
|
|
|
|
+ addCell(pdfPTable2, pdfPCell, true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ document.add(pdfPTable2);
|
|
|
|
+
|
|
|
|
+ // ------- 4.详细得分说明 -------
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * //新的一页,横向显示
|
|
|
|
+ * document.setPageSize(PageSize.A4.rotate());
|
|
|
|
+ * document.newPage();
|
|
|
|
+ */
|
|
|
|
+ // lineFeed(document, 2, 2);
|
|
|
|
+ List<Map> scoreLiTitle = vo.getSceneScoreLiTitle();
|
|
|
|
+ List<SceneScListVo> sceneScoreLi = vo.getSceneScoreLi();
|
|
|
|
+ addElement(document, "4. 详细场景得分说明", null, bf4, 16, false, 40, false);
|
|
|
|
+ StringBuffer s1 = new StringBuffer(" " + vo.getAlgorithmName());
|
|
|
|
+ /*
|
|
|
|
+ * boolean b = true;
|
|
|
|
+ * for (int i = 0; i < size1; i++) {
|
|
|
|
+ * AlgorithmScoreVo v = algorithmScoreList.get(i);
|
|
|
|
+ * Double score = v.getScore();
|
|
|
|
+ * if (100 > score) {
|
|
|
|
+ * b = false;
|
|
|
|
+ * break;
|
|
|
|
+ * }
|
|
|
|
+ * }
|
|
|
|
+ */
|
|
|
|
+ String substring1 = "";
|
|
|
|
+ // StringBuffer stringBuffer2 = new StringBuffer(" ");
|
|
|
|
+ // 末级指标
|
|
|
|
+ // 先对末级指标进行分组
|
|
|
|
+ LinkedHashMap<String, List<SceneScListVo>> map1 = new LinkedHashMap<>();
|
|
|
|
+ for (SceneScListVo sc : sceneScoreLi) {
|
|
|
|
+ String lastZbName = "";
|
|
|
|
+ // 最多支持到6级指标
|
|
|
|
+ lastZbName = sc.getSublistName1();
|
|
|
|
+ if (StringUtil.isNotEmpty(sc.getSublistName2())) {
|
|
|
|
+ lastZbName = sc.getSublistName2();
|
|
|
|
+ }
|
|
|
|
+ if (StringUtil.isNotEmpty(sc.getSublistName3())) {
|
|
|
|
+ lastZbName = sc.getSublistName3();
|
|
|
|
+ }
|
|
|
|
+ if (StringUtil.isNotEmpty(sc.getSublistName4())) {
|
|
|
|
+ lastZbName = sc.getSublistName4();
|
|
|
|
+ }
|
|
|
|
+ if (StringUtil.isNotEmpty(sc.getSublistName5())) {
|
|
|
|
+ lastZbName = sc.getSublistName5();
|
|
|
|
+ }
|
|
|
|
+ if (StringUtil.isNotEmpty(sc.getSublistName6())) {
|
|
|
|
+ lastZbName = sc.getSublistName6();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<SceneScListVo> listVos = map1.get(lastZbName);
|
|
|
|
+ if (listVos == null) {
|
|
|
|
+ listVos = new ArrayList<>();
|
|
|
|
+ listVos.add(sc);
|
|
|
|
+ map1.put(lastZbName, listVos);
|
|
|
|
+ } else {
|
|
|
|
+ listVos.add(sc);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ StringBuffer deFenShuoMing = new StringBuffer(" " + vo.getAlgorithmName());
|
|
|
|
+ for (String m : map1.keySet()) {
|
|
|
|
+ List<SceneScListVo> sceneScListVos = map1.get(m);
|
|
|
|
+ int size2 = sceneScListVos.size();
|
|
|
|
+ int xy100b = 0;
|
|
|
|
+ for (SceneScListVo sc1 : sceneScListVos) {
|
|
|
|
+ String sceneScore = sc1.getSceneScore();
|
|
|
|
+ BigDecimal score = new BigDecimal("0");
|
|
|
|
+ if (sceneScore != null && !"".equals(sceneScore)) {
|
|
|
|
+ try {
|
|
|
|
+ score = new BigDecimal(sceneScore);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ score = new BigDecimal("0");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ int r = score.compareTo(new BigDecimal("100"));
|
|
|
|
+ // 小于100
|
|
|
|
+ if (r < 0) {
|
|
|
|
+ xy100b++;
|
|
|
|
+ deFenShuoMing.append("在" + m + "指标中的" + sc1.getSceneId() + "中,测试得分为" + sceneScore + ";");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if (xy100b == 0) {
|
|
|
|
+ deFenShuoMing.append("在" + m + "指标中的" + sceneScListVos.size() + "个场景均表现优秀,测试得分100分。");
|
|
|
|
+ } else {
|
|
|
|
+ int num = size2 - xy100b;
|
|
|
|
+ if (num != 0) {
|
|
|
|
+ deFenShuoMing.append("其他" + num + "个场景表现优秀,测试得分100分。");
|
|
|
|
+ } else {
|
|
|
|
+ deFenShuoMing = new StringBuffer(deFenShuoMing.substring(0, deFenShuoMing.lastIndexOf(";")) + "。");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ substring1 = deFenShuoMing.append("详见表4-1。").toString();
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * if (b) {
|
|
|
|
+ * //得分都为100,取末级指标
|
|
|
|
+ * for (int i = 0; i < size1; i++) {
|
|
|
|
+ * AlgorithmScoreVo v = algorithmScoreList.get(i);
|
|
|
|
+ * if ("汇总".equals(v.getProjectName())) {
|
|
|
|
+ * continue;
|
|
|
|
+ * }
|
|
|
|
+ * stringBuffer2.append(vo.getAlgorithmName() + "在指标中的" + v.getSceneNum() +
|
|
|
|
+ * "个场景均表现良好,测试得分为" + v.getScore() +
|
|
|
|
+ * ";");
|
|
|
|
+ * }
|
|
|
|
+ * substring1 = stringBuffer2.substring(0, stringBuffer2.lastIndexOf(";"));
|
|
|
|
+ * substring1 += "。详见表4-1。";
|
|
|
|
+ *
|
|
|
|
+ * } else {
|
|
|
|
+ * //得分有小于100的,取末级指标
|
|
|
|
+ * for (int i = 0; i < size1; i++) {
|
|
|
|
+ * AlgorithmScoreVo v = algorithmScoreList.get(i);
|
|
|
|
+ * if ("汇总".equals(v.getProjectName())) {
|
|
|
|
+ * continue;
|
|
|
|
+ * }
|
|
|
|
+ * Integer sceneNum = v.getSceneNum();
|
|
|
|
+ * String projectName = v.getProjectName();
|
|
|
|
+ *
|
|
|
|
+ * for (SceneScListVo v1 : sceneScoreLi) {
|
|
|
|
+ * if (projectName.equals(v1.getSublistName1())) {
|
|
|
|
+ * String sceneScore = v1.getSceneScore();
|
|
|
|
+ * BigDecimal score = new BigDecimal("0");
|
|
|
|
+ * if (sceneScore != null && !"".equals(sceneScore)) {
|
|
|
|
+ * try {
|
|
|
|
+ * score = new BigDecimal(sceneScore);
|
|
|
|
+ * } catch (Exception e) {
|
|
|
|
+ * score = new BigDecimal("0");
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * }
|
|
|
|
+ * int r = score.compareTo(new BigDecimal("100"));
|
|
|
|
+ * if (r == -1) {
|
|
|
|
+ * stringBuffer2.append(vo.getAlgorithmName() + "在" + v1.getSublistName1() +
|
|
|
|
+ * "指标中的" + v1.getSceneId() + "中," + "测试得分为" + v1.getSceneScore() + ";");
|
|
|
|
+ * sceneNum--;
|
|
|
|
+ * }
|
|
|
|
+ * }
|
|
|
|
+ * }
|
|
|
|
+ * substring1 = stringBuffer2.substring(0, stringBuffer2.lastIndexOf(";"));
|
|
|
|
+ * if (sceneNum > 0) {
|
|
|
|
+ * substring1 += ",在其他" + sceneNum + "个场景表现良好,测试得分100分";
|
|
|
|
+ * } else {
|
|
|
|
+ * substring1 += "。详见表4-1。";
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ *
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * }
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ addElement(document, substring1, null, bf3, 15, false, 30, false);
|
|
|
|
+ addElement(document, "表4-1 详细得分情况", null, bf3, 15, false, 30, true);
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * 详细得分情况
|
|
|
|
+ */
|
|
|
|
+ /*
|
|
|
|
+ * Paragraph sceneScoreElements = new Paragraph(
|
|
|
|
+ * 50,
|
|
|
|
+ * "详细得分情况",
|
|
|
|
+ * defaultFont(font));
|
|
|
|
+ * sceneScoreElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
|
|
+ * document.add(sceneScoreElements);
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ setBlankLineSpacing(20, font, document);
|
|
|
|
+
|
|
|
|
+ // List<Map> scoreLiTitle = vo.getSceneScoreLiTitle();
|
|
|
|
+ int size2 = scoreLiTitle.size();
|
|
|
|
+ PdfPTable pdfPTable3 = new PdfPTable(size2);
|
|
|
|
+ pdfPTable3.setSplitLate(false);
|
|
|
|
+ pdfPTable3.setHeaderRows(1);
|
|
|
|
+ String[] slt2 = new String[size2];
|
|
|
|
+ for (int i = 0; i < size2; i++) {
|
|
|
|
+ slt2[i] = scoreLiTitle.get(i).get("label").toString();
|
|
|
|
+ }
|
|
|
|
+ addTitleList(pdfPTable3, font, slt2, true, 30);
|
|
|
|
+
|
|
|
|
+ List<String[]> list2 = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ for (SceneScListVo sslv : sceneScoreLi) {
|
|
|
|
+ String[] ssli = new String[size2];
|
|
|
|
+ for (int i = 0; i < size2; i++) {
|
|
|
|
+ ssli[i] = "";
|
|
|
|
+ }
|
|
|
|
+ // 目前最多支持到6级指标
|
|
|
|
+ for (int i = 0; i < size2 - 5; i++) {
|
|
|
|
+ if (i == 0) {
|
|
|
|
+ if (sslv.getSublistName1() != null) {
|
|
|
|
+ ssli[i] = sslv.getSublistName1();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (i == 1) {
|
|
|
|
+ if (sslv.getSublistName2() != null) {
|
|
|
|
+ ssli[i] = sslv.getSublistName2();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (i == 2) {
|
|
|
|
+ if (sslv.getSublistName3() != null) {
|
|
|
|
+ ssli[i] = sslv.getSublistName3();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (i == 3) {
|
|
|
|
+ if (sslv.getSublistName4() != null) {
|
|
|
|
+ ssli[i] = sslv.getSublistName4();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (i == 4) {
|
|
|
|
+ if (sslv.getSublistName5() != null) {
|
|
|
|
+ ssli[i] = sslv.getSublistName5();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (i == 5) {
|
|
|
|
+ if (sslv.getSublistName6() != null) {
|
|
|
|
+ ssli[i] = sslv.getSublistName6();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ ssli[size2 - 5] = sslv.getSceneId();
|
|
|
|
+ ssli[size2 - 4] = sslv.getSceneIdType();
|
|
|
|
+ ssli[size2 - 3] = sslv.getSceneScore();
|
|
|
|
+ ssli[size2 - 2] = sslv.getTargetEvaluate();
|
|
|
|
+ ssli[size2 - 1] = sslv.getScoreExplain();
|
|
|
|
+
|
|
|
|
+ list2.add(ssli);
|
|
|
|
+
|
|
|
|
+ // addDataList(pdfPTable3, font, ssli);
|
|
}
|
|
}
|
|
|
|
|
|
- }
|
|
|
|
- int r = score.compareTo(new BigDecimal("100"));
|
|
|
|
- // 小于100
|
|
|
|
- if (r < 0) {
|
|
|
|
- xy100b++;
|
|
|
|
- deFenShuoMing.append("在" + m + "指标中的" + sc1.getSceneId() + "中,测试得分为" + sceneScore + ";");
|
|
|
|
- }
|
|
|
|
|
|
+ Map map2 = getSceneScListCombineCoord(sceneScoreLi, size2);
|
|
|
|
+
|
|
|
|
+ Map<String, Integer> combineCoordList2 = (Map<String, Integer>) map2.get("combineCoordList");
|
|
|
|
+ List<String> skipCoordList2 = (List<String>) map2.get("skipCoordList");
|
|
|
|
+
|
|
|
|
+ boolean b2 = false;
|
|
|
|
+ int num2 = 0;
|
|
|
|
+ for (int i = 0; i < list2.size(); i++) {
|
|
|
|
+ String[] strings = list2.get(i);
|
|
|
|
+ for (int j = 0; j < strings.length; j++) {
|
|
|
|
+ String coord = i + "," + j;
|
|
|
|
+
|
|
|
|
+ // 是否要跳过
|
|
|
|
+ boolean contains = skipCoordList2.contains(coord);
|
|
|
|
+ if (contains) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ PdfPCell pdfPCell = new PdfPCell(new Paragraph(strings[j], defaultFont(font)));
|
|
|
|
+ // 是否要合并
|
|
|
|
+ Integer n = combineCoordList2.get(coord);
|
|
|
|
+ if (n != null) {
|
|
|
|
+ pdfPCell.setRowspan(n);
|
|
|
|
+ }
|
|
|
|
+ addCell(pdfPTable3, pdfPCell, true);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ document.add(pdfPTable3);
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * //标题
|
|
|
|
+ * Font titleFont = new Font(font, 20); //字体
|
|
|
|
+ * Paragraph titleElements = new Paragraph("评价报告",titleFont);
|
|
|
|
+ * titleElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
|
|
+ * document.add(titleElements);
|
|
|
|
+ *
|
|
|
|
+ *
|
|
|
|
+ * //算法名称、算法得分、测试等级
|
|
|
|
+ * Paragraph algorithmNanmeElements = new Paragraph(
|
|
|
|
+ * 50,
|
|
|
|
+ * " 算法名称:"+vo.getAlgorithmName()
|
|
|
|
+ * +" 算法得分:"+vo.getAlgorithmScore()
|
|
|
|
+ * +" 测试等级:"+vo.getEvaluationLevel(),
|
|
|
|
+ * defaultFont(font));
|
|
|
|
+ * algorithmNanmeElements.setAlignment(Element.ALIGN_LEFT); //靠左
|
|
|
|
+ * document.add(algorithmNanmeElements);
|
|
|
|
+ *
|
|
|
|
+ *
|
|
|
|
+ * //算法描述
|
|
|
|
+ * Paragraph algorithmDescribeFontElements = new Paragraph(
|
|
|
|
+ * 30,
|
|
|
|
+ * " 算法描述:"+vo.getAlgorithmDescribe(),
|
|
|
|
+ * defaultFont(font));
|
|
|
|
+ * algorithmDescribeFontElements.setAlignment(Element.ALIGN_LEFT); //居中
|
|
|
|
+ * document.add(algorithmDescribeFontElements);
|
|
|
|
+ *
|
|
|
|
+ * //算法简评
|
|
|
|
+ * Font algorithmEvaluateFont = new Font(font, 14); //字体
|
|
|
|
+ * Paragraph algorithmEvaluateElements = new Paragraph(
|
|
|
|
+ * 30,
|
|
|
|
+ * " 算法简评:"+vo.getAlgorithmEvaluation(),
|
|
|
|
+ * algorithmEvaluateFont);
|
|
|
|
+ * algorithmEvaluateElements.setAlignment(Element.ALIGN_LEFT); //居中
|
|
|
|
+ * document.add(algorithmEvaluateElements);
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * 测试得分表
|
|
|
|
+ *//*
|
|
|
|
+ * Paragraph scoreTableElements = new Paragraph(
|
|
|
|
+ * 50,
|
|
|
|
+ * "测试得分表",
|
|
|
|
+ * defaultFont(font));
|
|
|
|
+ * scoreTableElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
|
|
+ * document.add(scoreTableElements);
|
|
|
|
+ *
|
|
|
|
+ * setBlankLineSpacing(20,font,document);
|
|
|
|
+ *
|
|
|
|
+ * //表头
|
|
|
|
+ * PdfPTable pdfPTable = new PdfPTable(5);
|
|
|
|
+ * pdfPTable.setHeaderRows(1);//换页每页显示表头
|
|
|
|
+ * addTitleList(pdfPTable, font, new
|
|
|
|
+ * String[]{"测试项目","场景数量","测试权重(%)","测试得分","得分率(%)"});
|
|
|
|
+ *
|
|
|
|
+ * //数据
|
|
|
|
+ * // List<AlgorithmScoreVo> algorithmScoreList = vo.getAlgorithmScoreList();
|
|
|
|
+ * for(AlgorithmScoreVo asv : algorithmScoreList){
|
|
|
|
+ * String[] data = new String[]{
|
|
|
|
+ * asv.getProjectName(), String.valueOf(asv.getSceneNum()), asv.getWeight(),
|
|
|
|
+ * String.valueOf(asv.getScore()), String.valueOf(asv.getScoreRatio())
|
|
|
|
+ * };
|
|
|
|
+ *
|
|
|
|
+ * addDataList(pdfPTable, font, data);
|
|
|
|
+ * }
|
|
|
|
+ * document.add(pdfPTable);
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * 评价等级
|
|
|
|
+ */
|
|
|
|
+ /*
|
|
|
|
+ * Paragraph levelTableElements = new Paragraph(
|
|
|
|
+ * 50,
|
|
|
|
+ * "评价等级",
|
|
|
|
+ * defaultFont(font));
|
|
|
|
+ * levelTableElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
|
|
+ * document.add(levelTableElements);
|
|
|
|
+ *
|
|
|
|
+ * setBlankLineSpacing(20,font,document);
|
|
|
|
+ *
|
|
|
|
+ * PdfPTable pdfPTable1 = new PdfPTable(5);
|
|
|
|
+ * addTitleList(pdfPTable1, font, new
|
|
|
|
+ * String[]{"测试项目","90<总分<100","80<总分<90","70<总分<80","0<总分<70"});
|
|
|
|
+ * addDataList(pdfPTable1, font, new
|
|
|
|
+ * String[]{"评价等级","优秀(G)","良好(A)","一般(M)","较差(P)",
|
|
|
|
+ * "评价等级","++++++","+++++","++++","+++",});
|
|
|
|
+ * document.add(pdfPTable1);
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * //新的一页,横向显示
|
|
|
|
+ * document.setPageSize(PageSize.A4.rotate());
|
|
|
|
+ * document.newPage();
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ // 指标得分列表
|
|
|
|
+ /*
|
|
|
|
+ * Paragraph subListScoreElements = new Paragraph(
|
|
|
|
+ * 50,
|
|
|
|
+ * "算法测试评分细则",
|
|
|
|
+ * defaultFont(font));
|
|
|
|
+ * subListScoreElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
|
|
+ * document.add(subListScoreElements);
|
|
|
|
+ *
|
|
|
|
+ * setBlankLineSpacing(20,font,document);
|
|
|
|
+ *
|
|
|
|
+ * List<Map> subListScoreLiTitle = vo.getSubListScoreLiTitle();
|
|
|
|
+ * int size = subListScoreLiTitle.size();
|
|
|
|
+ * PdfPTable pdfPTable2 = new PdfPTable(size);
|
|
|
|
+ * pdfPTable2.setHeaderRows(1);
|
|
|
|
+ * String[] slt = new String[size];
|
|
|
|
+ * for(int i=0; i<size; i++){
|
|
|
|
+ * slt[i] = subListScoreLiTitle.get(i).get("label").toString();
|
|
|
|
+ * }
|
|
|
|
+ * addTitleList(pdfPTable2, font, slt);
|
|
|
|
+ *
|
|
|
|
+ * List<SubScListVo> subListScoreLi = vo.getSubListScoreLi();
|
|
|
|
+ *
|
|
|
|
+ * List<String[]> list = new ArrayList<>();
|
|
|
|
+ * for(SubScListVo slv : subListScoreLi){
|
|
|
|
+ * String[] slsi = new String[size];
|
|
|
|
+ * for(int i=0;i<size;i++){
|
|
|
|
+ * slsi[i] = "";
|
|
|
|
+ * }
|
|
|
|
+ * //目前最多支持到6级指标
|
|
|
|
+ * for(int i=0; i<size-4; i++){
|
|
|
|
+ * if(i==0){
|
|
|
|
+ * if(slv.getSublistName1() != null){
|
|
|
|
+ * slsi[i] = slv.getSublistName1();
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * }else if(i==1){
|
|
|
|
+ * if(slv.getSublistName2() != null){
|
|
|
|
+ * slsi[i] = slv.getSublistName2();
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * }else if(i==2){
|
|
|
|
+ * if(slv.getSublistName3() != null){
|
|
|
|
+ * slsi[i] = slv.getSublistName3();
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * }else if(i==3){
|
|
|
|
+ * if(slv.getSublistName4() != null){
|
|
|
|
+ * slsi[i] = slv.getSublistName4();
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * }else if(i==4){
|
|
|
|
+ * if(slv.getSublistName5() != null){
|
|
|
|
+ * slsi[i] = slv.getSublistName5();
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * }else if(i==5){
|
|
|
|
+ * if(slv.getSublistName6() != null){
|
|
|
|
+ * slsi[i] = slv.getSublistName6();
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * }
|
|
|
|
+ * }
|
|
|
|
+ * slsi[size-4] = slv.getSceneNum();
|
|
|
|
+ * slsi[size-3] = slv.getNotStandardSceneNum();
|
|
|
|
+ * slsi[size-2] = slv.getLastScore();
|
|
|
|
+ * slsi[size-1] = slv.getFirstScore();
|
|
|
|
+ *
|
|
|
|
+ * list.add(slsi);
|
|
|
|
+ *
|
|
|
|
+ * // addDataList(pdfPTable2, font, slsi);
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ *
|
|
|
|
+ * Map map = getSubScListCombineCoord(subListScoreLi, size);
|
|
|
|
+ *
|
|
|
|
+ * Map<String, Integer> combineCoordList = (Map<String, Integer>)
|
|
|
|
+ * map.get("combineCoordList");
|
|
|
|
+ * List<String> skipCoordList = (List<String>) map.get("skipCoordList");
|
|
|
|
+ *
|
|
|
|
+ * for(int i=0; i<list.size();i++){
|
|
|
|
+ * String[] strings = list.get(i);
|
|
|
|
+ * for(int j=0; j<strings.length; j++){
|
|
|
|
+ * String coord = i+","+j;
|
|
|
|
+ *
|
|
|
|
+ * //是否要跳过
|
|
|
|
+ * boolean contains = skipCoordList.contains(coord);
|
|
|
|
+ * if(contains){
|
|
|
|
+ * continue;
|
|
|
|
+ * }
|
|
|
|
+ * PdfPCell pdfPCell = new PdfPCell(new
|
|
|
|
+ * Paragraph(strings[j],defaultFont(font)));
|
|
|
|
+ *
|
|
|
|
+ * //是否要合并
|
|
|
|
+ * Integer n = combineCoordList.get(coord);
|
|
|
|
+ * if(n != null){
|
|
|
|
+ * pdfPCell.setRowspan(n);
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * pdfPTable2.addCell(pdfPCell);
|
|
|
|
+ *
|
|
|
|
+ *
|
|
|
|
+ * }
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * document.add(pdfPTable2);
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * 场景得分列表
|
|
|
|
+ */
|
|
|
|
+ /*
|
|
|
|
+ * Paragraph sceneScoreElements = new Paragraph(
|
|
|
|
+ * 50,
|
|
|
|
+ * "详细得分情况",
|
|
|
|
+ * defaultFont(font));
|
|
|
|
+ * sceneScoreElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
|
|
+ * document.add(sceneScoreElements);
|
|
|
|
+ *
|
|
|
|
+ * setBlankLineSpacing(20,font,document);
|
|
|
|
+ *
|
|
|
|
+ * List<Map> scoreLiTitle = vo.getSceneScoreLiTitle();
|
|
|
|
+ * int size2 = scoreLiTitle.size();
|
|
|
|
+ * PdfPTable pdfPTable3 = new PdfPTable(size2);
|
|
|
|
+ * pdfPTable3.setHeaderRows(1);
|
|
|
|
+ * String[] slt2 = new String[size2];
|
|
|
|
+ * for(int i=0; i<size2; i++){
|
|
|
|
+ * slt2[i] = scoreLiTitle.get(i).get("label").toString();
|
|
|
|
+ * }
|
|
|
|
+ * addTitleList(pdfPTable3, font, slt2);
|
|
|
|
+ * List<SceneScListVo> sceneScoreLi = vo.getSceneScoreLi();
|
|
|
|
+ *
|
|
|
|
+ * List<String[]> list2 = new ArrayList<>();
|
|
|
|
+ *
|
|
|
|
+ * for(SceneScListVo sslv : sceneScoreLi){
|
|
|
|
+ * String[] ssli = new String[size2];
|
|
|
|
+ * for(int i=0;i<size2;i++){
|
|
|
|
+ * ssli[i] = "";
|
|
|
|
+ * }
|
|
|
|
+ * //目前最多支持到6级指标
|
|
|
|
+ * for(int i=0; i<size2-5; i++){
|
|
|
|
+ * if(i==0){
|
|
|
|
+ * if(sslv.getSublistName1() != null){
|
|
|
|
+ * ssli[i] = sslv.getSublistName1();
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * }else if(i==1){
|
|
|
|
+ * if(sslv.getSublistName2() != null){
|
|
|
|
+ * ssli[i] = sslv.getSublistName2();
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * }else if(i==2){
|
|
|
|
+ * if(sslv.getSublistName3() != null){
|
|
|
|
+ * ssli[i] = sslv.getSublistName3();
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * }else if(i==3){
|
|
|
|
+ * if(sslv.getSublistName4() != null){
|
|
|
|
+ * ssli[i] = sslv.getSublistName4();
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * }else if(i==4){
|
|
|
|
+ * if(sslv.getSublistName5() != null){
|
|
|
|
+ * ssli[i] = sslv.getSublistName5();
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * }else if(i==5){
|
|
|
|
+ * if(sslv.getSublistName6() != null){
|
|
|
|
+ * ssli[i] = sslv.getSublistName6();
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * }
|
|
|
|
+ * }
|
|
|
|
+ * ssli[size2-5] = sslv.getSceneId();
|
|
|
|
+ * ssli[size2-4] = sslv.getSceneIdType();
|
|
|
|
+ * ssli[size2-3] = sslv.getSceneScore();
|
|
|
|
+ * ssli[size2-2] = sslv.getTargetEvaluate();
|
|
|
|
+ * ssli[size2-1] = sslv.getScoreExplain();
|
|
|
|
+ *
|
|
|
|
+ * list2.add(ssli);
|
|
|
|
+ *
|
|
|
|
+ * // addDataList(pdfPTable3, font, ssli);
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * Map map2 = getSceneScListCombineCoord(sceneScoreLi, size2);
|
|
|
|
+ *
|
|
|
|
+ * Map<String, Integer> combineCoordList2 = (Map<String, Integer>)
|
|
|
|
+ * map2.get("combineCoordList");
|
|
|
|
+ * List<String> skipCoordList2 = (List<String>) map2.get("skipCoordList");
|
|
|
|
+ *
|
|
|
|
+ * boolean b2 = false;
|
|
|
|
+ * int num2 = 0;
|
|
|
|
+ * for(int i=0; i<list2.size();i++){
|
|
|
|
+ * String[] strings = list2.get(i);
|
|
|
|
+ * for(int j=0; j<strings.length; j++){
|
|
|
|
+ * String coord = i+","+j;
|
|
|
|
+ *
|
|
|
|
+ * //是否要跳过
|
|
|
|
+ * boolean contains = skipCoordList2.contains(coord);
|
|
|
|
+ * if(contains){
|
|
|
|
+ * continue;
|
|
|
|
+ * }
|
|
|
|
+ * PdfPCell pdfPCell = new PdfPCell(new
|
|
|
|
+ * Paragraph(strings[j],defaultFont(font)));
|
|
|
|
+ * //是否要合并
|
|
|
|
+ * Integer n = combineCoordList2.get(coord);
|
|
|
|
+ * if(n != null){
|
|
|
|
+ * pdfPCell.setRowspan(n);
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * pdfPTable3.addCell(pdfPCell);
|
|
|
|
+ *
|
|
|
|
+ *
|
|
|
|
+ * }
|
|
|
|
+ * }
|
|
|
|
+ *
|
|
|
|
+ * document.add(pdfPTable3);
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+
|
|
|
|
+ } finally {
|
|
|
|
+ document.close();
|
|
|
|
+ try {
|
|
|
|
+ os.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (xy100b == 0) {
|
|
|
|
- deFenShuoMing.append("在" + m + "指标中的" + sceneScListVos.size() + "个场景均表现优秀,测试得分100分。");
|
|
|
|
- } else {
|
|
|
|
- int num = size2 - xy100b;
|
|
|
|
- if (num != 0) {
|
|
|
|
- deFenShuoMing.append("其他" + num + "个场景表现优秀,测试得分100分。");
|
|
|
|
- } else {
|
|
|
|
- deFenShuoMing = new StringBuffer(deFenShuoMing.substring(0, deFenShuoMing.lastIndexOf(";")) + "。");
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- substring1 = deFenShuoMing.append("详见表4-1。").toString();
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * if (b) {
|
|
|
|
- * //得分都为100,取末级指标
|
|
|
|
- * for (int i = 0; i < size1; i++) {
|
|
|
|
- * AlgorithmScoreVo v = algorithmScoreList.get(i);
|
|
|
|
- * if ("汇总".equals(v.getProjectName())) {
|
|
|
|
- * continue;
|
|
|
|
- * }
|
|
|
|
- * stringBuffer2.append(vo.getAlgorithmName() + "在指标中的" + v.getSceneNum() +
|
|
|
|
- * "个场景均表现良好,测试得分为" + v.getScore() +
|
|
|
|
- * ";");
|
|
|
|
- * }
|
|
|
|
- * substring1 = stringBuffer2.substring(0, stringBuffer2.lastIndexOf(";"));
|
|
|
|
- * substring1 += "。详见表4-1。";
|
|
|
|
- *
|
|
|
|
- * } else {
|
|
|
|
- * //得分有小于100的,取末级指标
|
|
|
|
- * for (int i = 0; i < size1; i++) {
|
|
|
|
- * AlgorithmScoreVo v = algorithmScoreList.get(i);
|
|
|
|
- * if ("汇总".equals(v.getProjectName())) {
|
|
|
|
- * continue;
|
|
|
|
- * }
|
|
|
|
- * Integer sceneNum = v.getSceneNum();
|
|
|
|
- * String projectName = v.getProjectName();
|
|
|
|
- *
|
|
|
|
- * for (SceneScListVo v1 : sceneScoreLi) {
|
|
|
|
- * if (projectName.equals(v1.getSublistName1())) {
|
|
|
|
- * String sceneScore = v1.getSceneScore();
|
|
|
|
- * BigDecimal score = new BigDecimal("0");
|
|
|
|
- * if (sceneScore != null && !"".equals(sceneScore)) {
|
|
|
|
- * try {
|
|
|
|
- * score = new BigDecimal(sceneScore);
|
|
|
|
- * } catch (Exception e) {
|
|
|
|
- * score = new BigDecimal("0");
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * }
|
|
|
|
- * int r = score.compareTo(new BigDecimal("100"));
|
|
|
|
- * if (r == -1) {
|
|
|
|
- * stringBuffer2.append(vo.getAlgorithmName() + "在" + v1.getSublistName1() +
|
|
|
|
- * "指标中的" + v1.getSceneId() + "中," + "测试得分为" + v1.getSceneScore() + ";");
|
|
|
|
- * sceneNum--;
|
|
|
|
- * }
|
|
|
|
- * }
|
|
|
|
- * }
|
|
|
|
- * substring1 = stringBuffer2.substring(0, stringBuffer2.lastIndexOf(";"));
|
|
|
|
- * if (sceneNum > 0) {
|
|
|
|
- * substring1 += ",在其他" + sceneNum + "个场景表现良好,测试得分100分";
|
|
|
|
- * } else {
|
|
|
|
- * substring1 += "。详见表4-1。";
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- *
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * }
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- addElement(document, substring1, null, bf3, 15, false, 30, false);
|
|
|
|
- addElement(document, "表4-1 详细得分情况", null, bf3, 15, false, 30, true);
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * 详细得分情况
|
|
|
|
- */
|
|
|
|
- /*
|
|
|
|
- * Paragraph sceneScoreElements = new Paragraph(
|
|
|
|
- * 50,
|
|
|
|
- * "详细得分情况",
|
|
|
|
- * defaultFont(font));
|
|
|
|
- * sceneScoreElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
|
|
- * document.add(sceneScoreElements);
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- setBlankLineSpacing(20, font, document);
|
|
|
|
-
|
|
|
|
- // List<Map> scoreLiTitle = vo.getSceneScoreLiTitle();
|
|
|
|
- int size2 = scoreLiTitle.size();
|
|
|
|
- PdfPTable pdfPTable3 = new PdfPTable(size2);
|
|
|
|
- pdfPTable3.setSplitLate(false);
|
|
|
|
- pdfPTable3.setHeaderRows(1);
|
|
|
|
- String[] slt2 = new String[size2];
|
|
|
|
- for (int i = 0; i < size2; i++) {
|
|
|
|
- slt2[i] = scoreLiTitle.get(i).get("label").toString();
|
|
|
|
- }
|
|
|
|
- addTitleList(pdfPTable3, font, slt2, true, 30);
|
|
|
|
-
|
|
|
|
- List<String[]> list2 = new ArrayList<>();
|
|
|
|
-
|
|
|
|
- for (SceneScListVo sslv : sceneScoreLi) {
|
|
|
|
- String[] ssli = new String[size2];
|
|
|
|
- for (int i = 0; i < size2; i++) {
|
|
|
|
- ssli[i] = "";
|
|
|
|
- }
|
|
|
|
- // 目前最多支持到6级指标
|
|
|
|
- for (int i = 0; i < size2 - 5; i++) {
|
|
|
|
- if (i == 0) {
|
|
|
|
- if (sslv.getSublistName1() != null) {
|
|
|
|
- ssli[i] = sslv.getSublistName1();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if (i == 1) {
|
|
|
|
- if (sslv.getSublistName2() != null) {
|
|
|
|
- ssli[i] = sslv.getSublistName2();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if (i == 2) {
|
|
|
|
- if (sslv.getSublistName3() != null) {
|
|
|
|
- ssli[i] = sslv.getSublistName3();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if (i == 3) {
|
|
|
|
- if (sslv.getSublistName4() != null) {
|
|
|
|
- ssli[i] = sslv.getSublistName4();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if (i == 4) {
|
|
|
|
- if (sslv.getSublistName5() != null) {
|
|
|
|
- ssli[i] = sslv.getSublistName5();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if (i == 5) {
|
|
|
|
- if (sslv.getSublistName6() != null) {
|
|
|
|
- ssli[i] = sslv.getSublistName6();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- ssli[size2 - 5] = sslv.getSceneId();
|
|
|
|
- ssli[size2 - 4] = sslv.getSceneIdType();
|
|
|
|
- ssli[size2 - 3] = sslv.getSceneScore();
|
|
|
|
- ssli[size2 - 2] = sslv.getTargetEvaluate();
|
|
|
|
- ssli[size2 - 1] = sslv.getScoreExplain();
|
|
|
|
-
|
|
|
|
- list2.add(ssli);
|
|
|
|
-
|
|
|
|
- // addDataList(pdfPTable3, font, ssli);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Map map2 = getSceneScListCombineCoord(sceneScoreLi, size2);
|
|
|
|
-
|
|
|
|
- Map<String, Integer> combineCoordList2 = (Map<String, Integer>) map2.get("combineCoordList");
|
|
|
|
- List<String> skipCoordList2 = (List<String>) map2.get("skipCoordList");
|
|
|
|
-
|
|
|
|
- boolean b2 = false;
|
|
|
|
- int num2 = 0;
|
|
|
|
- for (int i = 0; i < list2.size(); i++) {
|
|
|
|
- String[] strings = list2.get(i);
|
|
|
|
- for (int j = 0; j < strings.length; j++) {
|
|
|
|
- String coord = i + "," + j;
|
|
|
|
-
|
|
|
|
- // 是否要跳过
|
|
|
|
- boolean contains = skipCoordList2.contains(coord);
|
|
|
|
- if (contains) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- PdfPCell pdfPCell = new PdfPCell(new Paragraph(strings[j], defaultFont(font)));
|
|
|
|
- // 是否要合并
|
|
|
|
- Integer n = combineCoordList2.get(coord);
|
|
|
|
- if (n != null) {
|
|
|
|
- pdfPCell.setRowspan(n);
|
|
|
|
- }
|
|
|
|
- addCell(pdfPTable3, pdfPCell, true);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- document.add(pdfPTable3);
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * //标题
|
|
|
|
- * Font titleFont = new Font(font, 20); //字体
|
|
|
|
- * Paragraph titleElements = new Paragraph("评价报告",titleFont);
|
|
|
|
- * titleElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
|
|
- * document.add(titleElements);
|
|
|
|
- *
|
|
|
|
- *
|
|
|
|
- * //算法名称、算法得分、测试等级
|
|
|
|
- * Paragraph algorithmNanmeElements = new Paragraph(
|
|
|
|
- * 50,
|
|
|
|
- * " 算法名称:"+vo.getAlgorithmName()
|
|
|
|
- * +" 算法得分:"+vo.getAlgorithmScore()
|
|
|
|
- * +" 测试等级:"+vo.getEvaluationLevel(),
|
|
|
|
- * defaultFont(font));
|
|
|
|
- * algorithmNanmeElements.setAlignment(Element.ALIGN_LEFT); //靠左
|
|
|
|
- * document.add(algorithmNanmeElements);
|
|
|
|
- *
|
|
|
|
- *
|
|
|
|
- * //算法描述
|
|
|
|
- * Paragraph algorithmDescribeFontElements = new Paragraph(
|
|
|
|
- * 30,
|
|
|
|
- * " 算法描述:"+vo.getAlgorithmDescribe(),
|
|
|
|
- * defaultFont(font));
|
|
|
|
- * algorithmDescribeFontElements.setAlignment(Element.ALIGN_LEFT); //居中
|
|
|
|
- * document.add(algorithmDescribeFontElements);
|
|
|
|
- *
|
|
|
|
- * //算法简评
|
|
|
|
- * Font algorithmEvaluateFont = new Font(font, 14); //字体
|
|
|
|
- * Paragraph algorithmEvaluateElements = new Paragraph(
|
|
|
|
- * 30,
|
|
|
|
- * " 算法简评:"+vo.getAlgorithmEvaluation(),
|
|
|
|
- * algorithmEvaluateFont);
|
|
|
|
- * algorithmEvaluateElements.setAlignment(Element.ALIGN_LEFT); //居中
|
|
|
|
- * document.add(algorithmEvaluateElements);
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * 测试得分表
|
|
|
|
- *//*
|
|
|
|
- * Paragraph scoreTableElements = new Paragraph(
|
|
|
|
- * 50,
|
|
|
|
- * "测试得分表",
|
|
|
|
- * defaultFont(font));
|
|
|
|
- * scoreTableElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
|
|
- * document.add(scoreTableElements);
|
|
|
|
- *
|
|
|
|
- * setBlankLineSpacing(20,font,document);
|
|
|
|
- *
|
|
|
|
- * //表头
|
|
|
|
- * PdfPTable pdfPTable = new PdfPTable(5);
|
|
|
|
- * pdfPTable.setHeaderRows(1);//换页每页显示表头
|
|
|
|
- * addTitleList(pdfPTable, font, new
|
|
|
|
- * String[]{"测试项目","场景数量","测试权重(%)","测试得分","得分率(%)"});
|
|
|
|
- *
|
|
|
|
- * //数据
|
|
|
|
- * // List<AlgorithmScoreVo> algorithmScoreList = vo.getAlgorithmScoreList();
|
|
|
|
- * for(AlgorithmScoreVo asv : algorithmScoreList){
|
|
|
|
- * String[] data = new String[]{
|
|
|
|
- * asv.getProjectName(), String.valueOf(asv.getSceneNum()), asv.getWeight(),
|
|
|
|
- * String.valueOf(asv.getScore()), String.valueOf(asv.getScoreRatio())
|
|
|
|
- * };
|
|
|
|
- *
|
|
|
|
- * addDataList(pdfPTable, font, data);
|
|
|
|
- * }
|
|
|
|
- * document.add(pdfPTable);
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * 评价等级
|
|
|
|
- */
|
|
|
|
- /*
|
|
|
|
- * Paragraph levelTableElements = new Paragraph(
|
|
|
|
- * 50,
|
|
|
|
- * "评价等级",
|
|
|
|
- * defaultFont(font));
|
|
|
|
- * levelTableElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
|
|
- * document.add(levelTableElements);
|
|
|
|
- *
|
|
|
|
- * setBlankLineSpacing(20,font,document);
|
|
|
|
- *
|
|
|
|
- * PdfPTable pdfPTable1 = new PdfPTable(5);
|
|
|
|
- * addTitleList(pdfPTable1, font, new
|
|
|
|
- * String[]{"测试项目","90<总分<100","80<总分<90","70<总分<80","0<总分<70"});
|
|
|
|
- * addDataList(pdfPTable1, font, new
|
|
|
|
- * String[]{"评价等级","优秀(G)","良好(A)","一般(M)","较差(P)",
|
|
|
|
- * "评价等级","++++++","+++++","++++","+++",});
|
|
|
|
- * document.add(pdfPTable1);
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * //新的一页,横向显示
|
|
|
|
- * document.setPageSize(PageSize.A4.rotate());
|
|
|
|
- * document.newPage();
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- // 指标得分列表
|
|
|
|
- /*
|
|
|
|
- * Paragraph subListScoreElements = new Paragraph(
|
|
|
|
- * 50,
|
|
|
|
- * "算法测试评分细则",
|
|
|
|
- * defaultFont(font));
|
|
|
|
- * subListScoreElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
|
|
- * document.add(subListScoreElements);
|
|
|
|
- *
|
|
|
|
- * setBlankLineSpacing(20,font,document);
|
|
|
|
- *
|
|
|
|
- * List<Map> subListScoreLiTitle = vo.getSubListScoreLiTitle();
|
|
|
|
- * int size = subListScoreLiTitle.size();
|
|
|
|
- * PdfPTable pdfPTable2 = new PdfPTable(size);
|
|
|
|
- * pdfPTable2.setHeaderRows(1);
|
|
|
|
- * String[] slt = new String[size];
|
|
|
|
- * for(int i=0; i<size; i++){
|
|
|
|
- * slt[i] = subListScoreLiTitle.get(i).get("label").toString();
|
|
|
|
- * }
|
|
|
|
- * addTitleList(pdfPTable2, font, slt);
|
|
|
|
- *
|
|
|
|
- * List<SubScListVo> subListScoreLi = vo.getSubListScoreLi();
|
|
|
|
- *
|
|
|
|
- * List<String[]> list = new ArrayList<>();
|
|
|
|
- * for(SubScListVo slv : subListScoreLi){
|
|
|
|
- * String[] slsi = new String[size];
|
|
|
|
- * for(int i=0;i<size;i++){
|
|
|
|
- * slsi[i] = "";
|
|
|
|
- * }
|
|
|
|
- * //目前最多支持到6级指标
|
|
|
|
- * for(int i=0; i<size-4; i++){
|
|
|
|
- * if(i==0){
|
|
|
|
- * if(slv.getSublistName1() != null){
|
|
|
|
- * slsi[i] = slv.getSublistName1();
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * }else if(i==1){
|
|
|
|
- * if(slv.getSublistName2() != null){
|
|
|
|
- * slsi[i] = slv.getSublistName2();
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * }else if(i==2){
|
|
|
|
- * if(slv.getSublistName3() != null){
|
|
|
|
- * slsi[i] = slv.getSublistName3();
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * }else if(i==3){
|
|
|
|
- * if(slv.getSublistName4() != null){
|
|
|
|
- * slsi[i] = slv.getSublistName4();
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * }else if(i==4){
|
|
|
|
- * if(slv.getSublistName5() != null){
|
|
|
|
- * slsi[i] = slv.getSublistName5();
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * }else if(i==5){
|
|
|
|
- * if(slv.getSublistName6() != null){
|
|
|
|
- * slsi[i] = slv.getSublistName6();
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * }
|
|
|
|
- * }
|
|
|
|
- * slsi[size-4] = slv.getSceneNum();
|
|
|
|
- * slsi[size-3] = slv.getNotStandardSceneNum();
|
|
|
|
- * slsi[size-2] = slv.getLastScore();
|
|
|
|
- * slsi[size-1] = slv.getFirstScore();
|
|
|
|
- *
|
|
|
|
- * list.add(slsi);
|
|
|
|
- *
|
|
|
|
- * // addDataList(pdfPTable2, font, slsi);
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- *
|
|
|
|
- * Map map = getSubScListCombineCoord(subListScoreLi, size);
|
|
|
|
- *
|
|
|
|
- * Map<String, Integer> combineCoordList = (Map<String, Integer>)
|
|
|
|
- * map.get("combineCoordList");
|
|
|
|
- * List<String> skipCoordList = (List<String>) map.get("skipCoordList");
|
|
|
|
- *
|
|
|
|
- * for(int i=0; i<list.size();i++){
|
|
|
|
- * String[] strings = list.get(i);
|
|
|
|
- * for(int j=0; j<strings.length; j++){
|
|
|
|
- * String coord = i+","+j;
|
|
|
|
- *
|
|
|
|
- * //是否要跳过
|
|
|
|
- * boolean contains = skipCoordList.contains(coord);
|
|
|
|
- * if(contains){
|
|
|
|
- * continue;
|
|
|
|
- * }
|
|
|
|
- * PdfPCell pdfPCell = new PdfPCell(new
|
|
|
|
- * Paragraph(strings[j],defaultFont(font)));
|
|
|
|
- *
|
|
|
|
- * //是否要合并
|
|
|
|
- * Integer n = combineCoordList.get(coord);
|
|
|
|
- * if(n != null){
|
|
|
|
- * pdfPCell.setRowspan(n);
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * pdfPTable2.addCell(pdfPCell);
|
|
|
|
- *
|
|
|
|
- *
|
|
|
|
- * }
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * document.add(pdfPTable2);
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * 场景得分列表
|
|
|
|
- */
|
|
|
|
- /*
|
|
|
|
- * Paragraph sceneScoreElements = new Paragraph(
|
|
|
|
- * 50,
|
|
|
|
- * "详细得分情况",
|
|
|
|
- * defaultFont(font));
|
|
|
|
- * sceneScoreElements.setAlignment(Element.ALIGN_CENTER); //居中
|
|
|
|
- * document.add(sceneScoreElements);
|
|
|
|
- *
|
|
|
|
- * setBlankLineSpacing(20,font,document);
|
|
|
|
- *
|
|
|
|
- * List<Map> scoreLiTitle = vo.getSceneScoreLiTitle();
|
|
|
|
- * int size2 = scoreLiTitle.size();
|
|
|
|
- * PdfPTable pdfPTable3 = new PdfPTable(size2);
|
|
|
|
- * pdfPTable3.setHeaderRows(1);
|
|
|
|
- * String[] slt2 = new String[size2];
|
|
|
|
- * for(int i=0; i<size2; i++){
|
|
|
|
- * slt2[i] = scoreLiTitle.get(i).get("label").toString();
|
|
|
|
- * }
|
|
|
|
- * addTitleList(pdfPTable3, font, slt2);
|
|
|
|
- * List<SceneScListVo> sceneScoreLi = vo.getSceneScoreLi();
|
|
|
|
- *
|
|
|
|
- * List<String[]> list2 = new ArrayList<>();
|
|
|
|
- *
|
|
|
|
- * for(SceneScListVo sslv : sceneScoreLi){
|
|
|
|
- * String[] ssli = new String[size2];
|
|
|
|
- * for(int i=0;i<size2;i++){
|
|
|
|
- * ssli[i] = "";
|
|
|
|
- * }
|
|
|
|
- * //目前最多支持到6级指标
|
|
|
|
- * for(int i=0; i<size2-5; i++){
|
|
|
|
- * if(i==0){
|
|
|
|
- * if(sslv.getSublistName1() != null){
|
|
|
|
- * ssli[i] = sslv.getSublistName1();
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * }else if(i==1){
|
|
|
|
- * if(sslv.getSublistName2() != null){
|
|
|
|
- * ssli[i] = sslv.getSublistName2();
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * }else if(i==2){
|
|
|
|
- * if(sslv.getSublistName3() != null){
|
|
|
|
- * ssli[i] = sslv.getSublistName3();
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * }else if(i==3){
|
|
|
|
- * if(sslv.getSublistName4() != null){
|
|
|
|
- * ssli[i] = sslv.getSublistName4();
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * }else if(i==4){
|
|
|
|
- * if(sslv.getSublistName5() != null){
|
|
|
|
- * ssli[i] = sslv.getSublistName5();
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * }else if(i==5){
|
|
|
|
- * if(sslv.getSublistName6() != null){
|
|
|
|
- * ssli[i] = sslv.getSublistName6();
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * }
|
|
|
|
- * }
|
|
|
|
- * ssli[size2-5] = sslv.getSceneId();
|
|
|
|
- * ssli[size2-4] = sslv.getSceneIdType();
|
|
|
|
- * ssli[size2-3] = sslv.getSceneScore();
|
|
|
|
- * ssli[size2-2] = sslv.getTargetEvaluate();
|
|
|
|
- * ssli[size2-1] = sslv.getScoreExplain();
|
|
|
|
- *
|
|
|
|
- * list2.add(ssli);
|
|
|
|
- *
|
|
|
|
- * // addDataList(pdfPTable3, font, ssli);
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * Map map2 = getSceneScListCombineCoord(sceneScoreLi, size2);
|
|
|
|
- *
|
|
|
|
- * Map<String, Integer> combineCoordList2 = (Map<String, Integer>)
|
|
|
|
- * map2.get("combineCoordList");
|
|
|
|
- * List<String> skipCoordList2 = (List<String>) map2.get("skipCoordList");
|
|
|
|
- *
|
|
|
|
- * boolean b2 = false;
|
|
|
|
- * int num2 = 0;
|
|
|
|
- * for(int i=0; i<list2.size();i++){
|
|
|
|
- * String[] strings = list2.get(i);
|
|
|
|
- * for(int j=0; j<strings.length; j++){
|
|
|
|
- * String coord = i+","+j;
|
|
|
|
- *
|
|
|
|
- * //是否要跳过
|
|
|
|
- * boolean contains = skipCoordList2.contains(coord);
|
|
|
|
- * if(contains){
|
|
|
|
- * continue;
|
|
|
|
- * }
|
|
|
|
- * PdfPCell pdfPCell = new PdfPCell(new
|
|
|
|
- * Paragraph(strings[j],defaultFont(font)));
|
|
|
|
- * //是否要合并
|
|
|
|
- * Integer n = combineCoordList2.get(coord);
|
|
|
|
- * if(n != null){
|
|
|
|
- * pdfPCell.setRowspan(n);
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * pdfPTable3.addCell(pdfPCell);
|
|
|
|
- *
|
|
|
|
- *
|
|
|
|
- * }
|
|
|
|
- * }
|
|
|
|
- *
|
|
|
|
- * document.add(pdfPTable3);
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
-
|
|
|
|
- } finally {
|
|
|
|
- document.close();
|
|
|
|
- try {
|
|
|
|
- os.close();
|
|
|
|
- } catch (IOException e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- public void lineFeed(Document document, int length, int type) throws DocumentException {
|
|
|
|
- if (type == 1) {
|
|
|
|
- for (int i = 0; i < length; i++) {
|
|
|
|
- document.add(Chunk.NEWLINE);
|
|
|
|
- }
|
|
|
|
- } else if (type == 2) {
|
|
|
|
- for (int i = 0; i < length; i++) {
|
|
|
|
- document.add(new Phrase("\n"));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void addElement(Document document, String val1, String val2, BaseFont f, int fontSize, boolean isBold, int leading, boolean isCenter) throws DocumentException {
|
|
|
|
- Font ft;
|
|
|
|
- Paragraph elm;
|
|
|
|
- if (isBold) {
|
|
|
|
- ft = new Font(f, fontSize, Font.BOLD);
|
|
|
|
- } else {
|
|
|
|
- ft = new Font(f, fontSize);
|
|
|
|
- }
|
|
|
|
- if (val2 != null && !"".equals(val2)) {
|
|
|
|
- elm = new Paragraph(leading, val1 + val2, ft);
|
|
|
|
- } else {
|
|
|
|
- elm = new Paragraph(leading, val1, ft);
|
|
|
|
- }
|
|
|
|
- if (isCenter) {
|
|
|
|
- elm.setAlignment(Element.ALIGN_CENTER);
|
|
|
|
}
|
|
}
|
|
- document.add(elm);
|
|
|
|
- }
|
|
|
|
|
|
|
|
- /**
|
|
|
|
- * 获取所有要合并的下标、每个下标索要合并的行数、要跳过创建表格的下标
|
|
|
|
- */
|
|
|
|
- private Map getSubScListCombineCoord(List<SubScListVo> voList, int size) {
|
|
|
|
- int sublistNameSize = size - 4;// 指标最大级数
|
|
|
|
- HashMap<String, Object> resultMap = new HashMap<>();
|
|
|
|
- Map<String, CombineCoordVo> map = new HashMap<>();
|
|
|
|
- Map<String, Integer> combineCoordMap = new HashMap<>(); // 要合并的格子下标
|
|
|
|
- List<String> skipCoordList = new ArrayList<>(); // 要跳过的格子下标
|
|
|
|
-
|
|
|
|
- for (int i = 0; i < voList.size(); i++) {
|
|
|
|
- SubScListVo vo = voList.get(i);
|
|
|
|
- if (sublistNameSize == 1) {
|
|
|
|
- // 一级
|
|
|
|
- String sublistName1 = vo.getSublistName1();
|
|
|
|
- if (!isEmpty(sublistName1)) {
|
|
|
|
- setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
- setCoord(map, sublistName1 + "firstScore", i + "," + (size - 1), skipCoordList);
|
|
|
|
|
|
+ public void lineFeed(Document document, int length, int type) throws DocumentException {
|
|
|
|
+ if (type == 1) {
|
|
|
|
+ for (int i = 0; i < length; i++) {
|
|
|
|
+ document.add(Chunk.NEWLINE);
|
|
|
|
+ }
|
|
|
|
+ } else if (type == 2) {
|
|
|
|
+ for (int i = 0; i < length; i++) {
|
|
|
|
+ document.add(new Phrase("\n"));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+ }
|
|
|
|
|
|
- } else if (sublistNameSize == 2) {
|
|
|
|
- // 二级
|
|
|
|
- String sublistName1 = vo.getSublistName1();
|
|
|
|
- String sublistName2 = vo.getSublistName2();
|
|
|
|
-
|
|
|
|
- if (!isEmpty(sublistName1)) {
|
|
|
|
- setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
- setCoord(map, sublistName1 + "firstScore", i + "," + (size - 1), skipCoordList);
|
|
|
|
|
|
+ private void addElement(Document document, String val1, String val2, BaseFont f, int fontSize, boolean isBold, int leading, boolean isCenter) throws DocumentException {
|
|
|
|
+ Font ft;
|
|
|
|
+ Paragraph elm;
|
|
|
|
+ if (isBold) {
|
|
|
|
+ ft = new Font(f, fontSize, Font.BOLD);
|
|
|
|
+ } else {
|
|
|
|
+ ft = new Font(f, fontSize);
|
|
|
|
+ }
|
|
|
|
+ if (val2 != null && !"".equals(val2)) {
|
|
|
|
+ elm = new Paragraph(leading, val1 + val2, ft);
|
|
|
|
+ } else {
|
|
|
|
+ elm = new Paragraph(leading, val1, ft);
|
|
}
|
|
}
|
|
- if (!isEmpty(sublistName2)) {
|
|
|
|
- setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
|
|
+ if (isCenter) {
|
|
|
|
+ elm.setAlignment(Element.ALIGN_CENTER);
|
|
}
|
|
}
|
|
|
|
+ document.add(elm);
|
|
|
|
+ }
|
|
|
|
|
|
- } else if (sublistNameSize == 3) {
|
|
|
|
- // 三级
|
|
|
|
- String sublistName1 = vo.getSublistName1();
|
|
|
|
- String sublistName2 = vo.getSublistName2();
|
|
|
|
- String sublistName3 = vo.getSublistName3();
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取所有要合并的下标、每个下标索要合并的行数、要跳过创建表格的下标
|
|
|
|
+ */
|
|
|
|
+ private Map getSubScListCombineCoord(List<SubScListVo> voList, int size) {
|
|
|
|
+ int sublistNameSize = size - 4;// 指标最大级数
|
|
|
|
+ HashMap<String, Object> resultMap = new HashMap<>();
|
|
|
|
+ Map<String, CombineCoordVo> map = new HashMap<>();
|
|
|
|
+ Map<String, Integer> combineCoordMap = new HashMap<>(); // 要合并的格子下标
|
|
|
|
+ List<String> skipCoordList = new ArrayList<>(); // 要跳过的格子下标
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < voList.size(); i++) {
|
|
|
|
+ SubScListVo vo = voList.get(i);
|
|
|
|
+ if (sublistNameSize == 1) {
|
|
|
|
+ // 一级
|
|
|
|
+ String sublistName1 = vo.getSublistName1();
|
|
|
|
+ if (!isEmpty(sublistName1)) {
|
|
|
|
+ setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
+ setCoord(map, sublistName1 + "firstScore", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (sublistNameSize == 2) {
|
|
|
|
+ // 二级
|
|
|
|
+ String sublistName1 = vo.getSublistName1();
|
|
|
|
+ String sublistName2 = vo.getSublistName2();
|
|
|
|
+
|
|
|
|
+ if (!isEmpty(sublistName1)) {
|
|
|
|
+ setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
+ setCoord(map, sublistName1 + "firstScore", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName2)) {
|
|
|
|
+ setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (sublistNameSize == 3) {
|
|
|
|
+ // 三级
|
|
|
|
+ String sublistName1 = vo.getSublistName1();
|
|
|
|
+ String sublistName2 = vo.getSublistName2();
|
|
|
|
+ String sublistName3 = vo.getSublistName3();
|
|
|
|
+
|
|
|
|
+ if (!isEmpty(sublistName1)) {
|
|
|
|
+ setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
+ setCoord(map, sublistName1 + "firstScore", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName2)) {
|
|
|
|
+ setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName3)) {
|
|
|
|
+ setCoord(map, sublistName3, i + ",2", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ } else if (sublistNameSize == 4) {
|
|
|
|
+ // 四级
|
|
|
|
+ String sublistName1 = vo.getSublistName1();
|
|
|
|
+ String sublistName2 = vo.getSublistName2();
|
|
|
|
+ String sublistName3 = vo.getSublistName3();
|
|
|
|
+ String sublistName4 = vo.getSublistName4();
|
|
|
|
+
|
|
|
|
+ if (!isEmpty(sublistName1)) {
|
|
|
|
+ setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
+ setCoord(map, sublistName1 + "firstScore", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName2)) {
|
|
|
|
+ setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName3)) {
|
|
|
|
+ setCoord(map, sublistName3, i + ",2", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName4)) {
|
|
|
|
+ setCoord(map, sublistName4, i + ",3", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (sublistNameSize == 5) {
|
|
|
|
+ // 五级
|
|
|
|
+ String sublistName1 = vo.getSublistName1();
|
|
|
|
+ String sublistName2 = vo.getSublistName2();
|
|
|
|
+ String sublistName3 = vo.getSublistName3();
|
|
|
|
+ String sublistName4 = vo.getSublistName4();
|
|
|
|
+ String sublistName5 = vo.getSublistName5();
|
|
|
|
+
|
|
|
|
+ if (!isEmpty(sublistName1)) {
|
|
|
|
+ setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
+ setCoord(map, sublistName1 + "firstScore", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName2)) {
|
|
|
|
+ setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName3)) {
|
|
|
|
+ setCoord(map, sublistName3, i + ",2", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName4)) {
|
|
|
|
+ setCoord(map, sublistName4, i + ",3", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName5)) {
|
|
|
|
+ setCoord(map, sublistName5, i + ",4", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (sublistNameSize == 6) {
|
|
|
|
+ // 六级
|
|
|
|
+ String sublistName1 = vo.getSublistName1();
|
|
|
|
+ String sublistName2 = vo.getSublistName2();
|
|
|
|
+ String sublistName3 = vo.getSublistName3();
|
|
|
|
+ String sublistName4 = vo.getSublistName4();
|
|
|
|
+ String sublistName5 = vo.getSublistName5();
|
|
|
|
+ String sublistName6 = vo.getSublistName6();
|
|
|
|
+
|
|
|
|
+ if (!isEmpty(sublistName1)) {
|
|
|
|
+ setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
+ setCoord(map, sublistName1 + "firstScore", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName2)) {
|
|
|
|
+ setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName3)) {
|
|
|
|
+ setCoord(map, sublistName3, i + ",2", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName4)) {
|
|
|
|
+ setCoord(map, sublistName4, i + ",3", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName5)) {
|
|
|
|
+ setCoord(map, sublistName5, i + ",4", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName6)) {
|
|
|
|
+ setCoord(map, sublistName6, i + ",5", skipCoordList);
|
|
|
|
+ }
|
|
|
|
|
|
- if (!isEmpty(sublistName1)) {
|
|
|
|
- setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
- setCoord(map, sublistName1 + "firstScore", i + "," + (size - 1), skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName2)) {
|
|
|
|
- setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName3)) {
|
|
|
|
- setCoord(map, sublistName3, i + ",2", skipCoordList);
|
|
|
|
- }
|
|
|
|
- } else if (sublistNameSize == 4) {
|
|
|
|
- // 四级
|
|
|
|
- String sublistName1 = vo.getSublistName1();
|
|
|
|
- String sublistName2 = vo.getSublistName2();
|
|
|
|
- String sublistName3 = vo.getSublistName3();
|
|
|
|
- String sublistName4 = vo.getSublistName4();
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- if (!isEmpty(sublistName1)) {
|
|
|
|
- setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
- setCoord(map, sublistName1 + "firstScore", i + "," + (size - 1), skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName2)) {
|
|
|
|
- setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
}
|
|
}
|
|
- if (!isEmpty(sublistName3)) {
|
|
|
|
- setCoord(map, sublistName3, i + ",2", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName4)) {
|
|
|
|
- setCoord(map, sublistName4, i + ",3", skipCoordList);
|
|
|
|
|
|
+
|
|
|
|
+ for (String k : map.keySet()) {
|
|
|
|
+ CombineCoordVo combineCoordVo = map.get(k);
|
|
|
|
+ combineCoordMap.put(combineCoordVo.getCoord(), combineCoordVo.getRepetitionNum());
|
|
}
|
|
}
|
|
|
|
|
|
- } else if (sublistNameSize == 5) {
|
|
|
|
- // 五级
|
|
|
|
- String sublistName1 = vo.getSublistName1();
|
|
|
|
- String sublistName2 = vo.getSublistName2();
|
|
|
|
- String sublistName3 = vo.getSublistName3();
|
|
|
|
- String sublistName4 = vo.getSublistName4();
|
|
|
|
- String sublistName5 = vo.getSublistName5();
|
|
|
|
|
|
+ resultMap.put("combineCoordList", combineCoordMap);
|
|
|
|
+ resultMap.put("skipCoordList", skipCoordList);
|
|
|
|
|
|
- if (!isEmpty(sublistName1)) {
|
|
|
|
- setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
- setCoord(map, sublistName1 + "firstScore", i + "," + (size - 1), skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName2)) {
|
|
|
|
- setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName3)) {
|
|
|
|
- setCoord(map, sublistName3, i + ",2", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName4)) {
|
|
|
|
- setCoord(map, sublistName4, i + ",3", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName5)) {
|
|
|
|
- setCoord(map, sublistName5, i + ",4", skipCoordList);
|
|
|
|
- }
|
|
|
|
|
|
+ return resultMap;
|
|
|
|
|
|
- } else if (sublistNameSize == 6) {
|
|
|
|
- // 六级
|
|
|
|
- String sublistName1 = vo.getSublistName1();
|
|
|
|
- String sublistName2 = vo.getSublistName2();
|
|
|
|
- String sublistName3 = vo.getSublistName3();
|
|
|
|
- String sublistName4 = vo.getSublistName4();
|
|
|
|
- String sublistName5 = vo.getSublistName5();
|
|
|
|
- String sublistName6 = vo.getSublistName6();
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取所有要合并的下标、每个下标索要合并的行数、要跳过创建表格的下标
|
|
|
|
+ */
|
|
|
|
+ private Map getSceneScListCombineCoord(List<SceneScListVo> voList, int size) {
|
|
|
|
+ int sublistNameSize = size - 5;// 指标最大级数
|
|
|
|
+ HashMap<String, Object> resultMap = new HashMap<>();
|
|
|
|
+ Map<String, CombineCoordVo> map = new HashMap<>();
|
|
|
|
+ Map<String, Integer> combineCoordMap = new HashMap<>(); // 要合并的格子下标
|
|
|
|
+ List<String> skipCoordList = new ArrayList<>(); // 要跳过的格子下标
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < voList.size(); i++) {
|
|
|
|
+ SceneScListVo vo = voList.get(i);
|
|
|
|
+ if (sublistNameSize == 1) {
|
|
|
|
+ // 一级
|
|
|
|
+ String sublistName1 = vo.getSublistName1();
|
|
|
|
+ if (!isEmpty(sublistName1)) {
|
|
|
|
+ setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
+ setCoord(map, sublistName1 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (sublistNameSize == 2) {
|
|
|
|
+ // 二级
|
|
|
|
+ String sublistName1 = vo.getSublistName1();
|
|
|
|
+ String sublistName2 = vo.getSublistName2();
|
|
|
|
+
|
|
|
|
+ if (!isEmpty(sublistName1)) {
|
|
|
|
+ setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName2)) {
|
|
|
|
+ setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName2)) {
|
|
|
|
+ setCoord(map, sublistName2 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ } else {
|
|
|
|
+ setCoord(map, sublistName1 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (sublistNameSize == 3) {
|
|
|
|
+ // 三级
|
|
|
|
+ String sublistName1 = vo.getSublistName1();
|
|
|
|
+ String sublistName2 = vo.getSublistName2();
|
|
|
|
+ String sublistName3 = vo.getSublistName3();
|
|
|
|
+
|
|
|
|
+ if (!isEmpty(sublistName1)) {
|
|
|
|
+ setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName2)) {
|
|
|
|
+ setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName3)) {
|
|
|
|
+ setCoord(map, sublistName3, i + ",2", skipCoordList);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName3)) {
|
|
|
|
+ setCoord(map, sublistName3 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ } else if (!isEmpty(sublistName2)) {
|
|
|
|
+ setCoord(map, sublistName2 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ } else {
|
|
|
|
+ setCoord(map, sublistName1 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ } else if (sublistNameSize == 4) {
|
|
|
|
+ // 四级
|
|
|
|
+ String sublistName1 = vo.getSublistName1();
|
|
|
|
+ String sublistName2 = vo.getSublistName2();
|
|
|
|
+ String sublistName3 = vo.getSublistName3();
|
|
|
|
+ String sublistName4 = vo.getSublistName4();
|
|
|
|
+
|
|
|
|
+ if (!isEmpty(sublistName1)) {
|
|
|
|
+ setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName2)) {
|
|
|
|
+ setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName3)) {
|
|
|
|
+ setCoord(map, sublistName3, i + ",2", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName4)) {
|
|
|
|
+ setCoord(map, sublistName4, i + ",3", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!isEmpty(sublistName4)) {
|
|
|
|
+ setCoord(map, sublistName4 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ } else if (!isEmpty(sublistName3)) {
|
|
|
|
+ setCoord(map, sublistName3 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ } else if (!isEmpty(sublistName2)) {
|
|
|
|
+ setCoord(map, sublistName2 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ } else {
|
|
|
|
+ setCoord(map, sublistName1 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (sublistNameSize == 5) {
|
|
|
|
+ // 五级
|
|
|
|
+ String sublistName1 = vo.getSublistName1();
|
|
|
|
+ String sublistName2 = vo.getSublistName2();
|
|
|
|
+ String sublistName3 = vo.getSublistName3();
|
|
|
|
+ String sublistName4 = vo.getSublistName4();
|
|
|
|
+ String sublistName5 = vo.getSublistName5();
|
|
|
|
+
|
|
|
|
+ if (!isEmpty(sublistName1)) {
|
|
|
|
+ setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName2)) {
|
|
|
|
+ setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName3)) {
|
|
|
|
+ setCoord(map, sublistName3, i + ",2", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName4)) {
|
|
|
|
+ setCoord(map, sublistName4, i + ",3", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName5)) {
|
|
|
|
+ setCoord(map, sublistName5, i + ",4", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!isEmpty(sublistName5)) {
|
|
|
|
+ setCoord(map, sublistName5 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ } else if (!isEmpty(sublistName4)) {
|
|
|
|
+ setCoord(map, sublistName4 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ } else if (!isEmpty(sublistName3)) {
|
|
|
|
+ setCoord(map, sublistName3 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ } else if (!isEmpty(sublistName2)) {
|
|
|
|
+ setCoord(map, sublistName2 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ } else {
|
|
|
|
+ setCoord(map, sublistName1 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } else if (sublistNameSize == 6) {
|
|
|
|
+ // 六级
|
|
|
|
+ String sublistName1 = vo.getSublistName1();
|
|
|
|
+ String sublistName2 = vo.getSublistName2();
|
|
|
|
+ String sublistName3 = vo.getSublistName3();
|
|
|
|
+ String sublistName4 = vo.getSublistName4();
|
|
|
|
+ String sublistName5 = vo.getSublistName5();
|
|
|
|
+ String sublistName6 = vo.getSublistName6();
|
|
|
|
+
|
|
|
|
+ if (!isEmpty(sublistName1)) {
|
|
|
|
+ setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName2)) {
|
|
|
|
+ setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName3)) {
|
|
|
|
+ setCoord(map, sublistName3, i + ",2", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName4)) {
|
|
|
|
+ setCoord(map, sublistName4, i + ",3", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName5)) {
|
|
|
|
+ setCoord(map, sublistName5, i + ",4", skipCoordList);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(sublistName6)) {
|
|
|
|
+ setCoord(map, sublistName6, i + ",5", skipCoordList);
|
|
|
|
+ setCoord(map, sublistName1 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!isEmpty(sublistName6)) {
|
|
|
|
+ setCoord(map, sublistName6 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ } else if (!isEmpty(sublistName5)) {
|
|
|
|
+ setCoord(map, sublistName5 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ } else if (!isEmpty(sublistName4)) {
|
|
|
|
+ setCoord(map, sublistName4 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ } else if (!isEmpty(sublistName3)) {
|
|
|
|
+ setCoord(map, sublistName3 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ } else if (!isEmpty(sublistName2)) {
|
|
|
|
+ setCoord(map, sublistName2 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ } else {
|
|
|
|
+ setCoord(map, sublistName1 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
- if (!isEmpty(sublistName1)) {
|
|
|
|
- setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
- setCoord(map, sublistName1 + "firstScore", i + "," + (size - 1), skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName2)) {
|
|
|
|
- setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName3)) {
|
|
|
|
- setCoord(map, sublistName3, i + ",2", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName4)) {
|
|
|
|
- setCoord(map, sublistName4, i + ",3", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName5)) {
|
|
|
|
- setCoord(map, sublistName5, i + ",4", skipCoordList);
|
|
|
|
}
|
|
}
|
|
- if (!isEmpty(sublistName6)) {
|
|
|
|
- setCoord(map, sublistName6, i + ",5", skipCoordList);
|
|
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * List<CombineCoordVo> combineCoordVoList = new ArrayList<>();
|
|
|
|
+ *
|
|
|
|
+ * for(String k : map.keySet()){
|
|
|
|
+ * combineCoordVoList.add(map.get(k));
|
|
|
|
+ * }
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ for (String k : map.keySet()) {
|
|
|
|
+ CombineCoordVo combineCoordVo = map.get(k);
|
|
|
|
+ combineCoordMap.put(combineCoordVo.getCoord(), combineCoordVo.getRepetitionNum());
|
|
}
|
|
}
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ resultMap.put("combineCoordList", combineCoordMap);
|
|
|
|
+ resultMap.put("skipCoordList", skipCoordList);
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ return resultMap;
|
|
|
|
|
|
- for (String k : map.keySet()) {
|
|
|
|
- CombineCoordVo combineCoordVo = map.get(k);
|
|
|
|
- combineCoordMap.put(combineCoordVo.getCoord(), combineCoordVo.getRepetitionNum());
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- resultMap.put("combineCoordList", combineCoordMap);
|
|
|
|
- resultMap.put("skipCoordList", skipCoordList);
|
|
|
|
|
|
+ private void setCoord(Map<String, CombineCoordVo> map, String key, String coord, List<String> skipCoordList) {
|
|
|
|
+ CombineCoordVo value = map.get(key);
|
|
|
|
+ if (value != null) {
|
|
|
|
+ // 坐标不变,合并行数+1
|
|
|
|
+ value.setRepetitionNum(value.getRepetitionNum() + 1);
|
|
|
|
+ skipCoordList.add(coord);
|
|
|
|
+ } else {
|
|
|
|
+ // 新增
|
|
|
|
+ CombineCoordVo combineCoordVo = new CombineCoordVo();
|
|
|
|
+ combineCoordVo.setCoord(coord);
|
|
|
|
+ combineCoordVo.setRepetitionNum(1);
|
|
|
|
+ map.put(key, combineCoordVo);
|
|
|
|
|
|
- return resultMap;
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public String selectProjectReportIdByAlgorithmId(String algorithmId) {
|
|
|
|
+ SimulationManualProjectPo po = simulationProjectMapper.selectProjectReportIdByAlgorithmId(algorithmId);
|
|
|
|
+ if (StringUtil.isNotEmpty(po)) {
|
|
|
|
+ return po.getId();
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
|
|
- /**
|
|
|
|
- * 获取所有要合并的下标、每个下标索要合并的行数、要跳过创建表格的下标
|
|
|
|
- */
|
|
|
|
- private Map getSceneScListCombineCoord(List<SceneScListVo> voList, int size) {
|
|
|
|
- int sublistNameSize = size - 5;// 指标最大级数
|
|
|
|
- HashMap<String, Object> resultMap = new HashMap<>();
|
|
|
|
- Map<String, CombineCoordVo> map = new HashMap<>();
|
|
|
|
- Map<String, Integer> combineCoordMap = new HashMap<>(); // 要合并的格子下标
|
|
|
|
- List<String> skipCoordList = new ArrayList<>(); // 要跳过的格子下标
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<String> saveEvaluationLevel(String projectId) {
|
|
|
|
|
|
- for (int i = 0; i < voList.size(); i++) {
|
|
|
|
- SceneScListVo vo = voList.get(i);
|
|
|
|
- if (sublistNameSize == 1) {
|
|
|
|
- // 一级
|
|
|
|
- String sublistName1 = vo.getSublistName1();
|
|
|
|
- if (!isEmpty(sublistName1)) {
|
|
|
|
- setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
- setCoord(map, sublistName1 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- }
|
|
|
|
|
|
+ // 1 根据 projectId 查询一级指标
|
|
|
|
+ double scoreOfProject = simulationMptFirstTargetScoreMapper.selectScoreOfProject(projectId);
|
|
|
|
+ String evaluationLevel = ProjectUtil.getEvaluationLevelReport(scoreOfProject);
|
|
|
|
+ // -------------------------------- 保存结果 --------------------------------
|
|
|
|
+ // 1 根据 projectId 获取类型 projectType
|
|
|
|
+ String projectType = projectUtil.getProjectTypeByProjectId(projectId);
|
|
|
|
+ log.info("SimulationProjectServiceImpl--saveEvaluationLevel 项目 " + projectId + " 类型为 " + projectType);
|
|
|
|
+ if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
|
|
+ manualProjectMapper.updateEvaluationLevel(projectId, evaluationLevel);
|
|
|
|
+ } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
|
|
+ autoSubProjectMapper.updateEvaluationLevel(projectId, evaluationLevel);
|
|
|
|
+ } else {
|
|
|
|
+ ;
|
|
|
|
+ }
|
|
|
|
+ log.info("SimulationProjectServiceImpl--saveEvaluationLevel 项目 " + projectId + " 的总分为: " + scoreOfProject + ",评价等级为:" + evaluationLevel);
|
|
|
|
+
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, "评价等级为" + evaluationLevel, "");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // @Override
|
|
|
|
+ // public ResponseBodyVO<String> saveEvaluationLevel(String projectId) {
|
|
|
|
+ //
|
|
|
|
+ // //1 根据 projectId 获取类型 projectType
|
|
|
|
+ // String projectType = projectUtil.getProjectTypeByProjectId(projectId);
|
|
|
|
+ // log.info("SimulationProjectServiceImpl--saveEvaluationLevel 项目 " + projectId
|
|
|
|
+ // + " 类型为 " + projectType);
|
|
|
|
+ //
|
|
|
|
+ // //2 查询场景包 id
|
|
|
|
+ // String scene = null;
|
|
|
|
+ // if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) { // 手动运行
|
|
|
|
+ // scene = simulationProjectMapper.selectSceneById(projectId);
|
|
|
|
+ // } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {// 自动运行
|
|
|
|
+ // scene = simulationAutomaticSubProjectMapper.selectSceneById(projectId);
|
|
|
|
+ // }
|
|
|
|
+ // if (StringUtil.isEmpty(scene)) {
|
|
|
|
+ // return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE,
|
|
|
|
+ // "未查询到项目使用的场景测试包。");
|
|
|
|
+ // }
|
|
|
|
+ // log.info("SimulationProjectServiceImpl--saveEvaluationLevel 项目 " + projectId
|
|
|
|
+ // + " 使用的场景包为 " + scene);
|
|
|
|
+ //
|
|
|
|
+ // // -------------------------------- 计算评价等级 --------------------------------
|
|
|
|
+ // //TODO 该段代码可优化,有时间再优化
|
|
|
|
+ // //1 查询场景报告关联的指标
|
|
|
|
+ // List<ScenePackageSubListVO> scenePackageSubListVOS =
|
|
|
|
+ // simulationProjectMapper.selectSubSceneByPid(scene);
|
|
|
|
+ // String evaluationLevelReport = "";
|
|
|
|
+ // if (!isEmpty(scenePackageSubListVOS)) {
|
|
|
|
+ // double totalScore = 0.0;
|
|
|
|
+ // for (ScenePackageSubListVO v : scenePackageSubListVOS) {
|
|
|
|
+ // double weightDouble = Double.parseDouble(v.getWeight());
|
|
|
|
+ // // 根据一级指标计算总得分
|
|
|
|
+ // SimulationMptFirstTargetScorePo simulationMptFirstTargetScorePo = new
|
|
|
|
+ // SimulationMptFirstTargetScorePo();
|
|
|
|
+ // simulationMptFirstTargetScorePo.setPId(projectId); //直接(子)任务表id
|
|
|
|
+ // simulationMptFirstTargetScorePo.setTarget(v.getSublistId());
|
|
|
|
+ // SimulationMptFirstTargetScorePo simulationMptFirstTargetScorePo1 =
|
|
|
|
+ // simulationMptFirstTargetScoreMapper.selectFirstTargetScore(simulationMptFirstTargetScorePo);
|
|
|
|
+ // if (simulationMptFirstTargetScorePo1 == null) {
|
|
|
|
+ // continue;
|
|
|
|
+ // }
|
|
|
|
+ // Double score = simulationMptFirstTargetScorePo1.getScore();
|
|
|
|
+ // totalScore += score * (weightDouble / 100);
|
|
|
|
+ // }
|
|
|
|
+ // evaluationLevelReport = ProjectUtil.getEvaluationLevelReport(totalScore);
|
|
|
|
+ // log.info("SimulationProjectServiceImpl--saveEvaluationLevel 项目 " + projectId
|
|
|
|
+ // + " 的总分为: " + totalScore + ",评价等级为:" + evaluationLevelReport);
|
|
|
|
+ // }
|
|
|
|
+ // // -------------------------------- 保存结果 --------------------------------
|
|
|
|
+ // if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
|
|
+ // manualProjectMapper.updateEvaluationLevel(projectId, evaluationLevelReport);
|
|
|
|
+ // } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
|
|
+ // autoSubProjectMapper.updateEvaluationLevel(projectId, evaluationLevelReport);
|
|
|
|
+ // } else {
|
|
|
|
+ // ;
|
|
|
|
+ // }
|
|
|
|
+ //
|
|
|
|
+ // return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
|
+ // }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO saveTaskResult(SimulationManualProjectParam param) {
|
|
|
|
|
|
- } else if (sublistNameSize == 2) {
|
|
|
|
- // 二级
|
|
|
|
- String sublistName1 = vo.getSublistName1();
|
|
|
|
- String sublistName2 = vo.getSublistName2();
|
|
|
|
|
|
+ String projectId = param.getProjectId();
|
|
|
|
+ String taskId = param.getTaskId();
|
|
|
|
+ String runResultFilePath = param.getRunResultFilePath();
|
|
|
|
|
|
- if (!isEmpty(sublistName1)) {
|
|
|
|
- setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
|
|
+ if (StringUtil.isEmpty(projectId)) {
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "工作id不能为空");
|
|
}
|
|
}
|
|
- if (!isEmpty(sublistName2)) {
|
|
|
|
- setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
-
|
|
|
|
|
|
+ if (StringUtil.isEmpty(taskId)) {
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "任务id不能为空");
|
|
}
|
|
}
|
|
- if (!isEmpty(sublistName2)) {
|
|
|
|
- setCoord(map, sublistName2 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- } else {
|
|
|
|
- setCoord(map, sublistName1 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
|
|
+ if (StringUtil.isEmpty(runResultFilePath)) {
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "地址不能为空");
|
|
}
|
|
}
|
|
|
|
|
|
- } else if (sublistNameSize == 3) {
|
|
|
|
- // 三级
|
|
|
|
- String sublistName1 = vo.getSublistName1();
|
|
|
|
- String sublistName2 = vo.getSublistName2();
|
|
|
|
- String sublistName3 = vo.getSublistName3();
|
|
|
|
|
|
+ InputStream fileInputStream = null;
|
|
|
|
+ InputStreamReader inputStreamReader = null;
|
|
|
|
+ BufferedReader bufferedReader = null;
|
|
|
|
+ File file = null;
|
|
|
|
+ try {
|
|
|
|
+ // time
|
|
|
|
+ List<Double> time_list = new ArrayList<>();
|
|
|
|
+ // velocity
|
|
|
|
+ List<String> velocity_list = new ArrayList<>();
|
|
|
|
+ List<Double> lateral_velocity_list = new ArrayList<>();
|
|
|
|
+ List<Double> longitudinal_velocity_list = new ArrayList<>();
|
|
|
|
+ // acceleration
|
|
|
|
+ List<String> acceleration_list = new ArrayList<>();
|
|
|
|
+ List<Double> lateral_acceleration = new ArrayList<>();
|
|
|
|
+ List<Double> longitudinal_acceleration_list = new ArrayList<>();
|
|
|
|
+ // lane_offset
|
|
|
|
+ List<String> lane_offset_list = new ArrayList<>();
|
|
|
|
+ /// TODO brake 暂无
|
|
|
|
+ List<String> brake_list = new ArrayList<>();
|
|
|
|
+ // steeting_wheel
|
|
|
|
+ List<String> steeting_wheel_list = new ArrayList<>();
|
|
|
|
+ /// TODO throttle 暂无
|
|
|
|
+ List<String> throttle_list = new ArrayList<>();
|
|
|
|
+ // 摆角速度
|
|
|
|
+ List<Double> yawrate_list = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ MinioParameter minioParameter = new MinioParameter();
|
|
|
|
+ minioParameter.setObjectName(runResultFilePath + "/Ego.csv");
|
|
|
|
+ Response download = fileDownService.download(minioParameter);
|
|
|
|
+ Response.Body body = download.body();
|
|
|
|
+ fileInputStream = body.asInputStream();
|
|
|
|
+
|
|
|
|
+ /*
|
|
|
|
+ * file = new File("E:\\仿真云平台\\任务详情界面数据\\Ego(1).csv");
|
|
|
|
+ * fileInputStream = new FileInputStream(file);
|
|
|
|
+ * inputStreamReader = new InputStreamReader(fileInputStream,"utf-8");
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
|
|
|
|
+ bufferedReader = new BufferedReader(inputStreamReader);
|
|
|
|
+ String line;
|
|
|
|
+ int lineIndex = 0;
|
|
|
|
+
|
|
|
|
+ while ((line = bufferedReader.readLine()) != null) {
|
|
|
|
+ lineIndex++;
|
|
|
|
+ if (lineIndex == 1) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ String[] split = line.split(",");
|
|
|
|
+
|
|
|
|
+ // 添加异常捕获,非正常数据默认为0
|
|
|
|
+ try {
|
|
|
|
+ Double aDouble = Double.valueOf(split[1]);
|
|
|
|
+ if (aDouble.isNaN()) {
|
|
|
|
+ time_list.add(0D);
|
|
|
|
+ } else {
|
|
|
|
+ time_list.add(aDouble);
|
|
|
|
+ }
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ time_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ Double aDouble = Double.valueOf(split[6]);
|
|
|
|
+ if (aDouble.isNaN()) {
|
|
|
|
+ lateral_velocity_list.add(0D);
|
|
|
|
+ } else {
|
|
|
|
+ lateral_velocity_list.add(aDouble);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ lateral_velocity_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ Double aDouble = Double.valueOf(split[7]);
|
|
|
|
+ if (aDouble.isNaN()) {
|
|
|
|
+ longitudinal_velocity_list.add(0D);
|
|
|
|
+ } else {
|
|
|
|
+ longitudinal_velocity_list.add(aDouble);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ longitudinal_velocity_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ Double aDouble = Double.valueOf(split[8]);
|
|
|
|
+ if (aDouble.isNaN()) {
|
|
|
|
+ lateral_acceleration.add(0D);
|
|
|
|
+ } else {
|
|
|
|
+ lateral_acceleration.add(aDouble);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ lateral_acceleration.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ Double aDouble = Double.valueOf(split[9]);
|
|
|
|
+ if (aDouble.isNaN()) {
|
|
|
|
+ longitudinal_acceleration_list.add(0D);
|
|
|
|
+ } else {
|
|
|
|
+ longitudinal_acceleration_list.add(aDouble);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ longitudinal_acceleration_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ Double aDouble = Double.valueOf(split[12]);
|
|
|
|
+ if (aDouble.isNaN()) {
|
|
|
|
+ steeting_wheel_list.add("0");
|
|
|
|
+ } else {
|
|
|
|
+ steeting_wheel_list.add(String.valueOf(aDouble));// steering_angle
|
|
|
|
+ }
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ steeting_wheel_list.add("0");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ Double aDouble = Double.valueOf(split[13]);
|
|
|
|
+ if (aDouble.isNaN()) {
|
|
|
|
+ yawrate_list.add(0D);
|
|
|
|
+ } else {
|
|
|
|
+ yawrate_list.add(aDouble);
|
|
|
|
+ }
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ yawrate_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ Double aDouble = Double.valueOf(split[27]);
|
|
|
|
+ if (aDouble.isNaN()) {
|
|
|
|
+ lane_offset_list.add("0");
|
|
|
|
+ } else {
|
|
|
|
+ lane_offset_list.add(String.valueOf(aDouble));// lane_center_offset
|
|
|
|
+ }
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
+ lane_offset_list.add("0");
|
|
|
|
+ }
|
|
|
|
|
|
- if (!isEmpty(sublistName1)) {
|
|
|
|
- setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName2)) {
|
|
|
|
- setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName3)) {
|
|
|
|
- setCoord(map, sublistName3, i + ",2", skipCoordList);
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName3)) {
|
|
|
|
- setCoord(map, sublistName3 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- } else if (!isEmpty(sublistName2)) {
|
|
|
|
- setCoord(map, sublistName2 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- } else {
|
|
|
|
- setCoord(map, sublistName1 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- }
|
|
|
|
- } else if (sublistNameSize == 4) {
|
|
|
|
- // 四级
|
|
|
|
- String sublistName1 = vo.getSublistName1();
|
|
|
|
- String sublistName2 = vo.getSublistName2();
|
|
|
|
- String sublistName3 = vo.getSublistName3();
|
|
|
|
- String sublistName4 = vo.getSublistName4();
|
|
|
|
|
|
+ // 里程
|
|
|
|
+ Double lc = 0D;
|
|
|
|
+ for (int i = 0; i < time_list.size(); i++) {
|
|
|
|
+ if (i == 0) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ lc += (time_list.get(i) - time_list.get(i - 1)) * longitudinal_velocity_list.get(i - 1);
|
|
|
|
|
|
- if (!isEmpty(sublistName1)) {
|
|
|
|
- setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName2)) {
|
|
|
|
- setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName3)) {
|
|
|
|
- setCoord(map, sublistName3, i + ",2", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName4)) {
|
|
|
|
- setCoord(map, sublistName4, i + ",3", skipCoordList);
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- if (!isEmpty(sublistName4)) {
|
|
|
|
- setCoord(map, sublistName4 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- } else if (!isEmpty(sublistName3)) {
|
|
|
|
- setCoord(map, sublistName3 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- } else if (!isEmpty(sublistName2)) {
|
|
|
|
- setCoord(map, sublistName2 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- } else {
|
|
|
|
- setCoord(map, sublistName1 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- }
|
|
|
|
|
|
+ // 平均速度
|
|
|
|
+ Double pjsd = lc / time_list.get(time_list.size() - 1);
|
|
|
|
|
|
- } else if (sublistNameSize == 5) {
|
|
|
|
- // 五级
|
|
|
|
- String sublistName1 = vo.getSublistName1();
|
|
|
|
- String sublistName2 = vo.getSublistName2();
|
|
|
|
- String sublistName3 = vo.getSublistName3();
|
|
|
|
- String sublistName4 = vo.getSublistName4();
|
|
|
|
- String sublistName5 = vo.getSublistName5();
|
|
|
|
|
|
+ // 最大速度
|
|
|
|
+ Double zdsd = Collections.max(longitudinal_velocity_list);
|
|
|
|
|
|
- if (!isEmpty(sublistName1)) {
|
|
|
|
- setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName2)) {
|
|
|
|
- setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName3)) {
|
|
|
|
- setCoord(map, sublistName3, i + ",2", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName4)) {
|
|
|
|
- setCoord(map, sublistName4, i + ",3", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName5)) {
|
|
|
|
- setCoord(map, sublistName5, i + ",4", skipCoordList);
|
|
|
|
- }
|
|
|
|
|
|
+ // 最小速度
|
|
|
|
+ Double zxsd = Collections.min(longitudinal_velocity_list);
|
|
|
|
|
|
- if (!isEmpty(sublistName5)) {
|
|
|
|
- setCoord(map, sublistName5 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- } else if (!isEmpty(sublistName4)) {
|
|
|
|
- setCoord(map, sublistName4 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- } else if (!isEmpty(sublistName3)) {
|
|
|
|
- setCoord(map, sublistName3 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- } else if (!isEmpty(sublistName2)) {
|
|
|
|
- setCoord(map, sublistName2 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- } else {
|
|
|
|
- setCoord(map, sublistName1 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- }
|
|
|
|
|
|
+ // 最大加速度
|
|
|
|
+ Double zdjiasd = Collections.max(longitudinal_acceleration_list);
|
|
|
|
|
|
- } else if (sublistNameSize == 6) {
|
|
|
|
- // 六级
|
|
|
|
- String sublistName1 = vo.getSublistName1();
|
|
|
|
- String sublistName2 = vo.getSublistName2();
|
|
|
|
- String sublistName3 = vo.getSublistName3();
|
|
|
|
- String sublistName4 = vo.getSublistName4();
|
|
|
|
- String sublistName5 = vo.getSublistName5();
|
|
|
|
- String sublistName6 = vo.getSublistName6();
|
|
|
|
|
|
+ // 最大减速度
|
|
|
|
+ Double zdjiansd = Collections.min(longitudinal_acceleration_list);
|
|
|
|
|
|
- if (!isEmpty(sublistName1)) {
|
|
|
|
- setCoord(map, sublistName1, i + ",0", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName2)) {
|
|
|
|
- setCoord(map, sublistName2, i + ",1", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName3)) {
|
|
|
|
- setCoord(map, sublistName3, i + ",2", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName4)) {
|
|
|
|
- setCoord(map, sublistName4, i + ",3", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName5)) {
|
|
|
|
- setCoord(map, sublistName5, i + ",4", skipCoordList);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(sublistName6)) {
|
|
|
|
- setCoord(map, sublistName6, i + ",5", skipCoordList);
|
|
|
|
- setCoord(map, sublistName1 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- }
|
|
|
|
|
|
+ // 最大摆角速度
|
|
|
|
+ Double zdbjsd = Collections.max(yawrate_list);
|
|
|
|
|
|
- if (!isEmpty(sublistName6)) {
|
|
|
|
- setCoord(map, sublistName6 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- } else if (!isEmpty(sublistName5)) {
|
|
|
|
- setCoord(map, sublistName5 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- } else if (!isEmpty(sublistName4)) {
|
|
|
|
- setCoord(map, sublistName4 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- } else if (!isEmpty(sublistName3)) {
|
|
|
|
- setCoord(map, sublistName3 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- } else if (!isEmpty(sublistName2)) {
|
|
|
|
- setCoord(map, sublistName2 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- } else {
|
|
|
|
- setCoord(map, sublistName1 + "scoreExplain", i + "," + (size - 1), skipCoordList);
|
|
|
|
- }
|
|
|
|
|
|
+ // 自车速度方差
|
|
|
|
+ Double zcsdfc = 0D;
|
|
|
|
+ for (Double d : longitudinal_velocity_list) {
|
|
|
|
+ zcsdfc += Math.pow(d - pjsd, 2);
|
|
|
|
+ }
|
|
|
|
+ zcsdfc = zcsdfc / longitudinal_velocity_list.size();
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ // 自车横摆角速度均方根
|
|
|
|
+ Double zchbjsdjfg = 0D;
|
|
|
|
+ for (Double d : yawrate_list) {
|
|
|
|
+ zchbjsdjfg += Math.pow(d - pjsd, 2);
|
|
|
|
+ }
|
|
|
|
+ zchbjsdjfg = Math.sqrt(zchbjsdjfg / yawrate_list.size());
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ for (int i = 0; i < lateral_acceleration.size(); i++) {
|
|
|
|
+ Double aDouble = lateral_acceleration.get(i);
|
|
|
|
+ Double aDouble1 = longitudinal_acceleration_list.get(i);
|
|
|
|
+ Double d = Math.pow(aDouble, 2) + Math.pow(aDouble1, 2);
|
|
|
|
+ acceleration_list.add(String.valueOf(Math.sqrt(d)));
|
|
|
|
+ }
|
|
|
|
|
|
- /*
|
|
|
|
- * List<CombineCoordVo> combineCoordVoList = new ArrayList<>();
|
|
|
|
- *
|
|
|
|
- * for(String k : map.keySet()){
|
|
|
|
- * combineCoordVoList.add(map.get(k));
|
|
|
|
- * }
|
|
|
|
- */
|
|
|
|
|
|
+ for (int i = 0; i < lateral_velocity_list.size(); i++) {
|
|
|
|
+ Double aDouble = lateral_velocity_list.get(i);
|
|
|
|
+ Double aDouble1 = longitudinal_velocity_list.get(i);
|
|
|
|
+ Double d = Math.pow(aDouble, 2) + Math.pow(aDouble1, 2);
|
|
|
|
+ velocity_list.add(String.valueOf(d));
|
|
|
|
+ }
|
|
|
|
|
|
- for (String k : map.keySet()) {
|
|
|
|
- CombineCoordVo combineCoordVo = map.get(k);
|
|
|
|
- combineCoordMap.put(combineCoordVo.getCoord(), combineCoordVo.getRepetitionNum());
|
|
|
|
- }
|
|
|
|
|
|
+ // 将数据保存到库
|
|
|
|
+ ManualProjectTaskPo manualProjectTaskPo = new ManualProjectTaskPo();
|
|
|
|
+ manualProjectTaskPo.setId(taskId);
|
|
|
|
+ manualProjectTaskPo.setPId(projectId);
|
|
|
|
+ manualProjectTaskPo.setMileage(lc.toString());
|
|
|
|
+ manualProjectTaskPo.setAverageVelocity(pjsd.toString());
|
|
|
|
+ manualProjectTaskPo.setMaximunSpeed(zdsd.toString());
|
|
|
|
+ manualProjectTaskPo.setMinimunVelocity(zxsd.toString());
|
|
|
|
+ manualProjectTaskPo.setMaximumAcceleration(zdjiasd.toString());
|
|
|
|
+ manualProjectTaskPo.setMaximumDeceleration(zdjiansd.toString());
|
|
|
|
+ manualProjectTaskPo.setMaximumSwingSpeed(zdbjsd.toString());
|
|
|
|
+ manualProjectTaskPo.setSpeedVariance(String.valueOf(zcsdfc));
|
|
|
|
+ manualProjectTaskPo.setSwingSpeedMeanSquareRoot(String.valueOf(zchbjsdjfg));
|
|
|
|
+ manualProjectTaskPo.setAcceleration(String.join(",", acceleration_list));
|
|
|
|
+ manualProjectTaskPo.setLaneOffset(String.join(",", lane_offset_list));
|
|
|
|
+ manualProjectTaskPo.setBrake(String.join(",", brake_list));
|
|
|
|
+ manualProjectTaskPo.setSteetingWheel(String.join(",", steeting_wheel_list));
|
|
|
|
+ manualProjectTaskPo.setThrottle(String.join(",", throttle_list));
|
|
|
|
+ if (!isEmpty(yawrate_list)) {
|
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
|
+ for (Double d : yawrate_list) {
|
|
|
|
+ sb.append(d + ",");
|
|
|
|
+ }
|
|
|
|
+ String s = sb.substring(0, sb.lastIndexOf(","));
|
|
|
|
+ manualProjectTaskPo.setYawRate(s);
|
|
|
|
+ }
|
|
|
|
+ manualProjectTaskPo.setVelocity(String.join(",", velocity_list));
|
|
|
|
+ manualProjectTaskPo.setOtherCurve("");/// TODO 其他暂无
|
|
|
|
+
|
|
|
|
+ if (!isEmpty(time_list)) {
|
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
|
+ for (Double d : time_list) {
|
|
|
|
+ sb.append(d + ",");
|
|
|
|
+ }
|
|
|
|
+ String s = sb.substring(0, sb.lastIndexOf(","));
|
|
|
|
+ manualProjectTaskPo.setTimerShaft(s);
|
|
|
|
+ }
|
|
|
|
|
|
- resultMap.put("combineCoordList", combineCoordMap);
|
|
|
|
- resultMap.put("skipCoordList", skipCoordList);
|
|
|
|
|
|
+ simulationProjectTaskMapper.updateTaksResult(manualProjectTaskPo);
|
|
|
|
|
|
- return resultMap;
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ } finally {
|
|
|
|
+ try {
|
|
|
|
+ if (fileInputStream != null) {
|
|
|
|
+ fileInputStream.close();
|
|
|
|
+ }
|
|
|
|
+ if (inputStreamReader != null) {
|
|
|
|
+ inputStreamReader.close();
|
|
|
|
+ }
|
|
|
|
+ if (bufferedReader != null) {
|
|
|
|
+ bufferedReader.close();
|
|
|
|
+ }
|
|
|
|
+ /*
|
|
|
|
+ * if(file != null ){
|
|
|
|
+ * file.delete();
|
|
|
|
+ * }
|
|
|
|
+ */
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- private void setCoord(Map<String, CombineCoordVo> map, String key, String coord, List<String> skipCoordList) {
|
|
|
|
- CombineCoordVo value = map.get(key);
|
|
|
|
- if (value != null) {
|
|
|
|
- // 坐标不变,合并行数+1
|
|
|
|
- value.setRepetitionNum(value.getRepetitionNum() + 1);
|
|
|
|
- skipCoordList.add(coord);
|
|
|
|
- } else {
|
|
|
|
- // 新增
|
|
|
|
- CombineCoordVo combineCoordVo = new CombineCoordVo();
|
|
|
|
- combineCoordVo.setCoord(coord);
|
|
|
|
- combineCoordVo.setRepetitionNum(1);
|
|
|
|
- map.put(key, combineCoordVo);
|
|
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
|
|
|
|
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
- public String selectProjectReportIdByAlgorithmId(String algorithmId) {
|
|
|
|
- SimulationManualProjectPo po = simulationProjectMapper.selectProjectReportIdByAlgorithmId(algorithmId);
|
|
|
|
- if (StringUtil.isNotEmpty(po)) {
|
|
|
|
- return po.getId();
|
|
|
|
- }
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<String> saveEvaluationLevel(String projectId) {
|
|
|
|
-
|
|
|
|
- // 1 根据 projectId 查询一级指标
|
|
|
|
- double scoreOfProject = simulationMptFirstTargetScoreMapper.selectScoreOfProject(projectId);
|
|
|
|
- String evaluationLevel = ProjectUtil.getEvaluationLevelReport(scoreOfProject);
|
|
|
|
- // -------------------------------- 保存结果 --------------------------------
|
|
|
|
- // 1 根据 projectId 获取类型 projectType
|
|
|
|
- String projectType = projectUtil.getProjectTypeByProjectId(projectId);
|
|
|
|
- log.info("SimulationProjectServiceImpl--saveEvaluationLevel 项目 " + projectId + " 类型为 " + projectType);
|
|
|
|
- if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
|
|
- manualProjectMapper.updateEvaluationLevel(projectId, evaluationLevel);
|
|
|
|
- } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
|
|
- autoSubProjectMapper.updateEvaluationLevel(projectId, evaluationLevel);
|
|
|
|
- } else {
|
|
|
|
- ;
|
|
|
|
- }
|
|
|
|
- log.info("SimulationProjectServiceImpl--saveEvaluationLevel 项目 " + projectId + " 的总分为: " + scoreOfProject + ",评价等级为:" + evaluationLevel);
|
|
|
|
-
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, "评价等级为" + evaluationLevel, "");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // @Override
|
|
|
|
- // public ResponseBodyVO<String> saveEvaluationLevel(String projectId) {
|
|
|
|
- //
|
|
|
|
- // //1 根据 projectId 获取类型 projectType
|
|
|
|
- // String projectType = projectUtil.getProjectTypeByProjectId(projectId);
|
|
|
|
- // log.info("SimulationProjectServiceImpl--saveEvaluationLevel 项目 " + projectId
|
|
|
|
- // + " 类型为 " + projectType);
|
|
|
|
- //
|
|
|
|
- // //2 查询场景包 id
|
|
|
|
- // String scene = null;
|
|
|
|
- // if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) { // 手动运行
|
|
|
|
- // scene = simulationProjectMapper.selectSceneById(projectId);
|
|
|
|
- // } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {// 自动运行
|
|
|
|
- // scene = simulationAutomaticSubProjectMapper.selectSceneById(projectId);
|
|
|
|
- // }
|
|
|
|
- // if (StringUtil.isEmpty(scene)) {
|
|
|
|
- // return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE,
|
|
|
|
- // "未查询到项目使用的场景测试包。");
|
|
|
|
- // }
|
|
|
|
- // log.info("SimulationProjectServiceImpl--saveEvaluationLevel 项目 " + projectId
|
|
|
|
- // + " 使用的场景包为 " + scene);
|
|
|
|
- //
|
|
|
|
- // // -------------------------------- 计算评价等级 --------------------------------
|
|
|
|
- // //TODO 该段代码可优化,有时间再优化
|
|
|
|
- // //1 查询场景报告关联的指标
|
|
|
|
- // List<ScenePackageSubListVO> scenePackageSubListVOS =
|
|
|
|
- // simulationProjectMapper.selectSubSceneByPid(scene);
|
|
|
|
- // String evaluationLevelReport = "";
|
|
|
|
- // if (!isEmpty(scenePackageSubListVOS)) {
|
|
|
|
- // double totalScore = 0.0;
|
|
|
|
- // for (ScenePackageSubListVO v : scenePackageSubListVOS) {
|
|
|
|
- // double weightDouble = Double.parseDouble(v.getWeight());
|
|
|
|
- // // 根据一级指标计算总得分
|
|
|
|
- // SimulationMptFirstTargetScorePo simulationMptFirstTargetScorePo = new
|
|
|
|
- // SimulationMptFirstTargetScorePo();
|
|
|
|
- // simulationMptFirstTargetScorePo.setPId(projectId); //直接(子)任务表id
|
|
|
|
- // simulationMptFirstTargetScorePo.setTarget(v.getSublistId());
|
|
|
|
- // SimulationMptFirstTargetScorePo simulationMptFirstTargetScorePo1 =
|
|
|
|
- // simulationMptFirstTargetScoreMapper.selectFirstTargetScore(simulationMptFirstTargetScorePo);
|
|
|
|
- // if (simulationMptFirstTargetScorePo1 == null) {
|
|
|
|
- // continue;
|
|
|
|
- // }
|
|
|
|
- // Double score = simulationMptFirstTargetScorePo1.getScore();
|
|
|
|
- // totalScore += score * (weightDouble / 100);
|
|
|
|
- // }
|
|
|
|
- // evaluationLevelReport = ProjectUtil.getEvaluationLevelReport(totalScore);
|
|
|
|
- // log.info("SimulationProjectServiceImpl--saveEvaluationLevel 项目 " + projectId
|
|
|
|
- // + " 的总分为: " + totalScore + ",评价等级为:" + evaluationLevelReport);
|
|
|
|
- // }
|
|
|
|
- // // -------------------------------- 保存结果 --------------------------------
|
|
|
|
- // if (DictConstants.PROJECT_TYPE_MANUAL.equals(projectType)) {
|
|
|
|
- // manualProjectMapper.updateEvaluationLevel(projectId, evaluationLevelReport);
|
|
|
|
- // } else if (DictConstants.PROJECT_TYPE_AUTO_SUB.equals(projectType)) {
|
|
|
|
- // autoSubProjectMapper.updateEvaluationLevel(projectId, evaluationLevelReport);
|
|
|
|
- // } else {
|
|
|
|
- // ;
|
|
|
|
- // }
|
|
|
|
- //
|
|
|
|
- // return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO saveTaskResult(SimulationManualProjectParam param) {
|
|
|
|
-
|
|
|
|
- String projectId = param.getProjectId();
|
|
|
|
- String taskId = param.getTaskId();
|
|
|
|
- String runResultFilePath = param.getRunResultFilePath();
|
|
|
|
-
|
|
|
|
- if (StringUtil.isEmpty(projectId)) {
|
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "工作id不能为空");
|
|
|
|
- }
|
|
|
|
- if (StringUtil.isEmpty(taskId)) {
|
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "任务id不能为空");
|
|
|
|
- }
|
|
|
|
- if (StringUtil.isEmpty(runResultFilePath)) {
|
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "地址不能为空");
|
|
|
|
- }
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void exportProjectTaskFileById(SimulationManualProjectParam param) {
|
|
|
|
+ String id = param.getId();
|
|
|
|
|
|
- InputStream fileInputStream = null;
|
|
|
|
- InputStreamReader inputStreamReader = null;
|
|
|
|
- BufferedReader bufferedReader = null;
|
|
|
|
- File file = null;
|
|
|
|
- try {
|
|
|
|
- // time
|
|
|
|
- List<Double> time_list = new ArrayList<>();
|
|
|
|
- // velocity
|
|
|
|
- List<String> velocity_list = new ArrayList<>();
|
|
|
|
- List<Double> lateral_velocity_list = new ArrayList<>();
|
|
|
|
- List<Double> longitudinal_velocity_list = new ArrayList<>();
|
|
|
|
- // acceleration
|
|
|
|
- List<String> acceleration_list = new ArrayList<>();
|
|
|
|
- List<Double> lateral_acceleration = new ArrayList<>();
|
|
|
|
- List<Double> longitudinal_acceleration_list = new ArrayList<>();
|
|
|
|
- // lane_offset
|
|
|
|
- List<String> lane_offset_list = new ArrayList<>();
|
|
|
|
- /// TODO brake 暂无
|
|
|
|
- List<String> brake_list = new ArrayList<>();
|
|
|
|
- // steeting_wheel
|
|
|
|
- List<String> steeting_wheel_list = new ArrayList<>();
|
|
|
|
- /// TODO throttle 暂无
|
|
|
|
- List<String> throttle_list = new ArrayList<>();
|
|
|
|
- // 摆角速度
|
|
|
|
- List<Double> yawrate_list = new ArrayList<>();
|
|
|
|
-
|
|
|
|
- MinioParameter minioParameter = new MinioParameter();
|
|
|
|
- minioParameter.setObjectName(runResultFilePath + "/Ego.csv");
|
|
|
|
- Response download = fileDownService.download(minioParameter);
|
|
|
|
- Response.Body body = download.body();
|
|
|
|
- fileInputStream = body.asInputStream();
|
|
|
|
-
|
|
|
|
- /*
|
|
|
|
- * file = new File("E:\\仿真云平台\\任务详情界面数据\\Ego(1).csv");
|
|
|
|
- * fileInputStream = new FileInputStream(file);
|
|
|
|
- * inputStreamReader = new InputStreamReader(fileInputStream,"utf-8");
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- inputStreamReader = new InputStreamReader(fileInputStream, "utf-8");
|
|
|
|
- bufferedReader = new BufferedReader(inputStreamReader);
|
|
|
|
- String line;
|
|
|
|
- int lineIndex = 0;
|
|
|
|
-
|
|
|
|
- while ((line = bufferedReader.readLine()) != null) {
|
|
|
|
- lineIndex++;
|
|
|
|
- if (lineIndex == 1) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- String[] split = line.split(",");
|
|
|
|
-
|
|
|
|
- // 添加异常捕获,非正常数据默认为0
|
|
|
|
- try {
|
|
|
|
- Double aDouble = Double.valueOf(split[1]);
|
|
|
|
- if (aDouble.isNaN()) {
|
|
|
|
- time_list.add(0D);
|
|
|
|
- } else {
|
|
|
|
- time_list.add(aDouble);
|
|
|
|
- }
|
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
- time_list.add(0D);
|
|
|
|
|
|
+ // 获取任务包信息
|
|
|
|
+ ProjectTaskParam projectTaskParam = new ProjectTaskParam();
|
|
|
|
+ projectTaskParam.setPId(id);
|
|
|
|
+ List<ManualProjectTaskVo> manualProjectTaskVos = simulationProjectTaskMapper.selectProjectTaskByProjectId(projectTaskParam);
|
|
|
|
+ if (isEmpty(manualProjectTaskVos)) {
|
|
|
|
+ throw new RuntimeException("没有获取到任务信息。");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 压缩包根路径
|
|
|
|
+ SimulationManualProjectParam sp = new SimulationManualProjectParam();
|
|
|
|
+ sp.setId(id);
|
|
|
|
+ SimulationManualProjectPo spo = simulationProjectMapper.selectProjectBaseById(sp);
|
|
|
|
+ String rootPath = spo.getProjectName();
|
|
|
|
+ // FileUtil.createDirectory(rootPath);
|
|
|
|
+
|
|
|
|
+ int len;
|
|
|
|
+ byte[] buffer = new byte[1024];
|
|
|
|
+ // BufferedInputStream in = null;
|
|
|
|
+ ZipOutputStream zos = null;
|
|
|
|
+ // InputStream inputStream = null;
|
|
|
|
+ File pdfFile = null;
|
|
try {
|
|
try {
|
|
- Double aDouble = Double.valueOf(split[6]);
|
|
|
|
- if (aDouble.isNaN()) {
|
|
|
|
- lateral_velocity_list.add(0D);
|
|
|
|
- } else {
|
|
|
|
- lateral_velocity_list.add(aDouble);
|
|
|
|
- }
|
|
|
|
|
|
+ HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
|
|
|
|
+ response.setContentType("multipart/form-data");
|
|
|
|
+ response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode("运行任务包.zip", "UTF-8"));
|
|
|
|
+ zos = new ZipOutputStream(response.getOutputStream());
|
|
|
|
+ int i = 1;
|
|
|
|
+ // ArrayList<String> fileList = CollectionUtil.createArrayList("Ego.csv",
|
|
|
|
+ // "evaluation.csv");
|
|
|
|
+ for (ManualProjectTaskVo task : manualProjectTaskVos) {
|
|
|
|
+ String taskId = task.getId();
|
|
|
|
+ String runResultFilePath = task.getRunResultFilePath();
|
|
|
|
+ if (!isEmpty(runResultFilePath)) {
|
|
|
|
+
|
|
|
|
+ // 获取场景名
|
|
|
|
+ SceneBaseInfoVo sceneBaseInfoVo = getSceneNameAndOther(task.getSceneId(), task.getSceneType());
|
|
|
|
+ String sceneName = sceneBaseInfoVo.getCommonSceneName();
|
|
|
|
+
|
|
|
|
+ // 任务包路径
|
|
|
|
+ // String taskPagePath = rootPath + File.separator + sceneName + "(" + i + ")";
|
|
|
|
+ String taskPagePath = rootPath + File.separator + sceneName + "- " + taskId.substring(0, 8);
|
|
|
|
+
|
|
|
|
+ // 视频文件路径
|
|
|
|
+ MinioParameter minioParameter1 = new MinioParameter();
|
|
|
|
+ minioParameter1.setObjectName(runResultFilePath);
|
|
|
|
+ ResponseBodyVO<List<String>> list = fileDownService.list(minioParameter1);
|
|
|
|
+ List<String> info = list.getInfo();
|
|
|
|
+ for (String s : info) {
|
|
|
|
+ String fileName;
|
|
|
|
+ String zipPath;
|
|
|
|
+ // 获取文件名
|
|
|
|
+ if (s.contains("/")) {
|
|
|
|
+ fileName = s.substring(s.lastIndexOf("/") + 1);
|
|
|
|
+ } else {
|
|
|
|
+ fileName = s.substring(s.lastIndexOf("\\") + 1);
|
|
|
|
+ }
|
|
|
|
+ zipPath = taskPagePath + File.separator + fileName;
|
|
|
|
+ // 文件后缀
|
|
|
|
+ String substring = s.substring(s.lastIndexOf(".") + 1);
|
|
|
|
+ if ("mp4".equals(substring)) {
|
|
|
|
+ // mp4视频文件导出
|
|
|
|
+ MinioParameter minioParameter2 = new MinioParameter();
|
|
|
|
+ minioParameter2.setObjectName(s);
|
|
|
|
+ Response download2 = fileDownService.download(minioParameter2);
|
|
|
|
+ Response.Body body2 = download2.body();
|
|
|
|
+ ZipEntry entry2 = new ZipEntry(zipPath);
|
|
|
|
+ zos.putNextEntry(entry2);
|
|
|
|
+ BufferedInputStream in = new BufferedInputStream(body2.asInputStream());
|
|
|
|
+ while ((len = in.read(buffer)) != -1) {
|
|
|
|
+ zos.write(buffer, 0, len);
|
|
|
|
+ }
|
|
|
|
+ in.close();
|
|
|
|
+ } else if ("Ego.csv".equals(fileName) || "evaluation.csv".equals(fileName)) {
|
|
|
|
+
|
|
|
|
+ MinioParameter minioParameter = new MinioParameter();
|
|
|
|
+ if (s.contains("/")) {
|
|
|
|
+ minioParameter.setObjectName(runResultFilePath + "/" + fileName);
|
|
|
|
+ } else {
|
|
|
|
+ minioParameter.setObjectName(runResultFilePath + "\\" + fileName);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Response download = fileDownService.download(minioParameter);
|
|
|
|
+ Response.Body body = download.body();
|
|
|
|
+
|
|
|
|
+ // 任务文件路径
|
|
|
|
+ String taskFilePath = taskPagePath + File.separator + fileName;
|
|
|
|
+
|
|
|
|
+ ZipEntry entry = new ZipEntry(taskFilePath);
|
|
|
|
+ zos.putNextEntry(entry);
|
|
|
|
+ BufferedInputStream in = new BufferedInputStream(body.asInputStream());
|
|
|
|
+ while ((len = in.read(buffer)) != -1) {
|
|
|
|
+ zos.write(buffer, 0, len);
|
|
|
|
+ }
|
|
|
|
+ in.close();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ i++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
- lateral_velocity_list.add(0D);
|
|
|
|
- }
|
|
|
|
|
|
+ // 打包pdf
|
|
|
|
+ if (param.getIsPagePdf() != null && param.getIsPagePdf()) {
|
|
|
|
+ // 获取工作信息
|
|
|
|
+ SimulationManualProjectPo p = simulationProjectMapper.selectProjectBaseById(param);
|
|
|
|
+ final String algorithmName = algorithmMapper.selectAlgorithmNameByAlgorithmId(param.getAlgorithm());
|
|
|
|
+
|
|
|
|
+ pdfFile = new File(param.getLocalPdfFilePath());
|
|
|
|
+ FileInputStream fileInputStream = new FileInputStream(pdfFile);
|
|
|
|
+ BufferedInputStream in = new BufferedInputStream(fileInputStream);
|
|
|
|
+ ZipEntry entry = new ZipEntry(rootPath + File.separator + algorithmName + "评价报告.pdf");
|
|
|
|
+ zos.putNextEntry(entry);
|
|
|
|
+ while ((len = in.read(buffer)) != -1) {
|
|
|
|
+ zos.write(buffer, 0, len);
|
|
|
|
+ }
|
|
|
|
+ in.close();
|
|
|
|
+ }
|
|
|
|
|
|
- try {
|
|
|
|
- Double aDouble = Double.valueOf(split[7]);
|
|
|
|
- if (aDouble.isNaN()) {
|
|
|
|
- longitudinal_velocity_list.add(0D);
|
|
|
|
- } else {
|
|
|
|
- longitudinal_velocity_list.add(aDouble);
|
|
|
|
- }
|
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ } finally {
|
|
|
|
+ try {
|
|
|
|
+ if (zos != null) {
|
|
|
|
+ zos.close();
|
|
|
|
+ }
|
|
|
|
+ if (pdfFile != null) {
|
|
|
|
+ pdfFile.delete();
|
|
|
|
+ }
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
- longitudinal_velocity_list.add(0D);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- try {
|
|
|
|
- Double aDouble = Double.valueOf(split[8]);
|
|
|
|
- if (aDouble.isNaN()) {
|
|
|
|
- lateral_acceleration.add(0D);
|
|
|
|
- } else {
|
|
|
|
- lateral_acceleration.add(aDouble);
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
- lateral_acceleration.add(0D);
|
|
|
|
- }
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void exportProjectReportAndTaskFileById(SimulationManualProjectParam param) {
|
|
|
|
+ // 生成本地pdf
|
|
|
|
+ param.setIsCreateLocalPdfFile(true);
|
|
|
|
+ param.setLocalPdfFilePath(StringUtil.getRandomUUID() + ".pdf");
|
|
|
|
+ param.setIsPagePdf(true);
|
|
|
|
+ // 下载报告和任务包
|
|
|
|
+ exportProjectReport(param);
|
|
|
|
+ exportProjectTaskFileById(param);
|
|
|
|
+ }
|
|
|
|
|
|
- try {
|
|
|
|
- Double aDouble = Double.valueOf(split[9]);
|
|
|
|
- if (aDouble.isNaN()) {
|
|
|
|
- longitudinal_acceleration_list.add(0D);
|
|
|
|
- } else {
|
|
|
|
- longitudinal_acceleration_list.add(aDouble);
|
|
|
|
- }
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO addOrUpdateAutomaticProject(SimulationManualProjectParam param) {
|
|
|
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
- longitudinal_acceleration_list.add(0D);
|
|
|
|
|
|
+ if (isEmpty(param.getProjectName())) {
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "工作名称不能为空");
|
|
}
|
|
}
|
|
-
|
|
|
|
- try {
|
|
|
|
- Double aDouble = Double.valueOf(split[12]);
|
|
|
|
- if (aDouble.isNaN()) {
|
|
|
|
- steeting_wheel_list.add("0");
|
|
|
|
- } else {
|
|
|
|
- steeting_wheel_list.add(String.valueOf(aDouble));// steering_angle
|
|
|
|
- }
|
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
- steeting_wheel_list.add("0");
|
|
|
|
|
|
+ // 校验cron表达式(运行周期)
|
|
|
|
+ String operationCycle = param.getOperationCycle();
|
|
|
|
+ if (isEmpty(operationCycle)) {
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "运行周期为必填项");
|
|
}
|
|
}
|
|
-
|
|
|
|
try {
|
|
try {
|
|
- Double aDouble = Double.valueOf(split[13]);
|
|
|
|
- if (aDouble.isNaN()) {
|
|
|
|
- yawrate_list.add(0D);
|
|
|
|
- } else {
|
|
|
|
- yawrate_list.add(aDouble);
|
|
|
|
- }
|
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
- yawrate_list.add(0D);
|
|
|
|
|
|
+ CronExpression.parse(operationCycle);
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "运行周期格式不对");
|
|
}
|
|
}
|
|
|
|
|
|
- try {
|
|
|
|
- Double aDouble = Double.valueOf(split[27]);
|
|
|
|
- if (aDouble.isNaN()) {
|
|
|
|
- lane_offset_list.add("0");
|
|
|
|
- } else {
|
|
|
|
- lane_offset_list.add(String.valueOf(aDouble));// lane_center_offset
|
|
|
|
- }
|
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
- lane_offset_list.add("0");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 里程
|
|
|
|
- Double lc = 0D;
|
|
|
|
- for (int i = 0; i < time_list.size(); i++) {
|
|
|
|
- if (i == 0) {
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- lc += (time_list.get(i) - time_list.get(i - 1)) * longitudinal_velocity_list.get(i - 1);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 平均速度
|
|
|
|
- Double pjsd = lc / time_list.get(time_list.size() - 1);
|
|
|
|
-
|
|
|
|
- // 最大速度
|
|
|
|
- Double zdsd = Collections.max(longitudinal_velocity_list);
|
|
|
|
-
|
|
|
|
- // 最小速度
|
|
|
|
- Double zxsd = Collections.min(longitudinal_velocity_list);
|
|
|
|
-
|
|
|
|
- // 最大加速度
|
|
|
|
- Double zdjiasd = Collections.max(longitudinal_acceleration_list);
|
|
|
|
-
|
|
|
|
- // 最大减速度
|
|
|
|
- Double zdjiansd = Collections.min(longitudinal_acceleration_list);
|
|
|
|
-
|
|
|
|
- // 最大摆角速度
|
|
|
|
- Double zdbjsd = Collections.max(yawrate_list);
|
|
|
|
-
|
|
|
|
- // 自车速度方差
|
|
|
|
- Double zcsdfc = 0D;
|
|
|
|
- for (Double d : longitudinal_velocity_list) {
|
|
|
|
- zcsdfc += Math.pow(d - pjsd, 2);
|
|
|
|
- }
|
|
|
|
- zcsdfc = zcsdfc / longitudinal_velocity_list.size();
|
|
|
|
-
|
|
|
|
- // 自车横摆角速度均方根
|
|
|
|
- Double zchbjsdjfg = 0D;
|
|
|
|
- for (Double d : yawrate_list) {
|
|
|
|
- zchbjsdjfg += Math.pow(d - pjsd, 2);
|
|
|
|
- }
|
|
|
|
- zchbjsdjfg = Math.sqrt(zchbjsdjfg / yawrate_list.size());
|
|
|
|
-
|
|
|
|
- for (int i = 0; i < lateral_acceleration.size(); i++) {
|
|
|
|
- Double aDouble = lateral_acceleration.get(i);
|
|
|
|
- Double aDouble1 = longitudinal_acceleration_list.get(i);
|
|
|
|
- Double d = Math.pow(aDouble, 2) + Math.pow(aDouble1, 2);
|
|
|
|
- acceleration_list.add(String.valueOf(Math.sqrt(d)));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- for (int i = 0; i < lateral_velocity_list.size(); i++) {
|
|
|
|
- Double aDouble = lateral_velocity_list.get(i);
|
|
|
|
- Double aDouble1 = longitudinal_velocity_list.get(i);
|
|
|
|
- Double d = Math.pow(aDouble, 2) + Math.pow(aDouble1, 2);
|
|
|
|
- velocity_list.add(String.valueOf(d));
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 将数据保存到库
|
|
|
|
- ManualProjectTaskPo manualProjectTaskPo = new ManualProjectTaskPo();
|
|
|
|
- manualProjectTaskPo.setId(taskId);
|
|
|
|
- manualProjectTaskPo.setPId(projectId);
|
|
|
|
- manualProjectTaskPo.setMileage(lc.toString());
|
|
|
|
- manualProjectTaskPo.setAverageVelocity(pjsd.toString());
|
|
|
|
- manualProjectTaskPo.setMaximunSpeed(zdsd.toString());
|
|
|
|
- manualProjectTaskPo.setMinimunVelocity(zxsd.toString());
|
|
|
|
- manualProjectTaskPo.setMaximumAcceleration(zdjiasd.toString());
|
|
|
|
- manualProjectTaskPo.setMaximumDeceleration(zdjiansd.toString());
|
|
|
|
- manualProjectTaskPo.setMaximumSwingSpeed(zdbjsd.toString());
|
|
|
|
- manualProjectTaskPo.setSpeedVariance(String.valueOf(zcsdfc));
|
|
|
|
- manualProjectTaskPo.setSwingSpeedMeanSquareRoot(String.valueOf(zchbjsdjfg));
|
|
|
|
- manualProjectTaskPo.setAcceleration(String.join(",", acceleration_list));
|
|
|
|
- manualProjectTaskPo.setLaneOffset(String.join(",", lane_offset_list));
|
|
|
|
- manualProjectTaskPo.setBrake(String.join(",", brake_list));
|
|
|
|
- manualProjectTaskPo.setSteetingWheel(String.join(",", steeting_wheel_list));
|
|
|
|
- manualProjectTaskPo.setThrottle(String.join(",", throttle_list));
|
|
|
|
- if (!isEmpty(yawrate_list)) {
|
|
|
|
- StringBuffer sb = new StringBuffer();
|
|
|
|
- for (Double d : yawrate_list) {
|
|
|
|
- sb.append(d + ",");
|
|
|
|
- }
|
|
|
|
- String s = sb.substring(0, sb.lastIndexOf(","));
|
|
|
|
- manualProjectTaskPo.setYawRate(s);
|
|
|
|
- }
|
|
|
|
- manualProjectTaskPo.setVelocity(String.join(",", velocity_list));
|
|
|
|
- manualProjectTaskPo.setOtherCurve("");/// TODO 其他暂无
|
|
|
|
-
|
|
|
|
- if (!isEmpty(time_list)) {
|
|
|
|
- StringBuffer sb = new StringBuffer();
|
|
|
|
- for (Double d : time_list) {
|
|
|
|
- sb.append(d + ",");
|
|
|
|
- }
|
|
|
|
- String s = sb.substring(0, sb.lastIndexOf(","));
|
|
|
|
- manualProjectTaskPo.setTimerShaft(s);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- simulationProjectTaskMapper.updateTaksResult(manualProjectTaskPo);
|
|
|
|
-
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- } finally {
|
|
|
|
- try {
|
|
|
|
- if (fileInputStream != null) {
|
|
|
|
- fileInputStream.close();
|
|
|
|
- }
|
|
|
|
- if (inputStreamReader != null) {
|
|
|
|
- inputStreamReader.close();
|
|
|
|
- }
|
|
|
|
- if (bufferedReader != null) {
|
|
|
|
- bufferedReader.close();
|
|
|
|
- }
|
|
|
|
- /*
|
|
|
|
- * if(file != null ){
|
|
|
|
- * file.delete();
|
|
|
|
- * }
|
|
|
|
- */
|
|
|
|
- } catch (IOException e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
|
+ // 创建自动运行任务时自动运行状态默认为关闭(1)
|
|
|
|
+ param.setAutomaticRunState("1");
|
|
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
+ SimulationAutomaticProjectPo po = convertToSimulationAutomaticProjectPo(param);
|
|
|
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS);
|
|
|
|
|
|
+ if (isEmpty(param.getId())) {
|
|
|
|
+ // 工作名称一样的的不能创建
|
|
|
|
+ List<SimulationAutomaticProjectPo> simulationManualProjectPos = simulationAutomaticProjectMapper.selectAutomaticProjectByQuery(param);
|
|
|
|
+ if (!isEmpty(simulationManualProjectPos)) {
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "工作名称已经存在,请修改后再保存");
|
|
|
|
+ }
|
|
|
|
+ po.createPo(AuthUtil.getCurrentUserId());
|
|
|
|
+ // 生成id
|
|
|
|
+ createProjectId(po);
|
|
|
|
+ int add = simulationAutomaticProjectMapper.add(po);
|
|
|
|
+ if (add > 0) {
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, ResponseBodyVO.Response.SUCCESS.getMessage(), po.getId());
|
|
|
|
+ }
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "添加失败");
|
|
|
|
+ } else {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ SimulationAutomaticProjectPo saPo = simulationAutomaticProjectMapper.selectById(param.getId());
|
|
|
|
|
|
- @Override
|
|
|
|
- public void exportProjectTaskFileById(SimulationManualProjectParam param) {
|
|
|
|
- String id = param.getId();
|
|
|
|
|
|
+ // 自动运行状态为关闭的才可以修改
|
|
|
|
+ if ("0".equals(saPo.getAutomaticRunState())) {
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "自动任务开启状态不支持修改");
|
|
|
|
+ }
|
|
|
|
|
|
- // 获取任务包信息
|
|
|
|
- ProjectTaskParam projectTaskParam = new ProjectTaskParam();
|
|
|
|
- projectTaskParam.setPId(id);
|
|
|
|
- List<ManualProjectTaskVo> manualProjectTaskVos = simulationProjectTaskMapper.selectProjectTaskByProjectId(projectTaskParam);
|
|
|
|
- if (isEmpty(manualProjectTaskVos)) {
|
|
|
|
- throw new RuntimeException("没有获取到任务信息。");
|
|
|
|
- }
|
|
|
|
|
|
+ po.updatePo(AuthUtil.getCurrentUserId());
|
|
|
|
+ int update = simulationAutomaticProjectMapper.updateById(po);
|
|
|
|
+ if (update > 0) {
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, ResponseBodyVO.Response.SUCCESS.getMessage(), po.getId());
|
|
|
|
+ }
|
|
|
|
|
|
- // 压缩包根路径
|
|
|
|
- SimulationManualProjectParam sp = new SimulationManualProjectParam();
|
|
|
|
- sp.setId(id);
|
|
|
|
- SimulationManualProjectPo spo = simulationProjectMapper.selectProjectBaseById(sp);
|
|
|
|
- String rootPath = spo.getProjectName();
|
|
|
|
- // FileUtil.createDirectory(rootPath);
|
|
|
|
-
|
|
|
|
- int len;
|
|
|
|
- byte[] buffer = new byte[1024];
|
|
|
|
- // BufferedInputStream in = null;
|
|
|
|
- ZipOutputStream zos = null;
|
|
|
|
- // InputStream inputStream = null;
|
|
|
|
- File pdfFile = null;
|
|
|
|
- try {
|
|
|
|
- HttpServletResponse response = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getResponse();
|
|
|
|
- response.setContentType("multipart/form-data");
|
|
|
|
- response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode("运行任务包.zip", "UTF-8"));
|
|
|
|
- zos = new ZipOutputStream(response.getOutputStream());
|
|
|
|
- int i = 1;
|
|
|
|
- // ArrayList<String> fileList = CollectionUtil.createArrayList("Ego.csv",
|
|
|
|
- // "evaluation.csv");
|
|
|
|
- for (ManualProjectTaskVo task : manualProjectTaskVos) {
|
|
|
|
- String taskId = task.getId();
|
|
|
|
- String runResultFilePath = task.getRunResultFilePath();
|
|
|
|
- if (!isEmpty(runResultFilePath)) {
|
|
|
|
-
|
|
|
|
- // 获取场景名
|
|
|
|
- SceneBaseInfoVo sceneBaseInfoVo = getSceneNameAndOther(task.getSceneId(), task.getSceneType());
|
|
|
|
- String sceneName = sceneBaseInfoVo.getCommonSceneName();
|
|
|
|
-
|
|
|
|
- // 任务包路径
|
|
|
|
- // String taskPagePath = rootPath + File.separator + sceneName + "(" + i + ")";
|
|
|
|
- String taskPagePath = rootPath + File.separator + sceneName + "- " + taskId.substring(0, 8);
|
|
|
|
-
|
|
|
|
- // 视频文件路径
|
|
|
|
- MinioParameter minioParameter1 = new MinioParameter();
|
|
|
|
- minioParameter1.setObjectName(runResultFilePath);
|
|
|
|
- ResponseBodyVO<List<String>> list = fileDownService.list(minioParameter1);
|
|
|
|
- List<String> info = list.getInfo();
|
|
|
|
- for (String s : info) {
|
|
|
|
- String fileName;
|
|
|
|
- String zipPath;
|
|
|
|
- // 获取文件名
|
|
|
|
- if (s.contains("/")) {
|
|
|
|
- fileName = s.substring(s.lastIndexOf("/") + 1);
|
|
|
|
- } else {
|
|
|
|
- fileName = s.substring(s.lastIndexOf("\\") + 1);
|
|
|
|
- }
|
|
|
|
- zipPath = taskPagePath + File.separator + fileName;
|
|
|
|
- // 文件后缀
|
|
|
|
- String substring = s.substring(s.lastIndexOf(".") + 1);
|
|
|
|
- if ("mp4".equals(substring)) {
|
|
|
|
- // mp4视频文件导出
|
|
|
|
- MinioParameter minioParameter2 = new MinioParameter();
|
|
|
|
- minioParameter2.setObjectName(s);
|
|
|
|
- Response download2 = fileDownService.download(minioParameter2);
|
|
|
|
- Response.Body body2 = download2.body();
|
|
|
|
- ZipEntry entry2 = new ZipEntry(zipPath);
|
|
|
|
- zos.putNextEntry(entry2);
|
|
|
|
- BufferedInputStream in = new BufferedInputStream(body2.asInputStream());
|
|
|
|
- while ((len = in.read(buffer)) != -1) {
|
|
|
|
- zos.write(buffer, 0, len);
|
|
|
|
- }
|
|
|
|
- in.close();
|
|
|
|
- } else if ("Ego.csv".equals(fileName) || "evaluation.csv".equals(fileName)) {
|
|
|
|
-
|
|
|
|
- MinioParameter minioParameter = new MinioParameter();
|
|
|
|
- if (s.contains("/")) {
|
|
|
|
- minioParameter.setObjectName(runResultFilePath + "/" + fileName);
|
|
|
|
- } else {
|
|
|
|
- minioParameter.setObjectName(runResultFilePath + "\\" + fileName);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Response download = fileDownService.download(minioParameter);
|
|
|
|
- Response.Body body = download.body();
|
|
|
|
-
|
|
|
|
- // 任务文件路径
|
|
|
|
- String taskFilePath = taskPagePath + File.separator + fileName;
|
|
|
|
-
|
|
|
|
- ZipEntry entry = new ZipEntry(taskFilePath);
|
|
|
|
- zos.putNextEntry(entry);
|
|
|
|
- BufferedInputStream in = new BufferedInputStream(body.asInputStream());
|
|
|
|
- while ((len = in.read(buffer)) != -1) {
|
|
|
|
- zos.write(buffer, 0, len);
|
|
|
|
- }
|
|
|
|
- in.close();
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- i++;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 打包pdf
|
|
|
|
- if (param.getIsPagePdf() != null && param.getIsPagePdf()) {
|
|
|
|
- // 获取工作信息
|
|
|
|
- SimulationManualProjectPo p = simulationProjectMapper.selectProjectBaseById(param);
|
|
|
|
- final String algorithmName = algorithmMapper.selectAlgorithmNameByAlgorithmId(param.getAlgorithm());
|
|
|
|
-
|
|
|
|
- pdfFile = new File(param.getLocalPdfFilePath());
|
|
|
|
- FileInputStream fileInputStream = new FileInputStream(pdfFile);
|
|
|
|
- BufferedInputStream in = new BufferedInputStream(fileInputStream);
|
|
|
|
- ZipEntry entry = new ZipEntry(rootPath + File.separator + algorithmName + "评价报告.pdf");
|
|
|
|
- zos.putNextEntry(entry);
|
|
|
|
- while ((len = in.read(buffer)) != -1) {
|
|
|
|
- zos.write(buffer, 0, len);
|
|
|
|
- }
|
|
|
|
- in.close();
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- } finally {
|
|
|
|
- try {
|
|
|
|
- if (zos != null) {
|
|
|
|
- zos.close();
|
|
|
|
- }
|
|
|
|
- if (pdfFile != null) {
|
|
|
|
- pdfFile.delete();
|
|
|
|
- }
|
|
|
|
- } catch (IOException e) {
|
|
|
|
- e.printStackTrace();
|
|
|
|
- }
|
|
|
|
|
|
+ return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "修改失败");
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<String> deleteAutomaticProjectByids(SimulationManualProjectParam param) {
|
|
|
|
+ String ids = param.getIds();
|
|
|
|
+ String[] idArr = ids.split(",");
|
|
|
|
|
|
- @Override
|
|
|
|
- public void exportProjectReportAndTaskFileById(SimulationManualProjectParam param) {
|
|
|
|
- // 生成本地pdf
|
|
|
|
- param.setIsCreateLocalPdfFile(true);
|
|
|
|
- param.setLocalPdfFilePath(StringUtil.getRandomUUID() + ".pdf");
|
|
|
|
- param.setIsPagePdf(true);
|
|
|
|
- // 下载报告和任务包
|
|
|
|
- exportProjectReport(param);
|
|
|
|
- exportProjectTaskFileById(param);
|
|
|
|
- }
|
|
|
|
|
|
+ List<SimulationAutomaticProjectPo> pos = simulationAutomaticProjectMapper.selectProjectNowRunState(idArr);
|
|
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO addOrUpdateAutomaticProject(SimulationManualProjectParam param) {
|
|
|
|
|
|
+ // 已经启动定时任务的项目不可以删除
|
|
|
|
+ for (SimulationAutomaticProjectPo p : pos) {
|
|
|
|
+ if ("0".equals(p.getAutomaticRunState())) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "自动任务开启状态不支持删除");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- if (isEmpty(param.getProjectName())) {
|
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "工作名称不能为空");
|
|
|
|
- }
|
|
|
|
- // 校验cron表达式(运行周期)
|
|
|
|
- String operationCycle = param.getOperationCycle();
|
|
|
|
- if (isEmpty(operationCycle)) {
|
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "运行周期为必填项");
|
|
|
|
- }
|
|
|
|
- try {
|
|
|
|
- CronExpression.parse(operationCycle);
|
|
|
|
- } catch (Exception e) {
|
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "运行周期格式不对");
|
|
|
|
- }
|
|
|
|
|
|
+ int i = simulationAutomaticProjectMapper.deleteProject(idArr);
|
|
|
|
+ if (i > 0) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
|
+ }
|
|
|
|
|
|
- // 创建自动运行任务时自动运行状态默认为关闭(1)
|
|
|
|
- param.setAutomaticRunState("1");
|
|
|
|
-
|
|
|
|
- SimulationAutomaticProjectPo po = convertToSimulationAutomaticProjectPo(param);
|
|
|
|
-
|
|
|
|
- if (isEmpty(param.getId())) {
|
|
|
|
- // 工作名称一样的的不能创建
|
|
|
|
- List<SimulationAutomaticProjectPo> simulationManualProjectPos = simulationAutomaticProjectMapper.selectAutomaticProjectByQuery(param);
|
|
|
|
- if (!isEmpty(simulationManualProjectPos)) {
|
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "工作名称已经存在,请修改后再保存");
|
|
|
|
- }
|
|
|
|
- po.createPo(AuthUtil.getCurrentUserId());
|
|
|
|
- // 生成id
|
|
|
|
- createProjectId(po);
|
|
|
|
- int add = simulationAutomaticProjectMapper.add(po);
|
|
|
|
- if (add > 0) {
|
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, ResponseBodyVO.Response.SUCCESS.getMessage(), po.getId());
|
|
|
|
- }
|
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "添加失败");
|
|
|
|
- } else {
|
|
|
|
-
|
|
|
|
- SimulationAutomaticProjectPo saPo = simulationAutomaticProjectMapper.selectById(param.getId());
|
|
|
|
-
|
|
|
|
- // 自动运行状态为关闭的才可以修改
|
|
|
|
- if ("0".equals(saPo.getAutomaticRunState())) {
|
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "自动任务开启状态不支持修改");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- po.updatePo(AuthUtil.getCurrentUserId());
|
|
|
|
- int update = simulationAutomaticProjectMapper.updateById(po);
|
|
|
|
- if (update > 0) {
|
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, ResponseBodyVO.Response.SUCCESS.getMessage(), po.getId());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return new ResponseBodyVO(ResponseBodyVO.Response.SERVER_FAILURE, "修改失败");
|
|
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "删除失败");
|
|
}
|
|
}
|
|
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<String> deleteAutomaticProjectByids(SimulationManualProjectParam param) {
|
|
|
|
- String ids = param.getIds();
|
|
|
|
- String[] idArr = ids.split(",");
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<String> updateAutomaticRunState(SimulationManualProjectParam param) {
|
|
|
|
+ String id = param.getId();
|
|
|
|
+ String automaticRunState = param.getAutomaticRunState();
|
|
|
|
+ Optional.ofNullable(id).orElseThrow(() -> new RuntimeException("id 不能为空。"));
|
|
|
|
+ Optional.ofNullable(automaticRunState).orElseThrow(() -> new RuntimeException("自动运行状态不能为空。"));
|
|
|
|
|
|
- List<SimulationAutomaticProjectPo> pos = simulationAutomaticProjectMapper.selectProjectNowRunState(idArr);
|
|
|
|
-
|
|
|
|
- // 已经启动定时任务的项目不可以删除
|
|
|
|
- for (SimulationAutomaticProjectPo p : pos) {
|
|
|
|
- if ("0".equals(p.getAutomaticRunState())) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "自动任务开启状态不支持删除");
|
|
|
|
- }
|
|
|
|
|
|
+ // 1 修改父项目停用状态
|
|
|
|
+ SimulationAutomaticProjectPo po = simulationAutomaticProjectMapper.selectById(id); // 查询父项目信息
|
|
|
|
+ if ("0".equals(param.getAutomaticRunState())) { // 启动
|
|
|
|
+ // 1 判断算法是否已经被删除
|
|
|
|
+ projectUtil.checkProject(po.getAlgorithm(), po.getVehicle(), po.getScene());
|
|
|
|
+ String currentGitVersion = algorithmService.getGitVersion(po.getAlgorithm());
|
|
|
|
+ simulationAutomaticProjectMapper.updateAutomaticRunState(param);
|
|
|
|
+ AlgorithmParameter algorithmParam = new AlgorithmParameter();
|
|
|
|
+ algorithmParam.setId(po.getAlgorithm());
|
|
|
|
+ algorithmParam.setGitVersion(currentGitVersion);
|
|
|
|
+ runProject(algorithmParam, param, po);
|
|
|
|
+ } else if ("1".equals(param.getAutomaticRunState())) { // 停止
|
|
|
|
+ simulationAutomaticProjectMapper.updateAutomaticRunState(param);
|
|
|
|
+ // 推送定时请求
|
|
|
|
+ projectTaskStop(po);
|
|
|
|
+ }
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
}
|
|
}
|
|
|
|
|
|
- int i = simulationAutomaticProjectMapper.deleteProject(idArr);
|
|
|
|
- if (i > 0) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
|
- }
|
|
|
|
|
|
+ private void runProject(AlgorithmParameter algorithmParam, SimulationManualProjectParam simulationManualProjectParam, SimulationAutomaticProjectPo simulationAutomaticProjectPo) {
|
|
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "删除失败");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<String> updateAutomaticRunState(SimulationManualProjectParam param) {
|
|
|
|
- String id = param.getId();
|
|
|
|
- String automaticRunState = param.getAutomaticRunState();
|
|
|
|
- Optional.ofNullable(id).orElseThrow(() -> new RuntimeException("id 不能为空。"));
|
|
|
|
- Optional.ofNullable(automaticRunState).orElseThrow(() -> new RuntimeException("自动运行状态不能为空。"));
|
|
|
|
-
|
|
|
|
- // 1 修改父项目停用状态
|
|
|
|
- SimulationAutomaticProjectPo po = simulationAutomaticProjectMapper.selectById(id); // 查询父项目信息
|
|
|
|
- if ("0".equals(param.getAutomaticRunState())) { // 启动
|
|
|
|
- // 1 判断算法是否已经被删除
|
|
|
|
- projectUtil.checkProject(po.getAlgorithm(), po.getVehicle(), po.getScene());
|
|
|
|
- String currentGitVersion = algorithmService.getGitVersion(po.getAlgorithm());
|
|
|
|
- simulationAutomaticProjectMapper.updateAutomaticRunState(param);
|
|
|
|
- AlgorithmParameter algorithmParam = new AlgorithmParameter();
|
|
|
|
- algorithmParam.setId(po.getAlgorithm());
|
|
|
|
- algorithmParam.setGitVersion(currentGitVersion);
|
|
|
|
- runProject(algorithmParam, param, po);
|
|
|
|
- } else if ("1".equals(param.getAutomaticRunState())) { // 停止
|
|
|
|
- simulationAutomaticProjectMapper.updateAutomaticRunState(param);
|
|
|
|
- // 推送定时请求
|
|
|
|
- projectTaskStop(po);
|
|
|
|
- }
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
|
- }
|
|
|
|
|
|
+ // 更新算法版本
|
|
|
|
+ simulationAutomaticProjectMapper.updateAlgorithmGitVersion(algorithmParam);
|
|
|
|
|
|
- private void runProject(AlgorithmParameter algorithmParam, SimulationManualProjectParam simulationManualProjectParam, SimulationAutomaticProjectPo simulationAutomaticProjectPo) {
|
|
|
|
|
|
+ // 添加一条子工作信息并推送消息到kafka ,执行项目
|
|
|
|
+ createAutomaticSubProject(simulationManualProjectParam);
|
|
|
|
|
|
- // 更新算法版本
|
|
|
|
- simulationAutomaticProjectMapper.updateAlgorithmGitVersion(algorithmParam);
|
|
|
|
|
|
+ // 推送定时请求,启动运行周期
|
|
|
|
+ projectTaskStart(simulationAutomaticProjectPo);
|
|
|
|
|
|
- // 添加一条子工作信息并推送消息到kafka ,执行项目
|
|
|
|
- createAutomaticSubProject(simulationManualProjectParam);
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- // 推送定时请求,启动运行周期
|
|
|
|
- projectTaskStart(simulationAutomaticProjectPo);
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<PageInfo<SimulationManualProjectVo>> selectAutomaticProject(SimulationManualProjectParam param) {
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ // 1 获取当前用户id
|
|
|
|
+ param.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<PageInfo<SimulationManualProjectVo>> selectAutomaticProject(SimulationManualProjectParam param) {
|
|
|
|
|
|
+ // 2 获取创建时间和开始时间
|
|
|
|
+ if (!isEmpty(param.getCreateStartDate())) {
|
|
|
|
+ String createStartDate = param.getCreateStartDate();
|
|
|
|
+ Date startDate = getDate(createStartDate + " 00:00:00", 1);
|
|
|
|
+ if (startDate == null) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
+ }
|
|
|
|
+ param.setCreateTimeStart(startDate);
|
|
|
|
+ }
|
|
|
|
+ if (!isEmpty(param.getCreateEndDate())) {
|
|
|
|
+ String createEndDate = param.getCreateEndDate();
|
|
|
|
+ Date endDate = getDate(createEndDate + " 23:59:59", 1);
|
|
|
|
+ if (endDate == null) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
+ }
|
|
|
|
+ param.setCreateTimeEnd(endDate);
|
|
|
|
+ }
|
|
|
|
|
|
- // 1 获取当前用户id
|
|
|
|
- param.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
|
|
|
|
+ setPage(param.getCurrentPage() == null ? 1 : param.getCurrentPage(), param.getPageSize() == null ? 10 : param.getPageSize());
|
|
|
|
+ List<SimulationManualProjectVo> simulationManualProjectVoList = simulationAutomaticProjectMapper.selectAutomaticProjectList(param);
|
|
|
|
+ PageInfo<SimulationManualProjectVo> pageInfo = new PageInfo<>(simulationManualProjectVoList);
|
|
|
|
|
|
- // 2 获取创建时间和开始时间
|
|
|
|
- if (!isEmpty(param.getCreateStartDate())) {
|
|
|
|
- String createStartDate = param.getCreateStartDate();
|
|
|
|
- Date startDate = getDate(createStartDate + " 00:00:00", 1);
|
|
|
|
- if (startDate == null) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
- }
|
|
|
|
- param.setCreateTimeStart(startDate);
|
|
|
|
- }
|
|
|
|
- if (!isEmpty(param.getCreateEndDate())) {
|
|
|
|
- String createEndDate = param.getCreateEndDate();
|
|
|
|
- Date endDate = getDate(createEndDate + " 23:59:59", 1);
|
|
|
|
- if (endDate == null) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
- }
|
|
|
|
- param.setCreateTimeEnd(endDate);
|
|
|
|
- }
|
|
|
|
|
|
+ for (SimulationManualProjectVo simulationManualProjectVo : pageInfo.getList()) {
|
|
|
|
+ convertPoToVo(simulationManualProjectVo, true);
|
|
|
|
+ }
|
|
|
|
|
|
- setPage(param.getCurrentPage() == null ? 1 : param.getCurrentPage(), param.getPageSize() == null ? 10 : param.getPageSize());
|
|
|
|
- List<SimulationManualProjectVo> simulationManualProjectVoList = simulationAutomaticProjectMapper.selectAutomaticProjectList(param);
|
|
|
|
- PageInfo<SimulationManualProjectVo> pageInfo = new PageInfo<>(simulationManualProjectVoList);
|
|
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, pageInfo);
|
|
|
|
|
|
- for (SimulationManualProjectVo simulationManualProjectVo : pageInfo.getList()) {
|
|
|
|
- convertPoToVo(simulationManualProjectVo, true);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, pageInfo);
|
|
|
|
|
|
+ @Override
|
|
|
|
+ @SneakyThrows
|
|
|
|
+ public ResponseBodyVO<String> createAutomaticSubProject(SimulationManualProjectParam param) {
|
|
|
|
+ if (StringUtil.isEmpty(param.getId())) {
|
|
|
|
+ throw new RuntimeException("id 不能为空。");
|
|
|
|
+ }
|
|
|
|
+ SimulationAutomaticProjectPo po = simulationAutomaticProjectMapper.selectById(param.getId());
|
|
|
|
+ // 校验项目信息
|
|
|
|
+ projectUtil.checkProject(po.getAlgorithm(), po.getVehicle(), po.getScene());
|
|
|
|
+ // 组装数据
|
|
|
|
+ String projectName = po.getProjectName();
|
|
|
|
+ SimulationAutomaticSubProjectPo subprojectPo = new SimulationAutomaticSubProjectPo();
|
|
|
|
+ subprojectPo.createPo(po.getCreateUserId());
|
|
|
|
+ subprojectPo.setParentId(po.getId());
|
|
|
|
+ subprojectPo.setParentProjectId(po.getProjectId());
|
|
|
|
+ subprojectPo.setProjectName(projectName);
|
|
|
|
+ subprojectPo.setStartTime(new Date());
|
|
|
|
+ subprojectPo.setNowRunState(ProjectRunStateEnum.EXECUTION.getCode());// 执行中
|
|
|
|
+ SimulationAutomaticSubProjectPo sPo = simulationAutomaticSubProjectMapper.selectLastProjectId(param.getId());
|
|
|
|
+ if (StringUtil.isEmpty(sPo)) {
|
|
|
|
+ subprojectPo.setProjectNum(1);
|
|
|
|
+ subprojectPo.setProjectId(po.getProjectId() + "-1");
|
|
|
|
+ } else {
|
|
|
|
+ Integer projectNum = sPo.getProjectNum() + 1;
|
|
|
|
+ subprojectPo.setProjectNum(projectNum);
|
|
|
|
+ subprojectPo.setProjectId(po.getProjectId() + "-" + projectNum);
|
|
|
|
+ }
|
|
|
|
+ // 修改自动运行次数
|
|
|
|
+ Long automaticRunTimes = po.getAutomaticRunTimes();
|
|
|
|
+ if (automaticRunTimes == null) {
|
|
|
|
+ po.setAutomaticRunTimes(1L);
|
|
|
|
+ } else {
|
|
|
|
+ po.setAutomaticRunTimes(automaticRunTimes + 1);
|
|
|
|
+ }
|
|
|
|
+ simulationAutomaticProjectMapper.updateAutomaticRunTimes(po);
|
|
|
|
+ int i = simulationAutomaticSubProjectMapper.addAutomaticSubProject(subprojectPo);
|
|
|
|
+ // 查询详情信息并保存
|
|
|
|
+ String projectId = subprojectPo.getId();
|
|
|
|
+ ProjectDetailsVo info = selectProjectDetailsByIdBackUp(SimulationManualProjectParam.builder().id(projectId).projectType(DictConstants.PROJECT_TYPE_AUTO_SUB).build()).getInfo();
|
|
|
|
+ String infoJson = JsonUtil.beanToJson(info);
|
|
|
|
+ log.info("项目 " + projectId + " 的详情信息为:" + infoJson);
|
|
|
|
+ autoSubProjectMapper.updateDetailsById(projectId, infoJson);
|
|
|
|
+ if (i <= 0) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "执行失败");
|
|
|
|
+ }
|
|
|
|
+ // 推送消息到 kafka
|
|
|
|
+ autoProjectRunToKafka(po, subprojectPo.getId());
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, null);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void autoProjectRunToKafka(SimulationAutomaticProjectPo po, String subId) {
|
|
|
|
+ SimulationManualProjectKafkaParam kafkaParam = new SimulationManualProjectKafkaParam();
|
|
|
|
+ kafkaParam.setProjectId(subId); // 子任务id
|
|
|
|
+ kafkaParam.setAlgorithmId(po.getAlgorithm());
|
|
|
|
+ kafkaParam.setVehicleConfigId(po.getVehicle());
|
|
|
|
+ kafkaParam.setScenePackageId(po.getScene());
|
|
|
|
+ kafkaParam.setMaxSimulationTime(po.getMaxSimulationTime());
|
|
|
|
+ kafkaParam.setParallelism(Integer.valueOf(po.getParallelism()));
|
|
|
|
+ kafkaParam.setType(DictConstants.PROJECT_TYPE_AUTO_SUB);
|
|
|
|
+ KafkaParameter kafkaParameter = new KafkaParameter();
|
|
|
|
+ kafkaParameter.setTopic(ProjectConstants.RUN_TASK_TOPIC);
|
|
|
|
+ kafkaParam.setModelType(vehicleMapper.selectParameterTypeById(po.getVehicle()));
|
|
|
|
+ String data = JsonUtil.beanToJson(kafkaParam);
|
|
|
|
+ kafkaParameter.setData(data);
|
|
|
|
+ log.info("自动运行项目推送消息到 kafka:" + data);
|
|
|
|
+ kafkaTemplate.send(kafkaParameter.getTopic(), kafkaParameter.getData()).addCallback(success -> {
|
|
|
|
+ // 消息发送到的topic
|
|
|
|
+ String topic = success.getRecordMetadata().topic();
|
|
|
|
+ // 消息发送到的分区
|
|
|
|
+ int partition = success.getRecordMetadata().partition();
|
|
|
|
+ // 消息在分区内的offset
|
|
|
|
+ long offset = success.getRecordMetadata().offset();
|
|
|
|
+ log.info("------- 发送消息成功:\n" + "主题 topic 为:" + topic + "\n" + "分区 partition 为:" + partition + "\n" + "偏移量为:" + offset + "\n" + "消息体为:" + kafkaParameter.getData());
|
|
|
|
+ }, failure -> {
|
|
|
|
+ log.error("发送消息失败:" + failure.getMessage());
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<String> deleteAutomaticSubProjectByIds(SimulationManualProjectParam param) {
|
|
|
|
+
|
|
|
|
+ String ids = param.getIds();
|
|
|
|
+ if (isEmpty(ids)) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
+ }
|
|
|
|
+ String[] idArr = ids.split(",");
|
|
|
|
+ // 仅有执行中的不能删除
|
|
|
|
+ List<SimulationAutomaticSubProjectPo> pos = simulationAutomaticSubProjectMapper.selectProjectNowRunState(idArr);
|
|
|
|
+ for (SimulationAutomaticSubProjectPo p : pos) {
|
|
|
|
+ if (ProjectRunStateEnum.EXECUTION.getCode().equals(p.getNowRunState())) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "数据不支持删除");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ int i = simulationAutomaticSubProjectMapper.deleteProject(idArr);
|
|
|
|
+ if (i > 0) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
|
|
|
- @Override
|
|
|
|
- @SneakyThrows
|
|
|
|
- public ResponseBodyVO<String> createAutomaticSubProject(SimulationManualProjectParam param) {
|
|
|
|
- if (StringUtil.isEmpty(param.getId())) {
|
|
|
|
- throw new RuntimeException("id 不能为空。");
|
|
|
|
- }
|
|
|
|
- SimulationAutomaticProjectPo po = simulationAutomaticProjectMapper.selectById(param.getId());
|
|
|
|
- // 校验项目信息
|
|
|
|
- projectUtil.checkProject(po.getAlgorithm(), po.getVehicle(), po.getScene());
|
|
|
|
- // 组装数据
|
|
|
|
- String projectName = po.getProjectName();
|
|
|
|
- SimulationAutomaticSubProjectPo subprojectPo = new SimulationAutomaticSubProjectPo();
|
|
|
|
- subprojectPo.createPo(po.getCreateUserId());
|
|
|
|
- subprojectPo.setParentId(po.getId());
|
|
|
|
- subprojectPo.setParentProjectId(po.getProjectId());
|
|
|
|
- subprojectPo.setProjectName(projectName);
|
|
|
|
- subprojectPo.setStartTime(new Date());
|
|
|
|
- subprojectPo.setNowRunState(ProjectRunStateEnum.EXECUTION.getCode());// 执行中
|
|
|
|
- SimulationAutomaticSubProjectPo sPo = simulationAutomaticSubProjectMapper.selectLastProjectId(param.getId());
|
|
|
|
- if (StringUtil.isEmpty(sPo)) {
|
|
|
|
- subprojectPo.setProjectNum(1);
|
|
|
|
- subprojectPo.setProjectId(po.getProjectId() + "-1");
|
|
|
|
- } else {
|
|
|
|
- Integer projectNum = sPo.getProjectNum() + 1;
|
|
|
|
- subprojectPo.setProjectNum(projectNum);
|
|
|
|
- subprojectPo.setProjectId(po.getProjectId() + "-" + projectNum);
|
|
|
|
- }
|
|
|
|
- // 修改自动运行次数
|
|
|
|
- Long automaticRunTimes = po.getAutomaticRunTimes();
|
|
|
|
- if (automaticRunTimes == null) {
|
|
|
|
- po.setAutomaticRunTimes(1L);
|
|
|
|
- } else {
|
|
|
|
- po.setAutomaticRunTimes(automaticRunTimes + 1);
|
|
|
|
- }
|
|
|
|
- simulationAutomaticProjectMapper.updateAutomaticRunTimes(po);
|
|
|
|
- int i = simulationAutomaticSubProjectMapper.addAutomaticSubProject(subprojectPo);
|
|
|
|
- // 查询详情信息并保存
|
|
|
|
- String projectId = subprojectPo.getId();
|
|
|
|
- ProjectDetailsVo info = selectProjectDetailsByIdBackUp(SimulationManualProjectParam.builder().id(projectId).projectType(DictConstants.PROJECT_TYPE_AUTO_SUB).build()).getInfo();
|
|
|
|
- String infoJson = JsonUtil.beanToJson(info);
|
|
|
|
- log.info("项目 " + projectId + " 的详情信息为:" + infoJson);
|
|
|
|
- autoSubProjectMapper.updateDetailsById(projectId, infoJson);
|
|
|
|
- if (i <= 0) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "执行失败");
|
|
|
|
- }
|
|
|
|
- // 推送消息到 kafka
|
|
|
|
- autoProjectRunToKafka(po, subprojectPo.getId());
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, null);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void autoProjectRunToKafka(SimulationAutomaticProjectPo po, String subId) {
|
|
|
|
- SimulationManualProjectKafkaParam kafkaParam = new SimulationManualProjectKafkaParam();
|
|
|
|
- kafkaParam.setProjectId(subId); // 子任务id
|
|
|
|
- kafkaParam.setAlgorithmId(po.getAlgorithm());
|
|
|
|
- kafkaParam.setVehicleConfigId(po.getVehicle());
|
|
|
|
- kafkaParam.setScenePackageId(po.getScene());
|
|
|
|
- kafkaParam.setMaxSimulationTime(po.getMaxSimulationTime());
|
|
|
|
- kafkaParam.setParallelism(Integer.valueOf(po.getParallelism()));
|
|
|
|
- kafkaParam.setType(DictConstants.PROJECT_TYPE_AUTO_SUB);
|
|
|
|
- KafkaParameter kafkaParameter = new KafkaParameter();
|
|
|
|
- kafkaParameter.setTopic(ProjectConstants.RUN_TASK_TOPIC);
|
|
|
|
- kafkaParam.setModelType(vehicleMapper.selectParameterTypeById(po.getVehicle()));
|
|
|
|
- String data = JsonUtil.beanToJson(kafkaParam);
|
|
|
|
- kafkaParameter.setData(data);
|
|
|
|
- log.info("自动运行项目推送消息到 kafka:" + data);
|
|
|
|
- kafkaTemplate.send(kafkaParameter.getTopic(), kafkaParameter.getData()).addCallback(success -> {
|
|
|
|
- // 消息发送到的topic
|
|
|
|
- String topic = success.getRecordMetadata().topic();
|
|
|
|
- // 消息发送到的分区
|
|
|
|
- int partition = success.getRecordMetadata().partition();
|
|
|
|
- // 消息在分区内的offset
|
|
|
|
- long offset = success.getRecordMetadata().offset();
|
|
|
|
- log.info("------- 发送消息成功:\n" + "主题 topic 为:" + topic + "\n" + "分区 partition 为:" + partition + "\n" + "偏移量为:" + offset + "\n" + "消息体为:" + kafkaParameter.getData());
|
|
|
|
- }, failure -> {
|
|
|
|
- log.error("发送消息失败:" + failure.getMessage());
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<String> deleteAutomaticSubProjectByIds(SimulationManualProjectParam param) {
|
|
|
|
-
|
|
|
|
- String ids = param.getIds();
|
|
|
|
- if (isEmpty(ids)) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE);
|
|
|
|
- }
|
|
|
|
- String[] idArr = ids.split(",");
|
|
|
|
- // 仅有执行中的不能删除
|
|
|
|
- List<SimulationAutomaticSubProjectPo> pos = simulationAutomaticSubProjectMapper.selectProjectNowRunState(idArr);
|
|
|
|
- for (SimulationAutomaticSubProjectPo p : pos) {
|
|
|
|
- if (ProjectRunStateEnum.EXECUTION.getCode().equals(p.getNowRunState())) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "数据不支持删除");
|
|
|
|
- }
|
|
|
|
|
|
+ }
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "删除失败");
|
|
}
|
|
}
|
|
|
|
|
|
- int i = simulationAutomaticSubProjectMapper.deleteProject(idArr);
|
|
|
|
- if (i > 0) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "删除失败");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 自动项目父项目信息
|
|
|
|
- */
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<AutomaticProjectVo> selectSubProjectInfo(SimulationManualProjectParam param) {
|
|
|
|
- /*
|
|
|
|
- * 项目名称、项目描述、算法名称、车辆、传感器、场景、运行周期、并行度、是否选择GPU、最大运行时间
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 自动项目父项目信息
|
|
*/
|
|
*/
|
|
- String id = param.getId();
|
|
|
|
- if (StringUtil.isEmpty(id)) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "id不能为空");
|
|
|
|
- }
|
|
|
|
- AutomaticProjectVo automaticProjectVo = simulationAutomaticProjectMapper.selectAutomaticProjectInfoById(id);
|
|
|
|
- if (StringUtil.isEmpty(automaticProjectVo)) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "没有查询到数据");
|
|
|
|
- }
|
|
|
|
- List<DropDownTypeVo> result = new ArrayList<>();
|
|
|
|
- setVehicleDropDown(result, automaticProjectVo.getVehicle());
|
|
|
|
- DropDownTypeVo dropDownTypeVo = result.get(0);
|
|
|
|
- DropDownVo dropDownVo = dropDownTypeVo.getDropDownList().get(0);
|
|
|
|
- automaticProjectVo.setVehicle(dropDownVo.getName());
|
|
|
|
- automaticProjectVo.setSensor(dropDownVo.getSensor());
|
|
|
|
- String isChoiceGpu = automaticProjectVo.getIsChoiceGpu();
|
|
|
|
- if ("0".equals(isChoiceGpu)) {
|
|
|
|
- isChoiceGpu = "是";
|
|
|
|
- } else if ("1".equals(isChoiceGpu)) {
|
|
|
|
- isChoiceGpu = "否";
|
|
|
|
- } else {
|
|
|
|
- isChoiceGpu = "未知";
|
|
|
|
- }
|
|
|
|
- automaticProjectVo.setIsChoiceGpu(isChoiceGpu);
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<AutomaticProjectVo> selectSubProjectInfo(SimulationManualProjectParam param) {
|
|
|
|
+ /*
|
|
|
|
+ * 项目名称、项目描述、算法名称、车辆、传感器、场景、运行周期、并行度、是否选择GPU、最大运行时间
|
|
|
|
+ */
|
|
|
|
+ String id = param.getId();
|
|
|
|
+ if (StringUtil.isEmpty(id)) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "id不能为空");
|
|
|
|
+ }
|
|
|
|
+ AutomaticProjectVo automaticProjectVo = simulationAutomaticProjectMapper.selectAutomaticProjectInfoById(id);
|
|
|
|
+ if (StringUtil.isEmpty(automaticProjectVo)) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "没有查询到数据");
|
|
|
|
+ }
|
|
|
|
+ List<DropDownTypeVo> result = new ArrayList<>();
|
|
|
|
+ setVehicleDropDown(result, automaticProjectVo.getVehicle());
|
|
|
|
+ DropDownTypeVo dropDownTypeVo = result.get(0);
|
|
|
|
+ DropDownVo dropDownVo = dropDownTypeVo.getDropDownList().get(0);
|
|
|
|
+ automaticProjectVo.setVehicle(dropDownVo.getName());
|
|
|
|
+ automaticProjectVo.setSensor(dropDownVo.getSensor());
|
|
|
|
+ String isChoiceGpu = automaticProjectVo.getIsChoiceGpu();
|
|
|
|
+ if ("0".equals(isChoiceGpu)) {
|
|
|
|
+ isChoiceGpu = "是";
|
|
|
|
+ } else if ("1".equals(isChoiceGpu)) {
|
|
|
|
+ isChoiceGpu = "否";
|
|
|
|
+ } else {
|
|
|
|
+ isChoiceGpu = "未知";
|
|
|
|
+ }
|
|
|
|
+ automaticProjectVo.setIsChoiceGpu(isChoiceGpu);
|
|
|
|
+
|
|
|
|
+ if (ObjectUtil.isNotNull(automaticProjectVo.getAlgorithmArray())) {
|
|
|
|
+ automaticProjectVo.setAlgorithmArrayS(automaticProjectVo.getAlgorithmArray().split(","));
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.isNotNull(automaticProjectVo.getVehicleArray())) {
|
|
|
|
+ automaticProjectVo.setVehicleArrayS(automaticProjectVo.getVehicleArray().split(","));
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.isNotNull(automaticProjectVo.getSceneArray())) {
|
|
|
|
+ automaticProjectVo.setSceneArrayS(automaticProjectVo.getSceneArray().split(","));
|
|
|
|
+ }
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, automaticProjectVo);
|
|
|
|
|
|
- if (ObjectUtil.isNotNull(automaticProjectVo.getAlgorithmArray())) {
|
|
|
|
- automaticProjectVo.setAlgorithmArrayS(automaticProjectVo.getAlgorithmArray().split(","));
|
|
|
|
- }
|
|
|
|
- if (ObjectUtil.isNotNull(automaticProjectVo.getVehicleArray())) {
|
|
|
|
- automaticProjectVo.setVehicleArrayS(automaticProjectVo.getVehicleArray().split(","));
|
|
|
|
- }
|
|
|
|
- if (ObjectUtil.isNotNull(automaticProjectVo.getSceneArray())) {
|
|
|
|
- automaticProjectVo.setSceneArrayS(automaticProjectVo.getSceneArray().split(","));
|
|
|
|
}
|
|
}
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, automaticProjectVo);
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<PageInfo<SimulationManualProjectVo>> selectSubProjectList(SimulationManualProjectParam param) {
|
|
|
|
+
|
|
|
|
+ String id = param.getParentId();
|
|
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<PageInfo<SimulationManualProjectVo>> selectSubProjectList(SimulationManualProjectParam param) {
|
|
|
|
|
|
+ if (isEmpty(id)) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "id不能为空");
|
|
|
|
+ }
|
|
|
|
|
|
- String id = param.getParentId();
|
|
|
|
|
|
+ setPage(param.getCurrentPage() == null ? 1 : param.getCurrentPage(), param.getPageSize() == null ? 10 : param.getPageSize());
|
|
|
|
|
|
- if (isEmpty(id)) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "id不能为空");
|
|
|
|
|
|
+ List<SimulationManualProjectVo> simulationManualProjectVoList = simulationAutomaticSubProjectMapper.selectList(param);
|
|
|
|
+ simulationManualProjectVoList.forEach(simulationManualProjectVo -> {
|
|
|
|
+ simulationManualProjectVo.setNowRunStateDict(getDictName(DictConstants.PROJECT_RUN_STATE, simulationManualProjectVo.getNowRunState()));
|
|
|
|
+ simulationManualProjectVo.setEvaluationLevelDict(getDictName(DictConstants.EVALUATION_LEVEL, simulationManualProjectVo.getEvaluationLevel()));
|
|
|
|
+ });
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, new PageInfo<>(simulationManualProjectVoList));
|
|
}
|
|
}
|
|
|
|
|
|
- setPage(param.getCurrentPage() == null ? 1 : param.getCurrentPage(), param.getPageSize() == null ? 10 : param.getPageSize());
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<SimulationManualProjectSingleVo> selectAutomaticProjectById(SimulationManualProjectParam param) {
|
|
|
|
+
|
|
|
|
+ if (isEmpty(param.getId())) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "id不能为空");
|
|
|
|
+ }
|
|
|
|
+ SimulationAutomaticProjectPo po = simulationAutomaticProjectMapper.selectById(param.getId());
|
|
|
|
+ if (po == null) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "没有获取到数据");
|
|
|
|
+ }
|
|
|
|
+ String deletedName = algorithmMapper.selectDeletedById(po.getAlgorithm());
|
|
|
|
+ if (StringUtil.isNotEmpty(deletedName)) {
|
|
|
|
+ po.setAlgorithm(deletedName + "(已删除)");
|
|
|
|
+ }
|
|
|
|
+ SimulationManualProjectSingleVo vo = new SimulationManualProjectSingleVo();
|
|
|
|
+ convertPoToVo(po, vo);
|
|
|
|
|
|
- List<SimulationManualProjectVo> simulationManualProjectVoList = simulationAutomaticSubProjectMapper.selectList(param);
|
|
|
|
- simulationManualProjectVoList.forEach(simulationManualProjectVo -> {
|
|
|
|
- simulationManualProjectVo.setNowRunStateDict(getDictName(DictConstants.PROJECT_RUN_STATE, simulationManualProjectVo.getNowRunState()));
|
|
|
|
- simulationManualProjectVo.setEvaluationLevelDict(getDictName(DictConstants.EVALUATION_LEVEL, simulationManualProjectVo.getEvaluationLevel()));
|
|
|
|
- });
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, new PageInfo<>(simulationManualProjectVoList));
|
|
|
|
- }
|
|
|
|
|
|
+ if (ObjectUtil.isNotNull(po.getAlgorithmArray())) {
|
|
|
|
+ vo.setAlgorithmArrayS(po.getAlgorithmArray().split(","));
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.isNotNull(po.getVehicleArray())) {
|
|
|
|
+ vo.setVehicleArrayS(po.getVehicleArray().split(","));
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.isNotNull(po.getSceneArray())) {
|
|
|
|
+ vo.setSceneArrayS(po.getSceneArray().split(","));
|
|
|
|
+ }
|
|
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<SimulationManualProjectSingleVo> selectAutomaticProjectById(SimulationManualProjectParam param) {
|
|
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, vo);
|
|
|
|
|
|
- if (isEmpty(param.getId())) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "id不能为空");
|
|
|
|
}
|
|
}
|
|
- SimulationAutomaticProjectPo po = simulationAutomaticProjectMapper.selectById(param.getId());
|
|
|
|
- if (po == null) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "没有获取到数据");
|
|
|
|
- }
|
|
|
|
- String deletedName = algorithmMapper.selectDeletedById(po.getAlgorithm());
|
|
|
|
- if (StringUtil.isNotEmpty(deletedName)) {
|
|
|
|
- po.setAlgorithm(deletedName + "(已删除)");
|
|
|
|
- }
|
|
|
|
- SimulationManualProjectSingleVo vo = new SimulationManualProjectSingleVo();
|
|
|
|
- convertPoToVo(po, vo);
|
|
|
|
|
|
|
|
- if (ObjectUtil.isNotNull(po.getAlgorithmArray())) {
|
|
|
|
- vo.setAlgorithmArrayS(po.getAlgorithmArray().split(","));
|
|
|
|
- }
|
|
|
|
- if (ObjectUtil.isNotNull(po.getVehicleArray())) {
|
|
|
|
- vo.setVehicleArrayS(po.getVehicleArray().split(","));
|
|
|
|
- }
|
|
|
|
- if (ObjectUtil.isNotNull(po.getSceneArray())) {
|
|
|
|
- vo.setSceneArrayS(po.getSceneArray().split(","));
|
|
|
|
- }
|
|
|
|
|
|
+ @SneakyThrows
|
|
|
|
+ @Override
|
|
|
|
+ public ResponseBodyVO<String> updateAutoProjectNowRunState(SimulationManualProjectParam param) {
|
|
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, vo);
|
|
|
|
|
|
+ if (isEmpty(param.getId()) || isEmpty(param.getNowRunState())) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "id或状态值不能为空");
|
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ SimulationAutomaticSubProjectPo po = simulationAutomaticSubProjectMapper.selectById(param);
|
|
|
|
|
|
- @SneakyThrows
|
|
|
|
- @Override
|
|
|
|
- public ResponseBodyVO<String> updateAutoProjectNowRunState(SimulationManualProjectParam param) {
|
|
|
|
|
|
+ if (po == null) {
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "数据没有找到");
|
|
|
|
+ }
|
|
|
|
|
|
- if (isEmpty(param.getId()) || isEmpty(param.getNowRunState())) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.CLIENT_FAILURE, "id或状态值不能为空");
|
|
|
|
- }
|
|
|
|
|
|
+ // 自动运行子项目只能终止
|
|
|
|
+ if (ProjectRunStateEnum.DISCONTINUE.getCode().equals(param.getNowRunState())) {
|
|
|
|
+ int i = simulationAutomaticSubProjectMapper.updateNowRunState(param);
|
|
|
|
+ if (i > 0) {
|
|
|
|
+ // 项目终止,推送到kafka
|
|
|
|
+ autoProjectStopToKafka(po);
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
|
+ }
|
|
|
|
|
|
- SimulationAutomaticSubProjectPo po = simulationAutomaticSubProjectMapper.selectById(param);
|
|
|
|
|
|
+ }
|
|
|
|
|
|
- if (po == null) {
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "数据没有找到");
|
|
|
|
|
|
+ return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "操作失败");
|
|
}
|
|
}
|
|
|
|
|
|
- // 自动运行子项目只能终止
|
|
|
|
- if (ProjectRunStateEnum.DISCONTINUE.getCode().equals(param.getNowRunState())) {
|
|
|
|
- int i = simulationAutomaticSubProjectMapper.updateNowRunState(param);
|
|
|
|
- if (i > 0) {
|
|
|
|
- // 项目终止,推送到kafka
|
|
|
|
- autoProjectStopToKafka(po);
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
|
|
|
|
- }
|
|
|
|
|
|
+ private void convertPoToVo(SimulationAutomaticProjectPo po, SimulationManualProjectSingleVo vo) {
|
|
|
|
+ vo.setId(po.getId());
|
|
|
|
+ vo.setProjectName(po.getProjectName());
|
|
|
|
+ vo.setProjectDescribe(po.getProjectDescribe());
|
|
|
|
+ vo.setAlgorithm(po.getAlgorithm());
|
|
|
|
+ vo.setAlgorithmType(po.getAlgorithmType());
|
|
|
|
+ vo.setVehicle(po.getVehicle());
|
|
|
|
+ vo.setScene(po.getScene());
|
|
|
|
+ vo.setOperationCycle(po.getOperationCycle());
|
|
|
|
+ vo.setParallelism(po.getParallelism());
|
|
|
|
+ vo.setRuleView(po.getRuleView());
|
|
|
|
+ vo.setIsChoiceGpu(po.getIsChoiceGpu());
|
|
|
|
+ vo.setMaxSimulationTime(po.getMaxSimulationTime());
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ private SimulationAutomaticProjectPo convertToSimulationAutomaticProjectPo(SimulationManualProjectParam param) {
|
|
|
|
+ SimulationAutomaticProjectPo po = new SimulationAutomaticProjectPo();
|
|
|
|
+ po.setId(param.getId());
|
|
|
|
+ po.setProjectName(param.getProjectName());
|
|
|
|
+ po.setProjectDescribe(param.getProjectDescribe());
|
|
|
|
+ po.setAlgorithm(param.getAlgorithm());
|
|
|
|
+ po.setVehicle(param.getVehicle());
|
|
|
|
+ po.setScene(param.getScene());
|
|
|
|
+ po.setOperationCycle(param.getOperationCycle());
|
|
|
|
+ po.setMaxSimulationTime(param.getMaxSimulationTime());
|
|
|
|
+ po.setParallelism(param.getParallelism());
|
|
|
|
+ po.setRuleView(param.getRuleView());
|
|
|
|
+ po.setIsChoiceGpu(param.getIsChoiceGpu());
|
|
|
|
+ // po.setNowRunState(param.getNowRunState());
|
|
|
|
+ po.setAutomaticRunState(param.getAutomaticRunState());
|
|
|
|
+ po.setAlgorithmType(param.getAlgorithmType());
|
|
|
|
+
|
|
|
|
+ if (ObjectUtil.isNotNull(param.getVehicleArrayS())) {
|
|
|
|
+ po.setVehicleArray(StringUtils.join(Arrays.asList(param.getVehicleArrayS()), ','));
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.isNotNull(param.getAlgorithmArrayS())) {
|
|
|
|
+ po.setAlgorithmArray(StringUtils.join(Arrays.asList(param.getAlgorithmArrayS()), ','));
|
|
|
|
+ }
|
|
|
|
+ if (ObjectUtil.isNotNull(param.getSceneArrayS())) {
|
|
|
|
+ po.setSceneArray(StringUtils.join(Arrays.asList(param.getSceneArrayS()), ','));
|
|
|
|
+ }
|
|
|
|
+ return po;
|
|
}
|
|
}
|
|
|
|
|
|
- return new ResponseBodyVO<>(ResponseBodyVO.Response.SERVER_FAILURE, "操作失败");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void convertPoToVo(SimulationAutomaticProjectPo po, SimulationManualProjectSingleVo vo) {
|
|
|
|
- vo.setId(po.getId());
|
|
|
|
- vo.setProjectName(po.getProjectName());
|
|
|
|
- vo.setProjectDescribe(po.getProjectDescribe());
|
|
|
|
- vo.setAlgorithm(po.getAlgorithm());
|
|
|
|
- vo.setAlgorithmType(po.getAlgorithmType());
|
|
|
|
- vo.setVehicle(po.getVehicle());
|
|
|
|
- vo.setScene(po.getScene());
|
|
|
|
- vo.setOperationCycle(po.getOperationCycle());
|
|
|
|
- vo.setParallelism(po.getParallelism());
|
|
|
|
- vo.setRuleView(po.getRuleView());
|
|
|
|
- vo.setIsChoiceGpu(po.getIsChoiceGpu());
|
|
|
|
- vo.setMaxSimulationTime(po.getMaxSimulationTime());
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private SimulationAutomaticProjectPo convertToSimulationAutomaticProjectPo(SimulationManualProjectParam param) {
|
|
|
|
- SimulationAutomaticProjectPo po = new SimulationAutomaticProjectPo();
|
|
|
|
- po.setId(param.getId());
|
|
|
|
- po.setProjectName(param.getProjectName());
|
|
|
|
- po.setProjectDescribe(param.getProjectDescribe());
|
|
|
|
- po.setAlgorithm(param.getAlgorithm());
|
|
|
|
- po.setVehicle(param.getVehicle());
|
|
|
|
- po.setScene(param.getScene());
|
|
|
|
- po.setOperationCycle(param.getOperationCycle());
|
|
|
|
- po.setMaxSimulationTime(param.getMaxSimulationTime());
|
|
|
|
- po.setParallelism(param.getParallelism());
|
|
|
|
- po.setRuleView(param.getRuleView());
|
|
|
|
- po.setIsChoiceGpu(param.getIsChoiceGpu());
|
|
|
|
- // po.setNowRunState(param.getNowRunState());
|
|
|
|
- po.setAutomaticRunState(param.getAutomaticRunState());
|
|
|
|
- po.setAlgorithmType(param.getAlgorithmType());
|
|
|
|
-
|
|
|
|
- if (ObjectUtil.isNotNull(param.getVehicleArrayS())) {
|
|
|
|
- po.setVehicleArray(StringUtils.join(Arrays.asList(param.getVehicleArrayS()), ','));
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 换行
|
|
|
|
+ *
|
|
|
|
+ * @param lineNum 换行数量
|
|
|
|
+ * @param document
|
|
|
|
+ */
|
|
|
|
+ private void lineFeed(int lineNum, Document document) throws DocumentException {
|
|
|
|
+ for (int i = 0; i < lineNum; i++) {
|
|
|
|
+ document.add(Chunk.NEWLINE);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (ObjectUtil.isNotNull(param.getAlgorithmArrayS())) {
|
|
|
|
- po.setAlgorithmArray(StringUtils.join(Arrays.asList(param.getAlgorithmArrayS()), ','));
|
|
|
|
|
|
+
|
|
|
|
+ private void setBlankLineSpacing(int lineSpacingIndex, BaseFont font, Document document) throws DocumentException {
|
|
|
|
+ Paragraph elements2 = new Paragraph(lineSpacingIndex, " ", defaultFont(font));
|
|
|
|
+ document.add(elements2);
|
|
}
|
|
}
|
|
- if (ObjectUtil.isNotNull(param.getSceneArrayS())) {
|
|
|
|
- po.setSceneArray(StringUtils.join(Arrays.asList(param.getSceneArrayS()), ','));
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 默认字体
|
|
|
|
+ */
|
|
|
|
+ private Font defaultFont(BaseFont font) {
|
|
|
|
+ return new Font(font, 14);
|
|
}
|
|
}
|
|
- return po;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 换行
|
|
|
|
- *
|
|
|
|
- * @param lineNum 换行数量
|
|
|
|
- * @param document
|
|
|
|
- */
|
|
|
|
- private void lineFeed(int lineNum, Document document) throws DocumentException {
|
|
|
|
- for (int i = 0; i < lineNum; i++) {
|
|
|
|
- document.add(Chunk.NEWLINE);
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加表头
|
|
|
|
+ */
|
|
|
|
+ private void addTitleList(PdfPTable pdfPTable, BaseFont font, String[] titleList) {
|
|
|
|
+ for (String title : titleList) {
|
|
|
|
+ PdfPCell pdfPCell = new PdfPCell(new Paragraph(title, defaultFont(font)));
|
|
|
|
+ pdfPCell.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
|
|
|
+ pdfPCell.setHorizontalAlignment(1);
|
|
|
|
+ pdfPTable.addCell(pdfPCell);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- private void setBlankLineSpacing(int lineSpacingIndex, BaseFont font, Document document) throws DocumentException {
|
|
|
|
- Paragraph elements2 = new Paragraph(lineSpacingIndex, " ", defaultFont(font));
|
|
|
|
- document.add(elements2);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 默认字体
|
|
|
|
- */
|
|
|
|
- private Font defaultFont(BaseFont font) {
|
|
|
|
- return new Font(font, 14);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 添加表头
|
|
|
|
- */
|
|
|
|
- private void addTitleList(PdfPTable pdfPTable, BaseFont font, String[] titleList) {
|
|
|
|
- for (String title : titleList) {
|
|
|
|
- PdfPCell pdfPCell = new PdfPCell(new Paragraph(title, defaultFont(font)));
|
|
|
|
- pdfPCell.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
|
|
|
- pdfPCell.setHorizontalAlignment(1);
|
|
|
|
- pdfPTable.addCell(pdfPCell);
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 水平垂直居中添加表头
|
|
|
|
+ */
|
|
|
|
+ private void addTitleList(PdfPTable table, BaseFont font, String[] titleList, boolean center) {
|
|
|
|
+ if (center) {
|
|
|
|
+ for (String title : titleList) {
|
|
|
|
+ PdfPCell cell = new PdfPCell(new Paragraph(title, defaultFont(font)));
|
|
|
|
+ cell.setFixedHeight(30);
|
|
|
|
+ cell.setUseAscender(true);
|
|
|
|
+ cell.setBackgroundColor(BaseColor.LIGHT_GRAY); // 单元格底色
|
|
|
|
+ cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 水平居中
|
|
|
|
+ cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 垂直居中
|
|
|
|
+ table.addCell(cell);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ for (String title : titleList) {
|
|
|
|
+ PdfPCell cell = new PdfPCell(new Paragraph(title, defaultFont(font)));
|
|
|
|
+ cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
|
|
|
+ cell.setHorizontalAlignment(1);
|
|
|
|
+ table.addCell(cell);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 水平垂直居中添加表头
|
|
|
|
- */
|
|
|
|
- private void addTitleList(PdfPTable table, BaseFont font, String[] titleList, boolean center) {
|
|
|
|
- if (center) {
|
|
|
|
- for (String title : titleList) {
|
|
|
|
- PdfPCell cell = new PdfPCell(new Paragraph(title, defaultFont(font)));
|
|
|
|
- cell.setFixedHeight(30);
|
|
|
|
- cell.setUseAscender(true);
|
|
|
|
- cell.setBackgroundColor(BaseColor.LIGHT_GRAY); // 单元格底色
|
|
|
|
- cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 水平居中
|
|
|
|
- cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 垂直居中
|
|
|
|
- table.addCell(cell);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- for (String title : titleList) {
|
|
|
|
- PdfPCell cell = new PdfPCell(new Paragraph(title, defaultFont(font)));
|
|
|
|
- cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
|
|
|
- cell.setHorizontalAlignment(1);
|
|
|
|
- table.addCell(cell);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 水平垂直居中添加表头
|
|
|
|
+ */
|
|
|
|
+ private void addTitleList(PdfPTable table, BaseFont font, String[] titleList, boolean center, int height) {
|
|
|
|
+ if (center) {
|
|
|
|
+ for (String title : titleList) {
|
|
|
|
+ PdfPCell cell = new PdfPCell(new Paragraph(title, defaultFont(font)));
|
|
|
|
+ cell.setFixedHeight(height);
|
|
|
|
+ cell.setUseAscender(true);
|
|
|
|
+ cell.setBackgroundColor(BaseColor.LIGHT_GRAY); // 单元格底色
|
|
|
|
+ cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 水平居中
|
|
|
|
+ cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 垂直居中
|
|
|
|
+ table.addCell(cell);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ for (String title : titleList) {
|
|
|
|
+ PdfPCell cell = new PdfPCell(new Paragraph(title, defaultFont(font)));
|
|
|
|
+ cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
|
|
|
+ cell.setHorizontalAlignment(1);
|
|
|
|
+ table.addCell(cell);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 水平垂直居中添加表头
|
|
|
|
- */
|
|
|
|
- private void addTitleList(PdfPTable table, BaseFont font, String[] titleList, boolean center, int height) {
|
|
|
|
- if (center) {
|
|
|
|
- for (String title : titleList) {
|
|
|
|
- PdfPCell cell = new PdfPCell(new Paragraph(title, defaultFont(font)));
|
|
|
|
- cell.setFixedHeight(height);
|
|
|
|
- cell.setUseAscender(true);
|
|
|
|
- cell.setBackgroundColor(BaseColor.LIGHT_GRAY); // 单元格底色
|
|
|
|
- cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 水平居中
|
|
|
|
- cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 垂直居中
|
|
|
|
- table.addCell(cell);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- for (String title : titleList) {
|
|
|
|
- PdfPCell cell = new PdfPCell(new Paragraph(title, defaultFont(font)));
|
|
|
|
- cell.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
|
|
|
- cell.setHorizontalAlignment(1);
|
|
|
|
- table.addCell(cell);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加数据
|
|
|
|
+ *
|
|
|
|
+ * @param pdfPTable
|
|
|
|
+ * @param font
|
|
|
|
+ * @param dataList
|
|
|
|
+ */
|
|
|
|
+ private void addDataList(PdfPTable table, BaseFont font, String[] dataList) {
|
|
|
|
+ for (String data : dataList) {
|
|
|
|
+ PdfPCell cell = new PdfPCell(new Paragraph(data, defaultFont(font)));
|
|
|
|
+ table.addCell(cell);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 添加数据
|
|
|
|
- *
|
|
|
|
- * @param pdfPTable
|
|
|
|
- * @param font
|
|
|
|
- * @param dataList
|
|
|
|
- */
|
|
|
|
- private void addDataList(PdfPTable table, BaseFont font, String[] dataList) {
|
|
|
|
- for (String data : dataList) {
|
|
|
|
- PdfPCell cell = new PdfPCell(new Paragraph(data, defaultFont(font)));
|
|
|
|
- table.addCell(cell);
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加数据
|
|
|
|
+ *
|
|
|
|
+ * @param pdfPTable
|
|
|
|
+ * @param font
|
|
|
|
+ * @param dataList
|
|
|
|
+ */
|
|
|
|
+ private void addDataList(PdfPTable table, BaseFont font, String[] dataList, boolean center) {
|
|
|
|
+ if (center) {
|
|
|
|
+ for (String data : dataList) {
|
|
|
|
+ PdfPCell cell = new PdfPCell(new Paragraph(data, defaultFont(font)));
|
|
|
|
+ cell.setUseAscender(true);
|
|
|
|
+ cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 水平居中
|
|
|
|
+ cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 垂直居中
|
|
|
|
+ table.addCell(cell);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ addDataList(table, font, dataList);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 添加数据
|
|
|
|
- *
|
|
|
|
- * @param pdfPTable
|
|
|
|
- * @param font
|
|
|
|
- * @param dataList
|
|
|
|
- */
|
|
|
|
- private void addDataList(PdfPTable table, BaseFont font, String[] dataList, boolean center) {
|
|
|
|
- if (center) {
|
|
|
|
- for (String data : dataList) {
|
|
|
|
- PdfPCell cell = new PdfPCell(new Paragraph(data, defaultFont(font)));
|
|
|
|
- cell.setUseAscender(true);
|
|
|
|
- cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 水平居中
|
|
|
|
- cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 垂直居中
|
|
|
|
- table.addCell(cell);
|
|
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- addDataList(table, font, dataList);
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加数据
|
|
|
|
+ *
|
|
|
|
+ * @param table
|
|
|
|
+ * @param font
|
|
|
|
+ * @param dataList
|
|
|
|
+ */
|
|
|
|
+ private void addDataList(PdfPTable table, BaseFont font, String[] dataList, boolean center, int height) {
|
|
|
|
+ if (center) {
|
|
|
|
+ for (String data : dataList) {
|
|
|
|
+ PdfPCell cell = new PdfPCell(new Paragraph(data, defaultFont(font)));
|
|
|
|
+ cell.setFixedHeight(height);
|
|
|
|
+ cell.setUseAscender(true);
|
|
|
|
+ cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 水平居中
|
|
|
|
+ cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 垂直居中
|
|
|
|
+ table.addCell(cell);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ addDataList(table, font, dataList);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 添加数据
|
|
|
|
- *
|
|
|
|
- * @param pdfPTable
|
|
|
|
- * @param font
|
|
|
|
- * @param dataList
|
|
|
|
- */
|
|
|
|
- private void addDataList(PdfPTable table, BaseFont font, String[] dataList, boolean center, int height) {
|
|
|
|
- if (center) {
|
|
|
|
- for (String data : dataList) {
|
|
|
|
- PdfPCell cell = new PdfPCell(new Paragraph(data, defaultFont(font)));
|
|
|
|
- cell.setFixedHeight(height);
|
|
|
|
|
|
+
|
|
|
|
+ private void addCell(PdfPTable table, PdfPCell cell, boolean center) {
|
|
cell.setUseAscender(true);
|
|
cell.setUseAscender(true);
|
|
cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 水平居中
|
|
cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 水平居中
|
|
cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 垂直居中
|
|
cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 垂直居中
|
|
table.addCell(cell);
|
|
table.addCell(cell);
|
|
- }
|
|
|
|
- } else {
|
|
|
|
- addDataList(table, font, dataList);
|
|
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- private void addCell(PdfPTable table, PdfPCell cell, boolean center) {
|
|
|
|
- cell.setUseAscender(true);
|
|
|
|
- cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 水平居中
|
|
|
|
- cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 垂直居中
|
|
|
|
- table.addCell(cell);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void insertOtherAlgorithm(SimulationManualProjectParam param) {
|
|
|
|
- if (DictConstants.PLATFORM.equals(param.getAlgorithmType())) {
|
|
|
|
- AlgorithmPO po = new AlgorithmPO();
|
|
|
|
- po.setId(param.getAlgorithm());
|
|
|
|
- po.setAlgorithmName(param.getAlgorithmName());
|
|
|
|
- po.setUploadMode(DictConstants.PLATFORM);
|
|
|
|
- po.setIsDeleted("0");
|
|
|
|
- AlgorithmPO po1 = simulationProjectMapper.selectalgorithmByQuery(po);
|
|
|
|
- if (po1 == null) {
|
|
|
|
- simulationProjectMapper.insertOtherAlgorithm(po);
|
|
|
|
- } else {
|
|
|
|
- if (!po1.getAlgorithmName().equals(param.getAlgorithmName())) {
|
|
|
|
- simulationProjectMapper.updateOtherAlgorithm(po);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ private void insertOtherAlgorithm(SimulationManualProjectParam param) {
|
|
|
|
+ if (DictConstants.PLATFORM.equals(param.getAlgorithmType())) {
|
|
|
|
+ AlgorithmPO po = new AlgorithmPO();
|
|
|
|
+ po.setId(param.getAlgorithm());
|
|
|
|
+ po.setAlgorithmName(param.getAlgorithmName());
|
|
|
|
+ po.setUploadMode(DictConstants.PLATFORM);
|
|
|
|
+ po.setIsDeleted("0");
|
|
|
|
+ AlgorithmPO po1 = simulationProjectMapper.selectalgorithmByQuery(po);
|
|
|
|
+ if (po1 == null) {
|
|
|
|
+ simulationProjectMapper.insertOtherAlgorithm(po);
|
|
|
|
+ } else {
|
|
|
|
+ if (!po1.getAlgorithmName().equals(param.getAlgorithmName())) {
|
|
|
|
+ simulationProjectMapper.updateOtherAlgorithm(po);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void projectTaskStart(SimulationAutomaticProjectPo po) {
|
|
|
|
- SimulationManualProjectParam p = new SimulationManualProjectParam();
|
|
|
|
- p.setProjectId(po.getId());
|
|
|
|
- p.setCron(po.getOperationCycle());
|
|
|
|
- ResponseBodyVO<String> start = monitorService.start(p);
|
|
|
|
- boolean status = start.isStatus();
|
|
|
|
- if (!status) {
|
|
|
|
- // 定时任务启动失败,抛出异常
|
|
|
|
- log.info("自动运行项目启动失败:" + po.getId());
|
|
|
|
- throw new RuntimeException("自动运行项目启动失败:" + po.getId());
|
|
|
|
}
|
|
}
|
|
- }
|
|
|
|
-
|
|
|
|
- private void projectTaskStop(SimulationAutomaticProjectPo po) {
|
|
|
|
-
|
|
|
|
- SimulationManualProjectParam p = new SimulationManualProjectParam();
|
|
|
|
- p.setProjectId(po.getId());
|
|
|
|
- // 停止任务
|
|
|
|
- ResponseBodyVO stop = monitorService.stop(p);
|
|
|
|
- // boolean status = stop.isStatus();
|
|
|
|
- // if (!status) {
|
|
|
|
- // //定时任务关闭失败,抛出异常
|
|
|
|
- // log.info("自动运行项目停止失败:" + po.getId());
|
|
|
|
- // throw new RuntimeException("自动运行项目停止失败:" + po.getId());
|
|
|
|
- // }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 获取一级指标得分列表
|
|
|
|
- *
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- private List<AlgorithmScoreVo> getFirstTargetScore(String id) {
|
|
|
|
- // 算法测试得分表
|
|
|
|
- /*
|
|
|
|
- * 汇总测试得分计算方法:(每一项一级指标的测试得分*测试权重)累加
|
|
|
|
- * 得分率计算方法:每一项一级指标的所有场景得分不为0的数量/每一项一级指标的场景数量
|
|
|
|
- * 汇总得分率计算方法:(每一项一级指标的所有场景得分不为0的数量_累加/每一项一级指标的场景数量_累加)换成(得分累加取平均值)
|
|
|
|
- */
|
|
|
|
- // 获取得分表一级指标信息
|
|
|
|
- SimulationMptFirstTargetScorePo simulationMptFirstTargetScorePo = new SimulationMptFirstTargetScorePo();
|
|
|
|
- simulationMptFirstTargetScorePo.setPId(id);
|
|
|
|
- List<SimulationMptFirstTargetScorePo> pos = simulationMptFirstTargetScoreMapper.selectFirstTargetByPid(simulationMptFirstTargetScorePo);
|
|
|
|
- List<AlgorithmScoreVo> algorithmScoreVoList = new ArrayList<>();
|
|
|
|
- if (!isEmpty(pos)) {
|
|
|
|
- // StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
- // 汇总数据初始化
|
|
|
|
- Integer totalSceneNum = 0;
|
|
|
|
- double totalScore = 0D;
|
|
|
|
- double totalScoreRatio = 0D;
|
|
|
|
- Integer totalSceneScoreNum = 0;
|
|
|
|
- for (SimulationMptFirstTargetScorePo v : pos) {
|
|
|
|
- // stringBuilder.append(v.getSublistName()).append("、");
|
|
|
|
- AlgorithmScoreVo algorithmScoreVo = new AlgorithmScoreVo();
|
|
|
|
- algorithmScoreVo.setProjectName(v.getSublistName());
|
|
|
|
- Integer sceneNum = v.getSceneNum();
|
|
|
|
- totalSceneNum += sceneNum;
|
|
|
|
- algorithmScoreVo.setSceneNum(sceneNum);
|
|
|
|
- String weight = v.getWeight();
|
|
|
|
- double weightDouble = Double.parseDouble(weight);
|
|
|
|
- algorithmScoreVo.setWeight(weight);
|
|
|
|
- // 单个二级指标得分
|
|
|
|
- Double score = v.getScore();
|
|
|
|
- totalScore += BigDecimal.valueOf(score).multiply(BigDecimal.valueOf(weightDouble).divide(BigDecimal.valueOf(100))).doubleValue();
|
|
|
|
- algorithmScoreVo.setScore(saveTwoDecimalPlaces(score));
|
|
|
|
- // 获取得分不为 0 的场景数量
|
|
|
|
- Integer scoreNum = getSetScoreNum(v.getSublistId(), id);
|
|
|
|
- totalSceneScoreNum += scoreNum;
|
|
|
|
- double tempScoreRatio = Double.valueOf(scoreNum) / Double.valueOf(sceneNum) * 100;
|
|
|
|
- algorithmScoreVo.setScoreRatio(saveTwoDecimalPlaces(tempScoreRatio));
|
|
|
|
- algorithmScoreVoList.add(algorithmScoreVo);
|
|
|
|
- totalScoreRatio += tempScoreRatio;
|
|
|
|
- }
|
|
|
|
- // 汇总
|
|
|
|
- AlgorithmScoreVo algorithmScoreVo = new AlgorithmScoreVo();
|
|
|
|
- algorithmScoreVo.setProjectName("汇总");
|
|
|
|
- algorithmScoreVo.setSceneNum(totalSceneNum);
|
|
|
|
- // 指标权重总和默认是100%
|
|
|
|
- algorithmScoreVo.setWeight("100");
|
|
|
|
- algorithmScoreVo.setScore(saveTwoDecimalPlaces(totalScore));
|
|
|
|
- totalScoreRatio = Double.valueOf(totalSceneScoreNum) / Double.valueOf(totalSceneNum) * 100;
|
|
|
|
- algorithmScoreVo.setScoreRatio(saveTwoDecimalPlaces(totalScoreRatio));
|
|
|
|
- algorithmScoreVoList.add(algorithmScoreVo);
|
|
|
|
|
|
+
|
|
|
|
+ private void projectTaskStart(SimulationAutomaticProjectPo po) {
|
|
|
|
+ SimulationManualProjectParam p = new SimulationManualProjectParam();
|
|
|
|
+ p.setProjectId(po.getId());
|
|
|
|
+ p.setCron(po.getOperationCycle());
|
|
|
|
+ ResponseBodyVO<String> start = monitorService.start(p);
|
|
|
|
+ boolean status = start.isStatus();
|
|
|
|
+ if (!status) {
|
|
|
|
+ // 定时任务启动失败,抛出异常
|
|
|
|
+ log.info("自动运行项目启动失败:" + po.getId());
|
|
|
|
+ throw new RuntimeException("自动运行项目启动失败:" + po.getId());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
- return algorithmScoreVoList;
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 查询算法下拉列表
|
|
|
|
- *
|
|
|
|
- * @param result
|
|
|
|
- * @param algorithmType 算法类型
|
|
|
|
- */
|
|
|
|
- private void setAlgorithmDropDownNew(List<DropDownTypeNewVo> result, String algorithmType) {
|
|
|
|
- List<Map> treeList = new ArrayList<>();
|
|
|
|
- List<DropDownVo> algorithmListSy = new ArrayList<>();
|
|
|
|
- List<DropDownVo> algorithmListGy = new ArrayList<>();
|
|
|
|
- if (DictConstants.FILE.equals(algorithmType) || DictConstants.GIT.equals(algorithmType)) {
|
|
|
|
- AlgorithmPO algorithmPO = new AlgorithmPO();
|
|
|
|
- algorithmPO.setCreateUserId(AuthUtil.getCurrentUserId()); // 获取当前用户 id
|
|
|
|
- if (StringUtil.isEmpty(algorithmType)) {
|
|
|
|
- algorithmPO.setUploadMode("1");
|
|
|
|
- } else {
|
|
|
|
- algorithmPO.setUploadMode(algorithmType);
|
|
|
|
- }
|
|
|
|
- List<AlgorithmPO> algorithmBaseInfoSyVo = simulationProjectMapper.selectAlgorithmBaseInfoByIdSy(algorithmPO);
|
|
|
|
-
|
|
|
|
- for (AlgorithmPO v : algorithmBaseInfoSyVo) {
|
|
|
|
- DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
- dropDownVo.setId(v.getId());
|
|
|
|
- dropDownVo.setName(v.getAlgorithmName());
|
|
|
|
- dropDownVo.setDescription(v.getDescription());
|
|
|
|
- dropDownVo.setShare(v.getShare());
|
|
|
|
- algorithmListSy.add(dropDownVo);
|
|
|
|
- }
|
|
|
|
- List<AlgorithmPO> algorithmBaseInfoGyVo = simulationProjectMapper.selectAlgorithmBaseInfoByIdGy(algorithmPO);
|
|
|
|
-
|
|
|
|
- for (AlgorithmPO v : algorithmBaseInfoGyVo) {
|
|
|
|
- DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
- dropDownVo.setId(v.getId());
|
|
|
|
- dropDownVo.setName(v.getAlgorithmName());
|
|
|
|
- dropDownVo.setDescription(v.getDescription());
|
|
|
|
- dropDownVo.setShare(v.getShare());
|
|
|
|
- algorithmListGy.add(dropDownVo);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- } else if (DictConstants.PLATFORM.equals(algorithmType)) {
|
|
|
|
- // 第三方算法平台获取(索为)
|
|
|
|
- String sort = "algorithmId-desc";
|
|
|
|
- int page = 1;
|
|
|
|
- int size = 999;// 全部
|
|
|
|
- String urlParam = "&page=" + page + "&size=" + size + "&sort=" + sort;
|
|
|
|
- algorithmListSy = getOtherAlgorithmInfo(urlParam);
|
|
|
|
|
|
+ private void projectTaskStop(SimulationAutomaticProjectPo po) {
|
|
|
|
|
|
|
|
+ SimulationManualProjectParam p = new SimulationManualProjectParam();
|
|
|
|
+ p.setProjectId(po.getId());
|
|
|
|
+ // 停止任务
|
|
|
|
+ ResponseBodyVO stop = monitorService.stop(p);
|
|
|
|
+ // boolean status = stop.isStatus();
|
|
|
|
+ // if (!status) {
|
|
|
|
+ // //定时任务关闭失败,抛出异常
|
|
|
|
+ // log.info("自动运行项目停止失败:" + po.getId());
|
|
|
|
+ // throw new RuntimeException("自动运行项目停止失败:" + po.getId());
|
|
|
|
+ // }
|
|
}
|
|
}
|
|
|
|
|
|
- Map typeMap = new HashMap();
|
|
|
|
- typeMap.put("code", "公有");
|
|
|
|
- typeMap.put("name", "公有");
|
|
|
|
- List<Map> colourList = new LinkedList();
|
|
|
|
- algorithmListGy.forEach(vo -> {
|
|
|
|
- Map colourMap = new HashMap();
|
|
|
|
- colourMap.put("code", vo.getId());
|
|
|
|
- colourMap.put("name", vo.getName());
|
|
|
|
- colourMap.put("vo", vo);
|
|
|
|
- colourList.add(colourMap);
|
|
|
|
- });
|
|
|
|
- typeMap.put("children", colourList);
|
|
|
|
- Map typeMap1 = new HashMap();
|
|
|
|
- typeMap1.put("code", "私有");
|
|
|
|
- typeMap1.put("name", "私有");
|
|
|
|
- List<Map> colourList1 = new LinkedList();
|
|
|
|
- algorithmListSy.forEach(vo -> {
|
|
|
|
- Map colourMap = new HashMap();
|
|
|
|
- colourMap.put("code", vo.getId());
|
|
|
|
- colourMap.put("name", vo.getName());
|
|
|
|
- colourMap.put("vo", vo);
|
|
|
|
- colourList1.add(colourMap);
|
|
|
|
- });
|
|
|
|
- typeMap1.put("children", colourList1);
|
|
|
|
- treeList.add(typeMap);
|
|
|
|
- treeList.add(typeMap1);
|
|
|
|
- /*
|
|
|
|
- * List<DropDownNewVo> listGSy = new ArrayList<>();
|
|
|
|
- * DropDownNewVo dropDownNewSyVo = new DropDownNewVo();
|
|
|
|
- * dropDownNewSyVo.setLabel("私有");
|
|
|
|
- * dropDownNewSyVo.setOptions(algorithmListSy);
|
|
|
|
- * listGSy.add(dropDownNewSyVo);
|
|
|
|
- * DropDownNewVo dropDownNewGyVo = new DropDownNewVo();
|
|
|
|
- * dropDownNewGyVo.setLabel("公有");
|
|
|
|
- * dropDownNewGyVo.setOptions(algorithmListGy);
|
|
|
|
- * listGSy.add(dropDownNewGyVo);
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 获取一级指标得分列表
|
|
|
|
+ *
|
|
|
|
+ * @return
|
|
*/
|
|
*/
|
|
- DropDownTypeNewVo dropDownTypeNewVo = new DropDownTypeNewVo();
|
|
|
|
- dropDownTypeNewVo.setDropDownList(treeList);
|
|
|
|
- dropDownTypeNewVo.setType("1");
|
|
|
|
- result.add(dropDownTypeNewVo);
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void setVehicleDropDownNew(List<DropDownTypeNewVo> result) {
|
|
|
|
- List<Map> treeList = new ArrayList<>();
|
|
|
|
- ConfigPO configPO = new ConfigPO();
|
|
|
|
- configPO.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
|
|
- List<ConfigPO> vehicleBaseInfoSyVo = simulationProjectMapper.selectConfigVehicleSy(configPO);
|
|
|
|
- List<DropDownVo> vehicleSyList = new ArrayList<>();
|
|
|
|
- for (ConfigPO v : vehicleBaseInfoSyVo) {
|
|
|
|
- DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
- dropDownVo.setId(v.getId());
|
|
|
|
- dropDownVo.setName(v.getConfigName());
|
|
|
|
- dropDownVo.setDescription(v.getDescription());
|
|
|
|
- dropDownVo.setShare(v.getShare());
|
|
|
|
- // 获取传感器信息
|
|
|
|
- List<ConfigSensorPO> configSensorVos = simulationProjectMapper.selectConfigSensor(v.getId());
|
|
|
|
- String sensor = "";
|
|
|
|
- if (!isEmpty(configSensorVos) && configSensorVos.get(0) != null) {
|
|
|
|
- StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
- for (ConfigSensorPO cv : configSensorVos) {
|
|
|
|
- stringBuilder.append(cv.getSensorType()).append(",");
|
|
|
|
|
|
+ private List<AlgorithmScoreVo> getFirstTargetScore(String id) {
|
|
|
|
+ // 算法测试得分表
|
|
|
|
+ /*
|
|
|
|
+ * 汇总测试得分计算方法:(每一项一级指标的测试得分*测试权重)累加
|
|
|
|
+ * 得分率计算方法:每一项一级指标的所有场景得分不为0的数量/每一项一级指标的场景数量
|
|
|
|
+ * 汇总得分率计算方法:(每一项一级指标的所有场景得分不为0的数量_累加/每一项一级指标的场景数量_累加)换成(得分累加取平均值)
|
|
|
|
+ */
|
|
|
|
+ // 获取得分表一级指标信息
|
|
|
|
+ SimulationMptFirstTargetScorePo simulationMptFirstTargetScorePo = new SimulationMptFirstTargetScorePo();
|
|
|
|
+ simulationMptFirstTargetScorePo.setPId(id);
|
|
|
|
+ List<SimulationMptFirstTargetScorePo> pos = simulationMptFirstTargetScoreMapper.selectFirstTargetByPid(simulationMptFirstTargetScorePo);
|
|
|
|
+ List<AlgorithmScoreVo> algorithmScoreVoList = new ArrayList<>();
|
|
|
|
+ if (!isEmpty(pos)) {
|
|
|
|
+ // StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
+ // 汇总数据初始化
|
|
|
|
+ Integer totalSceneNum = 0;
|
|
|
|
+ double totalScore = 0D;
|
|
|
|
+ double totalScoreRatio = 0D;
|
|
|
|
+ Integer totalSceneScoreNum = 0;
|
|
|
|
+ for (SimulationMptFirstTargetScorePo v : pos) {
|
|
|
|
+ // stringBuilder.append(v.getSublistName()).append("、");
|
|
|
|
+ AlgorithmScoreVo algorithmScoreVo = new AlgorithmScoreVo();
|
|
|
|
+ algorithmScoreVo.setProjectName(v.getSublistName());
|
|
|
|
+ Integer sceneNum = v.getSceneNum();
|
|
|
|
+ totalSceneNum += sceneNum;
|
|
|
|
+ algorithmScoreVo.setSceneNum(sceneNum);
|
|
|
|
+ String weight = v.getWeight();
|
|
|
|
+ double weightDouble = Double.parseDouble(weight);
|
|
|
|
+ algorithmScoreVo.setWeight(weight);
|
|
|
|
+ // 单个二级指标得分
|
|
|
|
+ Double score = v.getScore();
|
|
|
|
+ totalScore += BigDecimal.valueOf(score).multiply(BigDecimal.valueOf(weightDouble).divide(BigDecimal.valueOf(100))).doubleValue();
|
|
|
|
+ algorithmScoreVo.setScore(saveTwoDecimalPlaces(score));
|
|
|
|
+ // 获取得分不为 0 的场景数量
|
|
|
|
+ Integer scoreNum = getSetScoreNum(v.getSublistId(), id);
|
|
|
|
+ totalSceneScoreNum += scoreNum;
|
|
|
|
+ double tempScoreRatio = Double.valueOf(scoreNum) / Double.valueOf(sceneNum) * 100;
|
|
|
|
+ algorithmScoreVo.setScoreRatio(saveTwoDecimalPlaces(tempScoreRatio));
|
|
|
|
+ algorithmScoreVoList.add(algorithmScoreVo);
|
|
|
|
+ totalScoreRatio += tempScoreRatio;
|
|
|
|
+ }
|
|
|
|
+ // 汇总
|
|
|
|
+ AlgorithmScoreVo algorithmScoreVo = new AlgorithmScoreVo();
|
|
|
|
+ algorithmScoreVo.setProjectName("汇总");
|
|
|
|
+ algorithmScoreVo.setSceneNum(totalSceneNum);
|
|
|
|
+ // 指标权重总和默认是100%
|
|
|
|
+ algorithmScoreVo.setWeight("100");
|
|
|
|
+ algorithmScoreVo.setScore(saveTwoDecimalPlaces(totalScore));
|
|
|
|
+ totalScoreRatio = Double.valueOf(totalSceneScoreNum) / Double.valueOf(totalSceneNum) * 100;
|
|
|
|
+ algorithmScoreVo.setScoreRatio(saveTwoDecimalPlaces(totalScoreRatio));
|
|
|
|
+ algorithmScoreVoList.add(algorithmScoreVo);
|
|
}
|
|
}
|
|
- sensor = stringBuilder.substring(0, stringBuilder.lastIndexOf(","));
|
|
|
|
|
|
|
|
- }
|
|
|
|
- dropDownVo.setSensor(sensor);
|
|
|
|
|
|
+ return algorithmScoreVoList;
|
|
|
|
|
|
- vehicleSyList.add(dropDownVo);
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- List<ConfigPO> vehicleBaseInfoGyVo = simulationProjectMapper.selectConfigVehicleGy(configPO);
|
|
|
|
- List<DropDownVo> vehicleGyList = new ArrayList<>();
|
|
|
|
- for (ConfigPO v : vehicleBaseInfoGyVo) {
|
|
|
|
- DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
- dropDownVo.setId(v.getId());
|
|
|
|
- dropDownVo.setName(v.getConfigName());
|
|
|
|
- dropDownVo.setDescription(v.getDescription());
|
|
|
|
- dropDownVo.setShare(v.getShare());
|
|
|
|
- // 获取传感器信息
|
|
|
|
- List<ConfigSensorPO> configSensorVos = simulationProjectMapper.selectConfigSensor(v.getId());
|
|
|
|
- String sensor = "";
|
|
|
|
- if (!isEmpty(configSensorVos) && configSensorVos.get(0) != null) {
|
|
|
|
- StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
- for (ConfigSensorPO cv : configSensorVos) {
|
|
|
|
- stringBuilder.append(cv.getSensorType()).append(",");
|
|
|
|
- }
|
|
|
|
- sensor = stringBuilder.substring(0, stringBuilder.lastIndexOf(","));
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 查询算法下拉列表
|
|
|
|
+ *
|
|
|
|
+ * @param result
|
|
|
|
+ * @param algorithmType 算法类型
|
|
|
|
+ */
|
|
|
|
+ private void setAlgorithmDropDownNew(List<DropDownTypeNewVo> result, String algorithmType) {
|
|
|
|
+ List<Map> treeList = new ArrayList<>();
|
|
|
|
+ List<DropDownVo> algorithmListSy = new ArrayList<>();
|
|
|
|
+ List<DropDownVo> algorithmListGy = new ArrayList<>();
|
|
|
|
+ if (DictConstants.FILE.equals(algorithmType) || DictConstants.GIT.equals(algorithmType)) {
|
|
|
|
+ AlgorithmPO algorithmPO = new AlgorithmPO();
|
|
|
|
+ algorithmPO.setCreateUserId(AuthUtil.getCurrentUserId()); // 获取当前用户 id
|
|
|
|
+ if (StringUtil.isEmpty(algorithmType)) {
|
|
|
|
+ algorithmPO.setUploadMode("1");
|
|
|
|
+ } else {
|
|
|
|
+ algorithmPO.setUploadMode(algorithmType);
|
|
|
|
+ }
|
|
|
|
+ List<AlgorithmPO> algorithmBaseInfoSyVo = simulationProjectMapper.selectAlgorithmBaseInfoByIdSy(algorithmPO);
|
|
|
|
+
|
|
|
|
+ for (AlgorithmPO v : algorithmBaseInfoSyVo) {
|
|
|
|
+ DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
+ dropDownVo.setId(v.getId());
|
|
|
|
+ dropDownVo.setName(v.getAlgorithmName());
|
|
|
|
+ dropDownVo.setDescription(v.getDescription());
|
|
|
|
+ dropDownVo.setShare(v.getShare());
|
|
|
|
+ algorithmListSy.add(dropDownVo);
|
|
|
|
+ }
|
|
|
|
+ List<AlgorithmPO> algorithmBaseInfoGyVo = simulationProjectMapper.selectAlgorithmBaseInfoByIdGy(algorithmPO);
|
|
|
|
+
|
|
|
|
+ for (AlgorithmPO v : algorithmBaseInfoGyVo) {
|
|
|
|
+ DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
+ dropDownVo.setId(v.getId());
|
|
|
|
+ dropDownVo.setName(v.getAlgorithmName());
|
|
|
|
+ dropDownVo.setDescription(v.getDescription());
|
|
|
|
+ dropDownVo.setShare(v.getShare());
|
|
|
|
+ algorithmListGy.add(dropDownVo);
|
|
|
|
+ }
|
|
|
|
|
|
- }
|
|
|
|
- dropDownVo.setSensor(sensor);
|
|
|
|
|
|
+ } else if (DictConstants.PLATFORM.equals(algorithmType)) {
|
|
|
|
+ // 第三方算法平台获取(索为)
|
|
|
|
+ String sort = "algorithmId-desc";
|
|
|
|
+ int page = 1;
|
|
|
|
+ int size = 999;// 全部
|
|
|
|
+ String urlParam = "&page=" + page + "&size=" + size + "&sort=" + sort;
|
|
|
|
+ algorithmListSy = getOtherAlgorithmInfo(urlParam);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Map typeMap = new HashMap();
|
|
|
|
+ typeMap.put("code", "公有");
|
|
|
|
+ typeMap.put("name", "公有");
|
|
|
|
+ List<Map> colourList = new LinkedList();
|
|
|
|
+ algorithmListGy.forEach(vo -> {
|
|
|
|
+ Map colourMap = new HashMap();
|
|
|
|
+ colourMap.put("code", vo.getId());
|
|
|
|
+ colourMap.put("name", vo.getName());
|
|
|
|
+ colourMap.put("vo", vo);
|
|
|
|
+ colourList.add(colourMap);
|
|
|
|
+ });
|
|
|
|
+ typeMap.put("children", colourList);
|
|
|
|
+ Map typeMap1 = new HashMap();
|
|
|
|
+ typeMap1.put("code", "私有");
|
|
|
|
+ typeMap1.put("name", "私有");
|
|
|
|
+ List<Map> colourList1 = new LinkedList();
|
|
|
|
+ algorithmListSy.forEach(vo -> {
|
|
|
|
+ Map colourMap = new HashMap();
|
|
|
|
+ colourMap.put("code", vo.getId());
|
|
|
|
+ colourMap.put("name", vo.getName());
|
|
|
|
+ colourMap.put("vo", vo);
|
|
|
|
+ colourList1.add(colourMap);
|
|
|
|
+ });
|
|
|
|
+ typeMap1.put("children", colourList1);
|
|
|
|
+ treeList.add(typeMap);
|
|
|
|
+ treeList.add(typeMap1);
|
|
|
|
+ /*
|
|
|
|
+ * List<DropDownNewVo> listGSy = new ArrayList<>();
|
|
|
|
+ * DropDownNewVo dropDownNewSyVo = new DropDownNewVo();
|
|
|
|
+ * dropDownNewSyVo.setLabel("私有");
|
|
|
|
+ * dropDownNewSyVo.setOptions(algorithmListSy);
|
|
|
|
+ * listGSy.add(dropDownNewSyVo);
|
|
|
|
+ * DropDownNewVo dropDownNewGyVo = new DropDownNewVo();
|
|
|
|
+ * dropDownNewGyVo.setLabel("公有");
|
|
|
|
+ * dropDownNewGyVo.setOptions(algorithmListGy);
|
|
|
|
+ * listGSy.add(dropDownNewGyVo);
|
|
|
|
+ */
|
|
|
|
+ DropDownTypeNewVo dropDownTypeNewVo = new DropDownTypeNewVo();
|
|
|
|
+ dropDownTypeNewVo.setDropDownList(treeList);
|
|
|
|
+ dropDownTypeNewVo.setType("1");
|
|
|
|
+ result.add(dropDownTypeNewVo);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setVehicleDropDownNew(List<DropDownTypeNewVo> result) {
|
|
|
|
+ List<Map> treeList = new ArrayList<>();
|
|
|
|
+ ConfigPO configPO = new ConfigPO();
|
|
|
|
+ configPO.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
|
|
+ List<ConfigPO> vehicleBaseInfoSyVo = simulationProjectMapper.selectConfigVehicleSy(configPO);
|
|
|
|
+ List<DropDownVo> vehicleSyList = new ArrayList<>();
|
|
|
|
+ for (ConfigPO v : vehicleBaseInfoSyVo) {
|
|
|
|
+ DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
+ dropDownVo.setId(v.getId());
|
|
|
|
+ dropDownVo.setName(v.getConfigName());
|
|
|
|
+ dropDownVo.setDescription(v.getDescription());
|
|
|
|
+ dropDownVo.setShare(v.getShare());
|
|
|
|
+ // 获取传感器信息
|
|
|
|
+ List<ConfigSensorPO> configSensorVos = simulationProjectMapper.selectConfigSensor(v.getId());
|
|
|
|
+ String sensor = "";
|
|
|
|
+ if (!isEmpty(configSensorVos) && configSensorVos.get(0) != null) {
|
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
+ for (ConfigSensorPO cv : configSensorVos) {
|
|
|
|
+ stringBuilder.append(cv.getSensorType()).append(",");
|
|
|
|
+ }
|
|
|
|
+ sensor = stringBuilder.substring(0, stringBuilder.lastIndexOf(","));
|
|
|
|
|
|
- vehicleGyList.add(dropDownVo);
|
|
|
|
- }
|
|
|
|
- /*
|
|
|
|
- * List<DropDownNewVo> listGSy = new ArrayList<>();
|
|
|
|
- * DropDownNewVo dropDownNewSyVo = new DropDownNewVo();
|
|
|
|
- * dropDownNewSyVo.setLabel("私有");
|
|
|
|
- * dropDownNewSyVo.setOptions(vehicleSyList);
|
|
|
|
- * listGSy.add(dropDownNewSyVo);
|
|
|
|
- * DropDownNewVo dropDownNewGyVo = new DropDownNewVo();
|
|
|
|
- * dropDownNewGyVo.setLabel("公有");
|
|
|
|
- * dropDownNewGyVo.setOptions(vehicleGyList);
|
|
|
|
- * listGSy.add(dropDownNewGyVo);
|
|
|
|
- */
|
|
|
|
- Map typeMap = new HashMap();
|
|
|
|
- typeMap.put("code", "公有");
|
|
|
|
- typeMap.put("name", "公有");
|
|
|
|
- List<Map> colourList = new LinkedList();
|
|
|
|
- vehicleGyList.forEach(vo -> {
|
|
|
|
- Map colourMap = new HashMap();
|
|
|
|
- colourMap.put("code", vo.getId());
|
|
|
|
- colourMap.put("name", vo.getName());
|
|
|
|
- colourMap.put("vo", vo);
|
|
|
|
- colourList.add(colourMap);
|
|
|
|
- });
|
|
|
|
- typeMap.put("children", colourList);
|
|
|
|
- Map typeMap1 = new HashMap();
|
|
|
|
- typeMap1.put("code", "私有");
|
|
|
|
- typeMap1.put("name", "私有");
|
|
|
|
- List<Map> colourList1 = new LinkedList();
|
|
|
|
- vehicleSyList.forEach(vo -> {
|
|
|
|
- Map colourMap = new HashMap();
|
|
|
|
- colourMap.put("code", vo.getId());
|
|
|
|
- colourMap.put("name", vo.getName());
|
|
|
|
- colourMap.put("vo", vo);
|
|
|
|
- colourList1.add(colourMap);
|
|
|
|
- });
|
|
|
|
- typeMap1.put("children", colourList1);
|
|
|
|
- treeList.add(typeMap);
|
|
|
|
- treeList.add(typeMap1);
|
|
|
|
-
|
|
|
|
- DropDownTypeNewVo dropDownTypeNewVo = new DropDownTypeNewVo();
|
|
|
|
- dropDownTypeNewVo.setDropDownList(treeList);
|
|
|
|
- dropDownTypeNewVo.setType("2");
|
|
|
|
- result.add(dropDownTypeNewVo);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- private void setScenePackageDropDownNew(List<DropDownTypeNewVo> result) {
|
|
|
|
- List<Map> treeList = new ArrayList<>();
|
|
|
|
- ScenePackagePO scenePackagePO = new ScenePackagePO();
|
|
|
|
- scenePackagePO.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
|
|
- List<ScenePackagePO> scenePackageBaseSyVo = simulationProjectMapper.selectScenePackageBaseByIdSy(scenePackagePO);
|
|
|
|
- List<DropDownVo> scenePackageSyList = new ArrayList<>();
|
|
|
|
- for (ScenePackagePO v : scenePackageBaseSyVo) {
|
|
|
|
- DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
- dropDownVo.setId(v.getPackageId());
|
|
|
|
- dropDownVo.setName(v.getPackageName());
|
|
|
|
- dropDownVo.setSceneNum(String.valueOf(v.getSceneNum()));
|
|
|
|
- dropDownVo.setShare(v.getShare());
|
|
|
|
- scenePackageSyList.add(dropDownVo);
|
|
|
|
- }
|
|
|
|
- List<ScenePackagePO> scenePackageBaseGyVo = simulationProjectMapper.selectScenePackageBaseByIdGy(scenePackagePO);
|
|
|
|
- List<DropDownVo> scenePackageGyList = new ArrayList<>();
|
|
|
|
- for (ScenePackagePO v : scenePackageBaseGyVo) {
|
|
|
|
- DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
- dropDownVo.setId(v.getPackageId());
|
|
|
|
- dropDownVo.setName(v.getPackageName());
|
|
|
|
- dropDownVo.setSceneNum(String.valueOf(v.getSceneNum()));
|
|
|
|
- dropDownVo.setShare(v.getShare());
|
|
|
|
- scenePackageGyList.add(dropDownVo);
|
|
|
|
|
|
+ }
|
|
|
|
+ dropDownVo.setSensor(sensor);
|
|
|
|
+
|
|
|
|
+ vehicleSyList.add(dropDownVo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ List<ConfigPO> vehicleBaseInfoGyVo = simulationProjectMapper.selectConfigVehicleGy(configPO);
|
|
|
|
+ List<DropDownVo> vehicleGyList = new ArrayList<>();
|
|
|
|
+ for (ConfigPO v : vehicleBaseInfoGyVo) {
|
|
|
|
+ DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
+ dropDownVo.setId(v.getId());
|
|
|
|
+ dropDownVo.setName(v.getConfigName());
|
|
|
|
+ dropDownVo.setDescription(v.getDescription());
|
|
|
|
+ dropDownVo.setShare(v.getShare());
|
|
|
|
+ // 获取传感器信息
|
|
|
|
+ List<ConfigSensorPO> configSensorVos = simulationProjectMapper.selectConfigSensor(v.getId());
|
|
|
|
+ String sensor = "";
|
|
|
|
+ if (!isEmpty(configSensorVos) && configSensorVos.get(0) != null) {
|
|
|
|
+ StringBuilder stringBuilder = new StringBuilder();
|
|
|
|
+ for (ConfigSensorPO cv : configSensorVos) {
|
|
|
|
+ stringBuilder.append(cv.getSensorType()).append(",");
|
|
|
|
+ }
|
|
|
|
+ sensor = stringBuilder.substring(0, stringBuilder.lastIndexOf(","));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ dropDownVo.setSensor(sensor);
|
|
|
|
+
|
|
|
|
+ vehicleGyList.add(dropDownVo);
|
|
|
|
+ }
|
|
|
|
+ /*
|
|
|
|
+ * List<DropDownNewVo> listGSy = new ArrayList<>();
|
|
|
|
+ * DropDownNewVo dropDownNewSyVo = new DropDownNewVo();
|
|
|
|
+ * dropDownNewSyVo.setLabel("私有");
|
|
|
|
+ * dropDownNewSyVo.setOptions(vehicleSyList);
|
|
|
|
+ * listGSy.add(dropDownNewSyVo);
|
|
|
|
+ * DropDownNewVo dropDownNewGyVo = new DropDownNewVo();
|
|
|
|
+ * dropDownNewGyVo.setLabel("公有");
|
|
|
|
+ * dropDownNewGyVo.setOptions(vehicleGyList);
|
|
|
|
+ * listGSy.add(dropDownNewGyVo);
|
|
|
|
+ */
|
|
|
|
+ Map typeMap = new HashMap();
|
|
|
|
+ typeMap.put("code", "公有");
|
|
|
|
+ typeMap.put("name", "公有");
|
|
|
|
+ List<Map> colourList = new LinkedList();
|
|
|
|
+ vehicleGyList.forEach(vo -> {
|
|
|
|
+ Map colourMap = new HashMap();
|
|
|
|
+ colourMap.put("code", vo.getId());
|
|
|
|
+ colourMap.put("name", vo.getName());
|
|
|
|
+ colourMap.put("vo", vo);
|
|
|
|
+ colourList.add(colourMap);
|
|
|
|
+ });
|
|
|
|
+ typeMap.put("children", colourList);
|
|
|
|
+ Map typeMap1 = new HashMap();
|
|
|
|
+ typeMap1.put("code", "私有");
|
|
|
|
+ typeMap1.put("name", "私有");
|
|
|
|
+ List<Map> colourList1 = new LinkedList();
|
|
|
|
+ vehicleSyList.forEach(vo -> {
|
|
|
|
+ Map colourMap = new HashMap();
|
|
|
|
+ colourMap.put("code", vo.getId());
|
|
|
|
+ colourMap.put("name", vo.getName());
|
|
|
|
+ colourMap.put("vo", vo);
|
|
|
|
+ colourList1.add(colourMap);
|
|
|
|
+ });
|
|
|
|
+ typeMap1.put("children", colourList1);
|
|
|
|
+ treeList.add(typeMap);
|
|
|
|
+ treeList.add(typeMap1);
|
|
|
|
+
|
|
|
|
+ DropDownTypeNewVo dropDownTypeNewVo = new DropDownTypeNewVo();
|
|
|
|
+ dropDownTypeNewVo.setDropDownList(treeList);
|
|
|
|
+ dropDownTypeNewVo.setType("2");
|
|
|
|
+ result.add(dropDownTypeNewVo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void setScenePackageDropDownNew(List<DropDownTypeNewVo> result) {
|
|
|
|
+ List<Map> treeList = new ArrayList<>();
|
|
|
|
+ ScenePackagePO scenePackagePO = new ScenePackagePO();
|
|
|
|
+ scenePackagePO.setCreateUserId(AuthUtil.getCurrentUserId());
|
|
|
|
+ List<ScenePackagePO> scenePackageBaseSyVo = simulationProjectMapper.selectScenePackageBaseByIdSy(scenePackagePO);
|
|
|
|
+ List<DropDownVo> scenePackageSyList = new ArrayList<>();
|
|
|
|
+ for (ScenePackagePO v : scenePackageBaseSyVo) {
|
|
|
|
+ DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
+ dropDownVo.setId(v.getPackageId());
|
|
|
|
+ dropDownVo.setName(v.getPackageName());
|
|
|
|
+ dropDownVo.setSceneNum(String.valueOf(v.getSceneNum()));
|
|
|
|
+ dropDownVo.setShare(v.getShare());
|
|
|
|
+ scenePackageSyList.add(dropDownVo);
|
|
|
|
+ }
|
|
|
|
+ List<ScenePackagePO> scenePackageBaseGyVo = simulationProjectMapper.selectScenePackageBaseByIdGy(scenePackagePO);
|
|
|
|
+ List<DropDownVo> scenePackageGyList = new ArrayList<>();
|
|
|
|
+ for (ScenePackagePO v : scenePackageBaseGyVo) {
|
|
|
|
+ DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
+ dropDownVo.setId(v.getPackageId());
|
|
|
|
+ dropDownVo.setName(v.getPackageName());
|
|
|
|
+ dropDownVo.setSceneNum(String.valueOf(v.getSceneNum()));
|
|
|
|
+ dropDownVo.setShare(v.getShare());
|
|
|
|
+ scenePackageGyList.add(dropDownVo);
|
|
|
|
+ }
|
|
|
|
+ Map typeMap = new HashMap();
|
|
|
|
+ typeMap.put("code", "公有");
|
|
|
|
+ typeMap.put("name", "公有");
|
|
|
|
+ List<Map> colourList = new LinkedList();
|
|
|
|
+ scenePackageGyList.forEach(vo -> {
|
|
|
|
+ Map colourMap = new HashMap();
|
|
|
|
+ colourMap.put("code", vo.getId());
|
|
|
|
+ colourMap.put("name", vo.getName());
|
|
|
|
+ colourMap.put("vo", vo);
|
|
|
|
+ colourList.add(colourMap);
|
|
|
|
+ });
|
|
|
|
+ typeMap.put("children", colourList);
|
|
|
|
+ Map typeMap1 = new HashMap();
|
|
|
|
+ typeMap1.put("code", "私有");
|
|
|
|
+ typeMap1.put("name", "私有");
|
|
|
|
+ List<Map> colourList1 = new LinkedList();
|
|
|
|
+ scenePackageSyList.forEach(vo -> {
|
|
|
|
+ Map colourMap = new HashMap();
|
|
|
|
+ colourMap.put("code", vo.getId());
|
|
|
|
+ colourMap.put("name", vo.getName());
|
|
|
|
+ colourMap.put("vo", vo);
|
|
|
|
+ colourList1.add(colourMap);
|
|
|
|
+ });
|
|
|
|
+ typeMap1.put("children", colourList1);
|
|
|
|
+ treeList.add(typeMap);
|
|
|
|
+ treeList.add(typeMap1);
|
|
|
|
+ DropDownTypeNewVo dropDownTypeNewVo = new DropDownTypeNewVo();
|
|
|
|
+ dropDownTypeNewVo.setDropDownList(treeList);
|
|
|
|
+ dropDownTypeNewVo.setType("3");
|
|
|
|
+ result.add(dropDownTypeNewVo);
|
|
}
|
|
}
|
|
- Map typeMap = new HashMap();
|
|
|
|
- typeMap.put("code", "公有");
|
|
|
|
- typeMap.put("name", "公有");
|
|
|
|
- List<Map> colourList = new LinkedList();
|
|
|
|
- scenePackageGyList.forEach(vo -> {
|
|
|
|
- Map colourMap = new HashMap();
|
|
|
|
- colourMap.put("code", vo.getId());
|
|
|
|
- colourMap.put("name", vo.getName());
|
|
|
|
- colourMap.put("vo", vo);
|
|
|
|
- colourList.add(colourMap);
|
|
|
|
- });
|
|
|
|
- typeMap.put("children", colourList);
|
|
|
|
- Map typeMap1 = new HashMap();
|
|
|
|
- typeMap1.put("code", "私有");
|
|
|
|
- typeMap1.put("name", "私有");
|
|
|
|
- List<Map> colourList1 = new LinkedList();
|
|
|
|
- scenePackageSyList.forEach(vo -> {
|
|
|
|
- Map colourMap = new HashMap();
|
|
|
|
- colourMap.put("code", vo.getId());
|
|
|
|
- colourMap.put("name", vo.getName());
|
|
|
|
- colourMap.put("vo", vo);
|
|
|
|
- colourList1.add(colourMap);
|
|
|
|
- });
|
|
|
|
- typeMap1.put("children", colourList1);
|
|
|
|
- treeList.add(typeMap);
|
|
|
|
- treeList.add(typeMap1);
|
|
|
|
- DropDownTypeNewVo dropDownTypeNewVo = new DropDownTypeNewVo();
|
|
|
|
- dropDownTypeNewVo.setDropDownList(treeList);
|
|
|
|
- dropDownTypeNewVo.setType("3");
|
|
|
|
- result.add(dropDownTypeNewVo);
|
|
|
|
- }
|
|
|
|
|
|
|
|
}
|
|
}
|