Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
browser-backend
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
Administrator
browser-backend
Commits
12775a91
Commit
12775a91
authored
Aug 12, 2020
by
xuxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改userpayment中 paymentDate 的含义
parent
f937d266
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
12 deletions
+16
-12
UserPayment.java
.../com/edgec/browserbackend/account/domain/UserPayment.java
+5
-1
UserPaymentRepositoryCustom.java
...ckend/account/repository/UserPaymentRepositoryCustom.java
+3
-1
UserPaymentRepositoryCustomImpl.java
...d/account/repository/UserPaymentRepositoryCustomImpl.java
+5
-5
PaymentServiceImpl.java
...owserbackend/account/service/impl/PaymentServiceImpl.java
+3
-5
No files found.
src/main/java/com/edgec/browserbackend/account/domain/UserPayment.java
View file @
12775a91
...
@@ -15,7 +15,7 @@ public class UserPayment {
...
@@ -15,7 +15,7 @@ public class UserPayment {
@Id
@Id
private
String
id
;
private
String
id
;
private
String
tradeNo
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
).
format
(
new
Date
())
+
SmsUtils
.
createRandom
(
true
,
4
);
private
String
tradeNo
=
new
SimpleDateFormat
(
"yyyyMMddHHmmss"
).
format
(
new
Date
())
+
SmsUtils
.
createRandom
(
true
,
4
);
private
String
username
;
private
String
username
;
...
@@ -23,6 +23,10 @@ public class UserPayment {
...
@@ -23,6 +23,10 @@ public class UserPayment {
private
boolean
succeed
;
private
boolean
succeed
;
/**
* 感觉这个时间记录的是订单创建时间不太合理
* 在业务中修改为 我们系统中记录的订单充值成功的时间
*/
private
Date
paymentDate
=
new
Date
();
private
Date
paymentDate
=
new
Date
();
private
PaymentMethod
paymentMethod
;
private
PaymentMethod
paymentMethod
;
...
...
src/main/java/com/edgec/browserbackend/account/repository/UserPaymentRepositoryCustom.java
View file @
12775a91
...
@@ -3,8 +3,10 @@ package com.edgec.browserbackend.account.repository;
...
@@ -3,8 +3,10 @@ package com.edgec.browserbackend.account.repository;
import
com.edgec.browserbackend.account.domain.UserPayment
;
import
com.edgec.browserbackend.account.domain.UserPayment
;
import
java.util.Date
;
public
interface
UserPaymentRepositoryCustom
{
public
interface
UserPaymentRepositoryCustom
{
boolean
updatePaymentResult
(
UserPayment
payment
,
boolean
result
);
boolean
updatePaymentResult
(
UserPayment
payment
,
boolean
result
,
Date
paymentDate
);
}
}
src/main/java/com/edgec/browserbackend/account/repository/UserPaymentRepositoryCustomImpl.java
View file @
12775a91
...
@@ -8,6 +8,8 @@ import org.springframework.data.mongodb.core.MongoTemplate;
...
@@ -8,6 +8,8 @@ import org.springframework.data.mongodb.core.MongoTemplate;
import
org.springframework.data.mongodb.core.query.BasicQuery
;
import
org.springframework.data.mongodb.core.query.BasicQuery
;
import
org.springframework.data.mongodb.core.query.Update
;
import
org.springframework.data.mongodb.core.query.Update
;
import
java.util.Date
;
import
static
org
.
springframework
.
data
.
mongodb
.
core
.
query
.
Criteria
.
where
;
import
static
org
.
springframework
.
data
.
mongodb
.
core
.
query
.
Criteria
.
where
;
public
class
UserPaymentRepositoryCustomImpl
implements
UserPaymentRepositoryCustom
{
public
class
UserPaymentRepositoryCustomImpl
implements
UserPaymentRepositoryCustom
{
...
@@ -16,18 +18,16 @@ public class UserPaymentRepositoryCustomImpl implements UserPaymentRepositoryCus
...
@@ -16,18 +18,16 @@ public class UserPaymentRepositoryCustomImpl implements UserPaymentRepositoryCus
private
MongoTemplate
mongoTemplate
;
private
MongoTemplate
mongoTemplate
;
@Override
@Override
public
boolean
updatePaymentResult
(
UserPayment
payment
,
boolean
result
)
{
public
boolean
updatePaymentResult
(
UserPayment
payment
,
boolean
result
,
Date
paymentDate
)
{
Document
doc
=
new
Document
();
Document
doc
=
new
Document
();
BasicQuery
basicQuery
=
new
BasicQuery
(
doc
);
BasicQuery
basicQuery
=
new
BasicQuery
(
doc
);
basicQuery
.
addCriteria
(
where
(
"id"
).
is
(
payment
.
getId
()).
and
(
"succeed"
).
is
(!
result
));
basicQuery
.
addCriteria
(
where
(
"id"
).
is
(
payment
.
getId
()).
and
(
"succeed"
).
is
(!
result
));
Update
update
=
new
Update
();
Update
update
=
new
Update
();
update
.
set
(
"succeed"
,
result
);
update
.
set
(
"succeed"
,
result
);
update
.
set
(
"paymentDate"
,
paymentDate
);
UpdateResult
operation
=
mongoTemplate
.
updateFirst
(
basicQuery
,
update
,
UserPayment
.
class
);
UpdateResult
operation
=
mongoTemplate
.
updateFirst
(
basicQuery
,
update
,
UserPayment
.
class
);
if
(
operation
.
getModifiedCount
()
<
1
)
return
operation
.
getModifiedCount
()
>=
1
;
return
false
;
else
return
true
;
}
}
}
}
src/main/java/com/edgec/browserbackend/account/service/impl/PaymentServiceImpl.java
View file @
12775a91
...
@@ -556,7 +556,6 @@ public class PaymentServiceImpl implements PaymentService {
...
@@ -556,7 +556,6 @@ public class PaymentServiceImpl implements PaymentService {
result
.
setBalance
(
Math
.
round
(
balance
.
getBalanced
()));
result
.
setBalance
(
Math
.
round
(
balance
.
getBalanced
()));
}
}
boolean
isVpsClient
=
true
;
boolean
isVpsClient
=
true
;
WXPayConfig
ourWxPayConfig
=
isVpsClient
?
new
FGLWxConfig
()
:
new
CloudamWxConfig
();
WXPayConfig
ourWxPayConfig
=
isVpsClient
?
new
FGLWxConfig
()
:
new
CloudamWxConfig
();
WXPay
wxPay
=
new
WXPay
(
ourWxPayConfig
);
WXPay
wxPay
=
new
WXPay
(
ourWxPayConfig
);
...
@@ -576,8 +575,7 @@ public class PaymentServiceImpl implements PaymentService {
...
@@ -576,8 +575,7 @@ public class PaymentServiceImpl implements PaymentService {
result
.
setStatus
(
respData
.
get
(
"trade_state"
));
result
.
setStatus
(
respData
.
get
(
"trade_state"
));
if
(
"SUCCESS"
.
equals
(
respData
.
get
(
"trade_state"
)))
{
if
(
"SUCCESS"
.
equals
(
respData
.
get
(
"trade_state"
)))
{
byTradeNo
.
setSucceed
(
true
);
byTradeNo
.
setSucceed
(
true
);
boolean
b
=
userPaymentRepository
.
updatePaymentResult
(
byTradeNo
,
true
,
new
Date
());
boolean
b
=
userPaymentRepository
.
updatePaymentResult
(
byTradeNo
,
true
);
if
(
b
)
{
if
(
b
)
{
if
(
balance
==
null
)
{
if
(
balance
==
null
)
{
...
@@ -644,7 +642,7 @@ public class PaymentServiceImpl implements PaymentService {
...
@@ -644,7 +642,7 @@ public class PaymentServiceImpl implements PaymentService {
if
(
"TRADE_SUCCESS"
.
equals
(
response
.
getTradeStatus
())
||
"TRADE_FINISHED"
.
equals
(
response
.
getTradeStatus
()))
{
if
(
"TRADE_SUCCESS"
.
equals
(
response
.
getTradeStatus
())
||
"TRADE_FINISHED"
.
equals
(
response
.
getTradeStatus
()))
{
byTradeNo
.
setSucceed
(
true
);
byTradeNo
.
setSucceed
(
true
);
boolean
b
=
userPaymentRepository
.
updatePaymentResult
(
byTradeNo
,
true
);
boolean
b
=
userPaymentRepository
.
updatePaymentResult
(
byTradeNo
,
true
,
new
Date
()
);
if
(
b
)
{
if
(
b
)
{
...
@@ -791,7 +789,7 @@ public class PaymentServiceImpl implements PaymentService {
...
@@ -791,7 +789,7 @@ public class PaymentServiceImpl implements PaymentService {
private
void
dealPaySuccess
(
int
chargeType
,
UserPaymentDto
result
,
UserPayment
byTradeNo
,
Account
byName
,
UserBalance
balance
)
{
private
void
dealPaySuccess
(
int
chargeType
,
UserPaymentDto
result
,
UserPayment
byTradeNo
,
Account
byName
,
UserBalance
balance
)
{
byTradeNo
.
setSucceed
(
true
);
byTradeNo
.
setSucceed
(
true
);
// 2.1 更新 userPayment 的支付状态为成功
// 2.1 更新 userPayment 的支付状态为成功
boolean
b
=
userPaymentRepository
.
updatePaymentResult
(
byTradeNo
,
true
);
boolean
b
=
userPaymentRepository
.
updatePaymentResult
(
byTradeNo
,
true
,
new
Date
()
);
if
(
b
)
{
if
(
b
)
{
log
.
info
(
"订单 "
+
byTradeNo
.
getTradeNo
()
+
" 的支付状态更新为成功"
);
log
.
info
(
"订单 "
+
byTradeNo
.
getTradeNo
()
+
" 的支付状态更新为成功"
);
// 2.2 获取充值优惠赠送
// 2.2 获取充值优惠赠送
...
...
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