diff --git a/uapbd/META-INF/querySync.rest b/uapbd/META-INF/querySync.rest new file mode 100644 index 0000000..558ec97 --- /dev/null +++ b/uapbd/META-INF/querySync.rest @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/uapbd/src/public/nccloud/api/uapbd/QuerySync.java b/uapbd/src/public/nccloud/api/uapbd/QuerySync.java new file mode 100644 index 0000000..43cff15 --- /dev/null +++ b/uapbd/src/public/nccloud/api/uapbd/QuerySync.java @@ -0,0 +1,59 @@ +package nccloud.api.uapbd; + + +import nccloud.api.rest.utils.IJsonForAPI; +import nccloud.api.rest.utils.JsonFactoryForAPI; +import nccloud.api.rest.utils.ResultMessageUtil; +import nccloud.api.rest.utils.vo.ApiDataVO; +import nccloud.api.rest.utils.vo.ApiQueryParam; +import nccloud.api.rest.utils.vo.ApiUfinterface; +import nccloud.ws.rest.resource.AbstractNCCRestResource; +import org.json.JSONString; + +import javax.ws.rs.Consumes; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; + +@Path("/uapbd/querySync") +public class QuerySync extends AbstractNCCRestResource { + + @Override + public String getModule() { + return "uapbd"; + } + + @POST + @Path("query") + @Consumes({"application/json"}) + @Produces({"application/json"}) + public JSONString query(JSONString json) { + IJsonForAPI iJsonForAPI = JsonFactoryForAPI.create(); + ApiQueryParam apiQueryParam = iJsonForAPI.fromJson(json.toJSONString(), ApiQueryParam.class); + ApiDataVO apiDataVO = apiQueryParam.getUfinterface().getData(); + // 从中抓取接口枚举类型 + ApiUfinterface ufinterface = apiQueryParam.getUfinterface(); + if (ufinterface.getData().getParamdata().containsKey("type")) { + String type = (String) ufinterface.getData().getParamdata().get("type"); + try { + switch (type) { + case "queryStordoc": + return queryStordoc(ufinterface); + default: + return ResultMessageUtil.exceptionToJSON(new Exception("不支持的接口类型: " + type)); + } + } catch (Exception e) { + // 捕获并返回异常信息 + return ResultMessageUtil.exceptionToJSON(e); + } + } else { + return ResultMessageUtil.exceptionToJSON(new Exception("缺失接口类型,请检查参数")); + } + } + + private JSONString queryStordoc(ApiUfinterface apiUfinterface) { + + return null; + } + +} \ No newline at end of file