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
9398f372
Commit
9398f372
authored
Sep 23, 2021
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
创建项目
parent
26f29bcd
Changes
30
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
950 additions
and
338 deletions
+950
-338
hibernate.cfg.xml
baa-pay-core/hibernate.cfg.xml
+1
-0
Acquirer.java
...ore/src/main/java/cn/quant/baa/pay/acquirer/Acquirer.java
+5
-6
AcquirerConstant.java
...main/java/cn/quant/baa/pay/acquirer/AcquirerConstant.java
+16
-0
ChannelResponse.java
.../main/java/cn/quant/baa/pay/acquirer/ChannelResponse.java
+136
-0
MerchantAcquirer.java
...main/java/cn/quant/baa/pay/acquirer/MerchantAcquirer.java
+5
-6
AlipayMerchantAcquirer.java
...quant/baa/pay/acquirer/alipay/AlipayMerchantAcquirer.java
+20
-17
WeiXinMerchantAcquirer.java
...quant/baa/pay/acquirer/weixin/WeiXinMerchantAcquirer.java
+159
-62
ModelBuilder.java
...rc/main/java/cn/quant/baa/pay/component/ModelBuilder.java
+3
-4
AcquirerConfiguration.java
...n/java/cn/quant/baa/pay/config/AcquirerConfiguration.java
+11
-7
DictionaryViewer.java
...c/main/java/cn/quant/baa/pay/config/DictionaryViewer.java
+16
-7
ServerConfiguration.java
...ain/java/cn/quant/baa/pay/config/ServerConfiguration.java
+11
-8
EntityBuilder.java
...ore/src/main/java/cn/quant/baa/pay/jpa/EntityBuilder.java
+21
-8
AccountIds.java
...src/main/java/cn/quant/baa/pay/jpa/entity/AccountIds.java
+0
-1
BatchCycleTriggerEntity.java
.../cn/quant/baa/pay/jpa/entity/BatchCycleTriggerEntity.java
+154
-0
DictionaryEntity.java
...in/java/cn/quant/baa/pay/jpa/entity/DictionaryEntity.java
+45
-8
DictionaryIds.java
.../main/java/cn/quant/baa/pay/jpa/entity/DictionaryIds.java
+2
-3
PayAccountIds.java
.../main/java/cn/quant/baa/pay/jpa/entity/PayAccountIds.java
+0
-1
PayFeatureIds.java
.../main/java/cn/quant/baa/pay/jpa/entity/PayFeatureIds.java
+0
-1
PayHistoryIds.java
.../main/java/cn/quant/baa/pay/jpa/entity/PayHistoryIds.java
+0
-1
StatusCodeEntity.java
...in/java/cn/quant/baa/pay/jpa/entity/StatusCodeEntity.java
+11
-10
StatusCodeIds.java
.../main/java/cn/quant/baa/pay/jpa/entity/StatusCodeIds.java
+7
-4
BatchCycleTriggerRepository.java
...t/baa/pay/jpa/repository/BatchCycleTriggerRepository.java
+15
-0
DictionaryItemDTO.java
...in/java/cn/quant/baa/pay/model/dto/DictionaryItemDTO.java
+94
-0
StatusCodeDTO.java
...c/main/java/cn/quant/baa/pay/model/dto/StatusCodeDTO.java
+16
-15
ProfileStorageService.java
.../java/cn/quant/baa/pay/service/ProfileStorageService.java
+3
-3
MerchantController.java
...c/main/java/cn/quant/baa/pay/rest/MerchantController.java
+4
-3
PayTestController.java
...rc/main/java/cn/quant/baa/pay/rest/PayTestController.java
+108
-108
TransactionController.java
...ain/java/cn/quant/baa/pay/rest/TransactionController.java
+38
-20
TransactionService.java
...ain/java/cn/quant/baa/pay/service/TransactionService.java
+48
-34
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 @
9398f372
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
<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"
/>
<mapping
class=
"cn.quant.baa.pay.jpa.entity.PayGoodsDetailEntity"
/>
<mapping
class=
"cn.quant.baa.pay.jpa.entity.StatusCodeEntity"
/>
<mapping
class=
"cn.quant.baa.pay.jpa.entity.StatusCodeEntity"
/>
<mapping
class=
"cn.quant.baa.pay.jpa.entity.BatchCycleTriggerEntity"
/>
<!-- 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/acquirer/Acquirer.java
View file @
9398f372
...
@@ -2,7 +2,6 @@ package cn.quant.baa.pay.acquirer;
...
@@ -2,7 +2,6 @@ package cn.quant.baa.pay.acquirer;
import
cn.quant.baa.pay.jpa.entity.PayHistoryEntity
;
import
cn.quant.baa.pay.jpa.entity.PayHistoryEntity
;
import
cn.quant.baa.pay.model.web.*
;
import
cn.quant.baa.pay.model.web.*
;
import
com.fasterxml.jackson.databind.JsonNode
;
/**
/**
* Created by Administrator on 2021/9/1 0001.
* Created by Administrator on 2021/9/1 0001.
...
@@ -10,9 +9,9 @@ import com.fasterxml.jackson.databind.JsonNode;
...
@@ -10,9 +9,9 @@ import com.fasterxml.jackson.databind.JsonNode;
public
interface
Acquirer
{
public
interface
Acquirer
{
Object
code
();
Object
code
();
JsonNode
pay
(
PayRequestData
payRequestData
,
PayHistoryEntity
payHistoryEntity
)
;
ChannelResponse
pay
(
PayRequestData
payRequestData
,
PayHistoryEntity
payHistoryEntity
)
throws
Exception
;
JsonNode
refund
(
RefundRequestData
refundRequestData
)
;
ChannelResponse
refund
(
RefundRequestData
refundRequestData
)
throws
Exception
;
JsonNode
checkPay
(
CheckPayRequestData
checkPayRequestData
)
;
ChannelResponse
checkPay
(
CheckPayRequestData
checkPayRequestData
)
throws
Exception
;
JsonNode
checkRefund
(
CheckRefundRequestData
checkRefundRequestData
)
;
ChannelResponse
checkRefund
(
CheckRefundRequestData
checkRefundRequestData
)
throws
Exception
;
JsonNode
close
(
CloseRequestData
closeRequestData
)
;
ChannelResponse
close
(
CloseRequestData
closeRequestData
)
throws
Exception
;
}
}
baa-pay-core/src/main/java/cn/quant/baa/pay/acquirer/AcquirerConstant.java
0 → 100644
View file @
9398f372
package
cn
.
quant
.
baa
.
pay
.
acquirer
;
/**
* Created by Administrator on 2021/9/23 0023.
*/
public
abstract
class
AcquirerConstant
{
public
final
static
String
HTTP_STATUS_TYPE
=
"HTTP_STAT"
;
public
final
static
String
COMMON_ERROR_CODE
=
"ERROR"
;
public
final
static
String
COMMON_ERROR_MESSAGE
=
"ERROR"
;
public
final
static
String
EXECUTE_PAY
=
"Pay"
;
public
final
static
String
EXECUTE_CHECK_PAY
=
"CheckPay"
;
public
final
static
String
EXECUTE_CHECK_REFUND
=
"CheckRefund"
;
public
final
static
String
EXECUTE_CLOSE
=
"Close"
;
public
final
static
String
EXECUTE_REFUND
=
"Refund"
;
}
baa-pay-core/src/main/java/cn/quant/baa/pay/acquirer/ChannelResponse.java
0 → 100644
View file @
9398f372
package
cn
.
quant
.
baa
.
pay
.
acquirer
;
import
com.fasterxml.jackson.databind.JsonNode
;
/**
* Created by Administrator on 2021/9/22 0022.
*/
public
class
ChannelResponse
{
private
boolean
success
;
private
String
code
;
private
String
message
;
private
String
requestId
;
//当前使用的微信平台证书序列号
private
String
serial
;
//微信服务器的时间戳
private
String
timestamp
;
//微信服务器提供的随机串
private
String
nonce
;
//微信平台签名
private
String
signature
;
private
String
payUrl
;
private
String
prepayId
;
private
JsonNode
node
;
public
boolean
getSuccess
()
{
return
success
;
}
public
void
setSuccess
(
boolean
success
)
{
this
.
success
=
success
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
String
getRequestId
()
{
return
requestId
;
}
public
void
setRequestId
(
String
requestId
)
{
this
.
requestId
=
requestId
;
}
public
String
getSerial
()
{
return
serial
;
}
public
void
setSerial
(
String
serial
)
{
this
.
serial
=
serial
;
}
public
String
getTimestamp
()
{
return
timestamp
;
}
public
void
setTimestamp
(
String
timestamp
)
{
this
.
timestamp
=
timestamp
;
}
public
String
getNonce
()
{
return
nonce
;
}
public
void
setNonce
(
String
nonce
)
{
this
.
nonce
=
nonce
;
}
public
String
getSignature
()
{
return
signature
;
}
public
void
setSignature
(
String
signature
)
{
this
.
signature
=
signature
;
}
public
String
getPayUrl
()
{
return
payUrl
;
}
public
void
setPayUrl
(
String
payUrl
)
{
this
.
payUrl
=
payUrl
;
}
public
String
getPrepayId
()
{
return
prepayId
;
}
public
void
setPrepayId
(
String
prepayId
)
{
this
.
prepayId
=
prepayId
;
}
public
JsonNode
getNode
()
{
return
node
;
}
public
void
setNode
(
JsonNode
node
)
{
this
.
node
=
node
;
}
@Override
public
String
toString
()
{
final
StringBuilder
sb
=
new
StringBuilder
(
"ChannelResponse{"
);
sb
.
append
(
"success="
).
append
(
success
);
sb
.
append
(
", code='"
).
append
(
code
).
append
(
'\''
);
sb
.
append
(
", message='"
).
append
(
message
).
append
(
'\''
);
sb
.
append
(
", requestId='"
).
append
(
requestId
).
append
(
'\''
);
sb
.
append
(
", serial='"
).
append
(
serial
).
append
(
'\''
);
sb
.
append
(
", timestamp='"
).
append
(
timestamp
).
append
(
'\''
);
sb
.
append
(
", nonce='"
).
append
(
nonce
).
append
(
'\''
);
sb
.
append
(
", signature='"
).
append
(
signature
).
append
(
'\''
);
sb
.
append
(
", payUrl='"
).
append
(
payUrl
).
append
(
'\''
);
sb
.
append
(
", prepayId='"
).
append
(
prepayId
).
append
(
'\''
);
sb
.
append
(
", node="
).
append
(
node
);
sb
.
append
(
'}'
);
return
sb
.
toString
();
}
}
baa-pay-core/src/main/java/cn/quant/baa/pay/acquirer/MerchantAcquirer.java
View file @
9398f372
...
@@ -6,7 +6,6 @@ import cn.quant.spring.NotSupportedException;
...
@@ -6,7 +6,6 @@ import cn.quant.spring.NotSupportedException;
import
cn.quant.spring.security.Base64Cipher
;
import
cn.quant.spring.security.Base64Cipher
;
import
cn.quant.spring.security.CharacterCipher
;
import
cn.quant.spring.security.CharacterCipher
;
import
cn.quant.spring.util.RandomSequencer
;
import
cn.quant.spring.util.RandomSequencer
;
import
com.fasterxml.jackson.databind.JsonNode
;
import
javax.crypto.Cipher
;
import
javax.crypto.Cipher
;
import
javax.crypto.spec.GCMParameterSpec
;
import
javax.crypto.spec.GCMParameterSpec
;
...
@@ -65,27 +64,27 @@ public class MerchantAcquirer implements Acquirer {
...
@@ -65,27 +64,27 @@ public class MerchantAcquirer implements Acquirer {
}
}
@Override
@Override
public
JsonNode
pay
(
PayRequestData
payRequestData
,
PayHistoryEntity
payHistoryEntity
)
{
public
ChannelResponse
pay
(
PayRequestData
payRequestData
,
PayHistoryEntity
payHistoryEntity
)
throws
Exception
{
return
acquirers
.
get
(
payRequestData
.
getChanId
()).
pay
(
payRequestData
,
payHistoryEntity
);
return
acquirers
.
get
(
payRequestData
.
getChanId
()).
pay
(
payRequestData
,
payHistoryEntity
);
}
}
@Override
@Override
public
JsonNode
refund
(
RefundRequestData
refundRequestData
)
{
public
ChannelResponse
refund
(
RefundRequestData
refundRequestData
)
throws
Exception
{
return
acquirers
.
get
(
refundRequestData
.
getChanId
()).
refund
(
refundRequestData
);
return
acquirers
.
get
(
refundRequestData
.
getChanId
()).
refund
(
refundRequestData
);
}
}
@Override
@Override
public
JsonNode
checkPay
(
CheckPayRequestData
checkPayRequestData
)
{
public
ChannelResponse
checkPay
(
CheckPayRequestData
checkPayRequestData
)
throws
Exception
{
return
acquirers
.
get
(
checkPayRequestData
.
getChanId
()).
checkPay
(
checkPayRequestData
);
return
acquirers
.
get
(
checkPayRequestData
.
getChanId
()).
checkPay
(
checkPayRequestData
);
}
}
@Override
@Override
public
JsonNode
checkRefund
(
CheckRefundRequestData
checkRefundRequestData
)
{
public
ChannelResponse
checkRefund
(
CheckRefundRequestData
checkRefundRequestData
)
throws
Exception
{
return
acquirers
.
get
(
checkRefundRequestData
.
getChanId
()).
checkRefund
(
checkRefundRequestData
);
return
acquirers
.
get
(
checkRefundRequestData
.
getChanId
()).
checkRefund
(
checkRefundRequestData
);
}
}
@Override
@Override
public
JsonNode
close
(
CloseRequestData
closeRequestData
)
{
public
ChannelResponse
close
(
CloseRequestData
closeRequestData
)
throws
Exception
{
return
acquirers
.
get
(
closeRequestData
.
getChanId
()).
close
(
closeRequestData
);
return
acquirers
.
get
(
closeRequestData
.
getChanId
()).
close
(
closeRequestData
);
}
}
}
}
baa-pay-core/src/main/java/cn/quant/baa/pay/acquirer/alipay/AlipayMerchantAcquirer.java
View file @
9398f372
package
cn
.
quant
.
baa
.
pay
.
acquirer
.
alipay
;
package
cn
.
quant
.
baa
.
pay
.
acquirer
.
alipay
;
import
cn.quant.baa.pay.acquirer.AcquirerProperties
;
import
cn.quant.baa.pay.acquirer.AcquirerProperties
;
import
cn.quant.baa.pay.acquirer.ChannelResponse
;
import
cn.quant.baa.pay.acquirer.MerchantAcquirer
;
import
cn.quant.baa.pay.acquirer.MerchantAcquirer
;
import
cn.quant.baa.pay.jpa.entity.PayHistoryEntity
;
import
cn.quant.baa.pay.jpa.entity.PayHistoryEntity
;
import
cn.quant.baa.pay.model.web.*
;
import
cn.quant.baa.pay.model.web.*
;
...
@@ -113,26 +114,27 @@ public class AlipayMerchantAcquirer extends MerchantAcquirer {
...
@@ -113,26 +114,27 @@ public class AlipayMerchantAcquirer extends MerchantAcquirer {
}
}
@Override
@Override
public
JsonNod
e
pay
(
PayRequestData
payRequestData
,
PayHistoryEntity
payHistoryEntity
)
{
public
ChannelRespons
e
pay
(
PayRequestData
payRequestData
,
PayHistoryEntity
payHistoryEntity
)
{
ObjectNode
bodyNode
=
objectMapper
.
createObjectNode
();
ObjectNode
bodyNode
=
objectMapper
.
createObjectNode
();
bodyNode
.
put
(
"out_trade_no"
,
payRequestData
.
getOutTradeNo
());
bodyNode
.
put
(
"out_trade_no"
,
payRequestData
.
getOutTradeNo
());
bodyNode
.
put
(
"total_amount"
,
payRequestData
.
getAmount
());
bodyNode
.
put
(
"total_amount"
,
payRequestData
.
getAmount
());
bodyNode
.
put
(
"subject"
,
payRequestData
.
getSubject
());
bodyNode
.
put
(
"subject"
,
payRequestData
.
getSubject
());
bodyNode
.
put
(
"body"
,
payRequestData
.
getSubject
());
bodyNode
.
put
(
"body"
,
payRequestData
.
getSubject
());
bodyNode
.
put
(
"product_code"
,
properties
.
getProductCode
());
bodyNode
.
put
(
"product_code"
,
properties
.
getProductCode
());
switch
(
properties
.
getAccessCode
())
{
// switch (properties.getAccessCode()) {
case
APP:
// case APP:
return
doAppExecute
(
bodyNode
);
// return doAppExecute(bodyNode);
case
H5:
// case H5:
case
WEB:
// case WEB:
return
doWebExecute
(
bodyNode
);
// return doWebExecute(bodyNode);
default
:
// default:
}
// }
return
doExecute
(
bodyNode
);
// return doExecute(bodyNode);
return
null
;
}
}
@Override
@Override
public
JsonNod
e
checkPay
(
CheckPayRequestData
checkPayRequestData
)
{
public
ChannelRespons
e
checkPay
(
CheckPayRequestData
checkPayRequestData
)
{
// String outTradeNo = "11111111218";
// String outTradeNo = "11111111218";
ObjectNode
bodyNode
=
objectMapper
.
createObjectNode
();
ObjectNode
bodyNode
=
objectMapper
.
createObjectNode
();
bodyNode
.
put
(
"out_trade_no"
,
checkPayRequestData
.
getOutTradeNo
());
bodyNode
.
put
(
"out_trade_no"
,
checkPayRequestData
.
getOutTradeNo
());
...
@@ -140,7 +142,7 @@ public class AlipayMerchantAcquirer extends MerchantAcquirer {
...
@@ -140,7 +142,7 @@ public class AlipayMerchantAcquirer extends MerchantAcquirer {
}
}
@Override
@Override
public
JsonNod
e
checkRefund
(
CheckRefundRequestData
checkRefundRequestData
)
{
public
ChannelRespons
e
checkRefund
(
CheckRefundRequestData
checkRefundRequestData
)
{
ObjectNode
bodyNode
=
objectMapper
.
createObjectNode
();
ObjectNode
bodyNode
=
objectMapper
.
createObjectNode
();
bodyNode
.
put
(
"out_trade_no"
,
checkRefundRequestData
.
getOutTradeNo
());
bodyNode
.
put
(
"out_trade_no"
,
checkRefundRequestData
.
getOutTradeNo
());
bodyNode
.
put
(
"out_request_no"
,
checkRefundRequestData
.
getOutRefundNo
());
bodyNode
.
put
(
"out_request_no"
,
checkRefundRequestData
.
getOutRefundNo
());
...
@@ -148,14 +150,14 @@ public class AlipayMerchantAcquirer extends MerchantAcquirer {
...
@@ -148,14 +150,14 @@ public class AlipayMerchantAcquirer extends MerchantAcquirer {
}
}
@Override
@Override
public
JsonNod
e
close
(
CloseRequestData
closeRequestData
)
{
public
ChannelRespons
e
close
(
CloseRequestData
closeRequestData
)
{
ObjectNode
bodyNode
=
objectMapper
.
createObjectNode
();
ObjectNode
bodyNode
=
objectMapper
.
createObjectNode
();
bodyNode
.
put
(
"out_trade_no"
,
closeRequestData
.
getOutTradeNo
());
bodyNode
.
put
(
"out_trade_no"
,
closeRequestData
.
getOutTradeNo
());
return
doExecute
(
bodyNode
);
return
doExecute
(
bodyNode
);
}
}
@Override
@Override
public
JsonNod
e
refund
(
RefundRequestData
refundRequestData
)
{
public
ChannelRespons
e
refund
(
RefundRequestData
refundRequestData
)
{
ObjectNode
bodyNode
=
objectMapper
.
createObjectNode
();
ObjectNode
bodyNode
=
objectMapper
.
createObjectNode
();
bodyNode
.
put
(
"out_trade_no"
,
refundRequestData
.
getOutTradeNo
());
bodyNode
.
put
(
"out_trade_no"
,
refundRequestData
.
getOutTradeNo
());
bodyNode
.
put
(
"refund_amount"
,
refundRequestData
.
getRefundAmount
());
bodyNode
.
put
(
"refund_amount"
,
refundRequestData
.
getRefundAmount
());
...
@@ -201,7 +203,7 @@ public class AlipayMerchantAcquirer extends MerchantAcquirer {
...
@@ -201,7 +203,7 @@ public class AlipayMerchantAcquirer extends MerchantAcquirer {
* @param bodyNode
* @param bodyNode
* @return
* @return
*/
*/
private
JsonNod
e
doExecute
(
ObjectNode
bodyNode
)
{
private
ChannelRespons
e
doExecute
(
ObjectNode
bodyNode
)
{
ObjectNode
params
=
buildParams
(
bodyNode
);
ObjectNode
params
=
buildParams
(
bodyNode
);
params
.
remove
(
"biz_content"
);
params
.
remove
(
"biz_content"
);
Map
<
String
,
String
>
sortedParams
=
objectMapper
.
convertValue
(
params
,
new
TypeReference
<
Map
<
String
,
String
>>(){});
Map
<
String
,
String
>
sortedParams
=
objectMapper
.
convertValue
(
params
,
new
TypeReference
<
Map
<
String
,
String
>>(){});
...
@@ -244,7 +246,7 @@ public class AlipayMerchantAcquirer extends MerchantAcquirer {
...
@@ -244,7 +246,7 @@ public class AlipayMerchantAcquirer extends MerchantAcquirer {
//这里的斜杠替换是因为json解析之后自动去掉了转义符/,签名的时候需要再给加上
//这里的斜杠替换是因为json解析之后自动去掉了转义符/,签名的时候需要再给加上
String
signText
=
bodyJsonNode
.
get
(
"response"
).
toString
().
replace
(
"/"
,
"\\/"
);
String
signText
=
bodyJsonNode
.
get
(
"response"
).
toString
().
replace
(
"/"
,
"\\/"
);
if
(
verify
(
signText
,
signature
))
{
if
(
verify
(
signText
,
signature
))
{
return
bodyJsonNode
;
//
return bodyJsonNode;
}
}
// TODO: 签名校验失败,做异常处理
// TODO: 签名校验失败,做异常处理
throw
new
RuntimeException
(
"签名校验失败"
);
throw
new
RuntimeException
(
"签名校验失败"
);
...
@@ -253,7 +255,8 @@ public class AlipayMerchantAcquirer extends MerchantAcquirer {
...
@@ -253,7 +255,8 @@ public class AlipayMerchantAcquirer extends MerchantAcquirer {
throw
new
RuntimeException
(
"返回异常,做异常处理"
);
throw
new
RuntimeException
(
"返回异常,做异常处理"
);
}
}
}
}
return
bodyJsonNode
;
// return bodyJsonNode;
return
null
;
}
}
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/acquirer/weixin/WeiXinMerchantAcquirer.java
View file @
9398f372
This diff is collapsed.
Click to expand it.
baa-pay-core/src/main/java/cn/quant/baa/pay/component/ModelBuilder.java
View file @
9398f372
...
@@ -3,14 +3,13 @@ package cn.quant.baa.pay.component;
...
@@ -3,14 +3,13 @@ package cn.quant.baa.pay.component;
import
cn.quant.baa.pay.acquirer.AcquirerProperties
;
import
cn.quant.baa.pay.acquirer.AcquirerProperties
;
import
cn.quant.baa.pay.config.DictionaryViewer
;
import
cn.quant.baa.pay.config.DictionaryViewer
;
import
cn.quant.baa.pay.dict.DictType
;
import
cn.quant.baa.pay.dict.DictType
;
import
cn.quant.baa.pay.model.
DictionaryItem
;
import
cn.quant.baa.pay.model.
dto.DictionaryItemDTO
;
import
cn.quant.baa.pay.model.web.MerchantAcquirerProperties
;
import
cn.quant.baa.pay.model.web.MerchantAcquirerProperties
;
import
cn.quant.baa.pay.model.web.MerchantChannelResponseData
;
import
cn.quant.baa.pay.model.web.MerchantChannelResponseData
;
import
cn.quant.spring.NotSupportedException
;
import
cn.quant.spring.NotSupportedException
;
import
cn.quant.spring.util.StringUtils
;
import
cn.quant.spring.util.StringUtils
;
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
org.springframework.stereotype.Service
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.HashMap
;
...
@@ -50,14 +49,14 @@ public class ModelBuilder {
...
@@ -50,14 +49,14 @@ public class ModelBuilder {
public
Map
<
String
,
MerchantChannelResponseData
>
toModel
(
Map
<
String
,
Collection
<
AcquirerProperties
>>
profiles
,
String
access
)
{
public
Map
<
String
,
MerchantChannelResponseData
>
toModel
(
Map
<
String
,
Collection
<
AcquirerProperties
>>
profiles
,
String
access
)
{
Map
<
String
,
MerchantChannelResponseData
>
models
=
new
HashMap
<>();
Map
<
String
,
MerchantChannelResponseData
>
models
=
new
HashMap
<>();
for
(
String
code
:
profiles
.
keySet
())
{
for
(
String
code
:
profiles
.
keySet
())
{
DictionaryItem
item
=
dictionaryViewer
.
get
(
DictType
.
PAY
,
code
);
DictionaryItem
DTO
item
=
dictionaryViewer
.
get
(
DictType
.
PAY
,
code
);
if
(
item
==
null
)
{
if
(
item
==
null
)
{
throw
new
NotSupportedException
(
StringUtils
.
format
(
"Dictionary item is null({}, {})."
,
DictType
.
PAY
,
code
));
throw
new
NotSupportedException
(
StringUtils
.
format
(
"Dictionary item is null({}, {})."
,
DictType
.
PAY
,
code
));
}
}
Collection
<
AcquirerProperties
>
collection
=
profiles
.
get
(
code
);
Collection
<
AcquirerProperties
>
collection
=
profiles
.
get
(
code
);
MerchantChannelResponseData
book
=
new
MerchantChannelResponseData
();
MerchantChannelResponseData
book
=
new
MerchantChannelResponseData
();
book
.
setCode
(
code
);
book
.
setCode
(
code
);
book
.
setName
(
item
.
get
Name
());
book
.
setName
(
item
.
get
Text
());
book
.
setImageUrl
(
item
.
getImageUrl
());
book
.
setImageUrl
(
item
.
getImageUrl
());
for
(
AcquirerProperties
profile
:
collection
)
{
for
(
AcquirerProperties
profile
:
collection
)
{
if
((
access
!=
null
)
&&
(!
access
.
equals
(
profile
.
getAccessCode
().
name
())))
{
if
((
access
!=
null
)
&&
(!
access
.
equals
(
profile
.
getAccessCode
().
name
())))
{
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/config/AcquirerConfiguration.java
View file @
9398f372
package
cn
.
quant
.
baa
.
pay
.
config
;
package
cn
.
quant
.
baa
.
pay
.
config
;
import
cn.quant.baa.pay.acquirer.AcquirerPropertiesSource
;
import
cn.quant.baa.pay.acquirer.AcquirerPropertiesBuilder
;
import
cn.quant.baa.pay.acquirer.AcquirerProperties
;
import
cn.quant.baa.pay.acquirer.AcquirerProperties
;
import
cn.quant.baa.pay.acquirer.AcquirerPropertiesBuilder
;
import
cn.quant.baa.pay.acquirer.AcquirerPropertiesSource
;
import
cn.quant.baa.pay.acquirer.MerchantAcquirer
;
import
cn.quant.baa.pay.acquirer.MerchantAcquirer
;
import
cn.quant.baa.pay.acquirer.alipay.AlipayMerchantAcquirer
;
import
cn.quant.baa.pay.acquirer.alipay.AlipayMerchantAcquirer
;
import
cn.quant.baa.pay.acquirer.weixin.WeiXinMerchantAcquirer
;
import
cn.quant.baa.pay.acquirer.weixin.WeiXinMerchantAcquirer
;
import
cn.quant.baa.pay.jpa.entity.*
;
import
cn.quant.baa.pay.jpa.entity.MchChannelEntity
;
import
cn.quant.baa.pay.jpa.repository.*
;
import
cn.quant.baa.pay.jpa.entity.PayAccountEntity
;
import
cn.quant.baa.pay.model.DictionaryItem
;
import
cn.quant.baa.pay.jpa.entity.PayAppEntity
;
import
cn.quant.baa.pay.jpa.entity.PayFeatureEntity
;
import
cn.quant.baa.pay.jpa.repository.MchChannelRepository
;
import
cn.quant.baa.pay.jpa.repository.PayAccountRepository
;
import
cn.quant.baa.pay.jpa.repository.PayAppRepository
;
import
cn.quant.baa.pay.jpa.repository.PayFeatureRepository
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
...
@@ -65,7 +70,7 @@ public class AcquirerConfiguration {
...
@@ -65,7 +70,7 @@ public class AcquirerConfiguration {
MerchantAcquirer
merchantAcquirer
=
MerchantAcquirer
.
getInstance
();
MerchantAcquirer
merchantAcquirer
=
MerchantAcquirer
.
getInstance
();
Collection
<
AcquirerProperties
>
properties
=
acquirerPropertiesSource
.
getAll
();
Collection
<
AcquirerProperties
>
properties
=
acquirerPropertiesSource
.
getAll
();
for
(
AcquirerProperties
property
:
properties
)
{
for
(
AcquirerProperties
property
:
properties
)
{
if
(
"WXP"
.
equals
(
property
.
getPayChanCode
()))
{
if
(
"WXP"
.
equals
(
property
.
getPayChanCode
()))
{
WeiXinMerchantAcquirer
acquirer
=
new
WeiXinMerchantAcquirer
();
WeiXinMerchantAcquirer
acquirer
=
new
WeiXinMerchantAcquirer
();
acquirer
.
init
(
property
);
acquirer
.
init
(
property
);
merchantAcquirer
.
register
(
acquirer
);
merchantAcquirer
.
register
(
acquirer
);
...
@@ -79,5 +84,4 @@ public class AcquirerConfiguration {
...
@@ -79,5 +84,4 @@ public class AcquirerConfiguration {
}
}
}
}
baa-pay-core/src/main/java/cn/quant/baa/pay/config/DictionaryViewer.java
View file @
9398f372
package
cn
.
quant
.
baa
.
pay
.
config
;
package
cn
.
quant
.
baa
.
pay
.
config
;
import
cn.quant.baa.pay.model.
DictionaryItem
;
import
cn.quant.baa.pay.model.
dto.DictionaryItemDTO
;
import
com.google.common.base.Supplier
;
import
com.google.common.base.Supplier
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Table
;
import
com.google.common.collect.Table
;
...
@@ -12,19 +12,28 @@ import java.util.Map;
...
@@ -12,19 +12,28 @@ import java.util.Map;
* Created by Administrator on 2021/8/23 0023.
* Created by Administrator on 2021/8/23 0023.
*/
*/
public
class
DictionaryViewer
{
public
class
DictionaryViewer
{
private
Table
<
String
,
String
,
DictionaryItem
>
bigTable
=
Tables
.
newCustomTable
(
Maps
.
newHashMap
(),
new
Supplier
()
{
public
Map
<
String
,
DictionaryItem
>
get
()
{
private
Table
<
String
,
String
,
DictionaryItemDTO
>
bigTable
=
Tables
.
newCustomTable
(
Maps
.
newHashMap
(),
new
Supplier
()
{
public
Map
<
String
,
DictionaryItemDTO
>
get
()
{
return
Maps
.
newLinkedHashMap
();
return
Maps
.
newLinkedHashMap
();
}
}
});
});
private
final
static
DictionaryViewer
viewer
=
new
DictionaryViewer
();
private
DictionaryViewer
()
{
}
public
static
DictionaryViewer
getInstance
()
{
return
viewer
;
}
public
void
add
(
DictionaryItem
item
)
{
public
static
void
add
(
DictionaryItemDTO
item
)
{
bigTable
.
put
(
item
.
getType
(),
item
.
getCode
(),
item
);
viewer
.
bigTable
.
put
(
item
.
getType
(),
item
.
getCode
(),
item
);
}
}
public
DictionaryItem
get
(
String
type
,
String
code
)
{
public
static
DictionaryItemDTO
get
(
String
type
,
String
code
)
{
return
bigTable
.
get
(
type
,
code
);
return
viewer
.
bigTable
.
get
(
type
,
code
);
}
}
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/config/ServerConfiguration.java
View file @
9398f372
...
@@ -2,7 +2,7 @@ package cn.quant.baa.pay.config;
...
@@ -2,7 +2,7 @@ package cn.quant.baa.pay.config;
import
cn.quant.baa.pay.jpa.entity.DictionaryEntity
;
import
cn.quant.baa.pay.jpa.entity.DictionaryEntity
;
import
cn.quant.baa.pay.jpa.repository.DictionaryRepository
;
import
cn.quant.baa.pay.jpa.repository.DictionaryRepository
;
import
cn.quant.baa.pay.model.
DictionaryItem
;
import
cn.quant.baa.pay.model.
dto.DictionaryItemDTO
;
import
cn.quant.spring.data.jpa.PersistentEntityInvoker
;
import
cn.quant.spring.data.jpa.PersistentEntityInvoker
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContext
;
...
@@ -26,16 +26,19 @@ public class ServerConfiguration {
...
@@ -26,16 +26,19 @@ public class ServerConfiguration {
@Bean
@Bean
public
DictionaryViewer
dictionaryViewer
()
{
public
DictionaryViewer
dictionaryViewer
()
{
DictionaryViewer
dictionary
=
new
DictionaryViewer
();
DictionaryViewer
dictionary
=
DictionaryViewer
.
getInstance
();
List
<
DictionaryEntity
>
entities
=
dictionaryRepository
.
findAll
();
List
<
DictionaryEntity
>
entities
=
dictionaryRepository
.
findAll
();
for
(
DictionaryEntity
entity
:
entities
)
{
for
(
DictionaryEntity
entity
:
entities
)
{
DictionaryItem
item
=
new
DictionaryItem
();
if
(
entity
.
getParentId
().
compareTo
(
0
)
>
0
)
{
item
.
setName
(
entity
.
getName
()
);
DictionaryItemDTO
item
=
new
DictionaryItemDTO
(
);
item
.
setCode
(
entity
.
getCode
());
item
.
setCode
(
entity
.
getCode
());
item
.
setType
(
entity
.
getType
());
item
.
setType
(
entity
.
getType
());
item
.
setText
(
entity
.
getText
());
item
.
setValue
(
entity
.
getValue
());
item
.
setImageUrl
(
entity
.
getImageUrl
());
item
.
setImageUrl
(
entity
.
getImageUrl
());
dictionary
.
add
(
item
);
dictionary
.
add
(
item
);
}
}
}
return
dictionary
;
return
dictionary
;
}
}
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/EntityBuilder.java
View file @
9398f372
...
@@ -7,12 +7,14 @@ import cn.quant.baa.pay.jpa.entity.*;
...
@@ -7,12 +7,14 @@ import cn.quant.baa.pay.jpa.entity.*;
import
cn.quant.baa.pay.model.web.GoodsDetail
;
import
cn.quant.baa.pay.model.web.GoodsDetail
;
import
cn.quant.baa.pay.model.web.PayRequestData
;
import
cn.quant.baa.pay.model.web.PayRequestData
;
import
cn.quant.spring.util.DateUtils
;
import
cn.quant.spring.util.DateUtils
;
import
org.hibernate.engine.jdbc.batch.spi.Batch
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
import
java.util.Date
;
import
static
cn
.
quant
.
baa
.
pay
.
Constant
.
MINI_DATE
;
import
static
cn
.
quant
.
baa
.
pay
.
Constant
.
MINI_LOCAL_DATE
;
import
static
cn
.
quant
.
baa
.
pay
.
Constant
.
MINI_LOCAL_DATE
;
/**
/**
...
@@ -20,10 +22,11 @@ import static cn.quant.baa.pay.Constant.MINI_LOCAL_DATE;
...
@@ -20,10 +22,11 @@ import static cn.quant.baa.pay.Constant.MINI_LOCAL_DATE;
*/
*/
public
class
EntityBuilder
{
public
class
EntityBuilder
{
p
rivate
static
int
nextTxnNo
(
AccountEntity
account
)
{
p
ublic
static
int
nextTxnNo
(
AccountEntity
account
,
PayHistoryEntity
history
)
{
Integer
txnNo
=
account
.
getNextTxnNo
();
Integer
txnNo
=
account
.
getNextTxnNo
();
account
.
setTxnNo
(
txnNo
);
account
.
setTxnNo
(
txnNo
);
account
.
setNextTxnNo
(
txnNo
+
1
);
account
.
setNextTxnNo
(
txnNo
+
1
);
history
.
setTxnNo
(
txnNo
);
return
txnNo
;
return
txnNo
;
}
}
...
@@ -60,7 +63,7 @@ public class EntityBuilder {
...
@@ -60,7 +63,7 @@ public class EntityBuilder {
return
account
;
return
account
;
}
}
public
static
PayHistoryEntity
h
istory
(
AccountEntity
account
,
PayHistoryIds
ids
,
long
historyId
,
PayRequestData
data
,
AcquirerProperties
profile
public
static
PayHistoryEntity
payH
istory
(
AccountEntity
account
,
PayHistoryIds
ids
,
long
historyId
,
PayRequestData
data
,
AcquirerProperties
profile
,
TransactionSession
session
)
{
,
TransactionSession
session
)
{
BigDecimal
discount
=
new
BigDecimal
(
data
.
getDiscounts
());
BigDecimal
discount
=
new
BigDecimal
(
data
.
getDiscounts
());
...
@@ -70,11 +73,9 @@ public class EntityBuilder {
...
@@ -70,11 +73,9 @@ public class EntityBuilder {
BigDecimal
amount
=
new
BigDecimal
(
data
.
getAmount
());
BigDecimal
amount
=
new
BigDecimal
(
data
.
getAmount
());
String
signer
=
data
.
getGoodsSigner
();
String
signer
=
data
.
getGoodsSigner
();
Long
accountId
=
account
.
getAccountId
();
PayHistoryEntity
entity
=
new
PayHistoryEntity
();
PayHistoryEntity
entity
=
new
PayHistoryEntity
();
entity
.
setIds
(
ids
);
entity
.
setIds
(
ids
);
entity
.
setAccountId
(
account
Id
);
entity
.
setAccountId
(
account
.
getAccountId
()
);
entity
.
setAddress
(
data
.
getAddress
());
entity
.
setAddress
(
data
.
getAddress
());
entity
.
setAttachText
(
data
.
getAttach
());
entity
.
setAttachText
(
data
.
getAttach
());
entity
.
setCreditDebitFlag
(
CreditDebitFlag
.
C
);
entity
.
setCreditDebitFlag
(
CreditDebitFlag
.
C
);
...
@@ -99,15 +100,14 @@ public class EntityBuilder {
...
@@ -99,15 +100,14 @@ public class EntityBuilder {
entity
.
setRequestTime
(
session
.
getRequestTime
());
entity
.
setRequestTime
(
session
.
getRequestTime
());
entity
.
setShopName
(
data
.
getShopName
());
entity
.
setShopName
(
data
.
getShopName
());
entity
.
setStatementeFlag
(
true
);
entity
.
setStatementeFlag
(
true
);
entity
.
setStatisticsCode
(
"
RPAY
"
);
entity
.
setStatisticsCode
(
"
PYMT
"
);
entity
.
setStatusCode
(
StatusCode
.
PEND
);
entity
.
setStatusCode
(
StatusCode
.
PEND
);
entity
.
setSubject
(
data
.
getSubject
());
entity
.
setSubject
(
data
.
getSubject
());
entity
.
setTransactionId
(
historyId
);
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
());
entity
.
setTxnType
(
"RETL"
);
entity
.
setTxnType
(
"PYMT"
);
entity
.
setTxnNo
(
nextTxnNo
(
account
));
if
(
cash
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
if
(
cash
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
entity
.
setTxnCode
(
"R001"
);
entity
.
setTxnCode
(
"R001"
);
}
else
{
}
else
{
...
@@ -139,4 +139,17 @@ public class EntityBuilder {
...
@@ -139,4 +139,17 @@ public class EntityBuilder {
return
entity
;
return
entity
;
}
}
public
static
BatchCycleTriggerEntity
payTrigger
(
Long
triggerId
,
PayHistoryEntity
history
){
Date
now
=
DateUtils
.
now
();
BatchCycleTriggerEntity
entity
=
new
BatchCycleTriggerEntity
();
entity
.
setAccountId
(
history
.
getAccountId
());
entity
.
setChanNotifyStatus
(
StatusCode
.
PEND
);
entity
.
setEntityCode
(
history
.
getTxnType
());
entity
.
setMchNotifyStatus
(
StatusCode
.
PEND
);
entity
.
setPayDueTime
(
DateUtils
.
toLocalDateTime
(
now
).
plusMinutes
(
30
));
entity
.
setTargetId
(
history
.
getTransactionId
());
entity
.
setTriggerId
(
triggerId
);
entity
.
setPartitionKey
(
history
.
getPartitionKey
());
return
entity
;
}
}
}
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/entity/AccountIds.java
View file @
9398f372
...
@@ -63,7 +63,6 @@ public class AccountIds extends PrimaryIds implements Serializable {
...
@@ -63,7 +63,6 @@ public class AccountIds extends PrimaryIds implements Serializable {
final
StringBuilder
sb
=
new
StringBuilder
(
"AccountIds{"
);
final
StringBuilder
sb
=
new
StringBuilder
(
"AccountIds{"
);
sb
.
append
(
"institutionId='"
).
append
(
institutionId
).
append
(
'\''
);
sb
.
append
(
"institutionId='"
).
append
(
institutionId
).
append
(
'\''
);
sb
.
append
(
", accountRefNo='"
).
append
(
accountRefNo
).
append
(
'\''
);
sb
.
append
(
", accountRefNo='"
).
append
(
accountRefNo
).
append
(
'\''
);
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/BatchCycleTriggerEntity.java
0 → 100644
View file @
9398f372
package
cn
.
quant
.
baa
.
pay
.
jpa
.
entity
;
import
cn.quant.baa.pay.dict.StatusCode
;
import
cn.quant.spring.data.jpa.entity.PartitionEntity
;
import
cn.quant.spring.util.StringUtils
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.time.LocalDateTime
;
import
java.util.Date
;
/**
* Created by Administrator on 2021/9/22 0022.
*/
@Entity
@Table
(
name
=
"batch_cycle_trigger"
)
public
class
BatchCycleTriggerEntity
extends
PartitionEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1419514603248200095L
;
public
final
static
String
CLASS_NAME
=
BatchCycleTriggerEntity
.
class
.
getSimpleName
();
@Id
@Column
(
name
=
"TRIGGER_ID"
,
nullable
=
false
)
private
long
triggerId
;
@Column
(
name
=
"ENTITY_CODE"
,
nullable
=
false
,
length
=
4
)
private
String
entityCode
;
@Column
(
name
=
"TARGET_ID"
,
nullable
=
false
)
private
Long
targetId
;
@Column
(
name
=
"ACCOUNT_ID"
,
nullable
=
false
)
private
Long
accountId
;
@Column
(
name
=
"PAY_DUE_TIME"
,
nullable
=
false
)
private
LocalDateTime
payDueTime
;
@Enumerated
(
EnumType
.
STRING
)
@Column
(
name
=
"CHAN_NOTIFY_STATUS"
,
nullable
=
false
,
length
=
4
)
private
StatusCode
chanNotifyStatus
;
@Column
(
name
=
"CHAN_NOTIFY_TIME"
,
nullable
=
true
)
private
Date
chanNotifyTime
;
@Enumerated
(
EnumType
.
STRING
)
@Column
(
name
=
"MCH_NOTIFY_STATUS"
,
nullable
=
false
,
length
=
4
)
private
StatusCode
mchNotifyStatus
;
@Column
(
name
=
"MCH_NOTIFY_TIME"
,
nullable
=
true
)
private
Date
mchNotifyTime
;
public
long
getTriggerId
()
{
return
triggerId
;
}
public
void
setTriggerId
(
long
triggerId
)
{
this
.
triggerId
=
triggerId
;
}
public
String
getEntityCode
()
{
return
entityCode
;
}
public
void
setEntityCode
(
String
entityCode
)
{
this
.
entityCode
=
entityCode
;
}
public
Long
getTargetId
()
{
return
targetId
;
}
public
void
setTargetId
(
Long
targetId
)
{
this
.
targetId
=
targetId
;
}
public
Long
getAccountId
()
{
return
accountId
;
}
public
void
setAccountId
(
Long
accountId
)
{
this
.
accountId
=
accountId
;
}
public
LocalDateTime
getPayDueTime
()
{
return
payDueTime
;
}
public
void
setPayDueTime
(
LocalDateTime
payDueTime
)
{
this
.
payDueTime
=
payDueTime
;
}
public
StatusCode
getChanNotifyStatus
()
{
return
chanNotifyStatus
;
}
public
void
setChanNotifyStatus
(
StatusCode
chanNotifyStatus
)
{
this
.
chanNotifyStatus
=
chanNotifyStatus
;
}
public
Date
getChanNotifyTime
()
{
return
chanNotifyTime
;
}
public
void
setChanNotifyTime
(
Date
chanNotifyTime
)
{
this
.
chanNotifyTime
=
chanNotifyTime
;
}
public
StatusCode
getMchNotifyStatus
()
{
return
mchNotifyStatus
;
}
public
void
setMchNotifyStatus
(
StatusCode
mchNotifyStatus
)
{
this
.
mchNotifyStatus
=
mchNotifyStatus
;
}
public
Date
getMchNotifyTime
()
{
return
mchNotifyTime
;
}
public
void
setMchNotifyTime
(
Date
mchNotifyTime
)
{
this
.
mchNotifyTime
=
mchNotifyTime
;
}
@Override
public
String
getPersistentKey
()
{
return
StringUtils
.
toDelimitedString
(
CLASS_NAME
,
triggerId
);
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
return
false
;
BatchCycleTriggerEntity
that
=
(
BatchCycleTriggerEntity
)
o
;
return
triggerId
==
that
.
triggerId
;
}
@Override
public
String
toString
()
{
final
StringBuilder
sb
=
new
StringBuilder
(
"BatchCycleTriggerEntity{"
);
sb
.
append
(
"triggerId="
).
append
(
triggerId
);
sb
.
append
(
", entityCode='"
).
append
(
entityCode
).
append
(
'\''
);
sb
.
append
(
", targetId="
).
append
(
targetId
);
sb
.
append
(
", accountId="
).
append
(
accountId
);
sb
.
append
(
", payDueTime="
).
append
(
payDueTime
);
sb
.
append
(
", chanNotifyStatus='"
).
append
(
chanNotifyStatus
).
append
(
'\''
);
sb
.
append
(
", chanNotifyTime="
).
append
(
chanNotifyTime
);
sb
.
append
(
", mchNotifyStatus='"
).
append
(
mchNotifyStatus
).
append
(
'\''
);
sb
.
append
(
", mchNotifyTime="
).
append
(
mchNotifyTime
);
sb
.
append
(
','
).
append
(
super
.
toString
());
sb
.
append
(
'}'
);
return
sb
.
toString
();
}
}
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/entity/DictionaryEntity.java
View file @
9398f372
package
cn
.
quant
.
baa
.
pay
.
jpa
.
entity
;
package
cn
.
quant
.
baa
.
pay
.
jpa
.
entity
;
import
cn.quant.baa.pay.dict.DictType
;
import
cn.quant.spring.data.jpa.entity.OptimisticEntity
;
import
cn.quant.spring.data.jpa.entity.OptimisticEntity
;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
...
@@ -21,12 +20,21 @@ public class DictionaryEntity extends OptimisticEntity implements Serializable {
...
@@ -21,12 +20,21 @@ public class DictionaryEntity extends OptimisticEntity implements Serializable {
@EmbeddedId
@EmbeddedId
private
DictionaryIds
ids
;
private
DictionaryIds
ids
;
@Column
(
name
=
"NAME"
,
nullable
=
false
,
length
=
255
)
@Column
(
name
=
"ID"
,
nullable
=
false
,
updatable
=
false
)
private
String
name
;
private
Long
id
;
@Column
(
name
=
"TEXT"
,
nullable
=
false
,
length
=
64
)
private
String
text
;
@Column
(
name
=
"VALUE"
,
nullable
=
false
,
length
=
500
)
private
String
value
;
@Column
(
name
=
"IMAGE_URL"
,
nullable
=
true
,
length
=
500
)
@Column
(
name
=
"IMAGE_URL"
,
nullable
=
true
,
length
=
500
)
private
String
imageUrl
;
private
String
imageUrl
;
@Column
(
name
=
"PARENT_ID"
,
nullable
=
true
,
length
=
500
)
private
Integer
parentId
;
public
DictionaryIds
getIds
()
{
public
DictionaryIds
getIds
()
{
return
ids
;
return
ids
;
}
}
...
@@ -35,12 +43,28 @@ public class DictionaryEntity extends OptimisticEntity implements Serializable {
...
@@ -35,12 +43,28 @@ public class DictionaryEntity extends OptimisticEntity implements Serializable {
this
.
ids
=
ids
;
this
.
ids
=
ids
;
}
}
public
String
getName
()
{
public
Long
getId
()
{
return
name
;
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
String
getText
()
{
return
text
;
}
public
void
setText
(
String
text
)
{
this
.
text
=
text
;
}
}
public
void
setName
(
String
name
)
{
public
String
getValue
()
{
this
.
name
=
name
;
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
}
public
String
getImageUrl
()
{
public
String
getImageUrl
()
{
...
@@ -51,6 +75,14 @@ public class DictionaryEntity extends OptimisticEntity implements Serializable {
...
@@ -51,6 +75,14 @@ public class DictionaryEntity extends OptimisticEntity implements Serializable {
this
.
imageUrl
=
imageUrl
;
this
.
imageUrl
=
imageUrl
;
}
}
public
Integer
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
Integer
parentId
)
{
this
.
parentId
=
parentId
;
}
@Override
@Override
public
String
getPersistentKey
()
{
public
String
getPersistentKey
()
{
return
ids
.
getPersistentKey
();
return
ids
.
getPersistentKey
();
...
@@ -68,8 +100,11 @@ public class DictionaryEntity extends OptimisticEntity implements Serializable {
...
@@ -68,8 +100,11 @@ public class DictionaryEntity extends OptimisticEntity implements Serializable {
public
String
toString
()
{
public
String
toString
()
{
final
StringBuilder
sb
=
new
StringBuilder
(
"DictionaryEntity{"
);
final
StringBuilder
sb
=
new
StringBuilder
(
"DictionaryEntity{"
);
sb
.
append
(
"ids="
).
append
(
ids
);
sb
.
append
(
"ids="
).
append
(
ids
);
sb
.
append
(
", name='"
).
append
(
name
).
append
(
'\''
);
sb
.
append
(
", id="
).
append
(
id
);
sb
.
append
(
", text='"
).
append
(
text
).
append
(
'\''
);
sb
.
append
(
", value='"
).
append
(
value
).
append
(
'\''
);
sb
.
append
(
", imageUrl='"
).
append
(
imageUrl
).
append
(
'\''
);
sb
.
append
(
", imageUrl='"
).
append
(
imageUrl
).
append
(
'\''
);
sb
.
append
(
", parentId="
).
append
(
parentId
);
sb
.
append
(
','
).
append
(
super
.
toString
());
sb
.
append
(
','
).
append
(
super
.
toString
());
sb
.
append
(
'}'
);
sb
.
append
(
'}'
);
return
sb
.
toString
();
return
sb
.
toString
();
...
@@ -82,4 +117,6 @@ public class DictionaryEntity extends OptimisticEntity implements Serializable {
...
@@ -82,4 +117,6 @@ public class DictionaryEntity extends OptimisticEntity implements Serializable {
public
String
getCode
(){
public
String
getCode
(){
return
ids
.
getCode
();
return
ids
.
getCode
();
}
}
}
}
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/entity/DictionaryIds.java
View file @
9398f372
...
@@ -18,10 +18,10 @@ public class DictionaryIds extends PrimaryIds implements Serializable {
...
@@ -18,10 +18,10 @@ public class DictionaryIds extends PrimaryIds implements Serializable {
private
final
static
String
CLASS_NAME
=
DictionaryEntity
.
class
.
getSimpleName
();
private
final
static
String
CLASS_NAME
=
DictionaryEntity
.
class
.
getSimpleName
();
@Column
(
name
=
"TYPE"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
@Column
(
name
=
"TYPE"
,
nullable
=
false
,
updatable
=
false
,
length
=
32
)
private
String
type
;
private
String
type
;
@Column
(
name
=
"CODE"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
@Column
(
name
=
"CODE"
,
nullable
=
false
,
updatable
=
false
,
length
=
32
)
private
String
code
;
private
String
code
;
public
String
getType
()
{
public
String
getType
()
{
...
@@ -64,7 +64,6 @@ public class DictionaryIds extends PrimaryIds implements Serializable {
...
@@ -64,7 +64,6 @@ public class DictionaryIds extends PrimaryIds implements Serializable {
final
StringBuilder
sb
=
new
StringBuilder
(
"DictionaryIds{"
);
final
StringBuilder
sb
=
new
StringBuilder
(
"DictionaryIds{"
);
sb
.
append
(
"type='"
).
append
(
type
).
append
(
'\''
);
sb
.
append
(
"type='"
).
append
(
type
).
append
(
'\''
);
sb
.
append
(
", code='"
).
append
(
code
).
append
(
'\''
);
sb
.
append
(
", code='"
).
append
(
code
).
append
(
'\''
);
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/PayAccountIds.java
View file @
9398f372
...
@@ -64,7 +64,6 @@ public class PayAccountIds extends PrimaryIds implements Serializable {
...
@@ -64,7 +64,6 @@ public class PayAccountIds extends PrimaryIds implements Serializable {
final
StringBuilder
sb
=
new
StringBuilder
(
"PayAccountIds{"
);
final
StringBuilder
sb
=
new
StringBuilder
(
"PayAccountIds{"
);
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
(
','
).
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 @
9398f372
...
@@ -68,7 +68,6 @@ public class PayFeatureIds extends PrimaryIds implements Serializable {
...
@@ -68,7 +68,6 @@ public class PayFeatureIds extends PrimaryIds implements Serializable {
final
StringBuilder
sb
=
new
StringBuilder
(
"PayFeatureIds{"
);
final
StringBuilder
sb
=
new
StringBuilder
(
"PayFeatureIds{"
);
sb
.
append
(
"payChanCode='"
).
append
(
payChanCode
).
append
(
'\''
);
sb
.
append
(
"payChanCode='"
).
append
(
payChanCode
).
append
(
'\''
);
sb
.
append
(
", accessCode='"
).
append
(
accessCode
).
append
(
'\''
);
sb
.
append
(
", accessCode='"
).
append
(
accessCode
).
append
(
'\''
);
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/PayHistoryIds.java
View file @
9398f372
...
@@ -75,7 +75,6 @@ public class PayHistoryIds extends PrimaryIds implements Serializable {
...
@@ -75,7 +75,6 @@ public class PayHistoryIds extends PrimaryIds implements Serializable {
sb
.
append
(
"institutionId='"
).
append
(
institutionId
).
append
(
'\''
);
sb
.
append
(
"institutionId='"
).
append
(
institutionId
).
append
(
'\''
);
sb
.
append
(
", productId='"
).
append
(
productId
).
append
(
'\''
);
sb
.
append
(
", productId='"
).
append
(
productId
).
append
(
'\''
);
sb
.
append
(
", externalOrderNo='"
).
append
(
externalOrderNo
).
append
(
'\''
);
sb
.
append
(
", externalOrderNo='"
).
append
(
externalOrderNo
).
append
(
'\''
);
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/StatusCodeEntity.java
View file @
9398f372
package
cn
.
quant
.
baa
.
pay
.
jpa
.
entity
;
package
cn
.
quant
.
baa
.
pay
.
jpa
.
entity
;
import
cn.quant.baa.pay.dict.StatusCode
;
import
cn.quant.spring.data.jpa.entity.DescriptionEntity
;
import
cn.quant.spring.data.jpa.entity.DescriptionEntity
;
import
org.hibernate.annotations.Type
;
import
org.hibernate.annotations.Type
;
...
@@ -35,13 +36,13 @@ public class StatusCodeEntity extends DescriptionEntity {
...
@@ -35,13 +36,13 @@ public class StatusCodeEntity extends DescriptionEntity {
private
Boolean
sendNoticeFlag
;
private
Boolean
sendNoticeFlag
;
@Column
(
name
=
"REGR_CODE"
,
nullable
=
true
,
length
=
4
)
@Column
(
name
=
"REGR_CODE"
,
nullable
=
true
,
length
=
4
)
private
St
ring
regrCode
;
private
St
atusCode
regrCode
;
@Column
(
name
=
"FAILED_CODE"
,
nullable
=
false
,
length
=
4
)
@Column
(
name
=
"FAILED_CODE"
,
nullable
=
false
,
length
=
4
)
private
St
ring
failedCode
;
private
St
atusCode
failedCode
;
@Column
(
name
=
"NEXT_CODE"
,
nullable
=
true
,
length
=
4
)
@Column
(
name
=
"NEXT_CODE"
,
nullable
=
true
,
length
=
4
)
private
St
ring
nextCode
;
private
St
atusCode
nextCode
;
@Column
(
name
=
"MESSAGE_CODE"
,
nullable
=
true
,
length
=
4
)
@Column
(
name
=
"MESSAGE_CODE"
,
nullable
=
true
,
length
=
4
)
private
String
messageCode
;
private
String
messageCode
;
...
@@ -86,27 +87,27 @@ public class StatusCodeEntity extends DescriptionEntity {
...
@@ -86,27 +87,27 @@ public class StatusCodeEntity extends DescriptionEntity {
this
.
sendNoticeFlag
=
sendNoticeFlag
;
this
.
sendNoticeFlag
=
sendNoticeFlag
;
}
}
public
St
ring
getRegrCode
()
{
public
St
atusCode
getRegrCode
()
{
return
regrCode
;
return
regrCode
;
}
}
public
void
setRegrCode
(
St
ring
regrCode
)
{
public
void
setRegrCode
(
St
atusCode
regrCode
)
{
this
.
regrCode
=
regrCode
;
this
.
regrCode
=
regrCode
;
}
}
public
St
ring
getFailedCode
()
{
public
St
atusCode
getFailedCode
()
{
return
failedCode
;
return
failedCode
;
}
}
public
void
setFailedCode
(
St
ring
failedCode
)
{
public
void
setFailedCode
(
St
atusCode
failedCode
)
{
this
.
failedCode
=
failedCode
;
this
.
failedCode
=
failedCode
;
}
}
public
St
ring
getNextCode
()
{
public
St
atusCode
getNextCode
()
{
return
nextCode
;
return
nextCode
;
}
}
public
void
setNextCode
(
St
ring
nextCode
)
{
public
void
setNextCode
(
St
atusCode
nextCode
)
{
this
.
nextCode
=
nextCode
;
this
.
nextCode
=
nextCode
;
}
}
...
@@ -126,7 +127,7 @@ public class StatusCodeEntity extends DescriptionEntity {
...
@@ -126,7 +127,7 @@ public class StatusCodeEntity extends DescriptionEntity {
return
this
.
ids
.
getEntity
();
return
this
.
ids
.
getEntity
();
}
}
public
St
ring
getCode
(){
public
St
atusCode
getCode
(){
return
this
.
ids
.
getCode
();
return
this
.
ids
.
getCode
();
}
}
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/jpa/entity/StatusCodeIds.java
View file @
9398f372
package
cn
.
quant
.
baa
.
pay
.
jpa
.
entity
;
package
cn
.
quant
.
baa
.
pay
.
jpa
.
entity
;
import
cn.quant.baa.pay.dict.StatusCode
;
import
cn.quant.spring.data.jpa.entity.PrimaryIds
;
import
cn.quant.spring.data.jpa.entity.PrimaryIds
;
import
cn.quant.spring.util.StringUtils
;
import
cn.quant.spring.util.StringUtils
;
import
javax.persistence.Column
;
import
javax.persistence.Column
;
import
javax.persistence.Embeddable
;
import
javax.persistence.Embeddable
;
import
javax.persistence.EnumType
;
import
javax.persistence.Enumerated
;
import
java.io.Serializable
;
import
java.io.Serializable
;
import
java.util.Objects
;
import
java.util.Objects
;
...
@@ -23,8 +26,9 @@ public class StatusCodeIds extends PrimaryIds implements Serializable {
...
@@ -23,8 +26,9 @@ public class StatusCodeIds extends PrimaryIds implements Serializable {
@Column
(
name
=
"ENTITY"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
@Column
(
name
=
"ENTITY"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
private
String
entity
;
private
String
entity
;
@Enumerated
(
EnumType
.
STRING
)
@Column
(
name
=
"CODE"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
@Column
(
name
=
"CODE"
,
nullable
=
false
,
updatable
=
false
,
length
=
4
)
private
St
ring
code
;
private
St
atusCode
code
;
public
String
getInstitutionId
()
{
public
String
getInstitutionId
()
{
return
institutionId
;
return
institutionId
;
...
@@ -42,11 +46,11 @@ public class StatusCodeIds extends PrimaryIds implements Serializable {
...
@@ -42,11 +46,11 @@ public class StatusCodeIds extends PrimaryIds implements Serializable {
this
.
entity
=
entity
;
this
.
entity
=
entity
;
}
}
public
St
ring
getCode
()
{
public
St
atusCode
getCode
()
{
return
code
;
return
code
;
}
}
public
void
setCode
(
St
ring
code
)
{
public
void
setCode
(
St
atusCode
code
)
{
this
.
code
=
code
;
this
.
code
=
code
;
}
}
...
@@ -76,7 +80,6 @@ public class StatusCodeIds extends PrimaryIds implements Serializable {
...
@@ -76,7 +80,6 @@ public class StatusCodeIds extends PrimaryIds implements Serializable {
sb
.
append
(
"institutionId='"
).
append
(
institutionId
).
append
(
'\''
);
sb
.
append
(
"institutionId='"
).
append
(
institutionId
).
append
(
'\''
);
sb
.
append
(
", entity='"
).
append
(
entity
).
append
(
'\''
);
sb
.
append
(
", entity='"
).
append
(
entity
).
append
(
'\''
);
sb
.
append
(
", code='"
).
append
(
code
).
append
(
'\''
);
sb
.
append
(
", code='"
).
append
(
code
).
append
(
'\''
);
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/repository/BatchCycleTriggerRepository.java
0 → 100644
View file @
9398f372
package
cn
.
quant
.
baa
.
pay
.
jpa
.
repository
;
import
cn.quant.baa.pay.jpa.entity.BatchCycleTriggerEntity
;
import
cn.quant.baa.pay.jpa.entity.PayHistoryEntity
;
import
cn.quant.baa.pay.jpa.entity.PayHistoryIds
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.stereotype.Repository
;
/**
* Created by Administrator on 2021/8/22 0022.
*/
@Repository
public
interface
BatchCycleTriggerRepository
extends
JpaRepository
<
BatchCycleTriggerEntity
,
Long
>
{
}
baa-pay-core/src/main/java/cn/quant/baa/pay/model/
DictionaryItem
.java
→
baa-pay-core/src/main/java/cn/quant/baa/pay/model/
dto/DictionaryItemDTO
.java
View file @
9398f372
package
cn
.
quant
.
baa
.
pay
.
model
;
package
cn
.
quant
.
baa
.
pay
.
model
.
dto
;
import
java.io.Serializable
;
import
java.io.Serializable
;
/**
/**
* Created by Administrator on 2021/8/23 0023.
* Created by Administrator on 2021/8/23 0023.
*/
*/
public
class
DictionaryItem
implements
Serializable
{
public
class
DictionaryItem
DTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1385949230287727125L
;
private
static
final
long
serialVersionUID
=
-
1385949230287727125L
;
private
Long
id
;
private
Long
parentId
;
private
String
type
;
private
String
type
;
private
String
code
;
private
String
code
;
private
String
name
;
private
String
text
;
private
String
value
;
private
String
imageUrl
;
private
String
imageUrl
;
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Long
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
Long
parentId
)
{
this
.
parentId
=
parentId
;
}
public
String
getType
()
{
public
String
getType
()
{
return
type
;
return
type
;
}
}
...
@@ -31,12 +54,20 @@ public class DictionaryItem implements Serializable {
...
@@ -31,12 +54,20 @@ public class DictionaryItem implements Serializable {
this
.
code
=
code
;
this
.
code
=
code
;
}
}
public
String
getName
()
{
public
String
getText
()
{
return
name
;
return
text
;
}
public
void
setText
(
String
text
)
{
this
.
text
=
text
;
}
public
String
getValue
()
{
return
value
;
}
}
public
void
set
Name
(
String
nam
e
)
{
public
void
set
Value
(
String
valu
e
)
{
this
.
name
=
nam
e
;
this
.
value
=
valu
e
;
}
}
public
String
getImageUrl
()
{
public
String
getImageUrl
()
{
...
@@ -49,10 +80,13 @@ public class DictionaryItem implements Serializable {
...
@@ -49,10 +80,13 @@ public class DictionaryItem implements Serializable {
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
final
StringBuilder
sb
=
new
StringBuilder
(
"DictionaryItem{"
);
final
StringBuilder
sb
=
new
StringBuilder
(
"DictionaryItemDTO{"
);
sb
.
append
(
"type='"
).
append
(
type
).
append
(
'\''
);
sb
.
append
(
"id="
).
append
(
id
);
sb
.
append
(
", parentId="
).
append
(
parentId
);
sb
.
append
(
", type='"
).
append
(
type
).
append
(
'\''
);
sb
.
append
(
", code='"
).
append
(
code
).
append
(
'\''
);
sb
.
append
(
", code='"
).
append
(
code
).
append
(
'\''
);
sb
.
append
(
", name='"
).
append
(
name
).
append
(
'\''
);
sb
.
append
(
", text='"
).
append
(
text
).
append
(
'\''
);
sb
.
append
(
", value='"
).
append
(
value
).
append
(
'\''
);
sb
.
append
(
", imageUrl='"
).
append
(
imageUrl
).
append
(
'\''
);
sb
.
append
(
", imageUrl='"
).
append
(
imageUrl
).
append
(
'\''
);
sb
.
append
(
'}'
);
sb
.
append
(
'}'
);
return
sb
.
toString
();
return
sb
.
toString
();
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/model/
StatusCode
.java
→
baa-pay-core/src/main/java/cn/quant/baa/pay/model/
dto/StatusCodeDTO
.java
View file @
9398f372
package
cn
.
quant
.
baa
.
pay
.
model
;
package
cn
.
quant
.
baa
.
pay
.
model
.
dto
;
import
cn.quant.baa.pay.dict.StatusCode
;
import
cn.quant.spring.data.jpa.PersistentObject
;
import
cn.quant.spring.data.jpa.PersistentObject
;
import
java.io.Serializable
;
import
java.io.Serializable
;
...
@@ -7,18 +8,18 @@ import java.io.Serializable;
...
@@ -7,18 +8,18 @@ import java.io.Serializable;
/**
/**
* Created by Administrator on 2021/9/13 0013.
* Created by Administrator on 2021/9/13 0013.
*/
*/
public
class
StatusCode
implements
PersistentObject
,
Serializable
{
public
class
StatusCode
DTO
implements
PersistentObject
,
Serializable
{
private
static
final
long
serialVersionUID
=
952357481570545998L
;
private
static
final
long
serialVersionUID
=
952357481570545998L
;
private
String
institutionId
;
private
String
institutionId
;
private
String
entity
;
private
String
entity
;
private
St
ring
code
;
private
St
atusCode
code
;
private
Integer
priority
;
private
Integer
priority
;
private
String
codeType
;
private
String
codeType
;
private
String
postingCode
;
private
String
postingCode
;
private
Boolean
sendNoticeFlag
;
private
Boolean
sendNoticeFlag
;
private
St
ring
regrCode
;
private
St
atusCode
regrCode
;
private
St
ring
failedCode
;
private
St
atusCode
failedCode
;
private
St
ring
nextCode
;
private
St
atusCode
nextCode
;
private
String
messageCode
;
private
String
messageCode
;
public
String
getInstitutionId
()
{
public
String
getInstitutionId
()
{
...
@@ -37,11 +38,11 @@ public class StatusCode implements PersistentObject, Serializable {
...
@@ -37,11 +38,11 @@ public class StatusCode implements PersistentObject, Serializable {
this
.
entity
=
entity
;
this
.
entity
=
entity
;
}
}
public
St
ring
getCode
()
{
public
St
atusCode
getCode
()
{
return
code
;
return
code
;
}
}
public
void
setCode
(
St
ring
code
)
{
public
void
setCode
(
St
atusCode
code
)
{
this
.
code
=
code
;
this
.
code
=
code
;
}
}
...
@@ -77,27 +78,27 @@ public class StatusCode implements PersistentObject, Serializable {
...
@@ -77,27 +78,27 @@ public class StatusCode implements PersistentObject, Serializable {
this
.
sendNoticeFlag
=
sendNoticeFlag
;
this
.
sendNoticeFlag
=
sendNoticeFlag
;
}
}
public
St
ring
getRegrCode
()
{
public
St
atusCode
getRegrCode
()
{
return
regrCode
;
return
regrCode
;
}
}
public
void
setRegrCode
(
St
ring
regrCode
)
{
public
void
setRegrCode
(
St
atusCode
regrCode
)
{
this
.
regrCode
=
regrCode
;
this
.
regrCode
=
regrCode
;
}
}
public
St
ring
getFailedCode
()
{
public
St
atusCode
getFailedCode
()
{
return
failedCode
;
return
failedCode
;
}
}
public
void
setFailedCode
(
St
ring
failedCode
)
{
public
void
setFailedCode
(
St
atusCode
failedCode
)
{
this
.
failedCode
=
failedCode
;
this
.
failedCode
=
failedCode
;
}
}
public
St
ring
getNextCode
()
{
public
St
atusCode
getNextCode
()
{
return
nextCode
;
return
nextCode
;
}
}
public
void
setNextCode
(
St
ring
nextCode
)
{
public
void
setNextCode
(
St
atusCode
nextCode
)
{
this
.
nextCode
=
nextCode
;
this
.
nextCode
=
nextCode
;
}
}
...
@@ -111,7 +112,7 @@ public class StatusCode implements PersistentObject, Serializable {
...
@@ -111,7 +112,7 @@ public class StatusCode implements PersistentObject, Serializable {
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
final
StringBuilder
sb
=
new
StringBuilder
(
"StatusCode{"
);
final
StringBuilder
sb
=
new
StringBuilder
(
"StatusCode
DTO
{"
);
sb
.
append
(
"institutionId='"
).
append
(
institutionId
).
append
(
'\''
);
sb
.
append
(
"institutionId='"
).
append
(
institutionId
).
append
(
'\''
);
sb
.
append
(
", entity='"
).
append
(
entity
).
append
(
'\''
);
sb
.
append
(
", entity='"
).
append
(
entity
).
append
(
'\''
);
sb
.
append
(
", code='"
).
append
(
code
).
append
(
'\''
);
sb
.
append
(
", code='"
).
append
(
code
).
append
(
'\''
);
...
...
baa-pay-core/src/main/java/cn/quant/baa/pay/service/ProfileStorageService.java
View file @
9398f372
...
@@ -3,7 +3,7 @@ package cn.quant.baa.pay.service;
...
@@ -3,7 +3,7 @@ package cn.quant.baa.pay.service;
import
cn.quant.baa.pay.config.LocalCacheConfiguration
;
import
cn.quant.baa.pay.config.LocalCacheConfiguration
;
import
cn.quant.baa.pay.jpa.entity.StatusCodeEntity
;
import
cn.quant.baa.pay.jpa.entity.StatusCodeEntity
;
import
cn.quant.baa.pay.jpa.entity.StatusCodeIds
;
import
cn.quant.baa.pay.jpa.entity.StatusCodeIds
;
import
cn.quant.baa.pay.model.
StatusCode
;
import
cn.quant.baa.pay.model.
dto.StatusCodeDTO
;
import
cn.quant.spring.data.jpa.PersistentEntityInvoker
;
import
cn.quant.spring.data.jpa.PersistentEntityInvoker
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cache.annotation.Cacheable
;
import
org.springframework.cache.annotation.Cacheable
;
...
@@ -21,8 +21,8 @@ public class ProfileStorageService {
...
@@ -21,8 +21,8 @@ public class ProfileStorageService {
@Cacheable
(
cacheManager
=
LocalCacheConfiguration
.
LOCAL_CACHE_MANAGER
@Cacheable
(
cacheManager
=
LocalCacheConfiguration
.
LOCAL_CACHE_MANAGER
,
cacheNames
=
LocalCacheConfiguration
.
LOCAL_CACHE_PROFILE
,
cacheNames
=
LocalCacheConfiguration
.
LOCAL_CACHE_PROFILE
,
key
=
"#ids.persistentKey"
)
,
key
=
"#ids.persistentKey"
)
public
StatusCode
getStatusCode
(
StatusCodeIds
ids
)
throws
Exception
{
public
StatusCode
DTO
getStatusCode
(
StatusCodeIds
ids
)
throws
Exception
{
StatusCode
code
=
persistentEntityInvoker
.
Invoke
(
ids
,
StatusCodeEntity
.
class
,
StatusCode
.
class
);
StatusCode
DTO
code
=
persistentEntityInvoker
.
Invoke
(
ids
,
StatusCodeEntity
.
class
,
StatusCodeDTO
.
class
);
return
code
;
return
code
;
}
}
...
...
baa-pay-server/src/main/java/cn/quant/baa/pay/rest/MerchantController.java
View file @
9398f372
package
cn
.
quant
.
baa
.
pay
.
rest
;
package
cn
.
quant
.
baa
.
pay
.
rest
;
import
cn.quant.baa.pay.jpa.entity.StatusCodeIds
;
import
cn.quant.baa.pay.model.StatusCode
;
import
cn.quant.baa.pay.model.web.MerchantAcquirerProperties
;
import
cn.quant.baa.pay.model.web.MerchantAcquirerProperties
;
import
cn.quant.baa.pay.model.web.MerchantChannelResponseData
;
import
cn.quant.baa.pay.model.web.MerchantChannelResponseData
;
import
cn.quant.baa.pay.model.web.MerchantChannelRequestData
;
import
cn.quant.baa.pay.model.web.MerchantChannelRequestData
;
...
@@ -35,10 +33,13 @@ public class MerchantController extends AbstractController {
...
@@ -35,10 +33,13 @@ public class MerchantController extends AbstractController {
@Autowired
@Autowired
private
CacheManager
cacheManager
;
private
CacheManager
cacheManager
;
@Autowired
private
ProfileStorageService
profileStorageService
;
@ResponseBody
@ResponseBody
@BusinessMapping
(
session
=
1
)
@BusinessMapping
(
session
=
1
)
@PostMapping
(
"/list"
)
@PostMapping
(
"/list"
)
public
ResponseEntity
list
(
@RequestBody
BusinessRequest
<
MerchantChannelRequestData
>
request
)
{
public
ResponseEntity
list
(
@RequestBody
BusinessRequest
<
MerchantChannelRequestData
>
request
)
throws
Exception
{
TransactionSession
session
=
TransactionSession
.
session
();
TransactionSession
session
=
TransactionSession
.
session
();
String
requestId
=
session
.
getRequestId
();
String
requestId
=
session
.
getRequestId
();
...
...
baa-pay-server/src/main/java/cn/quant/baa/pay/rest/PayTestController.java
View file @
9398f372
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.component.Sequencer
;
//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.model.BusinessRequest
;
//import cn.quant.baa.pay.model.BusinessRequest;
import
cn.quant.baa.pay.model.web.CheckPayRequestData
;
//import cn.quant.baa.pay.model.web.CheckPayRequestData;
import
cn.quant.baa.pay.model.web.CheckRefundRequestData
;
//import cn.quant.baa.pay.model.web.CheckRefundRequestData;
import
cn.quant.baa.pay.model.web.PayRequestData
;
//import cn.quant.baa.pay.model.web.PayRequestData;
import
cn.quant.baa.pay.service.TransactionService
;
//import cn.quant.baa.pay.service.TransactionService;
import
cn.quant.spring.context.ServerApplicationContext
;
//import cn.quant.spring.context.ServerApplicationContext;
import
com.fasterxml.jackson.core.JsonProcessingException
;
//import com.fasterxml.jackson.core.JsonProcessingException;
import
com.fasterxml.jackson.databind.DeserializationFeature
;
//import com.fasterxml.jackson.databind.DeserializationFeature;
import
com.fasterxml.jackson.databind.JsonNode
;
//import com.fasterxml.jackson.databind.JsonNode;
import
com.fasterxml.jackson.databind.ObjectMapper
;
//import com.fasterxml.jackson.databind.ObjectMapper;
import
com.fasterxml.jackson.databind.PropertyNamingStrategy
;
//import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import
com.fasterxml.jackson.databind.json.JsonMapper
;
//import com.fasterxml.jackson.databind.json.JsonMapper;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
//import com.fasterxml.jackson.databind.node.ObjectNode;
import
org.json.JSONObject
;
//import org.json.JSONObject;
import
org.springframework.beans.factory.annotation.Autowired
;
//import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Controller
;
//import org.springframework.stereotype.Controller;
import
org.springframework.ui.Model
;
//import org.springframework.ui.Model;
import
org.springframework.web.bind.annotation.*
;
//import org.springframework.web.bind.annotation.*;
//
import
javax.servlet.http.HttpServletRequest
;
//import javax.servlet.http.HttpServletRequest;
import
java.util.HashMap
;
//import java.util.HashMap;
import
java.util.Map
;
//import java.util.Map;
//
/**
///**
* Created with IntelliJ IDEA.
// * Created with IntelliJ IDEA.
* Author: Lipeng Liu
// * Author: Lipeng Liu
* Date: 2021/9/9
// * Date: 2021/9/9
* Time: 上午9:51
// * Time: 上午9:51
* Description: No Description
// * Description: No Description
*/
// */
@Controller
//@Controller
//@RestController
////@RestController
@RequestMapping
(
"pay"
)
//@RequestMapping("pay")
public
class
PayTestController
{
//public class PayTestController {
//
ObjectMapper
objectMapper
=
new
ObjectMapper
();
// ObjectMapper objectMapper = new ObjectMapper();
//
@Autowired
// @Autowired
private
TransactionService
transactionService
;
// private TransactionService transactionService;
//
@Autowired
// @Autowired
private
ServerApplicationContext
serverApplicationContext
;
// private ServerApplicationContext serverApplicationContext;
//
@Autowired
// @Autowired
private
Sequencer
sequencer
;
// private Sequencer sequencer;
//
@GetMapping
(
""
)
// @GetMapping("")
public
String
getPay
(
Model
model
)
{
// public String getPay(Model model) {
return
"pay/index"
;
// return "pay/index";
}
// }
//
@RequestMapping
(
"h5"
)
// @RequestMapping("h5")
public
String
getH5
(
Model
model
)
{
// public String getH5(Model model) {
return
"pay/h5"
;
// return "pay/h5";
}
// }
//
@RequestMapping
(
"checkPay"
)
// @RequestMapping("checkPay")
public
String
checkPay
(
CheckPayRequestData
data
,
Model
model
,
HttpServletRequest
servletRequest
)
{
// public String checkPay(CheckPayRequestData data, Model model, HttpServletRequest servletRequest) {
String
res
=
""
;
// String res = "";
if
(
servletRequest
.
getMethod
().
equals
(
"POST"
))
{
// if (servletRequest.getMethod().equals("POST")) {
res
=
transactionService
.
checkPay
(
data
).
toString
();
// res = transactionService.checkPay(data).toString();
}
// }
model
.
addAttribute
(
"res"
,
res
);
// model.addAttribute("res", res);
return
"pay/checkPay"
;
// return "pay/checkPay";
}
// }
//
@RequestMapping
(
"checkRefund"
)
// @RequestMapping("checkRefund")
public
String
checkRefund
(
CheckRefundRequestData
data
,
Model
model
,
HttpServletRequest
servletRequest
)
{
// public String checkRefund(CheckRefundRequestData data, Model model, HttpServletRequest servletRequest) {
//
String
res
=
""
;
// String res = "";
if
(
servletRequest
.
getMethod
().
equals
(
"POST"
))
{
// if (servletRequest.getMethod().equals("POST")) {
res
=
transactionService
.
checkRefund
(
data
).
toString
();
// res = transactionService.checkRefund(data).toString();
}
// }
model
.
addAttribute
(
"res"
,
res
);
// model.addAttribute("res", res);
return
"pay/checkRefund"
;
// return "pay/checkRefund";
}
// }
//
//
@PostMapping
(
"goPay"
)
// @PostMapping("goPay")
@BusinessMapping
(
session
=
1
)
// @BusinessMapping(session = 1)
@ResponseBody
// @ResponseBody
public
JsonNode
goPay
(
@RequestBody
(
required
=
false
)
BusinessRequest
<
PayRequestData
>
requestData
)
{
// public JsonNode goPay(@RequestBody(required = false) BusinessRequest<PayRequestData> requestData) {
PayRequestData
data
=
requestData
.
getData
();
// PayRequestData data = requestData.getData();
String
str
=
"{\"subject\":\"测试订单1\",\"mchId\":\"wx2f44c7fe7b08458d\",\"chanId\":\"75772285618946307\",\"outTradeNo\":\"11111111223\",\"originalAmount\":\"110.00\",\"amount\":0.01,\"discounts\":\"10.00\",\"notifyUrl\":\"http://127.0.0.1:8080/notifyUrl\",\"buyerId\":\"777777\",\"attach\":\"AAAA-BBBB-1111-2222\",\"creditAmount\":\"10.00\",\"cashAmount\":\"10\",\"goodsDetail\":[{\"goodsNo\":\"123123\",\"goodsId\":\"11111\",\"goodsName\":\"商品1\",\"quantity\":2,\"price\":\"10.00\",\"discounts\":\"2.5\",\"amount\":\"17.5\",\"attach\":\"---\",\"creditAmount\":123,\"cashAmount\":123}]}"
;
// String str = "{\"subject\":\"测试订单1\",\"mchId\":\"wx2f44c7fe7b08458d\",\"chanId\":\"75772285618946307\",\"outTradeNo\":\"11111111223\",\"originalAmount\":\"110.00\",\"amount\":0.01,\"discounts\":\"10.00\",\"notifyUrl\":\"http://127.0.0.1:8080/notifyUrl\",\"buyerId\":\"777777\",\"attach\":\"AAAA-BBBB-1111-2222\",\"creditAmount\":\"10.00\",\"cashAmount\":\"10\",\"goodsDetail\":[{\"goodsNo\":\"123123\",\"goodsId\":\"11111\",\"goodsName\":\"商品1\",\"quantity\":2,\"price\":\"10.00\",\"discounts\":\"2.5\",\"amount\":\"17.5\",\"attach\":\"---\",\"creditAmount\":123,\"cashAmount\":123}]}";
try
{
// try {
objectMapper
.
configure
(
DeserializationFeature
.
FAIL_ON_UNKNOWN_PROPERTIES
,
false
);
// objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
PayRequestData
payRequestData
=
objectMapper
.
readValue
(
str
,
PayRequestData
.
class
);
// PayRequestData payRequestData = objectMapper.readValue(str, PayRequestData.class);
String
[]
temp
=
data
.
getChanId
().
split
(
"_"
);
// String[] temp = data.getChanId().split("_");
payRequestData
.
setChanId
(
temp
[
0
]);
// payRequestData.setChanId(temp[0]);
payRequestData
.
setMchId
(
temp
[
1
]);
// payRequestData.setMchId(temp[1]);
payRequestData
.
setOutTradeNo
(
data
.
getOutTradeNo
());
// payRequestData.setOutTradeNo(data.getOutTradeNo());
payRequestData
.
setSubject
(
data
.
getSubject
());
// payRequestData.setSubject(data.getSubject());
payRequestData
.
setAmount
(
data
.
getAmount
());
// payRequestData.setAmount(data.getAmount());
payRequestData
.
setNotifyUrl
(
"http://127.0.0.1:8080/notifyUrl"
);
// payRequestData.setNotifyUrl("http://127.0.0.1:8080/notifyUrl");
JsonNode
res
=
transactionService
.
pay
(
payRequestData
);
// JsonNode res = transactionService.pay(payRequestData);
return
res
;
// return res;
}
catch
(
JsonProcessingException
e
)
{
// } catch (JsonProcessingException e) {
e
.
printStackTrace
();
// e.printStackTrace();
}
// }
return
objectMapper
.
createObjectNode
();
// return objectMapper.createObjectNode();
}
// }
//
}
//}
\ No newline at end of file
\ No newline at end of file
baa-pay-server/src/main/java/cn/quant/baa/pay/rest/TransactionController.java
View file @
9398f372
package
cn
.
quant
.
baa
.
pay
.
rest
;
package
cn
.
quant
.
baa
.
pay
.
rest
;
import
cn.quant.baa.pay.acquirer.ChannelResponse
;
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.web.*
;
import
cn.quant.baa.pay.model.web.*
;
import
cn.quant.baa.pay.service.TransactionService
;
import
cn.quant.baa.pay.service.TransactionService
;
import
c
om.fasterxml.jackson.databind.JsonNode
;
import
c
n.quant.spring.http.HttpResponseData
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
/**
/**
...
@@ -23,61 +23,79 @@ public class TransactionController extends BusinessController {
...
@@ -23,61 +23,79 @@ public class TransactionController extends BusinessController {
@ResponseBody
@ResponseBody
@BusinessMapping
(
session
=
1
)
@BusinessMapping
(
session
=
1
)
@PostMapping
(
"/pay"
)
@PostMapping
(
"/pay"
)
public
JsonNode
pay
(
@RequestBody
BusinessRequest
<
PayRequestData
>
request
)
{
public
ResponseEntity
pay
(
@RequestBody
BusinessRequest
<
PayRequestData
>
request
)
{
PayRequestData
requestData
=
request
.
getData
();
ChannelResponse
responseData
=
null
;
try
{
responseData
=
transactionService
.
pay
(
requestData
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
PayRequestData
data
=
request
.
getData
();
ResponseEntity
<
HttpResponseData
>
responseEntity
=
succeed
(
responseData
);
JsonNode
res
=
transactionService
.
pay
(
data
);
System
.
currentTimeMillis
();
return
responseEntity
;
return
res
;
}
}
@ResponseBody
@ResponseBody
@BusinessMapping
(
session
=
1
)
@BusinessMapping
(
session
=
1
)
@PostMapping
(
"/checkPay"
)
@PostMapping
(
"/checkPay"
)
public
JsonNode
checkPay
(
@RequestBody
BusinessRequest
<
CheckPayRequestData
>
request
)
{
public
ChannelResponse
checkPay
(
@RequestBody
BusinessRequest
<
CheckPayRequestData
>
request
)
throws
Exception
{
CheckPayRequestData
data
=
request
.
getData
();
CheckPayRequestData
data
=
request
.
getData
();
JsonNode
res
=
transactionService
.
checkPay
(
data
);
ChannelResponse
responseData
=
null
;
responseData
=
transactionService
.
checkPay
(
data
);
System
.
currentTimeMillis
();
System
.
currentTimeMillis
();
return
res
;
return
res
ponseData
;
}
}
@ResponseBody
@ResponseBody
@BusinessMapping
(
session
=
1
)
@BusinessMapping
(
session
=
1
)
@PostMapping
(
"/checkRefund"
)
@PostMapping
(
"/checkRefund"
)
public
JsonNode
checkRefund
(
@RequestBody
BusinessRequest
<
CheckRefundRequestData
>
request
)
{
public
ChannelResponse
checkRefund
(
@RequestBody
BusinessRequest
<
CheckRefundRequestData
>
request
)
throws
Exception
{
CheckRefundRequestData
data
=
request
.
getData
();
CheckRefundRequestData
data
=
request
.
getData
();
JsonNode
res
=
transactionService
.
checkRefund
(
data
);
ChannelResponse
responseData
=
null
;
responseData
=
transactionService
.
checkRefund
(
data
);
System
.
currentTimeMillis
();
System
.
currentTimeMillis
();
return
res
;
return
res
ponseData
;
}
}
@ResponseBody
@ResponseBody
@BusinessMapping
(
session
=
1
)
@BusinessMapping
(
session
=
1
)
@PostMapping
(
"/close"
)
@PostMapping
(
"/close"
)
public
JsonNode
close
(
@RequestBody
BusinessRequest
<
CloseRequestData
>
request
)
{
public
ChannelResponse
close
(
@RequestBody
BusinessRequest
<
CloseRequestData
>
request
)
throws
Exception
{
CloseRequestData
data
=
request
.
getData
();
CloseRequestData
data
=
request
.
getData
();
JsonNode
res
=
transactionService
.
close
(
data
);
ChannelResponse
responseData
=
null
;
responseData
=
transactionService
.
close
(
data
);
System
.
currentTimeMillis
();
System
.
currentTimeMillis
();
return
res
;
return
res
ponseData
;
}
}
@ResponseBody
@ResponseBody
@BusinessMapping
(
session
=
1
)
@BusinessMapping
(
session
=
1
)
@PostMapping
(
"/refund"
)
@PostMapping
(
"/refund"
)
public
JsonNode
refund
(
@RequestBody
BusinessRequest
<
RefundRequestData
>
request
)
{
public
ChannelResponse
refund
(
@RequestBody
BusinessRequest
<
RefundRequestData
>
request
)
throws
Exception
{
RefundRequestData
data
=
request
.
getData
();
RefundRequestData
data
=
request
.
getData
();
JsonNode
res
=
transactionService
.
refund
(
data
);
ChannelResponse
responseData
=
null
;
responseData
=
transactionService
.
refund
(
data
);
System
.
currentTimeMillis
();
System
.
currentTimeMillis
();
return
res
;
return
res
ponseData
;
}
}
}
}
baa-pay-server/src/main/java/cn/quant/baa/pay/service/TransactionService.java
View file @
9398f372
...
@@ -2,13 +2,14 @@ package cn.quant.baa.pay.service;
...
@@ -2,13 +2,14 @@ package cn.quant.baa.pay.service;
import
cn.quant.baa.pay.acquirer.AcquirerPropertiesSource
;
import
cn.quant.baa.pay.acquirer.AcquirerPropertiesSource
;
import
cn.quant.baa.pay.acquirer.AcquirerProperties
;
import
cn.quant.baa.pay.acquirer.AcquirerProperties
;
import
cn.quant.baa.pay.acquirer.ChannelResponse
;
import
cn.quant.baa.pay.acquirer.MerchantAcquirer
;
import
cn.quant.baa.pay.acquirer.MerchantAcquirer
;
import
cn.quant.baa.pay.config.DictionaryViewer
;
import
cn.quant.baa.pay.context.TransactionSession
;
import
cn.quant.baa.pay.context.TransactionSession
;
import
cn.quant.baa.pay.jpa.EntityBuilder
;
import
cn.quant.baa.pay.jpa.EntityBuilder
;
import
cn.quant.baa.pay.jpa.entity.*
;
import
cn.quant.baa.pay.jpa.entity.*
;
import
cn.quant.baa.pay.model.web.*
;
import
cn.quant.baa.pay.model.web.*
;
import
cn.quant.baa.pay.util.AssertUtils
;
import
cn.quant.baa.pay.util.AssertUtils
;
import
com.fasterxml.jackson.databind.JsonNode
;
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
;
...
@@ -35,6 +36,9 @@ public class TransactionService extends BusinessService {
...
@@ -35,6 +36,9 @@ public class TransactionService extends BusinessService {
@Autowired
@Autowired
private
MerchantAcquirer
acquirer
;
private
MerchantAcquirer
acquirer
;
@Autowired
private
DictionaryViewer
dictionaryViewer
;
@Transactional
(
propagation
=
Propagation
.
NOT_SUPPORTED
)
@Transactional
(
propagation
=
Propagation
.
NOT_SUPPORTED
)
public
void
check
(
PayHistoryIds
ids
,
TransactionSession
session
)
{
public
void
check
(
PayHistoryIds
ids
,
TransactionSession
session
)
{
PayHistoryEntity
historyEntity
=
session
.
findOne
(
PayHistoryEntity
.
class
,
ids
);
PayHistoryEntity
historyEntity
=
session
.
findOne
(
PayHistoryEntity
.
class
,
ids
);
...
@@ -43,8 +47,8 @@ public class TransactionService extends BusinessService {
...
@@ -43,8 +47,8 @@ public class TransactionService extends BusinessService {
}
}
}
}
@Transactional
@Transactional
(
propagation
=
Propagation
.
REQUIRES_NEW
)
public
TransactionSession
payHistory
(
PayRequestData
data
)
{
public
ChannelResponse
pay
(
PayRequestData
data
)
throws
Exception
{
validate
(
data
);
validate
(
data
);
...
@@ -57,10 +61,21 @@ public class TransactionService extends BusinessService {
...
@@ -57,10 +61,21 @@ public class TransactionService extends BusinessService {
String
institutionId
=
profile
.
getInstitutionId
();
String
institutionId
=
profile
.
getInstitutionId
();
String
productId
=
profile
.
getProductId
();
String
productId
=
profile
.
getProductId
();
String
buyerId
=
data
.
getBuyerId
();
String
buyerId
=
data
.
getBuyerId
();
TransactionSession
session
=
TransactionSession
.
session
();
TransactionSession
session
=
TransactionSession
.
session
();
String
outTradeNo
=
data
.
getOutTradeNo
();
PayHistoryIds
ids
=
new
PayHistoryIds
();
ids
.
setInstitutionId
(
institutionId
);
ids
.
setProductId
(
productId
);
ids
.
setExternalOrderNo
(
outTradeNo
);
check
(
ids
,
session
);
prepare
(
institutionId
,
productId
,
buyerId
,
session
);
prepare
(
institutionId
,
productId
,
buyerId
,
session
);
String
mchId
=
data
.
getMchId
();
if
(!
mchId
.
equals
(
profile
.
getPayAppId
()))
{
AssertUtils
.
throwMessage
(
ACQUIRER_NOMATCH
,
chanId
,
mchId
);
}
AccountEntity
account
=
session
.
getAccount
();
AccountEntity
account
=
session
.
getAccount
();
long
historyId
=
session
.
nextId
();
long
historyId
=
session
.
nextId
();
...
@@ -75,22 +90,17 @@ public class TransactionService extends BusinessService {
...
@@ -75,22 +90,17 @@ public class TransactionService extends BusinessService {
details
.
add
(
detailEntity
);
details
.
add
(
detailEntity
);
}
}
PayHistoryEntity
history
=
EntityBuilder
.
payHistory
(
account
,
ids
,
historyId
,
data
,
profile
,
session
);
String
mchId
=
data
.
getMchId
();
long
triggerId
=
session
.
nextId
();
if
(!
mchId
.
equals
(
profile
.
getPayAppId
()))
{
ChannelResponse
responseData
=
acquirer
.
pay
(
data
,
history
);
AssertUtils
.
throwMessage
(
ACQUIRER_NOMATCH
,
chanId
,
mchId
);
}
String
outTradeNo
=
data
.
getOutTradeNo
();
if
(
responseData
.
getSuccess
()){
PayHistoryIds
ids
=
new
PayHistoryIds
();
EntityBuilder
.
nextTxnNo
(
account
,
history
);
ids
.
setInstitutionId
(
institutionId
);
ids
.
setProductId
(
productId
);
ids
.
setExternalOrderNo
(
outTradeNo
);
check
(
ids
,
session
);
BatchCycleTriggerEntity
trigger
=
EntityBuilder
.
payTrigger
(
triggerId
,
history
);
PayHistoryEntity
history
=
EntityBuilder
.
history
(
account
,
ids
,
historyId
,
data
,
profile
,
session
);
session
.
pushEntity
(
history
);
session
.
pushEntity
(
history
);
session
.
pushEntity
(
trigger
);
session
.
pushEntity
(
details
);
session
.
pushEntity
(
details
);
session
.
commit
();
session
.
commit
();
...
@@ -98,37 +108,41 @@ public class TransactionService extends BusinessService {
...
@@ -98,37 +108,41 @@ public class TransactionService extends BusinessService {
session
.
addProperty
(
PayHistoryEntity
.
class
,
history
);
session
.
addProperty
(
PayHistoryEntity
.
class
,
history
);
session
.
addProperty
(
PayGoodsDetailEntity
.
class
,
details
);
session
.
addProperty
(
PayGoodsDetailEntity
.
class
,
details
);
return
session
;
}
}
return
responseData
;
}
@Transactional
(
propagation
=
Propagation
.
NOT_SUPPORTED
)
public
JsonNode
pay
(
PayRequestData
data
)
{
TransactionSession
session
=
payHistory
(
data
);
PayHistoryEntity
payHistoryEntity
=
session
.
getProperty
(
PayHistoryEntity
.
class
,
PayHistoryEntity
.
class
);
// @Transactional(propagation = Propagation.NOT_SUPPORTED)
System
.
currentTimeMillis
();
// public JsonNode pay(PayRequestData data) {
return
acquirer
.
pay
(
data
,
payHistoryEntity
);
//
}
//
//
// TransactionSession session = payHistory(data);
//
// PayHistoryEntity payHistoryEntity = session.getProperty(PayHistoryEntity.class, PayHistoryEntity.class);
// System.currentTimeMillis();
// return acquirer.pay(data, payHistoryEntity);
// }
@Transactional
(
propagation
=
Propagation
.
NOT_SUPPORTED
)
@Transactional
(
propagation
=
Propagation
.
NOT_SUPPORTED
)
public
JsonNode
checkPay
(
CheckPayRequestData
data
)
{
public
ChannelResponse
checkPay
(
CheckPayRequestData
data
)
throws
Exception
{
return
acquirer
.
checkPay
(
data
);
return
acquirer
.
checkPay
(
data
);
}
}
@Transactional
(
propagation
=
Propagation
.
NOT_SUPPORTED
)
@Transactional
(
propagation
=
Propagation
.
NOT_SUPPORTED
)
public
JsonNode
checkRefund
(
CheckRefundRequestData
data
)
{
public
ChannelResponse
checkRefund
(
CheckRefundRequestData
data
)
throws
Exception
{
return
acquirer
.
checkRefund
(
data
);
return
acquirer
.
checkRefund
(
data
);
}
}
@Transactional
(
propagation
=
Propagation
.
NOT_SUPPORTED
)
@Transactional
(
propagation
=
Propagation
.
NOT_SUPPORTED
)
public
JsonNode
close
(
CloseRequestData
data
)
{
public
ChannelResponse
close
(
CloseRequestData
data
)
throws
Exception
{
return
acquirer
.
close
(
data
);
return
acquirer
.
close
(
data
);
}
}
@Transactional
(
propagation
=
Propagation
.
NOT_SUPPORTED
)
@Transactional
(
propagation
=
Propagation
.
NOT_SUPPORTED
)
public
JsonNode
refund
(
RefundRequestData
data
)
{
public
ChannelResponse
refund
(
RefundRequestData
data
)
throws
Exception
{
return
acquirer
.
refund
(
data
);
return
acquirer
.
refund
(
data
);
}
}
...
...
baa-pay-server/src/main/resources/logback-spring.xml
View file @
9398f372
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
</encoder>
</encoder>
</appender>
</appender>
<logger
name=
"cn.quant.baa.pay"
level=
"
ERROR
"
/>
<logger
name=
"cn.quant.baa.pay"
level=
"
WARN
"
/>
<logger
name=
"javax.activation"
level=
"ERROR"
/>
<logger
name=
"javax.activation"
level=
"ERROR"
/>
<logger
name=
"org.quartz.core"
level=
"ERROR"
/>
<logger
name=
"org.quartz.core"
level=
"ERROR"
/>
<logger
name=
"org.quartz.simpl"
level=
"ERROR"
/>
<logger
name=
"org.quartz.simpl"
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