Browse Source

Merge branch 'develop' of com_yunfei_saas/agmp_iotm into master

yf_zn 11 months ago
parent
commit
6d6aea6b4a
46 changed files with 3842 additions and 98 deletions
  1. 458 0
      src/main/java/com/yunfeiyun/agmp/iotm/device/sf/controller/IotDeviceSfController.java
  2. 13 0
      src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfConfigCmdReqVo.java
  3. 67 0
      src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfElementfactorAddReqVo.java
  4. 67 0
      src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfElementfactorAlreadyListResVo.java
  5. 20 0
      src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfElementfactorBatchAddReqVo.java
  6. 35 0
      src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfElementfactorEditReqVo.java
  7. 70 0
      src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfElementfactorInfoVo.java
  8. 66 0
      src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfElementfactorListReqVo.java
  9. 10 0
      src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfGroupParamEditReqVo.java
  10. 10 0
      src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfGroupParamResVo.java
  11. 23 0
      src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfIrrigationOprecordListReqVo.java
  12. 35 0
      src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfIrrigationRecordListReqVo.java
  13. 487 0
      src/main/java/com/yunfeiyun/agmp/iotm/device/sf/service/IIotSfCommService.java
  14. 1180 0
      src/main/java/com/yunfeiyun/agmp/iotm/device/sf/service/impl/IotRunHaoSfServiceImpl.java
  15. 11 1
      src/main/java/com/yunfeiyun/agmp/iotm/web/controller/IotWarnconfigController.java
  16. 9 0
      src/main/java/com/yunfeiyun/agmp/iotm/web/controller/IotWarnreceiverController.java
  17. 16 5
      src/main/java/com/yunfeiyun/agmp/iotm/web/domain/reqvo/IotWarnconfigAddReqVo.java
  18. 10 3
      src/main/java/com/yunfeiyun/agmp/iotm/web/domain/reqvo/IotWarnconfigEditReqVo.java
  19. 10 3
      src/main/java/com/yunfeiyun/agmp/iotm/web/domain/resvo/IotWarnconfigInfoResVo.java
  20. 2 1
      src/main/java/com/yunfeiyun/agmp/iotm/web/domain/resvo/IotWarnconfigResVo.java
  21. 55 0
      src/main/java/com/yunfeiyun/agmp/iotm/web/mapper/IotSfElementfactorMapper.java
  22. 33 0
      src/main/java/com/yunfeiyun/agmp/iotm/web/mapper/IotSfIrrigationOprecordMapper.java
  23. 25 0
      src/main/java/com/yunfeiyun/agmp/iotm/web/mapper/IotSfIrrigationRecordMapper.java
  24. 11 7
      src/main/java/com/yunfeiyun/agmp/iotm/web/mapper/IotWarnpolicyMapper.java
  25. 11 7
      src/main/java/com/yunfeiyun/agmp/iotm/web/mapper/IotWarnreceiverMapper.java
  26. 2 0
      src/main/java/com/yunfeiyun/agmp/iotm/web/service/IIotDeviceconfigService.java
  27. 120 0
      src/main/java/com/yunfeiyun/agmp/iotm/web/service/IIotSfElementfactorService.java
  28. 33 0
      src/main/java/com/yunfeiyun/agmp/iotm/web/service/IIotSfIrrigationOprecordService.java
  29. 34 0
      src/main/java/com/yunfeiyun/agmp/iotm/web/service/IIotSfIrrigationRecordService.java
  30. 8 7
      src/main/java/com/yunfeiyun/agmp/iotm/web/service/IIotWarnindicatorService.java
  31. 12 7
      src/main/java/com/yunfeiyun/agmp/iotm/web/service/IIotWarnpolicyService.java
  32. 12 7
      src/main/java/com/yunfeiyun/agmp/iotm/web/service/IIotWarnreceiverService.java
  33. 249 0
      src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotSfElementfactorServiceImpl.java
  34. 75 0
      src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotSfIrrigationOprecordServiceImpl.java
  35. 105 0
      src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotSfIrrigationRecordServiceImpl.java
  36. 106 6
      src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotWarnconfigServiceImpl.java
  37. 34 13
      src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotWarnindicatorServiceImpl.java
  38. 18 7
      src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotWarnpolicyServiceImpl.java
  39. 18 7
      src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotWarnreceiverServiceImpl.java
  40. 1 1
      src/main/resources/application-test.yml
  41. 71 0
      src/main/resources/mapper/IotSfElementfactorMapper.xml
  42. 47 0
      src/main/resources/mapper/IotSfIrrigationOprecordMapper.xml
  43. 130 0
      src/main/resources/mapper/IotSfIrrigationRecordMapper.xml
  44. 6 6
      src/main/resources/mapper/IotWarnlogMapper.xml
  45. 13 5
      src/main/resources/mapper/IotWarnpolicyMapper.xml
  46. 14 5
      src/main/resources/mapper/IotWarnreceiverMapper.xml

+ 458 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/sf/controller/IotDeviceSfController.java

@@ -0,0 +1,458 @@
+package com.yunfeiyun.agmp.iotm.device.sf.controller;
+
+import cn.hutool.core.exceptions.ValidateException;
+import com.alibaba.fastjson2.JSONObject;
+import com.yunfeiyun.agmp.common.constant.ErrorCode;
+import com.yunfeiyun.agmp.common.core.domain.AjaxResult;
+import com.yunfeiyun.agmp.common.core.page.TableDataInfo;
+import com.yunfeiyun.agmp.common.log.LogCore;
+import com.yunfeiyun.agmp.common.utils.StringUtils;
+import com.yunfeiyun.agmp.iot.common.constant.IotErrorCode;
+import com.yunfeiyun.agmp.iot.common.constant.devicetype.IotDeviceDictConst;
+import com.yunfeiyun.agmp.iot.common.domain.IotSfElementfactor;
+import com.yunfeiyun.agmp.iot.common.exception.IotBizException;
+import com.yunfeiyun.agmp.iotm.common.controller.BaseController;
+import com.yunfeiyun.agmp.iotm.device.common.domin.IotDeviceBaseFunReqVo;
+import com.yunfeiyun.agmp.iotm.device.common.domin.IotDeviceDataListReqVo;
+import com.yunfeiyun.agmp.iotm.device.common.service.IotDeviceCommonService;
+import com.yunfeiyun.agmp.iotm.device.sf.domain.*;
+import com.yunfeiyun.agmp.iotm.util.ValidateUtil;
+import com.yunfeiyun.agmp.iotm.web.domain.reqvo.IotDeviceListReqVo;
+import com.yunfeiyun.agmp.iotm.web.domain.resvo.IotDeviceListResVo;
+import com.yunfeiyun.agmp.iotm.web.service.IIotDeviceService;
+import com.yunfeiyun.agmp.iotm.web.service.IIotSfElementfactorService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * 水肥机设备
+ */
+
+@RestController
+@RequestMapping("/iot/device/sf")
+@Slf4j
+public class IotDeviceSfController extends BaseController {
+    @Autowired
+    private IIotDeviceService iIotDeviceService;
+
+    @Autowired
+    private IotDeviceCommonService iotDeviceCommonService;
+
+    @Autowired
+    private IIotSfElementfactorService iotSfElementfactorService;
+
+    /**
+     * 水肥设备列表
+     * /list  所有设备
+     * /rh/list 润浩设备
+     * @param reqVo
+     * @return
+     */
+    @GetMapping({"/list", "/rh/list"})
+    public TableDataInfo list(HttpServletRequest request, IotDeviceListReqVo reqVo) {
+        startPage();
+        String reqUri = request.getRequestURI();
+        String[] devTypeList = null;
+
+        if(reqUri.endsWith("/rh/list")){
+            devTypeList = new String[]{IotDeviceDictConst.TYPE_RUNHAO_SF};
+        }
+
+        List<IotDeviceListResVo> list = null;
+        if (devTypeList != null) {
+            reqVo.setDevtypeBidList(Arrays.asList(devTypeList));
+            list = iIotDeviceService.selectIotDeviceListByType(reqVo);
+        }
+        return getDataTable(list);
+    }
+
+    /**
+     * 获取泵类设备已存在的元素列表
+     * 该接口用于根据请求参数获取已存在的元素列表,并返回相关数据。
+     *
+     * @param reqVo 请求参数,包含设备标识devBid等信息
+     * @return 返回TableDataInfo对象,包含元素列表数据
+     * @throws IllegalArgumentException 如果reqVo中的devBid为空,则抛出异常
+     */
+    @GetMapping("/pump/already/list")
+    public TableDataInfo getPumpAlreadyElementList(IotSfElementfactorListReqVo reqVo){
+        ValidateUtil.validateDevBid(reqVo.getDevBid());
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
+        iotDeviceBaseFunReqVo.setMethodName("getPumpAlreadyElementList");
+        iotDeviceBaseFunReqVo.setParam(reqVo);
+        return iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+    }
+
+    /**
+     * 获取泵类未处理的元素列表
+     * 该接口用于根据请求参数获取未处理的元素列表,并返回相关数据。
+     *
+     * @param reqVo 请求参数,包含设备标识(devBid)等信息
+     * @return TableDataInfo 包含未处理的元素列表的数据封装对象
+     * @throws IllegalArgumentException 如果devBid为空,则抛出非法参数异常
+     */
+    @GetMapping("/pump/unalready/list")
+    public TableDataInfo getPumpUnAlreadyElementList(IotSfElementfactorListReqVo reqVo){
+        ValidateUtil.validateDevBid(reqVo.getDevBid());
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
+        iotDeviceBaseFunReqVo.setMethodName("getPumpUnAlreadyElementList");
+        iotDeviceBaseFunReqVo.setParam(reqVo);
+        return iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+    }
+
+    /**
+     * 新增要素
+     * 该接口用于添加新的泵类要素,接收相关参数并调用通用设备功能服务进行处理。
+     *
+     * @param reqVo 包含设备添加请求的参数,包括设备标识(devBid)等
+     * @return 返回操作结果的表格数据信息
+     * @throws ValidateException 如果设备标识(devBid)无效,则抛出ValidateException异常
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @PostMapping("/ele/add")
+    public AjaxResult elementAdd(@RequestBody IotSfElementfactorAddReqVo reqVo){
+        ValidateUtil.validateDevBid(reqVo.getDevBid());
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
+        iotDeviceBaseFunReqVo.setMethodName("elementAdd");
+        iotDeviceBaseFunReqVo.setParam(reqVo);
+        int status = iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+        return toAjax(status);
+    }
+
+
+    /**
+     * 删除要素接口
+     * 根据传入的要素标识删除对应的要素信息
+     *
+     * @param sfBid 要素标识,用于唯一确定要删除的要素
+     * @return AjaxResult 操作结果,包含状态码和消息
+     * @throws IotBizException 如果要素标识为空,则抛出IotBizException异常
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @DeleteMapping("/ele/delete/{sfBid}")
+    public AjaxResult elementDelete(@PathVariable String sfBid){
+        if(StringUtils.isEmpty(sfBid)){
+            throw new IotBizException(IotErrorCode.PARAM_INVALID.getCode(), "要素标识不能为空");
+        }
+        IotSfElementfactor iotSfElementfactor = iotSfElementfactorService.selectIotSfElementfactorBySfBid(sfBid);
+        if(iotSfElementfactor == null){
+            throw new IotBizException(IotErrorCode.PARAM_INVALID.getCode(), "要素不存在");
+        }
+
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(iotSfElementfactor.getDevBid());
+        iotDeviceBaseFunReqVo.setMethodName("elementDelete");
+        iotDeviceBaseFunReqVo.setParam(iotSfElementfactor);
+        int status = iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+        return toAjax(status);
+    }
+
+    /**
+     * 获取未配置的灌区元素列表
+     *
+     * @param reqVo 请求参数,包含设备标识(devBid)等筛选条件
+     * @return 返回TableDataInfo对象,包含未分组的元素列表及相关信息
+     * @throws ValidateException 如果devBid为空或不符合要求,则抛出ValidateException异常
+     */
+    @GetMapping("/group/unalready/list")
+    public TableDataInfo getGroupUnAlreadyElementList(IotSfElementfactorListReqVo reqVo){
+        ValidateUtil.validateDevBid(reqVo.getDevBid());
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
+        iotDeviceBaseFunReqVo.setMethodName("getGroupUnAlreadyElementList");
+        iotDeviceBaseFunReqVo.setParam(reqVo);
+        return iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+    }
+
+
+    /**
+     * 获取灌区设备已存在的元素列表
+     * 该接口用于根据请求参数获取已存在的元素列表,并返回相关数据。
+     *
+     * @param reqVo 请求参数,包含设备标识devBid等信息
+     * @return 返回TableDataInfo对象,包含元素列表数据
+     * @throws IllegalArgumentException 如果reqVo中的devBid为空,则抛出异常
+     */
+    @GetMapping("/group/already/list")
+    public TableDataInfo getGroupAlreadyElementList(IotSfElementfactorListReqVo reqVo){
+        ValidateUtil.validateDevBid(reqVo.getDevBid());
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
+        iotDeviceBaseFunReqVo.setMethodName("getGroupAlreadyElementList");
+        iotDeviceBaseFunReqVo.setParam(reqVo);
+        return iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+    }
+
+    /**
+     * 批量新增要素
+     * 该接口用于添加新的泵类要素,接收相关参数并调用通用设备功能服务进行处理。
+     *
+     * @param reqVo 包含设备添加请求的参数,包括设备标识(devBid)等
+     * @return 返回操作结果的表格数据信息
+     * @throws ValidateException 如果设备标识(devBid)无效,则抛出ValidateException异常
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @PostMapping("/ele/batch/add")
+    public AjaxResult elementBatchAdd(@RequestBody IotSfElementfactorBatchAddReqVo reqVo){
+        ValidateUtil.validateDevBid(reqVo.getDevBid());
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
+        iotDeviceBaseFunReqVo.setMethodName("elementBatchAdd");
+        iotDeviceBaseFunReqVo.setParam(reqVo);
+        int status = iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+        return toAjax(status);
+    }
+
+    /**
+     * 获取未配置的电磁阀元素列表
+     *
+     * @param reqVo 请求参数,包含设备标识(devBid)等筛选条件
+     * @return 返回TableDataInfo对象,包含未分组的元素列表及相关信息
+     * @throws ValidateException 如果devBid为空或不符合要求,则抛出ValidateException异常
+     */
+    @GetMapping("/valve/unalready/list")
+    public TableDataInfo getValveUnAlreadyElementList(IotSfElementfactorListReqVo reqVo){
+        ValidateUtil.validateDevBid(reqVo.getDevBid());
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
+        iotDeviceBaseFunReqVo.setMethodName("getValveUnAlreadyElementList");
+        iotDeviceBaseFunReqVo.setParam(reqVo);
+        return iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+    }
+
+    /**
+     * 获取水肥机状态信息
+     * @param
+     * @return
+     */
+    @GetMapping("/status/{devBid}")
+    public TableDataInfo getStatus(@PathVariable String devBid){
+        ValidateUtil.validateDevBid(devBid);
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(devBid);
+        iotDeviceBaseFunReqVo.setMethodName("getStatus");
+        iotDeviceBaseFunReqVo.setParam(devBid);
+        return iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+    }
+
+    /**
+     * 设备详情信息
+     * @param
+     * @return
+     */
+    @GetMapping("/rh/info/{devBid}")
+    public AjaxResult info(@PathVariable("devBid") String devBid) {
+        ValidateUtil.validateDevBid(devBid);
+
+        IotDeviceListReqVo reqVo = new IotDeviceListReqVo();
+        reqVo.setDevBid(devBid);
+        List<IotDeviceListResVo> resVoList = iIotDeviceService.selectIotDeviceListByType(reqVo);
+        if(resVoList == null || resVoList.isEmpty()){
+            throw new IotBizException(IotErrorCode.PARAM_INVALID.getCode(), "设备不存在");
+        }
+        IotDeviceListResVo resVo = resVoList.get(0);
+        return AjaxResult.success(resVo);
+    }
+
+    @GetMapping("/config/info/{devBid}")
+    public AjaxResult configInfo(@PathVariable("devBid") String devBid){
+        IotDeviceDataListReqVo reqVo = new IotDeviceDataListReqVo();
+        reqVo.setDevBid(devBid);
+
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
+        iotDeviceBaseFunReqVo.setMethodName("configInfo");
+        iotDeviceBaseFunReqVo.setParam(reqVo);
+        JSONObject jsonObject = iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+        return AjaxResult.success(jsonObject);
+    }
+
+    /**
+     * 获取水肥机状态信息
+     * @param
+     * @return
+     */
+    @GetMapping("/rh/run/status/{devBid}")
+    public AjaxResult getRunStatus(@PathVariable String devBid){
+        ValidateUtil.validateDevBid(devBid);
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(devBid);
+        iotDeviceBaseFunReqVo.setMethodName("getRunStatus");
+        iotDeviceBaseFunReqVo.setParam(devBid);
+        JSONObject jsonObject = iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+        return AjaxResult.success(jsonObject);
+    }
+
+    /**
+     * 下发水肥机设备设置指令
+     *
+     * @return
+     * @throws Exception
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @PostMapping("/config/edit")
+    public AjaxResult editConfig(@RequestBody IotSfConfigCmdReqVo reqVo) {
+        log.info("【{}】【水肥机】【发水肥机设备设置指令】客户id {}", LogCore.getSeq(), getCustomerId());
+        String devBid = reqVo.getDevBid();
+        ValidateUtil.validateDevBid(devBid);
+
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
+        iotDeviceBaseFunReqVo.setMethodName("editConfig");
+        iotDeviceBaseFunReqVo.setParam(reqVo);
+        String taskId = iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+
+        return new AjaxResult(ErrorCode.SUCCESS.getCode(), "下发成功,等待设备响应结果", taskId);
+    }
+
+    /**
+     * 新增要素
+     * 该接口用于添加新的泵类要素,接收相关参数并调用通用设备功能服务进行处理。
+     *
+     * @param reqVo 包含设备添加请求的参数,包括设备标识(devBid)等
+     * @return 返回操作结果的表格数据信息
+     * @throws ValidateException 如果设备标识(devBid)无效,则抛出ValidateException异常
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @PostMapping("/ele/edit")
+    public AjaxResult elementEdit(@RequestBody IotSfElementfactorEditReqVo reqVo){
+        ValidateUtil.validateDevBid(reqVo.getDevBid());
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
+        iotDeviceBaseFunReqVo.setMethodName("elementEdit");
+        iotDeviceBaseFunReqVo.setParam(reqVo);
+        int status = iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+        return toAjax(status);
+    }
+
+    /**
+     * 获取润浩全局灌区参数
+     * @param
+     * @return
+     */
+    @GetMapping("/rh/group/param/global/{devBid}")
+    public AjaxResult getGroupParamByGlobal(@PathVariable String devBid){
+        ValidateUtil.validateDevBid(devBid);
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(devBid);
+        iotDeviceBaseFunReqVo.setMethodName("getGroupParamByGlobal");
+        iotDeviceBaseFunReqVo.setParam(devBid);
+        List<IotSfGroupParamResVo> groupParamResVoList = iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+        return AjaxResult.success(groupParamResVoList);
+    }
+
+    /**
+     * 获取润浩全局灌区参数
+     * @param
+     * @return
+     */
+    @PostMapping("/rh/group/param/global/edit")
+    public AjaxResult getGroupParamByGlobal(@RequestBody IotSfGroupParamEditReqVo reqVo){
+        String devBid = reqVo.getDevBid();
+        ValidateUtil.validateDevBid(devBid);
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(devBid);
+        iotDeviceBaseFunReqVo.setMethodName("editGroupParamByGlobal");
+        iotDeviceBaseFunReqVo.setParam(reqVo);
+        String taskId = iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+
+        return new AjaxResult(ErrorCode.SUCCESS.getCode(), "下发成功,等待设备响应结果", taskId);
+    }
+
+    /**
+     * 开始自动灌溉
+     * @param
+     * @return
+     */
+    @PostMapping("/auto/start")
+    public AjaxResult autoStart(@RequestBody IotSfConfigCmdReqVo reqVo){
+        String devBid = reqVo.getDevBid();
+        ValidateUtil.validateDevBid(devBid);
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(devBid);
+        iotDeviceBaseFunReqVo.setMethodName("autoStart");
+        iotDeviceBaseFunReqVo.setParam(reqVo);
+        String taskId = iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+        return new AjaxResult(ErrorCode.SUCCESS.getCode(), "下发成功,等待设备响应结果", taskId);
+    }
+
+    /**
+     * 开始自动灌溉
+     * @param
+     * @return
+     */
+    @PostMapping("/auto/stop")
+    public AjaxResult autoStop(@RequestBody IotSfConfigCmdReqVo reqVo){
+        String devBid = reqVo.getDevBid();
+        ValidateUtil.validateDevBid(devBid);
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(devBid);
+        iotDeviceBaseFunReqVo.setMethodName("autoStop");
+        iotDeviceBaseFunReqVo.setParam(reqVo);
+        String taskId = iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+        return new AjaxResult(ErrorCode.SUCCESS.getCode(), "下发成功,等待设备响应结果", taskId);
+    }
+
+    /**
+     * 下发水肥机指令
+     *
+     * @return
+     * @throws Exception
+     */
+    @PostMapping("/devctl")
+    public AjaxResult devControl(@RequestBody IotSfConfigCmdReqVo reqVo) {
+        log.info("【{}】【水肥机】【下发水肥机设备控制指令】客户id {}", LogCore.getSeq(), getCustomerId());
+        String devBid = reqVo.getDevBid();
+        ValidateUtil.validateDevBid(devBid);
+
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
+        iotDeviceBaseFunReqVo.setMethodName("devControl");
+        iotDeviceBaseFunReqVo.setParam(reqVo);
+        String taskId = iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+
+        return new AjaxResult(ErrorCode.SUCCESS.getCode(), "下发成功,等待设备响应结果", taskId);
+    }
+
+    /**
+     * 获取水肥机灌溉记录
+     * @param
+     * @return
+     */
+    @GetMapping("/record/list")
+    public TableDataInfo getRecordList(IotSfIrrigationRecordListReqVo reqVo){
+        String devBid = reqVo.getDevBid();
+        ValidateUtil.validateDevBid(devBid);
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(devBid);
+        iotDeviceBaseFunReqVo.setMethodName("getRecordList");
+        iotDeviceBaseFunReqVo.setParam(reqVo);
+        return iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+    }
+
+    /**
+     * 获取水肥机灌溉操作记录
+     * @param
+     * @return
+     */
+    @GetMapping("/op/record/list")
+    public TableDataInfo getOpRecordList(IotSfIrrigationOprecordListReqVo reqVo){
+        String devBid = reqVo.getDevBid();
+        ValidateUtil.validateDevBid(devBid);
+        IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
+        iotDeviceBaseFunReqVo.setDevBid(devBid);
+        iotDeviceBaseFunReqVo.setMethodName("getOpRecordList");
+        iotDeviceBaseFunReqVo.setParam(reqVo);
+        return iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
+    }
+
+}

+ 13 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfConfigCmdReqVo.java

@@ -0,0 +1,13 @@
+package com.yunfeiyun.agmp.iotm.device.sf.domain;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.yunfeiyun.agmp.iot.common.domain.IotDevice;
+import lombok.Data;
+
+@Data
+public class IotSfConfigCmdReqVo {
+    private String devBid;
+    private String cmd;
+    private JSONObject data;
+    private IotDevice iotDevice;
+}

+ 67 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfElementfactorAddReqVo.java

@@ -0,0 +1,67 @@
+package com.yunfeiyun.agmp.iotm.device.sf.domain;
+
+import com.yunfeiyun.agmp.iot.common.domain.IotBaseEntity;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 水肥机要素
+ */
+@Data
+public class IotSfElementfactorAddReqVo extends IotBaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /** 自增主键 */
+    private Long id;
+
+    /** 业务标识 */
+    private String sfBid;
+
+    /** 设备编号 */
+    private String devBid;
+
+    /** 水肥要素类型 */
+    private String sfType;
+
+    /** 原始名称 */
+    private String sfName;
+
+    /** 显示名称 */
+    private String sfDisplayname;
+
+    /** 要素编码 */
+    private String sfCode;
+
+    /** 父类id */
+    private String sfParentBid;
+
+    /** 排序字段 默认0 */
+    private Integer sfSequence;
+
+    /** 租户ID */
+    private String tid;
+
+    /** 创建时间 */
+    private String sfCreatedDate;
+
+    /** 创建人 */
+    private String sfCreator;
+
+    /** 修改时间 */
+    private String sfModifieddate;
+    /** 修改人 */
+    private String sfModifier;
+
+    /** 纬度 */
+    private BigDecimal sfLat;
+    /** 经度 */
+    private BigDecimal sfLng;
+
+    /** 地址 */
+    private String sfAddress;
+
+    private List<IotSfElementfactorAddReqVo> childrenList;
+
+}

+ 67 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfElementfactorAlreadyListResVo.java

@@ -0,0 +1,67 @@
+package com.yunfeiyun.agmp.iotm.device.sf.domain;
+
+import com.yunfeiyun.agmp.iot.common.domain.IotBaseEntity;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 水肥机要素
+ */
+@Data
+public class IotSfElementfactorAlreadyListResVo extends IotBaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /** 自增主键 */
+    private Long id;
+
+    /** 业务标识 */
+    private String sfBid;
+
+    /** 设备编号 */
+    private String devBid;
+
+    /** 水肥要素类型 */
+    private String sfType;
+
+    /** 原始名称 */
+    private String sfName;
+
+    /** 显示名称 */
+    private String sfDisplayname;
+
+    /** 要素编码 */
+    private String sfCode;
+
+    /** 父类id */
+    private String sfParentBid;
+
+    /** 排序字段 默认0 */
+    private Integer sfSequence;
+
+    /** 租户ID */
+    private String tid;
+
+    /** 创建时间 */
+    private String sfCreatedDate;
+
+    /** 创建人 */
+    private String sfCreator;
+
+    /** 修改时间 */
+    private String sfModifieddate;
+    /** 修改人 */
+    private String sfModifier;
+
+    /** 纬度 */
+    private BigDecimal sfLat;
+    /** 经度 */
+    private BigDecimal sfLng;
+
+    /** 地址 */
+    private String sfAddress;
+
+    private List<IotSfElementfactorAlreadyListResVo> childrenList;
+
+}

+ 20 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfElementfactorBatchAddReqVo.java

@@ -0,0 +1,20 @@
+package com.yunfeiyun.agmp.iotm.device.sf.domain;
+
+import com.yunfeiyun.agmp.iot.common.domain.IotBaseEntity;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 水肥机要素
+ */
+@Data
+public class IotSfElementfactorBatchAddReqVo extends IotBaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /** 设备编号 */
+    private String devBid;
+
+    private List<IotSfElementfactorAddReqVo> elementList;
+
+}

+ 35 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfElementfactorEditReqVo.java

@@ -0,0 +1,35 @@
+package com.yunfeiyun.agmp.iotm.device.sf.domain;
+
+import com.yunfeiyun.agmp.iot.common.domain.IotBaseEntity;
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+/**
+ * 水肥机要素
+ */
+@Data
+public class IotSfElementfactorEditReqVo extends IotBaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /** 业务标识 */
+    private String sfBid;
+
+    /** 设备编号 */
+    private String devBid;
+
+    /** 显示名称 */
+    private String sfDisplayname;
+
+    /** 排序字段 默认0 */
+    private Integer sfSequence;
+
+    /** 纬度 */
+    private BigDecimal sfLat;
+    /** 经度 */
+    private BigDecimal sfLng;
+
+    /** 地址 */
+    private String sfAddress;
+
+}

+ 70 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfElementfactorInfoVo.java

@@ -0,0 +1,70 @@
+package com.yunfeiyun.agmp.iotm.device.sf.domain;
+
+import com.yunfeiyun.agmp.iot.common.domain.IotBaseEntity;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 水肥机要素
+ */
+@Data
+public class IotSfElementfactorInfoVo extends IotBaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /** 自增主键 */
+    private Long id;
+
+    /** 业务标识 */
+    private String sfBid;
+
+    /** 设备编号 */
+    private String devBid;
+
+    /** 水肥要素类型 */
+    private String sfType;
+
+    /** 原始名称 */
+    private String sfName;
+
+    /** 显示名称 */
+    private String sfDisplayname;
+
+    /** 要素编码 */
+    private String sfCode;
+
+    /** 父类id */
+    private String sfParentBid;
+
+    /** 排序字段 默认0 */
+    private Integer sfSequence;
+
+    /** 租户ID */
+    private String tid;
+
+    /** 创建时间 */
+    private String sfCreatedDate;
+
+    /** 创建人 */
+    private String sfCreator;
+
+    /** 修改时间 */
+    private String sfModifieddate;
+    /** 修改人 */
+    private String sfModifier;
+
+    /** 值 */
+    private String value;
+
+    /** 纬度 */
+    private BigDecimal sfLat;
+    /** 经度 */
+    private BigDecimal sfLng;
+
+    /** 地址 */
+    private String sfAddress;
+
+    private List<IotSfElementfactorInfoVo> childrenList;
+
+}

+ 66 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfElementfactorListReqVo.java

@@ -0,0 +1,66 @@
+package com.yunfeiyun.agmp.iotm.device.sf.domain;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+/**
+ * 水肥机要素
+ */
+@Data
+public class IotSfElementfactorListReqVo {
+    private static final long serialVersionUID = 1L;
+
+    /** 自增主键 */
+    private Long id;
+
+    /** 业务标识 */
+    private String sfBid;
+
+    /** 设备编号 */
+    private String devBid;
+
+    /** 水肥要素类型 */
+    private String sfType;
+
+    /** 原始名称 */
+    private String sfName;
+
+    /** 显示名称 */
+    private String sfDisplayname;
+
+    /** 要素编码 */
+    private String sfCode;
+
+    /** 父类id */
+    private String sfParentBid;
+
+    /** 排序字段 默认0 */
+    private Integer sfSequence;
+
+    /** 租户ID */
+    private String tid;
+
+    /** 创建时间 */
+    private String sfCreatedDate;
+
+    /** 创建人 */
+    private String sfCreator;
+
+    /** 修改时间 */
+    private String sfModifieddate;
+    /** 修改人 */
+    private String sfModifier;
+
+    /** 纬度 */
+    private BigDecimal sfLat;
+    /** 经度 */
+    private BigDecimal sfLng;
+
+    /** 地址 */
+    private String sfAddress;
+
+    private List<String> sfTypeList;
+
+}

+ 10 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfGroupParamEditReqVo.java

@@ -0,0 +1,10 @@
+package com.yunfeiyun.agmp.iotm.device.sf.domain;
+
+import com.alibaba.fastjson2.JSONObject;
+import lombok.Data;
+
+@Data
+public class IotSfGroupParamEditReqVo {
+    private String devBid;
+    private JSONObject paramJson;
+}

+ 10 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfGroupParamResVo.java

@@ -0,0 +1,10 @@
+package com.yunfeiyun.agmp.iotm.device.sf.domain;
+
+import lombok.Data;
+
+@Data
+public class IotSfGroupParamResVo {
+    private String sfCode;
+    private String sfDisplayName;
+    private String value;
+}

+ 23 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfIrrigationOprecordListReqVo.java

@@ -0,0 +1,23 @@
+package com.yunfeiyun.agmp.iotm.device.sf.domain;
+
+import com.yunfeiyun.agmp.iot.common.domain.IotBaseEntity;
+import lombok.Data;
+
+@Data
+public class IotSfIrrigationOprecordListReqVo extends IotBaseEntity {
+
+    private String oprcdBid; // 唯一标识
+    private String devBid; // 设备标识
+    private String oprecdName; // 操作名称
+    private String oprecdContent; // 操作内容
+    private Character oprecdStatus; // 操作状态 0 关闭 1 打开
+    private String oprcdCreatorName; // 操作用户名称
+    private String oprcdCreateddate; // 创建时间
+    private String tid;
+
+    // 开始时间
+    private String startTime;
+
+    // 结束时间
+    private String endTime;
+}

+ 35 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/sf/domain/IotSfIrrigationRecordListReqVo.java

@@ -0,0 +1,35 @@
+package com.yunfeiyun.agmp.iotm.device.sf.domain;
+
+import com.yunfeiyun.agmp.iot.common.domain.IotBaseEntity;
+import lombok.Data;
+
+@Data
+public class IotSfIrrigationRecordListReqVo extends IotBaseEntity {
+
+    // 设备标识
+    private String devBid;
+
+    // 灌区标识
+    private String rcdGroupbid;
+
+    // 灌区名称
+    private String rcdGroupName;
+
+    // 灌溉状态 0 进行中 1 已完成
+    private String rcdStatus;
+
+    // 灌溉模式 0 手动 1 自动
+    private String rcdMode;
+
+    // 灌溉数据标识
+    private String sfdataBid;
+
+    // 开始时间
+    private String startTime;
+
+    // 结束时间
+    private String endTime;
+
+    private String tid;
+
+}

+ 487 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/sf/service/IIotSfCommService.java

@@ -0,0 +1,487 @@
+package com.yunfeiyun.agmp.iotm.device.sf.service;
+
+import cn.hutool.core.exceptions.ValidateException;
+import com.alibaba.fastjson2.JSONObject;
+import com.yunfeiyun.agmp.common.constant.ErrorCode;
+import com.yunfeiyun.agmp.common.core.page.TableDataInfo;
+import com.yunfeiyun.agmp.common.log.LogCore;
+import com.yunfeiyun.agmp.common.utils.DateUtils;
+import com.yunfeiyun.agmp.common.utils.JSONUtils;
+import com.yunfeiyun.agmp.common.utils.SecurityUtils;
+import com.yunfeiyun.agmp.common.utils.StringUtils;
+import com.yunfeiyun.agmp.common.utils.uuid.IdUtils;
+import com.yunfeiyun.agmp.iot.common.constant.IotErrorCode;
+import com.yunfeiyun.agmp.iot.common.constant.devicetype.IotDeviceDictConst;
+import com.yunfeiyun.agmp.iot.common.domain.*;
+import com.yunfeiyun.agmp.iot.common.exception.IotBizException;
+import com.yunfeiyun.agmp.iot.common.model.cmd.CmdGroupModel;
+import com.yunfeiyun.agmp.iot.common.util.dev.RunHaoSfElementUtil;
+import com.yunfeiyun.agmp.iotm.device.common.domin.IotDeviceDataListReqVo;
+import com.yunfeiyun.agmp.iotm.device.common.service.IotDeviceBaseService;
+import com.yunfeiyun.agmp.iotm.device.common.service.impl.IotDeviceBaseServiceImpl;
+import com.yunfeiyun.agmp.iotm.device.sf.domain.*;
+import com.yunfeiyun.agmp.iotm.web.service.*;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import javax.annotation.Resource;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 水肥机通用服务
+ */
+@Slf4j
+public class IIotSfCommService extends IotDeviceBaseServiceImpl implements IotDeviceBaseService {
+
+    @Autowired
+    private IIotDeviceService iotDeviceService;
+
+    @Autowired
+    private IIotSfElementfactorService iotSfElementfactorService;
+
+    @Resource
+    private IIotDeviceconfigService iIotDeviceconfigService;
+
+    @Autowired
+    private IIotCmdtaskService iIotCmdtaskService;
+
+    @Autowired
+    private IIotSfIrrigationRecordService iIotSfIrrigationRecordService;
+
+    @Autowired
+    private IIotSfIrrigationOprecordService iIotSfIrrigationOprecordService;
+
+
+    public Class getTableClass(String devtypeBid) {
+        Class tableClass = null;
+        if (devtypeBid.equals(IotDeviceDictConst.TYPE_RUNHAO_SF)) {
+            tableClass = IotRunHaoSfdata.class;
+        }
+        return tableClass;
+    }
+
+    /**
+     * 获取泵类设备已存在的元素列表
+     *
+     * @param reqVo 请求对象,包含设备标识等信息
+     * @return TableDataInfo 包含响应码、消息、数据和总数
+     * @throws IotBizException 抛出业务异常,包含错误码和错误信息
+     */
+    public TableDataInfo getPumpAlreadyElementList(IotSfElementfactorListReqVo reqVo) {
+        TableDataInfo rspData = new TableDataInfo();
+        rspData.setCode(ErrorCode.SUCCESS.getCode());
+        rspData.setMsg(ErrorCode.SUCCESS.getMessage());
+        rspData.setData(new ArrayList<>());
+        rspData.setTotal(0);
+
+        String devBid = reqVo.getDevBid();
+        if (StringUtils.isEmpty(devBid)) {
+            throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备标识不能为空");
+        }
+
+        IotDevice findDevice = iotDeviceService.selectIotDeviceByDevBid(reqVo.getDevBid());
+        if (findDevice == null) {
+            throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备不存在");
+        }
+
+        List<IotSfElementfactorAlreadyListResVo> resVoList = iotSfElementfactorService.getPumpAlreadyElementList(reqVo);
+        if (resVoList != null && !resVoList.isEmpty()){
+            rspData.setData(resVoList);
+            rspData.setTotal(resVoList.size());
+        }
+        return rspData;
+    }
+
+    /**
+     * 获取泵类未处理的元素列表
+     * 该接口用于根据请求参数获取未处理的元素列表,并返回相关数据。
+     *
+     * @param reqVo 请求参数,包含设备标识(devBid)等信息
+     * @return TableDataInfo 包含未处理的元素列表的数据封装对象
+     * @throws IllegalArgumentException 如果devBid为空,则抛出非法参数异常
+     */
+    public TableDataInfo getPumpUnAlreadyElementList(IotSfElementfactorListReqVo reqVo) {
+        // 由具体子类实现
+        return null;
+    }
+
+    public IotSfElementfactor makeIotSfElementfactor(IotSfElementfactorAddReqVo reqVo, String date){
+        String tid = SecurityUtils.getTid();
+        String userId = SecurityUtils.getUserId();
+        String sfType = reqVo.getSfType();
+        String sfCode = reqVo.getSfCode();
+
+        IotSfElementfactor elementfactor = new IotSfElementfactor();
+        String sfBid = elementfactor.getUUId();
+        BeanUtils.copyProperties(reqVo, elementfactor);
+        elementfactor.setSfBid(sfBid);
+        elementfactor.setTid(tid);
+        elementfactor.setSfCreatedDate(date);
+        elementfactor.setSfCreator(userId);
+        elementfactor.setSfModifieddate(date);
+        elementfactor.setSfModifier(userId);
+
+        IotSfElementfactor sfElementfactor = RunHaoSfElementUtil.getElementFactor(sfType, sfCode);
+        if(sfElementfactor != null){
+            elementfactor.setSfName(sfElementfactor.getSfName());
+        }
+        return elementfactor;
+    }
+
+
+    /**
+     * 删除元素
+     *
+     * @param reqVo 请求对象,包含了要删除的元素信息
+     * @return 返回删除结果,返回值为0表示删除成功,非0表示删除失败
+     */
+    public int elementDelete(IotSfElementfactor reqVo) {
+        // 由具体子类实现
+        return 0;
+    }
+
+    /**
+     * 新增要素
+     * 该接口用于添加新的泵类要素,接收相关参数并调用通用设备功能服务进行处理。
+     *
+     * @param reqVo 包含设备添加请求的参数,包括设备标识(devBid)等
+     */
+    public int elementAdd(IotSfElementfactorAddReqVo reqVo) {
+        // 由具体子类实现
+        return 0;
+    }
+
+    /**
+     * 批量新增要素
+     * 该接口用于添加新的泵类要素,接收相关参数并调用通用设备功能服务进行处理。
+     *
+     * @param reqVo 包含设备添加请求的参数,包括设备标识(devBid)等
+     */
+    public int elementBatchAdd(IotSfElementfactorBatchAddReqVo reqVo) {
+        // 由具体子类实现
+        return 0;
+    }
+
+    /**
+     * 获取未配置的灌区元素列表
+     *
+     * @param reqVo 请求参数,包含设备标识(devBid)等筛选条件
+     * @return 返回TableDataInfo对象,包含未分组的元素列表及相关信息
+     * @throws ValidateException 如果devBid为空或不符合要求,则抛出ValidateException异常
+     */
+
+    public TableDataInfo getGroupUnAlreadyElementList(IotSfElementfactorListReqVo reqVo) {
+        // 由具体子类实现
+        return null;
+    }
+
+    /**
+     * 获取灌区设备已存在的元素列表
+     *
+     * @param reqVo 请求对象,包含设备标识等信息
+     * @return TableDataInfo 包含响应码、消息、数据和总数
+     * @throws IotBizException 抛出业务异常,包含错误码和错误信息
+     */
+    public TableDataInfo getGroupAlreadyElementList(IotSfElementfactorListReqVo reqVo) {
+        TableDataInfo rspData = new TableDataInfo();
+        rspData.setCode(ErrorCode.SUCCESS.getCode());
+        rspData.setMsg(ErrorCode.SUCCESS.getMessage());
+        rspData.setData(new ArrayList<>());
+        rspData.setTotal(0);
+
+        String devBid = reqVo.getDevBid();
+        if (StringUtils.isEmpty(devBid)) {
+            throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备标识不能为空");
+        }
+
+        IotDevice findDevice = iotDeviceService.selectIotDeviceByDevBid(reqVo.getDevBid());
+        if (findDevice == null) {
+            throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备不存在");
+        }
+
+        List<IotSfElementfactorAlreadyListResVo> resVoList = iotSfElementfactorService.getGroupAlreadyElementList(reqVo);
+        if (resVoList != null && !resVoList.isEmpty()){
+            rspData.setData(resVoList);
+            rspData.setTotal(resVoList.size());
+        }
+        return rspData;
+    }
+
+    /**
+     * 获取未配置的电磁阀元素列表
+     *
+     * @param reqVo 请求参数,包含设备标识(devBid)等筛选条件
+     * @return 返回TableDataInfo对象,包含未分组的元素列表及相关信息
+     * @throws ValidateException 如果devBid为空或不符合要求,则抛出ValidateException异常
+     */
+
+    /**
+     * 获取未配置的电磁阀元素列表
+     *
+     * @param reqVo 请求参数,包含设备标识(devBid)等筛选条件
+     * @return 返回TableDataInfo对象,包含未分组的元素列表及相关信息
+     * @throws ValidateException 如果devBid为空或不符合要求,则抛出ValidateException异常
+     */
+    public TableDataInfo getValveUnAlreadyElementList(IotSfElementfactorListReqVo reqVo) {
+        // 由具体子类实现
+        return null;
+    }
+
+    /**
+     * 获取灌区设备已存在的元素列表
+     *
+     * @param reqVo 请求对象,包含设备标识等信息
+     * @return TableDataInfo 包含响应码、消息、数据和总数
+     * @throws IotBizException 抛出业务异常,包含错误码和错误信息
+     */
+    public TableDataInfo getValveAlreadyElementList(IotSfElementfactorListReqVo reqVo) {
+        TableDataInfo rspData = new TableDataInfo();
+        rspData.setCode(ErrorCode.SUCCESS.getCode());
+        rspData.setMsg(ErrorCode.SUCCESS.getMessage());
+        rspData.setData(new ArrayList<>());
+        rspData.setTotal(0);
+
+        String devBid = reqVo.getDevBid();
+        if (StringUtils.isEmpty(devBid)) {
+            throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备标识不能为空");
+        }
+
+        IotDevice findDevice = iotDeviceService.selectIotDeviceByDevBid(reqVo.getDevBid());
+        if (findDevice == null) {
+            throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备不存在");
+        }
+
+        List<IotSfElementfactorAlreadyListResVo> resVoList = iotSfElementfactorService.getValveAlreadyElementList(reqVo);
+        if (resVoList != null && !resVoList.isEmpty()){
+            rspData.setData(resVoList);
+            rspData.setTotal(resVoList.size());
+        }
+        return rspData;
+    }
+
+
+    /**
+     * 获取水肥机状态信息
+     *
+     * @param devBid 请求对象,包含设备标识等信息
+     * @return TableDataInfo 包含响应码、消息、数据和总数
+     * @throws IotBizException 抛出业务异常,包含错误码和错误信息
+     */
+    public TableDataInfo getStatus(String devBid) {
+        // 由具体子类实现
+        return null;
+    }
+
+    /**
+     * 根据设备请求获取配置信息
+     *
+     * @param reqVo 设备数据列表请求对象
+     * @return 配置信息对象
+     * @throws IotBizException 如果设备ID为空或设备不存在,则抛出异常
+     */
+    public JSONObject configInfo(IotDeviceDataListReqVo reqVo){
+        String devBid = reqVo.getDevBid();
+        if(StringUtils.isEmpty(devBid)){
+            throw new IotBizException(IotErrorCode.PARAM_INVALID.getCode(),"参数不能为空");
+        }
+        IotDevice iotDevice = iotDeviceService.selectIotDeviceByDevBid(devBid);
+        if(iotDevice == null){
+            throw new IotBizException(ErrorCode.INVALID_PARAMETER.getCode(),"设备不存在");
+        }
+        IotDeviceconfig iotDeviceconfig = iIotDeviceconfigService.selectIotDeviceConfigByDevBid(devBid);
+        return JSONObject.parseObject(iotDeviceconfig.getDevcfgContext());
+    }
+
+    /**
+     * 获取水肥机运行状态信息
+     *
+     * @param devBid 请求对象,包含设备标识等信息
+     * @return TableDataInfo 包含响应码、消息、数据和总数
+     * @throws IotBizException 抛出业务异常,包含错误码和错误信息
+     */
+    public JSONObject getRunStatus(String devBid) {
+        // 由具体子类实现
+        return null;
+    }
+
+    public String sendConfigCmd(IotSfConfigCmdReqVo reqVo) {
+        IotDevice iotDevice = reqVo.getIotDevice();
+        String devBid = reqVo.getDevBid();
+        JSONObject data = reqVo.getData();
+        IotDeviceconfig iotDeviceconfig = new IotDeviceconfig();
+        iotDeviceconfig.setDevBid(devBid);
+        iotDeviceconfig.setDevcfgContext(data.toJSONString());
+        iotDeviceconfig.setTid(iotDevice.getTid());
+
+        String func = reqVo.getCmd();
+        CmdGroupModel cmdGroupModel = iIotDeviceconfigService.createCmd(iotDeviceconfig, func);
+        log.info("【{}】【水肥机 [下发配置]】【构建 cmdGroupModel】{}", LogCore.getSeq(), JSONUtils.toJSONString(cmdGroupModel));
+        cmdGroupModel.setRequestId(IdUtils.fastUUID());
+
+        // 适配增加详细日志使用
+        cmdGroupModel.setDevCode(iotDevice.getDevCode());
+        cmdGroupModel.setCtBiztitle(iotDevice.getDevtypeName() + ":" + iotDevice.getDevCode());
+        cmdGroupModel.setCtBiztype("3");
+        cmdGroupModel.setCtDevtype(iotDevice.getDevtypeBid());
+        cmdGroupModel.setCtParam(JSONUtils.toJSONString(reqVo));
+        iIotCmdtaskService.handInternalCmd(cmdGroupModel);
+        return cmdGroupModel.getTaskUuid();
+    }
+
+    public String editConfig(IotSfConfigCmdReqVo reqVo) {
+        // 由具体子类实现
+        return null;
+    }
+
+    public String devControl(IotSfConfigCmdReqVo reqVo) {
+        // 由具体子类实现
+        return null;
+    }
+
+    /**
+     * 要素编辑
+     *
+     * @param reqVo 包含设备添加请求的参数,包括设备标识(devBid)等
+     */
+    public int elementEdit(IotSfElementfactorEditReqVo reqVo) {
+        String devBid = reqVo.getDevBid();
+        String sfBid = reqVo.getSfBid();
+        String sfDisplayname = reqVo.getSfDisplayname();
+
+        if (StringUtils.isEmpty(devBid)) {
+            throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备标识不能为空");
+        }
+        if (StringUtils.isEmpty(sfDisplayname)) {
+            throw new IotBizException(IotErrorCode.PARAM_INVALID.getCode(), "要素名称不能为空");
+        }
+        IotDevice iotDevice = iotDeviceService.selectIotDeviceByDevBid(reqVo.getDevBid());
+        if (iotDevice == null) {
+            throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备不存在");
+        }
+        if (StringUtils.isEmpty(sfBid)) {
+            throw new IotBizException(IotErrorCode.PARAM_INVALID.getCode(), "要素标识不能为空");
+        }
+
+        IotSfElementfactor iotSfElementfactor = iotSfElementfactorService.selectIotSfElementfactorBySfBid(sfBid);
+        if (iotSfElementfactor == null) {
+            throw new IotBizException(IotErrorCode.PARAM_INVALID.getCode(), "要素不存在");
+        }
+
+        iotSfElementfactor.setSfDisplayname(sfDisplayname);
+        iotSfElementfactor.setSfAddress(reqVo.getSfAddress());
+        iotSfElementfactor.setSfLat(reqVo.getSfLat());
+        iotSfElementfactor.setSfLng(reqVo.getSfLng());
+        iotSfElementfactor.setSfSequence(reqVo.getSfSequence());
+        iotSfElementfactor.setSfModifieddate(DateUtils.dateTimeNow());
+        iotSfElementfactor.setSfModifier(SecurityUtils.getUserId());
+        return iotSfElementfactorService.updateIotSfElementfactor(iotSfElementfactor);
+    }
+
+    /**
+     * 获取灌区参数
+     *
+     * @param reqVo 包含设备添加请求的参数,包括设备标识(devBid)等
+     * @param reqVo
+     */
+    public List<IotSfGroupParamResVo> getGroupParamByGlobal (String devBid) {
+        // 由具体子类实现
+        return null;
+    }
+
+    /**
+     * 编辑灌区参数
+     *
+     * @param reqVo 包含设备添加请求的参数,包括设备标识(devBid)等
+     * @param reqVo
+     */
+    public String editGroupParamByGlobal (IotSfGroupParamEditReqVo reqVo) {
+        // 由具体子类实现
+        return null;
+    }
+
+    /**
+     * 开始自动灌溉
+     *
+     * @param reqVo 包含设备添加请求的参数,包括设备标识(devBid)等
+     * @param reqVo
+     */
+    public String autoStart(IotSfConfigCmdReqVo reqVo) {
+        // 由具体子类实现
+        return null;
+    }
+
+
+    /**
+     * 停止自动灌溉
+     *
+     * @param reqVo 包含设备添加请求的参数,包括设备标识(devBid)等
+     * @param reqVo
+     */
+    public String autoStop(IotSfConfigCmdReqVo reqVo) {
+        // 由具体子类实现
+        return null;
+    }
+
+    /**
+     * 获取灌溉记录列表
+     *
+     * @param reqVo 包含设备添加请求的参数,包括设备标识(devBid)等
+     * @param reqVo
+     */
+    public TableDataInfo getRecordList(IotSfIrrigationRecordListReqVo reqVo) {
+        TableDataInfo rspData = new TableDataInfo();
+        rspData.setCode(ErrorCode.SUCCESS.getCode());
+        rspData.setMsg(ErrorCode.SUCCESS.getMessage());
+        rspData.setData(new ArrayList<>());
+        rspData.setTotal(0);
+
+        String devBid = reqVo.getDevBid();
+        if (StringUtils.isEmpty(devBid)) {
+            throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备标识不能为空");
+        }
+        IotDevice iotDevice = iotDeviceService.selectIotDeviceByDevBid(reqVo.getDevBid());
+        if (iotDevice == null) {
+            throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备不存在");
+        }
+
+        List<IotSfIrrigationRecord> recordList = iIotSfIrrigationRecordService.selectIrrigationRecordList(reqVo);
+        if (recordList != null && !recordList.isEmpty()){
+            rspData.setData(recordList);
+            rspData.setTotal(recordList.size());
+        }
+        return rspData;
+    }
+
+    /**
+     * 获取灌溉记录列表
+     *
+     * @param reqVo 包含设备添加请求的参数,包括设备标识(devBid)等
+     * @param reqVo
+     */
+    public TableDataInfo getOpRecordList(IotSfIrrigationOprecordListReqVo reqVo) {
+        TableDataInfo rspData = new TableDataInfo();
+        rspData.setCode(ErrorCode.SUCCESS.getCode());
+        rspData.setMsg(ErrorCode.SUCCESS.getMessage());
+        rspData.setData(new ArrayList<>());
+        rspData.setTotal(0);
+
+        String devBid = reqVo.getDevBid();
+        if (StringUtils.isEmpty(devBid)) {
+            throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备标识不能为空");
+        }
+        IotDevice iotDevice = iotDeviceService.selectIotDeviceByDevBid(reqVo.getDevBid());
+        if (iotDevice == null) {
+            throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备不存在");
+        }
+
+        List<IotSfIrrigationOprecord> recordList = iIotSfIrrigationOprecordService.selectIrrigationOprecordList(reqVo);
+        if (recordList != null && !recordList.isEmpty()){
+            rspData.setData(recordList);
+            rspData.setTotal(recordList.size());
+        }
+        return rspData;
+    }
+
+}

File diff suppressed because it is too large
+ 1180 - 0
src/main/java/com/yunfeiyun/agmp/iotm/device/sf/service/impl/IotRunHaoSfServiceImpl.java


+ 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);
+    }
     /**
      * 查询告警配置列表
      */

+ 9 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/controller/IotWarnreceiverController.java

@@ -42,6 +42,15 @@ public class IotWarnreceiverController extends BaseController{
     }
 
     /**
+     *根据配置查询接收人列表
+     */
+    @PreAuthorize("@ss.hasPermi('iot:warn:receiver:list')")
+    @GetMapping("/config/list")
+    public AjaxResult listByWcBid(String wcBid){
+        List<IotWarnreceiver> list = iotWarnreceiverService.selectIotWarnreceiversByWcBid(wcBid);
+        return AjaxResult.success(list);
+    }
+    /**
      * 导出告警接收者列表
      */
     @PreAuthorize("@ss.hasPermi('iot:warn:receiver:export')")

+ 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;
 }

+ 55 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/mapper/IotSfElementfactorMapper.java

@@ -0,0 +1,55 @@
+package com.yunfeiyun.agmp.iotm.web.mapper;
+
+import com.yunfeiyun.agmp.iot.common.domain.IotSfElementfactor;
+import com.yunfeiyun.agmp.iotm.device.sf.domain.IotSfElementfactorListReqVo;
+
+import java.util.List;
+
+/**
+ * Mapper接口
+ *
+ */
+public interface IotSfElementfactorMapper {
+
+    /**
+     * 查询水肥机要素列表
+     *
+     * @param iotSfElementfactor 水肥机要素
+     * @return 水肥机要素集合
+     */
+    public List<IotSfElementfactor> selectIotSfElementfactorList(IotSfElementfactorListReqVo reqVo);
+
+    /**
+     * 批量插入水肥机要素
+     *
+     * @param factorList 水肥机要素列表
+     * @return 结果
+     */
+    public int batchInsertIotSfElementfactor(List<IotSfElementfactor> factorList);
+
+
+    /**
+     * 删除水肥机要素
+     *
+     * @param sfBid 水肥机要素ID
+     * @return 结果
+     */
+    public int deleteIotSfElementfactorBySfBid(String sfBid);
+
+    /**
+     * 查询水肥机要素
+     *
+     * @param iotSfElementfactor 水肥机要素
+     * @return 水肥机要素集合
+     */
+    public IotSfElementfactor selectIotSfElementfactorBySfBid(String sfBid);
+
+    /**
+     * 更新水肥机要素
+     *
+     * @param elementfactor 水肥机要素
+     * @return 结果
+     */
+    public int updateIotSfElementfactor(IotSfElementfactor elementfactor);
+
+}

+ 33 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/mapper/IotSfIrrigationOprecordMapper.java

@@ -0,0 +1,33 @@
+package com.yunfeiyun.agmp.iotm.web.mapper;
+
+import com.yunfeiyun.agmp.iot.common.domain.IotSfIrrigationOprecord;
+import com.yunfeiyun.agmp.iotm.device.sf.domain.IotSfIrrigationOprecordListReqVo;
+
+import java.util.List;
+
+public interface IotSfIrrigationOprecordMapper {
+    // 添加灌溉记录
+    public int insertIrrigationOprecord(IotSfIrrigationOprecord record);
+
+//    public int batchInsertIotSfIrrigationOprecord(List<IotSfIrrigationOprecord> recordList);
+//
+//    // 根据唯一标识查询灌溉记录
+//    public IotSfIrrigationOprecord selectIrrigationOprecordByBid(String rcdBid);
+//
+//    // 更新灌溉记录
+//    public int updateIrrigationOprecord(IotSfIrrigationOprecord record);
+//
+//    // 删除灌溉记录
+//    public void deleteIrrigationOprecord(String rcdBid);
+//
+    // 查询所有灌溉记录
+    public List<IotSfIrrigationOprecord> selectIrrigationOprecordList(IotSfIrrigationOprecordListReqVo record);
+//
+//    /**
+//     * 生成灌溉记录列表
+//     * @param groupList  灌区要素列表
+//     * @param runMode  运行模式 0 手动 1 自动
+//     * @return
+//     */
+//    public void createIotSfIrrigationOprecordList(List<IotSfIrrigationOprecordListReqVo> groupList, String runMode, String sfdataBid);
+}

+ 25 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/mapper/IotSfIrrigationRecordMapper.java

@@ -0,0 +1,25 @@
+package com.yunfeiyun.agmp.iotm.web.mapper;
+
+import com.yunfeiyun.agmp.iot.common.domain.IotSfIrrigationRecord;
+import com.yunfeiyun.agmp.iotm.device.sf.domain.IotSfIrrigationRecordListReqVo;
+
+import java.util.List;
+
+public interface IotSfIrrigationRecordMapper {
+    // 添加灌溉记录
+    public int insertIrrigationRecord(IotSfIrrigationRecord record);
+
+    public int batchInsertIotSfIrrigationRecord(List<IotSfIrrigationRecord> recordList);
+
+    // 根据唯一标识查询灌溉记录
+    public IotSfIrrigationRecord selectIrrigationRecordByBid(String rcdBid);
+
+    // 更新灌溉记录
+    public int updateIrrigationRecord(IotSfIrrigationRecord record);
+
+//    // 删除灌溉记录
+//    public void deleteIrrigationRecord(String rcdBid);
+
+    // 查询所有灌溉记录
+    public List<IotSfIrrigationRecord> selectIrrigationRecordList(IotSfIrrigationRecordListReqVo record);
+}

+ 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);
 }

+ 2 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/service/IIotDeviceconfigService.java

@@ -71,6 +71,8 @@ public interface IIotDeviceconfigService {
      */
     public CmdGroupModel createConfigCmd(IotDeviceconfig iotDeviceconfig);
 
+    public CmdGroupModel createCmd(IotDeviceconfig iotDeviceconfig, String func);
+
     CmdGroupModel createTakePhotoCmd(IotDeviceconfig iotDeviceconfig);
 
     List<IotDeviceconfig> selectIotDeviceConfigByDevBidList(List<String> devBidList);

+ 120 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/service/IIotSfElementfactorService.java

@@ -0,0 +1,120 @@
+package com.yunfeiyun.agmp.iotm.web.service;
+
+import com.yunfeiyun.agmp.iot.common.domain.IotSfElementfactor;
+import com.yunfeiyun.agmp.iotm.device.sf.domain.IotSfElementfactorAlreadyListResVo;
+import com.yunfeiyun.agmp.iotm.device.sf.domain.IotSfElementfactorListReqVo;
+
+import java.util.List;
+
+/**
+ * 水肥机要素Service
+ */
+public interface IIotSfElementfactorService {
+
+    /**
+     * 查询水肥机要素
+     *
+     * @param iotSfElementfactor 水肥机要素
+     * @return 水肥机要素集合
+     */
+    public IotSfElementfactor selectIotSfElementfactorBySfBid(String sfBid);
+
+    /**
+     * 查询水肥机要素列表
+     *
+     * @param iotSfElementfactor 水肥机要素
+     * @return 水肥机要素集合
+     */
+    public List<IotSfElementfactor> selectIotSfElementfactorList(IotSfElementfactorListReqVo reqVo);
+
+    /**
+     * 查询泵类已配置原始要素列表
+     * @param reqVo
+     * @return
+     */
+
+    public List<IotSfElementfactor> selectIotSfElementfactorListByPump(IotSfElementfactorListReqVo reqVo);
+
+    /**
+     * 查询灌区已配置原始要素列表
+     * @param reqVo
+     * @return
+     */
+
+    public List<IotSfElementfactor> selectIotSfElementfactorListByGroup(IotSfElementfactorListReqVo reqVo);
+
+    /**
+     * 查询电磁阀已配置原始要素列表
+     * @param reqVo
+     * @return
+     */
+
+    public List<IotSfElementfactor> selectIotSfElementfactorListByValve(IotSfElementfactorListReqVo reqVo);
+
+
+
+    /**
+     * 批量插入水肥机要素
+     *
+     * @param factorList 水肥机要素列表
+     * @return 结果
+     */
+    public int batchInsertIotSfElementfactor(List<IotSfElementfactor> factorList);
+
+    /**
+     * 更新水肥机要素
+     *
+     * @param elementfactor 水肥机要素
+     * @return 结果
+     */
+    public int updateIotSfElementfactor(IotSfElementfactor elementfactor);
+
+    /**
+     * 删除水肥机要素
+     *
+     * @param sfBid 水肥机要素ID
+     * @return 结果
+     */
+    public int deleteIotSfElementfactorBySfBid(String sfBid);
+
+//    /**
+//     * 查询已配置要素列表
+//     * @param reqVo
+//     * @return
+//     */
+//
+//    public List<IotSfElementfactorAlreadyListResVo> getAlreadyElementList(IotSfElementfactorListReqVo reqVo);
+
+    /**
+     * 查询已配置要素列表
+     * @param reqVo
+     * @return
+     */
+
+    public List<IotSfElementfactorAlreadyListResVo> getAlreadyElementList(List<IotSfElementfactor> factorList);
+
+    /**
+     * 查询泵类已配置要素列表
+     * @param reqVo
+     * @return
+     */
+
+    public List<IotSfElementfactorAlreadyListResVo> getPumpAlreadyElementList(IotSfElementfactorListReqVo reqVo);
+
+    /**
+     * 查询灌区已配置要素列表
+     * @param reqVo
+     * @return
+     */
+
+    public List<IotSfElementfactorAlreadyListResVo> getGroupAlreadyElementList(IotSfElementfactorListReqVo reqVo);
+
+    /**
+     * 查询电磁阀已配置要素列表
+     * @param reqVo
+     * @return
+     */
+
+    public List<IotSfElementfactorAlreadyListResVo> getValveAlreadyElementList(IotSfElementfactorListReqVo reqVo);
+}
+

+ 33 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/service/IIotSfIrrigationOprecordService.java

@@ -0,0 +1,33 @@
+package com.yunfeiyun.agmp.iotm.web.service;
+
+import com.yunfeiyun.agmp.iot.common.domain.IotSfIrrigationOprecord;
+import com.yunfeiyun.agmp.iotm.device.sf.domain.IotSfIrrigationOprecordListReqVo;
+
+import java.util.List;
+
+public interface IIotSfIrrigationOprecordService {
+    // 添加灌溉操作记录
+    public int insertIrrigationOprecord(IotSfIrrigationOprecord record);
+
+    public int batchInsertIotSfIrrigationOprecord(List<IotSfIrrigationOprecord> recordList);
+
+    // 根据唯一标识查询灌溉操作记录
+    public IotSfIrrigationOprecord selectIrrigationOprecordByBid(String rcdBid);
+
+    // 更新灌溉操作记录
+    public int updateIrrigationOprecord(IotSfIrrigationOprecord record);
+
+    // 删除灌溉操作记录
+    public void deleteIrrigationOprecord(String rcdBid);
+
+    // 查询所有灌溉操作记录
+    public List<IotSfIrrigationOprecord> selectIrrigationOprecordList(IotSfIrrigationOprecordListReqVo record);
+
+    /**
+     * 生成灌溉操作记录列表
+     * @param groupList  灌区要素列表
+     * @param runMode  运行模式 0 手动 1 自动
+     * @return
+     */
+    public void createIotSfIrrigationOprecord(String devBid, String oprecdName, String oprecdContent, String oprecdStatus);
+}

+ 34 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/service/IIotSfIrrigationRecordService.java

@@ -0,0 +1,34 @@
+package com.yunfeiyun.agmp.iotm.web.service;
+
+import com.yunfeiyun.agmp.iot.common.domain.IotSfIrrigationRecord;
+import com.yunfeiyun.agmp.iotm.device.sf.domain.IotSfElementfactorAlreadyListResVo;
+import com.yunfeiyun.agmp.iotm.device.sf.domain.IotSfIrrigationRecordListReqVo;
+
+import java.util.List;
+
+public interface IIotSfIrrigationRecordService {
+    // 添加灌溉记录
+    public int insertIrrigationRecord(IotSfIrrigationRecord record);
+
+    public int batchInsertIotSfIrrigationRecord(List<IotSfIrrigationRecord> recordList);
+
+    // 根据唯一标识查询灌溉记录
+    public IotSfIrrigationRecord selectIrrigationRecordByBid(String rcdBid);
+
+    // 更新灌溉记录
+    public int updateIrrigationRecord(IotSfIrrigationRecord record);
+
+    // 删除灌溉记录
+    public void deleteIrrigationRecord(String rcdBid);
+
+    // 查询所有灌溉记录
+    public List<IotSfIrrigationRecord> selectIrrigationRecordList(IotSfIrrigationRecordListReqVo record);
+
+    /**
+     * 生成灌溉记录列表
+     * @param groupList  灌区要素列表
+     * @param runMode  运行模式 0 手动 1 自动
+     * @return
+     */
+    public void createIotSfIrrigationRecordList(List<IotSfElementfactorAlreadyListResVo> groupList, String runMode, String sfdataBid);
+}

+ 8 - 7
src/main/java/com/yunfeiyun/agmp/iotm/web/service/IIotWarnindicatorService.java

@@ -9,14 +9,14 @@ import java.util.List;
 
 /**
  * 告警指标,存储所有与告警相关的指标信息Service接口
- * 
+ *
  * @author 杨晓辉
  * @date 2025-03-07
  */
 public interface IIotWarnindicatorService {
     /**
      * 查询告警指标,存储所有与告警相关的指标信息
-     * 
+     *
      * @param wiBid 告警指标,存储所有与告警相关的指标信息主键
      * @return 告警指标,存储所有与告警相关的指标信息
      */
@@ -24,7 +24,7 @@ public interface IIotWarnindicatorService {
 
     /**
      * 查询告警指标,存储所有与告警相关的指标信息列表
-     * 
+     *
      * @param iotWarnindicator 告警指标,存储所有与告警相关的指标信息
      * @return 告警指标,存储所有与告警相关的指标信息集合
      */
@@ -32,7 +32,7 @@ public interface IIotWarnindicatorService {
 
     /**
      * 新增告警指标,存储所有与告警相关的指标信息
-     * 
+     *
      * @param iotWarnindicator 告警指标,存储所有与告警相关的指标信息
      * @return 结果
      */
@@ -40,7 +40,7 @@ public interface IIotWarnindicatorService {
 
     /**
      * 修改告警指标,存储所有与告警相关的指标信息
-     * 
+     *
      * @param iotWarnindicator 告警指标,存储所有与告警相关的指标信息
      * @return 结果
      */
@@ -48,7 +48,7 @@ public interface IIotWarnindicatorService {
 
     /**
      * 批量删除告警指标,存储所有与告警相关的指标信息
-     * 
+     *
      * @param wiBids 需要删除的告警指标,存储所有与告警相关的指标信息主键集合
      * @return 结果
      */
@@ -56,7 +56,7 @@ public interface IIotWarnindicatorService {
 
     /**
      * 删除告警指标,存储所有与告警相关的指标信息信息
-     * 
+     *
      * @param wiBid 告警指标,存储所有与告警相关的指标信息主键
      * @return 结果
      */
@@ -76,6 +76,7 @@ public interface IIotWarnindicatorService {
      * @return
      */
     public List<IotWarnindicator> warnindicatorDevQueryByCbd(IotDevice iotDevice);
+    public List<IotWarnindicator> warnindicatorDevQueryByYbq(IotDevice iotDevice);
 
     /**
      * 查询虫情列表

+ 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);
 }

+ 249 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotSfElementfactorServiceImpl.java

@@ -0,0 +1,249 @@
+package com.yunfeiyun.agmp.iotm.web.service.impl;
+
+import com.yunfeiyun.agmp.common.utils.SecurityUtils;
+import com.yunfeiyun.agmp.common.utils.StringUtils;
+import com.yunfeiyun.agmp.iot.common.domain.IotSfElementfactor;
+import com.yunfeiyun.agmp.iot.common.enums.EnumSfElementType;
+import com.yunfeiyun.agmp.iotm.device.sf.domain.IotSfElementfactorAlreadyListResVo;
+import com.yunfeiyun.agmp.iotm.device.sf.domain.IotSfElementfactorListReqVo;
+import com.yunfeiyun.agmp.iotm.web.mapper.IotSfElementfactorMapper;
+import com.yunfeiyun.agmp.iotm.web.service.IIotSfElementfactorService;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
+
+@Slf4j
+@Service
+public class IotSfElementfactorServiceImpl implements IIotSfElementfactorService {
+    @Autowired
+    private IotSfElementfactorMapper iotSfElementfactorMapper;
+
+    /**
+     * 查询水肥机要素
+     *
+     * @param reqVo@return 水肥机要素集合
+     */
+    @Override
+    public IotSfElementfactor selectIotSfElementfactorBySfBid(String sfBid) {
+        return iotSfElementfactorMapper.selectIotSfElementfactorBySfBid(sfBid);
+    }
+
+    /**
+     * 查询水肥机要素列表
+     *
+     * @param  水肥机要素
+     * @return 水肥机要素集合
+     */
+    @Override
+    public List<IotSfElementfactor> selectIotSfElementfactorList(IotSfElementfactorListReqVo reqVo) {
+        reqVo.setTid(SecurityUtils.getTid());
+        return iotSfElementfactorMapper.selectIotSfElementfactorList(reqVo);
+    }
+
+
+    /**
+     * 批量插入水肥机要素
+     *
+     * @param factorList 水肥机要素列表
+     * @return 结果
+     */
+    @Override
+    public int batchInsertIotSfElementfactor(List<IotSfElementfactor> factorList) {
+        return iotSfElementfactorMapper.batchInsertIotSfElementfactor(factorList);
+    }
+
+    /**
+     * 更新水肥机要素
+     *
+     * @param elementfactor 水肥机要素
+     * @return 结果
+     */
+    @Override
+    public int updateIotSfElementfactor(IotSfElementfactor elementfactor) {
+        return iotSfElementfactorMapper.updateIotSfElementfactor(elementfactor);
+    }
+
+    /**
+     * 删除水肥机要素
+     *
+     * @param sfBid 水肥机要素ID
+     * @return 结果
+     */
+    @Override
+    public int deleteIotSfElementfactorBySfBid(String sfBid) {
+        return iotSfElementfactorMapper.deleteIotSfElementfactorBySfBid(sfBid);
+    }
+
+//    /**
+//     * 查询已配置要素列表
+//     *
+//     * @param reqVo
+//     * @return
+//     */
+//    @Override
+//    public List<IotSfElementfactorAlreadyListResVo> getAlreadyElementList(IotSfElementfactorListReqVo reqVo) {
+//        List<IotSfElementfactor> elementfactorList = selectIotSfElementfactorList(reqVo);
+//        Map<String, IotSfElementfactorAlreadyListResVo> eleMap = new LinkedHashMap<>();
+//        for (IotSfElementfactor elementfactor : elementfactorList) {
+//            String sfBid = elementfactor.getSfBid();
+//            String sfParentBid = elementfactor.getSfParentBid();
+//
+//            IotSfElementfactorAlreadyListResVo eleResVo = new IotSfElementfactorAlreadyListResVo();
+//            BeanUtils.copyProperties(elementfactor, eleResVo);
+//
+//            IotSfElementfactorAlreadyListResVo parentInfo = eleMap.get(sfParentBid);
+//            if(parentInfo == null){
+//                eleResVo.setChildrenList(new ArrayList<>());
+//                eleMap.put(sfBid, eleResVo);
+//            }else{
+//                parentInfo.getChildrenList().add(eleResVo);
+//            }
+//        }
+//        return new ArrayList<>(eleMap.values());
+//    }
+
+    /**
+     * 查询已配置要素列表
+     *
+     * @param factorList@return
+     */
+    @Override
+    public List<IotSfElementfactorAlreadyListResVo> getAlreadyElementList(List<IotSfElementfactor> factorList) {
+        Map<String, IotSfElementfactorAlreadyListResVo> eleMap = new LinkedHashMap<>();
+        Map<String, IotSfElementfactor> tempMap = new LinkedHashMap<>();
+
+        for (IotSfElementfactor elementfactor : factorList) {
+            String sfBid = elementfactor.getSfBid();
+            tempMap.put(sfBid, elementfactor);
+        }
+
+        for (IotSfElementfactor elementfactor : factorList) {
+            String sfBid = elementfactor.getSfBid();
+            String sfParentBid = elementfactor.getSfParentBid();
+
+            IotSfElementfactorAlreadyListResVo eleResVo = new IotSfElementfactorAlreadyListResVo();
+            BeanUtils.copyProperties(elementfactor, eleResVo);
+
+            // 表示是一级元素,直接添加
+            if(StringUtils.isEmpty(sfParentBid) && !eleMap.containsKey(sfBid)){
+                eleResVo.setChildrenList(new ArrayList<>());
+                eleMap.put(sfBid, eleResVo);
+            }else{
+                // 表示不是一级元素,需要判断父元素是否已经存在
+                IotSfElementfactorAlreadyListResVo parentInfo = eleMap.get(sfParentBid);
+                // 如果父类已经添加,直接添加到父类的childrenList中
+                if(parentInfo != null){
+                    parentInfo.getChildrenList().add(eleResVo);
+                }else{
+                    // 如果父类没有添加,需要先添加父类,再添加当前元素
+                    IotSfElementfactor parentElement = tempMap.get(sfParentBid);
+                    // 如果父类不存在,直接跳过
+                    if(parentElement == null){
+                        continue;
+                    }
+                    IotSfElementfactorAlreadyListResVo parentReq = new IotSfElementfactorAlreadyListResVo();
+                    BeanUtils.copyProperties(parentElement, parentReq);
+                    parentReq.setChildrenList(new ArrayList<>());
+
+                    parentReq.getChildrenList().add(eleResVo);
+                    eleMap.put(sfParentBid, parentReq);
+                }
+            }
+        }
+        return new ArrayList<>(eleMap.values());
+    }
+
+    /**
+     * 查询泵类已配置原始要素列表
+     *
+     * @param reqVo
+     * @return
+     */
+    @Override
+    public List<IotSfElementfactor> selectIotSfElementfactorListByPump(IotSfElementfactorListReqVo reqVo) {
+        List<String> sfTypeList = new ArrayList<>();
+        sfTypeList.add(EnumSfElementType.WATER_SOURCE.getCode());
+        sfTypeList.add(EnumSfElementType.FERTILIZER.getCode());
+        sfTypeList.add(EnumSfElementType.SUCTION.getCode());
+        sfTypeList.add(EnumSfElementType.MIXING.getCode());
+        sfTypeList.add(EnumSfElementType.FERTILIZER_BUCKET.getCode());
+        reqVo.setSfTypeList(sfTypeList);
+        return selectIotSfElementfactorList(reqVo);
+    }
+
+    /**
+     * 查询灌区已配置原始要素列表
+     *
+     * @param reqVo
+     * @return
+     */
+    @Override
+    public List<IotSfElementfactor> selectIotSfElementfactorListByGroup(IotSfElementfactorListReqVo reqVo) {
+        List<String> sfTypeList = new ArrayList<>();
+        sfTypeList.add(EnumSfElementType.GROUP.getCode());
+        reqVo.setSfTypeList(sfTypeList);
+        return selectIotSfElementfactorList(reqVo);
+    }
+
+    /**
+     * 查询电磁阀已配置原始要素列表
+     *
+     * @param reqVo
+     * @return
+     */
+    @Override
+    public List<IotSfElementfactor> selectIotSfElementfactorListByValve(IotSfElementfactorListReqVo reqVo) {
+        List<String> sfTypeList = new ArrayList<>();
+        sfTypeList.add(EnumSfElementType.SOLENOID_VALVE.getCode());
+        reqVo.setSfTypeList(sfTypeList);
+        return selectIotSfElementfactorList(reqVo);
+    }
+
+    /**
+     * 查询泵类已配置要素列表
+     *
+     * @param reqVo
+     * @return
+     */
+    @Override
+    public List<IotSfElementfactorAlreadyListResVo> getPumpAlreadyElementList(IotSfElementfactorListReqVo reqVo) {
+        List<IotSfElementfactor> elementfactorList = selectIotSfElementfactorListByPump(reqVo);
+        return getAlreadyElementList(elementfactorList);
+    }
+
+    /**
+     * 查询灌区已配置要素列表
+     *
+     * @param reqVo
+     * @return
+     */
+    @Override
+    public List<IotSfElementfactorAlreadyListResVo> getGroupAlreadyElementList(IotSfElementfactorListReqVo reqVo) {
+        List<String> sfTypeList = new ArrayList<>();
+        sfTypeList.add(EnumSfElementType.GROUP.getCode());
+        sfTypeList.add(EnumSfElementType.SOLENOID_VALVE.getCode());
+        reqVo.setSfTypeList(sfTypeList);
+
+        List<IotSfElementfactor> elementfactorList = selectIotSfElementfactorList(reqVo);
+        return getAlreadyElementList(elementfactorList);
+    }
+
+    /**
+     * 查询电磁阀已配置要素列表
+     *
+     * @param reqVo
+     * @return
+     */
+    @Override
+    public List<IotSfElementfactorAlreadyListResVo> getValveAlreadyElementList(IotSfElementfactorListReqVo reqVo) {
+        List<IotSfElementfactor> elementfactorList = selectIotSfElementfactorListByValve(reqVo);
+        return getAlreadyElementList(elementfactorList);
+    }
+}

+ 75 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotSfIrrigationOprecordServiceImpl.java

@@ -0,0 +1,75 @@
+package com.yunfeiyun.agmp.iotm.web.service.impl;
+
+import com.yunfeiyun.agmp.common.utils.DateUtils;
+import com.yunfeiyun.agmp.common.utils.SecurityUtils;
+import com.yunfeiyun.agmp.iot.common.domain.IotSfIrrigationOprecord;
+import com.yunfeiyun.agmp.iotm.device.sf.domain.IotSfIrrigationOprecordListReqVo;
+import com.yunfeiyun.agmp.iotm.web.mapper.IotSfIrrigationOprecordMapper;
+import com.yunfeiyun.agmp.iotm.web.service.IIotSfIrrigationOprecordService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class IotSfIrrigationOprecordServiceImpl implements IIotSfIrrigationOprecordService {
+
+    @Autowired
+    private IotSfIrrigationOprecordMapper iotSfIrrigationOprecordMapper;
+
+    @Override
+    public int insertIrrigationOprecord(IotSfIrrigationOprecord record) {
+        record.setTid(SecurityUtils.getTid());
+        return iotSfIrrigationOprecordMapper.insertIrrigationOprecord(record);
+    }
+
+    @Override
+    public int batchInsertIotSfIrrigationOprecord(List<IotSfIrrigationOprecord> recordList) {
+        return 0;
+    }
+
+    @Override
+    public IotSfIrrigationOprecord selectIrrigationOprecordByBid(String rcdBid) {
+        return null;
+    }
+
+    @Override
+    public int updateIrrigationOprecord(IotSfIrrigationOprecord record) {
+        return 0;
+    }
+
+    @Override
+    public void deleteIrrigationOprecord(String rcdBid) {
+
+    }
+
+    @Override
+    public List<IotSfIrrigationOprecord> selectIrrigationOprecordList(IotSfIrrigationOprecordListReqVo record) {
+        record.setTid(SecurityUtils.getTid());
+        return iotSfIrrigationOprecordMapper.selectIrrigationOprecordList(record);
+    }
+
+    /**
+     * 生成灌溉操作记录列表
+     *
+     * @param devBid
+     * @param oprecdName
+     * @param oprecdContent
+     * @param oprecdStatus
+     * @return
+     */
+    @Override
+    public void createIotSfIrrigationOprecord(String devBid, String oprecdName, String oprecdContent, String oprecdStatus) {
+        IotSfIrrigationOprecord oprecord = new IotSfIrrigationOprecord();
+        oprecord.setOprcdBid(oprecord.getUUId());
+        oprecord.setDevBid(devBid);
+        oprecord.setOprecdName(oprecdName);
+        oprecord.setOprecdContent(oprecdContent);
+        oprecord.setOprecdStatus(oprecdStatus);
+        oprecord.setOprcdCreatorName(SecurityUtils.getLoginLogName());
+        oprecord.setOprcdCreateddate(DateUtils.dateTimeNow());
+        oprecord.setTid(SecurityUtils.getTid());
+
+        insertIrrigationOprecord(oprecord);
+    }
+}

+ 105 - 0
src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotSfIrrigationRecordServiceImpl.java

@@ -0,0 +1,105 @@
+package com.yunfeiyun.agmp.iotm.web.service.impl;
+
+import com.yunfeiyun.agmp.common.utils.DateUtils;
+import com.yunfeiyun.agmp.common.utils.SecurityUtils;
+import com.yunfeiyun.agmp.iot.common.domain.IotSfIrrigationRecord;
+import com.yunfeiyun.agmp.iot.common.enums.EnumIrrigationRecord;
+import com.yunfeiyun.agmp.iotm.device.sf.domain.IotSfElementfactorAlreadyListResVo;
+import com.yunfeiyun.agmp.iotm.device.sf.domain.IotSfIrrigationRecordListReqVo;
+import com.yunfeiyun.agmp.iotm.web.mapper.IotSfIrrigationRecordMapper;
+import com.yunfeiyun.agmp.iotm.web.service.IIotSfIrrigationRecordService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class IotSfIrrigationRecordServiceImpl implements IIotSfIrrigationRecordService {
+
+    @Autowired
+    private IotSfIrrigationRecordMapper irrigationRecordMapper;
+
+    @Override
+    public int insertIrrigationRecord(IotSfIrrigationRecord record) {
+        record.setTid(SecurityUtils.getTid());
+        return irrigationRecordMapper.insertIrrigationRecord(record);
+    }
+
+    @Override
+    public int batchInsertIotSfIrrigationRecord(List<IotSfIrrigationRecord> recordList) {
+        for (IotSfIrrigationRecord record : recordList) {
+            record.setTid(SecurityUtils.getTid());
+        }
+        return irrigationRecordMapper.batchInsertIotSfIrrigationRecord(recordList);
+    }
+
+    @Override
+    public IotSfIrrigationRecord selectIrrigationRecordByBid(String rcdBid) {
+        return irrigationRecordMapper.selectIrrigationRecordByBid(rcdBid);
+    }
+
+    @Override
+    public int updateIrrigationRecord(IotSfIrrigationRecord record) {
+        record.setTid(SecurityUtils.getTid());
+        return irrigationRecordMapper.updateIrrigationRecord(record);
+    }
+
+    @Override
+    public void deleteIrrigationRecord(String rcdBid) {
+
+    }
+
+    @Override
+    public List<IotSfIrrigationRecord> selectIrrigationRecordList(IotSfIrrigationRecordListReqVo record) {
+        record.setTid(SecurityUtils.getTid());
+        return irrigationRecordMapper.selectIrrigationRecordList(record);
+    }
+
+    /**
+     * 生成灌溉记录列表
+     *
+     * @param groupList 灌区要素列表
+     * @param runMode   运行模式 0 手动 1 自动
+     * @return
+     */
+    @Override
+    public void createIotSfIrrigationRecordList(List<IotSfElementfactorAlreadyListResVo> groupList, String runMode, String sfdataBid) {
+        String tid = SecurityUtils.getTid();
+        String userId = SecurityUtils.getUserId();
+        String userLoginName = SecurityUtils.getLoginLogName();
+        String rcdStartdate = DateUtils.dateTimeNow();
+        List<IotSfIrrigationRecord> irrigationRecordList = new ArrayList<>();
+        for(IotSfElementfactorAlreadyListResVo group : groupList){
+            StringBuilder rcdContent = new StringBuilder();
+            List<IotSfElementfactorAlreadyListResVo> childrenList = group.getChildrenList();
+            for(IotSfElementfactorAlreadyListResVo child : childrenList){
+                rcdContent.append(child.getSfDisplayname()).append(",");
+            }
+            if(rcdContent.length() > 0){
+                rcdContent.deleteCharAt(rcdContent.length() - 1);
+            }
+            rcdContent.append(EnumIrrigationRecord.STATUS_RUNNING.getName());
+
+            IotSfIrrigationRecord record = new IotSfIrrigationRecord();
+            record.setRcdBid(record.getUUId());
+            record.setDevBid(group.getDevBid());
+            record.setRcdGroupbid(group.getSfBid());
+            record.setRcdGroupName(group.getSfDisplayname());
+            record.setRcdStatus(EnumIrrigationRecord.STATUS_RUNNING.getCode());
+            record.setRcdMode(runMode);
+            record.setRcdContent(rcdContent.toString());
+            record.setSfdataBid(sfdataBid);
+            record.setRcdCreator(userId);
+            record.setRcdCreatorName(userLoginName);
+            record.setRcdStartdate(rcdStartdate);
+            record.setRcdCreateddate(rcdStartdate);
+            record.setTid(tid);
+
+            irrigationRecordList.add(record);
+        }
+        if(!irrigationRecordList.isEmpty()){
+            batchInsertIotSfIrrigationRecord(irrigationRecordList);
+        }
+    }
+}

+ 106 - 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,45 @@ 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());
+                iotWarnpolicy.setWpType(iotWarnpolicyEdit.getWpType());
+                iotWarnpolicy.setWpFrequency(iotWarnpolicyEdit.getWpFrequency());
+                iotWarnpolicy.setWpChannel(iotWarnpolicyEdit.getWpChannel());
+                iotWarnpolicy.setDeliveryTimePeriod(iotWarnpolicyEdit.getDeliveryTimePeriod());
+                iotWarnpolicyService.insertIotWarnpolicy(iotWarnpolicy);
+            }
+        }else{
+            log.info("策略为空,不进行编辑操作");
+        }
+
+        //插入通知对象
+        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);
     }
 
@@ -360,6 +429,23 @@ public class IotWarnconfigServiceImpl implements IIotWarnconfigService {
         resultIotWarnIndicatorList.addAll(iotWarnindicatorMap.values());
     }
 
+    private void setInfoByYbq(IotWarnconfig iotWarnconfig, List<IotWarnobject> iotWarnobjectList, List<IotWarnindicator> resultIotWarnIndicatorList) {
+        String wcBid = iotWarnconfig.getWcBid();
+        String tid = SecurityUtils.getTid();
+
+        IotWarnindicator iotWarnindicatorQuery = new IotWarnindicator();
+        iotWarnindicatorQuery.setWcBid(wcBid);
+        iotWarnindicatorQuery.setTid(tid);
+        // 获取已经配置的设备要素
+        List<IotWarnindicator> iotWarnindicatorList = iotWarnindicatorService.selectIotWarnindicatorList(iotWarnindicatorQuery);
+        Map<String, IotWarnindicator> iotWarnindicatorMap = new LinkedHashMap<>();
+        for (IotWarnindicator iotWarnindicator : iotWarnindicatorList) {
+            String wiBid = iotWarnindicator.getWiBid();
+            iotWarnindicatorMap.put(wiBid, iotWarnindicator);
+        }
+        resultIotWarnIndicatorList.addAll(iotWarnindicatorMap.values());
+    }
+
     @Override
     public IotWarnconfigInfoResVo info(String wcBid) {
         String tid = SecurityUtils.getTid();
@@ -386,6 +472,8 @@ public class IotWarnconfigServiceImpl implements IIotWarnconfigService {
                 setInfoByQxz(iotWarnconfig, iotWarnobjectList, resultIotWarnIndicatorList);
             } else if (DevTypeUtil.isYfCbd(devtypeBid)) {
                 setInfoByCbd(iotWarnconfig, iotWarnobjectList, resultIotWarnIndicatorList);
+            } else if (DevTypeUtil.isYbd(devtypeBid)) {
+                setInfoByYbq(iotWarnconfig, iotWarnobjectList, resultIotWarnIndicatorList);
             }
         }
 
@@ -393,6 +481,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;
     }
 
@@ -402,6 +497,11 @@ public class IotWarnconfigServiceImpl implements IIotWarnconfigService {
         Set<String> devtypeSet = new HashSet<>();
         devtypeSet.add(IotDeviceDictConst.TYPE_DAHUA_YUNRUI_DEVICE);
         devtypeSet.add(IotDeviceDictConst.TYPE_EZVIZ_JKSB);
+        devtypeSet.add(IotDeviceDictConst.TYPE_HS_YBQ_BFB);
+        devtypeSet.add(IotDeviceDictConst.TYPE_HS_YBQ_CMB);
+        devtypeSet.add(IotDeviceDictConst.TYPE_HS_YBQ_DBB);
+        devtypeSet.add(IotDeviceDictConst.TYPE_HS_YBQ_DWB);
+        devtypeSet.add(IotDeviceDictConst.TYPE_HS_YBQ_TXB);
 
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("interval", interval);

+ 34 - 13
src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotWarnindicatorServiceImpl.java

@@ -129,32 +129,35 @@ public class IotWarnindicatorServiceImpl implements IIotWarnindicatorService {
 
         List<IotWarnindicator> result = new ArrayList<>();
         // 暂时只支持针对设备的告警要素查询
-        if(DevTypeUtil.isQxSq(devTypeBid)){
+        if (DevTypeUtil.isQxSq(devTypeBid)) {
             result = warnindicatorDevQueryByQxSq(iotDevice);
-        }else if(DevTypeUtil.isYfRecogCbd(devTypeBid)){
+        } else if (DevTypeUtil.isYfRecogCbd(devTypeBid)) {
             result = warnindicatorDevQueryByCbd(iotDevice);
+        } else if (DevTypeUtil.isYbd(devTypeBid)) {
+            result = warnindicatorDevQueryByYbq(iotDevice);
         }
         return result;
     }
 
     /**
      * 查询气象墒情告警要素列表
+     *
      * @param iotDevice
      * @return
      */
     @Override
-    public List<IotWarnindicator> warnindicatorDevQueryByQxSq(IotDevice iotDevice){
+    public List<IotWarnindicator> warnindicatorDevQueryByQxSq(IotDevice iotDevice) {
         // 暂不支持根据类型查询要素
         // 查询当前设备是否存在预设要素
         List<IotWarnindicator> result = new ArrayList<>();
         IotDeviceDataListReqVo iotDeviceDataListReqVo = new IotDeviceDataListReqVo();
-        BeanUtils.copyProperties(iotDevice,iotDeviceDataListReqVo);
+        BeanUtils.copyProperties(iotDevice, iotDeviceDataListReqVo);
         IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
         iotDeviceBaseFunReqVo.setDevBid(iotDevice.getDevBid());
         iotDeviceBaseFunReqVo.setMethodName("warnDataLatest");
         iotDeviceBaseFunReqVo.setParam(iotDeviceDataListReqVo);
         IotDevicelasteddata iotDevicelasteddata = iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
-        if(null == iotDevicelasteddata){
+        if (null == iotDevicelasteddata) {
             return result;
         }
         JSONArray jsonArray = JSONArray.parseArray(iotDevicelasteddata.getDevldContent());
@@ -189,7 +192,26 @@ public class IotWarnindicatorServiceImpl implements IIotWarnindicatorService {
         factorList.add(new String[]{"pestDetail", "指定害虫", "头", "1"});
 
         List<IotWarnindicator> result = new ArrayList<>();
-        for(String[] factor : factorList){
+        for (String[] factor : factorList) {
+            IotWarnindicator iotWarnindicator = new IotWarnindicator();
+            iotWarnindicator.setWiAddress(factor[0]);
+            iotWarnindicator.setWiCode(factor[0]);
+            iotWarnindicator.setWiName(factor[1]);
+            iotWarnindicator.setWiUnit(factor[2]);
+            iotWarnindicator.setWiOptiontype(factor[3]);
+            result.add(iotWarnindicator);
+        }
+        return result;
+    }
+
+    @Override
+    public List<IotWarnindicator> warnindicatorDevQueryByYbq(IotDevice iotDevice) {
+
+        List<String[]> factorList = new ArrayList<>();
+        factorList.add(new String[]{"computeValue", "发生率", "%", "0"});
+
+        List<IotWarnindicator> result = new ArrayList<>();
+        for (String[] factor : factorList) {
             IotWarnindicator iotWarnindicator = new IotWarnindicator();
             iotWarnindicator.setWiAddress(factor[0]);
             iotWarnindicator.setWiCode(factor[0]);
@@ -201,7 +223,7 @@ public class IotWarnindicatorServiceImpl implements IIotWarnindicatorService {
         return result;
     }
 
-    private Map<String,IotWarndataitem> queryDefaultFactorMap(IotDevice iotDevice){
+    private Map<String, IotWarndataitem> queryDefaultFactorMap(IotDevice iotDevice) {
         // 查询设备是否存在预设要素
         IotWarndataitem iotWarndataitemQuery = new IotWarndataitem();
         iotWarndataitemQuery.setWdType("0");
@@ -226,12 +248,12 @@ public class IotWarnindicatorServiceImpl implements IIotWarnindicatorService {
     @Override
     public List<IotPest> pestList(String devBid) {
         IotDevice iotDevice = iotDeviceService.selectIotDeviceByDevBid(devBid);
-        if(null == iotDevice){
+        if (null == iotDevice) {
             throw new BizException(ErrorCode.INVALID_PARAMETER.getCode(), "设备不存在");
         }
         String devtypeBid = iotDevice.getDevtypeBid();
         String devType = null;
-        switch (devtypeBid){
+        switch (devtypeBid) {
             case IotDeviceDictConst.TYPE_YF_CBD:
             case IotDeviceDictConst.TYPE_YF_SDCBD:
                 devType = "CBD";
@@ -251,14 +273,13 @@ public class IotWarnindicatorServiceImpl implements IIotWarnindicatorService {
      * 批量新增告警指标
      *
      * @param iotWarnindicator
-     * @return 结果
      * @param iotWarnindicator
      * @return
      */
     @Override
     public int insertIotWarnindicatorBatch(List<IotWarnindicator> iotWarnindicator) {
-        for(IotWarnindicator item : iotWarnindicator){
-            if(StringUtils.isEmpty(item.getWiOptiontype())){
+        for (IotWarnindicator item : iotWarnindicator) {
+            if (StringUtils.isEmpty(item.getWiOptiontype())) {
                 item.setWiOptiontype("0");
             }
         }
@@ -267,7 +288,7 @@ public class IotWarnindicatorServiceImpl implements IIotWarnindicatorService {
 
     @Override
     public int deleteIotWarnindicatorByWcBid(String wcBid, String tid) {
-        return iotWarnindicatorMapper.deleteIotWarnindicatorByWcBid(wcBid,tid);
+        return iotWarnindicatorMapper.deleteIotWarnindicatorByWcBid(wcBid, tid);
     }
 
     @Override

+ 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);
+    }
 }

+ 1 - 1
src/main/resources/application-test.yml

@@ -149,7 +149,7 @@ spring:
       port: 5672
       username: user
       password: 123456
-      virtual-host: /agmp-saas
+      virtual-host: /agmp-saas-iot
       connection-timeout: 15000
       publisher-returns: true
       enabled: true

+ 71 - 0
src/main/resources/mapper/IotSfElementfactorMapper.xml

@@ -0,0 +1,71 @@
+<?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.yunfeiyun.agmp.iotm.web.mapper.IotSfElementfactorMapper">
+
+    <update id="updateIotSfElementfactor" parameterType="IotSfElementfactor">
+        UPDATE IotSfElementfactor
+        <set>
+            <if test="sfDisplayname!= null and sfDisplayname!= ''">sfDisplayname = #{sfDisplayname},</if>
+            <if test="sfSequence != null">sfSequence = #{sfSequence},</if>
+            <if test="sfLng!= null and sfLng!= ''">sfLng = #{sfLng},</if>
+            <if test="sfLat!= null and sfLat!= ''">sfLat = #{sfLat},</if>
+            <if test="sfAddress != null and sfAddress!= ''">sfAddress = #{sfAddress},</if>
+            <if test="sfModifieddate!= null and sfModifieddate!= ''">sfModifieddate = #{sfModifieddate},</if>
+            <if test="sfModifier!= null and sfModifier!= ''">sfModifier = #{sfModifier},</if>
+        </set>
+        WHERE sfBid = #{sfBid}
+    </update>
+
+    <select id="selectIotSfElementfactorList" parameterType="com.yunfeiyun.agmp.iotm.device.sf.domain.IotSfElementfactorListReqVo"
+            resultType="com.yunfeiyun.agmp.iot.common.domain.IotSfElementfactor" >
+        SELECT sf.id, sf.sfBid, sf.devBid, sf.sfType, sf.sfCode, sf.sfName, sf.sfDisplayname, sf.sfParentBid, sf.sfSequence,
+            sf.tid, sf.sfCreatedDate, sf.sfCreator, sf.sfModifieddate, sf.sfModifier, sf.sfLng, sf.sfLat, sf.sfAddress
+        FROM IotSfElementfactor AS sf
+        <where>
+            sf.tid = #{tid}
+            <if test="sfBid!= null and sfBid!= ''"> and sf.sfBid = #{sfBid}</if>
+            <if test="sfType!= null and sfType!= ''"> and sf.sfType = #{sfType}</if>
+            <if test="devBid != null and devBid != ''"> and sf.devBid = #{devBid}</if>
+            <if test="sfCode!= null and sfCode!= ''"> and sf.sfCode = #{sfCode}</if>
+            <if test="sfName!= null and sfName!= ''"> and sf.sfName like concat('%', #{sfName}, '%')</if>
+            <if test="sfDisplayname!= null and sfDisplayname!= ''"> and sf.sfDisplayname like concat('%', #{sfDisplayname}, '%')</if>
+            <if test="sfParentBid!= null and sfParentBid!= ''"> and sf.sfParentBid = #{sfParentBid}</if>
+            <if test="sfSequence!= null and sfSequence!= ''"> and sf.sfSequence = #{sfSequence}</if>
+            <if test="sfCreatedDate!= null and sfCreatedDate!= ''"> and sf.sfCreatedDate = #{sfCreatedDate}</if>
+            <if test="sfCreator!= null and sfCreator!= ''"> and sf.sfCreator = #{sfCreator}</if>
+            <if test="sfModifieddate!= null and sfModifieddate!= ''"> and sf.sfModifieddate = #{sfModifieddate}</if>
+            <if test="sfModifier!= null and sfModifier!= ''"> and sf.sfModifier = #{sfModifier}</if>
+            <if test="sfTypeList != null and sfTypeList.size() > 0">
+                and sf.sfType in
+                <foreach collection="sfTypeList" item="item" index="index" open="(" separator="," close=")">
+                    #{item}
+                </foreach>
+            </if>
+        </where>
+        ORDER BY sf.sfSequence ASC, sf.sfModifieddate DESC
+    </select>
+
+    <select id="selectIotSfElementfactorBySfBid" resultType="com.yunfeiyun.agmp.iot.common.domain.IotSfElementfactor" parameterType="string">
+        SELECT sf.id, sf.sfBid, sf.devBid, sf.sfType, sf.sfCode, sf.sfName, sf.sfDisplayname, sf.sfParentBid, sf.sfSequence,
+        sf.tid, sf.sfCreatedDate, sf.sfCreator, sf.sfModifieddate, sf.sfModifier, sf.sfLng, sf.sfLat, sf.sfAddress
+        FROM IotSfElementfactor AS sf
+        where sf.sfBid = #{sfBid}
+    </select>
+
+    <insert id="batchInsertIotSfElementfactor" parameterType="IotSfElementfactor">
+        INSERT INTO IotSfElementfactor (sfBid, devBid, sfType, sfCode, sfName, sfDisplayname, sfParentBid, sfSequence,
+            tid, sfCreatedDate, sfCreator, sfModifieddate, sfModifier, sfLng, sfLat, sfAddress)
+        VALUES
+        <foreach collection="list" item="item" index="index" separator=",">
+            (#{item.sfBid}, #{item.devBid}, #{item.sfType}, #{item.sfCode}, #{item.sfName}, #{item.sfDisplayname}, #{item.sfParentBid}, #{item.sfSequence},
+            #{item.tid}, #{item.sfCreatedDate}, #{item.sfCreator}, #{item.sfModifieddate}, #{item.sfModifier}, #{item.sfLng}, #{item.sfLat}, #{item.sfAddress})
+        </foreach>
+    </insert>
+
+    <delete id="deleteIotSfElementfactorBySfBid" parameterType="string">
+        DELETE FROM IotSfElementfactor WHERE sfBid = #{sfBid} OR sfParentBid = #{sfBid}
+    </delete>
+
+</mapper>

+ 47 - 0
src/main/resources/mapper/IotSfIrrigationOprecordMapper.xml

@@ -0,0 +1,47 @@
+<?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.yunfeiyun.agmp.iotm.web.mapper.IotSfIrrigationOprecordMapper">
+
+    <insert id="insertIrrigationOprecord" parameterType="com.yunfeiyun.agmp.iot.common.domain.IotSfIrrigationOprecord">
+        INSERT INTO IotSfIrrigationOprecord
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="oprcdBid != null">oprcdBid,</if>
+            <if test="devBid != null">devBid,</if>
+            <if test="oprecdName != null">oprecdName,</if>
+            <if test="oprecdContent != null">oprecdContent,</if>
+            <if test="oprecdStatus!= null">oprecdStatus,</if>
+            <if test="oprcdCreatorName!= null">oprcdCreatorName,</if>
+            <if test="oprcdCreateddate!= null">oprcdCreateddate,</if>
+            <if test="tid!= null">tid,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="oprcdBid!= null">#{oprcdBid},</if>
+            <if test="devBid!= null">#{devBid},</if>
+            <if test="oprecdName!= null">#{oprecdName},</if>
+            <if test="oprecdContent!= null">#{oprecdContent},</if>
+            <if test="oprecdStatus!= null">#{oprecdStatus},</if>
+            <if test="oprcdCreatorName!= null">#{oprcdCreatorName},</if>
+            <if test="oprcdCreateddate!= null">#{oprcdCreateddate},</if>
+            <if test="tid!= null">#{tid},</if>
+        </trim>
+    </insert>
+    <select id="selectIrrigationOprecordList" parameterType="IotSfIrrigationOprecordListReqVo"
+            resultType="com.yunfeiyun.agmp.iot.common.domain.IotSfIrrigationOprecord">
+        SELECT * FROM IotSfIrrigationOprecord
+        <where>
+            tid = #{tid}
+            <if test="oprcdBid!= null"> AND oprcdBid = #{oprcdBid}</if>
+            <if test="devBid!= null"> AND devBid = #{devBid}</if>
+            <if test="oprecdName!= null"> AND oprcdName = #{oprecdName}</if>
+            <if test="oprecdContent!= null"> AND oprcdContent = #{oprecdContent}</if>
+            <if test="oprecdStatus!= null"> AND oprcdStatus = #{oprecdStatus}</if>
+            <if test="oprcdCreatorName!= null"> AND oprcdCreatorName = #{oprcdCreatorName}</if>
+            <if test="oprcdCreateddate!= null"> AND oprcdCreateddate = #{oprcdCreateddate}</if>
+            <if test="startTime!= null and startTime!= ''"> and oprcdCreateddate <![CDATA[ >= ]]> #{startTime}</if>
+            <if test="endTime!= null and endTime!= ''"> and oprcdCreateddate <![CDATA[ <= ]]> #{endTime}</if>
+        </where>
+        ORDER BY oprcdCreateddate DESC
+    </select>
+</mapper>

+ 130 - 0
src/main/resources/mapper/IotSfIrrigationRecordMapper.xml

@@ -0,0 +1,130 @@
+<?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.yunfeiyun.agmp.iotm.web.mapper.IotSfIrrigationRecordMapper">
+
+    <insert id="insertIrrigationRecord" parameterType="com.yunfeiyun.agmp.iot.common.domain.IotSfIrrigationRecord">
+        INSERT INTO IotSfIrrigationRecord
+            <trim prefix="(" suffix=")" suffixOverrides=",">
+                <if test="rcdBid != null">rcdBid,</if>
+                <if test="devBid != null">devBid,</if>
+                <if test="rcdContent != null">rcdContent,</if>
+                <if test="rcdGroupbid != null">rcdGroupbid,</if>
+                <if test="rcdGroupName!= null">rcdGroupName,</if>
+                <if test="rcdStatus!= null">rcdStatus,</if>
+                <if test="rcdMode!= null">rcdMode,</if>
+                <if test="sfdataBid!= null">sfdataBid,</if>
+                <if test="rcdFlow!= null">rcdFlow,</if>
+                <if test="rcdCreator!= null">rcdCreator,</if>
+                <if test="rcdStartdate!= null">rcdStartdate,</if>
+                <if test="rcdEnddate!= null">rcdEnddate,</if>
+                <if test="rcdCreatorName!= null">rcdCreatorName,</if>
+                <if test="rcdCreateddate!= null">rcdCreateddate,</if>
+                <if test="tid!= null">tid,</if>
+                <if test="rcdTime!= null">rcdTime,</if>
+                <if test="rcdUpdateddate!= null">rcdUpdateddate,</if>
+            </trim>
+            <trim prefix="values (" suffix=")" suffixOverrides=",">
+                <if test="rcdBid!= null">#{rcdBid},</if>
+                <if test="devBid!= null">#{devBid},</if>
+                <if test="rcdContent!= null">#{rcdContent},</if>
+                <if test="rcdGroupbid!= null">#{rcdGroupbid},</if>
+                <if test="rcdGroupName!= null">#{rcdGroupName},</if>
+                <if test="rcdStatus!= null">#{rcdStatus},</if>
+                <if test="rcdMode!= null">#{rcdMode},</if>
+                <if test="sfdataBid!= null">#{sfdataBid},</if>
+                <if test="rcdFlow!= null">#{rcdFlow},</if>
+                <if test="rcdCreator!= null">#{rcdCreator},</if>
+                <if test="rcdStartdate!= null">#{rcdStartdate},</if>
+                <if test="rcdEnddate!= null">#{rcdEnddate},</if>
+                <if test="rcdCreatorName!= null">#{rcdCreatorName},</if>
+                <if test="rcdCreateddate!= null">#{rcdCreateddate},</if>
+                <if test="tid!= null">#{tid},</if>
+                <if test="rcdTime!= null">#{rcdTime},</if>
+                <if test="rcdFertilizer!= null">#{rcdFertilizer},</if>
+            </trim>
+    </insert>
+    <insert id="batchInsertIotSfIrrigationRecord">
+        <foreach collection="list" item="item" separator=";">
+            INSERT INTO IotSfIrrigationRecord
+            <trim prefix="(" suffix=")" suffixOverrides=",">
+                <if test="item.rcdBid!= null">rcdBid,</if>
+                <if test="item.devBid!= null">devBid,</if>
+                <if test="item.rcdContent!= null">rcdContent,</if>
+                <if test="item.rcdGroupbid!= null">rcdGroupbid,</if>
+                <if test="item.rcdGroupName!= null">rcdGroupName,</if>
+                <if test="item.rcdStatus!= null">rcdStatus,</if>
+                <if test="item.rcdMode!= null">rcdMode,</if>
+                <if test="item.sfdataBid!= null">sfdataBid,</if>
+                <if test="item.rcdFlow!= null">rcdFlow,</if>
+                <if test="item.rcdCreator!= null">rcdCreator,</if>
+                <if test="item.rcdStartdate!= null">rcdStartdate,</if>
+                <if test="item.rcdEnddate!= null">rcdEnddate,</if>
+                <if test="item.rcdCreatorName!= null">rcdCreatorName,</if>
+                <if test="item.rcdCreateddate!= null">rcdCreateddate,</if>
+                <if test="item.tid!= null">tid,</if>
+                <if test="item.rcdTime!= null">rcdTime,</if>
+                <if test="item.rcdFertilizer!= null">rcdFertilizer,</if>
+            </trim>
+            <trim prefix="values (" suffix=")" suffixOverrides=",">
+                <if test="item.rcdBid!= null">#{item.rcdBid},</if>
+                <if test="item.devBid!= null">#{item.devBid},</if>
+                <if test="item.rcdContent!= null">#{item.rcdContent},</if>
+                <if test="item.rcdGroupbid!= null">#{item.rcdGroupbid},</if>
+                <if test="item.rcdGroupName!= null">#{item.rcdGroupName},</if>
+                <if test="item.rcdStatus!= null">#{item.rcdStatus},</if>
+                <if test="item.rcdMode!= null">#{item.rcdMode},</if>
+                <if test="item.sfdataBid!= null">#{item.sfdataBid},</if>
+                <if test="item.rcdFlow!= null">#{item.rcdFlow},</if>
+                <if test="item.rcdCreator!= null">#{item.rcdCreator},</if>
+                <if test="item.rcdStartdate!= null">#{item.rcdStartdate},</if>
+                <if test="item.rcdEnddate!= null">#{item.rcdEnddate},</if>
+                <if test="item.rcdCreatorName!= null">#{item.rcdCreatorName},</if>
+                <if test="item.rcdCreateddate!= null">#{item.rcdCreateddate},</if>
+                <if test="item.tid!= null">#{item.tid},</if>
+                <if test="item.rcdTime!= null">#{item.rcdTime},</if>
+                <if test="item.rcdFertilizer!= null">#{item.rcdFertilizer},</if>
+            </trim>
+        </foreach>
+    </insert>
+
+    <update id="updateIrrigationRecord" parameterType="com.yunfeiyun.agmp.iot.common.domain.IotSfIrrigationRecord">
+        UPDATE IotSfIrrigationRecord
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="rcdContent!= null">rcdContent = #{rcdContent},</if>
+            <if test="rcdStatus!= null">rcdStatus = #{rcdStatus},</if>
+            <if test="rcdFlow!= null">rcdFlow = #{rcdFlow},</if>
+            <if test="rcdEnddate!= null">rcdEnddate = #{rcdEnddate},</if>
+            <if test="rcdTime!= null">rcdTime = #{rcdTime},</if>
+            <if test="rcdFertilizer!= null">rcdFertilizer = #{rcdFertilizer},</if>
+        </trim>
+        where rcdBid = #{rcdBid} and tid = #{tid}
+    </update>
+
+    <select id="selectIrrigationRecordByBid" parameterType="com.yunfeiyun.agmp.iot.common.domain.IotSfIrrigationRecord"
+            resultType="com.yunfeiyun.agmp.iot.common.domain.IotSfIrrigationRecord">
+        SELECT rcdBid, devBid, rcdContent, rcdGroupbid, rcdGroupName, rcdStatus, rcdMode, sfdataBid, rcdFlow, rcdCreator,
+            rcdStartdate, rcdEnddate, rcdCreatorName, rcdCreateddate, tid, rcdTime,rcdFertilizer
+        FROM IotSfIrrigationRecord
+        where rcdBid = #{rcdBid}
+    </select>
+
+    <select id="selectIrrigationRecordList" parameterType="IotSfIrrigationRecordListReqVo"
+            resultType="com.yunfeiyun.agmp.iot.common.domain.IotSfIrrigationRecord">
+        SELECT rcdBid, devBid, rcdContent, rcdGroupbid, rcdGroupName, rcdStatus, rcdMode, sfdataBid, rcdFlow, rcdCreator,
+            rcdStartdate, rcdEnddate, rcdCreatorName, rcdCreateddate, tid, rcdTime, rcdFertilizer
+        FROM IotSfIrrigationRecord
+        <where>
+            tid = #{tid}
+            <if test="devBid!= null and devBid!= ''"> and devBid = #{devBid}</if>
+            <if test="rcdGroupbid!= null and rcdGroupbid!= ''"> and rcdGroupbid = #{rcdGroupbid}</if>
+            <if test="rcdGroupName!= null and rcdGroupName!= ''"> and rcdGroupName = #{rcdGroupName}</if>
+            <if test="rcdStatus!= null and rcdStatus!= ''"> and rcdStatus = #{rcdStatus}</if>
+            <if test="rcdMode!= null and rcdMode!= ''"> and rcdMode = #{rcdMode}</if>
+            <if test="startTime!= null and startTime!= ''"> and rcdStartdate <![CDATA[ >= ]]> #{startTime}</if>
+            <if test="endTime!= null and endTime!= ''"> and rcdStartdate <![CDATA[ <= ]]> #{endTime}</if>
+        </where>
+        order by rcdCreateddate desc
+    </select>
+</mapper>

+ 6 - 6
src/main/resources/mapper/IotWarnlogMapper.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.IotWarnlogMapper">
-    
+
     <resultMap type="IotWarnlog" id="IotWarnlogResult">
         <result property="id"    column="id"    />
         <result property="wlBid"    column="wlBid"    />
@@ -24,12 +24,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectIotWarnlogVo">
-        select id, wlBid, wlName,wcBid, wlType, wlContent, wlLevel, devtypeBid, devBid, status, wlDealuserid, wlDealresult, wlDealtime,  wlCreateddate, wlData, tid from IotWarnlog
+        select id, wlBid, wlName,wcBid, wlType, wlContent, wlLevel, devtypeBid, devBid, status, wlDealuserid, wlDealresult, wlDealtime,  wlCreateddate, wlData, tid,wlSendmsgtime,wlSendmsgstatus from IotWarnlog
     </sql>
 
     <select id="selectIotWarnlogList" parameterType="IotWarnlog" resultMap="IotWarnlogResult">
         <include refid="selectIotWarnlogVo"/>
-        <where>  
+        <where>
             <if test="wlBid != null  and wlBid != ''"> and wlBid = #{wlBid}</if>
             <if test="wlName != null  and wlName != ''"> and wlName like concat('%', #{wlName}, '%')</if>
             <if test="wcBid != null and wcBid != ''">and wcBid = #{wcBid}</if>
@@ -48,12 +48,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="tid != null  and tid != ''"> and tid = #{tid}</if>
         </where>
     </select>
-    
+
     <select id="selectIotWarnlogById" resultMap="IotWarnlogResult">
         <include refid="selectIotWarnlogVo"/>
         where wlBid = #{wlBid} and tid = #{tid}
     </select>
-        
+
     <insert id="insertIotWarnlog" parameterType="IotWarnlog" useGeneratedKeys="true" keyProperty="id">
         insert into IotWarnlog
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -155,4 +155,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             </if>
         </where>
     </select>
-</mapper>
+</mapper>

+ 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>

+ 14 - 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,25 @@ 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 ic.*,su.userName,su.userMobile FROM IotWarnreceiver ic
+                 left join SysUser su on ic.wruserId = su.userId
+
+        WHERE wcBid = #{wcBid}
+    </select>
+
     <insert id="insertIotWarnreceiver" parameterType="IotWarnreceiver" useGeneratedKeys="true" keyProperty="id">
         insert into IotWarnreceiver
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -68,4 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{wrBid}
         </foreach>
     </delete>
-</mapper>
+    <delete id="deleteIotWarnreceiverByWcBid">
+        delete from IotWarnreceiver where wcBid = #{wcBid}
+    </delete>
+</mapper>