From e74ec9d701c27adbab7ac9dd632bcd363ce47939 Mon Sep 17 00:00:00 2001 From: WeiRan <2392355487@qq.com> Date: Sat, 7 Sep 2024 20:18:40 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=BF=E9=87=8C=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 38 +++ Dockerfile | 23 ++ cloud-ali-client/.gitignore | 38 +++ cloud-ali-client/pom.xml | 21 ++ .../main/java/com/muyu/data/mart/Main.java | 14 + cloud-ali-server/.gitignore | 38 +++ cloud-ali-server/pom.xml | 108 ++++++ .../data/mart/DataMartAliApplication.java | 20 ++ .../controller/RealNameAliController.java | 43 +++ .../service/impl/RealNameServiceImpl.java | 109 ++++++ .../com/muyu/data/mart/util/HttpUtils.java | 311 ++++++++++++++++++ .../src/main/resources/application.yml | 53 +++ .../src/main/resources/logback/dev.xml | 74 +++++ .../src/main/resources/logback/prod.xml | 81 +++++ .../src/main/resources/logback/test.xml | 81 +++++ pom.xml | 40 +++ 16 files changed, 1092 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 cloud-ali-client/.gitignore create mode 100644 cloud-ali-client/pom.xml create mode 100644 cloud-ali-client/src/main/java/com/muyu/data/mart/Main.java create mode 100644 cloud-ali-server/.gitignore create mode 100644 cloud-ali-server/pom.xml create mode 100644 cloud-ali-server/src/main/java/com/muyu/data/mart/DataMartAliApplication.java create mode 100644 cloud-ali-server/src/main/java/com/muyu/data/mart/controller/RealNameAliController.java create mode 100644 cloud-ali-server/src/main/java/com/muyu/data/mart/service/impl/RealNameServiceImpl.java create mode 100644 cloud-ali-server/src/main/java/com/muyu/data/mart/util/HttpUtils.java create mode 100644 cloud-ali-server/src/main/resources/application.yml create mode 100644 cloud-ali-server/src/main/resources/logback/dev.xml create mode 100644 cloud-ali-server/src/main/resources/logback/prod.xml create mode 100644 cloud-ali-server/src/main/resources/logback/test.xml create mode 100644 pom.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6095016 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +#执行一些必备的条件 +# |-home +# |- app.jar -启动jar包 +# |- logs -日志文件 +# |- uploadPath -上传路径 + +#指定构建镜像的起始镜像 +FROM anolis-registry.cn-zhangjiakou.cr.aliyuncs.com/openanolis/dragonwell:17.0.4.0.4.8-standard-ga-8.6 + +#定义时区参数 +# 设置环境变量TZ +ENV TZ=Asia/Shanghai +RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone + +#挂载工作目录 +VOLUME ["/home/logs/cloud-ali"] + +#拷贝执行jar包文件 +COPY ./cloud-ali-server/target/cloud-ali.jar /home/app.jar + +#构建启动命令 +ENTRYPOINT ["java","-Dfile.encoding=utf-8","-jar"] +CMD ["/home/app.jar"] diff --git a/cloud-ali-client/.gitignore b/cloud-ali-client/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/cloud-ali-client/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/cloud-ali-client/pom.xml b/cloud-ali-client/pom.xml new file mode 100644 index 0000000..fd40aee --- /dev/null +++ b/cloud-ali-client/pom.xml @@ -0,0 +1,21 @@ + + + 4.0.0 + + com.muyu + cloud-ali + 1.0.0 + + + cloud-ali-client + + + + 17 + 17 + UTF-8 + + + diff --git a/cloud-ali-client/src/main/java/com/muyu/data/mart/Main.java b/cloud-ali-client/src/main/java/com/muyu/data/mart/Main.java new file mode 100644 index 0000000..b470e05 --- /dev/null +++ b/cloud-ali-client/src/main/java/com/muyu/data/mart/Main.java @@ -0,0 +1,14 @@ +package com.muyu.data.mart; + +/** + * @Author:weiran + * @Package:com.muyu.data.mart + * @Project:Default (Template) Project + * @name:${NAME} + * @Date:2024/9/7 12:29 + */ +public class Main { + public static void main(String[] args) { + System.out.println("Hello world!"); + } +} diff --git a/cloud-ali-server/.gitignore b/cloud-ali-server/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/cloud-ali-server/.gitignore @@ -0,0 +1,38 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +.idea/modules.xml +.idea/jarRepositories.xml +.idea/compiler.xml +.idea/libraries/ +*.iws +*.iml +*.ipr + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store \ No newline at end of file diff --git a/cloud-ali-server/pom.xml b/cloud-ali-server/pom.xml new file mode 100644 index 0000000..8934edf --- /dev/null +++ b/cloud-ali-server/pom.xml @@ -0,0 +1,108 @@ + + + 4.0.0 + + com.muyu + cloud-ali + 1.0.0 + + + cloud-ali-server + 1.0.0 + + + 17 + 17 + UTF-8 + + + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + com.muyu + cloud-background-common + 1.0.0 + + + + com.mysql + mysql-connector-j + + + + org.apache.httpcomponents + httpclient + 4.5.13 + + + + + com.muyu + cloud-common-datasource + + + + com.alibaba.fastjson2 + fastjson2 + + + + com.google.code.gson + gson + 2.8.8 + + + + org.springframework.boot + spring-boot-starter-web + + + + com.muyu + cloud-common-datascope + + + + + cloud-ali + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.13.0 + + + -parameters + + + + + + + diff --git a/cloud-ali-server/src/main/java/com/muyu/data/mart/DataMartAliApplication.java b/cloud-ali-server/src/main/java/com/muyu/data/mart/DataMartAliApplication.java new file mode 100644 index 0000000..2595c18 --- /dev/null +++ b/cloud-ali-server/src/main/java/com/muyu/data/mart/DataMartAliApplication.java @@ -0,0 +1,20 @@ +package com.muyu.data.mart; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.openfeign.EnableFeignClients; + +/** + * @Author:weiran + * @Package:com.muyu.data.mart + * @Project:cloud-background + * @name:DataMartAliApplication + * @Date:2024/9/6 9:14 + */ +@SpringBootApplication +@EnableFeignClients +public class DataMartAliApplication { + public static void main(String[] args) { + SpringApplication.run(DataMartAliApplication.class, args); + } +} diff --git a/cloud-ali-server/src/main/java/com/muyu/data/mart/controller/RealNameAliController.java b/cloud-ali-server/src/main/java/com/muyu/data/mart/controller/RealNameAliController.java new file mode 100644 index 0000000..4d3f6f5 --- /dev/null +++ b/cloud-ali-server/src/main/java/com/muyu/data/mart/controller/RealNameAliController.java @@ -0,0 +1,43 @@ +package com.muyu.data.mart.controller; + +import com.muyu.cloud.background.common.BasicApi; +import com.muyu.cloud.background.domin.realname.RealNameReq; +import com.muyu.cloud.background.domin.realname.RealNameResp; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Author:weiran + * @Package:com.muyu.data.mart.controller + * @Project:cloud-background + * @name:RealNameAliController + * @Date:2024/9/6 9:26 + */ +@RestController +@RequestMapping("/ali") +public class RealNameAliController { + + private final BasicApi realNameService; + + + @Autowired + public RealNameAliController(@Qualifier("ali-real-name") BasicApi realNameService) { + this.realNameService = realNameService; + } + + @PostMapping("/real/name") + RealNameResp realName(@RequestBody RealNameReq realNameReq){ + RealNameResp realNameResp = null; + try { + realNameResp = realNameService.send(realNameReq); + return realNameResp; + } catch (Exception e) { + throw new RuntimeException(e); + } + + } +} diff --git a/cloud-ali-server/src/main/java/com/muyu/data/mart/service/impl/RealNameServiceImpl.java b/cloud-ali-server/src/main/java/com/muyu/data/mart/service/impl/RealNameServiceImpl.java new file mode 100644 index 0000000..bf71bb3 --- /dev/null +++ b/cloud-ali-server/src/main/java/com/muyu/data/mart/service/impl/RealNameServiceImpl.java @@ -0,0 +1,109 @@ +package com.muyu.data.mart.service.impl; + +import com.alibaba.fastjson2.JSON; +import com.muyu.cloud.background.common.BasicApi; +import com.muyu.cloud.background.domin.ali.AliResult; +import com.muyu.cloud.background.domin.ali.AliResultData; +import com.muyu.cloud.background.domin.realname.RealNameReq; +import com.muyu.cloud.background.domin.realname.RealNameResp; +import com.muyu.cloud.background.domin.realname.ali.RealNameAliReq; +import com.muyu.cloud.background.domin.realname.ali.RealNameAliResp; +import com.muyu.data.mart.util.HttpUtils; +import org.apache.http.HttpResponse; +import org.springframework.boot.configurationprocessor.json.JSONObject; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.Map; + +/** + * @Author:weiran + * @Package:com.muyu.data.mart.service.impl + * @Project:cloud-background + * @name:RealNameServiceImpl + * @Date:2024/9/6 9:27 + */ +@Service("ali-real-name") +public class RealNameServiceImpl implements BasicApi { + + @Override + public RealNameResp send(RealNameReq realNameReq){ + RealNameAliReq realNameAliReq = RealNameAliReq.realNameAliReqBuild(realNameReq); + AliResult realNameAliRespAliResult = null; + try { + realNameAliRespAliResult = sendApi(realNameAliReq); + } catch (Exception e) { + throw new RuntimeException(e); + } + return RealNameResp.builder() + .code(realNameAliRespAliResult.getCode()) + .msg(realNameAliRespAliResult.getMessage()) + .build(); + } + + + + public AliResult sendApi(RealNameAliReq realNameAliReq) throws Exception { + + String host = "https://smrzhy.market.alicloudapi.com"; + String path = "/smrz/dmp/api/jinrun.idcard.verify.idcard"; + String method = "POST"; + String appcode = "4428d6e8b75040198bf9b50b75e207a6"; + Map headers = new HashMap(); + //最后在header中的格式(中间是英文空格)为Authorization:APPCODE 83359fd73fe94948385f570e3c139105 + headers.put("Authorization", "APPCODE " + appcode); + //根据API的要求,定义相对应的Content-Type + headers.put("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); + Map querys = new HashMap(); + Map bodys = new HashMap(); + Map map = new HashMap(); + map.put("name", realNameAliReq.getName()); + map.put("idcard", realNameAliReq.getIdCard()); + + bodys.put("biz_content", JSON.toJSONString(map)); + HttpResponse response=null; + try { + /** + * 重要提示如下: + * HttpUtils请从\r\n\t \t* https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/src/main/java/com/aliyun/api/gateway/demo/util/HttpUtils.java\r\n\t \t* 下载 + * + * 相应的依赖请参照 + * https://github.com/aliyun/api-gateway-demo-sign-java/blob/master/pom.xml + */ + response = HttpUtils.doPost(host, path, method, headers, querys, bodys); + System.out.println(response.toString()); + //获取response的body + //System.out.println(EntityUtils.toString(response.getEntity())); + } catch (Exception e) { + e.printStackTrace(); + } + StringBuffer stringBuffer = new StringBuffer(response.toString()); + JSONObject jsonObject = new JSONObject(stringBuffer.toString()); + String code = jsonObject.getString("code"); + String message = jsonObject.getString("message"); + Long timestamp = jsonObject.getLong("timestamp"); + JSONObject data = jsonObject.getJSONObject("data"); + String messagedata = data.getString("message"); + String seqNum = data.getString("seqNum"); + int status = data.getInt("status"); + JSONObject data1 = data.getJSONObject("resultData"); + String result = data1.getString("result"); + String resultMsg = data1.getString("resultMsg"); + return new AliResult(){{ + setCode(code); + setMessage(message); + setData( + RealNameAliResp.builder() + .message(messagedata) + .seqNum(seqNum) + .status(status) + .resultData( + new AliResultData(result,resultMsg) + ) + .build() + ); + setTimestamp(timestamp); + }}; + + } +} diff --git a/cloud-ali-server/src/main/java/com/muyu/data/mart/util/HttpUtils.java b/cloud-ali-server/src/main/java/com/muyu/data/mart/util/HttpUtils.java new file mode 100644 index 0000000..d6da42b --- /dev/null +++ b/cloud-ali-server/src/main/java/com/muyu/data/mart/util/HttpUtils.java @@ -0,0 +1,311 @@ +package com.muyu.data.mart.util; + +import com.baomidou.mybatisplus.core.toolkit.StringUtils; +import org.apache.http.HttpResponse; +import org.apache.http.NameValuePair; +import org.apache.http.client.HttpClient; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.HttpDelete; +import org.apache.http.client.methods.HttpGet; +import org.apache.http.client.methods.HttpPost; +import org.apache.http.client.methods.HttpPut; +import org.apache.http.conn.ClientConnectionManager; +import org.apache.http.conn.scheme.Scheme; +import org.apache.http.conn.scheme.SchemeRegistry; +import org.apache.http.conn.ssl.SSLSocketFactory; +import org.apache.http.entity.ByteArrayEntity; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.DefaultHttpClient; +import org.apache.http.message.BasicNameValuePair; + +import javax.net.ssl.SSLContext; +import javax.net.ssl.TrustManager; +import javax.net.ssl.X509TrustManager; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; +import java.security.KeyManagementException; +import java.security.NoSuchAlgorithmException; +import java.security.cert.X509Certificate; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class HttpUtils { + /** + * get + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @return + * @throws Exception + */ + public static HttpResponse doGet(String host, String path, String method, + Map headers, + Map querys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpGet request = new HttpGet(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + return httpClient.execute(request); + } + + /** + * post form + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param bodys + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + Map bodys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (bodys != null) { + List nameValuePairList = new ArrayList(); + + for (String key : bodys.keySet()) { + nameValuePairList.add(new BasicNameValuePair(key, bodys.get(key))); + } + UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(nameValuePairList, "utf-8"); + formEntity.setContentType("application/x-www-form-urlencoded; charset=UTF-8"); + request.setEntity(formEntity); + } + + return httpClient.execute(request); + } + + /** + * Post String + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + String body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (StringUtils.isNotBlank(body)) { + request.setEntity(new StringEntity(body, "utf-8")); + } + + return httpClient.execute(request); + } + + /** + * Post stream + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPost(String host, String path, String method, + Map headers, + Map querys, + byte[] body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPost request = new HttpPost(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (body != null) { + request.setEntity(new ByteArrayEntity(body)); + } + + return httpClient.execute(request); + } + + /** + * Put String + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPut(String host, String path, String method, + Map headers, + Map querys, + String body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPut request = new HttpPut(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (StringUtils.isNotBlank(body)) { + request.setEntity(new StringEntity(body, "utf-8")); + } + + return httpClient.execute(request); + } + + /** + * Put stream + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @param body + * @return + * @throws Exception + */ + public static HttpResponse doPut(String host, String path, String method, + Map headers, + Map querys, + byte[] body) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpPut request = new HttpPut(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + if (body != null) { + request.setEntity(new ByteArrayEntity(body)); + } + + return httpClient.execute(request); + } + + /** + * Delete + * + * @param host + * @param path + * @param method + * @param headers + * @param querys + * @return + * @throws Exception + */ + public static HttpResponse doDelete(String host, String path, String method, + Map headers, + Map querys) + throws Exception { + HttpClient httpClient = wrapClient(host); + + HttpDelete request = new HttpDelete(buildUrl(host, path, querys)); + for (Map.Entry e : headers.entrySet()) { + request.addHeader(e.getKey(), e.getValue()); + } + + return httpClient.execute(request); + } + + private static String buildUrl(String host, String path, Map querys) throws UnsupportedEncodingException { + StringBuilder sbUrl = new StringBuilder(); + sbUrl.append(host); + if (!StringUtils.isBlank(path)) { + sbUrl.append(path); + } + if (null != querys) { + StringBuilder sbQuery = new StringBuilder(); + for (Map.Entry query : querys.entrySet()) { + if (0 < sbQuery.length()) { + sbQuery.append("&"); + } + if (StringUtils.isBlank(query.getKey()) && !StringUtils.isBlank(query.getValue())) { + sbQuery.append(query.getValue()); + } + if (!StringUtils.isBlank(query.getKey())) { + sbQuery.append(query.getKey()); + if (!StringUtils.isBlank(query.getValue())) { + sbQuery.append("="); + sbQuery.append(URLEncoder.encode(query.getValue(), "utf-8")); + } + } + } + if (0 < sbQuery.length()) { + sbUrl.append("?").append(sbQuery); + } + } + + return sbUrl.toString(); + } + + private static HttpClient wrapClient(String host) { + HttpClient httpClient = new DefaultHttpClient(); + if (host.startsWith("https://")) { + sslClient(httpClient); + } + + return httpClient; + } + + private static void sslClient(HttpClient httpClient) { + try { + SSLContext ctx = SSLContext.getInstance("TLS"); + X509TrustManager tm = new X509TrustManager() { + public X509Certificate[] getAcceptedIssuers() { + return null; + } + public void checkClientTrusted(X509Certificate[] xcs, String str) { + + } + public void checkServerTrusted(X509Certificate[] xcs, String str) { + + } + }; + ctx.init(null, new TrustManager[] { tm }, null); + SSLSocketFactory ssf = new SSLSocketFactory(ctx); + ssf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); + ClientConnectionManager ccm = httpClient.getConnectionManager(); + SchemeRegistry registry = ccm.getSchemeRegistry(); + registry.register(new Scheme("https", 443, ssf)); + } catch (KeyManagementException ex) { + throw new RuntimeException(ex); + } catch (NoSuchAlgorithmException ex) { + throw new RuntimeException(ex); + } + } + +} diff --git a/cloud-ali-server/src/main/resources/application.yml b/cloud-ali-server/src/main/resources/application.yml new file mode 100644 index 0000000..bdd3946 --- /dev/null +++ b/cloud-ali-server/src/main/resources/application.yml @@ -0,0 +1,53 @@ +# Tomcat +server: + port: 9723 + +# nacos线上地址 +nacos: + addr: 21.12.0.8:8848 + user-name: nacos + password: nacos + namespace: ec66ecf1-f28e-43bc-aa86-625f1bc53bf8 + +# Spring +spring: + main: + allow-bean-definition-overriding: true + application: + # 应用名称 + name: cloud-ali + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: ${nacos.addr} + # nacos用户名 + username: ${nacos.user-name} + # nacos密码 + password: ${nacos.password} + # 命名空间 + namespace: ${nacos.namespace} + config: + # 服务注册地址 + server-addr: ${nacos.addr} + # nacos用户名 + username: ${nacos.user-name} + # nacos密码 + password: ${nacos.password} + # 命名空间 + namespace: ${nacos.namespace} + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + # 系统共享配置 + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + # 系统环境Config共享配置 + - application-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + # xxl-job 配置文件 + - application-xxl-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + # rabbit 配置文件 + - application-rabbit-config-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} diff --git a/cloud-ali-server/src/main/resources/logback/dev.xml b/cloud-ali-server/src/main/resources/logback/dev.xml new file mode 100644 index 0000000..f68cb80 --- /dev/null +++ b/cloud-ali-server/src/main/resources/logback/dev.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + + + + + + + + + + + + + diff --git a/cloud-ali-server/src/main/resources/logback/prod.xml b/cloud-ali-server/src/main/resources/logback/prod.xml new file mode 100644 index 0000000..d5bdfce --- /dev/null +++ b/cloud-ali-server/src/main/resources/logback/prod.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + ${log.sky.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + + + ERROR + + ACCEPT + + DENY + + + + + + + + ${log.sky.pattern} + + + + + + + + + + + + + + + + + + + + diff --git a/cloud-ali-server/src/main/resources/logback/test.xml b/cloud-ali-server/src/main/resources/logback/test.xml new file mode 100644 index 0000000..d5bdfce --- /dev/null +++ b/cloud-ali-server/src/main/resources/logback/test.xml @@ -0,0 +1,81 @@ + + + + + + + + + + + + ${log.sky.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + + + ERROR + + ACCEPT + + DENY + + + + + + + + ${log.sky.pattern} + + + + + + + + + + + + + + + + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..b30f9fb --- /dev/null +++ b/pom.xml @@ -0,0 +1,40 @@ + + + 4.0.0 + + + + com.muyu + cloud-server-parent + 3.6.4 + + + cloud-ali + 1.0.0 + pom + + cloud-ali-server + cloud-ali-client + + + + 17 + 17 + UTF-8 + + + + + com.alibaba.fastjson2 + fastjson2 + + + org.springframework.cloud + spring-cloud-starter-feign + 1.4.7.RELEASE + + + +