|
|
@@ -8,6 +8,9 @@ import com.zhongshu.card.client.ret.ResultContent;
|
|
|
import com.zhongshu.card.client.service.school.DeviceInfoService;
|
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationDao;
|
|
|
import com.zhongshu.card.server.core.dao.org.OrganizationRelationDao;
|
|
|
+import com.zhongshu.card.server.core.domain.org.DeviceInfo;
|
|
|
+import com.zhongshu.card.server.core.domain.school.DeviceBind;
|
|
|
+import com.zhongshu.card.server.core.service.base.CommonService;
|
|
|
import com.zhongshu.card.server.core.service.org.GateWayInfoServiceImpl;
|
|
|
import com.zhongshu.card.server.core.service.user.OperationLogsService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -15,6 +18,7 @@ import org.apache.commons.lang3.ObjectUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
|
|
|
/**
|
|
|
@@ -40,6 +44,9 @@ public class DeviceSyncFromIotService {
|
|
|
@Autowired
|
|
|
GateWayInfoServiceImpl gateWayService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ CommonService commonService;
|
|
|
+
|
|
|
/**
|
|
|
* 物联网同步设备
|
|
|
*
|
|
|
@@ -69,10 +76,27 @@ public class DeviceSyncFromIotService {
|
|
|
* @return
|
|
|
*/
|
|
|
public ResultContent syncDeviceOnLineState(DevicePingInfoParam param) {
|
|
|
+ HashMap<String, Object> where = new HashMap<>();
|
|
|
+ where.put("deviceId", param.getDeviceId());
|
|
|
|
|
|
+ HashMap<String, Object> map = new HashMap<>();
|
|
|
+ map.put("lastOnlineTime", param.getLastOnlineTime());
|
|
|
+ map.put("onLineState", param.getOnLineState());
|
|
|
+ commonService.updateData(where, map, DeviceInfo.class.getSimpleName());
|
|
|
+ commonService.updateData(where, map, DeviceBind.class.getSimpleName());
|
|
|
return ResultContent.buildSuccess();
|
|
|
}
|
|
|
|
|
|
+ public ResultContent syncDeviceOnLineTime(DevicePingInfoParam param) {
|
|
|
+ HashMap<String, Object> where = new HashMap<>();
|
|
|
+ where.put("deviceId", param.getDeviceId());
|
|
|
+
|
|
|
+ HashMap<String, Object> map = new HashMap<>();
|
|
|
+ map.put("lastOnlineTime", param.getLastOnlineTime());
|
|
|
+ commonService.updateData(where, map, DeviceInfo.class.getSimpleName());
|
|
|
+ commonService.updateData(where, map, DeviceBind.class.getSimpleName());
|
|
|
+ return ResultContent.buildSuccess();
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 同步网关列表
|