10 changed files with 401 additions and 35 deletions
@ -0,0 +1,63 @@ |
|||||
|
package com.ccsens.logistics.bean.vo; |
||||
|
|
||||
|
import com.alibaba.fastjson.JSON; |
||||
|
import com.alibaba.fastjson.JSONArray; |
||||
|
import io.swagger.annotations.ApiModel; |
||||
|
import io.swagger.annotations.ApiModelProperty; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author 马 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class HttpVo { |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("温湿度设备分组") |
||||
|
public static class Groups{ |
||||
|
@ApiModelProperty("分组id") |
||||
|
private String groupId; |
||||
|
@ApiModelProperty("分组名称") |
||||
|
private String groupName; |
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("温湿度设备的数据") |
||||
|
public static class EnvironmentOfData{ |
||||
|
@ApiModelProperty("分组id") |
||||
|
private String groupId; |
||||
|
@ApiModelProperty("设备编号") |
||||
|
private String deviceKey; |
||||
|
@ApiModelProperty("设备地址") |
||||
|
private Integer deviceAddr; |
||||
|
@ApiModelProperty("节点编号") |
||||
|
private Integer nodeID; |
||||
|
@ApiModelProperty("节点类型") |
||||
|
private Integer nodeType; |
||||
|
@ApiModelProperty("停用状态,true停用") |
||||
|
private Integer deviceDisabled; |
||||
|
@ApiModelProperty("设备名称") |
||||
|
private String deviceName; |
||||
|
@ApiModelProperty("设备状态0未运行,1离线,2在线") |
||||
|
private Integer deviceStatus; |
||||
|
@ApiModelProperty("实时数据") |
||||
|
private JSONArray relTimeData; |
||||
|
// @ApiModelProperty("实时数据")
|
||||
|
// private List<RealData> relTimeData;
|
||||
|
} |
||||
|
|
||||
|
@Data |
||||
|
@ApiModel("实时数据") |
||||
|
public static class RealData{ |
||||
|
@ApiModelProperty("模拟量名称") |
||||
|
private String dataName; |
||||
|
@ApiModelProperty("实时数据") |
||||
|
private String dataValue; |
||||
|
@ApiModelProperty("是否报警") |
||||
|
private Boolean isAlarm; |
||||
|
@ApiModelProperty("报警信息") |
||||
|
private String alarmMsg; |
||||
|
} |
||||
|
} |
@ -0,0 +1,31 @@ |
|||||
|
package com.ccsens.logistics.scheduled; |
||||
|
|
||||
|
|
||||
|
import com.ccsens.logistics.service.IHttpService; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.scheduling.annotation.EnableScheduling; |
||||
|
import org.springframework.scheduling.annotation.Scheduled; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
import org.springframework.transaction.annotation.Propagation; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
import javax.annotation.Resource; |
||||
|
|
||||
|
/** |
||||
|
* @author 逗 |
||||
|
*/ |
||||
|
@Slf4j |
||||
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class) |
||||
|
@Component |
||||
|
@EnableScheduling |
||||
|
public class ScheduledService { |
||||
|
|
||||
|
@Resource |
||||
|
private IHttpService iHttpService; |
||||
|
|
||||
|
@Scheduled(cron = "*/30 * * * * ?") |
||||
|
public void runfirst(){ |
||||
|
iHttpService.getTemperatureAndHumidity(); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
Loading…
Reference in new issue