Browse Source

管网区分压力流量和水质

wangyangyang 4 years ago
parent
commit
80d9d2a737

+ 2 - 1
sms_water/src/main/java/com/huaxu/controller/AppReportMonitorController.java

@@ -66,8 +66,9 @@ public class AppReportMonitorController {
     @RequestMapping(value = "getDeviceByCompanyForPipeNetwork",method = RequestMethod.GET)
     @RequestMapping(value = "getDeviceByCompanyForPipeNetwork",method = RequestMethod.GET)
     @ApiOperation(value = "App报表展示——公司管网设备查询(点击公司查询水厂)")
     @ApiOperation(value = "App报表展示——公司管网设备查询(点击公司查询水厂)")
     public AjaxMessage<List<DeviceEntity>> getDeviceByCompanyForPipeNetwork(
     public AjaxMessage<List<DeviceEntity>> getDeviceByCompanyForPipeNetwork(
+            @ApiParam(value = "场景类型名称:压力、流量、水质") @RequestParam(required = false)  String typeName,
             @ApiParam(value = "公司id") @RequestParam Integer companyOrgId){
             @ApiParam(value = "公司id") @RequestParam Integer companyOrgId){
-        return new AjaxMessage<>(ResultStatus.OK,appReportMonitorService.getDeviceByCompany(companyOrgId));
+        return new AjaxMessage<>(ResultStatus.OK,appReportMonitorService.getDeviceByCompany(typeName,companyOrgId));
     }
     }
 
 
     @RequestMapping(value = "getWaterQualification",method = RequestMethod.GET)
     @RequestMapping(value = "getWaterQualification",method = RequestMethod.GET)

+ 5 - 4
sms_water/src/main/java/com/huaxu/dao/AppReportMonitorMapper.java

@@ -21,10 +21,11 @@ public interface AppReportMonitorMapper {
                                         @Param("permissonType")Integer permissonType,
                                         @Param("permissonType")Integer permissonType,
                                         @Param("programItems")List<ProgramItem> programItems);
                                         @Param("programItems")List<ProgramItem> programItems);
 
 
-    List<DeviceEntity> getDeviceByCompany(@Param("companyOrgId") Integer companyOrgId ,
-                                        @Param("tenantId")String tenantId, @Param("userType")String userType,
-                                        @Param("permissonType")Integer permissonType,
-                                        @Param("programItems")List<ProgramItem> programItems);
+    List<DeviceEntity> getDeviceByCompany(@Param("typeName") String typeName ,
+                                          @Param("companyOrgId") Integer companyOrgId ,
+                                          @Param("tenantId")String tenantId, @Param("userType")String userType,
+                                          @Param("permissonType")Integer permissonType,
+                                          @Param("programItems")List<ProgramItem> programItems);
 
 
     List<Integer> getCompanyBySceneCondition(@Param("sceneType") String sceneType,@Param("condition") String condition ,
     List<Integer> getCompanyBySceneCondition(@Param("sceneType") String sceneType,@Param("condition") String condition ,
                                              @Param("tenantId")String tenantId, @Param("userType")String userType,
                                              @Param("tenantId")String tenantId, @Param("userType")String userType,

+ 1 - 1
sms_water/src/main/java/com/huaxu/service/AppReportMonitorService.java

@@ -24,7 +24,7 @@ public interface AppReportMonitorService {
 
 
     CompanySceneInfoDto getSceneByCompanyBySearch(String sceneTypeName, String condition);
     CompanySceneInfoDto getSceneByCompanyBySearch(String sceneTypeName, String condition);
 
 
-    List<DeviceEntity> getDeviceByCompany(Integer companyOrgId);
+    List<DeviceEntity> getDeviceByCompany(String typeName,Integer companyOrgId);
 
 
     CompanySceneInfoDto getDeviceByCompanyBySearch( String condition);
     CompanySceneInfoDto getDeviceByCompanyBySearch( String condition);
 
 

+ 6 - 6
sms_water/src/main/java/com/huaxu/service/impl/AppReportMonitorServiceImpl.java

@@ -54,9 +54,9 @@ public class AppReportMonitorServiceImpl  implements AppReportMonitorService {
     }
     }
 
 
     @Override
     @Override
-    public List<DeviceEntity> getDeviceByCompany(Integer companyOrgId) {
+    public List<DeviceEntity> getDeviceByCompany(String typeName,Integer companyOrgId) {
         LoginUser loginUser = UserUtil.getCurrentUser();
         LoginUser loginUser = UserUtil.getCurrentUser();
-        return appReportMonitorMapper.getDeviceByCompany(companyOrgId,loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
+        return appReportMonitorMapper.getDeviceByCompany(typeName,companyOrgId,loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
     }
     }
     @Override
     @Override
     public CompanySceneInfoDto getSceneByCompanyBySearch(String sceneTypeName, String condition) {
     public CompanySceneInfoDto getSceneByCompanyBySearch(String sceneTypeName, String condition) {
@@ -76,16 +76,16 @@ public class AppReportMonitorServiceImpl  implements AppReportMonitorService {
     }
     }
 
 
     @Override
     @Override
-    public CompanySceneInfoDto getDeviceByCompanyBySearch( String condition) {
+    public CompanySceneInfoDto getDeviceByCompanyBySearch(String condition) {
         LoginUser loginUser = UserUtil.getCurrentUser();
         LoginUser loginUser = UserUtil.getCurrentUser();
         //模糊查询设备所属公司id
         //模糊查询设备所属公司id
         List<Integer> companyIds = appReportMonitorMapper.getCompanyByDeviceCondition(condition,loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
         List<Integer> companyIds = appReportMonitorMapper.getCompanyByDeviceCondition(condition,loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
         //先查询公司
         //先查询公司
         List<OrgBaseTreeInfoDto> orgBaseTreeInfoDtos = userCenterClient.getCompanyByUser(condition,companyIds);
         List<OrgBaseTreeInfoDto> orgBaseTreeInfoDtos = userCenterClient.getCompanyByUser(condition,companyIds);
         //有公司的展示第一个公司信息
         //有公司的展示第一个公司信息
-        if(orgBaseTreeInfoDtos.size() > 0){
-            List<DeviceEntity> deviceEntities = appReportMonitorMapper.getDeviceByCompany(orgBaseTreeInfoDtos.get(0).getId(),loginUser.getTenantId(),loginUser.getType(),loginUser.getPermissonType(),loginUser.getProgramItemList());
-            return new CompanySceneInfoDto(orgBaseTreeInfoDtos,null,deviceEntities);
+        if(orgBaseTreeInfoDtos.size() > 0) {
+            List<DeviceEntity> deviceEntities = appReportMonitorMapper.getDeviceByCompany(null, orgBaseTreeInfoDtos.get(0).getId(), loginUser.getTenantId(), loginUser.getType(), loginUser.getPermissonType(), loginUser.getProgramItemList());
+            return new CompanySceneInfoDto(orgBaseTreeInfoDtos, null, deviceEntities);
         }
         }
 
 
 
 

+ 4 - 1
sms_water/src/main/resources/mapper/AppReportMonitorMapper.xml

@@ -53,10 +53,14 @@
         from sms_scene_type st
         from sms_scene_type st
         left join sms_scene s on st.id=s.SCENE_TYPE_ID
         left join sms_scene s on st.id=s.SCENE_TYPE_ID
         LEFT JOIN sms_scene sc on substring_index(substring_index(sc.parent_scene_ids, ',', 2), ',', -1)=s.id
         LEFT JOIN sms_scene sc on substring_index(substring_index(sc.parent_scene_ids, ',', 2), ',', -1)=s.id
+        left join sms_scene_type sct on sct.id=sc.SCENE_TYPE_ID
         left join sms_device_scene ds on ds.SCENE_ID =sc.id
         left join sms_device_scene ds on ds.SCENE_ID =sc.id
         left join sms_device d on d.id=ds.DEVICE_ID
         left join sms_device d on d.id=ds.DEVICE_ID
         where st.STATUS = 1 and s.STATUS = 1 and ds.`STATUS` =1 and d.`STATUS` =1 and d.ENABLE_STATE =1
         where st.STATUS = 1 and s.STATUS = 1 and ds.`STATUS` =1 and d.`STATUS` =1 and d.ENABLE_STATE =1
         and st.SCENE_TYPE_NAME = '管网'
         and st.SCENE_TYPE_NAME = '管网'
+        <if test="typeName != null and typeName !=''">
+            and sct.SCENE_TYPE_NAME =#{typeName}
+        </if>
         and  s.COMPANY_ORG_ID = #{companyOrgId}
         and  s.COMPANY_ORG_ID = #{companyOrgId}
         and s.TENANT_ID = #{tenantId}
         and s.TENANT_ID = #{tenantId}
         <if test="userType!=null and userType!=-999 and userType!=-9999 and  programItems != null and programItems.size() > 0">
         <if test="userType!=null and userType!=-999 and userType!=-9999 and  programItems != null and programItems.size() > 0">
@@ -88,7 +92,6 @@
         </if>
         </if>
         order by s.SCENE_NAME
         order by s.SCENE_NAME
     </select>
     </select>
-
     <select id="getCompanyBySceneCondition" resultType="java.lang.Integer">
     <select id="getCompanyBySceneCondition" resultType="java.lang.Integer">
         select
         select
         distinct
         distinct