Toggle navigation
Toggle navigation
This project
Loading...
Sign in
zyn
/
cjs-site
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
yehefeng
2025-03-24 13:30:27 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
dd386be60419d5466be15fb59828ec994f7989f0
dd386be6
1 parent
cd28f3ec
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
83 deletions
src/main/java/com/cjs/site/action/user/fund/PickPayAction.java
src/main/java/com/cjs/site/biz/user/pick/PickPayBiz.java
src/main/webapp/view/user/pick/payInfo.jsp
src/main/java/com/cjs/site/action/user/fund/PickPayAction.java
View file @
dd386be
...
...
@@ -34,17 +34,6 @@ public class PickPayAction {
return
pickPayBiz
.
createOrder
(
session
);
}
//支付通知
@RequestMapping
(
value
=
"notify"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
String
notify
(
HttpServletRequest
request
)
{
Map
<
String
,
String
>
params
=
UnionPayUtil
.
getRequestParams
(
request
);
System
.
out
.
println
(
"银联支付推送回调参数:"
+
JsonUtil
.
toJson
(
params
));
if
(
pickPayBiz
.
isValidNotify
(
params
))
{
return
"SUCCESS"
;
}
return
"FAILED"
;
}
@RequestMapping
(
value
=
"query"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
...
...
src/main/java/com/cjs/site/biz/user/pick/PickPayBiz.java
View file @
dd386be
...
...
@@ -138,18 +138,12 @@ public class PickPayBiz {
OutpropApplyPickInfo
pickInfo
=
(
OutpropApplyPickInfo
)
session
.
getAttribute
(
"pickInfo"
);
pickInfo
.
setCreateTime
((
String
)
session
.
getAttribute
(
"pack"
));
//将提货方式放入createTime属性里
createQrCode
.
setSrcReserve
(
JsonUtil
.
toJsonRemoveNull
(
pickInfo
));
@SuppressWarnings
(
"unchecked"
)
Map
<
String
,
String
>
mapTypes
=
JsonUtil
.
fromJson
(
JsonUtil
.
toJson
(
createQrCode
),
Map
.
class
);
String
json
=
UnionPayUtil
.
sendPost
(
UnionConstants
.
CREATE_ORDER
,
mapTypes
);
UnionResponse
response
=
JsonUtil
.
fromJson
(
json
,
UnionResponse
.
class
);
if
(
response
!=
null
&&
response
.
getErrCode
().
equals
(
UnionConstants
.
SUCCESS_CODE
))
{
result
.
put
(
"qrCode"
,
UnionPayUtil
.
createQrCode
(
createQrCode
.
getQrCodeId
()));
result
.
put
(
"billNo"
,
createQrCode
.
getBillNo
());
insertPickPay
(
userId
,
createQrCode
.
getBillNo
(),
createQrCode
.
getSrcReserve
(),
totalAmount
.
toString
(),
trustCycle
);
}
else
{
result
.
put
(
"code"
,
false
);
result
.
put
(
"msg"
,
response
.
getErrMsg
());
}
//插入支付记录
insertPickPay
(
userId
,
createQrCode
.
getBillNo
(),
createQrCode
.
getSrcReserve
(),
totalAmount
.
toString
(),
trustCycle
);
//验证支付
this
.
isValidNotify
(
pickInfo
,
createQrCode
.
getBillNo
(),
"PAID"
);
result
.
put
(
"code"
,
true
);
}
catch
(
Exception
e
)
{
result
.
put
(
"code"
,
false
);
result
.
put
(
"msg"
,
e
.
getMessage
());
...
...
@@ -157,12 +151,12 @@ public class PickPayBiz {
return
result
;
}
public
Boolean
isValidNotify
(
Map
<
String
,
String
>
result
)
{
if
(
UnionPayUtil
.
checkSign
(
result
)
)
{
public
Boolean
isValidNotify
(
OutpropApplyPickInfo
pickInfo
,
String
billNo
,
String
billStatus
)
{
if
(
billNo
!=
null
)
{
OutpropApplyPayInfo
update
=
new
OutpropApplyPayInfo
();
String
tradeNo
=
result
.
get
(
"billNo"
)
;
String
tradeNo
=
billNo
;
update
.
setTradeNo
(
tradeNo
);
if
(
result
.
get
(
"billStatus"
)
.
equals
(
UnionConstants
.
NOTIFY_PAY_STATUS
))
{
if
(
billStatus
.
equals
(
UnionConstants
.
NOTIFY_PAY_STATUS
))
{
DefaultTransactionDefinition
def
=
new
DefaultTransactionDefinition
();
def
.
setPropagationBehavior
(
TransactionDefinition
.
PROPAGATION_REQUIRED
);
TransactionStatus
status
=
transactionManager
.
getTransaction
(
def
);
...
...
@@ -171,8 +165,6 @@ public class PickPayBiz {
if
(!
info
.
getStatus
().
equals
(
"2"
))
{
update
.
setStatus
(
"2"
);
outpropApplyPayDao
.
update
(
update
);
OutpropApplyPickInfo
pickInfo
=
JsonUtil
.
fromJson
(
result
.
get
(
"srcReserve"
),
OutpropApplyPickInfo
.
class
);
pickInfo
.
setClientId
(
info
.
getClientId
());
pickInfo
.
setAmount
(
info
.
getAmount
());
pickInfo
.
setTrusteeshipCycle
(
info
.
getTrusteeshipCycle
());
...
...
@@ -189,7 +181,7 @@ public class PickPayBiz {
}
catch
(
Exception
e
)
{
transactionManager
.
rollback
(
status
);
}
}
else
if
(
result
.
get
(
"billStatus"
)
.
equals
(
"REFUND"
))
{
}
else
if
(
billStatus
.
equals
(
"REFUND"
))
{
update
.
setStatus
(
"4"
);
//退款
outpropApplyPayDao
.
update
(
update
);
}
else
{
...
...
src/main/webapp/view/user/pick/payInfo.jsp
View file @
dd386be
...
...
@@ -36,60 +36,25 @@
},
showPayDialog
:
function
()
{
$
.
ajax
({
type
:
"get"
,
url
:
"/pick/unionPay/createOrder"
,
success
:
function
(
data
)
{
if
(
data
.
code
)
{
var
laytpl
=
layui
.
laytpl
;
layer
.
open
({
type
:
1
,
title
:
'付款码'
,
closeBtn
:
1
,
area
:
[
'800px;'
,
'500px'
],
shade
:
0.8
,
id
:
'payDialogContent'
,
skin
:
'payDialogContent'
,
btnAlign
:
'c'
,
moveType
:
1
,
content
:
''
,
cancel
:
function
(){
Pay
.
count
=
16
;
window
.
clearInterval
(
Pay
.
interval
);
}
});
var
htmlStr
=
''
;
htmlStr
+=
'<div style="width:100%;height:50px;font-size:16px;text-align:center;padding-top:30px;">'
htmlStr
+=
'请打开微信或支付宝app扫码进行支付'
htmlStr
+=
'</div>'
htmlStr
+=
'<div style="width:100%;height:60px;font-size:22px;text-align:center;color:#f20000;font-weight:bold;">'
htmlStr
+=
data
.
totalAmount
+
'元'
htmlStr
+=
'</div>'
htmlStr
+=
'<div style="width: 200px;height: 200px;margin: 0 auto;">'
htmlStr
+=
'<div style="width:100%;height:100%;position: relative;" id="qrcode"></div>'
htmlStr
+=
'</div>'
htmlStr
+=
'<div style="width:100%;height:30px;font-size:16px;text-align:center;padding-top:30px;">'
htmlStr
+=
'付款码每2分钟刷新一次,请在规定时间内完成付款'
htmlStr
+=
'</div>'
$
(
'#payDialogContent'
).
html
(
htmlStr
);
var
qrcode
=
new
QRCode
(
document
.
getElementById
(
"qrcode"
),
{
width
:
200
,
height
:
200
,
background
:
"#ffffff"
});
qrcode
.
clear
();
qrcode
.
makeCode
(
data
.
qrCode
);
Pay
.
count
=
1
;
Pay
.
billNo
=
data
.
billNo
;
setTimeout
(
function
()
{
Pay
.
interval
=
setInterval
(
function
()
{
Pay
.
ajaxstatus
()},
5000
);
},
3000
);
Pay
.
_timer
();
}
else
{
layer
.
msg
(
data
.
msg
,
{
icon
:
'2'
});
layer
.
confirm
(
'是否申请提货或发货?'
,
{
icon
:
3
,
title
:
'取消'
},
function
(
index
){
$
.
ajax
({
type
:
"get"
,
url
:
"/pick/unionPay/createOrder"
,
success
:
function
(
data
)
{
if
(
data
.
code
)
{
layer
.
msg
(
"提货或者发货成功"
,
{
icon
:
'1'
});
}
else
{
layer
.
msg
(
data
.
msg
,
{
icon
:
'2'
});
}
}
}
});
});
layer
.
close
(
index
);
});
},
ajaxstatus
:
function
()
{
$
.
ajax
({
...
...
Please
register
or
login
to post a comment