修改类型

This commit is contained in:
wangwenhua 2025-09-14 16:16:33 +08:00
parent 45007d9b8f
commit 5d1e4020f3
2 changed files with 27 additions and 17 deletions

View File

@ -1,10 +1,14 @@
package com.hivekion.scenario.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Map;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -33,13 +37,14 @@ public class Resource implements Serializable {
private String icon;
@ApiModelProperty("纬度")
private BigDecimal lat;
private String lat;
@ApiModelProperty("经度")
private BigDecimal lng;
private String lng;
@ApiModelProperty("设施属性")
private byte[] resourceAttribut;
@TableField(typeHandler = JacksonTypeHandler.class)
private Map<String,Object> resourceAttribut;
@ApiModelProperty("创建人")
private String createOper;
@ -74,27 +79,27 @@ public class Resource implements Serializable {
this.icon = icon;
}
public BigDecimal getLat() {
public String getLat() {
return lat;
}
public void setLat(BigDecimal lat) {
public void setLat(String lat) {
this.lat = lat;
}
public BigDecimal getLng() {
public String getLng() {
return lng;
}
public void setLng(BigDecimal lng) {
public void setLng(String lng) {
this.lng = lng;
}
public byte[] getResourceAttribut() {
public Map<String, Object> getResourceAttribut() {
return resourceAttribut;
}
public void setResourceAttribut(byte[] resourceAttribut) {
public void setResourceAttribut(Map<String, Object> resourceAttribut) {
this.resourceAttribut = resourceAttribut;
}

View File

@ -1,5 +1,6 @@
package com.hivekion.scenario.service.impl;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -122,16 +123,20 @@ public class ScenarioTaskServiceImpl extends
try {
QueryWrapper<WeatherResource> weatherResourceQueryWrapper = new QueryWrapper<>();
weatherResourceQueryWrapper.eq("scenario_id", currentScenario.getId()).eq("room_id", roomId);
WeatherResource weatherResource = this.weatherResourceService.getOne(weatherResourceQueryWrapper);
ResponseCmdInfo<JSONObject> responseCmdInfo = new ResponseCmdInfo();
List<WeatherResource> weatherResourceList = this.weatherResourceService.list();
ResponseCmdInfo<JSONArray> responseCmdInfo = new ResponseCmdInfo();
responseCmdInfo.setScenarioId(currentScenario.getId());
responseCmdInfo.setRoom(roomId);
JSONObject weatherMsg = new JSONObject();
JSONArray weatherMsgArray = new JSONArray();
for(WeatherResource weatherResource: weatherResourceList) {
JSONObject jsonObject = new JSONObject();
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
weatherMsg.putOnce("begTime", dtf.format(weatherResource.getLastBegTime()));
weatherMsg.putOnce("endTime", dtf.format(weatherResource.getLastEndTime()));
jsonObject.putOnce("begTime", dtf.format(weatherResource.getLastBegTime()));
jsonObject.putOnce("endTime", dtf.format(weatherResource.getLastEndTime()));
weatherMsgArray.add(jsonObject);
responseCmdInfo.setCmdType("66-" + weatherResource.getWeatherType());
responseCmdInfo.setData(weatherMsg);
}
responseCmdInfo.setData(weatherMsgArray);
Global.sendCmdInfoQueue.add(responseCmdInfo);
}catch (Exception ex){
ex.printStackTrace();