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
cf6dedc5
Commit
cf6dedc5
authored
Aug 30, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
123
parent
1f04c7a6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
40 deletions
+73
-40
SmsTemplateDTO.java
.../java/com/xxfc/platform/universal/dto/SmsTemplateDTO.java
+4
-0
AliYunSmsBiz.java
...in/java/com/xxfc/platform/universal/biz/AliYunSmsBiz.java
+60
-36
SmsController.java
...com/xxfc/platform/universal/controller/SmsController.java
+5
-1
SmsService.java
.../java/com/xxfc/platform/universal/service/SmsService.java
+4
-3
No files found.
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/dto/SmsTemplateDTO.java
View file @
cf6dedc5
...
@@ -66,6 +66,10 @@ public class SmsTemplateDTO {
...
@@ -66,6 +66,10 @@ public class SmsTemplateDTO {
public
static
final
int
PAY_H
=
24
;
public
static
final
int
PAY_H
=
24
;
//取消旅游订单(客服)
//取消旅游订单(客服)
public
static
final
int
CANCEL_F
=
25
;
public
static
final
int
CANCEL_F
=
25
;
//租车(取车提醒)26
public
static
final
int
PAY_I
=
26
;
//旅游(上车通知)27
public
static
final
int
PAY_J
=
27
;
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/biz/AliYunSmsBiz.java
View file @
cf6dedc5
package
com
.
xxfc
.
platform
.
universal
.
biz
;
package
com
.
xxfc
.
platform
.
universal
.
biz
;
import
com.xxfc.platform.universal.service.SmsService
;
import
com.xxfc.platform.universal.utils.CCPRestSmsUtils
;
import
com.xxfc.platform.universal.utils.CCPRestSmsUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -28,42 +29,58 @@ public class AliYunSmsBiz {
...
@@ -28,42 +29,58 @@ public class AliYunSmsBiz {
//租车(通用)10
//租车(通用)10
public
static
final
String
TEMPLATE_ID_PAY_A
=
"460759"
;
//public static final String TEMPLATE_ID_PAY_A = "460759";
public
static
final
String
TEMPLATE_ID_PAY_A
=
"SMS_171112286"
;
//租车(使用会员权益)11
//租车(使用会员权益)11
public
static
final
String
TEMPLATE_ID_PAY_B
=
"460760"
;
//public static final String TEMPLATE_ID_PAY_B = "460760";
public
static
final
String
TEMPLATE_ID_PAY_B
=
"SMS_173340577"
;
//租车内部通知(客服)12
//租车内部通知(客服)12
public
static
final
String
TEMPLATE_ID_PAY_C
=
"460763"
;
//public static final String TEMPLATE_ID_PAY_C = "460763";
public
static
final
String
TEMPLATE_ID_PAY_C
=
"SMS_173345572"
;
//租车内部通知(出车人)13
//租车内部通知(出车人)13
public
static
final
String
TEMPLATE_ID_PAY_D
=
"460762"
;
//public static final String TEMPLATE_ID_PAY_D = "460762";
public
static
final
String
TEMPLATE_ID_PAY_D
=
"SMS_173340609"
;
//租车内部通知(收车人)14
//租车内部通知(收车人)14
public
static
final
String
TEMPLATE_ID_PAY_E
=
"460764"
;
//public static final String TEMPLATE_ID_PAY_E = "460764";
public
static
final
String
TEMPLATE_ID_PAY_E
=
"SMS_173345589"
;
//旅游(通用)15
//旅游(通用)15
public
static
final
String
TEMPLATE_ID_PAY_F
=
"460765"
;
//public static final String TEMPLATE_ID_PAY_F = "460765";
public
static
final
String
TEMPLATE_ID_PAY_F
=
"SMS_173345597"
;
//会员购买(通用)16
//会员购买(通用)16
public
static
final
String
TEMPLATE_ID_PAY_G
=
"460766"
;
//public static final String TEMPLATE_ID_PAY_G = "460766";
public
static
final
String
TEMPLATE_ID_PAY_G
=
"SMS_173340637"
;
//取消租车(通用)17
//取消租车(通用)17
public
static
final
String
TEMPLATE_ID_CANCEL_A
=
"460767"
;
//public static final String TEMPLATE_ID_CANCEL_A= "460767";
public
static
final
String
TEMPLATE_ID_CANCEL_A
=
"SMS_173345633"
;
//取消租车(使用会员权益)18
//取消租车(使用会员权益)18
public
static
final
String
TEMPLATE_ID_CANCEL_B
=
"460768"
;
//public static final String TEMPLATE_ID_CANCEL_B = "460768";
public
static
final
String
TEMPLATE_ID_CANCEL_B
=
"SMS_173340658"
;
//取消租车(通用扣违约金)19
//取消租车(通用扣违约金)19
public
static
final
String
TEMPLATE_ID_CANCEL_C
=
"460769"
;
//public static final String TEMPLATE_ID_CANCEL_C = "460769";
public
static
final
String
TEMPLATE_ID_CANCEL_C
=
"SMS_173345646"
;
//取消租车(会员权益&扣违 20
//取消租车(会员权益&扣违 20
public
static
final
String
TEMPLATE_ID_CANCEL_D
=
"460770"
;
//public static final String TEMPLATE_ID_CANCEL_D = "460770";
public
static
final
String
TEMPLATE_ID_CANCEL_D
=
"SMS_173340671"
;
//取消租车(出车人)21
//取消租车(出车人)21
public
static
final
String
TEMPLATE_ID_CANCEL_E
=
"460771"
;
//
public static final String TEMPLATE_ID_CANCEL_E = "460771";
public
static
final
String
TEMPLATE_ID_CANCEL_E
=
"SMS_173345667"
;
//租车押金退还 22
//租车押金退还 22
public
static
final
String
TEMPLATE_ID_FINISH_A
=
"460772"
;
//public static final String TEMPLATE_ID_FINISH_A = "460772";
public
static
final
String
TEMPLATE_ID_FINISH_A
=
"SMS_173340710"
;
//违章押金退还 23
//违章押金退还 23
public
static
final
String
TEMPLATE_ID_FINISH_B
=
"460773"
;
//
public static final String TEMPLATE_ID_FINISH_B = "460773";
public
static
final
String
TEMPLATE_ID_FINISH_B
=
"SMS_173340712"
;
//旅游内部通知(客服)24
//旅游内部通知(客服)24
public
static
final
String
TEMPLATE_ID_PAY_H
=
"461421"
;
//public static final String TEMPLATE_ID_PAY_H = "461421";
public
static
final
String
TEMPLATE_ID_PAY_H
=
"SMS_173340630"
;
//取消旅游订单(客服)25
//取消旅游订单(客服)25
public
static
final
String
TEMPLATE_ID_CANCEL_F
=
"461424"
;
//public static final String TEMPLATE_ID_CANCEL_F = "461424";
public
static
final
String
TEMPLATE_ID_CANCEL_F
=
"SMS_173340695"
;
//租车(取车提醒)26
public
static
final
String
TEMPLATE_ID_PAY_I
=
"SMS_173345539"
;
//旅游(上车通知)27
public
static
final
String
TEMPLATE_ID_PAY_J
=
"SMS_173345606"
;
...
@@ -95,52 +112,59 @@ public class AliYunSmsBiz {
...
@@ -95,52 +112,59 @@ public class AliYunSmsBiz {
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_CANCEL
);
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_CANCEL
);
break
;
break
;
case
10
:
case
10
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_PAY_A
);
//CCPRestSmsUtils.sendTemplateSMS(phoneNumbers,params,TEMPLATE_ID_PAY_A);
SmsService
.
sendTemplateToJson
(
phoneNumbers
,
params
,
TEMPLATE_ID_PAY_A
);
break
;
break
;
case
11
:
case
11
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_PAY_B
);
SmsService
.
sendTemplateToJson
(
phoneNumbers
,
params
,
TEMPLATE_ID_PAY_B
);
break
;
break
;
case
12
:
case
12
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_PAY_C
);
SmsService
.
sendTemplateToJson
(
phoneNumbers
,
params
,
TEMPLATE_ID_PAY_C
);
break
;
break
;
case
13
:
case
13
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_PAY_D
);
SmsService
.
sendTemplateToJson
(
phoneNumbers
,
params
,
TEMPLATE_ID_PAY_D
);
break
;
break
;
case
14
:
case
14
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_PAY_E
);
SmsService
.
sendTemplateToJson
(
phoneNumbers
,
params
,
TEMPLATE_ID_PAY_E
);
break
;
break
;
case
15
:
case
15
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_PAY_F
);
SmsService
.
sendTemplateToJson
(
phoneNumbers
,
params
,
TEMPLATE_ID_PAY_F
);
break
;
break
;
case
16
:
case
16
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_PAY_G
);
SmsService
.
sendTemplateToJson
(
phoneNumbers
,
params
,
TEMPLATE_ID_PAY_G
);
break
;
break
;
case
17
:
case
17
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_CANCEL_A
);
SmsService
.
sendTemplateToJson
(
phoneNumbers
,
params
,
TEMPLATE_ID_CANCEL_A
);
break
;
break
;
case
18
:
case
18
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_CANCEL_B
);
SmsService
.
sendTemplateToJson
(
phoneNumbers
,
params
,
TEMPLATE_ID_CANCEL_B
);
break
;
break
;
case
19
:
case
19
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_CANCEL_C
);
SmsService
.
sendTemplateToJson
(
phoneNumbers
,
params
,
TEMPLATE_ID_CANCEL_C
);
break
;
break
;
case
20
:
case
20
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_CANCEL_D
);
SmsService
.
sendTemplateToJson
(
phoneNumbers
,
params
,
TEMPLATE_ID_CANCEL_D
);
break
;
break
;
case
21
:
case
21
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_CANCEL_E
);
SmsService
.
sendTemplateToJson
(
phoneNumbers
,
params
,
TEMPLATE_ID_CANCEL_E
);
break
;
break
;
case
22
:
case
22
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_FINISH_A
);
SmsService
.
sendTemplateToJson
(
phoneNumbers
,
params
,
TEMPLATE_ID_FINISH_A
);
break
;
break
;
case
23
:
case
23
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_FINISH_B
);
SmsService
.
sendTemplateToJson
(
phoneNumbers
,
params
,
TEMPLATE_ID_FINISH_B
);
break
;
break
;
case
24
:
case
24
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_PAY_H
);
SmsService
.
sendTemplateToJson
(
phoneNumbers
,
params
,
TEMPLATE_ID_PAY_H
);
break
;
break
;
case
25
:
case
25
:
CCPRestSmsUtils
.
sendTemplateSMS
(
phoneNumbers
,
params
,
TEMPLATE_ID_CANCEL_F
);
SmsService
.
sendTemplateToJson
(
phoneNumbers
,
params
,
TEMPLATE_ID_CANCEL_F
);
break
;
case
26
:
SmsService
.
sendTemplateToJson
(
phoneNumbers
,
params
,
TEMPLATE_ID_PAY_I
);
break
;
case
27
:
SmsService
.
sendTemplateToJson
(
phoneNumbers
,
params
,
TEMPLATE_ID_PAY_J
);
break
;
break
;
}
}
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/SmsController.java
View file @
cf6dedc5
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -5,6 +5,7 @@ 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.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.AliYunSmsBiz
;
import
com.xxfc.platform.universal.biz.CCPRestSmsBiz
;
import
com.xxfc.platform.universal.biz.CCPRestSmsBiz
;
import
com.xxfc.platform.universal.dto.SmsTemplateDTO
;
import
com.xxfc.platform.universal.dto.SmsTemplateDTO
;
import
com.xxfc.platform.universal.service.SmsService
;
import
com.xxfc.platform.universal.service.SmsService
;
...
@@ -32,6 +33,9 @@ public class SmsController {
...
@@ -32,6 +33,9 @@ public class SmsController {
@Autowired
@Autowired
CCPRestSmsBiz
smsBiz
;
CCPRestSmsBiz
smsBiz
;
@Autowired
AliYunSmsBiz
aliYunSmsBiz
;
@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
);
...
@@ -52,7 +56,7 @@ public class SmsController {
...
@@ -52,7 +56,7 @@ public class SmsController {
Integer
type
=
smsTemplateDTO
.
getType
();
Integer
type
=
smsTemplateDTO
.
getType
();
String
[]
params
=
smsTemplateDTO
.
getParams
();
String
[]
params
=
smsTemplateDTO
.
getParams
();
String
phoneNumbers
=
smsTemplateDTO
.
getPhoneNumbers
();
String
phoneNumbers
=
smsTemplateDTO
.
getPhoneNumbers
();
s
msBiz
.
sendTemplateSMS
(
type
,
phoneNumbers
,
params
);
aliYunS
msBiz
.
sendTemplateSMS
(
type
,
phoneNumbers
,
params
);
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
}
}
}
}
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/SmsService.java
View file @
cf6dedc5
...
@@ -148,7 +148,7 @@ public class SmsService {
...
@@ -148,7 +148,7 @@ public class SmsService {
return
false
;
return
false
;
}
}
public
boolean
sendTemplate
(
String
PhoneNumbers
,
String
params
,
String
templateCode
)
throws
ClientException
{
public
static
boolean
sendTemplate
(
String
PhoneNumbers
,
String
params
,
String
templateCode
)
throws
ClientException
{
//可自助调整超时时间
//可自助调整超时时间
System
.
setProperty
(
"sun.net.client.defaultConnectTimeout"
,
"10000"
);
System
.
setProperty
(
"sun.net.client.defaultConnectTimeout"
,
"10000"
);
...
@@ -191,12 +191,13 @@ public class SmsService {
...
@@ -191,12 +191,13 @@ public class SmsService {
return
false
;
return
false
;
}
}
public
void
sendTemplateToJson
(
String
PhoneNumbers
,
String
[]
params
,
String
templateCode
){
public
static
void
sendTemplateToJson
(
String
PhoneNumbers
,
String
[]
params
,
String
templateCode
){
try
{
try
{
JSONObject
jsonParams
=
new
JSONObject
();
JSONObject
jsonParams
=
new
JSONObject
();
for
(
int
i
=
0
;
i
<
params
.
length
;
i
++){
for
(
int
i
=
0
;
i
<
params
.
length
;
i
++){
jsonParams
.
put
(
param
+(
i
+
1
),
params
[
i
]);
jsonParams
.
put
(
param
+(
i
+
1
),
params
[
i
]);
}
}
sendTemplate
(
PhoneNumbers
,
jsonParams
.
toJSONString
(),
templateCode
);
sendTemplate
(
PhoneNumbers
,
jsonParams
.
toJSONString
(),
templateCode
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
...
@@ -209,7 +210,7 @@ public class SmsService {
...
@@ -209,7 +210,7 @@ public class SmsService {
SmsService
smsService
=
new
SmsService
();
SmsService
smsService
=
new
SmsService
();
//发短信
//发短信
String
[]
params
={
"1"
,
"2"
,
"3"
,
"2019-08-29"
,
"松山湖"
};
String
[]
params
={
"1"
,
"2"
,
"3"
,
"2019-08-29"
,
"松山湖"
};
s
msService
.
sendTemplateToJson
(
"13612688539,13265487972"
,
params
,
"SMS_169904346"
);
S
msService
.
sendTemplateToJson
(
"13612688539,13265487972"
,
params
,
"SMS_169904346"
);
/*System.out.println("短信接口返回的数据----------------");
/*System.out.println("短信接口返回的数据----------------");
System.out.println("Code=" + response.getCode());
System.out.println("Code=" + response.getCode());
System.out.println("Message=" + response.getMessage());
System.out.println("Message=" + response.getMessage());
...
...
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