Merge branch 'master' of codeup.aliyun.com:6428039c708c83a3fd907211/hzwmiot/hzwmiot24_java

This commit is contained in:
wyw 2024-08-19 11:21:38 +08:00
commit 511c04b364
12 changed files with 177 additions and 15 deletions

View File

@ -0,0 +1,30 @@
package com.fastbee.common.model.vo.iot;
import lombok.Data;
/**
* 设备详细信息
*/
@Data
public class DeviceDetailVo {
//运行状态
private String runState;
//最后更新时间
private String lastDataTime;
//总累计用电量(kwh)
private String sumEle;
//总累计用水量(m³)
private String sumFlow;
//供电类型
private String gongDianType;
//环境温度
private String temp;
//电池电量
private String powerDianliang;
//电池电压
private String powerVolt;
//电池电流
private String powerCur;
}

View File

@ -13,6 +13,7 @@ import com.fastbee.common.exception.ServiceException;
import com.fastbee.common.utils.SecurityUtils; import com.fastbee.common.utils.SecurityUtils;
import com.fastbee.common.utils.StringUtils; import com.fastbee.common.utils.StringUtils;
import com.fastbee.common.utils.poi.ExcelUtil; import com.fastbee.common.utils.poi.ExcelUtil;
import com.fastbee.data.service.devicedetail.IDeviceDetailService;
import com.fastbee.iot.domain.Device; import com.fastbee.iot.domain.Device;
import com.fastbee.iot.domain.JiankongDeviceParam; import com.fastbee.iot.domain.JiankongDeviceParam;
import com.fastbee.iot.model.DeviceAssignmentVO; import com.fastbee.iot.model.DeviceAssignmentVO;
@ -52,7 +53,8 @@ import java.util.stream.Collectors;
public class DeviceController extends BaseController { public class DeviceController extends BaseController {
@Autowired @Autowired
private IDeviceService deviceService; private IDeviceService deviceService;
@Autowired
private IDeviceDetailService deviceDetailService;
// @Lazy // @Lazy
@Autowired @Autowired
private IMqttMessagePublish messagePublish; private IMqttMessagePublish messagePublish;
@ -165,6 +167,7 @@ public class DeviceController extends BaseController {
@ApiOperation("获取设备详情") @ApiOperation("获取设备详情")
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));
// 判断当前用户是否有设备分享权限 设备所属机构管理员和设备所属用户有权限 // 判断当前用户是否有设备分享权限 设备所属机构管理员和设备所属用户有权限
// LoginUser loginUser = getLoginUser(); // LoginUser loginUser = getLoginUser();
// List<SysRole> roles = loginUser.getUser().getRoles(); // List<SysRole> roles = loginUser.getUser().getRoles();

View File

@ -87,6 +87,7 @@ public class UploadedPhotosController extends BaseController {
@RequestParam("cpuTemp") Double cpuTemp, @RequestParam("cpuTemp") Double cpuTemp,
@RequestParam("eventType") String eventType, @RequestParam("eventType") String eventType,
@RequestParam("doorState") String doorState, @RequestParam("doorState") String doorState,
@RequestParam("anFangStatus") String anFangStatus,
@RequestParam("time") String time) { @RequestParam("time") String time) {
if (photo.isEmpty()) { if (photo.isEmpty()) {
@ -111,7 +112,8 @@ public class UploadedPhotosController extends BaseController {
//推送告警短信通知 //推送告警短信通知
uploadedPhotosService.sendAlarmMessage(sn, doorState, shakeState,eventType); uploadedPhotosService.sendAlarmMessage(sn, doorState, shakeState,eventType);
UploadedPhotos uploadedPhotos = new UploadedPhotos( UploadedPhotos uploadedPhotos = new UploadedPhotos(
null, fileName, monitorPath, imei, sn, latitude, longitude, temperature, doorState, shakeState,cpuTemp,eventType, date null, fileName, monitorPath, imei, sn, latitude, longitude,
temperature, doorState, shakeState,cpuTemp,eventType,anFangStatus, date
); );
return toAjax(uploadedPhotosService.insertUploadedPhotos(uploadedPhotos)); return toAjax(uploadedPhotosService.insertUploadedPhotos(uploadedPhotos));
} catch (IOException e) { } catch (IOException e) {
@ -142,6 +144,7 @@ public class UploadedPhotosController extends BaseController {
@RequestParam("doorState") String doorState, @RequestParam("doorState") String doorState,
@RequestParam("cpuTemp") Double cpuTemp, @RequestParam("cpuTemp") Double cpuTemp,
@RequestParam("eventType") String eventType, @RequestParam("eventType") String eventType,
@RequestParam("anFangStatus") String anFangStatus,
@RequestParam("time") String time) { @RequestParam("time") String time) {
// 处理可能为空的字段 // 处理可能为空的字段
Double latitude = isEmpty(lat) ? 0.0 : Double.valueOf(lat); Double latitude = isEmpty(lat) ? 0.0 : Double.valueOf(lat);
@ -156,7 +159,7 @@ public class UploadedPhotosController extends BaseController {
//推送告警短信通知 //推送告警短信通知
uploadedPhotosService.sendAlarmMessage(sn, doorState, shakeState,eventType); uploadedPhotosService.sendAlarmMessage(sn, doorState, shakeState,eventType);
UploadedPhotos uploadedPhotos = new UploadedPhotos( UploadedPhotos uploadedPhotos = new UploadedPhotos(
null, "", monitorPath, imei, sn, latitude, longitude, temperature, doorState, shakeState,cpuTemp,eventType, date null, "", monitorPath, imei, sn, latitude, longitude, temperature, doorState, shakeState,cpuTemp,eventType,anFangStatus, date
); );
return toAjax(uploadedPhotosService.insertUploadedPhotos(uploadedPhotos)); return toAjax(uploadedPhotosService.insertUploadedPhotos(uploadedPhotos));
} }

View File

@ -244,6 +244,12 @@ public class UploadedPhotosServiceImpl implements IUploadedPhotosService {
} else if (Integer.parseInt(eventType) == 3) { } else if (Integer.parseInt(eventType) == 3) {
temp.put("warnInfo", "箱门持续打开"); temp.put("warnInfo", "箱门持续打开");
notify = true; notify = true;
}else if(Integer.parseInt(eventType) == 4){
temp.put("warnInfo", "开启布放");
notify = true;
}else if(Integer.parseInt(eventType) == 5){
temp.put("warnInfo", "撤防");
notify = true;
} }
if (notify) { if (notify) {
DeviceAlertUser deviceAlertUser = new DeviceAlertUser(); DeviceAlertUser deviceAlertUser = new DeviceAlertUser();
@ -278,14 +284,25 @@ public class UploadedPhotosServiceImpl implements IUploadedPhotosService {
} }
int doorState = 0; int doorState = 0;
int shakeState = 0; int shakeState = 0;
int anFangStatus = 0;
int eventType = doorAlertBto.getEventType(); int eventType = doorAlertBto.getEventType();
if (doorAlertBto.getEventType() > 0) { if (doorAlertBto.getEventType() > 0) {
if (doorAlertBto.getEventType() == 1) { if (eventType == 1) {
shakeState = doorAlertBto.getEventType(); shakeState = doorAlertBto.getEventType();
doorState = 0; doorState = 0;
} else if (doorAlertBto.getEventType() >= 2) { anFangStatus = 1;
} else if (eventType == 2 || eventType == 3) {
doorState = 1; doorState = 1;
shakeState = 0; shakeState = 0;
anFangStatus = 1;
}else if(eventType == 4 ){
anFangStatus = 1;
doorState = 0;
shakeState = 0;
}else if(eventType == 5){
anFangStatus = 0;
doorState = 0;
shakeState = 0;
} }
sendAlarmMessage(device.getSerialNumber(), doorState + "", shakeState + "", eventType + ""); sendAlarmMessage(device.getSerialNumber(), doorState + "", shakeState + "", eventType + "");
} }
@ -295,7 +312,7 @@ public class UploadedPhotosServiceImpl implements IUploadedPhotosService {
null, "", monitorPath, "", device.getSerialNumber(), null, "", monitorPath, "", device.getSerialNumber(),
device.getLatitude() != null ? device.getLatitude().doubleValue() : 0d, device.getLatitude() != null ? device.getLatitude().doubleValue() : 0d,
device.getLongitude() != null ? device.getLatitude().doubleValue() : 0d, device.getLongitude() != null ? device.getLatitude().doubleValue() : 0d,
18.23d, doorState + "", shakeState + "", 32.3, doorAlertBto.getEventType().toString(), new Date() 18.23d, doorState + "", shakeState + "", 32.3, doorAlertBto.getEventType().toString(),anFangStatus + "", new Date()
); );
int count = insertUploadedPhotos(uploadedPhotos); int count = insertUploadedPhotos(uploadedPhotos);
if (count > 0) { if (count > 0) {

View File

@ -1,6 +1,7 @@
package com.fastbee.data.service.devicedetail; package com.fastbee.data.service.devicedetail;
import com.fastbee.common.core.domain.CommonResult; import com.fastbee.common.core.domain.CommonResult;
import com.fastbee.common.model.vo.iot.DeviceDetailVo;
import com.fastbee.common.model.vo.iot.QueryLogVo; import com.fastbee.common.model.vo.iot.QueryLogVo;
import com.fastbee.data.domain.vo.AnfangInfoVo; import com.fastbee.data.domain.vo.AnfangInfoVo;
import com.fastbee.iot.domain.Device; import com.fastbee.iot.domain.Device;
@ -43,5 +44,5 @@ public interface IDeviceDetailService {
*/ */
List<HashMap<Object, Object>> gongdianRealData(QueryLogVo queryLogVo); List<HashMap<Object, Object>> gongdianRealData(QueryLogVo queryLogVo);
List<HashMap<Object, Object>> yongshuiRealData(QueryLogVo queryLogVo); List<HashMap<Object, Object>> yongshuiRealData(QueryLogVo queryLogVo);
DeviceDetailVo getDetailInfo(Device device);
} }

View File

@ -5,7 +5,10 @@ import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.fastbee.common.core.domain.CommonResult; import com.fastbee.common.core.domain.CommonResult;
import com.fastbee.common.core.page.TableDataInfo;
import com.fastbee.common.model.vo.iot.DeviceDetailVo;
import com.fastbee.common.model.vo.iot.QueryLogVo; import com.fastbee.common.model.vo.iot.QueryLogVo;
import com.fastbee.common.utils.DateUtils;
import com.fastbee.common.utils.DevParamsUtils; import com.fastbee.common.utils.DevParamsUtils;
import com.fastbee.common.utils.StringUtils; import com.fastbee.common.utils.StringUtils;
import com.fastbee.data.domain.vo.AnfangInfoVo; import com.fastbee.data.domain.vo.AnfangInfoVo;
@ -27,6 +30,7 @@ import com.fastbee.iot.service.IThingsModelService;
import com.fastbee.waterele.domain.MaWatereleRecord; import com.fastbee.waterele.domain.MaWatereleRecord;
import com.fastbee.waterele.domain.dto.MaGuangaiRecordDto; import com.fastbee.waterele.domain.dto.MaGuangaiRecordDto;
import com.fastbee.waterele.domain.dto.MaWatereleRecordDto; import com.fastbee.waterele.domain.dto.MaWatereleRecordDto;
import com.fastbee.waterele.service.IMaWatereleRecordService;
import com.fastbee.xunjian.domain.XjInspectionRecords; import com.fastbee.xunjian.domain.XjInspectionRecords;
import com.fastbee.xunjian.domain.XjInspectionRoutes; import com.fastbee.xunjian.domain.XjInspectionRoutes;
import com.fastbee.xunjian.mapper.XjInspectionRecordsMapper; import com.fastbee.xunjian.mapper.XjInspectionRecordsMapper;
@ -34,6 +38,7 @@ import com.fastbee.xunjian.mapper.XjInspectionRoutesMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -58,6 +63,8 @@ public class DeviceDetailServiceImpl implements IDeviceDetailService {
@Autowired @Autowired
private IDeviceLogService logService; private IDeviceLogService logService;
@Resource
private IMaWatereleRecordService watereleRecordService;
public DeviceDetailServiceImpl(DeviceMapper deviceMapper) { public DeviceDetailServiceImpl(DeviceMapper deviceMapper) {
this.deviceMapper = deviceMapper; this.deviceMapper = deviceMapper;
@ -403,5 +410,86 @@ public class DeviceDetailServiceImpl implements IDeviceDetailService {
return haiWeiService.cmdDevices(cmdHaiWeiDto); return haiWeiService.cmdDevices(cmdHaiWeiDto);
} }
/**
* 获取设备详细信息
* @param device
*/
@Override
public DeviceDetailVo getDetailInfo(Device device) {
DeviceDetailVo deviceDetailVo = new DeviceDetailVo();
//运行状态最后一次更新时间
MaWatereleRecord watereleRecord = new MaWatereleRecord();
watereleRecord.setDevSn(device.getSerialNumber());
TableDataInfo tableDataInfo = watereleRecordService.selectMaWatereleRecordList(watereleRecord);
List<MaWatereleRecord> rows = (List<MaWatereleRecord>) tableDataInfo.getRows();
//运行状态
deviceDetailVo.setRunState("未运行");
//累计用电量
deviceDetailVo.setSumEle("--kwh");
//最近一次上传时间
deviceDetailVo.setLastDataTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,
new Date()));
if(rows.size()> 0){
MaWatereleRecord item = rows.get(0);
deviceDetailVo.setLastDataTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS,
item.getCreateTime()));
if(item.getWorkstate() == 0){
deviceDetailVo.setRunState("未运行");
}else {
deviceDetailVo.setRunState("运行中");
}
deviceDetailVo.setSumEle(item.getSumele()+"kwh");
}
Map<String, Object> devParams = DevParamsUtils.getDevParams(device.getDevParams());
//累计水量
deviceDetailVo.setSumFlow("--m³");
if(devParams.containsKey("liuliangIds")){
String liuliangIds = devParams.get("liuliangIds").toString();
//获取
CommonResult<HaiWeiDeviceInfoVo> cache = haiWeiService.getCache(Long.valueOf(liuliangIds));
HaiWeiDeviceInfoVo checkedData = cache.getCheckedData();
List<HaiWeiPropertyVo> propertyList = checkedData.getPropertyList();
for (HaiWeiPropertyVo haiWeiPropertyVo : propertyList) {
if (haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_sumFlow")) {
deviceDetailVo.setSumFlow(haiWeiPropertyVo.getValue()+"");
}
}
}
//供电信息
//环境温度
deviceDetailVo.setTemp("--℃");
//供电方式
deviceDetailVo.setGongDianType("市电");
//电池电量
deviceDetailVo.setPowerDianliang("--%");
//电池电压
deviceDetailVo.setPowerVolt("--V");
//电池电流
deviceDetailVo.setPowerCur("--A");
if(devParams.containsKey("taiyangnIds")){
String taiyangIds = devParams.get("taiyangnIds").toString();
//获取
CommonResult<HaiWeiDeviceInfoVo> cache = haiWeiService.getCache(Long.valueOf(taiyangIds));
HaiWeiDeviceInfoVo checkedData = cache.getCheckedData();
List<HaiWeiPropertyVo> propertyList = checkedData.getPropertyList();
for (HaiWeiPropertyVo haiWeiPropertyVo : propertyList) {
if (haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_市电状态")) {
if(Float.parseFloat(haiWeiPropertyVo.getValue().toString()) == 0){
deviceDetailVo.setGongDianType("太阳能");
}
}else if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_bat")){
deviceDetailVo.setPowerDianliang(haiWeiPropertyVo.getValueAndUnit());
}else if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_batVolt")){
deviceDetailVo.setPowerVolt(haiWeiPropertyVo.getValueAndUnit());
}else if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_batCur")){
deviceDetailVo.setPowerCur(haiWeiPropertyVo.getValueAndUnit());
}else if(haiWeiPropertyVo.getNameEn().equals("三菱FX2N_1_airTemp")){
deviceDetailVo.setTemp(haiWeiPropertyVo.getValueAndUnit());
}
}
}
return deviceDetailVo;
}
} }

View File

@ -1,5 +1,6 @@
package com.fastbee.iot.domain; package com.fastbee.iot.domain;
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;
import com.fastbee.common.core.domain.BaseEntity; import com.fastbee.common.core.domain.BaseEntity;
@ -165,7 +166,9 @@ public class Device extends BaseEntity
@Transient @Transient
@ApiModelProperty("机构id") @ApiModelProperty("机构id")
private Long deptId; private Long deptId;
//设备详情
@ApiModelProperty("详情")
private DeviceDetailVo deviceDetailVo;
@Transient @Transient
@ApiModelProperty("是否显示下级") @ApiModelProperty("是否显示下级")
private Boolean showChild; private Boolean showChild;

View File

@ -61,9 +61,11 @@ public class UploadedPhotos extends BaseEntity
/** CPU温度 */ /** CPU温度 */
@Excel(name = "CPU温度") @Excel(name = "CPU温度")
private Double cpuTemp; private Double cpuTemp;
/** 事件类型1=振动2=箱门打开,3=人员入侵 */ /** 事件类型1=振动2=箱门打开,3=箱门持续打开 */
@Excel(name = "事件类型") @Excel(name = "事件类型")
private String eventType; private String eventType;
@Excel(name = "安防状态:1=布防, 0=撤防")
private String anFangStatus;
/** 上传时间 */ /** 上传时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")

View File

@ -4,6 +4,7 @@ import com.fastbee.common.core.device.DeviceAndProtocol;
import com.fastbee.common.core.domain.AjaxResult; import com.fastbee.common.core.domain.AjaxResult;
import com.fastbee.common.core.thingsModel.ThingsModelSimpleItem; import com.fastbee.common.core.thingsModel.ThingsModelSimpleItem;
import com.fastbee.common.enums.DeviceStatus; import com.fastbee.common.enums.DeviceStatus;
import com.fastbee.common.model.vo.iot.DeviceDetailVo;
import com.fastbee.iot.domain.Device; import com.fastbee.iot.domain.Device;
import com.fastbee.iot.domain.DeviceGroup; import com.fastbee.iot.domain.DeviceGroup;
import com.fastbee.iot.domain.JiankongDeviceParam; import com.fastbee.iot.domain.JiankongDeviceParam;
@ -336,4 +337,6 @@ public interface IDeviceService
ArrayList<Object> getDeviceLogAllCurves(Long deviceId, String beginTime, String endTime); ArrayList<Object> getDeviceLogAllCurves(Long deviceId, String beginTime, String endTime);
Map<String, Object> getvideourl(JiankongDeviceParam jiankongDeviceParam); Map<String, Object> getvideourl(JiankongDeviceParam jiankongDeviceParam);
} }

View File

@ -7,6 +7,7 @@ import com.fastbee.common.constant.Constants;
import com.fastbee.common.constant.ProductAuthConstant; import com.fastbee.common.constant.ProductAuthConstant;
import com.fastbee.common.core.device.DeviceAndProtocol; import com.fastbee.common.core.device.DeviceAndProtocol;
import com.fastbee.common.core.domain.AjaxResult; import com.fastbee.common.core.domain.AjaxResult;
import com.fastbee.common.core.domain.CommonResult;
import com.fastbee.common.core.domain.entity.SysDept; import com.fastbee.common.core.domain.entity.SysDept;
import com.fastbee.common.core.domain.entity.SysUser; import com.fastbee.common.core.domain.entity.SysUser;
import com.fastbee.common.core.domain.model.LoginUser; import com.fastbee.common.core.domain.model.LoginUser;
@ -17,6 +18,7 @@ import com.fastbee.common.core.thingsModel.ThingsModelSimpleItem;
import com.fastbee.common.core.thingsModel.ThingsModelValuesInput; import com.fastbee.common.core.thingsModel.ThingsModelValuesInput;
import com.fastbee.common.enums.*; import com.fastbee.common.enums.*;
import com.fastbee.common.exception.ServiceException; import com.fastbee.common.exception.ServiceException;
import com.fastbee.common.model.vo.iot.DeviceDetailVo;
import com.fastbee.common.utils.*; import com.fastbee.common.utils.*;
import com.fastbee.common.utils.http.HttpUtils; import com.fastbee.common.utils.http.HttpUtils;
import com.fastbee.common.utils.ip.IpUtils; import com.fastbee.common.utils.ip.IpUtils;
@ -24,6 +26,7 @@ import com.fastbee.common.utils.json.JsonUtils;
import com.fastbee.iot.cache.ITSLCache; import com.fastbee.iot.cache.ITSLCache;
import com.fastbee.iot.domain.*; import com.fastbee.iot.domain.*;
import com.fastbee.iot.haikang.HaikangYingshiApi; import com.fastbee.iot.haikang.HaikangYingshiApi;
import com.fastbee.iot.haiwei.service.HaiWeiService;
import com.fastbee.iot.mapper.*; import com.fastbee.iot.mapper.*;
import com.fastbee.iot.model.*; import com.fastbee.iot.model.*;
import com.fastbee.iot.model.ThingsModelItem.Datatype; import com.fastbee.iot.model.ThingsModelItem.Datatype;
@ -32,6 +35,8 @@ import com.fastbee.iot.domain.ThingsModel;
import com.fastbee.iot.model.ThingsModels.*; import com.fastbee.iot.model.ThingsModels.*;
import com.fastbee.iot.model.dto.ThingsModelDTO; import com.fastbee.iot.model.dto.ThingsModelDTO;
import com.fastbee.iot.model.gateWay.SubDeviceListVO; import com.fastbee.iot.model.gateWay.SubDeviceListVO;
import com.fastbee.iot.model.haiwei.HaiWeiDeviceInfoVo;
import com.fastbee.iot.model.haiwei.HaiWeiPropertyVo;
import com.fastbee.iot.service.*; import com.fastbee.iot.service.*;
import com.fastbee.iot.cache.IDeviceCache; import com.fastbee.iot.cache.IDeviceCache;
import com.fastbee.iot.cache.ITSLValueCache; import com.fastbee.iot.cache.ITSLValueCache;
@ -40,6 +45,7 @@ import com.fastbee.system.mapper.SysDeptMapper;
import com.fastbee.system.service.ISysUserService; import com.fastbee.system.service.ISysUserService;
import com.fastbee.waterele.domain.MaWatereleRecord; import com.fastbee.waterele.domain.MaWatereleRecord;
import com.fastbee.waterele.service.IMaWatereleRecordService; import com.fastbee.waterele.service.IMaWatereleRecordService;
import com.fastbee.waterele.service.impl.MaWatereleRecordServiceImpl;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -124,9 +130,6 @@ public class DeviceServiceImpl implements IDeviceService {
private SubGatewayMapper subGatewayMapper; private SubGatewayMapper subGatewayMapper;
@Resource @Resource
private IOrderControlService orderControlService; private IOrderControlService orderControlService;
@Resource
private IMaWatereleRecordService watereleRecordService;
/** /**
* 查询设备 * 查询设备
* *
@ -1755,4 +1758,5 @@ public class DeviceServiceImpl implements IDeviceService {
} }

View File

@ -122,8 +122,9 @@ public class QxtrTask {
com.alibaba.fastjson2.JSONObject thingsModelObject = com.alibaba.fastjson2.JSONObject thingsModelObject =
com.alibaba.fastjson2.JSONObject.parseObject(itslCache.getCacheThingsModelByProductId(productId)); com.alibaba.fastjson2.JSONObject.parseObject(itslCache.getCacheThingsModelByProductId(productId));
com.alibaba.fastjson2.JSONArray thingsList = thingsModelObject.getJSONArray("properties"); com.alibaba.fastjson2.JSONArray thingsList = thingsModelObject.getJSONArray("properties");
List<PropertyDto> properties = thingsList.toList(PropertyDto.class); List<PropertyDto> properties = thingsList.toList(PropertyDto.class);
Map<String, List<PropertyDto>> stringListMap = properties.stream().collect(Collectors.groupingBy(PropertyDto::getGroup)); Map<String, List<PropertyDto>> stringListMap =
properties.stream().collect(Collectors.groupingBy(PropertyDto::getGroup));
for (Device device : devices) { for (Device device : devices) {
try { try {
Map<String, String> devParams = getDevParams(device); Map<String, String> devParams = getDevParams(device);
@ -141,7 +142,8 @@ public class QxtrTask {
tags[i] = propertyDtos.get(i).getId(); tags[i] = propertyDtos.get(i).getId();
} }
haiWeiBo.setTags(tags); haiWeiBo.setTags(tags);
HttpResultDTO duhttpResultDTO = HttpAPIController.doPostWithJsonParamAndHeaders(url, JsonUtils.toJsonString(haiWeiBo), HttpResultDTO duhttpResultDTO =
HttpAPIController.doPostWithJsonParamAndHeaders(url, JsonUtils.toJsonString(haiWeiBo),
new HashMap<>()); new HashMap<>());
if (null != duhttpResultDTO && duhttpResultDTO.getCode() == 200) { if (null != duhttpResultDTO && duhttpResultDTO.getCode() == 200) {
Object object = com.alibaba.fastjson.JSON.parse(duhttpResultDTO.getBody()); //先转换成Object Object object = com.alibaba.fastjson.JSON.parse(duhttpResultDTO.getBody()); //先转换成Object

View File

@ -18,6 +18,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="uploadTime" column="upload_time" /> <result property="uploadTime" column="upload_time" />
<result property="eventType" column="event_type" /> <result property="eventType" column="event_type" />
<result property="cpuTemp" column="cpu_temp" /> <result property="cpuTemp" column="cpu_temp" />
<result property="anFangStatus" column="an_fang_status" />
</resultMap> </resultMap>
<sql id="selectUploadedPhotosVo"> <sql id="selectUploadedPhotosVo">
@ -38,6 +39,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="eventType != null and eventType != ''"> and event_type = #{eventType}</if> <if test="eventType != null and eventType != ''"> and event_type = #{eventType}</if>
<if test="cpuTemp != null and cpuTemp != ''"> and cpu_temp = #{cpuTemp}</if> <if test="cpuTemp != null and cpuTemp != ''"> and cpu_temp = #{cpuTemp}</if>
<if test="shakeState != null and shakeState != ''"> and shake_state = #{shakeState}</if> <if test="shakeState != null and shakeState != ''"> and shake_state = #{shakeState}</if>
<if test="anFangStatus != null and anFangStatus != ''"> and an_fang_status = #{anFangStatus}</if>
<if test="params.beginUploadTime != null and params.beginUploadTime != '' and params.endUploadTime != null and params.endUploadTime != ''"> and upload_time between #{params.beginUploadTime} and #{params.endUploadTime}</if> <if test="params.beginUploadTime != null and params.beginUploadTime != '' and params.endUploadTime != null and params.endUploadTime != ''"> and upload_time between #{params.beginUploadTime} and #{params.endUploadTime}</if>
</where> </where>
order by id desc order by id desc
@ -63,6 +65,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="uploadTime != null">upload_time,</if> <if test="uploadTime != null">upload_time,</if>
<if test="eventType != null">event_type,</if> <if test="eventType != null">event_type,</if>
<if test="cpuTemp != null">cpu_temp,</if> <if test="cpuTemp != null">cpu_temp,</if>
<if test="anFangStatus != null">an_fang_status,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="photoPath != null and photoPath != ''">#{photoPath},</if> <if test="photoPath != null and photoPath != ''">#{photoPath},</if>
@ -77,6 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="uploadTime != null">#{uploadTime},</if> <if test="uploadTime != null">#{uploadTime},</if>
<if test="eventType != null">#{eventType},</if> <if test="eventType != null">#{eventType},</if>
<if test="cpuTemp != null">#{cpuTemp},</if> <if test="cpuTemp != null">#{cpuTemp},</if>
<if test="anFangStatus != null">#{anFangStatus},</if>
</trim> </trim>
</insert> </insert>
@ -95,6 +99,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="uploadTime != null">upload_time = #{uploadTime},</if> <if test="uploadTime != null">upload_time = #{uploadTime},</if>
<if test="eventType != null">event_type = #{eventType},</if> <if test="eventType != null">event_type = #{eventType},</if>
<if test="cpuTemp != null">cpu_temp = #{cpuTemp},</if> <if test="cpuTemp != null">cpu_temp = #{cpuTemp},</if>
<if test="anFangStatus != null">an_fang_status = #{anFangStatus},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
@ -114,6 +119,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="uploadTime != null">upload_time = #{uploadTime},</if> <if test="uploadTime != null">upload_time = #{uploadTime},</if>
<if test="eventType != null">event_type = #{eventType},</if> <if test="eventType != null">event_type = #{eventType},</if>
<if test="cpuTemp != null">cpu_temp = #{cpuTemp},</if> <if test="cpuTemp != null">cpu_temp = #{cpuTemp},</if>
<if test="anFangStatus != null">an_fang_status = #{anFangStatus},</if>
</trim> </trim>
where sn = #{sn} and upload_time = #{uploadTime} where sn = #{sn} and upload_time = #{uploadTime}
</update> </update>