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
48f39131
Commit
48f39131
authored
Nov 30, 2019
by
libin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
分公司统计
parent
9d57dcd7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
94 additions
and
86 deletions
+94
-86
StatisticsStatusEnum.java
...latform/order/contant/enumerate/StatisticsStatusEnum.java
+6
-2
OrderReceivedStatisticsBiz.java
...m/xxfc/platform/order/biz/OrderReceivedStatisticsBiz.java
+65
-60
OrderReceivedStatisticsMapper.xml
...c/main/resources/mapper/OrderReceivedStatisticsMapper.xml
+18
-18
ServiceTest.java
xx-order/xx-order-server/src/test/java/ServiceTest.java
+5
-6
No files found.
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/contant/enumerate/StatisticsStatusEnum.java
View file @
48f39131
...
...
@@ -137,7 +137,6 @@ public enum StatisticsStatusEnum {
feeTypeBo
.
setNoDeductibleAmount
(
feeTypeBo
.
getNoDeductibleAmount
().
add
(
dameSafeAmount
));
}
//订单金额(不包含免赔和押金)
feeTypeBo
.
setTotalAmount
(
feeTypeBo
.
getTotalAmount
().
add
(
accountDetailEntity
.
getOrderAmount
()).
subtract
(
feeTypeBo
.
getNoDeductibleAmount
()));
}
else
{
//退款订单押金
...
...
@@ -154,7 +153,6 @@ public enum StatisticsStatusEnum {
feeTypeBo
.
setNoDeductibleRefundAmount
(
feeTypeBo
.
getNoDeductibleRefundAmount
().
add
(
dameSafeAmount
));
}
}
//遍历消费明细
for
(
OrderAccountDeduction
deduction
:
deductions
)
{
BigDecimal
deductionAmount
=
deduction
.
getAmount
();
...
...
@@ -189,6 +187,12 @@ public enum StatisticsStatusEnum {
feeTypeBo
.
setOrderRefundAmount
(
feeTypeBo
.
getOrderRefundAmount
().
add
(
accountDetailEntity
.
getOrderAmount
()).
subtract
(
feeTypeBo
.
getNoDeductibleRefundAmount
()));
}
}
//订单支付金额(不包含免赔,押金)减去退款的金额
feeTypeBo
.
setTotalAmount
(
feeTypeBo
.
getTotalAmount
().
subtract
(
feeTypeBo
.
getOrderRefundAmount
()));
//订单押金减去退款押金
feeTypeBo
.
setDepositAmount
(
feeTypeBo
.
getDepositAmount
().
subtract
(
feeTypeBo
.
getDepositRefundAmount
()));
//订单免赔金额减去退款的免赔金额
feeTypeBo
.
setNoDeductibleAmount
(
feeTypeBo
.
getNoDeductibleAmount
().
subtract
(
feeTypeBo
.
getDepositRefundAmount
()));
return
feeTypeBo
;
}
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderReceivedStatisticsBiz.java
View file @
48f39131
...
...
@@ -14,6 +14,7 @@ import com.xxfc.platform.order.pojo.dto.CompanyPerformanceFindDTO;
import
com.xxfc.platform.order.pojo.dto.OrderReceivedStatisticsFindDTO
;
import
com.xxfc.platform.order.pojo.vo.OrderReceivedStatisticsVo
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.collections4.CollectionUtils
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
...
...
@@ -37,6 +38,7 @@ import java.util.stream.Collectors;
* @email 18178966185@163.com
* @date 2019-11-08 18:03:42
*/
@Slf4j
@Service
@Transactional
(
rollbackFor
=
Exception
.
class
)
@RequiredArgsConstructor
(
onConstructor
=
@__
(
@Autowired
))
...
...
@@ -263,6 +265,7 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
OrderReceivedStatistics
orderReceivedStatistics
=
new
OrderReceivedStatistics
();
Set
<
Map
.
Entry
<
String
,
List
<
OrderRentVehicleReceivedStatistics
>>>
rentVehicleSet
=
rentVehicleMap
.
entrySet
();
for
(
Map
.
Entry
<
String
,
List
<
OrderRentVehicleReceivedStatistics
>>
rentVehicleEntry
:
rentVehicleSet
)
{
try
{
String
stateGroup
=
rentVehicleEntry
.
getKey
();
List
<
OrderRentVehicleReceivedStatistics
>
rentVehicleEntryValue
=
rentVehicleEntry
.
getValue
();
//创建默认的订单统计对象并设置默认值
...
...
@@ -322,7 +325,9 @@ public class OrderReceivedStatisticsBiz extends BaseBiz<OrderReceivedStatisticsM
orderReceivedStatisticsClone
.
setOrderRefundAmount
(
totalRefundAmount
);
orderReceivedStatisticsClone
.
setTotalQuantity
(
totalQuantity
);
orderReceivedStatisticsList
.
add
(
orderReceivedStatisticsClone
);
}
catch
(
Exception
ex
){
log
.
error
(
"当前状态组合【{}】===日期【{}】"
,
rentVehicleEntry
.
getKey
(),
rentVehicleEntry
.
getValue
().
get
(
0
).
getDate
());
}
}
//保存
StatisticsStatusEnum
.
insertReceivedStatisticsBatch
(
orderReceivedStatisticsList
,
mapper
);
...
...
xx-order/xx-order-server/src/main/resources/mapper/OrderReceivedStatisticsMapper.xml
View file @
48f39131
...
...
@@ -71,11 +71,11 @@
`company_id` AS `companyId`,
`year`,
`date`,
SUM(`member_amount`
-`member_refund_amount`
) AS `memberAmount`,
SUM(`travel_amount`
-`travel_refund_amount`
) AS `travelAmount`,
SUM(`rent_vehicle_amount`
-`rent_vehicle_refund_amount`
) AS `rentVehilceAmount`,
SUM(`no_deductible_amount`
- `no_deductible_refund_amount`
) as `noDeductibleAmount`,
SUM(`deposit_amount`
- `deposit_refund_amount`
) as `depositAmount`
SUM(`member_amount`) AS `memberAmount`,
SUM(`travel_amount`) AS `travelAmount`,
SUM(`rent_vehicle_amount`) AS `rentVehilceAmount`,
SUM(`no_deductible_amount`) as `noDeductibleAmount`,
SUM(`deposit_amount`) as `depositAmount`
FROM
`order_received_statistics` WHERE `has_pay`=1
<if
test=
"companyName!=null and companyName!=''"
>
...
...
@@ -156,11 +156,11 @@
company_id AS `companyId`,
`year`,
`month`,
SUM(`member_amount`
-`member_refund_amount`
) AS `memberAmount`,
SUM(`travel_amount`
-`travel_refund_amount`
) AS `travelAmount`,
SUM(`rent_vehicle_amount`
-`rent_vehicle_refund_amount`
) AS `rentVehilceAmount`,
SUM(`no_deductible_amount`
- `no_deductible_refund_amount`
) as `noDeductibleAmount`,
SUM(`deposit_amount`
- `deposit_refund_amount`
) as `depositAmount`
SUM(`member_amount`) AS `memberAmount`,
SUM(`travel_amount`) AS `travelAmount`,
SUM(`rent_vehicle_amount`) AS `rentVehilceAmount`,
SUM(`no_deductible_amount`) as `noDeductibleAmount`,
SUM(`deposit_amount`) as `depositAmount`
FROM
`order_received_statistics` WHERE `has_pay`=1
<if
test=
"companyName!=null and companyName!=''"
>
...
...
@@ -240,11 +240,11 @@
company_id AS `companyId`,
`year`,
`week_of_year` AS `weekOfYear`,
SUM(`member_amount`
-`member_refund_amount`
) AS `memberAmount`,
SUM(`travel_amount`
-`travel_refund_amount`
) AS `travelAmount`,
SUM(`rent_vehicle_amount`
-`rent_vehicle_refund_amount`
) AS `rentVehilceAmount`,
SUM(`no_deductible_amount`
- `no_deductible_refund_amount`
) as `noDeductibleAmount`,
SUM(`deposit_amount`
- `deposit_refund_amount`
) as `depositAmount`
SUM(`member_amount`) AS `memberAmount`,
SUM(`travel_amount`) AS `travelAmount`,
SUM(`rent_vehicle_amount`) AS `rentVehilceAmount`,
SUM(`no_deductible_amount`) as `noDeductibleAmount`,
SUM(`deposit_amount`) as `depositAmount`
FROM
`order_received_statistics` WHERE `has_pay`=1
<if
test=
"companyName!=null and companyName!=''"
>
...
...
@@ -313,7 +313,7 @@
</select>
<select
id=
"selectCountByDate"
resultType=
"int"
>
select count(
*
) from (SELECT `date` FROM `order_received_statistics` WHERE `has_pay`=1
select count(
0
) from (SELECT `date` FROM `order_received_statistics` WHERE `has_pay`=1
<if
test=
"companyName!=null and companyName!=''"
>
AND `company_name` LIKE CONCAT('%',#{companyName},'%')
</if>
...
...
@@ -341,7 +341,7 @@
</select>
<select
id=
"selectCountByMonth"
resultType=
"int"
>
select count(
*
) from (SELECT `month` FROM `order_received_statistics` WHERE `has_pay`=1
select count(
0
) from (SELECT `month` FROM `order_received_statistics` WHERE `has_pay`=1
<if
test=
"companyName!=null and companyName!=''"
>
AND `company_name` LIKE CONCAT('%',#{companyName},'%')
</if>
...
...
@@ -369,7 +369,7 @@
</select>
<select
id=
"selectCountByWeekOfYear"
resultType=
"int"
>
select count(
*
) from (SELECT `week_of_year` FROM `order_received_statistics` WHERE `has_pay`=1
select count(
0
) from (SELECT `week_of_year` FROM `order_received_statistics` WHERE `has_pay`=1
<if
test=
"companyName!=null and companyName!=''"
>
AND `company_name` LIKE CONCAT('%',#{companyName},'%')
</if>
...
...
xx-order/xx-order-server/src/test/java/ServiceTest.java
View file @
48f39131
...
...
@@ -98,7 +98,7 @@ public class ServiceTest {
@Test
public
void
testMemberStatistics
(){
Date
date
=
DateTime
.
parse
(
"2019-11-
15
"
).
toDate
();
Date
date
=
DateTime
.
parse
(
"2019-11-
28
"
).
toDate
();
Date
startDate
=
DateUtil
.
beginOfDay
(
date
).
toJdkDate
();
Date
endDate
=
DateUtil
.
endOfDay
(
date
).
toJdkDate
();
Map
<
Integer
,
String
>
companyMap
=
vehicleFeign
.
findCompanyMap
();
...
...
@@ -126,17 +126,16 @@ public class ServiceTest {
@Test
@SneakyThrows
public
void
testOrderReceivedStatisticsJobHandler
(){
cn
.
hutool
.
core
.
date
.
DateTime
dateTime
=
DateUtil
.
parse
(
"2019-11-29"
,
"yyyy-MM-dd"
);
/*
cn.hutool.core.date.DateTime dateTime = DateUtil.parse("2019-11-29", "yyyy-MM-dd");
// cn.hutool.core.date.DateTime offset = DateUtil.offset(dateTime, DateField.DAY_OF_MONTH, 1);
orderReceivedStatisticsJobHandler
.
execute
(
"2019-11-29"
);
/*
LocalDate startLocalDate = LocalDate.of(2019, 10, 1);
LocalDate endLocalDate = LocalDate.of(2019,11,2
9
);
orderReceivedStatisticsJobHandler.execute("2019-11-29");
*/
LocalDate
startLocalDate
=
LocalDate
.
of
(
2019
,
10
,
1
);
LocalDate
endLocalDate
=
LocalDate
.
of
(
2019
,
11
,
2
8
);
while
(
startLocalDate
.
isBefore
(
endLocalDate
)){
String
dateStr
=
startLocalDate
.
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
));
startLocalDate
=
startLocalDate
.
plusDays
(
1
);
orderReceivedStatisticsJobHandler
.
execute
(
dateStr
);
}
*/
}
}
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