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
c5544e9e
Commit
c5544e9e
authored
Dec 26, 2019
by
libin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
大屏数据调试
parent
e2ef45c1
Changes
34
Hide whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
476 additions
and
252 deletions
+476
-252
UserProfileDisplay.java
...hub/wxiaoqi/security/admin/entity/UserProfileDisplay.java
+4
-5
UserProfileDisplayVo.java
...ithub/wxiaoqi/security/admin/vo/UserProfileDisplayVo.java
+1
-1
AppUserDetailBiz.java
...m/github/wxiaoqi/security/admin/biz/AppUserDetailBiz.java
+8
-1
UserProfileDisplayBiz.java
...hub/wxiaoqi/security/admin/biz/UserProfileDisplayBiz.java
+99
-1
LargeScreenDisplayUserController.java
...security/admin/rest/LargeScreenDisplayUserController.java
+1
-1
UserProfileDisplayMapper.xml
...in/src/main/resources/mapper/UserProfileDisplayMapper.xml
+0
-1
LargeScreenDisplayConstantDataBo.java
...c/platform/order/bo/LargeScreenDisplayConstantDataBo.java
+17
-0
CenterOrderProfileDisplay.java
...xxfc/platform/order/entity/CenterOrderProfileDisplay.java
+42
-0
OrderProfileDisplay.java
...a/com/xxfc/platform/order/entity/OrderProfileDisplay.java
+21
-30
BaseOrderDTO.java
...n/java/com/xxfc/platform/order/pojo/dto/BaseOrderDTO.java
+1
-1
CenterOrderProfileDisplayVo.java
...c/platform/order/pojo/vo/CenterOrderProfileDisplayVo.java
+1
-1
LargeScreenDisplayDataVo.java
...xxfc/platform/order/pojo/vo/LargeScreenDisplayDataVo.java
+0
-9
OrderPayProfileDispalyVo.java
...xxfc/platform/order/pojo/vo/OrderPayProfileDispalyVo.java
+13
-5
OrderProfileVo.java
.../java/com/xxfc/platform/order/pojo/vo/OrderProfileVo.java
+6
-0
BaseOrderBiz.java
...c/main/java/com/xxfc/platform/order/biz/BaseOrderBiz.java
+6
-1
CenterOrderProfileDisplayBiz.java
...xxfc/platform/order/biz/CenterOrderProfileDisplayBiz.java
+37
-0
OrderProfileDisplayBiz.java
...a/com/xxfc/platform/order/biz/OrderProfileDisplayBiz.java
+111
-78
BaseOrderMapper.java
.../java/com/xxfc/platform/order/mapper/BaseOrderMapper.java
+3
-1
CenterOrderProfileDisplayMapper.java
...latform/order/mapper/CenterOrderProfileDisplayMapper.java
+13
-0
LargeScreenDisplayController.java
...xfc/platform/order/rest/LargeScreenDisplayController.java
+1
-1
BaseOrderMapper.xml
...rder-server/src/main/resources/mapper/BaseOrderMapper.xml
+35
-17
CenterOrderProfileDisplayMapper.xml
...main/resources/mapper/CenterOrderProfileDisplayMapper.xml
+13
-0
OrderProfileDisplayMapper.xml
...r/src/main/resources/mapper/OrderProfileDisplayMapper.xml
+0
-6
VehicleProfileDisplay.java
...m/xxfc/platform/vehicle/entity/VehicleProfileDisplay.java
+5
-20
VehicleFeign.java
...in/java/com/xxfc/platform/vehicle/feign/VehicleFeign.java
+4
-0
BranchCompanyAreaDTO.java
.../xxfc/platform/vehicle/pojo/dto/BranchCompanyAreaDTO.java
+1
-2
VehicleProfileDisplayVo.java
...xfc/platform/vehicle/pojo/vo/VehicleProfileDisplayVo.java
+0
-18
BranchCompanyBiz.java
.../java/com/xxfc/platform/vehicle/biz/BranchCompanyBiz.java
+5
-0
VehicleProfileDisplayBiz.java
...m/xxfc/platform/vehicle/biz/VehicleProfileDisplayBiz.java
+7
-47
BranchCompanyMapper.java
...com/xxfc/platform/vehicle/mapper/BranchCompanyMapper.java
+2
-0
BranchCompanyController.java
...m/xxfc/platform/vehicle/rest/BranchCompanyController.java
+6
-0
LargeScreenDisplayCCTVehicleController.java
.../vehicle/rest/LargeScreenDisplayCCTVehicleController.java
+1
-1
BranchCompanyMapper.xml
...-server/src/main/resources/mapper/BranchCompanyMapper.xml
+11
-0
VehicleProfileDisplayMapper.xml
...src/main/resources/mapper/VehicleProfileDisplayMapper.xml
+1
-4
No files found.
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/entity/UserProfileDisplay.java
View file @
c5544e9e
...
...
@@ -38,9 +38,8 @@ public class UserProfileDisplay {
*/
@Column
(
name
=
"users_num"
)
private
Integer
usersNum
;
/**
* 会员数
*/
@Column
(
name
=
"members_num"
)
private
Integer
membersNum
;
@Transient
@JsonIgnore
private
long
memberNums
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/vo/UserProfileDisplayVo.java
View file @
c5544e9e
...
...
@@ -30,7 +30,7 @@ public class UserProfileDisplayVo implements Serializable {
/**
* 会员占比数
*/
private
int
membershipRatio
;
private
String
membershipRatio
;
/**
* 用户统计
*/
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserDetailBiz.java
View file @
c5544e9e
...
...
@@ -12,7 +12,6 @@ import com.github.wxiaoqi.security.admin.vo.AppUserInfoVo;
import
com.github.wxiaoqi.security.admin.vo.AppUserVo
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.xxfc.platform.im.utils.BeanUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -222,4 +221,12 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
}
return
null
;
}
public
List
<
AppUserDetail
>
findAllUsers
()
{
Example
example
=
new
Example
(
AppUserDetail
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"isdel"
,
0
);
List
<
AppUserDetail
>
userDetails
=
mapper
.
selectByExample
(
example
);
return
CollectionUtils
.
isEmpty
(
userDetails
)?
Collections
.
emptyList
():
userDetails
;
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/UserProfileDisplayBiz.java
View file @
c5544e9e
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
biz
;
import
com.github.wxiaoqi.security.admin.entity.AppUserDetail
;
import
com.github.wxiaoqi.security.admin.entity.UserProfileDisplay
;
import
com.github.wxiaoqi.security.admin.mapper.UserProfileDisplayMapper
;
import
com.github.wxiaoqi.security.admin.vo.UserProfileDisplayVo
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.xxfc.platform.universal.entity.Dictionary
;
import
com.xxfc.platform.universal.feign.ThirdFeign
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StringUtils
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
/**
* @author libin
...
...
@@ -19,9 +29,97 @@ import org.springframework.transaction.annotation.Transactional;
@Service
@RequiredArgsConstructor
(
onConstructor
=
@__
(
@Autowired
))
public
class
UserProfileDisplayBiz
extends
BaseBiz
<
UserProfileDisplayMapper
,
UserProfileDisplay
>
{
/**
* 字典查询type
*/
@Value
(
"${large.screen.type:LARGE_SCREEN_DISPLAY}"
)
private
String
largeScreenType
;
/**
* 字典查询code
*/
@Value
(
"${large.screen.member.code:LARGE_SCREEN_DISPLAY_EMEMBER_CONSTANT}"
)
private
String
largeScreenCode
;
private
final
AppUserDetailBiz
appUserDetailBiz
;
private
final
ThirdFeign
thirdFeign
;
private
static
final
Integer
GUANG_DONG_CODE
=
440000
;
public
UserProfileDisplayVo
findUserProfileData
()
{
UserProfileDisplayVo
userProfileDisplayVo
=
new
UserProfileDisplayVo
();
//todo
//1.查询固定数据
List
<
UserProfileDisplay
>
userProfileDisplays
=
mapper
.
selectAll
();
//2.查询真实数据
List
<
AppUserDetail
>
appUserDetails
=
appUserDetailBiz
.
findAllUsers
();
//3.包装数据
List
<
UserProfileDisplay
>
wrapUserProfileDisplays
=
wrapToUserProfileDisplay
(
appUserDetails
);
if
(
CollectionUtils
.
isNotEmpty
(
wrapUserProfileDisplays
))
{
wrapUserProfileDisplays
=
aggreationForUserProfileDisplayData
(
userProfileDisplays
,
wrapUserProfileDisplays
);
}
//4.查询固定会员数
Dictionary
dictionary
=
thirdFeign
.
findDictionaryByTypeAndCode
(
largeScreenType
,
largeScreenCode
);
if
(
Objects
.
nonNull
(
dictionary
)
&&
StringUtils
.
hasText
(
dictionary
.
getDetail
()))
{
String
memberNumStr
=
dictionary
.
getDetail
();
long
memberNums
=
Integer
.
valueOf
(
memberNumStr
);
userProfileDisplayVo
.
setMembersNum
(
memberNums
);
}
wrapUserProfileDisplay
(
wrapUserProfileDisplays
,
userProfileDisplayVo
);
userProfileDisplayVo
.
setUserProfileDisplays
(
wrapUserProfileDisplays
);
return
userProfileDisplayVo
;
}
private
List
<
UserProfileDisplay
>
aggreationForUserProfileDisplayData
(
List
<
UserProfileDisplay
>
baseuserProfileDisplays
,
List
<
UserProfileDisplay
>
wrapUserProfileDisplays
)
{
Map
<
Integer
,
UserProfileDisplay
>
userProfileMap
=
wrapUserProfileDisplays
.
stream
().
collect
(
Collectors
.
toMap
(
UserProfileDisplay:
:
getProvinceCode
,
Function
.
identity
()));
for
(
UserProfileDisplay
baseuserProfileDisplay
:
baseuserProfileDisplays
)
{
Integer
provinceCode
=
baseuserProfileDisplay
.
getProvinceCode
();
UserProfileDisplay
userProfileDisplay
=
userProfileMap
.
get
(
provinceCode
);
if
(
Objects
.
isNull
(
userProfileDisplay
))
{
continue
;
}
int
userNums
=
baseuserProfileDisplay
.
getUsersNum
()
+
userProfileDisplay
.
getUsersNum
();
long
memberNums
=
baseuserProfileDisplay
.
getMemberNums
()
+
userProfileDisplay
.
getMemberNums
();
baseuserProfileDisplay
.
setUsersNum
(
userNums
);
baseuserProfileDisplay
.
setMemberNums
(
memberNums
);
}
return
baseuserProfileDisplays
;
}
private
UserProfileDisplayVo
wrapUserProfileDisplay
(
List
<
UserProfileDisplay
>
userProfileDisplays
,
UserProfileDisplayVo
userProfileDisplayVo
)
{
long
membersNum
=
0
;
long
usersNum
=
0
;
for
(
UserProfileDisplay
userProfileDisplay
:
userProfileDisplays
)
{
usersNum
=
usersNum
+
userProfileDisplay
.
getUsersNum
();
membersNum
=
membersNum
+
userProfileDisplay
.
getMemberNums
();
}
membersNum
=
membersNum
+
userProfileDisplayVo
.
getMembersNum
();
userProfileDisplayVo
.
setUsersNum
(
usersNum
);
userProfileDisplayVo
.
setMembersNum
(
membersNum
);
double
ratio
=
membersNum
/
(
usersNum
*
1.0
);
userProfileDisplayVo
.
setMembershipRatio
(
String
.
format
(
"%.2f"
,
ratio
));
return
userProfileDisplayVo
;
}
private
List
<
UserProfileDisplay
>
wrapToUserProfileDisplay
(
List
<
AppUserDetail
>
appUserDetails
)
{
List
<
UserProfileDisplay
>
userProfileDisplays
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isEmpty
(
appUserDetails
))
{
return
userProfileDisplays
;
}
Map
<
Integer
,
List
<
AppUserDetail
>>
appUserDetailMap
=
appUserDetails
.
stream
().
peek
(
x
->
{
if
(
x
.
getProvinceCode
()
==
null
||
x
.
getProvinceCode
()
==
0
)
{
x
.
setProvinceCode
(
GUANG_DONG_CODE
);
}
}).
collect
(
Collectors
.
groupingBy
(
AppUserDetail:
:
getProvinceCode
,
Collectors
.
toList
()));
UserProfileDisplay
userProfileDisplay
;
Set
<
Map
.
Entry
<
Integer
,
List
<
AppUserDetail
>>>
appUserDetailEntrySet
=
appUserDetailMap
.
entrySet
();
for
(
Map
.
Entry
<
Integer
,
List
<
AppUserDetail
>>
appUserMapEntry
:
appUserDetailEntrySet
)
{
userProfileDisplay
=
new
UserProfileDisplay
();
Integer
provinceCode
=
appUserMapEntry
.
getKey
();
userProfileDisplay
.
setProvinceCode
(
provinceCode
);
List
<
AppUserDetail
>
appUserDetailList
=
appUserMapEntry
.
getValue
();
userProfileDisplay
.
setUsersNum
(
appUserDetailList
.
size
());
long
members
=
appUserDetailList
.
stream
().
filter
(
x
->
Objects
.
equals
(
x
.
getIsMember
(),
1
)).
count
();
userProfileDisplay
.
setMemberNums
(
members
);
userProfileDisplays
.
add
(
userProfileDisplay
);
}
return
userProfileDisplays
;
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/LargeScreenDisplayUserController.java
View file @
c5544e9e
...
...
@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
* @data 2019/12/26 10:11
*/
@RestController
@RequestMapping
(
"/large_screen"
)
@RequestMapping
(
"/large_screen
/app/unauth
"
)
@RequiredArgsConstructor
(
onConstructor
=
@__
(
@Autowired
))
public
class
LargeScreenDisplayUserController
{
private
final
UserProfileDisplayBiz
userProfileDisplayBiz
;
...
...
ace-modules/ace-admin/src/main/resources/mapper/UserProfileDisplayMapper.xml
View file @
c5544e9e
...
...
@@ -6,7 +6,6 @@
<!-- 可根据自己的需求,是否要使用 -->
<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"
/>
<result
property=
"provinceName"
column=
"province_name"
/>
<result
property=
"usersNum"
column=
"users_num"
/>
...
...
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/bo/LargeScreenDisplayConstantDataBo.java
View file @
c5544e9e
...
...
@@ -26,4 +26,21 @@ public class LargeScreenDisplayConstantDataBo implements Serializable {
* 订单基础单量
*/
private
int
baseOrderNum
;
/**
* 微信支付占比率
*/
private
double
wxPayRatio
;
/**
* 支付宝支付占比率
*/
private
double
aliPayRatio
;
/**
* 安卓终端支付占比率
*/
private
double
androidPayRatio
;
/**
* ios终端支付占比率
*/
private
double
iosPayRatio
;
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/entity/CenterOrderProfileDisplay.java
0 → 100644
View file @
c5544e9e
package
com
.
xxfc
.
platform
.
order
.
entity
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.persistence.*
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/26 15:43
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Table
(
name
=
"center_order_profile_display"
)
@Entity
public
class
CenterOrderProfileDisplay
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
@Id
@GeneratedValue
(
generator
=
"JDBC"
)
private
Integer
id
;
/**
* 区域id
*/
@Column
(
name
=
"area_id"
)
private
Integer
areaId
;
/**
* 区域名称
*/
@Column
(
name
=
"area_name"
)
private
String
areaName
;
/**
* 区域订单金额
*/
@Column
(
name
=
"area_amount"
)
private
BigDecimal
areaAmount
;
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/entity/OrderProfileDisplay.java
View file @
c5544e9e
...
...
@@ -23,16 +23,7 @@ public class OrderProfileDisplay {
@Id
@GeneratedValue
(
generator
=
"JDBC"
)
private
Integer
id
;
/**
* 区域id
*/
@Column
(
name
=
"area_id"
)
private
Integer
areaId
;
/**
* 区域名称
*/
@Column
(
name
=
"area_name"
)
private
String
areaName
;
/**
* 订单日期
*/
...
...
@@ -43,25 +34,25 @@ public class OrderProfileDisplay {
*/
@Column
(
name
=
"order_amount"
)
private
BigDecimal
orderAmount
;
/**
* 订单量
*/
@Column
(
name
=
"order_num"
)
private
Integer
orderNum
;
/**
* 支付方式 1:微信 2:支付宝
*/
@Column
(
name
=
"pay_way"
)
private
Integer
payWay
;
/**
* 支付终端 1:app 2:小程序 3:公众号 4:ios
*/
@Column
(
name
=
"pay_terminal"
)
private
Integer
payTerminal
;
/**
* 订单类型 1:租车 2:旅游 3:会员
*/
@Column
(
name
=
"order_type"
)
private
Integer
orderType
;
//
/**
//
* 订单量
//
*/
//
@Column(name = "order_num")
//
private Integer orderNum;
//
/**
//
* 支付方式 1:微信 2:支付宝
//
*/
//
@Column(name = "pay_way")
//
private Integer payWay;
//
/**
//
* 支付终端 1:app 2:小程序 3:公众号 4:ios
//
*/
//
@Column(name = "pay_terminal")
//
private Integer payTerminal;
//
/**
//
* 订单类型 1:租车 2:旅游 3:会员
//
*/
//
@Column(name = "order_type")
//
private Integer orderType;
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/dto/BaseOrderDTO.java
View file @
c5544e9e
...
...
@@ -60,7 +60,7 @@ public class BaseOrderDTO implements Serializable {
public
Date
getPayDate
()
{
return
Objects
.
isNull
(
payTime
)
?
null
:
DateUtil
.
beginOfDay
(
new
Date
(
payTime
));
return
Objects
.
isNull
(
payTime
)
?
payDate
:
DateUtil
.
beginOfDay
(
new
Date
(
payTime
));
}
public
Integer
getOrderNum
()
{
...
...
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/vo/CenterOrderProfileDisplayVo.java
View file @
c5544e9e
...
...
@@ -21,7 +21,7 @@ public class CenterOrderProfileDisplayVo implements Serializable {
/**
* 订单金额
*/
private
BigDecimal
order
Amount
=
BigDecimal
.
ZERO
;
private
BigDecimal
area
Amount
=
BigDecimal
.
ZERO
;
/**
* 区域名称
*/
...
...
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/vo/LargeScreenDisplayDataVo.java
View file @
c5544e9e
package
com
.
xxfc
.
platform
.
order
.
pojo
.
vo
;
import
com.xxfc.platform.order.bo.LargeScreenDisplayConstantDataBo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
...
...
@@ -23,16 +22,8 @@ public class LargeScreenDisplayDataVo implements Serializable {
* 订单相关数据
*/
private
OrderProfileDispayVo
orderProfileDispayData
;
/**
* 常量数据
*/
private
LargeScreenDisplayConstantDataBo
largeScreenDisplayConstantData
;
public
OrderProfileDispayVo
getOrderProfileDispayData
()
{
return
Objects
.
isNull
(
orderProfileDispayData
)?
new
OrderProfileDispayVo
():
orderProfileDispayData
;
}
public
LargeScreenDisplayConstantDataBo
getLargeScreenDisplayConstantData
()
{
return
Objects
.
isNull
(
largeScreenDisplayConstantData
)?
new
LargeScreenDisplayConstantDataBo
():
largeScreenDisplayConstantData
;
}
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/vo/OrderPayProfileDispalyVo.java
View file @
c5544e9e
...
...
@@ -29,17 +29,25 @@ public class OrderPayProfileDispalyVo implements Serializable {
/**
* app支付金额
*/
private
BigDecimal
a
pp
PayAmount
=
BigDecimal
.
ZERO
;
private
BigDecimal
a
ndroid
PayAmount
=
BigDecimal
.
ZERO
;
/**
* ios支付金额
*/
private
BigDecimal
iosPayAmount
=
BigDecimal
.
ZERO
;
/**
*
小程序支付金额
*
微信占比
*/
private
BigDecimal
appletPayAmount
=
BigDecimal
.
ZERO
;
private
String
wxPayRatio
;
/**
*
公众号支付金额
*
支付宝占比
*/
private
BigDecimal
weChatOfficialAccountPayAmount
=
BigDecimal
.
ZERO
;
private
String
aliPayRatio
;
/**
* 安卓支付占比
*/
private
String
androidPayRatio
;
/**
* ios支付占比
*/
private
String
iosPayRatio
;
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/vo/OrderProfileVo.java
View file @
c5544e9e
package
com
.
xxfc
.
platform
.
order
.
pojo
.
vo
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
...
...
@@ -22,9 +23,14 @@ public class OrderProfileVo implements Serializable {
/**
* 订单日期
*/
@JsonIgnore
private
Date
orderDate
;
/**
* 订单金额
*/
private
BigDecimal
orderAmount
=
BigDecimal
.
ZERO
;
/**
* 显示日期
*/
private
String
date
;
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/BaseOrderBiz.java
View file @
c5544e9e
...
...
@@ -2,6 +2,7 @@ package com.xxfc.platform.order.biz;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.bean.copier.CopyOptions
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.alibaba.fastjson.JSONArray
;
...
...
@@ -970,7 +971,11 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper, BaseOrder> implements
}
public
List
<
BaseOrderDTO
>
findOrdersByDate
(
Date
startDate
,
Date
endDate
)
{
List
<
BaseOrderDTO
>
baseOrderDTOS
=
mapper
.
findOrdersByDate
(
startDate
,
endDate
);
startDate
=
DateUtil
.
beginOfDay
(
startDate
);
endDate
=
DateUtil
.
endOfDay
(
endDate
);
long
startTime
=
startDate
.
getTime
();
long
endTime
=
endDate
.
getTime
();
List
<
BaseOrderDTO
>
baseOrderDTOS
=
mapper
.
findOrdersByDate
(
startDate
,
endDate
,
startTime
,
endTime
);
return
CollectionUtils
.
isEmpty
(
baseOrderDTOS
)?
Collections
.
emptyList
():
baseOrderDTOS
;
}
}
\ No newline at end of file
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/CenterOrderProfileDisplayBiz.java
0 → 100644
View file @
c5544e9e
package
com
.
xxfc
.
platform
.
order
.
biz
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.TypeReference
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.xxfc.platform.order.entity.CenterOrderProfileDisplay
;
import
com.xxfc.platform.order.mapper.CenterOrderProfileDisplayMapper
;
import
com.xxfc.platform.order.pojo.vo.CenterOrderProfileDisplayVo
;
import
lombok.RequiredArgsConstructor
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/26 15:48
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Service
@RequiredArgsConstructor
(
onConstructor
=
@__
(
@Autowired
))
public
class
CenterOrderProfileDisplayBiz
extends
BaseBiz
<
CenterOrderProfileDisplayMapper
,
CenterOrderProfileDisplay
>
{
public
List
<
CenterOrderProfileDisplayVo
>
findCenterOrderProfileDisplays
(){
List
<
CenterOrderProfileDisplayVo
>
centerOrderProfileDisplayVos
=
new
ArrayList
<>();
List
<
CenterOrderProfileDisplay
>
centerOrderProfileDisplays
=
mapper
.
selectAll
();
if
(
CollectionUtils
.
isEmpty
(
centerOrderProfileDisplays
)){
return
centerOrderProfileDisplayVos
;
}
return
JSON
.
parseObject
(
JSON
.
toJSONString
(
centerOrderProfileDisplays
),
new
TypeReference
<
List
<
CenterOrderProfileDisplayVo
>>(){});
}
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderProfileDisplayBiz.java
View file @
c5544e9e
...
...
@@ -12,8 +12,8 @@ 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
com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -27,9 +27,8 @@ 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.function.
Function
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
* @author libin
...
...
@@ -45,17 +44,18 @@ public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, O
/**
* 字典查询type
*/
@Value
(
"
large.screen.type:LARGE_SCREEN_DISPLAY
"
)
@Value
(
"
${large.screen.type:LARGE_SCREEN_DISPLAY}
"
)
private
String
largeScreenType
;
/**
* 字典查询code
*/
@Value
(
"
large.screen.code:LARGE_SCREEN_DISPLAY_CONSTANT
"
)
@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
VehicleFeign
vehicleFeign
;
private
final
CenterOrderProfileDisplayBiz
centerOrderProfileDisplayBiz
;
private
final
ThreadPoolTaskExecutor
executor
;
private
static
final
Integer
WX_PAY_STATE
=
1
;
private
static
final
Integer
ALI_PAY_STATE
=
2
;
...
...
@@ -87,16 +87,11 @@ public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, O
//2.2查询固定数据
List
<
OrderProfileDisplay
>
orderProfileDisplays
=
findOrderProfileDisplayDataByDate
(
startDate
,
endDate
);
//包装成基础订单
List
<
BaseOrderDTO
>
wrapBaseOrders
=
wrapToBaseOrder
(
orderProfileDisplays
);
wrapBaseOrders
.
addAll
(
baseOrders
);
Supplier
<
Stream
<
BaseOrderDTO
>>
orderSupplier
=
()
->
wrapBaseOrders
.
stream
();
CountDownLatch
latch
=
new
CountDownLatch
(
3
);
//3. 十大运营中心订单数据
executor
.
execute
(()
->
{
try
{
analyticStatisticsCenterOrder
(
orderSupplier
,
orderProfileDispayVo
);
analyticStatisticsCenterOrder
(
baseOrders
,
orderProfileDispayVo
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"十大运营中心订单统计失败【{}】"
,
ex
);
}
finally
{
...
...
@@ -106,7 +101,7 @@ public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, O
//4.总的订单数据
executor
.
execute
(()
->
{
try
{
analyticStatisticsOrderProfiles
(
orderSupplier
,
orderProfileDispayVo
);
analyticStatisticsOrderProfiles
(
baseOrders
,
orderProfileDisplays
,
orderProfileDispayVo
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"总订单数据解析失败【{}】"
,
ex
);
}
finally
{
...
...
@@ -114,9 +109,10 @@ public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, O
}
});
//5.支付方式|支付终端数据处理
LargeScreenDisplayConstantDataBo
finalLargeScreenDisplayConstantDataBo
=
largeScreenDisplayConstantDataBo
;
executor
.
execute
(()
->
{
try
{
analyticStatisticsOrderPayWayProfiles
(
orderSupplier
,
orderProfileDispayVo
);
analyticStatisticsOrderPayWayProfiles
(
baseOrders
,
orderProfileDisplays
,
finalLargeScreenDisplayConstantDataBo
,
orderProfileDispayVo
);
}
catch
(
Exception
ex
)
{
log
.
error
(
"支付方式|支付终端数据处理失败【{}】"
,
ex
);
}
finally
{
...
...
@@ -128,13 +124,13 @@ public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, O
}
catch
(
InterruptedException
e
)
{
log
.
error
(
"统计出错:【{}】"
,
e
);
}
//6.基础金额 + 真实金额 基础订单量+真实订单量
//1.基础金额 + 真实金额 基础订单量+真实订单量
long
totalOrderNum
=
orderProfileDispayVo
.
getOrderNum
()
+
largeScreenDisplayConstantDataBo
.
getBaseOrderNum
();
BigDecimal
totalOrderAmount
=
orderProfileDispayVo
.
getOrderAmount
().
add
(
largeScreenDisplayConstantDataBo
.
getBaseOrderAmount
());
orderProfileDispayVo
.
setOrderNum
(
totalOrderNum
);
orderProfileDispayVo
.
setOrderAmount
(
totalOrderAmount
);
largeScreenDisplayDataVo
.
setLargeScreenDisplayConstantData
(
largeScreenDisplayConstantDataBo
);
orderProfileDispayVo
.
setOrderNum
(
totalOrderNum
);
largeScreenDisplayDataVo
.
setOrderProfileDispayData
(
orderProfileDispayVo
);
return
largeScreenDisplayDataVo
;
}
...
...
@@ -142,17 +138,22 @@ public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, O
/**
* 支付方式|终端的统计
*
* @param orderSuppiler
* @param orderProfileDispayVo
* @param largeScreenDisplayConstantDataBo
* @param baseOrders
* @return
*/
private
OrderProfileDispayVo
analyticStatisticsOrderPayWayProfiles
(
Supplier
<
Stream
<
BaseOrderDTO
>>
orderSuppiler
,
private
OrderProfileDispayVo
analyticStatisticsOrderPayWayProfiles
(
List
<
BaseOrderDTO
>
baseOrders
,
List
<
OrderProfileDisplay
>
orderProfileDisplays
,
LargeScreenDisplayConstantDataBo
largeScreenDisplayConstantDataBo
,
OrderProfileDispayVo
orderProfileDispayVo
)
{
OrderPayProfileDispalyVo
orderPayProfileDispalyVo
=
new
OrderPayProfileDispalyVo
();
BigDecimal
orderAmountConstant
=
CollectionUtils
.
isEmpty
(
orderProfileDisplays
)
?
BigDecimal
.
ZERO
:
orderProfileDisplays
.
stream
().
map
(
OrderProfileDisplay:
:
getOrderAmount
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
//1.支付方式统计
wrapToPayProfileWithPayWay
(
orderSuppiler
,
orderPayProfileDispalyVo
);
wrapToPayProfileWithPayWay
(
baseOrders
,
orderAmountConstant
,
largeScreenDisplayConstantDataBo
,
orderPayProfileDispalyVo
);
//2.支付终端统计
wrapToPayProfileWithPayTerminal
(
orderSuppiler
,
orderPayProfileDispalyVo
);
wrapToPayProfileWithPayTerminal
(
baseOrders
,
orderAmountConstant
,
largeScreenDisplayConstantDataBo
,
orderPayProfileDispalyVo
);
orderProfileDispayVo
.
setOrderPayProfileDisplay
(
orderPayProfileDispalyVo
);
return
orderProfileDispayVo
;
...
...
@@ -161,39 +162,69 @@ public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, O
/**
* 支付方式统计
*
* @param orderSupplier
* @param baseOrders
* @param orderAmountConstant
* @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
);
private
OrderPayProfileDispalyVo
wrapToPayProfileWithPayWay
(
List
<
BaseOrderDTO
>
baseOrders
,
BigDecimal
orderAmountConstant
,
LargeScreenDisplayConstantDataBo
largeScreenDisplayConstantDataBo
,
OrderPayProfileDispalyVo
orderPayProfileDispalyVo
)
{
Map
<
Integer
,
BigDecimal
>
payWayMap
=
CollectionUtils
.
isEmpty
(
baseOrders
)
?
Collections
.
EMPTY_MAP
:
baseOrders
.
stream
().
collect
(
Collectors
.
groupingBy
(
BaseOrderDTO:
:
getPayWay
,
CollectorsUtil
.
summingBigDecimal
(
BaseOrderDTO:
:
getRealAmount
)));
boolean
isEmpty
=
payWayMap
.
isEmpty
();
BigDecimal
wxPayAmount
=
isEmpty
?
BigDecimal
.
ZERO
:
payWayMap
.
get
(
WX_PAY_STATE
)
==
null
?
BigDecimal
.
ZERO
:
payWayMap
.
get
(
WX_PAY_STATE
);
BigDecimal
aliPayAmount
=
isEmpty
?
BigDecimal
.
ZERO
:
payWayMap
.
get
(
ALI_PAY_STATE
)
==
null
?
BigDecimal
.
ZERO
:
payWayMap
.
get
(
ALI_PAY_STATE
);
//基础金额 * 占比率
wxPayAmount
=
wxPayAmount
.
add
(
orderAmountConstant
.
multiply
(
new
BigDecimal
(
String
.
valueOf
(
largeScreenDisplayConstantDataBo
.
getWxPayRatio
()))));
aliPayAmount
=
aliPayAmount
.
add
(
orderAmountConstant
.
multiply
(
new
BigDecimal
(
String
.
valueOf
(
largeScreenDisplayConstantDataBo
.
getAliPayRatio
()))));
BigDecimal
totalAmount
=
wxPayAmount
.
add
(
aliPayAmount
);
String
wxPayRatio
=
wxPayAmount
.
divide
(
totalAmount
,
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
String
aliPayRatio
=
aliPayAmount
.
divide
(
totalAmount
,
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
orderPayProfileDispalyVo
.
setWxPayRatio
(
wxPayRatio
);
orderPayProfileDispalyVo
.
setAliPayRatio
(
aliPayRatio
);
orderPayProfileDispalyVo
.
setWxPayAmount
(
wxPayAmount
.
setScale
(
2
));
orderPayProfileDispalyVo
.
setAliPayAmount
(
aliPayAmount
.
setScale
(
2
));
return
orderPayProfileDispalyVo
;
}
/**
* 支付终端统计
*
* @param
orderSupplier
* @param
baseOrders
* @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
);
orderPayProfileDispalyVo
.
setAppletPayAmount
(
appPayAmount
);
orderPayProfileDispalyVo
.
setAppletPayAmount
(
appletPayAmount
);
orderPayProfileDispalyVo
.
setWeChatOfficialAccountPayAmount
(
weChatOfficialAccountPayAmount
);
orderPayProfileDispalyVo
.
setIosPayAmount
(
iosPayAmount
);
private
OrderPayProfileDispalyVo
wrapToPayProfileWithPayTerminal
(
List
<
BaseOrderDTO
>
baseOrders
,
BigDecimal
orderAmountConstant
,
LargeScreenDisplayConstantDataBo
largeScreenDisplayConstantDataBo
,
OrderPayProfileDispalyVo
orderPayProfileDispalyVo
)
{
Map
<
Integer
,
BigDecimal
>
payTerminalMap
=
CollectionUtils
.
isEmpty
(
baseOrders
)
?
Collections
.
EMPTY_MAP
:
baseOrders
.
stream
().
collect
(
Collectors
.
groupingBy
(
BaseOrderDTO:
:
getPayOrigin
,
CollectorsUtil
.
summingBigDecimal
(
BaseOrderDTO:
:
getRealAmount
)));
boolean
isEmpty
=
payTerminalMap
.
isEmpty
();
BigDecimal
androidPayAmount
=
isEmpty
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
APP_PAY_STATE
)
==
null
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
APP_PAY_STATE
);
BigDecimal
appletPayAmount
=
isEmpty
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
APPLET_PAY_STATE
)
==
null
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
APPLET_PAY_STATE
);
BigDecimal
weChatOfficialAccountPayAmount
=
isEmpty
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
WECHAT_OFFICIAL_ACCOUNT_PAY_STATE
)
==
null
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
WECHAT_OFFICIAL_ACCOUNT_PAY_STATE
);
BigDecimal
iosPayAmount
=
isEmpty
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
IOS_PAY_STATE
)
==
null
?
BigDecimal
.
ZERO
:
payTerminalMap
.
get
(
IOS_PAY_STATE
);
//applet 公众号 划为ios支付
iosPayAmount
=
iosPayAmount
.
add
(
appletPayAmount
).
add
(
weChatOfficialAccountPayAmount
);
//基础金额 * 占比率
androidPayAmount
=
androidPayAmount
.
add
(
orderAmountConstant
.
multiply
(
new
BigDecimal
(
String
.
valueOf
(
largeScreenDisplayConstantDataBo
.
getAndroidPayRatio
()))));
iosPayAmount
=
iosPayAmount
.
add
(
orderAmountConstant
.
multiply
(
new
BigDecimal
(
String
.
valueOf
(
largeScreenDisplayConstantDataBo
.
getIosPayRatio
()))));
BigDecimal
totalAmount
=
androidPayAmount
.
add
(
iosPayAmount
);
String
androidPayRatio
=
androidPayAmount
.
divide
(
totalAmount
,
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
String
iosPayRatio
=
iosPayAmount
.
divide
(
totalAmount
,
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
();
orderPayProfileDispalyVo
.
setAndroidPayRatio
(
androidPayRatio
);
orderPayProfileDispalyVo
.
setIosPayRatio
(
iosPayRatio
);
orderPayProfileDispalyVo
.
setAndroidPayAmount
(
androidPayAmount
.
setScale
(
2
));
orderPayProfileDispalyVo
.
setIosPayAmount
(
iosPayAmount
.
setScale
(
2
));
return
orderPayProfileDispalyVo
;
}
...
...
@@ -204,15 +235,19 @@ public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, O
* @param orderProfileDispayVo
* @return
*/
private
OrderProfileDispayVo
analyticStatisticsOrderProfiles
(
Supplier
<
Stream
<
BaseOrderDTO
>>
orderSuppiler
,
private
OrderProfileDispayVo
analyticStatisticsOrderProfiles
(
List
<
BaseOrderDTO
>
baseOrders
,
List
<
OrderProfileDisplay
>
orderProfileDisplays
,
OrderProfileDispayVo
orderProfileDispayVo
)
{
//包装数据
List
<
BaseOrderDTO
>
baseOrderDTOS
=
wrapToBaseOrder
(
orderProfileDisplays
);
baseOrderDTOS
.
addAll
(
baseOrders
);
//1.真实数据按时间分组
Map
<
Date
,
BigDecimal
>
orderAmountMap
=
orderSuppiler
.
get
().
collect
(
Collectors
.
groupingBy
(
BaseOrderDTO:
:
getPayDate
,
CollectorsUtil
.
summingBigDecimal
(
BaseOrderDTO:
:
getRealAmount
)));
Map
<
Date
,
BigDecimal
>
orderAmountMap
=
baseOrderDTOS
.
stream
().
collect
(
Collectors
.
groupingBy
(
BaseOrderDTO:
:
getPayDate
,
CollectorsUtil
.
summingBigDecimal
(
BaseOrderDTO:
:
getRealAmount
)));
//2.某个时间段的订单统计
//2.1 订单金额
List
<
OrderProfileVo
>
orderProfileVos
=
createOrderProfiles
(
orderAmountMap
);
//2.2 订单量
wrapBaseDateToOrderProfileDispay
(
orderSuppiler
,
orderProfileDispayVo
);
wrapBaseDateToOrderProfileDispay
(
baseOrders
,
orderProfileDispayVo
);
//3.今日金额
Date
date
=
DateUtil
.
beginOfDay
(
new
Date
()).
toJdkDate
();
BigDecimal
todayOrderAmount
=
orderAmountMap
==
null
?
BigDecimal
.
ZERO
:
orderAmountMap
.
get
(
date
)
==
null
?
BigDecimal
.
ZERO
:
orderAmountMap
.
get
(
date
);
...
...
@@ -224,27 +259,18 @@ public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, O
/**
* 包装基础数据 订单金额 与订单量
*
* @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
()));
private
OrderProfileDispayVo
wrapBaseDateToOrderProfileDispay
(
List
<
BaseOrderDTO
>
baseOrderDTOS
,
OrderProfileDispayVo
orderProfileDispayVo
)
{
Map
<
Date
,
Long
>
orderNumMap
=
CollectionUtils
.
isEmpty
(
baseOrderDTOS
)
?
Collections
.
EMPTY_MAP
:
baseOrderDTOS
.
stream
().
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
;
}
...
...
@@ -268,23 +294,39 @@ public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, O
orderProfileVo
=
new
OrderProfileVo
();
orderProfileVo
.
setOrderDate
(
orderAmountMapEntry
.
getKey
());
orderProfileVo
.
setOrderAmount
(
orderAmountMapEntry
.
getValue
());
orderProfileVo
.
setDate
(
DateUtil
.
format
(
orderProfileVo
.
getOrderDate
(),
"MM.dd"
));
orderProfileVos
.
add
(
orderProfileVo
);
}
orderProfileVos
.
sort
(
Comparator
.
comparing
(
OrderProfileVo:
:
getOrderDate
));
return
orderProfileVos
;
}
/**
* 运营中心订单统计
*
* @param orderSuppiler
* @param orderProfileDispayVo
* @return
*/
private
OrderProfileDispayVo
analyticStatisticsCenterOrder
(
Supplier
<
Stream
<
BaseOrderDTO
>>
orderSuppiler
,
private
OrderProfileDispayVo
analyticStatisticsCenterOrder
(
List
<
BaseOrderDTO
>
baseOrders
,
OrderProfileDispayVo
orderProfileDispayVo
)
{
//根据公司id查询公司区域
Map
<
Integer
,
BranchCompanyAreaDTO
>
companyAreaDTOMap
=
new
HashMap
<>(
100
);
if
(!
CollectionUtils
.
isEmpty
(
baseOrders
)){
List
<
Integer
>
companyIds
=
baseOrders
.
stream
().
map
(
BaseOrderDTO:
:
getCompanyId
).
collect
(
Collectors
.
toList
());
List
<
BranchCompanyAreaDTO
>
branchCompnays
=
vehicleFeign
.
findBranchCompnayAreaByIds
(
companyIds
);
companyAreaDTOMap
=
branchCompnays
.
stream
().
collect
(
Collectors
.
toMap
(
BranchCompanyAreaDTO:
:
getCompanyId
,
Function
.
identity
()));
}
//筛选出租车订单
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
)));
Map
<
Integer
,
BranchCompanyAreaDTO
>
finalCompanyAreaDTOMap
=
companyAreaDTOMap
;
Map
<
Integer
,
BigDecimal
>
areaAmountMap
=
CollectionUtils
.
isEmpty
(
baseOrders
)
?
Collections
.
EMPTY_MAP
:
baseOrders
.
stream
().
filter
(
x
->
Objects
.
equals
(
x
.
getType
(),
OrderTypeEnum
.
RENT_VEHICLE
.
getCode
()))
.
peek
(
x
->{
BranchCompanyAreaDTO
branchCompanyAreaDTO
=
finalCompanyAreaDTOMap
.
get
(
x
.
getCompanyId
());
x
.
setAreaId
(
branchCompanyAreaDTO
.
getAreaId
());
})
.
collect
(
Collectors
.
groupingBy
(
BaseOrderDTO:
:
getAreaId
,
CollectorsUtil
.
summingBigDecimal
(
BaseOrderDTO:
:
getRealAmount
)));
List
<
CenterOrderProfileDisplayVo
>
centerOrderProfileDisplayVos
=
createCenterOrderProfileDisplay
(
areaAmountMap
);
orderProfileDispayVo
.
setCenterOrderProfileDisplays
(
centerOrderProfileDisplayVos
);
...
...
@@ -300,20 +342,14 @@ public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, O
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
();
List
<
CenterOrderProfileDisplayVo
>
centerOrderProfileDisplays
=
centerOrderProfileDisplayBiz
.
findCenterOrderProfileDisplays
();
for
(
CenterOrderProfileDisplayVo
centerOrderProfileDisplay
:
centerOrderProfileDisplays
)
{
Integer
areaId
=
centerOrderProfileDisplay
.
getAreaId
();
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
);
areaAmount
=
areaAmount
.
add
(
centerOrderProfileDisplay
.
getAreaAmount
());
centerOrderProfileDisplay
.
setAreaAmount
(
areaAmount
);
centerOrderProfileDisplayVos
.
add
(
centerOrderProfileDisplay
);
}
return
centerOrderProfileDisplayVos
;
}
...
...
@@ -327,11 +363,8 @@ public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, O
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
());
baseOrderDTO
.
setPayDate
(
x
.
getOrderDate
());
return
baseOrderDTO
;
}).
collect
(
Collectors
.
toList
());
return
CollectionUtils
.
isEmpty
(
baseOrderDTOS
)
?
new
ArrayList
<>()
:
baseOrderDTOS
;
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/mapper/BaseOrderMapper.java
View file @
c5544e9e
...
...
@@ -53,5 +53,7 @@ public interface BaseOrderMapper extends Mapper<BaseOrder> {
List
<
Achievement
>
selectTotalStatistical
(
QueryCriteria
queryCriteria
);
List
<
BaseOrderDTO
>
findOrdersByDate
(
@Param
(
"startDate"
)
Date
startDate
,
@Param
(
"endDate"
)
Date
endDate
);
@Param
(
"endDate"
)
Date
endDate
,
@Param
(
"startTime"
)
Long
startTime
,
@Param
(
"endTime"
)
Long
endTime
);
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/mapper/CenterOrderProfileDisplayMapper.java
0 → 100644
View file @
c5544e9e
package
com
.
xxfc
.
platform
.
order
.
mapper
;
import
com.xxfc.platform.order.entity.CenterOrderProfileDisplay
;
import
tk.mybatis.mapper.common.Mapper
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/12/26 15:49
*/
public
interface
CenterOrderProfileDisplayMapper
extends
Mapper
<
CenterOrderProfileDisplay
>
{
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/LargeScreenDisplayController.java
View file @
c5544e9e
...
...
@@ -19,7 +19,7 @@ import java.util.Date;
* @data 2019/12/24 16:29
*/
@RestController
@RequestMapping
(
"/large_screen"
)
@RequestMapping
(
"/large_screen
/app/unauth
"
)
@RequiredArgsConstructor
(
onConstructor
=
@__
(
@Autowired
))
public
class
LargeScreenDisplayController
{
...
...
xx-order/xx-order-server/src/main/resources/mapper/BaseOrderMapper.xml
View file @
c5544e9e
...
...
@@ -116,14 +116,14 @@
<select
id=
"listOrder"
parameterType=
"Map"
resultMap=
"orderListMap"
>
select b.*
<if
test=
"type==1"
>
,i.detail
as carArticlesJson
,i.detail as carArticlesJson
</if>
from base_order b
LEFT JOIN order_rent_vehicle_detail r on r.order_id = b.id
LEFT JOIN order_tour_detail t on t.order_id = b.id
LEFT JOIN order_member_detail m on m.order_id = b.id
<if
test=
"type==1"
>
LEFT JOIN (select * from
order_item where type = 104) i on
b.id = i.order_id
LEFT JOIN (select * from
order_item where type = 104) i on
b.id = i.order_id
</if>
<where>
<if
test=
"crtUser != null"
>
...
...
@@ -372,7 +372,7 @@
</select>
<select
id=
"findMemberOrders"
resultType=
"com.xxfc.platform.order.pojo.dto.MemberOrderBo"
>
select bo.*,omd.member_level AS `memberLevel` from (
select bo.*,omd.member_level AS `memberLevel` from (
SELECT
`id`,
`no` AS `orderNo`,
...
...
@@ -426,29 +426,33 @@
</foreach>
</if>
) AS `bo`
INNER JOIN (select
* from `order_member_detail` where
1=1
INNER JOIN (select
* from `order_member_detail` where
1=1
<if
test=
"level!=null"
>
and
`member_level`=#{level}
and
`member_level`=#{level}
</if>
) AS `omd` ON omd.order_id=bo.id
ORDER BY bo.`creatTime` DESC
</select>
<select
id=
"selectOrdersByTypeAndTime"
resultType=
"com.xxfc.platform.order.pojo.dto.OrderDTO"
>
select bo.id,bo.type,bo.status,bo.order_amount,bo.real_amount,bo.order_origin,bo.parent_user_id as `userId`,bo.parent_position_id as `postionId`,
bo.has_pay,bo.pay_way,omd.memberLevel,IFNULL(IFNULL(orvd.start_company_id,otd.start_company_id),`parent_user_company_id`) AS `companyId`,
select bo.id,bo.type,bo.status,bo.order_amount,bo.real_amount,bo.order_origin,bo.parent_user_id as
`userId`,bo.parent_position_id as `postionId`,
bo.has_pay,bo.pay_way,omd.memberLevel,IFNULL(IFNULL(orvd.start_company_id,otd.start_company_id),`parent_user_company_id`)
AS `companyId`,
orvd.deposit,orvd.cost_detail AS `costDetail`
from (select * from `base_order` where 1=1
<if
test=
"hasPay!=null"
>
and `has_pay`=#{hasPay}
</if>
and (`crt_time` between #{startDate} and #{endDate} or `pay_time` between #{startDate} and #{endDate} ) and `type` IN
<foreach
collection=
"types"
item=
"type"
open=
"("
close=
")"
separator=
","
>
<if
test=
"hasPay!=null"
>
and `has_pay`=#{hasPay}
</if>
and (`crt_time` between #{startDate} and #{endDate} or `pay_time` between #{startDate} and #{endDate} ) and
`type` IN
<foreach
collection=
"types"
item=
"type"
open=
"("
close=
")"
separator=
","
>
#{type}
</foreach>
) AS `bo`
LEFT JOIN (select `order_id`,`start_company_id`,`deposit`,`cost_detail` from `order_rent_vehicle_detail`) AS `orvd` ON
LEFT JOIN (select `order_id`,`start_company_id`,`deposit`,`cost_detail` from `order_rent_vehicle_detail`) AS
`orvd` ON
orvd.order_id=bo.id
LEFT JOIN (select `order_id`,`start_company_id` from `order_tour_detail`) AS `otd` ON otd.order_id=bo.id
LEFT JOIN (select `order_id`,`member_level` AS `memberLevel` from `order_member_detail`) AS `omd` ON
...
...
@@ -466,7 +470,8 @@
<select
id=
"selectTotalStatistical"
parameterType=
"com.xxfc.platform.order.pojo.QueryCriteria"
resultType=
"com.xxfc.platform.order.pojo.Achievement"
>
select
crt_time,no,type,order_amount,real_amount,realname,username,parentRealname,positionName,parentUsername,companyName,pay_way,company_id,(order_amount-real_amount) as favorablePrice
crt_time,no,type,order_amount,real_amount,realname,username,parentRealname,positionName,parentUsername,companyName,pay_way,company_id,(order_amount-real_amount)
as favorablePrice
from order_user_position_company
<where>
<if
test=
"startDate != null"
>
...
...
@@ -495,7 +500,20 @@
</select>
<select
id=
"findOrdersByDate"
resultType=
"com.xxfc.platform.order.pojo.dto.BaseOrderDTO"
>
SELECT bo.*,orvd.start_company_id as `companyId`,orvd.`start_zone_id` as `areaId` FROM(
SELECT
`id`,
`type`,
`real_amount`,
`pay_way`,
`pay_origin`,
`pay_time`
FROM
`base_order`
WHERE
has_pay = 1 and `pay_time` BETWEEN #{startTime} AND #{endTime}
) as bo
left join order_rent_vehicle_detail as orvd on orvd.order_id=bo.id;
</select>
</mapper>
\ No newline at end of file
xx-order/xx-order-server/src/main/resources/mapper/CenterOrderProfileDisplayMapper.xml
0 → 100644
View file @
c5544e9e
<?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.CenterOrderProfileDisplayMapper"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.xxfc.platform.order.entity.CenterOrderProfileDisplay"
id=
"centerOrderProfileDisplayMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"areaId"
column=
"area_id"
/>
<result
property=
"areaName"
column=
"area_name"
/>
<result
property=
"areaAmount"
column=
"area_amount"
/>
</resultMap>
</mapper>
\ No newline at end of file
xx-order/xx-order-server/src/main/resources/mapper/OrderProfileDisplayMapper.xml
View file @
c5544e9e
...
...
@@ -6,14 +6,8 @@
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.xxfc.platform.order.entity.OrderProfileDisplay"
id=
"orderProfileDisplayMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"areaId"
column=
"area_id"
/>
<result
property=
"areaName"
column=
"area_name"
/>
<result
property=
"orderAmount"
column=
"order_amount"
/>
<result
property=
"orderDate"
column=
"order_date"
/>
<result
property=
"orderNum"
column=
"order_num"
/>
<result
property=
"orderType"
column=
"order_num"
/>
<result
property=
"payTerminal"
column=
"pay_terminal"
/>
<result
property=
"payWay"
column=
"pay_way"
/>
</resultMap>
<select
id=
"findOrderProfileDisplayDatabyDate"
resultMap=
"orderProfileDisplayMap"
>
...
...
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/entity/VehicleProfileDisplay.java
View file @
c5544e9e
package
com
.
xxfc
.
platform
.
vehicle
.
entity
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
...
...
@@ -20,6 +21,7 @@ import javax.persistence.*;
public
class
VehicleProfileDisplay
{
@Id
@GeneratedValue
(
generator
=
"JDBC"
)
@JsonIgnore
private
Integer
id
;
/**
* 省份code
...
...
@@ -32,26 +34,9 @@ public class VehicleProfileDisplay {
@Column
(
name
=
"province_name"
)
private
String
provinceName
;
/**
*
出行中
*
车辆数量
*/
@Column
(
name
=
"travel_num"
)
private
Integer
travelNum
;
/**
* 待出行
*/
@Column
(
name
=
"to_travel_num"
)
private
Integer
toTravelNum
;
/**
* 保养中
*/
@Column
(
name
=
"maintenance_num"
)
private
Integer
maintenanceNum
;
/**
* 维修中
*/
@Column
(
name
=
"in_maintenance_num"
)
private
Integer
inMaintenanceNum
;
@Column
(
name
=
"vehicle_num"
)
private
Integer
vehicleNum
;
}
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/feign/VehicleFeign.java
View file @
c5544e9e
...
...
@@ -6,6 +6,7 @@ import com.github.wxiaoqi.security.common.vo.PageDataVO;
import
com.xxfc.platform.vehicle.common.RestResponse
;
import
com.xxfc.platform.vehicle.entity.*
;
import
com.xxfc.platform.vehicle.pojo.*
;
import
com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO
;
import
com.xxfc.platform.vehicle.pojo.dto.BranchCompanyFindDTO
;
import
com.xxfc.platform.vehicle.pojo.dto.VehicleModelCalendarPriceDTO
;
import
com.xxfc.platform.vehicle.pojo.vo.AccompanyingItemVo
;
...
...
@@ -215,4 +216,7 @@ public interface VehicleFeign {
@GetMapping
(
"/area/areas"
)
List
<
Area
>
findAllAreas
();
@GetMapping
(
"/branchCompany/compnays_area"
)
public
List
<
BranchCompanyAreaDTO
>
findBranchCompnayAreaByIds
(
@RequestParam
(
"companyIds"
)
List
<
Integer
>
compnayIds
);
}
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/dto/BranchCompanyAreaDTO.java
View file @
c5544e9e
...
...
@@ -17,8 +17,7 @@ import java.io.Serializable;
@AllArgsConstructor
public
class
BranchCompanyAreaDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
Integer
comp
na
yId
;
private
Integer
comp
an
yId
;
private
String
companyName
;
private
Integer
areaId
;
private
String
areaName
;
}
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/vo/VehicleProfileDisplayVo.java
View file @
c5544e9e
...
...
@@ -21,24 +21,6 @@ import java.util.List;
@AllArgsConstructor
public
class
VehicleProfileDisplayVo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 出行中
*/
private
long
travelNum
;
/**
* 待出行
*/
private
long
toTravelNum
;
/**
* 保养中
*/
private
long
maintenanceNum
;
/**
* 维修中
*/
private
long
inMaintenanceNum
;
/**
* 每个省份车辆概况数据
*/
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/BranchCompanyBiz.java
View file @
c5544e9e
...
...
@@ -24,6 +24,7 @@ import com.xxfc.platform.vehicle.mapper.BranchCompanyMapper;
import
com.xxfc.platform.vehicle.pojo.BranchCompanyVo
;
import
com.xxfc.platform.vehicle.pojo.CompanyDetail
;
import
com.xxfc.platform.vehicle.pojo.CompanySearchDTO
;
import
com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO
;
import
com.xxfc.platform.vehicle.pojo.dto.BranchCompanyFindDTO
;
import
com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO
;
import
com.xxfc.platform.vehicle.pojo.vo.BranComanyLeaderVo
;
...
...
@@ -446,4 +447,8 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
return
branchCompanies
.
stream
().
collect
(
Collectors
.
toMap
(
BranchCompany:
:
getId
,
BranchCompany:
:
getName
));
}
public
List
<
BranchCompanyAreaDTO
>
findBranchCompanyAreaByIds
(
List
<
Integer
>
compnayIds
)
{
List
<
BranchCompanyAreaDTO
>
branchCompanyAreaDTOS
=
mapper
.
findBranchCompanyAreaByIds
(
compnayIds
);
return
CollectionUtils
.
isEmpty
(
branchCompanyAreaDTOS
)?
Collections
.
EMPTY_LIST
:
branchCompanyAreaDTOS
;
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleProfileDisplayBiz.java
View file @
c5544e9e
...
...
@@ -11,16 +11,13 @@ 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
...
...
@@ -36,65 +33,28 @@ public class VehicleProfileDisplayBiz extends BaseBiz<VehicleProfileDisplayMappe
/**
* 字典查询type
*/
@Value
(
"
large.screen.type:LARGE_SCREEN_DISPLAY
"
)
@Value
(
"
${large.screen.type:LARGE_SCREEN_DISPLAY}
"
)
private
String
largeScreenType
;
/**
* 字典查询code
*/
@Value
(
"
large.screen.cct.code:LARGE_SCREEN_DISPLAY_CCT_CONSTANT
"
)
@Value
(
"
${large.screen.cct.code:LARGE_SCREEN_DISPLAY_CCT_CONSTANT}
"
)
private
String
largeScreenCode
;
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
))
{
try
{
latch
.
await
();
}
catch
(
InterruptedException
e
)
{
log
.
error
(
"查询失败【{}】"
,
e
);
}
return
largeScreenDisplayBaseDataVo
;
Dictionary
dictionary
=
thirdFeign
.
findDictionaryByTypeAndCode
(
largeScreenType
,
largeScreenCode
);
if
(
dictionary
!=
null
&&
StringUtils
.
hasText
(
dictionary
.
getDetail
()))
{
LargeScreenDisplayCCTConstantDataBo
largeScreenDisplayConstantDataBo
=
JSON
.
parseObject
(
dictionary
.
getDetail
(),
LargeScreenDisplayCCTConstantDataBo
.
class
);
largeScreenDisplayBaseDataVo
.
setLargeScreenDisplayCCTConstantDataBo
(
largeScreenDisplayConstantDataBo
);
}
long
travelNum
=
0
;
long
toTravelNum
=
0
;
long
maintenanceNum
=
0
;
long
inMaintenanceNum
=
0
;
for
(
VehicleProfileDisplay
vehicleProfileDisplay
:
vehicleProfileDisplays
)
{
travelNum
=
+
vehicleProfileDisplay
.
getTravelNum
();
toTravelNum
=
+
vehicleProfileDisplay
.
getToTravelNum
();
maintenanceNum
=
+
vehicleProfileDisplay
.
getMaintenanceNum
();
inMaintenanceNum
=
+
vehicleProfileDisplay
.
getInMaintenanceNum
();
}
vehicleProfileDisplayVo
.
setTravelNum
(
travelNum
);
vehicleProfileDisplayVo
.
setToTravelNum
(
toTravelNum
);
vehicleProfileDisplayVo
.
setMaintenanceNum
(
maintenanceNum
);
vehicleProfileDisplayVo
.
setInMaintenanceNum
(
inMaintenanceNum
);
vehicleProfileDisplayVo
.
setVehicleProfileDisplays
(
vehicleProfileDisplays
);
largeScreenDisplayBaseDataVo
.
setVehicleProfileDisplayVo
(
vehicleProfileDisplayVo
);
try
{
latch
.
await
();
}
catch
(
InterruptedException
e
)
{
log
.
error
(
"查询失败【{}】"
,
e
);
}
return
largeScreenDisplayBaseDataVo
;
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/mapper/BranchCompanyMapper.java
View file @
c5544e9e
...
...
@@ -2,6 +2,7 @@ package com.xxfc.platform.vehicle.mapper;
import
com.alibaba.fastjson.JSONObject
;
import
com.xxfc.platform.vehicle.entity.BranchCompany
;
import
com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO
;
import
com.xxfc.platform.vehicle.pojo.dto.BranchCompanyListDTO
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Select
;
...
...
@@ -24,4 +25,5 @@ public interface BranchCompanyMapper extends Mapper<BranchCompany>, SelectByIdLi
List
<
JSONObject
>
getList
();
List
<
BranchCompanyAreaDTO
>
findBranchCompanyAreaByIds
(
@Param
(
"companyIds"
)
List
<
Integer
>
compnayIds
);
}
\ No newline at end of file
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/BranchCompanyController.java
View file @
c5544e9e
...
...
@@ -19,6 +19,7 @@ import com.xxfc.platform.vehicle.entity.BranchCompany;
import
com.xxfc.platform.vehicle.pojo.BranchCompanyVo
;
import
com.xxfc.platform.vehicle.pojo.CompanyDetail
;
import
com.xxfc.platform.vehicle.pojo.CompanySearchDTO
;
import
com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO
;
import
com.xxfc.platform.vehicle.pojo.dto.BranchCompanyFindDTO
;
import
com.xxfc.platform.vehicle.pojo.vo.BranComanyLeaderVo
;
import
com.xxfc.platform.vehicle.pojo.vo.BranchCompanyListVO
;
...
...
@@ -228,4 +229,9 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> {
return
baseBiz
.
selectCompanyMap
();
}
@GetMapping
(
"/compnays_area"
)
public
List
<
BranchCompanyAreaDTO
>
findBranchCompnayAreaByIds
(
@RequestParam
(
"companyIds"
)
List
<
Integer
>
compnayIds
){
return
baseBiz
.
findBranchCompanyAreaByIds
(
compnayIds
);
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/LargeScreenDisplayCCTVehicleController.java
View file @
c5544e9e
...
...
@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.RestController;
* @data 2019/12/26 9:41
*/
@RestController
@RequestMapping
(
"/large_screen"
)
@RequestMapping
(
"/large_screen
/app/unauth
"
)
@RequiredArgsConstructor
(
onConstructor
=
@__
(
@Autowired
))
public
class
LargeScreenDisplayCCTVehicleController
{
private
final
VehicleProfileDisplayBiz
vehicleProfileDisplayBiz
;
...
...
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/BranchCompanyMapper.xml
View file @
c5544e9e
...
...
@@ -97,4 +97,15 @@
</if>
) AS `cb` ON cb.id = bc.company_base_id ORDER BY bc.id
</select>
<select
id=
"findBranchCompanyAreaByIds"
resultType=
"com.xxfc.platform.vehicle.pojo.dto.BranchCompanyAreaDTO"
>
select `id` as `companyId`,`name` as `companyName`,`zone_id` as `areaId` from `branch_company`
<if
test=
"companyIds != null and companyIds.size() != 0"
>
where `id` in
<foreach
collection=
"companyIds"
item=
"companyId"
open=
"("
close=
")"
separator=
","
>
#{companyId}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleProfileDisplayMapper.xml
View file @
c5544e9e
...
...
@@ -8,9 +8,6 @@
<result
property=
"id"
column=
"id"
/>
<result
property=
"provinceName"
column=
"province_name"
/>
<result
property=
"provinceCode"
column=
"province_code"
/>
<result
property=
"inMaintenanceNum"
column=
"in_maintenance_num"
/>
<result
property=
"maintenanceNum"
column=
"maintenance_num"
/>
<result
property=
"toTravelNum"
column=
"to_travel_num"
/>
<result
property=
"travelNum"
column=
"travel_num"
/>
<result
property=
"vehicleNum"
column=
"vehicle_num"
/>
</resultMap>
</mapper>
\ No newline at end of file
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