Преглед изворни кода

Merge remote-tracking branch 'origin/develop' into develop

yf_zn пре 10 месеци
родитељ
комит
b9b71297c1

+ 14 - 3
src/main/java/com/yunfeiyun/agmp/iot/common/service/impl/IotDeviceGeoLocationCommonServiceImpl.java

@@ -1,6 +1,7 @@
 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;
@@ -48,12 +49,17 @@ public class IotDeviceGeoLocationCommonServiceImpl implements IotDeviceGeoLocati
             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);
@@ -102,11 +108,15 @@ public class IotDeviceGeoLocationCommonServiceImpl implements IotDeviceGeoLocati
             }
 
             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(iotDevice.getTid());
+                iotDeviceGeoLocation.setTid(tid);
                 iotDeviceGeoLocation.setDevBid(devBid);
                 iotDeviceGeoLocation.setDevtypeBid(iotDevice.getDevtypeBid());
                 iotDeviceGeoLocation.setDevGeoCreateddate(DateUtils.dateTimeNow());
@@ -132,6 +142,7 @@ public class IotDeviceGeoLocationCommonServiceImpl implements IotDeviceGeoLocati
                     iotDeviceGeoLocation.getDevGeoLocation().setCoordinates(coordinates);
                     iotDeviceGeoLocation.setDevGeoUpdateddate(DateUtils.dateTimeNow());
                     iotDeviceGeoLocation.setDevtypeBid(iotDevice.getDevtypeBid());
+                    iotDeviceGeoLocation.setTid(tid);
 
                     updateList.add(iotDeviceGeoLocation);
                 }
@@ -148,8 +159,8 @@ public class IotDeviceGeoLocationCommonServiceImpl implements IotDeviceGeoLocati
     @Override
     public List<IotDeviceGeoLocation> selectByDevBidList(List<String> devBidList) {
         Map<String, Object> params = new HashMap<>();
-        params.put("list_devBid", devBidList);
-        return mongoService.findAll(IotDeviceGeoLocation.class, null);
+        params.put("newList_devBid", devBidList);
+        return mongoService.findAll(IotDeviceGeoLocation.class, params);
     }
 
     @Override