|
@@ -1,7 +1,12 @@
|
|
|
package com.nokia.domainb.service;
|
|
|
|
|
|
import cn.chinaunicom.open.nlgxptconnection.COMPConnectionContext;
|
|
|
-import com.google.gson.*;
|
|
|
+import com.google.gson.JsonArray;
|
|
|
+import com.google.gson.JsonElement;
|
|
|
+import com.google.gson.JsonObject;
|
|
|
+import com.google.gson.JsonParser;
|
|
|
+import com.nokia.common.exception.BizException;
|
|
|
+import com.nokia.common.exception.MyRuntimeException;
|
|
|
import com.nokia.common.http.R;
|
|
|
import com.nokia.domainb.capability.*;
|
|
|
import com.nokia.domainb.dto.*;
|
|
@@ -169,7 +174,7 @@ public class DomainService {
|
|
|
|
|
|
public R userState(UserStateDTO dto) {
|
|
|
SpThreePartCheck spThreePartCheck = new SpThreePartCheck();
|
|
|
- COMPConnectionContext result = spThreePartCheck.query(dto.getPhoneNumber(), "18", false);
|
|
|
+ COMPConnectionContext result = spThreePartCheck.query(dto.getPhoneNumber(), "18", "50", false);
|
|
|
JsonObject jsonObject = JsonParser.parseString(result.getResponseContext()).getAsJsonObject();
|
|
|
JsonObject rsp = jsonObject.getAsJsonObject("UNI_BSS_BODY")
|
|
|
.getAsJsonObject("SP_THREEPART_CHECK_RSP")
|
|
@@ -339,4 +344,44 @@ public class DomainService {
|
|
|
return R.ok().data(vo);
|
|
|
}, qryowefeeExecutor);
|
|
|
}
|
|
|
+
|
|
|
+ public R getPhoneByShortNumber(GetPhoneByShortNumberDTO dto) {
|
|
|
+ SpThreePartCheck spThreePartCheck = new SpThreePartCheck();
|
|
|
+ COMPConnectionContext result = spThreePartCheck.query(dto.getShortNumber(), "18", "30", false);
|
|
|
+ JsonObject jsonObject = JsonParser.parseString(result.getResponseContext()).getAsJsonObject();
|
|
|
+ if (!"00000".equals(jsonObject.getAsJsonObject("UNI_BSS_HEAD").get("RESP_CODE").getAsString())) {
|
|
|
+ throw new MyRuntimeException(jsonObject.getAsJsonObject("UNI_BSS_HEAD").get("RESP_DESC").getAsString());
|
|
|
+ }
|
|
|
+ JsonObject rsp = jsonObject.getAsJsonObject("UNI_BSS_BODY")
|
|
|
+ .getAsJsonObject("SP_THREEPART_CHECK_RSP")
|
|
|
+ .getAsJsonObject("RSP");
|
|
|
+ if (rsp == null) {
|
|
|
+ throw new MyRuntimeException("能开接口调用异常");
|
|
|
+ }
|
|
|
+
|
|
|
+ String rspCode = rsp.get("RSP_CODE").getAsString();
|
|
|
+ if (!"0000".equals(rspCode)) {
|
|
|
+ String rspDesc = rsp.get("RSP_DESC").getAsString();
|
|
|
+ throw new BizException(rspDesc);
|
|
|
+ }
|
|
|
+
|
|
|
+ JsonObject data = rsp.getAsJsonArray("DATA").get(0).getAsJsonObject();
|
|
|
+ JsonArray svcInfo = data.getAsJsonObject("userInfo").getAsJsonArray("svcInfo");
|
|
|
+ for (JsonElement t : svcInfo) {
|
|
|
+ JsonObject tt = t.getAsJsonObject();
|
|
|
+ if ("30501".equals(tt.get("serviceId").getAsString())) {
|
|
|
+ JsonArray attrInfo = tt.getAsJsonArray("attrInfo");
|
|
|
+ for (JsonElement ttt : attrInfo) {
|
|
|
+ JsonObject tttt = ttt.getAsJsonObject();
|
|
|
+ if ("s184".equals(tttt.get("attrCode").getAsString())) {
|
|
|
+ return R.ok().data(new GetPhoneByShortNumberVO(tttt.get("attrValue").getAsString()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 循环结束说明不包含s184
|
|
|
+ throw new BizException("用户开通了一号双机(serviceId 30501)业务,但未查询到手机号码(s184)");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 循环结束说明不包含一号双机业务
|
|
|
+ throw new BizException("用户未开通一号双机(serviceId 30501)业务");
|
|
|
+ }
|
|
|
}
|