|
@@ -7,7 +7,9 @@ import org.springframework.http.HttpEntity;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.nokia.domainb.capability.entity.Route;
|
|
|
|
|
|
import cn.chinaunicom.open.common.Const;
|
|
|
import cn.chinaunicom.open.nlgxptconnection.COMPConnection;
|
|
@@ -59,7 +61,9 @@ public class QryRouteAll extends AbstractQuery {
|
|
|
return queryWithSdk(phoneNumber, false);
|
|
|
}
|
|
|
|
|
|
- // 使用能力商店SDK查询
|
|
|
+ /**
|
|
|
+ * 使用能力商店SDK查询
|
|
|
+ */
|
|
|
public COMPConnectionContext queryWithSdk(String phoneNumber, boolean test) {
|
|
|
String realAppSecret = test ? appSecretTest : appSecret;
|
|
|
String realUrl = test ? urlTest : url;
|
|
@@ -78,4 +82,35 @@ public class QryRouteAll extends AbstractQuery {
|
|
|
return compConnection.excute(Const.HttpMethodType.POST, realUrl, uniBssBody, false);
|
|
|
}
|
|
|
|
|
|
+ public Route query2(String phoneNumber, boolean test) {
|
|
|
+ String realAppSecret = test ? appSecretTest : appSecret;
|
|
|
+ String realUrl = test ? urlTest : url;
|
|
|
+ COMPConnection compConnection = new COMPJsonConnection(appId, realAppSecret);
|
|
|
+ // REQ
|
|
|
+ Map<String, Object> req = new HashMap<>();
|
|
|
+ // 查询号码
|
|
|
+ req.put("ROUTE_VALUE", phoneNumber);
|
|
|
+ // 网别 支持 30固话 40宽带 50移网
|
|
|
+ req.put("NET_TYPE_CODE", "50");
|
|
|
+ // QRYROUTEALL_REQ
|
|
|
+ Map<String, Object> qryRouteAllReq = new HashMap<>();
|
|
|
+ qryRouteAllReq.put("REQ", req);
|
|
|
+ Map<String, Object> uniBssBody = new HashMap<>();
|
|
|
+ uniBssBody.put("QRYROUTEALL_REQ", qryRouteAllReq);
|
|
|
+ COMPConnectionContext context = compConnection.excute(Const.HttpMethodType.POST, realUrl, uniBssBody, false);
|
|
|
+ JSONObject result = JSON.parseObject(context.getResponseContext()).getJSONObject("UNI_BSS_BODY")
|
|
|
+ .getJSONObject("QRYROUTEALL_RSP").getJSONObject("RSP");
|
|
|
+ if ("0000".equals(result.get("SUB_CODE"))) {
|
|
|
+ // 确认调用成功
|
|
|
+ Route route = JSON.parseObject(result.getJSONArray("DATA").getString(0), Route.class);
|
|
|
+ result = result.getJSONArray("DATA").getJSONObject(0);
|
|
|
+ // 1:drds 号码在用状态 且为新架构号码 2:oracle 号码在用状态 且为cBss常态化号码 3:非CB 号码在cBss系统没有路由记录
|
|
|
+ // 4:drds 号码失效状态 且为新架构号码 5:oracle 号码失效状态 且为cBss常态化号码
|
|
|
+ System.out.println(result);
|
|
|
+
|
|
|
+ System.out.println(route);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
}
|