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
6ea4e128
Commit
6ea4e128
authored
Aug 30, 2021
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建项目
parent
2314406c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
17 deletions
+52
-17
EntityBuilder.java
.../main/java/cn/quant/baa/pay/jpa/entity/EntityBuilder.java
+12
-1
PayHistoryEntity.java
...in/java/cn/quant/baa/pay/jpa/entity/PayHistoryEntity.java
+35
-10
TransactionService.java
...ain/java/cn/quant/baa/pay/service/TransactionService.java
+3
-1
TransactionController.java
...ain/java/cn/quant/baa/pay/rest/TransactionController.java
+2
-5
No files found.
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/entity/EntityBuilder.java
View file @
6ea4e128
...
@@ -9,6 +9,7 @@ import cn.quant.spring.util.DateUtils;
...
@@ -9,6 +9,7 @@ import cn.quant.spring.util.DateUtils;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.Date
;
import
static
cn
.
quant
.
baa
.
pay
.
Constant
.
MINI_LOCAL_DATE
;
import
static
cn
.
quant
.
baa
.
pay
.
Constant
.
MINI_LOCAL_DATE
;
...
@@ -17,6 +18,14 @@ import static cn.quant.baa.pay.Constant.MINI_LOCAL_DATE;
...
@@ -17,6 +18,14 @@ import static cn.quant.baa.pay.Constant.MINI_LOCAL_DATE;
* Created by Administrator on 2021/8/27 0027.
* Created by Administrator on 2021/8/27 0027.
*/
*/
public
class
EntityBuilder
{
public
class
EntityBuilder
{
private
static
int
nextTxnNo
(
AccountEntity
account
)
{
Integer
txnNo
=
account
.
getNextTxnNo
();
account
.
setTxnNo
(
txnNo
);
account
.
setNextTxnNo
(
txnNo
+
1
);
return
txnNo
;
}
public
static
AccountEntity
account
(
AccountIds
ids
,
String
productId
,
long
accountId
,
String
buyerId
,
int
partitionKey
)
{
public
static
AccountEntity
account
(
AccountIds
ids
,
String
productId
,
long
accountId
,
String
buyerId
,
int
partitionKey
)
{
LocalDate
now
=
LocalDate
.
now
();
LocalDate
now
=
LocalDate
.
now
();
AccountEntity
account
=
new
AccountEntity
();
AccountEntity
account
=
new
AccountEntity
();
...
@@ -77,6 +86,7 @@ public class EntityBuilder {
...
@@ -77,6 +86,7 @@ public class EntityBuilder {
entity
.
setMobilePhone
(
data
.
getPhoneNo
());
entity
.
setMobilePhone
(
data
.
getPhoneNo
());
entity
.
setNotifyUrl
(
data
.
getNotifyUrl
());
entity
.
setNotifyUrl
(
data
.
getNotifyUrl
());
entity
.
setOriginalTxnAmount
(
origAmt
);
entity
.
setOriginalTxnAmount
(
origAmt
);
entity
.
setPayDueTime
(
LocalDateTime
.
now
().
plusMinutes
(
30
));
entity
.
setPayAcctId
(
profile
.
getPayAcctId
());
entity
.
setPayAcctId
(
profile
.
getPayAcctId
());
entity
.
setPayChanCode
(
profile
.
getPayChanCode
());
entity
.
setPayChanCode
(
profile
.
getPayChanCode
());
entity
.
setPayAppId
(
profile
.
getPayAppId
());
entity
.
setPayAppId
(
profile
.
getPayAppId
());
...
@@ -95,7 +105,8 @@ public class EntityBuilder {
...
@@ -95,7 +105,8 @@ public class EntityBuilder {
entity
.
setTxnAmount
(
amount
);
entity
.
setTxnAmount
(
amount
);
entity
.
setTxnDate
(
session
.
getBusinessLocalDate
());
entity
.
setTxnDate
(
session
.
getBusinessLocalDate
());
entity
.
setTxnTime
(
session
.
getBusinessLocalTime
());
entity
.
setTxnTime
(
session
.
getBusinessLocalTime
());
entity
.
setTxnTypeCode
(
"RETL"
);
entity
.
setTxnType
(
"RETL"
);
entity
.
setTxnNo
(
nextTxnNo
(
account
));
if
(
cash
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
if
(
cash
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
entity
.
setTxnCode
(
"R001"
);
entity
.
setTxnCode
(
"R001"
);
}
else
{
}
else
{
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/entity/PayHistoryEntity.java
View file @
6ea4e128
...
@@ -11,6 +11,7 @@ import javax.persistence.*;
...
@@ -11,6 +11,7 @@ import javax.persistence.*;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalTime
;
import
java.time.LocalTime
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.Objects
;
import
java.util.Objects
;
...
@@ -56,12 +57,15 @@ public class PayHistoryEntity extends DescribablePartitionEntity implements Seri
...
@@ -56,12 +57,15 @@ public class PayHistoryEntity extends DescribablePartitionEntity implements Seri
@Column
(
name
=
"PAY_METHOD"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
@Column
(
name
=
"PAY_METHOD"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
private
PayMethod
payMethod
;
private
PayMethod
payMethod
;
@Column
(
name
=
"TXN_TYPE
_CODE
"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
@Column
(
name
=
"TXN_TYPE"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
private
String
txnType
Code
;
private
String
txnType
;
@Column
(
name
=
"TXN_CODE"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
@Column
(
name
=
"TXN_CODE"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
private
String
txnCode
;
private
String
txnCode
;
@Column
(
name
=
"TXN_NO"
,
nullable
=
false
,
updatable
=
false
)
private
Integer
txnNo
;
@Column
(
name
=
"STATISTICS_CODE"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
@Column
(
name
=
"STATISTICS_CODE"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
private
String
statisticsCode
;
private
String
statisticsCode
;
...
@@ -100,6 +104,9 @@ public class PayHistoryEntity extends DescribablePartitionEntity implements Seri
...
@@ -100,6 +104,9 @@ public class PayHistoryEntity extends DescribablePartitionEntity implements Seri
@Column
(
name
=
"TXN_TIME"
,
nullable
=
false
,
updatable
=
false
)
@Column
(
name
=
"TXN_TIME"
,
nullable
=
false
,
updatable
=
false
)
private
LocalTime
txnTime
;
private
LocalTime
txnTime
;
@Column
(
name
=
"PAY_DUE_TIME"
,
nullable
=
false
,
updatable
=
false
)
private
LocalDateTime
payDueTime
;
@Column
(
name
=
"REQUEST_ID"
,
nullable
=
false
,
updatable
=
false
,
length
=
64
)
@Column
(
name
=
"REQUEST_ID"
,
nullable
=
false
,
updatable
=
false
,
length
=
64
)
private
String
requestId
;
private
String
requestId
;
...
@@ -204,12 +211,12 @@ public class PayHistoryEntity extends DescribablePartitionEntity implements Seri
...
@@ -204,12 +211,12 @@ public class PayHistoryEntity extends DescribablePartitionEntity implements Seri
this
.
payMethod
=
payMethod
;
this
.
payMethod
=
payMethod
;
}
}
public
String
getTxnType
Code
()
{
public
String
getTxnType
()
{
return
txnType
Code
;
return
txnType
;
}
}
public
void
setTxnType
Code
(
String
txnTypeCode
)
{
public
void
setTxnType
(
String
txnTypeCode
)
{
this
.
txnType
Code
=
txnTypeCode
;
this
.
txnType
=
txnTypeCode
;
}
}
public
String
getTxnCode
()
{
public
String
getTxnCode
()
{
...
@@ -220,6 +227,14 @@ public class PayHistoryEntity extends DescribablePartitionEntity implements Seri
...
@@ -220,6 +227,14 @@ public class PayHistoryEntity extends DescribablePartitionEntity implements Seri
this
.
txnCode
=
txnCode
;
this
.
txnCode
=
txnCode
;
}
}
public
Integer
getTxnNo
()
{
return
txnNo
;
}
public
void
setTxnNo
(
Integer
txnNo
)
{
this
.
txnNo
=
txnNo
;
}
public
String
getStatisticsCode
()
{
public
String
getStatisticsCode
()
{
return
statisticsCode
;
return
statisticsCode
;
}
}
...
@@ -316,6 +331,14 @@ public class PayHistoryEntity extends DescribablePartitionEntity implements Seri
...
@@ -316,6 +331,14 @@ public class PayHistoryEntity extends DescribablePartitionEntity implements Seri
this
.
txnTime
=
txnTime
;
this
.
txnTime
=
txnTime
;
}
}
public
LocalDateTime
getPayDueTime
()
{
return
payDueTime
;
}
public
void
setPayDueTime
(
LocalDateTime
payDueTime
)
{
this
.
payDueTime
=
payDueTime
;
}
public
String
getRequestId
()
{
public
String
getRequestId
()
{
return
requestId
;
return
requestId
;
}
}
...
@@ -403,13 +426,14 @@ public class PayHistoryEntity extends DescribablePartitionEntity implements Seri
...
@@ -403,13 +426,14 @@ public class PayHistoryEntity extends DescribablePartitionEntity implements Seri
sb
.
append
(
", payChanCode='"
).
append
(
payChanCode
).
append
(
'\''
);
sb
.
append
(
", payChanCode='"
).
append
(
payChanCode
).
append
(
'\''
);
sb
.
append
(
", payAcctId='"
).
append
(
payAcctId
).
append
(
'\''
);
sb
.
append
(
", payAcctId='"
).
append
(
payAcctId
).
append
(
'\''
);
sb
.
append
(
", subject='"
).
append
(
subject
).
append
(
'\''
);
sb
.
append
(
", subject='"
).
append
(
subject
).
append
(
'\''
);
sb
.
append
(
", statusCode=
'"
).
append
(
statusCode
).
append
(
'\''
);
sb
.
append
(
", statusCode=
"
).
append
(
statusCode
);
sb
.
append
(
", currencyCode="
).
append
(
currencyCode
);
sb
.
append
(
", currencyCode="
).
append
(
currencyCode
);
sb
.
append
(
", payMethod=
'"
).
append
(
payMethod
).
append
(
'\''
);
sb
.
append
(
", payMethod=
"
).
append
(
payMethod
);
sb
.
append
(
", txnType
Code='"
).
append
(
txnTypeCod
e
).
append
(
'\''
);
sb
.
append
(
", txnType
='"
).
append
(
txnTyp
e
).
append
(
'\''
);
sb
.
append
(
", txnCode='"
).
append
(
txnCode
).
append
(
'\''
);
sb
.
append
(
", txnCode='"
).
append
(
txnCode
).
append
(
'\''
);
sb
.
append
(
", txnNo="
).
append
(
txnNo
);
sb
.
append
(
", statisticsCode='"
).
append
(
statisticsCode
).
append
(
'\''
);
sb
.
append
(
", statisticsCode='"
).
append
(
statisticsCode
).
append
(
'\''
);
sb
.
append
(
", creditDebitFlag=
'"
).
append
(
creditDebitFlag
).
append
(
'\''
);
sb
.
append
(
", creditDebitFlag=
"
).
append
(
creditDebitFlag
);
sb
.
append
(
", customerGenFlag="
).
append
(
customerGenFlag
);
sb
.
append
(
", customerGenFlag="
).
append
(
customerGenFlag
);
sb
.
append
(
", originalTxnAmount="
).
append
(
originalTxnAmount
);
sb
.
append
(
", originalTxnAmount="
).
append
(
originalTxnAmount
);
sb
.
append
(
", txnAmount="
).
append
(
txnAmount
);
sb
.
append
(
", txnAmount="
).
append
(
txnAmount
);
...
@@ -420,6 +444,7 @@ public class PayHistoryEntity extends DescribablePartitionEntity implements Seri
...
@@ -420,6 +444,7 @@ public class PayHistoryEntity extends DescribablePartitionEntity implements Seri
sb
.
append
(
", statementeFlag="
).
append
(
statementeFlag
);
sb
.
append
(
", statementeFlag="
).
append
(
statementeFlag
);
sb
.
append
(
", txnDate="
).
append
(
txnDate
);
sb
.
append
(
", txnDate="
).
append
(
txnDate
);
sb
.
append
(
", txnTime="
).
append
(
txnTime
);
sb
.
append
(
", txnTime="
).
append
(
txnTime
);
sb
.
append
(
", payDueTime="
).
append
(
payDueTime
);
sb
.
append
(
", requestId='"
).
append
(
requestId
).
append
(
'\''
);
sb
.
append
(
", requestId='"
).
append
(
requestId
).
append
(
'\''
);
sb
.
append
(
", requestTime="
).
append
(
requestTime
);
sb
.
append
(
", requestTime="
).
append
(
requestTime
);
sb
.
append
(
", shopName='"
).
append
(
shopName
).
append
(
'\''
);
sb
.
append
(
", shopName='"
).
append
(
shopName
).
append
(
'\''
);
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/service/TransactionService.java
View file @
6ea4e128
...
@@ -39,7 +39,7 @@ public class TransactionService extends BusinessService {
...
@@ -39,7 +39,7 @@ public class TransactionService extends BusinessService {
}
}
@Transactional
@Transactional
public
void
pay
(
PayRequestData
data
)
{
public
PayHistoryEntity
pay
(
PayRequestData
data
)
{
validate
(
data
);
validate
(
data
);
...
@@ -90,5 +90,7 @@ public class TransactionService extends BusinessService {
...
@@ -90,5 +90,7 @@ public class TransactionService extends BusinessService {
session
.
commit
();
session
.
commit
();
return
history
;
}
}
}
}
baa-pay-server/src/main/java/cn/quant/baa/pay/rest/TransactionController.java
View file @
6ea4e128
package
cn
.
quant
.
baa
.
pay
.
rest
;
package
cn
.
quant
.
baa
.
pay
.
rest
;
import
cn.quant.baa.pay.annotation.BusinessMapping
;
import
cn.quant.baa.pay.annotation.BusinessMapping
;
import
cn.quant.baa.pay.jpa.entity.PayHistoryEntity
;
import
cn.quant.baa.pay.model.BusinessRequest
;
import
cn.quant.baa.pay.model.BusinessRequest
;
import
cn.quant.baa.pay.model.GoodsDetail
;
import
cn.quant.baa.pay.model.GoodsDetail
;
import
cn.quant.baa.pay.model.PayRequestData
;
import
cn.quant.baa.pay.model.PayRequestData
;
...
@@ -29,12 +30,8 @@ public class TransactionController extends BusinessController {
...
@@ -29,12 +30,8 @@ public class TransactionController extends BusinessController {
@PostMapping
(
"/pay"
)
@PostMapping
(
"/pay"
)
public
void
pay
(
@RequestBody
BusinessRequest
<
PayRequestData
>
request
)
{
public
void
pay
(
@RequestBody
BusinessRequest
<
PayRequestData
>
request
)
{
PayRequestData
data
=
request
.
getData
();
PayRequestData
data
=
request
.
getData
();
PayHistoryEntity
pay
=
transactionService
.
pay
(
data
);
transactionService
.
pay
(
data
);
System
.
currentTimeMillis
();
System
.
currentTimeMillis
();
}
}
...
...
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