Преглед изворни кода

Merge remote-tracking branch 'origin/20210223' into 20210308

# Conflicts:
#	smart-city-platform/src/main/java/com/bz/smart_city/commom/security/platform/PlatformCheckUserFilter.java
#	smart-city-platform/src/main/java/com/bz/smart_city/commom/security/platform/PlatformLoginUserDetailService.java
hym пре 4 година
родитељ
комит
060ebd4b71
36 измењених фајлова са 1737 додато и 38 уклоњено
  1. 9 0
      smart-city-platform/src/main/java/com/bz/smart_city/commom/security/platform/SmsCodeException.java
  2. 51 0
      smart-city-platform/src/main/java/com/bz/smart_city/commom/util/SendWechatPush.java
  3. 70 9
      smart-city-platform/src/main/java/com/bz/smart_city/controller/common/TestController.java
  4. 2 1
      smart-city-platform/src/main/java/com/bz/smart_city/controller/system/WarningLogController.java
  5. 98 0
      smart-city-platform/src/main/java/com/bz/smart_city/dao/GridManagementMapper.java
  6. 1 0
      smart-city-platform/src/main/java/com/bz/smart_city/dao/WarningLogMapper.java
  7. 19 0
      smart-city-platform/src/main/java/com/bz/smart_city/dao/WarningMessageMapper.java
  8. 3 0
      smart-city-platform/src/main/java/com/bz/smart_city/dto/CommunityDto.java
  9. 3 0
      smart-city-platform/src/main/java/com/bz/smart_city/entity/Community.java
  10. 75 0
      smart-city-platform/src/main/java/com/bz/smart_city/entity/GridManagement.java
  11. 3 0
      smart-city-platform/src/main/java/com/bz/smart_city/entity/WarningLog.java
  12. 42 0
      smart-city-platform/src/main/java/com/bz/smart_city/entity/WarningMessage.java
  13. 10 0
      smart-city-platform/src/main/java/com/bz/smart_city/grid/GridInfo.java
  14. 170 0
      smart-city-platform/src/main/java/com/bz/smart_city/grid/GridManagementController.java
  15. 89 0
      smart-city-platform/src/main/java/com/bz/smart_city/grid/GridManagementService.java
  16. 153 0
      smart-city-platform/src/main/java/com/bz/smart_city/grid/GridManagementServiceImpl.java
  17. 25 0
      smart-city-platform/src/main/java/com/bz/smart_city/grid/GridUser.java
  18. 1 1
      smart-city-platform/src/main/java/com/bz/smart_city/service/WarningLogService.java
  19. 4 8
      smart-city-platform/src/main/java/com/bz/smart_city/service/impl/WarningLogServiceImpl.java
  20. 7 7
      smart-city-platform/src/main/resources/application-dev.properties
  21. 18 8
      smart-city-platform/src/main/resources/mapper/CommunityMapper.xml
  22. 189 0
      smart-city-platform/src/main/resources/mapper/GridManagementMapper.xml
  23. 1 1
      smart-city-platform/src/main/resources/mapper/UserMapper.xml
  24. 18 3
      smart-city-platform/src/main/resources/mapper/WarningLogMapper.xml
  25. 114 0
      smart-city-platform/src/main/resources/mapper/WarningMessageMapper.xml
  26. 111 0
      water_query_api/src/main/java/com/bz/smart_city/controller/GridManagementController.java
  27. 81 0
      water_query_api/src/main/java/com/bz/smart_city/dao/GridManagementMapper.java
  28. 64 0
      water_query_api/src/main/java/com/bz/smart_city/entity/GridManagement.java
  29. 78 0
      water_query_api/src/main/java/com/bz/smart_city/service/GridManagementService.java
  30. 109 0
      water_query_api/src/main/java/com/bz/smart_city/service/impl/GridManagementServiceImpl.java
  31. 29 0
      water_query_api/src/main/java/com/zcxk/controller/WaterApiController.java
  32. 3 0
      water_query_api/src/main/java/com/zcxk/entity/WarningLog.java
  33. 1 0
      water_query_api/src/main/java/com/zcxk/service/WarningRuleService.java
  34. 27 0
      water_query_api/src/main/java/com/zcxk/service/impl/WarningRuleServiceImpl.java
  35. 4 0
      water_query_api/src/main/resources/application-dev.properties
  36. 55 0
      water_query_api/src/main/resources/application-prd.properties

+ 9 - 0
smart-city-platform/src/main/java/com/bz/smart_city/commom/security/platform/SmsCodeException.java

@@ -0,0 +1,9 @@
+package com.bz.smart_city.commom.security.platform;
+
+import org.springframework.security.core.AuthenticationException;
+
+public class SmsCodeException extends AuthenticationException {
+    public SmsCodeException(String msg) {
+        super(msg);
+    }
+}

+ 51 - 0
smart-city-platform/src/main/java/com/bz/smart_city/commom/util/SendWechatPush.java

@@ -662,4 +662,55 @@ public class SendWechatPush {
             return "accessToken不存在";
         }
     }
+
+
+    /**
+     * 统一消息发送异常通知(微信公众号和小程序)
+     */
+    public static String sendAbnormalNotice(String accessToken,String oa_appid, String openId, String url,String weapp_appid, String pagepath, String first, String keyword1, String keyword2, String keyword3, String remark) {
+        if (accessToken != null && !"".equals(accessToken)) {
+            String sendUrl = "https://api.weixin.qq.com/cgi-bin/message/wxopen/template/uniform_send?access_token=" + accessToken;
+            String json = "{\n" +
+                    "  \"touser\": \""+openId+"\",\n" +
+                    "  \"mp_template_msg\": {\n" +
+                    "    \"appid\": \""+oa_appid +"\",\n" +
+                    "    \"template_id\": \"r8mtd2mgMt8w-sNgHsJ4deoD2bfq-0RyK9lCY3WEoxI\",\n" +
+                    "    \"url\": \""+url+"\",\n" +
+                    "    \"miniprogram\": {\n" +
+                    "      \"appid\": \""+weapp_appid+"\",\n" +
+                    "      \"pagepath\": \""+pagepath+"\"\n" +
+                    "    },\n" +
+                    "    \"data\": {\n" +
+                    "      \"first\": {\n" +
+                    "        \"value\": \""+first+"\",\n" +
+                    "        \"color\": \"#173177\"\n" +
+                    "      },\n" +
+                    "      \"keyword1\": {\n" +
+                    "        \"value\": \""+keyword1+"\",\n" +
+                    "        \"color\": \"#173177\"\n" +
+                    "      },\n" +
+                    "      \"keyword2\": {\n" +
+                    "        \"value\": \""+keyword2+"\",\n" +
+                    "        \"color\": \"#173177\"\n" +
+                    "      },\n" +
+                    "      \"keyword3\": {\n" +
+                    "        \"value\": \""+keyword3+"\",\n" +
+                    "        \"color\": \"#173177\"\n" +
+                    "      },\n" +
+                    "      \"remark\": {\n" +
+                    "        \"value\": \""+remark+"\",\n" +
+                    "        \"color\": \"#173177\"\n" +
+                    "      }\n" +
+                    "    }\n" +
+                    "  }\n" +
+                    "}";
+            try {
+                return HttpRequest.doPost(sendUrl, json);
+            } catch (IOException e) {
+                return null;
+            }
+        } else {
+            return "accessToken不存在";
+        }
+    }
 }

+ 70 - 9
smart-city-platform/src/main/java/com/bz/smart_city/controller/common/TestController.java

@@ -6,13 +6,10 @@ import com.bz.smart_city.commom.model.AjaxMessage;
 import com.bz.smart_city.commom.model.ResultStatus;
 import com.bz.smart_city.commom.util.*;
 import com.bz.smart_city.config.AccessTokenService;
-import com.bz.smart_city.dao.PermissionMapper;
-import com.bz.smart_city.dao.SitePermissionMapper;
+import com.bz.smart_city.dao.*;
 import com.bz.smart_city.dto.LoginUser;
 import com.bz.smart_city.dto.ZipStreamEntity;
-import com.bz.smart_city.entity.Permission;
-import com.bz.smart_city.entity.SitePermission;
-import com.bz.smart_city.entity.User;
+import com.bz.smart_city.entity.*;
 import com.bz.smart_city.quartz.entity.QuartzEntity;
 import com.bz.smart_city.quartz.job.WaterMeterReadJobV2;
 import com.bz.smart_city.quartz.service.JobAndTriggerService;
@@ -78,6 +75,8 @@ public class TestController {
     @Autowired
     private DeviceService deviceService;
     @Autowired
+    private DeviceMapper deviceMapper;
+    @Autowired
     private PublisherService publisherService;
     @Autowired
     private BPMNService bpmnService;
@@ -89,6 +88,12 @@ public class TestController {
     SitePermissionMapper sitePermissionMapper;
     @Autowired
     MeterReadRecordService meterReadRecordService;
+    @Resource
+    WarningLogMapper warningLogMapper;
+    @Resource
+    WarningMessageMapper warningMessageMapper;
+    @Autowired
+    private GridManagementMapper gridManagementMapper;
 
     @GetMapping("test")
     @ApiOperation(value = "test")
@@ -131,8 +136,8 @@ public class TestController {
             @ApiParam(value = "opendid", required = true) @RequestParam String opendid
     ) {
         String accessToken = accessTokenService.getMpAccessToken();
-        String url = "http://smartcity.100zone.cn";
-        String pagepath = "pages/workorder/detail?orderNo=2019031904500057";
+        String url = "https://www.zoniot.com";
+        String pagepath = "";
         /*SendWechatPush.sendDeviceFaultNotice(accessToken,opendid,url,"您好,您的监控设备发生了故障","电气火灾探测器","TR-18WD01L",
                 "1305办公室","过压","2018-10-25 17:59:32","请尽快查看故障详细信息并及时处理");*/
         /*SendWechatPush.sendDeviceAlarmNotice(accessToken,opendid,url,"您好,您的监控设备发生了报警","电气火灾探测器","TR-18WD01L",
@@ -140,8 +145,10 @@ public class TestController {
         /*String result = SendWechatPush.sendDispatchNotice(accessToken, opendid, url, "您好,您有新派单待处理", "张三", "T3-207室",
                 "电气火灾探测器-025A", "供电中断", "2018-10-25 17:59:32", "请尽快查看并及时处理");*/
 
-        String result = SendWechatPush.sendUniformNotice(accessToken, "wx6b2ce547cd593413", opendid, url, "wx890c58705ee4e2de", pagepath, "您好,您有新派单待处理", "张三", "T3-207室",
-                "电气火灾探测器-025A", "供电中断", "2018-10-25 17:59:32", "请尽快查看并及时处理");
+        /*String result = SendWechatPush.sendUniformNotice(accessToken, "wx6b2ce547cd593413", opendid, url, "wx890c58705ee4e2de", pagepath, "您好,您有新派单待处理", "张三", "T3-207室",
+                "电气火灾探测器-025A", "供电中断", "2018-10-25 17:59:32", "请尽快查看并及时处理");*/
+        String result = SendWechatPush.sendAbnormalNotice(accessToken, "wx6b2ce547cd593413", opendid, url, "wx759db34b9c2e1491", pagepath, "用户用水异常", "水量预警", "单日用水量超过2吨",
+                "2021-02-23 17:59:32", "1030844808林家栋13765510000长泽花园2-1-502楼梯间用水量有异常情况,请及时关注用户情况!");
         log.info(result);
         return new AjaxMessage(ResultStatus.OK);
     }
@@ -486,4 +493,58 @@ public class TestController {
         //int result = deviceService.importRemoteMeterExcel(file);
         return "ok";
     }
+
+    @ResponseBody
+    @GetMapping("/addDemoWarningLog")
+    @ApiOperation(value = "添加演示告警记录", notes = "添加演示告警记录")
+    public String addDemoWarningLog(
+            @ApiParam(value = "openId", required = true) @RequestParam String openId,
+            @ApiParam(value = "deviceId", required = true) @RequestParam Long deviceId,
+            @ApiParam(value = "type", required = true) @RequestParam Integer type
+    ) {
+        //int result = deviceService.importRemoteMeterExcel(file);
+        WarningLog warningLogNew = new WarningLog();
+        //warningLogNew.setClientUserId(clientUserDevice.getClientUserId());
+        warningLogNew.setDeviceId(deviceId);
+        warningLogNew.setWarningType(type);
+        warningLogNew.setFeedbackStatus(0);
+        warningLogNew.setFeedbackContent("");
+        warningLogNew.setLastDate(LocalDateTime.now());
+        warningLogNew.setStatus(1);
+        warningLogNew.setCreateBy("system");
+        warningLogNew.setDateCreate(LocalDateTime.now());
+        warningLogNew.setUpdateBy("system");
+        warningLogNew.setDateUpdate(LocalDateTime.now());
+        warningLogMapper.insertSelective(warningLogNew);
+
+
+        String content = "";
+        if(type==1)content="较上日用水量激增30%";
+        if(type==2)content="连续无用水量数据7天";
+        if(type==3)content="单日用水量少于0.01吨";
+        if(type==4)content="单日用水量超过2吨";
+
+        WarningMessage warningMessageNew = new WarningMessage();
+        warningMessageNew.setWarningLogId(warningLogNew.getId());
+        warningMessageNew.setContent(content);
+        warningMessageNew.setStatus(1);
+        warningMessageNew.setCreateBy("system");
+        warningMessageNew.setDateCreate(LocalDateTime.now());
+        warningMessageNew.setUpdateBy("system");
+        warningMessageNew.setDateUpdate(LocalDateTime.now());
+        warningMessageMapper.insertSelective(warningMessageNew);
+        DateTimeFormatter df = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+        Device device = deviceMapper.findByDeviceId(deviceId);
+        GridManagement gridManagement = gridManagementMapper.getByDeviceId(deviceId);
+
+        String accessToken = accessTokenService.getMpAccessToken();
+        String url = "https://www.zoniot.com";
+        String pagepath = "";
+        String result = SendWechatPush.sendAbnormalNotice(accessToken, "wx6b2ce547cd593413", openId, url, "wx27f831675081e293", pagepath, "用户用水异常", "水量预警", content,
+                LocalDateTime.now().format(df), device.getWaterMeterNo()+gridManagement.getCustomerName()+gridManagement.getCustomerPhone()+device.getLocDesc()+"用水量有异常情况,请及时关注用户情况!");
+        log.info(result);
+        return "ok";
+    }
+
 }

+ 2 - 1
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) Long deviceId,
             @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,
@@ -48,7 +49,7 @@ public class WarningLogController {
             @ApiParam(value = "条数,非必传,默认15条", required = false, defaultValue = "15") @RequestParam(required = false, defaultValue = "15") int pageSize
     ){
         Pagination<WarningLogDto> pageInfo = warningLogService.getList(
-                channelId,deviceNo,warningType,clientName,feedbackStatus,provinceId,cityId,regionId,communityId,buildingId,
+                deviceId,channelId,deviceNo,warningType,clientName,feedbackStatus,provinceId,cityId,regionId,communityId,buildingId,
                 startDate,endDate, pageNum, pageSize);
         return new AjaxMessage<>(ResultStatus.OK, pageInfo);
     }

+ 98 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dao/GridManagementMapper.java

@@ -0,0 +1,98 @@
+package com.bz.smart_city.dao;
+
+import com.bz.smart_city.entity.Building;
+import com.bz.smart_city.entity.Community;
+import com.bz.smart_city.entity.Device;
+import com.bz.smart_city.entity.GridManagement;
+import com.bz.smart_city.grid.GridUser;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * (GridManagement)表数据库访问层
+ *
+ * @author hym
+ * @since 2021-02-23 11:48:07
+ */
+@Mapper
+public interface GridManagementMapper {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    GridManagement selectById(Integer id);
+
+
+    /**
+     * 查询全部
+     *
+     * @return 对象列表
+     */
+    List<GridManagement> selectAll();
+
+    /**
+     * 通过实体作为筛选条件查询
+     *
+     * @param gridManagement 实例对象
+     * @return 对象列表
+     */
+    List<GridManagement> selectList(GridManagement gridManagement);
+
+    /**
+     * 新增数据
+     *
+     * @param gridManagement 实例对象
+     * @return 影响行数
+     */
+    int insert(GridManagement gridManagement);
+
+    /**
+     * 批量新增
+     *
+     * @param gridManagements 实例对象的集合
+     * @return 影响行数
+     */
+    int batchInsert(@Param("gridManagements") List<GridManagement> gridManagements);
+
+    /**
+     * 修改数据
+     *
+     * @param gridManagement 实例对象
+     * @return 影响行数
+     */
+    int update(GridManagement gridManagement);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 影响行数
+     */
+    int deleteById(Integer id);
+
+    /**
+     * 查询总数据数
+     *
+     * @return 数据总数
+     */
+    int count();
+
+    List<GridUser> selectGirdUserInfo(@Param("username") String username,
+                                      @Param("orgId")Integer orgId,
+                                      @Param("roleId") Integer roleId,
+                                      @Param("siteId") Integer siteId);
+
+    List<Community> getCommutityByOrg(@Param("orgId") Integer orgId);
+
+    List<Building> getBuildingByCommutity(@Param("commutityId") Integer commutityId);
+
+    List<Device> getDevices(@Param("buildingId") Integer buildingId,
+                            @Param("userId") Integer userId,@Param("address") String address);
+
+    GridManagement getByDeviceId(@Param("deviceId") Long deviceId);
+}

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

@@ -18,6 +18,7 @@ public interface WarningLogMapper {
 
     List<WarningLogDto> getList(
             @Param("siteId") Integer siteId,
+            @Param("deviceId") Long deviceId,
             @Param("channelId") Integer channelId,
             @Param("deviceNo") String deviceNo,
             @Param("warningType") Integer warningType,

+ 19 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dao/WarningMessageMapper.java

@@ -0,0 +1,19 @@
+package com.bz.smart_city.dao;
+
+import com.bz.smart_city.entity.WarningMessage;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface WarningMessageMapper {
+    int insertSelective(WarningMessage record);
+
+    int updateByPrimaryKeySelective(WarningMessage record);
+
+    int batchInsert(@Param("list") List<WarningMessage> list);
+
+    WarningMessage findById(@Param("id") Integer id);
+
+}

+ 3 - 0
smart-city-platform/src/main/java/com/bz/smart_city/dto/CommunityDto.java

@@ -22,4 +22,7 @@ public class CommunityDto extends Community {
     @ApiModelProperty(value = "片区区", position = 4)
     private String districtName;
 
+    @ApiModelProperty(value = "机构名称", position = 5)
+    private String orgName;
+
 }

+ 3 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/Community.java

@@ -53,6 +53,9 @@ public class Community implements Serializable {
     @ApiModelProperty(value="状态", hidden = true)
     private Integer status;
 
+    @ApiModelProperty(value="机构id", required = true)
+    private Integer orgId;
+
     @ApiModelProperty(value="创建时间", hidden = true)
     private LocalDateTime dateCreate;
 

+ 75 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/GridManagement.java

@@ -0,0 +1,75 @@
+package com.bz.smart_city.entity;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * (GridManagement)实体类
+ *
+ * @author hym
+ * @since 2021-02-23 11:48:07
+ */
+@Data
+@ApiModel
+public class GridManagement implements Serializable {
+    private static final long serialVersionUID = 458833882113660963L;
+    /**
+     * 主键
+     */
+    @ApiModelProperty(value = "主键")
+    private Integer id;
+    /**
+     * 设备id
+     */
+    @ApiModelProperty(value = "设备id")
+    private Long deviceId;
+    /**
+     * 客户编号
+     */
+    @ApiModelProperty(value = "客户编号")
+    private String customerNo;
+    /**
+     * 客户手机
+     */
+    @ApiModelProperty(value = "客户手机")
+    private String customerPhone;
+    /**
+     * 客户名称
+     */
+    @ApiModelProperty(value = "客户名称")
+    private String customerName;
+    /**
+     * 标签
+     */
+    @ApiModelProperty(value = "标签")
+    private String label;
+    /**
+     * 紧急联系人
+     */
+    @ApiModelProperty(value = "紧急联系人")
+    private String emergencyContact;
+    /**
+     * 紧急联系人电话
+     */
+    @ApiModelProperty(value = "紧急联系人电话")
+    private String emergencyContactPhoneNumber;
+    /**
+     * 用户id
+     */
+    @ApiModelProperty(value = "用户id")
+    private Integer userId;
+    @ApiModelProperty(value = "水表电子号")
+    private String waterMeterNo;
+    @ApiModelProperty(value = "水表档案号")
+    private String waterMeterFileNo;
+    @ApiModelProperty(value = "机构")
+    private String orgName;
+    @ApiModelProperty(value = "建筑")
+    private String bulidingName;
+    @ApiModelProperty(value = "安装地址")
+    private String address;
+
+}

+ 3 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/WarningLog.java

@@ -28,6 +28,9 @@ public class WarningLog {
     @ApiModelProperty(value="反馈内容")
     private String feedbackContent;
 
+    @ApiModelProperty(value="最后预警时间")
+    private LocalDateTime lastDate;
+
     @JsonIgnore
     @ApiModelProperty(value="")
     private Integer status;

+ 42 - 0
smart-city-platform/src/main/java/com/bz/smart_city/entity/WarningMessage.java

@@ -0,0 +1,42 @@
+package com.bz.smart_city.entity;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.time.LocalDateTime;
+
+@ApiModel(value="com-zcxk-water-entity-WarningMessage")
+@Data
+public class WarningMessage {
+    @ApiModelProperty(value="")
+    private Integer id;
+
+    @ApiModelProperty(value="")
+    private Integer warningLogId;
+
+    @ApiModelProperty(value="")
+    private String content;
+
+    @ApiModelProperty(value="")
+    private Integer status;
+
+    @JsonIgnore
+    @ApiModelProperty(value="",hidden = true)
+    private String createBy;
+
+    @ApiModelProperty(value="")
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private LocalDateTime dateCreate;
+
+    @JsonIgnore
+    @ApiModelProperty(value="",hidden = true)
+    private String updateBy;
+
+    @JsonIgnore
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value="",hidden = true)
+    private LocalDateTime dateUpdate;
+}

+ 10 - 0
smart-city-platform/src/main/java/com/bz/smart_city/grid/GridInfo.java

@@ -0,0 +1,10 @@
+package com.bz.smart_city.grid;
+
+import lombok.Data;
+
+import java.util.List;
+@Data
+public class GridInfo {
+    private Integer userId;
+    private List<Long> deviceIds;
+}

+ 170 - 0
smart-city-platform/src/main/java/com/bz/smart_city/grid/GridManagementController.java

@@ -0,0 +1,170 @@
+package com.bz.smart_city.grid;
+
+import com.bz.smart_city.commom.model.AjaxMessage;
+import com.bz.smart_city.commom.model.Pagination;
+import com.bz.smart_city.commom.model.ResultStatus;
+import com.bz.smart_city.entity.Building;
+import com.bz.smart_city.entity.Community;
+import com.bz.smart_city.entity.Device;
+import com.bz.smart_city.entity.GridManagement;
+
+
+import com.github.pagehelper.PageHelper;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * (GridManagement)控制层
+ *
+ * @author hym
+ * @since 2021-02-23 11:47:59
+ */
+@RestController
+@RequestMapping("/gridManagement")
+@Api(tags = "网格管理")
+public class GridManagementController {
+    /**
+     * 服务对象
+     */
+    @Autowired
+    private GridManagementService gridManagementService;
+
+
+
+    /**
+     * 新增一条数据
+     *
+     * @param gridInfo 实体类
+     * @return Response对象
+     */
+    @RequestMapping(value = "insert", method = RequestMethod.POST)
+    @ApiOperation(value = "插入网格管理户表信息")
+    public AjaxMessage<Integer> insert(@ApiParam(value = "设置配置", required = true) @RequestBody GridInfo gridInfo) {
+        int result = gridManagementService.insert(gridInfo);
+
+        return new AjaxMessage<>(ResultStatus.OK, result);
+    }
+
+    /**
+     * 修改一条数据
+     *
+     * @param gridManagement 实体类
+     * @return Response对象
+     */
+    @RequestMapping(value = "update", method = RequestMethod.POST)
+    @ApiOperation(value = "更改网格户表信息")
+    public AjaxMessage<Integer> update(@ApiParam(value = "设置配置", required = true) @RequestBody GridManagement gridManagement) {
+        int result = gridManagementService.update(gridManagement);
+        return new AjaxMessage<>(ResultStatus.OK, result);
+
+    }
+
+    /**
+     * 删除一条数据
+     *
+     * @param gridManagement 参数对象
+     * @return Response对象
+     */
+    @RequestMapping(value = "delete", method = RequestMethod.POST)
+    @ApiOperation(value = "查询设施配置列表")
+    public AjaxMessage<Integer> delete(@ApiParam(value = "设置配置", required = true) @RequestBody GridManagement gridManagement) {
+        int result = gridManagementService.deleteById(gridManagement.getId());
+        return new AjaxMessage<>(ResultStatus.OK, result);
+    }
+
+
+    /**
+     * 分页查询
+     *
+     * @param pageNum  偏移
+     * @param pageSize 条数
+     * @return Response对象
+     */
+    @RequestMapping(value = "selectPage", method = RequestMethod.POST)
+    @ApiOperation(value = "查询网格管理列表")
+    public AjaxMessage<Pagination<GridManagement>> selectPage(Integer pageNum, Integer pageSize,
+                                                              Integer userId,String waterNo
+            ,String adddress,String name) {
+        GridManagement gridManagement = new GridManagement();
+        gridManagement.setAddress(adddress);
+        gridManagement.setUserId(userId);
+        gridManagement.setWaterMeterNo(waterNo);
+        gridManagement.setCustomerName(name);
+        PageHelper.startPage(pageNum, pageSize);
+        List<GridManagement> gridManagements = gridManagementService.selectList(gridManagement);
+        Pagination<GridManagement> pages = new Pagination<>(gridManagements);
+        return new AjaxMessage<>(ResultStatus.OK, pages);
+    }
+
+    /**
+     * 分页查询
+     *
+     * @param pageNum  偏移
+     * @param pageSize 条数
+     * @return Response对象
+     */
+    @RequestMapping(value = "selectGridPage", method = RequestMethod.POST)
+    @ApiOperation(value = "查询网格管理列表")
+    public AjaxMessage<Pagination<GridUser>> selectGridPage(Integer pageNum, Integer pageSize,
+                                                        String name, Integer orgId) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<GridUser>gridUsers=gridManagementService.selectGirdUserInfo(name,orgId);
+        Pagination<GridUser> pages = new Pagination<>(gridUsers);
+        return new AjaxMessage<>(ResultStatus.OK, pages);
+    }
+    /**
+     * 分页查询
+     *
+     * @param
+     * @param
+     * @return Response对象
+     */
+    @RequestMapping(value = "getCommutityByOrg", method = RequestMethod.POST)
+    @ApiOperation(value = "查询小区信息")
+    public AjaxMessage<List<Community>> selectGridPage(Integer orgId) {
+
+        List<Community>communities=gridManagementService.getCommutityByOrg(orgId);
+
+        return new AjaxMessage<>(ResultStatus.OK, communities);
+    }
+    /**
+     * 分页查询
+     *
+     * @param
+     * @param
+     * @return Response对象
+     */
+    @RequestMapping(value = "getBuildingByCommutity", method = RequestMethod.POST)
+    @ApiOperation(value = "查询建筑信息")
+    public AjaxMessage<List<Building>> getBuildingByCommutity(Integer commutityId) {
+
+        List<Building>buildings=gridManagementService.getBuildingByCommutity(commutityId);
+
+        return new AjaxMessage<>(ResultStatus.OK, buildings);
+    }
+    /**
+     * 分页查询
+     *
+     * @param
+     * @param
+     * @return Response对象
+     */
+    @RequestMapping(value = "getDevices", method = RequestMethod.POST)
+    @ApiOperation(value = "查询建筑信息")
+    public AjaxMessage<List<Device>> getDevices(Integer buildingId,Integer userId,String address) {
+
+        List<Device>devices=gridManagementService.getDevices(buildingId,userId,address);
+
+        return new AjaxMessage<>(ResultStatus.OK, devices);
+    }
+}

+ 89 - 0
smart-city-platform/src/main/java/com/bz/smart_city/grid/GridManagementService.java

@@ -0,0 +1,89 @@
+package com.bz.smart_city.grid;
+
+import com.bz.smart_city.entity.Building;
+import com.bz.smart_city.entity.Community;
+import com.bz.smart_city.entity.Device;
+import com.bz.smart_city.entity.GridManagement;
+
+import java.util.List;
+
+
+/**
+ * (GridManagement)表服务接口
+ *
+ * @author hym
+ * @since 2021-02-23 11:48:06
+ */
+public interface GridManagementService {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    GridManagement selectById(Integer id);
+
+
+    /**
+     * 查询全部
+     *
+     * @return 对象列表
+     */
+    List<GridManagement> selectAll();
+
+    /**
+     * 通过实体作为筛选条件查询
+     *
+     * @param gridManagement 实例对象
+     * @return 对象列表
+     */
+    List<GridManagement> selectList(GridManagement gridManagement);
+
+    /**
+     * 新增数据
+     *
+     * @param gridManagement 实例对象
+     * @return 影响行数
+     */
+    int insert(GridInfo gridManagement);
+
+    /**
+     * 批量新增
+     *
+     * @param gridManagements 实例对象的集合
+     * @return 影响行数
+     */
+    int batchInsert(List<GridManagement> gridManagements);
+
+    /**
+     * 修改数据
+     *
+     * @param gridManagement 实例对象
+     * @return 修改
+     */
+    int update(GridManagement gridManagement);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 影响行数
+     */
+    int deleteById(Integer id);
+
+    /**
+     * 查询总数据数
+     *
+     * @return 数据总数
+     */
+    int count();
+
+    List<GridUser> selectGirdUserInfo(String name, Integer orgId);
+
+    List<Community> getCommutityByOrg(Integer orgId);
+
+    List<Building> getBuildingByCommutity(Integer commutityId);
+
+    List<Device> getDevices(Integer buildingId, Integer userId, String address);
+}

+ 153 - 0
smart-city-platform/src/main/java/com/bz/smart_city/grid/GridManagementServiceImpl.java

@@ -0,0 +1,153 @@
+package com.bz.smart_city.grid;
+
+import com.bz.smart_city.commom.util.UserUtil;
+import com.bz.smart_city.dao.GridManagementMapper;
+import com.bz.smart_city.dto.LoginUser;
+import com.bz.smart_city.entity.Building;
+import com.bz.smart_city.entity.Community;
+import com.bz.smart_city.entity.Device;
+import com.bz.smart_city.entity.GridManagement;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * (GridManagement表)服务实现类
+ *
+ * @author hym
+ * @since 2021-02-23 11:48:08
+ */
+@Service("gridManagementService")
+public class GridManagementServiceImpl implements GridManagementService {
+    @Autowired
+    private GridManagementMapper gridManagementMapper;
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    @Override
+    public GridManagement selectById(Integer id) {
+        return this.gridManagementMapper.selectById(id);
+    }
+
+
+    /**
+     * 查询所有
+     *
+     * @return 实例对象的集合
+     */
+    @Override
+    public List<GridManagement> selectAll() {
+        return this.gridManagementMapper.selectAll();
+    }
+
+    /**
+     * 根据条件查询
+     *
+     * @return 实例对象的集合
+     */
+    @Override
+    public List<GridManagement> selectList(GridManagement gridManagement) {
+        return this.gridManagementMapper.selectList(gridManagement);
+    }
+
+    /**
+     * 新增数据
+     *
+     * @param gridInfo 实例对象
+     * @return 实例对象
+     */
+    @Override
+    public int insert(GridInfo gridInfo) {
+        Integer userId = gridInfo.getUserId();
+        List<Long> deviceIds = gridInfo.getDeviceIds();
+        List<GridManagement> gridManagements=new ArrayList<>();
+        deviceIds.forEach(deviceId->{
+            GridManagement gridManagement=new GridManagement();
+            gridManagement.setUserId(userId);
+            gridManagement.setDeviceId(deviceId);
+            gridManagements.add(gridManagement);
+        });
+        if(gridManagements.size()>0)
+        gridManagementMapper.batchInsert(gridManagements);
+        return 1;
+    }
+
+    /**
+     * 批量新增
+     *
+     * @param gridManagements 实例对象的集合
+     * @return 生效的条数
+     */
+    @Override
+    public int batchInsert(List<GridManagement> gridManagements) {
+        return this.gridManagementMapper.batchInsert(gridManagements);
+    }
+
+    /**
+     * 修改数据
+     *
+     * @param gridManagement 实例对象
+     * @return 实例对象
+     */
+    @Override
+    public int update(GridManagement gridManagement) {
+
+        return this.gridManagementMapper.update(gridManagement);
+    }
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 是否成功
+     */
+    @Override
+    public int deleteById(Integer id) {
+        return this.gridManagementMapper.deleteById(id);
+    }
+
+    /**
+     * 查询总数据数
+     *
+     * @return 数据总数
+     */
+    @Override
+    public int count() {
+        return this.gridManagementMapper.count();
+    }
+
+    @Override
+    public List<GridUser> selectGirdUserInfo(String name, Integer orgId) {
+        Integer roleId=108;
+        LoginUser currentUser = UserUtil.getCurrentUser();
+        Integer siteId=currentUser.getSiteId();
+
+        List<GridUser> users=gridManagementMapper.selectGirdUserInfo(name,orgId,roleId,siteId);
+        return users;
+    }
+
+    @Override
+    public List<Community> getCommutityByOrg(Integer orgId) {
+        List<Community> communities=gridManagementMapper.getCommutityByOrg(orgId);
+        return communities;
+    }
+
+    @Override
+    public List<Building> getBuildingByCommutity(Integer commutityId) {
+        List<Building>buildings= gridManagementMapper.getBuildingByCommutity( commutityId);
+        return buildings;
+    }
+
+    @Override
+    public List<Device> getDevices(Integer buildingId, Integer userId, String address) {
+        List<Device> devices=gridManagementMapper.getDevices(buildingId,userId,address);
+        return devices;
+    }
+
+}

+ 25 - 0
smart-city-platform/src/main/java/com/bz/smart_city/grid/GridUser.java

@@ -0,0 +1,25 @@
+package com.bz.smart_city.grid;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+public class GridUser {
+    @ApiModelProperty(value = "id")
+    private Integer id;
+    @ApiModelProperty(value = "用户名")
+    private String username;
+    @ApiModelProperty(value = "姓名")
+    private String mobilePhone;
+    @ApiModelProperty(value = "手机号")
+    private String name;
+    @ApiModelProperty(value = "机构名称")
+    private String orgName;
+    @ApiModelProperty(value = "地址")
+    private String address;
+    @ApiModelProperty(value = "管理户表")
+    private Integer peoples;
+    @ApiModelProperty(value = "机构id")
+    private Integer orgId;
+    private Integer siteId;
+}

+ 1 - 1
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(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);
+    Pagination<WarningLogDto> getList(Long deviceId, 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(Integer channelId, String deviceNo, Integer warningType, String clientName, Integer feedbackStatus, LocalDateTime startDate, LocalDateTime endDate);
 

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

@@ -10,10 +10,8 @@ import com.bz.smart_city.dto.BuildingSelectDto;
 import com.bz.smart_city.dto.BuildingSelectInfoDto;
 import com.bz.smart_city.dto.LoginUser;
 import com.bz.smart_city.dto.WarningLogDto;
-import com.bz.smart_city.entity.WarningRule;
 import com.bz.smart_city.service.BuildingService;
 import com.github.pagehelper.PageHelper;
-import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpEntity;
@@ -25,8 +23,6 @@ import javax.annotation.Resource;
 import com.bz.smart_city.entity.WarningLog;
 import com.bz.smart_city.dao.WarningLogMapper;
 import com.bz.smart_city.service.WarningLogService;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.util.MultiValueMap;
 import org.springframework.web.client.RestTemplate;
 
 import java.time.LocalDateTime;
@@ -60,11 +56,11 @@ public class WarningLogServiceImpl implements WarningLogService{
     }
 
     @Override
-    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) {
+    public Pagination<WarningLogDto> getList(Long deviceId, 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(),channelId,deviceNo,warningType,clientName,feedbackStatus,provinceId,cityId,regionId,communityId,buildingId,startDate,endDate,UserUtil.getCurrentSiteProgramItems(loginUser));
-        Set<String>meterCodes=new HashSet<>();
+        List<WarningLogDto> list =  warningLogMapper.getList(loginUser.getSiteId(),deviceId,channelId,deviceNo,warningType,clientName,feedbackStatus,provinceId,cityId,regionId,communityId,buildingId,startDate,endDate,UserUtil.getCurrentSiteProgramItems(loginUser));
+        /*Set<String>meterCodes=new HashSet<>();
         list.forEach(warningLogDto -> {
             meterCodes.add(warningLogDto.getMeterCode());
         });
@@ -83,7 +79,7 @@ public class WarningLogServiceImpl implements WarningLogService{
                      }
                 }
             });
-        }
+        }*/
 
         return new Pagination<>(list);
     }

+ 7 - 7
smart-city-platform/src/main/resources/application-dev.properties

@@ -68,15 +68,15 @@ spring.servlet.multipart.max-request-size=100MB
 spring.servlet.multipart.location=D:/test
 files.path=${file-path:D:/test}
 
-#\u5FAE\u4FE1\u516C\u4F17\u53F7
+#微信公众号
 wechat.oa.appid=wx6b2ce547cd593413
 wechat.oa.app-secret=a0fd84db87a6d56057c2ff261b8b97f1
-#\u4E2D\u8BDA\u4FE1\u79D1\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F
-#wechat.mp.appid=wx890c58705ee4e2de
-#wechat.mp.app-secret=12db3150f496405b4425e6f1a54e204d
-#\u5A04\u5C71\u4E91\u5FAE\u4FE1\u5C0F\u7A0B\u5E8F
-wechat.mp.appid=wx32aae5a5179d3c5b
-wechat.mp.app-secret=ad8b1589a39752602641b134b189378a
+#中诚信科微信小程序
+wechat.mp.appid=wx890c58705ee4e2de
+wechat.mp.app-secret=12db3150f496405b4425e6f1a54e204d
+#娄山云微信小程序
+#wechat.mp.appid=wx32aae5a5179d3c5b
+#wechat.mp.app-secret=ad8b1589a39752602641b134b189378a
 
 #\u8D26\u53F7\u7533\u8BF7\u901A\u77E5\u7684\u4EBA\u7684\u5FAE\u4FE1openid
 account.apply.wechat.openid=oCaAI50Ty9bfqkNzhXUYzbGXkHVY

+ 18 - 8
smart-city-platform/src/main/resources/mapper/CommunityMapper.xml

@@ -74,6 +74,7 @@
             `name`,
             code,
             customer_id,
+            org_id,
             province,
             city,
             region,
@@ -93,6 +94,7 @@
             #{community.name,jdbcType=VARCHAR},
             #{community.code,jdbcType=VARCHAR},
             #{community.customerId,jdbcType=INTEGER},
+            #{community.orgId,jdbcType=INTEGER},
             #{community.province,jdbcType=INTEGER},
             #{community.city,jdbcType=INTEGER},
             #{community.region,jdbcType=INTEGER},
@@ -224,6 +226,7 @@
             <if test="community.siteId != null"> site_id= #{community.siteId,jdbcType=INTEGER},</if>
             <if test="community.name != null"> `name`= #{community.name,jdbcType=VARCHAR},</if>
             <if test="community.customerId != null"> customer_id= #{community.customerId,jdbcType=INTEGER},</if>
+            <if test="community.orgId != null"> org_id= #{community.orgId,jdbcType=INTEGER},</if>
             <if test="community.province != null"> province= #{community.province,jdbcType=INTEGER},</if>
             <if test="community.city != null"> city= #{community.city,jdbcType=INTEGER},</if>
             <if test="community.region != null"> region= #{community.region,jdbcType=INTEGER},</if>
@@ -337,17 +340,20 @@
         </if>
     </select>
     <select id="getList" resultType="com.bz.smart_city.dto.CommunityDto">
-        select <include refid="General_Column_List"></include>,
+        select
+        sc.*,
         sa1.name as province_name,
         sa2.name as city_name,
-        sa3.name as region_name
+        sa3.name as region_name,
+        so.name as org_name
         from sc_community sc
         left join sc_area sa1 on sa1.id = sc.province
         left join sc_area sa2 on sa2.id = sc.city
         left join sc_area sa3 on sa3.id = sc.region
+        left join sc_organization so on   so.id=sc.org_id
         where sc.status = 1
-        <if test="siteId != null"> and site_id = #{siteId} </if>
-        <if test="customerId != null"> and customer_id = #{customerId} </if>
+        <if test="siteId != null"> and sc.site_id = #{siteId} </if>
+        <if test="customerId != null"> and sc.customer_id = #{customerId} </if>
         <if test="communityName != null and communityName != ''"> and sc.name like concat('%',#{communityName} ,'%')</if>
         <if test="province != null"> and sc.province = #{province}</if>
         <if test="city != null"> and sc.city = #{city}</if>
@@ -396,18 +402,22 @@
         where status = 1 and site_id = #{siteId}
     </select>
     <select id="getListByCustomerIds" resultType="com.bz.smart_city.dto.CommunityDto">
-        select <include refid="General_Column_List"></include>,
+        select
+        sc.*,
         sa1.name as province_name,
         sa2.name as city_name,
-        sa3.name as region_name
+        sa3.name as region_name,
+        so.name as org_name
         from sc_community sc
         left join sc_area sa1 on sa1.id = sc.province
         left join sc_area sa2 on sa2.id = sc.city
         left join sc_area sa3 on sa3.id = sc.region
+        left join sc_organization so on so.id = sc.org_id
+
         where sc.status = 1
-        <if test="siteId != null"> and site_id = #{siteId} </if>
+        <if test="siteId != null"> and sc.site_id = #{siteId} </if>
         <if test="customerIds != null">
-            and customer_id in <foreach collection="customerIds" item="item" open="(" separator="," close=")">#{item}</foreach>
+            and sc.customer_id in <foreach collection="customerIds" item="item" open="(" separator="," close=")">#{item}</foreach>
         </if>
         <if test="communityName != null and communityName != ''"> and sc.name like concat('%',#{communityName} ,'%')</if>
         <if test="province != null"> and sc.province = #{province}</if>

+ 189 - 0
smart-city-platform/src/main/resources/mapper/GridManagementMapper.xml

@@ -0,0 +1,189 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.bz.smart_city.dao.GridManagementMapper">
+    <!-- 结果集 -->
+    <resultMap type="com.bz.smart_city.entity.GridManagement" id="GridManagementMap">
+        <result property="id" column="id" jdbcType="INTEGER"/>
+        <result property="deviceId" column="device_id" jdbcType="INTEGER"/>
+        <result property="customerNo" column="customer_no" jdbcType="VARCHAR"/>
+        <result property="customerPhone" column="customer_phone" jdbcType="VARCHAR"/>
+        <result property="customerName" column="customer_name" jdbcType="VARCHAR"/>
+        <result property="label" column="label" jdbcType="VARCHAR"/>
+        <result property="emergencyContact" column="emergency_contact" jdbcType="VARCHAR"/>
+        <result property="emergencyContactPhoneNumber" column="emergency_contact_phone_number" jdbcType="VARCHAR"/>
+        <result property="userId" column="user_id" jdbcType="INTEGER"/>
+    </resultMap>
+
+    <!-- 基本字段 -->
+    <sql id="Base_Column_List">
+        id, device_id, customer_no, customer_phone, customer_name, label, emergency_contact, emergency_contact_phone_number, user_id    </sql>
+
+    <!-- 查询单个 -->
+    <select id="selectById" resultMap="GridManagementMap">
+        select
+        <include refid="Base_Column_List"/>
+        from sc_grid_management
+        where id = #{id}
+    </select>
+
+
+    <!-- 查询全部 -->
+    <select id="selectAll" resultMap="GridManagementMap">
+        select
+        <include refid="Base_Column_List"/>
+        from sc_grid_management
+    </select>
+
+    <!--通过实体作为筛选条件查询-->
+    <select id="selectList" resultMap="GridManagementMap">
+        select
+         a.*,b.water_meter_no,b.water_meter_file_no,b.loc_desc address,c.name bulidingName,
+         e.name orgName
+        from sc_grid_management a join sc_device b on a.device_id=b.id
+        join sc_building c on b.building_id=c.id join sc_community d on c.community =d.id
+        left join sc_organization e on d.org_id=e.id
+        <where>
+            <if test="id != null">
+                and id = #{id}
+            </if>
+            <if test="deviceId != null">
+                and device_id = #{deviceId}
+            </if>
+            <if test="customerNo != null and customerNo != ''">
+                and customer_no = #{customerNo}
+            </if>
+            <if test="customerPhone != null and customerPhone != ''">
+                and customer_phone = #{customerPhone}
+            </if>
+            <if test="customerName != null and customerName != ''">
+                and customer_name LIKE concat('%',#{customerName},'%')
+            </if>
+            <if test="label != null and label != ''">
+                and label = #{label}
+            </if>
+            <if test="emergencyContact != null and emergencyContact != ''">
+                and emergency_contact = #{emergencyContact}
+            </if>
+            <if test="emergencyContactPhoneNumber != null and emergencyContactPhoneNumber != ''">
+                and emergency_contact_phone_number = #{emergencyContactPhoneNumber}
+            </if>
+            <if test="userId != null">
+                and user_id = #{userId}
+            </if>
+            <if test="address != null and address !=''">
+                and b.loc_desc LIKE concat('%',#{address},'%')
+            </if>
+            <if test="waterMeterNo != null and waterMeterNo !=''">
+                and ( b.water_meter_no LIKE concat('%',#{waterMeterNo},'%') or
+                      b.water_meter_file_no LIKE concat('%',#{waterMeterNo},'%'))
+            </if>
+        </where>
+    </select>
+
+    <!-- 新增所有列 -->
+    <insert id="insert" keyProperty="id" useGeneratedKeys="true">
+        insert into sc_grid_management(id, device_id, customer_no, customer_phone, customer_name, label,
+                                       emergency_contact, emergency_contact_phone_number, user_id)
+        values (#{id}, #{deviceId}, #{customerNo}, #{customerPhone}, #{customerName}, #{label}, #{emergencyContact},
+                #{emergencyContactPhoneNumber}, #{userId})
+    </insert>
+
+    <!-- 批量新增 -->
+    <insert id="batchInsert">
+        insert into sc_grid_management(id, device_id, customer_no, customer_phone, customer_name, label,
+        emergency_contact, emergency_contact_phone_number, user_id)
+        values
+        <foreach collection="gridManagements" item="item" index="index" separator=",">
+            (
+            #{item.id}, #{item.deviceId}, #{item.customerNo}, #{item.customerPhone}, #{item.customerName},
+            #{item.label}, #{item.emergencyContact}, #{item.emergencyContactPhoneNumber}, #{item.userId} )
+        </foreach>
+    </insert>
+
+    <!-- 通过主键修改数据 -->
+    <update id="update">
+        update sc_grid_management
+        <set>
+            <if test="deviceId != null">
+                device_id = #{deviceId},
+            </if>
+            <if test="customerNo != null and customerNo != ''">
+                customer_no = #{customerNo},
+            </if>
+            <if test="customerPhone != null and customerPhone != ''">
+                customer_phone = #{customerPhone},
+            </if>
+            <if test="customerName != null and customerName != ''">
+                customer_name = #{customerName},
+            </if>
+            <if test="label != null and label != ''">
+                label = #{label},
+            </if>
+            <if test="emergencyContact != null and emergencyContact != ''">
+                emergency_contact = #{emergencyContact},
+            </if>
+            <if test="emergencyContactPhoneNumber != null and emergencyContactPhoneNumber != ''">
+                emergency_contact_phone_number = #{emergencyContactPhoneNumber},
+            </if>
+            <if test="userId != null">
+                user_id = #{userId},
+            </if>
+        </set>
+        where id = #{id}
+    </update>
+
+    <!--通过主键删除-->
+    <delete id="deleteById">
+        delete
+        from sc_grid_management
+        where id = #{id}
+    </delete>
+
+    <!-- 总数 -->
+    <select id="count" resultType="int">
+        select count(*)
+        from sc_grid_management
+    </select>
+    <select id="selectGirdUserInfo" resultType="com.bz.smart_city.grid.GridUser">
+        select  b.id orgId,a.id,username,mobile_phone,a.name,b.name org_name,b.address,ifnull(c.peoples,0) peoples from
+         sc_site_user ssu   join    sc_user a on ssu.user_id=a.id
+         join sc_organization b on ssu.organ_id=b.id
+         join sc_user_role d on d.uid=a.id join sc_role e on e.id=d.rid
+         left join (select count(*)peoples,user_id from sc_grid_management group by user_id)c
+         on a.id=c.user_id
+        <where>
+                d.status=1
+            <if test="username != null and username!='' ">
+                and username LIKE concat('%',#{username},'%')
+            </if>
+            <if test="orgId != null  ">
+                and ssu.organ_id = #{orgId}
+            </if>
+            <if test="roleId != null  ">
+                and e.id = #{roleId}
+            </if>
+            <if test="siteId != null  ">
+                and ssu.site_id = #{siteId}
+            </if>
+       </where>
+        order by ssu.create_date desc
+    </select>
+    <select id="getCommutityByOrg" resultType="com.bz.smart_city.entity.Community">
+        select * from sc_community a
+        where a.org_id=#{orgId} and status=1
+    </select>
+    <select id="getBuildingByCommutity" resultType="com.bz.smart_city.entity.Building">
+        select * from sc_building where community=#{commutityId} and status=1
+    </select>
+    <select id="getDevices" resultType="com.bz.smart_city.entity.Device">
+        select * from sc_device where building_id=#{buildingId} and
+         id not in (select distinct device_id from sc_grid_management) and status=1
+        <if test="address != null  ">
+            and loc_desc LIKE concat('%',#{address},'%')
+        </if>
+    </select>
+
+    <select id="getByDeviceId" resultMap="GridManagementMap">
+        select * from sc_grid_management where device_id = #{deviceId}
+    </select>
+</mapper>

+ 1 - 1
smart-city-platform/src/main/resources/mapper/UserMapper.xml

@@ -455,7 +455,7 @@
         <if test="organId != null"> and ssu.organ_id = #{organId} </if>
         <if test="roleId != null"> and sr.id = #{roleId} </if>
         <if test="programId != null"> and surp.program_id = #{programId} </if>
-        order by su.type asc,su.create_date desc
+        order by su.type asc,ssu.create_date desc
     </select>
 
 	<select id="findUserByOrgsIds" resultType="com.bz.smart_city.entity.User">

+ 18 - 3
smart-city-platform/src/main/resources/mapper/WarningLogMapper.xml

@@ -40,6 +40,9 @@
       <if test="feedbackContent != null">
         feedback_content,
       </if>
+      <if test="lastDate != null">
+        last_date,
+      </if>
       <if test="status != null">
         `status`,
       </if>
@@ -72,6 +75,9 @@
       <if test="feedbackContent != null">
         #{feedbackContent},
       </if>
+      <if test="lastDate != null">
+        #{lastDate},
+      </if>
       <if test="status != null">
         #{status},
       </if>
@@ -108,6 +114,9 @@
       <if test="feedbackContent != null">
         feedback_content = #{feedbackContent},
       </if>
+      <if test="lastDate != null">
+        last_date = #{lastDate},
+      </if>
       <if test="status != null">
         `status` = #{status},
       </if>
@@ -129,30 +138,36 @@
 
   <select id="getList" resultType="com.bz.smart_city.dto.WarningLogDto">
     select
-    swl.*,
+    swl.id, swl.client_user_id, swl.device_id, swl.warning_type, swl.feedback_status, swl.feedback_content, swl.`status`,
+    swl.create_by, swl.date_create, swl.update_by, swl.date_update,
     sd.device_no,
     sd.water_meter_no,
     sd.loc_desc,
     sdt1.equipment_type as equipment_type,
     sdt1.model as model,
     sdm1.name as manufacturer_name,
-    sil.metercode meterCode
+    sil.metercode meterCode,
+    sgm.customer_no as account_number,
+    sgm.customer_name as account_name,
+    sgm.customer_phone as account_phone
     from sc_warning_log swl
     left join sc_device sd on(sd.id = swl.device_id)
     left join sc_install_list sil on sd.id=sil.device_id
     left join sc_building sb on(sb.id = sd.building_id)
     left join sc_device_type sdt1 on(sdt1.id = sd.device_type)
     left join sc_device_manufacturer sdm1 on(sdm1.id = sdt1.manufacturer_id)
+    left join sc_grid_management sgm on(sgm.device_id = swl.device_id)
     <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="deviceId != null"> and sd.id = #{deviceId}</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>
     <if test="warningType != null"> and swl.warning_type = #{warningType}</if>
     <if test="clientName != null and clientName != ''"> and (
-      pba.name LIKE concat('%',#{clientName},'%') or pba.mobilephone LIKE concat('%',#{clientName},'%') or pba.accountnumber LIKE concat('%',#{clientName},'%')
+      sgm.customer_name LIKE concat('%',#{clientName},'%') or sgm.customer_phone LIKE concat('%',#{clientName},'%') or sgm.customer_no LIKE concat('%',#{clientName},'%')
     )</if>
     <if test="feedbackStatus != null"> and swl.feedback_status = #{feedbackStatus}</if>
     <if test="provinceId != null"> and sb.province = #{provinceId}</if>

+ 114 - 0
smart-city-platform/src/main/resources/mapper/WarningMessageMapper.xml

@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.bz.smart_city.dao.WarningMessageMapper">
+  <resultMap id="BaseResultMap" type="com.bz.smart_city.entity.WarningMessage">
+    <!--@mbg.generated-->
+    <!--@Table sc_warning_message-->
+    <id column="id" property="id" />
+    <result column="warning_log_id" property="warningLogId" />
+    <result column="content" property="content" />
+    <result column="status" property="status" />
+    <result column="create_by" property="createBy" />
+    <result column="date_create" property="dateCreate" />
+    <result column="update_by" property="updateBy" />
+    <result column="date_update" property="dateUpdate" />
+  </resultMap>
+  <sql id="Base_Column_List">
+    <!--@mbg.generated-->
+    id, warning_log_id, content, `status`, create_by, date_create, update_by, date_update
+  </sql>
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.bz.smart_city.entity.WarningMessage" useGeneratedKeys="true">
+    <!--@mbg.generated-->
+    insert into sc_warning_message
+    <trim prefix="(" suffix=")" suffixOverrides=",">
+      <if test="warningLogId != null">
+        warning_log_id,
+      </if>
+      <if test="content != null">
+        content,
+      </if>
+      <if test="status != null">
+        `status`,
+      </if>
+      <if test="createBy != null">
+        create_by,
+      </if>
+      <if test="dateCreate != null">
+        date_create,
+      </if>
+      <if test="updateBy != null">
+        update_by,
+      </if>
+      <if test="dateUpdate != null">
+        date_update,
+      </if>
+    </trim>
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
+      <if test="warningLogId != null">
+        #{warningLogId},
+      </if>
+      <if test="content != null">
+        #{content},
+      </if>
+      <if test="status != null">
+        #{status},
+      </if>
+      <if test="createBy != null">
+        #{createBy},
+      </if>
+      <if test="dateCreate != null">
+        #{dateCreate},
+      </if>
+      <if test="updateBy != null">
+        #{updateBy},
+      </if>
+      <if test="dateUpdate != null">
+        #{dateUpdate},
+      </if>
+    </trim>
+  </insert>
+  <update id="updateByPrimaryKeySelective" parameterType="com.bz.smart_city.entity.WarningMessage">
+    <!--@mbg.generated-->
+    update sc_warning_message
+    <set>
+      <if test="warningLogId != null">
+        warning_log_id = #{warningLogId},
+      </if>
+      <if test="content != null">
+        content = #{content},
+      </if>
+      <if test="status != null">
+        `status` = #{status},
+      </if>
+      <if test="createBy != null">
+        create_by = #{createBy},
+      </if>
+      <if test="dateCreate != null">
+        date_create = #{dateCreate},
+      </if>
+      <if test="updateBy != null">
+        update_by = #{updateBy},
+      </if>
+      <if test="dateUpdate != null">
+        date_update = #{dateUpdate},
+      </if>
+    </set>
+    where id = #{id}
+  </update>
+  <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" useGeneratedKeys="true">
+    <!--@mbg.generated-->
+    insert into sc_warning_message
+    (warning_log_id, content, `status`, create_by, date_create, update_by, date_update
+      )
+    values
+    <foreach collection="list" item="item" separator=",">
+      (#{item.warningLogId}, #{item.content}, #{item.status}, #{item.createBy}, #{item.dateCreate}, 
+        #{item.updateBy}, #{item.dateUpdate})
+    </foreach>
+  </insert>
+
+  <select id="findById" resultMap="BaseResultMap">
+    select <include refid="Base_Column_List" /> from sc_warning_message where status = 1 and id = #{id}
+  </select>
+
+</mapper>

+ 111 - 0
water_query_api/src/main/java/com/bz/smart_city/controller/GridManagementController.java

@@ -0,0 +1,111 @@
+package com.bz.smart_city.controller;
+
+import com.bz.smart_city.entity.GridManagement;
+import com.bz.smart_city.service.GridManagementService;
+import com.github.pagehelper.PageHelper;
+import com.zcxk.common.model.AjaxMessage;
+import com.zcxk.common.model.Pagination;
+import com.zcxk.common.model.ResultStatus;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * (GridManagement)控制层
+ *
+ * @author hym
+ * @since 2021-02-23 11:47:59
+ */
+@RestController
+@RequestMapping("/gridManagement")
+@Api(tags = "")
+public class GridManagementController {
+    /**
+     * 服务对象
+     */
+    @Autowired
+    private GridManagementService gridManagementService;
+
+    /**
+     * 通过主键查询单条数据
+     *
+     * @param id 参数对象
+     * @return 单条数据
+     */
+    @RequestMapping(value = "get", method = RequestMethod.POST)
+    @ApiOperation(value = "查询设施配置列表")
+    public AjaxMessage<GridManagement> selectOne(
+            @ApiParam(value = "设置配置", required = true) Integer id) {
+        GridManagement result = gridManagementService.selectById(id);
+
+        return new AjaxMessage<>(ResultStatus.OK, result);
+    }
+
+    /**
+     * 新增一条数据
+     *
+     * @param gridManagement 实体类
+     * @return Response对象
+     */
+    @RequestMapping(value = "insert", method = RequestMethod.POST)
+    @ApiOperation(value = "查询设施配置列表")
+    public AjaxMessage<Integer> insert(@ApiParam(value = "设置配置", required = true) @RequestBody GridManagement gridManagement) {
+        int result = gridManagementService.insert(gridManagement);
+
+        return new AjaxMessage<>(ResultStatus.OK, result);
+    }
+
+    /**
+     * 修改一条数据
+     *
+     * @param gridManagement 实体类
+     * @return Response对象
+     */
+    @RequestMapping(value = "update", method = RequestMethod.POST)
+    @ApiOperation(value = "查询设施配置列表")
+    public AjaxMessage<Integer> update(@ApiParam(value = "设置配置", required = true) @RequestBody GridManagement gridManagement) {
+        int result = gridManagementService.update(gridManagement);
+        return new AjaxMessage<>(ResultStatus.OK, result);
+
+    }
+
+    /**
+     * 删除一条数据
+     *
+     * @param gridManagement 参数对象
+     * @return Response对象
+     */
+    @RequestMapping(value = "delete", method = RequestMethod.POST)
+    @ApiOperation(value = "查询设施配置列表")
+    public AjaxMessage<Integer> delete(@ApiParam(value = "设置配置", required = true) @RequestBody GridManagement gridManagement) {
+        int result = gridManagementService.deleteById(gridManagement.getId());
+        return new AjaxMessage<>(ResultStatus.OK, result);
+    }
+
+
+    /**
+     * 分页查询
+     *
+     * @param pageNum  偏移
+     * @param pageSize 条数
+     * @return Response对象
+     */
+    @RequestMapping(value = "selectPage", method = RequestMethod.POST)
+    @ApiOperation(value = "查询设施配置列表")
+    public AjaxMessage<Pagination<GridManagement>> selectPage(Integer pageNum, Integer pageSize) {
+        GridManagement gridManagement = new GridManagement();
+
+        PageHelper.startPage(pageNum, pageSize);
+        List<GridManagement> gridManagements = gridManagementService.selectList(gridManagement);
+        Pagination<GridManagement> pages = new Pagination<>(gridManagements);
+        return new AjaxMessage<>(ResultStatus.OK, pages);
+    }
+
+}

+ 81 - 0
water_query_api/src/main/java/com/bz/smart_city/dao/GridManagementMapper.java

@@ -0,0 +1,81 @@
+package com.bz.smart_city.dao;
+
+import com.bz.smart_city.entity.GridManagement;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * (GridManagement)表数据库访问层
+ *
+ * @author hym
+ * @since 2021-02-23 11:48:07
+ */
+@Mapper
+public interface GridManagementMapper {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    GridManagement selectById(Integer id);
+
+
+    /**
+     * 查询全部
+     *
+     * @return 对象列表
+     */
+    List<GridManagement> selectAll();
+
+    /**
+     * 通过实体作为筛选条件查询
+     *
+     * @param gridManagement 实例对象
+     * @return 对象列表
+     */
+    List<GridManagement> selectList(GridManagement gridManagement);
+
+    /**
+     * 新增数据
+     *
+     * @param gridManagement 实例对象
+     * @return 影响行数
+     */
+    int insert(GridManagement gridManagement);
+
+    /**
+     * 批量新增
+     *
+     * @param gridManagements 实例对象的集合
+     * @return 影响行数
+     */
+    int batchInsert(@Param("gridManagements") List<GridManagement> gridManagements);
+
+    /**
+     * 修改数据
+     *
+     * @param gridManagement 实例对象
+     * @return 影响行数
+     */
+    int update(GridManagement gridManagement);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 影响行数
+     */
+    int deleteById(Integer id);
+
+    /**
+     * 查询总数据数
+     *
+     * @return 数据总数
+     */
+    int count();
+
+}

+ 64 - 0
water_query_api/src/main/java/com/bz/smart_city/entity/GridManagement.java

@@ -0,0 +1,64 @@
+package com.bz.smart_city.entity;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * (GridManagement)实体类
+ *
+ * @author hym
+ * @since 2021-02-23 11:48:07
+ */
+@Data
+@ApiModel
+public class GridManagement implements Serializable {
+    private static final long serialVersionUID = 458833882113660963L;
+    /**
+     * 主键
+     */
+    @ApiModelProperty(value = "主键")
+    private Integer id;
+    /**
+     * 设备id
+     */
+    @ApiModelProperty(value = "设备id")
+    private Integer deviceId;
+    /**
+     * 客户编号
+     */
+    @ApiModelProperty(value = "客户编号")
+    private String customerNo;
+    /**
+     * 客户手机
+     */
+    @ApiModelProperty(value = "客户手机")
+    private String customerPhone;
+    /**
+     * 客户名称
+     */
+    @ApiModelProperty(value = "客户名称")
+    private String customerName;
+    /**
+     * 标签
+     */
+    @ApiModelProperty(value = "标签")
+    private String label;
+    /**
+     * 紧急联系人
+     */
+    @ApiModelProperty(value = "紧急联系人")
+    private String emergencyContact;
+    /**
+     * 紧急联系人电话
+     */
+    @ApiModelProperty(value = "紧急联系人电话")
+    private String emergencyContactPhoneNumber;
+    /**
+     * 用户id
+     */
+    @ApiModelProperty(value = "用户id")
+    private Integer userId;
+}

+ 78 - 0
water_query_api/src/main/java/com/bz/smart_city/service/GridManagementService.java

@@ -0,0 +1,78 @@
+package com.bz.smart_city.service;
+
+import com.bz.smart_city.entity.GridManagement;
+
+import java.util.List;
+
+
+/**
+ * (GridManagement)表服务接口
+ *
+ * @author hym
+ * @since 2021-02-23 11:48:06
+ */
+public interface GridManagementService {
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    GridManagement selectById(Integer id);
+
+
+    /**
+     * 查询全部
+     *
+     * @return 对象列表
+     */
+    List<GridManagement> selectAll();
+
+    /**
+     * 通过实体作为筛选条件查询
+     *
+     * @param gridManagement 实例对象
+     * @return 对象列表
+     */
+    List<GridManagement> selectList(GridManagement gridManagement);
+
+    /**
+     * 新增数据
+     *
+     * @param gridManagement 实例对象
+     * @return 影响行数
+     */
+    int insert(GridManagement gridManagement);
+
+    /**
+     * 批量新增
+     *
+     * @param gridManagements 实例对象的集合
+     * @return 影响行数
+     */
+    int batchInsert(List<GridManagement> gridManagements);
+
+    /**
+     * 修改数据
+     *
+     * @param gridManagement 实例对象
+     * @return 修改
+     */
+    int update(GridManagement gridManagement);
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 影响行数
+     */
+    int deleteById(Integer id);
+
+    /**
+     * 查询总数据数
+     *
+     * @return 数据总数
+     */
+    int count();
+}

+ 109 - 0
water_query_api/src/main/java/com/bz/smart_city/service/impl/GridManagementServiceImpl.java

@@ -0,0 +1,109 @@
+package com.bz.smart_city.service.impl;
+
+import com.bz.smart_city.dao.GridManagementMapper;
+import com.bz.smart_city.entity.GridManagement;
+import com.bz.smart_city.service.GridManagementService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * (GridManagement表)服务实现类
+ *
+ * @author hym
+ * @since 2021-02-23 11:48:08
+ */
+@Service("gridManagementService")
+public class GridManagementServiceImpl implements GridManagementService {
+    @Autowired
+    private GridManagementMapper gridManagementMapper;
+
+    /**
+     * 通过ID查询单条数据
+     *
+     * @param id 主键
+     * @return 实例对象
+     */
+    @Override
+    public GridManagement selectById(Integer id) {
+        return this.gridManagementMapper.selectById(id);
+    }
+
+
+    /**
+     * 查询所有
+     *
+     * @return 实例对象的集合
+     */
+    @Override
+    public List<GridManagement> selectAll() {
+        return this.gridManagementMapper.selectAll();
+    }
+
+    /**
+     * 根据条件查询
+     *
+     * @return 实例对象的集合
+     */
+    @Override
+    public List<GridManagement> selectList(GridManagement gridManagement) {
+        return this.gridManagementMapper.selectList(gridManagement);
+    }
+
+    /**
+     * 新增数据
+     *
+     * @param gridManagement 实例对象
+     * @return 实例对象
+     */
+    @Override
+    public int insert(GridManagement gridManagement) {
+        return this.gridManagementMapper.insert(gridManagement);
+    }
+
+    /**
+     * 批量新增
+     *
+     * @param gridManagements 实例对象的集合
+     * @return 生效的条数
+     */
+    @Override
+    public int batchInsert(List<GridManagement> gridManagements) {
+        return this.gridManagementMapper.batchInsert(gridManagements);
+    }
+
+    /**
+     * 修改数据
+     *
+     * @param gridManagement 实例对象
+     * @return 实例对象
+     */
+    @Override
+    public int update(GridManagement gridManagement) {
+
+        return this.gridManagementMapper.update(gridManagement);
+    }
+
+    /**
+     * 通过主键删除数据
+     *
+     * @param id 主键
+     * @return 是否成功
+     */
+    @Override
+    public int deleteById(Integer id) {
+        return this.gridManagementMapper.deleteById(id);
+    }
+
+    /**
+     * 查询总数据数
+     *
+     * @return 数据总数
+     */
+    @Override
+    public int count() {
+        return this.gridManagementMapper.count();
+    }
+
+}

+ 29 - 0
water_query_api/src/main/java/com/zcxk/controller/WaterApiController.java

@@ -182,5 +182,34 @@ public class WaterApiController {
         Double deviceVolume = warningRuleService.delWaringRule(id,userName);
         return new AjaxMessage<>(ResultStatus.OK, deviceVolume);
     }
+    /**
+     * 删除警告规则
+     *
+     * @param
+     *
+     * @return Response对象
+     */
+    @RequestMapping(value = "setWaringData", method = RequestMethod.POST)
+    @ApiOperation(value = "用水量")
+    public AjaxMessage< Double> setWaringData(
+
+    ) {
+        //warningMessageJob.warningMessage();
+        return new AjaxMessage<>(ResultStatus.OK);
+    }
+    @ResponseBody
+    @PostMapping("/feedback")
+    @ApiOperation(value = "反馈")
+    public AjaxMessage feedback(
+            @ApiParam(value = "id", required = true) @RequestParam(required = true) Integer id,
+            @ApiParam(value = "反馈状态 0:待反馈 1:已确认无异常 2:已反馈信息", required = true) @RequestParam(required = true) Integer feedbackStatus,
+            @ApiParam(value = "反馈内容", required = false) @RequestParam(required = false) String feedbackContent,
+            @ApiParam(value = "反馈内容", required = false) @RequestParam(required = false) String phoneNumber,
+            @ApiParam(value = "反馈内容", required = false) @RequestParam(required = false) String accountNumber,
+            @ApiParam(value = "反馈内容", required = false) @RequestParam(required = false) String userName
+    ){
+        warningRuleService.feedback(userName,id,feedbackStatus,feedbackContent,phoneNumber,accountNumber);
+        return new AjaxMessage<>(ResultStatus.OK);
+    }
 
 }

+ 3 - 0
water_query_api/src/main/java/com/zcxk/entity/WarningLog.java

@@ -63,4 +63,7 @@ public class WarningLog {
 
     @ApiModelProperty(value="")
     private LocalDateTime dateUpdate;
+    private String userName;
+    private String phoneNumber;
+    private String accountNumber;
 }

+ 1 - 0
water_query_api/src/main/java/com/zcxk/service/WarningRuleService.java

@@ -22,4 +22,5 @@ public interface WarningRuleService {
 
     Double delWaringRule(Integer id, String userName);
 
+    void feedback(String name, Integer id, Integer feedbackStatus, String content, String phoneNumber, String accountNumber);
 }

+ 27 - 0
water_query_api/src/main/java/com/zcxk/service/impl/WarningRuleServiceImpl.java

@@ -1,12 +1,17 @@
 package com.zcxk.service.impl;
 
+import com.zcxk.dao.WarningLogMapper;
+import com.zcxk.dao.WarningMessageMapper;
 import com.zcxk.dao.WarningRuleMapper;
 import com.zcxk.entity.Device;
+import com.zcxk.entity.WarningLog;
+import com.zcxk.entity.WarningMessage;
 import com.zcxk.entity.WarningRule;
 import com.zcxk.service.WarningRuleService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -21,6 +26,10 @@ import java.util.List;
 public class WarningRuleServiceImpl implements WarningRuleService {
     @Autowired
     private WarningRuleMapper warningRuleMapper;
+    @Autowired
+    private WarningLogMapper warningLogMapper;
+    @Autowired
+    private WarningMessageMapper warningMessageMapper;
 
 
     @Override
@@ -73,4 +82,22 @@ public class WarningRuleServiceImpl implements WarningRuleService {
         warningRuleMapper.updateByPrimaryKeySelective(warningRule);
         return null;
     }
+
+    @Override
+    public void feedback(String name, Integer id, Integer feedbackStatus, String feedbackContent, String phoneNumber
+            , String accountNumber) {
+
+        WarningMessage warningMessage = warningMessageMapper.findById(id);
+
+        WarningLog warningLog = new WarningLog();
+        warningLog.setId(warningMessage.getWarningLogId());
+        warningLog.setFeedbackStatus(feedbackStatus);
+        warningLog.setFeedbackContent(feedbackContent);
+        warningLog.setUpdateBy(name);
+        warningLog.setDateUpdate(LocalDateTime.now());
+        warningLog.setUserName(name);
+        warningLog.setAccountNumber(accountNumber);
+        warningLog.setPhoneNumber(phoneNumber);
+        warningLogMapper.updateByPrimaryKeySelective(warningLog);
+    }
 }

+ 4 - 0
water_query_api/src/main/resources/application-dev.properties

@@ -41,6 +41,10 @@ spring.redis.jedis.pool.max-wait=-1s
 spring.redis.jedis.pool.max-idle=8
 ##½Ó³ØÖеÄ×îС¿ÕÏÐÁ¬½Ó
 spring.redis.jedis.pool.min-idle=0
+myapp=1001
+appsecret=123456
+getUniqIdUrl=http://192.168.0.113:8081/user-auth/user/getUniqId?appId={appId}&appSecret={appSecret}&code={code}
+
 
 
 

+ 55 - 0
water_query_api/src/main/resources/application-prd.properties

@@ -0,0 +1,55 @@
+server.port=9002
+server.servlet.context-path=/api
+logging.file.path=./logs
+spring.thymeleaf.prefix=classpath:/templates/
+spring.datasource.driver-class-name=com.mysql.jdbc.Driver
+#spring.datasource.url=jdbc:mysql://10.0.0.161:3306/smart_city_sit_6_10?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
+#spring.datasource.url=jdbc:mysql://114.135.61.188:33306/smart_city_sit_6_10?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
+spring.datasource.url=jdbc:mysql://47.112.217.10:3306/smart_city?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
+spring.datasource.username=root
+spring.datasource.password=100Zone@123
+spring.datasource.hikari.max-lifetime=30000
+# mybatis_config
+mybatis.mapper-locations=classpath*:mapper/*.xml
+mybatis.type-aliases-package=com.zcxk.entity
+mybatis.configuration.map-underscore-to-camel-case=true
+mybatis.configuration.log-impl=org.apache.ibatis.logging.stdout.StdOutImpl
+mybatis.configuration.use-column-label=true
+
+spring.jackson.time-zone=GMT+8
+
+
+
+
+spring.servlet.multipart.max-file-size=100MB
+spring.servlet.multipart.max-request-size=100MB
+spring.servlet.multipart.location=e:/test/files
+
+#spring.redis.password=123456
+spring.redis.sentinel.master=mymaster
+spring.redis.sentinel.nodes=10.0.0.71:26379,10.0.0.72:26379,10.0.0.73:26379
+#连接超时时间
+spring.redis.timeout=6000ms
+##Redis数据库索引(默认为0)
+spring.redis.database=0
+## 连接池配置,springboot2.0中直接使用jedis或者lettuce配置连接池,默认为lettuce连接池
+##连接池最大连接数(使用负值表示没有限制)
+spring.redis.jedis.pool.max-active=8
+##连接池最大阻塞等待时间(使用负值表示没有限制)
+spring.redis.jedis.pool.max-wait=-1s
+##连接池中的最大空闲连接
+spring.redis.jedis.pool.max-idle=8
+##接池中的最小空闲连接
+spring.redis.jedis.pool.min-idle=0
+
+
+
+
+
+
+
+
+
+
+
+