From db45890e10345fe692efc58e1bc2420645b406e0 Mon Sep 17 00:00:00 2001 From: maolei Date: Mon, 12 May 2025 11:12:41 +0800 Subject: [PATCH] =?UTF-8?q?feat(uapbd):=20=E6=B7=BB=E5=8A=A0=20QuerySync?= =?UTF-8?q?=20=E6=8E=A5=E5=8F=A3,=E7=94=A8=E6=9D=A5=E6=A0=B9=E6=8D=AEtype?= =?UTF-8?q?=E6=9D=A5=E8=B0=83=E7=94=A8=E4=B8=8D=E5=90=8C=E7=9A=84=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 新增 QuerySync 类,实现 /uapbd/querySync 查询接口 - 添加 query 方法处理 JSON 请求,支持不同的查询类型 --- uapbd/META-INF/querySync.rest | 6 ++ .../public/nccloud/api/uapbd/QuerySync.java | 59 +++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 uapbd/META-INF/querySync.rest create mode 100644 uapbd/src/public/nccloud/api/uapbd/QuerySync.java 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