Browse Source

省侧模型同步修改

master
wangguangyuan 1 month ago
parent
commit
64e95df275
2 changed files with 20 additions and 2 deletions
  1. +1
    -1
      src/main/java/com/inspect/tcpserver/minio/service/MinioService.java
  2. +19
    -1
      src/main/java/com/inspect/tcpserver/tcp/NettyClient.java

+ 1
- 1
src/main/java/com/inspect/tcpserver/minio/service/MinioService.java View File

@ -26,7 +26,7 @@ public class MinioService {
public UploadResponse upload(MultipartFile file) throws Exception {
String fileName = file.getOriginalFilename();
String objectName = "/lingzhouzhiliu/Model/" + fileName;
String objectName = "/1cc010d8a78a598ccb52fb470301531cbff88e26c5/Model/" + fileName;
log.info("fileName: {}, objectName: {}", fileName, objectName);
try (InputStream in = file.getInputStream()) {


+ 19
- 1
src/main/java/com/inspect/tcpserver/tcp/NettyClient.java View File

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.inspect.tcpserver.domain.Result;
import com.inspect.tcpserver.domain.UpSystemServerProperties;
import com.inspect.tcpserver.util.Color;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.naming.NoNameCoder;
import com.thoughtworks.xstream.io.xml.Xpp3Driver;
@ -195,6 +196,7 @@ public class NettyClient {
SAXReader saxReader = new SAXReader();
Document document = saxReader.read(new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8)));
Element root = document.getRootElement();
String sendCode = root.element("SendCode").getText();
int type = 0;
if (null != root.element("Type") && !StringUtil.isNullOrEmpty(root.element("Type").getText())) {
type = Integer.parseInt(root.element("Type").getText());
@ -206,8 +208,15 @@ public class NettyClient {
if (type == SystemType.system) {
if (command == SystemType.no_response || command == SystemType.has_response) {
if (null != root.element("Code")) {
if (Objects.equals(root.element("Code").getText(), ResponseType.retry)) {
String code = root.element("Code").getText();
if (Objects.equals(code, ResponseType.retry)) {
resetSendMsg(binaryModel.receiveIndex);
} else if (Objects.equals(code, ResponseType.succeed)) {
log.info(Color.YELLOW + "###### 上级系统[{}]响应结果为成功 ######" + Color.END, sendCode);
} else if (Objects.equals(code, ResponseType.fault)) {
log.info(Color.RED + "###### 上级系统[{}]响应结果为失败 ######" + Color.END, sendCode);
} else if (Objects.equals(code, ResponseType.reject)) {
log.info(Color.RED + "###### 上级系统[{}]响应结果为拒绝 ######" + Color.END, sendCode);
}
}
}
@ -222,6 +231,7 @@ public class NettyClient {
switch (command) {
case SystemType.has_response:
dealRegister(xml);
log.info(Color.YELLOW + "###### 上级系统[{}]注册响应成功 ######" + Color.END, sendCode);
break;
case SystemType.no_response:
//心跳处理
@ -235,6 +245,7 @@ public class NettyClient {
case RobotType.robotIr:
case RobotType.robotPtz:
json = downXml2Json.DownStreamJson2Xml(binaryModel.uuid, binaryModel.id, xml, RobotControl.class);
log.info(Color.YELLOW + "###### 上级系统[{}]发送机器人控制指令 ######" + Color.END, sendCode);
break;
case UAVType.uav:
case UAVType.uavXj:
@ -242,24 +253,31 @@ public class NettyClient {
case UAVType.uavYt:
case UAVType.nest:
json = downXml2Json.DownStreamJson2Xml(binaryModel.uuid, binaryModel.id, xml, RobotControl.class);
log.info(Color.YELLOW + "###### 上级系统[{}]发送无人机控制指令 ######" + Color.END, sendCode);
break;
case TaskType.taskControl:
json = downXml2Json.DownStreamJson2Xml(binaryModel.uuid, binaryModel.id, xml, BaseControl.class);
log.info(Color.YELLOW + "###### 上级系统[{}]发送任务控制指令 ######" + Color.END, sendCode);
break;
case TaskType.taskSend:
json = downXml2Json.DownStreamJson2Xml(binaryModel.uuid, binaryModel.id, xml, TaskSendControl.class);
log.info(Color.YELLOW + "###### 上级系统[{}]发送任务下发指令 ######" + Color.END, sendCode);
break;
case TaskType.lendonTask:
json = downXml2Json.DownStreamJson2Xml(binaryModel.uuid, binaryModel.id, xml, LinkageTaskControl.class);
log.info(Color.YELLOW + "###### 上级系统[{}]发送联动任务下发指令 ######" + Color.END, sendCode);
break;
case TaskType.taskArea:
json = downXml2Json.DownStreamJson2Xml(binaryModel.uuid, binaryModel.id, xml, AreaControl.class);
log.info(Color.YELLOW + "###### 上级系统[{}]发送检修区域下发指令 ######" + Color.END, sendCode);
break;
case ModelType.modelSync:
json = downXml2Json.DownStreamJson2Xml(binaryModel.uuid, binaryModel.id, xml, BaseControl.class);
log.info(Color.YELLOW + "###### 上级系统[{}]发送模型同步指令 ######" + Color.END, sendCode);
break;
case QueryType.queryResult:
json = downXml2Json.DownStreamJson2Xml(binaryModel.uuid, binaryModel.id, xml, ResultControl.class);
log.info(Color.YELLOW + "###### 上级系统[{}]发送巡视结果统计查询指令 ######" + Color.END, sendCode);
break;
default:
log.info("ClienHandler接收到的type:{}不在处理范围内, 不予处理", type);


Loading…
Cancel
Save