Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
payment
Project
Project
Details
Activity
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
曲欣亮
payment
Commits
53ec7e65
Commit
53ec7e65
authored
Oct 15, 2018
by
zhangyong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
7c795ff3
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
1757 additions
and
8 deletions
+1757
-8
pom.xml
pom.xml
+20
-0
PaymentApplication.java
src/main/java/com/egolm/payment/PaymentApplication.java
+0
-2
SwaggerConfig.java
src/main/java/com/egolm/payment/config/SwaggerConfig.java
+1
-1
WxApiController.java
...in/java/com/egolm/payment/controller/WxApiController.java
+4
-4
WxMiniApiController.java
...ava/com/egolm/payment/controller/WxMiniApiController.java
+347
-0
WxPayNotifyController.java
...a/com/egolm/payment/controller/WxPayNotifyController.java
+113
-0
WxPayResponse.java
src/main/java/com/egolm/payment/entiry/WxPayResponse.java
+693
-0
SystemCtrlService.java
...ain/java/com/egolm/payment/service/SystemCtrlService.java
+7
-0
WxChatService.java
src/main/java/com/egolm/payment/service/WxChatService.java
+14
-0
SystemCtrlServiceImpl.java
...com/egolm/payment/service/impl/SystemCtrlServiceImpl.java
+37
-0
WeChatServiceImpl.java
...ava/com/egolm/payment/service/impl/WeChatServiceImpl.java
+184
-0
MD5Util.java
src/main/java/com/egolm/payment/util/MD5Util.java
+42
-0
PayContstrant.java
src/main/java/com/egolm/payment/util/PayContstrant.java
+9
-0
SAXXmlContentHandler.java
...ain/java/com/egolm/payment/util/SAXXmlContentHandler.java
+64
-0
WxApiXmlComer.java
src/main/java/com/egolm/payment/util/WxApiXmlComer.java
+124
-0
WxSignUtil.java
src/main/java/com/egolm/payment/util/WxSignUtil.java
+80
-0
application-dev.properties
src/main/resources/application-dev.properties
+18
-1
No files found.
pom.xml
View file @
53ec7e65
...
...
@@ -26,6 +26,7 @@
<artifactId>
spring-boot-devtools
</artifactId>
<optional>
true
</optional>
</dependency>
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
...
...
@@ -40,11 +41,20 @@
<artifactId>
fastjson
</artifactId>
<version>
1.2.38
</version>
</dependency>
<dependency>
<groupId>
org.springframework.security
</groupId>
<artifactId>
spring-security-core
</artifactId>
<version>
4.0.4.RELEASE
</version>
</dependency>
<dependency>
<groupId>
com.egolm
</groupId>
<artifactId>
common
</artifactId>
<version>
0.0.1-RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid
</artifactId>
...
...
@@ -64,6 +74,16 @@
<groupId>
net.sf.ehcache
</groupId>
<artifactId>
ehcache
</artifactId>
</dependency>
<dependency>
<groupId>
org.jdom
</groupId>
<artifactId>
jdom
</artifactId>
<version>
2.0.2
</version>
</dependency>
<dependency>
<groupId>
com.thoughtworks.xstream
</groupId>
<artifactId>
xstream
</artifactId>
<version>
1.4.1
</version>
</dependency>
</dependencies>
<build>
<plugins>
...
...
src/main/java/com/egolm/payment/PaymentApplication.java
View file @
53ec7e65
...
...
@@ -4,7 +4,6 @@ import org.springframework.boot.SpringApplication;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cache.annotation.EnableCaching
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.annotation.ComponentScan
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
...
...
@@ -13,7 +12,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2
@SpringBootApplication
@EnableTransactionManagement
@ComponentScan
(
basePackages
=
{
"com.egolm.payment.alipay,com.egolm.payment.wxpay"
})
//包名
public
class
PaymentApplication
{
private
static
ApplicationContext
applicationContext
;
...
...
src/main/java/com/egolm/payment/config/SwaggerConfig.java
View file @
53ec7e65
...
...
@@ -18,7 +18,7 @@ public class SwaggerConfig {
return
new
Docket
(
DocumentationType
.
SWAGGER_2
)
.
apiInfo
(
apiInfo
())
.
select
()
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.egolm.
msc
"
))
.
apis
(
RequestHandlerSelectors
.
basePackage
(
"com.egolm.
payment
"
))
.
paths
(
PathSelectors
.
any
())
.
build
();
}
...
...
src/main/java/com/egolm/payment/
wxpay/controller/WXTest
Controller.java
→
src/main/java/com/egolm/payment/
controller/WxApi
Controller.java
View file @
53ec7e65
package
com
.
egolm
.
payment
.
wxpay
.
controller
;
package
com
.
egolm
.
payment
.
controller
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -11,10 +11,10 @@ import io.swagger.annotations.Api;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
@Api
(
tags
={
"微信
测试
管理"
})
@Api
(
tags
={
"微信
公众号接口
管理"
})
@RestController
@RequestMapping
(
"wx
pay
"
)
public
class
W
XTest
Controller
{
@RequestMapping
(
"wx"
)
public
class
W
xApi
Controller
{
@ApiOperation
(
"测试"
)
@ApiImplicitParams
({
...
...
src/main/java/com/egolm/payment/controller/WxMiniApiController.java
0 → 100644
View file @
53ec7e65
package
com
.
egolm
.
payment
.
controller
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.SortedMap
;
import
java.util.TreeMap
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.alibaba.fastjson.JSONObject
;
import
com.egolm.common.DateUtil
;
import
com.egolm.common.StringUtil
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.web.ServletUtil
;
import
com.egolm.payment.service.WxChatService
;
import
com.egolm.payment.util.PayContstrant
;
import
com.egolm.payment.util.WxSignUtil
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
@Api
(
tags
={
"微信小程序接口管理"
})
@RestController
@RequestMapping
(
"wxMini"
)
public
class
WxMiniApiController
{
private
static
final
Log
logger
=
LogFactory
.
getLog
(
WxMiniApiController
.
class
);
@Autowired
private
WxChatService
wxChatService
;
/**
*
* <p>Title: 微信小程序获取openid </p>
* <p>Description: </p>
* @param request
* @param response
* @return
*/
@ApiOperation
(
"微信小程序获取openid"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"code"
,
dataType
=
"String"
,
required
=
true
,
value
=
"微信提供的code"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"terminal"
,
dataType
=
"String"
,
required
=
false
,
value
=
"终端标识"
,
defaultValue
=
"wechat"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"langID"
,
dataType
=
"String"
,
required
=
false
,
value
=
"语言"
,
defaultValue
=
"936"
),
})
@RequestMapping
(
value
=
"/getOpenid"
,
method
=
RequestMethod
.
GET
)
public
String
getOpenId
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
String
code
=
request
.
getParameter
(
"code"
);
String
terminal
=
request
.
getParameter
(
"terminal"
);
String
langID
=
request
.
getParameter
(
"langID"
);
logger
.
info
(
terminal
+
" 获取openid时 code 为:"
+
code
);
if
(!
StringUtil
.
isNotEmpty
(
code
,
terminal
,
langID
))
{
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"参数不能为空"
).
toJson
();
}
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
Object
>
systemCtrlMap
=
wxChatService
.
loadAppID
(
PayContstrant
.
WX_MINI_APP_KEY
,
langID
);
if
(
systemCtrlMap
!=
null
)
{
params
.
put
(
"appid"
,
systemCtrlMap
.
get
(
"sValue1"
)+
""
);
params
.
put
(
"secret"
,
systemCtrlMap
.
get
(
"sValue2"
)+
""
);
}
else
{
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"openId获取失败"
).
set
(
"errorMsg"
,
"数据字典参数未配置"
).
toJson
();
}
params
.
put
(
"js_code"
,
code
);
params
.
put
(
"grant_type"
,
"authorization_code"
);
String
openIdStr
=
wxChatService
.
getWxOpenId
(
params
);
JSONObject
openJsonObject
=
JSONObject
.
parseObject
(
openIdStr
);
if
(
openJsonObject
.
containsKey
(
"openid"
)){
String
openId
=
openJsonObject
.
getString
(
"openid"
);
return
Rjx
.
jsonOk
().
set
(
"openId"
,
openId
).
toJson
();
}
String
errcode
=
openJsonObject
.
getString
(
"errcode"
);
String
errmsg
=
openJsonObject
.
getString
(
"errmsg"
);
return
Rjx
.
jsonErr
().
set
(
"errcode"
,
errcode
).
set
(
"errmsg"
,
errmsg
).
toJson
();
}
/**
*
* <p>Title: 微信統一下单接口 </p>
* <p>Description: https://pay.weixin.qq.com/wiki/doc/api/wxa/wxa_api.php?chapter=9_1&index=1 </p>
* 传参请按微信API的参数属性名传值
* @param request
* @param response
* @return
*/
@ApiOperation
(
"微信統一下单接口"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"terminal"
,
dataType
=
"String"
,
required
=
false
,
value
=
"终端标识"
,
defaultValue
=
"wechat"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"langID"
,
dataType
=
"String"
,
required
=
false
,
value
=
"语言"
,
defaultValue
=
"936"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"body"
,
dataType
=
"String"
,
required
=
true
,
value
=
"商品描述"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"detail"
,
dataType
=
"String"
,
required
=
false
,
value
=
"商品详情"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"out_trade_no"
,
dataType
=
"String"
,
required
=
true
,
value
=
"商户订单号"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"total_fee"
,
dataType
=
"String"
,
required
=
true
,
value
=
"总金额(分)"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"openid"
,
dataType
=
"String"
,
required
=
false
,
value
=
"用户标识"
,
defaultValue
=
""
)
})
@RequestMapping
(
value
=
"/unifiedorder"
,
method
=
RequestMethod
.
GET
)
public
String
unifiedorder
(
HttpServletRequest
request
,
HttpServletResponse
response
){
try
{
String
terminal
=
request
.
getParameter
(
"terminal"
);
String
langID
=
request
.
getParameter
(
"langID"
);
SortedMap
<
Object
,
Object
>
params
=
new
TreeMap
<
Object
,
Object
>();
String
appid
=
""
;
String
md5Key
=
""
;
Map
<
String
,
Object
>
systemCtrlMap
=
wxChatService
.
loadAppID
(
PayContstrant
.
WX_MINI_APP_KEY
,
langID
);
if
(
systemCtrlMap
!=
null
)
{
appid
=
systemCtrlMap
.
get
(
"sValue1"
)+
""
;
String
mch_id
=
systemCtrlMap
.
get
(
"sValue3"
)+
""
;
String
notify_url
=
systemCtrlMap
.
get
(
"sValue4"
)+
""
;
md5Key
=
systemCtrlMap
.
get
(
"sValue5"
)+
""
;
params
.
put
(
"appid"
,
appid
);
params
.
put
(
"mch_id"
,
mch_id
);
params
.
put
(
"notify_url"
,
notify_url
);
params
.
put
(
"md5Key"
,
md5Key
);
if
(!
StringUtil
.
isNotEmpty
(
appid
,
mch_id
,
notify_url
,
md5Key
))
{
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"支付失败"
).
set
(
"errorMsg"
,
"数据字典参数配置不完整"
).
toJson
();
}
}
else
{
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"支付失败"
).
set
(
"errorMsg"
,
"数据字典参数未配置"
).
toJson
();
}
params
.
put
(
"nonce_str"
,
StringUtil
.
getNonceStr
());
params
.
put
(
"sign_type"
,
"MD5"
);
params
.
put
(
"fee_type"
,
"CNY"
);
params
.
put
(
"spbill_create_ip"
,
ServletUtil
.
getLocalIP
());
params
.
put
(
"trade_type"
,
"JSAPI"
);
params
.
put
(
"body"
,
request
.
getParameter
(
"body"
)==
null
?
""
:
request
.
getParameter
(
"body"
));
params
.
put
(
"detail"
,
request
.
getParameter
(
"detail"
)==
null
?
""
:
request
.
getParameter
(
"detail"
));
params
.
put
(
"out_trade_no"
,
request
.
getParameter
(
"out_trade_no"
)==
null
?
""
:
request
.
getParameter
(
"out_trade_no"
));
params
.
put
(
"total_fee"
,
request
.
getParameter
(
"total_fee"
)==
null
?
""
:
request
.
getParameter
(
"total_fee"
));
params
.
put
(
"openid"
,
request
.
getParameter
(
"openid"
)==
null
?
""
:
request
.
getParameter
(
"openid"
));
Map
<
String
,
String
>
resultMap
=
wxChatService
.
unifiedorder
(
params
);
String
return_code
=
resultMap
.
get
(
"return_code"
);
String
result_code
=
resultMap
.
get
(
"result_code"
);
if
(
return_code
.
equals
(
"SUCCESS"
)
&&
result_code
.
equals
(
"SUCCESS"
)){
//返回前端支付需要的参数
String
return_sign
=
resultMap
.
get
(
"sign"
);
// 返回的签名
resultMap
.
put
(
"md5Key"
,
md5Key
);
if
(!
WxSignUtil
.
checkSign
(
resultMap
,
return_sign
)){
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"微信下单失败"
).
set
(
"errorMsg"
,
"返回结果签名不一致"
).
toJson
();
}
String
prepay_id
=
resultMap
.
get
(
"prepay_id"
);
String
trade_type
=
resultMap
.
get
(
"trade_type"
);
String
packageStr
=
"prepay_id="
+
prepay_id
;
String
payNonceStr
=
StringUtil
.
getNonceStr
();
String
timeStampStr
=
DateUtil
.
getTimeStamp
();
SortedMap
<
Object
,
Object
>
payParams
=
new
TreeMap
<
Object
,
Object
>();
payParams
.
put
(
"appId"
,
appid
);
payParams
.
put
(
"timeStamp"
,
timeStampStr
);
payParams
.
put
(
"nonceStr"
,
payNonceStr
);
payParams
.
put
(
"package"
,
packageStr
);
payParams
.
put
(
"signType"
,
"MD5"
);
payParams
.
put
(
"md5Key"
,
md5Key
);
String
paySign
=
WxSignUtil
.
createSign
(
payParams
);
return
Rjx
.
jsonOk
().
set
(
"package"
,
packageStr
).
set
(
"trade_type"
,
trade_type
).
set
(
"nonceStr"
,
payNonceStr
).
set
(
"timeStamp"
,
timeStampStr
).
set
(
"paySign"
,
paySign
).
toJson
();
}
if
(
return_code
.
equals
(
"FAIL"
)){
String
return_msg
=
resultMap
.
get
(
"return_msg"
);
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"微信下单失败"
).
set
(
"errorMsg"
,
return_msg
).
toJson
();
}
if
(
return_code
.
equals
(
"SUCCESS"
)
&&
result_code
.
equals
(
"FAIL"
)){
String
err_code
=
resultMap
.
get
(
"err_code"
);
String
err_code_des
=
resultMap
.
get
(
"err_code_des"
);
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"微信下单失败"
).
set
(
"errorMsg"
,
err_code
).
set
(
"err_code_des"
,
err_code_des
).
toJson
();
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"微信下单失败"
).
set
(
"errorMsg"
,
"生成预支付订单异常"
).
toJson
();
}
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"微信下单失败"
).
toJson
();
}
/**
* 申请退款
* <p>Title: https://api.mch.weixin.qq.com/secapi/pay/refund</p>
* <p>Description: </p>
* @param request
* @param response
* @return
*/
@ApiOperation
(
"申请退款"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"terminal"
,
dataType
=
"String"
,
required
=
false
,
value
=
"终端标识"
,
defaultValue
=
"wechat"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"langID"
,
dataType
=
"String"
,
required
=
false
,
value
=
"语言"
,
defaultValue
=
"936"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"transaction_id"
,
dataType
=
"String"
,
required
=
true
,
value
=
"微信订单号"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"out_trade_no"
,
dataType
=
"String"
,
required
=
false
,
value
=
"商户订单号"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"out_refund_no"
,
dataType
=
"String"
,
required
=
true
,
value
=
"商户退款单号"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"total_fee"
,
dataType
=
"String"
,
required
=
true
,
value
=
"订单金额(分)"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"refund_fee"
,
dataType
=
"String"
,
required
=
false
,
value
=
"申请退款金额(分)"
,
defaultValue
=
""
),
})
@RequestMapping
(
value
=
"/refund"
,
method
=
RequestMethod
.
GET
)
public
String
refund
(
HttpServletRequest
request
,
HttpServletResponse
response
){
try
{
String
terminal
=
request
.
getParameter
(
"terminal"
);
String
langID
=
request
.
getParameter
(
"langID"
);
SortedMap
<
Object
,
Object
>
params
=
new
TreeMap
<
Object
,
Object
>();
String
appid
=
""
;
String
mch_id
=
""
;
String
md5Key
=
""
;
Map
<
String
,
Object
>
systemCtrlMap
=
wxChatService
.
loadAppID
(
PayContstrant
.
WX_MINI_APP_KEY
,
langID
);
if
(
systemCtrlMap
!=
null
)
{
appid
=
systemCtrlMap
.
get
(
"sValue1"
)+
""
;
mch_id
=
systemCtrlMap
.
get
(
"sValue3"
)+
""
;
md5Key
=
systemCtrlMap
.
get
(
"sValue5"
)+
""
;
if
(!
StringUtil
.
isNotEmpty
(
appid
,
mch_id
,
md5Key
))
{
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"支付失败"
).
set
(
"errorMsg"
,
"数据字典参数配置不完整"
).
toJson
();
}
}
else
{
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"支付失败"
).
set
(
"errorMsg"
,
"数据字典参数未配置"
).
toJson
();
}
params
.
put
(
"appid"
,
appid
);
params
.
put
(
"mch_id"
,
mch_id
);
params
.
put
(
"md5Key"
,
md5Key
);
params
.
put
(
"nonce_str"
,
StringUtil
.
getNonceStr
());
//随机字符串
params
.
put
(
"sign_type"
,
"MD5"
);
params
.
put
(
"transaction_id"
,
request
.
getParameter
(
"transaction_id"
)==
null
?
""
:
request
.
getParameter
(
"transaction_id"
));
params
.
put
(
"out_trade_no"
,
request
.
getParameter
(
"out_trade_no"
)==
null
?
""
:
request
.
getParameter
(
"out_trade_no"
));
params
.
put
(
"out_refund_no"
,
request
.
getParameter
(
"out_refund_no"
)==
null
?
""
:
request
.
getParameter
(
"out_refund_no"
));
params
.
put
(
"total_fee"
,
request
.
getParameter
(
"total_fee"
)==
null
?
""
:
request
.
getParameter
(
"total_fee"
));
params
.
put
(
"refund_fee"
,
request
.
getParameter
(
"refund_fee"
)==
null
?
""
:
request
.
getParameter
(
"refund_fee"
));
Map
<
String
,
String
>
resultMap
=
wxChatService
.
refund
(
params
);
String
return_code
=
resultMap
.
get
(
"return_code"
);
String
result_code
=
resultMap
.
get
(
"result_code"
);
if
(
return_code
.
equals
(
"SUCCESS"
)
&&
result_code
.
equals
(
"SUCCESS"
)){
//返回前端支付需要的参数
String
return_sign
=
resultMap
.
get
(
"sign"
);
// 返回的签名
resultMap
.
put
(
"md5Key"
,
md5Key
);
if
(!
WxSignUtil
.
checkSign
(
resultMap
,
return_sign
)){
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"退款失败"
).
set
(
"errorMsg"
,
"返回结果签名不一致"
).
toJson
();
}
return
Rjx
.
jsonOk
().
setMessage
(
"微信退款成功"
).
toJson
();
}
if
(
return_code
.
equals
(
"FAIL"
)){
String
return_msg
=
resultMap
.
get
(
"return_msg"
);
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"退款失败"
).
set
(
"errorMsg"
,
return_msg
).
toJson
();
}
if
(
return_code
.
equals
(
"SUCCESS"
)
&&
result_code
.
equals
(
"FAIL"
)){
String
err_code
=
resultMap
.
get
(
"err_code"
);
String
err_code_des
=
resultMap
.
get
(
"err_code_des"
);
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"退款失败"
).
set
(
"err_code"
,
err_code
).
set
(
"errorMsg"
,
err_code_des
).
toJson
();
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
@ApiOperation
(
"获取微信支付流水号(没做完)"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"terminal"
,
dataType
=
"String"
,
required
=
true
,
value
=
"终端标识"
,
defaultValue
=
"wechat"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"langID"
,
dataType
=
"String"
,
required
=
true
,
value
=
"语言"
,
defaultValue
=
"936"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"orderId"
,
dataType
=
"String"
,
required
=
true
,
value
=
"订单号"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"status"
,
dataType
=
"String"
,
required
=
true
,
value
=
"查询状态(PAY,REFUND)"
,
defaultValue
=
""
)
})
@RequestMapping
(
value
=
"/getWxPayFlow"
,
method
=
RequestMethod
.
GET
)
public
String
getWxPayFlow
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
String
terminal
=
request
.
getParameter
(
"terminal"
);
String
langID
=
request
.
getParameter
(
"langID"
);
String
orderId
=
request
.
getParameter
(
"orderId"
);
String
status
=
request
.
getParameter
(
"status"
);
if
(!
StringUtil
.
isNotEmpty
(
terminal
,
langID
,
orderId
,
status
)){
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"参数不能为空"
).
toJson
();
}
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
params
.
put
(
"orderId"
,
orderId
);
params
.
put
(
"status"
,
status
);
try
{
/*WxPayFlow wxPayFlow = wxApiService.getWxPayFlow(params);
if(wxPayFlow == null){
wxPayFlow = new WxPayFlow();
}
Map<String,Object> resultMap = new HashMap<String,Object>();
resultMap.put("orderId", wxPayFlow.getOrderid()==null?"":wxPayFlow.getOrderid());
resultMap.put("status", wxPayFlow.getStatus()==null?"":wxPayFlow.getStatus());
resultMap.put("transactionid", wxPayFlow.getTransactionid()==null?"":wxPayFlow.getTransactionid());
resultMap.put("totalFee", wxPayFlow.getTotalfee()==null?0:wxPayFlow.getTotalfee());
resultMap.put("refundId", wxPayFlow.getRefundid()==null?"":wxPayFlow.getRefundid());
resultMap.put("refundFee", wxPayFlow.getRefundfee()==null?0:wxPayFlow.getRefundfee());
resultMap.put("cashFee", wxPayFlow.getCashfee()==null?0:wxPayFlow.getCashfee());
resultMap.put("couponRefundCount", wxPayFlow.getCouponrefundcount()==null?0:wxPayFlow.getCouponrefundcount());
resultMap.put("cashRefundFee", wxPayFlow.getCashrefundfee()==null?0:wxPayFlow.getCashrefundfee());*/
return
Rjx
.
jsonOk
().
toJson
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"查询异常"
).
toJson
();
}
}
}
src/main/java/com/egolm/payment/controller/WxPayNotifyController.java
0 → 100644
View file @
53ec7e65
package
com
.
egolm
.
payment
.
controller
;
import
java.util.Date
;
import
javax.servlet.ServletInputStream
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.alibaba.fastjson.JSONObject
;
import
com.egolm.common.StringUtil
;
import
com.egolm.payment.entiry.WxPayResponse
;
import
com.thoughtworks.xstream.XStream
;
import
com.thoughtworks.xstream.io.xml.DomDriver
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
@Api
(
tags
={
"微信支付回调 事件控制器"
})
@RestController
@RequestMapping
(
"notify"
)
public
class
WxPayNotifyController
{
protected
final
Logger
logger
=
LoggerFactory
.
getLogger
(
WxPayNotifyController
.
class
);
/**
*
* <p>Title: 微信回調</p>
* <p>Description: </p>
* @param req
* @param resp
*/
@ApiOperation
(
"微信支付回调通知接口"
)
@RequestMapping
(
value
=
"/wxMiniJsApiNotify"
,
method
=
RequestMethod
.
POST
)
public
String
jsApiPayNotify
(
HttpServletRequest
req
,
HttpServletResponse
resp
){
Date
startTime
=
new
Date
();
WxPayResponse
postData
=
null
;
try
{
//postData = PayApiXmlConver.toRequestBean(req,postData);
ServletInputStream
in
=
req
.
getInputStream
();
// 转换微信post过来的xml内容
XStream
xs
=
new
XStream
(
new
DomDriver
());
xs
.
alias
(
"xml"
,
WxPayResponse
.
class
);
String
xmlMsg
=
StringUtil
.
inputStream2String
(
in
);
postData
=
(
WxPayResponse
)
xs
.
fromXML
(
xmlMsg
);
String
appid
=
postData
.
getAppid
();
Date
endTime
=
new
Date
();
try
{
//添加日志
/* WxApiLog wxApiLog = new WxApiLog();
wxApiLog.setPaytypeid(payTypeId);
wxApiLog.setPaytype(payTpye);
wxApiLog.setRequestXml("");
wxApiLog.setResponseXml(xmlMsg);
wxApiLog.setStarttime(startTime);
wxApiLog.setEndtime(endTime);
wxApiLog.setLogcode("jsApiNotify");
wxApiLog.setLogname("微信支付回调");
wxApiLog.setOutTradeNo(postData.getOut_trade_no());
wxApiLog.setTransactionId(postData.getTransaction_id());
wxApiLogService.insert(wxApiLog);*/
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
try
{
/*WxPayFlow wxPayFlow = new WxPayFlow();
String refundId = postData.getRefund_id();
wxPayFlow.setPaytypeid(payTypeId);
wxPayFlow.setPaytype(payTpye);
wxPayFlow.setAppid(appid);
wxPayFlow.setOrderid(postData.getOut_trade_no());
wxPayFlow.setTotalfee(postData.getTotal_fee().intValue());
if(StringUtil.isNotEmpty(refundId)){
wxPayFlow.setStatus("REFUND");
wxPayFlow.setStatusdesc("退款");
}else{
wxPayFlow.setStatus("PAY");
wxPayFlow.setStatusdesc("支付");
}
wxPayFlow.setErrorcode(postData.getErr_code());
wxPayFlow.setErrormsg(postData.getErr_code_des());
wxPayFlow.setTransactionid(postData.getTransaction_id());
wxPayFlow.setRefundid(postData.getRefund_id());
wxPayFlow.setRefundfee(StringUtil.isNotEmpty(postData.getRefund_fee())?Integer.valueOf(postData.getRefund_fee()):0);
wxPayFlow.setCashfee(postData.getCash_fee().intValue());
wxPayFlow.setCouponrefundcount(StringUtil.isNotEmpty(postData.getCoupon_refund_count())?Integer.valueOf(postData.getCoupon_refund_count()):0);
wxPayFlow.setCashrefundfee(StringUtil.isNotEmpty(postData.getCash_refund_fee())?Integer.valueOf(postData.getCash_refund_fee()):0);
wxPayFlowService.insert(wxPayFlow);*/
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
logger
.
info
(
"收到微信的回调結果---"
+
xmlMsg
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
"收到"
;
}
}
src/main/java/com/egolm/payment/entiry/WxPayResponse.java
0 → 100644
View file @
53ec7e65
package
com
.
egolm
.
payment
.
entiry
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlRootElement
;
import
com.thoughtworks.xstream.annotations.XStreamAlias
;
/**
* @Title: 微信支付返回
* @Description: https://pay.weixin.qq.com/wiki/doc/api/micropay.php?chapter=
* 9_10 &index=1
* @author 張永
* @date 2016年8月10
* @version V1.0
*
*/
@XmlRootElement
(
name
=
"xml"
)
@XmlAccessorType
(
XmlAccessType
.
FIELD
)
public
class
WxPayResponse
implements
Serializable
{
/**
*
*/
private
static
final
long
serialVersionUID
=
-
4871369633747793198L
;
@XStreamAlias
(
"order_flow_no"
)
private
String
order_flow_no
;
// 订单流水号
@XStreamAlias
(
"appid"
)
private
String
appid
;
// 调用接口提交的公众账号ID
@XStreamAlias
(
"mch_id"
)
private
String
mch_id
;
// 商户号
@XStreamAlias
(
"sub_mch_id"
)
private
String
sub_mch_id
;
// 子商户号
@XStreamAlias
(
"sub_appid"
)
private
String
sub_appid
;
// 子商户公众账号ID
@XStreamAlias
(
"sub_openid"
)
private
String
sub_openid
;
// 用户子标识
@XStreamAlias
(
"device_info"
)
private
String
device_info
;
// 设备号
@XStreamAlias
(
"nonce_str"
)
private
String
nonce_str
;
// 随机字符串
@XStreamAlias
(
"sign"
)
private
String
sign
;
// 签名
@XStreamAlias
(
"result_code"
)
private
String
result_code
;
// 业务结果
@XStreamAlias
(
"err_code"
)
private
String
err_code
;
// 错误代码
@XStreamAlias
(
"err_code_des"
)
private
String
err_code_des
;
// 错误代码描述
@XStreamAlias
(
"openid"
)
private
String
openid
;
// 用户标识
@XStreamAlias
(
"is_subscribe"
)
private
String
is_subscribe
;
// 是否关注公众账号
@XStreamAlias
(
"trade_type"
)
private
String
trade_type
;
// 交易类型
@XStreamAlias
(
"bank_type"
)
private
String
bank_type
;
// 付款银行
@XStreamAlias
(
"fee_type"
)
private
String
fee_type
;
// 货币类型
@XStreamAlias
(
"total_fee"
)
private
BigDecimal
total_fee
;
// 总金额
@XStreamAlias
(
"cash_fee_type"
)
private
String
cash_fee_type
;
// 现金支付货币类型
@XStreamAlias
(
"cash_fee"
)
private
BigDecimal
cash_fee
;
// 现金支付金额
@XStreamAlias
(
"coupon_fee"
)
private
BigDecimal
coupon_fee
;
// 代金券或立减优惠金额
@XStreamAlias
(
"transaction_id"
)
private
String
transaction_id
;
// 微信支付订单号
@XStreamAlias
(
"out_trade_no"
)
private
String
out_trade_no
;
// 商户订单号
@XStreamAlias
(
"attach"
)
private
String
attach
;
// 商家数据包
@XStreamAlias
(
"time_end"
)
private
String
time_end
;
// 支付完成时间
@XStreamAlias
(
"sub_is_subscribe"
)
private
String
sub_is_subscribe
;
// 是否关注子公众账号
@XStreamAlias
(
"return_code"
)
private
String
return_code
;
// 返回状态码 SUCCESS/FAIL
// 此字段是通信标识,非交易标识,交易是否成功需要查看result_code来判断
@XStreamAlias
(
"return_msg"
)
private
String
return_msg
;
// 返回信息
@XStreamAlias
(
"auth_code"
)
private
String
auth_code
;
// 扫码支付授权码,设备读取用户微信中的条码或者二维码信息
@XStreamAlias
(
"operator_no"
)
private
String
operator_no
;
// 交易发起人在平台内的标识,如司机APP则operatorNo是APP的登录用户名
@XStreamAlias
(
"server_host"
)
private
String
server_host
;
// 处理交易订单的服务器的IP地址
@XStreamAlias
(
"start_time"
)
private
String
start_time
;
// 交易开始时间
@XStreamAlias
(
"randByNum"
)
private
String
randByNum
;
// 交易订单随机码
@XStreamAlias
(
"body"
)
private
String
body
;
// 商品或支付单简要描述
// 交易流水查询时返回
@XStreamAlias
(
"trade_state"
)
private
String
trade_state
;
// 交易状态
@XStreamAlias
(
"trade_state_desc"
)
private
String
trade_state_desc
;
// 交易状态描述
@XStreamAlias
(
"tradeTypeDesc"
)
private
String
tradeTypeDesc
;
@XStreamAlias
(
"recall"
)
private
String
recall
;
// 发起刷卡支付撤销订单时返回,是否需要继续调用撤销,Y-需要,N-不需要
@XStreamAlias
(
"flow_type"
)
private
String
flow_type
;
// 交易流水类型 --PAY 支付, --QUERY 查询, --REVERSE 撤单
@XStreamAlias
(
"out_refund_no"
)
private
String
out_refund_no
;
// 商户退款单号
@XStreamAlias
(
"refund_id"
)
private
String
refund_id
;
// 微信退款单号
@XStreamAlias
(
"refund_fee"
)
private
String
refund_fee
;
// 申请退款金额
@XStreamAlias
(
"refund_channel"
)
private
String
refund_channel
;
@XStreamAlias
(
"coupon_refund_fee"
)
private
String
coupon_refund_fee
;
@XStreamAlias
(
"coupon_refund_count"
)
private
String
coupon_refund_count
;
@XStreamAlias
(
"cash_refund_fee"
)
private
String
cash_refund_fee
;
@XStreamAlias
(
"product_id"
)
private
String
product_id
;
@XStreamAlias
(
"coupon_count"
)
private
String
coupon_count
;
@XStreamAlias
(
"coupon_fee_0"
)
private
String
coupon_fee_0
;
@XStreamAlias
(
"coupon_id_0"
)
private
String
coupon_id_0
;
@XStreamAlias
(
"coupon_fee_1"
)
private
String
coupon_fee_1
;
@XStreamAlias
(
"coupon_id_1"
)
private
String
coupon_id_1
;
@XStreamAlias
(
"coupon_fee_2"
)
private
String
coupon_fee_2
;
@XStreamAlias
(
"coupon_id_2"
)
private
String
coupon_id_2
;
@XStreamAlias
(
"coupon_fee_3"
)
private
String
coupon_fee_3
;
@XStreamAlias
(
"coupon_id_3"
)
private
String
coupon_id_3
;
@XStreamAlias
(
"prepay_id"
)
private
String
prepay_id
;
@XStreamAlias
(
"code_url"
)
private
String
code_url
;
@XStreamAlias
(
"coupon_refund_fee_0"
)
private
String
coupon_refund_fee_0
;
@XStreamAlias
(
"coupon_refund_id_0"
)
private
String
coupon_refund_id_0
;
public
String
getCoupon_refund_fee_0
()
{
return
coupon_refund_fee_0
;
}
public
void
setCoupon_refund_fee_0
(
String
coupon_refund_fee_0
)
{
this
.
coupon_refund_fee_0
=
coupon_refund_fee_0
;
}
public
String
getCoupon_refund_id_0
()
{
return
coupon_refund_id_0
;
}
public
void
setCoupon_refund_id_0
(
String
coupon_refund_id_0
)
{
this
.
coupon_refund_id_0
=
coupon_refund_id_0
;
}
public
String
getCoupon_fee_1
()
{
return
coupon_fee_1
;
}
public
void
setCoupon_fee_1
(
String
coupon_fee_1
)
{
this
.
coupon_fee_1
=
coupon_fee_1
;
}
public
String
getCoupon_id_1
()
{
return
coupon_id_1
;
}
public
void
setCoupon_id_1
(
String
coupon_id_1
)
{
this
.
coupon_id_1
=
coupon_id_1
;
}
public
String
getCoupon_fee_2
()
{
return
coupon_fee_2
;
}
public
void
setCoupon_fee_2
(
String
coupon_fee_2
)
{
this
.
coupon_fee_2
=
coupon_fee_2
;
}
public
String
getCoupon_id_2
()
{
return
coupon_id_2
;
}
public
void
setCoupon_id_2
(
String
coupon_id_2
)
{
this
.
coupon_id_2
=
coupon_id_2
;
}
public
String
getCoupon_fee_3
()
{
return
coupon_fee_3
;
}
public
void
setCoupon_fee_3
(
String
coupon_fee_3
)
{
this
.
coupon_fee_3
=
coupon_fee_3
;
}
public
String
getCoupon_id_3
()
{
return
coupon_id_3
;
}
public
void
setCoupon_id_3
(
String
coupon_id_3
)
{
this
.
coupon_id_3
=
coupon_id_3
;
}
public
String
getCode_url
()
{
return
code_url
;
}
public
void
setCode_url
(
String
code_url
)
{
this
.
code_url
=
code_url
;
}
public
String
getPrepay_id
()
{
return
prepay_id
;
}
public
void
setPrepay_id
(
String
prepay_id
)
{
this
.
prepay_id
=
prepay_id
;
}
public
String
getOut_refund_no
()
{
return
out_refund_no
;
}
public
void
setOut_refund_no
(
String
out_refund_no
)
{
this
.
out_refund_no
=
out_refund_no
;
}
public
String
getRefund_id
()
{
return
refund_id
;
}
public
void
setRefund_id
(
String
refund_id
)
{
this
.
refund_id
=
refund_id
;
}
public
String
getRefund_fee
()
{
return
refund_fee
;
}
public
void
setRefund_fee
(
String
refund_fee
)
{
this
.
refund_fee
=
refund_fee
;
}
public
String
getRefund_channel
()
{
return
refund_channel
;
}
public
void
setRefund_channel
(
String
refund_channel
)
{
this
.
refund_channel
=
refund_channel
;
}
public
String
getCoupon_refund_fee
()
{
return
coupon_refund_fee
;
}
public
void
setCoupon_refund_fee
(
String
coupon_refund_fee
)
{
this
.
coupon_refund_fee
=
coupon_refund_fee
;
}
public
String
getCoupon_refund_count
()
{
return
coupon_refund_count
;
}
public
void
setCoupon_refund_count
(
String
coupon_refund_count
)
{
this
.
coupon_refund_count
=
coupon_refund_count
;
}
public
String
getCash_refund_fee
()
{
return
cash_refund_fee
;
}
public
void
setCash_refund_fee
(
String
cash_refund_fee
)
{
this
.
cash_refund_fee
=
cash_refund_fee
;
}
public
String
getBody
()
{
return
body
;
}
public
void
setBody
(
String
body
)
{
this
.
body
=
body
;
}
public
String
getRandByNum
()
{
return
randByNum
;
}
public
void
setRandByNum
(
String
randByNum
)
{
this
.
randByNum
=
randByNum
;
}
public
String
getSub_openid
()
{
return
sub_openid
;
}
public
void
setSub_openid
(
String
sub_openid
)
{
this
.
sub_openid
=
sub_openid
;
}
public
String
getSub_appid
()
{
return
sub_appid
;
}
public
void
setSub_appid
(
String
sub_appid
)
{
this
.
sub_appid
=
sub_appid
;
}
public
String
getSub_mch_id
()
{
return
sub_mch_id
;
}
public
void
setSub_mch_id
(
String
sub_mch_id
)
{
this
.
sub_mch_id
=
sub_mch_id
;
}
public
String
getReturn_code
()
{
return
return_code
;
}
public
void
setReturn_code
(
String
return_code
)
{
this
.
return_code
=
return_code
;
}
public
String
getReturn_msg
()
{
return
return_msg
;
}
public
void
setReturn_msg
(
String
return_msg
)
{
this
.
return_msg
=
return_msg
;
}
public
String
getAppid
()
{
return
appid
;
}
public
void
setAppid
(
String
appid
)
{
this
.
appid
=
appid
;
}
public
String
getMch_id
()
{
return
mch_id
;
}
public
void
setMch_id
(
String
mch_id
)
{
this
.
mch_id
=
mch_id
;
}
public
String
getDevice_info
()
{
return
device_info
;
}
public
void
setDevice_info
(
String
device_info
)
{
this
.
device_info
=
device_info
;
}
public
String
getNonce_str
()
{
return
nonce_str
;
}
public
void
setNonce_str
(
String
nonce_str
)
{
this
.
nonce_str
=
nonce_str
;
}
public
String
getSign
()
{
return
sign
;
}
public
String
getCoupon_count
()
{
return
coupon_count
;
}
public
void
setCoupon_count
(
String
coupon_count
)
{
this
.
coupon_count
=
coupon_count
;
}
public
String
getCoupon_fee_0
()
{
return
coupon_fee_0
;
}
public
void
setCoupon_fee_0
(
String
coupon_fee_0
)
{
this
.
coupon_fee_0
=
coupon_fee_0
;
}
public
String
getCoupon_id_0
()
{
return
coupon_id_0
;
}
public
void
setCoupon_id_0
(
String
coupon_id_0
)
{
this
.
coupon_id_0
=
coupon_id_0
;
}
public
void
setSign
(
String
sign
)
{
this
.
sign
=
sign
;
}
public
String
getResult_code
()
{
return
result_code
;
}
public
void
setResult_code
(
String
result_code
)
{
this
.
result_code
=
result_code
;
}
public
String
getErr_code
()
{
return
err_code
;
}
public
void
setErr_code
(
String
err_code
)
{
this
.
err_code
=
err_code
;
}
public
String
getErr_code_des
()
{
return
err_code_des
;
}
public
void
setErr_code_des
(
String
err_code_des
)
{
this
.
err_code_des
=
err_code_des
;
}
public
String
getOpenid
()
{
return
openid
;
}
public
void
setOpenid
(
String
openid
)
{
this
.
openid
=
openid
;
}
public
String
getIs_subscribe
()
{
return
is_subscribe
;
}
public
void
setIs_subscribe
(
String
is_subscribe
)
{
this
.
is_subscribe
=
is_subscribe
;
}
public
String
getTrade_type
()
{
return
trade_type
;
}
public
void
setTrade_type
(
String
trade_type
)
{
this
.
trade_type
=
trade_type
;
}
public
String
getBank_type
()
{
return
bank_type
;
}
public
void
setBank_type
(
String
bank_type
)
{
this
.
bank_type
=
bank_type
;
}
public
String
getFee_type
()
{
return
fee_type
;
}
public
void
setFee_type
(
String
fee_type
)
{
this
.
fee_type
=
fee_type
;
}
public
String
getCash_fee_type
()
{
return
cash_fee_type
;
}
public
void
setCash_fee_type
(
String
cash_fee_type
)
{
this
.
cash_fee_type
=
cash_fee_type
;
}
public
BigDecimal
getTotal_fee
()
{
return
total_fee
;
}
public
void
setTotal_fee
(
BigDecimal
total_fee
)
{
this
.
total_fee
=
total_fee
;
}
public
BigDecimal
getCash_fee
()
{
return
cash_fee
;
}
public
void
setCash_fee
(
BigDecimal
cash_fee
)
{
this
.
cash_fee
=
cash_fee
;
}
public
BigDecimal
getCoupon_fee
()
{
return
coupon_fee
;
}
public
void
setCoupon_fee
(
BigDecimal
coupon_fee
)
{
this
.
coupon_fee
=
coupon_fee
;
}
public
String
getTransaction_id
()
{
return
transaction_id
;
}
public
void
setTransaction_id
(
String
transaction_id
)
{
this
.
transaction_id
=
transaction_id
;
}
public
String
getOut_trade_no
()
{
return
out_trade_no
;
}
public
void
setOut_trade_no
(
String
out_trade_no
)
{
this
.
out_trade_no
=
out_trade_no
;
}
public
String
getAttach
()
{
return
attach
;
}
public
void
setAttach
(
String
attach
)
{
this
.
attach
=
attach
;
}
public
String
getSub_is_subscribe
()
{
return
sub_is_subscribe
;
}
public
void
setSub_is_subscribe
(
String
sub_is_subscribe
)
{
this
.
sub_is_subscribe
=
sub_is_subscribe
;
}
public
String
getOrder_flow_no
()
{
return
order_flow_no
;
}
public
void
setOrder_flow_no
(
String
order_flow_no
)
{
this
.
order_flow_no
=
order_flow_no
;
}
public
String
getAuth_code
()
{
return
auth_code
;
}
public
void
setAuth_code
(
String
auth_code
)
{
this
.
auth_code
=
auth_code
;
}
public
String
getOperator_no
()
{
return
operator_no
;
}
public
void
setOperator_no
(
String
operator_no
)
{
this
.
operator_no
=
operator_no
;
}
public
String
getServer_host
()
{
return
server_host
;
}
public
void
setServer_host
(
String
server_host
)
{
this
.
server_host
=
server_host
;
}
public
String
getTime_end
()
{
return
time_end
;
}
public
void
setTime_end
(
String
time_end
)
{
this
.
time_end
=
time_end
;
}
public
String
getStart_time
()
{
return
start_time
;
}
public
void
setStart_time
(
String
start_time
)
{
this
.
start_time
=
start_time
;
}
public
String
getTradeTypeDesc
()
{
return
tradeTypeDesc
;
}
public
void
setTradeTypeDesc
(
String
tradeTypeDesc
)
{
this
.
tradeTypeDesc
=
tradeTypeDesc
;
}
public
String
getTrade_state
()
{
return
trade_state
;
}
public
void
setTrade_state
(
String
trade_state
)
{
this
.
trade_state
=
trade_state
;
}
public
String
getTrade_state_desc
()
{
return
trade_state_desc
;
}
public
void
setTrade_state_desc
(
String
trade_state_desc
)
{
this
.
trade_state_desc
=
trade_state_desc
;
}
public
String
getFlow_type
()
{
return
flow_type
;
}
public
void
setFlow_type
(
String
flow_type
)
{
this
.
flow_type
=
flow_type
;
}
public
String
getRecall
()
{
return
recall
;
}
public
void
setRecall
(
String
recall
)
{
this
.
recall
=
recall
;
}
public
String
getProduct_id
()
{
return
product_id
;
}
public
void
setProduct_id
(
String
product_id
)
{
this
.
product_id
=
product_id
;
}
}
src/main/java/com/egolm/payment/service/SystemCtrlService.java
0 → 100644
View file @
53ec7e65
package
com
.
egolm
.
payment
.
service
;
import
java.util.Map
;
public
interface
SystemCtrlService
{
public
Map
<
String
,
Object
>
queryTSystemCtrlByCode
(
String
sCode
,
String
langID
);
}
src/main/java/com/egolm/payment/service/WxChatService.java
0 → 100644
View file @
53ec7e65
package
com
.
egolm
.
payment
.
service
;
import
java.util.Map
;
import
java.util.SortedMap
;
public
interface
WxChatService
{
public
Map
<
String
,
Object
>
loadAppID
(
String
code
,
String
langID
);
public
String
getWxOpenId
(
Map
<
String
,
String
>
params
);
public
Map
<
String
,
String
>
unifiedorder
(
SortedMap
<
Object
,
Object
>
params
)
throws
Exception
;
public
Map
<
String
,
String
>
refund
(
SortedMap
<
Object
,
Object
>
params
)
throws
Exception
;
}
src/main/java/com/egolm/payment/service/impl/SystemCtrlServiceImpl.java
0 → 100644
View file @
53ec7e65
package
com
.
egolm
.
payment
.
service
.
impl
;
import
java.util.Map
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.dialect.SqlServerDialect
;
import
com.egolm.payment.service.SystemCtrlService
;
@Service
public
class
SystemCtrlServiceImpl
implements
SystemCtrlService
{
private
static
final
Log
logger
=
LogFactory
.
getLog
(
SystemCtrlServiceImpl
.
class
);
@Autowired
private
JdbcTemplate
jdbcTemplate
;
public
Map
<
String
,
Object
>
queryTSystemCtrlByCode
(
String
sCode
,
String
langID
)
{
try
{
jdbcTemplate
.
setDialect
(
new
SqlServerDialect
());
String
sql
=
"select sDesc, sSysTypeID, sSysType, sValue1, sValue2, sValue3,sMemo,sValue4,sValue5 from tSystemCtrl where sCode = ? and nTag&1 = 0"
;
Map
<
String
,
Object
>
mapRsult
=
jdbcTemplate
.
queryForMap
(
sql
,
sCode
);
return
mapRsult
;
}
catch
(
Exception
e
)
{
logger
.
error
(
"支付服务数据字典查询出错: "
+
e
.
getMessage
());
}
return
null
;
}
}
src/main/java/com/egolm/payment/service/impl/WeChatServiceImpl.java
0 → 100644
View file @
53ec7e65
package
com
.
egolm
.
payment
.
service
.
impl
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.SortedMap
;
import
javax.servlet.http.HttpUtils
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
com.egolm.common.HttpsUtil
;
import
com.egolm.payment.service.SystemCtrlService
;
import
com.egolm.payment.service.WxChatService
;
import
com.egolm.payment.util.PayContstrant
;
import
com.egolm.payment.util.WxApiXmlComer
;
import
com.egolm.payment.util.WxSignUtil
;
@Service
public
class
WeChatServiceImpl
implements
WxChatService
{
private
static
final
Log
logger
=
LogFactory
.
getLog
(
WeChatServiceImpl
.
class
);
@Value
(
"${wx.refund.ssl.path}"
)
private
String
sslPath
;
@Autowired
private
RedisTemplate
<
String
,
?>
redisTemplate
;
@Autowired
private
SystemCtrlService
systemCtrlService
;
/**
*
* @Title: loadAppID
* @Description: 获取appid 和密钥信息
* @param: @param code
* @param: @param langID
* @param: @return
* @return: Map<String,Object>
* @throws
*/
public
Map
<
String
,
Object
>
loadAppID
(
String
code
,
String
langID
)
{
System
.
out
.
println
(
redisTemplate
);
System
.
out
.
println
(
redisTemplate
.
opsForHash
());
Map
<
String
,
Object
>
map
=
(
Map
<
String
,
Object
>)
redisTemplate
.
opsForHash
().
get
(
PayContstrant
.
WX_APP_KEY
,
code
);
System
.
out
.
println
(
map
);
if
(
map
==
null
)
{
map
=
systemCtrlService
.
queryTSystemCtrlByCode
(
code
,
langID
);
if
(
map
!=
null
)
{
redisTemplate
.
opsForHash
().
put
(
PayContstrant
.
WX_APP_KEY
,
code
,
map
);
}
}
return
map
;
}
/**
*
* @Title: getWxOpenId
* @Description: TODO(小程序获取openid)
* @param @param params
* @param @return 设定文件
* @return 返回类型
* @throws
*/
public
String
getWxOpenId
(
Map
<
String
,
String
>
params
){
String
requestUrl
=
"https://api.weixin.qq.com/sns/jscode2session"
;
String
openIdStr
=
HttpsUtil
.
doGet
(
requestUrl
,
params
);
try
{
//记日志
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
openIdStr
;
}
/**
* @throws Exception
*
* @Title: unifiedorder
* @Description: TODO(生成预支付单号)
* @param @param params
* @param @return 设定文件
* @return 返回类型
* @throws
*/
@Override
public
Map
<
String
,
String
>
unifiedorder
(
SortedMap
<
Object
,
Object
>
params
)
throws
Exception
{
Date
startTime
=
new
Date
();
String
requestUrl
=
"https://api.mch.weixin.qq.com/pay/unifiedorder"
;
String
sign
=
WxSignUtil
.
createSign
(
params
);
//计算签名
params
.
put
(
"sign"
,
sign
);
String
requestXml
=
WxApiXmlComer
.
mapToXml
(
params
);
logger
.
info
(
"预支付生成的XML请求: "
+
requestXml
);
String
responseXml
=
HttpsUtil
.
doPostForXml
(
requestUrl
,
requestXml
);
logger
.
info
(
"预支付生成的XML返回: "
+
responseXml
);
Map
<
String
,
String
>
resultMap
=
WxApiXmlComer
.
doXMLParse
(
responseXml
);
Date
endTime
=
new
Date
();
try
{
/*WxApiLog wxApiLog = new WxApiLog();
wxApiLog.setPaytypeid(wxAppIdObject.getString("payTypeId"));
wxApiLog.setPaytype(wxAppIdObject.getString("payTpye"));
wxApiLog.setRequestXml(requestXml);
wxApiLog.setResponseXml(responseXml);
wxApiLog.setStarttime(startTime);
wxApiLog.setEndtime(endTime);
wxApiLog.setLogcode("unifiedorder");
wxApiLog.setLogname("生成预支付单号");
wxApiLog.setOutTradeNo(params.get("out_trade_no")+"");
wxApiLog.setTransactionId(resultMap.containsKey("prepay_id")==true?resultMap.get("prepay_id"):"");
wxApiLogService.insert(wxApiLog);*/
//加日志
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
resultMap
;
}
/**
* 发起退款
* <p>Title: </p>
* <p>Description: </p>
* @param params
* @param wxAppIdObject
* @return
* @throws Exception
*/
public
Map
<
String
,
String
>
refund
(
SortedMap
<
Object
,
Object
>
params
)
throws
Exception
{
Date
startTime
=
new
Date
();
String
requestUrl
=
"https://api.mch.weixin.qq.com/secapi/pay/refund"
;
String
sign
=
WxSignUtil
.
createSign
(
params
);
//计算签名
params
.
put
(
"sign"
,
sign
);
logger
.
info
(
"退款签名:"
+
sign
);
String
requestXml
=
WxApiXmlComer
.
mapToXml
(
params
);
String
mch_id
=
params
.
get
(
"mch_id"
)+
""
;
//商户号
String
responseXml
=
HttpsUtil
.
doPostBySSL
(
mch_id
,
sslPath
,
requestXml
,
requestUrl
);
logger
.
info
(
"退款返回---:"
+
responseXml
);
Map
<
String
,
String
>
resultMap
=
WxApiXmlComer
.
doXMLParse
(
responseXml
);
Date
endTime
=
new
Date
();
try
{
String
return_code
=
resultMap
.
get
(
"return_code"
);
String
result_code
=
resultMap
.
get
(
"result_code"
);
/* WxApiLog wxApiLog = new WxApiLog();
wxApiLog.setPaytypeid(wxAppIdObject.getString("payTypeId"));
wxApiLog.setPaytype(wxAppIdObject.getString("payTpye"));
wxApiLog.setRequestXml(requestXml);
wxApiLog.setResponseXml(responseXml);
wxApiLog.setStarttime(startTime);
wxApiLog.setEndtime(endTime);
wxApiLog.setLogcode("refund");
wxApiLog.setLogname("申请退款");
wxApiLog.setOutTradeNo(params.get("out_trade_no")+"");
wxApiLog.setTransactionId(params.get("transaction_id")+"");
if(return_code.equals("SUCCESS") && result_code.equals("SUCCESS")){ //当退款成功,全部重取这两个参数
wxApiLog.setOutTradeNo(resultMap.get("out_trade_no"));
wxApiLog.setTransactionId(resultMap.get("transaction_id"));
}
wxApiLogService.insert(wxApiLog);*/
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
resultMap
;
}
}
src/main/java/com/egolm/payment/util/MD5Util.java
0 → 100644
View file @
53ec7e65
package
com
.
egolm
.
payment
.
util
;
import
java.security.MessageDigest
;
public
class
MD5Util
{
private
static
String
byteArrayToHexString
(
byte
b
[])
{
StringBuffer
resultSb
=
new
StringBuffer
();
for
(
int
i
=
0
;
i
<
b
.
length
;
i
++)
resultSb
.
append
(
byteToHexString
(
b
[
i
]));
return
resultSb
.
toString
();
}
private
static
String
byteToHexString
(
byte
b
)
{
int
n
=
b
;
if
(
n
<
0
)
n
+=
256
;
int
d1
=
n
/
16
;
int
d2
=
n
%
16
;
return
hexDigits
[
d1
]
+
hexDigits
[
d2
];
}
public
static
String
MD5Encode
(
String
origin
,
String
charsetname
)
{
String
resultString
=
null
;
try
{
resultString
=
new
String
(
origin
);
MessageDigest
md
=
MessageDigest
.
getInstance
(
"MD5"
);
if
(
charsetname
==
null
||
""
.
equals
(
charsetname
))
resultString
=
byteArrayToHexString
(
md
.
digest
(
resultString
.
getBytes
()));
else
resultString
=
byteArrayToHexString
(
md
.
digest
(
resultString
.
getBytes
(
charsetname
)));
}
catch
(
Exception
exception
)
{
}
return
resultString
;
}
private
static
final
String
hexDigits
[]
=
{
"0"
,
"1"
,
"2"
,
"3"
,
"4"
,
"5"
,
"6"
,
"7"
,
"8"
,
"9"
,
"a"
,
"b"
,
"c"
,
"d"
,
"e"
,
"f"
};
}
src/main/java/com/egolm/payment/util/PayContstrant.java
0 → 100644
View file @
53ec7e65
package
com
.
egolm
.
payment
.
util
;
public
class
PayContstrant
{
public
static
final
String
WX_APP_KEY
=
"WX_APP_KEY"
;
//微信app信息存储前缀
public
static
final
String
WX_CHAT_APP_KEY
=
"WxChatKey"
;
//微信公众号KEY 存放appid 密钥 信息的
public
static
final
String
WX_MINI_APP_KEY
=
"WxMiniProgramKey"
;
//微信小程序KEY 存放appid 密钥 信息的
}
src/main/java/com/egolm/payment/util/SAXXmlContentHandler.java
0 → 100644
View file @
53ec7e65
package
com
.
egolm
.
payment
.
util
;
import
java.io.UnsupportedEncodingException
;
import
java.util.SortedMap
;
import
java.util.TreeMap
;
import
org.xml.sax.Attributes
;
import
org.xml.sax.SAXException
;
import
org.xml.sax.helpers.DefaultHandler
;
/**
* @Title:
* @Description:
* @author zhangyong
* @date 2016年3月11日 下午6:04:03
* @version V1.0
*
*/
public
class
SAXXmlContentHandler
extends
DefaultHandler
{
private
String
tagName
;
private
SortedMap
<
Object
,
Object
>
parameters
=
new
TreeMap
<
Object
,
Object
>();
@Override
public
void
startDocument
()
throws
SAXException
{
}
@Override
public
void
startElement
(
String
uri
,
String
localName
,
String
qName
,
Attributes
attributes
)
throws
SAXException
{
tagName
=
qName
;
}
@Override
public
void
characters
(
char
[]
ch
,
int
start
,
int
length
)
{
String
dataStr
=
new
String
(
ch
,
start
,
length
);
try
{
dataStr
=
new
String
(
dataStr
.
getBytes
(),
"UTF-8"
);
}
catch
(
UnsupportedEncodingException
e1
)
{
e1
.
printStackTrace
();
}
try
{
if
(
tagName
!=
null
&&
!
tagName
.
equals
(
"sign"
)
){
parameters
.
put
(
tagName
,
dataStr
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
@Override
public
void
endElement
(
String
uri
,
String
localName
,
String
qName
)
throws
SAXException
{
if
(
tagName
!=
null
&&
tagName
.
equals
(
qName
)){
tagName
=
null
;
}
}
public
SortedMap
<
Object
,
Object
>
getMap
(){
return
parameters
;
}
}
src/main/java/com/egolm/payment/util/WxApiXmlComer.java
0 → 100644
View file @
53ec7e65
package
com
.
egolm
.
payment
.
util
;
import
java.io.ByteArrayInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.Set
;
import
java.util.SortedMap
;
import
org.jdom2.Document
;
import
org.jdom2.Element
;
import
org.jdom2.JDOMException
;
import
org.jdom2.input.SAXBuilder
;
public
class
WxApiXmlComer
{
/**
* 将MAP转换成微信需要的XML
* <p>
* Title:
* </p>
* <p>
* Description:
* </p>
*
* @param params
* @return
*/
public
static
String
mapToXml
(
SortedMap
<
Object
,
Object
>
params
)
{
StringBuffer
sbuff
=
new
StringBuffer
();
sbuff
.
append
(
"<xml>"
);
if
(
params
!=
null
&&
params
.
size
()
>
0
)
{
Set
<
Entry
<
Object
,
Object
>>
set
=
params
.
entrySet
();
Iterator
<
Entry
<
Object
,
Object
>>
itor
=
set
.
iterator
();
Entry
<
Object
,
Object
>
tmpEntry
=
null
;
while
(
itor
.
hasNext
())
{
tmpEntry
=
itor
.
next
();
String
key
=
(
String
)
tmpEntry
.
getKey
();
String
value
=
(
String
)
tmpEntry
.
getValue
();
if
(!
key
.
equals
(
"md5Key"
))
{
if
(
key
.
equals
(
"body"
))
{
sbuff
.
append
(
"<"
+
key
+
">"
).
append
(
"<![CDATA["
+
value
+
"]]>"
).
append
(
"</"
+
key
+
">"
);
}
else
{
sbuff
.
append
(
"<"
+
key
+
">"
).
append
(
value
).
append
(
"</"
+
key
+
">"
);
}
}
}
}
sbuff
.
append
(
"</xml>"
);
return
sbuff
.
toString
();
}
/**
* 解析xml,返回第一级元素键值对。如果第一级元素有子节点,则此节点的值是子节点的xml数据。
*
* @param strxml
* @return
* @throws JDOMException
* @throws IOException
*/
public
static
Map
<
String
,
String
>
doXMLParse
(
String
strxml
)
throws
Exception
{
if
(
null
==
strxml
||
""
.
equals
(
strxml
))
{
return
null
;
}
Map
<
String
,
String
>
m
=
new
HashMap
<
String
,
String
>();
InputStream
in
=
String2Inputstream
(
strxml
);
SAXBuilder
builder
=
new
SAXBuilder
();
Document
doc
=
builder
.
build
(
in
);
Element
root
=
doc
.
getRootElement
();
List
list
=
root
.
getChildren
();
Iterator
it
=
list
.
iterator
();
while
(
it
.
hasNext
())
{
Element
e
=
(
Element
)
it
.
next
();
String
k
=
e
.
getName
();
String
v
=
""
;
List
children
=
e
.
getChildren
();
if
(
children
.
isEmpty
())
{
v
=
e
.
getTextNormalize
();
}
else
{
v
=
getChildrenText
(
children
);
}
m
.
put
(
k
,
v
);
}
// 关闭流
in
.
close
();
return
m
;
}
/**
* 获取子结点的xml
*
* @param children
* @return String
*/
public
static
String
getChildrenText
(
List
children
)
{
StringBuffer
sb
=
new
StringBuffer
();
if
(!
children
.
isEmpty
())
{
Iterator
it
=
children
.
iterator
();
while
(
it
.
hasNext
())
{
Element
e
=
(
Element
)
it
.
next
();
String
name
=
e
.
getName
();
String
value
=
e
.
getTextNormalize
();
List
list
=
e
.
getChildren
();
sb
.
append
(
"<"
+
name
+
">"
);
if
(!
list
.
isEmpty
())
{
sb
.
append
(
getChildrenText
(
list
));
}
sb
.
append
(
value
);
sb
.
append
(
"</"
+
name
+
">"
);
}
}
return
sb
.
toString
();
}
public
static
InputStream
String2Inputstream
(
String
str
)
{
return
new
ByteArrayInputStream
(
str
.
getBytes
());
}
}
src/main/java/com/egolm/payment/util/WxSignUtil.java
0 → 100644
View file @
53ec7e65
package
com
.
egolm
.
payment
.
util
;
import
java.io.ByteArrayInputStream
;
import
java.io.InputStream
;
import
java.util.Iterator
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.SortedMap
;
import
java.util.TreeMap
;
import
javax.xml.parsers.SAXParser
;
import
javax.xml.parsers.SAXParserFactory
;
public
class
WxSignUtil
{
public
static
final
String
characterEncoding
=
"UTF8"
;
/**
* 创建md5摘要,规则是:按参数名称a-z排序,遇到空值的参数不参加签名。
*/
public
static
String
createSign
(
SortedMap
<
Object
,
Object
>
packageParams
)
{
StringBuffer
sb
=
new
StringBuffer
();
Set
es
=
packageParams
.
entrySet
();
Iterator
it
=
es
.
iterator
();
while
(
it
.
hasNext
())
{
Map
.
Entry
entry
=
(
Map
.
Entry
)
it
.
next
();
String
k
=
(
String
)
entry
.
getKey
();
String
v
=
(
String
)
entry
.
getValue
();
if
(
null
!=
v
&&
!
""
.
equals
(
v
)
&&
!
"sign"
.
equals
(
k
)
&&
!
"md5Key"
.
equals
(
k
))
{
sb
.
append
(
k
+
"="
+
v
+
"&"
);
}
}
sb
.
append
(
"key="
+
packageParams
.
get
(
"md5Key"
));
System
.
out
.
println
(
sb
.
toString
());
String
sign
=
MD5Util
.
MD5Encode
(
sb
.
toString
(),
characterEncoding
).
toUpperCase
();
return
sign
;
}
/**
* 根据微信返回的数据生成签名
* @param wxXml
* @return
* @throws Exception
*/
public
static
String
getSignKey
(
String
wxXml
,
String
md5Key
)
throws
Exception
{
System
.
out
.
println
(
">>>>>>>>>>>>>"
+
wxXml
);
SAXXmlContentHandler
sch
=
new
SAXXmlContentHandler
();
InputStream
is
=
new
ByteArrayInputStream
(
wxXml
.
getBytes
(
"UTF-8"
));
// 创建一个SAXParserFactory
SAXParserFactory
factory
=
SAXParserFactory
.
newInstance
();
// ②创建SAX解析器
SAXParser
parser
=
factory
.
newSAXParser
();
parser
.
parse
(
is
,
sch
);
SortedMap
<
Object
,
Object
>
parameters
=
sch
.
getMap
();
parameters
.
put
(
"md5Key"
,
md5Key
);
String
mySign
=
createSign
(
parameters
);
return
mySign
;
}
public
static
boolean
checkSign
(
Map
<
String
,
String
>
resultMap
,
String
sign
)
throws
Exception
{
String
createSign
=
createSign
(
mapToStoredMap
(
resultMap
));
if
(
createSign
.
equals
(
sign
)){
return
true
;
}
return
false
;
}
public
static
SortedMap
<
Object
,
Object
>
mapToStoredMap
(
Map
<
String
,
String
>
resultMap
){
SortedMap
<
Object
,
Object
>
params
=
new
TreeMap
<
Object
,
Object
>();
if
(
resultMap
!=
null
&&
resultMap
.
size
()
>
0
){
for
(
Map
.
Entry
<
String
,
String
>
result:
resultMap
.
entrySet
()){
params
.
put
(
result
.
getKey
(),
result
.
getValue
());
}
}
return
params
;
}
}
src/main/resources/application-dev.properties
View file @
53ec7e65
...
...
@@ -19,4 +19,21 @@ spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
spring.datasource.testWhileIdle
=
true
spring.datasource.validationQueryTimeout
=
5
spring.datasource.validationQuery
=
SELECT 1
spring.datasource.timeBetweenEvictionRunsMillis
=
3600000
\ No newline at end of file
spring.datasource.timeBetweenEvictionRunsMillis
=
3600000
spring.redis.database
=
0
spring.redis.host
=
10.10.0.15
spring.redis.port
=
16379
spring.redis.password
=
spring.redis.timeout=2000
spring.redis.pool.max-active
=
20
spring.redis.pool.max-wait
=
2000
spring.redis.pool.max-idle
=
5
spring.redis.pool.min-idle
=
0
#微信退款证书地址
wx.refund.ssl.path
=
\ No newline at end of file
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