Commit dea261c6 authored by zhouleilei's avatar zhouleilei

Merge remote-tracking branch 'origin/master'

parents 9f8e1dd6 c5485f21
package net.wanji.opt.synthesis.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.synthesis.pojo.StrategyControlVO;
import net.wanji.opt.synthesis.service.StrategyControlService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.ws.rs.core.MediaType;
/**
* @author duanruiming
* @date 2024/11/03 12:42
* @description 神思电子获取1.1策略计划基础信息
*/
@Api(value = "StrategyControlController", description = "策略控制")
@RequestMapping("/strategyControl")
@RestController
public class StrategyControlController {
@Resource
private StrategyControlService strategyControlService;
@ApiOperation(value = "策略控制信息操作", notes = "策略控制信息操作",
response = JsonViewObject.class,
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@PostMapping(value = "/strategyInfoOperation",
produces = MediaType.APPLICATION_JSON, consumes = MediaType.APPLICATION_JSON)
@ApiResponses({
@ApiResponse(code = 200, message = "OK", response = StrategyControlVO.class),
})
public JsonViewObject strategyInfoOperation(@RequestBody StrategyControlVO strategyControlVO) throws Exception {
return strategyControlService.strategyInfoOperation(strategyControlVO);
}
}
package net.wanji.opt.synthesis.pojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author duanruiming
* @date 2024/11/03 14:09
* @description 神思电子返回实体
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result {
private String code;
private String msg;
private Object data;
}
package net.wanji.opt.synthesis.pojo;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author duanruiming
* @date 2024/11/03 18:13
*/
@Data
public class StrategyControlDataReq {
/**
* 路口干线Id
*/
private String biz_id;
/**
* 类型 0-路口 1-干线
*/
private Integer biz_type;
/**
* 策略类型 0-绿波带 1-失衡 2-溢出 3-空放
*/
private Integer strategy;
private String schedule_start;
private String schedule_end;
private List<Time_table> time;
/**
* 调控频率(秒),策略下发的频率(只针对失衡和绿波带有效)
*/
private Integer freq;
/**
* 状态(1=开启,0=停止)
*/
private Integer status;
/**
* 操作(insert=新增,update=更新,delete=删除)
*/
private String action;
@Data
@NoArgsConstructor
public static class Time_table {
/**
* 星期周日至周六 0-6 7为每天不限时
*/
private Integer week;
/**
* 时间段,格式为“开始时间-结束时间”,时间格式为hh:mm:ss,范围00:00:00到23:59:59
*/
private String[] time_list;
}
}
package net.wanji.opt.synthesis.pojo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* @author duanruiming
* @date 2024/11/03 18:18
*/
@Data
@ApiModel(value = "StrategyControlDataVO", description = "策略控制操作数据实体")
public class StrategyControlDataVO {
@ApiModelProperty(value = "路口干线Id")
private String bizId;
@ApiModelProperty(value = "类型 0-路口 1-干线")
private Integer bizType;
@ApiModelProperty(value = "策略类型 0-绿波带 1-失衡 2-溢出 3-空放")
private Integer strategy;
@ApiModelProperty(value = "开始时间日期")
private Date scheduleStart;
@ApiModelProperty(value = "结束时间日期")
private Date scheduleEnd;
@ApiModelProperty(value = "日计划表")
private List<StrategyControlDataVO.TimeTable> time;
@ApiModelProperty(value = "调控频率(秒),策略下发的频率(只针对失衡和绿波带有效)")
private Integer freq;
@ApiModelProperty(value = "状态(1=开启,0=停止)")
private Integer status;
@ApiModelProperty(value = "操作(insert=新增,update=更新,delete=删除)")
private String action;
@Data
@NoArgsConstructor
public static class TimeTable {
@ApiModelProperty(value = "星期周日至周六 0-6 7为每天不限时")
private Integer week;
@ApiModelProperty(value = "时间段,格式为“开始时间-结束时间”,时间格式为hh:mm:ss,范围00:00:00到23:59:59")
private String[] timeList;
}
}
package net.wanji.opt.synthesis.pojo;
import lombok.Data;
import java.util.List;
/**
* @author duanruiming
* @date 2024/11/03 14:12
* @description 策略基础信息推送请求
*/
@Data
public class StrategyControlReq {
private List<StrategyControlDataReq> data;
}
package net.wanji.opt.synthesis.pojo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import java.util.List;
/**
* @author duanruiming
* @date 2024/11/03 17:31
*/
@Data
@ApiModel(value = "StrategyControlVO", description = "策略控制操作实体")
public class StrategyControlVO {
private List<StrategyControlDataVO> dataList;
}
package net.wanji.opt.synthesis.service;
import net.wanji.opt.synthesis.pojo.Result;
import net.wanji.opt.synthesis.pojo.StrategyControlReq;
/**
* @author duanruiming
* @date 2024/11/03 14:06
*/
public interface PushStrategyControlService {
void insert();
void update();
void delete();
Result push(StrategyControlReq req) throws Exception;
}
package net.wanji.opt.synthesis.service;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.opt.synthesis.pojo.StrategyControlVO;
/**
* @author duanruiming
* @date 2024/11/03 17:36
*/
public interface StrategyControlService {
JsonViewObject strategyInfoOperation(StrategyControlVO strategyControlVO) throws Exception;
}
package net.wanji.opt.synthesis.service.impl;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.tool.resttool.RestTemplateTool;
import net.wanji.common.utils.tool.JacksonUtils;
import net.wanji.opt.synthesis.pojo.Result;
import net.wanji.opt.synthesis.pojo.StrategyControlReq;
import net.wanji.opt.synthesis.service.PushStrategyControlService;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.Objects;
/**
* @author duanruiming
* @date 2024/11/03 16:25
*/
@Service
@Slf4j
public class PushStrategyControlServiceImpl implements PushStrategyControlService {
@Override
public void insert() {
}
@Override
public void update() {
}
@Override
public void delete() {
}
@Override
public Result push(StrategyControlReq req) throws Exception {
String url = "";
try {
ObjectMapper mapper = JacksonUtils.getInstance();
String resultStr = RestTemplateTool.post(url, mapper.writeValueAsString(req));
Result result = mapper.readValue(resultStr, Result.class);
if (Objects.nonNull(result)) {
if (StringUtils.endsWithIgnoreCase("200", result.getCode())) {
return result;
}
return result;
} else {
log.error("策略推送url:{}失败:返回数据异常", url);
return new Result("500", "服务调用失败", null);
}
} catch (Exception e) {
log.error("策略控制推送url:{},失败:{}", url, e);
throw new Exception(e);
}
}
}
package net.wanji.opt.synthesis.service.impl;
import cn.hutool.core.date.DateUtil;
import com.alibaba.druid.util.StringUtils;
import lombok.extern.slf4j.Slf4j;
import net.wanji.common.enums.DateStyle;
import net.wanji.common.framework.Constants;
import net.wanji.common.framework.rest.JsonViewObject;
import net.wanji.common.utils.tool.JacksonUtils;
import net.wanji.opt.synthesis.pojo.*;
import net.wanji.opt.synthesis.service.PushStrategyControlService;
import net.wanji.opt.synthesis.service.StrategyControlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.*;
/**
* @author duanruiming
* @date 2024/11/03 17:37
*/
@Slf4j
@Service
public class StrategyControlServiceImpl implements StrategyControlService {
@Autowired
private PushStrategyControlService pushStrategyControlService;
@Override
public JsonViewObject strategyInfoOperation(StrategyControlVO strategyControlVO) throws Exception {
try {
StrategyControlReq req = convertReq(strategyControlVO);
// 存库
// 调用推送
//StrategyControlDataReq detailData = new StrategyControlDataReq();
//detailData.setBiz_id("241940");
//detailData.setBiz_type(0);
//detailData.setStrategy(3);
//Date date = new Date();
//detailData.setSchedule_end(DateUtil.format(date, DateStyle.YYYY_MM_DD_HH_MM_SS.getValue()));
//detailData.setSchedule_end(DateUtil.format(date, DateStyle.YYYY_MM_DD_HH_MM_SS.getValue()));
//StrategyControlDataReq.Time_table timeTable = new StrategyControlDataReq.Time_table();
//timeTable.setWeek(1);
//timeTable.setTime_list(new String[]{"00:00-01:00", "01:00-02:00"});
//StrategyControlDataReq.Time_table timeTable1 = new StrategyControlDataReq.Time_table();
//timeTable1.setWeek(1);
//timeTable1.setTime_list(new String[]{"02:00-03:00", "03:00-04:00"});
//detailData.setTime(Arrays.asList(timeTable1, timeTable));
//detailData.setFreq(1000 * 60);
//detailData.setStrategy(1);
//detailData.setAction("insert");
// todo 测试数据
//req.setData(Arrays.asList(detailData));
Result result = pushStrategyControlService.push(req);
if (Objects.nonNull(result)) {
JsonViewObject jsonViewObject = JsonViewObject.newInstance();
jsonViewObject.setCode(Integer.valueOf(result.getCode()));
jsonViewObject.setMessage(result.getMsg());
jsonViewObject.setContent(result.getData());
jsonViewObject.setStatus(StringUtils.equals("200", result.getCode()) ? Constants.JsonView.STATUS_SUCCESS : Constants.JsonView.STATUS_FAIL);
return jsonViewObject;
} else {
return JsonViewObject.newInstance().fail("推送神思策略控制失败!");
}
} catch (Exception e) {
log.error("策略操作失败:{}", e);
throw new Exception(e);
}
}
private StrategyControlReq convertReq(StrategyControlVO vo) throws Exception {
try {
List<StrategyControlDataVO> dataList = vo.getDataList();
StrategyControlReq req = new StrategyControlReq();
if (!CollectionUtils.isEmpty(dataList)) {
List<StrategyControlDataReq> dataReqList = new ArrayList<>(dataList.size());
for (StrategyControlDataVO dataVO : dataList) {
StrategyControlDataReq detailData = new StrategyControlDataReq();
detailData.setBiz_id(dataVO.getBizId());
detailData.setBiz_type(dataVO.getBizType());
detailData.setStrategy(dataVO.getStrategy());
detailData.setSchedule_start(DateUtil.format(dataVO.getScheduleStart(), DateStyle.YYYY_MM_DD_HH_MM_SS.getValue()));
detailData.setSchedule_end(DateUtil.format(dataVO.getScheduleEnd(), DateStyle.YYYY_MM_DD_HH_MM_SS.getValue()));
List<StrategyControlDataVO.TimeTable> timeTableList = dataVO.getTime();
List<StrategyControlDataReq.Time_table> timeTables = new ArrayList<>(timeTableList.size());
timeTableList.forEach(item -> {
StrategyControlDataReq.Time_table timeTable = new StrategyControlDataReq.Time_table();
timeTable.setTime_list(item.getTimeList());
timeTable.setWeek(item.getWeek());
timeTables.add(timeTable);
});
detailData.setTime(timeTables);
detailData.setFreq(dataVO.getFreq());
detailData.setStatus(dataVO.getStatus());
detailData.setAction(dataVO.getAction());
dataReqList.add(detailData);
req.setData(dataReqList);
}
}
return req;
} catch (Exception e) {
log.error("策略控制操作数据转换异常:{}", e);
throw new Exception(e);
}
}
public static void main(String[] args) throws Exception {
StrategyControlDataReq detailData = new StrategyControlDataReq();
detailData.setBiz_id("241940");
detailData.setBiz_type(0);
detailData.setStrategy(3);
Date date = new Date();
detailData.setSchedule_start(DateUtil.format(date, DateStyle.YYYY_MM_DD_HH_MM_SS.getValue()));
detailData.setSchedule_end(DateUtil.format(date, DateStyle.YYYY_MM_DD_HH_MM_SS.getValue()));
StrategyControlDataReq.Time_table timeTable = new StrategyControlDataReq.Time_table();
timeTable.setWeek(1);
timeTable.setTime_list(new String[]{"00:00-01:00", "01:00-02:00"});
StrategyControlDataReq.Time_table timeTable1 = new StrategyControlDataReq.Time_table();
timeTable1.setWeek(2);
timeTable1.setTime_list(new String[]{"02:00-03:00", "03:00-04:00"});
detailData.setTime(Arrays.asList(timeTable1, timeTable));
detailData.setFreq(1000 * 60);
detailData.setStatus(1);
detailData.setAction("insert");
// todo 测试数据
StrategyControlReq req = new StrategyControlReq();
req.setData(Arrays.asList(detailData));
System.err.println(JacksonUtils.getInstance().writeValueAsString(req));
System.err.println(new Date());
}
}
...@@ -11,7 +11,8 @@ import java.util.Objects; ...@@ -11,7 +11,8 @@ import java.util.Objects;
*/ */
@Getter @Getter
public enum CommandResultSignEnum { public enum CommandResultSignEnum {
GET_RUNNING_STATE_INFO(RunningLightsStatusPojo.class, "getRunningStateInfoService"); GET_RUNNING_STATE_INFO(RunningLightsStatusPojo.class, "getRunningStateInfoService"),
GET_RUNNING_SCHEME_NO(RunningLightsStatusPojo.class, "getSchemeNoService");
private final Object resultPojo; private final Object resultPojo;
private final String className; private final String className;
......
...@@ -13,6 +13,7 @@ import net.wanji.utc.hisense.cache.netty.NettyMessageCache; ...@@ -13,6 +13,7 @@ import net.wanji.utc.hisense.cache.netty.NettyMessageCache;
import net.wanji.utc.hisense.netty.codec.MessageDecoder; import net.wanji.utc.hisense.netty.codec.MessageDecoder;
import net.wanji.utc.hisense.netty.codec.MessageEnCoder; import net.wanji.utc.hisense.netty.codec.MessageEnCoder;
import net.wanji.utc.hisense.netty.handler.TcpClientHandler; import net.wanji.utc.hisense.netty.handler.TcpClientHandler;
import net.wanji.utc.hisense.util.XMLUtils;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
...@@ -65,19 +66,16 @@ public class TcpClient { ...@@ -65,19 +66,16 @@ public class TcpClient {
} }
//public static void sendMessage(String ip, Integer port, String msg) { public static void sendMessage(Object msg) {
// byte[] bytes = HexUtil.decodeHex(msg); try {
// try { ChannelFuture channelFuture = tcpChannelFuture.channel().writeAndFlush(XMLUtils.strToHex(XMLUtils.convertToXml(msg)));
// if (channelFutureMap.isEmpty()) { if (channelFuture.isSuccess()) {
// return; log.debug("发送信号机命令消息成功:{}", msg);
// } }
// tcpChannelFuture.channel() } catch (Exception e) {
// .writeAndFlush(new DatagramPacket(Unpooled.copiedBuffer(bytes), new InetSocketAddress(ip, port))).sync(); log.error("发送信号机命令消息失败", e);
// log.debug("发送信号机:{}/{}命令消息:{}", ip, port, msg); }
// } catch (InterruptedException e) { }
// log.error("sendMsg is error", e);
// }
//}
//public static MessageResultPojo sendMessage(String ip, Integer port, String msg, String command, int timeout) { //public static MessageResultPojo sendMessage(String ip, Integer port, String msg, String command, int timeout) {
// try { // try {
......
...@@ -11,6 +11,7 @@ public class CommandResultSign { ...@@ -11,6 +11,7 @@ public class CommandResultSign {
public static Object getHexSign(String data) throws Exception{ public static Object getHexSign(String data) throws Exception{
//Object runningLightsStatusPojo = JSON.parseObject(data, RunningLightsStatusPojo.class); //Object runningLightsStatusPojo = JSON.parseObject(data, RunningLightsStatusPojo.class);
return XMLUtils.convertXmlStrToObject(RunningLightsStatusPojo.class, data); return XMLUtils.convertXmlStrToObject(RunningLightsStatusPojo.class, data);
} }
......
...@@ -107,7 +107,7 @@ public class TcpClientHandler extends SimpleChannelInboundHandler<DatagramPacket ...@@ -107,7 +107,7 @@ public class TcpClientHandler extends SimpleChannelInboundHandler<DatagramPacket
commandPojo.setSignalId(crossInfo.getCode()); commandPojo.setSignalId(crossInfo.getCode());
commandPojo.setSignalIp(crossInfo.getIp()); commandPojo.setSignalIp(crossInfo.getIp());
commandPojo.setPort(crossInfo.getPort()); commandPojo.setPort(crossInfo.getPort());
commandPojo.setResponseMsg(data); commandPojo.setMsg(data);
return commandPojo; return commandPojo;
} }
...@@ -120,7 +120,6 @@ public class TcpClientHandler extends SimpleChannelInboundHandler<DatagramPacket ...@@ -120,7 +120,6 @@ public class TcpClientHandler extends SimpleChannelInboundHandler<DatagramPacket
super.userEventTriggered(ctx, evt); super.userEventTriggered(ctx, evt);
if (evt instanceof IdleStateEvent) { if (evt instanceof IdleStateEvent) {
IdleStateEvent idleStateEvent = (IdleStateEvent) evt; IdleStateEvent idleStateEvent = (IdleStateEvent) evt;
log.info("已经 10 秒没有发送信息,给服务端发送心跳!");
//向服务端发送消息 //向服务端发送消息
try { try {
SocketAddress socketAddress = ctx.channel().remoteAddress(); SocketAddress socketAddress = ctx.channel().remoteAddress();
...@@ -128,10 +127,9 @@ public class TcpClientHandler extends SimpleChannelInboundHandler<DatagramPacket ...@@ -128,10 +127,9 @@ public class TcpClientHandler extends SimpleChannelInboundHandler<DatagramPacket
//向服务端发送心跳 //向服务端发送心跳
HeartBeatRequest heartBeatRequest = new HeartBeatRequest(); HeartBeatRequest heartBeatRequest = new HeartBeatRequest();
heartBeatRequest.setMessageType(MessageTypeEnum.HEARTBEAT_STATUS.getType()); heartBeatRequest.setMessageType(MessageTypeEnum.HEARTBEAT_STATUS.getType());
log.error("心跳消息:{}", XMLUtils.convertToXml(heartBeatRequest));
ctx.channel().writeAndFlush(XMLUtils.strToHex(XMLUtils.convertToXml(heartBeatRequest))); ctx.channel().writeAndFlush(XMLUtils.strToHex(XMLUtils.convertToXml(heartBeatRequest)));
} catch (Exception ex) { } catch (Exception ex) {
log.error(ex.getMessage()); log.error("心跳消息发送失败:{}", ex.getMessage());
} }
} }
......
...@@ -83,7 +83,7 @@ public class UdpClientHandler extends SimpleChannelInboundHandler<DatagramPacket ...@@ -83,7 +83,7 @@ public class UdpClientHandler extends SimpleChannelInboundHandler<DatagramPacket
commandPojo.setSignalId(crossInfo.getCode()); commandPojo.setSignalId(crossInfo.getCode());
commandPojo.setSignalIp(crossInfo.getIp()); commandPojo.setSignalIp(crossInfo.getIp());
commandPojo.setPort(crossInfo.getPort()); commandPojo.setPort(crossInfo.getPort());
commandPojo.setResponseMsg(data); commandPojo.setMsg(data);
return commandPojo; return commandPojo;
} }
......
...@@ -12,5 +12,5 @@ public class CommandPojo { ...@@ -12,5 +12,5 @@ public class CommandPojo {
private String signalId; private String signalId;
private String signalIp; private String signalIp;
private Integer port; private Integer port;
private Object responseMsg; private Object msg;
} }
package net.wanji.utc.hisense.netty.request;
/**
* @author duanruiming
* @date 2024/11/02 20:15
*/
public interface CommandRequestFactory {
/**
* 发送海信请求
*/
void sendCommandRequest(Object content);
}
...@@ -7,5 +7,6 @@ import net.wanji.utc.hisense.netty.pojo.CommandPojo; ...@@ -7,5 +7,6 @@ import net.wanji.utc.hisense.netty.pojo.CommandPojo;
* @date 2023/05/10 10:07 * @date 2023/05/10 10:07
*/ */
public interface CommandResponseFactory { public interface CommandResponseFactory {
Object getCommandResponse(CommandPojo commandPojo); Object getCommandResponse(CommandPojo commandPojo);
} }
...@@ -17,7 +17,7 @@ public class HeartBeatService implements CommandResponseFactory { ...@@ -17,7 +17,7 @@ public class HeartBeatService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class GetAlarmInfoService implements CommandResponseFactory { public class GetAlarmInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class GetBaseInfoService implements CommandResponseFactory { public class GetBaseInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class GetDailyPlanInfoService implements CommandResponseFactory { public class GetDailyPlanInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class GetDetectorInfoService implements CommandResponseFactory { public class GetDetectorInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -13,6 +13,6 @@ import org.springframework.stereotype.Service; ...@@ -13,6 +13,6 @@ import org.springframework.stereotype.Service;
public class GetDeviceInfoService implements CommandResponseFactory { public class GetDeviceInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class GetFaultInfoService implements CommandResponseFactory { public class GetFaultInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class GetLightsGroupInfoService implements CommandResponseFactory { public class GetLightsGroupInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class GetLightsStatusInfoService implements CommandResponseFactory { public class GetLightsStatusInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class GetPhaseInfoService implements CommandResponseFactory { public class GetPhaseInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class GetPhaseSecurityInfoService implements CommandResponseFactory { public class GetPhaseSecurityInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -16,7 +16,7 @@ import org.springframework.stereotype.Service; ...@@ -16,7 +16,7 @@ import org.springframework.stereotype.Service;
public class GetRunningStateInfoService implements CommandResponseFactory { public class GetRunningStateInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
SignalDataCache.runningStateInfoCacheUdp.put(commandPojo.getCrossId(), (RunningLightsStatusPojo) commandPojo.getResponseMsg()); SignalDataCache.runningStateInfoCacheUdp.put(commandPojo.getCrossId(), (RunningLightsStatusPojo) commandPojo.getMsg());
return commandPojo; return commandPojo;
} }
......
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class GetSchedulesInfoService implements CommandResponseFactory { public class GetSchedulesInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class GetSchemeInfoService implements CommandResponseFactory { public class GetSchemeInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
package net.wanji.utc.hisense.netty.response.impl.get;
import net.wanji.utc.hisense.netty.TcpClient;
import net.wanji.utc.hisense.netty.pojo.CommandPojo;
import net.wanji.utc.hisense.netty.request.CommandRequestFactory;
import net.wanji.utc.hisense.netty.response.CommandResponseFactory;
import net.wanji.utc.hisense.pojo.xml.pojo.messagecontent.get.GetSchemeNoRequest;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
/**
* @author duanruiming
* @date 2024/11/02 19:51
* @description 获取海信当前运行方案号,对应【协调状态】
*/
@Service
public class GetSchemeNoService implements CommandResponseFactory, CommandRequestFactory {
@Override
public void sendCommandRequest(Object msg) {
GetSchemeNoRequest request = new GetSchemeNoRequest();
GetSchemeNoRequest.Content content = new GetSchemeNoRequest.Content();
content.setSpot(String.valueOf(msg));
request.setMessageContent(content);
TcpClient.sendMessage(request);
}
@Override
public Object getCommandResponse(CommandPojo commandPojo) {
System.err.println("==============收到消息成功" + commandPojo.getMsg());
return commandPojo.getMsg();
}
@Scheduled(initialDelay = 30 * 1000, fixedRate = 4000)
public void test(){
sendCommandRequest(1);
System.err.println("==============发送消息成功");
}
}
\ No newline at end of file
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class GetStageInfoService implements CommandResponseFactory { public class GetStageInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class GetStageStatusService implements CommandResponseFactory { public class GetStageStatusService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class GetTrafficDataInfoService implements CommandResponseFactory { public class GetTrafficDataInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetAlarmInfoService implements CommandResponseFactory { public class SetAlarmInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetBaseInfoService implements CommandResponseFactory { public class SetBaseInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetControlInfoService implements CommandResponseFactory { public class SetControlInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetDailyPlanInfoService implements CommandResponseFactory { public class SetDailyPlanInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetDetectorInfoService implements CommandResponseFactory { public class SetDetectorInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetDeviceInfoService implements CommandResponseFactory { public class SetDeviceInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetFaultInfoService implements CommandResponseFactory { public class SetFaultInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetLightsGroupInfoService implements CommandResponseFactory { public class SetLightsGroupInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetPhaseInfoService implements CommandResponseFactory { public class SetPhaseInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetPhaseSecurityInfoService implements CommandResponseFactory { public class SetPhaseSecurityInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetSchedulesInfoService implements CommandResponseFactory { public class SetSchedulesInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetSchemeInfoService implements CommandResponseFactory { public class SetSchemeInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetStageInfoService implements CommandResponseFactory { public class SetStageInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,6 @@ import org.springframework.stereotype.Service;
public class SetTrafficDataInfoService implements CommandResponseFactory { public class SetTrafficDataInfoService implements CommandResponseFactory {
@Override @Override
public Object getCommandResponse(CommandPojo commandPojo) { public Object getCommandResponse(CommandPojo commandPojo) {
return commandPojo.getResponseMsg(); return commandPojo.getMsg();
} }
} }
...@@ -12,6 +12,7 @@ import java.io.Serializable; ...@@ -12,6 +12,7 @@ import java.io.Serializable;
* @author duanruiming * @author duanruiming
* @date 2024/01/08 10:03 * @date 2024/01/08 10:03
*/ */
@SuppressWarnings("SpellCheckingInspection")
@Data @Data
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "systemScription") @XmlRootElement(name = "systemScription")
......
...@@ -16,11 +16,11 @@ import javax.xml.bind.annotation.XmlRootElement; ...@@ -16,11 +16,11 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "systemScription") @XmlRootElement(name = "systemScription")
public class LogOnRequest extends SystemScriptionRequest { public class LogOnRequest extends SystemScriptionRequest {
private LogOnContent messageContent; private Content messageContent;
@Data @Data
@XmlAccessorType(XmlAccessType.FIELD) @XmlAccessorType(XmlAccessType.FIELD)
public static class LogOnContent { public static class Content {
private String user; private String user;
private String password; private String password;
} }
......
package net.wanji.utc.hisense.pojo.xml.pojo.messagecontent;
import lombok.Data;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
/**
* @author duanruiming
* @date 2024/10/29 17:22
*/
@Data
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "systemScription")
public class StepControlMultiPhaseRequest {
private Content messageContent;
@Data
@XmlAccessorType(XmlAccessType.FIELD)
public static class Content {
private String spot;
/** 相位数量 */
private int count;
/** 相位号 */
private String holdPhase;
private String holdPhase1;
private String holdPhase2;
private String holdPhase3;
private String holdPhase4;
private String holdPhase5;
}
}
package net.wanji.utc.hisense.pojo.xml.pojo.messagecontent;
import lombok.Data;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
/**
* @author duanruiming
* @date 2024/10/29 16:56
*/
@Data
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "systemScription")
public class StepControlRequest {
private Content messageContent;
@Data
@XmlAccessorType(XmlAccessType.FIELD)
public static class Content {
private String spot;
/** 1-开始步进 0-取消 */
private String command;
/** 0 顺序步进,仅支持顺序 */
private String ctrlStep;
}
}
package net.wanji.utc.hisense.pojo.xml.pojo.messagecontent.get;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import net.wanji.utc.hisense.pojo.xml.pojo.SystemScriptionRequest;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
/**
* @author duanruiming
* @date 2024/11/02 20:00
* @description 获取海信方案号请求实体,
*/
@Data
@XmlAccessorType(XmlAccessType.FIELD)
@XmlRootElement(name = "systemScription")
@AllArgsConstructor
@NoArgsConstructor
public class GetSchemeNoRequest extends SystemScriptionRequest {
private Content messageContent;
@Data
@XmlAccessorType(XmlAccessType.FIELD)
@AllArgsConstructor
@NoArgsConstructor
public static class Content {
private String spot;
}
}
...@@ -61,7 +61,7 @@ public class XMLUtils { ...@@ -61,7 +61,7 @@ public class XMLUtils {
System.err.println("================"); System.err.println("================");
LogOnRequest logOnMessageContent = new LogOnRequest(); LogOnRequest logOnMessageContent = new LogOnRequest();
LogOnRequest.LogOnContent body = new LogOnRequest.LogOnContent(); LogOnRequest.Content body = new LogOnRequest.Content();
body.setUser("user"); body.setUser("user");
body.setPassword("123456"); body.setPassword("123456");
logOnMessageContent.setMessageContent(body); logOnMessageContent.setMessageContent(body);
......
...@@ -96,7 +96,7 @@ threadPoolConfig: ...@@ -96,7 +96,7 @@ threadPoolConfig:
portParam: portParam:
localPort: 55051 localPort: 55051
remotePort: 10010 remotePort: 10010
remoteIp: 172.24.71.68 remoteIp: 127.0.0.1
server: server:
port: 39003 port: 39003
servlet: servlet:
......
spring: spring:
application:
# dubbo启动需要程序名称
name: utc-hisense
main:
allow-circular-references: true
cloud: cloud:
nacos: nacos:
config: config:
...@@ -12,4 +7,9 @@ spring: ...@@ -12,4 +7,9 @@ spring:
group: signal group: signal
namespace: signal namespace: signal
username: nacos username: nacos
password: nacos password: nacos
\ No newline at end of file application:
# dubbo启动需要程序名称
name: utc-hisense
main:
allow-circular-references: true
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment