소스 검색

自动运行查询算法列表

martin 2 년 전
부모
커밋
227710d19a

+ 0 - 3
api-common/src/main/java/api/common/pojo/constants/DictConstants.java

@@ -30,9 +30,6 @@ public class DictConstants {
     public static final String USE_TYPE = "useType";//占用类型
     public static final String SCENE_TYPE = "sceneType";//场景类型
     public static final String SCENE_IMPORT_STATUS = "sceneImportStatus";//场景上传状态
-
-
-
     public static final String ALGORITHM_FILE = "algorithmFile";    //算法文件上传type
     public static final String VEHICLE_IMG_FILE = "vehicleImg";    //车辆图片上传type
 

+ 36 - 119
api-common/src/main/java/api/common/pojo/param/project/SimulationManualProjectParam.java

@@ -10,131 +10,48 @@ import java.util.Date;
 @Setter
 public class SimulationManualProjectParam extends PageVO {
 
-    //id
-    private String id;
-
-    //项目日期
-    private Integer projectDate;
-
-    //项目序号
-    private Integer projectNum;
-
-    //项目id
-    private String projectId;
-
-    //周期表达式
-    private String cron;
-
-    //项目名称
-    private String projectName;
-
-    //项目描述
-    private String projectDescribe;
-
-    //算法
-    private String algorithm;
-
-    //算法名称
-    private String algorithmName;
-
-    //车辆
-    private String vehicle;
-
-    //场景
-    private String scene;
-
-    //运行周期
-    private String operationCycle;
-
-    //并行度
-    private String parallelism;
-
-    //规则查看
-    private String ruleView;
-
-    //是否选择gpu(0:是,1:否)
-    private String isChoiceGpu;
-
-    //创建开始日期yyyy-MM-dd
-    private String createStartDate;
-
-    //创建结束日期yyyy-MM-dd
-    private String createEndDate;
-
-    //当前运行状态
-    private String nowRunState;
-
-    //评测等级
-    private String evaluationLevel;
-
-    //开始时间
-    private Date startTime;
-
-    //完成时间
-    private Date finishTime;
-
-    //最大仿真时间
-    private Long maxSimulationTime;
-
+    private String id;  //id
+    private Integer projectDate;    //项目日期
+    private Integer projectNum; //项目序号
+    private String projectId;   //项目id
+    private String cron;    //周期表达式
+    private String projectName;//项目名称
+    private String projectDescribe; //项目描述
+    private String algorithm;   //算法
+    private String algorithmName;   //算法名称
+    private String vehicle; //车辆
+    private String scene;   //场景
+    private String operationCycle;  //运行周期
+    private String parallelism; //并行度
+    private String ruleView;    //规则查看
+    private String isChoiceGpu; //是否选择gpu(0:是,1:否)
+    private String createStartDate; //创建开始日期yyyy-MM-dd
+    private String createEndDate;   //创建结束日期yyyy-MM-dd
+    private String nowRunState;//当前运行状态
+    private String evaluationLevel; //评测等级
+    private Date startTime;  //开始时间
+    private Date finishTime;     //完成时间
+    private Long maxSimulationTime;  //最大仿真时间
     private String isDeleted;
-
     private Date createTimeStart;
-
     private Date createTimeEnd;
-
     private Date finishTimeStart;
-
     private Date finishTimeEnd;
-
     private String finishDateStart;
-
     private String finishDateEnd;
-
-
     private String ids;
-
-    //条件参数
-    private String finishTimeFmt;
-
-    //下拉类型1、算法2、车辆、3、场景
-    private String dropDownType;
-
-    //任务id
-    private String taskId;
-
-    //算法类型
-    private String algorithmType;
-
-    //算法来源1、文件上传,2、仓库地址
-    private String algorithmSource;
-
-    //仿真结果地址
-    private String runResultFilePath;
-
-
-    //是否生成本地pdf文件
-    private Boolean isCreateLocalPdfFile;
-
-    //本地pdf文件路径
-    private String LocalPdfFilePath;
-
-    //是否打包报告pdf
-    private Boolean isPagePdf;
-
-    //创建人
-    private String createUserId;
-
-    //场景包id
-    private String packageId;
-
-    //自动运行状态
-    private String automaticRunState;
-
-    //父级项目id
-    private String parentId;
-
-    //项目类型 1.手动;2.自动
-    private String projectType;
-
-
+    private String finishTimeFmt;   //条件参数
+    private String dropDownType;    //下拉类型1、算法2、车辆、3、场景
+    private String taskId;  //任务id
+    private String algorithmType;   //算法类型
+    private String algorithmSource; //算法来源1、文件上传,2、仓库地址
+    private String runResultFilePath;    //仿真结果地址
+    private Boolean isCreateLocalPdfFile;   //是否生成本地pdf文件
+    private String LocalPdfFilePath;    //本地pdf文件路径
+    private Boolean isPagePdf;  //是否打包报告pdf
+    private String createUserId;    //创建人
+    private String packageId;    //场景包id
+    private String automaticRunState;    //自动运行状态
+    private String parentId;    //父级项目id
+    private String projectType; //项目类型 1.手动;2.自动
 }

+ 13 - 10
simulation-resource-server/src/main/java/com/css/simulation/resource/common/utils/AuthUtil.java

@@ -1,30 +1,33 @@
 package com.css.simulation.resource.common.utils;
 
 import com.css.simulation.resource.common.oauth.MyUserDetails;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.security.core.Authentication;
 import org.springframework.security.core.context.SecurityContextHolder;
 
 /**
  * 认证信息工具类
  */
+@Slf4j
 public class AuthUtil {
 
     /**
      * 获取当前登录人id
      */
-    public static String getCurrentUserId(){
+    public static String getCurrentUserId() {
         Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
-        MyUserDetails userDetails = (MyUserDetails)authentication.getPrincipal();
+        MyUserDetails userDetails = (MyUserDetails) authentication.getPrincipal();
         String userId = userDetails.getId();
+        log.info("AuthUtil--getCurrentUserId 当前 userId 为:" + userId);
         return userId;
     }
 
     /**
      * 获取当前登录人roleCode
      */
-    public static String getCurrentUserRoleCode(){
+    public static String getCurrentUserRoleCode() {
         Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
-        MyUserDetails userDetails = (MyUserDetails)authentication.getPrincipal();
+        MyUserDetails userDetails = (MyUserDetails) authentication.getPrincipal();
         String roleCode = userDetails.getRoleCode();
         return roleCode;
     }
@@ -32,9 +35,9 @@ public class AuthUtil {
     /**
      * 获取当前登录人useType
      */
-    public static String getCurrentUseType(){
+    public static String getCurrentUseType() {
         Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
-        MyUserDetails userDetails = (MyUserDetails)authentication.getPrincipal();
+        MyUserDetails userDetails = (MyUserDetails) authentication.getPrincipal();
         String useType = userDetails.getUseType();
         return useType;
     }
@@ -42,9 +45,9 @@ public class AuthUtil {
     /**
      * 获取当前登录人username
      */
-    public static String getCurrentUsername(){
+    public static String getCurrentUsername() {
         Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
-        MyUserDetails userDetails = (MyUserDetails)authentication.getPrincipal();
+        MyUserDetails userDetails = (MyUserDetails) authentication.getPrincipal();
         String username = userDetails.getUsername();
         return username;
     }
@@ -52,9 +55,9 @@ public class AuthUtil {
     /**
      * 获取当前登录人createUserId
      */
-    public static String getCreateUserId(){
+    public static String getCreateUserId() {
         Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
-        MyUserDetails userDetails = (MyUserDetails)authentication.getPrincipal();
+        MyUserDetails userDetails = (MyUserDetails) authentication.getPrincipal();
         String createUserId = userDetails.getCreateUserId();
         return createUserId;
     }

+ 7 - 2
simulation-resource-server/src/main/java/com/css/simulation/resource/project/ctrl/SimulationProjectCtrl.java

@@ -3,6 +3,7 @@ package com.css.simulation.resource.project.ctrl;
 import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.param.project.DictParam;
 import api.common.pojo.param.project.SimulationManualProjectParam;
+import api.common.pojo.vo.project.DropDownTypeVo;
 import api.common.pojo.vo.project.ProjectTaskDetailsVo;
 import api.common.pojo.vo.project.SimulationManualProjectVo;
 import com.css.simulation.resource.project.service.SimulationProjectService;
@@ -14,6 +15,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 
+import java.util.List;
+
 /**
  * 工作台模块--项目运行
  */
@@ -121,12 +124,14 @@ public class SimulationProjectCtrl {
 
     /**
      * 获取添加工作时需要的下拉选项
+     * 0. 算法列表
+     * 1. 车辆列表
+     * 2. 场景列表
      *
-     * @return
      */
     @RequestMapping("selectDropDownByType")
     @ResponseBody
-    public ResponseBodyVO selectDropDownByType(@RequestBody SimulationManualProjectParam param) {
+    public ResponseBodyVO<List<DropDownTypeVo>> selectDropDownByType(@RequestBody SimulationManualProjectParam param) {
         return service.selectDropDownByType(param);
     }
 

+ 30 - 20
simulation-resource-server/src/main/java/com/css/simulation/resource/project/impl/SimulationProjectServiceImpl.java

@@ -866,22 +866,28 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
     }
 
 
+    /**
+     * 获取添加工作时需要的下拉选项
+     * 0. 算法列表
+     * 1. 车辆列表
+     * 2. 场景列表
+     */
     @Override
-    public ResponseBodyVO selectDropDownByType(SimulationManualProjectParam param) {
+    public ResponseBodyVO<List<DropDownTypeVo>> selectDropDownByType(SimulationManualProjectParam param) {
         List<DropDownTypeVo> result = new ArrayList<>();
         if (isEmpty(param.getDropDownType())) {
             //获取全部(算法,车辆,场景)
-            setAlgorithmDropDown(result, param.getAlgorithmType(), param.getAlgorithmSource());
+            setAlgorithmDropDown(result, param.getAlgorithmType());
             setVehicleDropDown(result, null);
             setScenePackageDropDown(result);
         } else if ("1".equals(param.getDropDownType())) {
-            setAlgorithmDropDown(result, param.getAlgorithmType(), param.getAlgorithmSource());
+            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);
+        return new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS, result);
     }
 
     @Override
@@ -1322,26 +1328,22 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         return resultVo;
     }
 
-    private void setAlgorithmDropDown(List<DropDownTypeVo> result, String algorithmType, String AlgorithmSource) {
+    /**
+     * 查询算法下拉列表
+     *
+     * @param result
+     * @param algorithmType 算法类型
+     */
+    private void setAlgorithmDropDown(List<DropDownTypeVo> result, String algorithmType) {
 
         List<DropDownVo> algorithmList = new ArrayList<>();
-
-        if (DictConstants.PLATFORM.equals(algorithmType)) {
-            //第三方算法平台获取(索为)
-            String sort = "algorithmId-desc";
-            Integer page = 1;
-            Integer size = 999;//全部
-
-            String urlParam = "&page=" + page + "&size=" + size + "&sort=" + sort;
-            algorithmList = getOtherAlgorithmInfo(urlParam);
-
-        } else {
+        if (DictConstants.FILE.equals(algorithmType)) {
             AlgorithmPO algorithmPO = new AlgorithmPO();
-            algorithmPO.setCreateUserId(AuthUtil.getCurrentUserId());
-            if (!isEmpty(AlgorithmSource)) {
-                algorithmPO.setUploadMode(AlgorithmSource); //算法来源
+            algorithmPO.setCreateUserId(AuthUtil.getCurrentUserId());   // 获取当前用户 id
+            if (StringUtil.isEmpty(algorithmType)) {
+                algorithmPO.setUploadMode("1");
             } else {
-                algorithmPO.setUploadMode("1");//默认值
+                algorithmPO.setUploadMode(algorithmType);
             }
             List<AlgorithmPO> algorithmBaseInfoVo = simulationProjectMapper.selectAlgorithmBaseInfoById(algorithmPO);
 
@@ -1353,6 +1355,14 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
                 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);

+ 4 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/project/service/SimulationProjectService.java

@@ -2,10 +2,13 @@ package com.css.simulation.resource.project.service;
 
 import api.common.pojo.common.ResponseBodyVO;
 import api.common.pojo.param.project.SimulationManualProjectParam;
+import api.common.pojo.vo.project.DropDownTypeVo;
 import api.common.pojo.vo.project.ProjectTaskDetailsVo;
 import api.common.pojo.vo.project.SimulationManualProjectVo;
 import com.github.pagehelper.PageInfo;
 
+import java.util.List;
+
 
 public interface SimulationProjectService {
 
@@ -23,7 +26,7 @@ public interface SimulationProjectService {
 
     ResponseBodyVO selectProjectReportById(SimulationManualProjectParam param);
 
-    ResponseBodyVO selectDropDownByType(SimulationManualProjectParam param);
+    ResponseBodyVO<List<DropDownTypeVo>> selectDropDownByType(SimulationManualProjectParam param);
 
     ResponseBodyVO<ProjectTaskDetailsVo> selectProjectTaskById(SimulationManualProjectParam param);
 

+ 1 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/system/ctrl/UserInfoCtrl.java

@@ -54,7 +54,7 @@ public class UserInfoCtrl {
     @RequestMapping("/getCurrentUserInfo")
     @ResponseBody
     public ResponseBodyVO getCurrentUserInfo() {
-        ResponseBodyVO<UserVO> response = new ResponseBodyVO<UserVO>(ResponseBodyVO.Response.SUCCESS);
+        ResponseBodyVO<UserVO> response = new ResponseBodyVO<>(ResponseBodyVO.Response.SUCCESS);
         response.setInfo(userService.getCurrentUserInfo());
         return response;
     }