Merge branch 'master' of codeup.aliyun.com:6428039c708c83a3fd907211/hzwmiot/hzwmiot24_java
This commit is contained in:
commit
5f40c70a81
@ -89,8 +89,12 @@ public class DeviceDetailController extends BaseController {
|
|||||||
if (null == queryLogVo.getDeviceId() || queryLogVo.getDeviceId() == 0L) {
|
if (null == queryLogVo.getDeviceId() || queryLogVo.getDeviceId() == 0L) {
|
||||||
return AjaxResult.error("请选择设备");
|
return AjaxResult.error("请选择设备");
|
||||||
}
|
}
|
||||||
|
//设备历史echart数据
|
||||||
List<Object> list = deviceDetailService.gongdianChart(queryLogVo);
|
List<Object> list = deviceDetailService.gongdianChart(queryLogVo);
|
||||||
return AjaxResult.success(list);
|
AjaxResult ajaxResult = AjaxResult.success();
|
||||||
|
ajaxResult.put("data", list);
|
||||||
|
ajaxResult.put("realData", deviceDetailService.gongdianRealData(queryLogVo));
|
||||||
|
return ajaxResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@ import com.fastbee.waterele.domain.dto.MaWatereleRecordDto;
|
|||||||
import com.fastbee.xunjian.domain.XjInspectionRecords;
|
import com.fastbee.xunjian.domain.XjInspectionRecords;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public interface IDeviceDetailService {
|
public interface IDeviceDetailService {
|
||||||
@ -34,4 +35,10 @@ public interface IDeviceDetailService {
|
|||||||
CommonResult<CmdHaiWeiVo> cmdDevices(CmdHaiWeiDto cmdHaiWeiDto);
|
CommonResult<CmdHaiWeiVo> cmdDevices(CmdHaiWeiDto cmdHaiWeiDto);
|
||||||
|
|
||||||
AnfangInfoVo anfangInfo(Long deviceId);
|
AnfangInfoVo anfangInfo(Long deviceId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 供电实时数据
|
||||||
|
* @param queryLogVo
|
||||||
|
*/
|
||||||
|
List<HashMap<Object, Object>> gongdianRealData(QueryLogVo queryLogVo);
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
package com.fastbee.data.service.devicedetail.impl;
|
package com.fastbee.data.service.devicedetail.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.fastbee.common.core.domain.CommonResult;
|
import com.fastbee.common.core.domain.CommonResult;
|
||||||
import com.fastbee.common.model.vo.iot.QueryLogVo;
|
import com.fastbee.common.model.vo.iot.QueryLogVo;
|
||||||
import com.fastbee.common.utils.DevParamsUtils;
|
import com.fastbee.common.utils.DevParamsUtils;
|
||||||
@ -9,11 +13,14 @@ import com.fastbee.data.domain.vo.AnfangInfoVo;
|
|||||||
import com.fastbee.data.service.devicedetail.IDeviceDetailService;
|
import com.fastbee.data.service.devicedetail.IDeviceDetailService;
|
||||||
import com.fastbee.iot.anfang.service.IUploadedPhotosService;
|
import com.fastbee.iot.anfang.service.IUploadedPhotosService;
|
||||||
import com.fastbee.iot.domain.Device;
|
import com.fastbee.iot.domain.Device;
|
||||||
|
import com.fastbee.iot.domain.DeviceLog;
|
||||||
|
import com.fastbee.iot.domain.ThingsModel;
|
||||||
import com.fastbee.iot.haiwei.service.HaiWeiService;
|
import com.fastbee.iot.haiwei.service.HaiWeiService;
|
||||||
import com.fastbee.iot.mapper.DeviceMapper;
|
import com.fastbee.iot.mapper.DeviceMapper;
|
||||||
import com.fastbee.iot.model.anfang.UploadedPhotos;
|
import com.fastbee.iot.model.anfang.UploadedPhotos;
|
||||||
import com.fastbee.iot.model.haiwei.CmdHaiWeiVo;
|
import com.fastbee.iot.model.haiwei.CmdHaiWeiVo;
|
||||||
import com.fastbee.iot.model.haiwei.dto.CmdHaiWeiDto;
|
import com.fastbee.iot.model.haiwei.dto.CmdHaiWeiDto;
|
||||||
|
import com.fastbee.iot.service.IDeviceLogService;
|
||||||
import com.fastbee.iot.service.IDeviceService;
|
import com.fastbee.iot.service.IDeviceService;
|
||||||
import com.fastbee.iot.service.IThingsModelService;
|
import com.fastbee.iot.service.IThingsModelService;
|
||||||
import com.fastbee.waterele.domain.MaWatereleRecord;
|
import com.fastbee.waterele.domain.MaWatereleRecord;
|
||||||
@ -28,6 +35,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.xml.crypto.Data;
|
import javax.xml.crypto.Data;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class DeviceDetailServiceImpl implements IDeviceDetailService {
|
public class DeviceDetailServiceImpl implements IDeviceDetailService {
|
||||||
@ -47,6 +55,10 @@ public class DeviceDetailServiceImpl implements IDeviceDetailService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IUploadedPhotosService uploadedPhotosService;
|
private IUploadedPhotosService uploadedPhotosService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IDeviceLogService logService;
|
||||||
|
|
||||||
public DeviceDetailServiceImpl(DeviceMapper deviceMapper) {
|
public DeviceDetailServiceImpl(DeviceMapper deviceMapper) {
|
||||||
this.deviceMapper = deviceMapper;
|
this.deviceMapper = deviceMapper;
|
||||||
}
|
}
|
||||||
@ -97,6 +109,7 @@ public class DeviceDetailServiceImpl implements IDeviceDetailService {
|
|||||||
return deviceLogAllCurves;
|
return deviceLogAllCurves;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<XjInspectionRecords> xunjianRecord(QueryLogVo queryLogVo) {
|
public List<XjInspectionRecords> xunjianRecord(QueryLogVo queryLogVo) {
|
||||||
//todo
|
//todo
|
||||||
@ -112,7 +125,7 @@ public class DeviceDetailServiceImpl implements IDeviceDetailService {
|
|||||||
xjInspectionRoutes.setEngineeringObjectId(deviceId);
|
xjInspectionRoutes.setEngineeringObjectId(deviceId);
|
||||||
xjInspectionRoutes.setEngineeringObjectType("1");
|
xjInspectionRoutes.setEngineeringObjectType("1");
|
||||||
List<XjInspectionRoutes> xjInspectionRoutes1 = xjInspectionRoutesMapper.selectXjInspectionRoutesList(xjInspectionRoutes);
|
List<XjInspectionRoutes> xjInspectionRoutes1 = xjInspectionRoutesMapper.selectXjInspectionRoutesList(xjInspectionRoutes);
|
||||||
if(xjInspectionRoutes1.size() > 0){
|
if (xjInspectionRoutes1.size() > 0) {
|
||||||
List<XjInspectionRecords> xjInspectionRecordsList = new ArrayList<>();
|
List<XjInspectionRecords> xjInspectionRecordsList = new ArrayList<>();
|
||||||
XjInspectionRecords xjInspectionRecords = new XjInspectionRecords();
|
XjInspectionRecords xjInspectionRecords = new XjInspectionRecords();
|
||||||
xjInspectionRecords.setInspectionRouteId(xjInspectionRoutes1.get(0).getId());
|
xjInspectionRecords.setInspectionRouteId(xjInspectionRoutes1.get(0).getId());
|
||||||
@ -136,44 +149,129 @@ public class DeviceDetailServiceImpl implements IDeviceDetailService {
|
|||||||
Map<String, Object> devParams = DevParamsUtils.getDevParams(device.getDevParams());
|
Map<String, Object> devParams = DevParamsUtils.getDevParams(device.getDevParams());
|
||||||
//安防设备
|
//安防设备
|
||||||
String jiankongIds = devParams.get("jiankongIds").toString();
|
String jiankongIds = devParams.get("jiankongIds").toString();
|
||||||
if(StringUtils.isNotEmpty(jiankongIds)){
|
if (StringUtils.isNotEmpty(jiankongIds)) {
|
||||||
Device jiankongDevice = iDeviceService.selectDeviceByDeviceId(Long.parseLong(jiankongIds));
|
Device jiankongDevice = iDeviceService.selectDeviceByDeviceId(Long.parseLong(jiankongIds));
|
||||||
anfangInfoVo.setJiankongDevice(jiankongDevice);
|
anfangInfoVo.setJiankongDevice(jiankongDevice);
|
||||||
}
|
}
|
||||||
//安防设备
|
//安防设备
|
||||||
String anfangIds = devParams.get("anfangIds").toString();
|
String anfangIds = devParams.get("anfangIds").toString();
|
||||||
//获取设备安防状态
|
//获取设备安防状态
|
||||||
if(StringUtils.isNotEmpty(anfangIds)){
|
if (StringUtils.isNotEmpty(anfangIds)) {
|
||||||
Device anfangDevice = iDeviceService.selectDeviceByDeviceId(Long.parseLong(anfangIds));
|
Device anfangDevice = iDeviceService.selectDeviceByDeviceId(Long.parseLong(anfangIds));
|
||||||
//获取当前安防告警状态
|
//获取当前安防告警状态
|
||||||
UploadedPhotos uploadedPhotos = new UploadedPhotos();
|
UploadedPhotos uploadedPhotos = new UploadedPhotos();
|
||||||
uploadedPhotos.setSn(anfangDevice.getSerialNumber());
|
uploadedPhotos.setSn(anfangDevice.getSerialNumber());
|
||||||
List<UploadedPhotos> uploadedPhotos1 = uploadedPhotosService.selectUploadedPhotosList(uploadedPhotos);
|
List<UploadedPhotos> uploadedPhotos1 = uploadedPhotosService.selectUploadedPhotosList(uploadedPhotos);
|
||||||
int doorStatus = 0;//0=正常,1=箱门振动,2=箱门打开
|
int doorStatus = 0;//0=正常,1=箱门振动,2=箱门打开
|
||||||
if(uploadedPhotos1.size() > 0){
|
if (uploadedPhotos1.size() > 0) {
|
||||||
UploadedPhotos temp = uploadedPhotos1.get(0);
|
UploadedPhotos temp = uploadedPhotos1.get(0);
|
||||||
if(new Date().getTime() - temp.getUploadTime().getTime() < 36000000){
|
if (new Date().getTime() - temp.getUploadTime().getTime() < 36000000) {
|
||||||
if(temp.getShakeState().equals("1")){
|
if (temp.getShakeState().equals("1")) {
|
||||||
doorStatus = 1;
|
doorStatus = 1;
|
||||||
}
|
}
|
||||||
if(temp.getDoorState().equals("1")){
|
if (temp.getDoorState().equals("1")) {
|
||||||
doorStatus = 2;
|
doorStatus = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(uploadedPhotos1.size() > 5){
|
if (uploadedPhotos1.size() > 5) {
|
||||||
uploadedPhotos1 = uploadedPhotos1.subList(0,5);
|
uploadedPhotos1 = uploadedPhotos1.subList(0, 5);
|
||||||
}
|
}
|
||||||
anfangInfoVo.setDoorStatus(doorStatus);
|
anfangInfoVo.setDoorStatus(doorStatus);
|
||||||
anfangInfoVo.setAnfangList(uploadedPhotos1);
|
anfangInfoVo.setAnfangList(uploadedPhotos1);
|
||||||
}
|
}
|
||||||
//安防设备
|
//安防设备
|
||||||
String guimenIds = devParams.get("guimenIds").toString();
|
String guimenIds = devParams.get("guimenIds").toString();
|
||||||
if(StringUtils.isNotEmpty(guimenIds)){
|
if (StringUtils.isNotEmpty(guimenIds)) {
|
||||||
anfangInfoVo.setGuimenId(devParams.get("guimenIds").toString());
|
anfangInfoVo.setGuimenId(devParams.get("guimenIds").toString());
|
||||||
}
|
}
|
||||||
return anfangInfoVo;
|
return anfangInfoVo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<HashMap<Object, Object>> gongdianRealData(QueryLogVo queryLogVo) {
|
||||||
|
Long deviceId = queryLogVo.getDeviceId();
|
||||||
|
if (deviceId == null) {
|
||||||
|
throw new RuntimeException("请上传devicerId");
|
||||||
|
}
|
||||||
|
Device device = iDeviceService.selectDeviceByDeviceId(deviceId);
|
||||||
|
if (device == null) {
|
||||||
|
throw new RuntimeException("未查到该设备");
|
||||||
|
}
|
||||||
|
DateTime dateTime = DateUtil.date(new Date());
|
||||||
|
Map<String, Object> devParams = DevParamsUtils.getDevParams(device.getDevParams());
|
||||||
|
//太阳能设备
|
||||||
|
String taiyangnengIds = devParams.get("taiyangnIds").toString();
|
||||||
|
ThingsModel thingsModel1 = new ThingsModel();
|
||||||
|
thingsModel1.setProductId(138L);
|
||||||
|
List<ThingsModel> taiyangnengModels = thingsModelService.selectThingsModelList(thingsModel1);
|
||||||
|
taiyangnengModels.sort(Comparator.comparing(ThingsModel::getModelOrder));
|
||||||
|
List<HashMap<Object, Object>> list = new ArrayList<>();
|
||||||
|
if (StringUtils.isNotEmpty(taiyangnengIds)) {
|
||||||
|
Device taiyangnengDevice = deviceMapper.selectDeviceByDeviceId(Long.parseLong(taiyangnengIds));
|
||||||
|
List<DeviceLog> deviceLogs = logService.selectDeviceLogList(new DeviceLog() {{
|
||||||
|
setSerialNumber(taiyangnengDevice.getSerialNumber());
|
||||||
|
setBeginTime(DateUtil.beginOfDay(DateUtil.offsetDay(dateTime, -1)).toString());
|
||||||
|
setEndTime(DateUtil.endOfDay(dateTime).toString());
|
||||||
|
}});
|
||||||
|
Map<String, List<DeviceLog>> taiyangnengCollect = deviceLogs.stream().sorted(Comparator
|
||||||
|
.comparing(DeviceLog::getCreateTime, Comparator
|
||||||
|
.nullsFirst(Comparator.naturalOrder())).reversed()).collect(Collectors.groupingBy(t -> t.getIdentity()));
|
||||||
|
for (ThingsModel thingsModel : taiyangnengModels) {
|
||||||
|
HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{
|
||||||
|
put("upType", 0);
|
||||||
|
put("identifier", thingsModel.getIdentifier());
|
||||||
|
put("unit", "");
|
||||||
|
put("value", 0);
|
||||||
|
put("name", thingsModel.getModelName());
|
||||||
|
}};
|
||||||
|
if (StringUtils.isNotEmpty(thingsModel.getSpecs())) {
|
||||||
|
String specs = thingsModel.getSpecs();
|
||||||
|
JSONObject parse = (JSONObject) JSON.parse(specs);
|
||||||
|
if (parse.containsKey("unit")) {
|
||||||
|
hashMap.put("unit", parse.get("unit"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hashMap.size() > 1) {
|
||||||
|
List<DeviceLog> deviceLogs1 = taiyangnengCollect.get(thingsModel.getIdentifier());
|
||||||
|
if (deviceLogs1 != null) {
|
||||||
|
if (StringUtils.isNotEmpty(deviceLogs1.get(0).getLogValue())) {
|
||||||
|
if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) == Float.parseFloat(deviceLogs1.get(1).getLogValue())) {
|
||||||
|
hashMap.put("upType", 1);
|
||||||
|
} else if (Float.parseFloat(deviceLogs1.get(0).getLogValue()) < Float.parseFloat(deviceLogs1.get(1).getLogValue())) {
|
||||||
|
hashMap.put("upType", -1);
|
||||||
|
}
|
||||||
|
hashMap.put("value", deviceLogs1.get(0).getLogValue());
|
||||||
|
} else {
|
||||||
|
hashMap.put("value", "--");
|
||||||
|
hashMap.put("upType", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
} else if (hashMap.size() > 0) {
|
||||||
|
List<DeviceLog> deviceLogs2 = taiyangnengCollect.get(thingsModel.getIdentifier());
|
||||||
|
if (deviceLogs2 != null) {
|
||||||
|
hashMap.put("value", deviceLogs2.get(0).getLogValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.add(hashMap);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (ThingsModel thingsModel : taiyangnengModels) {
|
||||||
|
HashMap<Object, Object> hashMap = new HashMap<Object, Object>() {{
|
||||||
|
put("upType", 0);
|
||||||
|
put("identifier", thingsModel.getIdentifier());
|
||||||
|
put("unit", "");
|
||||||
|
put("value", 0);
|
||||||
|
put("name", thingsModel.getModelName());
|
||||||
|
}};
|
||||||
|
list.add(hashMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommonResult<CmdHaiWeiVo> cmdDevices(CmdHaiWeiDto cmdHaiWeiDto) {
|
public CommonResult<CmdHaiWeiVo> cmdDevices(CmdHaiWeiDto cmdHaiWeiDto) {
|
||||||
String url = "https://cloud.haiwell.com/api/project/machine/datagroup/setTagsValue";
|
String url = "https://cloud.haiwell.com/api/project/machine/datagroup/setTagsValue";
|
||||||
|
@ -121,6 +121,7 @@ public class GisDeviceServiceImpl implements IGisDeviceService {
|
|||||||
ThingsModel thingsModel1 = new ThingsModel();
|
ThingsModel thingsModel1 = new ThingsModel();
|
||||||
thingsModel1.setProductId(138L);
|
thingsModel1.setProductId(138L);
|
||||||
List<ThingsModel> taiyangnengModels = thingsModelService.selectThingsModelList(thingsModel1);
|
List<ThingsModel> taiyangnengModels = thingsModelService.selectThingsModelList(thingsModel1);
|
||||||
|
taiyangnengModels.sort(Comparator.comparing(ThingsModel::getModelOrder));
|
||||||
if (StringUtils.isNotEmpty(taiyangnengIds)) {
|
if (StringUtils.isNotEmpty(taiyangnengIds)) {
|
||||||
Device taiyangnengDevice = deviceMapper.selectDeviceByDeviceId(Long.parseLong(taiyangnengIds));
|
Device taiyangnengDevice = deviceMapper.selectDeviceByDeviceId(Long.parseLong(taiyangnengIds));
|
||||||
List<DeviceLog> deviceLogs = logService.selectDeviceLogList(new DeviceLog() {{
|
List<DeviceLog> deviceLogs = logService.selectDeviceLogList(new DeviceLog() {{
|
||||||
|
@ -178,6 +178,12 @@ public class Device extends BaseEntity
|
|||||||
|
|
||||||
@ApiModelProperty("设备参数")
|
@ApiModelProperty("设备参数")
|
||||||
private String devParams;
|
private String devParams;
|
||||||
|
@ApiModelProperty("管护人")
|
||||||
|
private String caretaker;
|
||||||
|
@ApiModelProperty("管护单位")
|
||||||
|
private String managementUnit;
|
||||||
|
@ApiModelProperty("联系电话")
|
||||||
|
private String tel;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关联组态,来源产品
|
* 关联组态,来源产品
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.fastbee.iot.model;
|
package com.fastbee.iot.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -66,6 +67,12 @@ public class DeviceAllShortOutput
|
|||||||
private Integer isOwner;
|
private Integer isOwner;
|
||||||
|
|
||||||
private Integer subDeviceCount;
|
private Integer subDeviceCount;
|
||||||
|
@ApiModelProperty("管护人")
|
||||||
|
private String caretaker;
|
||||||
|
@ApiModelProperty("管护单位")
|
||||||
|
private String managementUnit;
|
||||||
|
@ApiModelProperty("联系电话")
|
||||||
|
private String tel;
|
||||||
|
|
||||||
public Integer getSubDeviceCount() {
|
public Integer getSubDeviceCount() {
|
||||||
return subDeviceCount;
|
return subDeviceCount;
|
||||||
|
@ -94,6 +94,13 @@ public class DeviceShortOutput
|
|||||||
@Excel(name = "网关设备编号(子设备使用)")
|
@Excel(name = "网关设备编号(子设备使用)")
|
||||||
private String gwDevCode;
|
private String gwDevCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("管护人")
|
||||||
|
private String caretaker;
|
||||||
|
@ApiModelProperty("管护单位")
|
||||||
|
private String managementUnit;
|
||||||
|
@ApiModelProperty("联系电话")
|
||||||
|
private String tel;
|
||||||
|
|
||||||
/** 是否自定义位置 **/
|
/** 是否自定义位置 **/
|
||||||
private Integer locationWay;
|
private Integer locationWay;
|
||||||
|
|
||||||
|
@ -1635,6 +1635,7 @@ public class DeviceServiceImpl implements IDeviceService {
|
|||||||
kvHashMap.put("beginTime", beginTime);
|
kvHashMap.put("beginTime", beginTime);
|
||||||
kvHashMap.put("endTime", endTime);
|
kvHashMap.put("endTime", endTime);
|
||||||
List<ThingsModel> thingsModels = thingsModelService.selectThingsModelList(new ThingsModel(device.getProductId()));
|
List<ThingsModel> thingsModels = thingsModelService.selectThingsModelList(new ThingsModel(device.getProductId()));
|
||||||
|
thingsModels.sort(Comparator.comparing(ThingsModel::getModelOrder));
|
||||||
List<DeviceLog> deviceLogs= logService.selectDataList(kvHashMap);
|
List<DeviceLog> deviceLogs= logService.selectDataList(kvHashMap);
|
||||||
Map<String, List<DeviceLog>> collect = deviceLogs != null ? deviceLogs.stream().collect(Collectors.groupingBy(t -> t.getIdentity())): new HashMap();
|
Map<String, List<DeviceLog>> collect = deviceLogs != null ? deviceLogs.stream().collect(Collectors.groupingBy(t -> t.getIdentity())): new HashMap();
|
||||||
for (ThingsModel modelDevice : thingsModels) {
|
for (ThingsModel modelDevice : thingsModels) {
|
||||||
|
@ -36,6 +36,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="transport" column="transport" />
|
<result property="transport" column="transport" />
|
||||||
<result property="guid" column="guid" />
|
<result property="guid" column="guid" />
|
||||||
<result property="devParams" column="dev_params" />
|
<result property="devParams" column="dev_params" />
|
||||||
|
<result property="tel" column="tel" />
|
||||||
|
<result property="caretaker" column="caretaker" />
|
||||||
|
<result property="managementUnit" column="management_unit" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap type="com.fastbee.iot.model.DeviceShortOutput" id="DeviceShortResult">
|
<resultMap type="com.fastbee.iot.model.DeviceShortOutput" id="DeviceShortResult">
|
||||||
@ -65,6 +68,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="transport" column="transport" />
|
<result property="transport" column="transport" />
|
||||||
<result property="guid" column="guid" />
|
<result property="guid" column="guid" />
|
||||||
<result property="devParams" column="dev_params" />
|
<result property="devParams" column="dev_params" />
|
||||||
|
<result property="tel" column="tel" />
|
||||||
|
<result property="caretaker" column="caretaker" />
|
||||||
|
<result property="managementUnit" column="management_unit" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap type="com.fastbee.iot.model.DeviceAllShortOutput" id="DeviceAllShortResult">
|
<resultMap type="com.fastbee.iot.model.DeviceAllShortOutput" id="DeviceAllShortResult">
|
||||||
@ -86,6 +92,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<result property="isOwner" column="is_owner" />
|
<result property="isOwner" column="is_owner" />
|
||||||
<result property="subDeviceCount" column="sub_device_count"/>
|
<result property="subDeviceCount" column="sub_device_count"/>
|
||||||
<result property="devParams" column="dev_params" />
|
<result property="devParams" column="dev_params" />
|
||||||
|
<result property="tel" column="tel" />
|
||||||
|
<result property="caretaker" column="caretaker" />
|
||||||
|
<result property="managementUnit" column="management_unit" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap type="com.fastbee.iot.model.UserAndTenant" id="UserAndTenantResult">
|
<resultMap type="com.fastbee.iot.model.UserAndTenant" id="UserAndTenantResult">
|
||||||
@ -203,7 +212,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<select id="selectUnAuthDeviceList" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceResult">
|
<select id="selectUnAuthDeviceList" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceResult">
|
||||||
select d.device_id, d.device_name, d.product_id, d.product_name, d.tenant_id, d.tenant_name,
|
select d.device_id, d.device_name, d.product_id, d.product_name, d.tenant_id, d.tenant_name,
|
||||||
d.serial_number,d.gw_dev_code,d.dev_params, d.firmware_version, d.status,d.is_shadow,d.is_simulate ,d.location_way,d.active_time, d.img_url,a.device_id as auth_device_id
|
d.management_unit, d.caretaker, d.tel,
|
||||||
|
d.serial_number,d.gw_dev_code,d.dev_params, d.firmware_version, d.status,d.is_shadow,d.is_simulate ,
|
||||||
|
d.location_way,d.active_time, d.img_url,a.device_id as auth_device_id
|
||||||
from iot_device d
|
from iot_device d
|
||||||
left join iot_product_authorize a on a.device_id=d.device_id
|
left join iot_product_authorize a on a.device_id=d.device_id
|
||||||
<where>
|
<where>
|
||||||
@ -230,7 +241,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDeviceListByGroup" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceResult">
|
<select id="selectDeviceListByGroup" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceResult">
|
||||||
select d.device_id, d.device_name, d.dev_params, d.product_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
select d.device_id, d.device_name, d.dev_params, d.product_name,
|
||||||
|
d.management_unit, d.caretaker, d.tel,
|
||||||
|
d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
||||||
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
||||||
from iot_device d
|
from iot_device d
|
||||||
<where>
|
<where>
|
||||||
@ -257,7 +270,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectAllDeviceShortList" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceAllShortResult">
|
<select id="selectAllDeviceShortList" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceAllShortResult">
|
||||||
select d.device_id, d.device_name,d.dev_params, d.product_name,p.device_type, d.tenant_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
select d.device_id, d.device_name,d.dev_params, d.product_name,p.device_type,
|
||||||
|
d.management_unit, d.caretaker, d.tel,
|
||||||
|
d.tenant_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
||||||
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
d.location_way, d.active_time,d.network_address,d.longitude,d.latitude
|
||||||
from iot_device d
|
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
|
||||||
@ -307,7 +322,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<select id="selectDeviceShortList" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceShortResult">
|
<select id="selectDeviceShortList" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceShortResult">
|
||||||
select d.device_id, d.device_name, d.dev_params, p.product_id, p.product_name,p.device_type,
|
select d.device_id, d.device_name, d.dev_params, p.product_id, p.product_name,p.device_type,
|
||||||
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,
|
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,d.management_unit, d.caretaker, d.tel,
|
||||||
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,
|
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,
|
||||||
d.things_model_value, d.active_time,d.create_time, if(null = d.img_url or '' = d.img_url, p.img_url, d.img_url) as img_url,
|
d.things_model_value, d.active_time,d.create_time, if(null = d.img_url or '' = d.img_url, p.img_url, d.img_url) as img_url,
|
||||||
case
|
case
|
||||||
@ -352,7 +367,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
|
|
||||||
<select id="selectDeviceByDeviceId" parameterType="Long" resultMap="DeviceResult">
|
<select id="selectDeviceByDeviceId" parameterType="Long" resultMap="DeviceResult">
|
||||||
select d.device_id, d.device_name, d.dev_params, d.product_id, p.product_name,p.device_type, d.tenant_id, d.tenant_name,
|
select d.device_id, d.device_name, d.dev_params, d.product_id, p.product_name,p.device_type, d.tenant_id, d.tenant_name,
|
||||||
d.serial_number, d.firmware_version, d.status, d.rssi,d.is_shadow,d.is_simulate ,d.location_way,d.things_model_value,
|
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.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,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
|
||||||
@ -518,6 +534,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="isSimulate != null">is_simulate,</if>
|
<if test="isSimulate != null">is_simulate,</if>
|
||||||
<if test="slaveId != null">slave_id,</if>
|
<if test="slaveId != null">slave_id,</if>
|
||||||
<if test="devParams != null">dev_params,</if>
|
<if test="devParams != null">dev_params,</if>
|
||||||
|
<if test="managementUnit != null">management_unit,</if>
|
||||||
|
<if test="caretaker != null">caretaker,</if>
|
||||||
|
<if test="tel != null">tel,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
||||||
@ -549,11 +568,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="isSimulate != null">#{isSimulate},</if>
|
<if test="isSimulate != null">#{isSimulate},</if>
|
||||||
<if test="slaveId != null">#{slaveId},</if>
|
<if test="slaveId != null">#{slaveId},</if>
|
||||||
<if test="devParams != null">#{devParams},</if>
|
<if test="devParams != null">#{devParams},</if>
|
||||||
|
<if test="managementUnit != null">#{managementUnit},</if>
|
||||||
|
<if test="caretaker != null">#{caretaker},</if>
|
||||||
|
<if test="tel != null">#{tel},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
<insert id="insertBatchDevice" parameterType="com.fastbee.iot.domain.Device" useGeneratedKeys="true" keyProperty="deviceId">
|
<insert id="insertBatchDevice" parameterType="com.fastbee.iot.domain.Device" useGeneratedKeys="true" keyProperty="deviceId">
|
||||||
insert into iot_device (device_name, product_id, product_name, tenant_id, tenant_name, serial_number, firmware_version, rssi, is_shadow, location_way,dev_params, create_by, create_time)
|
insert into iot_device (device_name, product_id, product_name, tenant_id, tenant_name, serial_number,
|
||||||
|
firmware_version, rssi, is_shadow, location_way,dev_params, create_by, create_time)
|
||||||
values
|
values
|
||||||
<foreach collection="deviceList" item="device" separator=",">
|
<foreach collection="deviceList" item="device" separator=",">
|
||||||
(#{device.deviceName},
|
(#{device.deviceName},
|
||||||
@ -604,6 +627,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="summary != null">summary = #{summary},</if>
|
<if test="summary != null">summary = #{summary},</if>
|
||||||
<if test="slaveId != null">slave_id = #{slaveId},</if>
|
<if test="slaveId != null">slave_id = #{slaveId},</if>
|
||||||
<if test="devParams != null">dev_params = #{devParams},</if>
|
<if test="devParams != null">dev_params = #{devParams},</if>
|
||||||
|
<if test="managementUnit != null">management_unit = #{managementUnit},</if>
|
||||||
|
<if test="caretaker != null">caretaker = #{caretaker},</if>
|
||||||
|
<if test="tel != null">tel = #{tel},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where device_id = #{deviceId}
|
where device_id = #{deviceId}
|
||||||
</update>
|
</update>
|
||||||
@ -665,6 +691,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="summary != null">summary = #{summary},</if>
|
<if test="summary != null">summary = #{summary},</if>
|
||||||
<if test="gwDevCode != null">gw_dev_code = #{gwDevCode},</if>
|
<if test="gwDevCode != null">gw_dev_code = #{gwDevCode},</if>
|
||||||
<if test="devParams != null">dev_params = #{devParams},</if>
|
<if test="devParams != null">dev_params = #{devParams},</if>
|
||||||
|
<if test="managementUnit != null">management_unit = #{managementUnit},</if>
|
||||||
|
<if test="caretaker != null">caretaker = #{caretaker},</if>
|
||||||
|
<if test="tel != null">tel = #{tel},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where serial_number = #{serialNumber}
|
where serial_number = #{serialNumber}
|
||||||
</update>
|
</update>
|
||||||
@ -812,6 +841,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<select id="listTerminalUser" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceShortResult">
|
<select id="listTerminalUser" parameterType="com.fastbee.iot.domain.Device" resultMap="DeviceShortResult">
|
||||||
select d.device_id, d.device_name, d.product_id, d.product_name,p.device_type,
|
select d.device_id, d.device_name, d.product_id, d.product_name,p.device_type,
|
||||||
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,
|
d.tenant_id, d.tenant_name, d.serial_number,d.gw_dev_code,
|
||||||
|
d.management_unit, d.caretaker, d.tel,
|
||||||
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,
|
d.firmware_version, d.status,d.rssi,d.is_shadow,d.is_simulate ,d.location_way,
|
||||||
d.things_model_value, d.active_time,d.create_time,d.img_url,d.dev_params,
|
d.things_model_value, d.active_time,d.create_time,d.img_url,d.dev_params,
|
||||||
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
|
(select count(*) from iot_device d1 where d1.gw_dev_code = d.serial_number) as sub_device_count,
|
||||||
@ -879,7 +909,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="listTerminalUserByGroup" resultType="com.fastbee.iot.domain.Device">
|
<select id="listTerminalUserByGroup" resultType="com.fastbee.iot.domain.Device">
|
||||||
select d.device_id, d.device_name, d.product_name, d.serial_number,d.gw_dev_code, d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
select d.device_id, d.device_name, d.product_name, d.serial_number,d.gw_dev_code,
|
||||||
|
d.management_unit, d.caretaker, d.tel,d.firmware_version, d.status,d.rssi,d.is_shadow ,
|
||||||
d.location_way, d.active_time,d.dev_params,d.network_address,d.longitude,d.latitude
|
d.location_way, d.active_time,d.dev_params,d.network_address,d.longitude,d.latitude
|
||||||
from (
|
from (
|
||||||
select device_id, 1 AS is_owner
|
select device_id, 1 AS is_owner
|
||||||
|
Loading…
x
Reference in New Issue
Block a user