Просмотр исходного кода

Merge branch 'develop' of http://code.nyzhwlw.com:3000/com_yunfei_saas/agmp_iotm into develop

zhaiyifei 8 месяцев назад
Родитель
Сommit
283f75df22

+ 11 - 1
src/main/java/com/yunfeiyun/agmp/iotm/web/controller/IotWarnconfigController.java

@@ -5,9 +5,11 @@ import com.yunfeiyun.agmp.common.annotation.Log;
 import com.yunfeiyun.agmp.common.constant.ErrorCode;
 import com.yunfeiyun.agmp.common.core.controller.BaseController;
 import com.yunfeiyun.agmp.common.core.domain.AjaxResult;
+import com.yunfeiyun.agmp.common.core.domain.entity.SysUser;
 import com.yunfeiyun.agmp.common.core.page.TableDataInfo;
 import com.yunfeiyun.agmp.common.enums.BusinessType;
 import com.yunfeiyun.agmp.common.exception.BizException;
+import com.yunfeiyun.agmp.common.framework.web.service.ISysUserService;
 import com.yunfeiyun.agmp.common.utils.SecurityUtils;
 import com.yunfeiyun.agmp.common.utils.StringUtils;
 import com.yunfeiyun.agmp.common.utils.poi.ExcelUtil;
@@ -35,7 +37,15 @@ import java.util.List;
 public class IotWarnconfigController extends BaseController{
     @Autowired
     private IIotWarnconfigService iotWarnconfigService;
-
+    @Autowired
+    private ISysUserService userService;
+    @GetMapping("/select/user/list")
+    public AjaxResult selectUserList() {
+        SysUser user = new SysUser();
+        user.setTid(getTid());
+        List<SysUser> list = userService.selectBaseUserList(user);
+        return AjaxResult.success(list);
+    }
     /**
      * 查询告警配置列表
      */

+ 16 - 5
src/main/java/com/yunfeiyun/agmp/iotm/web/domain/reqvo/IotWarnconfigAddReqVo.java

@@ -1,17 +1,28 @@
 package com.yunfeiyun.agmp.iotm.web.domain.reqvo;
 
-import com.yunfeiyun.agmp.iot.common.domain.IotWarnconfig;
-import com.yunfeiyun.agmp.iot.common.domain.IotWarnindicator;
-import com.yunfeiyun.agmp.iot.common.domain.IotWarnobject;
+import com.yunfeiyun.agmp.iot.common.domain.*;
 import lombok.Data;
 
 import java.util.List;
 
 @Data
 public class IotWarnconfigAddReqVo extends IotWarnconfig {
-    /**告警对象*/
+    /**
+     * 告警对象
+     */
     private List<IotWarnobject> iotWarnobjectList;
-    /**告警指标(告警条件)*/
+    /**
+     * 告警指标(告警条件)
+     */
     private List<IotWarnindicator> iotWarnindicatorList;
+    /**
+     * 通知策略
+     */
+    private IotWarnpolicy iotWarnpolicy;
+
+    /**
+     * 接收人
+     */
+    private List<IotWarnreceiver> iotWarnreceiverList;
 
 }

+ 10 - 3
src/main/java/com/yunfeiyun/agmp/iotm/web/domain/reqvo/IotWarnconfigEditReqVo.java

@@ -1,8 +1,6 @@
 package com.yunfeiyun.agmp.iotm.web.domain.reqvo;
 
-import com.yunfeiyun.agmp.iot.common.domain.IotWarnconfig;
-import com.yunfeiyun.agmp.iot.common.domain.IotWarnindicator;
-import com.yunfeiyun.agmp.iot.common.domain.IotWarnobject;
+import com.yunfeiyun.agmp.iot.common.domain.*;
 import lombok.Data;
 
 import java.util.List;
@@ -13,4 +11,13 @@ public class IotWarnconfigEditReqVo extends IotWarnconfig {
     private List<IotWarnobject> iotWarnobjectList;
     // 告警指标
     private List<IotWarnindicator> iotWarnindicatorList;
+    /**
+     * 通知策略
+     */
+    private IotWarnpolicy iotWarnpolicy;
+
+    /**
+     * 接收人
+     */
+    private List<IotWarnreceiver> iotWarnreceiverList;
 }

+ 10 - 3
src/main/java/com/yunfeiyun/agmp/iotm/web/domain/resvo/IotWarnconfigInfoResVo.java

@@ -1,8 +1,6 @@
 package com.yunfeiyun.agmp.iotm.web.domain.resvo;
 
-import com.yunfeiyun.agmp.iot.common.domain.IotWarnconfig;
-import com.yunfeiyun.agmp.iot.common.domain.IotWarnindicator;
-import com.yunfeiyun.agmp.iot.common.domain.IotWarnobject;
+import com.yunfeiyun.agmp.iot.common.domain.*;
 import lombok.Data;
 
 import java.util.List;
@@ -11,4 +9,13 @@ import java.util.List;
 public class IotWarnconfigInfoResVo extends IotWarnconfig {
     private List<IotWarnobject> iotWarnobjectList;
     private List<IotWarnindicator> iotWarnindicatorList;
+    /**
+     * 通知策略
+     */
+    private IotWarnpolicy iotWarnpolicy;
+
+    /**
+     * 接收人
+     */
+    private List<IotWarnreceiver> iotWarnreceiverList;
 }

+ 2 - 1
src/main/java/com/yunfeiyun/agmp/iotm/web/domain/resvo/IotWarnconfigResVo.java

@@ -3,6 +3,7 @@ package com.yunfeiyun.agmp.iotm.web.domain.resvo;
 import com.yunfeiyun.agmp.common.core.domain.entity.SysUser;
 import com.yunfeiyun.agmp.iot.common.domain.IotDevice;
 import com.yunfeiyun.agmp.iot.common.domain.IotWarnconfig;
+import com.yunfeiyun.agmp.iot.common.domain.IotWarnpolicy;
 import lombok.Data;
 
 import java.util.List;
@@ -13,7 +14,7 @@ public class IotWarnconfigResVo extends IotWarnconfig {
     private String wpChannel;
     private String wcTouchtypeName;
     private String wcLevelName;
-
+    private String warnpolicy;
     private List<IotDevice> iotDeviceList;
     private List<SysUser> sysUserList;
 }

+ 11 - 7
src/main/java/com/yunfeiyun/agmp/iotm/web/mapper/IotWarnpolicyMapper.java

@@ -8,14 +8,14 @@ import java.util.List;
 
 /**
  * 告警通知策略,存储所有与告警相关的通知策略信息Mapper接口
- * 
+ *
  * @author 杨晓辉
  * @date 2025-03-07
  */
 public interface IotWarnpolicyMapper {
     /**
      * 查询告警通知策略,存储所有与告警相关的通知策略信息
-     * 
+     *
      * @param wpBid 告警通知策略,存储所有与告警相关的通知策略信息主键
      * @return 告警通知策略,存储所有与告警相关的通知策略信息
      */
@@ -23,7 +23,7 @@ public interface IotWarnpolicyMapper {
 
     /**
      * 查询告警通知策略,存储所有与告警相关的通知策略信息列表
-     * 
+     *
      * @param iotWarnpolicy 告警通知策略,存储所有与告警相关的通知策略信息
      * @return 告警通知策略,存储所有与告警相关的通知策略信息集合
      */
@@ -31,7 +31,7 @@ public interface IotWarnpolicyMapper {
 
     /**
      * 新增告警通知策略,存储所有与告警相关的通知策略信息
-     * 
+     *
      * @param iotWarnpolicy 告警通知策略,存储所有与告警相关的通知策略信息
      * @return 结果
      */
@@ -39,7 +39,7 @@ public interface IotWarnpolicyMapper {
 
     /**
      * 修改告警通知策略,存储所有与告警相关的通知策略信息
-     * 
+     *
      * @param iotWarnpolicy 告警通知策略,存储所有与告警相关的通知策略信息
      * @return 结果
      */
@@ -47,7 +47,7 @@ public interface IotWarnpolicyMapper {
 
     /**
      * 删除告警通知策略,存储所有与告警相关的通知策略信息
-     * 
+     *
      * @param wpBid 告警通知策略,存储所有与告警相关的通知策略信息主键
      * @return 结果
      */
@@ -55,9 +55,13 @@ public interface IotWarnpolicyMapper {
 
     /**
      * 批量删除告警通知策略,存储所有与告警相关的通知策略信息
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
     public int deleteIotWarnpolicyByWpBids(@Param("array") String[] ids, @Param("tid") String tid);
+
+    IotWarnpolicy findIotWarnpolicyByWcBid(String wcBid);
+
+    List<IotWarnpolicy> selectIotWarnpolicyListByWcBids(List<String> wcBids);
 }

+ 11 - 7
src/main/java/com/yunfeiyun/agmp/iotm/web/mapper/IotWarnreceiverMapper.java

@@ -8,14 +8,14 @@ import java.util.List;
 
 /**
  * 告警接收者Mapper接口
- * 
+ *
  * @author 杨晓辉
  * @date 2025-03-07
  */
 public interface IotWarnreceiverMapper {
     /**
      * 查询告警接收者
-     * 
+     *
      * @param wrBid 告警接收者主键
      * @return 告警接收者
      */
@@ -23,7 +23,7 @@ public interface IotWarnreceiverMapper {
 
     /**
      * 查询告警接收者列表
-     * 
+     *
      * @param iotWarnreceiver 告警接收者
      * @return 告警接收者集合
      */
@@ -31,7 +31,7 @@ public interface IotWarnreceiverMapper {
 
     /**
      * 新增告警接收者
-     * 
+     *
      * @param iotWarnreceiver 告警接收者
      * @return 结果
      */
@@ -39,7 +39,7 @@ public interface IotWarnreceiverMapper {
 
     /**
      * 修改告警接收者
-     * 
+     *
      * @param iotWarnreceiver 告警接收者
      * @return 结果
      */
@@ -47,7 +47,7 @@ public interface IotWarnreceiverMapper {
 
     /**
      * 删除告警接收者
-     * 
+     *
      * @param wrBid 告警接收者主键
      * @return 结果
      */
@@ -55,9 +55,13 @@ public interface IotWarnreceiverMapper {
 
     /**
      * 批量删除告警接收者
-     * 
+     *
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
     public int deleteIotWarnreceiverByWrBids(@Param("array") String[] ids, @Param("tid") String tid);
+
+    void deleteIotWarnreceiverByWcBid(String wcBid);
+
+    List<IotWarnreceiver>  selectIotWarnreceiversByWcBid(String wcBid);
 }

+ 12 - 7
src/main/java/com/yunfeiyun/agmp/iotm/web/service/IIotWarnpolicyService.java

@@ -1,19 +1,20 @@
 package com.yunfeiyun.agmp.iotm.web.service;
 
 import com.yunfeiyun.agmp.iot.common.domain.IotWarnpolicy;
+import org.hibernate.validator.constraints.Length;
 
 import java.util.List;
 
 /**
  * 告警通知策略,存储所有与告警相关的通知策略信息Service接口
- * 
+ *
  * @author 杨晓辉
  * @date 2025-03-07
  */
 public interface IIotWarnpolicyService {
     /**
      * 查询告警通知策略,存储所有与告警相关的通知策略信息
-     * 
+     *
      * @param wpBid 告警通知策略,存储所有与告警相关的通知策略信息主键
      * @return 告警通知策略,存储所有与告警相关的通知策略信息
      */
@@ -21,7 +22,7 @@ public interface IIotWarnpolicyService {
 
     /**
      * 查询告警通知策略,存储所有与告警相关的通知策略信息列表
-     * 
+     *
      * @param iotWarnpolicy 告警通知策略,存储所有与告警相关的通知策略信息
      * @return 告警通知策略,存储所有与告警相关的通知策略信息集合
      */
@@ -29,7 +30,7 @@ public interface IIotWarnpolicyService {
 
     /**
      * 新增告警通知策略,存储所有与告警相关的通知策略信息
-     * 
+     *
      * @param iotWarnpolicy 告警通知策略,存储所有与告警相关的通知策略信息
      * @return 结果
      */
@@ -37,7 +38,7 @@ public interface IIotWarnpolicyService {
 
     /**
      * 修改告警通知策略,存储所有与告警相关的通知策略信息
-     * 
+     *
      * @param iotWarnpolicy 告警通知策略,存储所有与告警相关的通知策略信息
      * @return 结果
      */
@@ -45,7 +46,7 @@ public interface IIotWarnpolicyService {
 
     /**
      * 批量删除告警通知策略,存储所有与告警相关的通知策略信息
-     * 
+     *
      * @param wpBids 需要删除的告警通知策略,存储所有与告警相关的通知策略信息主键集合
      * @return 结果
      */
@@ -53,9 +54,13 @@ public interface IIotWarnpolicyService {
 
     /**
      * 删除告警通知策略,存储所有与告警相关的通知策略信息信息
-     * 
+     *
      * @param wpBid 告警通知策略,存储所有与告警相关的通知策略信息主键
      * @return 结果
      */
     public int deleteIotWarnpolicyByWpBid(String wpBid, String tid);
+
+    IotWarnpolicy findIotWarnpolicyByWcBid(String wcBid);
+
+    List<IotWarnpolicy> selectIotWarnpolicyListByWcBids(List<String> wcBids);
 }

+ 12 - 7
src/main/java/com/yunfeiyun/agmp/iotm/web/service/IIotWarnreceiverService.java

@@ -1,19 +1,20 @@
 package com.yunfeiyun.agmp.iotm.web.service;
 
 import com.yunfeiyun.agmp.iot.common.domain.IotWarnreceiver;
+import org.hibernate.validator.constraints.Length;
 
 import java.util.List;
 
 /**
  * 告警接收者Service接口
- * 
+ *
  * @author 杨晓辉
  * @date 2025-03-07
  */
 public interface IIotWarnreceiverService {
     /**
      * 查询告警接收者
-     * 
+     *
      * @param wrBid 告警接收者主键
      * @return 告警接收者
      */
@@ -21,7 +22,7 @@ public interface IIotWarnreceiverService {
 
     /**
      * 查询告警接收者列表
-     * 
+     *
      * @param iotWarnreceiver 告警接收者
      * @return 告警接收者集合
      */
@@ -29,7 +30,7 @@ public interface IIotWarnreceiverService {
 
     /**
      * 新增告警接收者
-     * 
+     *
      * @param iotWarnreceiver 告警接收者
      * @return 结果
      */
@@ -37,7 +38,7 @@ public interface IIotWarnreceiverService {
 
     /**
      * 修改告警接收者
-     * 
+     *
      * @param iotWarnreceiver 告警接收者
      * @return 结果
      */
@@ -45,7 +46,7 @@ public interface IIotWarnreceiverService {
 
     /**
      * 批量删除告警接收者
-     * 
+     *
      * @param wrBids 需要删除的告警接收者主键集合
      * @return 结果
      */
@@ -53,9 +54,13 @@ public interface IIotWarnreceiverService {
 
     /**
      * 删除告警接收者信息
-     * 
+     *
      * @param wrBid 告警接收者主键
      * @return 结果
      */
     public int deleteIotWarnreceiverByWrBid(String wrBid, String tid);
+
+    void deleteIotWarnreceiverByWcBid(String wcBid);
+
+    List<IotWarnreceiver> selectIotWarnreceiversByWcBid(String wcBid);
 }

+ 76 - 6
src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotWarnconfigServiceImpl.java

@@ -29,10 +29,8 @@ import com.yunfeiyun.agmp.iotm.web.mapper.IotDeviceMapper;
 import com.yunfeiyun.agmp.iotm.web.mapper.IotDeviceconfigMapper;
 import com.yunfeiyun.agmp.iotm.web.mapper.IotWarnconfigMapper;
 import com.yunfeiyun.agmp.iotm.web.mapper.IotWarnobjectMapper;
-import com.yunfeiyun.agmp.iotm.web.service.IIotWarnconfigService;
-import com.yunfeiyun.agmp.iotm.web.service.IIotWarncountService;
-import com.yunfeiyun.agmp.iotm.web.service.IIotWarnindicatorService;
-import com.yunfeiyun.agmp.iotm.web.service.IIotWarnobjectService;
+import com.yunfeiyun.agmp.iotm.web.service.*;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections4.CollectionUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -50,6 +48,7 @@ import java.util.stream.Collectors;
  * @author 杨晓辉
  * @date 2025-03-07
  */
+@Slf4j
 @Service
 public class IotWarnconfigServiceImpl implements IIotWarnconfigService {
     @Autowired
@@ -74,7 +73,11 @@ public class IotWarnconfigServiceImpl implements IIotWarnconfigService {
 
     @Autowired
     private IIotWarncountService iIotWarncountService;
+    @Autowired
+    private IIotWarnpolicyService iotWarnpolicyService;
 
+    @Autowired
+    private IIotWarnreceiverService iIotWarnreceiverService;
 
     /**
      * 查询告警配置
@@ -136,9 +139,17 @@ public class IotWarnconfigServiceImpl implements IIotWarnconfigService {
                 }
             }
             // 填充通知人信息,暂不实现
+            List<IotWarnpolicy> iotWarnobjects = iotWarnpolicyService.selectIotWarnpolicyListByWcBids(wcBids);
+            if (iotWarnobjects != null) {
+                Map<String, IotWarnpolicy> iotWarnpolicyMap = iotWarnobjects.stream().collect(Collectors.toMap(IotWarnpolicy::getWcBid, i -> i));
+                for (IotWarnconfigResVo iotWarnconfigResVo : iotWarnconfigResVoList) {
+                    IotWarnpolicy iotWarnpolicy = iotWarnpolicyMap.get(iotWarnconfigResVo.getWcBid());
+                    if (null != iotWarnpolicy) {
+                        iotWarnconfigResVo.setWarnpolicy(iotWarnpolicy.getWpChannel());
+                    }
+                }
+            }
         }
-
-
         return iotWarnconfigResVoList;
     }
 
@@ -261,6 +272,25 @@ public class IotWarnconfigServiceImpl implements IIotWarnconfigService {
         List<IotWarnindicator> iotWarnindicatorList = iotWarnconfigAddReqVo.getIotWarnindicatorList();
 
         addWarnindicator(iotWarnconfigAddReqVo.getWcBid(), iotWarnindicatorList);
+
+        //插入通知策略
+        IotWarnpolicy iotWarnpolicy = iotWarnconfigAddReqVo.getIotWarnpolicy();
+        if (iotWarnpolicy != null) {
+            iotWarnpolicy.setWpBid(iotWarnpolicy.getUUId());
+            iotWarnpolicy.setWcBid(iotWarnconfigAddReqVo.getWcBid());
+            iotWarnpolicy.setTid(SecurityUtils.getTid());
+            iotWarnpolicy.setWpCreator(SecurityUtils.getUserId());
+            iotWarnpolicy.setWpCreateddate(DateUtils.dateTimeNow());
+            iotWarnpolicyService.insertIotWarnpolicy(iotWarnpolicy);
+        }
+        //插入通知对象
+        List<IotWarnreceiver> iotWarnreceiverList = iotWarnconfigAddReqVo.getIotWarnreceiverList();
+        for (IotWarnreceiver iotWarnreceiver : iotWarnreceiverList) {
+            iotWarnreceiver.setWrBid(iotWarnreceiver.getUUId());
+            iotWarnreceiver.setTid(SecurityUtils.getTid());
+            iotWarnreceiver.setWcBid(iotWarnconfigAddReqVo.getWcBid());
+            iIotWarnreceiverService.insertIotWarnreceiver(iotWarnreceiver);
+        }
         return iotWarnconfigMapper.insertIotWarnconfig(iotWarnconfigAddReqVo);
     }
 
@@ -302,6 +332,39 @@ public class IotWarnconfigServiceImpl implements IIotWarnconfigService {
 
         List<IotWarnindicator> iotWarnindicatorList = iotWarnconfigEditReqVo.getIotWarnindicatorList();
         addWarnindicator(iotWarnconfigEditReqVo.getWcBid(), iotWarnindicatorList);
+
+        //编辑策略
+        IotWarnpolicy iotWarnpolicy = iotWarnpolicyService.findIotWarnpolicyByWcBid(iotWarnconfigEditReqVo.getWcBid());
+        IotWarnpolicy iotWarnpolicyEdit = iotWarnconfigEditReqVo.getIotWarnpolicy();
+
+
+        if (iotWarnpolicyEdit != null) {
+            if (iotWarnpolicy != null) {
+                iotWarnpolicyEdit.setWpBid(iotWarnpolicy.getWpBid());
+                iotWarnpolicyEdit.setWpModifieddate(DateUtils.dateTimeNow());
+                iotWarnpolicyEdit.setWpModifier(SecurityUtils.getUserId());
+                iotWarnpolicyService.updateIotWarnpolicy(iotWarnpolicyEdit);
+            } else {
+                iotWarnpolicy = new IotWarnpolicy();
+                iotWarnpolicy.setWpBid(iotWarnpolicy.getUUId());
+                iotWarnpolicy.setWcBid(iotWarnconfigEditReqVo.getWcBid());
+                iotWarnpolicy.setTid(SecurityUtils.getTid());
+                iotWarnpolicy.setWpCreator(SecurityUtils.getUserId());
+                iotWarnpolicy.setWpCreateddate(DateUtils.dateTimeNow());
+                iotWarnpolicyService.insertIotWarnpolicy(iotWarnpolicy);
+            }
+        }
+
+        //插入通知对象
+        List<IotWarnreceiver> iotWarnreceiverList = iotWarnconfigEditReqVo.getIotWarnreceiverList();
+        iIotWarnreceiverService.deleteIotWarnreceiverByWcBid(iotWarnconfigEditReqVo.getWcBid());
+        for (IotWarnreceiver iotWarnreceiver : iotWarnreceiverList) {
+            iotWarnreceiver.setWrBid(iotWarnreceiver.getUUId());
+            iotWarnreceiver.setTid(iotWarnpolicy.getTid());
+            iotWarnreceiver.setWcBid(iotWarnconfigEditReqVo.getWcBid());
+            iIotWarnreceiverService.insertIotWarnreceiver(iotWarnreceiver);
+        }
+
         return iotWarnconfigMapper.updateIotWarnconfig(iotWarnconfigEditReqVo);
     }
 
@@ -412,6 +475,13 @@ public class IotWarnconfigServiceImpl implements IIotWarnconfigService {
         BeanUtils.copyProperties(iotWarnconfig, iotWarnconfigInfoResVo);
         iotWarnconfigInfoResVo.setIotWarnindicatorList(resultIotWarnIndicatorList);
         iotWarnconfigInfoResVo.setIotWarnobjectList(iotWarnobjectList);
+        //设置通知策略
+        IotWarnpolicy iotWarnpolicyByWcBid = iotWarnpolicyService.findIotWarnpolicyByWcBid(wcBid);
+        iotWarnconfigInfoResVo.setIotWarnpolicy(iotWarnpolicyByWcBid);
+
+        //设置通知接收人
+        List<IotWarnreceiver> iotWarnreceiverList = iIotWarnreceiverService.selectIotWarnreceiversByWcBid(wcBid);
+        iotWarnconfigInfoResVo.setIotWarnreceiverList(iotWarnreceiverList);
         return iotWarnconfigInfoResVo;
     }
 

+ 18 - 7
src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotWarnpolicyServiceImpl.java

@@ -6,12 +6,13 @@ import com.yunfeiyun.agmp.iotm.web.service.IIotWarnpolicyService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Collections;
 import java.util.List;
 
 
 /**
  * 告警通知策略,存储所有与告警相关的通知策略信息Service业务层处理
- * 
+ *
  * @author 杨晓辉
  * @date 2025-03-07
  */
@@ -22,7 +23,7 @@ public class IotWarnpolicyServiceImpl implements IIotWarnpolicyService {
 
     /**
      * 查询告警通知策略,存储所有与告警相关的通知策略信息
-     * 
+     *
      * @param wpBid 告警通知策略,存储所有与告警相关的通知策略信息主键
      * @return 告警通知策略,存储所有与告警相关的通知策略信息
      */
@@ -33,7 +34,7 @@ public class IotWarnpolicyServiceImpl implements IIotWarnpolicyService {
 
     /**
      * 查询告警通知策略,存储所有与告警相关的通知策略信息列表
-     * 
+     *
      * @param iotWarnpolicy 告警通知策略,存储所有与告警相关的通知策略信息
      * @return 告警通知策略,存储所有与告警相关的通知策略信息
      */
@@ -44,7 +45,7 @@ public class IotWarnpolicyServiceImpl implements IIotWarnpolicyService {
 
     /**
      * 新增告警通知策略,存储所有与告警相关的通知策略信息
-     * 
+     *
      * @param iotWarnpolicy 告警通知策略,存储所有与告警相关的通知策略信息
      * @return 结果
      */
@@ -55,7 +56,7 @@ public class IotWarnpolicyServiceImpl implements IIotWarnpolicyService {
 
     /**
      * 修改告警通知策略,存储所有与告警相关的通知策略信息
-     * 
+     *
      * @param iotWarnpolicy 告警通知策略,存储所有与告警相关的通知策略信息
      * @return 结果
      */
@@ -66,7 +67,7 @@ public class IotWarnpolicyServiceImpl implements IIotWarnpolicyService {
 
     /**
      * 批量删除告警通知策略,存储所有与告警相关的通知策略信息
-     * 
+     *
      * @param wpBids 需要删除的告警通知策略,存储所有与告警相关的通知策略信息主键
      * @return 结果
      */
@@ -77,7 +78,7 @@ public class IotWarnpolicyServiceImpl implements IIotWarnpolicyService {
 
     /**
      * 删除告警通知策略,存储所有与告警相关的通知策略信息信息
-     * 
+     *
      * @param wpBid 告警通知策略,存储所有与告警相关的通知策略信息主键
      * @return 结果
      */
@@ -85,4 +86,14 @@ public class IotWarnpolicyServiceImpl implements IIotWarnpolicyService {
     public int deleteIotWarnpolicyByWpBid(String wpBid, String tid){
         return iotWarnpolicyMapper.deleteIotWarnpolicyByWpBid(wpBid, tid);
     }
+
+    @Override
+    public IotWarnpolicy findIotWarnpolicyByWcBid(String wcBid) {
+        return iotWarnpolicyMapper.findIotWarnpolicyByWcBid(wcBid);
+    }
+
+    @Override
+    public List<IotWarnpolicy> selectIotWarnpolicyListByWcBids(List<String> wcBids) {
+        return iotWarnpolicyMapper.selectIotWarnpolicyListByWcBids(wcBids);
+    }
 }

+ 18 - 7
src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotWarnreceiverServiceImpl.java

@@ -6,12 +6,13 @@ import com.yunfeiyun.agmp.iotm.web.service.IIotWarnreceiverService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.Collections;
 import java.util.List;
 
 
 /**
  * 告警接收者Service业务层处理
- * 
+ *
  * @author 杨晓辉
  * @date 2025-03-07
  */
@@ -22,7 +23,7 @@ public class IotWarnreceiverServiceImpl implements IIotWarnreceiverService {
 
     /**
      * 查询告警接收者
-     * 
+     *
      * @param wrBid 告警接收者主键
      * @return 告警接收者
      */
@@ -33,7 +34,7 @@ public class IotWarnreceiverServiceImpl implements IIotWarnreceiverService {
 
     /**
      * 查询告警接收者列表
-     * 
+     *
      * @param iotWarnreceiver 告警接收者
      * @return 告警接收者
      */
@@ -44,7 +45,7 @@ public class IotWarnreceiverServiceImpl implements IIotWarnreceiverService {
 
     /**
      * 新增告警接收者
-     * 
+     *
      * @param iotWarnreceiver 告警接收者
      * @return 结果
      */
@@ -55,7 +56,7 @@ public class IotWarnreceiverServiceImpl implements IIotWarnreceiverService {
 
     /**
      * 修改告警接收者
-     * 
+     *
      * @param iotWarnreceiver 告警接收者
      * @return 结果
      */
@@ -66,7 +67,7 @@ public class IotWarnreceiverServiceImpl implements IIotWarnreceiverService {
 
     /**
      * 批量删除告警接收者
-     * 
+     *
      * @param wrBids 需要删除的告警接收者主键
      * @return 结果
      */
@@ -77,7 +78,7 @@ public class IotWarnreceiverServiceImpl implements IIotWarnreceiverService {
 
     /**
      * 删除告警接收者信息
-     * 
+     *
      * @param wrBid 告警接收者主键
      * @return 结果
      */
@@ -85,4 +86,14 @@ public class IotWarnreceiverServiceImpl implements IIotWarnreceiverService {
     public int deleteIotWarnreceiverByWrBid(String wrBid, String tid){
         return iotWarnreceiverMapper.deleteIotWarnreceiverByWrBid(wrBid, tid);
     }
+
+    @Override
+    public void deleteIotWarnreceiverByWcBid(String wcBid) {
+        iotWarnreceiverMapper.deleteIotWarnreceiverByWcBid(wcBid);
+    }
+
+    @Override
+    public List<IotWarnreceiver> selectIotWarnreceiversByWcBid(String wcBid) {
+        return  iotWarnreceiverMapper.selectIotWarnreceiversByWcBid(wcBid);
+    }
 }

+ 13 - 5
src/main/resources/mapper/IotWarnpolicyMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.yunfeiyun.agmp.iotm.web.mapper.IotWarnpolicyMapper">
-    
+
     <resultMap type="IotWarnpolicy" id="IotWarnpolicyResult">
         <result property="id"    column="id"    />
         <result property="wpBid"    column="wpBid"    />
@@ -25,7 +25,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectIotWarnpolicyList" parameterType="IotWarnpolicy" resultMap="IotWarnpolicyResult">
         <include refid="selectIotWarnpolicyVo"/>
-        <where>  
+        <where>
             <if test="wpBid != null  and wpBid != ''"> and wpBid = #{wpBid}</if>
             <if test="wcBid != null  and wcBid != ''"> and wcBid = #{wcBid}</if>
             <if test="wpFrequency != null  and wpFrequency != ''"> and wpFrequency = #{wpFrequency}</if>
@@ -39,12 +39,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="tid != null  and tid != ''"> and tid = #{tid}</if>
         </where>
     </select>
-    
+
     <select id="selectIotWarnpolicyById" parameterType="Long" resultMap="IotWarnpolicyResult">
         <include refid="selectIotWarnpolicyVo"/>
         where wpBid = #{wpBid} and tid = #{tid}
     </select>
-        
+    <select id="findIotWarnpolicyByWcBid" resultType="com.yunfeiyun.agmp.iot.common.domain.IotWarnpolicy">
+        select * from IotWarnpolicy where wcBid = #{wcBid}
+    </select>
+    <select id="selectIotWarnpolicyListByWcBids"
+            resultType="com.yunfeiyun.agmp.iot.common.domain.IotWarnpolicy" parameterType="list">
+        select * from IotWarnpolicy where wcBid in
+        <foreach item="wcBid" collection="list" open="(" separator="," close=")">#{wcBid}</foreach>
+    </select>
+
     <insert id="insertIotWarnpolicy" parameterType="IotWarnpolicy" useGeneratedKeys="true" keyProperty="id">
         insert into IotWarnpolicy
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -103,4 +111,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{wpBid}
         </foreach>
     </delete>
-</mapper>
+</mapper>

+ 13 - 5
src/main/resources/mapper/IotWarnreceiverMapper.xml

@@ -3,7 +3,7 @@
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.yunfeiyun.agmp.iotm.web.mapper.IotWarnreceiverMapper">
-    
+
     <resultMap type="IotWarnreceiver" id="IotWarnreceiverResult">
         <result property="id"    column="id"    />
         <result property="wrBid"    column="wrBid"    />
@@ -18,19 +18,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectIotWarnreceiverList" parameterType="IotWarnreceiver" resultMap="IotWarnreceiverResult">
         <include refid="selectIotWarnreceiverVo"/>
-        <where>  
+        <where>
             <if test="wrBid != null  and wrBid != ''"> and wrBid = #{wrBid}</if>
             <if test="wcBid != null  and wcBid != ''"> and wcBid = #{wcBid}</if>
             <if test="wruserId != null  and wruserId != ''"> and wruserId = #{wruserId}</if>
             <if test="tid != null  and tid != ''"> and tid = #{tid}</if>
         </where>
     </select>
-    
+
     <select id="selectIotWarnreceiverByWrBid" parameterType="Long" resultMap="IotWarnreceiverResult">
         <include refid="selectIotWarnreceiverVo"/>
         where wrBid = #{wrBid} and tid = #{tid}
     </select>
-        
+    <select id="selectIotWarnreceiversByWcBid" resultType="com.yunfeiyun.agmp.iot.common.domain.IotWarnreceiver">
+        SELECT *
+        FROM IotWarnreceiver
+        WHERE wcBid = #{wcBid}
+    </select>
+
     <insert id="insertIotWarnreceiver" parameterType="IotWarnreceiver" useGeneratedKeys="true" keyProperty="id">
         insert into IotWarnreceiver
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -68,4 +73,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{wrBid}
         </foreach>
     </delete>
-</mapper>
+    <delete id="deleteIotWarnreceiverByWcBid">
+        delete from IotWarnreceiver where wcBid = #{wcBid}
+    </delete>
+</mapper>