Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
baa-pay-server
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
贺超
baa-pay-server
Commits
5f70e1fe
Commit
5f70e1fe
authored
Aug 28, 2021
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建项目
parent
3aac1d6d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
20 deletions
+29
-20
BusinessService.java
...c/main/java/cn/quant/baa/pay/service/BusinessService.java
+25
-0
TransactionService.java
...ain/java/cn/quant/baa/pay/service/TransactionService.java
+3
-0
BusinessController.java
...c/main/java/cn/quant/baa/pay/rest/BusinessController.java
+0
-19
TransactionController.java
...ain/java/cn/quant/baa/pay/rest/TransactionController.java
+1
-1
No files found.
baa-pay-core/src/main/java/cn/quant/baa/pay/service/BusinessService.java
View file @
5f70e1fe
...
...
@@ -10,7 +10,10 @@ import cn.quant.baa.pay.jpa.entity.AccountIds;
import
cn.quant.baa.pay.jpa.entity.EntityBuilder
;
import
cn.quant.baa.pay.jpa.repository.AccountRepository
;
import
cn.quant.baa.pay.model.AssertUtils
;
import
cn.quant.spring.IllegalParameterException
;
import
cn.quant.spring.NullException
;
import
cn.quant.spring.context.ContextLoader
;
import
cn.quant.spring.context.ServerApplicationContext
;
import
cn.quant.spring.util.DateUtils
;
import
cn.quant.spring.util.StringUtils
;
import
org.slf4j.Logger
;
...
...
@@ -20,9 +23,12 @@ import org.springframework.data.jpa.repository.JpaRepository;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.validation.ConstraintViolation
;
import
javax.validation.Validator
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.util.Date
;
import
java.util.Set
;
import
static
cn
.
quant
.
baa
.
pay
.
Constant
.
MINI_LOCAL_DATE
;
import
static
cn
.
quant
.
baa
.
pay
.
dict
.
MessageEnum
.*;
...
...
@@ -34,6 +40,25 @@ public abstract class BusinessService {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
BusinessService
.
class
);
@Autowired
private
Validator
validator
;
public
<
T
>
void
validate
(
T
t
)
{
if
(
t
==
null
)
{
throw
new
NullException
();
}
Set
<
ConstraintViolation
<
T
>>
validate
=
validator
.
validate
(
t
);
if
(
validate
.
size
()
>
0
)
{
ConstraintViolation
<
T
>
next
=
validate
.
iterator
().
next
();
String
s
=
next
.
getPropertyPath
().
toString
();
String
template
=
next
.
getMessageTemplate
();
ServerApplicationContext
applicationContext
=
ContextLoader
.
getCurrentApplicationContext
();
String
message
=
applicationContext
.
getMessage
(
template
,
"{0}-Illegal request parameter"
,
(
Object
)
s
);
throw
new
IllegalParameterException
(
message
);
}
}
public
TransactionSession
prepare
(
String
institutionId
,
String
productId
,
String
buyerId
,
TransactionSession
session
)
{
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/service/TransactionService.java
View file @
5f70e1fe
...
...
@@ -40,6 +40,9 @@ public class TransactionService extends BusinessService {
@Transactional
public
void
pay
(
PayRequestData
data
)
{
validate
(
data
);
String
chanId
=
data
.
getChanId
();
MerchantAcquirerProfile
profile
=
merchantAcquirerBuilder
.
get
(
Long
.
valueOf
(
chanId
));
if
(
profile
==
null
)
{
...
...
baa-pay-server/src/main/java/cn/quant/baa/pay/rest/BusinessController.java
View file @
5f70e1fe
...
...
@@ -19,23 +19,4 @@ import static cn.quant.baa.pay.dict.MessageEnum.EMPTY_REQ_DATA;
*/
public
abstract
class
BusinessController
extends
AbstractController
{
@Autowired
private
Validator
validator
;
public
<
T
>
void
validate
(
T
t
)
{
if
(
t
==
null
)
{
throw
new
NullException
();
}
Set
<
ConstraintViolation
<
T
>>
validate
=
validator
.
validate
(
t
);
if
(
validate
.
size
()
>
0
)
{
ConstraintViolation
<
T
>
next
=
validate
.
iterator
().
next
();
String
s
=
next
.
getPropertyPath
().
toString
();
String
template
=
next
.
getMessageTemplate
();
ServerApplicationContext
applicationContext
=
ContextLoader
.
getCurrentApplicationContext
();
String
message
=
applicationContext
.
getMessage
(
template
,
"{0}-Illegal request parameter"
,
(
Object
)
s
);
throw
new
IllegalParameterException
(
message
);
}
}
}
baa-pay-server/src/main/java/cn/quant/baa/pay/rest/TransactionController.java
View file @
5f70e1fe
...
...
@@ -31,7 +31,7 @@ public class TransactionController extends BusinessController {
PayRequestData
data
=
request
.
getData
();
validate
(
data
);
transactionService
.
pay
(
data
);
...
...
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