Browse Source

用户预警

lin 4 years ago
parent
commit
a5b2399454

+ 4 - 2
smart-city-platform/src/main/java/com/bz/smart_city/controller/system/WarningLogController.java

@@ -32,6 +32,7 @@ public class WarningLogController {
     @GetMapping("getList")
     @ApiOperation(value = "查询预警记录列表")
     public AjaxMessage<Pagination<WarningLogDto>> getList(
+            @ApiParam(value = "场景ID", required = false) @RequestParam(required = false) Integer channelId,
             @ApiParam(value = "设备编号/电子号", required = false) @RequestParam(required = false) String deviceNo,
             @ApiParam(value = "预警类型 1:较上日用水量激增30% 2:连续无用水量超过7天", required = false) @RequestParam(required = false) Integer warningType,
             @ApiParam(value = "客户名称", required = false) @RequestParam(required = false) String clientName,
@@ -47,7 +48,7 @@ public class WarningLogController {
             @ApiParam(value = "条数,非必传,默认15条", required = false, defaultValue = "15") @RequestParam(required = false, defaultValue = "15") int pageSize
     ){
         Pagination<WarningLogDto> pageInfo = warningLogService.getList(
-                deviceNo,warningType,clientName,feedbackStatus,provinceId,cityId,regionId,communityId,buildingId,
+                channelId,deviceNo,warningType,clientName,feedbackStatus,provinceId,cityId,regionId,communityId,buildingId,
                 startDate,endDate, pageNum, pageSize);
         return new AjaxMessage<>(ResultStatus.OK, pageInfo);
     }
@@ -55,6 +56,7 @@ public class WarningLogController {
     @GetMapping("getAreaList")
     @ApiOperation(value = "查询预警记录区域列表")
     public AjaxMessage<List<BuildingSelectDto>> getAreaList(
+            @ApiParam(value = "场景ID", required = false) @RequestParam(required = false) Integer channelId,
             @ApiParam(value = "设备编号/电子号", required = false) @RequestParam(required = false) String deviceNo,
             @ApiParam(value = "预警类型 1:较上日用水量激增30% 2:连续无用水量超过7天", required = false) @RequestParam(required = false) Integer warningType,
             @ApiParam(value = "客户名称", required = false) @RequestParam(required = false) String clientName,
@@ -63,7 +65,7 @@ public class WarningLogController {
             @ApiParam(value = "开始时间 格式:yyyyMMddHHmmss", required = false) @RequestParam(required = false) @DateTimeFormat(pattern = "yyyyMMddHHmmss") LocalDateTime endDate
     ){
         List<BuildingSelectDto> list = warningLogService.getAreaList(
-                deviceNo,warningType,clientName,feedbackStatus,startDate,endDate
+                channelId,deviceNo,warningType,clientName,feedbackStatus,startDate,endDate
         );
         return new AjaxMessage<>(ResultStatus.OK, list);
     }

+ 2 - 1
smart-city-platform/src/main/java/com/bz/smart_city/dao/WarningLogMapper.java

@@ -1,6 +1,5 @@
 package com.bz.smart_city.dao;
 
-import com.bz.smart_city.commom.model.Pagination;
 import com.bz.smart_city.dto.BuildingSelectInfoDto;
 import com.bz.smart_city.dto.WarningLogDto;
 import com.bz.smart_city.entity.ProgramItem;
@@ -19,6 +18,7 @@ public interface WarningLogMapper {
 
     List<WarningLogDto> getList(
             @Param("siteId") Integer siteId,
+            @Param("channelId") Integer channelId,
             @Param("deviceNo") String deviceNo,
             @Param("warningType") Integer warningType,
             @Param("clientName") String clientName,
@@ -34,6 +34,7 @@ public interface WarningLogMapper {
 
     List<BuildingSelectInfoDto> getAreaList(
             @Param("siteId") Integer siteId,
+            @Param("channelId") Integer channelId,
             @Param("deviceNo") String deviceNo,
             @Param("warningType") Integer warningType,
             @Param("clientName") String clientName,

+ 2 - 2
smart-city-platform/src/main/java/com/bz/smart_city/service/WarningLogService.java

@@ -15,7 +15,7 @@ public interface WarningLogService{
 
     int updateByPrimaryKeySelective(WarningLog record);
 
-    Pagination<WarningLogDto> getList(String deviceNo, Integer warningType, String clientName, Integer feedbackStatus, Integer provinceId, Integer cityId, Integer regionId, Integer communityId, Integer buildingId, LocalDateTime startDate, LocalDateTime endDate, int pageNum, int pageSize);
+    Pagination<WarningLogDto> getList(Integer channelId, String deviceNo, Integer warningType, String clientName, Integer feedbackStatus, Integer provinceId, Integer cityId, Integer regionId, Integer communityId, Integer buildingId, LocalDateTime startDate, LocalDateTime endDate, int pageNum, int pageSize);
 
-    List<BuildingSelectDto> getAreaList(String deviceNo, Integer warningType, String clientName, Integer feedbackStatus, LocalDateTime startDate, LocalDateTime endDate);
+    List<BuildingSelectDto> getAreaList(Integer channelId, String deviceNo, Integer warningType, String clientName, Integer feedbackStatus, LocalDateTime startDate, LocalDateTime endDate);
 }

+ 4 - 4
smart-city-platform/src/main/java/com/bz/smart_city/service/impl/WarningLogServiceImpl.java

@@ -38,17 +38,17 @@ public class WarningLogServiceImpl implements WarningLogService{
     }
 
     @Override
-    public Pagination<WarningLogDto> getList(String deviceNo, Integer warningType, String clientName, Integer feedbackStatus, Integer provinceId, Integer cityId, Integer regionId, Integer communityId, Integer buildingId, LocalDateTime startDate, LocalDateTime endDate, int pageNum, int pageSize) {
+    public Pagination<WarningLogDto> getList(Integer channelId, String deviceNo, Integer warningType, String clientName, Integer feedbackStatus, Integer provinceId, Integer cityId, Integer regionId, Integer communityId, Integer buildingId, LocalDateTime startDate, LocalDateTime endDate, int pageNum, int pageSize) {
         LoginUser loginUser = UserUtil.getCurrentUser();
         PageHelper.startPage(pageNum,pageSize);
-        List<WarningLogDto> list =  warningLogMapper.getList(loginUser.getSiteId(),deviceNo,warningType,clientName,feedbackStatus,provinceId,cityId,regionId,communityId,buildingId,startDate,endDate,UserUtil.getCurrentSiteProgramItems(loginUser));
+        List<WarningLogDto> list =  warningLogMapper.getList(loginUser.getSiteId(),channelId,deviceNo,warningType,clientName,feedbackStatus,provinceId,cityId,regionId,communityId,buildingId,startDate,endDate,UserUtil.getCurrentSiteProgramItems(loginUser));
         return new Pagination<>(list);
     }
 
     @Override
-    public List<BuildingSelectDto> getAreaList(String deviceNo, Integer warningType, String clientName, Integer feedbackStatus, LocalDateTime startDate, LocalDateTime endDate) {
+    public List<BuildingSelectDto> getAreaList(Integer channelId, String deviceNo, Integer warningType, String clientName, Integer feedbackStatus, LocalDateTime startDate, LocalDateTime endDate) {
         LoginUser loginUser = UserUtil.getCurrentUser();
-        List<BuildingSelectInfoDto> buildingList = warningLogMapper.getAreaList(loginUser.getSiteId(),deviceNo,warningType,clientName,feedbackStatus,startDate,endDate,UserUtil.getCurrentSiteProgramItems(loginUser));
+        List<BuildingSelectInfoDto> buildingList = warningLogMapper.getAreaList(loginUser.getSiteId(),channelId,deviceNo,warningType,clientName,feedbackStatus,startDate,endDate,UserUtil.getCurrentSiteProgramItems(loginUser));
         return buildingService.areaList(buildingList);
     }
 }

+ 2 - 0
smart-city-platform/src/main/resources/mapper/WarningLogMapper.xml

@@ -148,6 +148,7 @@
     <if test="programItems != null and programItems.size() != 0">left join sc_device_dimension sdd on (sdd.device_id = sd.id and sdd.status = 1)</if>
     where swl.status = 1 and sd.status = 1
     <if test="siteId != null"> and sd.site_id = #{siteId}</if>
+    <if test="channelId != null"> and sd.sys_id = #{channelId}</if>
     <if test="deviceNo != null and deviceNo != ''"> and (
       sd.device_no LIKE concat('%',#{deviceNo},'%') or sd.water_meter_no LIKE concat('%',#{deviceNo},'%')
     )</if>
@@ -191,6 +192,7 @@
     <if test="programItems != null and programItems.size() != 0">left join sc_device_dimension sdd on (sdd.device_id = sd.id and sdd.status = 1)</if>
     where swl.status = 1 and sd.status = 1
     <if test="siteId != null"> and sd.site_id = #{siteId}</if>
+    <if test="channelId != null"> and sd.sys_id = #{channelId}</if>
     <if test="deviceNo != null and deviceNo != ''"> and (
       sd.device_no LIKE concat('%',#{deviceNo},'%') or sd.water_meter_no LIKE concat('%',#{deviceNo},'%')
       )</if>