Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/master'

root 2 gadi atpakaļ
vecāks
revīzija
657f341839

+ 2 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/home/ctrl/HomePageCtrl.java

@@ -49,7 +49,8 @@ public class HomePageCtrl {
     public ResponseBodyVO<Map<String,Integer>> queryAllNum() {
 
         Map<String,Integer> map = algorithmService.selectDetailsBySy();     //算法文件数量
-        map.put("SceneNum", sceneNaturalService.querySceneNumBySy());       //场景数量
+        map.put("SySceneNum", sceneNaturalService.querySceneNumBySy());//私有场景数量
+        map.put("GySceneNum", sceneNaturalService.querySceneNumByGy());//共有场景数量
         map.put("ConfigTotal", configService.getConfigTotal());             //车辆配置数量
         map.put("maxConcurrency", clusterService.getLicenseNum());          //最大并发数量
         map.put("currentConcurrency", homePageService.getRunningTask());    //当前并发数量

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

@@ -1389,7 +1389,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             configPO.setId(ConfigId);
         }
         configPO.setCreateUserId(AuthUtil.getCurrentUserId());
-        List<ConfigPO> vehicleBaseInfoVo = simulationProjectMapper.selectConfigVehicle(configPO);
+        List<ConfigPO> vehicleBaseInfoVo = simulationProjectMapper.selectConfigVehicle2(configPO);
         List<DropDownVo> vehicleList = new ArrayList<>();
         for (ConfigPO v : vehicleBaseInfoVo) {
             DropDownVo dropDownVo = new DropDownVo();

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

@@ -100,6 +100,7 @@ public interface SimulationProjectMapper {
     SystemUserVo selectUserById(String id);
 
     List<ConfigPO> selectConfigVehicle(ConfigPO configPO);
+    List<ConfigPO> selectConfigVehicle2(ConfigPO configPO);
 
     List<ConfigSensorPO> selectConfigSensor(String id);
 

+ 21 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SceneNaturalService.java

@@ -452,6 +452,26 @@ public class SceneNaturalService {
         if (DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)) {
             //管理员账户
             return sceneNaturalMapper.querySceneNumBySy(params);
+        } else if (DictConstants.ROLE_CODE_SUBUESR.equals(roleCode)) {
+            //根据普通子账户查询父账户
+            userId = AuthUtil.getCreateUserId();
+            params.setCreateUserId(userId);
+            return sceneNaturalMapper.querySceneNumBySy(params);
+        } else if (DictConstants.ROLE_CODE_UESR.equals(roleCode)) {
+            //查询普通账户
+            params.setCreateUserId(userId);
+            return sceneNaturalMapper.querySceneNumBySy(params);
+        }
+        return 0;
+    }
+
+    public Integer querySceneNumByGy() {
+        SceneNaturalParam params = new SceneNaturalParam();
+        String roleCode = AuthUtil.getCurrentUserRoleCode();
+        String userId = AuthUtil.getCurrentUserId();
+        if (DictConstants.ROLE_CODE_ADMIN.equals(roleCode) || DictConstants.ROLE_CODE_SYSADMIN.equals(roleCode)) {
+            //管理员账户
+            return systemScenePackageMapper.querySceneNum("");
         } else if (DictConstants.ROLE_CODE_SUBUESR.equals(roleCode)) {
             //根据普通子账户查询父账户
             userId = AuthUtil.getCreateUserId();
@@ -464,6 +484,7 @@ public class SceneNaturalService {
     }
 
 
+
     /**
      * 获取自然场景数据:
      */

+ 1 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/service/SystemScenePackageService.java

@@ -745,7 +745,7 @@ public class SystemScenePackageService {
                 fhPo.setSublistId(StringUtil.getRandomUUID());
                 fhPo.setIsDeleted("0");
                 fhPo.setSceneType("4");
-                fhPo.setSceneName(sceneGeneralTemplatePOSy.getShare());
+                fhPo.setSceneName(sceneGeneralTemplatePOSy.getSceneId());
                 fhPo.setSceneAndPackage(packId);
                 fhPo.setCreateTime(TimeUtil.getNowForMysql());
                 fhPo.setModifyTime(TimeUtil.getNowForMysql());

+ 34 - 6
simulation-resource-server/src/main/resources/mapper/project/SimulationProjectMapper.xml

@@ -270,9 +270,10 @@
 
     <!--获取算法基本信息 /*where a.share = '0' and a.is_deleted = '0'*/-->
     <select id="selectAlgorithmBaseInfoById" resultType="api.common.pojo.po.algorithm.AlgorithmPO">
-        select a.id, a.algorithm_name, a.description
+        select id, algorithm_name, description,share from(
+         select a.id, a.algorithm_name, a.description,a.share,a.modify_time
         from algorithm a
-        where a.share = '0' and a.is_deleted = '0'
+        where  a.is_deleted = '0' and share='0'
         <if test="id != null and id != ''">
             and a.id = #{id,jdbcType=VARCHAR}
         </if>
@@ -282,6 +283,13 @@
         <if test="uploadMode != null and uploadMode != ''">
             and upload_mode = #{uploadMode,jdbcType=VARCHAR}
         </if>
+        union  select b.id, b.algorithm_name,b.description,b.share,b.modify_time
+        from algorithm b
+        where  b.is_deleted = '0' and b.share='1'
+        <if test="uploadMode != null and uploadMode != ''">
+            and upload_mode = #{uploadMode,jdbcType=VARCHAR}
+        </if>
+        )c order by c.share ,c.modify_time desc
     </select>
 
     <!--获取车辆基本信息-->
@@ -296,9 +304,9 @@
 
     <!--获取车辆配置信息-->
     <select id="selectConfigVehicle" resultType="api.common.pojo.po.model.ConfigPO">
-        select id, config_name, vehicle_id, description
+        select id, config_name, vehicle_id, description,share
         from model_config
-        where share = '0' and is_deleted = '0'
+        where  is_deleted = '0'
         <if test="id != null and id != ''">
             and id = #{id,jdbcType=VARCHAR}
         </if>
@@ -307,6 +315,23 @@
         </if>
     </select>
 
+    <!--获取车辆配置信息-->
+    <select id="selectConfigVehicle2" resultType="api.common.pojo.po.model.ConfigPO">
+        select id, config_name, vehicle_id, description,share from(
+        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>
+        union select id, config_name, vehicle_id, description,share,modify_time
+        from model_config
+        where  is_deleted = '0' and share='1')c order by c.share ,c.modify_time desc
+    </select>
+
     <!--查询车辆配置传感器信息-->
     <select id="selectConfigSensor" parameterType="string" resultType="api.common.pojo.po.model.ConfigSensorPO">
         select sensor_type
@@ -320,7 +345,8 @@
 
     <!--获取场景包基本信息-->
     <select id="selectScenePackageBaseById" resultType="api.common.pojo.po.scene.ScenePackagePO">
-        select a.package_id,a.package_name, a.scene_num
+        select package_id,package_name, scene_num,share from(
+        select a.package_id,a.package_name, a.scene_num,a.share,a.modify_time
         from scene_package a
         where a.share = '0' and a.is_deleted = '0'
         <if test="packageId != null and packageId != ''">
@@ -329,7 +355,9 @@
         <if test="createUserId != null and createUserId !=''">
             and create_user_id=#{createUserId,jdbcType=VARCHAR}
         </if>
-        order by modify_time desc
+        union select b.package_id,b.package_name, b.scene_num,b.share,b.modify_time
+        from scene_package b where b.share = '1' and b.is_deleted = '0'
+        ) c order by c.share ,c.modify_time desc
     </select>
 
     <!--根据id查询场景包信息-->

+ 24 - 4
simulation-resource-server/src/main/resources/mapper/scene/SceneNaturalMapper.xml

@@ -419,13 +419,33 @@
 
     <select id="querySceneNumBySy" parameterType="api.common.pojo.param.scene.SceneNaturalParam" resultType="java.lang.Integer">
       select SUM(num) from(
-        select COUNT(1) AS num from simulation.scene_natural WHERE is_deleted = '0'
+        select COUNT(1) AS num from simulation.scene_natural
+        <where> is_deleted = '0'  and share='0'
+        <if test="createUserId != null and createUserId!=''">
+            and create_user_id =#{createUserId}
+        </if>
+    </where>
         union all
-        select COUNT(1) AS num from simulation.scene_accident WHERE is_deleted = '0'
+        select COUNT(1) AS num from simulation.scene_accident
+        <where> is_deleted = '0'  and share='0'
+            <if test="createUserId != null and createUserId!=''">
+                and create_user_id =#{createUserId}
+            </if>
+        </where>
         union all
-        select COUNT(1) AS num from simulation.scene_standards_regulations WHERE is_deleted = '0'
+        select COUNT(1) AS num from simulation.scene_standards_regulations
+        <where> is_deleted = '0'  and share='0'
+            <if test="createUserId != null and createUserId!=''">
+                and create_user_id =#{createUserId}
+            </if>
+        </where>
         union all
-        select COUNT(1) AS num from simulation.scene_general_template WHERE is_deleted = '0') a
+        select COUNT(1) AS num from simulation.scene_general_template
+        <where> is_deleted = '0'  and share='0'
+            <if test="createUserId != null and createUserId!=''">
+                and create_user_id =#{createUserId}
+            </if>
+        </where>) a
     </select>
 
 

+ 24 - 4
simulation-resource-server/src/main/resources/mapper/scene/SystemScenePackageMapper.xml

@@ -148,28 +148,48 @@
                        JOIN system_scene_package b ON a.package_id = b.id AND b.is_deleted = '0'
                        JOIN system_scene_package_sublist c ON b.id = c.scene_and_package AND c.is_deleted = '0'
                        JOIN scene_natural d ON d.natural_name = c.scene_name AND d.is_deleted = '0'
-              WHERE a.user_id = #{userId}
+        <where> d.share='2'
+            <if test="userId != null and userId!=''">
+                and a.user_id = #{userId}
+            </if>
+        </where>
+        UNION ALL SELECT COUNT(*) AS num from scene_natural where is_deleted = '0'  and share='1'
               UNION ALL
               SELECT COUNT(DISTINCT c.scene_name) AS num
               FROM system_user_scene a
                        JOIN system_scene_package b ON a.package_id = b.id AND b.is_deleted = '0'
                        JOIN system_scene_package_sublist c ON b.id = c.scene_and_package AND c.is_deleted = '0'
                        JOIN scene_accident d ON d.scene_name = c.scene_name AND d.is_deleted = '0'
-              WHERE a.user_id = #{userId}
+        <where> d.share='2'
+            <if test="userId != null and userId!=''">
+                and a.user_id = #{userId}
+            </if>
+        </where>
+        UNION ALL SELECT COUNT(*) AS num from scene_accident where is_deleted = '0'  and share='1'
               UNION ALL
               SELECT COUNT(DISTINCT c.scene_name) AS num
               FROM system_user_scene a
                        JOIN system_scene_package b ON a.package_id = b.id AND b.is_deleted = '0'
                        JOIN system_scene_package_sublist c ON b.id = c.scene_and_package AND c.is_deleted = '0'
                        JOIN scene_standards_regulations d ON d.scene_name = c.scene_name AND d.is_deleted = '0'
-              WHERE a.user_id = #{userId}
+        <where> d.share='2'
+            <if test="userId != null and userId!=''">
+                and a.user_id = #{userId}
+            </if>
+        </where>
+        UNION ALL SELECT COUNT(*) AS num from scene_standards_regulations where is_deleted = '0'  and share='1'
               UNION ALL
               SELECT COUNT(DISTINCT c.scene_name) AS num
               FROM system_user_scene a
                        JOIN system_scene_package b ON a.package_id = b.id AND b.is_deleted = '0'
                        JOIN system_scene_package_sublist c ON b.id = c.scene_and_package AND c.is_deleted = '0'
                        JOIN scene_general_template d ON d.scene_id = c.scene_name AND d.is_deleted = '0'
-              WHERE a.user_id = #{userId}) AS t
+        <where> d.share='2'
+            <if test="userId != null and userId!=''">
+                and a.user_id = #{userId}
+            </if>
+        </where>
+        UNION ALL SELECT COUNT(*) AS num from scene_general_template where is_deleted = '0'  and share='1') AS t
     </select>