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
798d3544
Commit
798d3544
authored
Oct 25, 2019
by
hanfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改订单统计
parent
a82e8a7f
Changes
24
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
371 additions
and
410 deletions
+371
-410
TimeMinimumSubdivisionEnum.java
...m/order/contant/enumerate/TimeMinimumSubdivisionEnum.java
+24
-0
OrderStatistics.java
.../java/com/xxfc/platform/order/entity/OrderStatistics.java
+2
-2
HomePageOrderData.java
.../java/com/xxfc/platform/order/pojo/HomePageOrderData.java
+3
-3
Term.java
...-api/src/main/java/com/xxfc/platform/order/pojo/Term.java
+46
-0
DailyMembersOrderStatisticsBiz.java
...fc/platform/order/biz/DailyMembersOrderStatisticsBiz.java
+46
-32
DailyOrderStatisticsBiz.java
.../com/xxfc/platform/order/biz/DailyOrderStatisticsBiz.java
+3
-3
DailyTravelOrderStatisticsBiz.java
...xfc/platform/order/biz/DailyTravelOrderStatisticsBiz.java
+37
-81
DailyVehicleOrderStatisticsBiz.java
...fc/platform/order/biz/DailyVehicleOrderStatisticsBiz.java
+28
-171
OrderAccountBiz.java
...ain/java/com/xxfc/platform/order/biz/OrderAccountBiz.java
+4
-4
OrderStatisticsBiz.java
.../java/com/xxfc/platform/order/biz/OrderStatisticsBiz.java
+86
-43
DailyMembersOrderStatisticsMapper.java
...tform/order/mapper/DailyMembersOrderStatisticsMapper.java
+1
-1
DailyTravelOrderStatisticsMapper.java
...atform/order/mapper/DailyTravelOrderStatisticsMapper.java
+1
-1
DailyVehicleOrderStatisticsMapper.java
...tform/order/mapper/DailyVehicleOrderStatisticsMapper.java
+1
-1
OrderAccountMapper.java
...va/com/xxfc/platform/order/mapper/OrderAccountMapper.java
+2
-1
OrderStatisticsController.java
...form/order/rest/background/OrderStatisticsController.java
+20
-50
DailyMembersOrderStatisticsMapper.xml
...in/resources/mapper/DailyMembersOrderStatisticsMapper.xml
+5
-3
DailyTravelOrderStatisticsMapper.xml
...ain/resources/mapper/DailyTravelOrderStatisticsMapper.xml
+5
-2
DailyVehicleOrderStatisticsMapper.xml
...in/resources/mapper/DailyVehicleOrderStatisticsMapper.xml
+6
-3
OrderAccountMapper.xml
...r-server/src/main/resources/mapper/OrderAccountMapper.xml
+32
-7
ServiceTest.java
xx-order/xx-order-server/src/test/java/ServiceTest.java
+1
-2
XCFQAuthentication.java
...vice/authenticationInterface/impl/XCFQAuthentication.java
+1
-0
VehicleFeign.java
...in/java/com/xxfc/platform/vehicle/feign/VehicleFeign.java
+3
-0
BranchCompanyBiz.java
.../java/com/xxfc/platform/vehicle/biz/BranchCompanyBiz.java
+4
-0
BranchCompanyController.java
...m/xxfc/platform/vehicle/rest/BranchCompanyController.java
+10
-0
No files found.
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/contant/enumerate/TimeMinimumSubdivisionEnum.java
0 → 100644
View file @
798d3544
package
com
.
xxfc
.
platform
.
order
.
contant
.
enumerate
;
/**
* 查询时间段最小细分(时间段内又划分的片段)
*/
public
enum
TimeMinimumSubdivisionEnum
{
nothing
(
0
,
"无细分"
),
day
(
1
,
"最小细分到天"
)
;
private
int
code
;
private
String
msg
;
public
String
getMsg
()
{
return
msg
;
}
TimeMinimumSubdivisionEnum
(
int
code
,
String
msg
)
{
this
.
code
=
code
;
this
.
msg
=
msg
;
}
public
Integer
getCode
()
{
return
code
;
}
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/entity/OrderStatistics.java
View file @
798d3544
...
@@ -64,6 +64,6 @@ public class OrderStatistics {
...
@@ -64,6 +64,6 @@ public class OrderStatistics {
/**
/**
* 订单补偿总额
* 订单补偿总额
*/
*/
@ApiModelProperty
(
value
=
"订单补偿总额"
)
@ApiModelProperty
(
value
=
"
历史
订单补偿总额"
)
private
BigDecimal
o
rderCompensation
;
private
BigDecimal
totalO
rderCompensation
;
}
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/HomePageOrderData.java
View file @
798d3544
...
@@ -9,15 +9,15 @@ public class HomePageOrderData {
...
@@ -9,15 +9,15 @@ public class HomePageOrderData {
/**
/**
* 订单总额
* 订单总额
*/
*/
private
BigDecimal
totalOrders
;
private
BigDecimal
totalOrders
=
BigDecimal
.
ZERO
;
/**
/**
* 为退还押金总额
* 为退还押金总额
*/
*/
private
BigDecimal
totalOutstandingDeposit
;
private
BigDecimal
totalOutstandingDeposit
=
BigDecimal
.
ZERO
;
/**
/**
* 额外赔款
* 额外赔款
*/
*/
private
BigDecimal
additionalIndemnity
;
private
BigDecimal
additionalIndemnity
=
BigDecimal
.
ZERO
;
}
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/Term.java
0 → 100644
View file @
798d3544
package
com
.
xxfc
.
platform
.
order
.
pojo
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
Term
{
/**
* 订单类型
*/
private
Integer
orderType
;
/**
* 几天前(用于判断计算几天前的数据) subdivide=2的实际存在
*/
private
Integer
day
;
/**
* 时间最小细分类型(最小细分到天,无细分)
*/
private
int
subdivide
;
/**
* 开始时间
*/
private
Long
startTime
;
/**
* 结束时间
*/
private
Long
endTime
;
/**
* 分公司id 数组
*/
private
List
<
Integer
>
companyIds
;
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/DailyMembersOrderStatisticsBiz.java
View file @
798d3544
...
@@ -10,6 +10,7 @@ import com.xxfc.platform.order.entity.OrderAccount;
...
@@ -10,6 +10,7 @@ import com.xxfc.platform.order.entity.OrderAccount;
import
com.xxfc.platform.order.entity.OrderStatistics
;
import
com.xxfc.platform.order.entity.OrderStatistics
;
import
com.xxfc.platform.order.mapper.DailyMembersOrderStatisticsMapper
;
import
com.xxfc.platform.order.mapper.DailyMembersOrderStatisticsMapper
;
import
com.xxfc.platform.order.pojo.OrderQuery
;
import
com.xxfc.platform.order.pojo.OrderQuery
;
import
com.xxfc.platform.order.pojo.Term
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDTO
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDTO
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDetail
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDetail
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -43,50 +44,61 @@ public class DailyMembersOrderStatisticsBiz extends BaseBiz<DailyMembersOrderSta
...
@@ -43,50 +44,61 @@ public class DailyMembersOrderStatisticsBiz extends BaseBiz<DailyMembersOrderSta
/**
/**
* 总公司id默认为1
* 总公司id默认为1
*/
*/
private
final
Integer
OMPANY_ID
=
1
;
private
final
Integer
OMPANY_ID
=
1
;
@Autowired
@Autowired
private
OrderAccountBiz
accountBiz
;
private
OrderAccountBiz
accountBiz
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
saveD
ailyMembersOrderRecord
(
Integer
day
)
{
public
boolean
d
ailyMembersOrderRecord
(
Integer
day
)
{
try
{
try
{
List
<
OrderAccountDTO
>
accountList
=
accountBiz
.
getOrderAccountByOrderType
(
OrderTypeEnum
.
MEMBER
.
getCode
(),
day
);
DailyMembersOrderStatistics
orderStatistics
=
statistics
(
new
Term
(
OrderTypeEnum
.
MEMBER
.
getCode
(),
day
,
1
,
null
,
null
,
null
));
log
.
info
(
"Members:统计完成"
);
if
(
CollectionUtils
.
isNotEmpty
(
accountList
))
{
save
(
orderStatistics
);
DailyMembersOrderStatistics
orderStatistics
=
new
DailyMembersOrderStatistics
();
log
.
info
(
"Members:保存成功"
);
ArrayList
<
OrderAccountDetail
>
orderAccountDetails
=
getOrderAccountDetail
(
accountList
);
if
(
CollectionUtils
.
isNotEmpty
(
orderAccountDetails
))
{
//获取订单总额
BigDecimal
gmv
=
getOrderAmountTotal
(
orderAccountDetails
);
orderStatistics
.
setGmv
(
gmv
);
orderStatistics
.
setBranchCompanyId
(
OMPANY_ID
);
orderStatistics
.
setOneDay
(
accountList
.
get
(
0
).
getOneDay
());
}
log
.
info
(
"Members:统计完成"
);
if
(
JudgmentOfExistence
(
orderStatistics
))
{
insertSelectiveRe
(
orderStatistics
);
}
else
{
mapper
.
updateByExampleSelective
(
orderStatistics
,
Example
.
builder
(
DailyMembersOrderStatistics
.
class
)
.
where
(
WeekendSqls
.<
DailyMembersOrderStatistics
>
custom
()
.
andEqualTo
(
DailyMembersOrderStatistics:
:
getOneDay
,
orderStatistics
.
getOneDay
())
.
andEqualTo
(
DailyMembersOrderStatistics:
:
getBranchCompanyId
,
orderStatistics
.
getBranchCompanyId
()))
.
build
());
}
log
.
info
(
"Members:保存成功"
);
}
return
true
;
return
true
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
log
.
error
(
"Members:"
+
e
.
getMessage
());
log
.
error
(
"Members:"
+
e
.
getMessage
());
return
false
;
return
false
;
}
}
}
}
public
void
save
(
DailyMembersOrderStatistics
orderStatistics
)
{
if
(
orderStatistics
!=
null
)
{
if
(
JudgmentOfExistence
(
orderStatistics
))
{
insertSelectiveRe
(
orderStatistics
);
}
else
{
mapper
.
updateByExampleSelective
(
orderStatistics
,
Example
.
builder
(
DailyMembersOrderStatistics
.
class
)
.
where
(
WeekendSqls
.<
DailyMembersOrderStatistics
>
custom
()
.
andEqualTo
(
DailyMembersOrderStatistics:
:
getOneDay
,
orderStatistics
.
getOneDay
())
.
andEqualTo
(
DailyMembersOrderStatistics:
:
getBranchCompanyId
,
orderStatistics
.
getBranchCompanyId
()))
.
build
());
}
}
}
public
DailyMembersOrderStatistics
statistics
(
Term
term
)
{
List
<
OrderAccountDTO
>
accountList
=
accountBiz
.
getOrderAccountByOrderType
(
term
);
if
(
CollectionUtils
.
isNotEmpty
(
accountList
))
{
DailyMembersOrderStatistics
orderStatistics
=
new
DailyMembersOrderStatistics
();
ArrayList
<
OrderAccountDetail
>
orderAccountDetails
=
getOrderAccountDetail
(
accountList
);
if
(
CollectionUtils
.
isNotEmpty
(
orderAccountDetails
))
{
//获取订单总额
BigDecimal
gmv
=
getOrderAmountTotal
(
orderAccountDetails
);
orderStatistics
.
setGmv
(
gmv
);
orderStatistics
.
setBranchCompanyId
(
OMPANY_ID
);
orderStatistics
.
setOneDay
(
accountList
.
get
(
0
).
getOneDay
());
}
return
orderStatistics
;
}
return
null
;
}
/**
/**
* 添加前查询是否存在这条数据
* 添加前查询是否存在这条数据
*
* @param orderStatistic
* @param orderStatistic
* @return
* @return
*/
*/
...
@@ -101,6 +113,7 @@ public class DailyMembersOrderStatisticsBiz extends BaseBiz<DailyMembersOrderSta
...
@@ -101,6 +113,7 @@ public class DailyMembersOrderStatisticsBiz extends BaseBiz<DailyMembersOrderSta
}
}
return
true
;
return
true
;
}
}
/**
/**
* 获取押金和
* 获取押金和
*
*
...
@@ -143,16 +156,17 @@ public class DailyMembersOrderStatisticsBiz extends BaseBiz<DailyMembersOrderSta
...
@@ -143,16 +156,17 @@ public class DailyMembersOrderStatisticsBiz extends BaseBiz<DailyMembersOrderSta
return
mapper
.
insertSelective
(
entity
);
return
mapper
.
insertSelective
(
entity
);
}
}
public
OrderStatistics
findAll
(
Integer
companyId
)
{
public
OrderStatistics
findAll
(
List
<
Integer
>
companyIds
)
{
return
mapper
.
monthOrderTotal
(
companyId
);
return
mapper
.
monthOrderTotal
(
companyId
s
);
}
}
/**
/**
* 根据时间按年月日分组
* 根据时间按年月日分组
*
* @param query
* @param query
* @return
* @return
*/
*/
public
List
<
MembersOrder
>
getMemberOrderStatistics
(
OrderQuery
query
)
{
public
List
<
MembersOrder
>
getMemberOrderStatistics
(
OrderQuery
query
)
{
return
mapper
.
getMemberOrderStatistics
(
query
);
return
mapper
.
getMemberOrderStatistics
(
query
);
}
}
}
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/DailyOrderStatisticsBiz.java
View file @
798d3544
...
@@ -26,9 +26,9 @@ public class DailyOrderStatisticsBiz extends BaseBiz<DailyOrderStatisticsMapper,
...
@@ -26,9 +26,9 @@ public class DailyOrderStatisticsBiz extends BaseBiz<DailyOrderStatisticsMapper,
private
DailyMembersOrderStatisticsBiz
membersStatisticsBiz
;
private
DailyMembersOrderStatisticsBiz
membersStatisticsBiz
;
public
boolean
statisticalOrder
(
Integer
day
){
public
boolean
statisticalOrder
(
Integer
day
){
boolean
vehicleFlag
=
vehicleStatisticsBiz
.
saveD
ailyVehicleOrderRecord
(
day
);
boolean
vehicleFlag
=
vehicleStatisticsBiz
.
d
ailyVehicleOrderRecord
(
day
);
boolean
travelFlag
=
travelStatisticsBiz
.
saveD
ailyTravelOrderRecord
(
day
);
boolean
travelFlag
=
travelStatisticsBiz
.
d
ailyTravelOrderRecord
(
day
);
boolean
membersFlag
=
membersStatisticsBiz
.
saveD
ailyMembersOrderRecord
(
day
);
boolean
membersFlag
=
membersStatisticsBiz
.
d
ailyMembersOrderRecord
(
day
);
if
(
vehicleFlag
&&
travelFlag
&&
membersFlag
){
if
(
vehicleFlag
&&
travelFlag
&&
membersFlag
){
log
.
info
(
"----statisticalOrder:成功-----"
);
log
.
info
(
"----statisticalOrder:成功-----"
);
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/DailyTravelOrderStatisticsBiz.java
View file @
798d3544
...
@@ -12,6 +12,7 @@ import com.xxfc.platform.order.contant.enumerate.DeductionTypeEnum;
...
@@ -12,6 +12,7 @@ import com.xxfc.platform.order.contant.enumerate.DeductionTypeEnum;
import
com.xxfc.platform.order.contant.enumerate.OrderTypeEnum
;
import
com.xxfc.platform.order.contant.enumerate.OrderTypeEnum
;
import
com.xxfc.platform.order.entity.*
;
import
com.xxfc.platform.order.entity.*
;
import
com.xxfc.platform.order.mapper.DailyTravelOrderStatisticsMapper
;
import
com.xxfc.platform.order.mapper.DailyTravelOrderStatisticsMapper
;
import
com.xxfc.platform.order.pojo.Term
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDTO
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDTO
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDeduction
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDeduction
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDetail
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDetail
;
...
@@ -43,89 +44,18 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
...
@@ -43,89 +44,18 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
@Autowired
@Autowired
private
OrderAccountBiz
accountBiz
;
private
OrderAccountBiz
accountBiz
;
// @Transactional(rollbackFor = Exception.class)
// public boolean StatisticsOfTravelOrders() {
// try {
//
// ArrayList<DailyTravelOrderStatistics> objects = new ArrayList<>();
// List<DailyTravelOrderStatistics> travelGmv = mapper.getTravelGmv(day);
// objects.addAll(travelGmv);
// List<DailyTravelOrderStatistics> travelPenalSum = mapper.getTravelPenalSum(day);
// objects.addAll(travelPenalSum);
// insertByList(objects);
//
// return true;
// } catch (Exception e) {
// e.printStackTrace();
// TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
// return false;
// }
// }
//
// private void insertByList(ArrayList<DailyTravelOrderStatistics> objects) throws Exception {
//
// if (CollectionUtils.isNotEmpty(objects)) {
// HashMap<Integer, DailyTravelOrderStatistics> map = new HashMap<>();
// for (DailyTravelOrderStatistics object : objects) {
//
// DailyTravelOrderStatistics statistics = map.get(object.getBranchCompanyId());
// if (statistics == null) {
// statistics = new DailyTravelOrderStatistics();
// map.put(object.getBranchCompanyId(), statistics);
// }
//
// BeanUtil.copyProperties(object, statistics, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
//
// }
// String oneDay = map.entrySet().parallelStream().map(Map.Entry::getValue).collect(Collectors.toList()).get(0).getOneDay();
//
// if (StringUtils.isBlank(oneDay)) {
// throw new BaseException();
// }
// Example exa= new Example(DailyTravelOrderStatistics.class);
// exa.createCriteria().andEqualTo("oneDay",oneDay);
// List<DailyTravelOrderStatistics> statistics= selectByExample(exa);
// if (CollectionUtils.isEmpty(statistics)){
// for (Map.Entry<Integer, DailyTravelOrderStatistics> entry : map.entrySet()) {
// insertSelectiveRe(entry.getValue());
// }
// }else {
// log.error("今日已统计车辆订单,请不要重复统计!");
// }
//
////
//// for (Map.Entry<Integer, DailyTravelOrderStatistics> e : map.entrySet()) {
//// insertSelectiveRe(e.getValue());
//// }
// }
// }
/******************************************************************************************************************************/
/**
/**
* 统计订单并保存到数据库当中
* 统计订单并保存到数据库当中
* @return
* @return
*/
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
boolean
saveD
ailyTravelOrderRecord
(
Integer
day
)
{
public
boolean
d
ailyTravelOrderRecord
(
Integer
day
)
{
try
{
try
{
//获取每日订单统计
//获取每日订单统计
List
<
DailyTravelOrderStatistics
>
orderStatistics
=
getDailyTravelOrderStatistics
(
day
);
List
<
DailyTravelOrderStatistics
>
orderStatistics
=
getDailyTravelOrderStatistics
(
new
Term
(
OrderTypeEnum
.
TOUR
.
getCode
(),
day
,
1
,
null
,
null
,
null
)
);
log
.
info
(
"Travel:统计完成"
);
log
.
info
(
"Travel:统计完成"
);
if
(
CollectionUtils
.
isNotEmpty
(
orderStatistics
))
{
seve
(
orderStatistics
);
for
(
DailyTravelOrderStatistics
orderStatistic
:
orderStatistics
)
{
if
(
JudgmentOfExistence
(
orderStatistic
))
{
insertSelectiveRe
(
orderStatistic
);
}
else
{
mapper
.
updateByExampleSelective
(
orderStatistic
,
Example
.
builder
(
DailyTravelOrderStatistics
.
class
)
.
where
(
WeekendSqls
.<
DailyTravelOrderStatistics
>
custom
()
.
andEqualTo
(
DailyTravelOrderStatistics:
:
getOneDay
,
orderStatistic
.
getOneDay
())
.
andEqualTo
(
DailyTravelOrderStatistics:
:
getBranchCompanyId
,
orderStatistic
.
getBranchCompanyId
()))
.
build
());
}
}
}
log
.
info
(
"Travel:保存成功"
);
log
.
info
(
"Travel:保存成功"
);
return
true
;
return
true
;
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -135,6 +65,23 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
...
@@ -135,6 +65,23 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
}
}
}
}
public
void
seve
(
List
<
DailyTravelOrderStatistics
>
orderStatistics
)
{
if
(
CollectionUtils
.
isNotEmpty
(
orderStatistics
))
{
for
(
DailyTravelOrderStatistics
orderStatistic
:
orderStatistics
)
{
if
(
JudgmentOfExistence
(
orderStatistic
))
{
insertSelectiveRe
(
orderStatistic
);
}
else
{
mapper
.
updateByExampleSelective
(
orderStatistic
,
Example
.
builder
(
DailyTravelOrderStatistics
.
class
)
.
where
(
WeekendSqls
.<
DailyTravelOrderStatistics
>
custom
()
.
andEqualTo
(
DailyTravelOrderStatistics:
:
getOneDay
,
orderStatistic
.
getOneDay
())
.
andEqualTo
(
DailyTravelOrderStatistics:
:
getBranchCompanyId
,
orderStatistic
.
getBranchCompanyId
()))
.
build
());
}
}
}
}
/**
/**
* 添加前查询是否存在这条数据
* 添加前查询是否存在这条数据
* @param orderStatistic
* @param orderStatistic
...
@@ -151,9 +98,9 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
...
@@ -151,9 +98,9 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
}
}
return
true
;
return
true
;
}
}
p
rivate
List
<
DailyTravelOrderStatistics
>
getDailyTravelOrderStatistics
(
Integer
day
)
{
p
ublic
List
<
DailyTravelOrderStatistics
>
getDailyTravelOrderStatistics
(
Term
term
)
{
//获取当天所有订单账目
//获取当天所有订单账目
List
<
OrderAccountDTO
>
accountList
=
accountBiz
.
getOrderAccountByOrderType
(
OrderTypeEnum
.
TOUR
.
getCode
(),
day
);
List
<
OrderAccountDTO
>
accountList
=
accountBiz
.
getOrderAccountByOrderType
(
term
);
if
(
CollectionUtils
.
isEmpty
(
accountList
))
{
if
(
CollectionUtils
.
isEmpty
(
accountList
))
{
return
null
;
return
null
;
}
}
...
@@ -225,19 +172,27 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
...
@@ -225,19 +172,27 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
}
}
if
(
CollectionUtils
.
isNotEmpty
(
arrayList
))
{
if
(
CollectionUtils
.
isNotEmpty
(
arrayList
))
{
ArrayList
<
OrderAccountDetail
>
orderAccountDetail
=
getOrderAccountDetail
(
arrayList
);
ArrayList
<
OrderAccountDetail
>
orderAccountDetail
=
getOrderAccountDetail
(
arrayList
);
if
(
CollectionUtils
.
isNotEmpty
(
orderAccountDetail
))
{
if
(
CollectionUtils
.
isNotEmpty
(
orderAccountDetail
))
{
//订单退还总额
BigDecimal
depositAmountTotal
=
getOrderAmountTotal
(
orderAccountDetail
);
orderStatistics
.
setReturnGmv
(
depositAmountTotal
);
List
<
OrderAccountDeduction
>
OrderAccountDeductions
=
gettDeductions
(
orderAccountDetail
);
List
<
OrderAccountDeduction
>
OrderAccountDeductions
=
gettDeductions
(
orderAccountDetail
);
//获取违约总额
//获取违约总额
BigDecimal
bigDecimal
=
get
(
OrderAccountDeductions
,
new
ArrayList
<
Integer
>()
{{
BigDecimal
bigDecimal
=
get
(
OrderAccountDeductions
,
new
ArrayList
<
Integer
>()
{{
add
(
DeductionTypeEnum
.
VIOLATE_CANCEL
.
getCode
());
add
(
DeductionTypeEnum
.
VIOLATE_CANCEL
.
getCode
());
add
(
DeductionTypeEnum
.
VIOLATE_ADVANCE
.
getCode
());
add
(
DeductionTypeEnum
.
VIOLATE_DELAY
.
getCode
());
}});
}});
orderStatistics
.
setDefaultMoney
(
bigDecimal
);
orderStatistics
.
setDefaultMoney
(
bigDecimal
);
//订单退还总额
orderStatistics
.
setReturnGmv
(
orderStatistics
.
getGmv
().
subtract
(
bigDecimal
));
}
}
}
}
}
}
private
DailyTravelOrderStatistics
getGmvAndSecurityDeposit
(
Map
<
Integer
,
List
<
OrderAccountDTO
>>
map
)
{
private
DailyTravelOrderStatistics
getGmvAndSecurityDeposit
(
Map
<
Integer
,
List
<
OrderAccountDTO
>>
map
)
{
...
@@ -256,6 +211,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
...
@@ -256,6 +211,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
return
orderStatistics
;
return
orderStatistics
;
}
}
/**
/**
* 获取金额详情
* 获取金额详情
*
*
...
@@ -322,7 +278,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
...
@@ -322,7 +278,7 @@ public class DailyTravelOrderStatisticsBiz extends BaseBiz<DailyTravelOrderStati
return
mapper
.
insertSelective
(
entity
);
return
mapper
.
insertSelective
(
entity
);
}
}
public
OrderStatistics
findAll
(
Integer
branchCompanyId
)
{
public
OrderStatistics
findAll
(
List
<
Integer
>
companyIds
)
{
return
mapper
.
monthOrderTotal
(
branchCompanyId
);
return
mapper
.
monthOrderTotal
(
companyIds
);
}
}
}
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/DailyVehicleOrderStatisticsBiz.java
View file @
798d3544
This diff is collapsed.
Click to expand it.
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderAccountBiz.java
View file @
798d3544
...
@@ -18,6 +18,7 @@ import com.xxfc.platform.order.contant.enumerate.*;
...
@@ -18,6 +18,7 @@ import com.xxfc.platform.order.contant.enumerate.*;
import
com.xxfc.platform.order.entity.*
;
import
com.xxfc.platform.order.entity.*
;
import
com.xxfc.platform.order.mapper.OrderAccountMapper
;
import
com.xxfc.platform.order.mapper.OrderAccountMapper
;
import
com.xxfc.platform.order.pojo.DedDetailDTO
;
import
com.xxfc.platform.order.pojo.DedDetailDTO
;
import
com.xxfc.platform.order.pojo.Term
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDTO
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDTO
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDeduction
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDeduction
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDetail
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDetail
;
...
@@ -511,12 +512,11 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
...
@@ -511,12 +512,11 @@ public class OrderAccountBiz extends BaseBiz<OrderAccountMapper,OrderAccount> {
/**
/**
* 获取每日订单账目,用于统计
* 获取每日订单账目,用于统计
* @param code
* @param term
* @param day
* @return
* @return
*/
*/
public
List
<
OrderAccountDTO
>
getOrderAccountByOrderType
(
Integer
code
,
Integer
day
)
{
public
List
<
OrderAccountDTO
>
getOrderAccountByOrderType
(
Term
term
)
{
return
mapper
.
getOrderAccountByOrderType
(
code
,
day
);
return
mapper
.
getOrderAccountByOrderType
(
term
);
}
}
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderStatisticsBiz.java
View file @
798d3544
...
@@ -8,15 +8,13 @@ import com.github.wxiaoqi.security.common.msg.auth.PageResult;
...
@@ -8,15 +8,13 @@ import com.github.wxiaoqi.security.common.msg.auth.PageResult;
import
com.google.common.collect.Maps
;
import
com.google.common.collect.Maps
;
import
com.xxfc.platform.order.Utils.OrderDateUtils
;
import
com.xxfc.platform.order.Utils.OrderDateUtils
;
import
com.xxfc.platform.order.contant.enumerate.OrderInquiryType
;
import
com.xxfc.platform.order.contant.enumerate.OrderInquiryType
;
import
com.xxfc.platform.order.
entity.MembersOrder
;
import
com.xxfc.platform.order.
contant.enumerate.OrderTypeEnum
;
import
com.xxfc.platform.order.entity.
OrderStatistics
;
import
com.xxfc.platform.order.entity.
*
;
import
com.xxfc.platform.order.mapper.OrderStatisticsMapper
;
import
com.xxfc.platform.order.mapper.OrderStatisticsMapper
;
import
com.xxfc.platform.order.pojo.HomePageOrderData
;
import
com.xxfc.platform.order.pojo.*
;
import
com.xxfc.platform.order.pojo.Member
;
import
com.xxfc.platform.order.pojo.MembersOrderDto
;
import
com.xxfc.platform.order.pojo.OrderQuery
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.aspectj.weaver.ast.Var
;
import
org.assertj.core.util.Lists
;
import
org.assertj.core.util.Lists
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -34,61 +32,111 @@ import java.util.stream.Collectors;
...
@@ -34,61 +32,111 @@ import java.util.stream.Collectors;
public
class
OrderStatisticsBiz
extends
BaseBiz
<
OrderStatisticsMapper
,
OrderStatistics
>
{
public
class
OrderStatisticsBiz
extends
BaseBiz
<
OrderStatisticsMapper
,
OrderStatistics
>
{
@Autowired
@Autowired
private
DailyVehicleOrderStatisticsBiz
vehicleBiz
;
private
DailyVehicleOrderStatisticsBiz
vehicleBiz
;
@Autowired
@Autowired
private
DailyTravelOrderStatisticsBiz
TravelBiz
;
private
DailyTravelOrderStatisticsBiz
TravelBiz
;
@Autowired
@Autowired
private
DailyMembersOrderStatisticsBiz
membersBiz
;
private
DailyMembersOrderStatisticsBiz
membersBiz
;
public
HomePageOrderData
getTotalOrder
(
Integer
companyId
)
{
@Autowired
private
DailyVehicleOrderStatisticsBiz
vehicleStatisticsBiz
;
@Autowired
private
DailyTravelOrderStatisticsBiz
travelStatisticsBiz
;
@Autowired
private
DailyMembersOrderStatisticsBiz
membersStatisticsBiz
;
public
HomePageOrderData
getTotalOrder
(
List
<
Integer
>
companyIds
)
{
HomePageOrderData
result
=
new
HomePageOrderData
();
HomePageOrderData
result
=
new
HomePageOrderData
();
ArrayList
<
HomePageOrderData
>
orderStatistics
=
new
ArrayList
<>();
ArrayList
<
HomePageOrderData
>
list
=
new
ArrayList
<>();
list
.
add
(
getVehicleHomePageOrderData
(
companyIds
))
;
list
.
add
(
getTourHomePageOrderData
(
companyIds
));
list
.
add
(
getMemberHomePageOrderData
(
companyIds
));
result
.
setTotalOrders
(
list
.
stream
().
map
(
HomePageOrderData:
:
getTotalOrders
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
result
.
setTotalOutstandingDeposit
(
list
.
stream
().
map
(
HomePageOrderData:
:
getTotalOutstandingDeposit
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
result
.
setAdditionalIndemnity
(
list
.
stream
().
map
(
HomePageOrderData:
:
getAdditionalIndemnity
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
return
result
;
}
OrderStatistics
vehicle
=
vehicleBiz
.
findAll
(
companyId
);
/**
if
(
vehicle
!=
null
)
{
* 会员数据
* @param companyIds
* @return
*/
public
HomePageOrderData
getMemberHomePageOrderData
(
List
<
Integer
>
companyIds
)
{
//今天之前的数据
OrderStatistics
member
=
membersBiz
.
findAll
(
companyIds
);
//当天的数据
DailyMembersOrderStatistics
statistics
=
membersStatisticsBiz
.
statistics
(
new
Term
(
OrderTypeEnum
.
MEMBER
.
getCode
(),
0
,
1
,
null
,
null
,
companyIds
));
member
.
setTotalGmv
(
member
.
getTotalGmv
().
add
(
statistics
.
getGmv
()));
if
(
member
!=
null
)
{
HomePageOrderData
data
=
new
HomePageOrderData
()
{{
HomePageOrderData
data
=
new
HomePageOrderData
()
{{
setTotalOrders
(
vehicle
.
getTotalGmv
().
subtract
(
vehicle
.
getTotalReturnGmv
()));
setTotalOrders
(
member
.
getTotalGmv
());
setAdditionalIndemnity
(
vehicle
.
getTotalCompensation
()
.
add
(
vehicle
.
getTotalForfeit
())
.
add
(
vehicle
.
getTotalDefaultMoney
())
.
add
(
vehicle
.
getOrderCompensation
()));
setTotalOutstandingDeposit
(
vehicle
.
getTotalSecurityDeposit
()
.
subtract
(
vehicle
.
getTotalRefundSecurityDeposit
())
.
subtract
(
getAdditionalIndemnity
()));
}};
}};
orderStatistics
.
add
(
data
)
;
return
data
;
}
}
OrderStatistics
tour
=
TravelBiz
.
findAll
(
companyId
);
return
new
HomePageOrderData
();
}
if
(
vehicle
!=
null
)
{
/**
* 旅游数据
* @param companyIds
* @return
*/
public
HomePageOrderData
getTourHomePageOrderData
(
List
<
Integer
>
companyIds
)
{
//今天之前的数据
OrderStatistics
tour
=
TravelBiz
.
findAll
(
companyIds
);
//当天的数据
List
<
DailyTravelOrderStatistics
>
travelOrderStatistics
=
travelStatisticsBiz
.
getDailyTravelOrderStatistics
(
new
Term
(
OrderTypeEnum
.
TOUR
.
getCode
(),
0
,
1
,
null
,
null
,
companyIds
));
tour
.
setTotalGmv
(
tour
.
getTotalGmv
().
add
(
travelOrderStatistics
.
parallelStream
().
map
(
DailyOrderStatistics:
:
getGmv
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
)));
tour
.
setTotalReturnGmv
(
tour
.
getTotalReturnGmv
().
add
(
travelOrderStatistics
.
parallelStream
().
map
(
DailyTravelOrderStatistics:
:
getReturnGmv
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
)));
// tour.
if
(
tour
!=
null
)
{
HomePageOrderData
data
=
new
HomePageOrderData
()
{{
HomePageOrderData
data
=
new
HomePageOrderData
()
{{
setTotalOrders
(
tour
.
getTotalGmv
().
subtract
(
tour
.
getTotalReturnGmv
()));
setTotalOrders
(
tour
.
getTotalGmv
().
subtract
(
tour
.
getTotalReturnGmv
()));
setAdditionalIndemnity
(
tour
.
getTotalDefaultMoney
());
setAdditionalIndemnity
(
tour
.
getTotalDefaultMoney
());
}};
}};
orderStatistics
.
add
(
data
);
return
data
;
}
}
return
new
HomePageOrderData
();
}
/**
* 车辆数据
* @param companyIds
* @return
*/
public
HomePageOrderData
getVehicleHomePageOrderData
(
List
<
Integer
>
companyIds
)
{
//今天之前的数据
OrderStatistics
vehicle
=
vehicleBiz
.
findAll
(
companyIds
);
//当天的数据
List
<
DailyVehicleOrderStatistics
>
vehicleOrderRecord
=
vehicleStatisticsBiz
.
getDailyVehicleOrderRecord
(
new
Term
(
OrderTypeEnum
.
RENT_VEHICLE
.
getCode
(),
0
,
1
,
null
,
null
,
companyIds
));
OrderStatistics
member
=
membersBiz
.
findAll
(
companyId
);
if
(
vehicle
!=
null
)
{
if
(
vehicle
!=
null
)
{
HomePageOrderData
data
=
new
HomePageOrderData
()
{{
HomePageOrderData
data
=
new
HomePageOrderData
()
{{
setTotalOrders
(
member
.
getTotalGmv
());
setTotalOrders
(
vehicle
.
getTotalGmv
().
subtract
(
vehicle
.
getTotalReturnGmv
()));
setAdditionalIndemnity
(
vehicle
.
getTotalCompensation
()
.
add
(
vehicle
.
getTotalForfeit
())
.
add
(
vehicle
.
getTotalDefaultMoney
())
.
add
(
vehicle
.
getTotalOrderCompensation
()));
setTotalOutstandingDeposit
(
vehicle
.
getTotalSecurityDeposit
()
.
subtract
(
vehicle
.
getTotalRefundSecurityDeposit
())
.
subtract
(
getAdditionalIndemnity
()));
}};
}};
orderStatistics
.
add
(
data
)
;
return
data
;
}
}
return
new
HomePageOrderData
();
result
.
setTotalOrders
(
orderStatistics
.
stream
().
map
(
HomePageOrderData:
:
getTotalOrders
).
filter
(
o
->
Objects
.
nonNull
(
o
)).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
result
.
setTotalOutstandingDeposit
(
orderStatistics
.
stream
().
map
(
HomePageOrderData:
:
getTotalOutstandingDeposit
).
filter
(
o
->
Objects
.
nonNull
(
o
)).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
result
.
setAdditionalIndemnity
(
orderStatistics
.
stream
().
map
(
HomePageOrderData:
:
getAdditionalIndemnity
).
filter
(
o
->
Objects
.
nonNull
(
o
)).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
));
return
result
;
}
}
/**
* 会员统计列表
* @param memberLevels
* @param query
* @return
* @throws ParseException
*/
public
PageResult
getMemberOrderStatistics
(
List
<
BaseUserMemberLevel
>
memberLevels
,
OrderQuery
query
)
throws
ParseException
{
public
PageResult
getMemberOrderStatistics
(
List
<
BaseUserMemberLevel
>
memberLevels
,
OrderQuery
query
)
throws
ParseException
{
List
<
MembersOrder
>
membersOrderList
=
membersBiz
.
getMemberOrderStatistics
(
query
);
List
<
MembersOrder
>
membersOrderList
=
membersBiz
.
getMemberOrderStatistics
(
query
);
...
@@ -176,16 +224,11 @@ public class OrderStatisticsBiz extends BaseBiz<OrderStatisticsMapper, OrderStat
...
@@ -176,16 +224,11 @@ public class OrderStatisticsBiz extends BaseBiz<OrderStatisticsMapper, OrderStat
//进行分页处理
//进行分页处理
return
PageResult
.
nowPageResult
(
query
.
getPage
(),
query
.
getLimit
(),
arrayList
);
return
PageResult
.
nowPageResult
(
query
.
getPage
(),
query
.
getLimit
(),
arrayList
);
// return pagingProcessing(query, arrayList);
}
}
private
void
TotalPaymentAndMemberName
(
HashMap
<
Integer
,
String
>
map
,
MembersOrder
mb
,
MembersOrderDto
mbdto
)
{
private
void
TotalPaymentAndMemberName
(
HashMap
<
Integer
,
String
>
map
,
MembersOrder
mb
,
MembersOrderDto
mbdto
)
{
BigDecimal
totalPayment
=
BigDecimal
.
ZERO
;
BigDecimal
totalPayment
=
BigDecimal
.
ZERO
;
List
<
Member
>
members
=
mb
.
getMembers
();
List
<
Member
>
members
=
mb
.
getMembers
();
//设置时间段购买会员总金额和不同的会员名称
//设置时间段购买会员总金额和不同的会员名称
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/mapper/DailyMembersOrderStatisticsMapper.java
View file @
798d3544
...
@@ -18,7 +18,7 @@ public interface DailyMembersOrderStatisticsMapper extends Mapper<DailyMembersOr
...
@@ -18,7 +18,7 @@ public interface DailyMembersOrderStatisticsMapper extends Mapper<DailyMembersOr
Map
<
String
,
Object
>
getTravelGmv
(
@Param
(
"day"
)
Integer
day
);
Map
<
String
,
Object
>
getTravelGmv
(
@Param
(
"day"
)
Integer
day
);
OrderStatistics
monthOrderTotal
(
@Param
(
"companyId"
)
Integer
companyId
);
OrderStatistics
monthOrderTotal
(
List
<
Integer
>
companyIds
);
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/mapper/DailyTravelOrderStatisticsMapper.java
View file @
798d3544
...
@@ -19,5 +19,5 @@ public interface DailyTravelOrderStatisticsMapper extends Mapper<DailyTravelOrde
...
@@ -19,5 +19,5 @@ public interface DailyTravelOrderStatisticsMapper extends Mapper<DailyTravelOrde
List
<
DailyTravelOrderStatistics
>
getTravelPenalSum
(
@Param
(
"day"
)
Integer
day
);
List
<
DailyTravelOrderStatistics
>
getTravelPenalSum
(
@Param
(
"day"
)
Integer
day
);
OrderStatistics
monthOrderTotal
(
@Param
(
"companyId"
)
Integer
companyId
);
OrderStatistics
monthOrderTotal
(
List
<
Integer
>
companyIds
);
}
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/mapper/DailyVehicleOrderStatisticsMapper.java
View file @
798d3544
...
@@ -25,5 +25,5 @@ public interface DailyVehicleOrderStatisticsMapper extends Mapper<DailyVehicleOr
...
@@ -25,5 +25,5 @@ public interface DailyVehicleOrderStatisticsMapper extends Mapper<DailyVehicleOr
List
<
DailyVehicleOrderStatistics
>
getViolationMoney
(
@Param
(
"day"
)
Integer
day
);
List
<
DailyVehicleOrderStatistics
>
getViolationMoney
(
@Param
(
"day"
)
Integer
day
);
OrderStatistics
monthOrderTotal
(
@Param
(
"companyId"
)
Integer
companyId
);
OrderStatistics
monthOrderTotal
(
List
<
Integer
>
companyIds
);
}
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/mapper/OrderAccountMapper.java
View file @
798d3544
package
com
.
xxfc
.
platform
.
order
.
mapper
;
package
com
.
xxfc
.
platform
.
order
.
mapper
;
import
com.xxfc.platform.order.entity.OrderAccount
;
import
com.xxfc.platform.order.entity.OrderAccount
;
import
com.xxfc.platform.order.pojo.Term
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDTO
;
import
com.xxfc.platform.order.pojo.account.OrderAccountDTO
;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.Mapper
;
import
tk.mybatis.mapper.common.Mapper
;
...
@@ -17,5 +18,5 @@ import java.util.List;
...
@@ -17,5 +18,5 @@ import java.util.List;
*/
*/
public
interface
OrderAccountMapper
extends
Mapper
<
OrderAccount
>
{
public
interface
OrderAccountMapper
extends
Mapper
<
OrderAccount
>
{
List
<
OrderAccountDTO
>
getOrderAccountByOrderType
(
@Param
(
"type"
)
Integer
type
,
@Param
(
"day"
)
Integer
day
);
List
<
OrderAccountDTO
>
getOrderAccountByOrderType
(
Term
term
);
}
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/background/OrderStatisticsController.java
View file @
798d3544
package
com
.
xxfc
.
platform
.
order
.
rest
.
background
;
package
com
.
xxfc
.
platform
.
order
.
rest
.
background
;
import
cn.hutool.core.collection.CollUtil
;
import
cn.hutool.core.io.IoUtil
;
import
cn.hutool.core.io.IoUtil
;
import
cn.hutool.poi.excel.ExcelUtil
;
import
cn.hutool.poi.excel.ExcelUtil
;
import
cn.hutool.poi.excel.ExcelWriter
;
import
cn.hutool.poi.excel.ExcelWriter
;
import
com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel
;
import
com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.dto.UserDTO
;
import
com.github.wxiaoqi.security.admin.feign.dto.UserDTO
;
import
com.github.wxiaoqi.security.admin.feign.rest.UserRestInterface
;
import
com.github.wxiaoqi.security.auth.client.config.UserAuthConfig
;
import
com.github.wxiaoqi.security.auth.client.config.UserAuthConfig
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.util.Query
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.google.common.collect.Lists
;
import
com.xxfc.platform.order.biz.DailyMembersOrderStatisticsBiz
;
import
com.xxfc.platform.order.biz.DailyMembersOrderStatisticsBiz
;
import
com.xxfc.platform.order.biz.DailyTravelOrderStatisticsBiz
;
import
com.xxfc.platform.order.biz.DailyTravelOrderStatisticsBiz
;
import
com.xxfc.platform.order.biz.DailyVehicleOrderStatisticsBiz
;
import
com.xxfc.platform.order.biz.DailyVehicleOrderStatisticsBiz
;
...
@@ -22,23 +20,18 @@ import com.xxfc.platform.order.entity.OrderStatistics;
...
@@ -22,23 +20,18 @@ import com.xxfc.platform.order.entity.OrderStatistics;
import
com.xxfc.platform.order.pojo.HomePageOrderData
;
import
com.xxfc.platform.order.pojo.HomePageOrderData
;
import
com.xxfc.platform.order.pojo.MembersOrderDto
;
import
com.xxfc.platform.order.pojo.MembersOrderDto
;
import
com.xxfc.platform.order.pojo.OrderQuery
;
import
com.xxfc.platform.order.pojo.OrderQuery
;
import
com.xxfc.platform.vehicle.common.RestResponse
;
import
com.xxfc.platform.vehicle.feign.VehicleFeign
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.lang.reflect.Array
;
import
java.text.DateFormat
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
/**
* @author Administrator
* @author Administrator
...
@@ -90,62 +83,40 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz
...
@@ -90,62 +83,40 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz
@Autowired
@Autowired
private
DailyMembersOrderStatisticsBiz
membersBiz
;
private
DailyMembersOrderStatisticsBiz
membersBiz
;
@Autowired
private
VehicleFeign
vehicleFeign
;
@ApiOperation
(
"获取订单统计数据"
)
@ApiOperation
(
"获取订单统计数据"
)
@GetMapping
(
"/findAll/{type}"
)
@GetMapping
(
"/findAll/{type}"
)
public
ObjectRestResponse
findAll
(
@PathVariable
Integer
type
)
{
public
ObjectRestResponse
findAll
(
@PathVariable
Integer
type
)
{
try
{
try
{
ObjectRestResponse
<
UserDTO
>
userDTOObjectRestResponse
ObjectRestResponse
<
UserDTO
>
userDTOObjectRestResponse
=
userFeign
.
userinfoByToken
(
userAuthConfig
.
getToken
(
getRequest
()));
=
userFeign
.
userinfoByToken
(
userAuthConfig
.
getToken
(
getRequest
()));
if
(
userDTOObjectRestResponse
==
null
||
userDTOObjectRestResponse
.
getData
()
==
null
)
{
if
(
userDTOObjectRestResponse
==
null
||
userDTOObjectRestResponse
.
getData
()
==
null
)
{
throw
new
BaseException
(
"
请登录
!"
);
throw
new
BaseException
(
"
token失效
!"
);
}
}
UserDTO
user
=
userDTOObjectRestResponse
.
getData
();
UserDTO
user
=
userDTOObjectRestResponse
.
getData
();
List
<
Integer
>
companyIds
=
null
;
Integer
companyId
=
user
.
getCompanyId
();
if
(!
DATA_AUTHORITY
.
equals
(
user
.
getDataAll
()))
{
if
(
DATA_AUTHORITY
.
equals
(
user
.
getDataAll
()))
{
companyIds
=
vehicleFeign
.
getCompanyIds
().
getData
();
companyId
=
null
;
}
}
//只统计租车订单
//只统计租车订单
if
(
TYPE_VEHICLE
.
equals
(
type
))
{
if
(
TYPE_VEHICLE
.
equals
(
type
))
{
OrderStatistics
vehicle
=
vehicleBiz
.
findAll
(
companyId
);
return
ObjectRestResponse
.
succ
(
baseBiz
.
getVehicleHomePageOrderData
(
companyIds
));
return
ObjectRestResponse
.
succ
(
new
HomePageOrderData
()
{{
setTotalOrders
(
vehicle
.
getTotalGmv
().
subtract
(
vehicle
.
getTotalReturnGmv
()));
setAdditionalIndemnity
(
vehicle
.
getTotalCompensation
()
.
add
(
vehicle
.
getTotalForfeit
())
.
add
(
vehicle
.
getTotalDefaultMoney
())
.
add
(
vehicle
.
getOrderCompensation
())
);
setTotalOutstandingDeposit
(
vehicle
.
getTotalSecurityDeposit
()
.
subtract
(
vehicle
.
getTotalRefundSecurityDeposit
())
.
subtract
(
getAdditionalIndemnity
()));
}});
}
}
//只统计
会租车
订单
//只统计
旅游
订单
if
(
TYPE_TOUR
.
equals
(
type
))
{
if
(
TYPE_TOUR
.
equals
(
type
))
{
OrderStatistics
tour
=
TravelBiz
.
findAll
(
companyId
);
return
ObjectRestResponse
.
succ
(
baseBiz
.
getTourHomePageOrderData
(
companyIds
));
return
ObjectRestResponse
.
succ
(
new
HomePageOrderData
()
{{
setTotalOrders
(
tour
.
getTotalGmv
().
subtract
(
tour
.
getTotalReturnGmv
()));
setAdditionalIndemnity
(
tour
.
getTotalDefaultMoney
());
}});
}
}
//只统计会员
定案
//只统计会员
订单
if
(
TYPE_MEMBER
.
equals
(
type
))
{
if
(
TYPE_MEMBER
.
equals
(
type
))
{
OrderStatistics
member
=
membersBiz
.
findAll
(
companyId
);
return
ObjectRestResponse
.
succ
(
baseBiz
.
getMemberHomePageOrderData
(
companyIds
));
return
ObjectRestResponse
.
succ
(
new
HomePageOrderData
()
{{
setTotalOrders
(
member
.
getTotalGmv
());
}});
}
}
//所有订单
//所有订单
if
(
TYPE_TOTAL
.
equals
(
type
))
{
if
(
TYPE_TOTAL
.
equals
(
type
))
{
return
ObjectRestResponse
.
succ
(
baseBiz
.
getTotalOrder
(
companyId
));
return
ObjectRestResponse
.
succ
(
baseBiz
.
getTotalOrder
(
companyId
s
));
}
}
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"参数错误!"
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"参数错误!"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -154,12 +125,11 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz
...
@@ -154,12 +125,11 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz
}
}
}
}
@PostMapping
(
"/order"
)
@PostMapping
(
"/order"
)
@ApiOperation
(
value
=
"会员统计"
)
@ApiOperation
(
value
=
"会员统计"
)
public
ObjectRestResponse
<
List
<
MembersOrderDto
>>
getMemberOrderStatisticsData
(
@RequestBody
OrderQuery
query
)
throws
ParseException
{
public
ObjectRestResponse
<
List
<
MembersOrderDto
>>
getMemberOrderStatisticsData
(
@RequestBody
OrderQuery
query
)
throws
ParseException
{
if
(
query
.
getEndTime
()
!=
null
)
{
if
(
query
.
getEndTime
()
!=
null
)
{
query
.
setEndTime
(
query
.
getEndTime
()
+(
24
*
60
*
60
*
1000
));
query
.
setEndTime
(
query
.
getEndTime
()
+
(
24
*
60
*
60
*
1000
));
}
}
//获取会员等级信息
//获取会员等级信息
List
<
BaseUserMemberLevel
>
memberLevels
=
userFeign
.
levels
();
List
<
BaseUserMemberLevel
>
memberLevels
=
userFeign
.
levels
();
...
@@ -171,8 +141,8 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz
...
@@ -171,8 +141,8 @@ public class OrderStatisticsController extends BaseController<OrderStatisticsBiz
@PostMapping
(
"/excel"
)
@PostMapping
(
"/excel"
)
@ApiOperation
(
value
=
"下载excel表"
)
@ApiOperation
(
value
=
"下载excel表"
)
public
void
downloadExcel
(
@RequestBody
OrderQuery
query
)
throws
Exception
{
public
void
downloadExcel
(
@RequestBody
OrderQuery
query
)
throws
Exception
{
if
(
query
.
getEndTime
()
!=
null
)
{
if
(
query
.
getEndTime
()
!=
null
)
{
query
.
setEndTime
(
query
.
getEndTime
()
+(
24
*
60
*
60
*
1000
));
query
.
setEndTime
(
query
.
getEndTime
()
+
(
24
*
60
*
60
*
1000
));
}
}
// 通过工具类创建writer,默认创建xls格式
// 通过工具类创建writer,默认创建xls格式
ExcelWriter
writer
=
ExcelUtil
.
getWriter
(
true
);
ExcelWriter
writer
=
ExcelUtil
.
getWriter
(
true
);
...
...
xx-order/xx-order-server/src/main/resources/mapper/DailyMembersOrderStatisticsMapper.xml
View file @
798d3544
...
@@ -22,10 +22,12 @@
...
@@ -22,10 +22,12 @@
daily_members_order_statistics
daily_members_order_statistics
WHERE
WHERE
1=1
1=1
<if
test=
"companyId != null"
>
<if
test=
"companyIds != null and companyIds.size()!=0"
>
and branch_company_id = #{companyId}
and branch_company_id in
<foreach
collection=
"companyIds"
index=
"index"
item=
"companyId"
open=
"("
separator=
","
close=
")"
>
#{companyId}
</foreach>
</if>
</if>
</select>
</select>
<!-- <select id="updateByExampleSelective">-->
<!-- <select id="updateByExampleSelective">-->
<!-- SELECT-->
<!-- SELECT-->
...
...
xx-order/xx-order-server/src/main/resources/mapper/DailyTravelOrderStatisticsMapper.xml
View file @
798d3544
...
@@ -58,8 +58,11 @@
...
@@ -58,8 +58,11 @@
daily_travel_order_statistics
daily_travel_order_statistics
WHERE
WHERE
1=1
1=1
<if
test=
"companyId != null"
>
<if
test=
"companyIds != null and companyIds.size()!=0"
>
and branch_company_id = #{companyId}
and branch_company_id in
<foreach
collection=
"companyIds"
index=
"index"
item=
"companyId"
open=
"("
separator=
","
close=
")"
>
#{companyId}
</foreach>
</if>
</if>
</select>
</select>
...
...
xx-order/xx-order-server/src/main/resources/mapper/DailyVehicleOrderStatisticsMapper.xml
View file @
798d3544
...
@@ -89,13 +89,16 @@
...
@@ -89,13 +89,16 @@
IFNULL( sum( compensation ), 0 ) AS totalCompensation,
IFNULL( sum( compensation ), 0 ) AS totalCompensation,
IFNULL( sum( return_gmv ), 0 ) AS totalReturnGmv,
IFNULL( sum( return_gmv ), 0 ) AS totalReturnGmv,
IFNULL( sum( default_money ), 0 ) AS totalDefaultMoney,
IFNULL( sum( default_money ), 0 ) AS totalDefaultMoney,
IFNULL( sum( order_compensation ), 0 ) AS
o
rderCompensation
IFNULL( sum( order_compensation ), 0 ) AS
totalO
rderCompensation
FROM
FROM
daily_vehicle_order_statistics
daily_vehicle_order_statistics
WHERE
WHERE
1=1
1=1
<if
test=
"companyId != null"
>
<if
test=
"companyIds != null and companyIds.size()!=0"
>
and branch_company_id = #{companyId}
and branch_company_id in
<foreach
collection=
"companyIds"
index=
"index"
item=
"companyId"
open=
"("
separator=
","
close=
")"
>
#{companyId}
</foreach>
</if>
</if>
</select>
</select>
...
...
xx-order/xx-order-server/src/main/resources/mapper/OrderAccountMapper.xml
View file @
798d3544
...
@@ -3,27 +3,52 @@
...
@@ -3,27 +3,52 @@
<mapper
namespace=
"com.xxfc.platform.order.mapper.OrderAccountMapper"
>
<mapper
namespace=
"com.xxfc.platform.order.mapper.OrderAccountMapper"
>
<select
id=
"getOrderAccountByOrderType"
resultType=
"com.xxfc.platform.order.pojo.account.OrderAccountDTO"
>
<select
id=
"getOrderAccountByOrderType"
resultType=
"com.xxfc.platform.order.pojo.account.OrderAccountDTO"
>
SELECT
SELECT
date(DATE_SUB(now(),interval #{day} day)) as oneDay,
<if
test=
"subdivide !=null and subdivide ==1"
>
date( FROM_UNIXTIME( a.crt_time / 1000 ) ) as oneDay,
</if>
a.*
a.*
<if
test=
"
type != null and t
ype == 1"
>
<if
test=
"
orderType != null and orderT
ype == 1"
>
, v.start_company_id as companyId
, v.start_company_id as companyId
</if>
</if>
<if
test=
"
type != null and t
ype == 2"
>
<if
test=
"
orderType != null and orderT
ype == 2"
>
, t.start_company_id as companyId
, t.start_company_id as companyId
</if>
</if>
FROM
FROM
order_account a
order_account a
LEFT JOIN base_order b ON a.order_id = b.id
LEFT JOIN base_order b ON a.order_id = b.id
<if
test=
"
type != null and t
ype==1"
>
<if
test=
"
orderType != null and orderT
ype==1"
>
LEFT JOIN order_rent_vehicle_detail v ON b.id = v.order_id
LEFT JOIN order_rent_vehicle_detail v ON b.id = v.order_id
</if>
</if>
<if
test=
"
type != null and t
ype==2"
>
<if
test=
"
orderType != null and orderT
ype==2"
>
LEFT JOIN order_tour_detail t ON b.id = t.order_id
LEFT JOIN order_tour_detail t ON b.id = t.order_id
</if>
</if>
WHERE
WHERE
a.account_status=1
a.account_status=1
AND
AND
b.type = #{type}
b.type = #{orderType}
AND date( FROM_UNIXTIME( a.crt_time / 1000 ) ) = date( DATE_SUB( now( ), INTERVAL #{day} DAY ) )
<if
test=
"startTime != null"
>
AND a.crt_time
<![CDATA[>= ]]>
#{startTime}
</if>
<if
test=
"endTime != null"
>
AND a.crt_time
>
endTime
</if>
<if
test=
"companyIds != null and companyIds.size() != 0 "
>
<if
test=
"orderType != null and orderType == 1"
>
AND v.start_company_id in
<foreach
collection=
"companyIds"
index=
"index"
item=
"companyId"
open=
"("
separator=
","
close=
")"
>
#{companyId}
</foreach>
</if>
<if
test=
"orderType != null and orderType == 2"
>
AND t.start_company_id in
<foreach
collection=
"companyIds"
index=
"index"
item=
"companyId"
open=
"("
separator=
","
close=
")"
>
#{companyId}
</foreach>
</if>
</if>
<if
test=
"subdivide !=null and subdivide ==1"
>
AND date( FROM_UNIXTIME( a.crt_time / 1000 ) ) = date( DATE_SUB( now( ), INTERVAL #{day} DAY ) )
</if>
</select>
</select>
</mapper>
</mapper>
\ No newline at end of file
xx-order/xx-order-server/src/test/java/ServiceTest.java
View file @
798d3544
...
@@ -61,10 +61,9 @@ public class ServiceTest {
...
@@ -61,10 +61,9 @@ public class ServiceTest {
}
}
@Test
@Test
public
void
handlerTeset
()
{
public
void
handlerTeset
()
{
handler
.
execute
(
"2019-08-
01
"
);
handler
.
execute
(
"2019-08-
16
"
);
}
}
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/authenticationInterface/impl/XCFQAuthentication.java
View file @
798d3544
...
@@ -70,6 +70,7 @@ public class XCFQAuthentication implements UserAuthentication {
...
@@ -70,6 +70,7 @@ public class XCFQAuthentication implements UserAuthentication {
/**
/**
* 状态码: 200 正常;400 URL无效;401 appCode错误; 403 次数用完; 500 API网管错误
* 状态码: 200 正常;400 URL无效;401 appCode错误; 403 次数用完; 500 API网管错误
*/
*/
log
.
info
(
"外部接口响应状态码:"
+
statusCode
);
//获取response的body
//获取response的body
if
(
statusCode
==
200
)
{
if
(
statusCode
==
200
)
{
String
result
=
EntityUtils
.
toString
(
response
.
getEntity
());
String
result
=
EntityUtils
.
toString
(
response
.
getEntity
());
...
...
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/feign/VehicleFeign.java
View file @
798d3544
...
@@ -163,4 +163,7 @@ public interface VehicleFeign {
...
@@ -163,4 +163,7 @@ public interface VehicleFeign {
@GetMapping
(
"/vehicleInfo/findVehicleIds"
)
@GetMapping
(
"/vehicleInfo/findVehicleIds"
)
List
<
String
>
findbyPlateNumberAndVehicleCod
(
@RequestParam
(
value
=
"plateNumber"
)
String
plateNumber
,
@RequestParam
(
value
=
"vehicleCode"
)
String
vehicleCode
);
List
<
String
>
findbyPlateNumberAndVehicleCod
(
@RequestParam
(
value
=
"plateNumber"
)
String
plateNumber
,
@RequestParam
(
value
=
"vehicleCode"
)
String
vehicleCode
);
@RequestMapping
(
value
=
"/branchCompany/app/unauth/getCompanyIds"
,
method
=
RequestMethod
.
GET
)
RestResponse
<
List
<
Integer
>>
getCompanyIds
();
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/BranchCompanyBiz.java
View file @
798d3544
...
@@ -411,4 +411,8 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
...
@@ -411,4 +411,8 @@ public class BranchCompanyBiz extends BaseBiz<BranchCompanyMapper, BranchCompany
return
ObjectRestResponse
.
succ
(
list
);
return
ObjectRestResponse
.
succ
(
list
);
}
}
public
List
<
Integer
>
getCompanyIds
()
{
UserDTO
userDTO
=
getAdminUserInfo
();
return
vehicleBiz
.
dataCompany
(
userDTO
.
getDataZone
(),
userDTO
.
getDataCompany
());
}
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/BranchCompanyController.java
View file @
798d3544
...
@@ -25,7 +25,9 @@ import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyListVO;
...
@@ -25,7 +25,9 @@ import com.xxfc.platform.vehicle.pojo.vo.BranchCompanyListVO;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.assertj.core.util.Lists
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -35,6 +37,7 @@ import javax.servlet.http.HttpServletRequest;
...
@@ -35,6 +37,7 @@ import javax.servlet.http.HttpServletRequest;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
@RestController
@RestController
@RequestMapping
(
"/branchCompany"
)
@RequestMapping
(
"/branchCompany"
)
...
@@ -217,4 +220,11 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> {
...
@@ -217,4 +220,11 @@ public class BranchCompanyController extends BaseController<BranchCompanyBiz> {
public
ObjectRestResponse
<
List
<
BranchCompany
>>
companys
()
{
public
ObjectRestResponse
<
List
<
BranchCompany
>>
companys
()
{
return
baseBiz
.
branchCompans
();
return
baseBiz
.
branchCompans
();
}
}
@RequestMapping
(
value
=
"/app/unauth/getCompanyIds"
,
method
=
RequestMethod
.
GET
)
public
RestResponse
<
List
<
Integer
>>
getCompanyIds
()
{
return
RestResponse
.
suc
(
baseBiz
.
getCompanyIds
());
}
}
}
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