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
1d1861a9
Commit
1d1861a9
authored
Aug 30, 2021
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建项目
parent
5f70e1fe
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
331 additions
and
67 deletions
+331
-67
hibernate.cfg.xml
baa-pay-core/hibernate.cfg.xml
+1
-0
AcquirerBuilder.java
...rc/main/java/cn/quant/baa/pay/config/AcquirerBuilder.java
+1
-0
MessageEnum.java
...core/src/main/java/cn/quant/baa/pay/dict/MessageEnum.java
+7
-0
EntityBuilder.java
.../main/java/cn/quant/baa/pay/jpa/entity/EntityBuilder.java
+24
-3
PayFeatureEntity.java
...in/java/cn/quant/baa/pay/jpa/entity/PayFeatureEntity.java
+44
-8
PayFeatureIds.java
.../main/java/cn/quant/baa/pay/jpa/entity/PayFeatureIds.java
+1
-0
PayGoodsDetailEntity.java
...ava/cn/quant/baa/pay/jpa/entity/PayGoodsDetailEntity.java
+153
-0
PayGoodsDetailRepository.java
...uant/baa/pay/jpa/repository/PayGoodsDetailRepository.java
+15
-0
GoodsDetail.java
...ore/src/main/java/cn/quant/baa/pay/model/GoodsDetail.java
+21
-9
MerchantAcquirerProfile.java
.../java/cn/quant/baa/pay/model/MerchantAcquirerProfile.java
+36
-10
BusinessService.java
...c/main/java/cn/quant/baa/pay/service/BusinessService.java
+0
-17
TransactionService.java
...ain/java/cn/quant/baa/pay/service/TransactionService.java
+28
-20
No files found.
baa-pay-core/hibernate.cfg.xml
View file @
1d1861a9
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
<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"
/>
<mapping
class=
"cn.quant.baa.pay.jpa.entity.PayHistoryEntity"
/>
<mapping
class=
"cn.quant.baa.pay.jpa.entity.PayGoodsDetailEntity"
/>
<!-- 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/config/AcquirerBuilder.java
View file @
1d1861a9
...
@@ -51,6 +51,7 @@ public class AcquirerBuilder {
...
@@ -51,6 +51,7 @@ public class AcquirerBuilder {
PayFeatureIds
featureIds
=
new
PayFeatureIds
();
PayFeatureIds
featureIds
=
new
PayFeatureIds
();
featureIds
.
setPayChanCode
(
entity
.
getPayChanCode
());
featureIds
.
setPayChanCode
(
entity
.
getPayChanCode
());
featureIds
.
setAccessCode
(
entity
.
getAccessCode
());
featureIds
.
setAccessCode
(
entity
.
getAccessCode
());
PayFeatureEntity
feature
=
(
PayFeatureEntity
)
bigTable
.
get
(
PayFeatureEntity
.
class
,
featureIds
);
PayFeatureEntity
feature
=
(
PayFeatureEntity
)
bigTable
.
get
(
PayFeatureEntity
.
class
,
featureIds
);
BeanUtils
.
copyProperties
(
feature
,
profile
);
BeanUtils
.
copyProperties
(
feature
,
profile
);
profile
.
setAccessCode
(
entity
.
getAccessCode
());
profile
.
setAccessCode
(
entity
.
getAccessCode
());
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/dict/MessageEnum.java
View file @
1d1861a9
...
@@ -17,6 +17,13 @@ public enum MessageEnum {
...
@@ -17,6 +17,13 @@ public enum MessageEnum {
ILLEGAL_REQ_DISC_AMT
(
"2000000"
),
ILLEGAL_REQ_DISC_AMT
(
"2000000"
),
ILLEGAL_REQ_CASH_AMT
(
"2000000"
),
ILLEGAL_REQ_CASH_AMT
(
"2000000"
),
ILLEGAL_REQ_CREDIT_AMT
(
"2000000"
),
ILLEGAL_REQ_CREDIT_AMT
(
"2000000"
),
ILLEGAL_REQ_GOODS_NO
(
"2000000"
),
ILLEGAL_REQ_GOODS_NAME
(
"2000000"
),
ILLEGAL_REQ_GOODS_QUANTITY
(
"2000000"
),
ILLEGAL_REQ_GOODS_PRICE
(
"2000000"
),
ILLEGAL_REQ_GOODS_DISC
(
"2000000"
),
ILLEGAL_REQ_GOODS_AMT
(
"2000000"
),
ILLEGAL_REQ_GOODS_ATTACH
(
"2000000"
),
EXIST_ORDER
(
"300"
),
EXIST_ORDER
(
"300"
),
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/entity/EntityBuilder.java
View file @
1d1861a9
...
@@ -2,6 +2,7 @@ package cn.quant.baa.pay.jpa.entity;
...
@@ -2,6 +2,7 @@ package cn.quant.baa.pay.jpa.entity;
import
cn.quant.baa.pay.context.TransactionSession
;
import
cn.quant.baa.pay.context.TransactionSession
;
import
cn.quant.baa.pay.dict.*
;
import
cn.quant.baa.pay.dict.*
;
import
cn.quant.baa.pay.model.GoodsDetail
;
import
cn.quant.baa.pay.model.MerchantAcquirerProfile
;
import
cn.quant.baa.pay.model.MerchantAcquirerProfile
;
import
cn.quant.baa.pay.model.PayRequestData
;
import
cn.quant.baa.pay.model.PayRequestData
;
import
cn.quant.spring.util.DateUtils
;
import
cn.quant.spring.util.DateUtils
;
...
@@ -49,7 +50,7 @@ public class EntityBuilder {
...
@@ -49,7 +50,7 @@ public class EntityBuilder {
return
account
;
return
account
;
}
}
public
static
PayHistoryEntity
history
(
MerchantAcquirerProfile
profile
,
AccountEntity
account
,
PayHistoryIds
ids
,
PayRequestData
data
public
static
PayHistoryEntity
history
(
AccountEntity
account
,
PayHistoryIds
ids
,
long
historyId
,
PayRequestData
data
,
MerchantAcquirerProfile
profile
,
TransactionSession
session
)
{
,
TransactionSession
session
)
{
BigDecimal
discount
=
new
BigDecimal
(
data
.
getDiscounts
());
BigDecimal
discount
=
new
BigDecimal
(
data
.
getDiscounts
());
...
@@ -82,7 +83,7 @@ public class EntityBuilder {
...
@@ -82,7 +83,7 @@ public class EntityBuilder {
entity
.
setPayMethod
(
PayMethod
.
DRST
);
entity
.
setPayMethod
(
PayMethod
.
DRST
);
entity
.
setPostCashAmount
(
cash
);
entity
.
setPostCashAmount
(
cash
);
entity
.
setPostCreditAmount
(
credit
);
entity
.
setPostCreditAmount
(
credit
);
entity
.
setPartitionKey
(
session
.
partitionKey
(
accountId
));
entity
.
setPartitionKey
(
account
.
getPartitionKey
(
));
entity
.
setRequestId
(
session
.
getRequestId
());
entity
.
setRequestId
(
session
.
getRequestId
());
entity
.
setRequestTime
(
session
.
getRequestTime
());
entity
.
setRequestTime
(
session
.
getRequestTime
());
entity
.
setShopName
(
data
.
getShopName
());
entity
.
setShopName
(
data
.
getShopName
());
...
@@ -90,7 +91,7 @@ public class EntityBuilder {
...
@@ -90,7 +91,7 @@ public class EntityBuilder {
entity
.
setStatisticsCode
(
"RPAY"
);
entity
.
setStatisticsCode
(
"RPAY"
);
entity
.
setStatusCode
(
StatusCode
.
PEND
);
entity
.
setStatusCode
(
StatusCode
.
PEND
);
entity
.
setSubject
(
data
.
getSubject
());
entity
.
setSubject
(
data
.
getSubject
());
entity
.
setTransactionId
(
session
.
nextId
()
);
entity
.
setTransactionId
(
historyId
);
entity
.
setTxnAmount
(
amount
);
entity
.
setTxnAmount
(
amount
);
entity
.
setTxnDate
(
session
.
getBusinessLocalDate
());
entity
.
setTxnDate
(
session
.
getBusinessLocalDate
());
entity
.
setTxnTime
(
session
.
getBusinessLocalTime
());
entity
.
setTxnTime
(
session
.
getBusinessLocalTime
());
...
@@ -106,4 +107,24 @@ public class EntityBuilder {
...
@@ -106,4 +107,24 @@ public class EntityBuilder {
return
entity
;
return
entity
;
}
}
public
static
PayGoodsDetailEntity
goodsDetail
(
long
goodsId
,
long
historyId
,
GoodsDetail
detail
)
{
BigDecimal
amount
=
new
BigDecimal
(
detail
.
getAmount
());
BigDecimal
discount
=
new
BigDecimal
(
detail
.
getDiscounts
());
BigDecimal
price
=
new
BigDecimal
(
detail
.
getPrice
());
int
qiantity
=
Integer
.
parseInt
(
detail
.
getQuantity
(),
10
);
PayGoodsDetailEntity
entity
=
new
PayGoodsDetailEntity
();
entity
.
setAttachText
(
detail
.
getAttach
());
entity
.
setDiscAmount
(
discount
);
entity
.
setTxnAmount
(
amount
);
entity
.
setTransactionId
(
historyId
);
entity
.
setGoodsId
(
goodsId
);
entity
.
setGoodsName
(
detail
.
getGoodsName
());
entity
.
setGoodsOrderNo
(
detail
.
getGoodsNo
());
entity
.
setPrice
(
price
);
entity
.
setQuantity
(
qiantity
);
return
entity
;
}
}
}
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/entity/PayFeatureEntity.java
View file @
1d1861a9
...
@@ -23,11 +23,20 @@ public class PayFeatureEntity extends DescriptionEntity implements Serializable
...
@@ -23,11 +23,20 @@ public class PayFeatureEntity extends DescriptionEntity implements Serializable
@Column
(
name
=
"ACCESS_TYPE"
,
nullable
=
false
,
length
=
3
)
@Column
(
name
=
"ACCESS_TYPE"
,
nullable
=
false
,
length
=
3
)
private
AccessType
accessType
;
private
AccessType
accessType
;
@Column
(
name
=
"ACCESS_METHOD"
,
nullable
=
false
,
length
=
255
)
private
String
accessMethod
;
@Column
(
name
=
"VERSION"
,
nullable
=
false
,
length
=
4
)
@Column
(
name
=
"VERSION"
,
nullable
=
false
,
length
=
4
)
private
String
version
;
private
String
version
;
@Column
(
name
=
"ACCESS_PATH"
,
nullable
=
true
,
length
=
255
)
@Column
(
name
=
"PAY_ACCESS"
,
nullable
=
false
,
length
=
255
)
private
String
accessPath
;
private
String
payAccess
;
@Column
(
name
=
"REFUND_ACCESS"
,
nullable
=
false
,
length
=
255
)
private
String
refundAccess
;
@Column
(
name
=
"CHECK_ACCESS"
,
nullable
=
false
,
length
=
255
)
private
String
checkAccess
;
public
PayFeatureIds
getIds
()
{
public
PayFeatureIds
getIds
()
{
return
ids
;
return
ids
;
...
@@ -45,6 +54,14 @@ public class PayFeatureEntity extends DescriptionEntity implements Serializable
...
@@ -45,6 +54,14 @@ public class PayFeatureEntity extends DescriptionEntity implements Serializable
this
.
accessType
=
accessType
;
this
.
accessType
=
accessType
;
}
}
public
String
getAccessMethod
()
{
return
accessMethod
;
}
public
void
setAccessMethod
(
String
accessMethod
)
{
this
.
accessMethod
=
accessMethod
;
}
public
String
getVersion
()
{
public
String
getVersion
()
{
return
version
;
return
version
;
}
}
...
@@ -53,12 +70,28 @@ public class PayFeatureEntity extends DescriptionEntity implements Serializable
...
@@ -53,12 +70,28 @@ public class PayFeatureEntity extends DescriptionEntity implements Serializable
this
.
version
=
version
;
this
.
version
=
version
;
}
}
public
String
getAccessPath
()
{
public
String
getPayAccess
()
{
return
accessPath
;
return
payAccess
;
}
public
void
setPayAccess
(
String
payAccess
)
{
this
.
payAccess
=
payAccess
;
}
public
String
getRefundAccess
()
{
return
refundAccess
;
}
public
void
setRefundAccess
(
String
refundAccess
)
{
this
.
refundAccess
=
refundAccess
;
}
public
String
getCheckAccess
()
{
return
checkAccess
;
}
}
public
void
set
AccessPath
(
String
accessPath
)
{
public
void
set
CheckAccess
(
String
checkAccess
)
{
this
.
accessPath
=
accessPath
;
this
.
checkAccess
=
checkAccess
;
}
}
@Override
@Override
...
@@ -78,9 +111,12 @@ public class PayFeatureEntity extends DescriptionEntity implements Serializable
...
@@ -78,9 +111,12 @@ public class PayFeatureEntity extends DescriptionEntity implements Serializable
public
String
toString
()
{
public
String
toString
()
{
final
StringBuilder
sb
=
new
StringBuilder
(
"PayFeatureEntity{"
);
final
StringBuilder
sb
=
new
StringBuilder
(
"PayFeatureEntity{"
);
sb
.
append
(
"ids="
).
append
(
ids
);
sb
.
append
(
"ids="
).
append
(
ids
);
sb
.
append
(
", accessType='"
).
append
(
accessType
).
append
(
'\''
);
sb
.
append
(
", accessType="
).
append
(
accessType
);
sb
.
append
(
", accessMethod='"
).
append
(
accessMethod
).
append
(
'\''
);
sb
.
append
(
", version='"
).
append
(
version
).
append
(
'\''
);
sb
.
append
(
", version='"
).
append
(
version
).
append
(
'\''
);
sb
.
append
(
", accessPath='"
).
append
(
accessPath
).
append
(
'\''
);
sb
.
append
(
", payAccess='"
).
append
(
payAccess
).
append
(
'\''
);
sb
.
append
(
", refundAccess='"
).
append
(
refundAccess
).
append
(
'\''
);
sb
.
append
(
", checkAccess='"
).
append
(
checkAccess
).
append
(
'\''
);
sb
.
append
(
','
).
append
(
super
.
toString
());
sb
.
append
(
','
).
append
(
super
.
toString
());
sb
.
append
(
'}'
);
sb
.
append
(
'}'
);
return
sb
.
toString
();
return
sb
.
toString
();
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/entity/PayFeatureIds.java
View file @
1d1861a9
package
cn
.
quant
.
baa
.
pay
.
jpa
.
entity
;
package
cn
.
quant
.
baa
.
pay
.
jpa
.
entity
;
import
cn.quant.baa.pay.dict.AccessCode
;
import
cn.quant.baa.pay.dict.AccessCode
;
import
cn.quant.baa.pay.dict.AccessType
;
import
cn.quant.spring.data.jpa.entity.EntityPrimaryIds
;
import
cn.quant.spring.data.jpa.entity.EntityPrimaryIds
;
import
cn.quant.spring.util.StringUtils
;
import
cn.quant.spring.util.StringUtils
;
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/entity/PayGoodsDetailEntity.java
0 → 100644
View file @
1d1861a9
package
cn
.
quant
.
baa
.
pay
.
jpa
.
entity
;
import
cn.quant.spring.data.jpa.entity.PartitionEntity
;
import
cn.quant.spring.util.StringUtils
;
import
javax.persistence.Column
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Objects
;
/**
* Created by Administrator on 2021/8/30 0030.
*/
@Entity
@Table
(
name
=
"pay_goods_detail"
)
public
class
PayGoodsDetailEntity
extends
PartitionEntity
implements
Serializable
{
public
final
static
String
CLASS_NAME
=
PayGoodsDetailEntity
.
class
.
getSimpleName
();
private
static
final
long
serialVersionUID
=
-
2783909112856789454L
;
@Id
@Column
(
name
=
"GOODS_ID"
,
nullable
=
false
,
updatable
=
false
)
private
Long
goodsId
;
@Column
(
name
=
"TRANSACTION_ID"
,
nullable
=
false
,
updatable
=
false
)
private
Long
transactionId
;
@Column
(
name
=
"GOODS_ORDER_NO"
,
nullable
=
false
,
updatable
=
false
,
length
=
64
)
private
String
goodsOrderNo
;
@Column
(
name
=
"GOODS_NAME"
,
nullable
=
false
,
updatable
=
false
,
length
=
512
)
private
String
goodsName
;
@Column
(
name
=
"QUANTITY"
,
nullable
=
false
,
updatable
=
false
)
private
Integer
quantity
;
@Column
(
name
=
"PRICE"
,
nullable
=
false
,
updatable
=
false
,
precision
=
2
)
private
BigDecimal
price
;
@Column
(
name
=
"DISC_AMOUNT"
,
nullable
=
false
,
updatable
=
false
,
precision
=
2
)
private
BigDecimal
discAmount
;
@Column
(
name
=
"TXN_AMOUNT"
,
nullable
=
false
,
updatable
=
false
,
precision
=
2
)
private
BigDecimal
txnAmount
;
@Column
(
name
=
"ATTACH_TEXT"
,
nullable
=
true
,
length
=
512
)
private
String
attachText
;
public
Long
getGoodsId
()
{
return
goodsId
;
}
public
void
setGoodsId
(
Long
goodsId
)
{
this
.
goodsId
=
goodsId
;
}
public
Long
getTransactionId
()
{
return
transactionId
;
}
public
void
setTransactionId
(
Long
transactionId
)
{
this
.
transactionId
=
transactionId
;
}
public
String
getGoodsOrderNo
()
{
return
goodsOrderNo
;
}
public
void
setGoodsOrderNo
(
String
goodsOrderNo
)
{
this
.
goodsOrderNo
=
goodsOrderNo
;
}
public
String
getGoodsName
()
{
return
goodsName
;
}
public
void
setGoodsName
(
String
goodsName
)
{
this
.
goodsName
=
goodsName
;
}
public
Integer
getQuantity
()
{
return
quantity
;
}
public
void
setQuantity
(
Integer
quantity
)
{
this
.
quantity
=
quantity
;
}
public
BigDecimal
getPrice
()
{
return
price
;
}
public
void
setPrice
(
BigDecimal
price
)
{
this
.
price
=
price
;
}
public
BigDecimal
getDiscAmount
()
{
return
discAmount
;
}
public
void
setDiscAmount
(
BigDecimal
discAmount
)
{
this
.
discAmount
=
discAmount
;
}
public
BigDecimal
getTxnAmount
()
{
return
txnAmount
;
}
public
void
setTxnAmount
(
BigDecimal
txnAmount
)
{
this
.
txnAmount
=
txnAmount
;
}
public
String
getAttachText
()
{
return
attachText
;
}
public
void
setAttachText
(
String
attachText
)
{
this
.
attachText
=
attachText
;
}
@Override
public
String
persistenceKey
()
{
return
StringUtils
.
toDelimitedString
(
CLASS_NAME
,
goodsId
);
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
PayGoodsDetailEntity
that
=
(
PayGoodsDetailEntity
)
o
;
return
Objects
.
equals
(
goodsId
,
that
.
goodsId
);
}
@Override
public
String
toString
()
{
final
StringBuilder
sb
=
new
StringBuilder
(
"PayGoodsDetailEntity{"
);
sb
.
append
(
"goodsId="
).
append
(
goodsId
);
sb
.
append
(
", transactionId="
).
append
(
transactionId
);
sb
.
append
(
", goodsOrderNo='"
).
append
(
goodsOrderNo
).
append
(
'\''
);
sb
.
append
(
", goodsName='"
).
append
(
goodsName
).
append
(
'\''
);
sb
.
append
(
", quantity="
).
append
(
quantity
);
sb
.
append
(
", price="
).
append
(
price
);
sb
.
append
(
", discAmount="
).
append
(
discAmount
);
sb
.
append
(
", txnAmount="
).
append
(
txnAmount
);
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/repository/PayGoodsDetailRepository.java
0 → 100644
View file @
1d1861a9
package
cn
.
quant
.
baa
.
pay
.
jpa
.
repository
;
import
cn.quant.baa.pay.jpa.entity.AccountEntity
;
import
cn.quant.baa.pay.jpa.entity.AccountIds
;
import
cn.quant.baa.pay.jpa.entity.PayGoodsDetailEntity
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.stereotype.Repository
;
/**
* Created by Administrator on 2021/8/22 0022.
*/
@Repository
public
interface
PayGoodsDetailRepository
extends
JpaRepository
<
PayGoodsDetailEntity
,
Long
>
{
}
baa-pay-core/src/main/java/cn/quant/baa/pay/model/GoodsDetail.java
View file @
1d1861a9
package
cn
.
quant
.
baa
.
pay
.
model
;
package
cn
.
quant
.
baa
.
pay
.
model
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.*
;
import
javax.validation.constraints.Size
;
import
java.io.Serializable
;
import
java.io.Serializable
;
/**
/**
...
@@ -14,46 +13,59 @@ public class GoodsDetail implements Serializable{
...
@@ -14,46 +13,59 @@ public class GoodsDetail implements Serializable{
/**
/**
* 商品ID
* 商品ID
*/
*/
@Size
(
min
=
6
,
max
=
64
)
@NotNull
(
message
=
"ILLEGAL_REQ_GOODS_NO"
)
private
String
goodsId
;
@Size
(
min
=
6
,
max
=
64
,
message
=
"ILLEGAL_REQ_GOODS_NO"
)
private
String
goodsNo
;
/**
/**
* 商品名
* 商品名
*/
*/
@NotNull
(
message
=
"ILLEGAL_REQ_GOODS_NAME"
)
@Size
(
min
=
3
,
max
=
512
,
message
=
"ILLEGAL_REQ_GOODS_NAME"
)
private
String
goodsName
;
private
String
goodsName
;
/**
/**
* 数量
* 数量
*/
*/
@NotNull
(
message
=
"ILLEGAL_REQ_GOODS_QUANTITY"
)
@Max
(
value
=
30000
,
message
=
"ILLEGAL_REQ_GOODS_QUANTITY"
)
@Min
(
value
=
1
,
message
=
"ILLEGAL_REQ_GOODS_QUANTITY"
)
private
String
quantity
;
private
String
quantity
;
/**
/**
* 商品单价
* 商品单价
*/
*/
@NotNull
(
message
=
"ILLEGAL_REQ_GOODS_PRICE"
)
@DecimalMin
(
value
=
"0.00"
)
private
String
price
;
private
String
price
;
/**
/**
* 优惠金额
* 优惠金额
*/
*/
@NotNull
(
message
=
"ILLEGAL_REQ_GOODS_DISC"
)
@DecimalMin
(
value
=
"0.00"
)
private
String
discounts
;
private
String
discounts
;
/**
/**
* 实付金额
* 实付金额
*/
*/
@NotNull
(
message
=
"ILLEGAL_REQ_GOODS_AMT"
)
@DecimalMin
(
value
=
"0.01"
)
private
String
amount
;
private
String
amount
;
/**
/**
* 附加信息
* 附加信息
*/
*/
@Size
(
max
=
512
,
message
=
"ILLEGAL_REQ_GOODS_ATTACH"
)
private
String
attach
;
private
String
attach
;
public
String
getGoods
Id
()
{
public
String
getGoods
No
()
{
return
goods
Id
;
return
goods
No
;
}
}
public
void
setGoods
Id
(
String
goodsId
)
{
public
void
setGoods
No
(
String
goodsNo
)
{
this
.
goods
Id
=
goodsId
;
this
.
goods
No
=
goodsNo
;
}
}
public
String
getGoodsName
()
{
public
String
getGoodsName
()
{
...
@@ -107,7 +119,7 @@ public class GoodsDetail implements Serializable{
...
@@ -107,7 +119,7 @@ public class GoodsDetail implements Serializable{
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
final
StringBuilder
sb
=
new
StringBuilder
(
"GoodsDetail{"
);
final
StringBuilder
sb
=
new
StringBuilder
(
"GoodsDetail{"
);
sb
.
append
(
"goods
Id='"
).
append
(
goodsId
).
append
(
'\''
);
sb
.
append
(
"goods
No='"
).
append
(
goodsNo
).
append
(
'\''
);
sb
.
append
(
", goodsName='"
).
append
(
goodsName
).
append
(
'\''
);
sb
.
append
(
", goodsName='"
).
append
(
goodsName
).
append
(
'\''
);
sb
.
append
(
", quantity="
).
append
(
quantity
);
sb
.
append
(
", quantity="
).
append
(
quantity
);
sb
.
append
(
", price='"
).
append
(
price
).
append
(
'\''
);
sb
.
append
(
", price='"
).
append
(
price
).
append
(
'\''
);
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/model/MerchantAcquirerProfile.java
View file @
1d1861a9
...
@@ -38,13 +38,12 @@ public class MerchantAcquirerProfile implements Serializable{
...
@@ -38,13 +38,12 @@ public class MerchantAcquirerProfile implements Serializable{
//feature
//feature
private
AccessCode
accessCode
;
private
AccessCode
accessCode
;
private
AccessType
accessType
;
private
AccessType
accessType
;
private
String
accessMethod
;
private
String
version
;
private
String
version
;
private
String
payAccess
;
private
String
accessPath
;
private
String
refundAccess
;
private
String
checkAccess
;
private
String
descText
;
private
String
descText
;
//APP
//APP
...
@@ -161,6 +160,14 @@ public class MerchantAcquirerProfile implements Serializable{
...
@@ -161,6 +160,14 @@ public class MerchantAcquirerProfile implements Serializable{
this
.
accessType
=
accessType
;
this
.
accessType
=
accessType
;
}
}
public
String
getAccessMethod
()
{
return
accessMethod
;
}
public
void
setAccessMethod
(
String
accessMethod
)
{
this
.
accessMethod
=
accessMethod
;
}
public
String
getVersion
()
{
public
String
getVersion
()
{
return
version
;
return
version
;
}
}
...
@@ -169,12 +176,28 @@ public class MerchantAcquirerProfile implements Serializable{
...
@@ -169,12 +176,28 @@ public class MerchantAcquirerProfile implements Serializable{
this
.
version
=
version
;
this
.
version
=
version
;
}
}
public
String
getAccessPath
()
{
public
String
getPayAccess
()
{
return
accessPath
;
return
payAccess
;
}
public
void
setPayAccess
(
String
payAccess
)
{
this
.
payAccess
=
payAccess
;
}
public
String
getRefundAccess
()
{
return
refundAccess
;
}
public
void
setRefundAccess
(
String
refundAccess
)
{
this
.
refundAccess
=
refundAccess
;
}
public
String
getCheckAccess
()
{
return
checkAccess
;
}
}
public
void
set
AccessPath
(
String
accessPath
)
{
public
void
set
CheckAccess
(
String
checkAccess
)
{
this
.
accessPath
=
accessPath
;
this
.
checkAccess
=
checkAccess
;
}
}
public
String
getDescText
()
{
public
String
getDescText
()
{
...
@@ -264,8 +287,11 @@ public class MerchantAcquirerProfile implements Serializable{
...
@@ -264,8 +287,11 @@ public class MerchantAcquirerProfile implements Serializable{
sb
.
append
(
", payPublicKey='"
).
append
(
payPublicKey
).
append
(
'\''
);
sb
.
append
(
", payPublicKey='"
).
append
(
payPublicKey
).
append
(
'\''
);
sb
.
append
(
", accessCode="
).
append
(
accessCode
);
sb
.
append
(
", accessCode="
).
append
(
accessCode
);
sb
.
append
(
", accessType="
).
append
(
accessType
);
sb
.
append
(
", accessType="
).
append
(
accessType
);
sb
.
append
(
", accessMethod='"
).
append
(
accessMethod
).
append
(
'\''
);
sb
.
append
(
", version='"
).
append
(
version
).
append
(
'\''
);
sb
.
append
(
", version='"
).
append
(
version
).
append
(
'\''
);
sb
.
append
(
", accessPath='"
).
append
(
accessPath
).
append
(
'\''
);
sb
.
append
(
", payAccess='"
).
append
(
payAccess
).
append
(
'\''
);
sb
.
append
(
", refundAccess='"
).
append
(
refundAccess
).
append
(
'\''
);
sb
.
append
(
", checkAccess='"
).
append
(
checkAccess
).
append
(
'\''
);
sb
.
append
(
", descText='"
).
append
(
descText
).
append
(
'\''
);
sb
.
append
(
", descText='"
).
append
(
descText
).
append
(
'\''
);
sb
.
append
(
", institutionId='"
).
append
(
institutionId
).
append
(
'\''
);
sb
.
append
(
", institutionId='"
).
append
(
institutionId
).
append
(
'\''
);
sb
.
append
(
", productId='"
).
append
(
productId
).
append
(
'\''
);
sb
.
append
(
", productId='"
).
append
(
productId
).
append
(
'\''
);
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/service/BusinessService.java
View file @
1d1861a9
package
cn
.
quant
.
baa
.
pay
.
service
;
package
cn
.
quant
.
baa
.
pay
.
service
;
import
cn.quant.baa.pay.component.Sequencer
;
import
cn.quant.baa.pay.context.TransactionSession
;
import
cn.quant.baa.pay.context.TransactionSession
;
import
cn.quant.baa.pay.dict.AcctTypeId
;
import
cn.quant.baa.pay.dict.CurrencyCode
;
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.entity.EntityBuilder
;
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.IllegalParameterException
;
import
cn.quant.spring.NullException
;
import
cn.quant.spring.NullException
;
import
cn.quant.spring.context.ContextLoader
;
import
cn.quant.spring.context.ContextLoader
;
import
cn.quant.spring.context.ServerApplicationContext
;
import
cn.quant.spring.context.ServerApplicationContext
;
import
cn.quant.spring.util.DateUtils
;
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
javax.validation.ConstraintViolation
;
import
javax.validation.ConstraintViolation
;
import
javax.validation.Validator
;
import
javax.validation.Validator
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.util.Date
;
import
java.util.Set
;
import
java.util.Set
;
import
static
cn
.
quant
.
baa
.
pay
.
Constant
.
MINI_LOCAL_DATE
;
import
static
cn
.
quant
.
baa
.
pay
.
dict
.
MessageEnum
.*;
/**
/**
* Created by Administrator on 2021/8/25 0025.
* Created by Administrator on 2021/8/25 0025.
*/
*/
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/service/TransactionService.java
View file @
1d1861a9
...
@@ -2,10 +2,7 @@ package cn.quant.baa.pay.service;
...
@@ -2,10 +2,7 @@ package cn.quant.baa.pay.service;
import
cn.quant.baa.pay.config.MerchantAcquirerBuilder
;
import
cn.quant.baa.pay.config.MerchantAcquirerBuilder
;
import
cn.quant.baa.pay.context.TransactionSession
;
import
cn.quant.baa.pay.context.TransactionSession
;
import
cn.quant.baa.pay.jpa.entity.AccountEntity
;
import
cn.quant.baa.pay.jpa.entity.*
;
import
cn.quant.baa.pay.jpa.entity.EntityBuilder
;
import
cn.quant.baa.pay.jpa.entity.PayHistoryEntity
;
import
cn.quant.baa.pay.jpa.entity.PayHistoryIds
;
import
cn.quant.baa.pay.model.AssertUtils
;
import
cn.quant.baa.pay.model.AssertUtils
;
import
cn.quant.baa.pay.model.GoodsDetail
;
import
cn.quant.baa.pay.model.GoodsDetail
;
import
cn.quant.baa.pay.model.MerchantAcquirerProfile
;
import
cn.quant.baa.pay.model.MerchantAcquirerProfile
;
...
@@ -17,6 +14,9 @@ import org.springframework.stereotype.Service;
...
@@ -17,6 +14,9 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.LinkedList
;
import
java.util.List
;
import
static
cn
.
quant
.
baa
.
pay
.
dict
.
MessageEnum
.*;
import
static
cn
.
quant
.
baa
.
pay
.
dict
.
MessageEnum
.*;
/**
/**
...
@@ -49,16 +49,33 @@ public class TransactionService extends BusinessService {
...
@@ -49,16 +49,33 @@ public class TransactionService extends BusinessService {
AssertUtils
.
throwMessage
(
ACQUIRER_NOSUCH
,
chanId
);
AssertUtils
.
throwMessage
(
ACQUIRER_NOSUCH
,
chanId
);
}
}
String
mchId
=
data
.
getMchId
();
if
(!
mchId
.
equals
(
profile
.
getPayAppId
()))
{
AssertUtils
.
throwMessage
(
ACQUIRER_NOMATCH
,
chanId
,
mchId
);
}
String
institutionId
=
profile
.
getInstitutionId
();
String
institutionId
=
profile
.
getInstitutionId
();
String
productId
=
profile
.
getProductId
();
String
productId
=
profile
.
getProductId
();
String
buyerId
=
data
.
getBuyerId
();
TransactionSession
session
=
TransactionSession
.
session
();
TransactionSession
session
=
TransactionSession
.
session
();
prepare
(
institutionId
,
productId
,
buyerId
,
session
);
AccountEntity
account
=
session
.
getAccount
();
long
historyId
=
session
.
nextId
();
Integer
partitionKey
=
account
.
getPartitionKey
();
GoodsDetail
[]
goodsDetails
=
data
.
getGoodsDetail
();
List
<
PayGoodsDetailEntity
>
details
=
new
LinkedList
<>();
for
(
GoodsDetail
detail
:
goodsDetails
)
{
validate
(
detail
);
PayGoodsDetailEntity
detailEntity
=
EntityBuilder
.
goodsDetail
(
session
.
nextId
(),
historyId
,
detail
);
detailEntity
.
setPartitionKey
(
partitionKey
);
details
.
add
(
detailEntity
);
}
String
mchId
=
data
.
getMchId
();
if
(!
mchId
.
equals
(
profile
.
getPayAppId
()))
{
AssertUtils
.
throwMessage
(
ACQUIRER_NOMATCH
,
chanId
,
mchId
);
}
String
outTradeNo
=
data
.
getOutTradeNo
();
String
outTradeNo
=
data
.
getOutTradeNo
();
PayHistoryIds
ids
=
new
PayHistoryIds
();
PayHistoryIds
ids
=
new
PayHistoryIds
();
ids
.
setInstitutionId
(
institutionId
);
ids
.
setInstitutionId
(
institutionId
);
...
@@ -66,19 +83,10 @@ public class TransactionService extends BusinessService {
...
@@ -66,19 +83,10 @@ public class TransactionService extends BusinessService {
ids
.
setExternalOrderNo
(
outTradeNo
);
ids
.
setExternalOrderNo
(
outTradeNo
);
check
(
ids
,
session
);
check
(
ids
,
session
);
GoodsDetail
[]
goodsDetail
=
data
.
getGoodsDetail
();
String
buyerId
=
data
.
getBuyerId
();
prepare
(
institutionId
,
productId
,
buyerId
,
session
);
AccountEntity
account
=
session
.
getAccount
();
PayHistoryEntity
history
=
EntityBuilder
.
history
(
profile
,
account
,
ids
,
data
,
session
);
PayHistoryEntity
history
=
EntityBuilder
.
history
(
account
,
ids
,
historyId
,
data
,
profile
,
session
);
session
.
pushEntity
(
history
);
session
.
pushEntity
(
history
);
session
.
pushEntity
(
details
);
session
.
commit
();
session
.
commit
();
...
...
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