From 72b8605073ed06b9094334a85087b53332892c07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B1=E9=A3=9E=E4=BA=91?= <1941783199@qq.com> Date: Tue, 13 Oct 2020 10:16:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BE=9D=E8=B5=96=E5=8C=85=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dq-financial-api/pom.xml | 17 +------- dq-financial-crms/pom.xml | 20 +++------ .../financial/crms/config/IPageConfig.java | 2 + dq-financial-hrms-auth/pom.xml | 40 +----------------- dq-financial-hrms/pom.xml | 41 ++----------------- .../com/daqing/framework/util/SendSMS.java | 27 ++++++++---- 6 files changed, 34 insertions(+), 113 deletions(-) diff --git a/dq-financial-api/pom.xml b/dq-financial-api/pom.xml index 4c8f7567..e0c617c1 100644 --- a/dq-financial-api/pom.xml +++ b/dq-financial-api/pom.xml @@ -15,31 +15,18 @@ 系统API统一定义 - + com.daqing.framework dq-framework-model 1.0-SNAPSHOT - + org.springframework.boot spring-boot-starter-web 2.1.8.RELEASE - \ No newline at end of file diff --git a/dq-financial-crms/pom.xml b/dq-financial-crms/pom.xml index e9f92db3..0c878f17 100644 --- a/dq-financial-crms/pom.xml +++ b/dq-financial-crms/pom.xml @@ -20,20 +20,12 @@ + - com.daqing.framework - dq-framework-common - 1.0-SNAPSHOT - - - com.daqing.framework - dq-framework-model - 1.0-SNAPSHOT - - - com.daqing.framework - dq-framework-utils + com.daqing.financial + dq-financial-hrms-auth 0.0.1-SNAPSHOT + compile com.daqing.financial @@ -44,11 +36,11 @@ org.springframework.boot spring-boot-starter-web - + org.springframework.boot spring-boot-starter-test diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/config/IPageConfig.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/config/IPageConfig.java index 6001a7e0..243e1e84 100644 --- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/config/IPageConfig.java +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/config/IPageConfig.java @@ -1,3 +1,4 @@ +/* package com.daqing.financial.crms.config; import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor; @@ -11,3 +12,4 @@ public class IPageConfig { return new PaginationInterceptor(); } } +*/ diff --git a/dq-financial-hrms-auth/pom.xml b/dq-financial-hrms-auth/pom.xml index c993f85e..7644b76e 100644 --- a/dq-financial-hrms-auth/pom.xml +++ b/dq-financial-hrms-auth/pom.xml @@ -20,11 +20,7 @@ - + com.auth0 java-jwt @@ -35,15 +31,10 @@ jjwt 0.7.0 - + @@ -51,33 +42,6 @@ spring-cloud-starter-openfeign - - - - - com.daqing.financial dq-financial-api diff --git a/dq-financial-hrms/pom.xml b/dq-financial-hrms/pom.xml index e65db31c..58dda903 100644 --- a/dq-financial-hrms/pom.xml +++ b/dq-financial-hrms/pom.xml @@ -21,53 +21,20 @@ - - - com.daqing.financial dq-financial-api 0.0.1-SNAPSHOT compile - - + --> + + - com.daqing.financial dq-financial-hrms-auth diff --git a/dq-framework-common/src/main/java/com/daqing/framework/util/SendSMS.java b/dq-framework-common/src/main/java/com/daqing/framework/util/SendSMS.java index 34587a05..68bc4c91 100644 --- a/dq-framework-common/src/main/java/com/daqing/framework/util/SendSMS.java +++ b/dq-framework-common/src/main/java/com/daqing/framework/util/SendSMS.java @@ -14,12 +14,12 @@ public class SendSMS { public static void main(String[] args){ - String mobile="13888888888";//需要接受短信验证码的手机号 - String sendTemplate="SMS_134188888";//短信模板ID,需要去阿里云平台申请,审核通过后方能使用,通常是以"SMS_"开头字符串 + String mobile="18707074784";//需要接受短信验证码的手机号 + String sendTemplate="SMS_204155294";//短信模板ID,需要去阿里云平台申请,审核通过后方能使用,通常是以"SMS_"开头字符串 String code = (int)((Math.random() * 9 + 1) * 100000)+ "";//要发送给用户的短信验证码,行业通常使用六位纯数字 - String result= sendCode(mobile,sendTemplate,code); - if(result!=null&&"OK".equals(result.toUpperCase())){ + boolean result= sendCode(mobile,sendTemplate,code); + if(result){ System.out.println("短信发送成功"); }else{ System.out.println("短信发送失败"); @@ -32,7 +32,8 @@ public class SendSMS { * @param sendTemplate 短信模板id,此处将其封装为变量,是为了由该方法的调用者决定自己来发送哪种类型的短信验证码,比如注册,重置密码类的 * @param code 您将发送到用户手机的短信验证码 */ - public static String sendCode(String mobile,String sendTemplate,String code){ + public static Boolean sendCode(String mobile,String sendTemplate,String code){ + boolean isSend = false; //请求失败这里会抛ClientException异常 String result=""; try { @@ -43,8 +44,8 @@ public class SendSMS { final String product = "Dysmsapi";//短信API产品名称(短信产品名固定,无需修改) final String domain = "dysmsapi.aliyuncs.com";//短信API产品域名(接口地址固定,无需修改) //替换成你的AK - final String accessKeyId = "LTAI3IJDEVkXgY0E";//你的accessKeyId,参考本文档步骤2 - final String accessKeySecret = "kmnOeksdTEauInvea9Hf6dqssDdvho";//你的accessKeySecret,参考本文档步骤2 + final String accessKeyId = "LTAI4FzqQHnk4rozqLZ8jCNj";//你的accessKeyId,参考本文档步骤2 + final String accessKeySecret = "mveW7B1OyFoKUkHm8WsxmrjHmkJWHq";//你的accessKeySecret,参考本文档步骤2 //初始化ascClient,暂时不支持多region(请勿修改) IClientProfile profile = DefaultProfile.getProfile("cn-hangzhou", accessKeyId, accessKeySecret); @@ -57,7 +58,7 @@ public class SendSMS { //必填:待发送手机号。支持以逗号分隔的形式进行批量调用,批量上限为1000个手机号码,批量调用相对于单条调用及时性稍有延迟,验证码类型的短信推荐使用单条调用的方式;发送国际/港澳台消息时,接收号码格式为00+国际区号+号码,如“0085200000000” request.setPhoneNumbers(mobile); //必填:短信签名-可在短信控制台中找到 - request.setSignName("");//注意要与你在短信控制台中的签名一致 + request.setSignName("职站");//注意要与你在短信控制台中的签名一致 //必填:短信模板-可在短信控制台中找到 request.setTemplateCode(sendTemplate); //可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为 @@ -71,10 +72,18 @@ public class SendSMS { SendSmsResponse response = acsClient.getAcsResponse(request); result=response.getCode(); + if(result!=null&&"OK".equals(result.toUpperCase())){ + System.out.println("短信发送成功"); + isSend = true; + }else{ + isSend = false; + System.out.println("短信发送失败"); + } } catch (Exception e) { result=e.getMessage(); + isSend = false; } - return result; + return isSend; } } \ No newline at end of file