Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
youka-api
Overview
Overview
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
java-youka-wallet
youka-api
Commits
2db32706
Commit
2db32706
authored
Jun 08, 2018
by
tang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加日志信息
parent
326682ff
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
26 additions
and
13 deletions
+26
-13
PayApiController.java
src/main/java/com/thinkgem/jeesite/modules/pay/api/PayApiController.java
+10
-3
JuHeZhongPayService.java
src/main/java/com/thinkgem/jeesite/modules/pay/juhezhong/service/JuHeZhongPayService.java
+0
-3
PayApiService.java
src/main/java/com/thinkgem/jeesite/modules/pay/service/PayApiService.java
+16
-7
No files found.
src/main/java/com/thinkgem/jeesite/modules/pay/api/PayApiController.java
View file @
2db32706
...
@@ -18,6 +18,8 @@ import com.thinkgem.jeesite.modules.user.entity.CardSwpaccidEntity;
...
@@ -18,6 +18,8 @@ import com.thinkgem.jeesite.modules.user.entity.CardSwpaccidEntity;
import
com.thinkgem.jeesite.modules.user.entity.UserEntity
;
import
com.thinkgem.jeesite.modules.user.entity.UserEntity
;
import
com.thinkgem.jeesite.modules.user.service.UserApiService
;
import
com.thinkgem.jeesite.modules.user.service.UserApiService
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
@@ -36,6 +38,8 @@ import java.util.*;
...
@@ -36,6 +38,8 @@ import java.util.*;
@RestController
@RestController
@RequestMapping
(
"/api/pay"
)
@RequestMapping
(
"/api/pay"
)
public
class
PayApiController
{
public
class
PayApiController
{
/** log */
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
PayApiController
.
class
);
@Autowired
@Autowired
private
PayApiService
payService
;
private
PayApiService
payService
;
...
@@ -202,6 +206,7 @@ public class PayApiController {
...
@@ -202,6 +206,7 @@ public class PayApiController {
@RequestMapping
(
"/notifyPay"
)
@RequestMapping
(
"/notifyPay"
)
public
void
notifyPay
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
public
void
notifyPay
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
System
.
out
.
println
(
"。。。。。。回调。。。。。"
);
System
.
out
.
println
(
"。。。。。。回调。。。。。"
);
logger
.
debug
(
"HL2回调开始"
);
Response
responseRetrun
=
new
Response
();
Response
responseRetrun
=
new
Response
();
Map
map
=
request
.
getParameterMap
();
Map
map
=
request
.
getParameterMap
();
printNotifyParam
(
map
);
printNotifyParam
(
map
);
...
@@ -231,6 +236,7 @@ public class PayApiController {
...
@@ -231,6 +236,7 @@ public class PayApiController {
}
}
String
orderId
=
request
.
getParameter
(
"orderId"
);
String
orderId
=
request
.
getParameter
(
"orderId"
);
String
code
=
request
.
getParameter
(
"code"
);
String
code
=
request
.
getParameter
(
"code"
);
logger
.
debug
(
"HL2回调信息, 订单ID : {} , code:{}"
,
orderId
,
code
);
if
(
"0000"
.
equals
(
code
)){
if
(
"0000"
.
equals
(
code
)){
System
.
out
.
println
(
"orderId:"
+
orderId
);
System
.
out
.
println
(
"orderId:"
+
orderId
);
OrderEntity
orderEntity
=
new
OrderEntity
();
OrderEntity
orderEntity
=
new
OrderEntity
();
...
@@ -269,7 +275,7 @@ public class PayApiController {
...
@@ -269,7 +275,7 @@ public class PayApiController {
*/
*/
@RequestMapping
(
"/notifyQuickPay"
)
@RequestMapping
(
"/notifyQuickPay"
)
public
void
notifyQuickPay
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
public
void
notifyQuickPay
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
System
.
out
.
println
(
"H4通道:quickPay支付回调"
);
logger
.
debug
(
"H4通道:quickPay支付回调"
);
Response
responseRetrun
=
new
Response
();
Response
responseRetrun
=
new
Response
();
Map
map
=
request
.
getParameterMap
();
Map
map
=
request
.
getParameterMap
();
printNotifyParam
(
map
);
printNotifyParam
(
map
);
...
@@ -299,6 +305,7 @@ public class PayApiController {
...
@@ -299,6 +305,7 @@ public class PayApiController {
}
}
String
orderId
=
request
.
getParameter
(
"orderId"
);
String
orderId
=
request
.
getParameter
(
"orderId"
);
String
code
=
request
.
getParameter
(
"code"
);
String
code
=
request
.
getParameter
(
"code"
);
logger
.
debug
(
"HL4回调信息, 订单ID : {} , code:{}"
,
orderId
,
code
);
if
(
"0000"
.
equals
(
code
)){
if
(
"0000"
.
equals
(
code
)){
System
.
out
.
println
(
"quick pay orderId:"
+
orderId
);
System
.
out
.
println
(
"quick pay orderId:"
+
orderId
);
OrderEntity
orderEntity
=
new
OrderEntity
();
OrderEntity
orderEntity
=
new
OrderEntity
();
...
@@ -337,7 +344,7 @@ public class PayApiController {
...
@@ -337,7 +344,7 @@ public class PayApiController {
*/
*/
@RequestMapping
(
"/notifyHuanqiuhuijuPay"
)
@RequestMapping
(
"/notifyHuanqiuhuijuPay"
)
public
void
notifyHuanqiuhuijuPay
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
public
void
notifyHuanqiuhuijuPay
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
System
.
out
.
println
(
"。。。。。。回调。。。。。
"
);
logger
.
debug
(
"Huanqiuhuiju快捷支付的回调开始
"
);
Response
responseRetrun
=
new
Response
();
Response
responseRetrun
=
new
Response
();
Map
map
=
request
.
getParameterMap
();
Map
map
=
request
.
getParameterMap
();
printNotifyParam
(
map
);
printNotifyParam
(
map
);
...
@@ -406,7 +413,7 @@ public class PayApiController {
...
@@ -406,7 +413,7 @@ public class PayApiController {
*/
*/
@RequestMapping
(
"/openCardCallback"
)
@RequestMapping
(
"/openCardCallback"
)
public
void
openCardCallback
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
public
void
openCardCallback
(
HttpServletRequest
request
,
HttpServletResponse
response
)
{
System
.
out
.
println
(
"。。。。。。openCardCallback回调。。。。。"
);
logger
.
debug
(
"。。。。。。openCardCallback回调。。。。。"
);
Map
map
=
request
.
getParameterMap
();
Map
map
=
request
.
getParameterMap
();
printNotifyParam
(
map
);
printNotifyParam
(
map
);
// Set keSet=map.entrySet();
// Set keSet=map.entrySet();
...
...
src/main/java/com/thinkgem/jeesite/modules/pay/juhezhong/service/JuHeZhongPayService.java
View file @
2db32706
...
@@ -144,11 +144,8 @@ public JSONObject quickWebPay ( JuhezhongDto dto ) throws Exception {
...
@@ -144,11 +144,8 @@ public JSONObject quickWebPay ( JuhezhongDto dto ) throws Exception {
}
}
public
JSONObject
quickPay
(
JuhezhongDto
dto
)
throws
Exception
{
public
JSONObject
quickPay
(
JuhezhongDto
dto
)
throws
Exception
{
Map
<
String
,
Object
>
params
=
Bean2Map
.
Entity2Map
(
dto
);
Map
<
String
,
Object
>
params
=
Bean2Map
.
Entity2Map
(
dto
);
System
.
out
.
println
(
params
);
String
signBefore
=
SignUtils
.
signBefore
(
params
);
String
signBefore
=
SignUtils
.
signBefore
(
params
);
System
.
out
.
println
(
signBefore
);
String
sign
=
SignUtils
.
sign
(
signBefore
,
ComCode
.
MERCHANT_SECRET
);
String
sign
=
SignUtils
.
sign
(
signBefore
,
ComCode
.
MERCHANT_SECRET
);
System
.
out
.
println
(
"sign2:"
+
sign
);
params
.
put
(
"sign"
,
sign
);
params
.
put
(
"sign"
,
sign
);
String
respStr
=
HttpUtil
.
post
(
ComCode
.
HOST
+
ComCode
.
NO_INTEGRAL_QUICK_PAY_URL
,
params
);
String
respStr
=
HttpUtil
.
post
(
ComCode
.
HOST
+
ComCode
.
NO_INTEGRAL_QUICK_PAY_URL
,
params
);
return
JSONObject
.
parseObject
(
respStr
);
return
JSONObject
.
parseObject
(
respStr
);
...
...
src/main/java/com/thinkgem/jeesite/modules/pay/service/PayApiService.java
View file @
2db32706
...
@@ -31,6 +31,8 @@ import com.thinkgem.jeesite.modules.user.bean.JuHeZhongPayRequest;
...
@@ -31,6 +31,8 @@ import com.thinkgem.jeesite.modules.user.bean.JuHeZhongPayRequest;
import
com.thinkgem.jeesite.modules.user.bean.UserRequest
;
import
com.thinkgem.jeesite.modules.user.bean.UserRequest
;
import
com.thinkgem.jeesite.modules.user.entity.*
;
import
com.thinkgem.jeesite.modules.user.entity.*
;
import
com.thinkgem.jeesite.modules.user.service.UserApiService
;
import
com.thinkgem.jeesite.modules.user.service.UserApiService
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -51,6 +53,8 @@ import java.util.Map;
...
@@ -51,6 +53,8 @@ import java.util.Map;
@Lazy
(
false
)
@Lazy
(
false
)
@Transactional
(
readOnly
=
true
)
@Transactional
(
readOnly
=
true
)
public
class
PayApiService
{
public
class
PayApiService
{
/** log */
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
PayApiService
.
class
);
@Autowired
@Autowired
private
PayApiDao
payDao
;
private
PayApiDao
payDao
;
@Autowired
@Autowired
...
@@ -702,9 +706,10 @@ public class PayApiService {
...
@@ -702,9 +706,10 @@ public class PayApiService {
JSONObject
jsonObject
=
juHeZhongPayJFenService
.
openCard
(
dto
);
JSONObject
jsonObject
=
juHeZhongPayJFenService
.
openCard
(
dto
);
this
.
notifyPay
(
orderEntity
);
payBackDto
.
setMessage
(
jsonObject
.
getString
(
"msg"
));
payBackDto
.
setMessage
(
jsonObject
.
getString
(
"msg"
));
if
(
"0000"
.
equals
(
jsonObject
.
get
(
"code"
))){
if
(
"0000"
.
equals
(
jsonObject
.
get
(
"code"
))){
this
.
notifyPay
(
orderEntity
);
return
payBackDto
;
return
payBackDto
;
}
else
{
}
else
{
throw
new
MyException
(
jsonObject
.
getString
(
"msg"
));
throw
new
MyException
(
jsonObject
.
getString
(
"msg"
));
...
@@ -741,7 +746,7 @@ public class PayApiService {
...
@@ -741,7 +746,7 @@ public class PayApiService {
dto
.
setPhone
(
cardEntity
.
getCardMobile
());
//支付卡预留手机号
dto
.
setPhone
(
cardEntity
.
getCardMobile
());
//支付卡预留手机号
dto
.
setExpired
(
request
.
getExpireDate
());
//信用卡有效期(MMYY)
dto
.
setExpired
(
request
.
getExpireDate
());
//信用卡有效期(MMYY)
dto
.
setUserFee
(
Integer
.
valueOf
(
ComCode
.
EXTRA_RATE
));
//手续费 单位:分 ,D0 业务必传,商家约定
dto
.
setUserFee
(
Integer
.
valueOf
(
ComCode
.
EXTRA_RATE
));
//手续费 单位:分 ,D0 业务必传,商家约定
if
(
cardEntity
.
getCardType
().
equals
(
"
D
"
)){
if
(
cardEntity
.
getCardType
().
equals
(
"
C
"
)){
if
(
cardEntityDebit
==
null
){
if
(
cardEntityDebit
==
null
){
throw
new
MyException
(
"还没有结算卡!"
);
throw
new
MyException
(
"还没有结算卡!"
);
}
}
...
@@ -756,10 +761,11 @@ public class PayApiService {
...
@@ -756,10 +761,11 @@ public class PayApiService {
dto
.
setTimestamp
(
System
.
currentTimeMillis
());
dto
.
setTimestamp
(
System
.
currentTimeMillis
());
JSONObject
jsonObject
=
juHeZhongPayService
.
quickPay
(
dto
);
JSONObject
jsonObject
=
juHeZhongPayService
.
quickPay
(
dto
);
logger
.
debug
(
"HL4支付返回结果信息:{}"
+
jsonObject
.
toJSONString
());
this
.
notifyPay
(
orderEntity
);
payBackDto
.
setMessage
(
jsonObject
.
getString
(
"msg"
));
payBackDto
.
setMessage
(
jsonObject
.
getString
(
"msg"
));
if
(
"0000"
.
equals
(
jsonObject
.
get
(
"code"
))){
if
(
"0000"
.
equals
(
jsonObject
.
get
(
"code"
))){
//订单支付成功,则进行一次查询,修改订单状态
this
.
notifyPay
(
orderEntity
);
return
payBackDto
;
return
payBackDto
;
}
else
{
}
else
{
throw
new
MyException
(
jsonObject
.
getString
(
"msg"
));
throw
new
MyException
(
jsonObject
.
getString
(
"msg"
));
...
@@ -999,13 +1005,16 @@ public class PayApiService {
...
@@ -999,13 +1005,16 @@ public class PayApiService {
return
orderEntity
;
return
orderEntity
;
}
}
System
.
out
.
println
(
"查询订单返回结果:
"
+
jsonObject
.
toJSONString
());
logger
.
debug
(
"查询订单返回结果: {}
"
+
jsonObject
.
toJSONString
());
// 支付成功
// 支付成功
if
(
"0000"
.
equals
(
jsonObject
.
get
(
"code"
))){
if
(
"0000"
.
equals
(
jsonObject
.
get
(
"code"
))){
//订单已经支付成功,则不进行再次修改,可能存在多次回调,所以进行判断
if
(
orderEntity
.
getPayStatus
()!=
"2"
){
orderEntity
.
setPayStatus
(
"2"
);
orderEntity
.
setPayStatus
(
"2"
);
payDao
.
updateOrderStatus
(
orderEntity
);
payDao
.
updateOrderStatus
(
orderEntity
);
}
}
else
{
// 支付失败
}
else
{
// 支付失败
orderFail
(
orderEntity
);
orderFail
(
orderEntity
);
}
}
...
...
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