|
|
|
|
@@ -125,12 +125,14 @@ public class ConfigServiceUtil {
|
|
|
|
|
Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON);
|
|
|
|
|
try {
|
|
|
|
|
response= header.get();
|
|
|
|
|
if(response != null) {
|
|
|
|
|
result=response.readEntity(String.class);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
|
|
|
|
}
|
|
|
|
|
if(response != null && response.getStatus() == 200){
|
|
|
|
|
logger.info("get result success");
|
|
|
|
|
result= response.readEntity(String.class);
|
|
|
|
|
// result = "{\"status\":200,\"businessCode\":2000,\"reason\":\"数据获取操作成功\","
|
|
|
|
|
// + "\"msg\":\"配置ID获取成功\",\"fromuri\":\"/galaxy/service/cfg/v1/configPzIdSources\","
|
|
|
|
|
// + "\"traceCode\":\"2018052409232108368751\",\"data\":{\"sourceName\":\"CONFIG_COMPILE\",\"num\":1,\"pzIdList\":[22]}}";
|
|
|
|
|
@@ -140,13 +142,13 @@ public class ConfigServiceUtil {
|
|
|
|
|
if(!StringUtil.isEmpty(bean.getData())){
|
|
|
|
|
list = bean.getData().getPzIdList();
|
|
|
|
|
}else{
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
|
|
|
|
}
|
|
|
|
|
long end=System.currentTimeMillis();
|
|
|
|
|
logger.warn("get ids finish,cost:"+(end-start));
|
|
|
|
|
@@ -178,18 +180,20 @@ public class ConfigServiceUtil {
|
|
|
|
|
Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON);
|
|
|
|
|
try {
|
|
|
|
|
response= header.post(Entity.entity(params, MediaType.APPLICATION_JSON));
|
|
|
|
|
if(response != null) {
|
|
|
|
|
result=response.readEntity(String.class);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
|
|
|
|
}
|
|
|
|
|
if(response != null && response.getStatus() == 200){
|
|
|
|
|
logger.info("get result success");
|
|
|
|
|
result= response.readEntity(String.class);
|
|
|
|
|
JsonConfig config=new JsonConfig();
|
|
|
|
|
config.setExcludes(new String[]{"configCompileList"});
|
|
|
|
|
JSONObject resObject = JSONObject.fromObject(result,config);
|
|
|
|
|
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
|
|
|
|
}else{
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw e;
|
|
|
|
|
@@ -220,15 +224,17 @@ public class ConfigServiceUtil {
|
|
|
|
|
Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON);
|
|
|
|
|
try {
|
|
|
|
|
response= header.post(Entity.entity(params, MediaType.APPLICATION_JSON));
|
|
|
|
|
if(response != null) {
|
|
|
|
|
result=response.readEntity(String.class);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
|
|
|
|
}
|
|
|
|
|
if(response != null && response.getStatus() == 200){
|
|
|
|
|
result= response.readEntity(String.class);
|
|
|
|
|
JSONObject resObject = JSONObject.fromObject(result);
|
|
|
|
|
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
|
|
|
|
}else{
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw e;
|
|
|
|
|
@@ -261,15 +267,17 @@ public class ConfigServiceUtil {
|
|
|
|
|
Builder header = wt.request(MediaType.APPLICATION_JSON).header("File-Desc",fileDesc);
|
|
|
|
|
try {
|
|
|
|
|
response= header.post(Entity.entity(formDataMultiPart, formDataMultiPart.getMediaType()));
|
|
|
|
|
if(response != null) {
|
|
|
|
|
result=response.readEntity(String.class);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
|
|
|
|
}
|
|
|
|
|
if(response != null && response.getStatus() == 200){
|
|
|
|
|
result= response.readEntity(String.class);
|
|
|
|
|
JSONObject resObject = JSONObject.fromObject(result);
|
|
|
|
|
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
|
|
|
|
}else{
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>"+result);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw e;
|
|
|
|
|
@@ -305,15 +313,17 @@ public class ConfigServiceUtil {
|
|
|
|
|
Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON);
|
|
|
|
|
try {
|
|
|
|
|
response= header.delete();
|
|
|
|
|
if(response != null) {
|
|
|
|
|
result=response.readEntity(String.class);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
|
|
|
|
}
|
|
|
|
|
if(response != null && response.getStatus() == 200){
|
|
|
|
|
result= response.readEntity(String.class);
|
|
|
|
|
JSONObject resObject = JSONObject.fromObject(result);
|
|
|
|
|
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
|
|
|
|
}else{
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw e;
|
|
|
|
|
@@ -351,15 +361,17 @@ public class ConfigServiceUtil {
|
|
|
|
|
Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON);
|
|
|
|
|
try {
|
|
|
|
|
response= header.put(Entity.entity(params, MediaType.APPLICATION_JSON));
|
|
|
|
|
if(response != null) {
|
|
|
|
|
result=response.readEntity(String.class);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
|
|
|
|
}
|
|
|
|
|
if(response !=null && response.getStatus() == 200){
|
|
|
|
|
result= response.readEntity(String.class);
|
|
|
|
|
JSONObject resObject = JSONObject.fromObject(result);
|
|
|
|
|
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
|
|
|
|
}else{
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw e;
|
|
|
|
|
@@ -424,16 +436,18 @@ public class ConfigServiceUtil {
|
|
|
|
|
Builder header = wt.request(MediaType.APPLICATION_JSON).header("File-Desc",fileDesc);
|
|
|
|
|
try {
|
|
|
|
|
response= header.post(Entity.entity(formDataMultiPart, formDataMultiPart.getMediaType()));
|
|
|
|
|
if(response != null) {
|
|
|
|
|
result=response.readEntity(String.class);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
|
|
|
|
}
|
|
|
|
|
if(response !=null && response.getStatus() == 200){
|
|
|
|
|
result= response.readEntity(String.class);
|
|
|
|
|
logger.info("获取文件摘要响应结果"+result);
|
|
|
|
|
JSONObject resObject = JSONObject.fromObject(result);
|
|
|
|
|
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
|
|
|
|
}else{
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw e;
|
|
|
|
|
@@ -465,17 +479,19 @@ public class ConfigServiceUtil {
|
|
|
|
|
Builder header = wt.request(MediaType.APPLICATION_JSON).header("Content-Type", MediaType.APPLICATION_JSON);
|
|
|
|
|
try {
|
|
|
|
|
response= header.post(Entity.entity(params, MediaType.APPLICATION_JSON));
|
|
|
|
|
if(response != null) {
|
|
|
|
|
result=response.readEntity(String.class);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>");
|
|
|
|
|
}
|
|
|
|
|
if(response !=null && response.getStatus() == 200){
|
|
|
|
|
result= response.readEntity(String.class);
|
|
|
|
|
JsonConfig config=new JsonConfig();
|
|
|
|
|
config.setExcludes(new String[]{"configCompileList"});
|
|
|
|
|
JSONObject resObject = JSONObject.fromObject(result,config);
|
|
|
|
|
bean = (ToMaatResult) JSONObject.toBean(resObject,ToMaatResult.class);
|
|
|
|
|
}else{
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
|
|
|
|
}
|
|
|
|
|
long end=System.currentTimeMillis();
|
|
|
|
|
logger.warn("postGroupReuseSources end,cost:"+(end-start));
|
|
|
|
|
@@ -535,7 +551,7 @@ public class ConfigServiceUtil {
|
|
|
|
|
if(response !=null && response.getStatus() == 200){
|
|
|
|
|
result= response.readEntity(String.class);
|
|
|
|
|
}else{
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw e;
|
|
|
|
|
@@ -597,7 +613,7 @@ public class ConfigServiceUtil {
|
|
|
|
|
if(response !=null && response.getStatus() == 200){
|
|
|
|
|
result= response.readEntity(String.class);
|
|
|
|
|
}else{
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+response.readEntity(String.class));
|
|
|
|
|
throw new MaatConvertException("<spring:message code=\"request_service_failed\"/>:"+result);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw e;
|
|
|
|
|
|