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
7f9113ed
Commit
7f9113ed
authored
Oct 20, 2020
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改分账
parent
14c8338d
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
86 additions
and
5 deletions
+86
-5
CompanyWalletDetailDTO.java
.../xxfc/platform/order/pojo/dto/CompanyWalletDetailDTO.java
+2
-2
CompanyWalletDetailBiz.java
...a/com/xxfc/platform/order/biz/CompanyWalletDetailBiz.java
+3
-3
RabbitOrderConfig.java
...ava/com/xxfc/platform/order/config/RabbitOrderConfig.java
+6
-0
OrderExtractMQHandler.java
.../xxfc/platform/order/mqhandler/OrderExtractMQHandler.java
+75
-0
No files found.
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/dto/CompanyWalletDetailDTO.java
View file @
7f9113ed
...
...
@@ -96,7 +96,7 @@ public class CompanyWalletDetailDTO{
public
BigDecimal
getOrderComssion
(){
return
getV
iolat
eAmount
().
multiply
(
orderExtract
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
return
getV
ehicl
eAmount
().
multiply
(
orderExtract
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
...
...
@@ -105,7 +105,7 @@ public class CompanyWalletDetailDTO{
public
BigDecimal
getPlatformComssion
(){
return
getV
iolat
eAmount
().
multiply
(
platformExtract
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
return
getV
ehicl
eAmount
().
multiply
(
platformExtract
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
}
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/CompanyWalletDetailBiz.java
View file @
7f9113ed
...
...
@@ -82,7 +82,7 @@ public class CompanyWalletDetailBiz extends BaseBiz<CompanyWalletDetailMapper, C
walletDetailDTO
.
setDeposit
(
vehicleDetail
.
getDeposit
());
walletDetailDTO
.
setViolateAmount
(
baseOrder
.
getViolateAmount
());
walletDetailDTO
.
setBreakRulesRegulation
(
vehicleDetail
.
getViolateTrafficAmount
());
walletDetailDTO
.
setLossSpecifiedAmount
(
baseOrder
.
get
Violate
Amount
());
walletDetailDTO
.
setLossSpecifiedAmount
(
baseOrder
.
get
Damages
Amount
());
//获取门店钱包信息
CompanyWallet
endCompany
=
companyWalletBiz
.
selectById
(
vehicleDetail
.
getActualEndCompanyId
());
...
...
@@ -142,10 +142,10 @@ public class CompanyWalletDetailBiz extends BaseBiz<CompanyWalletDetailMapper, C
}
if
(
walletDetailDTO
.
getOrderAmount
()
!=
null
&&
walletDetailDTO
.
getOrderAmount
().
compareTo
(
BigDecimal
.
ZERO
)>
0
){
BigDecimal
amount
=
mapper
.
sumAmountByNo
(
orderNo
,
vehicleDetail
.
getStartCompanyId
());
startCompanyAmount
=
startCompanyAmount
.
add
(
walletDetailDTO
.
getOrderAmount
());
companyWalletDetail
.
setAmount
(
walletDetailDTO
.
getOrder
Amount
());
companyWalletDetail
.
setAmount
(
walletDetailDTO
.
getOrder
Comssion
());
companyWalletDetail
.
setCompanyId
(
vehicleDetail
.
getStartCompanyId
());
companyWalletDetail
.
setBranchId
(
vehicleDetail
.
getStartBranchId
());
companyWalletDetail
.
setSAmount
(
walletDetailDTO
.
getOrder
Amount
().
add
(
amount
));
companyWalletDetail
.
setSAmount
(
walletDetailDTO
.
getOrder
Comssion
().
add
(
amount
));
companyWalletDetail
.
setSource
(
CompanyWalletSourceEnum
.
ORDER_COMSSION
.
getCode
());
companyWalletDetail
.
setItype
(
CompanyWalletITypeEnum
.
VEHICLE
.
getCode
());
companyWalletDetail
.
setId
(
null
);
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/config/RabbitOrderConfig.java
View file @
7f9113ed
...
...
@@ -22,6 +22,10 @@ public class RabbitOrderConfig extends RabbitCommonConfig {
public
static
final
String
ORDER_DEPOSIT_REFUND_QUEUE
=
"order.deposit.refund.queue"
;
public
static
final
String
ORDER_DEPOSIT_FINISH_QUEUE
=
"order.deposit.finish.queue"
;
//同步企业信息
public
static
final
String
ORDER_CORPORATION_UPD_QUEUE
=
"order.corporation:upd.queue"
;
...
...
@@ -31,6 +35,8 @@ public class RabbitOrderConfig extends RabbitCommonConfig {
static
{
myQueue
=
new
ArrayList
<
BindDTO
>(){{
add
(
new
BindDTO
(
ORDER_DEPOSIT_REFUND_QUEUE
,
ORDER_TOPIC
,
KEY_ORDER_FINLISH
));
add
(
new
BindDTO
(
ORDER_DEPOSIT_FINISH_QUEUE
,
ORDER_TOPIC
,
KEY_ORDER_FINLISH
));
//企业
add
(
new
BindDTO
(
ORDER_CORPORATION_UPD_QUEUE
,
VEHICLE_TOPIC
,
KEY_CORPORATION_UPD
));
//门店
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/mqhandler/OrderExtractMQHandler.java
0 → 100644
View file @
7f9113ed
package
com
.
xxfc
.
platform
.
order
.
mqhandler
;
import
cn.hutool.json.JSONUtil
;
import
com.rabbitmq.client.Channel
;
import
com.xxfc.platform.order.biz.CompanyWalletDetailBiz
;
import
com.xxfc.platform.order.biz.OrderAccountBiz
;
import
com.xxfc.platform.order.biz.OrderRefundBiz
;
import
com.xxfc.platform.order.contant.enumerate.OrderTypeEnum
;
import
com.xxfc.platform.order.entity.CompanyWalletDetail
;
import
com.xxfc.platform.order.pojo.mq.OrderMQDTO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.amqp.support.AmqpHeaders
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.messaging.handler.annotation.Headers
;
import
org.springframework.stereotype.Component
;
import
java.io.IOException
;
import
java.util.Map
;
import
java.util.concurrent.ExecutorService
;
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
.
ORDER_DEPOSIT_REFUND_QUEUE
;
@Component
@Slf4j
public
class
OrderExtractMQHandler
{
@Autowired
CompanyWalletDetailBiz
companyWalletDetailBiz
;
/**
* 退款
* @param
*/
@RabbitListener
(
queues
=
ORDER_DEPOSIT_FINISH_QUEUE
)
public
void
integralHandler
(
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
);
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
);
}
}
});
}
}
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