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
d942f839
Commit
d942f839
authored
Nov 19, 2019
by
zuoyh
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/order_received_statistics' into order_received_statistics
parents
b111e4b2
6ed0c570
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
12 deletions
+22
-12
OrderRentVehicleReceivedStatisticsBiz.java
...form/order/biz/OrderRentVehicleReceivedStatisticsBiz.java
+21
-12
OrderAccountMapper.xml
...r-server/src/main/resources/mapper/OrderAccountMapper.xml
+1
-0
No files found.
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderRentVehicleReceivedStatisticsBiz.java
View file @
d942f839
...
@@ -2,7 +2,6 @@ package com.xxfc.platform.order.biz;
...
@@ -2,7 +2,6 @@ package com.xxfc.platform.order.biz;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.core.util.ObjectUtil
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.google.common.collect.Lists
;
import
com.xxfc.platform.order.contant.enumerate.StatisticsStatusEnum
;
import
com.xxfc.platform.order.contant.enumerate.StatisticsStatusEnum
;
import
com.xxfc.platform.order.entity.OrderRentVehicleReceivedStatistics
;
import
com.xxfc.platform.order.entity.OrderRentVehicleReceivedStatistics
;
import
com.xxfc.platform.order.mapper.OrderRentVehicleReceivedStatisticsMapper
;
import
com.xxfc.platform.order.mapper.OrderRentVehicleReceivedStatisticsMapper
;
...
@@ -12,7 +11,6 @@ import com.xxfc.platform.order.pojo.dto.OrderDTO;
...
@@ -12,7 +11,6 @@ import com.xxfc.platform.order.pojo.dto.OrderDTO;
import
com.xxfc.platform.order.pojo.dto.OrderReceivedStatisticsFindDTO
;
import
com.xxfc.platform.order.pojo.dto.OrderReceivedStatisticsFindDTO
;
import
com.xxfc.platform.vehicle.feign.VehicleFeign
;
import
com.xxfc.platform.vehicle.feign.VehicleFeign
;
import
lombok.RequiredArgsConstructor
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
...
@@ -62,25 +60,29 @@ public class OrderRentVehicleReceivedStatisticsBiz extends BaseBiz<OrderRentVehi
...
@@ -62,25 +60,29 @@ public class OrderRentVehicleReceivedStatisticsBiz extends BaseBiz<OrderRentVehi
//数据处理 状态组合 按支付状态分组 而后按组合状态
//数据处理 状态组合 按支付状态分组 而后按组合状态
Map
<
Boolean
,
Map
<
String
,
List
<
OrderDTO
>>>
stateGroupMap
=
orderDTOS
.
stream
().
peek
(
x
->
{
Map
<
Boolean
,
Map
<
String
,
List
<
OrderDTO
>>>
stateGroupMap
=
orderDTOS
.
stream
().
peek
(
x
->
{
x
.
setStateGroup
(
String
.
format
(
"%d-%d-%d-%d"
,
x
.
getCompanyId
(),
x
.
getOrderOrigin
(),
x
.
getPayWay
()
==
null
?
StatisticsStatusEnum
.
NO_PAY_WAY
:
x
.
getPayWay
(),
x
.
getStatus
()));
x
.
setStateGroup
(
String
.
format
(
"%d-%d-%d-%d"
,
x
.
getCompanyId
(),
x
.
getOrderOrigin
(),
x
.
getPayWay
()
==
null
?
StatisticsStatusEnum
.
NO_PAY_WAY
:
x
.
getPayWay
(),
x
.
getHasPay
()));
stisticsActiveState
.
add
(
x
.
getStateGroup
());
stisticsActiveState
.
add
(
x
.
getStateGroup
());
})
})
.
collect
(
Collectors
.
partitioningBy
(
x
->
Objects
.
is
Null
(
x
.
getPayWay
()),
Collectors
.
groupingBy
(
OrderDTO:
:
getStateGroup
,
Collectors
.
toList
())));
.
collect
(
Collectors
.
partitioningBy
(
x
->
Objects
.
non
Null
(
x
.
getPayWay
()),
Collectors
.
groupingBy
(
OrderDTO:
:
getStateGroup
,
Collectors
.
toList
())));
//订单账目信息
//订单账目信息
List
<
OrderAccountBo
>
orderAccountBoList
=
orderAccountBiz
.
selectByDate
(
startDate
,
endDate
);
List
<
OrderAccountBo
>
orderAccountBoList
=
orderAccountBiz
.
selectByDate
(
startDate
,
endDate
);
//账目数据处理 状态组合
//账目数据处理 状态组合
Map
<
String
,
List
<
OrderAccountBo
>>
ordersMap
=
orderAccountBoList
.
stream
().
peek
(
x
->
{
Map
<
String
,
List
<
OrderAccountBo
>>
ordersMap
=
orderAccountBoList
.
stream
().
peek
(
x
->
{
x
.
setStateGroup
(
String
.
format
(
"%d-%d-%d-%d"
,
x
.
getCompanyId
(),
x
.
getOrderOrigin
(),
x
.
getPayWay
()
==
null
?
StatisticsStatusEnum
.
NO_PAY_WAY
:
x
.
getPayWay
(),
x
.
getStatus
()));
x
.
setStateGroup
(
String
.
format
(
"%d-%d-%d-%d"
,
x
.
getCompanyId
(),
x
.
getOrderOrigin
(),
x
.
getPayWay
()
==
null
?
StatisticsStatusEnum
.
NO_PAY_WAY
:
x
.
getPayWay
(),
x
.
getHasPay
()));
}).
collect
(
Collectors
.
groupingBy
(
OrderAccountBo:
:
getStateGroup
,
Collectors
.
toList
()));
}).
collect
(
Collectors
.
groupingBy
(
OrderAccountBo:
:
getStateGroup
,
Collectors
.
toList
()));
BigDecimal
globalTotalAmount
=
BigDecimal
.
ZERO
;
//已经支付单
//已经支付单
Set
<
Map
.
Entry
<
String
,
List
<
OrderAccountBo
>>>
ordersSet
=
ordersMap
.
entrySet
();
Set
<
Map
.
Entry
<
String
,
List
<
OrderAccountBo
>>>
ordersSet
=
ordersMap
.
entrySet
();
for
(
Map
.
Entry
<
String
,
List
<
OrderAccountBo
>>
orderEntry
:
ordersSet
)
{
for
(
Map
.
Entry
<
String
,
List
<
OrderAccountBo
>>
orderEntry
:
ordersSet
)
{
String
orderKey
=
orderEntry
.
getKey
();
String
orderKey
=
orderEntry
.
getKey
();
List
<
OrderAccountBo
>
orderAccountBos
=
orderEntry
.
getValue
();
List
<
OrderAccountBo
>
orderAccountBos
=
orderEntry
.
getValue
();
OrderRentVehicleReceivedStatistics
orderRentVehicleReceivedStatistics
=
StatisticsStatusEnum
.
wrapStatisticsObject
(
startDate
,
orderKey
,
new
OrderRentVehicleReceivedStatistics
());
BigDecimal
totalAmount
=
BigDecimal
.
ZERO
;
BigDecimal
totalAmount
=
BigDecimal
.
ZERO
;
BigDecimal
refundAmount
=
BigDecimal
.
ZERO
;
BigDecimal
refundAmount
=
BigDecimal
.
ZERO
;
for
(
OrderAccountBo
orderAccountBo
:
orderAccountBos
)
{
for
(
OrderAccountBo
orderAccountBo
:
orderAccountBos
)
{
OrderAccountDetail
accountDetailEntity
=
orderAccountBo
.
getAccountDetailEntity
();
OrderAccountDetail
accountDetailEntity
=
orderAccountBo
.
getAccountDetailEntity
();
if
(
orderAccountBo
.
getAccountType
()
==
PAY_ORDER
)
{
if
(
orderAccountBo
.
getAccountType
()
==
PAY_ORDER
)
{
...
@@ -89,10 +91,15 @@ public class OrderRentVehicleReceivedStatisticsBiz extends BaseBiz<OrderRentVehi
...
@@ -89,10 +91,15 @@ public class OrderRentVehicleReceivedStatisticsBiz extends BaseBiz<OrderRentVehi
refundAmount
.
add
(
accountDetailEntity
.
getOrderAmount
()).
add
(
accountDetailEntity
.
getDepositAmount
());
refundAmount
.
add
(
accountDetailEntity
.
getOrderAmount
()).
add
(
accountDetailEntity
.
getDepositAmount
());
}
}
}
}
orderRentVehicleReceivedStatistics
.
setTotalAmount
(
totalAmount
.
subtract
(
refundAmount
));
boolean
flag
=
stateGroupMap
==
null
?
false
:
stateGroupMap
.
get
(
Boolean
.
TRUE
)
==
null
?
false
:
stateGroupMap
.
get
(
Boolean
.
TRUE
).
get
(
orderKey
)==
null
?
false
:
true
;
Long
totalQuantity
=
stateGroupMap
==
null
?
0L
:
stateGroupMap
.
get
(
Boolean
.
TRUE
)
==
null
?
0L
:
stateGroupMap
.
get
(
Boolean
.
TRUE
).
get
(
orderKey
)==
null
?
0
:
stateGroupMap
.
get
(
Boolean
.
TRUE
).
get
(
orderKey
).
size
();
if
(
flag
){
orderRentVehicleReceivedStatistics
.
setTotalQuantity
(
totalQuantity
.
intValue
());
OrderRentVehicleReceivedStatistics
orderRentVehicleReceivedStatistics
=
StatisticsStatusEnum
.
wrapStatisticsObject
(
startDate
,
orderKey
,
new
OrderRentVehicleReceivedStatistics
());
orderRentVehicleReceivedStatisticsList
.
add
(
orderRentVehicleReceivedStatistics
);
orderRentVehicleReceivedStatistics
.
setTotalAmount
(
totalAmount
.
subtract
(
refundAmount
));
orderRentVehicleReceivedStatistics
.
setTotalQuantity
(
stateGroupMap
.
get
(
Boolean
.
TRUE
).
get
(
orderKey
).
size
());
orderRentVehicleReceivedStatisticsList
.
add
(
orderRentVehicleReceivedStatistics
);
}
globalTotalAmount
.
add
(
totalAmount
.
subtract
(
refundAmount
));
}
}
//未支付单
//未支付单
...
@@ -102,7 +109,7 @@ public class OrderRentVehicleReceivedStatisticsBiz extends BaseBiz<OrderRentVehi
...
@@ -102,7 +109,7 @@ public class OrderRentVehicleReceivedStatisticsBiz extends BaseBiz<OrderRentVehi
//查询分公司ids
//查询分公司ids
List
<
Integer
>
companyIds
=
vehicleFeign
.
findCompanyIdsByAreaId
(
null
);
List
<
Integer
>
companyIds
=
vehicleFeign
.
findCompanyIdsByAreaId
(
null
);
//创建剩余状态组合的租车统计对象
//创建剩余状态组合的租车统计对象
List
<
OrderRentVehicleReceivedStatistics
>
otherStatisticsStateGroupList
=
createOtherStatisticsStateGroupList
(
startDate
,
stisticsActiveState
,
companyIds
);
List
<
OrderRentVehicleReceivedStatistics
>
otherStatisticsStateGroupList
=
createOtherStatisticsStateGroupList
(
startDate
,
globalTotalAmount
,
stisticsActiveState
,
companyIds
);
orderRentVehicleReceivedStatisticsList
.
addAll
(
otherStatisticsStateGroupList
);
orderRentVehicleReceivedStatisticsList
.
addAll
(
otherStatisticsStateGroupList
);
//保存
//保存
insertMemberReceivedStatisticsBatch
(
orderRentVehicleReceivedStatisticsList
);
insertMemberReceivedStatisticsBatch
(
orderRentVehicleReceivedStatisticsList
);
...
@@ -136,11 +143,13 @@ public class OrderRentVehicleReceivedStatisticsBiz extends BaseBiz<OrderRentVehi
...
@@ -136,11 +143,13 @@ public class OrderRentVehicleReceivedStatisticsBiz extends BaseBiz<OrderRentVehi
* 创建剩余状态数据
* 创建剩余状态数据
*
*
* @param startDate 时间
* @param startDate 时间
* @param totalAmount 订单状态
* @param statisticsStateGroups 状态组合 集合
* @param statisticsStateGroups 状态组合 集合
* @param companyIds 公司ids
* @param companyIds 公司ids
* @return
* @return
*/
*/
private
List
<
OrderRentVehicleReceivedStatistics
>
createOtherStatisticsStateGroupList
(
Date
startDate
,
private
List
<
OrderRentVehicleReceivedStatistics
>
createOtherStatisticsStateGroupList
(
Date
startDate
,
BigDecimal
totalAmount
,
List
<
String
>
statisticsStateGroups
,
List
<
String
>
statisticsStateGroups
,
List
<
Integer
>
companyIds
)
{
List
<
Integer
>
companyIds
)
{
...
@@ -152,7 +161,7 @@ public class OrderRentVehicleReceivedStatisticsBiz extends BaseBiz<OrderRentVehi
...
@@ -152,7 +161,7 @@ public class OrderRentVehicleReceivedStatisticsBiz extends BaseBiz<OrderRentVehi
//统计对象的生成
//统计对象的生成
otherStatisticsStateGroup
.
parallelStream
().
map
(
stateGroup
->
{
otherStatisticsStateGroup
.
parallelStream
().
map
(
stateGroup
->
{
OrderRentVehicleReceivedStatistics
orderRentVehicleReceivedStatisticsClone
=
StatisticsStatusEnum
.
wrapStatisticsObject
(
startDate
,
stateGroup
,
ObjectUtil
.
cloneByStream
(
orderRentVehicleReceivedStatistics
));
OrderRentVehicleReceivedStatistics
orderRentVehicleReceivedStatisticsClone
=
StatisticsStatusEnum
.
wrapStatisticsObject
(
startDate
,
stateGroup
,
ObjectUtil
.
cloneByStream
(
orderRentVehicleReceivedStatistics
));
orderRentVehicleReceivedStatisticsClone
.
setTotalAmount
(
BigDecimal
.
ZERO
);
orderRentVehicleReceivedStatisticsClone
.
setTotalAmount
(
totalAmount
);
orderRentVehicleReceivedStatisticsClone
.
setTotalQuantity
(
0
);
orderRentVehicleReceivedStatisticsClone
.
setTotalQuantity
(
0
);
orderRentVehicleReceivedStatisticsList
.
add
(
orderRentVehicleReceivedStatisticsClone
);
orderRentVehicleReceivedStatisticsList
.
add
(
orderRentVehicleReceivedStatisticsClone
);
return
orderRentVehicleReceivedStatisticsClone
;
return
orderRentVehicleReceivedStatisticsClone
;
...
...
xx-order/xx-order-server/src/main/resources/mapper/OrderAccountMapper.xml
View file @
d942f839
...
@@ -61,6 +61,7 @@
...
@@ -61,6 +61,7 @@
bo.`status`,
bo.`status`,
bo.order_origin,
bo.order_origin,
bo.pay_way,
bo.pay_way,
bo.has_pay,
brvd.start_company_id AS `companyId`
brvd.start_company_id AS `companyId`
FROM
FROM
`order_account` AS `oa`
`order_account` AS `oa`
...
...
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