展连设备数据解析策略
This commit is contained in:
parent
148800d58f
commit
70d9d40aeb
@ -168,6 +168,7 @@ public class DeviceController extends BaseController {
|
|||||||
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) {
|
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) {
|
||||||
Device device = deviceService.selectDeviceByDeviceId(deviceId);
|
Device device = deviceService.selectDeviceByDeviceId(deviceId);
|
||||||
device.setDeviceDetailVo(deviceDetailService.getDetailInfo(device));
|
device.setDeviceDetailVo(deviceDetailService.getDetailInfo(device));
|
||||||
|
System.err.println(device.getDevParams());
|
||||||
// 判断当前用户是否有设备分享权限 (设备所属机构管理员和设备所属用户有权限)
|
// 判断当前用户是否有设备分享权限 (设备所属机构管理员和设备所属用户有权限)
|
||||||
// LoginUser loginUser = getLoginUser();
|
// LoginUser loginUser = getLoginUser();
|
||||||
// List<SysRole> roles = loginUser.getUser().getRoles();
|
// List<SysRole> roles = loginUser.getUser().getRoles();
|
||||||
|
@ -41,10 +41,11 @@ public class RenKeAuthorizationService {
|
|||||||
HttpResponse response = HttpRequest.post(AUTH_URL)
|
HttpResponse response = HttpRequest.post(AUTH_URL)
|
||||||
.body(JSONUtil.toJsonStr(reqBody)).execute();
|
.body(JSONUtil.toJsonStr(reqBody)).execute();
|
||||||
String resultObjectStr = response.body();
|
String resultObjectStr = response.body();
|
||||||
if(StringUtils.isBlank(response.toString())){
|
|
||||||
throw new RuntimeException("获取token失败!");
|
|
||||||
}
|
|
||||||
JSONObject resultObject = JSONUtil.parseObj(resultObjectStr);
|
JSONObject resultObject = JSONUtil.parseObj(resultObjectStr);
|
||||||
|
if(!resultObject.get("code").toString().equals("1000")){
|
||||||
|
throw new RuntimeException("仁科获取token失败!");
|
||||||
|
}
|
||||||
JSONObject tokenObject = JSONUtil.parseObj(resultObject.get("data"));
|
JSONObject tokenObject = JSONUtil.parseObj(resultObject.get("data"));
|
||||||
int currDate = Integer.parseInt(tokenObject.get("currDate").toString());
|
int currDate = Integer.parseInt(tokenObject.get("currDate").toString());
|
||||||
int expDate = Integer.parseInt(tokenObject.get("expDate").toString());
|
int expDate = Integer.parseInt(tokenObject.get("expDate").toString());
|
||||||
|
@ -5,8 +5,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
|||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.*;
|
||||||
import lombok.Data;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
import com.fastbee.common.annotation.Excel;
|
import com.fastbee.common.annotation.Excel;
|
||||||
@ -22,6 +21,9 @@ import java.util.Date;
|
|||||||
*/
|
*/
|
||||||
@ApiModel(value = "DeviceRealtimedataWorms",description = "虫情设备实时数据 iot_device_realtimedata_worms")
|
@ApiModel(value = "DeviceRealtimedataWorms",description = "虫情设备实时数据 iot_device_realtimedata_worms")
|
||||||
@Data
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@TableName("iot_device_realtimedata_worms")
|
@TableName("iot_device_realtimedata_worms")
|
||||||
public class DeviceRealtimedataWorms extends BaseEntity
|
public class DeviceRealtimedataWorms extends BaseEntity
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.fastbee.iot.domain;
|
package com.fastbee.iot.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fastbee.common.model.vo.iot.DeviceDetailVo;
|
import com.fastbee.common.model.vo.iot.DeviceDetailVo;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fastbee.common.annotation.Excel;
|
import com.fastbee.common.annotation.Excel;
|
||||||
@ -27,6 +28,7 @@ import java.util.List;
|
|||||||
@ApiModel(value = "Device", description = "设备对象 iot_device")
|
@ApiModel(value = "Device", description = "设备对象 iot_device")
|
||||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||||
@Data
|
@Data
|
||||||
|
@TableName("iot_device")
|
||||||
public class Device extends BaseEntity
|
public class Device extends BaseEntity
|
||||||
{
|
{
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
@ -188,6 +190,16 @@ public class Device extends BaseEntity
|
|||||||
@ApiModelProperty("联系电话")
|
@ApiModelProperty("联系电话")
|
||||||
private String tel;
|
private String tel;
|
||||||
|
|
||||||
|
/** 设备品牌 */
|
||||||
|
@Excel(name = "设备品牌")
|
||||||
|
@ApiModelProperty("设备品牌")
|
||||||
|
private String deviceBrand;
|
||||||
|
|
||||||
|
/** 设备型号 */
|
||||||
|
@Excel(name = "设备型号")
|
||||||
|
@ApiModelProperty("设备型号")
|
||||||
|
private String deviceModel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关联组态,来源产品
|
* 关联组态,来源产品
|
||||||
*/
|
*/
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.fastbee.iot.mapper;
|
package com.fastbee.iot.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.fastbee.common.core.iot.response.IdentityAndName;
|
import com.fastbee.common.core.iot.response.IdentityAndName;
|
||||||
import com.fastbee.iot.domain.ThingsModel;
|
import com.fastbee.iot.domain.ThingsModel;
|
||||||
import com.fastbee.iot.model.ThingsModelPerm;
|
import com.fastbee.iot.model.ThingsModelPerm;
|
||||||
@ -19,7 +20,7 @@ import java.util.List;
|
|||||||
* @date 2021-12-16
|
* @date 2021-12-16
|
||||||
*/
|
*/
|
||||||
@Repository
|
@Repository
|
||||||
public interface ThingsModelMapper
|
public interface ThingsModelMapper extends BaseMapper<ThingsModel>
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* 查询物模型
|
* 查询物模型
|
||||||
|
@ -130,6 +130,8 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
private SubGatewayMapper subGatewayMapper;
|
private SubGatewayMapper subGatewayMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private IOrderControlService orderControlService;
|
private IOrderControlService orderControlService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询设备
|
* 查询设备
|
||||||
*
|
*
|
||||||
@ -140,6 +142,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
@Override
|
@Override
|
||||||
public Device selectDeviceByDeviceId(Long deviceId) {
|
public Device selectDeviceByDeviceId(Long deviceId) {
|
||||||
Device device = deviceMapper.selectDeviceByDeviceId(deviceId);
|
Device device = deviceMapper.selectDeviceByDeviceId(deviceId);
|
||||||
|
System.err.println(device.getDevParams());
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ public class ProductServiceImpl implements IProductService
|
|||||||
* @param productId 产品主键
|
* @param productId 产品主键
|
||||||
* @return 产品
|
* @return 产品
|
||||||
*/
|
*/
|
||||||
@Cacheable(value = "product", key = "#root.methodName + '_' + #productId", unless = "#result == null")
|
// @Cacheable(value = "product", key = "#root.methodName + '_' + #productId", unless = "#result == null")
|
||||||
@Override
|
@Override
|
||||||
public Product selectProductByProductId(Long productId)
|
public Product selectProductByProductId(Long productId)
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.fastbee.iot.strategy;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取设备实时数据策略接口
|
||||||
|
*/
|
||||||
|
public interface DeviceRealTimeDataGetStrategy {
|
||||||
|
|
||||||
|
JSONObject getDeviceRealTimeData(String deviceId);
|
||||||
|
}
|
@ -0,0 +1,208 @@
|
|||||||
|
package com.fastbee.iot.strategy;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.fastbee.common.exception.ServiceException;
|
||||||
|
import com.fastbee.common.utils.DateUtils;
|
||||||
|
import com.fastbee.deviceData.domain.DeviceRealtimedataMeteorology;
|
||||||
|
import com.fastbee.deviceData.domain.DeviceRealtimedataMiaoqing;
|
||||||
|
import com.fastbee.deviceData.domain.DeviceRealtimedataMoisture;
|
||||||
|
import com.fastbee.deviceData.domain.DeviceRealtimedataWorms;
|
||||||
|
import com.fastbee.deviceData.mapper.DeviceRealtimedataMoistureMapper;
|
||||||
|
import com.fastbee.deviceData.mapper.DeviceRealtimedataWormsMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class DeviceRealTimeDataStorage {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DeviceRealtimedataMoistureMapper dataMoistureMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DeviceRealtimedataWormsMapper dataWormsMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public boolean saveData(Long productId,String deviceBrand,JSONObject propertiesMap){
|
||||||
|
|
||||||
|
//墒情设备
|
||||||
|
if(productId==142){
|
||||||
|
//根据设备品牌映射数据
|
||||||
|
if(deviceBrand.equals("展连IOT")){
|
||||||
|
int inserted = dataMoistureMapper.insert(setMoistureDataByZhanLian(propertiesMap));
|
||||||
|
return inserted > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//虫情设备
|
||||||
|
if(productId==143){
|
||||||
|
if(deviceBrand.equals("仁科") ){
|
||||||
|
int inserted = dataWormsMapper.insert(setWormsDataByRenKe(propertiesMap));
|
||||||
|
return inserted > 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仁科虫情设备数据映射
|
||||||
|
*/
|
||||||
|
public DeviceRealtimedataWorms setWormsDataByRenKe(JSONObject propertiesMap){
|
||||||
|
DeviceRealtimedataWorms build = DeviceRealtimedataWorms.builder()
|
||||||
|
.deviceAddr(propertiesMap.get("deviceId").toString())
|
||||||
|
.rain(propertiesMap.get("rain").toString())
|
||||||
|
.insecticideTem(propertiesMap.get("insecticideTem").toString())
|
||||||
|
.shake(propertiesMap.get("shake").toString())
|
||||||
|
.lng(propertiesMap.get("lng").toString())
|
||||||
|
.lat(propertiesMap.get("lat").toString())
|
||||||
|
.drying(propertiesMap.get("drying").toString())
|
||||||
|
.rainFlap(propertiesMap.get("rainFlap").toString())
|
||||||
|
.attractWorm(propertiesMap.get("attractWorm").toString())
|
||||||
|
.illum(propertiesMap.get("illum").toString())
|
||||||
|
.dryingTem(propertiesMap.get("dryingTem").toString())
|
||||||
|
.fillLight(propertiesMap.get("fillLight").toString())
|
||||||
|
.camera(propertiesMap.get("camera").toString())
|
||||||
|
.pestPhotos(propertiesMap.get("pestPhotos").toString())
|
||||||
|
.build();
|
||||||
|
return build;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 展连IOT墒情设备数据映射
|
||||||
|
*/
|
||||||
|
public DeviceRealtimedataMoisture setMoistureDataByZhanLian(JSONObject propertiesMap){
|
||||||
|
DeviceRealtimedataMoisture build = DeviceRealtimedataMoisture.builder()
|
||||||
|
.deviceId(propertiesMap.get("deviceId").toString())
|
||||||
|
.soilTemp(propertiesMap.getBigDecimal("soilTemp"))
|
||||||
|
.soilHumi(propertiesMap.getBigDecimal("soilHumi"))
|
||||||
|
.soilEc(propertiesMap.getBigDecimal("soilEc"))
|
||||||
|
.soilPh(propertiesMap.getBigDecimal("soilPh"))
|
||||||
|
.soilTemp1(propertiesMap.getBigDecimal("soilTemp_1"))
|
||||||
|
.soilHumi1(propertiesMap.getBigDecimal("soilHumi_1"))
|
||||||
|
.soilTemp2(propertiesMap.getBigDecimal("soilTemp_2"))
|
||||||
|
.soilHumi2(propertiesMap.getBigDecimal("soilHumi_2"))
|
||||||
|
.soilTemp3(propertiesMap.getBigDecimal("soilTemp_3"))
|
||||||
|
.soilHumi3(propertiesMap.getBigDecimal("soilHumi_3"))
|
||||||
|
.soilTemp4(propertiesMap.getBigDecimal("soilTemp_4"))
|
||||||
|
.soilHumi4(propertiesMap.getBigDecimal("soilHumi_4"))
|
||||||
|
.airTemp(propertiesMap.getBigDecimal("airTemp"))
|
||||||
|
.mppTemp(propertiesMap.getBigDecimal("mppTemp"))
|
||||||
|
.batteryCap(propertiesMap.getBigDecimal("batteryCap"))
|
||||||
|
.batteryVolt(propertiesMap.getBigDecimal("batteryVolt"))
|
||||||
|
.batteryCur(propertiesMap.getBigDecimal("batteryCur"))
|
||||||
|
.batteryPower(propertiesMap.getBigDecimal("batteryPower"))
|
||||||
|
.loadVolt(propertiesMap.getBigDecimal("loadVolt"))
|
||||||
|
.loadCur(propertiesMap.getBigDecimal("loadCur"))
|
||||||
|
.loadPower(propertiesMap.getBigDecimal("loadPower"))
|
||||||
|
.photVolt(propertiesMap.getBigDecimal("photVolt"))
|
||||||
|
.photCur(propertiesMap.getBigDecimal("photCur"))
|
||||||
|
.photPower(propertiesMap.getBigDecimal("photPower"))
|
||||||
|
.cumChargeDay(propertiesMap.getBigDecimal("cum_charge_day"))
|
||||||
|
.cumChargeMon(propertiesMap.getBigDecimal("cum_charge_mon"))
|
||||||
|
.cumChargeYear(propertiesMap.getBigDecimal("cum_charge_year"))
|
||||||
|
.cumChargeAll(propertiesMap.getBigDecimal("cum_charge_all"))
|
||||||
|
.cumEleDay(propertiesMap.getBigDecimal("cum_ele_day"))
|
||||||
|
.cumEleMon(propertiesMap.getBigDecimal("cum_ele_mon"))
|
||||||
|
.cumEleYear(propertiesMap.getBigDecimal("cum_ele_year"))
|
||||||
|
.cumEleAll(propertiesMap.getBigDecimal("cum_ele_all"))
|
||||||
|
.shoudong(propertiesMap.getLong("shoudong"))
|
||||||
|
.control(propertiesMap.getLong("control"))
|
||||||
|
//TODO set实时时间
|
||||||
|
.saveTime(DateUtils.getNowDate())
|
||||||
|
.build();
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
try {
|
||||||
|
Date date = sdf.parse(propertiesMap.get("realTime").toString());
|
||||||
|
build.setRealTime(date);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new ServiceException("时间格式转换失败!");
|
||||||
|
}
|
||||||
|
System.err.println("墒情设备实时数据:"+build);
|
||||||
|
return build;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 展连IOT气象设备数据映射
|
||||||
|
*/
|
||||||
|
public DeviceRealtimedataMeteorology setMeteorologyDataByZhanLian(JSONObject propertiesMap) {
|
||||||
|
DeviceRealtimedataMeteorology build = DeviceRealtimedataMeteorology.builder()
|
||||||
|
.deviceId(propertiesMap.getStr("deviceId"))
|
||||||
|
.airTemp(propertiesMap.getBigDecimal("airTemp"))
|
||||||
|
.airHumi(propertiesMap.getBigDecimal("airHumi"))
|
||||||
|
.windSpeed(propertiesMap.getBigDecimal("windSpeed"))
|
||||||
|
.windDir(propertiesMap.getBigDecimal("windDir"))
|
||||||
|
.airPre(propertiesMap.getBigDecimal("airPre"))
|
||||||
|
.guangzhao(propertiesMap.getBigDecimal("guangzhao"))
|
||||||
|
.fushe(propertiesMap.getBigDecimal("fushe"))
|
||||||
|
.sumRain(propertiesMap.getBigDecimal("sumRain"))
|
||||||
|
.sumRain(propertiesMap.getBigDecimal("sumRain"))
|
||||||
|
.insRain((propertiesMap.getBigDecimal("insRain")))
|
||||||
|
.dayRain(propertiesMap.getBigDecimal("dayRain"))
|
||||||
|
.zhengfa(propertiesMap.getBigDecimal("zhengfa"))
|
||||||
|
.soilTemp(propertiesMap.getBigDecimal("soilTemp"))
|
||||||
|
.soilHumi(propertiesMap.getBigDecimal("soilHumi"))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
build.setSaveTime(DateUtils.getNowDate());
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
try {
|
||||||
|
Date date = sdf.parse(propertiesMap.getStr("realTime"));
|
||||||
|
build.setRealTime(date);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new ServiceException("时间格式转换失败!");
|
||||||
|
}
|
||||||
|
System.err.println("气象设备实时数据:"+build);
|
||||||
|
return build;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 展连IOT苗情设备数据映射
|
||||||
|
*/
|
||||||
|
public DeviceRealtimedataMiaoqing setMiaoqingDataByZhanLian(JSONObject propertiesMap) {
|
||||||
|
DeviceRealtimedataMiaoqing build = DeviceRealtimedataMiaoqing.builder()
|
||||||
|
.deviceId(propertiesMap.getStr("deviceId"))
|
||||||
|
.airTemp(propertiesMap.getBigDecimal("airTemp"))
|
||||||
|
.mppTemp(propertiesMap.getBigDecimal("mppTemp"))
|
||||||
|
.batteryCap(propertiesMap.getLong("batteryCap"))
|
||||||
|
.batteryVolt(propertiesMap.getBigDecimal("batteryVolt"))
|
||||||
|
.batteryCur(propertiesMap.getBigDecimal("batteryCur"))
|
||||||
|
.batteryPower(propertiesMap.getBigDecimal("batteryPower"))
|
||||||
|
.loadVolt(propertiesMap.getBigDecimal("loadVolt"))
|
||||||
|
.loadCur(propertiesMap.getBigDecimal("loadCur"))
|
||||||
|
.loadPower(propertiesMap.getBigDecimal("loadPower"))
|
||||||
|
.photVolt(propertiesMap.getBigDecimal("photVolt"))
|
||||||
|
.photCur(propertiesMap.getBigDecimal("photCur"))
|
||||||
|
.photPower(propertiesMap.getBigDecimal("photPower"))
|
||||||
|
.cumChargeDay(propertiesMap.getBigDecimal("cum_charge_day"))
|
||||||
|
.cumChargeMon(propertiesMap.getBigDecimal("cum_charge_mon"))
|
||||||
|
.cumChargeYear(propertiesMap.getBigDecimal("cum_charge_year"))
|
||||||
|
.cumChargeAll(propertiesMap.getBigDecimal("cum_charge_all"))
|
||||||
|
.cumEleDay(propertiesMap.getBigDecimal("cum_ele_day"))
|
||||||
|
.cumEleMon(propertiesMap.getBigDecimal("cum_ele_mon"))
|
||||||
|
.cumEleYear(propertiesMap.getBigDecimal("cum_ele_year"))
|
||||||
|
.cumEleAll(propertiesMap.getBigDecimal("cum_ele_all"))
|
||||||
|
.shoudong(propertiesMap.getBigDecimal("shoudong"))
|
||||||
|
.control(propertiesMap.getBigDecimal("control"))
|
||||||
|
.build();
|
||||||
|
build.setSaveTime(DateUtils.getNowDate());
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
try {
|
||||||
|
Date date = sdf.parse(propertiesMap.getStr("realTime"));
|
||||||
|
build.setRealTime(date);
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new ServiceException("时间格式转换失败!");
|
||||||
|
}
|
||||||
|
return build;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.fastbee.iot.strategy;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
|
||||||
|
public interface DeviceRealTimeDataStorageStrategy {
|
||||||
|
|
||||||
|
boolean storageDeviceRealTimeData(JSONObject deviceRealTimeData);
|
||||||
|
}
|
@ -1,8 +0,0 @@
|
|||||||
package com.fastbee.iot.strategy;
|
|
||||||
|
|
||||||
import cn.hutool.json.JSONObject;
|
|
||||||
import java.util.List;
|
|
||||||
public interface DeviceRealTimeDataStrategy {
|
|
||||||
|
|
||||||
List<JSONObject> getDeviceRealTimeData(String deviceId);
|
|
||||||
}
|
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.fastbee.iot.strategy.factory;
|
||||||
|
|
||||||
|
import com.fastbee.iot.strategy.DeviceRealTimeDataGetStrategy;
|
||||||
|
import com.fastbee.iot.strategy.impl.RenKeDeviceRealTimeGetStrategy;
|
||||||
|
import com.fastbee.iot.strategy.impl.ZhanLianDeviceRealTimeDataGetStrategy;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class DeviceRealTimeDataGetFactory {
|
||||||
|
@Autowired
|
||||||
|
private ZhanLianDeviceRealTimeDataGetStrategy zhanLianDeviceRealTimeDataGetStrategy;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RenKeDeviceRealTimeGetStrategy renKeDeviceRealTimeGetStrategy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备品牌获取设备实时数据策略
|
||||||
|
* @param deviceBrand 设备品牌
|
||||||
|
* @return 设备实时数据策略
|
||||||
|
*/
|
||||||
|
|
||||||
|
public DeviceRealTimeDataGetStrategy getDeviceRealTimeDataGetStrategy(String deviceBrand){
|
||||||
|
if(deviceBrand.equals("展连IOT")){
|
||||||
|
return zhanLianDeviceRealTimeDataGetStrategy;
|
||||||
|
}else if(deviceBrand.equals("仁科")){
|
||||||
|
return renKeDeviceRealTimeGetStrategy;
|
||||||
|
}else {
|
||||||
|
throw new RuntimeException("暂不支持该设备品牌");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
package com.fastbee.iot.strategy.factory;
|
||||||
|
|
||||||
|
public class DeviceRealTimeDataStorageFactory {
|
||||||
|
}
|
@ -0,0 +1,4 @@
|
|||||||
|
package com.fastbee.iot.strategy.impl;
|
||||||
|
|
||||||
|
public class MoistureDeviceRealTimeDataStorageStrategy {
|
||||||
|
}
|
@ -0,0 +1,149 @@
|
|||||||
|
package com.fastbee.iot.strategy.impl;
|
||||||
|
|
||||||
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
|
import cn.hutool.json.JSONArray;
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||||
|
import com.fastbee.common.exception.ServiceException;
|
||||||
|
import com.fastbee.iot.domain.Device;
|
||||||
|
import com.fastbee.iot.mapper.DeviceMapper;
|
||||||
|
import com.fastbee.iot.strategy.DeviceRealTimeDataGetStrategy;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 仁科设备数据对接
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class RenKeDeviceRealTimeGetStrategy implements DeviceRealTimeDataGetStrategy {
|
||||||
|
|
||||||
|
private final static String BASE_URL="http://farm.0531yun.cn";
|
||||||
|
private final static String LOGIN_URL="http://api.farm.0531yun.cn/api/v2.0/entrance/user/userLogin";
|
||||||
|
private final static String DEVICE_BASE_DATA_URL="http://api.farm.0531yun.cn/api/v2.0/entrance/device/getRealTimeData";
|
||||||
|
private final static String DEVICE_CORE_DATA_URL="http://api.farm.0531yun.cn/api/v2.0/worm/deviceData/getWormDataAndWormDataAIBy";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StringRedisTemplate stringRedisTemplate;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DeviceMapper deviceMapper;
|
||||||
|
@Override
|
||||||
|
public JSONObject getDeviceRealTimeData(String deviceId) {
|
||||||
|
|
||||||
|
//根据产品查询对应设备
|
||||||
|
Device device = new LambdaQueryChainWrapper<>(deviceMapper)
|
||||||
|
.select(Device::getDeviceId,Device::getSerialNumber,Device::getDevParams)
|
||||||
|
.eq(Device::getSerialNumber,deviceId)
|
||||||
|
.eq(Device::getDelFlag, 0)
|
||||||
|
.one();
|
||||||
|
if(device == null){
|
||||||
|
throw new RuntimeException("仁科设备不存在!设备id为:"+deviceId);
|
||||||
|
}
|
||||||
|
//解析设备对接参数
|
||||||
|
String devParams = device.getDevParams();
|
||||||
|
if(StringUtils.isBlank(devParams)){
|
||||||
|
throw new RuntimeException("展连设备对接参数为空!设备id为:"+device.getDeviceId());
|
||||||
|
}
|
||||||
|
JSONArray paramArray = JSONUtil.parseArray(devParams);
|
||||||
|
//解析对接参数列表建立map
|
||||||
|
Map<String, String> params = new HashMap<>();
|
||||||
|
//解析参数列表建立map
|
||||||
|
paramArray.forEach(paramObj->{
|
||||||
|
JSONObject entries = JSONUtil.parseObj(paramObj);
|
||||||
|
Object key = entries.get("key");
|
||||||
|
Object value = entries.get("value");
|
||||||
|
params.put(key.toString(),value.toString());
|
||||||
|
});
|
||||||
|
//获取token
|
||||||
|
String token = getToken(params.get("account"), params.get("password"));
|
||||||
|
//获取设备基础实时数据
|
||||||
|
HttpResponse response = HttpRequest.get(DEVICE_BASE_DATA_URL)
|
||||||
|
.header("token", token)
|
||||||
|
.form("deviceAddrs", deviceId)
|
||||||
|
.execute();
|
||||||
|
String respBodyStr = response.body();
|
||||||
|
JSONObject respBody = JSONUtil.parseObj(respBodyStr);
|
||||||
|
// System.err.println(respBodyStr);
|
||||||
|
if(!respBody.get("code").toString().equals("1000")){
|
||||||
|
throw new ServiceException("获取设备实时数据失败!");
|
||||||
|
}
|
||||||
|
JSONArray realtimeDataList = JSONUtil.parseArray(respBody.get("data"));
|
||||||
|
JSONObject jsonObject = JSONUtil.parseObj(realtimeDataList.get(0));
|
||||||
|
JSONObject dataMap = JSONUtil.parseObj(jsonObject.get("data"));
|
||||||
|
dataMap.put("deviceId",deviceId);
|
||||||
|
|
||||||
|
//获取虫情设备关键数据
|
||||||
|
HttpResponse response1 = HttpRequest.get(DEVICE_CORE_DATA_URL+"?deviceAddr="+deviceId)
|
||||||
|
.header("token", token)
|
||||||
|
.execute();
|
||||||
|
|
||||||
|
String respBodyStr1 = response1.body();
|
||||||
|
JSONObject respBody1 = JSONUtil.parseObj(respBodyStr1);
|
||||||
|
// System.err.println(respBodyStr1);
|
||||||
|
if(!respBody1.get("code") .toString().equals("1000")) {
|
||||||
|
throw new RuntimeException("获取设备实时数据失败!");
|
||||||
|
}
|
||||||
|
System.err.println(respBody1);
|
||||||
|
JSONArray jsonArray = JSONUtil.parseArray(respBody1.get("data"));
|
||||||
|
JSONObject entries = JSONUtil.parseObj(jsonArray.get(0));
|
||||||
|
|
||||||
|
//获取害虫种类以及数量
|
||||||
|
JSONArray analyseData = JSONUtil.parseArray(entries.get("analyseData"));
|
||||||
|
//有害虫时保存
|
||||||
|
if(!analyseData.isEmpty()){
|
||||||
|
//获取拍照图片
|
||||||
|
Object imagesUrl = entries .get("imagesUrl");
|
||||||
|
//获取虫情分析后的图片地址
|
||||||
|
Object analyseCoordUrl = entries .get("analyseCoordUrl");
|
||||||
|
dataMap.put("pestPhotos",analyseCoordUrl.toString());
|
||||||
|
dataMap.put("camera",imagesUrl.toString());
|
||||||
|
}
|
||||||
|
return dataMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取token
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getToken(String account,String password){
|
||||||
|
//判断token是否过期
|
||||||
|
String cacheToken = stringRedisTemplate.opsForValue().get("renke:user:token");
|
||||||
|
if (!Objects.isNull(cacheToken)){
|
||||||
|
return cacheToken;
|
||||||
|
}
|
||||||
|
//获取鉴权token
|
||||||
|
//构建请求体
|
||||||
|
Map<String,Object> reqBody =new HashMap<>();
|
||||||
|
reqBody.put("loginName",account);
|
||||||
|
reqBody.put("loginPwd",password);
|
||||||
|
|
||||||
|
HttpResponse response = HttpRequest.post(LOGIN_URL)
|
||||||
|
.body(JSONUtil.toJsonStr(reqBody)).execute();
|
||||||
|
String resultObjectStr = response.body();
|
||||||
|
|
||||||
|
JSONObject resultObject = JSONUtil.parseObj(resultObjectStr);
|
||||||
|
if(!resultObject.get("code").toString().equals("1000")){
|
||||||
|
throw new RuntimeException("仁科获取token失败!");
|
||||||
|
}
|
||||||
|
JSONObject tokenObject = JSONUtil.parseObj(resultObject.get("data"));
|
||||||
|
int currDate = Integer.parseInt(tokenObject.get("currDate").toString());
|
||||||
|
int expDate = Integer.parseInt(tokenObject.get("expDate").toString());
|
||||||
|
Integer periodValidity= expDate - currDate;
|
||||||
|
//将token存入redis
|
||||||
|
// return tokenObject.get("token").toString();
|
||||||
|
stringRedisTemplate.opsForValue().set("renke:user:token", tokenObject.get("token").toString(),2, TimeUnit.HOURS);
|
||||||
|
// System.err.println("请求获取到token:"+tokenObject.get("token").toString());
|
||||||
|
return stringRedisTemplate.opsForValue().get("renke:user:token");
|
||||||
|
}
|
||||||
|
}
|
@ -4,34 +4,33 @@ import cn.hutool.json.JSONArray;
|
|||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||||
|
|
||||||
|
|
||||||
import com.fastbee.deviceData.api.devlink.service.ZhanLianConfig;
|
import com.fastbee.deviceData.api.devlink.service.ZhanLianConfig;
|
||||||
import com.fastbee.iot.domain.Device;
|
import com.fastbee.iot.domain.Device;
|
||||||
import com.fastbee.iot.mapper.DeviceMapper;
|
import com.fastbee.iot.mapper.DeviceMapper;
|
||||||
import com.fastbee.iot.strategy.DeviceRealTimeDataStrategy;
|
import com.fastbee.iot.strategy.DeviceRealTimeDataGetStrategy;
|
||||||
import com.fastbee.iot.zhanlian.ZhanLianAuthorizationService;
|
import com.fastbee.iot.zhanlian.ZhanLianAuthorizationService;
|
||||||
import com.fastbee.iot.zhanlian.ZhanLianBaseService;
|
import com.fastbee.iot.zhanlian.ZhanLianBaseService;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 展连设备获取实时数据
|
||||||
|
*/
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class ZhanLianDeviceRealTimeDataStrategy implements DeviceRealTimeDataStrategy {
|
public class ZhanLianDeviceRealTimeDataGetStrategy implements DeviceRealTimeDataGetStrategy {
|
||||||
|
private final static String BASE_URL = "https://plat.developlink.cloud/prod-api/iot/data/forward";
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private DeviceMapper deviceMapper;
|
private DeviceMapper deviceMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<JSONObject> getDeviceRealTimeData(String deviceId) {
|
public JSONObject getDeviceRealTimeData(String deviceId) {
|
||||||
|
|
||||||
//根据产品查询对应设备
|
//查询对应设备信息
|
||||||
Device device = new LambdaQueryChainWrapper<>(deviceMapper)
|
Device device = new LambdaQueryChainWrapper<>(deviceMapper)
|
||||||
.select(Device::getDeviceId,Device::getSerialNumber,Device::getDevParams)
|
.select(Device::getDeviceId,Device::getSerialNumber,Device::getDevParams)
|
||||||
.eq(Device::getSerialNumber,deviceId)
|
.eq(Device::getSerialNumber,deviceId)
|
||||||
@ -57,30 +56,31 @@ public class ZhanLianDeviceRealTimeDataStrategy implements DeviceRealTimeDataStr
|
|||||||
params.put(key.toString(),value.toString());
|
params.put(key.toString(),value.toString());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
//获取请求地址
|
//获取请求地址
|
||||||
String authEndpoint = ZhanLianAuthorizationService.getAuthEndpoint(ZhanLianConfig.builder()
|
String authEndpoint = ZhanLianAuthorizationService.getAuthEndpoint(ZhanLianConfig.builder()
|
||||||
.ak(params.get("ak"))
|
.ak(params.get("ak"))
|
||||||
.sk(params.get("sk"))
|
.sk(params.get("sk"))
|
||||||
.authId( params.get("authId"))
|
.authId( params.get("authId"))
|
||||||
.endpoint("https://plat.developlink.cloud/prod-api/iot/data/forward")
|
.endpoint(BASE_URL)
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
//请求参数构建
|
//请求参数构建
|
||||||
HashMap<String, Object> reqBody = new HashMap<>();
|
HashMap<String, Object> reqBody = new HashMap<>();
|
||||||
reqBody.put("method","get");
|
reqBody.put("method","get");
|
||||||
reqBody.put("path","api/v1/product/device/run_status");
|
reqBody.put("path","api/v1/product/device/run_status");
|
||||||
|
|
||||||
Map<String,Object> param =new HashMap<>();
|
Map<String,Object> param =new HashMap<>();
|
||||||
|
|
||||||
param.put("id", deviceId);
|
param.put("id", deviceId);
|
||||||
reqBody.put("params",params);
|
reqBody.put("params",param);
|
||||||
|
|
||||||
ZhanLianBaseService zhanLianBaseService = new ZhanLianBaseService();
|
ZhanLianBaseService zhanLianBaseService = new ZhanLianBaseService();
|
||||||
//请求设备
|
//请求设备
|
||||||
|
System.err.println(reqBody);
|
||||||
JSONObject respObj = zhanLianBaseService.baseRequest(reqBody, authEndpoint);
|
JSONObject respObj = zhanLianBaseService.baseRequest(reqBody, authEndpoint);
|
||||||
//解析设备实时数据
|
//解析设备实时数据
|
||||||
Map<String, String> deviceRealTimeData = getDeviceRealTimeData(respObj, deviceId);
|
JSONObject deviceRealTimeData = getDeviceRealTimeData(respObj, deviceId);
|
||||||
//映射为数据存储对象
|
//映射为数据存储对象
|
||||||
return null;
|
return deviceRealTimeData;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -88,7 +88,7 @@ public class ZhanLianDeviceRealTimeDataStrategy implements DeviceRealTimeDataStr
|
|||||||
* @param deviceId 设备id
|
* @param deviceId 设备id
|
||||||
* @return 实时数据
|
* @return 实时数据
|
||||||
*/
|
*/
|
||||||
public Map<String,String> getDeviceRealTimeData(JSONObject data ,String deviceId){
|
public JSONObject getDeviceRealTimeData(JSONObject data ,String deviceId){
|
||||||
|
|
||||||
//获取设备状态
|
//获取设备状态
|
||||||
JSONObject jsonObjectData = JSONUtil.parseObj(data);
|
JSONObject jsonObjectData = JSONUtil.parseObj(data);
|
||||||
@ -100,7 +100,7 @@ public class ZhanLianDeviceRealTimeDataStrategy implements DeviceRealTimeDataStr
|
|||||||
JSONArray propertiesArray = JSONUtil.parseArray(properties);
|
JSONArray propertiesArray = JSONUtil.parseArray(properties);
|
||||||
//获取设备各项属性实时数据
|
//获取设备各项属性实时数据
|
||||||
//设备属性与值建立map
|
//设备属性与值建立map
|
||||||
Map<String, String> propertiesMap = new HashMap<>();
|
JSONObject propertiesMap = new JSONObject();
|
||||||
propertiesArray.forEach(p -> {
|
propertiesArray.forEach(p -> {
|
||||||
Object property = JSONUtil.parseObj(p).get("property");
|
Object property = JSONUtil.parseObj(p).get("property");
|
||||||
JSONObject propertyMap = JSONUtil.parseObj(property);
|
JSONObject propertyMap = JSONUtil.parseObj(property);
|
||||||
@ -119,7 +119,6 @@ public class ZhanLianDeviceRealTimeDataStrategy implements DeviceRealTimeDataStr
|
|||||||
Object list = JSONUtil.parseObj(p).get("list");
|
Object list = JSONUtil.parseObj(p).get("list");
|
||||||
//建立属性-值映射关系
|
//建立属性-值映射关系
|
||||||
propertiesMap.put(key,value);
|
propertiesMap.put(key,value);
|
||||||
|
|
||||||
});
|
});
|
||||||
propertiesMap.put("status",status.toString());
|
propertiesMap.put("status",status.toString());
|
||||||
propertiesMap.put("deviceId",deviceId);
|
propertiesMap.put("deviceId",deviceId);
|
@ -0,0 +1,73 @@
|
|||||||
|
package com.fastbee.iot.strategy;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import com.fastbee.common.core.domain.AjaxResult;
|
||||||
|
import com.fastbee.iot.strategy.factory.DeviceRealTimeDataGetFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/temp")
|
||||||
|
public class test11 {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DeviceRealTimeDataGetFactory dataGetFactory;
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping("/test")
|
||||||
|
public AjaxResult test(){
|
||||||
|
|
||||||
|
String deviceId = "3270";
|
||||||
|
String deviceBrand = "展连IOT";
|
||||||
|
// String deviceId = "1017240042";
|
||||||
|
// String deviceBrand = "仁科";
|
||||||
|
Long productId = 143L;
|
||||||
|
//获取设备对应数据获取器
|
||||||
|
DeviceRealTimeDataGetStrategy DataGetMachine = dataGetFactory.getDeviceRealTimeDataGetStrategy(deviceBrand);
|
||||||
|
//获取设备实时数据
|
||||||
|
JSONObject deviceRealTimeData = DataGetMachine.getDeviceRealTimeData(deviceId);
|
||||||
|
System.err.println(deviceRealTimeData);
|
||||||
|
return AjaxResult.success(deviceRealTimeData);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String deviceId = "3270";
|
||||||
|
String deviceBrand = "展连IOT";
|
||||||
|
Long productId = 142L;
|
||||||
|
//设备实时数据获取器工厂
|
||||||
|
DeviceRealTimeDataGetFactory dataGetFactory = new DeviceRealTimeDataGetFactory();
|
||||||
|
//获取设备对应数据获取器
|
||||||
|
DeviceRealTimeDataGetStrategy DataGetMachine = dataGetFactory.getDeviceRealTimeDataGetStrategy(deviceBrand);
|
||||||
|
//获取设备实时数据
|
||||||
|
JSONObject deviceRealTimeData = DataGetMachine.getDeviceRealTimeData(deviceId);
|
||||||
|
System.err.println(deviceRealTimeData);
|
||||||
|
|
||||||
|
//获取实时数据存储器
|
||||||
|
//映射并持久化设备数据
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -25,8 +25,9 @@ public class ZhanLianBaseService {
|
|||||||
String jsonStr = JSONUtil.toJsonStr(body);
|
String jsonStr = JSONUtil.toJsonStr(body);
|
||||||
String respStr = HttpUtil.post(url,jsonStr);
|
String respStr = HttpUtil.post(url,jsonStr);
|
||||||
JSONObject resp = JSONUtil.parseObj(respStr);
|
JSONObject resp = JSONUtil.parseObj(respStr);
|
||||||
if(!resp.get("code").toString().equals("200")){
|
System.err.println(resp);
|
||||||
throw new ServiceException(resp.get("message").toString());
|
if(!resp.getStr("code").equals("200")){
|
||||||
|
throw new ServiceException("展联基本请求失败!");
|
||||||
}
|
}
|
||||||
return resp.getJSONObject("data");
|
return resp.getJSONObject("data");
|
||||||
}
|
}
|
||||||
|
@ -370,7 +370,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
d.serial_number, d.management_unit, d.caretaker, d.tel,
|
d.serial_number, d.management_unit, d.caretaker, d.tel,
|
||||||
d.firmware_version, d.status, d.rssi,d.is_shadow,d.is_simulate ,d.location_way,d.things_model_value,
|
d.firmware_version, d.status, d.rssi,d.is_shadow,d.is_simulate ,d.location_way,d.things_model_value,
|
||||||
d.network_address, d.network_ip, d.longitude, d.latitude, d.active_time, d.create_time, d.update_time,
|
d.network_address, d.network_ip, d.longitude, d.latitude, d.active_time, d.create_time, d.update_time,
|
||||||
d.img_url,d.summary,d.remark,p.guid from iot_device d
|
d.img_url,d.summary,d.remark,d.dev_params,p.guid from iot_device d
|
||||||
left join iot_product p on p.product_id=d.product_id
|
left join iot_product p on p.product_id=d.product_id
|
||||||
where device_id = #{deviceId}
|
where device_id = #{deviceId}
|
||||||
</select>
|
</select>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user