Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
7fb092c5
Commit
7fb092c5
authored
Jul 13, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加短信机
parent
702ff965
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
134 additions
and
0 deletions
+134
-0
pom.xml
xx-universal/xx-universal-api/pom.xml
+8
-0
SmsTemplateDTO.java
.../java/com/xxfc/platform/universal/dto/SmsTemplateDTO.java
+22
-0
ThirdFeign.java
...in/java/com/xxfc/platform/universal/feign/ThirdFeign.java
+4
-0
CCPRestSmsUtils.java
...va/com/xxfc/platform/universal/utils/CCPRestSmsUtils.java
+40
-0
CCPRestSmsBiz.java
...n/java/com/xxfc/platform/universal/biz/CCPRestSmsBiz.java
+42
-0
SmsController.java
...com/xxfc/platform/universal/controller/SmsController.java
+18
-0
No files found.
xx-universal/xx-universal-api/pom.xml
View file @
7fb092c5
...
@@ -41,6 +41,14 @@
...
@@ -41,6 +41,14 @@
<artifactId>
httpclient
</artifactId>
<artifactId>
httpclient
</artifactId>
<version>
4.5
</version>
<version>
4.5
</version>
</dependency>
</dependency>
<!-- 短信机-->
<dependency>
<groupId>
sms
</groupId>
<artifactId>
sms
</artifactId>
<version>
2.6.3
</version>
<scope>
system
</scope>
<systemPath>
D:/hezhen/Program Files/apache-maven-3.5.4/repo/sms/CCP_REST_SMS_SDK_JAVA_v2.6.3r.jar
</systemPath>
</dependency>
</dependencies>
</dependencies>
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/dto/SmsTemplateDTO.java
0 → 100644
View file @
7fb092c5
package
com
.
xxfc
.
platform
.
universal
.
dto
;
import
lombok.Data
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/3 17:51
*/
@Data
public
class
SmsTemplateDTO
{
//类型:1-租车订单通知(普通用户),2-租车订单短信(会员权益),3-旅游订单短信,4-加入会员通知
private
Integer
type
;
//手机号码(多个短信逗号隔开)
private
String
phoneNumbers
;
//参数
private
String
[]
params
;
}
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/feign/ThirdFeign.java
View file @
7fb092c5
...
@@ -3,6 +3,7 @@ package com.xxfc.platform.universal.feign;
...
@@ -3,6 +3,7 @@ package com.xxfc.platform.universal.feign;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.universal.dto.RegionDTO
;
import
com.xxfc.platform.universal.dto.RegionDTO
;
import
com.xxfc.platform.universal.dto.SmsTemplateDTO
;
import
com.xxfc.platform.universal.entity.Dictionary
;
import
com.xxfc.platform.universal.entity.Dictionary
;
import
com.xxfc.platform.universal.entity.OrderRefund
;
import
com.xxfc.platform.universal.entity.OrderRefund
;
import
com.xxfc.platform.universal.vo.*
;
import
com.xxfc.platform.universal.vo.*
;
...
@@ -29,6 +30,9 @@ public interface ThirdFeign {
...
@@ -29,6 +30,9 @@ public interface ThirdFeign {
@RequestMapping
(
value
=
"/sms/app/unauth/sendCode"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/sms/app/unauth/sendCode"
,
method
=
RequestMethod
.
GET
)
//发送短信模板消息
//发送短信模板消息
public
JSONObject
sendCode
(
@RequestParam
(
"phone"
)
String
phone
,
@RequestParam
(
"code"
)
String
code
,
@RequestParam
(
"templateCode"
)
String
templateCode
);
public
JSONObject
sendCode
(
@RequestParam
(
"phone"
)
String
phone
,
@RequestParam
(
"code"
)
String
code
,
@RequestParam
(
"templateCode"
)
String
templateCode
);
//云通讯短信机
@RequestMapping
(
value
=
"/app/unauth/sendTemplate"
,
method
=
RequestMethod
.
GET
)
public
ObjectRestResponse
sendTemplate
(
SmsTemplateDTO
smsTemplateDTO
);
@RequestMapping
(
value
=
"/file/app/unauth/uploadFiles"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/file/app/unauth/uploadFiles"
,
method
=
RequestMethod
.
POST
)
public
JSONObject
uploadFiles
(
@RequestParam
(
value
=
"files"
)
MultipartFile
[]
files
);
public
JSONObject
uploadFiles
(
@RequestParam
(
value
=
"files"
)
MultipartFile
[]
files
);
@RequestMapping
(
value
=
"/pay/app/wx"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/pay/app/wx"
,
method
=
RequestMethod
.
POST
)
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/utils/CCPRestSmsUtils.java
0 → 100644
View file @
7fb092c5
package
com
.
xxfc
.
platform
.
universal
.
utils
;
import
com.cloopen.rest.sdk.CCPRestSmsSDK
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
public
class
CCPRestSmsUtils
{
public
static
CCPRestSmsSDK
restAPI
;
static
{
restAPI
=
new
CCPRestSmsSDK
();
restAPI
.
init
(
"app.cloopen.com"
,
"8883"
);
restAPI
.
setAccount
(
"8aaf070865e6b6eb0165ecd776700559"
,
"3fe5e2f053674f23b029a9a9fc9503f0"
);
restAPI
.
setAppId
(
"8a216da86812593601684bec10581ab5"
);
}
public
static
Map
<
String
,
Object
>
sendTemplateSMS
(
String
phoneNumbers
,
String
[]
params
,
String
templateId
)
{
HashMap
<
String
,
Object
>
result
=
null
;
result
=
restAPI
.
sendTemplateSMS
(
phoneNumbers
,
templateId
,
params
);
System
.
out
.
println
(
"SDKTestGetSubAccounts result="
+
result
);
if
(
"000000"
.
equals
(
result
.
get
(
"statusCode"
)))
{
// 正常返回输出data包体信息(map)
HashMap
<
String
,
Object
>
data
=
(
HashMap
<
String
,
Object
>)
result
.
get
(
"data"
);
Set
<
String
>
keySet
=
data
.
keySet
();
for
(
String
key
:
keySet
)
{
Object
object
=
data
.
get
(
key
);
System
.
out
.
println
(
key
+
" = "
+
object
);
}
}
else
{
// 异常返回输出错误码和错误信息
System
.
out
.
println
(
"错误码="
+
result
.
get
(
"statusCode"
)
+
" 错误信息= "
+
result
.
get
(
"statusMsg"
));
}
return
result
;
}
}
\ No newline at end of file
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/biz/CCPRestSmsBiz.java
0 → 100644
View file @
7fb092c5
package
com
.
xxfc
.
platform
.
universal
.
biz
;
import
com.xxfc.platform.universal.utils.CCPRestSmsUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
@Service
@Slf4j
public
class
CCPRestSmsBiz
{
//租车订单通知(普通用户)1
public
static
final
String
TEMPLATE_ID_ORDER
=
"457270"
;
//租车订单短信(会员权益)2
public
static
final
String
TEMPLATE_ID_ORDER_MEMBER
=
"457271"
;
//旅游订单短信3
public
static
final
String
TEMPLATE_ID_ORDER_TOUR
=
"457272"
;
//加入会员通知4
public
static
final
String
TEMPLATE_ID_MEMBER
=
"457273"
;
//发送模板消息
public
void
sendTemplateSMS
(
Integer
type
,
String
phoneNumbers
,
String
[]
params
){
switch
(
type
){
case
1
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_ORDER
);
break
;
case
2
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_ORDER_MEMBER
);
break
;
case
3
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_ORDER_TOUR
);
break
;
case
4
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_MEMBER
);
break
;
}
}
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/SmsController.java
View file @
7fb092c5
...
@@ -3,7 +3,10 @@ package com.xxfc.platform.universal.controller;
...
@@ -3,7 +3,10 @@ package com.xxfc.platform.universal.controller;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.result.JsonResultUtil
;
import
com.github.wxiaoqi.security.common.util.result.JsonResultUtil
;
import
com.xxfc.platform.universal.biz.CCPRestSmsBiz
;
import
com.xxfc.platform.universal.dto.SmsTemplateDTO
;
import
com.xxfc.platform.universal.service.SmsService
;
import
com.xxfc.platform.universal.service.SmsService
;
import
com.xxfc.platform.universal.service.UploadService
;
import
com.xxfc.platform.universal.service.UploadService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
@@ -29,6 +32,9 @@ public class SmsController {
...
@@ -29,6 +32,9 @@ public class SmsController {
@Autowired
@Autowired
SmsService
smsService
;
SmsService
smsService
;
@Autowired
CCPRestSmsBiz
smsBiz
;
@RequestMapping
(
value
=
"/app/unauth/send"
,
method
=
RequestMethod
.
GET
)
//匹配的是href中的download请求
@RequestMapping
(
value
=
"/app/unauth/send"
,
method
=
RequestMethod
.
GET
)
//匹配的是href中的download请求
public
JSONObject
sendSms
(
@RequestParam
(
"phone"
)
String
phone
)
throws
Exception
{
public
JSONObject
sendSms
(
@RequestParam
(
"phone"
)
String
phone
)
throws
Exception
{
return
smsService
.
smsCode
(
phone
);
return
smsService
.
smsCode
(
phone
);
...
@@ -40,5 +46,17 @@ public class SmsController {
...
@@ -40,5 +46,17 @@ public class SmsController {
@RequestParam
(
"templateCode"
)
String
templateCode
)
throws
Exception
{
@RequestParam
(
"templateCode"
)
String
templateCode
)
throws
Exception
{
return
smsService
.
smsByCode
(
phone
,
code
,
templateCode
);
return
smsService
.
smsByCode
(
phone
,
code
,
templateCode
);
}
}
@RequestMapping
(
value
=
"/app/unauth/sendTemplate"
,
method
=
RequestMethod
.
GET
)
public
ObjectRestResponse
sendTemplate
(
SmsTemplateDTO
smsTemplateDTO
)
throws
Exception
{
if
(
smsTemplateDTO
==
null
){
return
ObjectRestResponse
.
createDefaultFail
();
}
Integer
type
=
smsTemplateDTO
.
getType
();
String
[]
params
=
smsTemplateDTO
.
getParams
();
String
phoneNumbers
=
smsTemplateDTO
.
getPhoneNumbers
();
smsBiz
.
sendTemplateSMS
(
type
,
phoneNumbers
,
params
);
return
ObjectRestResponse
.
succ
();
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment