Conflicts:
	xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalScheduleRuleServiceImpl.java
master
liuguijing 2 years ago
commit 90ac7742d3

@ -7,7 +7,7 @@ import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.bean.ServiceStatus;
import com.shxy.xymanager_common.model.GetModel;
import com.shxy.xymanager_common.model.TerminalVideoParamsModel;
import com.shxy.xymanager_common.vo.PhotoParamsVo;
import com.shxy.xymanager_common.vo.VideoGetVo;
import com.shxy.xymanager_common.vo.VideoParamsVo;
import com.shxy.xymanager_service.service.TerminalVideoService;
import io.swagger.annotations.Api;
@ -48,7 +48,7 @@ public class TerminalVideoController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/videoParamGet")
@Log(title = "视频参数查询触发", type = "查询")
public ResponseReult<GetModel> videoParamGet(@RequestBody @Validated VideoParamsVo vo) {
public ResponseReult<GetModel> videoParamGet(@RequestBody @Validated VideoGetVo vo) {
ServiceBody<GetModel> serviceBody = terminalVideoService.videoParamGet(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());

@ -41,6 +41,10 @@ public class Terminals implements Serializable {
private Date updateTime;
private Long lastheartbeat;
private Integer onlinestatus;
/*展示名字 等价与displayname 用于方便*/
private String name;

@ -64,5 +64,8 @@ public class DyLineAndTermModel implements Serializable {
@ApiModelProperty(value = "显示名", example = "名称名称")
private String name;
@ApiModelProperty(value = "在线状态", example = "0--掉线1--在线")
private Integer onlinestatus;
}
}

@ -28,6 +28,10 @@ public class RequestIdListVo {
@ApiModelProperty(value = "请求编号", example = "AAAA")
private Integer requestid;
@ApiModelProperty(value = "状态", example = "AAAA")
private Integer status;
}
}

@ -0,0 +1,23 @@
package com.shxy.xymanager_common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Data
@ApiModel(value = "声光报警设置对象", description = "声光报警设置对象描述")
public class VideoGetVo {
@NotBlank(message = "监测装置ID")
@ApiModelProperty(value = "监测装置ID", example = "123455")
private String cmdId;
@NotNull(message = "通道编号")
@ApiModelProperty(value = "通道编号", example = "01")
private short channelId;
}

@ -44,6 +44,7 @@
<result column="term_id" jdbcType="INTEGER" property="id"/>
<result column="tower_id" jdbcType="INTEGER" property="towerid"/>
<result column="cmdid" jdbcType="VARCHAR" property="cmdid"/>
<result column="last_heartbeat" jdbcType="BIGINT" property="lastheartbeat"/>
<result column="display_name" jdbcType="VARCHAR" property="name"/>
</collection>
</collection>
@ -98,13 +99,15 @@
c.id AS term_id,
c.tower_id AS tower_id,
c.cmdid AS cmdid,
ts.last_heartbeat as last_heartbeat,
c.display_name AS display_name
FROM
((((dy_level a
(((((dy_level a
left JOIN `lines` b ON a.id = b.dy_level_id and a.status = #{status} and b.status = #{status})
left JOIN terminals c ON b.id = c.line_id and c.status = #{status})
left JOIN terminal_channel_mapper d ON d.term_id = c.id)
left JOIN terminal_channels e ON d.channel_id = e.id and e.status = #{status})
left JOIN terminal_status ts ON c.id = ts.term_id )
<if test="channelid != null">
where e.id = #{channelid}
</if>

@ -272,11 +272,10 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
int indexOri = index;
int indexAdd = indexOri + 1;
int indexAddT = indexAdd + 1;
String string = "--hour" + indexOri + "=" + startHour + " --min" + indexOri + "=" + startMin + " --preset" + indexOri + "=255 --hour" + (indexAdd) + "=" +
endTimeHour + " --min" + (indexAdd) + "=" + endTimeMin + " --preset" + (indexAdd) + "=255 --hour" + indexAddT + "=" + span1 + " --min" + indexAddT +
"=" + span2 + " --preset" + indexAddT + "=255";
String string = " --hour" + indexAddT + "=" + startHour + "\t" + "--min" + indexAddT + "=" + startMin + "\t" + "--preset" + indexAddT + "=255 --hour" + (indexAdd) + "=" + endTimeHour + "\t" + "--min" + (indexAdd) + "=" + endTimeMin + "\t"
+ "--preset" + (indexAdd) + "=255 --hour" + indexOri + "=" + span1 + "\t" + "--min" + indexOri + "=" + span2 + "\t" + "--preset" + indexOri + "=255";
timestr.append(string);
index = indexAddT + 1;
index = indexAddT+1;
}
ArrayList<GetScheduleRequestIdListModel.RequestBean> requestIdList = new ArrayList<>();
@ -284,7 +283,7 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
ChannelAndTermDto channelAndTermDto = terminalsList.get(x);
int requestId = Constants.REQUEST_ID.addAndGet(1);
String cmd = Constants.CMD + "schedule --group=" + dtoList.size() * 3 + " --flag=1 --clientid=10 --cmdid="
String cmd = Constants.CMD + "schedule --group=" + dtoList.size()*3 + " --flag=1 --clientid=10 --cmdid="
+ channelAndTermDto.getCmdid() + " --reqid=" + requestId + " --channel=" + channelAndTermDto.getChannelid() + " " +
timestr.toString();
ProcessExecUtils.exec(cmd);

@ -30,6 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import cn.hutool.core.date.DateUnit;
import java.math.BigInteger;
import java.util.ArrayList;
@ -283,6 +284,25 @@ public class TerminalServiceImpl implements TerminalService {
Integer id = vo.getId();
DyLineAndTermModel model = new DyLineAndTermModel();
List<DyLineAndTerminalNoHeartDto> list = dyLevelDao.selectTreeListByChannelId(id, CommonStatus.EFFECTIVE.value());
list.stream().forEach(var->{
var.getList().forEach(item->{
item.getList().forEach(terminalsWithHeart ->{
Long lastheartbeat = terminalsWithHeart.getLastheartbeat();
if (!BeanUtil.isEmpty(lastheartbeat)) {
BigInteger time = MyDateUtils.TimeSecond2MillSecond(lastheartbeat);
DateTime date = MyDateUtils.date(time.longValue());
long between = MyDateUtils.between(MyDateUtils.getNowDate(), date, DateUnit.MINUTE);
if (between > 30) {
terminalsWithHeart.setOnlinestatus(CommonStatus.DELETE.value());
} else {
terminalsWithHeart.setOnlinestatus(CommonStatus.EFFECTIVE.value());
}
}
});
});
});
boolean empty = CollectionUtil.isEmpty(list);
if (empty) {
model.setList(new ArrayList<>());

@ -59,10 +59,14 @@ public class TerminalVideoServiceImpl implements TerminalVideoService {
}
@Override
public ServiceBody<GetModel> videoParamGet(VideoParamsVo vo) {
return null;
public ServiceBody<GetModel> videoParamGet(VideoGetVo vo) {
GetModel model = new GetModel();
String cmd = Constants.CMD+"videoparams --clientid=10 --flag=0 --cmdid="+vo.getCmdId()+ "\t"+"--reqid="+Constants.REQUEST_ID+"\t"+"--channel="+vo.getChannelId();
ProcessExecUtils.exec(cmd);
model.setRequestId(Integer.parseInt( Constants.REQUEST_ID.toString()));
Constants.REQUEST_ID.addAndGet(1);
return Asserts.success(model);
}
@Override
public ServiceBody<TerminalVideoParamsModel> selectVideoParam(Integer requestId) {
return null;

@ -19,7 +19,7 @@ public interface TerminalVideoService {
*/
ServiceBody<String> updateVideoParam(VideoParamsVo vo);
ServiceBody<GetModel> videoParamGet(VideoParamsVo vo);
ServiceBody<GetModel> videoParamGet(VideoGetVo vo);
ServiceBody<TerminalVideoParamsModel> selectVideoParam(Integer requestId);

Loading…
Cancel
Save