Bläddra i källkod

Merge branch 'develop' of com_yunfei_saas/agmp_iot_common into master

yf_zn 1 år sedan
förälder
incheckning
1fd5010ae8
41 ändrade filer med 848 tillägg och 909 borttagningar
  1. 6 12
      src/main/java/com/yunfeiyun/agmp/iot/common/constant/device/ElementFormatUtil.java
  2. 22 9
      src/main/java/com/yunfeiyun/agmp/iot/common/constant/devicetype/IotDeviceDictConst.java
  3. 79 73
      src/main/java/com/yunfeiyun/agmp/iot/common/constant/devicetype/IotDeviceDictEnum.java
  4. 2 1
      src/main/java/com/yunfeiyun/agmp/iot/common/constant/devicetype/ServiceNameConst.java
  5. 1 0
      src/main/java/com/yunfeiyun/agmp/iot/common/constant/mq/IotActionEnums.java
  6. 68 42
      src/main/java/com/yunfeiyun/agmp/iot/common/constant/mqtt/IotMqttConstant.java
  7. 26 0
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/CbdBaseDataEntity.java
  8. 5 158
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/FmsBlock.java
  9. 0 207
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/FmsCrop.java
  10. 2 2
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/FmsLand.java
  11. 2 15
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotCbddata.java
  12. 0 42
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotCbdpest.java
  13. 9 0
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotDevGeoPoint.java
  14. 5 2
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotDevice.java
  15. 29 0
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotDeviceGeoLocation.java
  16. 16 0
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotXctdata.java
  17. 3 1
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotXycbimg.java
  18. 2 1
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotXyinfo.java
  19. 1 14
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotYfXycb2data.java
  20. 2 2
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotYfXycbIIIdata.java
  21. 1 14
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotZjsfXycbdata.java
  22. 3 2
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/TmnBlock.java
  23. 4 50
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/TmnLand.java
  24. 4 0
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/TosDevicetype.java
  25. 12 0
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/dto/MgUpdateBatchDto.java
  26. 3 1
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/reqvo/IotCbdConfigEditReqVo.java
  27. 0 10
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/reqvo/IotCbddataReqVo.java
  28. 2 0
      src/main/java/com/yunfeiyun/agmp/iot/common/domain/reqvo/IotCbdrecogAgainReqVo.java
  29. 2 1
      src/main/java/com/yunfeiyun/agmp/iot/common/enums/EnumYfQxzElement.java
  30. 4 1
      src/main/java/com/yunfeiyun/agmp/iot/common/enums/YfqxzEnumFactor.java
  31. 0 115
      src/main/java/com/yunfeiyun/agmp/iot/common/service/DeviceconnCacheService.java
  32. 24 0
      src/main/java/com/yunfeiyun/agmp/iot/common/service/IotDeviceGeoLocationCommonService.java
  33. 0 23
      src/main/java/com/yunfeiyun/agmp/iot/common/service/IotMqttTopicCacheService.java
  34. 97 3
      src/main/java/com/yunfeiyun/agmp/iot/common/service/MongoService.java
  35. 0 73
      src/main/java/com/yunfeiyun/agmp/iot/common/service/TypeCacheService.java
  36. 0 31
      src/main/java/com/yunfeiyun/agmp/iot/common/service/TypeCoreService.java
  37. 47 4
      src/main/java/com/yunfeiyun/agmp/iot/common/service/YfCbdRecogeService.java
  38. 172 0
      src/main/java/com/yunfeiyun/agmp/iot/common/service/impl/IotDeviceGeoLocationCommonServiceImpl.java
  39. 25 0
      src/main/java/com/yunfeiyun/agmp/iot/common/util/BigDecimalUtil.java
  40. 67 0
      src/main/java/com/yunfeiyun/agmp/iot/common/util/dev/QxzTypeUtil.java
  41. 101 0
      src/main/java/com/yunfeiyun/agmp/iot/common/util/dev/XctToCbdUtil.java

+ 6 - 12
src/main/java/com/yunfeiyun/agmp/iot/common/constant/device/ElementFormatUtil.java

@@ -9,6 +9,7 @@ import com.yunfeiyun.agmp.iot.common.domain.QxzDataDto;
 import com.yunfeiyun.agmp.iot.common.domain.dto.IotElementDto;
 import com.yunfeiyun.agmp.iot.common.enums.EnumAdznGssqElement;
 import com.yunfeiyun.agmp.iot.common.enums.EnumYfQxzElement;
+import com.yunfeiyun.agmp.iot.common.util.dev.QxzTypeUtil;
 
 import java.util.*;
 
@@ -96,18 +97,11 @@ public class ElementFormatUtil {
     private static IotElementDto getElement(IotDevice iotDevice, QxzDataDto dataitem, Map<String, List<Integer>> elementMap){
         IotElementDto iotElementDto = null;
         String devtypeBid = iotDevice.getDevtypeBid();
-        switch (devtypeBid){
-            case IotDeviceDictConst.TYPE_YF_QXZ:
-            case IotDeviceDictConst.TYPE_YF_SQZ:
-            case IotDeviceDictConst.TYPE_XPH_YF_QXZ:
-            case IotDeviceDictConst.TYPE_XPH_YF_SQZ:
-                iotElementDto = getYfQxzElement(dataitem, elementMap);
-                break;
-            case IotDeviceDictConst.TYPE_ADZN_GSSQ:
-                iotElementDto = getAdznGssqElement(dataitem, elementMap);
-                break;
-            default:
-                break;
+        boolean isQxz = QxzTypeUtil.isYfCommQxz(devtypeBid);
+        if(isQxz){
+            iotElementDto = getYfQxzElement(dataitem, elementMap);
+        }else if(IotDeviceDictConst.TYPE_ADZN_GSSQ.equals(devtypeBid)){
+            iotElementDto = getAdznGssqElement(dataitem, elementMap);
         }
         return iotElementDto;
     }

+ 22 - 9
src/main/java/com/yunfeiyun/agmp/iot/common/constant/devicetype/IotDeviceDictConst.java

@@ -82,10 +82,7 @@ public class IotDeviceDictConst {
     public static final String TYPE_ZHAO_HE_SFJ = "103";
 
 
-    /**
-     * 云飞-性诱测报灯2.0
-     */
-    public static final String TYPE_YF_XYCB_2 = "1700";
+
 
 
 
@@ -143,10 +140,7 @@ public class IotDeviceDictConst {
      */
     public static final String TYPE_XPH_TRSH_CL = "5001";
 
-    /**
-     * 中捷四方性诱
-     */
-    public static final String TYPE_ZJSF_XYCB = "1701";
+
 
     /**
      * 海普发温室灭菌智能开关
@@ -196,7 +190,7 @@ public class IotDeviceDictConst {
      * */
     public static final String TYPE_JSY_ST_QF = "9001";
 
-
+    /* 新版值写下下面,上面的老版本的值不在使用 */
 
     /*
      ***********************************************************
@@ -217,6 +211,12 @@ public class IotDeviceDictConst {
      */
     public static final String TYPE_ADZN_GSSQ = "SQZ00003";
 
+    /**
+     * 新普惠-管式墒情
+     * 新普惠MQTT墒情站分管式和普通,都是一样的设备,数据也一样,只是类型上做区分
+     */
+    public static final String TYPE_XPH_YF_GSSQ = "SQZ00004";
+
 
 
     /*
@@ -352,6 +352,19 @@ public class IotDeviceDictConst {
      */
     /**
      * 云飞-性诱测报灯III
+     * 带控制 不带图片
      */
     public static final String TYPE_YF_XYCB_III = "XYCB00003";
+
+    /**
+     * 云飞-性诱测报灯2.0
+     * 宁录-性诱测报灯
+     * 不带控制 不带图片
+     */
+    public static final String TYPE_YF_XYCB_2 = "XYCB00004";
+    /**
+     * 中捷四方性诱
+     * 带图片 不带控制
+     */
+    public static final String TYPE_ZJSF_XYCB = "XYCB00005";
 }

+ 79 - 73
src/main/java/com/yunfeiyun/agmp/iot/common/constant/devicetype/IotDeviceDictEnum.java

@@ -2,8 +2,6 @@ package com.yunfeiyun.agmp.iot.common.constant.devicetype;
 
 import com.yunfeiyun.agmp.common.constant.ErrorCode;
 import com.yunfeiyun.agmp.common.exception.BizException;
-import com.yunfeiyun.agmp.common.utils.spring.SpringUtils;
-import com.yunfeiyun.agmp.iot.common.service.TypeCoreService;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -17,58 +15,55 @@ import java.util.List;
 public enum IotDeviceDictEnum {
 
 
-
-    TYPE_YF_SY3(IotDeviceDictConst.TYPE_YF_SY3, "云飞性诱3.0"),
-    TYPE_YF_SY2(IotDeviceDictConst.TYPE_YF_SY2, "云飞性诱2.0"),
-
-
-
-
-
-
-
-
-
-    TYPE_JP(IotDeviceDictConst.TYPE_JP, "卷盘"),
-    TYPE_HT_SFJ(IotDeviceDictConst.TYPE_HT_SFJ, "宏泰水肥机", ServiceNameConst.SERVICE_Ht_SF, IotDeviceTypeLv1Enum.SFJ),
-    TYPE_BY_SFJ(IotDeviceDictConst.TYPE_BY_SFJ, "博云水肥机", ServiceNameConst.SERVICE_BY_SF, IotDeviceTypeLv1Enum.SFJ),
-    TYPE_XMZN_PNHJJC(IotDeviceDictConst.TYPE_XMZN_PNHJJC, "小马智农-棚内环境监测", ServiceNameConst.SERVICE_XMZN_ZNDP, IotDeviceTypeLv1Enum.PNHJJC),
-    TYPE_XMZN_QXZ(IotDeviceDictConst.TYPE_XMZN_QXZ, "小马智农-气象站", ServiceNameConst.SERVICE_XMZN_ZNDP, IotDeviceTypeLv1Enum.QXZ),
-    TYPE_XMZN_GSSQ(IotDeviceDictConst.TYPE_XMZN_GSSQ, "小马智农-管式墒情", ServiceNameConst.SERVICE_XMZN_ZNDP, IotDeviceTypeLv1Enum.GSSQ),
-    TYPE_XMZN_JM(IotDeviceDictConst.TYPE_XMZN_JM, "小马智农-卷膜", ServiceNameConst.SERVICE_XMZN_ZNDP, IotDeviceTypeLv1Enum.JM),
-    TYPE_XMZN_JB(IotDeviceDictConst.TYPE_XMZN_JB, "小马智农-卷被", ServiceNameConst.SERVICE_XMZN_ZNDP, IotDeviceTypeLv1Enum.JB),
-    TYPE_XMZN_SQZ(IotDeviceDictConst.TYPE_XMZN_SQZ, "小马智农-墒情站", ServiceNameConst.SERVICE_XMZN_ZNDP, IotDeviceTypeLv1Enum.SQZ),
-    TYPE_RT_XJ(IotDeviceDictConst.TYPE_RT_XJ, "睿瞳相机", IotDeviceTypeLv1Enum.WH_XJ),
-    TYPE_ZHAO_HE_SFJ(IotDeviceDictConst.TYPE_ZHAO_HE_SFJ, "兆赫水肥机", ServiceNameConst.SERVICE_ZHAO_HE_SF, IotDeviceTypeLv1Enum.SFJ),
-
-
-    TYPE_YF_XYCB_2(IotDeviceDictConst.TYPE_YF_XYCB_2, "云飞-性诱测报灯2.0", ServiceNameConst.SERVICE_YF_XYCB_2, IotDeviceTypeLv1Enum.XYCB),
-
-    TYPE_XPH_SZZX_JC(IotDeviceDictConst.TYPE_XPH_SZZX_JC, "新浦会水质在线监测站", ServiceNameConst.SERVICE_XPH_SZZX_JC, IotDeviceTypeLv1Enum.JZC_SZ_ZX),
-    TYPE_XPH_LDSW_JC(IotDeviceDictConst.TYPE_XPH_LDSW_JC, "新浦会雷达水位监测站", ServiceNameConst.SERVICE_XPH_LDSW_JC, IotDeviceTypeLv1Enum.JZC_LD_SW),
-    TYPE_DAHUA_DEVICE(IotDeviceDictConst.TYPE_DAHUA_DEVICE, "大华球形摄像机", ServiceNameConst.SERVICE_DAHUA_ICC, IotDeviceTypeLv1Enum.JKSB),
-    TYPE_OB_NTSWJ(IotDeviceDictConst.TYPE_OB_NTSWJ, "欧标农田水位计", ServiceNameConst.SERVICE_OB_NTSWJ, IotDeviceTypeLv1Enum.NTSWJ),
-    TYPE_OB_SZ(IotDeviceDictConst.TYPE_OB_SZ, "欧标水闸设备", ServiceNameConst.SERVICE_OB_SZ, IotDeviceTypeLv1Enum.SZ),
-
-    TYPE_XPH_WSHJ_JC(IotDeviceDictConst.TYPE_XPH_WSHJ_JC, "新浦会温室环境监测", ServiceNameConst.SERVICE_XPH_WSHJ_JC, IotDeviceTypeLv1Enum.PNHJJC),
-
-    TYPE_XPH_WSKZ(IotDeviceDictConst.TYPE_XPH_WSKZ, "新浦会温室控制", ServiceNameConst.SERVICE_XPH_WSKZ, IotDeviceTypeLv1Enum.WSKZ),
-
-    TYPE_YF_GXZW(IotDeviceDictConst.TYPE_YF_GXZW, "根系作物监测", ServiceNameConst.SERVICE_YF_GXZW, IotDeviceTypeLv1Enum.SQZ),
+//
+//    TYPE_YF_SY3(IotDeviceDictConst.TYPE_YF_SY3, "云飞性诱3.0"),
+//    TYPE_YF_SY2(IotDeviceDictConst.TYPE_YF_SY2, "云飞性诱2.0"),
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//    TYPE_JP(IotDeviceDictConst.TYPE_JP, "卷盘"),
+//    TYPE_HT_SFJ(IotDeviceDictConst.TYPE_HT_SFJ, "宏泰水肥机", ServiceNameConst.SERVICE_Ht_SF, IotDeviceTypeLv1Enum.SFJ),
+//    TYPE_BY_SFJ(IotDeviceDictConst.TYPE_BY_SFJ, "博云水肥机", ServiceNameConst.SERVICE_BY_SF, IotDeviceTypeLv1Enum.SFJ),
+//    TYPE_XMZN_PNHJJC(IotDeviceDictConst.TYPE_XMZN_PNHJJC, "小马智农-棚内环境监测", ServiceNameConst.SERVICE_XMZN_ZNDP, IotDeviceTypeLv1Enum.PNHJJC),
+//    TYPE_XMZN_QXZ(IotDeviceDictConst.TYPE_XMZN_QXZ, "小马智农-气象站", ServiceNameConst.SERVICE_XMZN_ZNDP, IotDeviceTypeLv1Enum.QXZ),
+//    TYPE_XMZN_GSSQ(IotDeviceDictConst.TYPE_XMZN_GSSQ, "小马智农-管式墒情", ServiceNameConst.SERVICE_XMZN_ZNDP, IotDeviceTypeLv1Enum.GSSQ),
+//    TYPE_XMZN_JM(IotDeviceDictConst.TYPE_XMZN_JM, "小马智农-卷膜", ServiceNameConst.SERVICE_XMZN_ZNDP, IotDeviceTypeLv1Enum.JM),
+//    TYPE_XMZN_JB(IotDeviceDictConst.TYPE_XMZN_JB, "小马智农-卷被", ServiceNameConst.SERVICE_XMZN_ZNDP, IotDeviceTypeLv1Enum.JB),
+//    TYPE_XMZN_SQZ(IotDeviceDictConst.TYPE_XMZN_SQZ, "小马智农-墒情站", ServiceNameConst.SERVICE_XMZN_ZNDP, IotDeviceTypeLv1Enum.SQZ),
+//    TYPE_RT_XJ(IotDeviceDictConst.TYPE_RT_XJ, "睿瞳相机", IotDeviceTypeLv1Enum.WH_XJ),
+//    TYPE_ZHAO_HE_SFJ(IotDeviceDictConst.TYPE_ZHAO_HE_SFJ, "兆赫水肥机", ServiceNameConst.SERVICE_ZHAO_HE_SF, IotDeviceTypeLv1Enum.SFJ),
+//
+//
+//
+//    TYPE_XPH_SZZX_JC(IotDeviceDictConst.TYPE_XPH_SZZX_JC, "新浦会水质在线监测站", ServiceNameConst.SERVICE_XPH_SZZX_JC, IotDeviceTypeLv1Enum.JZC_SZ_ZX),
+//    TYPE_XPH_LDSW_JC(IotDeviceDictConst.TYPE_XPH_LDSW_JC, "新浦会雷达水位监测站", ServiceNameConst.SERVICE_XPH_LDSW_JC, IotDeviceTypeLv1Enum.JZC_LD_SW),
+//    TYPE_DAHUA_DEVICE(IotDeviceDictConst.TYPE_DAHUA_DEVICE, "大华球形摄像机", ServiceNameConst.SERVICE_DAHUA_ICC, IotDeviceTypeLv1Enum.JKSB),
+//    TYPE_OB_NTSWJ(IotDeviceDictConst.TYPE_OB_NTSWJ, "欧标农田水位计", ServiceNameConst.SERVICE_OB_NTSWJ, IotDeviceTypeLv1Enum.NTSWJ),
+//    TYPE_OB_SZ(IotDeviceDictConst.TYPE_OB_SZ, "欧标水闸设备", ServiceNameConst.SERVICE_OB_SZ, IotDeviceTypeLv1Enum.SZ),
+//
+//    TYPE_XPH_WSHJ_JC(IotDeviceDictConst.TYPE_XPH_WSHJ_JC, "新浦会温室环境监测", ServiceNameConst.SERVICE_XPH_WSHJ_JC, IotDeviceTypeLv1Enum.PNHJJC),
+//
+//    TYPE_XPH_WSKZ(IotDeviceDictConst.TYPE_XPH_WSKZ, "新浦会温室控制", ServiceNameConst.SERVICE_XPH_WSKZ, IotDeviceTypeLv1Enum.WSKZ),
+//
+//    TYPE_YF_GXZW(IotDeviceDictConst.TYPE_YF_GXZW, "根系作物监测", ServiceNameConst.SERVICE_YF_GXZW, IotDeviceTypeLv1Enum.SQZ),
 
     TYPE_XPH_TRSH_CL(IotDeviceDictConst.TYPE_XPH_TRSH_CL, "土壤水势测量", ServiceNameConst.SERVICE_XPH_TRSH_CL, IotDeviceTypeLv1Enum.TRSH_CL),
-
-    TYPE_ZJSF_XYCB(IotDeviceDictConst.TYPE_ZJSF_XYCB, "中捷四方性诱", ServiceNameConst.SERVICE_ZJSF_XYCB, IotDeviceTypeLv1Enum.XYCB),
-    /**
-     * 大数据平台监控设备,用于通过mqtt接收设备定时上报的抓拍图片
-     */
-    TYPE_BIG_DATA_MONITOR_DEVICE(IotDeviceDictConst.TYPE_BIG_DATA_MONITOR_DEVICE, "大数据平台监控设备", ServiceNameConst.SERVICE_BIG_DATA_MONITOR, IotDeviceTypeLv1Enum.JKSB),
-
-    TYPE_HPF_WSMJ_ZNKG(IotDeviceDictConst.TYPE_HPF_WSMJ_ZNKG, "海普发温室灭菌智能开关", ServiceNameConst.SERVICE_HPF_WSMJ_ZNKG, IotDeviceTypeLv1Enum.HPF_WSMJ_ZNKG),
-    TYPE_XPH_GP_QXZ(IotDeviceDictConst.TYPE_XPH_GP_QXZ, "新普惠光谱气象站", ServiceNameConst.SERVICE_XPH_GP_QXZ, IotDeviceTypeLv1Enum.QXZ),
-    TYPE_YR_SF_SERVICE(IotDeviceDictConst.TYPE_YR_SF, "源润水肥机", ServiceNameConst.SERVICE_YR_SF_SERVICE, IotDeviceTypeLv1Enum.YR_SF),
-    TYPE_JSY_ST_QF(IotDeviceDictConst.TYPE_JSY_ST_QF, "及时雨三通球阀", ServiceNameConst.SERVICE_JSY_ST_QF, IotDeviceTypeLv1Enum.QF),
-    TYPE_XPH_GSSQ(IotDeviceDictConst.TYPE_XPH_GSSQ, "新浦会管式墒情", ServiceNameConst.SERVICE_XPH_GSSQ, IotDeviceTypeLv1Enum.GSSQ),
+//    /**
+//     * 大数据平台监控设备,用于通过mqtt接收设备定时上报的抓拍图片
+//     */
+//    TYPE_BIG_DATA_MONITOR_DEVICE(IotDeviceDictConst.TYPE_BIG_DATA_MONITOR_DEVICE, "大数据平台监控设备", ServiceNameConst.SERVICE_BIG_DATA_MONITOR, IotDeviceTypeLv1Enum.JKSB),
+//
+//    TYPE_HPF_WSMJ_ZNKG(IotDeviceDictConst.TYPE_HPF_WSMJ_ZNKG, "海普发温室灭菌智能开关", ServiceNameConst.SERVICE_HPF_WSMJ_ZNKG, IotDeviceTypeLv1Enum.HPF_WSMJ_ZNKG),
+//    TYPE_XPH_GP_QXZ(IotDeviceDictConst.TYPE_XPH_GP_QXZ, "新普惠光谱气象站", ServiceNameConst.SERVICE_XPH_GP_QXZ, IotDeviceTypeLv1Enum.QXZ),
+//    TYPE_YR_SF_SERVICE(IotDeviceDictConst.TYPE_YR_SF, "源润水肥机", ServiceNameConst.SERVICE_YR_SF_SERVICE, IotDeviceTypeLv1Enum.YR_SF),
+//    TYPE_JSY_ST_QF(IotDeviceDictConst.TYPE_JSY_ST_QF, "及时雨三通球阀", ServiceNameConst.SERVICE_JSY_ST_QF, IotDeviceTypeLv1Enum.QF),
+//    TYPE_XPH_GSSQ(IotDeviceDictConst.TYPE_XPH_GSSQ, "新浦会管式墒情", ServiceNameConst.SERVICE_XPH_GSSQ, IotDeviceTypeLv1Enum.GSSQ),
 
     /**
      * 新版本的写道下面
@@ -76,7 +71,7 @@ public enum IotDeviceDictEnum {
     TYPE_YF_CBD(IotDeviceDictConst.TYPE_YF_CBD, "普通测报灯", ServiceNameConst.SERVICE_YF_CBD, IotDeviceTypeLv1Enum.CBD),
     TYPE_YF_GKCBD(IotDeviceDictConst.TYPE_YF_GKCBD, "高空测报灯", ServiceNameConst.SERVICE_YF_GKCBD, IotDeviceTypeLv1Enum.CBD),
     TYPE_YF_SDCBD(IotDeviceDictConst.TYPE_YF_SDCBD, "水稻测报灯", ServiceNameConst.SERVICE_YF_SDCBD, IotDeviceTypeLv1Enum.CBD),
-    TYPE_YF_XCT(IotDeviceDictConst.TYPE_YF_XCT,"吸虫塔",ServiceNameConst.SERVICE_YF_CBD,IotDeviceTypeLv1Enum.CBD),
+    TYPE_YF_XCT(IotDeviceDictConst.TYPE_YF_XCT,"吸虫塔",ServiceNameConst.SERVICE_YF_XCT,IotDeviceTypeLv1Enum.CBD),
 
     TYPE_YF_SCD(IotDeviceDictConst.TYPE_YF_SCD, "云飞普通杀虫灯", ServiceNameConst.SERVICE_YF_SCD, IotDeviceTypeLv1Enum.SCD),
     TYPE_YF_FXSSCD(IotDeviceDictConst.TYPE_YF_FXSSCD, "云飞风吸式杀虫灯", ServiceNameConst.SERVICE_YF_FXSSCD, IotDeviceTypeLv1Enum.SCD),
@@ -89,6 +84,7 @@ public enum IotDeviceDictEnum {
 
     TYPE_YF_SQZ(IotDeviceDictConst.TYPE_YF_SQZ, "云飞-墒情站", ServiceNameConst.SERVICE_YF_SQZ, IotDeviceTypeLv1Enum.SQZ),
     TYPE_XPH_YF_SQZ(IotDeviceDictConst.TYPE_XPH_YF_SQZ, "新普惠-云飞-墒情站", ServiceNameConst.SERVICE_XPH_YF_SQZ, IotDeviceTypeLv1Enum.SQZ),
+    TYPE_XPH_YF_GSSQ(IotDeviceDictConst.TYPE_XPH_YF_GSSQ, "新普惠-云飞-管式墒情", ServiceNameConst.SERVICE_XPH_YF_SQZ, IotDeviceTypeLv1Enum.SQZ),
     TYPE_ADZN_GSSQ(IotDeviceDictConst.TYPE_ADZN_GSSQ, "爱迪智农-管式墒情", ServiceNameConst.SERVICE_ADZN_GSSQ, IotDeviceTypeLv1Enum.SQZ),
 
 
@@ -107,7 +103,10 @@ public enum IotDeviceDictEnum {
     TYPE_YF_L_BZY(IotDeviceDictConst.TYPE_YF_L_BZY, "云飞低端款孢子仪", ServiceNameConst.SERVICE_YF_BZY, IotDeviceTypeLv1Enum.BZY),
 
 
-    TYPE_YF_XYCB_III(IotDeviceDictConst.TYPE_YF_XYCB_III, "云飞-性诱测报灯III", ServiceNameConst.SERVICE_YF_XYCB_III, IotDeviceTypeLv1Enum.XYCB);
+    TYPE_YF_XYCB_III(IotDeviceDictConst.TYPE_YF_XYCB_III, "云飞-性诱测报灯III", ServiceNameConst.SERVICE_YF_XYCB_III, IotDeviceTypeLv1Enum.XYCB),
+    TYPE_ZJSF_XYCB(IotDeviceDictConst.TYPE_ZJSF_XYCB, "中捷四方性诱", ServiceNameConst.SERVICE_ZJSF_XYCB, IotDeviceTypeLv1Enum.XYCB),
+    /**  宁录性诱测报灯 */
+    TYPE_YF_XYCB_2(IotDeviceDictConst.TYPE_YF_XYCB_2, "云飞-性诱测报灯2.0", ServiceNameConst.SERVICE_YF_XYCB_2, IotDeviceTypeLv1Enum.XYCB);
 
     private String code;
     private String name;
@@ -176,8 +175,9 @@ public enum IotDeviceDictEnum {
      * @return
      */
     public String getName() {
-        String typeName = getTypeCoreService().getTypeLv2NameByTypeCode(this.code);
-        return typeName;
+//        String typeName = getTypeCoreService().getTypeLv2NameByTypeCode(this.code);
+//        return typeName;
+        throw new BizException(ErrorCode.FAILURE.getCode(), "该方法不可使用,请见TypeCoreService");
     }
 
     public String getServiceName() {
@@ -200,33 +200,39 @@ public enum IotDeviceDictEnum {
         return null;
     }
 
-    TypeCoreService getTypeCoreService() {
-        TypeCoreService typeCoreService = SpringUtils.getBean(TypeCoreService.class);
-        if (typeCoreService == null) {
-            throw new BizException(ErrorCode.FAILURE.getCode(), "获取typeCoreService需要再bean实例化之后");
-        }
-        return typeCoreService;
-    }
-    /**根据Code查找ServiceName*/
-    public static String findServiceNameByDevTypeBid(String devTypeBid){
-        for(IotDeviceDictEnum item:IotDeviceDictEnum.values()){
-            if(item.getCode().equals(devTypeBid)){
+//    TypeCoreService getTypeCoreService() {
+//        TypeCoreService typeCoreService = SpringUtils.getBean(TypeCoreService.class);
+//        if (typeCoreService == null) {
+//            throw new BizException(ErrorCode.FAILURE.getCode(), "获取typeCoreService需要再bean实例化之后");
+//        }
+//        return typeCoreService;
+//    }
+
+    /**
+     * 根据Code查找ServiceName
+     */
+    public static String findServiceNameByDevTypeBid(String devTypeBid) {
+        for (IotDeviceDictEnum item : IotDeviceDictEnum.values()) {
+            if (item.getCode().equals(devTypeBid)) {
                 return item.getServiceName();
             }
         }
         return "未知类型";
     }
-    /**根据ServiceName查找类型列表*/
-    public static List<String> findDevTypeBidByServiceName(String serviceName){
+
+    /**
+     * 根据ServiceName查找类型列表
+     */
+    public static List<String> findDevTypeBidByServiceName(String serviceName) {
         List<String> devTypeBid = new ArrayList<>();
-        for(IotDeviceDictEnum item:IotDeviceDictEnum.values()){
-            if(item.getServiceName().equals(serviceName)){
+        for (IotDeviceDictEnum item : IotDeviceDictEnum.values()) {
+            if (item.getServiceName().equals(serviceName)) {
                 devTypeBid.add(item.getCode());
             }
         }
-        if(devTypeBid.isEmpty()){
+        if (devTypeBid.isEmpty()) {
             return null;
-        }else{
+        } else {
             return devTypeBid;
         }
     }

+ 2 - 1
src/main/java/com/yunfeiyun/agmp/iot/common/constant/devicetype/ServiceNameConst.java

@@ -114,7 +114,8 @@ public class ServiceNameConst {
     public static final String SERVICE_XYCB = "XYCB-SERVICE";
 
     /**
-     * 云飞性诱测报灯2.0
+     * 云飞性诱测报灯2.0 不带拍照
+     * 宁录性诱测报
      */
     public static final String SERVICE_YF_XYCB_2 = "YF-XYCB-2-SERVICE";
 

+ 1 - 0
src/main/java/com/yunfeiyun/agmp/iot/common/constant/mq/IotActionEnums.java

@@ -9,6 +9,7 @@ public enum IotActionEnums {
     CMD_TASK("CMD_TASK", "控制指令"),
     CMD_TASK_RESULT("CMD_TASK_RESULT", "控制指令结果"),
     IOT_DEVICE_CREATE("DEVICE_CREATE", "设备创建"),
+    IOT_DEVICE_CREATE_BATCH("IOT_DEVICE_CREATE_BATCH", "设备创建"),
     IOT_DEVICE_UPDATE("IOT_DEVICE_UPDATE","设备更新"),
     IOT_DEVICE_DELETE("DEVICE_DELETE", "设备删除"),
     DEVICE_CONN_CREATE("DEVICE_CONN_CREATE", "设备连接信息创建"),

+ 68 - 42
src/main/java/com/yunfeiyun/agmp/iot/common/constant/mqtt/IotMqttConstant.java

@@ -1,6 +1,13 @@
 package com.yunfeiyun.agmp.iot.common.constant.mqtt;
 
 import com.yunfeiyun.agmp.iot.common.constant.devicetype.IotDeviceDictConst;
+import com.yunfeiyun.agmp.iot.common.constant.devicetype.IotDeviceDictEnum;
+import com.yunfeiyun.agmp.iot.common.util.dev.QxzTypeUtil;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * mqtt topic 厂家维护
@@ -160,7 +167,8 @@ public class IotMqttConstant {
     }
 
     /**
-     * 云飞 性诱设备 topic
+     * 云飞 性诱2.0设备 topic
+     * 宁录性诱
      */
     public class YFXycb2Topic {
 
@@ -233,48 +241,66 @@ public class IotMqttConstant {
 
     public static String getReportTopicByDevtype(String devtypeBid){
         String topic = null;
-        if(IotDeviceDictConst.TYPE_YF_SCD.equals(devtypeBid)){
-            topic =  YFCbdTopic.TOPIC_CBD_CMD_PREFIX;
-        }
-        switch (devtypeBid){
-            case IotDeviceDictConst.TYPE_YF_CBD:
-            case IotDeviceDictConst.TYPE_YF_SDCBD:
-            case IotDeviceDictConst.TYPE_YF_GKCBD:
-                topic = YFCbdTopic.TOPIC_CBD_REPORT_PREFIX;
-                break;
-            case IotDeviceDictConst.TYPE_BY_SFJ:
-                topic = BoByunSfTopic.TOPIC_PRE;
-                break;
-            case IotDeviceDictConst.TYPE_YF_SCD:
-            case IotDeviceDictConst.TYPE_YF_FXSSCD:
-            case IotDeviceDictConst.TYPE_YF_JGFXSSCD:
-                topic = YFScdTopic.TOPIC_SCD_REPORT_PREFIX;
-                break;
-            case IotDeviceDictConst.TYPE_YF_BZY:
-            case IotDeviceDictConst.TYPE_YF_L_BZY:
-                topic = YFBzyTopic.TOPIC_BZY_REPORT_PREFIX;
-                break;
-            case IotDeviceDictConst.TYPE_YF_QXZ:
-            case IotDeviceDictConst.TYPE_YF_SQZ:
-                topic = YFQxzTopic.TOPIC_QXZ_REPORT_PREFIX;
-                break;
-            case IotDeviceDictConst.TYPE_YF_XYCB_2:
-                topic = YFXycb2Topic.TOPIC_XYCB_2_REPORT_PREFIX;
-                break;
-            case IotDeviceDictConst.TYPE_XPH_YF_QXZ:
-            case IotDeviceDictConst.TYPE_XPH_YF_SQZ:
-                topic = XphDeviceTopic.TOPIC_XPH_REPORT_PREFIX;
-                break;
-            case IotDeviceDictConst.TYPE_HPF_WSMJ_ZNKG:
-                topic = HpfZnkgTopic.TOPIC_HPF_ZNKG_REPORT_PREFIX;
-                break;
-            case IotDeviceDictConst.TYPE_YR_SF:
-                topic = YrSfTopic.TOPIC_YR_SF_REPORT_PREFIX;
-                break;
-            case IotDeviceDictConst.TYPE_YF_XYCB_III:
-                topic = YFXycbIIITopic.TOPIC_XYCB_III_REPORT_PREFIX;
-                break;
+        if (QxzTypeUtil.isXphYfQxSq(devtypeBid)) {
+            topic = XphDeviceTopic.TOPIC_XPH_REPORT_PREFIX;
+        } else if (QxzTypeUtil.isYfQxSq(devtypeBid)) {
+            topic = YFQxzTopic.TOPIC_QXZ_REPORT_PREFIX;
+        } else{
+            switch (devtypeBid){
+                case IotDeviceDictConst.TYPE_YF_CBD:
+                case IotDeviceDictConst.TYPE_YF_SDCBD:
+                case IotDeviceDictConst.TYPE_YF_GKCBD:
+                case IotDeviceDictConst.TYPE_YF_XCT:
+                    topic = YFCbdTopic.TOPIC_CBD_REPORT_PREFIX;
+                    break;
+                case IotDeviceDictConst.TYPE_BY_SFJ:
+                    topic = BoByunSfTopic.TOPIC_PRE;
+                    break;
+                case IotDeviceDictConst.TYPE_YF_SCD:
+                case IotDeviceDictConst.TYPE_YF_FXSSCD:
+                case IotDeviceDictConst.TYPE_YF_JGFXSSCD:
+                    topic = YFScdTopic.TOPIC_SCD_REPORT_PREFIX;
+                    break;
+                case IotDeviceDictConst.TYPE_YF_BZY:
+                case IotDeviceDictConst.TYPE_YF_L_BZY:
+                    topic = YFBzyTopic.TOPIC_BZY_REPORT_PREFIX;
+                    break;
+                case IotDeviceDictConst.TYPE_YF_XYCB_2:
+                    topic = YFXycb2Topic.TOPIC_XYCB_2_REPORT_PREFIX;
+                    break;
+                case IotDeviceDictConst.TYPE_HPF_WSMJ_ZNKG:
+                    topic = HpfZnkgTopic.TOPIC_HPF_ZNKG_REPORT_PREFIX;
+                    break;
+                case IotDeviceDictConst.TYPE_YR_SF:
+                    topic = YrSfTopic.TOPIC_YR_SF_REPORT_PREFIX;
+                    break;
+                case IotDeviceDictConst.TYPE_YF_XYCB_III:
+                    topic = YFXycbIIITopic.TOPIC_XYCB_III_REPORT_PREFIX;
+                    break;
+            }
         }
         return topic;
     }
+
+    public static List<String> getDevtypeBidList(String devtypeBid){
+        Map<String, String> devtypeBidMap = new HashMap<>();
+        Map<String, ArrayList<String>> devtypeBidListMap = new HashMap<>();
+        for (IotDeviceDictEnum iotDeviceDictEnum : IotDeviceDictEnum.values()) {
+            String bid = iotDeviceDictEnum.getCode();
+            String subTopic = getReportTopicByDevtype(bid);
+            if (subTopic == null) {
+                continue;
+            }
+            devtypeBidMap.put(bid, subTopic);
+            devtypeBidListMap.computeIfAbsent(subTopic, k -> new ArrayList<>()).add(bid);
+        }
+        ArrayList<String> devtypeBidList = new ArrayList<>();
+        String key = devtypeBidMap.get(devtypeBid);
+        if(key == null){
+            devtypeBidList.add(devtypeBid);
+        }else{
+            devtypeBidList = devtypeBidListMap.get(key);
+        }
+        return devtypeBidList;
+    }
 }

+ 26 - 0
src/main/java/com/yunfeiyun/agmp/iot/common/domain/CbdBaseDataEntity.java

@@ -0,0 +1,26 @@
+package com.yunfeiyun.agmp.iot.common.domain;
+
+
+import com.alibaba.fastjson2.JSONObject;
+import lombok.Data;
+
+/**
+ * mongo
+ * 虫情测报基础表, 设备上报数据 用于具体设备继承
+ */
+@Data
+public class CbdBaseDataEntity extends IotBaseEntity{
+
+    public String id;
+
+    public String tid;
+
+    public String cdbdataBid;
+
+    public String devBid;
+
+    public JSONObject cdbdataContent;
+
+    public String cbddataCreatedDate;
+
+}

+ 5 - 158
src/main/java/com/yunfeiyun/agmp/iot/common/domain/FmsBlock.java

@@ -1,11 +1,9 @@
 package com.yunfeiyun.agmp.iot.common.domain;
 
 import com.yunfeiyun.agmp.common.annotation.Excel;
-import com.yunfeiyun.agmp.common.core.domain.BaseEntity;
 import com.yunfeiyun.agmp.common.utils.DictUtils;
 import com.yunfeiyun.agmp.common.utils.StringUtils;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
+import lombok.Data;
 
 import javax.validation.constraints.NotBlank;
 import javax.validation.constraints.NotNull;
@@ -17,7 +15,8 @@ import java.math.BigDecimal;
  * @author 杨晓辉
  * @date 2023-05-15
  */
-public class FmsBlock extends BaseEntity
+@Data
+public class FmsBlock extends IotBaseEntity
 {
     private static final long serialVersionUID = 1L;
 
@@ -87,6 +86,8 @@ public class FmsBlock extends BaseEntity
     /** 地块名称,用于查询时等于 */
     private String blockNameEq;
 
+    private String tid;
+
     public String getBlockTypeContent() {
         if (!StringUtils.isEmpty(this.blockType)) {
             return DictUtils.getDictLabel("fms_block_type", this.blockType);
@@ -95,158 +96,4 @@ public class FmsBlock extends BaseEntity
         }
     }
 
-    public void setBlockTypeContent(String blockTypeContent) {
-        this.blockTypeContent = blockTypeContent;
-    }
-
-    public String getResIds() {
-        return resIds;
-    }
-
-    public void setResIds(String resIds) {
-        this.resIds = resIds;
-    }
-
-    public String getBlockRemark() {
-        return blockRemark;
-    }
-
-    public void setBlockRemark(String blockRemark) {
-        this.blockRemark = blockRemark;
-    }
-
-    public String getBlockPreview() {
-        return blockPreview;
-    }
-
-    public void setBlockPreview(String blockPreview) {
-        this.blockPreview = blockPreview;
-    }
-
-    public void setBlockId(String blockId)
-    {
-        this.blockId = blockId;
-    }
-
-    public String getBlockId()
-    {
-        return blockId;
-    }
-    public void setLandId(String landId)
-    {
-        this.landId = landId;
-    }
-
-    public String getLandId()
-    {
-        return landId;
-    }
-    public void setBlockName(String blockName)
-    {
-        this.blockName = blockName;
-    }
-
-    public String getBlockName()
-    {
-        return blockName;
-    }
-    public void setBlockType(String blockType)
-    {
-        this.blockType = blockType;
-    }
-
-    public String getBlockType()
-    {
-        return blockType;
-    }
-    public void setBlockManager(String blockManager)
-    {
-        this.blockManager = blockManager;
-    }
-
-    public String getBlockManager()
-    {
-        return blockManager;
-    }
-    public void setBlockManagername(String blockManagername)
-    {
-        this.blockManagername = blockManagername;
-    }
-
-    public String getBlockManagername()
-    {
-        return blockManagername;
-    }
-    public void setBlockArea(BigDecimal blockArea)
-    {
-        this.blockArea = blockArea;
-    }
-
-    public BigDecimal getBlockArea()
-    {
-        return blockArea;
-    }
-    public void setBlockAreaplant(BigDecimal blockAreaplant)
-    {
-        this.blockAreaplant = blockAreaplant;
-    }
-
-    public BigDecimal getBlockAreaplant()
-    {
-        return blockAreaplant;
-    }
-    public void setBlockLngrange(String blockLngrange)
-    {
-        this.blockLngrange = blockLngrange;
-    }
-
-    public String getBlockLngrange()
-    {
-        return blockLngrange;
-    }
-    public void setBlockColor(String blockColor)
-    {
-        this.blockColor = blockColor;
-    }
-
-    public String getBlockColor()
-    {
-        return blockColor;
-    }
-
-    public String getBlockNameEq() {
-        return blockNameEq;
-    }
-
-    public void setBlockNameEq(String blockNameEq) {
-        this.blockNameEq = blockNameEq;
-    }
-
-    public Integer getBlockSeq() {
-        return blockSeq;
-    }
-
-    public void setBlockSeq(Integer blockSeq) {
-        this.blockSeq = blockSeq;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
-            .append("blockId", getBlockId())
-            .append("landId", getLandId())
-            .append("blockName", getBlockName())
-            .append("blockType", getBlockType())
-            .append("blockManager", getBlockManager())
-            .append("blockManagername", getBlockManagername())
-            .append("blockArea", getBlockArea())
-            .append("blockAreaplant", getBlockAreaplant())
-            .append("blockLngrange", getBlockLngrange())
-            .append("blockColor", getBlockColor())
-            .append("blockPreview", getBlockPreview())
-            .append("blockRemark", getBlockRemark())
-            .append("resIds", getResIds())
-            .append("blockNameEq", getBlockNameEq())
-            .toString();
-    }
 }

+ 0 - 207
src/main/java/com/yunfeiyun/agmp/iot/common/domain/FmsCrop.java

@@ -1,207 +0,0 @@
-package com.yunfeiyun.agmp.iot.common.domain;
-
-import com.yunfeiyun.agmp.common.annotation.Excel;
-import com.yunfeiyun.agmp.common.core.domain.BaseEntity;
-import com.yunfeiyun.agmp.common.utils.DictUtils;
-import com.yunfeiyun.agmp.common.utils.StringUtils;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-
-import javax.validation.constraints.NotBlank;
-import java.math.BigDecimal;
-
-/**
- * 作物对象 FmsCrop
- * 
- * @author 杨晓辉
- * @date 2023-05-16
- */
-public class FmsCrop extends BaseEntity
-{
-    private static final long serialVersionUID = 1L;
-
-    /** 作物标识 */
-    private String cropId;
-
-    /** 作物名称 */
-    @NotBlank(message = "作物名称不能为空")
-    @Excel(name = "作物名称")
-    private String cropName;
-
-    /** 作物种类 */
-    @Excel(name = "作物种类")
-    private String cropType;
-
-    /** 作物主要类型 */
-    @NotBlank(message = "作物类型不能为空")
-    @Excel(name = "作物主要类型")
-    private String cropMaintype;
-
-    /** 作物推荐状态 */
-    @Excel(name = "作物推荐状态")
-    private String cropRcmdstatus;
-
-    /** 作物预览图 */
-    @Excel(name = "作物预览图")
-    private String cropPreview;
-
-    /** 作物备注 */
-    @Excel(name = "作物备注")
-    private String cropRemark;
-
-    @Excel(name = "地块预览图标识")
-    private String resIds;
-
-    /** 作物主要类型 */
-    @Excel(name = "作物主要类型")
-    private String cropMaintypeContent;
-
-    /** 创建人 */
-    @Excel(name = "创建人")
-    private String cropCreator;
-
-    /** 创建时间 */
-    @Excel(name = "创建时间")
-    private String cropCreateddate;
-
-    @Excel(name = "作物预览图")
-    private String cropVideo;
-    @Excel(name = "地块预览图标识")
-    private String videoIds;
-
-    private BigDecimal cropInitialvalue;
-
-    public String getCropMaintypeContent() {
-        if (!StringUtils.isEmpty(this.cropMaintype)) {
-            return DictUtils.getDictLabel("fms_crop_type", this.cropMaintype);
-        } else {
-            return "";
-        }
-    }
-
-    public String getCropCreator() {
-        return cropCreator;
-    }
-
-    public void setCropCreator(String cropCreator) {
-        this.cropCreator = cropCreator;
-    }
-
-    public String getCropCreateddate() {
-        return cropCreateddate;
-    }
-
-    public void setCropCreateddate(String cropCreateddate) {
-        this.cropCreateddate = cropCreateddate;
-    }
-
-    public String getResIds() {
-        return resIds;
-    }
-
-    public void setResIds(String resIds) {
-        this.resIds = resIds;
-    }
-
-    public void setCropId(String cropId)
-    {
-        this.cropId = cropId;
-    }
-
-    public String getCropId()
-    {
-        return cropId;
-    }
-    public void setCropName(String cropName)
-    {
-        this.cropName = cropName;
-    }
-
-    public String getCropName()
-    {
-        return cropName;
-    }
-    public void setCropType(String cropType)
-    {
-        this.cropType = cropType;
-    }
-
-    public String getCropType()
-    {
-        return cropType;
-    }
-    public void setCropMaintype(String cropMaintype)
-    {
-        this.cropMaintype = cropMaintype;
-    }
-
-    public String getCropMaintype()
-    {
-        return cropMaintype;
-    }
-    public void setCropRcmdstatus(String cropRcmdstatus)
-    {
-        this.cropRcmdstatus = cropRcmdstatus;
-    }
-
-    public String getCropRcmdstatus()
-    {
-        return cropRcmdstatus;
-    }
-    public void setCropPreview(String cropPreview)
-    {
-        this.cropPreview = cropPreview;
-    }
-
-    public String getCropPreview()
-    {
-        return cropPreview;
-    }
-    public void setCropRemark(String cropRemark)
-    {
-        this.cropRemark = cropRemark;
-    }
-
-    public String getCropRemark()
-    {
-        return cropRemark;
-    }
-
-    public String getCropVideo() {
-        return cropVideo;
-    }
-
-    public void setCropVideo(String cropVideo) {
-        this.cropVideo = cropVideo;
-    }
-
-    public String getVideoIds() {
-        return videoIds;
-    }
-
-    public void setVideoIds(String videoIds) {
-        this.videoIds = videoIds;
-    }
-
-    public BigDecimal getCropInitialvalue() {
-        return cropInitialvalue;
-    }
-
-    public void setCropInitialvalue(BigDecimal cropInitialvalue) {
-        this.cropInitialvalue = cropInitialvalue;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
-            .append("cropId", getCropId())
-            .append("cropName", getCropName())
-            .append("cropType", getCropType())
-            .append("cropMaintype", getCropMaintype())
-            .append("cropRcmdstatus", getCropRcmdstatus())
-            .append("cropPreview", getCropPreview())
-            .append("cropRemark", getCropRemark())
-            .append("resIds", getResIds())
-            .toString();
-    }
-}

+ 2 - 2
src/main/java/com/yunfeiyun/agmp/iot/common/domain/FmsLand.java

@@ -1,7 +1,6 @@
 package com.yunfeiyun.agmp.iot.common.domain;
 
 import com.yunfeiyun.agmp.common.annotation.Excel;
-import com.yunfeiyun.agmp.common.core.domain.BaseEntity;
 import lombok.Data;
 
 import javax.validation.constraints.NotBlank;
@@ -15,7 +14,7 @@ import java.math.BigDecimal;
  * @date 2023-05-15
  */
 @Data
-public class FmsLand extends BaseEntity
+public class FmsLand extends IotBaseEntity
 {
     private static final long serialVersionUID = 1L;
 
@@ -83,5 +82,6 @@ public class FmsLand extends BaseEntity
 
     private Integer landSeq;
 
+    private String tid;
 
 }

+ 2 - 15
src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotCbddata.java

@@ -1,9 +1,8 @@
 package com.yunfeiyun.agmp.iot.common.domain;
 
 
-import com.alibaba.fastjson2.JSONObject;
-import lombok.Data;
 import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
 
 /**
  * mongo
@@ -11,18 +10,6 @@ import com.baomidou.mybatisplus.annotation.TableName;
  */
 @Data
 @TableName("IotCbddata")
-public class IotCbddata extends IotBaseEntity{
-
-    private String id;
-
-    private String tid;
-
-    private String cdbdataBid;
-
-    private String devBid;
-
-    private JSONObject cdbdataContent;
-
-    private String cbddataCreatedDate;
+public class IotCbddata extends CbdBaseDataEntity {
 
 }

+ 0 - 42
src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotCbdpest.java

@@ -1,42 +0,0 @@
-package com.yunfeiyun.agmp.iot.common.domain;
-
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.yunfeiyun.agmp.common.annotation.Excel;
-import lombok.Data;
-
-/**
- * 测报灯虫情信息关联对象 IotCbdpest
- *
- * @author 杨晓辉
- * @date 2024-01-04
- */
-@Data
-@TableName("IotCbdpest")
-public class IotCbdpest extends IotBaseEntity
-{
-    private static final long serialVersionUID = 1L;
-
-    /**  */
-    private String id;
-
-    /** 测报灯虫情信息关联表业务标识 */
-    @Excel(name = "测报灯虫情信息关联表业务标识")
-    private String cbdpestBid;
-
-    /** 客户id */
-    @Excel(name = "客户id")
-    private String tid;
-
-    /** 虫情识别信息业务标识 */
-    @Excel(name = "虫情识别信息业务标识")
-    private String pestrecogBid;
-
-    /** 图片识别业务标识 */
-    @Excel(name = "图片识别业务标识")
-    private String cbdrecogBid;
-
-    /** 创建时间 */
-    @Excel(name = "创建时间")
-    private String cbdpestCreatedDate;
-
-}

+ 9 - 0
src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotDevGeoPoint.java

@@ -0,0 +1,9 @@
+package com.yunfeiyun.agmp.iot.common.domain;
+
+import lombok.Data;
+
+@Data
+public class IotDevGeoPoint extends IotBaseEntity {
+    private String type;
+    private double[] coordinates;
+}

+ 5 - 2
src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotDevice.java

@@ -1,10 +1,11 @@
 package com.yunfeiyun.agmp.iot.common.domain;
 
-import java.math.BigDecimal;
 import com.yunfeiyun.agmp.common.annotation.Excel;
-import com.yunfeiyun.agmp.common.core.domain.BaseEntity;
 import lombok.Data;
 
+import java.math.BigDecimal;
+import java.util.List;
+
 /**
  * 设备基础对象 IotDevice
  *
@@ -167,4 +168,6 @@ public class IotDevice extends IotBaseEntity
     private String devSubtype;
     private String devOriginalid;
     private String devHostingstatus;
+
+    private List<String> devtypeBidList;
 }

+ 29 - 0
src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotDeviceGeoLocation.java

@@ -0,0 +1,29 @@
+package com.yunfeiyun.agmp.iot.common.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+@Data
+@TableName("IotDeviceGeoLocation")
+public class IotDeviceGeoLocation extends IotBaseEntity {
+    private String id;
+    private String tid;
+    private String devGeoBid;
+
+    /** 地理位置信息
+     * { type: "Point", coordinates: [ -73.97, 40.77 ] }
+     * */
+    private IotDevGeoPoint devGeoLocation;
+
+    /** 设备地理位置创建时间 */
+    private String devGeoCreateddate;
+
+    /** 设备地理位置更新时间 */
+    private String devGeoUpdateddate;
+
+    /** 设备标识 */
+    private String devBid;
+
+    /** 设备类型标识 */
+    private String devtypeBid;
+}

+ 16 - 0
src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotXctdata.java

@@ -0,0 +1,16 @@
+package com.yunfeiyun.agmp.iot.common.domain;
+
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+/**
+ * mongo
+ * 吸虫塔上报数据
+ * 吸虫塔是测报灯的一种
+ */
+@Data
+@TableName("IotXctdata")
+public class IotXctdata extends CbdBaseDataEntity {
+
+}

+ 3 - 1
src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotXycbimg.java

@@ -25,7 +25,7 @@ public class IotXycbimg extends IotBaseEntity
 
     /** 客户id */
     @Excel(name = "客户id")
-    private String cId;
+    private String tid;
 
     /** 设备业务标识 */
     @Excel(name = "设备业务标识")
@@ -35,6 +35,8 @@ public class IotXycbimg extends IotBaseEntity
     @Excel(name = "原图地址")
     private String xycbimgAddr;
 
+    private String xycbimgOssAddr;
+
     /** 修改时间 */
     @Excel(name = "修改时间")
     private String xycbimgModifieddate;

+ 2 - 1
src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotXyinfo.java

@@ -1,7 +1,6 @@
 package com.yunfeiyun.agmp.iot.common.domain;
 
 import com.yunfeiyun.agmp.common.annotation.Excel;
-import com.yunfeiyun.agmp.common.core.domain.BaseEntity;
 import lombok.Data;
 
 /**
@@ -61,4 +60,6 @@ public class IotXyinfo extends IotBaseEntity
     /** 删除状态 */
     @Excel(name = "删除状态")
     private String xyinfoDelstatus;
+
+    private String tid;
 }

+ 1 - 14
src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotYfXycb2data.java

@@ -1,7 +1,6 @@
 package com.yunfeiyun.agmp.iot.common.domain;
 
 
-import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
@@ -11,18 +10,6 @@ import lombok.Data;
  */
 @Data
 @TableName("IotYfXycb2data")
-public class IotYfXycb2data extends IotBaseEntity{
-
-    private String id;
-
-    private String cId;
-
-    private String xycb2dataBid;
-
-    private String devBid;
-
-    private JSONObject xycb2dataContent;
-
-    private String xycb2dataCreatedDate;
+public class IotYfXycb2data extends IotYfXycbdata {
 
 }

+ 2 - 2
src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotYfXycbIIIdata.java

@@ -6,10 +6,10 @@ import lombok.Data;
 
 /**
  * mongo
- * 性诱测报灯2.0
+ * 性诱测报灯III
  */
 @Data
 @TableName("IotYfXycbIIIdata")
-public class IotYfXycbIIIdata extends IotYfXycbdata{
+public class IotYfXycbIIIdata extends IotYfXycbdata {
 
 }

+ 1 - 14
src/main/java/com/yunfeiyun/agmp/iot/common/domain/IotZjsfXycbdata.java

@@ -1,7 +1,6 @@
 package com.yunfeiyun.agmp.iot.common.domain;
 
 
-import com.alibaba.fastjson2.JSONObject;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
@@ -11,18 +10,6 @@ import lombok.Data;
  */
 @Data
 @TableName("IotZjsfXycbdata")
-public class IotZjsfXycbdata extends IotBaseEntity{
-
-    private String id;
-
-    private String tid;
-
-    private String xycbdataBid;
-
-    private String devBid;
-
-    private JSONObject xycbdataContent;
-
-    private String xycbdataCreatedDate;
+public class IotZjsfXycbdata extends IotYfXycbdata {
 
 }

+ 3 - 2
src/main/java/com/yunfeiyun/agmp/iot/common/domain/TmnBlock.java

@@ -1,7 +1,6 @@
 package com.yunfeiyun.agmp.iot.common.domain;
 
 import com.yunfeiyun.agmp.common.annotation.Excel;
-import com.yunfeiyun.agmp.common.core.domain.BaseEntity;
 import lombok.Data;
 
 /**
@@ -11,7 +10,7 @@ import lombok.Data;
  * @date 2023-07-12
  */
 @Data
-public class TmnBlock extends BaseEntity
+public class TmnBlock extends IotBaseEntity
 {
     private static final long serialVersionUID = 1L;
 
@@ -33,4 +32,6 @@ public class TmnBlock extends BaseEntity
     /** 设备地块分配时间 */
     @Excel(name = "设备地块分配时间")
     private String tmnblockAssigndate;
+
+    private String tid;
 }

+ 4 - 50
src/main/java/com/yunfeiyun/agmp/iot/common/domain/TmnLand.java

@@ -1,9 +1,7 @@
 package com.yunfeiyun.agmp.iot.common.domain;
 
 import com.yunfeiyun.agmp.common.annotation.Excel;
-import com.yunfeiyun.agmp.common.core.domain.BaseEntity;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
+import lombok.Data;
 
 /**
  * 设备基地对象 TmnLand
@@ -11,7 +9,8 @@ import org.apache.commons.lang3.builder.ToStringStyle;
  * @author 杨晓辉
  * @date 2023-07-12
  */
-public class TmnLand extends BaseEntity
+@Data
+public class TmnLand extends IotBaseEntity
 {
     private static final long serialVersionUID = 1L;
 
@@ -30,50 +29,5 @@ public class TmnLand extends BaseEntity
     @Excel(name = "设备基地分配时间")
     private String tmnlandAssigndate;
 
-    public void setTmnlandId(String tmnlandId)
-    {
-        this.tmnlandId = tmnlandId;
-    }
-
-    public String getTmnlandId()
-    {
-        return tmnlandId;
-    }
-    public void setTmnId(String tmnId)
-    {
-        this.tmnId = tmnId;
-    }
-
-    public String getTmnId()
-    {
-        return tmnId;
-    }
-    public void setLandId(String landId)
-    {
-        this.landId = landId;
-    }
-
-    public String getLandId()
-    {
-        return landId;
-    }
-    public void setTmnlandAssigndate(String tmnlandAssigndate)
-    {
-        this.tmnlandAssigndate = tmnlandAssigndate;
-    }
-
-    public String getTmnlandAssigndate()
-    {
-        return tmnlandAssigndate;
-    }
-
-    @Override
-    public String toString() {
-        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
-            .append("tmnlandId", getTmnlandId())
-            .append("tmnId", getTmnId())
-            .append("landId", getLandId())
-            .append("tmnlandAssigndate", getTmnlandAssigndate())
-            .toString();
-    }
+    private String tid;
 }

+ 4 - 0
src/main/java/com/yunfeiyun/agmp/iot/common/domain/TosDevicetype.java

@@ -40,6 +40,10 @@ public class TosDevicetype extends IotBaseEntity {
     @Excel(name = "型号图示")
     private String devtypePreview;
 
+    /** 型号地图图标 */
+    @Excel(name = "型号地图图标")
+    private String devtypeMapicon;
+
     /** 备注 */
     @Excel(name = "备注")
     private String devtypeRemark;

+ 12 - 0
src/main/java/com/yunfeiyun/agmp/iot/common/domain/dto/MgUpdateBatchDto.java

@@ -0,0 +1,12 @@
+package com.yunfeiyun.agmp.iot.common.domain.dto;
+
+import lombok.Data;
+import org.springframework.data.mongodb.core.query.Query;
+
+import java.util.Map;
+
+@Data
+public class MgUpdateBatchDto {
+    private Query query;
+    private Map<String, Object> updateField;
+}

+ 3 - 1
src/main/java/com/yunfeiyun/agmp/iot/common/domain/reqvo/IotCbdConfigEditReqVo.java

@@ -1,11 +1,13 @@
 package com.yunfeiyun.agmp.iot.common.domain.reqvo;
 
+import com.yunfeiyun.agmp.iot.common.domain.IotDevice;
 import com.yunfeiyun.agmp.iot.common.domain.device.config.IotCbdConfig;
 import lombok.Data;
 
 @Data
 public class IotCbdConfigEditReqVo {
-    private String cdbdataBid;
+    private IotDevice iotDevice;
+    private String devBid;
     private IotCbdConfig iotCbdConfig;
 
 }

+ 0 - 10
src/main/java/com/yunfeiyun/agmp/iot/common/domain/reqvo/IotCbddataReqVo.java

@@ -1,10 +0,0 @@
-package com.yunfeiyun.agmp.iot.common.domain.reqvo;
-
-import com.yunfeiyun.agmp.iot.common.domain.IotCbddata;
-import lombok.Data;
-
-@Data
-public class IotCbddataReqVo extends IotCbddata {
-    private String startDate;
-    private String endDate;
-}

+ 2 - 0
src/main/java/com/yunfeiyun/agmp/iot/common/domain/reqvo/IotCbdrecogAgainReqVo.java

@@ -29,4 +29,6 @@ public class IotCbdrecogAgainReqVo
     /** 设备标识 */
     private String devBid;
 
+    private String devtypeBid;
+
 }

+ 2 - 1
src/main/java/com/yunfeiyun/agmp/iot/common/enums/EnumYfQxzElement.java

@@ -79,7 +79,8 @@ public enum EnumYfQxzElement {
     TYPE72("257","透明度","NTU"),
     TYPE73("211","电导率","mS/cm"),
     TYPE74("220","土壤电导率","mS/cm")/*新浦会-土壤水势*/,
-    TYPE75("277","土壤水势","KPa")/*新浦会-土壤水势,  跟201重复了,废弃201 */;
+    TYPE75("277","土壤水势","KPa")/*新浦会-土壤水势,  跟201重复了,废弃201 */,
+    TYPE223("223","溶解氧","mg/L");
 
     private String eNum;
     private String cName;

+ 4 - 1
src/main/java/com/yunfeiyun/agmp/iot/common/enums/YfqxzEnumFactor.java

@@ -80,7 +80,10 @@ public enum YfqxzEnumFactor {
     TYPE73("211","电导率","uS/cm"),
     TYPE74("220","土壤电导率","uS/cm"),
     TYPE75("232","二氧化氮","PPM"),
-    TYPE178("178","电导率","uS/cm");
+    TYPE178("178","电导率","uS/cm"),
+    TYPE223("223","溶解氧","mg/L");
+
+
 
 
     private String code;

+ 0 - 115
src/main/java/com/yunfeiyun/agmp/iot/common/service/DeviceconnCacheService.java

@@ -1,115 +0,0 @@
-package com.yunfeiyun.agmp.iot.common.service;
-
-import com.alibaba.fastjson2.JSON;
-import com.alibaba.fastjson2.JSONArray;
-import com.alibaba.fastjson2.JSONObject;
-import com.yunfeiyun.agmp.common.enums.RedisCacheKey;
-import com.yunfeiyun.agmp.iot.common.constant.IotErrorCode;
-import com.yunfeiyun.agmp.iot.common.domain.IotDevice;
-import com.yunfeiyun.agmp.iot.common.domain.IotDeviceconn;
-import com.yunfeiyun.agmp.iot.common.exception.IotBizException;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.stereotype.Service;
-import javax.annotation.Resource;
-import java.util.Set;
-
-@Service
-@Slf4j
-public class DeviceconnCacheService {
-    @Resource
-    private RedisTemplate redisTemplate;
-
-    public void setCache(IotDeviceconn iotDeviceconn){
-        log.error("【设备连接缓存】保存设备连接信息缓存,设备链接信息标识:{}",iotDeviceconn.getDevconnBid());
-        redisTemplate.opsForValue().set(getKey(RedisCacheKey.IOT_DEVICE_CONN)+iotDeviceconn.getDevconnBid(),iotDeviceconn);
-    }
-    public void deleteCache(IotDeviceconn iotDeviceconn){
-        log.error("【设备连接缓存】删除设备连接信息缓存,设备链接信息标识:{}",iotDeviceconn.getDevconnBid());
-        redisTemplate.delete(getKey(RedisCacheKey.IOT_DEVICE_CONN)+iotDeviceconn.getDevconnBid());
-    }
-    public IotDeviceconn getIotDeviceConnByDevconnBid(String devconnBid){
-        log.error("【设备连接缓存】查询设备连接信息,设备连接标识为:{}",devconnBid);
-        // 首先查询出当前设备的连接信息
-        IotDeviceconn iotDeviceconn = (IotDeviceconn) redisTemplate.opsForValue().get(getKey(RedisCacheKey.IOT_DEVICE_CONN)+devconnBid);
-        if(null == iotDeviceconn){
-            log.error("【设备连接缓存】查询设备连接信息失败,设备连接标识为:{}",devconnBid);
-            throw new IotBizException(IotErrorCode.INVALID_DEVICE_CONN_BID);
-        }
-        return iotDeviceconn;
-    }
-
-    public IotDeviceconn getIotDeviceConnByIotDevice(IotDevice iotDevice){
-        return this.getIotDeviceConnByDevconnBid(iotDevice.getDevconnBid());
-    }
-    private String getKey(RedisCacheKey redisCacheKey){
-        return redisCacheKey.getPrefix() + ":" + redisCacheKey.getModuleType() + ":" + redisCacheKey.getName()+":";
-    }
-    /**
-     * 【mqtt】 通过设备连接标识获取mqtt链接标识
-     * */
-    public String getMqttConnectIdByDeviceConnBid(String devconnBid){
-        log.error("【设备连接缓存】查询mqtt链接标识,设备连接标识为:{}",devconnBid);
-        String connectId = (String) redisTemplate.opsForValue().get(getKey(RedisCacheKey.IOT_DEVICE_CONN_MQTT_ID)+devconnBid);
-        if(null == connectId){
-            log.error("【设备连接缓存】查询mqtt链接标识失败,设备连接标识为:{}",devconnBid);
-            throw new IotBizException(IotErrorCode.INVALID_DEVICE_CONN_BID);
-        }
-        return connectId;
-    }
-    /**
-     * 【mqtt】 关联设备连接标识和mqtt链接标识
-     * */
-    public void setMqttConnectionIdByConnBid(String devconnBid,String connectionId){
-        redisTemplate.opsForList().leftPush(getKey(RedisCacheKey.IOT_MQTT_DEVICE_CONN_BID_LIST)+connectionId,devconnBid);
-        redisTemplate.opsForValue().set(getKey(RedisCacheKey.IOT_DEVICE_CONN_MQTT_ID)+devconnBid,connectionId);
-    }
-    /**
-     * 【mqtt】删除mqtt链接标识
-     * */
-    public void deleteMqttConnectionId(String devconnBid){
-        redisTemplate.opsForList().remove(getKey(RedisCacheKey.IOT_MQTT_DEVICE_CONN_BID_LIST)+getMqttConnectIdByDeviceConnBid(devconnBid),1,devconnBid);
-        redisTemplate.delete(getKey(RedisCacheKey.IOT_DEVICE_CONN_MQTT_ID)+devconnBid);
-    }
-    /**
-     * 【mqtt】判定mqtt链接标识是否还有绑定的设备连接标识
-     * */
-    public boolean mqttConnectionIdHasLink(String connectionId){
-       return redisTemplate.hasKey(getKey(RedisCacheKey.IOT_MQTT_DEVICE_CONN_BID_LIST)+connectionId);
-    }
-    /**
-     * 【http】保存租户的http通用连接信息
-     * */
-    public void setHttpCommonConnectionByDevtypeCode(String devconnBid,String devtypeCode){
-        redisTemplate.opsForList().leftPush(getKey(RedisCacheKey.IOT_HTTP_DEVICE_CONN_BID_LIST)+devtypeCode,devconnBid);
-    }
-    /**
-     * 【http】删除租户的http通用连接信息
-     * */
-    public void deleteMqttConnectionId(String devconnBid,String devtypeCode){
-        redisTemplate.opsForList().remove(getKey(RedisCacheKey.IOT_HTTP_DEVICE_CONN_BID_LIST)+devtypeCode,1,devconnBid);
-    }
-    /**
-     * 【http】判定http通用连接是否还有绑定的设备连接
-     * */
-    public boolean httpConnectionBidHasLink(String devtypeCode){
-       return redisTemplate.hasKey(getKey(RedisCacheKey.IOT_MQTT_DEVICE_CONN_BID_LIST)+devtypeCode);
-    }
-
-
-    public void cleanCache(){
-        // Mqtt设备连接数据标识列表
-        cleanCache(RedisCacheKey.IOT_MQTT_DEVICE_CONN_BID_LIST);
-        // Mqtt设备链接标识
-        cleanCache(RedisCacheKey.IOT_DEVICE_CONN_MQTT_ID);
-        // Mqtt设备连接信息标识
-        cleanCache(RedisCacheKey.IOT_DEVICE_CONN);
-    }
-    public void cleanCache(RedisCacheKey redisCacheKey){
-        Set<String> keySet = redisTemplate.keys(getKey(redisCacheKey)+"*");
-        for(String key : keySet){
-            redisTemplate.delete(key);
-        }
-    }
-
-}

+ 24 - 0
src/main/java/com/yunfeiyun/agmp/iot/common/service/IotDeviceGeoLocationCommonService.java

@@ -0,0 +1,24 @@
+package com.yunfeiyun.agmp.iot.common.service;
+
+import com.yunfeiyun.agmp.iot.common.domain.IotDevice;
+import com.yunfeiyun.agmp.iot.common.domain.IotDeviceGeoLocation;
+
+import java.util.List;
+
+public interface IotDeviceGeoLocationCommonService {
+    /**
+     * 插入数据
+     */
+    public void insertBatchData(List<IotDeviceGeoLocation> dataList);
+
+    /**
+     * 更新数据
+     */
+    public void updateBatchData(List<IotDeviceGeoLocation> dataList);
+
+    public void insertOrUpdateBatchData(List<IotDevice> iotDeviceList);
+
+    public List<IotDeviceGeoLocation> selectByDevBidList(List<String> devBidList);
+
+    public void deleteByDevBidList(List<String> devBidList);
+}

+ 0 - 23
src/main/java/com/yunfeiyun/agmp/iot/common/service/IotMqttTopicCacheService.java

@@ -1,23 +0,0 @@
-package com.yunfeiyun.agmp.iot.common.service;
-
-import com.yunfeiyun.agmp.common.enums.RedisCacheKey;
-import com.yunfeiyun.agmp.common.framework.manager.RedisCacheManager;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.Set;
-
-@Service
-public class IotMqttTopicCacheService {
-
-    private static final String KEY_ID = "all";
-
-    @Autowired
-    private RedisCacheManager redisCacheManager;
-
-    public void refreshTopicCache(Set<String> topicSet){
-        redisCacheManager.setCacheSet(RedisCacheKey.IOT_MQTT_DEVICE_TOPIC_SET, KEY_ID, topicSet);
-    }
-
-
-}

+ 97 - 3
src/main/java/com/yunfeiyun/agmp/iot/common/service/MongoService.java

@@ -7,10 +7,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.mongodb.client.ListIndexesIterable;
 import com.mongodb.client.MongoCollection;
 import com.mongodb.client.model.IndexModel;
+import com.mongodb.client.result.UpdateResult;
 import com.yunfeiyun.agmp.common.core.page.PageDomain;
 import com.yunfeiyun.agmp.common.utils.DateUtils;
 import com.yunfeiyun.agmp.common.utils.JSONUtils;
 import com.yunfeiyun.agmp.common.utils.StringUtils;
+import com.yunfeiyun.agmp.iot.common.domain.dto.MgUpdateBatchDto;
 import lombok.Data;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.http.util.TextUtils;
@@ -21,8 +23,10 @@ import org.bson.conversions.Bson;
 import org.bson.types.ObjectId;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.domain.Sort;
+import org.springframework.data.mongodb.core.BulkOperations;
 import org.springframework.data.mongodb.core.MongoTemplate;
 import org.springframework.data.mongodb.core.aggregation.*;
+import org.springframework.data.mongodb.core.index.GeospatialIndex;
 import org.springframework.data.mongodb.core.query.Criteria;
 import org.springframework.data.mongodb.core.query.Query;
 import org.springframework.data.mongodb.core.query.Update;
@@ -32,6 +36,8 @@ import org.springframework.stereotype.Service;
 import java.util.*;
 import java.util.regex.Pattern;
 
+import static org.springframework.data.mongodb.core.index.GeoSpatialIndexType.GEO_2DSPHERE;
+
 @Data
 class AggregateTotalBean{
     private int total;
@@ -167,6 +173,26 @@ public class  MongoService<T>{
         mongoTemplate.updateFirst(query, update, annotation.value());
     }
 
+    public int updateMulti(Class<T> entity, Query query, Map<String, Object> updateField) {
+        if (query == null) {
+            throw new RuntimeException("query 不可为空");
+        }
+        TableName annotation = entity.getAnnotation(TableName.class);
+        if (annotation == null || StringUtils.isEmpty(annotation.value())) {
+            throw new RuntimeException(entity.getName() + "未被@TableName修饰或value为空");
+        }
+        Update update = new Update();
+        //设置遍历值
+        updateField.forEach((key, value) -> {
+            //忽略空值
+            if (value != null) {
+                update.set(key, value);
+            }
+        });
+        UpdateResult updateResult = mongoTemplate.updateMulti(query, update, annotation.value());
+        return (int) updateResult.getModifiedCount();
+    }
+
     /**
      * 根据参数查询全部数据
      *
@@ -194,6 +220,7 @@ public class  MongoService<T>{
         //设置查询
         Query query = new Query(getCriteria(params));
         query = processOrderby(query,orderBy);
+        query.allowDiskUse(true);
         return mongoTemplate.find(query, entity, annotation.value());
     }
 
@@ -329,11 +356,9 @@ public class  MongoService<T>{
      * @return
      */
     public IPage<T> findListPage(Class<T> entity, Map params, PageDomain queryRequest) {
-        Page<T> iPage = new Page<>(queryRequest.getPageNum(), queryRequest.getPageSize());
         TableName tableName = entity.getAnnotation(TableName.class);
         String collName = tableName.value();
-        int pageSize = queryRequest.getPageSize();
-        int pageNum = queryRequest.getPageNum();
+
         //设置参数查询
         Query query = new Query(getCriteria(params));
         //log.debug(query.getQueryObject().toString());
@@ -342,10 +367,19 @@ public class  MongoService<T>{
         if (!StringUtils.isEmpty(field)) {
             query.with(Sort.by(getOrder(queryRequest)));
         }
+
         //设置总数
         long count = mongoTemplate.count(query, entity, collName);
         //log.debug("共"+count+" 条记录");
+
+        int pageSize = (int) count;
+        int pageNum = 1;
         //分页计算
+        if(queryRequest.getPage()){
+            pageSize = queryRequest.getPageSize();
+            pageNum = queryRequest.getPageNum();
+        }
+        Page<T> iPage = new Page<>(pageNum, pageSize);
         int pages = (int) Math.ceil((double) count / (double) pageSize);
         if (pageNum <= 0 || pageNum > pages) {
             iPage.setRecords(new ArrayList<>());
@@ -650,5 +684,65 @@ public class  MongoService<T>{
             collection.createIndexes(indexModelListCreate);
         }
     }
+
+    public void createGeoIndexes(Class<T> entity, List<IndexModel> indexModelList) {
+        TableName annotation = entity.getAnnotation(TableName.class);
+        String tableName = annotation.value();
+        if(!mongoTemplate.collectionExists(tableName)){
+            mongoTemplate.createCollection(tableName);
+        }
+        MongoCollection<Document> collection = mongoTemplate.getCollection(tableName);
+        ListIndexesIterable<Document> indexInfoList = collection.listIndexes();
+        Set<String> indexNameSet = new HashSet<>();
+        for (Document indexInfo : indexInfoList) {
+            indexNameSet.add(indexInfo.getString("name"));
+        }
+        log.info("{} 已存在索引: {}", tableName, indexNameSet);
+        List<String> geoIndexNameList = new ArrayList<>();
+        for(IndexModel indexModel : indexModelList) {
+            Bson keys = indexModel.getKeys();
+            BsonDocument bsonDocument = keys.toBsonDocument();
+            for (Map.Entry<String, BsonValue> entry : bsonDocument.entrySet()) {
+                String indexName = entry.getKey();
+                String key = indexName + "_2dsphere";
+                if(!indexNameSet.contains(key)) {
+                    geoIndexNameList.add(indexName);
+                    log.info("创建mongodb {} 索引: {}", tableName, indexName);
+                }
+            }
+
+        }
+        for(String indexName : geoIndexNameList){
+            GeospatialIndex geoIndex = new GeospatialIndex(indexName).typed(GEO_2DSPHERE);
+            mongoTemplate.indexOps(tableName).ensureIndex(geoIndex);
+        }
+    }
+
+    public void updateBatch(Class<T> entity, List<MgUpdateBatchDto> updateBatchDtoList) {
+        TableName annotation = entity.getAnnotation(TableName.class);
+        if (annotation == null || StringUtils.isEmpty(annotation.value())) {
+            throw new RuntimeException(entity.getName() + "未被@TableName修饰或value为空");
+        }
+        /**
+         * 不得用entity实体,会自动将类名转换为小写开头的表名
+         */
+        BulkOperations operations = mongoTemplate.bulkOps(BulkOperations.BulkMode.UNORDERED, annotation.value());
+        for(MgUpdateBatchDto updateBatchDto : updateBatchDtoList) {
+            Query query = updateBatchDto.getQuery();
+            Map<String, Object> updateField = updateBatchDto.getUpdateField();
+            if (query == null || updateField == null || updateField.isEmpty()) {
+                throw new RuntimeException("query 或 更新内容 不可为空");
+            }
+            Update update = new Update();
+            updateField.forEach((key, value) -> {
+                //忽略空值
+                if (value != null) {
+                    update.set(key, value);
+                }
+            });
+            operations.updateOne(query, update);
+        }
+        operations.execute();
+    }
 }
 

+ 0 - 73
src/main/java/com/yunfeiyun/agmp/iot/common/service/TypeCacheService.java

@@ -1,73 +0,0 @@
-package com.yunfeiyun.agmp.iot.common.service;
-
-import com.alibaba.fastjson2.JSONObject;
-import com.yunfeiyun.agmp.common.enums.RedisCacheKey;
-import com.yunfeiyun.agmp.common.framework.manager.RedisCacheManager;
-import com.yunfeiyun.agmp.iot.common.constant.IotErrorCode;
-import com.yunfeiyun.agmp.iot.common.constant.devicetype.IotDeviceDictEnum;
-import com.yunfeiyun.agmp.iot.common.domain.TosDevicetype;
-import com.yunfeiyun.agmp.iot.common.exception.IotBizException;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.Resource;
-
-/**
- * 统一维护type(lv2)的缓存,增删改查
- */
-@Service
-public class TypeCacheService {
-
-    @Resource
-    private RedisTemplate redisTemplate;
-
-    public void setCache(TosDevicetype tosDevicetype){
-        redisTemplate.opsForValue().set(getKey(RedisCacheKey.IOT_DEVICE_TYPE)+tosDevicetype.getDevtypeBid(),tosDevicetype);
-        redisTemplate.opsForValue().set(getKey(RedisCacheKey.IOT_DEVICE_TYPE)+tosDevicetype.getDevtypeCode(),tosDevicetype);
-    }
-    public void deleteCache(TosDevicetype tosDevicetype){
-        redisTemplate.delete(getKey(RedisCacheKey.IOT_DEVICE_TYPE)+tosDevicetype.getDevtypeBid());
-        redisTemplate.delete(getKey(RedisCacheKey.IOT_DEVICE_TYPE)+tosDevicetype.getDevtypeCode());
-    }
-
-    public TosDevicetype getCacheObjectByDevTypeCode(String devtypeCode){
-        Object tosDevicetype = redisTemplate.opsForValue().get(getKey(RedisCacheKey.IOT_DEVICE_TYPE)+devtypeCode);
-        if(null == tosDevicetype){
-            throw new IotBizException(IotErrorCode.CACHE_NOT_FOUNT);
-        }
-        return JSONObject.parseObject(JSONObject.toJSONString(tosDevicetype), TosDevicetype.class);
-    }
-    public TosDevicetype getCacheObjectByDevTypeBid(String devtypeBid){
-        Object tosDevicetype = redisTemplate.opsForValue().get(getKey(RedisCacheKey.IOT_DEVICE_TYPE)+devtypeBid);
-        if(null == tosDevicetype){
-            throw new IotBizException(IotErrorCode.CACHE_NOT_FOUNT);
-        }
-        return JSONObject.parseObject(JSONObject.toJSONString(tosDevicetype), TosDevicetype.class);
-    }
-    public String getServiceNameByDevTypeCode(String devtypeCode){
-        if(null == devtypeCode){
-            throw new IotBizException(IotErrorCode.INVALID_DEVICE_TYPE);
-        }
-        IotDeviceDictEnum iotDeviceDictEnum = IotDeviceDictEnum.findEnumByCode(devtypeCode);
-        if(null == iotDeviceDictEnum){
-            throw new IotBizException(IotErrorCode.INVALID_DEVICE_TYPE);
-        }
-        return iotDeviceDictEnum.getServiceName();
-    }
-    public String getServiceNameByDevTypeBid(String devtypeBid){
-        TosDevicetype tosDevicetype = this.getCacheObjectByDevTypeBid(devtypeBid);
-        if(null == tosDevicetype){
-            throw new IotBizException(IotErrorCode.INVALID_DEVICE_TYPE);
-        }
-        IotDeviceDictEnum iotDeviceDictEnum = IotDeviceDictEnum.findEnumByCode(tosDevicetype.getDevtypeCode());
-        if(null == iotDeviceDictEnum){
-            throw new IotBizException(IotErrorCode.INVALID_DEVICE_TYPE);
-        }
-        return iotDeviceDictEnum.getServiceName();
-    }
-    
-    private String getKey(RedisCacheKey redisCacheKey){
-        return redisCacheKey.getPrefix() + ":" + redisCacheKey.getModuleType() + ":" + redisCacheKey.getName()+":";
-    }
-
-}

+ 0 - 31
src/main/java/com/yunfeiyun/agmp/iot/common/service/TypeCoreService.java

@@ -1,31 +0,0 @@
-package com.yunfeiyun.agmp.iot.common.service;
-
-import com.yunfeiyun.agmp.iot.common.domain.TosDevicetype;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-/**
- * 负责型号相关操作,用来替换之前的枚举写死的name获取相关
- * 如果其他的,自行处理
- */
-@Service
-public class TypeCoreService {
-
-    @Autowired
-    private TypeCacheService typeCacheService;
-
-    /**
-     * 获取型号(二级)的名称根据他的code
-     *
-     * @return
-     */
-    public String getTypeLv2NameByTypeCode(String typeCode) {
-        // 从缓存取出来
-        return getLv2ModelByLv2Code(typeCode).getDevtypeName();
-    }
-
-    public TosDevicetype getLv2ModelByLv2Code(String typeCode) {
-        return typeCacheService.getCacheObjectByDevTypeCode(typeCode);
-    }
-
-}

+ 47 - 4
src/main/java/com/yunfeiyun/agmp/iot/common/service/YfCbdRecogeService.java

@@ -4,6 +4,7 @@ import cn.hutool.http.Header;
 import cn.hutool.http.HttpRequest;
 import cn.hutool.http.HttpUtil;
 import com.alibaba.fastjson2.JSONObject;
+import com.yunfeiyun.agmp.iot.common.util.dev.XctToCbdUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
 
@@ -16,9 +17,12 @@ public class YfCbdRecogeService {
     private static String username = "软件事业部专用";
     private static String password = "2024@yfkj!@#$";
 
-    private static String recogeUrlByA = "http://8.136.98.49:8002/identify/9143";
+    private static String recogeUrlByCbdA = "http://8.136.98.49:8002/identify/9143";
 
-    private static String recogeUrlByB = "http://8.136.98.49:8002/identify/9153";
+    private static String recogeUrlByCbdB = "http://8.136.98.49:8002/identify/9153";
+
+//    private static String recogeUrlByXct = "https://web.hnyfwlw.com:58002/identify/20222";
+    private static String recogeUrlByXct = "http://8.136.98.49:8002/identify/20222";
 
     public byte[] getImgBytes(String imgUrl){
         return HttpUtil.downloadBytes(imgUrl);
@@ -34,11 +38,37 @@ public class YfCbdRecogeService {
         return jsonObject.getJSONObject("data");
     }
 
+    private JSONObject getXctRecogeResult(String content) {
+        JSONObject jsonObject = JSONObject.parseObject(content);
+        log.info("[云飞吸虫塔手动识别服务]: 识别结果:{}", jsonObject);
+        if (jsonObject.getIntValue("code") != 0){
+            log.error("[云飞吸虫塔手动识别服务]: 识别失败,错误信息:{}", jsonObject);
+            throw new RuntimeException("识别失败,请检查图片是否正确");
+        }
+        JSONObject rspData = jsonObject.getJSONObject("data");
+//        {
+//            "device_id": "15f6713a39ed8a4d",
+//                "return_string": "4,1",
+//                "label": "[{'4': [5852, 1412, 6431, 1980, 0.86]}]",
+//                "create_time": "1739146312",
+//                "img": "https://web.hnyfwlw.com:58003/Basics/xct/15f6713a39ed8a4d/2025/2/10/15f6713a39ed8a4d-20250210-081122-3000.000000.jpg"}
+//
+        JSONObject resultData = new JSONObject();
+        resultData.put("device_id", "");
+        resultData.put("return_string", rspData.getString("returnString"));
+        resultData.put("label", rspData.getString("returnCode"));
+        resultData.put("create_time", "");
+        resultData.put("img", rspData.getString("returnImageUrl"));
+
+
+        return XctToCbdUtil.xctToCbdData(resultData);
+    }
+
     public JSONObject getRecogeResultByA(String imgUrl){
         String[] pathTemp = imgUrl.split("/");
         String fileName = pathTemp[pathTemp.length - 1];
         byte[] fileBytes = getImgBytes(imgUrl);
-        HttpRequest request = HttpUtil.createPost(recogeUrlByA);
+        HttpRequest request = HttpUtil.createPost(recogeUrlByCbdA);
         request.basicAuth(username, password);
         request.form("imageFile", fileBytes, fileName);
         String response = request.execute().body();
@@ -49,7 +79,7 @@ public class YfCbdRecogeService {
         String[] pathTemp = imgUrl.split("/");
         String fileName = pathTemp[pathTemp.length - 1];
         byte[] fileBytes = getImgBytes(imgUrl);
-        HttpRequest request = HttpUtil.createPost(recogeUrlByB);
+        HttpRequest request = HttpUtil.createPost(recogeUrlByCbdB);
         request.header(Header.USER_AGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36");
         request.basicAuth(username, password);
         request.contentType("multipart/form-data");
@@ -58,6 +88,19 @@ public class YfCbdRecogeService {
         return getRecogeResult(response);
     }
 
+    public JSONObject getRecogeResultByXct(String imgUrl){
+        String[] pathTemp = imgUrl.split("/");
+        String fileName = pathTemp[pathTemp.length - 1];
+        byte[] fileBytes = getImgBytes(imgUrl);
+        HttpRequest request = HttpUtil.createPost(recogeUrlByXct);
+        request.header(Header.USER_AGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36");
+        request.basicAuth(username, password);
+        request.contentType("multipart/form-data");
+        request.form("imageFile", fileBytes, fileName);
+        String response = request.execute().body();
+        return getXctRecogeResult(response);
+    }
+
 //    public static void main(String[] args) {
 //        YfCbdRecogeService service = new YfCbdRecogeService();
 //        JSONObject result = service.getRecogeResultByA("https://web.hnyfwlw.com:58003/Basics/cbd/864865062128484/2024/9/29/864865062128484-20240929-004951.jpg");

+ 172 - 0
src/main/java/com/yunfeiyun/agmp/iot/common/service/impl/IotDeviceGeoLocationCommonServiceImpl.java

@@ -0,0 +1,172 @@
+package com.yunfeiyun.agmp.iot.common.service.impl;
+
+import com.yunfeiyun.agmp.common.utils.DateUtils;
+import com.yunfeiyun.agmp.common.utils.SecurityUtils;
+import com.yunfeiyun.agmp.iot.common.domain.IotDevGeoPoint;
+import com.yunfeiyun.agmp.iot.common.domain.IotDevice;
+import com.yunfeiyun.agmp.iot.common.domain.IotDeviceGeoLocation;
+import com.yunfeiyun.agmp.iot.common.domain.dto.MgUpdateBatchDto;
+import com.yunfeiyun.agmp.iot.common.service.IotDeviceGeoLocationCommonService;
+import com.yunfeiyun.agmp.iot.common.service.MongoService;
+import com.yunfeiyun.agmp.iot.common.util.BigDecimalUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.data.mongodb.core.query.Criteria;
+import org.springframework.data.mongodb.core.query.Query;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class IotDeviceGeoLocationCommonServiceImpl implements IotDeviceGeoLocationCommonService {
+
+    @Autowired
+    private MongoService mongoService;
+
+    /**
+     * 插入或更新数据
+     */
+    @Override
+    public void insertBatchData(List<IotDeviceGeoLocation> dataList) {
+        if(!dataList.isEmpty()) {
+            mongoService.insertList(IotDeviceGeoLocation.class, dataList);
+        }
+    }
+
+    /**
+     * 更新数据
+     *
+     * @param dataList
+     */
+    @Override
+    public void updateBatchData(List<IotDeviceGeoLocation> dataList) {
+        List<MgUpdateBatchDto> updateBatchDtoList = new ArrayList<>();
+        for(IotDeviceGeoLocation item : dataList) {
+            String devGeoBid = item.getDevGeoBid();
+            IotDevGeoPoint geoPoint = item.getDevGeoLocation();
+            String devGeoUpdateddate = DateUtils.dateTimeNow();
+            String devtypeBid = item.getDevtypeBid();
+            String tid = item.getTid();
+            if(tid == null){
+                tid = SecurityUtils.getTid();
+            }
+
+            Query query = new Query(Criteria.where("devGeoBid").is(devGeoBid));
+            Map<String, Object> updateField = new HashMap<>();
+            updateField.put("devGeoUpdateddate", devGeoUpdateddate);
+            updateField.put("devtypeBid", devtypeBid);
+            updateField.put("devGeoLocation", geoPoint);
+            updateField.put("tid", tid);
+
+            MgUpdateBatchDto updateBatchDto = new MgUpdateBatchDto();
+            updateBatchDto.setQuery(query);
+            updateBatchDto.setUpdateField(updateField);
+            updateBatchDtoList.add(updateBatchDto);
+        }
+        if(!updateBatchDtoList.isEmpty()) {
+            mongoService.updateBatch(IotDeviceGeoLocation.class, updateBatchDtoList);
+        }
+    }
+
+    @Override
+    public void insertOrUpdateBatchData(List<IotDevice> iotDeviceList) {
+        List<IotDevice> dataList = new ArrayList<>();
+        List<String> devBidList = new ArrayList<>();
+        for(IotDevice iotDevice : iotDeviceList) {
+            BigDecimal devLng = iotDevice.getDevLngalign();
+            BigDecimal devLat = iotDevice.getDevLatalign();
+            if(devLng == null || devLat == null) {
+                devLng = iotDevice.getDevLng();
+                devLat = iotDevice.getDevLat();
+            }
+            if (devLng == null || devLat == null){
+                continue;
+            }
+
+            String devBid = iotDevice.getDevBid();
+            devBidList.add(devBid);
+            dataList.add(iotDevice);
+        }
+        Map<String, IotDeviceGeoLocation> iotDeviceGeoLocationMap = new HashMap<>();
+        if(!devBidList.isEmpty()) {
+            List<IotDeviceGeoLocation> iotDeviceGeoLocationList = selectByDevBidList(devBidList);
+            for(IotDeviceGeoLocation iotDeviceGeoLocation : iotDeviceGeoLocationList) {
+                iotDeviceGeoLocationMap.put(iotDeviceGeoLocation.getDevBid(), iotDeviceGeoLocation);
+            }
+        }
+        List<IotDeviceGeoLocation> updateList = new ArrayList<>();
+        List<IotDeviceGeoLocation> insertList = new ArrayList<>();
+        for(IotDevice iotDevice : dataList) {
+            BigDecimal devLng = iotDevice.getDevLngalign();
+            BigDecimal devLat = iotDevice.getDevLatalign();
+            if(devLng == null || devLat == null) {
+                devLng = iotDevice.getDevLng();
+                devLat = iotDevice.getDevLat();
+            }
+
+            String devBid = iotDevice.getDevBid();
+            String tid = iotDevice.getTid();
+            if(tid == null) {
+                tid = SecurityUtils.getTid();
+            }
+            IotDeviceGeoLocation iotDeviceGeoLocation = iotDeviceGeoLocationMap.get(devBid);
+            if (iotDeviceGeoLocation == null) {
+                iotDeviceGeoLocation = new IotDeviceGeoLocation();
+                iotDeviceGeoLocation.setDevGeoBid(iotDeviceGeoLocation.getUUId());
+                iotDeviceGeoLocation.setTid(tid);
+                iotDeviceGeoLocation.setDevBid(devBid);
+                iotDeviceGeoLocation.setDevtypeBid(iotDevice.getDevtypeBid());
+                iotDeviceGeoLocation.setDevGeoCreateddate(DateUtils.dateTimeNow());
+                iotDeviceGeoLocation.setDevGeoUpdateddate(DateUtils.dateTimeNow());
+                IotDevGeoPoint geoPoint = new IotDevGeoPoint();
+                geoPoint.setType("Point");
+
+                double[] coordinates = new double[2];
+                coordinates[0] = BigDecimalUtil.toDouble(devLng);
+                coordinates[1] = BigDecimalUtil.toDouble(devLat);
+                geoPoint.setCoordinates(coordinates);
+                iotDeviceGeoLocation.setDevGeoLocation(geoPoint);
+
+                insertList.add(iotDeviceGeoLocation);
+            }else{
+                double[] coordinates = iotDeviceGeoLocation.getDevGeoLocation().getCoordinates();
+                BigDecimal devLngOld = BigDecimalUtil.format(coordinates[0]);
+                BigDecimal devLatOld = BigDecimalUtil.format(coordinates[1]);
+                if(!devLng.equals(devLngOld) || !devLat.equals(devLatOld)) {
+                    coordinates[0] = BigDecimalUtil.toDouble(devLng);
+                    coordinates[1] = BigDecimalUtil.toDouble(devLat);
+
+                    iotDeviceGeoLocation.getDevGeoLocation().setCoordinates(coordinates);
+                    iotDeviceGeoLocation.setDevGeoUpdateddate(DateUtils.dateTimeNow());
+                    iotDeviceGeoLocation.setDevtypeBid(iotDevice.getDevtypeBid());
+                    iotDeviceGeoLocation.setTid(tid);
+
+                    updateList.add(iotDeviceGeoLocation);
+                }
+            }
+        }
+        if(!updateList.isEmpty()) {
+            updateBatchData(updateList);
+        }
+        if(!insertList.isEmpty()) {
+            insertBatchData(insertList);
+        }
+    }
+
+    @Override
+    public List<IotDeviceGeoLocation> selectByDevBidList(List<String> devBidList) {
+        Map<String, Object> params = new HashMap<>();
+        params.put("newList_devBid", devBidList);
+        return mongoService.findAll(IotDeviceGeoLocation.class, params);
+    }
+
+    @Override
+    public void deleteByDevBidList(List<String> devBidList) {
+        if(!devBidList.isEmpty()) {
+            mongoService.removeAllByBatch("devBid", devBidList, "IotDeviceGeoLocation");
+        }
+    }
+}

+ 25 - 0
src/main/java/com/yunfeiyun/agmp/iot/common/util/BigDecimalUtil.java

@@ -0,0 +1,25 @@
+package com.yunfeiyun.agmp.iot.common.util;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+
+public class BigDecimalUtil {
+    private static final int scale = 6;
+    private static RoundingMode roundingMode = RoundingMode.DOWN;
+
+    public static BigDecimal format(double value) {
+        return BigDecimal.valueOf(value).setScale(scale, roundingMode);
+    }
+
+    public static BigDecimal format(String value) {
+        return new BigDecimal(value).setScale(scale, roundingMode);
+    }
+
+    public static BigDecimal format(BigDecimal value) {
+        return value.setScale(scale, roundingMode);
+    }
+
+    public static double toDouble(BigDecimal value){
+        return value.setScale(scale, roundingMode).doubleValue();
+    }
+}

+ 67 - 0
src/main/java/com/yunfeiyun/agmp/iot/common/util/dev/QxzTypeUtil.java

@@ -0,0 +1,67 @@
+package com.yunfeiyun.agmp.iot.common.util.dev;
+
+import com.yunfeiyun.agmp.iot.common.constant.devicetype.IotDeviceDictConst;
+
+public class QxzTypeUtil {
+    public static boolean isXphYfQxSq(String devtypeBid){
+        boolean isQxz = false;
+        switch (devtypeBid){
+            case IotDeviceDictConst.TYPE_XPH_YF_QXZ:
+            case IotDeviceDictConst.TYPE_XPH_YF_SQZ:
+            case IotDeviceDictConst.TYPE_XPH_YF_GSSQ:
+                isQxz = true;
+                break;
+        }
+        return isQxz;
+    }
+
+    public static boolean isYfCommQxz(String devtypeBid){
+        boolean isQxz = false;
+        switch (devtypeBid){
+            case IotDeviceDictConst.TYPE_YF_QXZ:
+            case IotDeviceDictConst.TYPE_YF_SQZ:
+            case IotDeviceDictConst.TYPE_XPH_YF_QXZ:
+            case IotDeviceDictConst.TYPE_XPH_YF_SQZ:
+            case IotDeviceDictConst.TYPE_XPH_YF_GSSQ:
+                isQxz = true;
+                break;
+        }
+        return isQxz;
+    }
+
+    public static boolean isYfQxSq(String devtypeBid){
+        boolean isQxz = false;
+        switch (devtypeBid){
+            case IotDeviceDictConst.TYPE_YF_QXZ:
+            case IotDeviceDictConst.TYPE_YF_SQZ:
+                isQxz = true;
+                break;
+        }
+        return isQxz;
+    }
+
+    public static String[] getAllQxzTypes(){
+        return new String[]{IotDeviceDictConst.TYPE_YF_QXZ, IotDeviceDictConst.TYPE_XPH_YF_QXZ};
+    }
+
+    public static String[] getPtQxzTypes(){
+        return new String[]{IotDeviceDictConst.TYPE_YF_QXZ, IotDeviceDictConst.TYPE_XPH_YF_QXZ};
+    }
+
+    public static String[] getAllSqzTypes(){
+        return new String[]{
+                IotDeviceDictConst.TYPE_YF_SQZ, IotDeviceDictConst.TYPE_XPH_YF_SQZ,
+                IotDeviceDictConst.TYPE_ADZN_GSSQ, IotDeviceDictConst.TYPE_XPH_YF_GSSQ
+        };
+    }
+
+    public static String[] getPtSqzTypes(){
+        return new String[]{
+                IotDeviceDictConst.TYPE_YF_SQZ, IotDeviceDictConst.TYPE_XPH_YF_SQZ
+        };
+    }
+
+    public static String[] getGssqTypes(){
+        return new String[]{IotDeviceDictConst.TYPE_XPH_YF_GSSQ, IotDeviceDictConst.TYPE_ADZN_GSSQ};
+    }
+}

+ 101 - 0
src/main/java/com/yunfeiyun/agmp/iot/common/util/dev/XctToCbdUtil.java

@@ -0,0 +1,101 @@
+package com.yunfeiyun.agmp.iot.common.util.dev;
+
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
+import com.yunfeiyun.agmp.common.utils.StringUtils;
+
+import java.util.Map;
+
+public class XctToCbdUtil {
+    public static JSONObject xctToCbdData(JSONObject dataJson) {
+        JSONObject newJson = transXctPestPoint(dataJson);
+        return transXctDataToCbdData(newJson);
+    }
+
+    /**
+     * 由于吸虫塔和测报灯的害虫编号重复将吸虫塔中的虫子编号进行转化
+     * @param dataJson
+     * @return
+     */
+    private static JSONObject transXctPestPoint(JSONObject dataJson){
+        String cbdrecogMachinemark = dataJson.getString("label");
+        String cbdrecogResult = dataJson.getString("return_string");
+
+        JSONArray jsonArray = new JSONArray();
+        try{
+            if(StringUtils.isNotEmpty(cbdrecogMachinemark)){
+                jsonArray = JSONArray.parseArray(cbdrecogMachinemark);
+            }
+        }catch (Exception e){}
+
+        JSONArray transAfterData = new JSONArray();
+
+        int totalPestNum = 0;
+        for(int i = jsonArray.size()-1;i>=0;i--){
+            JSONObject returnStrItem = jsonArray.getJSONObject(i);
+            for(Map.Entry<String,Object> entry : returnStrItem.entrySet()){
+                String key = entry.getKey();
+                Object value = entry.getValue();
+                totalPestNum++;
+                if(!"4".equals(key)) {
+                    returnStrItem.remove(key);
+                    returnStrItem.put("xct"+key,value);
+                    transAfterData.add(returnStrItem);
+                }
+            }
+        }
+        String label = "";
+        if(!transAfterData.isEmpty()){
+            label = transAfterData.toJSONString();
+        }
+
+        for(int i = 1;i<=3;i++){
+            cbdrecogResult = cbdrecogResult.replaceFirst(i+",","xct"+i+",");
+        }
+        cbdrecogResult = cbdrecogResult.replaceAll("4,\\d+#|#4,\\d+","");
+
+        if(StringUtils.isEmpty(label) || StringUtils.isEmpty(cbdrecogResult)){
+            label = "";
+            cbdrecogResult = "";
+            totalPestNum = 0;
+        }
+
+        dataJson.put("label", label);
+        dataJson.put("return_string",cbdrecogResult);
+        dataJson.put("Result_c", totalPestNum);
+        return dataJson;
+    }
+
+    /**
+     * 将吸虫塔的数据格式转化成测报灯的数据格式
+     * @param jsonObject
+     * @return
+     */
+    private static JSONObject transXctDataToCbdData(JSONObject jsonObject) {
+        String return_string = jsonObject.getString("return_string");
+        if(StringUtils.isEmpty(return_string)){
+            return_string = "0";
+        }
+
+        String label = jsonObject.getString("label");
+        if(StringUtils.isEmpty(label)){
+            label = "0";
+        }
+
+        String Result_c = "0," + jsonObject.getString("Result_c");
+
+        JSONObject result = new JSONObject();
+        result.put("imei",jsonObject.get("device_id"));
+        result.put("Image",jsonObject.get("img"));
+        result.put("Result", return_string);
+        result.put("Result_image",jsonObject.get("img"));
+        result.put("Result_code", label);
+        result.put("Image_b","0");
+        result.put("Result_b","0");
+        result.put("Result_image_b","0");
+        result.put("Result_code_b","0");
+        result.put("Result_c", Result_c);
+        result.put("disable","0");
+        return result;
+    }
+}