diff --git a/data/init/deviceInfo.json b/data/init/deviceInfo.json index c89f5ec0..4b86015f 100755 --- a/data/init/deviceInfo.json +++ b/data/init/deviceInfo.json @@ -7,6 +7,8 @@ "secret": "rMAweEJrE7cxbQWa", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655415536032 @@ -33,6 +35,8 @@ "secret": "eN4PjDhH4yx4mrmi", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655415536130 @@ -59,6 +63,8 @@ "secret": "ePSkE7bzGMsR6rTs", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655415536135 @@ -85,6 +91,8 @@ "secret": "mkQiSDk4rF3EWKFM", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655416465031 @@ -114,6 +122,8 @@ "secret": "p72KAZyTA42zi8cJ", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655416465035 @@ -139,6 +149,8 @@ "secret": "xnKZZyPKj2rH6ee3", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655416465133 @@ -168,6 +180,8 @@ "secret": "PDkTxHPfw2H4WZjQ", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655416465231 @@ -193,6 +207,8 @@ "secret": "3KdPNBKZEyDGaNYK", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655652738672 @@ -218,6 +234,8 @@ "secret": "TBwbHJdJBQCpGdHi", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655652738676 @@ -243,6 +261,8 @@ "secret": "86pTYbQxxX3wd2FR", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655652738773 @@ -268,6 +288,8 @@ "secret": "FtxYcTM5p6B5GyPk", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655652738872 @@ -293,6 +315,8 @@ "secret": "5yHFHseBHDbCK3eZ", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655652738972 @@ -318,6 +342,8 @@ "secret": "pGC4z4TrbjZhii2m", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655652739072 @@ -343,6 +369,8 @@ "secret": "HMxT2rQ55bzeRNJx", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655652739076 @@ -368,6 +396,8 @@ "secret": "Z6yMp6D6mHKMjFi7", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655652739174 @@ -393,6 +423,8 @@ "secret": "Ek3ZjwPayCymDxhN", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655652739272 @@ -418,6 +450,8 @@ "secret": "NnnHaibdHJXMxNbC", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655652739372 @@ -443,6 +477,8 @@ "secret": "bWkiEmY6wKM8WQP5", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": false }, @@ -463,6 +499,8 @@ "subUid": [ "04c6722f-9a6d-40f3-ac9b-cd791b4c8933" ], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653839933067 @@ -499,6 +537,8 @@ "secret": "CN8ZGpcAheAbsDn2", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653839933167 @@ -518,6 +558,8 @@ "secret": "S4SDRKscRXAn43bc", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653839933267 @@ -543,6 +585,8 @@ "secret": "7N4S6eYzMCjA7YfK", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653839933367 @@ -562,6 +606,8 @@ "secret": "Jm7ecfyXawiend8K", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653839933376 @@ -587,6 +633,8 @@ "secret": "rtsZbST3tiJHccbe", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653839933474 @@ -612,6 +660,8 @@ "secret": "PXHwHXH4a8YJzZ3S", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653839918667 @@ -639,6 +689,8 @@ "secret": "BQj5SZetsC3eGtfM", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653839918676 @@ -666,6 +718,8 @@ "secret": "mbs4PsY4atEtzcA3", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653839918771 @@ -693,6 +747,8 @@ "secret": "4nrNrjnFMSQZB562", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653839918871 @@ -720,6 +776,8 @@ "secret": "Js66kBbXRjXmcpMB", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653839918967 @@ -741,6 +799,8 @@ "secret": "pGxKYrNJC7rDhsr8", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655416485331 @@ -760,6 +820,8 @@ "secret": "ZxDQeQ8jhMrfx8eE", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655416485335 @@ -779,6 +841,8 @@ "secret": "fEbdXEayedpBx6wk", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655416485433 @@ -798,6 +862,8 @@ "secret": "Crm28CTD6iw7hYw5", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655416485531 @@ -817,6 +883,8 @@ "secret": "FkCQGREXYCmjzxaZ", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655416485631 @@ -836,6 +904,8 @@ "secret": "JwKxnDWGrRcP8xAJ", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653839919567 @@ -855,6 +925,8 @@ "secret": "xrX2mrkQwf3YYaWc", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653839919576 @@ -874,6 +946,8 @@ "secret": "diRBkEREDt47MzWF", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653839919673 @@ -893,6 +967,8 @@ "secret": "fR3R3i8BYDKWAiDj", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": false }, @@ -908,6 +984,8 @@ "secret": "t3NYS5p7ExYaWKx4", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": false }, @@ -923,6 +1001,8 @@ "secret": "KSpeRjXRP8H7tcAn", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": false }, @@ -938,6 +1018,8 @@ "secret": "DSBbhJW7cGXRWeZA", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653839926671 @@ -957,6 +1039,8 @@ "secret": "5bm8pNYcdj7YPMXn", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653839926777 @@ -976,6 +1060,8 @@ "secret": "neSfPnhsjCsQiCQx", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653839927067 @@ -995,6 +1081,8 @@ "secret": "2D2k8mmHbi2AMh8G", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653785231385 @@ -1015,6 +1103,8 @@ "secret": "AQHQJTQ2iXkncb3C", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653785231786 @@ -1035,6 +1125,8 @@ "secret": "PwYEKSARBJjD4y6B", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653785232184 @@ -1055,6 +1147,8 @@ "secret": "C8YxCycFFeQDPKX4", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653730979070 @@ -1076,6 +1170,8 @@ "parentId": "16514626212240aabbccee01000000143", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653380321483 @@ -1099,6 +1195,8 @@ "model": "GW01", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": false, "onlineTime": 1653185932725, @@ -1117,6 +1215,8 @@ "parentId": "16514626212240aabbccee01000000143", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653380322090, @@ -1138,6 +1238,8 @@ "parentId": "16514626212240aabbccee01000000143", "uid": "15620886-b30d-439d-9e5f-13a094c1f1f9", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653380319984, @@ -1159,6 +1261,8 @@ "parentId": "16514626212240aabbccee01000000143", "uid": "15620886-b30d-439d-9e5f-13a094c1f1f9", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653380317469, @@ -1178,6 +1282,8 @@ "deviceName": "AA:BB:CC:EE:01", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653380312358, @@ -1198,6 +1304,8 @@ "parentId": "165017126122400cefafcfee61000012b", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655415536433, @@ -1229,6 +1337,8 @@ "subUid": [ "04c6722f-9a6d-40f3-ac9b-cd791b4c8933" ], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": false, "onlineTime": 1652602130873, @@ -1266,6 +1376,8 @@ "subUid": [ "04c6722f-9a6d-40f3-ac9b-cd791b4c8933" ], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": false, "onlineTime": 1652602115884, @@ -1301,6 +1413,8 @@ "subUid": [ "629daa3de5a005209d182876" ], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655581924548, @@ -1334,6 +1448,8 @@ "subUid": [ "629daa3de5a005209d182876" ], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655581925148, @@ -1369,6 +1485,8 @@ "subUid": [ "629daa3de5a005209d182876" ], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655581925152, @@ -1404,6 +1522,8 @@ "subUid": [ "629daa3de5a005209d182876" ], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655581925157, @@ -1439,6 +1559,8 @@ "subUid": [ "629daa3de5a005209d182876" ], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655581925252, @@ -1474,6 +1596,8 @@ "subUid": [ "629daa3de5a005209d182876" ], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655581925255, @@ -1509,6 +1633,8 @@ "subUid": [ "629daa3de5a005209d182876" ], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1655581925247, @@ -1543,6 +1669,8 @@ "parentId": "16465226744430aabbccdd22000000143", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": false, "onlineTime": 1653380311848, @@ -1565,6 +1693,8 @@ "parentId": "16465226744430aabbccdd22000000143", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": false, "onlineTime": 1653380308883, @@ -1585,6 +1715,8 @@ "parentId": "16465226744430aabbccdd22000000143", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653729780071, @@ -1606,6 +1738,8 @@ "parentId": "16465226744430aabbccdd22000000143", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": true, "onlineTime": 1653729780174, @@ -1625,6 +1759,8 @@ "deviceName": "AA:BB:CC:DD:22", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": false, "onlineTime": 1653380299997, @@ -1641,6 +1777,8 @@ "deviceName": "123456789123", "uid": "1", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": false, "onlineTime": 1653380299997, @@ -1658,6 +1796,8 @@ "uid": "1", "parentId": "168187356997901234567891230000120", "subUid": [], + "longitude": "104.090377", + "latitude": "30.604218", "state": { "online": false, "onlineTime": 1653380299997, diff --git a/data/init/product.json b/data/init/product.json index 6b68e11c..5c938393 100755 --- a/data/init/product.json +++ b/data/init/product.json @@ -4,6 +4,8 @@ "name": "调光灯", "category": "light", "nodeType": 1, + "isOpenLocate": true, + "locateUpdateType": "manual", "uid": "1", "createAt": 1650174777304 }, @@ -13,6 +15,7 @@ "name": "智能风扇", "category": "fan", "nodeType": 1, + "isOpenLocate": false, "uid": "1", "createAt": 1646571291131 }, @@ -24,6 +27,7 @@ "uid": "1", "img": "http://iotkit-img.oss-cn-shenzhen.aliyuncs.com/product/hbtgIA0SuVw9lxjB/cover.jpg?Expires=1967598154&OSSAccessKeyId=LTAI5tGEHNoVu5tWHUWnosrs&Signature=2gh2jad14mVHGvWThwOd%2FykiB5g%3D", "transparent": false, + "isOpenLocate": false, "createAt": 1652238155938 }, { @@ -34,6 +38,7 @@ "uid": "1", "img": "http://iotkit-img.oss-cn-shenzhen.aliyuncs.com/product/eDhXKwEzwFybM5R7/cover.jpeg?Expires=1967598172&OSSAccessKeyId=LTAI5tGEHNoVu5tWHUWnosrs&Signature=ZrFgANkomVEDQRV5JdmONL0S2sY%3D", "transparent": false, + "isOpenLocate": false, "createAt": 1652238173536 }, { @@ -44,6 +49,7 @@ "uid": "1", "img": "http://iotkit-img.oss-cn-shenzhen.aliyuncs.com/product/cGCrkK7Ex4FESAwe/cover.jpeg?Expires=1967598137&OSSAccessKeyId=LTAI5tGEHNoVu5tWHUWnosrs&Signature=vOjqav0pRZqQFgx8xBo99WhgWXk%3D", "transparent": false, + "isOpenLocate": false, "createAt": 1652238138626 }, { @@ -54,6 +60,7 @@ "uid": "1", "img": "http://iotkit-img.oss-cn-shenzhen.aliyuncs.com/product/Rf4QSjbm65X45753/cover.jpeg?Expires=1967598145&OSSAccessKeyId=LTAI5tGEHNoVu5tWHUWnosrs&Signature=ksQhmEm5Rn7C7FFqY09o9l%2BZ%2BIQ%3D", "transparent": false, + "isOpenLocate": false, "createAt": 1652238147123 }, { @@ -63,6 +70,7 @@ "nodeType": 1, "uid": "1", "img": "null", + "isOpenLocate": false, "createAt": 1650190400357 }, { @@ -73,6 +81,7 @@ "uid": "1", "img": "http://iotkit-img.oss-cn-shenzhen.aliyuncs.com/product/N523nWsCiG3CAn6X/cover.jpg?Expires=1967597641&OSSAccessKeyId=LTAI5tGEHNoVu5tWHUWnosrs&Signature=%2BaGcHBT%2FHA3s%2BrZ687U50b4YE0A%3D", "transparent": false, + "isOpenLocate": false, "createAt": 1652237643216 }, { @@ -82,6 +91,7 @@ "nodeType": 2, "uid": "1", "transparent": false, + "isOpenLocate": false, "createAt": 1654237604221 }, { @@ -92,6 +102,7 @@ "uid": "1", "img": "http://iotkit-img.oss-cn-shenzhen.aliyuncs.com/product/DSGxxKk6E8mmDk6C/cover.jpeg?Expires=1967598201&OSSAccessKeyId=LTAI5tGEHNoVu5tWHUWnosrs&Signature=k2PqHc%2BI14DfCwD8kQIflwoBAog%3D", "transparent": false, + "isOpenLocate": false, "createAt": 1652238202310 }, { @@ -100,6 +111,7 @@ "category": "switch", "nodeType": 1, "uid": "1", + "isOpenLocate": false, "createAt": 1650187781637 }, { @@ -110,6 +122,7 @@ "uid": "1", "img": "http://iotkit-img.oss-cn-shenzhen.aliyuncs.com/product/AWcJnf7ymGSkaz5M/cover.jpeg?Expires=1967598035&OSSAccessKeyId=LTAI5tGEHNoVu5tWHUWnosrs&Signature=tXzWH5%2B4JNcnuTFrJbvGwsbx97c%3D", "transparent": true, + "isOpenLocate": false, "createAt": 1652279098100 }, { @@ -118,6 +131,7 @@ "category": "sensor", "nodeType": 1, "uid": "1", + "isOpenLocate": false, "createAt": 1649653149339 }, { @@ -126,6 +140,7 @@ "category": "FreshAir", "nodeType": 1, "uid": "1", + "isOpenLocate": false, "createAt": 1649653149339 }, { @@ -134,6 +149,7 @@ "category": "gateway", "nodeType": 0, "uid": "1", + "isOpenLocate": false, "createAt": 1649653149339 }, { @@ -142,6 +158,7 @@ "category": "SmartMeter", "nodeType": 1, "uid": "1", + "isOpenLocate": false, "createAt": 1649653149339 } ] \ No newline at end of file diff --git a/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/device/DeviceInfo.java b/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/device/DeviceInfo.java index e0cda92d..0785b824 100644 --- a/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/device/DeviceInfo.java +++ b/iot-common/iot-common-dao/iot-common-model/src/main/java/cc/iotkit/model/device/DeviceInfo.java @@ -59,6 +59,11 @@ public class DeviceInfo implements Owned { */ private List subUid = new ArrayList<>(); + /** + * 设备定位对象 + */ + private Locate locate = new Locate(); + /** * 设备在离线状态 */ @@ -81,6 +86,17 @@ public class DeviceInfo implements Owned { private Long createAt; + @Data + @NoArgsConstructor + @AllArgsConstructor + public static class Locate { + + private String longitude; + + private String latitude; + + } + @Data @NoArgsConstructor @AllArgsConstructor diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbDeviceInfo.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbDeviceInfo.java index 187ce7a6..5a749df9 100644 --- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbDeviceInfo.java +++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/model/TbDeviceInfo.java @@ -44,6 +44,12 @@ public class TbDeviceInfo { @ApiModelProperty(value = "父级id") private String parentId; + @ApiModelProperty(value = "经度") + private String longitude; + + @ApiModelProperty(value = "纬度") + private String latitude; + @ApiModelProperty(value = "用户id") private String uid; diff --git a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/DeviceInfoDataImpl.java b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/DeviceInfoDataImpl.java index e1ac2041..ea0a74dc 100644 --- a/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/DeviceInfoDataImpl.java +++ b/iot-common/iot-common-dao/iot-data-serviceImpl-rdb/src/main/java/cc/iotkit/data/service/DeviceInfoDataImpl.java @@ -1,14 +1,14 @@ package cc.iotkit.data.service; import cc.iotkit.common.api.PageRequest; +import cc.iotkit.common.api.Paging; import cc.iotkit.common.utils.MapstructUtils; import cc.iotkit.common.utils.ReflectUtil; +import cc.iotkit.data.dao.*; import cc.iotkit.data.manager.ICategoryData; import cc.iotkit.data.manager.IDeviceInfoData; import cc.iotkit.data.manager.IProductData; -import cc.iotkit.data.dao.*; import cc.iotkit.data.model.*; -import cc.iotkit.common.api.Paging; import cc.iotkit.data.util.PageBuilder; import cc.iotkit.model.device.DeviceInfo; import cc.iotkit.model.product.Category; @@ -125,6 +125,7 @@ public class DeviceInfoDataImpl implements IDeviceInfoData, IJPACommData thingModelProperties = thingModel.getModel(). + Map thingModelProperties = thingModel.getModel(). getProperties().stream().collect(Collectors.toMap( - ThingModel.Property::getIdentifier, ThingModel.Property::getName)); + ThingModel.Property::getIdentifier, ThingModel.Property::getDataType)); Map addProperties = new HashMap<>(); //删除非属性字段 properties.forEach((key,val)->{ if (thingModelProperties.containsKey(key)) { addProperties.put(key,val); + handleLocate(deviceInfo,val,thingModelProperties.get(key)); } }); @@ -95,6 +97,31 @@ public class DevicePropertyConsumer implements ConsumerHandler) specs).get("locateType");//定位方式 + if (objlocateType != null) { + locateType = objlocateType.toString(); + } + if(StringUtils.isNotBlank(locateType)){ + if("lonLat".equals(locateType)){//经纬度定位格式:经度,纬度 + String[] lonLats=data.toString().split(","); + deviceInfo.getLocate().setLongitude(lonLats[0]); + deviceInfo.getLocate().setLatitude(lonLats[1]); + deviceInfoData.save(deviceInfo); + }else if("basestation".equals(locateType)){//基站定位 + + }else if("ipinfo".equals(locateType)){//ip定位 + + } + } + } + } + } + /** * 更新设备当前属性 */ diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/bo/device/DeviceInfoBo.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/bo/device/DeviceInfoBo.java index 1ca346fe..e651f285 100644 --- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/bo/device/DeviceInfoBo.java +++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/dto/bo/device/DeviceInfoBo.java @@ -1,25 +1,13 @@ package cc.iotkit.manager.dto.bo.device; +import cc.iotkit.common.api.BaseDto; import cc.iotkit.model.device.DeviceInfo; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonFormat; +import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapping; import io.github.linpeilie.annotations.ReverseAutoMapping; -import jakarta.validation.constraints.Size; -import org.springframework.format.annotation.DateTimeFormat; - import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; - -import java.io.Serializable; -import java.util.Date; -import java.math.BigDecimal; - -import cc.iotkit.common.api.BaseDto; -import cc.iotkit.common.validate.AddGroup; -import cc.iotkit.common.validate.EditGroup; - -import io.github.linpeilie.annotations.AutoMapper; +import jakarta.validation.constraints.Size; import lombok.Data; import lombok.EqualsAndHashCode; @@ -65,6 +53,12 @@ public class DeviceInfoBo extends BaseDto { @Size(max = 255, message = "设备描述长度不正确") private String secret; + @ApiModelProperty(value = "经度") + private String longitude; + + @ApiModelProperty(value = "纬度") + private String latitude; + @ApiModelProperty(value = "设备状态") @Size(max = 255, message = "设备状态长度不正确") @AutoMapping(ignore = true) diff --git a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/DeviceServiceImpl.java b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/DeviceServiceImpl.java index 54d5a3cc..77d65aaf 100644 --- a/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/DeviceServiceImpl.java +++ b/iot-module/iot-manager/src/main/java/cc/iotkit/manager/service/impl/DeviceServiceImpl.java @@ -136,6 +136,7 @@ public class DeviceServiceImpl implements IDeviceService { device.setDeviceName(deviceName); device.setSecret(secret.toString()); device.setState(new DeviceInfo.State(false, null, null)); + device.setLocate(new DeviceInfo.Locate(deviceInfo.getLongitude(),deviceInfo.getLatitude())); device.setCreateAt(System.currentTimeMillis()); if (StringUtils.isNotBlank(parentId)) { device.setParentId(parentId);