From efd78e2f1be09c8dfb909cba3554f32e015b0ba1 Mon Sep 17 00:00:00 2001 From: WeiRan <2392355487@qq.com> Date: Sat, 7 Sep 2024 21:07:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=8E=92=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cloud-ali/.gitignore | 38 --- cloud-ali/cloud-ali-client/.gitignore | 38 --- cloud-ali/cloud-ali-client/pom.xml | 21 -- cloud-ali/cloud-ali-server/.gitignore | 38 --- cloud-ali/cloud-ali-server/pom.xml | 80 ----- .../data/mart/DataMartAliApplication.java | 20 -- .../controller/RealNameAliController.java | 46 --- .../service/impl/RealNameServiceImpl.java | 110 ------ .../com/muyu/data/mart/util/HttpUtils.java | 313 ------------------ .../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 ----- cloud-ali/pom.xml | 26 -- cloud-juhe/.gitignore | 38 --- cloud-juhe/cloud-juhe-client/.gitignore | 38 --- cloud-juhe/cloud-juhe-client/pom.xml | 22 -- cloud-juhe/cloud-juhe-server/.gitignore | 38 --- cloud-juhe/cloud-juhe-server/pom.xml | 71 ---- .../data/mart/DataMartJuHeApplication.java | 20 -- .../controller/RealNameJuHeController.java | 46 --- .../service/impl/RealNameServiceImpl.java | 133 -------- .../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 ----- cloud-juhe/pom.xml | 27 -- pom.xml | 7 +- 28 files changed, 1 insertion(+), 1747 deletions(-) delete mode 100644 cloud-ali/.gitignore delete mode 100644 cloud-ali/cloud-ali-client/.gitignore delete mode 100644 cloud-ali/cloud-ali-client/pom.xml delete mode 100644 cloud-ali/cloud-ali-server/.gitignore delete mode 100644 cloud-ali/cloud-ali-server/pom.xml delete mode 100644 cloud-ali/cloud-ali-server/src/main/java/com/muyu/data/mart/DataMartAliApplication.java delete mode 100644 cloud-ali/cloud-ali-server/src/main/java/com/muyu/data/mart/controller/RealNameAliController.java delete mode 100644 cloud-ali/cloud-ali-server/src/main/java/com/muyu/data/mart/service/impl/RealNameServiceImpl.java delete mode 100644 cloud-ali/cloud-ali-server/src/main/java/com/muyu/data/mart/util/HttpUtils.java delete mode 100644 cloud-ali/cloud-ali-server/src/main/resources/application.yml delete mode 100644 cloud-ali/cloud-ali-server/src/main/resources/logback/dev.xml delete mode 100644 cloud-ali/cloud-ali-server/src/main/resources/logback/prod.xml delete mode 100644 cloud-ali/cloud-ali-server/src/main/resources/logback/test.xml delete mode 100644 cloud-ali/pom.xml delete mode 100644 cloud-juhe/.gitignore delete mode 100644 cloud-juhe/cloud-juhe-client/.gitignore delete mode 100644 cloud-juhe/cloud-juhe-client/pom.xml delete mode 100644 cloud-juhe/cloud-juhe-server/.gitignore delete mode 100644 cloud-juhe/cloud-juhe-server/pom.xml delete mode 100644 cloud-juhe/cloud-juhe-server/src/main/java/com/muyu/data/mart/DataMartJuHeApplication.java delete mode 100644 cloud-juhe/cloud-juhe-server/src/main/java/com/muyu/data/mart/controller/RealNameJuHeController.java delete mode 100644 cloud-juhe/cloud-juhe-server/src/main/java/com/muyu/data/mart/service/impl/RealNameServiceImpl.java delete mode 100644 cloud-juhe/cloud-juhe-server/src/main/resources/application.yml delete mode 100644 cloud-juhe/cloud-juhe-server/src/main/resources/logback/dev.xml delete mode 100644 cloud-juhe/cloud-juhe-server/src/main/resources/logback/prod.xml delete mode 100644 cloud-juhe/cloud-juhe-server/src/main/resources/logback/test.xml delete mode 100644 cloud-juhe/pom.xml diff --git a/cloud-ali/.gitignore b/cloud-ali/.gitignore deleted file mode 100644 index 5ff6309..0000000 --- a/cloud-ali/.gitignore +++ /dev/null @@ -1,38 +0,0 @@ -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/cloud-ali-client/.gitignore b/cloud-ali/cloud-ali-client/.gitignore deleted file mode 100644 index 5ff6309..0000000 --- a/cloud-ali/cloud-ali-client/.gitignore +++ /dev/null @@ -1,38 +0,0 @@ -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/cloud-ali-client/pom.xml b/cloud-ali/cloud-ali-client/pom.xml deleted file mode 100644 index 286b946..0000000 --- a/cloud-ali/cloud-ali-client/pom.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - 4.0.0 - - com.muyu.data - cloud-ali - 1.0.0 - - - com.muyu.data.mart - cloud-ali-client - - - 17 - 17 - UTF-8 - - - diff --git a/cloud-ali/cloud-ali-server/.gitignore b/cloud-ali/cloud-ali-server/.gitignore deleted file mode 100644 index 5ff6309..0000000 --- a/cloud-ali/cloud-ali-server/.gitignore +++ /dev/null @@ -1,38 +0,0 @@ -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/cloud-ali-server/pom.xml b/cloud-ali/cloud-ali-server/pom.xml deleted file mode 100644 index a2dee3a..0000000 --- a/cloud-ali/cloud-ali-server/pom.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - 4.0.0 - - com.muyu.data - cloud-ali - 1.0.0 - - - com.muyu.data.mart - cloud-ali-server - - - 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 - - - - diff --git a/cloud-ali/cloud-ali-server/src/main/java/com/muyu/data/mart/DataMartAliApplication.java b/cloud-ali/cloud-ali-server/src/main/java/com/muyu/data/mart/DataMartAliApplication.java deleted file mode 100644 index 2595c18..0000000 --- a/cloud-ali/cloud-ali-server/src/main/java/com/muyu/data/mart/DataMartAliApplication.java +++ /dev/null @@ -1,20 +0,0 @@ -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/cloud-ali-server/src/main/java/com/muyu/data/mart/controller/RealNameAliController.java b/cloud-ali/cloud-ali-server/src/main/java/com/muyu/data/mart/controller/RealNameAliController.java deleted file mode 100644 index df7e166..0000000 --- a/cloud-ali/cloud-ali-server/src/main/java/com/muyu/data/mart/controller/RealNameAliController.java +++ /dev/null @@ -1,46 +0,0 @@ -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; - -import java.io.IOException; - -/** - * @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/cloud-ali-server/src/main/java/com/muyu/data/mart/service/impl/RealNameServiceImpl.java b/cloud-ali/cloud-ali-server/src/main/java/com/muyu/data/mart/service/impl/RealNameServiceImpl.java deleted file mode 100644 index 15defef..0000000 --- a/cloud-ali/cloud-ali-server/src/main/java/com/muyu/data/mart/service/impl/RealNameServiceImpl.java +++ /dev/null @@ -1,110 +0,0 @@ -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.io.IOException; -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/cloud-ali-server/src/main/java/com/muyu/data/mart/util/HttpUtils.java b/cloud-ali/cloud-ali-server/src/main/java/com/muyu/data/mart/util/HttpUtils.java deleted file mode 100644 index 321e660..0000000 --- a/cloud-ali/cloud-ali-server/src/main/java/com/muyu/data/mart/util/HttpUtils.java +++ /dev/null @@ -1,313 +0,0 @@ -package com.muyu.data.mart.util; - -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; - -import javax.net.ssl.SSLContext; -import javax.net.ssl.TrustManager; -import javax.net.ssl.X509TrustManager; - - -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; - -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/cloud-ali-server/src/main/resources/application.yml b/cloud-ali/cloud-ali-server/src/main/resources/application.yml deleted file mode 100644 index bdd3946..0000000 --- a/cloud-ali/cloud-ali-server/src/main/resources/application.yml +++ /dev/null @@ -1,53 +0,0 @@ -# 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/cloud-ali-server/src/main/resources/logback/dev.xml b/cloud-ali/cloud-ali-server/src/main/resources/logback/dev.xml deleted file mode 100644 index f68cb80..0000000 --- a/cloud-ali/cloud-ali-server/src/main/resources/logback/dev.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - ${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/cloud-ali-server/src/main/resources/logback/prod.xml b/cloud-ali/cloud-ali-server/src/main/resources/logback/prod.xml deleted file mode 100644 index d5bdfce..0000000 --- a/cloud-ali/cloud-ali-server/src/main/resources/logback/prod.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - ${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/cloud-ali-server/src/main/resources/logback/test.xml b/cloud-ali/cloud-ali-server/src/main/resources/logback/test.xml deleted file mode 100644 index d5bdfce..0000000 --- a/cloud-ali/cloud-ali-server/src/main/resources/logback/test.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - ${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/pom.xml b/cloud-ali/pom.xml deleted file mode 100644 index 33209eb..0000000 --- a/cloud-ali/pom.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - 4.0.0 - - com.muyu - cloud-background - 1.0.0 - - - com.muyu.data - cloud-ali - pom - - cloud-ali-server - cloud-ali-client - - - - 17 - 17 - UTF-8 - - - diff --git a/cloud-juhe/.gitignore b/cloud-juhe/.gitignore deleted file mode 100644 index 5ff6309..0000000 --- a/cloud-juhe/.gitignore +++ /dev/null @@ -1,38 +0,0 @@ -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-juhe/cloud-juhe-client/.gitignore b/cloud-juhe/cloud-juhe-client/.gitignore deleted file mode 100644 index 5ff6309..0000000 --- a/cloud-juhe/cloud-juhe-client/.gitignore +++ /dev/null @@ -1,38 +0,0 @@ -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-juhe/cloud-juhe-client/pom.xml b/cloud-juhe/cloud-juhe-client/pom.xml deleted file mode 100644 index a3aaf38..0000000 --- a/cloud-juhe/cloud-juhe-client/pom.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - 4.0.0 - - com.muyu - cloud-background - 1.0.0 - ../../pom.xml - - - com.muyu.data - cloud-juhe-client - - - 17 - 17 - UTF-8 - - - diff --git a/cloud-juhe/cloud-juhe-server/.gitignore b/cloud-juhe/cloud-juhe-server/.gitignore deleted file mode 100644 index 5ff6309..0000000 --- a/cloud-juhe/cloud-juhe-server/.gitignore +++ /dev/null @@ -1,38 +0,0 @@ -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-juhe/cloud-juhe-server/pom.xml b/cloud-juhe/cloud-juhe-server/pom.xml deleted file mode 100644 index a087520..0000000 --- a/cloud-juhe/cloud-juhe-server/pom.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - 4.0.0 - - com.muyu.cloud.background - cloud-juhe - 1.0.0 - - - cloud-juhe-server - - - 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 - - - - - 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 - - - diff --git a/cloud-juhe/cloud-juhe-server/src/main/java/com/muyu/data/mart/DataMartJuHeApplication.java b/cloud-juhe/cloud-juhe-server/src/main/java/com/muyu/data/mart/DataMartJuHeApplication.java deleted file mode 100644 index 297ca82..0000000 --- a/cloud-juhe/cloud-juhe-server/src/main/java/com/muyu/data/mart/DataMartJuHeApplication.java +++ /dev/null @@ -1,20 +0,0 @@ -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:DataMartJuHeApplication - * @Date:2024/9/5 16:07 - */ -@SpringBootApplication -@EnableFeignClients -public class DataMartJuHeApplication { - public static void main(String[] args) { - SpringApplication.run(DataMartJuHeApplication.class, args); - } -} diff --git a/cloud-juhe/cloud-juhe-server/src/main/java/com/muyu/data/mart/controller/RealNameJuHeController.java b/cloud-juhe/cloud-juhe-server/src/main/java/com/muyu/data/mart/controller/RealNameJuHeController.java deleted file mode 100644 index 3f6f9d2..0000000 --- a/cloud-juhe/cloud-juhe-server/src/main/java/com/muyu/data/mart/controller/RealNameJuHeController.java +++ /dev/null @@ -1,46 +0,0 @@ -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 com.muyu.cloud.background.domin.realname.juhe.RealNameJuHeResp; -import lombok.AllArgsConstructor; -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; - -import java.io.IOException; - -/** - * @Author:weiran - * @Package:com.muyu.data.mart.controller - * @Project:cloud-background - * @name:RealNameJuHeController - * @Date:2024/9/5 21:16 - */ -@RestController -@RequestMapping("/juhe") -public class RealNameJuHeController { - - private final BasicApi realNameService; - - - @Autowired - public RealNameJuHeController(@Qualifier("juhe-real-name") BasicApi realNameService) { - this.realNameService = realNameService; - } - - @PostMapping("/real/name") - public 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-juhe/cloud-juhe-server/src/main/java/com/muyu/data/mart/service/impl/RealNameServiceImpl.java b/cloud-juhe/cloud-juhe-server/src/main/java/com/muyu/data/mart/service/impl/RealNameServiceImpl.java deleted file mode 100644 index 7093e35..0000000 --- a/cloud-juhe/cloud-juhe-server/src/main/java/com/muyu/data/mart/service/impl/RealNameServiceImpl.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.muyu.data.mart.service.impl; - - - -import com.muyu.cloud.background.common.BasicApi; -import com.muyu.cloud.background.domin.juhe.JuHeResult; -import com.muyu.cloud.background.domin.realname.RealNameReq; -import com.muyu.cloud.background.domin.realname.RealNameResp; -import com.muyu.cloud.background.domin.realname.juhe.RealNameJuHeReq; -import com.muyu.cloud.background.domin.realname.juhe.RealNameJuHeResp; - - -import org.springframework.boot.configurationprocessor.json.JSONObject; -import org.springframework.stereotype.Service; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.lang.reflect.Type; -import java.net.HttpURLConnection; - -import java.net.URL; -import java.net.URLEncoder; -import java.nio.charset.StandardCharsets; -import java.util.HashMap; -import java.util.Map; -import java.util.stream.Collectors; - - - -/** - * @Author:weiran - * @Package:com.muyu.data.mart.service.impl - * @Project:cloud-background - * @name:RealNameService - * @Date:2024/9/5 19:27 - */ -@Service("juhe-real-name") -public class RealNameServiceImpl implements BasicApi{ - @Override - public RealNameResp send(RealNameReq realNameResp) { - - RealNameJuHeReq realNameJuHeReq = RealNameJuHeReq.realNameJuHeReqBuild(realNameResp); - JuHeResult realNameJuHeRespJuHeResult = null; - try { - realNameJuHeRespJuHeResult = sendApi(realNameJuHeReq); - } catch (Exception e) { - throw new RuntimeException(e); - } - return RealNameResp.builder() - .code(String.valueOf(realNameJuHeRespJuHeResult.getErrorCode())) - .msg(realNameJuHeRespJuHeResult.getReason()) - .build(); - } - - public JuHeResult sendApi(RealNameJuHeReq realNameJuHeReq) throws IOException, Exception { - - //调用第三方的方法 - String apiKey = "c00bc093c4d5aee149a8d2efb2f2c51c"; - //1a398917d330f5ec01ce1110c459ec45 张腾 - //1abdb559b392ff72c789840e943e1d5f 彭思睿 - //586eae3d5ee4cbf46cb1430fdb3f8428 杨闪闪 - String apiUrl = "http://op.juhe.cn/idcard/query"; - - HashMap map = new HashMap<>(); - map.put("key", apiKey); - map.put("idcard", realNameJuHeReq.getIdCard()); - map.put("realname", realNameJuHeReq.getRealName()); - map.put("orderid", ""); - - String queryString = params(map); - URL url = new URL(apiUrl + "?" + queryString); - HttpURLConnection connection = (HttpURLConnection) url.openConnection(); - connection.setRequestMethod("GET"); - - BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); - String inputLine; - StringBuffer response = new StringBuffer(); - while ((inputLine = in.readLine()) != null) { - response.append(inputLine); - } - in.close(); - System.out.println(response); - //{"reason":"参数错误:身份证不合法","result":null,"error_code":210304} 或 - //{"reason":"成功","result":{"realname":"魏然","idcard":"321183200303152916","res":1},"error_code":0} - StringBuffer stringBuffer = new StringBuffer(response); - JSONObject jsonObject = new JSONObject(stringBuffer.toString()); - String reason = jsonObject.getString("reason"); - JSONObject resultObj = jsonObject.getJSONObject("result"); - String realname = resultObj.getString("realname"); - String idcard = resultObj.getString("idcard"); - int res = resultObj.getInt("res"); - int errorCode = jsonObject.getInt("error_code"); - return new JuHeResult(){{ - setErrorCode(errorCode); - setReason(reason); - setResult( - RealNameJuHeResp.builder() - .realName(realname) - .idCard(idcard) - .res(res) - .build() - ); - }}; - -// return new JuHeResult(){{ -// setErrorCode(0); -// setReason("成功"); -// setResult( -// RealNameJuHeResp.builder() -// .realName(realNameJuHeReq.getRealName()) -// .idCard(realNameJuHeReq.getIdCard()) -// .res(0) -// .build() -// ); -// }}; - - } - - - public static String params(Map map) { - return map.entrySet().stream() - .map(entry -> { - try { - return entry.getKey() + "=" + URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8.toString()); - } catch (Exception e) { - e.printStackTrace(); - return entry.getKey() + "=" + entry.getValue(); - } - }) - .collect(Collectors.joining("&")); - } -} diff --git a/cloud-juhe/cloud-juhe-server/src/main/resources/application.yml b/cloud-juhe/cloud-juhe-server/src/main/resources/application.yml deleted file mode 100644 index 401620c..0000000 --- a/cloud-juhe/cloud-juhe-server/src/main/resources/application.yml +++ /dev/null @@ -1,53 +0,0 @@ -# Tomcat -server: - port: 9722 - -# 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-juhe - 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-juhe/cloud-juhe-server/src/main/resources/logback/dev.xml b/cloud-juhe/cloud-juhe-server/src/main/resources/logback/dev.xml deleted file mode 100644 index 3b900f9..0000000 --- a/cloud-juhe/cloud-juhe-server/src/main/resources/logback/dev.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - ${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-juhe/cloud-juhe-server/src/main/resources/logback/prod.xml b/cloud-juhe/cloud-juhe-server/src/main/resources/logback/prod.xml deleted file mode 100644 index 44e117e..0000000 --- a/cloud-juhe/cloud-juhe-server/src/main/resources/logback/prod.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - ${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-juhe/cloud-juhe-server/src/main/resources/logback/test.xml b/cloud-juhe/cloud-juhe-server/src/main/resources/logback/test.xml deleted file mode 100644 index 44e117e..0000000 --- a/cloud-juhe/cloud-juhe-server/src/main/resources/logback/test.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - - - - ${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-juhe/pom.xml b/cloud-juhe/pom.xml deleted file mode 100644 index ccc8345..0000000 --- a/cloud-juhe/pom.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - 4.0.0 - - com.muyu - cloud-background - 1.0.0 - - - com.muyu.cloud.background - cloud-juhe - pom - - cloud-juhe-server - cloud-juhe-client - - - - 17 - 17 - UTF-8 - - - - diff --git a/pom.xml b/pom.xml index 4788bcf..e94257e 100644 --- a/pom.xml +++ b/pom.xml @@ -20,8 +20,6 @@ cloud-background-client cloud-background-server cloud-background-remote - cloud-juhe - cloud-ali @@ -31,10 +29,7 @@ - - com.alibaba.fastjson2 - fastjson2 - + org.springframework.cloud spring-cloud-starter-feign