parent
9e5f283984
commit
c30c5291bf
@ -1,28 +0,0 @@
|
|||||||
package com.shxy.xymanager_common.model;
|
|
||||||
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@AllArgsConstructor
|
|
||||||
@ApiModel(value = "记录拍照装置通道信息", description = "记录拍照装置通道信息描述")
|
|
||||||
public class TermChannelModel implements Serializable {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "装置id", example = "123456")
|
|
||||||
private Integer termId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "通道id", example = "123456")
|
|
||||||
private Integer channelId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "拍照时间", example = "123456")
|
|
||||||
private Long photoTime;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "当前时间", example = "123456")
|
|
||||||
private Long currentTime;
|
|
||||||
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
package com.shxy.xymanager_common.vo;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import io.swagger.models.auth.In;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotEmpty;
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@ApiModel(value = "装置控制对象", description = "装置控制对象描述")
|
|
||||||
public class TermCtrlVo {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "装置编号", example = "123455")
|
|
||||||
private Integer termId;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "通道编号", example = "123456")
|
|
||||||
private Integer channelId;
|
|
||||||
|
|
||||||
@NotNull(message = "不能传入空值")
|
|
||||||
@ApiModelProperty(value = "控制对象数组", required = true)
|
|
||||||
private List<CtrlBean> list;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class CtrlBean {
|
|
||||||
@ApiModelProperty(value = "命令key", example = "act")
|
|
||||||
private String name;
|
|
||||||
@ApiModelProperty(value = "命令value", example = "shecdule")
|
|
||||||
private String value;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,67 +0,0 @@
|
|||||||
package com.shxy.xymanager_framework.timeTask;
|
|
||||||
|
|
||||||
import com.shxy.xymanager_common.bean.ServiceBody;
|
|
||||||
import com.shxy.xymanager_common.entity.Terminals;
|
|
||||||
import com.shxy.xymanager_common.model.TermChannelModel;
|
|
||||||
import com.shxy.xymanager_framework.socket.WebSocketServer;
|
|
||||||
import com.shxy.xymanager_service.impl.TermSetServiceImpl;
|
|
||||||
import com.shxy.xymanager_service.service.TerminalPhotoService;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.scheduling.annotation.Scheduled;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
@Slf4j
|
|
||||||
public class TermChannelTask {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
TerminalPhotoService terminalPhotoService;
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
WebSocketServer webSocketServer;
|
|
||||||
|
|
||||||
//超时时间 分钟 5
|
|
||||||
Integer overtime = 1;
|
|
||||||
|
|
||||||
//创建记录主动拍照参数
|
|
||||||
// public static Map<String , TermChannelModel> termChannelModelMap = new HashMap<>();
|
|
||||||
|
|
||||||
@Scheduled(fixedDelay = 10000)
|
|
||||||
public void queryTermChannelTime() {
|
|
||||||
Map<String , TermChannelModel> termChannelModelMap = TermSetServiceImpl.termChannelModelMap;
|
|
||||||
//获取当前系统时间
|
|
||||||
Long time = System.currentTimeMillis();
|
|
||||||
if ( !termChannelModelMap.isEmpty() ) {
|
|
||||||
Iterator<String> iterator = termChannelModelMap.keySet().iterator();
|
|
||||||
|
|
||||||
while ( iterator.hasNext() ) {
|
|
||||||
String key = iterator.next();
|
|
||||||
TermChannelModel model = termChannelModelMap.get(key);
|
|
||||||
//开始拍照的时间 + 5分钟
|
|
||||||
Long currentTime = model.getCurrentTime() + ( overtime * 60 * 1000);
|
|
||||||
if ( time >= currentTime ) {
|
|
||||||
iterator.remove();
|
|
||||||
} else {
|
|
||||||
//调用查询最新照片
|
|
||||||
Terminals terminals = terminalPhotoService.getTakePicPhotoStatus(model).getData();
|
|
||||||
if ( terminals.checkInclude() ) {
|
|
||||||
String str = "装置:" + terminals.getCmdid() + " 在通道" + model.getChannelId() + "拍的最新图片已上传";
|
|
||||||
webSocketServer.sendNotice(str);
|
|
||||||
// System.out.println(str);
|
|
||||||
iterator.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue