|
@@ -15,15 +15,16 @@ import api.common.pojo.po.model.ConfigSensorPO;
|
|
import api.common.pojo.po.model.VehiclePO;
|
|
import api.common.pojo.po.model.VehiclePO;
|
|
import api.common.pojo.po.project.*;
|
|
import api.common.pojo.po.project.*;
|
|
import api.common.pojo.po.scene.ScenePackagePO;
|
|
import api.common.pojo.po.scene.ScenePackagePO;
|
|
-import api.common.pojo.po.scene.ScenePackageSublistPO;
|
|
|
|
|
|
+import api.common.pojo.vo.algorithm.AlgorithmVO;
|
|
import api.common.pojo.vo.project.*;
|
|
import api.common.pojo.vo.project.*;
|
|
import api.common.pojo.vo.scene.RunProjectVO;
|
|
import api.common.pojo.vo.scene.RunProjectVO;
|
|
import api.common.util.JsonUtil;
|
|
import api.common.util.JsonUtil;
|
|
import api.common.util.ObjectUtil;
|
|
import api.common.util.ObjectUtil;
|
|
|
|
+import api.common.util.StringUtil;
|
|
import api.common.util.TimeUtil;
|
|
import api.common.util.TimeUtil;
|
|
-import com.alibaba.druid.support.spring.stat.SpringStatUtils;
|
|
|
|
import com.css.simulation.resource.common.utils.AuthUtil;
|
|
import com.css.simulation.resource.common.utils.AuthUtil;
|
|
import com.css.simulation.resource.common.utils.PageUtil;
|
|
import com.css.simulation.resource.common.utils.PageUtil;
|
|
|
|
+import com.css.simulation.resource.feign.AlgoPlatformService;
|
|
import com.css.simulation.resource.project.constants.ProjectConstants;
|
|
import com.css.simulation.resource.project.constants.ProjectConstants;
|
|
import com.css.simulation.resource.project.enums.ProjectRunStateEnum;
|
|
import com.css.simulation.resource.project.enums.ProjectRunStateEnum;
|
|
import com.css.simulation.resource.project.enums.SceneTypeEnum;
|
|
import com.css.simulation.resource.project.enums.SceneTypeEnum;
|
|
@@ -36,19 +37,31 @@ import com.css.simulation.resource.project.service.SimulationProjectService;
|
|
import com.css.simulation.resource.system.service.DictService;
|
|
import com.css.simulation.resource.system.service.DictService;
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
+import com.itextpdf.text.*;
|
|
|
|
+import com.itextpdf.text.pdf.BaseFont;
|
|
|
|
+import com.itextpdf.text.pdf.PdfPCell;
|
|
|
|
+import com.itextpdf.text.pdf.PdfPTable;
|
|
|
|
+import com.itextpdf.text.pdf.PdfWriter;
|
|
import lombok.SneakyThrows;
|
|
import lombok.SneakyThrows;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.http.server.ServletServerHttpRequest;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.web.context.request.RequestContextHolder;
|
|
|
|
+import org.springframework.web.context.request.ServletRequestAttributes;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
import java.io.*;
|
|
import java.io.*;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
|
|
+import java.net.URLEncoder;
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
+import java.util.List;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@Slf4j
|
|
@Slf4j
|
|
@@ -72,6 +85,9 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
@Autowired
|
|
@Autowired
|
|
DictService dictService;
|
|
DictService dictService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ AlgoPlatformService algoPlatformService;
|
|
|
|
+
|
|
private String[] dateFmtArr= new String[]{"yyyyMMdd", "yyyy-MM-dd HH:mm:ss","yyyy-MM-dd"};
|
|
private String[] dateFmtArr= new String[]{"yyyyMMdd", "yyyy-MM-dd HH:mm:ss","yyyy-MM-dd"};
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -239,12 +255,9 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
//设置开始时间
|
|
//设置开始时间
|
|
param.setStartTime(new Date());
|
|
param.setStartTime(new Date());
|
|
|
|
|
|
- //创建项目最后一级指标信息和场景信息(生成得分时创建数据)
|
|
|
|
-// createProjectSceneAndTarget(param.getId());
|
|
|
|
- ///TODO Kafka推送消息
|
|
|
|
|
|
+ //Kafka推送消息
|
|
projectRunToKafka(po);
|
|
projectRunToKafka(po);
|
|
|
|
|
|
-
|
|
|
|
}else if("30".equals(param.getNowRunState())){
|
|
}else if("30".equals(param.getNowRunState())){
|
|
//设置完成时间
|
|
//设置完成时间
|
|
param.setFinishTime(new Date());
|
|
param.setFinishTime(new Date());
|
|
@@ -283,8 +296,6 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
}
|
|
}
|
|
ProjectDetailsVo projectDetailsVo = new ProjectDetailsVo();
|
|
ProjectDetailsVo projectDetailsVo = new ProjectDetailsVo();
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
//项目基本信息
|
|
//项目基本信息
|
|
SimulationManualProjectPo po = simulationProjectMapper.selectProjectById(param);
|
|
SimulationManualProjectPo po = simulationProjectMapper.selectProjectById(param);
|
|
if(po == null){
|
|
if(po == null){
|
|
@@ -352,44 +363,20 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
//任务信息
|
|
//任务信息
|
|
ProjectTaskParam projectTaskParam = new ProjectTaskParam();
|
|
ProjectTaskParam projectTaskParam = new ProjectTaskParam();
|
|
projectTaskParam.setPId(po.getId());
|
|
projectTaskParam.setPId(po.getId());
|
|
-// List<ManualProjectTaskPo> manualProjectTaskPos = simulationProjectMapper.selectprojectTaskByQuery(projectTaskParam);
|
|
|
|
-// List<ManualProjectTaskVo> ManualProjectTaskVoList = new ArrayList<>();
|
|
|
|
- List<ProjectRunStateNumVo> projectRunStateNumVoList = new ArrayList<>();
|
|
|
|
- List<ProjectRunResultRatioNumVo> projectRunResultRatioNumVoList = new ArrayList<>();
|
|
|
|
-// if(manualProjectTaskPos != null){
|
|
|
|
-// for(ManualProjectTaskPo task : manualProjectTaskPos){
|
|
|
|
-// ManualProjectTaskVo manualProjectTaskVo = convertManualProjectTaskPoToVo(task);
|
|
|
|
-// setUpSceneInfo(manualProjectTaskVo);
|
|
|
|
-// ManualProjectTaskVoList.add(manualProjectTaskVo);
|
|
|
|
-// }
|
|
|
|
-
|
|
|
|
- //任务运行状态统计
|
|
|
|
- Integer size = simulationProjectTaskMapper.selectProjectTaskNumByProjectId(projectTaskParam);
|
|
|
|
-// List<ProjectRunStateNumVo> projectRunStateNumVos = simulationProjectMapper.selectRunStateCount(po.getId());
|
|
|
|
- projectRunStateNumVoList = simulationProjectTaskMapper.selectRunStateCount(po.getId());
|
|
|
|
-
|
|
|
|
- /*状态统计统计数字,不统计比率
|
|
|
|
- for(ProjectRunStateNumVo pv : projectRunStateNumVos){
|
|
|
|
- Integer num = pv.getNum();
|
|
|
|
- Double d = (double)num/size;
|
|
|
|
- d = saveTwoDecimalPlaces(d);
|
|
|
|
- pv.setRatio(d);
|
|
|
|
- projectRunStateNumVoList.add(pv);
|
|
|
|
- }*/
|
|
|
|
|
|
+ List<ProjectRunResultRatioNumVo> projectRunResultRatioNumVos = null;
|
|
|
|
|
|
- //结果状态统计
|
|
|
|
- List<ProjectRunResultRatioNumVo> projectRunResultRatioNumVos = simulationProjectTaskMapper.selectRunResultCount(po.getId());
|
|
|
|
- for(ProjectRunResultRatioNumVo rv : projectRunResultRatioNumVos){
|
|
|
|
- Integer num = rv.getNum();
|
|
|
|
- Double d = (double)num/size;
|
|
|
|
- d = saveTwoDecimalPlaces(d);
|
|
|
|
- rv.setRatio(d);
|
|
|
|
- projectRunResultRatioNumVoList.add(rv);
|
|
|
|
- }
|
|
|
|
|
|
+ //任务运行状态统计
|
|
|
|
+ List<ProjectRunStateNumVo> projectRunStateNumVos = null;
|
|
|
|
+ Integer size = simulationProjectTaskMapper.selectProjectTaskNumByProjectId(projectTaskParam);
|
|
|
|
+ if(size > 0){
|
|
|
|
+ projectRunStateNumVos = simulationProjectTaskMapper.selectRunStateCount(po.getId());
|
|
|
|
+ taskRunState(projectRunStateNumVos, size);
|
|
|
|
|
|
-// }
|
|
|
|
|
|
|
|
|
|
+ projectRunResultRatioNumVos = simulationProjectTaskMapper.selectRunResultCount(po.getId());
|
|
|
|
+ taskResultState(projectRunResultRatioNumVos, size);
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
projectDetailsVo.setProjectId(po.getProjectId());
|
|
projectDetailsVo.setProjectId(po.getProjectId());
|
|
projectDetailsVo.setProjectName(po.getProjectName());
|
|
projectDetailsVo.setProjectName(po.getProjectName());
|
|
@@ -415,13 +402,68 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
projectDetailsVo.setSensorLidarList(sensorLidarList);
|
|
projectDetailsVo.setSensorLidarList(sensorLidarList);
|
|
projectDetailsVo.setSensorRadarList(sensorRadarList);
|
|
projectDetailsVo.setSensorRadarList(sensorRadarList);
|
|
projectDetailsVo.setSensorGpsList(sensorGpsList);
|
|
projectDetailsVo.setSensorGpsList(sensorGpsList);
|
|
-// projectDetailsVo.setTaskList(ManualProjectTaskVoList);
|
|
|
|
- projectDetailsVo.setStateList(projectRunStateNumVoList);
|
|
|
|
- projectDetailsVo.setResultList(projectRunResultRatioNumVoList);
|
|
|
|
|
|
+ projectDetailsVo.setStateList(projectRunStateNumVos);
|
|
|
|
+ projectDetailsVo.setResultList(projectRunResultRatioNumVos);
|
|
|
|
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, projectDetailsVo);
|
|
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);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //运行结果统计
|
|
|
|
+ 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(pv.getResultName().equals(dict.get(key))){
|
|
|
|
+ b = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(!b){
|
|
|
|
+ ProjectRunResultRatioNumVo vo = new ProjectRunResultRatioNumVo();
|
|
|
|
+ vo.setResultName(dict.get(key));
|
|
|
|
+ vo.setNum(0);
|
|
|
|
+ vo.setRatio(0D);
|
|
|
|
+ vos.add(vo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
private void setVehicleConfig(SensorBaseInfoVo vo, ConfigSensorPO vs){
|
|
private void setVehicleConfig(SensorBaseInfoVo vo, ConfigSensorPO vs){
|
|
vo.setConfigId(vs.getConfigId());
|
|
vo.setConfigId(vs.getConfigId());
|
|
vo.setSensorId(vs.getSensorId());
|
|
vo.setSensorId(vs.getSensorId());
|
|
@@ -568,11 +610,11 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
List<DropDownTypeVo> result = new ArrayList<>();
|
|
List<DropDownTypeVo> result = new ArrayList<>();
|
|
if(isEmpty(param.getDropDownType())){
|
|
if(isEmpty(param.getDropDownType())){
|
|
//获取全部(算法,车辆,场景)
|
|
//获取全部(算法,车辆,场景)
|
|
- setAlgorithmDropDown(result);
|
|
|
|
|
|
+ setAlgorithmDropDown(result,param.getAlgorithmType());
|
|
setVehicleDropDown(result);
|
|
setVehicleDropDown(result);
|
|
setScenePackageDropDown(result);
|
|
setScenePackageDropDown(result);
|
|
}else if("1".equals(param.getDropDownType())){
|
|
}else if("1".equals(param.getDropDownType())){
|
|
- setAlgorithmDropDown(result);
|
|
|
|
|
|
+ setAlgorithmDropDown(result,param.getAlgorithmType());
|
|
}else if("2".equals(param.getDropDownType())){
|
|
}else if("2".equals(param.getDropDownType())){
|
|
setVehicleDropDown(result);
|
|
setVehicleDropDown(result);
|
|
}else if("3".equals(param.getDropDownType())){
|
|
}else if("3".equals(param.getDropDownType())){
|
|
@@ -646,14 +688,23 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public String getDictName(String type, String code) {
|
|
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 dictParam = new DictParam();
|
|
dictParam.setDictTypes(type);
|
|
dictParam.setDictTypes(type);
|
|
Map<String, Map<String, String>> dictMapsByTypes = dictService.getDictMapsByTypes(dictParam);
|
|
Map<String, Map<String, String>> dictMapsByTypes = dictService.getDictMapsByTypes(dictParam);
|
|
Map<String, String> stringStringMap = dictMapsByTypes.get(type);
|
|
Map<String, String> stringStringMap = dictMapsByTypes.get(type);
|
|
if(stringStringMap != null && stringStringMap.size() > 0){
|
|
if(stringStringMap != null && stringStringMap.size() > 0){
|
|
- return stringStringMap.get(code);
|
|
|
|
|
|
+ return stringStringMap;
|
|
}
|
|
}
|
|
- return "";
|
|
|
|
|
|
+ return null;
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -735,19 +786,50 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- private void setAlgorithmDropDown(List<DropDownTypeVo> result){
|
|
|
|
- List<AlgorithmPO> algorithmBaseInfoVo = simulationProjectMapper.selectAlgorithmBaseInfoById(null);
|
|
|
|
|
|
+ private void setAlgorithmDropDown(List<DropDownTypeVo> result, String algorithmType){
|
|
|
|
+
|
|
List<DropDownVo> algorithmList = new ArrayList<>();
|
|
List<DropDownVo> algorithmList = new ArrayList<>();
|
|
- for(AlgorithmPO v : algorithmBaseInfoVo){
|
|
|
|
- DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
- dropDownVo.setId(v.getId());
|
|
|
|
- dropDownVo.setName(v.getAlgorithmName());
|
|
|
|
- algorithmList.add(dropDownVo);
|
|
|
|
|
|
+
|
|
|
|
+ if(algorithmType.equals(ProjectConstants.SY_ALGORITHM_TYPE)){
|
|
|
|
+ //第三方算法平台获取(索为)
|
|
|
|
+ String sort = "algorithmId-desc";
|
|
|
|
+ Integer page = 1;
|
|
|
|
+ Integer size = 999;//全部
|
|
|
|
+
|
|
|
|
+ String urlParam = "&page=" + page+ "&size=" + size+ "&sort=" + sort;
|
|
|
|
+ ResponseBodyVO algorithmBody = algoPlatformService.getAlgorithmList(urlParam);
|
|
|
|
+
|
|
|
|
+ //解析数据
|
|
|
|
+ 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"));
|
|
|
|
+ algorithmList.add(dropDownVo);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }else{
|
|
|
|
+ List<AlgorithmPO> algorithmBaseInfoVo = simulationProjectMapper.selectAlgorithmBaseInfoById(null);
|
|
|
|
+
|
|
|
|
+ for(AlgorithmPO v : algorithmBaseInfoVo){
|
|
|
|
+ DropDownVo dropDownVo = new DropDownVo();
|
|
|
|
+ dropDownVo.setId(v.getId());
|
|
|
|
+ dropDownVo.setName(v.getAlgorithmName());
|
|
|
|
+ algorithmList.add(dropDownVo);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
DropDownTypeVo algorithmDropDown = new DropDownTypeVo();
|
|
DropDownTypeVo algorithmDropDown = new DropDownTypeVo();
|
|
algorithmDropDown.setDropDownList(algorithmList);
|
|
algorithmDropDown.setDropDownList(algorithmList);
|
|
algorithmDropDown.setType("1");
|
|
algorithmDropDown.setType("1");
|
|
result.add(algorithmDropDown);
|
|
result.add(algorithmDropDown);
|
|
|
|
+
|
|
}
|
|
}
|
|
private void setVehicleDropDown(List<DropDownTypeVo> result){
|
|
private void setVehicleDropDown(List<DropDownTypeVo> result){
|
|
List<ConfigPO> vehicleBaseInfoVo = simulationProjectMapper.selectConfigVehicle(null);
|
|
List<ConfigPO> vehicleBaseInfoVo = simulationProjectMapper.selectConfigVehicle(null);
|
|
@@ -953,72 +1035,6 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
return manualProjectTaskVo;
|
|
return manualProjectTaskVo;
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 生成项目场景信息和最后一级指标信息 TODO 暂不使用
|
|
|
|
- */
|
|
|
|
- private void createProjectSceneAndTarget(String id){
|
|
|
|
- //1.查询场景包下最后一级指标和指标下所有场景
|
|
|
|
- List<ScenePackageSubListVO> scenePackageSubListVOS = simulationProjectMapper.selectSubListByPid(id);
|
|
|
|
-
|
|
|
|
- //2.保存最后一级指标
|
|
|
|
- for(ScenePackageSubListVO v : scenePackageSubListVOS){
|
|
|
|
- SimulationMptLastTargetScorePo simulationMptTargetScorePo = new SimulationMptLastTargetScorePo();
|
|
|
|
- simulationMptTargetScorePo.setPId(id);
|
|
|
|
- simulationMptTargetScorePo.setTarget(v.getSublistId());
|
|
|
|
- simulationMptTargetScorePo.createPo(AuthUtil.getCurrentUserId());
|
|
|
|
- simulationProjectMapper.insertSimulationMptLastTargetScorePo(simulationMptTargetScorePo);
|
|
|
|
-
|
|
|
|
- //3.保存场景
|
|
|
|
- String sceneNaturalIds = v.getSceneNaturalIds();
|
|
|
|
- String sceneTrafficIds = v.getSceneTrafficIds();
|
|
|
|
- String sceneStatueIds = v.getSceneStatueIds();
|
|
|
|
- if(!isEmpty(sceneNaturalIds)){
|
|
|
|
- String[] split = sceneNaturalIds.split(",");
|
|
|
|
- for(String s : split){
|
|
|
|
- SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneNatural(s);
|
|
|
|
- SimulationMptSceneScorePo simulationMptSceneScorePo = new SimulationMptSceneScorePo();
|
|
|
|
- simulationMptSceneScorePo.setPId(id);
|
|
|
|
- simulationMptSceneScorePo.setSceneId(s);
|
|
|
|
- simulationMptSceneScorePo.setSceneType(DictConstants.SCENE_NATURAL);
|
|
|
|
- simulationMptSceneScorePo.createPo(AuthUtil.getCurrentUserId());
|
|
|
|
- simulationProjectMapper.insertSimulationMptSceneScorePo(simulationMptSceneScorePo);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- if(!isEmpty(sceneTrafficIds)){
|
|
|
|
- String[] split = sceneTrafficIds.split(",");
|
|
|
|
- for(String s : split){
|
|
|
|
- SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneAccidentById(s);
|
|
|
|
- SimulationMptSceneScorePo simulationMptSceneScorePo = new SimulationMptSceneScorePo();
|
|
|
|
- simulationMptSceneScorePo.setPId(id);
|
|
|
|
- simulationMptSceneScorePo.setSceneId(s);
|
|
|
|
- simulationMptSceneScorePo.setSceneType(DictConstants.SCENE_ACCIDENT);
|
|
|
|
- simulationMptSceneScorePo.createPo(AuthUtil.getCurrentUserId());
|
|
|
|
- simulationProjectMapper.insertSimulationMptSceneScorePo(simulationMptSceneScorePo);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if(!isEmpty(sceneStatueIds)){
|
|
|
|
- String[] split = sceneStatueIds.split(",");
|
|
|
|
- for(String s : split){
|
|
|
|
- SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneStandardsRegulations(s);
|
|
|
|
- SimulationMptSceneScorePo simulationMptSceneScorePo = new SimulationMptSceneScorePo();
|
|
|
|
- simulationMptSceneScorePo.setPId(id);
|
|
|
|
- simulationMptSceneScorePo.setSceneId(s);
|
|
|
|
- simulationMptSceneScorePo.setSceneType(DictConstants.SCENE_STANDARD);
|
|
|
|
- simulationMptSceneScorePo.createPo(AuthUtil.getCurrentUserId());
|
|
|
|
- simulationProjectMapper.insertSimulationMptSceneScorePo(simulationMptSceneScorePo);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- ///TODO 泛化场景暂不支持
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //4.查询第一级指标
|
|
|
|
-
|
|
|
|
- //5.保存第一级指标
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
* 级联获取场景指标得分数据
|
|
* 级联获取场景指标得分数据
|
|
@@ -1140,11 +1156,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
List<SceneScListVo> objects = new ArrayList<>();
|
|
List<SceneScListVo> objects = new ArrayList<>();
|
|
//结果补全
|
|
//结果补全
|
|
for(List<String> list : result){
|
|
for(List<String> list : result){
|
|
- int offset = size - list.size();
|
|
|
|
int start = list.size() - 5;
|
|
int start = list.size() - 5;
|
|
-// for(int i=0;i<offset;i++){
|
|
|
|
-// list.add(start+i,"");
|
|
|
|
-// }
|
|
|
|
SceneScListVo sceneScListVo = new SceneScListVo();
|
|
SceneScListVo sceneScListVo = new SceneScListVo();
|
|
for(int i=0;i<start;i++){
|
|
for(int i=0;i<start;i++){
|
|
if(0 == i){
|
|
if(0 == i){
|
|
@@ -1175,37 +1187,6 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
List<Map<String, String>> cloums = new ArrayList<>();
|
|
List<Map<String, String>> cloums = new ArrayList<>();
|
|
for(int i=0; i<size-5;i++){
|
|
for(int i=0; i<size-5;i++){
|
|
setCloums(i,cloums);
|
|
setCloums(i,cloums);
|
|
- /*if(0 == i){
|
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
|
- map.put("label","一级指标");
|
|
|
|
- map.put("prop","sublistName1");
|
|
|
|
- cloums.add(map);
|
|
|
|
- }else if(1 == i){
|
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
|
- map.put("label","二级指标");
|
|
|
|
- map.put("prop","sublistName2");
|
|
|
|
- cloums.add(map);
|
|
|
|
- }else if(2 == i){
|
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
|
- map.put("label","三级指标");
|
|
|
|
- map.put("prop","sublistName3");
|
|
|
|
- cloums.add(map);
|
|
|
|
- }else if(3 == i){
|
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
|
- map.put("label","四级指标");
|
|
|
|
- map.put("prop","sublistName4");
|
|
|
|
- cloums.add(map);
|
|
|
|
- }else if(4 == i){
|
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
|
- map.put("label","五级指标");
|
|
|
|
- map.put("prop","sublistName5");
|
|
|
|
- cloums.add(map);
|
|
|
|
- }else if(5 == i){
|
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
|
- map.put("label","六级指标");
|
|
|
|
- map.put("prop","sublistName6");
|
|
|
|
- cloums.add(map);
|
|
|
|
- }*/
|
|
|
|
}
|
|
}
|
|
|
|
|
|
Map<String, String> map1 = new HashMap<>();
|
|
Map<String, String> map1 = new HashMap<>();
|
|
@@ -1248,13 +1229,6 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
* @param pos 所有指标
|
|
* @param pos 所有指标
|
|
*/
|
|
*/
|
|
private void setParentSub(SublistScoreVo po, SublistScoreVo parentPo, List<SublistScoreVo> pos) {
|
|
private void setParentSub(SublistScoreVo po, SublistScoreVo parentPo, List<SublistScoreVo> pos) {
|
|
- /*for(SublistScoreVo p : pos){
|
|
|
|
- if(po.getParentId().equals(p.getId())){
|
|
|
|
- po.setSublistName(p.getSublistName()+","+po.getSublistName());
|
|
|
|
- setParentSub(p, pos);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- }*/
|
|
|
|
if(parentPo == null){
|
|
if(parentPo == null){
|
|
for(SublistScoreVo p : pos){
|
|
for(SublistScoreVo p : pos){
|
|
setSc(po,p,po,pos);
|
|
setSc(po,p,po,pos);
|
|
@@ -1332,11 +1306,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
List<SubScListVo> objects = new ArrayList<>();
|
|
List<SubScListVo> objects = new ArrayList<>();
|
|
//结果补全
|
|
//结果补全
|
|
for(List<String> list : result){
|
|
for(List<String> list : result){
|
|
- int offset = size - list.size();
|
|
|
|
int start = list.size() - 4;
|
|
int start = list.size() - 4;
|
|
- /*for(int i=0;i<offset;i++){
|
|
|
|
- list.add(start+i,"");
|
|
|
|
- }*/
|
|
|
|
SubScListVo subScListVo = new SubScListVo();
|
|
SubScListVo subScListVo = new SubScListVo();
|
|
for(int i=0;i<start;i++){
|
|
for(int i=0;i<start;i++){
|
|
if(0 == i){
|
|
if(0 == i){
|
|
@@ -1367,37 +1337,6 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
List<Map<String, String>> cloums = new ArrayList<>();
|
|
List<Map<String, String>> cloums = new ArrayList<>();
|
|
for(int i=0; i<size-4;i++){
|
|
for(int i=0; i<size-4;i++){
|
|
setCloums(i,cloums);
|
|
setCloums(i,cloums);
|
|
- /*if(0 == i){
|
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
|
- map.put("label","一级指标");
|
|
|
|
- map.put("prop","sublistName1");
|
|
|
|
- cloums.add(map);
|
|
|
|
- }else if(1 == i){
|
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
|
- map.put("label","二级指标");
|
|
|
|
- map.put("prop","sublistName2");
|
|
|
|
- cloums.add(map);
|
|
|
|
- }else if(2 == i){
|
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
|
- map.put("label","三级指标");
|
|
|
|
- map.put("prop","sublistName3");
|
|
|
|
- cloums.add(map);
|
|
|
|
- }else if(3 == i){
|
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
|
- map.put("label","四级指标");
|
|
|
|
- map.put("prop","sublistName4");
|
|
|
|
- cloums.add(map);
|
|
|
|
- }else if(4 == i){
|
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
|
- map.put("label","五级指标");
|
|
|
|
- map.put("prop","sublistName5");
|
|
|
|
- cloums.add(map);
|
|
|
|
- }else if(5 == i){
|
|
|
|
- Map<String, String> map = new HashMap<>();
|
|
|
|
- map.put("label","六级指标");
|
|
|
|
- map.put("prop","sublistName6");
|
|
|
|
- cloums.add(map);
|
|
|
|
- }*/
|
|
|
|
}
|
|
}
|
|
Map<String, String> map1 = new HashMap<>();
|
|
Map<String, String> map1 = new HashMap<>();
|
|
map1.put("label","场景数量");
|
|
map1.put("label","场景数量");
|
|
@@ -1756,10 +1695,8 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
}
|
|
}
|
|
|
|
|
|
private void setScoreNum(String sublistId, String pId, SceneScoreVo resultVo){
|
|
private void setScoreNum(String sublistId, String pId, SceneScoreVo resultVo){
|
|
-// ScenePackageSubListVO scenePackageSubListVO = simulationProjectMapper.selectsublistBySublistId(sublistId);
|
|
|
|
SimulationMptSceneScorePo po = new SimulationMptSceneScorePo();
|
|
SimulationMptSceneScorePo po = new SimulationMptSceneScorePo();
|
|
po.setPId(pId);
|
|
po.setPId(pId);
|
|
-// po.setLastTargerId(scenePackageSubListVO.getSublistId());
|
|
|
|
po.setLastTargerId(sublistId);
|
|
po.setLastTargerId(sublistId);
|
|
SceneScoreVo sceneScoreVo = simulationProjectTaskMapper.selectSceneScoreNumQuery(po);
|
|
SceneScoreVo sceneScoreVo = simulationProjectTaskMapper.selectSceneScoreNumQuery(po);
|
|
resultVo.setNum(resultVo.getNum()+sceneScoreVo.getNum());
|
|
resultVo.setNum(resultVo.getNum()+sceneScoreVo.getNum());
|
|
@@ -1899,6 +1836,200 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, simulationProjectMapper.selectEvaluationLevel(params));
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, simulationProjectMapper.selectEvaluationLevel(params));
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public void exportProjectReport(SimulationManualProjectParam param) throws Exception {
|
|
|
|
+ Document document = new Document(PageSize.A4);
|
|
|
|
+ OutputStream os = null;
|
|
|
|
+ try {
|
|
|
|
+ HttpServletResponse response = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getResponse();
|
|
|
|
+
|
|
|
|
+ //获取要生成的数据
|
|
|
|
+ ResponseBodyVO bodyVO = selectProjectReportById(param);
|
|
|
|
+ ProjectReportVo vo = (ProjectReportVo)bodyVO.getInfo();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //下载
|
|
|
|
+ String fileName="评价报告";
|
|
|
|
+ response.setContentType("application/x-download");
|
|
|
|
+ response.addHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8") + ".pdf");
|
|
|
|
+ os = new BufferedOutputStream(response.getOutputStream());
|
|
|
|
+
|
|
|
|
+ PdfWriter.getInstance(document, os);
|
|
|
|
+
|
|
|
|
+ // 以下生成PDF
|
|
|
|
+ BaseFont font = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
|
|
|
|
+
|
|
|
|
+ //标题
|
|
|
|
+ document.open();
|
|
|
|
+ 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.newPage();
|
|
|
|
+ document.setPageSize(PageSize.A4.rotate());
|
|
|
|
+ PdfPTable pdfPTable2 = new PdfPTable(5);
|
|
|
|
+ addTitleList(pdfPTable2, font, new String[]{"测试项目","90<总分<100","80<总分<90","70<总分<80","0<总分<70"});
|
|
|
|
+ addDataList(pdfPTable2, font, new String[]{"评价等级","优秀(G)","良好(A)","一般(M)","较差(P)",
|
|
|
|
+ "评价等级","++++++","+++++","++++","+++",});
|
|
|
|
+ document.add(pdfPTable2);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ } finally {
|
|
|
|
+ document.close();
|
|
|
|
+ os.close();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public String selectProjectReportIdByAlgorithmId(String algorithmId) {
|
|
|
|
+ SimulationManualProjectPo po = simulationProjectMapper.selectProjectReportIdByAlgorithmId(algorithmId);
|
|
|
|
+ if(StringUtil.isNotEmpty(po)){
|
|
|
|
+ return po.getId();
|
|
|
|
+ }
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 换行
|
|
|
|
+ * @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 setBlankLineSpacing(int lineSpacingIndex, BaseFont font, Document document) throws DocumentException {
|
|
|
|
+ Paragraph elements2 = new Paragraph(
|
|
|
|
+ lineSpacingIndex,
|
|
|
|
+ " ",
|
|
|
|
+ defaultFont(font));
|
|
|
|
+ document.add(elements2);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 默认字体
|
|
|
|
+ * @param font
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private Font defaultFont(BaseFont font){
|
|
|
|
+ return new Font(font, 14);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加表头
|
|
|
|
+ * @param pdfPTable
|
|
|
|
+ * @param font
|
|
|
|
+ * @param titleList
|
|
|
|
+ */
|
|
|
|
+ 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);
|
|
|
|
+ pdfPTable.addCell(pdfPCell);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 添加数据
|
|
|
|
+ * @param pdfPTable
|
|
|
|
+ * @param font
|
|
|
|
+ * @param dataList
|
|
|
|
+ */
|
|
|
|
+ private void addDataList(PdfPTable pdfPTable, BaseFont font, String[] dataList){
|
|
|
|
+ for(String title : dataList){
|
|
|
|
+ PdfPCell pdfPCell = new PdfPCell(new Paragraph(title,defaultFont(font)));
|
|
|
|
+ pdfPTable.addCell(pdfPCell);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
private void insertOtherAlgorithm(SimulationManualProjectParam param){
|
|
private void insertOtherAlgorithm(SimulationManualProjectParam param){
|
|
if(ProjectConstants.SY_ALGORITHM_TYPE.equals(param.getAlgorithmType())){
|
|
if(ProjectConstants.SY_ALGORITHM_TYPE.equals(param.getAlgorithmType())){
|