记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
董敬伟
liquidnet-bus-v1
Commits
26ba85bb
Commit
26ba85bb
authored
Jul 07, 2021
by
jiangxiulong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test'
parents
784bb9b1
5f14fc0b
Changes
16
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
239 additions
and
122 deletions
+239
-122
DragonConstant.java
...com/liquidnet/service/dragon/constant/DragonConstant.java
+36
-0
IDragonOrdersService.java
...iquidnet/service/dragon/service/IDragonOrdersService.java
+1
-0
PerformancesExpressController.java
...troller/zhengzai/kylin/PerformancesExpressController.java
+1
-1
KylinOrderRefundsServiceImpl.java
...gzai/kylin/service/impl/KylinOrderRefundsServiceImpl.java
+17
-15
KylinRefundExecuteServiceImpl.java
...zai/kylin/service/impl/KylinRefundExecuteServiceImpl.java
+12
-4
KylinRefundsStatusServiceImpl.java
...zai/kylin/service/impl/KylinRefundsStatusServiceImpl.java
+14
-7
PerformancesExpressServiceImpl.java
...ai/kylin/service/impl/PerformancesExpressServiceImpl.java
+15
-15
HttpClientUtils.java
...et/client/admin/zhengzai/kylin/utils/HttpClientUtils.java
+9
-4
ShunfengSignUtils.java
.../client/admin/zhengzai/kylin/utils/ShunfengSignUtils.java
+15
-59
RedisStreamConfig.java
...om/liquidnet/service/dragon/config/RedisStreamConfig.java
+52
-7
PayController.java
...om/liquidnet/service/dragon/controller/PayController.java
+16
-0
RedisPayReceiver.java
...m/liquidnet/service/dragon/receiver/RedisPayReceiver.java
+2
-2
RedisRefundReceiver.java
...iquidnet/service/dragon/receiver/RedisRefundReceiver.java
+19
-0
DragonOrderRefundsServiceImpl.java
...ce/dragon/service/impl/DragonOrderRefundsServiceImpl.java
+1
-1
DragonOrdersServiceImpl.java
.../service/dragon/service/impl/DragonOrdersServiceImpl.java
+22
-0
KylinRefundsStatusServiceImpl.java
...latform/service/refund/KylinRefundsStatusServiceImpl.java
+7
-7
No files found.
liquidnet-bus-api/liquidnet-service-dragon-api/src/main/java/com/liquidnet/service/dragon/constant/DragonConstant.java
View file @
26ba85bb
...
@@ -76,4 +76,40 @@ public class DragonConstant {
...
@@ -76,4 +76,40 @@ public class DragonConstant {
this
.
message
=
message
;
this
.
message
=
message
;
}
}
}
}
/**
* MYSQL_REDIS_QUEUE
*/
public
enum
mysqlRedisQueueEnum
{
DRAGON_PAY_KEY
(
"dragon-pay"
,
"同步数据-支付"
),
DRAGON_REFUND_KEY
(
"dragon-refund"
,
"同步数据-退款"
),
DRAGON_PAY_GROUP
(
"dragon-pay-group"
,
"同步数据-支付-组"
),
DRAGON_REFUND_GROUP
(
"dragon-refund-group"
,
"同步数据-退款-组"
);
private
String
code
;
private
String
message
;
mysqlRedisQueueEnum
(
String
code
,
String
message
)
{
this
.
code
=
code
;
this
.
message
=
message
;
}
}
/**
* CHANNEL_REDIS_QUEUE
*/
public
enum
channelRedisQueueEnum
{
WECHAT_PAY_KEY
(
"wechat-pay"
,
"微信-支付-回调"
),
WECHAT_REFUND_KEY
(
"wechat-pay"
,
"微信-退款-回调"
),
ALIPAY_PAY_KEY
(
"alipay-pay"
,
"支付宝-支付-回调"
),
ALIPAY_REFUND_KEY
(
"alipay-refund"
,
"支付宝-退款-回调"
),
WECHAT_PAY_GROUP
(
"wechat-pay-group"
,
"微信-支付-回调-组"
),
WECHAT_REFUND_GROUP
(
"wechat-pay-group"
,
"微信-退款-回调-组"
),
ALIPAY_PAY_GROUP
(
"alipay-pay-group"
,
"支付宝-支付-回调-组"
),
ALIPAY_REFUND_GROUP
(
"alipay-refund-group"
,
"支付宝-退款-回调-组"
);
private
String
code
;
private
String
message
;
channelRedisQueueEnum
(
String
code
,
String
message
)
{
this
.
code
=
code
;
this
.
message
=
message
;
}
}
}
}
liquidnet-bus-api/liquidnet-service-dragon-api/src/main/java/com/liquidnet/service/dragon/service/IDragonOrdersService.java
View file @
26ba85bb
package
com
.
liquidnet
.
service
.
dragon
.
service
;
package
com
.
liquidnet
.
service
.
dragon
.
service
;
public
interface
IDragonOrdersService
{
public
interface
IDragonOrdersService
{
void
sendRedisQueue
();
}
}
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-web/src/main/java/com/liquidnet/client/admin/web/controller/zhengzai/kylin/PerformancesExpressController.java
View file @
26ba85bb
...
@@ -75,7 +75,7 @@ public class PerformancesExpressController extends BaseController {
...
@@ -75,7 +75,7 @@ public class PerformancesExpressController extends BaseController {
@RequiresPermissions
(
"kylin:performancesExpress:placeOrder"
)
@RequiresPermissions
(
"kylin:performancesExpress:placeOrder"
)
@PostMapping
(
"/placeOrder"
)
@PostMapping
(
"/placeOrder"
)
@ResponseBody
@ResponseBody
public
AjaxResult
placeOrder
(
PerformanceExpressSearchAdminParam
performanceExpressSearchAdminParam
)
throws
Exception
{
public
AjaxResult
placeOrder
(
PerformanceExpressSearchAdminParam
performanceExpressSearchAdminParam
)
{
ResponseDto
res
=
performancesExpressServiceImpl
.
placeOrder
(
performanceExpressSearchAdminParam
);
ResponseDto
res
=
performancesExpressServiceImpl
.
placeOrder
(
performanceExpressSearchAdminParam
);
try
{
try
{
if
(
res
.
isSuccess
())
{
if
(
res
.
isSuccess
())
{
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/kylin/service/impl/KylinOrderRefundsServiceImpl.java
View file @
26ba85bb
...
@@ -93,10 +93,12 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
...
@@ -93,10 +93,12 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
String
orderTicketsId
=
refundApplyParam
.
getOrderTicketsId
();
String
orderTicketsId
=
refundApplyParam
.
getOrderTicketsId
();
List
<
String
>
ticketEntityIds
=
refundApplyParam
.
getTicketEntityIds
();
List
<
String
>
ticketEntityIds
=
refundApplyParam
.
getTicketEntityIds
();
List
<
Double
>
entitiesPrice
=
refundApplyParam
.
getEntitiesPrice
();
List
<
Double
>
entitiesPrice
=
refundApplyParam
.
getEntitiesPrice
();
Double
RefundPriceExpress
=
refundApplyParam
.
getRefundPriceExpress
();
Double
RefundPriceExpress
Double
=
refundApplyParam
.
getRefundPriceExpress
();
if
(
null
==
RefundPriceExpress
)
{
if
(
null
==
RefundPriceExpress
Double
)
{
RefundPriceExpress
=
0.0
;
RefundPriceExpress
Double
=
0.0
;
}
}
BigDecimal
RefundPriceExpress
=
BigDecimal
.
valueOf
(
RefundPriceExpressDouble
);
KylinOrderTickets
orderInfo
=
kylinOrderTicketsMapper
.
selectOne
(
KylinOrderTickets
orderInfo
=
kylinOrderTicketsMapper
.
selectOne
(
new
QueryWrapper
<
KylinOrderTickets
>().
eq
(
"order_tickets_id"
,
orderTicketsId
)
new
QueryWrapper
<
KylinOrderTickets
>().
eq
(
"order_tickets_id"
,
orderTicketsId
)
...
@@ -106,7 +108,7 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
...
@@ -106,7 +108,7 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
);
);
int
thisOrderStatus
=
orderStatus
.
getStatus
();
int
thisOrderStatus
=
orderStatus
.
getStatus
();
int
thisPayStatus
=
orderStatus
.
getPayStatus
();
int
thisPayStatus
=
orderStatus
.
getPayStatus
();
double
priceExpress
=
orderInfo
.
getPriceExpress
().
doubleValue
();
BigDecimal
priceExpress
=
orderInfo
.
getPriceExpress
();
// todo 转增是否能退
// todo 转增是否能退
// 订单状态需已付款
// 订单状态需已付款
...
@@ -127,11 +129,11 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
...
@@ -127,11 +129,11 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
refundPriceExpressSum
=
0.0
;
refundPriceExpressSum
=
0.0
;
}
}
if
(
null
==
refundApplyParam
.
getOrderRefundBatchesId
()
||
refundApplyParam
.
getOrderRefundBatchesId
().
isEmpty
())
{
// 不是批量退款
if
(
null
==
refundApplyParam
.
getOrderRefundBatchesId
()
||
refundApplyParam
.
getOrderRefundBatchesId
().
isEmpty
())
{
// 不是批量退款
if
(
RefundPriceExpress
>
(
priceExpress
-
refundPriceExpressSum
)
)
{
if
(
RefundPriceExpress
.
compareTo
(
priceExpress
.
subtract
(
BigDecimal
.
valueOf
(
refundPriceExpressSum
)))
>
0
)
{
return
ResponseDto
.
failure
(
"快递费不能大于实际减去已退的快递费"
);
return
ResponseDto
.
failure
(
"快递费不能大于实际减去已退的快递费"
);
}
}
}
else
{
}
else
{
RefundPriceExpress
=
priceExpress
-
refundPriceExpressSum
;
RefundPriceExpress
=
priceExpress
.
subtract
(
BigDecimal
.
valueOf
(
refundPriceExpressSum
))
;
}
}
// todo 出票未出票
// todo 出票未出票
...
@@ -148,18 +150,18 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
...
@@ -148,18 +150,18 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
}
}
// 该订单正在退款或已有退款 因支持填入价格所有取消判断
// 该订单正在退款或已有退款 因支持填入价格所有取消判断
// 各个入场人订单填写的退款金额是否正确
// 各个入场人订单填写的退款金额是否正确
double
priceActual
=
orderInfo
.
getPriceActual
().
doubleValue
();
BigDecimal
priceActual
=
orderInfo
.
getPriceActual
();
int
allEntitiesCount
=
kylinOrderTicketEntitiesMapper
.
selectCount
(
// 总入场人数量 排出未付款的 用来计算单入场人的价格
int
allEntitiesCount
=
kylinOrderTicketEntitiesMapper
.
selectCount
(
// 总入场人数量 排出未付款的 用来计算单入场人的价格
new
QueryWrapper
<
KylinOrderTicketEntities
>()
new
QueryWrapper
<
KylinOrderTicketEntities
>()
.
eq
(
"order_id"
,
orderTicketsId
)
.
eq
(
"order_id"
,
orderTicketsId
)
.
ne
(
"is_payment"
,
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT0
)
.
ne
(
"is_payment"
,
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT0
)
);
);
double
onePrice
=
(
priceActual
-
priceExpress
)
/
allEntitiesCount
;
//单价
BigDecimal
onePrice
=
priceActual
.
subtract
(
priceExpress
).
divide
(
BigDecimal
.
valueOf
(
allEntitiesCount
))
;
//单价
List
<
Double
>
realRefundPriceList
=
new
ArrayList
<>();
List
<
Double
>
realRefundPriceList
=
new
ArrayList
<>();
if
(
null
==
refundApplyParam
.
getOrderRefundBatchesId
()
||
refundApplyParam
.
getOrderRefundBatchesId
().
isEmpty
())
{
// 不是批量退款
if
(
null
==
refundApplyParam
.
getOrderRefundBatchesId
()
||
refundApplyParam
.
getOrderRefundBatchesId
().
isEmpty
())
{
// 不是批量退款
for
(
int
i
=
0
;
i
<=
ticketEntityIds
.
size
()
-
1
;
i
++)
{
for
(
int
i
=
0
;
i
<=
ticketEntityIds
.
size
()
-
1
;
i
++)
{
Double
price
=
entitiesPrice
.
get
(
i
);
BigDecimal
price
=
BigDecimal
.
valueOf
(
entitiesPrice
.
get
(
i
)
);
if
(
price
<
0
)
{
if
(
price
.
compareTo
(
BigDecimal
.
ZERO
)
<=
0
)
{
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"20021"
));
return
ResponseDto
.
failure
(
ErrorMapping
.
get
(
"20021"
));
}
else
{
}
else
{
Double
refundedPrice
=
kylinOrderTicketEntitiesMapper
.
getRefundEntitiesPrice
(
//已退
Double
refundedPrice
=
kylinOrderTicketEntitiesMapper
.
getRefundEntitiesPrice
(
//已退
...
@@ -170,7 +172,7 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
...
@@ -170,7 +172,7 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
if
(
null
==
refundedPrice
)
{
if
(
null
==
refundedPrice
)
{
refundedPrice
=
0.0
;
refundedPrice
=
0.0
;
}
}
if
(
price
>
(
onePrice
-
refundedPrice
)
)
{
if
(
price
.
compareTo
(
onePrice
.
subtract
(
BigDecimal
.
valueOf
(
refundedPrice
)))
>
0
)
{
return
ResponseDto
.
failure
(
"超过可退款金额"
);
return
ResponseDto
.
failure
(
"超过可退款金额"
);
}
}
}
}
...
@@ -187,9 +189,9 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
...
@@ -187,9 +189,9 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
if
(
null
==
refundedPrice
)
{
if
(
null
==
refundedPrice
)
{
refundedPrice
=
0.0
;
refundedPrice
=
0.0
;
}
}
Double
price
=
onePrice
-
refundedPrice
;
// 计算可退金额
BigDecimal
price
=
onePrice
.
subtract
(
BigDecimal
.
valueOf
(
refundedPrice
))
;
// 计算可退金额
if
(
price
>
0
)
{
if
(
price
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
realRefundPriceList
.
add
(
price
);
realRefundPriceList
.
add
(
price
.
doubleValue
()
);
ticketEntityIdsNew
.
add
(
ticketEntityIds
.
get
(
i
));
ticketEntityIdsNew
.
add
(
ticketEntityIds
.
get
(
i
));
}
}
}
}
...
@@ -199,7 +201,7 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
...
@@ -199,7 +201,7 @@ public class KylinOrderRefundsServiceImpl extends ServiceImpl<KylinOrderRefundsM
boolean
res
=
kylinRefundsStatusServiceImpl
.
orderTicketRefunding
(
boolean
res
=
kylinRefundsStatusServiceImpl
.
orderTicketRefunding
(
refundApplyParam
,
orderInfo
,
orderTicketsId
,
refundApplyParam
,
orderInfo
,
orderTicketsId
,
RefundPriceExpress
,
RefundPriceExpress
.
doubleValue
()
,
ticketEntityIds
,
realRefundPriceList
ticketEntityIds
,
realRefundPriceList
);
);
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/kylin/service/impl/KylinRefundExecuteServiceImpl.java
View file @
26ba85bb
...
@@ -73,7 +73,11 @@ public class KylinRefundExecuteServiceImpl {
...
@@ -73,7 +73,11 @@ public class KylinRefundExecuteServiceImpl {
if
(
order
.
getPriceExpress
()
!=
null
)
{
if
(
order
.
getPriceExpress
()
!=
null
)
{
refundApplyParam
.
setRefundPriceExpress
(
order
.
getPriceExpress
().
doubleValue
());
refundApplyParam
.
setRefundPriceExpress
(
order
.
getPriceExpress
().
doubleValue
());
}
}
ResponseDto
res
=
kylinOrderRefundsServiceImpl
.
refundApply
(
refundApplyParam
);
try
{
ResponseDto
res
=
kylinOrderRefundsServiceImpl
.
refundApply
(
refundApplyParam
);
}
catch
(
Exception
e
)
{
}
}
}
count
=
orderList
.
size
();
count
=
orderList
.
size
();
...
@@ -133,7 +137,7 @@ public class KylinRefundExecuteServiceImpl {
...
@@ -133,7 +137,7 @@ public class KylinRefundExecuteServiceImpl {
List
<
KylinOrderRefunds
>
refundList
=
kylinOrderRefundsMapper
.
getRefundList
(
whereType
,
refundBatchId
,
whereStatus
,
mid
,
limitNum
);
List
<
KylinOrderRefunds
>
refundList
=
kylinOrderRefundsMapper
.
getRefundList
(
whereType
,
refundBatchId
,
whereStatus
,
mid
,
limitNum
);
List
<
String
>
refundIds
=
null
;
List
<
String
>
refundIds
=
null
;
if
(
refundList
!=
null
&&
refundList
.
size
()
>
0
)
{
if
(
refundList
!=
null
&&
refundList
.
size
()
>
0
)
{
refundIds
=
refundList
.
stream
().
map
(
KylinOrderRefunds
->
KylinOrderRefunds
.
getOrderRefundsId
()).
collect
(
Collectors
.
toList
());
refundIds
=
refundList
.
stream
().
map
(
KylinOrderRefunds
->
KylinOrderRefunds
.
getOrderRefundsId
()).
collect
(
Collectors
.
toList
());
RefundApplyParam
refundApplyParam
=
new
RefundApplyParam
();
RefundApplyParam
refundApplyParam
=
new
RefundApplyParam
();
...
@@ -145,11 +149,15 @@ public class KylinRefundExecuteServiceImpl {
...
@@ -145,11 +149,15 @@ public class KylinRefundExecuteServiceImpl {
if
(
null
!=
refundBatchApplyParam
.
getReject
())
{
if
(
null
!=
refundBatchApplyParam
.
getReject
())
{
refundApplyParam
.
setReject
(
refundBatchApplyParam
.
getReject
());
refundApplyParam
.
setReject
(
refundBatchApplyParam
.
getReject
());
}
}
ResponseDto
res
=
kylinOrderRefundsServiceImpl
.
refundCheckStatus
(
refundApplyParam
);
try
{
ResponseDto
res
=
kylinOrderRefundsServiceImpl
.
refundCheckStatus
(
refundApplyParam
);
}
catch
(
Exception
e
)
{
}
}
}
count
=
refundList
.
size
();
count
=
refundList
.
size
();
if
(
count
>
0
){
if
(
count
>
0
)
{
KylinOrderRefunds
lastInfo
=
refundList
.
get
(
count
-
1
);
KylinOrderRefunds
lastInfo
=
refundList
.
get
(
count
-
1
);
if
(
lastInfo
!=
null
)
{
if
(
lastInfo
!=
null
)
{
mid
=
lastInfo
.
getMid
();
mid
=
lastInfo
.
getMid
();
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/kylin/service/impl/KylinRefundsStatusServiceImpl.java
View file @
26ba85bb
...
@@ -202,6 +202,13 @@ public class KylinRefundsStatusServiceImpl {
...
@@ -202,6 +202,13 @@ public class KylinRefundsStatusServiceImpl {
mongoTemplate
.
insert
(
kylinOrderRefundEntitiesVo
,
KylinOrderRefundEntitiesVo
.
class
.
getSimpleName
());
mongoTemplate
.
insert
(
kylinOrderRefundEntitiesVo
,
KylinOrderRefundEntitiesVo
.
class
.
getSimpleName
());
}
}
List
<
String
>
orderRefundIds
=
new
ArrayList
<>();
orderRefundIds
.
add
(
orderRefundsId
);
List
<
String
>
orderIds
=
new
ArrayList
<>();
orderIds
.
add
(
orderTicketsId
);
dataUtils
.
delOrderRefundVo
(
orderRefundIds
);
dataUtils
.
delOrderRefundVoByOrderId
(
orderIds
);
return
true
;
return
true
;
}
}
...
@@ -474,14 +481,14 @@ public class KylinRefundsStatusServiceImpl {
...
@@ -474,14 +481,14 @@ public class KylinRefundsStatusServiceImpl {
);
);
// 入场人
// 入场人
double
priceActual
=
orderInfo
.
getPriceActual
().
doubleValue
();
BigDecimal
priceActual
=
orderInfo
.
getPriceActual
();
double
priceExpress
=
orderInfo
.
getPriceExpress
().
doubleValue
();
BigDecimal
priceExpress
=
orderInfo
.
getPriceExpress
();
int
allEntitiesCount
=
kylinOrderTicketEntitiesMapper
.
selectCount
(
// 总入场人数量 排出未付款的 用来计算单入场人的价格
int
allEntitiesCount
=
kylinOrderTicketEntitiesMapper
.
selectCount
(
// 总入场人数量 排出未付款的 用来计算单入场人的价格
new
QueryWrapper
<
KylinOrderTicketEntities
>()
new
QueryWrapper
<
KylinOrderTicketEntities
>()
.
eq
(
"order_id"
,
orderTicketsId
)
.
eq
(
"order_id"
,
orderTicketsId
)
.
ne
(
"is_payment"
,
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT0
)
.
ne
(
"is_payment"
,
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT0
)
);
);
double
onePrice
=
(
priceActual
-
priceExpress
)
/
allEntitiesCount
;
//单价
BigDecimal
onePrice
=
priceActual
.
subtract
(
priceExpress
).
divide
(
BigDecimal
.
valueOf
(
allEntitiesCount
))
;
//单价
int
refundNumber
=
0
;
int
refundNumber
=
0
;
for
(
String
entitiesId
:
orderTicketEntitiesIdsArr
)
{
for
(
String
entitiesId
:
orderTicketEntitiesIdsArr
)
{
KylinOrderTicketEntities
EntitiesInfo
=
kylinOrderTicketEntitiesMapper
.
selectOne
(
//已退完成的
KylinOrderTicketEntities
EntitiesInfo
=
kylinOrderTicketEntitiesMapper
.
selectOne
(
//已退完成的
...
@@ -497,9 +504,9 @@ public class KylinRefundsStatusServiceImpl {
...
@@ -497,9 +504,9 @@ public class KylinRefundsStatusServiceImpl {
);
);
KylinOrderTicketEntities
entitiesTable
=
new
KylinOrderTicketEntities
();
KylinOrderTicketEntities
entitiesTable
=
new
KylinOrderTicketEntities
();
double
priceNew
=
refundEntitiesInfo
.
getRefundPrice
().
doubleValue
()
+
refundedPrice
.
doubleValue
(
);
BigDecimal
priceNew
=
refundEntitiesInfo
.
getRefundPrice
().
add
(
refundedPrice
);
int
isPayment
=
0
;
int
isPayment
=
0
;
if
(
priceNew
==
onePrice
)
{
if
(
priceNew
.
compareTo
(
onePrice
)
==
0
)
{
isPayment
=
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT3
;
isPayment
=
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT3
;
refundNumber
++;
refundNumber
++;
}
else
{
}
else
{
...
@@ -507,7 +514,7 @@ public class KylinRefundsStatusServiceImpl {
...
@@ -507,7 +514,7 @@ public class KylinRefundsStatusServiceImpl {
}
}
entitiesTable
.
setIsPayment
(
isPayment
);
entitiesTable
.
setIsPayment
(
isPayment
);
entitiesTable
.
setUpdatedAt
(
LocalDateTime
.
now
());
entitiesTable
.
setUpdatedAt
(
LocalDateTime
.
now
());
entitiesTable
.
setRefundPrice
(
BigDecimal
.
valueOf
(
priceNew
)
);
entitiesTable
.
setRefundPrice
(
priceNew
);
Integer
[]
entitiesTableIsPayment
=
{
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT2
,
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT4
};
Integer
[]
entitiesTableIsPayment
=
{
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT2
,
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT4
};
kylinOrderTicketEntitiesMapper
.
update
(
entitiesTable
,
new
UpdateWrapper
<
KylinOrderTicketEntities
>()
kylinOrderTicketEntitiesMapper
.
update
(
entitiesTable
,
new
UpdateWrapper
<
KylinOrderTicketEntities
>()
.
eq
(
"order_ticket_entities_id"
,
entitiesId
)
.
eq
(
"order_ticket_entities_id"
,
entitiesId
)
...
@@ -516,7 +523,7 @@ public class KylinRefundsStatusServiceImpl {
...
@@ -516,7 +523,7 @@ public class KylinRefundsStatusServiceImpl {
HashMap
<
String
,
Object
>
EntitiesVo
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
EntitiesVo
=
new
HashMap
<>();
EntitiesVo
.
put
(
"updatedAt"
,
DateUtil
.
getNowTime
());
EntitiesVo
.
put
(
"updatedAt"
,
DateUtil
.
getNowTime
());
EntitiesVo
.
put
(
"refundPrice"
,
BigDecimal
.
valueOf
(
priceNew
)
);
EntitiesVo
.
put
(
"refundPrice"
,
priceNew
);
EntitiesVo
.
put
(
"isPayment"
,
isPayment
);
EntitiesVo
.
put
(
"isPayment"
,
isPayment
);
BasicDBObject
EntitiesVov
=
new
BasicDBObject
(
"$set"
,
mongoConverter
.
convertToMongoType
(
EntitiesVo
));
BasicDBObject
EntitiesVov
=
new
BasicDBObject
(
"$set"
,
mongoConverter
.
convertToMongoType
(
EntitiesVo
));
UpdateResult
updateResult
=
mongoTemplate
.
getCollection
(
KylinOrderTicketEntitiesVo
.
class
.
getSimpleName
()).
updateOne
(
UpdateResult
updateResult
=
mongoTemplate
.
getCollection
(
KylinOrderTicketEntitiesVo
.
class
.
getSimpleName
()).
updateOne
(
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/kylin/service/impl/PerformancesExpressServiceImpl.java
View file @
26ba85bb
...
@@ -121,7 +121,7 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
...
@@ -121,7 +121,7 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
return
voList
;
return
voList
;
}
}
public
ResponseDto
placeOrder
(
PerformanceExpressSearchAdminParam
performanceExpressSearchAdminParam
)
throws
Exception
{
public
ResponseDto
placeOrder
(
PerformanceExpressSearchAdminParam
performanceExpressSearchAdminParam
)
{
List
<
String
>
ids
=
performanceExpressSearchAdminParam
.
getIds
();
List
<
String
>
ids
=
performanceExpressSearchAdminParam
.
getIds
();
for
(
String
orderTicketsId
:
ids
)
{
for
(
String
orderTicketsId
:
ids
)
{
// 已经存在未取消的下单数据过滤掉
// 已经存在未取消的下单数据过滤掉
...
@@ -179,7 +179,7 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
...
@@ -179,7 +179,7 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
hBody
.
put
(
"dAddress"
,
orderInfo
.
getExpressAddress
());
hBody
.
put
(
"dAddress"
,
orderInfo
.
getExpressAddress
());
// 生成签名并请求
// 生成签名并请求
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
Test
(
hBody
,
"/public/order/v1/placeOrder"
);
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
New
(
hBody
,
"/public/order/v1/placeOrder"
);
System
.
out
.
println
(
result
);
System
.
out
.
println
(
result
);
HashMap
hashMap
=
new
HashMap
();
HashMap
hashMap
=
new
HashMap
();
try
{
try
{
...
@@ -283,11 +283,11 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
...
@@ -283,11 +283,11 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
.
notIn
(
"express_status"
,
expressStatus
)
.
notIn
(
"express_status"
,
expressStatus
)
);
);
if
(
null
!=
orderExpressInfo
)
{
if
(
null
!=
orderExpressInfo
)
{
HashMap
<
String
,
Object
>
hBody
=
new
HashMap
<>();
Map
<
String
,
String
>
hBody
=
new
HashMap
<>();
hBody
.
put
(
"orderId"
,
orderExpressInfo
.
getOrderExpressCode
());
hBody
.
put
(
"orderId"
,
orderExpressInfo
.
getOrderExpressCode
());
// 生成签名并请求
// 生成签名并请求
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
(
hBody
,
"/public/order/v1/cancelOrder"
);
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
New
(
hBody
,
"/public/order/v1/cancelOrder"
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
System
.
out
.
println
(
result
);
System
.
out
.
println
(
result
);
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
...
@@ -329,12 +329,12 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
...
@@ -329,12 +329,12 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
.
notIn
(
"express_status"
,
expressStatus
)
.
notIn
(
"express_status"
,
expressStatus
)
);
);
if
(
null
!=
orderExpressInfo
)
{
if
(
null
!=
orderExpressInfo
)
{
HashMap
<
String
,
Object
>
hBody
=
new
HashMap
<>();
Map
<
String
,
String
>
hBody
=
new
HashMap
<>();
hBody
.
put
(
"orderId"
,
orderExpressInfo
.
getOrderExpressCode
());
hBody
.
put
(
"orderId"
,
orderExpressInfo
.
getOrderExpressCode
());
hBody
.
put
(
"searchType"
,
1
);
//查询类型:1,正向单查询,传入的orderid为正向定单号,2,退货单查询,传入的orderid为退货原始订单号
hBody
.
put
(
"searchType"
,
"1"
);
//查询类型:1,正向单查询,传入的orderid为正向定单号,2,退货单查询,传入的orderid为退货原始订单号
// 生成签名并请求
// 生成签名并请求
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
(
hBody
,
"/public/order/v1/getResult"
);
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
New
(
hBody
,
"/public/order/v1/getResult"
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
System
.
out
.
println
(
result
);
System
.
out
.
println
(
result
);
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
...
@@ -375,7 +375,7 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
...
@@ -375,7 +375,7 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
new
QueryWrapper
<
KylinOrderTickets
>().
eq
(
"order_tickets_id"
,
orderTicketsId
)
new
QueryWrapper
<
KylinOrderTickets
>().
eq
(
"order_tickets_id"
,
orderTicketsId
)
);
);
if
(
null
!=
orderExpressInfo
)
{
if
(
null
!=
orderExpressInfo
)
{
HashMap
<
String
,
Object
>
hBody
=
new
HashMap
<>();
Map
<
String
,
String
>
hBody
=
new
HashMap
<>();
hBody
.
put
(
"jProvince"
,
jProvince
);
hBody
.
put
(
"jProvince"
,
jProvince
);
hBody
.
put
(
"jCity"
,
jCity
);
hBody
.
put
(
"jCity"
,
jCity
);
hBody
.
put
(
"jAddress"
,
jAddress
);
hBody
.
put
(
"jAddress"
,
jAddress
);
...
@@ -383,12 +383,12 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
...
@@ -383,12 +383,12 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
hBody
.
put
(
"dProvince"
,
orderInfo
.
getProvince
());
hBody
.
put
(
"dProvince"
,
orderInfo
.
getProvince
());
hBody
.
put
(
"dCity"
,
orderInfo
.
getCity
());
hBody
.
put
(
"dCity"
,
orderInfo
.
getCity
());
hBody
.
put
(
"dAddress"
,
orderInfo
.
getExpressAddress
());
hBody
.
put
(
"dAddress"
,
orderInfo
.
getExpressAddress
());
hBody
.
put
(
"expressType"
,
expressType
);
hBody
.
put
(
"expressType"
,
expressType
.
toString
()
);
// hBody.put("parcelWeighs", 2.00);
// hBody.put("parcelWeighs", 2.00);
// hBody.put("volume", "10,10,20");
// hBody.put("volume", "10,10,20");
// 生成签名并请求
// 生成签名并请求
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
(
hBody
,
"/public/order/v1/getFreight"
);
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
New
(
hBody
,
"/public/order/v1/getFreight"
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
System
.
out
.
println
(
result
);
System
.
out
.
println
(
result
);
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
...
@@ -420,11 +420,11 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
...
@@ -420,11 +420,11 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
.
notIn
(
"express_status"
,
expressStatus
)
.
notIn
(
"express_status"
,
expressStatus
)
);
);
if
(
null
!=
orderExpressInfo
)
{
if
(
null
!=
orderExpressInfo
)
{
HashMap
<
String
,
Object
>
hBody
=
new
HashMap
<>();
Map
<
String
,
String
>
hBody
=
new
HashMap
<>();
hBody
.
put
(
"orderId"
,
orderExpressInfo
.
getOrderExpressCode
());
hBody
.
put
(
"orderId"
,
orderExpressInfo
.
getOrderExpressCode
());
// 生成签名并请求
// 生成签名并请求
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
(
hBody
,
"/public/order/v1/getListFreight"
);
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
New
(
hBody
,
"/public/order/v1/getListFreight"
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
System
.
out
.
println
(
result
);
System
.
out
.
println
(
result
);
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
...
@@ -462,11 +462,11 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
...
@@ -462,11 +462,11 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
.
notIn
(
"express_status"
,
expressStatus
)
.
notIn
(
"express_status"
,
expressStatus
)
);
);
if
(
null
!=
orderExpressInfo
)
{
if
(
null
!=
orderExpressInfo
)
{
HashMap
<
String
,
Object
>
hBody
=
new
HashMap
<>();
Map
<
String
,
String
>
hBody
=
new
HashMap
<>();
hBody
.
put
(
"orderId"
,
orderExpressInfo
.
getOrderExpressCode
());
hBody
.
put
(
"orderId"
,
orderExpressInfo
.
getOrderExpressCode
());
// 生成签名并请求
// 生成签名并请求
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
(
hBody
,
"/public/order/v1/listOrderRoute"
);
String
result
=
shunfengSignUtils
.
generateSignatureAndRequest
New
(
hBody
,
"/public/order/v1/listOrderRoute"
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
HashMap
hashMap
=
JsonUtils
.
fromJson
(
result
,
HashMap
.
class
);
System
.
out
.
println
(
result
);
System
.
out
.
println
(
result
);
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
if
(
hashMap
.
get
(
"succ"
).
equals
(
"fail"
))
{
...
@@ -499,7 +499,7 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
...
@@ -499,7 +499,7 @@ public class PerformancesExpressServiceImpl extends ServiceImpl<KylinOrderExpres
}
}
// @Async
// @Async
public
void
batchPlaceOrder
(
String
performanceId
)
throws
Exception
{
public
void
batchPlaceOrder
(
String
performanceId
)
{
int
count
;
int
count
;
int
limitNum
=
10
;
int
limitNum
=
10
;
int
mid
=
0
;
int
mid
=
0
;
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/kylin/utils/HttpClientUtils.java
View file @
26ba85bb
...
@@ -2,6 +2,7 @@ package com.liquidnet.client.admin.zhengzai.kylin.utils;
...
@@ -2,6 +2,7 @@ package com.liquidnet.client.admin.zhengzai.kylin.utils;
import
com.liquidnet.client.admin.common.utils.StringUtils
;
import
com.liquidnet.client.admin.common.utils.StringUtils
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
java.io.UnsupportedEncodingException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.security.KeyManagementException
;
import
java.security.KeyManagementException
;
...
@@ -13,6 +14,7 @@ import java.util.Map;
...
@@ -13,6 +14,7 @@ import java.util.Map;
import
javax.net.ssl.SSLContext
;
import
javax.net.ssl.SSLContext
;
import
javax.net.ssl.TrustManager
;
import
javax.net.ssl.TrustManager
;
import
javax.net.ssl.X509TrustManager
;
import
javax.net.ssl.X509TrustManager
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.NameValuePair
;
import
org.apache.http.NameValuePair
;
import
org.apache.http.client.HttpClient
;
import
org.apache.http.client.HttpClient
;
...
@@ -29,11 +31,14 @@ import org.apache.http.entity.ByteArrayEntity;
...
@@ -29,11 +31,14 @@ import org.apache.http.entity.ByteArrayEntity;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.entity.StringEntity
;
import
org.apache.http.impl.client.DefaultHttpClient
;
import
org.apache.http.impl.client.DefaultHttpClient
;
import
org.apache.http.message.BasicNameValuePair
;
import
org.apache.http.message.BasicNameValuePair
;
/**
/**
* author:
* <p>
* date:
* HttpClientUtils
* time:
* </p>
* description: HttpClient调用Https接口封装.
*
* @author jiangxiulong
* @since 2021-07-07
*/
*/
@Component
@Component
public
class
HttpClientUtils
{
public
class
HttpClientUtils
{
...
...
liquidnet-bus-client/liquidnet-client-admin/liquidnet-client-admin-zhengzai/src/main/java/com/liquidnet/client/admin/zhengzai/kylin/utils/ShunfengSignUtils.java
View file @
26ba85bb
package
com
.
liquidnet
.
client
.
admin
.
zhengzai
.
kylin
.
utils
;
package
com
.
liquidnet
.
client
.
admin
.
zhengzai
.
kylin
.
utils
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.commons.lang.util.JsonUtils
;
import
com.liquidnet.service.base.UserPathDto
;
import
com.liquidnet.service.base.UserPathDto
;
import
com.liquidnet.service.kylin.entity.KylinOrderExpress
;
import
com.liquidnet.service.kylin.mapper.KylinOrderExpressMapper
;
import
com.liquidnet.service.kylin.mapper.KylinOrderExpressMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.codec.binary.Base64
;
import
org.apache.commons.codec.binary.Base64
;
...
@@ -57,15 +55,12 @@ public class ShunfengSignUtils {
...
@@ -57,15 +55,12 @@ public class ShunfengSignUtils {
*/
*/
private
final
static
Long
CHECK_TIME
=
600000L
;
private
final
static
Long
CHECK_TIME
=
600000L
;
@Autowired
private
KylinOrderExpressMapper
kylinOrderExpressMapper
;
/**
/**
* 生成签名并请求
* 生成签名并请求
* @param hbody 请求body
* @param hbody 请求body
* @return
* @return
*/
*/
public
String
generateSignatureAndRequest
Test
(
Map
<
String
,
String
>
hbody
,
String
url
)
throws
Exception
{
public
String
generateSignatureAndRequest
New
(
Map
<
String
,
String
>
hbody
,
String
url
)
{
long
currentTimeMillis
=
System
.
currentTimeMillis
();
// 时间戳
long
currentTimeMillis
=
System
.
currentTimeMillis
();
// 时间戳
String
timestamp
=
currentTimeMillis
+
""
;
String
timestamp
=
currentTimeMillis
+
""
;
hbody
.
put
(
"companyId"
,
APP_ID
);
hbody
.
put
(
"companyId"
,
APP_ID
);
...
@@ -79,21 +74,25 @@ public class ShunfengSignUtils {
...
@@ -79,21 +74,25 @@ public class ShunfengSignUtils {
headers
.
put
(
"sign"
,
sign
);
headers
.
put
(
"sign"
,
sign
);
headers
.
put
(
"Content-Type"
,
"application/json;charset=utf-8"
);
headers
.
put
(
"Content-Type"
,
"application/json;charset=utf-8"
);
headers
.
put
(
"Accept"
,
"application/json"
);
headers
.
put
(
"Accept"
,
"application/json"
);
// CloseableHttpClient client = HttpClients.createDefault();
Map
<
String
,
String
>
querys
=
new
HashMap
<>();
Map
<
String
,
String
>
querys
=
new
HashMap
<>();
HttpResponse
httpResponse
=
HttpClientUtils
.
doPost
(
URL
,
url
,
""
,
headers
,
querys
,
hbody
);
try
{
System
.
out
.
println
(
httpResponse
);
HttpResponse
httpResponse
=
HttpClientUtils
.
doPost
(
URL
,
url
,
""
,
headers
,
querys
,
body
);
if
(
httpResponse
.
getStatusLine
().
getStatusCode
()
==
200
)
{
if
(
httpResponse
.
getStatusLine
().
getStatusCode
()
==
200
)
{
System
.
out
.
println
(
"发送请求成功"
);
System
.
out
.
println
(
"发送请求成功"
);
HttpEntity
entity
=
httpResponse
.
getEntity
();
HttpEntity
entity
=
httpResponse
.
getEntity
();
// 发送响应且编码UTF8!!!
// 发送响应且编码UTF8!!!
return
EntityUtils
.
toString
(
entity
,
"utf-8"
);
return
EntityUtils
.
toString
(
entity
,
"utf-8"
);
}
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"发送请求失败"
);
e
.
printStackTrace
();
return
e
.
getMessage
();
}
}
return
"error"
;
return
null
;
}
}
/**
/**
* 生成签名并请求
* 生成签名并请求
线上Received fatal alert:handshake_failure 废弃
* @param hbody 请求body
* @param hbody 请求body
* @return
* @return
*/
*/
...
@@ -191,47 +190,4 @@ public class ShunfengSignUtils {
...
@@ -191,47 +190,4 @@ public class ShunfengSignUtils {
return
Base64
.
encodeBase64URLSafeString
(
bytes
);
return
Base64
.
encodeBase64URLSafeString
(
bytes
);
}
}
/**
* 接收请求且验签(可在控制层调用此方法)
* @param params 接收请求参数
* @param request 接收请求
* @return
*/
public
boolean
receiveRequestAndCheckSign
(
String
params
,
HttpServletRequest
request
)
{
// 请求方APPID
String
sendAppId
=
request
.
getHeader
(
"sendAppId"
);
// 请求方时间戳
String
timestamp
=
request
.
getHeader
(
"timestamp"
);
// 请求方签名
String
sign
=
request
.
getHeader
(
"sign"
);
if
(
StringUtils
.
isBlank
(
sendAppId
))
{
System
.
out
.
println
(
"参数sendAppId不能为空"
);
return
false
;
}
if
(
StringUtils
.
isBlank
(
timestamp
))
{
System
.
out
.
println
(
"参数timestamp不能为空"
);
return
false
;
}
if
(
StringUtils
.
isBlank
(
sign
))
{
System
.
out
.
println
(
"参数sign不能为空"
);
return
false
;
}
// 校验签名是否过期
long
requestTime
=
Long
.
parseLong
(
timestamp
);
long
now
=
System
.
currentTimeMillis
();
if
(
Math
.
abs
(
now
-
requestTime
)
>
CHECK_TIME
)
{
System
.
out
.
println
(
"签名过期!"
);
return
false
;
}
// 请求方参数+请求方时间戳+SK 生成签名
String
thisSign
=
genSign
(
timestamp
,
params
);
// 获取的签名和请求方签名比较是否一致
if
(!
thisSign
.
equals
(
sign
))
{
System
.
out
.
println
(
"签名错误"
);
return
false
;
}
return
true
;
}
}
}
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/config/RedisStreamConfig.java
View file @
26ba85bb
package
com
.
liquidnet
.
service
.
dragon
.
config
;
package
com
.
liquidnet
.
service
.
dragon
.
config
;
import
com.liquidnet.service.dragon.receiver.RedisReceiver
;
import
com.liquidnet.service.dragon.receiver.RedisPayReceiver
;
import
com.liquidnet.service.dragon.receiver.RedisRefundReceiver
;
import
lombok.var
;
import
lombok.var
;
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
;
...
@@ -18,18 +19,62 @@ import java.time.Duration;
...
@@ -18,18 +19,62 @@ import java.time.Duration;
public
class
RedisStreamConfig
{
public
class
RedisStreamConfig
{
@Autowired
@Autowired
private
RedisReceiver
redisReceiver
;
private
RedisPayReceiver
redisPayReceiver
;
@Autowired
private
RedisRefundReceiver
redisRefundReceiver
;
@Bean
public
Subscription
subscriptionPay0
(
RedisConnectionFactory
factory
)
{
var
options
=
StreamMessageListenerContainer
.
StreamMessageListenerContainerOptions
.
builder
()
.
pollTimeout
(
Duration
.
ofMillis
(
1
))
.
build
();
var
listenerContainer
=
StreamMessageListenerContainer
.
create
(
factory
,
options
);
var
subscription
=
listenerContainer
.
receiveAutoAck
(
Consumer
.
from
(
"dragon-pay-group"
,
"dragon-pay-0"
),
StreamOffset
.
create
(
"dragon-pay"
,
ReadOffset
.
lastConsumed
()),
redisPayReceiver
);
listenerContainer
.
start
();
return
subscription
;
}
@Bean
public
Subscription
subscriptionPay1
(
RedisConnectionFactory
factory
)
{
var
options
=
StreamMessageListenerContainer
.
StreamMessageListenerContainerOptions
.
builder
()
.
pollTimeout
(
Duration
.
ofMillis
(
1
))
.
build
();
var
listenerContainer
=
StreamMessageListenerContainer
.
create
(
factory
,
options
);
var
subscription
=
listenerContainer
.
receiveAutoAck
(
Consumer
.
from
(
"dragon-pay-group"
,
"dragon-pay-1"
),
StreamOffset
.
create
(
"dragon-pay"
,
ReadOffset
.
lastConsumed
()),
redisPayReceiver
);
listenerContainer
.
start
();
return
subscription
;
}
@Bean
public
Subscription
subscriptionRefund0
(
RedisConnectionFactory
factory
)
{
var
options
=
StreamMessageListenerContainer
.
StreamMessageListenerContainerOptions
.
builder
()
.
pollTimeout
(
Duration
.
ofMillis
(
1
))
.
build
();
var
listenerContainer
=
StreamMessageListenerContainer
.
create
(
factory
,
options
);
var
subscription
=
listenerContainer
.
receiveAutoAck
(
Consumer
.
from
(
"dragon-refund-group"
,
"dragon-refund-0"
),
StreamOffset
.
create
(
"dragon-refund"
,
ReadOffset
.
lastConsumed
()),
redisRefundReceiver
);
listenerContainer
.
start
();
return
subscription
;
}
@Bean
@Bean
public
Subscription
subscription
(
RedisConnectionFactory
factory
)
{
public
Subscription
subscription
Refund1
(
RedisConnectionFactory
factory
)
{
var
options
=
StreamMessageListenerContainer
var
options
=
StreamMessageListenerContainer
.
StreamMessageListenerContainerOptions
.
StreamMessageListenerContainerOptions
.
builder
()
.
builder
()
.
pollTimeout
(
Duration
.
of
Second
s
(
1
))
.
pollTimeout
(
Duration
.
of
Milli
s
(
1
))
.
build
();
.
build
();
var
listenerContainer
=
StreamMessageListenerContainer
.
create
(
factory
,
options
);
var
listenerContainer
=
StreamMessageListenerContainer
.
create
(
factory
,
options
);
var
subscription
=
listenerContainer
.
receiveAutoAck
(
Consumer
.
from
(
"
group-1"
,
"consumer
-1"
),
var
subscription
=
listenerContainer
.
receiveAutoAck
(
Consumer
.
from
(
"
dragon-refund-group"
,
"dragon-refund
-1"
),
StreamOffset
.
create
(
"
mystream"
,
ReadOffset
.
lastConsumed
()),
redis
Receiver
);
StreamOffset
.
create
(
"
dragon-refund"
,
ReadOffset
.
lastConsumed
()),
redisRefund
Receiver
);
listenerContainer
.
start
();
listenerContainer
.
start
();
return
subscription
;
return
subscription
;
}
}
...
...
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/controller/PayController.java
View file @
26ba85bb
package
com
.
liquidnet
.
service
.
dragon
.
controller
;
package
com
.
liquidnet
.
service
.
dragon
.
controller
;
import
com.liquidnet.service.base.ResponseDto
;
import
com.liquidnet.service.dragon.service.IDragonOrdersService
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RestController
@RequestMapping
(
"pay"
)
@RequestMapping
(
"pay"
)
public
class
PayController
{
public
class
PayController
{
@Autowired
IDragonOrdersService
dragonOrdersService
;
@PostMapping
(
"pre"
)
@ApiOperation
(
"发送测试redis"
)
@ApiResponse
(
code
=
200
,
message
=
"接口返回对象参数"
)
public
ResponseDto
<
String
>
checkCanOrder
()
{
dragonOrdersService
.
sendRedisQueue
();
return
ResponseDto
.
success
();
}
}
}
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/receiver/RedisReceiver.java
→
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/receiver/Redis
Pay
Receiver.java
View file @
26ba85bb
...
@@ -7,11 +7,11 @@ import org.springframework.stereotype.Component;
...
@@ -7,11 +7,11 @@ import org.springframework.stereotype.Component;
@Slf4j
@Slf4j
@Component
@Component
public
class
RedisReceiver
implements
StreamListener
<
String
,
MapRecord
<
String
,
String
,
String
>>
{
public
class
Redis
Pay
Receiver
implements
StreamListener
<
String
,
MapRecord
<
String
,
String
,
String
>>
{
@Override
@Override
public
void
onMessage
(
MapRecord
<
String
,
String
,
String
>
message
)
{
public
void
onMessage
(
MapRecord
<
String
,
String
,
String
>
message
)
{
log
.
info
(
"接受到来自redis的消息"
);
log
.
info
(
"接受到来自redis
PAY
的消息"
);
System
.
out
.
println
(
"message id "
+
message
.
getId
());
System
.
out
.
println
(
"message id "
+
message
.
getId
());
System
.
out
.
println
(
"stream "
+
message
.
getStream
());
System
.
out
.
println
(
"stream "
+
message
.
getStream
());
System
.
out
.
println
(
"body "
+
message
.
getValue
());
System
.
out
.
println
(
"body "
+
message
.
getValue
());
...
...
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/receiver/RedisRefundReceiver.java
0 → 100644
View file @
26ba85bb
package
com
.
liquidnet
.
service
.
dragon
.
receiver
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.data.redis.connection.stream.MapRecord
;
import
org.springframework.data.redis.stream.StreamListener
;
import
org.springframework.stereotype.Component
;
@Slf4j
@Component
public
class
RedisRefundReceiver
implements
StreamListener
<
String
,
MapRecord
<
String
,
String
,
String
>>
{
@Override
public
void
onMessage
(
MapRecord
<
String
,
String
,
String
>
message
)
{
log
.
info
(
"接受到来自redis REFUND 的消息"
);
System
.
out
.
println
(
"message id "
+
message
.
getId
());
System
.
out
.
println
(
"stream "
+
message
.
getStream
());
System
.
out
.
println
(
"body "
+
message
.
getValue
());
}
}
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/service/impl/DragonOrderRefundsServiceImpl.java
View file @
26ba85bb
...
@@ -20,7 +20,7 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
...
@@ -20,7 +20,7 @@ public class DragonOrderRefundsServiceImpl implements IDragonOrderRefundsService
try
{
try
{
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"message"
,
"测试 redis 订阅信息1"
);
map
.
put
(
"message"
,
"测试 redis 订阅信息1"
);
MapRecord
<
String
,
String
,
String
>
record
=
StreamRecords
.
mapBacked
(
map
).
withStreamKey
(
"
mystream
"
);
MapRecord
<
String
,
String
,
String
>
record
=
StreamRecords
.
mapBacked
(
map
).
withStreamKey
(
"
dragon-refund
"
);
stringRedisTemplate
.
opsForStream
().
add
(
record
);
stringRedisTemplate
.
opsForStream
().
add
(
record
);
}
catch
(
Exception
e
){
}
catch
(
Exception
e
){
e
.
printStackTrace
();
e
.
printStackTrace
();
...
...
liquidnet-bus-service/liquidnet-service-dragon/liquidnet-service-dragon-impl/src/main/java/com/liquidnet/service/dragon/service/impl/DragonOrdersServiceImpl.java
View file @
26ba85bb
package
com
.
liquidnet
.
service
.
dragon
.
service
.
impl
;
package
com
.
liquidnet
.
service
.
dragon
.
service
.
impl
;
import
com.liquidnet.service.dragon.service.IDragonOrdersService
;
import
com.liquidnet.service.dragon.service.IDragonOrdersService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.data.redis.connection.stream.MapRecord
;
import
org.springframework.data.redis.connection.stream.StreamRecords
;
import
org.springframework.data.redis.core.StringRedisTemplate
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
@Service
public
class
DragonOrdersServiceImpl
implements
IDragonOrdersService
{
public
class
DragonOrdersServiceImpl
implements
IDragonOrdersService
{
@Autowired
StringRedisTemplate
stringRedisTemplate
;
@Override
public
void
sendRedisQueue
()
{
try
{
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"message"
,
"测试 redis 订阅信息1"
);
MapRecord
<
String
,
String
,
String
>
record
=
StreamRecords
.
mapBacked
(
map
).
withStreamKey
(
"dragon-pay"
);
stringRedisTemplate
.
opsForStream
().
add
(
record
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
}
}
}
}
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/service/refund/KylinRefundsStatusServiceImpl.java
View file @
26ba85bb
...
@@ -105,14 +105,14 @@ public class KylinRefundsStatusServiceImpl {
...
@@ -105,14 +105,14 @@ public class KylinRefundsStatusServiceImpl {
);
);
// 入场人
// 入场人
double
priceActual
=
orderInfo
.
getPriceActual
().
doubleValue
();
BigDecimal
priceActual
=
orderInfo
.
getPriceActual
();
double
priceExpress
=
orderInfo
.
getPriceExpress
().
doubleValue
();
BigDecimal
priceExpress
=
orderInfo
.
getPriceExpress
();
int
allEntitiesCount
=
kylinOrderTicketEntitiesMapper
.
selectCount
(
// 总入场人数量 排出未付款的 用来计算单入场人的价格
int
allEntitiesCount
=
kylinOrderTicketEntitiesMapper
.
selectCount
(
// 总入场人数量 排出未付款的 用来计算单入场人的价格
new
QueryWrapper
<
KylinOrderTicketEntities
>()
new
QueryWrapper
<
KylinOrderTicketEntities
>()
.
eq
(
"order_id"
,
orderTicketsId
)
.
eq
(
"order_id"
,
orderTicketsId
)
.
ne
(
"is_payment"
,
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT0
)
.
ne
(
"is_payment"
,
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT0
)
);
);
double
onePrice
=
(
priceActual
-
priceExpress
)
/
allEntitiesCount
;
//单价
BigDecimal
onePrice
=
priceActual
.
subtract
(
priceExpress
).
divide
(
BigDecimal
.
valueOf
(
allEntitiesCount
))
;
//单价
int
refundNumber
=
0
;
int
refundNumber
=
0
;
for
(
String
entitiesId
:
orderTicketEntitiesIdsArr
)
{
for
(
String
entitiesId
:
orderTicketEntitiesIdsArr
)
{
KylinOrderTicketEntities
EntitiesInfo
=
kylinOrderTicketEntitiesMapper
.
selectOne
(
//已退完成的
KylinOrderTicketEntities
EntitiesInfo
=
kylinOrderTicketEntitiesMapper
.
selectOne
(
//已退完成的
...
@@ -128,9 +128,9 @@ public class KylinRefundsStatusServiceImpl {
...
@@ -128,9 +128,9 @@ public class KylinRefundsStatusServiceImpl {
);
);
KylinOrderTicketEntities
entitiesTable
=
new
KylinOrderTicketEntities
();
KylinOrderTicketEntities
entitiesTable
=
new
KylinOrderTicketEntities
();
double
priceNew
=
refundEntitiesInfo
.
getRefundPrice
().
doubleValue
()
+
refundedPrice
.
doubleValue
(
);
BigDecimal
priceNew
=
refundEntitiesInfo
.
getRefundPrice
().
add
(
refundedPrice
);
int
isPayment
=
0
;
int
isPayment
=
0
;
if
(
priceNew
==
onePrice
)
{
if
(
priceNew
.
compareTo
(
onePrice
)
==
0
)
{
isPayment
=
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT3
;
isPayment
=
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT3
;
refundNumber
++;
refundNumber
++;
}
else
{
}
else
{
...
@@ -138,7 +138,7 @@ public class KylinRefundsStatusServiceImpl {
...
@@ -138,7 +138,7 @@ public class KylinRefundsStatusServiceImpl {
}
}
entitiesTable
.
setIsPayment
(
isPayment
);
entitiesTable
.
setIsPayment
(
isPayment
);
entitiesTable
.
setUpdatedAt
(
LocalDateTime
.
now
());
entitiesTable
.
setUpdatedAt
(
LocalDateTime
.
now
());
entitiesTable
.
setRefundPrice
(
BigDecimal
.
valueOf
(
priceNew
)
);
entitiesTable
.
setRefundPrice
(
priceNew
);
Integer
[]
entitiesTableIsPayment
=
{
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT2
,
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT4
};
Integer
[]
entitiesTableIsPayment
=
{
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT2
,
KylinTableStatusConst
.
ENTITIES_IS_PAYMENT4
};
kylinOrderTicketEntitiesMapper
.
update
(
entitiesTable
,
new
UpdateWrapper
<
KylinOrderTicketEntities
>()
kylinOrderTicketEntitiesMapper
.
update
(
entitiesTable
,
new
UpdateWrapper
<
KylinOrderTicketEntities
>()
.
eq
(
"order_ticket_entities_id"
,
entitiesId
)
.
eq
(
"order_ticket_entities_id"
,
entitiesId
)
...
@@ -147,7 +147,7 @@ public class KylinRefundsStatusServiceImpl {
...
@@ -147,7 +147,7 @@ public class KylinRefundsStatusServiceImpl {
HashMap
<
String
,
Object
>
EntitiesVo
=
new
HashMap
<>();
HashMap
<
String
,
Object
>
EntitiesVo
=
new
HashMap
<>();
EntitiesVo
.
put
(
"updatedAt"
,
DateUtil
.
getNowTime
());
EntitiesVo
.
put
(
"updatedAt"
,
DateUtil
.
getNowTime
());
EntitiesVo
.
put
(
"refundPrice"
,
BigDecimal
.
valueOf
(
priceNew
)
);
EntitiesVo
.
put
(
"refundPrice"
,
priceNew
);
EntitiesVo
.
put
(
"isPayment"
,
isPayment
);
EntitiesVo
.
put
(
"isPayment"
,
isPayment
);
BasicDBObject
EntitiesVov
=
new
BasicDBObject
(
"$set"
,
mongoConverter
.
convertToMongoType
(
EntitiesVo
));
BasicDBObject
EntitiesVov
=
new
BasicDBObject
(
"$set"
,
mongoConverter
.
convertToMongoType
(
EntitiesVo
));
UpdateResult
updateResult
=
mongoTemplate
.
getCollection
(
KylinOrderTicketEntitiesVo
.
class
.
getSimpleName
()).
updateOne
(
UpdateResult
updateResult
=
mongoTemplate
.
getCollection
(
KylinOrderTicketEntitiesVo
.
class
.
getSimpleName
()).
updateOne
(
...
...
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