Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
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
youjj
cloud-platform
Commits
2fe5156d
Commit
2fe5156d
authored
Oct 21, 2020
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
123
parent
8b8f707c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
26 deletions
+73
-26
CompanyWalletDetailV2Biz.java
...com/xxfc/platform/order/biz/CompanyWalletDetailV2Biz.java
+26
-20
OrderExtractMQHandler.java
.../xxfc/platform/order/mqhandler/OrderExtractMQHandler.java
+44
-4
CompanyWalletDetailController.java
...fc/platform/order/rest/CompanyWalletDetailController.java
+3
-2
No files found.
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/CompanyWalletDetailV2Biz.java
View file @
2fe5156d
...
@@ -31,6 +31,7 @@ import tk.mybatis.mapper.entity.Example;
...
@@ -31,6 +31,7 @@ import tk.mybatis.mapper.entity.Example;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Objects
;
@Service
@Service
...
@@ -80,9 +81,13 @@ public class CompanyWalletDetailV2Biz extends BaseBiz<CompanyWalletDetailMapper,
...
@@ -80,9 +81,13 @@ public class CompanyWalletDetailV2Biz extends BaseBiz<CompanyWalletDetailMapper,
throw
new
BaseException
(
"订单详情不存在"
,
ResultCode
.
FAILED_CODE
);
throw
new
BaseException
(
"订单详情不存在"
,
ResultCode
.
FAILED_CODE
);
}
}
List
<
Integer
>
types
=
new
ArrayList
<>();
List
<
Integer
>
types
=
new
ArrayList
<>();
types
.
add
(
201
);
if
(
type
==
2
){
types
.
add
(
202
);
types
.
add
(
204
);
types
.
add
(
203
);
}
else
{
types
.
add
(
201
);
types
.
add
(
202
);
types
.
add
(
203
);
}
OrderAccountDetail
accountDetail
=
getAccountDetail
(
types
,
baseOrder
.
getId
());
OrderAccountDetail
accountDetail
=
getAccountDetail
(
types
,
baseOrder
.
getId
());
if
(
accountDetail
==
null
){
if
(
accountDetail
==
null
){
throw
new
BaseException
(
"费用明细不存在"
,
ResultCode
.
FAILED_CODE
);
throw
new
BaseException
(
"费用明细不存在"
,
ResultCode
.
FAILED_CODE
);
...
@@ -126,25 +131,26 @@ public class CompanyWalletDetailV2Biz extends BaseBiz<CompanyWalletDetailMapper,
...
@@ -126,25 +131,26 @@ public class CompanyWalletDetailV2Biz extends BaseBiz<CompanyWalletDetailMapper,
BigDecimal
safeAmount
=
BigDecimal
.
ZERO
;
//不计免赔费
BigDecimal
safeAmount
=
BigDecimal
.
ZERO
;
//不计免赔费
BigDecimal
rentVehicleAmount
=
BigDecimal
.
ZERO
;
//车辆租赁费
BigDecimal
rentVehicleAmount
=
BigDecimal
.
ZERO
;
//车辆租赁费
BigDecimal
orderComssion
=
BigDecimal
.
ZERO
;
//订单抽成
BigDecimal
orderComssion
=
BigDecimal
.
ZERO
;
//订单抽成
BigDecimal
platformComssion
;
//平台抽成
BigDecimal
platformComssion
=
BigDecimal
.
ZERO
;
//平台抽成
BigDecimal
lossSpecifiedAmount
=
BigDecimal
.
ZERO
;
//定损费
BigDecimal
lossSpecifiedAmount
=
BigDecimal
.
ZERO
;
//定损费
BigDecimal
breakRulesRegulation
=
BigDecimal
.
ZERO
;
//违章费
BigDecimal
breakRulesRegulation
=
BigDecimal
.
ZERO
;
//违章费
BigDecimal
violateAmount
;
//违约金
BigDecimal
violateAmount
=
BigDecimal
.
ZERO
;
//违约金
if
(
walletDetailDTO
.
getIsCanelOrder
()
!=
null
&&
walletDetailDTO
.
getIsCanelOrder
()
==
1
){
if
(
walletDetailDTO
.
getIsCanelOrder
()
!=
null
&&
walletDetailDTO
.
getIsCanelOrder
()
==
1
){
violateAmount
=
walletDetailDTO
.
getViolateAmount
();
violateAmount
=
walletDetailDTO
.
getViolateAmount
();
platformComssion
=
violateAmount
.
multiply
(
walletDetailDTO
.
getOrderExtract
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
platformComssion
=
violateAmount
.
multiply
(
walletDetailDTO
.
getOrderExtract
()).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
violateAmount
=
violateAmount
.
subtract
(
platformComssion
);
violateAmount
=
violateAmount
.
subtract
(
platformComssion
);
}
else
{
}
else
{
closedVehicleAmout
=
walletDetailDTO
.
getClosedVehicleAmout
()
==
null
?
BigDecimal
.
ZERO
:
walletDetailDTO
.
getClosedVehicleAmout
();
safeAmount
=
walletDetailDTO
.
getDamageSafeAmount
()
==
null
?
BigDecimal
.
ZERO
:
walletDetailDTO
.
getDamageSafeAmount
();
safeAmount
=
safeAmount
.
add
(
walletDetailDTO
.
getDamageSafeAmount2
()
==
null
?
BigDecimal
.
ZERO
:
walletDetailDTO
.
getDamageSafeAmount2
());
orderComssion
=
walletDetailDTO
.
getOrderComssion
();
platformComssion
=
walletDetailDTO
.
getPlatformComssion
();
rentVehicleAmount
=
walletDetailDTO
.
getRentVehicleAmount
();
lossSpecifiedAmount
=
walletDetailDTO
.
getLossSpecifiedAmount
();
violateAmount
=
walletDetailDTO
.
getViolateAmount
();
if
(
type
==
2
){
if
(
type
==
2
){
breakRulesRegulation
=
walletDetailDTO
.
getBreakRulesRegulation
();
breakRulesRegulation
=
walletDetailDTO
.
getBreakRulesRegulation
();
}
else
{
closedVehicleAmout
=
walletDetailDTO
.
getClosedVehicleAmout
()
==
null
?
BigDecimal
.
ZERO
:
walletDetailDTO
.
getClosedVehicleAmout
();
safeAmount
=
walletDetailDTO
.
getDamageSafeAmount
()
==
null
?
BigDecimal
.
ZERO
:
walletDetailDTO
.
getDamageSafeAmount
();
safeAmount
=
safeAmount
.
add
(
walletDetailDTO
.
getDamageSafeAmount2
()
==
null
?
BigDecimal
.
ZERO
:
walletDetailDTO
.
getDamageSafeAmount2
());
orderComssion
=
walletDetailDTO
.
getOrderComssion
();
platformComssion
=
walletDetailDTO
.
getPlatformComssion
();
rentVehicleAmount
=
walletDetailDTO
.
getRentVehicleAmount
();
lossSpecifiedAmount
=
walletDetailDTO
.
getLossSpecifiedAmount
();
violateAmount
=
walletDetailDTO
.
getViolateAmount
();
}
}
...
@@ -348,22 +354,22 @@ public class CompanyWalletDetailV2Biz extends BaseBiz<CompanyWalletDetailMapper,
...
@@ -348,22 +354,22 @@ public class CompanyWalletDetailV2Biz extends BaseBiz<CompanyWalletDetailMapper,
for
(
OrderAccountDeduction
orderAccountDeduction:
deductions
){
for
(
OrderAccountDeduction
orderAccountDeduction:
deductions
){
Integer
type
=
orderAccountDeduction
.
getType
()
==
null
?
0
:
orderAccountDeduction
.
getType
();
Integer
type
=
orderAccountDeduction
.
getType
()
==
null
?
0
:
orderAccountDeduction
.
getType
();
BigDecimal
amount
=
orderAccountDeduction
.
getAmount
()
==
null
?
BigDecimal
.
ZERO
:
orderAccountDeduction
.
getAmount
();
BigDecimal
amount
=
orderAccountDeduction
.
getAmount
()
==
null
?
BigDecimal
.
ZERO
:
orderAccountDeduction
.
getAmount
();
if
(
type
==
DeductionTypeEnum
.
VIOLATE_CANCEL
.
getCode
(
)){
if
(
Objects
.
equals
(
DeductionTypeEnum
.
VIOLATE_CANCEL
.
getCode
(),
type
)){
walletDetailV2DTO
.
setIsCanelOrder
(
1
);
walletDetailV2DTO
.
setIsCanelOrder
(
1
);
walletDetailV2DTO
.
setViolateAmount
(
amount
);
walletDetailV2DTO
.
setViolateAmount
(
amount
);
}
else
{
}
else
{
walletDetailV2DTO
.
setIsCanelOrder
(
0
);
walletDetailV2DTO
.
setIsCanelOrder
(
0
);
if
(
type
==
DeductionTypeEnum
.
VIOLATE_ADVANCE
.
getCode
()
||
type
==
DeductionTypeEnum
.
VIOLATE_DELAY
.
getCode
(
)){
if
(
Objects
.
equals
(
DeductionTypeEnum
.
VIOLATE_ADVANCE
.
getCode
(),
type
)
||
Objects
.
equals
(
DeductionTypeEnum
.
VIOLATE_DELAY
.
getCode
(),
type
)){
walletDetailV2DTO
.
setViolateAmount
(
amount
);
walletDetailV2DTO
.
setViolateAmount
(
amount
);
}
else
if
(
type
==
DeductionTypeEnum
.
VIOLATE_CHANGE_C
.
getCode
(
)){
}
else
if
(
Objects
.
equals
(
DeductionTypeEnum
.
VIOLATE_CHANGE_C
.
getCode
(),
type
)){
walletDetailV2DTO
.
setChageAmount
(
amount
);
walletDetailV2DTO
.
setChageAmount
(
amount
);
}
else
if
(
type
==
DeductionTypeEnum
.
CONSUME
.
getCode
(
)){
}
else
if
(
Objects
.
equals
(
DeductionTypeEnum
.
CONSUME
.
getCode
(),
type
)){
walletDetailV2DTO
.
setOrderAmount
(
amount
);
walletDetailV2DTO
.
setOrderAmount
(
amount
);
}
else
if
(
type
==
DeductionTypeEnum
.
DAMAGES
.
getCode
(
)){
}
else
if
(
Objects
.
equals
(
DeductionTypeEnum
.
DAMAGES
.
getCode
(),
type
)){
walletDetailV2DTO
.
setLossSpecifiedAmount
(
amount
);
walletDetailV2DTO
.
setLossSpecifiedAmount
(
amount
);
}
else
if
(
type
==
DeductionTypeEnum
.
VIOLATE_TRAFFIC_DEDUCT
.
getCode
(
)){
}
else
if
(
Objects
.
equals
(
DeductionTypeEnum
.
VIOLATE_TRAFFIC_DEDUCT
.
getCode
(),
type
)){
walletDetailV2DTO
.
setBreakRulesRegulation
(
amount
);
walletDetailV2DTO
.
setBreakRulesRegulation
(
amount
);
}
else
if
(
type
==
DeductionTypeEnum
.
OTHER_DELAY_SAFE
.
getCode
(
)){
}
else
if
(
Objects
.
equals
(
DeductionTypeEnum
.
OTHER_DELAY_SAFE
.
getCode
(),
type
)){
walletDetailV2DTO
.
setDamageSafeAmount2
(
amount
);
walletDetailV2DTO
.
setDamageSafeAmount2
(
amount
);
}
}
}
}
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/mqhandler/OrderExtractMQHandler.java
View file @
2fe5156d
...
@@ -4,6 +4,7 @@ package com.xxfc.platform.order.mqhandler;
...
@@ -4,6 +4,7 @@ package com.xxfc.platform.order.mqhandler;
import
cn.hutool.json.JSONUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.rabbitmq.client.Channel
;
import
com.rabbitmq.client.Channel
;
import
com.xxfc.platform.order.biz.CompanyWalletDetailBiz
;
import
com.xxfc.platform.order.biz.CompanyWalletDetailBiz
;
import
com.xxfc.platform.order.biz.CompanyWalletDetailV2Biz
;
import
com.xxfc.platform.order.biz.OrderAccountBiz
;
import
com.xxfc.platform.order.biz.OrderAccountBiz
;
import
com.xxfc.platform.order.biz.OrderRefundBiz
;
import
com.xxfc.platform.order.biz.OrderRefundBiz
;
import
com.xxfc.platform.order.contant.enumerate.OrderTypeEnum
;
import
com.xxfc.platform.order.contant.enumerate.OrderTypeEnum
;
...
@@ -22,15 +23,14 @@ import java.util.Map;
...
@@ -22,15 +23,14 @@ import java.util.Map;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.Executors
;
import
static
com
.
xxfc
.
platform
.
order
.
config
.
RabbitOrderConfig
.
ORDER_DEPOSIT_FINISH_QUEUE
;
import
static
com
.
xxfc
.
platform
.
order
.
config
.
RabbitOrderConfig
.*;
import
static
com
.
xxfc
.
platform
.
order
.
config
.
RabbitOrderConfig
.
ORDER_DEPOSIT_REFUND_QUEUE
;
@Component
@Component
@Slf4j
@Slf4j
public
class
OrderExtractMQHandler
{
public
class
OrderExtractMQHandler
{
@Autowired
@Autowired
CompanyWalletDetailBiz
companyWalletDetailBiz
;
CompanyWalletDetail
V2
Biz
companyWalletDetailBiz
;
...
@@ -55,7 +55,47 @@ public class OrderExtractMQHandler {
...
@@ -55,7 +55,47 @@ public class OrderExtractMQHandler {
OrderMQDTO
orderMQDTO
=
JSONUtil
.
toBean
(
msg
,
OrderMQDTO
.
class
);
OrderMQDTO
orderMQDTO
=
JSONUtil
.
toBean
(
msg
,
OrderMQDTO
.
class
);
CompanyWalletDetail
companyWalletDetail
=
new
CompanyWalletDetail
();
CompanyWalletDetail
companyWalletDetail
=
new
CompanyWalletDetail
();
companyWalletDetail
.
setCono
(
orderMQDTO
.
getNo
());
companyWalletDetail
.
setCono
(
orderMQDTO
.
getNo
());
companyWalletDetailBiz
.
addOrUpd
(
companyWalletDetail
);
companyWalletDetailBiz
.
addOrUpd
(
companyWalletDetail
,
1
);
executorService
.
shutdown
();
Long
deliveryTag
=
(
Long
)
headers
.
get
(
AmqpHeaders
.
DELIVERY_TAG
);
// 手动签收
channel
.
basicAck
(
deliveryTag
,
false
);
}
catch
(
Exception
e
)
{
log
.
info
(
"接收到的消息失败"
);
try
{
channel
.
basicNack
(
message
.
getMessageProperties
().
getDeliveryTag
(),
false
,
false
);
}
catch
(
IOException
i
)
{
log
.
error
(
e
.
getMessage
(),
i
);
}
log
.
error
(
e
.
getMessage
(),
e
);
}
}
});
}
/**
* 退款
* @param
*/
@RabbitListener
(
queues
=
ORDER_DEPOSIT_END2_QUEUE
)
public
void
orderHandler
(
Message
message
,
@Headers
Map
<
String
,
Object
>
headers
,
Channel
channel
)
{
try
{
Thread
.
sleep
(
5000L
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
ExecutorService
executorService
=
Executors
.
newCachedThreadPool
();
executorService
.
execute
(
new
Runnable
()
{
@Override
public
void
run
()
{
try
{
String
messageId
=
message
.
getMessageProperties
().
getMessageId
();
String
msg
=
new
String
(
message
.
getBody
(),
"UTF-8"
);
OrderMQDTO
orderMQDTO
=
JSONUtil
.
toBean
(
msg
,
OrderMQDTO
.
class
);
CompanyWalletDetail
companyWalletDetail
=
new
CompanyWalletDetail
();
companyWalletDetail
.
setCono
(
orderMQDTO
.
getNo
());
companyWalletDetailBiz
.
addOrUpd
(
companyWalletDetail
,
2
);
executorService
.
shutdown
();
executorService
.
shutdown
();
Long
deliveryTag
=
(
Long
)
headers
.
get
(
AmqpHeaders
.
DELIVERY_TAG
);
Long
deliveryTag
=
(
Long
)
headers
.
get
(
AmqpHeaders
.
DELIVERY_TAG
);
// 手动签收
// 手动签收
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/CompanyWalletDetailController.java
View file @
2fe5156d
...
@@ -4,6 +4,7 @@ package com.xxfc.platform.order.rest;
...
@@ -4,6 +4,7 @@ package com.xxfc.platform.order.rest;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.xxfc.platform.order.biz.CompanyWalletDetailBiz
;
import
com.xxfc.platform.order.biz.CompanyWalletDetailBiz
;
import
com.xxfc.platform.order.biz.CompanyWalletDetailV2Biz
;
import
com.xxfc.platform.order.entity.CompanyWalletDetail
;
import
com.xxfc.platform.order.entity.CompanyWalletDetail
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
@@ -12,12 +13,12 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -12,12 +13,12 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RestController
@RequestMapping
(
"wallet/detail"
)
@RequestMapping
(
"wallet/detail"
)
public
class
CompanyWalletDetailController
extends
BaseController
<
CompanyWalletDetailBiz
,
CompanyWalletDetail
>
{
public
class
CompanyWalletDetailController
extends
BaseController
<
CompanyWalletDetail
V2
Biz
,
CompanyWalletDetail
>
{
@RequestMapping
(
value
=
"upd"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"upd"
,
method
=
RequestMethod
.
POST
)
public
ObjectRestResponse
refundAmount
(
@RequestBody
CompanyWalletDetail
companyWalletDetail
)
{
public
ObjectRestResponse
refundAmount
(
@RequestBody
CompanyWalletDetail
companyWalletDetail
)
{
baseBiz
.
addOrUpd
(
companyWalletDetail
);
baseBiz
.
addOrUpd
(
companyWalletDetail
,
2
);
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
}
}
...
...
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