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
ee1659fd
Commit
ee1659fd
authored
Aug 26, 2021
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建项目
parent
f64ea89a
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
566 additions
and
56 deletions
+566
-56
hibernate.cfg.xml
baa-pay-core/hibernate.cfg.xml
+2
-1
ThreadSessionAspect.java
...ain/java/cn/quant/baa/pay/aspect/ThreadSessionAspect.java
+39
-39
TransactionSession.java
...ain/java/cn/quant/baa/pay/context/TransactionSession.java
+15
-6
PayHistoryEntity.java
...in/java/cn/quant/baa/pay/jpa/entity/PayHistoryEntity.java
+388
-0
PayHistoryIds.java
.../main/java/cn/quant/baa/pay/jpa/entity/PayHistoryIds.java
+82
-0
BusinessService.java
...c/main/java/cn/quant/baa/pay/service/BusinessService.java
+18
-1
TransactionService.java
...ain/java/cn/quant/baa/pay/service/TransactionService.java
+17
-2
TransactionController.java
...ain/java/cn/quant/baa/pay/rest/TransactionController.java
+1
-3
application-dev.properties
...rver/src/main/resources/config/application-dev.properties
+3
-3
logback-spring.xml
baa-pay-server/src/main/resources/logback-spring.xml
+1
-1
No files found.
baa-pay-core/hibernate.cfg.xml
View file @
ee1659fd
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
<session-factory>
<session-factory>
<!-- Database connection settings -->
<!-- Database connection settings -->
<property
name=
"connection.driver_class"
>
com.mysql.jdbc.Driver
</property>
<property
name=
"connection.driver_class"
>
com.mysql.jdbc.Driver
</property>
<property
name=
"connection.url"
>
jdbc:mysql://1
27.0.0.1:3306/baa_pay_v
1.0
</property>
<property
name=
"connection.url"
>
jdbc:mysql://1
72.17.5.17:31548/baa_pay_
1.0
</property>
<!-- JDBC connection pool (use the built-in) -->
<!-- JDBC connection pool (use the built-in) -->
<!--
<!--
...
@@ -28,6 +28,7 @@
...
@@ -28,6 +28,7 @@
<mapping
class=
"cn.quant.baa.pay.jpa.entity.DictionaryEntity"
/>
<mapping
class=
"cn.quant.baa.pay.jpa.entity.DictionaryEntity"
/>
<mapping
class=
"cn.quant.baa.pay.jpa.entity.CustomerEntity"
/>
<mapping
class=
"cn.quant.baa.pay.jpa.entity.CustomerEntity"
/>
<mapping
class=
"cn.quant.baa.pay.jpa.entity.AccountEntity"
/>
<mapping
class=
"cn.quant.baa.pay.jpa.entity.AccountEntity"
/>
<mapping
class=
"cn.quant.baa.pay.jpa.entity.PayHistoryEntity"
/>
<!-- Drop and re-create the database schema on startup -->
<!-- Drop and re-create the database schema on startup -->
<!--
<!--
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/aspect/ThreadSessionAspect.java
View file @
ee1659fd
package
cn
.
quant
.
baa
.
pay
.
aspect
;
//
package cn.quant.baa.pay.aspect;
//
import
cn.quant.spring.annotation.ThreadSession
;
//
import cn.quant.spring.annotation.ThreadSession;
import
cn.quant.spring.context.ServerApplicationContext
;
//
import cn.quant.spring.context.ServerApplicationContext;
import
org.aspectj.lang.ProceedingJoinPoint
;
//
import org.aspectj.lang.ProceedingJoinPoint;
import
org.aspectj.lang.annotation.Around
;
//
import org.aspectj.lang.annotation.Around;
import
org.aspectj.lang.annotation.Aspect
;
//
import org.aspectj.lang.annotation.Aspect;
import
org.aspectj.lang.annotation.Pointcut
;
//
import org.aspectj.lang.annotation.Pointcut;
import
org.aspectj.lang.reflect.MethodSignature
;
//
import org.aspectj.lang.reflect.MethodSignature;
import
org.slf4j.Logger
;
//
import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
//
import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
//
import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
//
import org.springframework.stereotype.Component;
//
import
java.lang.reflect.Method
;
//
import java.lang.reflect.Method;
//
/**
/
//
**
* Created by Administrator on 2021/8/23 0023.
//
* Created by Administrator on 2021/8/23 0023.
*/
//
*/
@Aspect
//
@Aspect
@Component
//
@Component
public
class
ThreadSessionAspect
{
//
public class ThreadSessionAspect {
//
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ThreadSessionAspect
.
class
);
//
private static final Logger logger = LoggerFactory.getLogger(ThreadSessionAspect.class);
//
@Pointcut
(
"@annotation(cn.quant.spring.annotation.ThreadSession)"
)
//
@Pointcut("@annotation(cn.quant.spring.annotation.ThreadSession)")
public
void
pointCut
()
{
//
public void pointCut() {
}
//
}
//
@Around
(
"pointCut()"
)
//
@Around("pointCut()")
public
Object
Around
(
ProceedingJoinPoint
joinPoint
)
throws
Throwable
{
//
public Object Around(ProceedingJoinPoint joinPoint) throws Throwable {
MethodSignature
signature
=
(
MethodSignature
)
joinPoint
.
getSignature
();
//
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
Method
method
=
signature
.
getMethod
();
//
Method method = signature.getMethod();
ThreadSession
annotation
=
method
.
getAnnotation
(
ThreadSession
.
class
);
//
ThreadSession annotation = method.getAnnotation(ThreadSession.class);
logger
.
info
(
"---->>>> Thread session aspect {}."
,
annotation
.
value
());
//
logger.info("---->>>> Thread session aspect {}.", annotation.value());
Object
object
=
joinPoint
.
proceed
();
//
Object object = joinPoint.proceed();
return
object
;
//
return object;
}
//
}
}
//
}
baa-pay-core/src/main/java/cn/quant/baa/pay/context/TransactionSession.java
View file @
ee1659fd
package
cn
.
quant
.
baa
.
pay
.
context
;
package
cn
.
quant
.
baa
.
pay
.
context
;
import
cn.quant.baa.pay.jpa.entity.AccountEntity
;
import
cn.quant.baa.pay.model.BusinessRequest
;
import
cn.quant.baa.pay.model.BusinessRequest
;
import
cn.quant.spring.NullException
;
import
cn.quant.spring.NullException
;
import
cn.quant.spring.context.BusinessSession
;
import
cn.quant.spring.context.BusinessSession
;
...
@@ -23,6 +24,8 @@ public class TransactionSession extends BusinessSession {
...
@@ -23,6 +24,8 @@ public class TransactionSession extends BusinessSession {
private
RepositoryProxy
repositoryProxy
;
private
RepositoryProxy
repositoryProxy
;
private
AccountEntity
account
;
public
TransactionSession
(
ServerApplicationContext
context
)
{
public
TransactionSession
(
ServerApplicationContext
context
)
{
super
(
context
);
super
(
context
);
this
.
repositoryProxy
=
new
JapRepositoryProxy
(
context
.
getParent
());
this
.
repositoryProxy
=
new
JapRepositoryProxy
(
context
.
getParent
());
...
@@ -57,6 +60,15 @@ public class TransactionSession extends BusinessSession {
...
@@ -57,6 +60,15 @@ public class TransactionSession extends BusinessSession {
return
session
;
return
session
;
}
}
public
AccountEntity
getAccount
()
{
return
account
;
}
public
void
setAccount
(
AccountEntity
account
)
{
this
.
account
=
account
;
}
//repository
public
RepositoryProxy
getRepositoryProxy
()
{
public
RepositoryProxy
getRepositoryProxy
()
{
return
repositoryProxy
;
return
repositoryProxy
;
}
}
...
@@ -89,15 +101,12 @@ public class TransactionSession extends BusinessSession {
...
@@ -89,15 +101,12 @@ public class TransactionSession extends BusinessSession {
repositoryProxy
.
clear
();
repositoryProxy
.
clear
();
}
}
public
JpaRepository
getRepository
(
Class
cls
,
TransactionSession
session
)
{
public
JpaRepository
getRepository
(
Class
cls
)
{
return
repositoryProxy
.
getRepository
(
cls
);
return
repositoryProxy
.
getRepository
(
cls
);
}
}
public
<
T
>
T
findOne
(
Class
<
T
>
cls
,
Object
key
,
TransactionSession
session
)
{
public
<
T
>
T
findOne
(
Class
<
T
>
cls
,
Object
key
)
{
if
(
session
==
null
)
{
RepositoryProxy
repositoryProxy
=
this
.
getRepositoryProxy
();
throw
new
NullException
(
"Session is null."
);
}
RepositoryProxy
repositoryProxy
=
session
.
getRepositoryProxy
();
T
t
=
null
;
T
t
=
null
;
if
(
repositoryProxy
!=
null
)
{
if
(
repositoryProxy
!=
null
)
{
t
=
(
T
)
repositoryProxy
.
get
(
cls
,
key
);
t
=
(
T
)
repositoryProxy
.
get
(
cls
,
key
);
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/entity/PayHistoryEntity.java
0 → 100644
View file @
ee1659fd
package
cn
.
quant
.
baa
.
pay
.
jpa
.
entity
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.sql.Timestamp
;
import
java.time.LocalDate
;
import
java.time.LocalTime
;
import
java.util.Date
;
import
java.util.Objects
;
/**
* Created by Administrator on 2021/8/26 0026.
*/
@Entity
@Table
(
name
=
"pay_history"
)
public
class
PayHistoryEntity
extends
AuditedDescriptionEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
6297586921507136281L
;
@EmbeddedId
private
PayHistoryIds
ids
;
@Column
(
name
=
"TRANSACTION_ID"
,
nullable
=
false
,
updatable
=
false
)
private
Long
transactionId
;
@Column
(
name
=
"ACCOUNT_ID"
,
nullable
=
false
,
updatable
=
false
)
private
Long
accountId
;
@Column
(
name
=
"PAY_APP_ID"
,
nullable
=
false
,
updatable
=
false
,
length
=
32
)
private
String
payAppId
;
@Column
(
name
=
"PAY_CHAN_CODE"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
private
String
payChanCode
;
@Column
(
name
=
"PAY_ACCT_ID"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
private
String
payAcctId
;
@Column
(
name
=
"STATUS_CODE"
,
nullable
=
false
,
length
=
4
)
private
String
statusCode
;
@Column
(
name
=
"TXN_UUID"
,
nullable
=
false
,
updatable
=
false
,
length
=
64
)
private
String
txnUuid
;
@Column
(
name
=
"CURRENCY_CODE"
,
nullable
=
false
,
updatable
=
false
,
length
=
3
)
private
String
currencyCode
;
@Column
(
name
=
"PAY_METHOD"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
private
String
payMethod
;
@Column
(
name
=
"TXN_TYPE_CODE"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
private
String
txnTypeCode
;
@Column
(
name
=
"TXN_CODE"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
private
String
txnCode
;
@Column
(
name
=
"STATISTICS_CODE"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
private
String
statisticsCode
;
@Column
(
name
=
"CREDIT_DEBIT_FLAG"
,
nullable
=
false
,
updatable
=
false
,
length
=
1
)
private
String
creditDebitFlag
;
@Column
(
name
=
"CUSTOMER_GEN_FLAG"
,
nullable
=
false
,
updatable
=
false
,
length
=
1
)
private
Boolean
customerGenFlag
;
@Column
(
name
=
"ORIGINAL_TXN_AMOUNT"
,
nullable
=
false
,
updatable
=
false
,
precision
=
2
)
private
BigDecimal
originalTxnAmount
;
@Column
(
name
=
"TXN_AMOUNT"
,
nullable
=
false
,
updatable
=
false
,
precision
=
2
)
private
BigDecimal
txnAmount
;
@Column
(
name
=
"POSTING_AMOUNT"
,
nullable
=
false
,
updatable
=
false
,
precision
=
2
)
private
BigDecimal
postingAmount
;
@Column
(
name
=
"DISC_AMOUNT"
,
nullable
=
false
,
updatable
=
false
,
precision
=
2
)
private
BigDecimal
discAmount
;
@Column
(
name
=
"GEN_FEE_AMOUNT"
,
nullable
=
false
,
updatable
=
false
,
precision
=
2
)
private
BigDecimal
genFeeAmount
;
@Column
(
name
=
"STATEMENTE_FLAG"
,
nullable
=
false
,
updatable
=
false
,
length
=
1
)
private
Boolean
statementeFlag
;
@Column
(
name
=
"TXN_DATE"
,
nullable
=
false
,
updatable
=
false
)
private
LocalDate
txnDate
;
@Column
(
name
=
"TXN_TIME"
,
nullable
=
false
,
updatable
=
false
)
private
LocalTime
txnTime
;
@Column
(
name
=
"REQUEST_ID"
,
nullable
=
false
,
updatable
=
false
,
length
=
64
)
private
String
requestId
;
@Column
(
name
=
"REQUEST_TIME"
,
nullable
=
false
,
updatable
=
false
)
private
Date
requestTime
;
@Column
(
name
=
"MERCHANT_NAME"
,
nullable
=
true
,
length
=
255
)
private
String
merchantName
;
@Column
(
name
=
"MOBILE_PHONE"
,
nullable
=
true
,
length
=
13
)
private
String
mobilePhone
;
@Column
(
name
=
"NOTIFY_URL"
,
nullable
=
true
,
length
=
1000
)
private
String
notifyUrl
;
@Column
(
name
=
"ATTACH_TEXT"
,
nullable
=
true
,
length
=
512
)
private
String
attachText
;
public
PayHistoryIds
getIds
()
{
return
ids
;
}
public
void
setIds
(
PayHistoryIds
ids
)
{
this
.
ids
=
ids
;
}
public
Long
getTransactionId
()
{
return
transactionId
;
}
public
void
setTransactionId
(
Long
transactionId
)
{
this
.
transactionId
=
transactionId
;
}
public
Long
getAccountId
()
{
return
accountId
;
}
public
void
setAccountId
(
Long
accountId
)
{
this
.
accountId
=
accountId
;
}
public
String
getPayAppId
()
{
return
payAppId
;
}
public
void
setPayAppId
(
String
payAppId
)
{
this
.
payAppId
=
payAppId
;
}
public
String
getPayChanCode
()
{
return
payChanCode
;
}
public
void
setPayChanCode
(
String
payChanCode
)
{
this
.
payChanCode
=
payChanCode
;
}
public
String
getPayAcctId
()
{
return
payAcctId
;
}
public
void
setPayAcctId
(
String
payAcctId
)
{
this
.
payAcctId
=
payAcctId
;
}
public
String
getStatusCode
()
{
return
statusCode
;
}
public
void
setStatusCode
(
String
statusCode
)
{
this
.
statusCode
=
statusCode
;
}
public
String
getTxnUuid
()
{
return
txnUuid
;
}
public
void
setTxnUuid
(
String
txnUuid
)
{
this
.
txnUuid
=
txnUuid
;
}
public
String
getCurrencyCode
()
{
return
currencyCode
;
}
public
void
setCurrencyCode
(
String
currencyCode
)
{
this
.
currencyCode
=
currencyCode
;
}
public
String
getPayMethod
()
{
return
payMethod
;
}
public
void
setPayMethod
(
String
payMethod
)
{
this
.
payMethod
=
payMethod
;
}
public
String
getTxnTypeCode
()
{
return
txnTypeCode
;
}
public
void
setTxnTypeCode
(
String
txnTypeCode
)
{
this
.
txnTypeCode
=
txnTypeCode
;
}
public
String
getTxnCode
()
{
return
txnCode
;
}
public
void
setTxnCode
(
String
txnCode
)
{
this
.
txnCode
=
txnCode
;
}
public
String
getStatisticsCode
()
{
return
statisticsCode
;
}
public
void
setStatisticsCode
(
String
statisticsCode
)
{
this
.
statisticsCode
=
statisticsCode
;
}
public
String
getCreditDebitFlag
()
{
return
creditDebitFlag
;
}
public
void
setCreditDebitFlag
(
String
creditDebitFlag
)
{
this
.
creditDebitFlag
=
creditDebitFlag
;
}
public
Boolean
getCustomerGenFlag
()
{
return
customerGenFlag
;
}
public
void
setCustomerGenFlag
(
Boolean
customerGenFlag
)
{
this
.
customerGenFlag
=
customerGenFlag
;
}
public
BigDecimal
getOriginalTxnAmount
()
{
return
originalTxnAmount
;
}
public
void
setOriginalTxnAmount
(
BigDecimal
originalTxnAmount
)
{
this
.
originalTxnAmount
=
originalTxnAmount
;
}
public
BigDecimal
getTxnAmount
()
{
return
txnAmount
;
}
public
void
setTxnAmount
(
BigDecimal
txnAmount
)
{
this
.
txnAmount
=
txnAmount
;
}
public
BigDecimal
getPostingAmount
()
{
return
postingAmount
;
}
public
void
setPostingAmount
(
BigDecimal
postingAmount
)
{
this
.
postingAmount
=
postingAmount
;
}
public
BigDecimal
getDiscAmount
()
{
return
discAmount
;
}
public
void
setDiscAmount
(
BigDecimal
discAmount
)
{
this
.
discAmount
=
discAmount
;
}
public
BigDecimal
getGenFeeAmount
()
{
return
genFeeAmount
;
}
public
void
setGenFeeAmount
(
BigDecimal
genFeeAmount
)
{
this
.
genFeeAmount
=
genFeeAmount
;
}
public
Boolean
getStatementeFlag
()
{
return
statementeFlag
;
}
public
void
setStatementeFlag
(
Boolean
statementeFlag
)
{
this
.
statementeFlag
=
statementeFlag
;
}
public
LocalDate
getTxnDate
()
{
return
txnDate
;
}
public
void
setTxnDate
(
LocalDate
txnDate
)
{
this
.
txnDate
=
txnDate
;
}
public
LocalTime
getTxnTime
()
{
return
txnTime
;
}
public
void
setTxnTime
(
LocalTime
txnTime
)
{
this
.
txnTime
=
txnTime
;
}
public
String
getRequestId
()
{
return
requestId
;
}
public
void
setRequestId
(
String
requestId
)
{
this
.
requestId
=
requestId
;
}
public
Date
getRequestTime
()
{
return
requestTime
;
}
public
void
setRequestTime
(
Date
requestTime
)
{
this
.
requestTime
=
requestTime
;
}
public
String
getMerchantName
()
{
return
merchantName
;
}
public
void
setMerchantName
(
String
merchantName
)
{
this
.
merchantName
=
merchantName
;
}
public
String
getMobilePhone
()
{
return
mobilePhone
;
}
public
void
setMobilePhone
(
String
mobilePhone
)
{
this
.
mobilePhone
=
mobilePhone
;
}
public
String
getNotifyUrl
()
{
return
notifyUrl
;
}
public
void
setNotifyUrl
(
String
notifyUrl
)
{
this
.
notifyUrl
=
notifyUrl
;
}
public
String
getAttachText
()
{
return
attachText
;
}
public
void
setAttachText
(
String
attachText
)
{
this
.
attachText
=
attachText
;
}
@Override
public
String
persistenceKey
()
{
return
ids
.
persistenceKey
();
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
PayHistoryEntity
that
=
(
PayHistoryEntity
)
o
;
return
Objects
.
equals
(
ids
,
that
.
ids
);
}
@Override
public
String
toString
()
{
final
StringBuilder
sb
=
new
StringBuilder
(
"PayHistoryEntity{"
);
sb
.
append
(
"ids="
).
append
(
ids
);
sb
.
append
(
", transactionId="
).
append
(
transactionId
);
sb
.
append
(
", accountId="
).
append
(
accountId
);
sb
.
append
(
", payAppId='"
).
append
(
payAppId
).
append
(
'\''
);
sb
.
append
(
", payChanCode='"
).
append
(
payChanCode
).
append
(
'\''
);
sb
.
append
(
", payAcctId='"
).
append
(
payAcctId
).
append
(
'\''
);
sb
.
append
(
", statusCode='"
).
append
(
statusCode
).
append
(
'\''
);
sb
.
append
(
", txnUuid='"
).
append
(
txnUuid
).
append
(
'\''
);
sb
.
append
(
", currencyCode='"
).
append
(
currencyCode
).
append
(
'\''
);
sb
.
append
(
", payMethod='"
).
append
(
payMethod
).
append
(
'\''
);
sb
.
append
(
", txnTypeCode='"
).
append
(
txnTypeCode
).
append
(
'\''
);
sb
.
append
(
", txnCode='"
).
append
(
txnCode
).
append
(
'\''
);
sb
.
append
(
", statisticsCode='"
).
append
(
statisticsCode
).
append
(
'\''
);
sb
.
append
(
", creditDebitFlag='"
).
append
(
creditDebitFlag
).
append
(
'\''
);
sb
.
append
(
", customerGenFlag="
).
append
(
customerGenFlag
);
sb
.
append
(
", originalTxnAmount="
).
append
(
originalTxnAmount
);
sb
.
append
(
", txnAmount="
).
append
(
txnAmount
);
sb
.
append
(
", postingAmount="
).
append
(
postingAmount
);
sb
.
append
(
", discAmount="
).
append
(
discAmount
);
sb
.
append
(
", genFeeAmount="
).
append
(
genFeeAmount
);
sb
.
append
(
", statementeFlag="
).
append
(
statementeFlag
);
sb
.
append
(
", txnDate="
).
append
(
txnDate
);
sb
.
append
(
", txnTime="
).
append
(
txnTime
);
sb
.
append
(
", requestId='"
).
append
(
requestId
).
append
(
'\''
);
sb
.
append
(
", requestTime="
).
append
(
requestTime
);
sb
.
append
(
", merchantName='"
).
append
(
merchantName
).
append
(
'\''
);
sb
.
append
(
", mobilePhone='"
).
append
(
mobilePhone
).
append
(
'\''
);
sb
.
append
(
", notifyUrl='"
).
append
(
notifyUrl
).
append
(
'\''
);
sb
.
append
(
", attachText='"
).
append
(
attachText
).
append
(
'\''
);
sb
.
append
(
','
).
append
(
super
.
toString
());
sb
.
append
(
'}'
);
return
sb
.
toString
();
}
}
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/entity/PayHistoryIds.java
0 → 100644
View file @
ee1659fd
package
cn
.
quant
.
baa
.
pay
.
jpa
.
entity
;
import
cn.quant.spring.data.jpa.entity.EntityPrimaryIds
;
import
cn.quant.spring.util.StringUtils
;
import
javax.persistence.Column
;
import
javax.persistence.Embeddable
;
import
java.io.Serializable
;
import
java.util.Objects
;
/**
* Created by Administrator on 2021/8/26 0026.
*/
@Embeddable
public
class
PayHistoryIds
extends
EntityPrimaryIds
implements
Serializable
{
public
final
static
String
CLASS_NAME
=
PayHistoryEntity
.
class
.
getSimpleName
();
@Column
(
name
=
"INSTITUTION_ID"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
private
String
institutionId
;
@Column
(
name
=
"PRODUCT_ID"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
private
String
productId
;
@Column
(
name
=
"EXTERNAL_ORDER_NO"
,
nullable
=
false
,
updatable
=
false
,
length
=
64
)
private
String
externalOrderNo
;
public
String
getInstitutionId
()
{
return
institutionId
;
}
public
void
setInstitutionId
(
String
institutionId
)
{
this
.
institutionId
=
institutionId
;
}
public
String
getProductId
()
{
return
productId
;
}
public
void
setProductId
(
String
productId
)
{
this
.
productId
=
productId
;
}
public
String
getExternalOrderNo
()
{
return
externalOrderNo
;
}
public
void
setExternalOrderNo
(
String
externalOrderNo
)
{
this
.
externalOrderNo
=
externalOrderNo
;
}
@Override
public
String
persistenceKey
()
{
return
StringUtils
.
toDelimitedString
(
CLASS_NAME
,
institutionId
,
productId
,
externalOrderNo
);
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
PayHistoryIds
that
=
(
PayHistoryIds
)
o
;
return
Objects
.
equals
(
institutionId
,
that
.
institutionId
)
&&
Objects
.
equals
(
productId
,
that
.
productId
)
&&
Objects
.
equals
(
externalOrderNo
,
that
.
externalOrderNo
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
CLASS_NAME
,
institutionId
,
productId
,
externalOrderNo
);
}
@Override
public
String
toString
()
{
final
StringBuilder
sb
=
new
StringBuilder
(
"PayHistoryIds{"
);
sb
.
append
(
"institutionId='"
).
append
(
institutionId
).
append
(
'\''
);
sb
.
append
(
", productId='"
).
append
(
productId
).
append
(
'\''
);
sb
.
append
(
", externalOrderNo='"
).
append
(
externalOrderNo
).
append
(
'\''
);
sb
.
append
(
','
).
append
(
super
.
toString
());
sb
.
append
(
'}'
);
return
sb
.
toString
();
}
}
baa-pay-core/src/main/java/cn/quant/baa/pay/service/BusinessService.java
View file @
ee1659fd
...
@@ -7,14 +7,21 @@ import cn.quant.baa.pay.dict.CurrencyCode;
...
@@ -7,14 +7,21 @@ import cn.quant.baa.pay.dict.CurrencyCode;
import
cn.quant.baa.pay.dict.StatusCode
;
import
cn.quant.baa.pay.dict.StatusCode
;
import
cn.quant.baa.pay.jpa.entity.AccountEntity
;
import
cn.quant.baa.pay.jpa.entity.AccountEntity
;
import
cn.quant.baa.pay.jpa.entity.AccountIds
;
import
cn.quant.baa.pay.jpa.entity.AccountIds
;
import
cn.quant.baa.pay.jpa.repository.AccountRepository
;
import
cn.quant.baa.pay.model.AssertUtils
;
import
cn.quant.baa.pay.model.AssertUtils
;
import
cn.quant.spring.NullException
;
import
cn.quant.spring.util.DateUtils
;
import
cn.quant.spring.util.StringUtils
;
import
cn.quant.spring.util.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.util.Date
;
import
static
cn
.
quant
.
baa
.
pay
.
Constant
.
MINI_LOCAL_DATE
;
import
static
cn
.
quant
.
baa
.
pay
.
Constant
.
MINI_LOCAL_DATE
;
import
static
cn
.
quant
.
baa
.
pay
.
dict
.
MessageEnum
.*;
import
static
cn
.
quant
.
baa
.
pay
.
dict
.
MessageEnum
.*;
...
@@ -31,6 +38,10 @@ public abstract class BusinessService {
...
@@ -31,6 +38,10 @@ public abstract class BusinessService {
public
void
prepare
(
String
institutionId
,
String
productId
,
String
buyerId
,
TransactionSession
session
)
{
public
void
prepare
(
String
institutionId
,
String
productId
,
String
buyerId
,
TransactionSession
session
)
{
if
(
session
==
null
)
{
throw
new
NullException
(
"Session is null."
);
}
if
(
StringUtils
.
isEmpty
(
institutionId
))
{
if
(
StringUtils
.
isEmpty
(
institutionId
))
{
AssertUtils
.
throwMessage
(
INSTITUTION_ID_ILLEGAL
);
AssertUtils
.
throwMessage
(
INSTITUTION_ID_ILLEGAL
);
}
}
...
@@ -46,7 +57,7 @@ public abstract class BusinessService {
...
@@ -46,7 +57,7 @@ public abstract class BusinessService {
AccountIds
ids
=
new
AccountIds
();
AccountIds
ids
=
new
AccountIds
();
ids
.
setInstitutionId
(
institutionId
);
ids
.
setInstitutionId
(
institutionId
);
ids
.
setAccountRefNo
(
buyerId
);
ids
.
setAccountRefNo
(
buyerId
);
AccountEntity
account
=
session
.
findOne
(
AccountEntity
.
class
,
ids
,
session
);
AccountEntity
account
=
session
.
findOne
(
AccountEntity
.
class
,
ids
);
if
(
account
==
null
)
{
if
(
account
==
null
)
{
Long
id
=
sequencer
.
nextId
(
buyerId
.
hashCode
());
Long
id
=
sequencer
.
nextId
(
buyerId
.
hashCode
());
LocalDate
now
=
LocalDate
.
now
();
LocalDate
now
=
LocalDate
.
now
();
...
@@ -73,8 +84,14 @@ public abstract class BusinessService {
...
@@ -73,8 +84,14 @@ public abstract class BusinessService {
account
.
setTotalCredit
(
BigDecimal
.
ZERO
);
account
.
setTotalCredit
(
BigDecimal
.
ZERO
);
account
.
setTotalDebit
(
BigDecimal
.
ZERO
);
account
.
setTotalDebit
(
BigDecimal
.
ZERO
);
account
.
setTxnNo
(
0
);
account
.
setTxnNo
(
0
);
Date
date
=
DateUtils
.
now
();
account
.
setCreatedDate
(
date
);
account
.
setModifiedDate
(
date
);
account
.
setPartitionKey
(
sequencer
.
getPartitionKey
(
id
));
account
.
setPartitionKey
(
sequencer
.
getPartitionKey
(
id
));
session
.
pushEntity
(
account
);
session
.
pushEntity
(
account
);
}
}
session
.
setAccount
(
account
);
}
}
}
}
baa-pay-core/src/main/java/cn/quant/baa/pay/service/TransactionService.java
View file @
ee1659fd
...
@@ -10,6 +10,7 @@ import org.slf4j.Logger;
...
@@ -10,6 +10,7 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
static
cn
.
quant
.
baa
.
pay
.
dict
.
MessageEnum
.*;
import
static
cn
.
quant
.
baa
.
pay
.
dict
.
MessageEnum
.*;
...
@@ -25,7 +26,8 @@ public class TransactionService extends BusinessService {
...
@@ -25,7 +26,8 @@ public class TransactionService extends BusinessService {
@Autowired
@Autowired
private
MerchantAcquirerBuilder
merchantAcquirerBuilder
;
private
MerchantAcquirerBuilder
merchantAcquirerBuilder
;
public
void
pay
(
PayRequestData
data
,
TransactionSession
session
)
{
@Transactional
public
void
pay
(
PayRequestData
data
)
{
if
(
data
==
null
)
{
if
(
data
==
null
)
{
AssertUtils
.
throwMessage
(
EMPTY_REQ_DATA
);
AssertUtils
.
throwMessage
(
EMPTY_REQ_DATA
);
...
@@ -47,8 +49,21 @@ public class TransactionService extends BusinessService {
...
@@ -47,8 +49,21 @@ public class TransactionService extends BusinessService {
AssertUtils
.
throwMessage
(
ACQUIRER_NOMATCH
);
AssertUtils
.
throwMessage
(
ACQUIRER_NOMATCH
);
}
}
prepare
(
profile
.
getInstitutionId
(),
profile
.
getProductId
(),
StringUtils
.
trimAllWhitespace
(
data
.
getBuyerId
()),
session
);
TransactionSession
session
=
TransactionSession
.
session
();
String
institutionId
=
profile
.
getInstitutionId
();
String
productId
=
profile
.
getProductId
();
String
buyerId
=
StringUtils
.
trimAllWhitespace
(
data
.
getBuyerId
());
if
(
StringUtils
.
isEmpty
(
buyerId
))
{
AssertUtils
.
throwMessage
(
BUYER_ID_ILLEGAL
);
}
prepare
(
institutionId
,
productId
,
buyerId
,
session
);
System
.
currentTimeMillis
();
System
.
currentTimeMillis
();
session
.
commit
();
}
}
}
}
baa-pay-server/src/main/java/cn/quant/baa/pay/rest/TransactionController.java
View file @
ee1659fd
...
@@ -29,13 +29,11 @@ public class TransactionController extends AbstractController {
...
@@ -29,13 +29,11 @@ public class TransactionController extends AbstractController {
@BusinessMapping
(
session
=
1
)
@BusinessMapping
(
session
=
1
)
@PostMapping
(
"/pay"
)
@PostMapping
(
"/pay"
)
public
void
pay
(
@RequestBody
BusinessRequest
<
PayRequestData
>
request
)
{
public
void
pay
(
@RequestBody
BusinessRequest
<
PayRequestData
>
request
)
{
TransactionSession
session
=
TransactionSession
.
session
();
String
requestId
=
session
.
getRequestId
();
PayRequestData
data
=
request
.
getData
();
PayRequestData
data
=
request
.
getData
();
transactionService
.
pay
(
data
,
session
);
transactionService
.
pay
(
data
);
System
.
currentTimeMillis
();
System
.
currentTimeMillis
();
...
...
baa-pay-server/src/main/resources/config/application-dev.properties
View file @
ee1659fd
...
@@ -15,9 +15,9 @@ quant.server.sequencer.sequence-bits=8
...
@@ -15,9 +15,9 @@ quant.server.sequencer.sequence-bits=8
#Database
#Database
spring.datasource.type
=
com.zaxxer.hikari.HikariDataSource
spring.datasource.type
=
com.zaxxer.hikari.HikariDataSource
spring.datasource.driver-class-name
=
org.mariadb.jdbc.Driver
spring.datasource.driver-class-name
=
org.mariadb.jdbc.Driver
spring.datasource.url
=
jdbc:mysql://1
27.0.0.1:3306/baa_pay_v
1.0?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.datasource.url
=
jdbc:mysql://1
72.17.5.17:31548/baa_pay_
1.0?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
spring.datasource.username
=
root
spring.datasource.username
=
qa
spring.datasource.password
=
111111
spring.datasource.password
=
qatest
spring.datasource.hikari.minimum-idle
=
1
spring.datasource.hikari.minimum-idle
=
1
spring.datasource.hikari.maximum-pool-size
=
3
spring.datasource.hikari.maximum-pool-size
=
3
spring.datasource.hikari.data-source-properties.cachePrepStmts
=
true
spring.datasource.hikari.data-source-properties.cachePrepStmts
=
true
...
...
baa-pay-server/src/main/resources/logback-spring.xml
View file @
ee1659fd
...
@@ -62,7 +62,7 @@
...
@@ -62,7 +62,7 @@
<logger
name=
"org.springframework.boot.actuate"
level=
"ERROR"
/>
<logger
name=
"org.springframework.boot.actuate"
level=
"ERROR"
/>
<logger
name=
"org.springframework.boot.context"
level=
"ERROR"
/>
<logger
name=
"org.springframework.boot.context"
level=
"ERROR"
/>
<logger
name=
"org.springframework.boot.autoconfigure.logging"
level=
"ERROR"
/>
<logger
name=
"org.springframework.boot.autoconfigure.logging"
level=
"ERROR"
/>
<
!--<logger name="org.hibernate.type.descriptor.sql.BasicBinder" level="TRACE"/>--
>
<
logger
name=
"org.hibernate.type.descriptor.sql.BasicBinder"
level=
"TRACE"
/
>
<logger
name=
"org.hibernate.type.descriptor.sql.BasicBinder"
level=
"ERROR"
/>
<logger
name=
"org.hibernate.type.descriptor.sql.BasicBinder"
level=
"ERROR"
/>
<logger
name=
"org.hibernate.engine.QueryParameters"
level=
"ERROR"
/>
<logger
name=
"org.hibernate.engine.QueryParameters"
level=
"ERROR"
/>
<logger
name=
"org.hibernate.SQL"
level=
"ERROR"
/>
<logger
name=
"org.hibernate.SQL"
level=
"ERROR"
/>
...
...
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