فهرست منبع

新增 获取未配置的水肥要素接口

zhaiyifei 8 ماه پیش
والد
کامیت
3cc5bc0cd3

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

@@ -60,37 +60,37 @@ public class IotDeviceSfController extends BaseController {
     }
 
     /**
-     * 获取已存在的元素列表
+     * 获取泵类设备已存在的元素列表
      * 该接口用于根据请求参数获取已存在的元素列表,并返回相关数据。
      *
      * @param reqVo 请求参数,包含设备标识devBid等信息
      * @return 返回TableDataInfo对象,包含元素列表数据
      * @throws IllegalArgumentException 如果reqVo中的devBid为空,则抛出异常
      */
-    @GetMapping("/ele/already/List")
-    public TableDataInfo getAlreadyElementList(IotSfElementfactorListReqVo reqVo){
+    @GetMapping("/pump/already/list")
+    public TableDataInfo getPumpAlreadyElementList(IotSfElementfactorListReqVo reqVo){
         ValidateUtil.validateDevBid(reqVo.getDevBid());
         IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
         iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
-        iotDeviceBaseFunReqVo.setMethodName("getAlreadyElementList");
+        iotDeviceBaseFunReqVo.setMethodName("getPumpAlreadyElementList");
         iotDeviceBaseFunReqVo.setParam(reqVo);
         return iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
     }
 
     /**
-     * 获取未处理的元素列表
+     * 获取泵类未处理的元素列表
      * 该接口用于根据请求参数获取未处理的元素列表,并返回相关数据。
      *
      * @param reqVo 请求参数,包含设备标识(devBid)等信息
      * @return TableDataInfo 包含未处理的元素列表的数据封装对象
      * @throws IllegalArgumentException 如果devBid为空,则抛出非法参数异常
      */
-    @GetMapping("/ele/unalready/List")
-    public TableDataInfo getUnAlreadyElementList(IotSfElementfactorListReqVo reqVo){
+    @GetMapping("/pump/unalready/list")
+    public TableDataInfo getPumpUnAlreadyElementList(IotSfElementfactorListReqVo reqVo){
         ValidateUtil.validateDevBid(reqVo.getDevBid());
         IotDeviceBaseFunReqVo iotDeviceBaseFunReqVo = new IotDeviceBaseFunReqVo();
         iotDeviceBaseFunReqVo.setDevBid(reqVo.getDevBid());
-        iotDeviceBaseFunReqVo.setMethodName("getUnAlreadyElementList");
+        iotDeviceBaseFunReqVo.setMethodName("getPumpUnAlreadyElementList");
         iotDeviceBaseFunReqVo.setParam(reqVo);
         return iotDeviceCommonService.func(iotDeviceBaseFunReqVo);
     }

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

@@ -2,6 +2,8 @@ package com.yunfeiyun.agmp.iotm.device.sf.domain;
 
 import lombok.Data;
 
+import java.util.List;
+
 /**
  * 水肥机要素
  */
@@ -50,4 +52,6 @@ public class IotSfElementfactorListReqVo {
     /** 修改人 */
     private String sfModifier;
 
+    private List<String> sfTypeList;
+
 }

+ 12 - 5
src/main/java/com/yunfeiyun/agmp/iotm/device/sf/service/IIotSfCommService.java

@@ -7,6 +7,7 @@ import com.yunfeiyun.agmp.iot.common.constant.IotErrorCode;
 import com.yunfeiyun.agmp.iot.common.constant.devicetype.IotDeviceDictConst;
 import com.yunfeiyun.agmp.iot.common.domain.IotDevice;
 import com.yunfeiyun.agmp.iot.common.domain.IotRunHaoSfdata;
+import com.yunfeiyun.agmp.iot.common.enums.EnumSfElementType;
 import com.yunfeiyun.agmp.iot.common.exception.IotBizException;
 import com.yunfeiyun.agmp.iotm.device.common.service.IotDeviceBaseService;
 import com.yunfeiyun.agmp.iotm.device.common.service.impl.IotDeviceBaseServiceImpl;
@@ -40,13 +41,13 @@ public class IIotSfCommService extends IotDeviceBaseServiceImpl implements IotDe
     }
 
     /**
-     * 获取已存在的元素列表
+     * 获取泵类设备已存在的元素列表
      *
      * @param reqVo 请求对象,包含设备标识等信息
      * @return TableDataInfo 包含响应码、消息、数据和总数
      * @throws IotBizException 抛出业务异常,包含错误码和错误信息
      */
-    public TableDataInfo getAlreadyElementList(IotSfElementfactorListReqVo reqVo) {
+    public TableDataInfo getPumpAlreadyElementList(IotSfElementfactorListReqVo reqVo) {
         TableDataInfo rspData = new TableDataInfo();
         rspData.setCode(ErrorCode.SUCCESS.getCode());
         rspData.setMsg(ErrorCode.SUCCESS.getMessage());
@@ -62,9 +63,15 @@ public class IIotSfCommService extends IotDeviceBaseServiceImpl implements IotDe
         if (findDevice == null) {
             throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备不存在");
         }
+        List<String> sfTypeList = new ArrayList<>();
+        sfTypeList.add(EnumSfElementType.WATER_SOURCE.getCode());
+        sfTypeList.add(EnumSfElementType.FERILIZER.getCode());
+        sfTypeList.add(EnumSfElementType.SUCTION.getCode());
+        sfTypeList.add(EnumSfElementType.MIXING.getCode());
+        reqVo.setSfTypeList(sfTypeList);
 
         List<IotSfElementfactorAlreadyListResVo> resVoList = iotSfElementfactorService.getAlreadyElementList(reqVo);
-        if (resVoList != null && resVoList.size() > 0){
+        if (resVoList != null && !resVoList.isEmpty()){
             rspData.setData(resVoList);
             rspData.setTotal(resVoList.size());
         }
@@ -72,14 +79,14 @@ public class IIotSfCommService extends IotDeviceBaseServiceImpl implements IotDe
     }
 
     /**
-     * 获取未处理的元素列表
+     * 获取泵类未处理的元素列表
      * 该接口用于根据请求参数获取未处理的元素列表,并返回相关数据。
      *
      * @param reqVo 请求参数,包含设备标识(devBid)等信息
      * @return TableDataInfo 包含未处理的元素列表的数据封装对象
      * @throws IllegalArgumentException 如果devBid为空,则抛出非法参数异常
      */
-    public TableDataInfo getUnAlreadyElementList(IotSfElementfactorListReqVo reqVo) {
+    public TableDataInfo getPumpUnAlreadyElementList(IotSfElementfactorListReqVo reqVo) {
         // 由具体子类实现
         return null;
     }

+ 11 - 3
src/main/java/com/yunfeiyun/agmp/iotm/device/sf/service/impl/IotRunHaoSfServiceImpl.java

@@ -9,6 +9,7 @@ import com.yunfeiyun.agmp.iot.common.constant.devicetype.ServiceNameConst;
 import com.yunfeiyun.agmp.iot.common.domain.IotDevice;
 import com.yunfeiyun.agmp.iot.common.domain.IotRunHaoSfdata;
 import com.yunfeiyun.agmp.iot.common.domain.IotSfElementfactor;
+import com.yunfeiyun.agmp.iot.common.enums.EnumSfElementType;
 import com.yunfeiyun.agmp.iot.common.exception.IotBizException;
 import com.yunfeiyun.agmp.iot.common.service.MongoService;
 import com.yunfeiyun.agmp.iot.common.util.dev.RunHaoSfElementUtil;
@@ -42,14 +43,14 @@ public class IotRunHaoSfServiceImpl extends IIotSfCommService {
     private MongoService mongoService;
 
     /**
-     * 获取未处理的元素列表
+     * 获取泵类未处理的元素列表
      * 该接口用于根据请求参数获取未处理的元素列表,并返回相关数据。
      *
      * @param reqVo 请求参数,包含设备标识(devBid)等信息
      * @return TableDataInfo 包含未处理的元素列表的数据封装对象
      * @throws IllegalArgumentException 如果devBid为空,则抛出非法参数异常
      */
-    public TableDataInfo getUnAlreadyElementList(IotSfElementfactorListReqVo reqVo) {
+    public TableDataInfo getPumpUnAlreadyElementList(IotSfElementfactorListReqVo reqVo) {
         TableDataInfo rspData = new TableDataInfo();
         rspData.setCode(ErrorCode.SUCCESS.getCode());
         rspData.setMsg(ErrorCode.SUCCESS.getMessage());
@@ -66,6 +67,13 @@ public class IotRunHaoSfServiceImpl extends IIotSfCommService {
             throw new IotBizException(IotErrorCode.INVALID_DEVICE_ID.getCode(), "设备不存在");
         }
 
+        List<String> sfTypeList = new ArrayList<>();
+        sfTypeList.add(EnumSfElementType.WATER_SOURCE.getCode());
+        sfTypeList.add(EnumSfElementType.FERILIZER.getCode());
+        sfTypeList.add(EnumSfElementType.SUCTION.getCode());
+        sfTypeList.add(EnumSfElementType.MIXING.getCode());
+        reqVo.setSfTypeList(sfTypeList);
+
         List<IotSfElementfactor> elementfactorList = iotSfElementfactorService.selectIotSfElementfactorList(reqVo);
         Set<String> sfCodeSet = new java.util.HashSet<>();
         for (IotSfElementfactor elementfactor : elementfactorList) {
@@ -83,7 +91,7 @@ public class IotRunHaoSfServiceImpl extends IIotSfCommService {
                 if(sfCodeSet.contains(key)){
                     continue;
                 }
-                IotSfElementfactor elementFactor = RunHaoSfElementUtil.getSfElementfactor(key);
+                IotSfElementfactor elementFactor = RunHaoSfElementUtil.getPumpElementFactor(key);
                 if(elementFactor == null){
                     continue;
                 }

+ 4 - 1
src/main/java/com/yunfeiyun/agmp/iotm/web/service/impl/IotSfElementfactorServiceImpl.java

@@ -8,6 +8,7 @@ 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;
@@ -15,9 +16,11 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
-@Service
+
 @Slf4j
+@Service
 public class IotSfElementfactorServiceImpl implements IIotSfElementfactorService {
+    @Autowired
     private IotSfElementfactorMapper iotSfElementfactorMapper;
     /**
      * 查询水肥机要素列表