Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
d12f3c47
Commit
d12f3c47
authored
Jul 20, 2018
by
Junling Bu
Browse files
chore[litemall-core]: 调整notify和express代码结果,以及调整配置命名以litemall开始
parent
29751a5f
Changes
33
Hide whitespace changes
Inline
Side-by-side
litemall-core/src/main/resources/application-core.yml
View file @
d12f3c47
# 邮件通知配置,邮箱一般用于接收业务通知例如收到新的订单,sendto 定义邮件接收者,通常为商城运营人员
MailNotifyConfig
:
enable
:
false
host
:
smtp.exmail.qq.com
username
:
ex@ex.com.cn
password
:
XXXXXXXXXXXXX
sendto
:
ex@qq.com
litemall
:
notify
:
mail
:
# 邮件通知配置,邮箱一般用于接收业务通知例如收到新的订单,sendto 定义邮件接收者,通常为商城运营人员
enable
:
false
host
:
smtp.exmail.qq.com
username
:
ex@ex.com.cn
password
:
XXXXXXXXXXXXX
sendfrom
:
ex@ex.com.cn
sendto
:
ex@qq.com
# 短消息模版通知配置
# 短信息用于通知客户,例如发货短信通知,注意配置格式;template-name,template-templateId 请参考 ConfigUtil 内枚举值
SMSNotifyConfig
:
enable
:
false
appid
:
111111111
appkey
:
xxxxxxxxxxxxxx
sign
:
xxxxxxxxx
template
:
-
name
:
paySucceed
templateId
:
156349
-
name
:
captcha
templateId
:
156433
-
name
:
ship
templateId
:
158002
-
name
:
refund
templateId
:
159447
# 短消息模版通知配置
# 短信息用于通知客户,例如发货短信通知,注意配置格式;template-name,template-templateId 请参考 NotifyType 枚举值
sms
:
enable
:
false
appid
:
111111111
appkey
:
xxxxxxxxxxxxxx
template
:
-
name
:
paySucceed
templateId
:
156349
-
name
:
captcha
templateId
:
156433
-
name
:
ship
templateId
:
158002
-
name
:
refund
templateId
:
159447
# 微信模版通知配置
# 微信模版用于通知客户或者运营者,注意配置格式;template-name,template-templateId 请参考 NotifyType 枚举值
wx
:
enable
:
false
template
:
-
name
:
paySucceed
templateId
:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-
name
:
captcha
templateId
:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-
name
:
ship
templateId
:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-
name
:
refund
templateId
:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# 微信模版通知配置
# 微信模版用于通知客户或者运营者,注意配置格式;template-name,template-templateId 请参考 ConfigUtil 内枚举值
WXNotifyConfig
:
enable
:
false
template
:
-
name
:
paySucceed
templateId
:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
-
name
:
captcha
templateId
:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
#快鸟物流查询配置
express
:
appId
:
"
XXXXXXXXX"
appKey
:
"
XXXXXXXXXXXXXXXXXXXXXXXXX"
vendors
:
# 快鸟物流查询配置
express
:
enable
:
false
appId
:
"
XXXXXXXXX"
appKey
:
"
XXXXXXXXXXXXXXXXXXXXXXXXX"
vendors
:
-
code
:
"
ZTO"
name
:
"
中通快递"
-
code
:
"
YTO"
...
...
litemall-core/src/test/java/org/linlinjava/litemall/core/CoreConfigTest.java
View file @
d12f3c47
...
...
@@ -2,8 +2,6 @@ package org.linlinjava.litemall.core;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.linlinjava.litemall.core.express.config.ExpressConfig
;
import
org.linlinjava.litemall.core.notify.config.MailNotifyConfig
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.core.env.Environment
;
...
...
@@ -14,16 +12,12 @@ import org.springframework.test.context.web.WebAppConfiguration;
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
public
class
CoreConfigTest
{
@Autowired
ExpressConfig
config
;
@Autowired
Environment
environment
;
@Test
public
void
test
()
{
System
.
out
.
println
(
config
.
getAppId
());
System
.
out
.
println
(
config
.
getAppKey
());
// 测试获取application-core.yml配置信息
System
.
out
.
println
(
environment
.
getProperty
(
"express.appId"
));
System
.
out
.
println
(
environment
.
getProperty
(
"
litemall.
express.appId"
));
}
}
litemall-core/src/test/java/org/linlinjava/litemall/core/MailTest.java
View file @
d12f3c47
...
...
@@ -2,7 +2,7 @@ package org.linlinjava.litemall.core;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.linlinjava.litemall.core.notify.
Litemall
NotifyService
;
import
org.linlinjava.litemall.core.notify.NotifyService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
...
...
@@ -24,11 +24,11 @@ import org.springframework.test.context.web.WebAppConfiguration;
public
class
MailTest
{
@Autowired
private
Litemall
NotifyService
litemallN
otifyService
;
private
NotifyService
n
otifyService
;
@Test
public
void
testMail
()
{
litemallN
otifyService
.
notifyMail
Message
(
"订单信息"
,
"订单1111111已付款,请发货"
);
n
otifyService
.
notifyMail
(
"订单信息"
,
"订单1111111已付款,请发货"
);
try
{
Thread
.
sleep
(
5000
);
...
...
litemall-core/src/test/java/org/linlinjava/litemall/core/SmsTest.java
View file @
d12f3c47
...
...
@@ -2,8 +2,8 @@ package org.linlinjava.litemall.core;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.linlinjava.litemall.core.notify.
Litemall
NotifyService
;
import
org.linlinjava.litemall.core.notify.
util.ConfigUtil
;
import
org.linlinjava.litemall.core.notify.NotifyService
;
import
org.linlinjava.litemall.core.notify.
NotifyType
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
...
...
@@ -26,14 +26,14 @@ import org.springframework.test.context.web.WebAppConfiguration;
public
class
SmsTest
{
@Autowired
private
Litemall
NotifyService
litemallN
otifyService
;
private
NotifyService
n
otifyService
;
//
@Test
@Test
public
void
testSingle
()
{
String
phone
=
"xxxxxxxxxxx"
;
// 这里的短信签名必须在短信管理平台内设置正确并且相符合
String
msg
=
"【xxx】你的验证码为:123456,请与2分钟内填写,如非本人操作,请忽略本短信。"
;
litemallN
otifyService
.
notifyS
MSMessage
(
phone
,
msg
);
n
otifyService
.
notifyS
ms
(
phone
,
msg
);
try
{
Thread
.
sleep
(
5000
);
...
...
@@ -47,7 +47,7 @@ public class SmsTest {
String
phone
=
"xxxxxxxxxxx"
;
String
[]
params
=
new
String
[]
{
"123456"
};
litemallN
otifyService
.
notifyS
MS
Template
(
phone
,
ConfigUtil
.
NotifyType
.
CAPTCHA
,
params
);
n
otifyService
.
notifyS
ms
Template
(
phone
,
NotifyType
.
CAPTCHA
,
params
);
try
{
Thread
.
sleep
(
5000
);
...
...
@@ -61,7 +61,7 @@ public class SmsTest {
String
phone
=
"xxxxxxxxxxx"
;
String
[]
params
=
new
String
[]
{
"123456"
};
litemallN
otifyService
.
notifyS
MS
Template
(
phone
,
ConfigUtil
.
NotifyType
.
PAY_SUCCEED
,
params
);
n
otifyService
.
notifyS
ms
Template
(
phone
,
NotifyType
.
PAY_SUCCEED
,
params
);
try
{
Thread
.
sleep
(
5000
);
...
...
litemall-core/src/test/java/org/linlinjava/litemall/core/WxTemplateTest.java
0 → 100644
View file @
d12f3c47
package
org.linlinjava.litemall.core
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.linlinjava.litemall.core.notify.NotifyService
;
import
org.linlinjava.litemall.core.notify.NotifyType
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.context.junit4.SpringJUnit4ClassRunner
;
import
org.springframework.test.context.web.WebAppConfiguration
;
/**
*/
@WebAppConfiguration
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
public
class
WxTemplateTest
{
@Autowired
private
NotifyService
notifyService
;
@Test
public
void
testPaySucceed
()
{
String
token
=
"xx"
;
String
touser
=
"xx"
;
String
formId
=
""
;
String
[]
params
=
new
String
[]{
"xxx"
};
notifyService
.
notifyWxTemplate
(
token
,
touser
,
formId
,
NotifyType
.
PAY_SUCCEED
,
params
);
try
{
Thread
.
sleep
(
5000
);
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
}
}
litemall-os-api/src/main/java/org/linlinjava/litemall/os/config/ObjectStorageConfig.java
View file @
d12f3c47
...
...
@@ -4,7 +4,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import
org.springframework.stereotype.Component
;
@Component
@ConfigurationProperties
(
prefix
=
"
org.linlinjava.
litemall.os"
)
@ConfigurationProperties
(
prefix
=
"litemall.os"
)
public
class
ObjectStorageConfig
{
private
String
address
;
...
...
litemall-os-api/src/main/resources/application-os.yml
View file @
d12f3c47
...
...
@@ -8,5 +8,5 @@ activeStorage: los
# 开发者应该设置成自己的域名,必须附带http或者https
# 开发者可以查看OsStorageController.generateUrl
org.linlinjava.litemall.os.address
:
http://127.0.0.1
org.linlinjava.litemall.os.port
:
8081
\ No newline at end of file
litemall.os.address
:
http://127.0.0.1
litemall.os.port
:
8081
\ No newline at end of file
litemall-os-api/src/test/java/org/linlinjava/litemall/os/OsTest.java
View file @
d12f3c47
...
...
@@ -18,11 +18,11 @@ public class OsTest {
@Test
public
void
test
()
{
// 测试获取application-core.yml配置信息
System
.
out
.
println
(
environment
.
getProperty
(
"express.appId"
));
System
.
out
.
println
(
environment
.
getProperty
(
"
litemall.
express.appId"
));
// 测试获取application-db.yml配置信息
System
.
out
.
println
(
environment
.
getProperty
(
"spring.datasource.druid.url"
));
// 测试获取application-os.yml配置信息
System
.
out
.
println
(
environment
.
getProperty
(
"
org.linlinjava.
litemall.os.address"
));
System
.
out
.
println
(
environment
.
getProperty
(
"litemall.os.address"
));
// 测试获取application.yml配置信息
System
.
out
.
println
(
environment
.
getProperty
(
"logging.level.org.linlinjava.litemall.os"
));
}
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/config/WxProperties.java
View file @
d12f3c47
...
...
@@ -6,7 +6,7 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
import
org.springframework.context.annotation.Configuration
;
@Configuration
@ConfigurationProperties
(
prefix
=
"wx"
)
@ConfigurationProperties
(
prefix
=
"
litemall.
wx"
)
public
class
WxProperties
{
private
String
appId
;
...
...
litemall-wx-api/src/main/java/org/linlinjava/litemall/wx/web/WxOrderController.java
View file @
d12f3c47
...
...
@@ -9,8 +9,8 @@ import com.github.binarywang.wxpay.service.WxPayService;
import
org.apache.commons.io.IOUtils
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.linlinjava.litemall.core.notify.
Litemall
NotifyService
;
import
org.linlinjava.litemall.core.notify.
util.ConfigUtil
;
import
org.linlinjava.litemall.core.notify.NotifyService
;
import
org.linlinjava.litemall.core.notify.
NotifyType
;
import
org.linlinjava.litemall.core.util.JacksonUtil
;
import
org.linlinjava.litemall.core.util.ResponseUtil
;
import
org.linlinjava.litemall.db.domain.*
;
...
...
@@ -82,7 +82,7 @@ public class WxOrderController {
private
WxPayService
wxPayService
;
@Autowired
private
Litemall
NotifyService
litemallN
otifyService
;
private
NotifyService
n
otifyService
;
public
WxOrderController
()
{
}
...
...
@@ -553,12 +553,12 @@ public class WxOrderController {
//TODO 发送邮件和短信通知,这里采用异步发送
// 订单支付成功以后,会发送短信给用户,以及发送邮件给管理员
litemallN
otifyService
.
notifyMail
Message
(
"新订单通知"
,
order
.
toString
());
n
otifyService
.
notifyMail
(
"新订单通知"
,
order
.
toString
());
/**
* 这里微信的短信平台对参数长度有限制,所以将订单号只截取后6位
*
*/
litemallN
otifyService
.
notifyS
MS
Template
(
order
.
getMobile
(),
ConfigUtil
.
NotifyType
.
PAY_SUCCEED
,
new
String
[]{
orderSn
.
substring
(
8
,
14
)});
n
otifyService
.
notifyS
ms
Template
(
order
.
getMobile
(),
NotifyType
.
PAY_SUCCEED
,
new
String
[]{
orderSn
.
substring
(
8
,
14
)});
return
WxPayNotifyResponse
.
success
(
"处理成功!"
);
}
catch
(
Exception
e
)
{
...
...
@@ -607,7 +607,7 @@ public class WxOrderController {
//TODO 发送邮件和短信通知,这里采用异步发送
// 有用户申请退款,邮件通知运营人员
litemallN
otifyService
.
notifyMail
Message
(
"退款申请"
,
order
.
toString
());
n
otifyService
.
notifyMail
(
"退款申请"
,
order
.
toString
());
return
ResponseUtil
.
ok
();
}
...
...
litemall-wx-api/src/main/resources/application-docker.yml
View file @
d12f3c47
...
...
@@ -6,9 +6,10 @@ spring:
password
:
${MYSQL_PASSWORD}
type
:
com.alibaba.druid.pool.DruidDataSource
wx
:
app-id
:
${WX_APP_ID}
app-secret
:
${WX_APP_SECRET}
mch-id
:
${WX_MCH_ID}
mch-key
:
${WX_MCH_KEY}
notify-url
:
${WX_NOTIFY_URL}
\ No newline at end of file
litemall
:
wx
:
app-id
:
${WX_APP_ID}
app-secret
:
${WX_APP_SECRET}
mch-id
:
${WX_MCH_ID}
mch-key
:
${WX_MCH_KEY}
notify-url
:
${WX_NOTIFY_URL}
\ No newline at end of file
litemall-wx-api/src/main/resources/application-wx.yml
View file @
d12f3c47
# 开发者应该设置成自己的wx相关信息
wx
:
app-id
:
wxa5b486c6b918ecfb
app-secret
:
e04004829d4c383b4db7769d88dfbca1
mch-id
:
111111
mch-key
:
xxxxxx
notify-url
:
http://www.example.com/wx/order/pay-notify
\ No newline at end of file
litemall
:
wx
:
app-id
:
wxa5b486c6b918ecfb
app-secret
:
e04004829d4c383b4db7769d88dfbca1
mch-id
:
111111
mch-key
:
xxxxxx
notify-url
:
http://www.example.com/wx/order/pay-notify
\ No newline at end of file
litemall-wx-api/src/test/java/org/linlinjava/litemall/wx/WxConfigTest.java
View file @
d12f3c47
...
...
@@ -20,11 +20,11 @@ public class WxConfigTest {
@Test
public
void
test
()
{
// 测试获取application-core.yml配置信息
System
.
out
.
println
(
environment
.
getProperty
(
"express.appId"
));
System
.
out
.
println
(
environment
.
getProperty
(
"
litemall.
express.appId"
));
// 测试获取application-db.yml配置信息
System
.
out
.
println
(
environment
.
getProperty
(
"spring.datasource.druid.url"
));
// 测试获取application-wx.yml配置信息
System
.
out
.
println
(
environment
.
getProperty
(
"wx.app-id"
));
System
.
out
.
println
(
environment
.
getProperty
(
"
litemall.
wx.app-id"
));
// 测试获取application.yml配置信息
System
.
out
.
println
(
environment
.
getProperty
(
"logging.level.org.linlinjava.litemall.wx"
));
}
...
...
Prev
1
2
Next
Write
Preview
Supports
Markdown
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