From 1d927c3eaa5c60d325f6f461e7cb4002029ec39a Mon Sep 17 00:00:00 2001 From: lvleigang <957075182@qq.com> Date: Sat, 14 Sep 2024 10:13:01 +0800 Subject: [PATCH] =?UTF-8?q?fw-oa=E5=88=86=E6=94=AF=E7=BB=93=E6=9E=84?= =?UTF-8?q?=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- base-webapp/pom.xml | 10 +-- fw-u8/pom.xml | 48 ++++++++++ .../com/hzya/frame/u8/dto/U8ResponseDTO.java | 89 +++++++++++++++++++ .../java/com/hzya/frame/u8/util/U8Util.java | 34 +++++++ fw-u8/src/main/webapp/WEB-INF/web.xml | 6 ++ pom.xml | 2 +- 6 files changed, 183 insertions(+), 6 deletions(-) create mode 100644 fw-u8/pom.xml create mode 100644 fw-u8/src/main/java/com/hzya/frame/u8/dto/U8ResponseDTO.java create mode 100644 fw-u8/src/main/java/com/hzya/frame/u8/util/U8Util.java create mode 100644 fw-u8/src/main/webapp/WEB-INF/web.xml diff --git a/base-webapp/pom.xml b/base-webapp/pom.xml index 79bd4cf9..322fb016 100644 --- a/base-webapp/pom.xml +++ b/base-webapp/pom.xml @@ -59,11 +59,11 @@ - - - - - + + com.hzya.frame + fw-u8 + ${revision} + diff --git a/fw-u8/pom.xml b/fw-u8/pom.xml new file mode 100644 index 00000000..ab815aad --- /dev/null +++ b/fw-u8/pom.xml @@ -0,0 +1,48 @@ + + + + kangarooDataCenterV3 + com.hzya.frame + ${revision} + + 4.0.0 + fw-u8 + jar + ${revision} + + + + com.hzya.frame + base-service + ${revision} + + + mysql + mysql-connector-java + ${mysql-connector-java} + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + none + execute + true + + + + + repackage + + + + + + + diff --git a/fw-u8/src/main/java/com/hzya/frame/u8/dto/U8ResponseDTO.java b/fw-u8/src/main/java/com/hzya/frame/u8/dto/U8ResponseDTO.java new file mode 100644 index 00000000..a72cb34d --- /dev/null +++ b/fw-u8/src/main/java/com/hzya/frame/u8/dto/U8ResponseDTO.java @@ -0,0 +1,89 @@ +package com.hzya.frame.u8.dto; + +import com.alibaba.fastjson.annotation.JSONField; + +/** + * @Description u8返回对象 + * @Author xiangerlin + * @Date 2024/5/14 15:40 + **/ +public class U8ResponseDTO { + @JSONField(name = "Flag") + private String flag; + @JSONField(name = "DataOne") + private String dataOne; + @JSONField(name = "DataTwo") + private String dataTwo; + @JSONField(name = "Msg") + private String msg; + + //如果co初始化失败,或者token不对的时候会返回这些信息 + private String code; + private String success; + private String message; + private String data; + + public String getFlag() { + return flag; + } + + public void setFlag(String flag) { + this.flag = flag; + } + + public String getDataOne() { + return dataOne; + } + + public void setDataOne(String dataOne) { + this.dataOne = dataOne; + } + + public String getDataTwo() { + return dataTwo; + } + + public void setDataTwo(String dataTwo) { + this.dataTwo = dataTwo; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getSuccess() { + return success; + } + + public void setSuccess(String success) { + this.success = success; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + public String getData() { + return data; + } + + public void setData(String data) { + this.data = data; + } +} diff --git a/fw-u8/src/main/java/com/hzya/frame/u8/util/U8Util.java b/fw-u8/src/main/java/com/hzya/frame/u8/util/U8Util.java new file mode 100644 index 00000000..c0c57e39 --- /dev/null +++ b/fw-u8/src/main/java/com/hzya/frame/u8/util/U8Util.java @@ -0,0 +1,34 @@ +package com.hzya.frame.u8.util; + +import cn.hutool.core.util.StrUtil; +import cn.hutool.http.HttpRequest; +import com.alibaba.fastjson.JSONObject; +import com.hzya.frame.u8.dto.U8ResponseDTO; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +/** + * @Description + * @Author xiangerlin + * @Date 2024/5/14 15:30 + **/ +public class U8Util { + + static Logger logger = LogManager.getLogger(U8Util.class); + + //获取token + public static String getToken() { + String url = "http://127.0.0.1:51910/Api/Base/GetToken"; + JSONObject jsonObject = new JSONObject(); + jsonObject.put("secretkey", "L1NhkDrQhtBDzTxFxPI0jxWcBzTBSPvaI5xZusRRi9ofS9d6ngxrj1erwbdjxtUT"); + logger.info("获取U8token参数:{}", jsonObject.toJSONString()); + String token = HttpRequest.post( url).body(jsonObject.toJSONString()).timeout(60000).execute().body(); + logger.info("token返回参数:{}", jsonObject.toJSONString()); + if (StrUtil.isNotEmpty(token)) { + U8ResponseDTO u8ResponseDTO = JSONObject.parseObject(token, U8ResponseDTO.class); + return u8ResponseDTO.getMessage(); + } + return token; + + } +} diff --git a/fw-u8/src/main/webapp/WEB-INF/web.xml b/fw-u8/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..d80081d1 --- /dev/null +++ b/fw-u8/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,6 @@ + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index fc53bd54..a59b6bf4 100644 --- a/pom.xml +++ b/pom.xml @@ -15,7 +15,7 @@ - + fw-u8