|
|
@@ -4,6 +4,7 @@ import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.yunfeiyun.agmp.common.utils.JSONUtils;
|
|
|
import com.yunfeiyun.agmp.iot.common.domain.resvo.IotFirmdevResVo;
|
|
|
import com.yunfeiyun.agmp.iot.common.constant.devicetype.ServiceNameConst;
|
|
|
+import com.yunfeiyun.agmp.iots.common.modal.IotDeviceconnResVo;
|
|
|
import com.yunfeiyun.agmp.iots.common.modal.TosDevicetypeResVo;
|
|
|
import com.yunfeiyun.agmp.iots.core.http.*;
|
|
|
import com.yunfeiyun.agmp.iots.device.service.XphHttpDevice;
|
|
|
@@ -38,7 +39,7 @@ public class HttpManager {
|
|
|
* 初始化
|
|
|
* 注意:原来的getFirmDevBid(原来的配置id)暂时换成了getDevtypeBid,真正实现时候看是否正确
|
|
|
*/
|
|
|
- public void buildHttpConnection(TosDevicetypeResVo tosDeviceType, JSONObject jsonConfig) {
|
|
|
+ public void buildHttpConnection(IotDeviceconnResVo iotDeviceconnResVo, JSONObject jsonConfig) {
|
|
|
|
|
|
log.info("【http初始化】加载配置{}", jsonConfig);
|
|
|
|
|
|
@@ -46,7 +47,7 @@ public class HttpManager {
|
|
|
|
|
|
HttpConfig httpConfig = null;
|
|
|
try {
|
|
|
- httpConfig = JSONUtils.toObject(tosDeviceType.getDevTypeConfig(), HttpConfig.class);
|
|
|
+ httpConfig = JSONUtils.toObject(iotDeviceconnResVo.getDevconnConfig(), HttpConfig.class);
|
|
|
} catch (Exception e) {
|
|
|
log.error("【http初始化】异常", e);
|
|
|
return;
|
|
|
@@ -58,7 +59,7 @@ public class HttpManager {
|
|
|
return;
|
|
|
}
|
|
|
String service = httpConfig.getService();
|
|
|
- String firmBid = tosDeviceType.getFirmBid();
|
|
|
+ String firmBid = iotDeviceconnResVo.getFirmBid();
|
|
|
if (ServiceNameConst.SERVICE_XMZN_ZNDP.equals(httpConfig.getService())) {
|
|
|
|
|
|
if (hmClientByServiceName.get(ServiceNameConst.SERVICE_XMZN_ZNDP) != null) {
|
|
|
@@ -67,18 +68,18 @@ public class HttpManager {
|
|
|
}
|
|
|
|
|
|
XmznHttpClient xmznHttpClient = new XmznHttpClient();
|
|
|
- hmClients.put(tosDeviceType.getDevtypeBid(), xmznHttpClient);
|
|
|
+ hmClients.put(iotDeviceconnResVo.getDevtypeBid(), xmznHttpClient);
|
|
|
|
|
|
- xmznHttpClient.init(tosDeviceType.getFirmBid(), httpConfig, tosDeviceType.getDevtypeBid());
|
|
|
+ xmznHttpClient.init(iotDeviceconnResVo.getFirmBid(), httpConfig, iotDeviceconnResVo.getDevtypeBid());
|
|
|
|
|
|
hmClientByServiceName.put(ServiceNameConst.SERVICE_XMZN_ZNDP, xmznHttpClient);
|
|
|
//hmClientByServiceName.put(httpConfig.getServiceName(), xmznHttpClient);
|
|
|
log.info("【小马智农】http-client初始化结束");
|
|
|
} else if (ServiceNameConst.SERVICE_ZHAO_HE_SF.equals(httpConfig.getService())) {
|
|
|
ZhaoHeSfHttpClient zhaoHeSfHttpClient = new ZhaoHeSfHttpClient();
|
|
|
- zhaoHeSfHttpClient.init(tosDeviceType.getFirmBid(), httpConfig, tosDeviceType.getDevtypeBid());
|
|
|
+ zhaoHeSfHttpClient.init(iotDeviceconnResVo.getFirmBid(), httpConfig, iotDeviceconnResVo.getDevtypeBid());
|
|
|
|
|
|
- hmClients.put(tosDeviceType.getDevtypeBid(), zhaoHeSfHttpClient);
|
|
|
+ hmClients.put(iotDeviceconnResVo.getDevtypeBid(), zhaoHeSfHttpClient);
|
|
|
|
|
|
hmClientByServiceName.put(ServiceNameConst.SERVICE_ZHAO_HE_SF, zhaoHeSfHttpClient);
|
|
|
log.info("【兆赫水肥机】http-client初始化结束");
|
|
|
@@ -87,15 +88,15 @@ public class HttpManager {
|
|
|
|
|
|
AdznHttpConfig adznHttpConfig = null;
|
|
|
try {
|
|
|
- adznHttpConfig = JSONUtils.toObject(tosDeviceType.getDevTypeConfig(), AdznHttpConfig.class);
|
|
|
+ adznHttpConfig = JSONUtils.toObject(iotDeviceconnResVo.getDevconnConfig(), AdznHttpConfig.class);
|
|
|
} catch (Exception e) {
|
|
|
log.error("【http初始化】异常", e);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- adznHttpClient.init(tosDeviceType.getFirmBid(), adznHttpConfig, tosDeviceType.getDevtypeBid());
|
|
|
+ adznHttpClient.init(iotDeviceconnResVo.getFirmBid(), adznHttpConfig, iotDeviceconnResVo.getDevtypeBid());
|
|
|
|
|
|
- hmClients.put(tosDeviceType.getDevtypeBid(), adznHttpClient);
|
|
|
+ hmClients.put(iotDeviceconnResVo.getDevtypeBid(), adznHttpClient);
|
|
|
|
|
|
hmClientByServiceName.put(ServiceNameConst.SERVICE_ADZN_GSSQ, adznHttpClient);
|
|
|
log.info("【爱迪智农】http-client初始化结束");
|
|
|
@@ -105,7 +106,7 @@ public class HttpManager {
|
|
|
try {
|
|
|
XphHttpClient xphHttpClient = new XphHttpClient();
|
|
|
xphHttpClient.init(firmBid, httpConfig, null);
|
|
|
- hmClients.put(tosDeviceType.getDevtypeBid(), xphHttpClient);
|
|
|
+ hmClients.put(iotDeviceconnResVo.getDevtypeBid(), xphHttpClient);
|
|
|
hmClientByServiceName.put(ServiceNameConst.SERVICE_XPH_HTTP, xphHttpClient);
|
|
|
|
|
|
xphHttpDevice.initElementInfo();
|
|
|
@@ -123,7 +124,7 @@ public class HttpManager {
|
|
|
try {
|
|
|
XphHttpClient xphHttpClient = new XphHttpClient();
|
|
|
xphHttpClient.init(firmBid, httpConfig, null);
|
|
|
- hmClients.put(tosDeviceType.getDevtypeBid(), xphHttpClient);
|
|
|
+ hmClients.put(iotDeviceconnResVo.getDevtypeBid(), xphHttpClient);
|
|
|
hmClientByServiceName.put(ServiceNameConst.SERVICE_XPH_GP_QXZ, xphHttpClient);
|
|
|
|
|
|
xphHttpGpQxzDevice.initElementInfo();
|
|
|
@@ -137,8 +138,8 @@ public class HttpManager {
|
|
|
}
|
|
|
} else if (ServiceNameConst.SERVICE_ZJSF_XYCB.equals(service)) {
|
|
|
ZjsfXycbHttpClient zjsfXycbHttpClient = new ZjsfXycbHttpClient();
|
|
|
- zjsfXycbHttpClient.init(tosDeviceType.getFirmBid(), httpConfig, tosDeviceType.getDevtypeBid());
|
|
|
- hmClients.put(tosDeviceType.getDevtypeBid(), zjsfXycbHttpClient);
|
|
|
+ zjsfXycbHttpClient.init(iotDeviceconnResVo.getFirmBid(), httpConfig, iotDeviceconnResVo.getDevtypeBid());
|
|
|
+ hmClients.put(iotDeviceconnResVo.getDevtypeBid(), zjsfXycbHttpClient);
|
|
|
hmClientByServiceName.put(ServiceNameConst.SERVICE_ZJSF_XYCB, zjsfXycbHttpClient);
|
|
|
log.info("【中捷四方性诱测报】http-client初始化结束");
|
|
|
} else {
|