Commit b3f9ed8e LN

panaCim IP和端口保存到cache

1 个父辈 5bd255be
......@@ -190,4 +190,15 @@ public class Constants {
*/
public static final String XLR_lockPos="lockPos";
/**
* PanaCim注册的IP
*/
public static final String Cache_PanaCIMIP="Cache_PanaCIMIP";
/**
* PanaCim注册的端口号
*/
public static final String Cache_PanaCIMPort="Cache_PanaCIMPort";
}
......@@ -346,9 +346,10 @@ public class DeviceController {
}
} catch (ValidateException ve) {
errorMsg = ve.getMessage();
errorMsg= MessageUtils.getText(ve.getMsgKey(),ve.getMsgParam(),new Locale("en","US"),ve.getDefaultMsg());
log.info("查找空库位失败:" + errorMsg);
resultMap.put("result", "105");
resultMap.put("msg", MessageUtils.getText(ve.getMsgKey(),ve.getMsgParam(),request.getLocale(),ve.getDefaultMsg()));
resultMap.put("msg",errorMsg);
} catch (Exception e) {
errorMsg = e.getMessage();
log.info("查找空库位失败,", e);
......
package com.neotel.smfcore.custom.panacim;
import cn.hutool.core.util.ObjectUtil;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Strings;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.neotel.smfcore.common.exception.ValidateException;
import com.neotel.smfcore.common.utils.Constants;
import com.neotel.smfcore.common.utils.HttpHelper;
import com.neotel.smfcore.common.utils.StorageConstants;
import com.neotel.smfcore.core.api.bean.CodeValidateParam;
......@@ -61,6 +63,15 @@ public class PanaApiController extends BaseSmfApiListener {
@Autowired
public void setDataCache(DataCache dataCache) {
PanaApiController.dataCache = dataCache;
String ip = dataCache.getCache(Constants.Cache_PanaCIMIP);
if (ObjectUtil.isNotEmpty(ip)) {
PanaCIMIP = ip;
String port = dataCache.getCache(Constants.Cache_PanaCIMPort);
if (ObjectUtil.isNotEmpty(port)) {
PanaCIMPort = port;
}
log.info("从缓存 " + Constants.Cache_PanaCIMIP + " 中读取到PanaCIM 的注册IP【" + ip + ":" + port + "】");
}
}
@Autowired
......@@ -91,6 +102,8 @@ public class PanaApiController extends BaseSmfApiListener {
PanaCIMIP = ip;
PanaCIMPort = port;
dataCache.updateCache(Constants.Cache_PanaCIMIP,ip);
dataCache.updateCache(Constants.Cache_PanaCIMPort,port);
return "OK";
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!