Browse Source

c场景数量去除已删除的

wangzhiqiang 2 years ago
parent
commit
16279dbcfe

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

@@ -1340,7 +1340,10 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             }
         }else if(DictConstants.SCENE_GENERAL.equals(sceneType)){
             ///TODO 泛化场景暂不支持
-
+            SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneGeneralDataById(sceneId);
+            if(sceneBaseInfoVo != null){
+                resultVo.setCommonSceneName(sceneBaseInfoVo.getSceneName());
+            }
         }
 
         return resultVo;
@@ -1638,6 +1641,10 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
             }
         }else if(DictConstants.SCENE_GENERAL.equals(sceneType)){
             /// TODO 泛化场景暂不支持
+             sceneBaseInfoVo = simulationProjectMapper.selectSceneGeneralDataById(sceneId);
+            if(sceneBaseInfoVo != null){
+                vo.setSceneName(sceneBaseInfoVo.getSceneName());
+            }
 
         }
     }
@@ -1773,6 +1780,13 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
 
                         }else if(DictConstants.SCENE_GENERAL.equals(sceneType)){
                             /// TODO 泛化场景暂不支持
+                            //泛化
+                            sublistScoreVo.setSceneType("泛化");
+                            //获取场景名称
+                            SceneBaseInfoVo sceneBaseInfoVo = simulationProjectMapper.selectSceneGeneralDataById(sc.getSceneId());
+                            if(sceneBaseInfoVo != null){
+                                sceneName = sceneBaseInfoVo.getSceneName();
+                            }
 
                         }
                         sublistScoreVo.setReturnSceneId(sceneName);//显示场景名称
@@ -2243,6 +2257,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         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)){
@@ -2254,6 +2269,10 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
         if(!isEmpty(TrafficSceneScoreVos)){
             sceneScoreVos.addAll(TrafficSceneScoreVos);
         }
+
+        if(!isEmpty(FhSceneScoreVos)){
+            sceneScoreVos.addAll(FhSceneScoreVos);
+        }
         vo.setSceneScoreList(sceneScoreVos);
     }
     private void setLastTargetScore(ScenePackageSubListVO vo, String pId){

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

@@ -65,6 +65,7 @@ public interface SimulationProjectMapper {
 
     SceneBaseInfoVo selectSceneNatural(String id);
 
+    SceneBaseInfoVo selectSceneGeneralDataById(String id);
     SceneBaseInfoVo selectSceneStandardsRegulations(String id);
 
     List<ScenePackageSubListVO> selectSubSceneByPid(String id);

+ 2 - 2
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/ctrl/SceneGeneralTemplateController.java

@@ -181,7 +181,7 @@ public class SceneGeneralTemplateController {
     }
 
 
-    //测试
+   /* //测试
     @PostMapping("/test1")
     @ResponseBody
     public ResponseBodyVO test1(@RequestBody SceneGeneralTemplatePO po) throws IllegalAccessException, IOException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException {
@@ -202,7 +202,7 @@ public class SceneGeneralTemplateController {
         List<SceneGeneralDataPO> list = JsonUtil.jsonToList(newjson, SceneGeneralDataPO.class);
         return new ResponseBodyVO(ResponseBodyVO.Response.CLIENT_FAILURE, "参数不能为空,请检查");
     }
-
+*/
     /**
      * 对象转Map
      *

+ 7 - 0
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/SystemScenePackageMapper.java

@@ -32,4 +32,11 @@ public interface SystemScenePackageMapper {
     //查询勾选场景数量
     List<Map> querySystemScenePackageListByTJ(SystemScenePackageParam params);
 
+
+    //查询勾选场景中自然数量
+    List<String> querySceneStandardsRegulationsListByTJ(SystemScenePackageParam po);
+    List<String> querySceneNaturalListByTJ(SystemScenePackageParam po);
+    List<String> querySceneAccidentListByTJ(SystemScenePackageParam po);
+    List<String> querySceneGeneralTemplateListByTJ(SystemScenePackageParam po);
+
 }

+ 5 - 1
simulation-resource-server/src/main/java/com/css/simulation/resource/scene/mapper/SystemScenePackageSublistMapper.java

@@ -13,6 +13,10 @@ import java.util.List;
 public interface SystemScenePackageSublistMapper {
 
     void saveSystemScenePackageSublist(List<SystemScenePackageSublistPO> list);
-    List<String> querySystemScenePackageSublistList(SystemScenePackageSublistPO po);
+    List<String> querySceneStandardsRegulationsList(SystemScenePackageSublistPO po);
+    List<String> querySceneNaturalList(SystemScenePackageSublistPO po);
+    List<String> querySceneAccidentList(SystemScenePackageSublistPO po);
+    List<String> querySceneGeneralTemplateList(SystemScenePackageSublistPO po);
+
     void deleteSystemScenePackageSublist(SystemScenePackageSublistPO po);
 }

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

@@ -148,6 +148,26 @@ public class SystemScenePackageService {
     @SneakyThrows
     public List<SystemScenePackageVO> querySystemScenePackageList(SystemScenePackageParam params) {
         List<SystemScenePackageVO> list = systemScenePackageMapper.querySystemScenePackageList(params);
+
+        for (SystemScenePackageVO vo:list) {
+
+            SystemScenePackageSublistPO sublistPo=new SystemScenePackageSublistPO();
+            sublistPo.setSceneAndPackage(vo.getId());
+            sublistPo.setSceneType("1");
+            List<String>  zrList=systemScenePackageSublistMapper.querySceneNaturalList(sublistPo);
+            sublistPo.setSceneType("2");
+            List<String>  bzList=systemScenePackageSublistMapper.querySceneStandardsRegulationsList(sublistPo);
+            sublistPo.setSceneType("3");
+            List<String>  jtList=systemScenePackageSublistMapper.querySceneAccidentList(sublistPo);
+            sublistPo.setSceneType("4");
+            List<String>  fhList=systemScenePackageSublistMapper.querySceneGeneralTemplateList(sublistPo);
+            vo.setZrCount(zrList.size());
+            vo.setBzCount(bzList.size());
+            vo.setJtCount(jtList.size());
+            vo.setFhCount(fhList.size());
+        }
+
+
         return list;
     }
     //
@@ -158,13 +178,13 @@ public class SystemScenePackageService {
         SystemScenePackageSublistPO sublistPo=new SystemScenePackageSublistPO();
         sublistPo.setSceneAndPackage(params.getId());
         sublistPo.setSceneType("1");
-       List<String>  zrList=systemScenePackageSublistMapper.querySystemScenePackageSublistList(sublistPo);
+       List<String>  zrList=systemScenePackageSublistMapper.querySceneNaturalList(sublistPo);
         sublistPo.setSceneType("2");
-        List<String>  bzList=systemScenePackageSublistMapper.querySystemScenePackageSublistList(sublistPo);
+        List<String>  bzList=systemScenePackageSublistMapper.querySceneStandardsRegulationsList(sublistPo);
         sublistPo.setSceneType("3");
-        List<String>  jtList=systemScenePackageSublistMapper.querySystemScenePackageSublistList(sublistPo);
+        List<String>  jtList=systemScenePackageSublistMapper.querySceneAccidentList(sublistPo);
         sublistPo.setSceneType("4");
-        List<String>  fhList=systemScenePackageSublistMapper.querySystemScenePackageSublistList(sublistPo);
+        List<String>  fhList=systemScenePackageSublistMapper.querySceneGeneralTemplateList(sublistPo);
         BeanUtils.copyProperties(po, newPo);
         newPo.setZrSceneNames(zrList);
         newPo.setBzSceneNames(bzList);
@@ -425,7 +445,30 @@ public class SystemScenePackageService {
     //查询勾选场景数量
     @SneakyThrows
     public ResponseBodyVO<List<Map>> querySystemScenePackageListByTJ(SystemScenePackageParam params) {
-        List<Map> list = systemScenePackageMapper.querySystemScenePackageListByTJ(params);
+       // List<Map> list = systemScenePackageMapper.querySystemScenePackageListByTJ(params);
+
+        List<String>  zrList=systemScenePackageMapper.querySceneNaturalListByTJ(params);
+        List<String>  bzList=systemScenePackageMapper.querySceneStandardsRegulationsListByTJ(params);
+        List<String>  jtList=systemScenePackageMapper.querySceneAccidentListByTJ(params);
+        List<String>  fhList=systemScenePackageMapper.querySceneGeneralTemplateListByTJ(params);
+
+        List<Map> list=new ArrayList<>();
+        Map map=new HashMap();
+        map.put("scene_type","1");
+        map.put("aaa",zrList.size());
+        Map map1=new HashMap();
+        map1.put("scene_type","2");
+        map1.put("aaa",bzList.size());
+        Map map2=new HashMap();
+        map2.put("scene_type","3");
+        map2.put("aaa",jtList.size());
+        Map map3=new HashMap();
+        map3.put("scene_type","4");
+        map3.put("aaa",fhList.size());
+        list.add(map1);
+        list.add(map2);
+        list.add(map3);
+        list.add(map);
         return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS, list);
     }
 }

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

@@ -358,6 +358,12 @@
         where natural_id = #{id,jdbcType=VARCHAR}
 
     </select>
+    <!--查询泛化场景信息-->
+    <select id="selectSceneGeneralDataById" parameterType="string" resultType="api.common.pojo.vo.project.SceneBaseInfoVo">
+        select scene_id
+        from scene_general_data
+        where id = #{id,jdbcType=VARCHAR}
+    </select>
     <!--查询标准法规场景信息-->
     <select id="selectSceneStandardsRegulations" parameterType="string" resultType="api.common.pojo.vo.project.SceneBaseInfoVo">
         select scene_name

+ 2 - 1
simulation-resource-server/src/main/resources/mapper/scene/SceneNaturalMapper.xml

@@ -394,7 +394,8 @@
         accident_id id,share,create_user_id,is_deleted
         from simulation.scene_accident  union all select
         regulations_id id,share,create_user_id,is_deleted
-        from simulation.scene_standards_regulations ) a
+        from simulation.scene_standards_regulations union all select
+        id, share,create_user_id,is_deleted from simulation.scene_general_template) a
         <where>
             is_deleted = '0'
             <if test="createUserId != null and createUserId != ''">

+ 61 - 3
simulation-resource-server/src/main/resources/mapper/scene/SystemScenePackageMapper.xml

@@ -62,12 +62,12 @@
             resultType="api.common.pojo.vo.scene.SystemScenePackageVO">
         select a.*,GROUP_CONCAT(DISTINCT(p.package_name)) as package_name from (select u.id user_id,u.is_deleted  ,username userName, company,s.package_id,s.modify_time
         from system_user  u left join system_user_scene s
-        on u.id=s.user_id and u.is_deleted = '0' and s.is_deleted = '0') a
+        on u.id=s.user_id where u.is_deleted = '0'  and  u.role_code ='2') a
         left join system_scene_package p on a.package_id = p.id AND p.is_deleted = '0'
         <where>
             a.is_deleted='0'
             <if test="userName != null and userName != ''">
-                and a.userName =#{userName,jdbcType=VARCHAR}
+                and a.userName  like  CONCAT('%',#{userName,jdbcType=VARCHAR},'%')
             </if>
             <if test="yearMax != null and yearMax != ''">
                 and #{yearMax,jdbcType=VARCHAR} &gt; a.modify_time and #{yearMin,jdbcType=VARCHAR} &lt; a.modify_time
@@ -135,7 +135,12 @@
             system_user_scene a
         LEFT 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'
-        WHERE a.is_deleted = '0' and a.user_id =#{userId}
+        WHERE a.is_deleted = '0' and a.user_id =#{userId} and c.scene_name in
+        ( select natural_name scene_name
+        from simulation.scene_natural where is_deleted='0' union all select
+         scene_name from simulation.scene_accident where is_deleted='0' union all select
+         scene_name from simulation.scene_standards_regulations where is_deleted='0' union all select
+         scene_id scene_name from simulation.scene_general_template where is_deleted='0')
 
     </select>
 
@@ -177,4 +182,57 @@
         </where>
         group by c.scene_type
     </select>
+
+
+    <select id="querySceneNaturalListByTJ" parameterType="api.common.pojo.param.scene.SystemScenePackageParam"
+            resultType="java.lang.String">
+        select a.scene_name
+        FROM system_scene_package_sublist a join  scene_natural s on a.scene_name=s.natural_name join system_scene_package b on a.scene_and_package=b.id
+        where
+            a.is_deleted='0' and s.is_deleted='0' and b.is_deleted='0' and a.scene_type='1'
+        and b.package_name in
+        <foreach collection="packageNames" item="item" index="index"
+                 separator="," open="(" close=")">
+            #{item}
+        </foreach>
+    </select>
+    <select id="querySceneStandardsRegulationsListByTJ" parameterType="api.common.pojo.param.scene.SystemScenePackageParam"
+            resultType="java.lang.String">
+        select a.scene_name
+        FROM system_scene_package_sublist a join  scene_standards_regulations s on a.scene_name=s.scene_name join system_scene_package b on a.scene_and_package=b.id
+        where
+        a.is_deleted='0' and s.is_deleted='0' and b.is_deleted='0' and a.scene_type='2'
+        and b.package_name in
+        <foreach collection="packageNames" item="item" index="index"
+                 separator="," open="(" close=")">
+            #{item}
+        </foreach>
+    </select>
+
+    <select id="querySceneAccidentListByTJ" parameterType="api.common.pojo.param.scene.SystemScenePackageParam"
+            resultType="java.lang.String">
+        select a.scene_name
+        FROM system_scene_package_sublist a join  scene_accident s on a.scene_name=s.scene_name join system_scene_package b on a.scene_and_package=b.id
+        where
+        a.is_deleted='0' and s.is_deleted='0' and b.is_deleted='0' and a.scene_type='3'
+        and b.package_name in
+        <foreach collection="packageNames" item="item" index="index"
+                 separator="," open="(" close=")">
+            #{item}
+        </foreach>
+    </select>
+
+    <select id="querySceneGeneralTemplateListByTJ" parameterType="api.common.pojo.param.scene.SystemScenePackageParam"
+            resultType="java.lang.String">
+        select a.scene_name
+        FROM system_scene_package_sublist a join  scene_general_template s on a.scene_name=s.scene_id join system_scene_package b on a.scene_and_package=b.id
+        where
+        a.is_deleted='0' and s.is_deleted='0' and b.is_deleted='0' and a.scene_type='4'
+        and b.package_name in
+        <foreach collection="packageNames" item="item" index="index"
+                 separator="," open="(" close=")">
+            #{item}
+        </foreach>
+    </select>
+
 </mapper>

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

@@ -15,11 +15,31 @@
 
 
 
-    <select id="querySystemScenePackageSublistList" parameterType="api.common.pojo.po.scene.SystemScenePackageSublistPO"
+    <select id="querySceneNaturalList" parameterType="api.common.pojo.po.scene.SystemScenePackageSublistPO"
             resultType="java.lang.String">
-        select scene_name
-        FROM system_scene_package_sublist where
-            is_deleted='0' and scene_and_package =#{sceneAndPackage} and scene_type =#{sceneType}
+        select a.scene_name
+        FROM system_scene_package_sublist a join  scene_natural s on a.scene_name=s.natural_name where
+            a.is_deleted='0' and s.is_deleted='0' and a.scene_and_package =#{sceneAndPackage} and a.scene_type =#{sceneType}
+    </select>
+    <select id="querySceneStandardsRegulationsList" parameterType="api.common.pojo.po.scene.SystemScenePackageSublistPO"
+            resultType="java.lang.String">
+        select a.scene_name
+        FROM system_scene_package_sublist a join  scene_standards_regulations s on a.scene_name=s.scene_name where
+            a.is_deleted='0' and s.is_deleted='0' and a.scene_and_package =#{sceneAndPackage} and a.scene_type =#{sceneType}
+    </select>
+
+    <select id="querySceneAccidentList" parameterType="api.common.pojo.po.scene.SystemScenePackageSublistPO"
+            resultType="java.lang.String">
+        select a.scene_name
+        FROM system_scene_package_sublist a join  scene_accident s on a.scene_name=s.scene_name where
+            a.is_deleted='0' and s.is_deleted='0' and a.scene_and_package =#{sceneAndPackage} and a.scene_type =#{sceneType}
+    </select>
+
+    <select id="querySceneGeneralTemplateList" parameterType="api.common.pojo.po.scene.SystemScenePackageSublistPO"
+            resultType="java.lang.String">
+        select a.scene_name
+        FROM system_scene_package_sublist a join  scene_general_template s on a.scene_name=s.scene_id where
+            a.is_deleted='0' and s.is_deleted='0' and a.scene_and_package =#{sceneAndPackage} and a.scene_type =#{sceneType}
     </select>
 
     <update id="deleteSystemScenePackageSublist" parameterType="api.common.pojo.po.scene.SystemScenePackageSublistPO">