Browse Source

工作公有私有分组

wangzhiqiang 2 years ago
parent
commit
004775eae5

+ 17 - 0
api-common/src/main/java/api/common/pojo/vo/project/DropDownNewVo.java

@@ -0,0 +1,17 @@
+package api.common.pojo.vo.project;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * 下拉菜单返回值
+ */
+@Getter
+@Setter
+public class DropDownNewVo {
+
+    private String label;   //
+    private List<DropDownVo> options ;
+}

+ 19 - 0
api-common/src/main/java/api/common/pojo/vo/project/DropDownTypeNewVo.java

@@ -0,0 +1,19 @@
+package api.common.pojo.vo.project;
+
+import lombok.Getter;
+import lombok.Setter;
+
+import java.util.List;
+
+/**
+ * 下拉菜单返回值
+ */
+@Getter
+@Setter
+public class DropDownTypeNewVo {
+
+    private List<DropDownNewVo> dropDownList;
+
+    private String type;
+
+}

+ 12 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/project/ctrl/SimulationProjectCtrl.java

@@ -119,6 +119,18 @@ public class SimulationProjectCtrl {
         return service.selectDropDownByType(param);
     }
 
+    /**
+     * 获取添加工作时需要的下拉选项
+     * 0. 算法列表
+     * 1. 车辆列表
+     * 2. 场景列表
+     */
+    @RequestMapping("selectDropDownByType")
+    @ResponseBody
+    public ResponseBodyVO<List<DropDownTypeNewVo>> selectDropDownByTypeNew(@RequestBody SimulationManualProjectParam param) {
+        return service.selectDropDownByTypeNew(param);
+    }
+
 
     /**
      * @return 人员可用最大并行度

+ 199 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/project/impl/SimulationProjectServiceImpl.java

@@ -943,6 +943,31 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         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, null);
+            setScenePackageDropDownNew(result);
+        } else if ("1".equals(param.getDropDownType())) {
+            setAlgorithmDropDownNew(result, param.getAlgorithmType());
+        } else if ("2".equals(param.getDropDownType())) {
+            setVehicleDropDownNew(result, null);
+        } 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();
@@ -4439,4 +4464,178 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         return algorithmScoreVoList;
 
     }
+
+
+
+    /**
+     * 查询算法下拉列表
+     *
+     * @param result
+     * @param algorithmType 算法类型
+     */
+    private void setAlgorithmDropDownNew(List<DropDownTypeNewVo> result, String algorithmType) {
+
+        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);
+
+        }
+        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(listGSy);
+        dropDownTypeNewVo.setType("1");
+        result.add(dropDownTypeNewVo);
+
+    }
+
+    private void setVehicleDropDownNew(List<DropDownTypeNewVo> result, String ConfigId) {
+        ConfigPO configPO = new ConfigPO();
+        if (StringUtil.isNotEmpty(ConfigId)) {
+            configPO.setId(ConfigId);
+        }
+        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(","));
+
+            }
+            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);
+        DropDownTypeNewVo dropDownTypeNewVo = new DropDownTypeNewVo();
+        dropDownTypeNewVo.setDropDownList(listGSy);
+        dropDownTypeNewVo.setType("2");
+        result.add(dropDownTypeNewVo);
+    }
+    private void setScenePackageDropDownNew(List<DropDownTypeNewVo> result) {
+        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);
+        }
+        List<DropDownNewVo> listGSy=new ArrayList<>();
+        DropDownNewVo dropDownNewSyVo = new DropDownNewVo();
+        dropDownNewSyVo.setLabel("私有");
+        dropDownNewSyVo.setOptions(scenePackageSyList);
+        listGSy.add(dropDownNewSyVo);
+        DropDownNewVo dropDownNewGyVo = new DropDownNewVo();
+        dropDownNewGyVo.setLabel("公有");
+        dropDownNewGyVo.setOptions(scenePackageGyList);
+        listGSy.add(dropDownNewGyVo);
+        DropDownTypeNewVo dropDownTypeNewVo = new DropDownTypeNewVo();
+        dropDownTypeNewVo.setDropDownList(listGSy);
+        dropDownTypeNewVo.setType("3");
+        result.add(dropDownTypeNewVo);
+    }
+
+
 }

+ 6 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/project/mapper/SimulationProjectMapper.java

@@ -52,6 +52,8 @@ public interface SimulationProjectMapper {
     int updateProjectNowRunState(SimulationManualProjectParam param);
 
     List<AlgorithmPO> selectAlgorithmBaseInfoById(AlgorithmPO algorithmPO);
+    List<AlgorithmPO> selectAlgorithmBaseInfoByIdGy(AlgorithmPO algorithmPO);
+    List<AlgorithmPO> selectAlgorithmBaseInfoByIdSy(AlgorithmPO algorithmPO);
 
     @Select("select id, algorithm_name, description\n" +
             "        from algorithm\n" +
@@ -61,6 +63,8 @@ public interface SimulationProjectMapper {
     List<VehiclePO> selectVehicleBaseInfoById(String id);
 
     List<ScenePackagePO> selectScenePackageBaseById(ScenePackagePO scenePackagePO);
+    List<ScenePackagePO> selectScenePackageBaseByIdGy(ScenePackagePO scenePackagePO);
+    List<ScenePackagePO> selectScenePackageBaseByIdSy(ScenePackagePO scenePackagePO);
 
     ScenePackagePO selectScenePackageInfoById(String id);
 
@@ -103,6 +107,8 @@ public interface SimulationProjectMapper {
     List<ConfigPO> selectConfigVehicle(ConfigPO configPO);
 
     List<ConfigPO> selectConfigVehicle2(ConfigPO configPO);
+    List<ConfigPO> selectConfigVehicleGy(ConfigPO configPO);
+    List<ConfigPO> selectConfigVehicleSy(ConfigPO configPO);
 
     List<ConfigSensorPO> selectConfigSensor(String id);
 

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

@@ -25,6 +25,7 @@ public interface SimulationProjectService {
     ResponseBodyVO<ProjectReportVo> selectProjectReportById(SimulationManualProjectParam param);
 
     ResponseBodyVO<List<DropDownTypeVo>> selectDropDownByType(SimulationManualProjectParam param);
+    ResponseBodyVO<List<DropDownTypeNewVo>> selectDropDownByTypeNew(SimulationManualProjectParam param);
 
     ResponseBodyVO<ProjectTaskDetailsVo> selectProjectTaskById(SimulationManualProjectParam param);
 

+ 67 - 0
simulation-resource-server/src/main/resources/mapper/project/SimulationProjectMapper.xml

@@ -682,4 +682,71 @@
         order by finish_time desc limit 1
     </select>
 
+    <!--获取算法基本信息 /*where a.share = '0' and a.is_deleted = '0'*/-->
+    <select id="selectAlgorithmBaseInfoByIdSy" resultType="api.common.pojo.po.algorithm.AlgorithmPO">
+        select id, algorithm_name, description,share,modify_time
+        from algorithm
+        where  is_deleted = '0' and share='0'
+        <if test="id != null and id != ''">
+            and id = #{id,jdbcType=VARCHAR}
+        </if>
+        <if test="createUserId != null and createUserId !=''">
+            and create_user_id=#{createUserId,jdbcType=VARCHAR}
+        </if>
+        <if test="uploadMode != null and uploadMode != ''">
+            and upload_mode = #{uploadMode,jdbcType=VARCHAR}
+        </if>
+         order by modify_time desc
+    </select>
+    <!--获取算法基本信息 /*where a.share = '0' and a.is_deleted = '0'*/-->
+    <select id="selectAlgorithmBaseInfoByIdGy" resultType="api.common.pojo.po.algorithm.AlgorithmPO">
+
+          select id, algorithm_name,description,share,modify_time
+        from algorithm
+        where  is_deleted = '0' and share='1'
+        <if test="uploadMode != null and uploadMode != ''">
+            and upload_mode = #{uploadMode,jdbcType=VARCHAR}
+        </if>
+         order by modify_time desc
+    </select>
+
+    <!--获取车辆配置信息-->
+    <select id="selectConfigVehicleGy" resultType="api.common.pojo.po.model.ConfigPO">
+       select id, config_name, vehicle_id, description,share,modify_time
+        from model_config
+        where  is_deleted = '0' and share='1' order by modify_time desc
+    </select>
+    <select id="selectConfigVehicleSy" resultType="api.common.pojo.po.model.ConfigPO">
+
+        select id, config_name, vehicle_id, description,share,modify_time
+        from model_config
+        where  is_deleted = '0' and share='0'
+        <if test="id != null and id != ''">
+            and id = #{id,jdbcType=VARCHAR}
+        </if>
+        <if test="createUserId != null and createUserId !=''">
+            and create_user_id=#{createUserId,jdbcType=VARCHAR}
+        </if>
+        order by modify_time desc
+    </select>
+    <!--获取场景包基本信息-->
+    <select id="selectScenePackageBaseByIdGy" resultType="api.common.pojo.po.scene.ScenePackagePO">
+
+        select package_id,package_name, scene_num,share,modify_time
+        from scene_package where share = '1' and is_deleted = '0'
+         order by modify_time desc
+    </select>
+    <!--获取场景包基本信息-->
+    <select id="selectScenePackageBaseByIdSy" resultType="api.common.pojo.po.scene.ScenePackagePO">
+        select package_id,package_name, scene_num,share,modify_time
+        from scene_package
+        where share = '0' and is_deleted = '0' and is_unavailable = '0'
+        <if test="packageId != null and packageId != ''">
+            and package_id = #{packageId,jdbcType=VARCHAR}
+        </if>
+        <if test="createUserId != null and createUserId !=''">
+            and create_user_id=#{createUserId,jdbcType=VARCHAR}
+        </if>
+        order by modify_time desc
+    </select>
 </mapper>