Browse Source

模型同步现场适配

master
lijw 9 months ago
parent
commit
e5809f2047
2 changed files with 19 additions and 16 deletions
  1. +18
    -15
      inspect-main/inspect-main-client/src/main/java/com/inspect/client/service/ClientService.java
  2. +1
    -1
      inspect-metadata/src/main/java/com/inspect/metadata/eqpbook/controller/BasedataEqpBookController.java

+ 18
- 15
inspect-main/inspect-main-client/src/main/java/com/inspect/client/service/ClientService.java View File

@ -203,7 +203,6 @@ public class ClientService {
String stationNo = statisticsMapper.selectStationNo();
if (StringUtils.isNotBlank(stationNo)) {
jsonObject.put("Code", stationNo);
jsonObject.put("Command", 1);
}
String iipCode = statisticsMapper.queryIICSystemCode();
@ -212,22 +211,26 @@ public class ClientService {
}
jsonObject.put("SendCode", iipCode);
// 武汉电站同步点位数据
try {
if (StringUtils.isNotEmpty(jsonObject.getString("ReceiveCode")) && jsonObject.getString("ReceiveCode").equals("areaPatrolServer")) {
logger.info("[CLIENT] 许继ReceiveCode: {}, lowMsgUrl: {}", jsonObject.getString("ReceiveCode"), lowMsgUrl);
jsonObject.computeIfAbsent("Time", k -> DateUtils.format(DateUtils.yyyyMMddHHmmss2, new Date()));
jsonObject.put("Command", "4");
jsonObject.put("ReceiveCode", "areaPatrolServer");
logger.info("--------------[CLIENT] 许继点位同步jsonObject: {}", jsonObject.toJSONString());
} else if (StringUtils.isNotEmpty(jsonObject.getString("ReceiveCode")) && jsonObject.getString("ReceiveCode").equals("Client05")) {
logger.info("[CLIENT] 无人机ReceiveCode: {}, lowMsgUrl: {}", jsonObject.getString("ReceiveCode"), lowMsgUrl);
jsonObject.computeIfAbsent("Time", k -> DateUtils.format(DateUtils.yyyyMMddHHmmss2, new Date()));
jsonObject.put("Command", "1");
jsonObject.put("ReceiveCode", "Client05");
logger.info("--------------[CLIENT] 无人机点位同步jsonObject: {}", jsonObject.toJSONString());
String receiveCode = jsonObject.getString("ReceiveCode");
if(StringUtils.isNotEmpty(receiveCode)) {
if (receiveCode.startsWith("areaPatrolServer")) {
logger.info("[CLIENT] 许继边缘节点ReceiveCode: {}, lowMsgUrl: {}", receiveCode, lowMsgUrl);
jsonObject.computeIfAbsent("Time", k -> DateUtils.format(DateUtils.yyyyMMddHHmmss2, new Date()));
jsonObject.put("Command", "4");
jsonObject.put("ReceiveCode",receiveCode);
logger.info("--------------[CLIENT] 许继边缘节点点位同步jsonObject: {}", jsonObject.toJSONString());
} else {
logger.info("[CLIENT] 直连设备ReceiveCode: {}, lowMsgUrl: {}", receiveCode, lowMsgUrl);
jsonObject.computeIfAbsent("Time", k -> DateUtils.format(DateUtils.yyyyMMddHHmmss2, new Date()));
jsonObject.put("Command", "1");
jsonObject.put("ReceiveCode",receiveCode);
logger.info("--------------[CLIENT] 直连设备点位同步jsonObject: {}", jsonObject.toJSONString());
}
return CallDeviceApi.callDevice(lowMsgUrl, jsonObject.toJSONString());
} else {
throw new ServiceException("receiveCode is empty");
}
return CallDeviceApi.callDevice(lowMsgUrl, jsonObject.toJSONString());
} catch (Exception e) {
throw new ServiceException("Call " + lowMsgUrl + " Exception!");
}


+ 1
- 1
inspect-metadata/src/main/java/com/inspect/metadata/eqpbook/controller/BasedataEqpBookController.java View File

@ -101,7 +101,7 @@ public class BasedataEqpBookController extends BaseController {
basedataEqpbook.setPatrolDeviceCode(patroldeviceCode);
}
logger.info("---------------list-----------basedataEqpbook:{}", basedataEqpbook);
if (basedataEqpbook != null && ("sync:areaPatrolServer".equals(basedataEqpbook.getPatrolDeviceCode()) || "sync:Client05".equals(basedataEqpbook.getPatrolDeviceCode()))) {
if (basedataEqpbook != null && basedataEqpbook.getPatrolDeviceCode().startsWith("sync:")) {
// 和许继无人机同步点位
String patrolDeviceCode = basedataEqpbook.getPatrolDeviceCode();
JSONObject jsonObject = new JSONObject();


Loading…
Cancel
Save