获取服务接口ID方法返回数据类型由应答字符串改为id list.
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
package com.nis.util;
|
package com.nis.util;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.ws.rs.client.Invocation.Builder;
|
import javax.ws.rs.client.Invocation.Builder;
|
||||||
@@ -14,6 +16,8 @@ import net.sf.json.JSONObject;
|
|||||||
import org.glassfish.jersey.media.multipart.FormDataMultiPart;
|
import org.glassfish.jersey.media.multipart.FormDataMultiPart;
|
||||||
import org.glassfish.jersey.media.multipart.file.FileDataBodyPart;
|
import org.glassfish.jersey.media.multipart.file.FileDataBodyPart;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.GsonBuilder;
|
||||||
import com.nis.exceptions.MaatConvertException;
|
import com.nis.exceptions.MaatConvertException;
|
||||||
import com.nis.util.httpclient.ClientUtil;
|
import com.nis.util.httpclient.ClientUtil;
|
||||||
|
|
||||||
@@ -23,9 +27,10 @@ public class ConfigServiceUtil {
|
|||||||
* @param type 1是compileid,2是groupid,3是regionid
|
* @param type 1是compileid,2是groupid,3是regionid
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String getId(int type,int num) throws Exception {
|
public static List<Integer> getId(int type,int num) throws Exception {
|
||||||
String result = null;
|
String result = null;
|
||||||
String url = "";
|
String url = "";
|
||||||
|
List<Integer> list = new ArrayList();
|
||||||
if (type == 1) {
|
if (type == 1) {
|
||||||
url = Constants.SERVICE_URL+Constants.CONFIG_ID_SOURCES+"?sourceName=CONFIG_COMPILE&num="+num;
|
url = Constants.SERVICE_URL+Constants.CONFIG_ID_SOURCES+"?sourceName=CONFIG_COMPILE&num="+num;
|
||||||
} else if (type == 2) {
|
} else if (type == 2) {
|
||||||
@@ -40,10 +45,25 @@ public class ConfigServiceUtil {
|
|||||||
Response response= header.get();
|
Response response= header.get();
|
||||||
if( response.getStatus() == 200){
|
if( response.getStatus() == 200){
|
||||||
result= response.readEntity(String.class);
|
result= response.readEntity(String.class);
|
||||||
|
Gson gson=new GsonBuilder().disableHtmlEscaping()
|
||||||
|
.excludeFieldsWithoutExposeAnnotation()
|
||||||
|
.create();
|
||||||
|
Map<String, Object> resMap = gson.fromJson(result,Map.class);
|
||||||
|
if(!StringUtil.isEmpty(resMap)){
|
||||||
|
Map<String, Object> dataMap = (Map<String, Object>)resMap.get("data");
|
||||||
|
if(!StringUtil.isEmpty(dataMap)){
|
||||||
|
list = (List<Integer>)dataMap.get("pzIdList");
|
||||||
|
|
||||||
}else{
|
}else{
|
||||||
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
||||||
}
|
}
|
||||||
return result;
|
}else{
|
||||||
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
||||||
|
}
|
||||||
|
return list;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* MAAT配置提交
|
* MAAT配置提交
|
||||||
|
|||||||
Reference in New Issue
Block a user