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
9dc71acf
Commit
9dc71acf
authored
Dec 26, 2019
by
libin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
大屏统计调整
parent
b1cafa25
Changes
18
Hide whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
568 additions
and
368 deletions
+568
-368
UserProfileDisplay.java
...hub/wxiaoqi/security/admin/entity/UserProfileDisplay.java
+1
-1
UserProfileDisplayBiz.java
...hub/wxiaoqi/security/admin/biz/UserProfileDisplayBiz.java
+3
-3
UserProfileDisplayMapper.java
...iaoqi/security/admin/mapper/UserProfileDisplayMapper.java
+2
-2
LargeScreenDisplayUserController.java
...security/admin/rest/LargeScreenDisplayUserController.java
+35
-0
UserProfileDisplayMapper.xml
...in/src/main/resources/mapper/UserProfileDisplayMapper.xml
+2
-2
LargeScreenDisplayConstantDataBo.java
...c/platform/order/bo/LargeScreenDisplayConstantDataBo.java
+0
-15
OrderProfileDisplay.java
...a/com/xxfc/platform/order/entity/OrderProfileDisplay.java
+1
-1
UserProfileDisplayVo.java
...com/xxfc/platform/order/pojo/vo/UserProfileDisplayVo.java
+1
-1
OrderProfileDisplayBiz.java
...a/com/xxfc/platform/order/biz/OrderProfileDisplayBiz.java
+316
-310
LargeScreenDisplayController.java
...xfc/platform/order/rest/LargeScreenDisplayController.java
+2
-26
VehicleProfileDisplay.java
...m/xxfc/platform/vehicle/entity/VehicleProfileDisplay.java
+1
-1
LargeScreenDisplayCCTConstantDataBo.java
.../vehicle/pojo/bo/LargeScreenDisplayCCTConstantDataBo.java
+32
-0
LargeScreenDisplayBaseDataVo.java
...latform/vehicle/pojo/vo/LargeScreenDisplayBaseDataVo.java
+32
-0
VehicleProfileDisplayVo.java
...xfc/platform/vehicle/pojo/vo/VehicleProfileDisplayVo.java
+2
-2
VehicleProfileDisplayBiz.java
...m/xxfc/platform/vehicle/biz/VehicleProfileDisplayBiz.java
+100
-0
VehicleProfileDisplayMapper.java
.../platform/vehicle/mapper/VehicleProfileDisplayMapper.java
+2
-2
LargeScreenDisplayCCTVehicleController.java
.../vehicle/rest/LargeScreenDisplayCCTVehicleController.java
+34
-0
VehicleProfileDisplayMapper.xml
...src/main/resources/mapper/VehicleProfileDisplayMapper.xml
+2
-2
No files found.
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order
/entity/UserProfileDisplay.java
→
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin
/entity/UserProfileDisplay.java
View file @
9dc71acf
package
com
.
xxfc
.
platform
.
order
.
entity
;
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
entity
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.AllArgsConstructor
;
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order
/biz/UserProfileDisplayBiz.java
→
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin
/biz/UserProfileDisplayBiz.java
View file @
9dc71acf
package
com
.
xxfc
.
platform
.
order
.
biz
;
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
biz
;
import
com.github.wxiaoqi.security.admin.entity.UserProfileDisplay
;
import
com.github.wxiaoqi.security.admin.mapper.UserProfileDisplayMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.xxfc.platform.order.entity.UserProfileDisplay
;
import
com.xxfc.platform.order.mapper.UserProfileDisplayMapper
;
import
com.xxfc.platform.order.pojo.vo.UserProfileDisplayVo
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order
/mapper/UserProfileDisplayMapper.java
→
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin
/mapper/UserProfileDisplayMapper.java
View file @
9dc71acf
package
com
.
xxfc
.
platform
.
order
.
mapper
;
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
mapper
;
import
com.
xxfc.platform.order
.entity.UserProfileDisplay
;
import
com.
github.wxiaoqi.security.admin
.entity.UserProfileDisplay
;
import
tk.mybatis.mapper.common.Mapper
;
/**
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/LargeScreenDisplayUserController.java
0 → 100644
View file @
9dc71acf
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
rest
;
import
com.github.wxiaoqi.security.admin.biz.UserProfileDisplayBiz
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.order.pojo.vo.UserProfileDisplayVo
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/26 10:11
*/
@RestController
@RequestMapping
(
"/large_screen"
)
@RequiredArgsConstructor
(
onConstructor
=
@__
(
@Autowired
))
public
class
LargeScreenDisplayUserController
{
private
final
UserProfileDisplayBiz
userProfileDisplayBiz
;
/**
* 用户概况
*
* @return
*/
@GetMapping
(
"/user_profile_display"
)
public
ObjectRestResponse
<
UserProfileDisplayVo
>
findUserProfileData
()
{
UserProfileDisplayVo
userProfileDisplayVo
=
userProfileDisplayBiz
.
findUserProfileData
();
return
ObjectRestResponse
.
succ
(
userProfileDisplayVo
);
}
}
xx-order/xx-order-server
/src/main/resources/mapper/UserProfileDisplayMapper.xml
→
ace-modules/ace-admin
/src/main/resources/mapper/UserProfileDisplayMapper.xml
View file @
9dc71acf
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.
xxfc.platform.order
.mapper.UserProfileDisplayMapper"
>
<mapper
namespace=
"com.
github.wxiaoqi.security.admin
.mapper.UserProfileDisplayMapper"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.
xxfc.platform.order
.entity.UserProfileDisplay"
id=
"userProfileDisplayMap"
>
<resultMap
type=
"com.
github.wxiaoqi.security.admin
.entity.UserProfileDisplay"
id=
"userProfileDisplayMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"membersNum"
column=
"travel_num"
/>
<result
property=
"provinceCode"
column=
"province_code"
/>
...
...
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/bo/LargeScreenDisplayConstantDataBo.java
View file @
9dc71acf
package
com
.
xxfc
.
platform
.
order
.
bo
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
...
...
@@ -19,26 +18,12 @@ import java.math.BigDecimal;
@NoArgsConstructor
public
class
LargeScreenDisplayConstantDataBo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 公司数量
*/
private
int
companyNum
;
/**
* 营地数量
*/
private
int
campsiteNum
;
/**
* 旅游路线数量
*/
private
int
tourNum
;
/**
* 订单金额基础金额
*/
@JsonIgnore
private
BigDecimal
baseOrderAmount
=
BigDecimal
.
ZERO
;
/**
* 订单基础单量
*/
@JsonIgnore
private
int
baseOrderNum
;
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/entity/OrderProfileDisplay.java
View file @
9dc71acf
...
...
@@ -54,7 +54,7 @@ public class OrderProfileDisplay {
@Column
(
name
=
"pay_way"
)
private
Integer
payWay
;
/**
* 支付终端 1:app 2:ios
* 支付终端 1:app 2:
小程序 3:公众号 4:
ios
*/
@Column
(
name
=
"pay_terminal"
)
private
Integer
payTerminal
;
...
...
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/vo/UserProfileDisplayVo.java
View file @
9dc71acf
package
com
.
xxfc
.
platform
.
order
.
pojo
.
vo
;
import
com.
xxfc.platform.order
.entity.UserProfileDisplay
;
import
com.
github.wxiaoqi.security.admin
.entity.UserProfileDisplay
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderProfileDisplayBiz.java
View file @
9dc71acf
package
com
.
xxfc
.
platform
.
order
.
biz
;
package
com
.
xxfc
.
platform
.
order
.
biz
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.util.CollectorsUtil
;
import
com.xxfc.platform.order.bo.LargeScreenDisplayConstantDataBo
;
import
com.xxfc.platform.order.contant.enumerate.OrderTypeEnum
;
import
com.xxfc.platform.order.entity.OrderProfileDisplay
;
import
com.xxfc.platform.order.mapper.OrderProfileDisplayMapper
;
import
com.xxfc.platform.order.pojo.dto.BaseOrderDTO
;
import
com.xxfc.platform.order.pojo.vo.*
;
import
com.xxfc.platform.universal.entity.Dictionary
;
import
com.xxfc.platform.universal.feign.ThirdFeign
;
import
com.xxfc.platform.vehicle.entity.Area
;
import
com.xxfc.platform.vehicle.feign.VehicleFeign
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
cn.hutool.core.date.DateUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.util.CollectorsUtil
;
import
com.xxfc.platform.order.bo.LargeScreenDisplayConstantDataBo
;
import
com.xxfc.platform.order.contant.enumerate.OrderTypeEnum
;
import
com.xxfc.platform.order.entity.OrderProfileDisplay
;
import
com.xxfc.platform.order.mapper.OrderProfileDisplayMapper
;
import
com.xxfc.platform.order.pojo.dto.BaseOrderDTO
;
import
com.xxfc.platform.order.pojo.vo.*
;
import
com.xxfc.platform.universal.entity.Dictionary
;
import
com.xxfc.platform.universal.feign.ThirdFeign
;
import
com.xxfc.platform.vehicle.entity.Area
;
import
com.xxfc.platform.vehicle.feign.VehicleFeign
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.concurrent.CountDownLatch
;
import
java.util.function.Supplier
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.concurrent.CountDownLatch
;
import
java.util.function.Supplier
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/24 17:06
*/
@Slf4j
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Service
@RequiredArgsConstructor
(
onConstructor
=
@__
(
@Autowired
))
public
class
OrderProfileDisplayBiz
extends
BaseBiz
<
OrderProfileDisplayMapper
,
OrderProfileDisplay
>
{
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/24 17:06
* 字典查询type
*/
@Slf4j
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Service
@RequiredArgsConstructor
(
onConstructor
=
@__
(
@Autowired
))
public
class
OrderProfileDisplayBiz
extends
BaseBiz
<
OrderProfileDisplayMapper
,
OrderProfileDisplay
>
{
/**
* 字典查询type
*/
@Value
(
"large.screen.type:LARGE_SCREEN_DISPLAY"
)
private
String
largeScreenType
;
/**
* 字典查询code
*/
@Value
(
"large.screen.code:LARGE_SCREEN_DISPLAY_CONSTANT"
)
private
String
largeScreenCode
;
@Value
(
"large.screen.type:LARGE_SCREEN_DISPLAY"
)
private
String
largeScreenType
;
/**
* 字典查询code
*/
@Value
(
"large.screen.code:LARGE_SCREEN_DISPLAY_CONSTANT"
)
private
String
largeScreenCode
;
private
final
ThirdFeign
thirdFeign
;
private
final
VehicleFeign
vehicleFeign
;
private
final
BaseOrderBiz
baseOrderBiz
;
private
final
ThreadPoolTaskExecutor
executor
;
private
static
final
Integer
WX_PAY_STATE
=
1
;
private
static
final
Integer
ALI_PAY_STATE
=
2
;
private
static
final
Integer
APP_PAY_STATE
=
1
;
private
static
final
Integer
APPLET_PAY_STATE
=
2
;
private
static
final
Integer
WECHAT_OFFICIAL_ACCOUNT_PAY_STATE
=
3
;
private
static
final
Integer
IOS_PAY_STATE
=
4
;
private
final
ThirdFeign
thirdFeign
;
private
final
VehicleFeign
vehicleFeign
;
private
final
BaseOrderBiz
baseOrderBiz
;
private
final
ThreadPoolTaskExecutor
executor
;
private
static
final
Integer
WX_PAY_STATE
=
1
;
private
static
final
Integer
ALI_PAY_STATE
=
2
;
private
static
final
Integer
APP_PAY_STATE
=
1
;
private
static
final
Integer
APPLET_PAY_STATE
=
2
;
private
static
final
Integer
WECHAT_OFFICIAL_ACCOUNT_PAY_STATE
=
3
;
private
static
final
Integer
IOS_PAY_STATE
=
4
;
/**
* @param startDate 开始时间
* @param endDate 结束时间
* @return
*/
public
LargeScreenDisplayDataVo
findLargeScreenDisplayDataByDate
(
Date
startDate
,
Date
endDate
)
{
LargeScreenDisplayDataVo
largeScreenDisplayDataVo
=
new
LargeScreenDisplayDataVo
();
//创建订单常量数据对象
LargeScreenDisplayConstantDataBo
largeScreenDisplayConstantDataBo
=
new
LargeScreenDisplayConstantDataBo
();
//创建订单数据统计对象
OrderProfileDispayVo
orderProfileDispayVo
=
new
OrderProfileDispayVo
();
/**
* @param startDate 开始时间
* @param endDate 结束时间
* @return
*/
public
LargeScreenDisplayDataVo
findLargeScreenDisplayDataByDate
(
Date
startDate
,
Date
endDate
)
{
LargeScreenDisplayDataVo
largeScreenDisplayDataVo
=
new
LargeScreenDisplayDataVo
();
//创建订单常量数据对象
LargeScreenDisplayConstantDataBo
largeScreenDisplayConstantDataBo
=
new
LargeScreenDisplayConstantDataBo
();
//创建订单数据统计对象
OrderProfileDispayVo
orderProfileDispayVo
=
new
OrderProfileDispayVo
();
//1.查询基础常量数据
Dictionary
largeScreenConstantDictionary
=
thirdFeign
.
findDictionaryByTypeAndCode
(
largeScreenType
,
largeScreenCode
);
if
(
Objects
.
nonNull
(
largeScreenConstantDictionary
)
&&
StringUtils
.
hasText
(
largeScreenConstantDictionary
.
getDetail
()))
{
largeScreenDisplayConstantDataBo
=
JSON
.
parseObject
(
largeScreenConstantDictionary
.
getDetail
(),
LargeScreenDisplayConstantDataBo
.
class
);
}
//1.查询基础常量数据
Dictionary
largeScreenConstantDictionary
=
thirdFeign
.
findDictionaryByTypeAndCode
(
largeScreenType
,
largeScreenCode
);
if
(
Objects
.
nonNull
(
largeScreenConstantDictionary
)
&&
StringUtils
.
hasText
(
largeScreenConstantDictionary
.
getDetail
()))
{
largeScreenDisplayConstantDataBo
=
JSON
.
parseObject
(
largeScreenConstantDictionary
.
getDetail
(),
LargeScreenDisplayConstantDataBo
.
class
);
}
//2.1查询订单数据
List
<
BaseOrderDTO
>
baseOrders
=
baseOrderBiz
.
findOrdersByDate
(
startDate
,
endDate
);
//2.2查询固定数据
List
<
OrderProfileDisplay
>
orderProfileDisplays
=
findOrderProfileDisplayDataByDate
(
startDate
,
endDate
);
//2.1查询订单数据
List
<
BaseOrderDTO
>
baseOrders
=
baseOrderBiz
.
findOrdersByDate
(
startDate
,
endDate
);
//2.2查询固定数据
List
<
OrderProfileDisplay
>
orderProfileDisplays
=
findOrderProfileDisplayDataByDate
(
startDate
,
endDate
);
//包装成基础订单
List
<
BaseOrderDTO
>
wrapBaseOrders
=
wrapToBaseOrder
(
orderProfileDisplays
);
wrapBaseOrders
.
addAll
(
baseOrders
);
//包装成基础订单
List
<
BaseOrderDTO
>
wrapBaseOrders
=
wrapToBaseOrder
(
orderProfileDisplays
);
wrapBaseOrders
.
addAll
(
baseOrders
);
Supplier
<
Stream
<
BaseOrderDTO
>>
orderSupplier
=
()
->
wrapBaseOrders
.
stream
();
CountDownLatch
latch
=
new
CountDownLatch
(
3
);
//3. 十大运营中心订单数据
executor
.
execute
(()
->
{
analyticStatisticsCenterOrder
(
orderSupplier
,
latch
,
orderProfileDispayVo
);
});
//4.总的订单数据
executor
.
execute
(()
->
{
analyticStatisticsOrderProfiles
(
orderSupplier
,
latch
,
orderProfileDispayVo
);
});
//5.支付方式|支付终端数据处理
executor
.
execute
(()
->
{
analyticStatisticsOrderPayWayProfiles
(
orderSupplier
,
latch
,
orderProfileDispayVo
);
});
Supplier
<
Stream
<
BaseOrderDTO
>>
orderSupplier
=
()
->
wrapBaseOrders
.
stream
();
CountDownLatch
latch
=
new
CountDownLatch
(
3
);
//3. 十大运营中心订单数据
executor
.
execute
(()
->
{
try
{
latch
.
await
();
}
catch
(
InterruptedException
e
)
{
log
.
error
(
"统计出错:【{}】"
,
e
);
analyticStatisticsCenterOrder
(
orderSupplier
,
orderProfileDispayVo
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"十大运营中心订单统计失败【{}】"
,
ex
);
}
finally
{
latch
.
countDown
();
}
//6.基础金额 + 真实金额 基础订单量+真实订单量
long
totalOrderNum
=
orderProfileDispayVo
.
getOrderNum
()
+
largeScreenDisplayConstantDataBo
.
getBaseOrderNum
();
BigDecimal
totalOrderAmount
=
orderProfileDispayVo
.
getOrderAmount
().
add
(
largeScreenDisplayConstantDataBo
.
getBaseOrderAmount
());
orderProfileDispayVo
.
setOrderNum
(
totalOrderNum
);
orderProfileDispayVo
.
setOrderAmount
(
totalOrderAmount
);
largeScreenDisplayDataVo
.
setLargeScreenDisplayConstantData
(
largeScreenDisplayConstantDataBo
);
largeScreenDisplayDataVo
.
setOrderProfileDispayData
(
orderProfileDispayVo
);
return
largeScreenDisplayDataVo
;
});
//4.总的订单数据
executor
.
execute
(()
->
{
try
{
analyticStatisticsOrderProfiles
(
orderSupplier
,
orderProfileDispayVo
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"总订单数据解析失败【{}】"
,
ex
);
}
finally
{
latch
.
countDown
();
}
});
//5.支付方式|支付终端数据处理
executor
.
execute
(()
->
{
try
{
analyticStatisticsOrderPayWayProfiles
(
orderSupplier
,
orderProfileDispayVo
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"支付方式|支付终端数据处理失败【{}】"
,
ex
);
}
finally
{
latch
.
countDown
();
}
});
try
{
latch
.
await
();
}
catch
(
InterruptedException
e
)
{
log
.
error
(
"统计出错:【{}】"
,
e
);
}
//6.基础金额 + 真实金额 基础订单量+真实订单量
long
totalOrderNum
=
orderProfileDispayVo
.
getOrderNum
()
+
largeScreenDisplayConstantDataBo
.
getBaseOrderNum
();
BigDecimal
totalOrderAmount
=
orderProfileDispayVo
.
getOrderAmount
().
add
(
largeScreenDisplayConstantDataBo
.
getBaseOrderAmount
());
/**
* 支付方式|终端的统计
*
* @param orderSuppiler
* @param latch
* @param orderProfileDispayVo
* @return
*/
private
OrderProfileDispayVo
analyticStatisticsOrderPayWayProfiles
(
Supplier
<
Stream
<
BaseOrderDTO
>>
orderSuppiler
,
CountDownLatch
latch
,
OrderProfileDispayVo
orderProfileDispayVo
)
{
OrderPayProfileDispalyVo
orderPayProfileDispalyVo
=
new
OrderPayProfileDispalyVo
();
//1.支付方式统计
wrapToPayProfileWithPayWay
(
orderSuppiler
,
orderPayProfileDispalyVo
);
//2.支付终端统计
wrapToPayProfileWithPayTerminal
(
orderSuppiler
,
orderPayProfileDispalyVo
);
orderProfileDispayVo
.
setOrderNum
(
totalOrderNum
);
orderProfileDispayVo
.
setOrderAmount
(
totalOrderAmount
);
largeScreenDisplayDataVo
.
setLargeScreenDisplayConstantData
(
largeScreenDisplayConstantDataBo
);
largeScreenDisplayDataVo
.
setOrderProfileDispayData
(
orderProfileDispayVo
);
return
largeScreenDisplayDataVo
;
}
orderProfileDispayVo
.
setOrderPayProfileDisplay
(
orderPayProfileDispalyVo
);
latch
.
countDown
();
return
orderProfileDispayVo
;
}
/**
* 支付方式|终端的统计
*
* @param orderSuppiler
* @param orderProfileDispayVo
* @return
*/
private
OrderProfileDispayVo
analyticStatisticsOrderPayWayProfiles
(
Supplier
<
Stream
<
BaseOrderDTO
>>
orderSuppiler
,
OrderProfileDispayVo
orderProfileDispayVo
)
{
OrderPayProfileDispalyVo
orderPayProfileDispalyVo
=
new
OrderPayProfileDispalyVo
();
//1.支付方式统计
wrapToPayProfileWithPayWay
(
orderSuppiler
,
orderPayProfileDispalyVo
);
//2.支付终端统计
wrapToPayProfileWithPayTerminal
(
orderSuppiler
,
orderPayProfileDispalyVo
);
/**
* 支付方式统计
*
* @param orderSupplier
* @param orderPayProfileDispalyVo
* @return
*/
private
OrderPayProfileDispalyVo
wrapToPayProfileWithPayWay
(
Supplier
<
Stream
<
BaseOrderDTO
>>
orderSupplier
,
OrderPayProfileDispalyVo
orderPayProfileDispalyVo
)
{
Map
<
Integer
,
BigDecimal
>
payWayMap
=
orderSupplier
.
get
().
collect
(
Collectors
.
groupingBy
(
BaseOrderDTO:
:
getPayWay
,
CollectorsUtil
.
summingBigDecimal
(
BaseOrderDTO:
:
getRealAmount
)));
boolean
isNull
=
payWayMap
==
null
;
BigDecimal
wxPayAmount
=
isNull
?
BigDecimal
.
ZERO
:
payWayMap
.
get
(
WX_PAY_STATE
)
==
null
?
BigDecimal
.
ZERO
:
payWayMap
.
get
(
WX_PAY_STATE
);
BigDecimal
aliPayAmount
=
isNull
?
BigDecimal
.
ZERO
:
payWayMap
.
get
(
ALI_PAY_STATE
)
==
null
?
BigDecimal
.
ZERO
:
payWayMap
.
get
(
ALI_PAY_STATE
);
orderPayProfileDispalyVo
.
setWxPayAmount
(
wxPayAmount
);
orderPayProfileDispalyVo
.
setAliPayAmount
(
aliPayAmount
);
return
orderPayProfileDispalyVo
;
}
orderProfileDispayVo
.
setOrderPayProfileDisplay
(
orderPayProfileDispalyVo
);
return
orderProfileDispayVo
;
}
/**
* 支付终端统计
*
* @param orderSupplier
* @param orderPayProfileDispalyVo
* @return
*/
private
OrderPayProfileDispalyVo
wrapToPayProfileWithPayTerminal
(
Supplier
<
Stream
<
BaseOrderDTO
>>
orderSupplier
,
OrderPayProfileDispalyVo
orderPayProfileDispalyVo
)
{
Map
<
Integer
,
BigDecimal
>
payTerminalMap
=
orderSupplier
.
get
().
collect
(
Collectors
.
groupingBy
(
BaseOrderDTO:
:
getPayOrigin
,
CollectorsUtil
.
summingBigDecimal
(
BaseOrderDTO:
:
getRealAmount
)));
boolean
isNull
=
payTerminalMap
==
null
;
BigDecimal
appPayAmount
=
isNull
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
APP_PAY_STATE
)
==
null
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
APP_PAY_STATE
);
BigDecimal
appletPayAmount
=
isNull
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
APPLET_PAY_STATE
)
==
null
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
APPLET_PAY_STATE
);
BigDecimal
weChatOfficialAccountPayAmount
=
isNull
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
WECHAT_OFFICIAL_ACCOUNT_PAY_STATE
)
==
null
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
WECHAT_OFFICIAL_ACCOUNT_PAY_STATE
);
BigDecimal
iosPayAmount
=
isNull
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
IOS_PAY_STATE
)
==
null
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
IOS_PAY_STATE
);
/**
* 支付方式统计
*
* @param orderSupplier
* @param orderPayProfileDispalyVo
* @return
*/
private
OrderPayProfileDispalyVo
wrapToPayProfileWithPayWay
(
Supplier
<
Stream
<
BaseOrderDTO
>>
orderSupplier
,
OrderPayProfileDispalyVo
orderPayProfileDispalyVo
)
{
Map
<
Integer
,
BigDecimal
>
payWayMap
=
orderSupplier
.
get
().
collect
(
Collectors
.
groupingBy
(
BaseOrderDTO:
:
getPayWay
,
CollectorsUtil
.
summingBigDecimal
(
BaseOrderDTO:
:
getRealAmount
)));
boolean
isNull
=
payWayMap
==
null
;
BigDecimal
wxPayAmount
=
isNull
?
BigDecimal
.
ZERO
:
payWayMap
.
get
(
WX_PAY_STATE
)
==
null
?
BigDecimal
.
ZERO
:
payWayMap
.
get
(
WX_PAY_STATE
);
BigDecimal
aliPayAmount
=
isNull
?
BigDecimal
.
ZERO
:
payWayMap
.
get
(
ALI_PAY_STATE
)
==
null
?
BigDecimal
.
ZERO
:
payWayMap
.
get
(
ALI_PAY_STATE
);
orderPayProfileDispalyVo
.
setWxPayAmount
(
wxPayAmount
);
orderPayProfileDispalyVo
.
setAliPayAmount
(
aliPayAmount
);
return
orderPayProfileDispalyVo
;
}
orderPayProfileDispalyVo
.
setAppletPayAmount
(
appPayAmount
);
orderPayProfileDispalyVo
.
setAppletPayAmount
(
appletPayAmount
);
orderPayProfileDispalyVo
.
setWeChatOfficialAccountPayAmount
(
weChatOfficialAccountPayAmount
);
orderPayProfileDispalyVo
.
setIosPayAmount
(
iosPayAmount
);
return
orderPayProfileDispalyVo
;
}
/**
* 支付终端统计
*
* @param orderSupplier
* @param orderPayProfileDispalyVo
* @return
*/
private
OrderPayProfileDispalyVo
wrapToPayProfileWithPayTerminal
(
Supplier
<
Stream
<
BaseOrderDTO
>>
orderSupplier
,
OrderPayProfileDispalyVo
orderPayProfileDispalyVo
)
{
Map
<
Integer
,
BigDecimal
>
payTerminalMap
=
orderSupplier
.
get
().
collect
(
Collectors
.
groupingBy
(
BaseOrderDTO:
:
getPayOrigin
,
CollectorsUtil
.
summingBigDecimal
(
BaseOrderDTO:
:
getRealAmount
)));
boolean
isNull
=
payTerminalMap
==
null
;
BigDecimal
appPayAmount
=
isNull
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
APP_PAY_STATE
)
==
null
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
APP_PAY_STATE
);
BigDecimal
appletPayAmount
=
isNull
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
APPLET_PAY_STATE
)
==
null
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
APPLET_PAY_STATE
);
BigDecimal
weChatOfficialAccountPayAmount
=
isNull
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
WECHAT_OFFICIAL_ACCOUNT_PAY_STATE
)
==
null
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
WECHAT_OFFICIAL_ACCOUNT_PAY_STATE
);
BigDecimal
iosPayAmount
=
isNull
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
IOS_PAY_STATE
)
==
null
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
IOS_PAY_STATE
);
/**
* 订单统计解析
*
* @param
* @param latch
* @param orderProfileDispayVo
* @return
*/
private
OrderProfileDispayVo
analyticStatisticsOrderProfiles
(
Supplier
<
Stream
<
BaseOrderDTO
>>
orderSuppiler
,
CountDownLatch
latch
,
OrderProfileDispayVo
orderProfileDispayVo
)
{
orderPayProfileDispalyVo
.
setAppletPayAmount
(
appPayAmount
);
orderPayProfileDispalyVo
.
setAppletPayAmount
(
appletPayAmount
);
orderPayProfileDispalyVo
.
setWeChatOfficialAccountPayAmount
(
weChatOfficialAccountPayAmount
);
orderPayProfileDispalyVo
.
setIosPayAmount
(
iosPayAmount
);
return
orderPayProfileDispalyVo
;
}
//1.真实数据按时间分组
Map
<
Date
,
BigDecimal
>
orderAmountMap
=
orderSuppiler
.
get
().
collect
(
Collectors
.
groupingBy
(
BaseOrderDTO:
:
getPayDate
,
CollectorsUtil
.
summingBigDecimal
(
BaseOrderDTO:
:
getRealAmount
)));
//2.某个时间段的订单统计
//2.1 订单金额
List
<
OrderProfileVo
>
orderProfileVos
=
createOrderProfiles
(
orderAmountMap
);
//2.2 订单量
wrapBaseDateToOrderProfileDispay
(
orderSuppiler
,
orderProfileDispayVo
);
//3.今日金额
Date
date
=
DateUtil
.
beginOfDay
(
new
Date
()).
toJdkDate
();
BigDecimal
todayOrderAmount
=
orderAmountMap
==
null
?
BigDecimal
.
ZERO
:
orderAmountMap
.
get
(
date
)
==
null
?
BigDecimal
.
ZERO
:
orderAmountMap
.
get
(
date
);
orderProfileDispayVo
.
setTodayOrderAmount
(
todayOrderAmount
);
orderProfileDispayVo
.
setOrderProfiles
(
orderProfileVos
);
latch
.
countDown
();
return
orderProfileDispayVo
;
}
/**
* 订单统计解析
*
* @param
* @param orderProfileDispayVo
* @return
*/
private
OrderProfileDispayVo
analyticStatisticsOrderProfiles
(
Supplier
<
Stream
<
BaseOrderDTO
>>
orderSuppiler
,
OrderProfileDispayVo
orderProfileDispayVo
)
{
//1.真实数据按时间分组
Map
<
Date
,
BigDecimal
>
orderAmountMap
=
orderSuppiler
.
get
().
collect
(
Collectors
.
groupingBy
(
BaseOrderDTO:
:
getPayDate
,
CollectorsUtil
.
summingBigDecimal
(
BaseOrderDTO:
:
getRealAmount
)));
//2.某个时间段的订单统计
//2.1 订单金额
List
<
OrderProfileVo
>
orderProfileVos
=
createOrderProfiles
(
orderAmountMap
);
//2.2 订单量
wrapBaseDateToOrderProfileDispay
(
orderSuppiler
,
orderProfileDispayVo
);
//3.今日金额
Date
date
=
DateUtil
.
beginOfDay
(
new
Date
()).
toJdkDate
();
BigDecimal
todayOrderAmount
=
orderAmountMap
==
null
?
BigDecimal
.
ZERO
:
orderAmountMap
.
get
(
date
)
==
null
?
BigDecimal
.
ZERO
:
orderAmountMap
.
get
(
date
);
orderProfileDispayVo
.
setTodayOrderAmount
(
todayOrderAmount
);
orderProfileDispayVo
.
setOrderProfiles
(
orderProfileVos
);
return
orderProfileDispayVo
;
}
/**
* 包装基础数据 订单金额 与订单量
*
* @param orderSuppiler
* @param orderProfileDispayVo
* @return
*/
private
OrderProfileDispayVo
wrapBaseDateToOrderProfileDispay
(
Supplier
<
Stream
<
BaseOrderDTO
>>
orderSuppiler
,
OrderProfileDispayVo
orderProfileDispayVo
)
{
Map
<
Date
,
Long
>
orderNumMap
=
orderSuppiler
.
get
().
collect
(
Collectors
.
groupingBy
(
BaseOrderDTO:
:
getPayDate
,
Collectors
.
counting
()));
if
(
orderNumMap
==
null
||
orderNumMap
.
isEmpty
())
{
return
orderProfileDispayVo
;
}
Date
date
=
DateUtil
.
beginOfDay
(
new
Date
()).
toJdkDate
();
//今日订单量
long
todayOrderNum
=
orderNumMap
.
get
(
date
)
==
null
?
0
:
orderNumMap
.
get
(
date
);
Set
<
Map
.
Entry
<
Date
,
Long
>>
orderNumEntrySet
=
orderNumMap
.
entrySet
();
Iterator
<
Map
.
Entry
<
Date
,
Long
>>
orderNumIterator
=
orderNumEntrySet
.
iterator
();
//总订单量累计
long
totalOrderNum
=
0
;
while
(
orderNumIterator
.
hasNext
())
{
Map
.
Entry
<
Date
,
Long
>
orderNumMapEntry
=
orderNumIterator
.
next
();
totalOrderNum
=
+
orderNumMapEntry
.
getValue
();
}
orderProfileDispayVo
.
setOrderNum
(
totalOrderNum
);
orderProfileDispayVo
.
setTodayOrderNum
(
todayOrderNum
);
/**
* 包装基础数据 订单金额 与订单量
*
* @param orderSuppiler
* @param orderProfileDispayVo
* @return
*/
private
OrderProfileDispayVo
wrapBaseDateToOrderProfileDispay
(
Supplier
<
Stream
<
BaseOrderDTO
>>
orderSuppiler
,
OrderProfileDispayVo
orderProfileDispayVo
)
{
Map
<
Date
,
Long
>
orderNumMap
=
orderSuppiler
.
get
().
collect
(
Collectors
.
groupingBy
(
BaseOrderDTO:
:
getPayDate
,
Collectors
.
counting
()));
if
(
orderNumMap
==
null
||
orderNumMap
.
isEmpty
())
{
return
orderProfileDispayVo
;
}
Date
date
=
DateUtil
.
beginOfDay
(
new
Date
()).
toJdkDate
();
//今日订单量
long
todayOrderNum
=
orderNumMap
.
get
(
date
)
==
null
?
0
:
orderNumMap
.
get
(
date
);
Set
<
Map
.
Entry
<
Date
,
Long
>>
orderNumEntrySet
=
orderNumMap
.
entrySet
();
Iterator
<
Map
.
Entry
<
Date
,
Long
>>
orderNumIterator
=
orderNumEntrySet
.
iterator
();
//总订单量累计
long
totalOrderNum
=
0
;
while
(
orderNumIterator
.
hasNext
())
{
Map
.
Entry
<
Date
,
Long
>
orderNumMapEntry
=
orderNumIterator
.
next
();
totalOrderNum
=
+
orderNumMapEntry
.
getValue
();
}
orderProfileDispayVo
.
setOrderNum
(
totalOrderNum
);
orderProfileDispayVo
.
setTodayOrderNum
(
todayOrderNum
);
return
orderProfileDispayVo
;
}
/**
* 组装对象
*
* @param orderAmountMap
* @return
*/
private
List
<
OrderProfileVo
>
createOrderProfiles
(
Map
<
Date
,
BigDecimal
>
orderAmountMap
)
{
List
<
OrderProfileVo
>
orderProfileVos
=
new
ArrayList
<>();
if
(
orderAmountMap
==
null
||
orderAmountMap
.
isEmpty
())
{
return
orderProfileVos
;
}
Set
<
Map
.
Entry
<
Date
,
BigDecimal
>>
orderAmountEntrySet
=
orderAmountMap
.
entrySet
();
Iterator
<
Map
.
Entry
<
Date
,
BigDecimal
>>
orderAmountIterator
=
orderAmountEntrySet
.
iterator
();
OrderProfileVo
orderProfileVo
;
while
(
orderAmountIterator
.
hasNext
())
{
Map
.
Entry
<
Date
,
BigDecimal
>
orderAmountMapEntry
=
orderAmountIterator
.
next
();
orderProfileVo
=
new
OrderProfileVo
();
orderProfileVo
.
setOrderDate
(
orderAmountMapEntry
.
getKey
());
orderProfileVo
.
setOrderAmount
(
orderAmountMapEntry
.
getValue
());
orderProfileVos
.
add
(
orderProfileVo
);
}
/**
* 组装对象
*
* @param orderAmountMap
* @return
*/
private
List
<
OrderProfileVo
>
createOrderProfiles
(
Map
<
Date
,
BigDecimal
>
orderAmountMap
)
{
List
<
OrderProfileVo
>
orderProfileVos
=
new
ArrayList
<>();
if
(
orderAmountMap
==
null
||
orderAmountMap
.
isEmpty
())
{
return
orderProfileVos
;
}
Set
<
Map
.
Entry
<
Date
,
BigDecimal
>>
orderAmountEntrySet
=
orderAmountMap
.
entrySet
();
Iterator
<
Map
.
Entry
<
Date
,
BigDecimal
>>
orderAmountIterator
=
orderAmountEntrySet
.
iterator
();
OrderProfileVo
orderProfileVo
;
while
(
orderAmountIterator
.
hasNext
())
{
Map
.
Entry
<
Date
,
BigDecimal
>
orderAmountMapEntry
=
orderAmountIterator
.
next
();
orderProfileVo
=
new
OrderProfileVo
();
orderProfileVo
.
setOrderDate
(
orderAmountMapEntry
.
getKey
());
orderProfileVo
.
setOrderAmount
(
orderAmountMapEntry
.
getValue
());
orderProfileVos
.
add
(
orderProfileVo
);
}
return
orderProfileVos
;
}
/**
* 运营中心订单统计
*
* @param orderSuppiler
* @param latch
* @param orderProfileDispayVo
* @return
*/
private
OrderProfileDispayVo
analyticStatisticsCenterOrder
(
Supplier
<
Stream
<
BaseOrderDTO
>>
orderSuppiler
,
CountDownLatch
latch
,
OrderProfileDispayVo
orderProfileDispayVo
)
{
//筛选出租车订单
Map
<
Integer
,
BigDecimal
>
areaAmountMap
=
orderSuppiler
.
get
().
filter
(
x
->
Objects
.
equals
(
x
.
getType
(),
OrderTypeEnum
.
RENT_VEHICLE
.
getCode
()))
.
collect
(
Collectors
.
groupingBy
(
BaseOrderDTO:
:
getAreaId
,
CollectorsUtil
.
summingBigDecimal
(
BaseOrderDTO:
:
getRealAmount
)));
/**
* 运营中心订单统计
*
* @param orderSuppiler
* @param orderProfileDispayVo
* @return
*/
private
OrderProfileDispayVo
analyticStatisticsCenterOrder
(
Supplier
<
Stream
<
BaseOrderDTO
>>
orderSuppiler
,
OrderProfileDispayVo
orderProfileDispayVo
)
{
//筛选出租车订单
Map
<
Integer
,
BigDecimal
>
areaAmountMap
=
orderSuppiler
.
get
().
filter
(
x
->
Objects
.
equals
(
x
.
getType
(),
OrderTypeEnum
.
RENT_VEHICLE
.
getCode
()))
.
collect
(
Collectors
.
groupingBy
(
BaseOrderDTO:
:
getAreaId
,
CollectorsUtil
.
summingBigDecimal
(
BaseOrderDTO:
:
getRealAmount
)));
List
<
CenterOrderProfileDisplayVo
>
centerOrderProfileDisplayVos
=
createCenterOrderProfileDisplay
(
areaAmountMap
);
orderProfileDispayVo
.
setCenterOrderProfileDisplays
(
centerOrderProfileDisplayVos
);
latch
.
countDown
();
return
orderProfileDispayVo
;
}
List
<
CenterOrderProfileDisplayVo
>
centerOrderProfileDisplayVos
=
createCenterOrderProfileDisplay
(
areaAmountMap
);
orderProfileDispayVo
.
setCenterOrderProfileDisplays
(
centerOrderProfileDisplayVos
);
return
orderProfileDispayVo
;
}
/**
* 区域统计处理
*
* @param areaAmountMap
* @return
*/
private
List
<
CenterOrderProfileDisplayVo
>
createCenterOrderProfileDisplay
(
Map
<
Integer
,
BigDecimal
>
areaAmountMap
)
{
List
<
CenterOrderProfileDisplayVo
>
centerOrderProfileDisplayVos
=
new
ArrayList
<>();
//查询全部区域
List
<
Area
>
areas
=
vehicleFeign
.
findAllAreas
();
if
(
CollectionUtils
.
isEmpty
(
areas
))
{
return
centerOrderProfileDisplayVos
;
}
CenterOrderProfileDisplayVo
centerOrderProfileDisplayVo
;
//区域统计组装
for
(
Area
area
:
areas
)
{
centerOrderProfileDisplayVo
=
new
CenterOrderProfileDisplayVo
();
Integer
areaId
=
area
.
getId
();
BigDecimal
areaAmount
=
areaAmountMap
==
null
?
BigDecimal
.
ZERO
:
areaAmountMap
.
get
(
areaId
)
==
null
?
BigDecimal
.
ZERO
:
areaAmountMap
.
get
(
areaId
);
centerOrderProfileDisplayVo
.
setAreaId
(
areaId
);
centerOrderProfileDisplayVo
.
setAreaName
(
area
.
getName
());
centerOrderProfileDisplayVo
.
setOrderAmount
(
areaAmount
);
centerOrderProfileDisplayVos
.
add
(
centerOrderProfileDisplayVo
);
}
/**
* 区域统计处理
*
* @param areaAmountMap
* @return
*/
private
List
<
CenterOrderProfileDisplayVo
>
createCenterOrderProfileDisplay
(
Map
<
Integer
,
BigDecimal
>
areaAmountMap
)
{
List
<
CenterOrderProfileDisplayVo
>
centerOrderProfileDisplayVos
=
new
ArrayList
<>();
//查询全部区域
List
<
Area
>
areas
=
vehicleFeign
.
findAllAreas
();
if
(
CollectionUtils
.
isEmpty
(
areas
))
{
return
centerOrderProfileDisplayVos
;
}
/**
* 包装成baseOrder
*
* @param orderProfileDisplays
* @return
*/
private
List
<
BaseOrderDTO
>
wrapToBaseOrder
(
List
<
OrderProfileDisplay
>
orderProfileDisplays
)
{
List
<
BaseOrderDTO
>
baseOrderDTOS
=
orderProfileDisplays
.
stream
().
map
(
x
->
{
BaseOrderDTO
baseOrderDTO
=
new
BaseOrderDTO
();
baseOrderDTO
.
setPayOrigin
(
x
.
getPayTerminal
());
baseOrderDTO
.
setPayWay
(
x
.
getPayWay
());
baseOrderDTO
.
setRealAmount
(
x
.
getOrderAmount
());
baseOrderDTO
.
setOrderNum
(
x
.
getOrderNum
());
baseOrderDTO
.
setAreaId
(
x
.
getAreaId
());
return
baseOrderDTO
;
}).
collect
(
Collectors
.
toList
());
return
CollectionUtils
.
isEmpty
(
baseOrderDTOS
)
?
new
ArrayList
<>()
:
baseOrderDTOS
;
CenterOrderProfileDisplayVo
centerOrderProfileDisplayVo
;
//区域统计组装
for
(
Area
area
:
areas
)
{
centerOrderProfileDisplayVo
=
new
CenterOrderProfileDisplayVo
();
Integer
areaId
=
area
.
getId
();
BigDecimal
areaAmount
=
areaAmountMap
==
null
?
BigDecimal
.
ZERO
:
areaAmountMap
.
get
(
areaId
)
==
null
?
BigDecimal
.
ZERO
:
areaAmountMap
.
get
(
areaId
);
centerOrderProfileDisplayVo
.
setAreaId
(
areaId
);
centerOrderProfileDisplayVo
.
setAreaName
(
area
.
getName
());
centerOrderProfileDisplayVo
.
setOrderAmount
(
areaAmount
);
centerOrderProfileDisplayVos
.
add
(
centerOrderProfileDisplayVo
);
}
return
centerOrderProfileDisplayVos
;
}
/**
* 包装成baseOrder
*
* @param orderProfileDisplays
* @return
*/
private
List
<
BaseOrderDTO
>
wrapToBaseOrder
(
List
<
OrderProfileDisplay
>
orderProfileDisplays
)
{
List
<
BaseOrderDTO
>
baseOrderDTOS
=
orderProfileDisplays
.
stream
().
map
(
x
->
{
BaseOrderDTO
baseOrderDTO
=
new
BaseOrderDTO
();
baseOrderDTO
.
setPayOrigin
(
x
.
getPayTerminal
());
baseOrderDTO
.
setPayWay
(
x
.
getPayWay
());
baseOrderDTO
.
setRealAmount
(
x
.
getOrderAmount
());
baseOrderDTO
.
setOrderNum
(
x
.
getOrderNum
());
baseOrderDTO
.
setAreaId
(
x
.
getAreaId
());
return
baseOrderDTO
;
}).
collect
(
Collectors
.
toList
());
return
CollectionUtils
.
isEmpty
(
baseOrderDTOS
)
?
new
ArrayList
<>()
:
baseOrderDTOS
;
}
/**
* 根据开始时间与结束时间查询
*
* @param startDate
* @param end
Date
* @return
*/
public
List
<
OrderProfileDisplay
>
findOrderProfileDisplayDataByDate
(
Date
startDate
,
Date
endDate
)
{
List
<
OrderProfileDisplay
>
orderProfileDisplays
=
mapper
.
findOrderProfileDisplayDatabyDate
(
startDate
,
endDate
);
return
CollectionUtils
.
isEmpty
(
orderProfileDisplays
)
?
Collections
.
emptyList
()
:
orderProfileDisplays
;
}
/**
* 根据开始时间与结束时间查询
*
* @param start
Date
* @param endDate
* @return
*/
public
List
<
OrderProfileDisplay
>
findOrderProfileDisplayDataByDate
(
Date
startDate
,
Date
endDate
)
{
List
<
OrderProfileDisplay
>
orderProfileDisplays
=
mapper
.
findOrderProfileDisplayDatabyDate
(
startDate
,
endDate
)
;
return
CollectionUtils
.
isEmpty
(
orderProfileDisplays
)
?
Collections
.
emptyList
()
:
orderProfileDisplays
;
}
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/LargeScreenDisplayController.java
View file @
9dc71acf
...
...
@@ -2,11 +2,8 @@ package com.xxfc.platform.order.rest;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.order.biz.OrderProfileDisplayBiz
;
import
com.xxfc.platform.order.biz.UserProfileDisplayBiz
;
import
com.xxfc.platform.order.biz.VehicleProfileDisplayBiz
;
import
com.xxfc.platform.order.pojo.vo.LargeScreenDisplayDataVo
;
import
com.xxfc.platform.order.pojo.vo.UserProfileDisplayVo
;
import
com.xxfc.platform.order.pojo.vo.VehicleProfileDisplayVo
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -26,31 +23,10 @@ import java.util.Date;
@RequestMapping
(
"/large_screen"
)
@RequiredArgsConstructor
(
onConstructor
=
@__
(
@Autowired
))
public
class
LargeScreenDisplayController
{
private
final
VehicleProfileDisplayBiz
vehicleProfileDisplayBiz
;
private
final
UserProfileDisplayBiz
userProfileDisplayBiz
;
private
final
OrderProfileDisplayBiz
orderProfileDisplayBiz
;
/**
* 车辆概况
*
* @return
*/
@GetMapping
(
"/vehicle_profile_display"
)
public
ObjectRestResponse
<
VehicleProfileDisplayVo
>
findLargeScreenDisplayData
()
{
VehicleProfileDisplayVo
vehicleProfileDisplayVo
=
vehicleProfileDisplayBiz
.
findVehicleProfileDisplayData
();
return
ObjectRestResponse
.
succ
(
vehicleProfileDisplayVo
);
}
/**
* 用户概况
*
* @return
*/
@GetMapping
(
"/user_profile_display"
)
public
ObjectRestResponse
<
UserProfileDisplayVo
>
findUserProfileData
()
{
UserProfileDisplayVo
userProfileDisplayVo
=
userProfileDisplayBiz
.
findUserProfileData
();
return
ObjectRestResponse
.
succ
(
userProfileDisplayVo
);
}
private
final
OrderProfileDisplayBiz
orderProfileDisplayBiz
;
/**
* 基础数据 与 订单概况
...
...
xx-
order/xx-order-api/src/main/java/com/xxfc/platform/order
/entity/VehicleProfileDisplay.java
→
xx-
vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle
/entity/VehicleProfileDisplay.java
View file @
9dc71acf
package
com
.
xxfc
.
platform
.
order
.
entity
;
package
com
.
xxfc
.
platform
.
vehicle
.
entity
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
...
...
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/bo/LargeScreenDisplayCCTConstantDataBo.java
0 → 100644
View file @
9dc71acf
package
com
.
xxfc
.
platform
.
vehicle
.
pojo
.
bo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/26 9:45
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
LargeScreenDisplayCCTConstantDataBo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 公司数量
*/
private
int
companyNum
;
/**
* 营地数量
*/
private
int
campsiteNum
;
/**
* 旅游路线数量
*/
private
int
tourNum
;
}
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/vo/LargeScreenDisplayBaseDataVo.java
0 → 100644
View file @
9dc71acf
package
com
.
xxfc
.
platform
.
vehicle
.
pojo
.
vo
;
import
com.xxfc.platform.vehicle.pojo.bo.LargeScreenDisplayCCTConstantDataBo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.Objects
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/26 8:44
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
LargeScreenDisplayBaseDataVo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
LargeScreenDisplayCCTConstantDataBo
largeScreenDisplayCCTConstantDataBo
;
private
VehicleProfileDisplayVo
vehicleProfileDisplayVo
;
public
LargeScreenDisplayCCTConstantDataBo
getLargeScreenDisplayCCTConstantDataBo
()
{
return
Objects
.
isNull
(
largeScreenDisplayCCTConstantDataBo
)?
new
LargeScreenDisplayCCTConstantDataBo
():
largeScreenDisplayCCTConstantDataBo
;
}
public
VehicleProfileDisplayVo
getVehicleProfileDisplayVo
()
{
return
Objects
.
isNull
(
vehicleProfileDisplayVo
)?
new
VehicleProfileDisplayVo
():
vehicleProfileDisplayVo
;
}
}
xx-
order/xx-order-api/src/main/java/com/xxfc/platform/order
/pojo/vo/VehicleProfileDisplayVo.java
→
xx-
vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle
/pojo/vo/VehicleProfileDisplayVo.java
View file @
9dc71acf
package
com
.
xxfc
.
platform
.
order
.
pojo
.
vo
;
package
com
.
xxfc
.
platform
.
vehicle
.
pojo
.
vo
;
import
com.xxfc.platform.
order
.entity.VehicleProfileDisplay
;
import
com.xxfc.platform.
vehicle
.entity.VehicleProfileDisplay
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
...
...
xx-
order/xx-order-server/src/main/java/com/xxfc/platform/order
/biz/VehicleProfileDisplayBiz.java
→
xx-
vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle
/biz/VehicleProfileDisplayBiz.java
View file @
9dc71acf
package
com
.
xxfc
.
platform
.
order
.
biz
;
package
com
.
xxfc
.
platform
.
vehicle
.
biz
;
import
com.alibaba.fastjson.JSON
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.xxfc.platform.order.entity.VehicleProfileDisplay
;
import
com.xxfc.platform.order.mapper.VehicleProfileDisplayMapper
;
import
com.xxfc.platform.order.pojo.vo.VehicleProfileDisplayVo
;
import
com.xxfc.platform.universal.entity.Dictionary
;
import
com.xxfc.platform.universal.feign.ThirdFeign
;
import
com.xxfc.platform.vehicle.entity.VehicleProfileDisplay
;
import
com.xxfc.platform.vehicle.mapper.VehicleProfileDisplayMapper
;
import
com.xxfc.platform.vehicle.pojo.bo.LargeScreenDisplayCCTConstantDataBo
;
import
com.xxfc.platform.vehicle.pojo.vo.LargeScreenDisplayBaseDataVo
;
import
com.xxfc.platform.vehicle.pojo.vo.VehicleProfileDisplayVo
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StringUtils
;
import
java.util.List
;
import
java.util.concurrent.CountDownLatch
;
/**
* @author libin
...
...
@@ -18,17 +28,51 @@ import java.util.List;
* @description
* @data 2019/12/24 17:06
*/
@Slf4j
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Service
@RequiredArgsConstructor
(
onConstructor
=
@__
(
@Autowired
))
public
class
VehicleProfileDisplayBiz
extends
BaseBiz
<
VehicleProfileDisplayMapper
,
VehicleProfileDisplay
>
{
/**
* 字典查询type
*/
@Value
(
"large.screen.type:LARGE_SCREEN_DISPLAY"
)
private
String
largeScreenType
;
/**
* 字典查询code
*/
@Value
(
"large.screen.cct.code:LARGE_SCREEN_DISPLAY_CCT_CONSTANT"
)
private
String
largeScreenCode
;
public
VehicleProfileDisplayVo
findVehicleProfileDisplayData
()
{
private
final
ThirdFeign
thirdFeign
;
private
final
ThreadPoolTaskExecutor
executor
;
public
LargeScreenDisplayBaseDataVo
findVehicleProfileDisplayData
()
{
LargeScreenDisplayBaseDataVo
largeScreenDisplayBaseDataVo
=
new
LargeScreenDisplayBaseDataVo
();
VehicleProfileDisplayVo
vehicleProfileDisplayVo
=
new
VehicleProfileDisplayVo
();
//1.查询全部固定数据
List
<
VehicleProfileDisplay
>
vehicleProfileDisplays
=
mapper
.
selectAll
();
CountDownLatch
latch
=
new
CountDownLatch
(
1
);
executor
.
execute
(()->{
try
{
Dictionary
dictionary
=
thirdFeign
.
findDictionaryByTypeAndCode
(
largeScreenType
,
largeScreenType
);
if
(
dictionary
!=
null
&&
StringUtils
.
hasText
(
dictionary
.
getDetail
()))
{
LargeScreenDisplayCCTConstantDataBo
largeScreenDisplayConstantDataBo
=
JSON
.
parseObject
(
dictionary
.
getDetail
(),
LargeScreenDisplayCCTConstantDataBo
.
class
);
largeScreenDisplayBaseDataVo
.
setLargeScreenDisplayCCTConstantDataBo
(
largeScreenDisplayConstantDataBo
);
}
}
catch
(
Exception
ex
){
log
.
error
(
"字典数据查询失败【{}】"
,
ex
);
}
finally
{
latch
.
countDown
();
}
});
if
(
CollectionUtils
.
isEmpty
(
vehicleProfileDisplays
))
{
return
vehicleProfileDisplayVo
;
try
{
latch
.
await
();
}
catch
(
InterruptedException
e
)
{
log
.
error
(
"查询失败【{}】"
,
e
);
}
return
largeScreenDisplayBaseDataVo
;
}
long
travelNum
=
0
;
long
toTravelNum
=
0
;
...
...
@@ -40,10 +84,17 @@ public class VehicleProfileDisplayBiz extends BaseBiz<VehicleProfileDisplayMappe
maintenanceNum
=
+
vehicleProfileDisplay
.
getMaintenanceNum
();
inMaintenanceNum
=
+
vehicleProfileDisplay
.
getInMaintenanceNum
();
}
vehicleProfileDisplayVo
.
setTravelNum
(
travelNum
);
vehicleProfileDisplayVo
.
setToTravelNum
(
toTravelNum
);
vehicleProfileDisplayVo
.
setMaintenanceNum
(
maintenanceNum
);
vehicleProfileDisplayVo
.
setInMaintenanceNum
(
inMaintenanceNum
);
return
vehicleProfileDisplayVo
;
largeScreenDisplayBaseDataVo
.
setVehicleProfileDisplayVo
(
vehicleProfileDisplayVo
);
try
{
latch
.
await
();
}
catch
(
InterruptedException
e
)
{
log
.
error
(
"查询失败【{}】"
,
e
);
}
return
largeScreenDisplayBaseDataVo
;
}
}
xx-
order/xx-order-server/src/main/java/com/xxfc/platform/order
/mapper/VehicleProfileDisplayMapper.java
→
xx-
vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle
/mapper/VehicleProfileDisplayMapper.java
View file @
9dc71acf
package
com
.
xxfc
.
platform
.
order
.
mapper
;
package
com
.
xxfc
.
platform
.
vehicle
.
mapper
;
import
com.xxfc.platform.
order
.entity.VehicleProfileDisplay
;
import
com.xxfc.platform.
vehicle
.entity.VehicleProfileDisplay
;
import
tk.mybatis.mapper.common.Mapper
;
/**
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/LargeScreenDisplayCCTVehicleController.java
0 → 100644
View file @
9dc71acf
package
com
.
xxfc
.
platform
.
vehicle
.
rest
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.vehicle.biz.VehicleProfileDisplayBiz
;
import
com.xxfc.platform.vehicle.pojo.vo.LargeScreenDisplayBaseDataVo
;
import
lombok.RequiredArgsConstructor
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/26 9:41
*/
@RestController
@RequestMapping
(
"/large_screen"
)
@RequiredArgsConstructor
(
onConstructor
=
@__
(
@Autowired
))
public
class
LargeScreenDisplayCCTVehicleController
{
private
final
VehicleProfileDisplayBiz
vehicleProfileDisplayBiz
;
/**
* 车辆概况
*
* @return
*/
@GetMapping
(
"/base_cct_vehicle_profile_display"
)
public
ObjectRestResponse
<
LargeScreenDisplayBaseDataVo
>
findLargeScreenDisplayData
()
{
LargeScreenDisplayBaseDataVo
largeScreenDisplayBaseDataVo
=
vehicleProfileDisplayBiz
.
findVehicleProfileDisplayData
();
return
ObjectRestResponse
.
succ
(
largeScreenDisplayBaseDataVo
);
}
}
xx-
order/xx-order
-server/src/main/resources/mapper/VehicleProfileDisplayMapper.xml
→
xx-
vehicle/xx-vehicle
-server/src/main/resources/mapper/VehicleProfileDisplayMapper.xml
View file @
9dc71acf
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.xxfc.platform.
order
.mapper.VehicleProfileDisplayMapper"
>
<mapper
namespace=
"com.xxfc.platform.
vehicle
.mapper.VehicleProfileDisplayMapper"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.xxfc.platform.
order
.entity.VehicleProfileDisplay"
id=
"vehicleProfileDisplayMap"
>
<resultMap
type=
"com.xxfc.platform.
vehicle
.entity.VehicleProfileDisplay"
id=
"vehicleProfileDisplayMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"provinceName"
column=
"province_name"
/>
<result
property=
"provinceCode"
column=
"province_code"
/>
...
...
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