Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
eshiled-new
/
ne-shield-trialdrive-admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit b76774c7
authored
Sep 03, 2021
by
杨林龙
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
优化报表查询
1 parent
95067eeb
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
185 additions
and
91 deletions
src/main/java/cn/com/glsx/admin/modules/model/export/ElectricInStoreExport.java
src/main/java/cn/com/glsx/admin/modules/model/export/TrialDriveReportExport.java
src/main/java/cn/com/glsx/admin/modules/model/param/ElectricInStoreSearch.java
src/main/java/cn/com/glsx/admin/modules/service/ElectricInStoreDriveService.java
src/main/java/cn/com/glsx/admin/modules/service/TrialDriveReportService.java
src/main/resources/mapper/ElectricInStoreDriveMapper.xml
src/main/resources/mapper/TrialDriveReportMapper.xml
src/main/resources/mapper/VehicleMapper.xml
src/test/java/cn/com/glsx/admin/modules/service/ElectricInStoreDriveServiceTest.java
src/main/java/cn/com/glsx/admin/modules/model/export/ElectricInStoreExport.java
View file @
b76774c
package
cn
.
com
.
glsx
.
admin
.
modules
.
model
.
export
;
package
cn
.
com
.
glsx
.
admin
.
modules
.
model
.
export
;
import
com.alibaba.excel.annotation.ExcelIgnore
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
com.alibaba.excel.annotation.ExcelProperty
;
import
lombok.Data
;
import
lombok.Data
;
...
@@ -10,6 +11,11 @@ import lombok.Data;
...
@@ -10,6 +11,11 @@ import lombok.Data;
*/
*/
@Data
@Data
public
class
ElectricInStoreExport
{
public
class
ElectricInStoreExport
{
/**
* 车辆Id
*/
@ExcelIgnore
private
Long
vehicleId
;
@ExcelProperty
(
value
=
"特约店代码"
,
index
=
0
)
@ExcelProperty
(
value
=
"特约店代码"
,
index
=
0
)
private
String
shopCode
;
private
String
shopCode
;
...
...
src/main/java/cn/com/glsx/admin/modules/model/export/TrialDriveReportExport.java
View file @
b76774c
...
@@ -19,6 +19,10 @@ public class TrialDriveReportExport {
...
@@ -19,6 +19,10 @@ public class TrialDriveReportExport {
@ExcelIgnore
@ExcelIgnore
private
Integer
dayCount
;
private
Integer
dayCount
;
// 车辆Id
@ExcelIgnore
private
Long
vehicleId
;
@ExcelProperty
(
value
=
"特约店代码"
,
index
=
0
)
@ExcelProperty
(
value
=
"特约店代码"
,
index
=
0
)
private
String
shopCode
;
private
String
shopCode
;
...
...
src/main/java/cn/com/glsx/admin/modules/model/param/ElectricInStoreSearch.java
View file @
b76774c
...
@@ -26,7 +26,7 @@ public class ElectricInStoreSearch extends Page {
...
@@ -26,7 +26,7 @@ public class ElectricInStoreSearch extends Page {
private
String
keywords
;
private
String
keywords
;
/**
/**
*
设备号
*
车辆id
*/
*/
private
String
sn
;
private
Long
vehicleId
;
}
}
src/main/java/cn/com/glsx/admin/modules/service/ElectricInStoreDriveService.java
View file @
b76774c
...
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -49,7 +50,7 @@ public class ElectricInStoreDriveService {
...
@@ -49,7 +50,7 @@ public class ElectricInStoreDriveService {
// 如果sn不为null 则封装每天具体数据
// 如果sn不为null 则封装每天具体数据
if
(
electricInStoreExport
.
getSn
()
!=
null
)
{
if
(
electricInStoreExport
.
getSn
()
!=
null
)
{
search
.
set
Sn
(
electricInStoreExport
.
getSn
());
search
.
set
VehicleId
(
electricInStoreExport
.
getVehicleId
());
List
<
ElectricInStoreDrive
>
inStoreDataList
=
inStoreDriveMapper
.
getInStoreDataListBySn
(
search
);
List
<
ElectricInStoreDrive
>
inStoreDataList
=
inStoreDriveMapper
.
getInStoreDataListBySn
(
search
);
Integer
num1
=
0
;
Integer
num1
=
0
;
Integer
num2
=
0
;
Integer
num2
=
0
;
...
@@ -98,6 +99,12 @@ public class ElectricInStoreDriveService {
...
@@ -98,6 +99,12 @@ public class ElectricInStoreDriveService {
num31
=
0
;
num31
=
0
;
}
}
// 每天数据缓存map
HashMap
<
Integer
,
Integer
>
cacheCalMap
=
new
HashMap
<>();
for
(
int
i
=
0
;
i
<
31
;
i
++)
{
cacheCalMap
.
put
(
i
,
0
);
}
// 组合每一天的数据
// 组合每一天的数据
for
(
ElectricInStoreDrive
inStoreDrive
:
inStoreDataList
)
{
for
(
ElectricInStoreDrive
inStoreDrive
:
inStoreDataList
)
{
// 设置报表统计时间
// 设置报表统计时间
...
@@ -108,157 +115,188 @@ public class ElectricInStoreDriveService {
...
@@ -108,157 +115,188 @@ public class ElectricInStoreDriveService {
case
1
:
case
1
:
num1
=
getInStoreNum
(
inStoreDrive
,
num1
);
num1
=
getInStoreNum
(
inStoreDrive
,
num1
);
summation
=
summation
+
num1
;
summation
=
summation
+
num1
;
electricInStoreExport
.
setDayNum1
(
num1
);
electricInStoreExport
.
setDayNum1
(
cacheCalMap
.
get
(
1
)
+
num1
);
cacheCalMap
.
put
(
1
,
cacheCalMap
.
get
(
1
)
+
num1
);
break
;
break
;
case
2
:
case
2
:
num2
=
getInStoreNum
(
inStoreDrive
,
num2
);
num2
=
getInStoreNum
(
inStoreDrive
,
num2
);
summation
=
summation
+
num2
;
summation
=
summation
+
num2
;
electricInStoreExport
.
setDayNum2
(
num2
);
electricInStoreExport
.
setDayNum2
(
cacheCalMap
.
get
(
2
)
+
num2
);
cacheCalMap
.
put
(
2
,
cacheCalMap
.
get
(
2
)
+
num2
);
break
;
break
;
case
3
:
case
3
:
num3
=
getInStoreNum
(
inStoreDrive
,
num3
);
num3
=
getInStoreNum
(
inStoreDrive
,
num3
);
summation
=
summation
+
num3
;
summation
=
summation
+
num3
;
electricInStoreExport
.
setDayNum3
(
num3
);
electricInStoreExport
.
setDayNum3
(
cacheCalMap
.
get
(
3
)
+
num3
);
cacheCalMap
.
put
(
3
,
cacheCalMap
.
get
(
3
)
+
num3
);
break
;
break
;
case
4
:
case
4
:
num4
=
getInStoreNum
(
inStoreDrive
,
num4
);
num4
=
getInStoreNum
(
inStoreDrive
,
num4
);
summation
=
summation
+
num4
;
summation
=
summation
+
num4
;
electricInStoreExport
.
setDayNum4
(
num4
);
electricInStoreExport
.
setDayNum4
(
cacheCalMap
.
get
(
4
)
+
num4
);
cacheCalMap
.
put
(
4
,
cacheCalMap
.
get
(
4
)
+
num4
);
break
;
break
;
case
5
:
case
5
:
num5
=
getInStoreNum
(
inStoreDrive
,
num5
);
num5
=
getInStoreNum
(
inStoreDrive
,
num5
);
summation
=
summation
+
num5
;
summation
=
summation
+
num5
;
electricInStoreExport
.
setDayNum5
(
num5
);
electricInStoreExport
.
setDayNum5
(
cacheCalMap
.
get
(
5
)
+
num5
);
cacheCalMap
.
put
(
5
,
cacheCalMap
.
get
(
5
)
+
num5
);
break
;
break
;
case
6
:
case
6
:
num6
=
getInStoreNum
(
inStoreDrive
,
num6
);
num6
=
getInStoreNum
(
inStoreDrive
,
num6
);
summation
=
summation
+
num6
;
summation
=
summation
+
num6
;
electricInStoreExport
.
setDayNum6
(
num6
);
electricInStoreExport
.
setDayNum6
(
cacheCalMap
.
get
(
6
)
+
num6
);
cacheCalMap
.
put
(
6
,
cacheCalMap
.
get
(
6
)
+
num6
);
break
;
break
;
case
7
:
case
7
:
num7
=
getInStoreNum
(
inStoreDrive
,
num7
);
num7
=
getInStoreNum
(
inStoreDrive
,
num7
);
summation
=
summation
+
num7
;
summation
=
summation
+
num7
;
electricInStoreExport
.
setDayNum7
(
num7
);
electricInStoreExport
.
setDayNum7
(
cacheCalMap
.
get
(
7
)
+
num7
);
cacheCalMap
.
put
(
7
,
cacheCalMap
.
get
(
7
)
+
num7
);
break
;
break
;
case
8
:
case
8
:
num8
=
getInStoreNum
(
inStoreDrive
,
num8
);
num8
=
getInStoreNum
(
inStoreDrive
,
num8
);
summation
=
summation
+
num8
;
summation
=
summation
+
num8
;
electricInStoreExport
.
setDayNum8
(
num8
);
electricInStoreExport
.
setDayNum8
(
cacheCalMap
.
get
(
8
)
+
num8
);
cacheCalMap
.
put
(
8
,
cacheCalMap
.
get
(
8
)
+
num8
);
break
;
break
;
case
9
:
case
9
:
num9
=
getInStoreNum
(
inStoreDrive
,
num9
);
num9
=
getInStoreNum
(
inStoreDrive
,
num9
);
summation
=
summation
+
num9
;
summation
=
summation
+
num9
;
electricInStoreExport
.
setDayNum9
(
num9
);
electricInStoreExport
.
setDayNum9
(
cacheCalMap
.
get
(
9
)
+
num9
);
cacheCalMap
.
put
(
9
,
cacheCalMap
.
get
(
9
)
+
num9
);
break
;
break
;
case
10
:
case
10
:
num10
=
getInStoreNum
(
inStoreDrive
,
num10
);
num10
=
getInStoreNum
(
inStoreDrive
,
num10
);
summation
=
summation
+
num10
;
summation
=
summation
+
num10
;
electricInStoreExport
.
setDayNum10
(
num10
);
electricInStoreExport
.
setDayNum10
(
cacheCalMap
.
get
(
10
)
+
num10
);
cacheCalMap
.
put
(
10
,
cacheCalMap
.
get
(
10
)
+
num10
);
break
;
break
;
case
11
:
case
11
:
num11
=
getInStoreNum
(
inStoreDrive
,
num11
);
num11
=
getInStoreNum
(
inStoreDrive
,
num11
);
summation
=
summation
+
num11
;
summation
=
summation
+
num11
;
electricInStoreExport
.
setDayNum11
(
num11
);
electricInStoreExport
.
setDayNum11
(
cacheCalMap
.
get
(
11
)
+
num11
);
cacheCalMap
.
put
(
11
,
cacheCalMap
.
get
(
11
)
+
num11
);
break
;
break
;
case
12
:
case
12
:
num12
=
getInStoreNum
(
inStoreDrive
,
num12
);
num12
=
getInStoreNum
(
inStoreDrive
,
num12
);
summation
=
summation
+
num12
;
summation
=
summation
+
num12
;
electricInStoreExport
.
setDayNum12
(
num12
);
electricInStoreExport
.
setDayNum12
(
cacheCalMap
.
get
(
12
)
+
num12
);
cacheCalMap
.
put
(
12
,
cacheCalMap
.
get
(
12
)
+
num12
);
break
;
break
;
case
13
:
case
13
:
num13
=
getInStoreNum
(
inStoreDrive
,
num13
);
num13
=
getInStoreNum
(
inStoreDrive
,
num13
);
summation
=
summation
+
num13
;
summation
=
summation
+
num13
;
electricInStoreExport
.
setDayNum13
(
num13
);
electricInStoreExport
.
setDayNum13
(
cacheCalMap
.
get
(
13
)
+
num13
);
cacheCalMap
.
put
(
13
,
cacheCalMap
.
get
(
13
)
+
num13
);
break
;
break
;
case
14
:
case
14
:
num14
=
getInStoreNum
(
inStoreDrive
,
num14
);
num14
=
getInStoreNum
(
inStoreDrive
,
num14
);
summation
=
summation
+
num14
;
summation
=
summation
+
num14
;
electricInStoreExport
.
setDayNum14
(
num14
);
electricInStoreExport
.
setDayNum14
(
cacheCalMap
.
get
(
14
)
+
num14
);
cacheCalMap
.
put
(
14
,
cacheCalMap
.
get
(
14
)
+
num14
);
break
;
break
;
case
15
:
case
15
:
num15
=
getInStoreNum
(
inStoreDrive
,
num15
);
num15
=
getInStoreNum
(
inStoreDrive
,
num15
);
summation
=
summation
+
num15
;
summation
=
summation
+
num15
;
electricInStoreExport
.
setDayNum15
(
num15
);
electricInStoreExport
.
setDayNum15
(
cacheCalMap
.
get
(
15
)
+
num15
);
cacheCalMap
.
put
(
15
,
cacheCalMap
.
get
(
15
)
+
num15
);
break
;
break
;
case
16
:
case
16
:
num16
=
getInStoreNum
(
inStoreDrive
,
num16
);
num16
=
getInStoreNum
(
inStoreDrive
,
num16
);
summation
=
summation
+
num16
;
summation
=
summation
+
num16
;
electricInStoreExport
.
setDayNum16
(
num16
);
electricInStoreExport
.
setDayNum16
(
cacheCalMap
.
get
(
16
)
+
num16
);
cacheCalMap
.
put
(
16
,
cacheCalMap
.
get
(
16
)
+
num16
);
break
;
break
;
case
17
:
case
17
:
num17
=
getInStoreNum
(
inStoreDrive
,
num17
);
num17
=
getInStoreNum
(
inStoreDrive
,
num17
);
summation
=
summation
+
num17
;
summation
=
summation
+
num17
;
electricInStoreExport
.
setDayNum17
(
num17
);
electricInStoreExport
.
setDayNum17
(
cacheCalMap
.
get
(
17
)
+
num17
);
cacheCalMap
.
put
(
17
,
cacheCalMap
.
get
(
17
)
+
num17
);
break
;
break
;
case
18
:
case
18
:
num18
=
getInStoreNum
(
inStoreDrive
,
num18
);
num18
=
getInStoreNum
(
inStoreDrive
,
num18
);
summation
=
summation
+
num18
;
summation
=
summation
+
num18
;
electricInStoreExport
.
setDayNum18
(
num18
);
electricInStoreExport
.
setDayNum18
(
cacheCalMap
.
get
(
18
)
+
num18
);
cacheCalMap
.
put
(
18
,
cacheCalMap
.
get
(
18
)
+
num18
);
break
;
break
;
case
19
:
case
19
:
num19
=
getInStoreNum
(
inStoreDrive
,
num19
);
num19
=
getInStoreNum
(
inStoreDrive
,
num19
);
summation
=
summation
+
num19
;
summation
=
summation
+
num19
;
electricInStoreExport
.
setDayNum19
(
num19
);
electricInStoreExport
.
setDayNum19
(
cacheCalMap
.
get
(
19
)
+
num19
);
cacheCalMap
.
put
(
19
,
cacheCalMap
.
get
(
19
)
+
num19
);
break
;
break
;
case
20
:
case
20
:
num20
=
getInStoreNum
(
inStoreDrive
,
num20
);
num20
=
getInStoreNum
(
inStoreDrive
,
num20
);
summation
=
summation
+
num20
;
summation
=
summation
+
num20
;
electricInStoreExport
.
setDayNum20
(
num20
);
electricInStoreExport
.
setDayNum20
(
cacheCalMap
.
get
(
20
)
+
num20
);
cacheCalMap
.
put
(
20
,
cacheCalMap
.
get
(
20
)
+
num20
);
break
;
break
;
case
21
:
case
21
:
num21
=
getInStoreNum
(
inStoreDrive
,
num21
);
num21
=
getInStoreNum
(
inStoreDrive
,
num21
);
summation
=
summation
+
num21
;
summation
=
summation
+
num21
;
electricInStoreExport
.
setDayNum21
(
num21
);
electricInStoreExport
.
setDayNum21
(
cacheCalMap
.
get
(
21
)
+
num21
);
cacheCalMap
.
put
(
21
,
cacheCalMap
.
get
(
21
)
+
num21
);
break
;
break
;
case
22
:
case
22
:
num22
=
getInStoreNum
(
inStoreDrive
,
num22
);
num22
=
getInStoreNum
(
inStoreDrive
,
num22
);
summation
=
summation
+
num22
;
summation
=
summation
+
num22
;
electricInStoreExport
.
setDayNum22
(
num22
);
electricInStoreExport
.
setDayNum22
(
cacheCalMap
.
get
(
22
)
+
num22
);
cacheCalMap
.
put
(
22
,
cacheCalMap
.
get
(
22
)
+
num22
);
break
;
break
;
case
23
:
case
23
:
num23
=
getInStoreNum
(
inStoreDrive
,
num23
);
num23
=
getInStoreNum
(
inStoreDrive
,
num23
);
summation
=
summation
+
num23
;
summation
=
summation
+
num23
;
electricInStoreExport
.
setDayNum23
(
num23
);
electricInStoreExport
.
setDayNum23
(
cacheCalMap
.
get
(
23
)
+
num23
);
cacheCalMap
.
put
(
23
,
cacheCalMap
.
get
(
23
)
+
num23
);
break
;
break
;
case
24
:
case
24
:
num24
=
getInStoreNum
(
inStoreDrive
,
num24
);
num24
=
getInStoreNum
(
inStoreDrive
,
num24
);
summation
=
summation
+
num24
;
summation
=
summation
+
num24
;
electricInStoreExport
.
setDayNum24
(
num24
);
electricInStoreExport
.
setDayNum24
(
cacheCalMap
.
get
(
24
)
+
num24
);
cacheCalMap
.
put
(
24
,
cacheCalMap
.
get
(
24
)
+
num24
);
break
;
break
;
case
25
:
case
25
:
num25
=
getInStoreNum
(
inStoreDrive
,
num25
);
num25
=
getInStoreNum
(
inStoreDrive
,
num25
);
summation
=
summation
+
num25
;
summation
=
summation
+
num25
;
electricInStoreExport
.
setDayNum25
(
num25
);
electricInStoreExport
.
setDayNum25
(
cacheCalMap
.
get
(
25
)
+
num25
);
cacheCalMap
.
put
(
25
,
cacheCalMap
.
get
(
25
)
+
num25
);
break
;
break
;
case
26
:
case
26
:
num26
=
getInStoreNum
(
inStoreDrive
,
num26
);
num26
=
getInStoreNum
(
inStoreDrive
,
num26
);
summation
=
summation
+
num26
;
summation
=
summation
+
num26
;
electricInStoreExport
.
setDayNum26
(
num26
);
electricInStoreExport
.
setDayNum26
(
cacheCalMap
.
get
(
26
)
+
num26
);
cacheCalMap
.
put
(
26
,
cacheCalMap
.
get
(
26
)
+
num26
);
break
;
break
;
case
27
:
case
27
:
num27
=
getInStoreNum
(
inStoreDrive
,
num27
);
num27
=
getInStoreNum
(
inStoreDrive
,
num27
);
summation
=
summation
+
num27
;
summation
=
summation
+
num27
;
electricInStoreExport
.
setDayNum27
(
num27
);
electricInStoreExport
.
setDayNum27
(
cacheCalMap
.
get
(
27
)
+
num27
);
cacheCalMap
.
put
(
27
,
cacheCalMap
.
get
(
27
)
+
num27
);
break
;
break
;
case
28
:
case
28
:
num28
=
getInStoreNum
(
inStoreDrive
,
num28
);
num28
=
getInStoreNum
(
inStoreDrive
,
num28
);
summation
=
summation
+
num28
;
summation
=
summation
+
num28
;
electricInStoreExport
.
setDayNum28
(
num28
);
electricInStoreExport
.
setDayNum28
(
cacheCalMap
.
get
(
28
)
+
num28
);
cacheCalMap
.
put
(
28
,
cacheCalMap
.
get
(
28
)
+
num28
);
break
;
break
;
case
29
:
case
29
:
num29
=
getInStoreNum
(
inStoreDrive
,
num29
);
num29
=
getInStoreNum
(
inStoreDrive
,
num29
);
summation
=
summation
+
num29
;
summation
=
summation
+
num29
;
electricInStoreExport
.
setDayNum29
(
num29
);
electricInStoreExport
.
setDayNum29
(
cacheCalMap
.
get
(
29
)
+
num29
);
cacheCalMap
.
put
(
29
,
cacheCalMap
.
get
(
29
)
+
num29
);
break
;
break
;
case
30
:
case
30
:
num30
=
getInStoreNum
(
inStoreDrive
,
num30
);
num30
=
getInStoreNum
(
inStoreDrive
,
num30
);
summation
=
summation
+
num30
;
summation
=
summation
+
num30
;
electricInStoreExport
.
setDayNum30
(
num30
);
electricInStoreExport
.
setDayNum30
(
cacheCalMap
.
get
(
30
)
+
num30
);
cacheCalMap
.
put
(
30
,
cacheCalMap
.
get
(
30
)
+
num30
);
break
;
break
;
case
31
:
case
31
:
num31
=
getInStoreNum
(
inStoreDrive
,
num31
);
num31
=
getInStoreNum
(
inStoreDrive
,
num31
);
summation
=
summation
+
num31
;
summation
=
summation
+
num31
;
electricInStoreExport
.
setDayNum8
(
num31
);
electricInStoreExport
.
setDayNum31
(
cacheCalMap
.
get
(
31
)
+
num31
);
cacheCalMap
.
put
(
31
,
cacheCalMap
.
get
(
31
)
+
num31
);
break
;
break
;
default
:
default
:
log
.
info
(
"已经超过最大天数"
);
log
.
info
(
"已经超过最大天数"
);
...
...
src/main/java/cn/com/glsx/admin/modules/service/TrialDriveReportService.java
View file @
b76774c
...
@@ -10,6 +10,7 @@ import org.apache.commons.collections.CollectionUtils;
...
@@ -10,6 +10,7 @@ import org.apache.commons.collections.CollectionUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -137,102 +138,139 @@ public class TrialDriveReportService {
...
@@ -137,102 +138,139 @@ public class TrialDriveReportService {
try
{
try
{
// 填充每一个有试驾车辆的数据
// 填充每一个有试驾车辆的数据
int
summation
=
0
;
int
summation
=
0
;
log
.
info
(
"makeDriveData sn ===="
+
drivePageExcel
.
getSn
());
log
.
info
(
"makeDriveData sn ===="
+
drivePageExcel
.
getVin
());
// 每天数据缓存map
HashMap
<
Integer
,
Integer
>
cacheCalMap
=
new
HashMap
<>();
for
(
int
i
=
0
;
i
<
31
;
i
++)
{
cacheCalMap
.
put
(
i
,
0
);
}
for
(
TrialDriveReportExport
driveDataOne
:
testDriveDataOneList
)
{
for
(
TrialDriveReportExport
driveDataOne
:
testDriveDataOneList
)
{
summation
=
summation
+
driveDataOne
.
getCnttotal
();
summation
=
summation
+
driveDataOne
.
getCnttotal
();
switch
(
driveDataOne
.
getDayCount
())
{
switch
(
driveDataOne
.
getDayCount
())
{
case
1
:
case
1
:
drivePageExcel
.
setDayNum1
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum1
(
cacheCalMap
.
get
(
1
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
1
,
cacheCalMap
.
get
(
1
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
2
:
case
2
:
drivePageExcel
.
setDayNum2
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum2
(
cacheCalMap
.
get
(
2
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
2
,
cacheCalMap
.
get
(
2
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
3
:
case
3
:
drivePageExcel
.
setDayNum3
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum3
(
cacheCalMap
.
get
(
3
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
3
,
cacheCalMap
.
get
(
3
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
4
:
case
4
:
drivePageExcel
.
setDayNum4
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum4
(
cacheCalMap
.
get
(
4
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
4
,
cacheCalMap
.
get
(
4
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
5
:
case
5
:
drivePageExcel
.
setDayNum5
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum5
(
cacheCalMap
.
get
(
5
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
5
,
cacheCalMap
.
get
(
5
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
6
:
case
6
:
drivePageExcel
.
setDayNum6
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum6
(
cacheCalMap
.
get
(
6
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
6
,
cacheCalMap
.
get
(
6
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
7
:
case
7
:
drivePageExcel
.
setDayNum7
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum7
(
cacheCalMap
.
get
(
7
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
7
,
cacheCalMap
.
get
(
7
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
8
:
case
8
:
drivePageExcel
.
setDayNum8
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum8
(
cacheCalMap
.
get
(
8
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
8
,
cacheCalMap
.
get
(
8
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
9
:
case
9
:
drivePageExcel
.
setDayNum9
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum9
(
cacheCalMap
.
get
(
9
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
9
,
cacheCalMap
.
get
(
9
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
10
:
case
10
:
drivePageExcel
.
setDayNum10
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum10
(
cacheCalMap
.
get
(
10
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
10
,
cacheCalMap
.
get
(
10
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
11
:
case
11
:
drivePageExcel
.
setDayNum11
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum11
(
cacheCalMap
.
get
(
11
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
11
,
cacheCalMap
.
get
(
11
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
12
:
case
12
:
drivePageExcel
.
setDayNum12
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum12
(
cacheCalMap
.
get
(
12
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
12
,
cacheCalMap
.
get
(
12
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
13
:
case
13
:
drivePageExcel
.
setDayNum13
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum13
(
cacheCalMap
.
get
(
13
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
13
,
cacheCalMap
.
get
(
13
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
14
:
case
14
:
drivePageExcel
.
setDayNum14
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum14
(
cacheCalMap
.
get
(
14
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
14
,
cacheCalMap
.
get
(
14
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
15
:
case
15
:
drivePageExcel
.
setDayNum15
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum15
(
cacheCalMap
.
get
(
15
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
15
,
cacheCalMap
.
get
(
15
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
16
:
case
16
:
drivePageExcel
.
setDayNum16
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum16
(
cacheCalMap
.
get
(
16
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
16
,
cacheCalMap
.
get
(
16
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
17
:
case
17
:
drivePageExcel
.
setDayNum17
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum17
(
cacheCalMap
.
get
(
17
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
17
,
cacheCalMap
.
get
(
17
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
18
:
case
18
:
drivePageExcel
.
setDayNum18
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum18
(
cacheCalMap
.
get
(
18
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
18
,
cacheCalMap
.
get
(
18
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
19
:
case
19
:
drivePageExcel
.
setDayNum19
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum19
(
cacheCalMap
.
get
(
19
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
19
,
cacheCalMap
.
get
(
19
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
20
:
case
20
:
drivePageExcel
.
setDayNum20
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum20
(
cacheCalMap
.
get
(
20
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
20
,
cacheCalMap
.
get
(
20
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
21
:
case
21
:
drivePageExcel
.
setDayNum21
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum21
(
cacheCalMap
.
get
(
21
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
21
,
cacheCalMap
.
get
(
21
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
22
:
case
22
:
drivePageExcel
.
setDayNum22
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum22
(
cacheCalMap
.
get
(
22
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
22
,
cacheCalMap
.
get
(
22
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
23
:
case
23
:
drivePageExcel
.
setDayNum23
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum23
(
cacheCalMap
.
get
(
23
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
23
,
cacheCalMap
.
get
(
23
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
24
:
case
24
:
drivePageExcel
.
setDayNum24
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum24
(
cacheCalMap
.
get
(
24
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
24
,
cacheCalMap
.
get
(
24
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
25
:
case
25
:
drivePageExcel
.
setDayNum25
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum25
(
cacheCalMap
.
get
(
25
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
25
,
cacheCalMap
.
get
(
25
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
26
:
case
26
:
drivePageExcel
.
setDayNum26
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum26
(
cacheCalMap
.
get
(
26
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
26
,
cacheCalMap
.
get
(
26
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
27
:
case
27
:
drivePageExcel
.
setDayNum27
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum27
(
cacheCalMap
.
get
(
27
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
27
,
cacheCalMap
.
get
(
27
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
28
:
case
28
:
drivePageExcel
.
setDayNum28
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum28
(
cacheCalMap
.
get
(
28
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
28
,
cacheCalMap
.
get
(
28
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
29
:
case
29
:
drivePageExcel
.
setDayNum29
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum29
(
cacheCalMap
.
get
(
29
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
29
,
cacheCalMap
.
get
(
29
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
30
:
case
30
:
drivePageExcel
.
setDayNum30
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum30
(
cacheCalMap
.
get
(
30
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
30
,
cacheCalMap
.
get
(
30
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
case
31
:
case
31
:
drivePageExcel
.
setDayNum31
(
driveDataOne
.
getCnttotal
());
drivePageExcel
.
setDayNum31
(
cacheCalMap
.
get
(
31
)
+
driveDataOne
.
getCnttotal
());
cacheCalMap
.
put
(
31
,
cacheCalMap
.
get
(
31
)
+
driveDataOne
.
getCnttotal
());
break
;
break
;
default
:
default
:
drivePageExcel
.
setDayNum1
(
0
);
drivePageExcel
.
setDayNum1
(
0
);
...
...
src/main/resources/mapper/ElectricInStoreDriveMapper.xml
View file @
b76774c
...
@@ -29,20 +29,18 @@
...
@@ -29,20 +29,18 @@
<select
id=
"getAllTestDrive"
parameterType=
"cn.com.glsx.admin.modules.model.param.ElectricInStoreSearch"
<select
id=
"getAllTestDrive"
parameterType=
"cn.com.glsx.admin.modules.model.param.ElectricInStoreSearch"
resultType=
"cn.com.glsx.admin.modules.model.export.ElectricInStoreExport"
>
resultType=
"cn.com.glsx.admin.modules.model.export.ElectricInStoreExport"
>
SELECT
distinct
SELECT
tu.account shopCode,
tu.account shopCode,
tu.username shopName,
tu.username shopName,
t
efs.s
n,
t
v.vi
n,
t
efs.vin
,
t
v.id as vehicleId
,
tv.model_name modelName
tv.model_name modelName
from t_vehicle tv
FROM t_vehicle tv
inner join t_electric_fence_sns tefs on tv.vin = tefs.vin
inner join t_trial_drive_vehicle ttdv on ttdv.vehicle_id = tv.id
inner join t_electric_fence tef on tef.id = tefs.fence_id
LEFT JOIN t_user tu ON tu.id = ttdv.created_by
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
WHERE tu.del_flag = 0
left join t_user tu on tu.id = tef.created_by
AND tv.del_flag = 0
where tef.biz_fence_type = 12
AND ttdv.del_flag = 0
and tu.del_flag = 0
and tvd.trial_type = 1
<if
test=
"keywords != null and keywords!='' "
>
<if
test=
"keywords != null and keywords!='' "
>
and (
and (
tu.account like '%${keywords}%'
tu.account like '%${keywords}%'
...
@@ -55,6 +53,7 @@
...
@@ -55,6 +53,7 @@
<select
id=
"getInStoreDataListBySn"
resultMap=
"BaseResultMap"
>
<select
id=
"getInStoreDataListBySn"
resultMap=
"BaseResultMap"
>
select teid.position_state , teid.gps_state , teid.gps_time , day(teid.gps_time) as dayOfMonth
select teid.position_state , teid.gps_state , teid.gps_time , day(teid.gps_time) as dayOfMonth
from t_electric_instore_drive teid
from t_electric_instore_drive teid
left join t_vehicle_device tvd on tvd.sn = teid.sn
<where>
<where>
<choose>
<choose>
<when
test=
"year != null and year != '' and month != null and month != '' "
>
<when
test=
"year != null and year != '' and month != null and month != '' "
>
...
@@ -69,7 +68,10 @@
...
@@ -69,7 +68,10 @@
</if>
</if>
</otherwise>
</otherwise>
</choose>
</choose>
and teid.sn = #{sn}
and tvd.vehicle_id = #{vehicleId}
and tvd.bind_status = 1
and tvd.trial_type = 1
and tvd.del_flag = 0
</where>
</where>
</select>
</select>
</mapper>
</mapper>
src/main/resources/mapper/TrialDriveReportMapper.xml
View file @
b76774c
...
@@ -19,26 +19,25 @@
...
@@ -19,26 +19,25 @@
<result
column=
"shopName"
jdbcType=
"VARCHAR"
property=
"shopName"
/>
<result
column=
"shopName"
jdbcType=
"VARCHAR"
property=
"shopName"
/>
<result
column=
"sn"
jdbcType=
"VARCHAR"
property=
"sn"
/>
<result
column=
"sn"
jdbcType=
"VARCHAR"
property=
"sn"
/>
<result
column=
"vin"
jdbcType=
"VARCHAR"
property=
"vin"
/>
<result
column=
"vin"
jdbcType=
"VARCHAR"
property=
"vin"
/>
<result
column=
"vehicleId"
jdbcType=
"INTEGER"
property=
"vehicleId"
/>
<result
column=
"vehicleTypeName"
jdbcType=
"VARCHAR"
property=
"vehicleTypeName"
/>
<result
column=
"vehicleTypeName"
jdbcType=
"VARCHAR"
property=
"vehicleTypeName"
/>
</resultMap>
</resultMap>
<select
id=
"getTestDrivePageList"
<select
id=
"getTestDrivePageList"
parameterType=
"cn.com.glsx.admin.modules.model.param.TrialDriveReportSearch"
parameterType=
"cn.com.glsx.admin.modules.model.param.TrialDriveReportSearch"
resultMap=
"PageBaseMap"
>
resultMap=
"PageBaseMap"
>
SELECT
distinct
SELECT
tu.account shopCode,
tu.account shopCode,
tu.username shopName,
tu.username shopName,
t
efs.s
n,
t
v.vi
n,
t
efs.vin
,
t
v.id as vehicleId
,
case when tv.type_id is null then tv.model_name else concat(tv.sub_brand_name, '/', series_name) end vehicleTypeName
case when tv.type_id is null then tv.model_name else concat(tv.sub_brand_name, '/', series_name) end vehicleTypeName
from t_vehicle tv
FROM t_vehicle tv
inner join t_electric_fence_sns tefs on tv.vin = tefs.vin
inner join t_trial_drive_vehicle ttdv on ttdv.vehicle_id = tv.id
inner join t_electric_fence tef on tef.id = tefs.fence_id
LEFT JOIN t_user tu ON tu.id = ttdv.created_by
left join t_vehicle_device tvd on tvd.vehicle_id = tv.id
WHERE tu.del_flag = 0
left join t_user tu on tu.id = tef.created_by
AND tv.del_flag = 0
where tef.del_flag = 0
AND ttdv.del_flag = 0
and tef.biz_fence_type = 12
and tvd.trial_type = 1
<if
test=
"keywords != null and keywords!='' "
>
<if
test=
"keywords != null and keywords!='' "
>
and (
and (
tu.account like '%${keywords}%'
tu.account like '%${keywords}%'
...
@@ -54,6 +53,7 @@
...
@@ -54,6 +53,7 @@
left(tsfd.drive_time,7) as statDate,
left(tsfd.drive_time,7) as statDate,
day(str_to_date(tsfd.drive_time, '%Y-%m-%d')) as dayCount
day(str_to_date(tsfd.drive_time, '%Y-%m-%d')) as dayCount
from t_statistics_fence_drive tsfd
from t_statistics_fence_drive tsfd
left join t_vehicle_device tvd on tvd.sn = tsfd.sn
<where>
<where>
<choose>
<choose>
<when
test=
"year != null and year != '' and month != null and month != '' "
>
<when
test=
"year != null and year != '' and month != null and month != '' "
>
...
@@ -68,7 +68,10 @@
...
@@ -68,7 +68,10 @@
</if>
</if>
</otherwise>
</otherwise>
</choose>
</choose>
and tsfd.sn = #{sn}
and tvd.vehicle_id = #{vehicleId}
and tvd.bind_status = 1
and tvd.trial_type = 1
and tvd.del_flag = 0
</where>
</where>
</select>
</select>
...
...
src/main/resources/mapper/VehicleMapper.xml
View file @
b76774c
...
@@ -165,6 +165,7 @@
...
@@ -165,6 +165,7 @@
left join t_user tu on tv.created_by = tu.id and tu.del_flag = 0
left join t_user tu on tv.created_by = tu.id and tu.del_flag = 0
left join t_trial_drive_shop ttds on tu.id = ttds.created_by and ttds.del_flag = 0
left join t_trial_drive_shop ttds on tu.id = ttds.created_by and ttds.del_flag = 0
where tv.del_flag = 0
where tv.del_flag = 0
and ttdv.del_flag = 0
<include
refid=
"search_sql_condition"
/>
<include
refid=
"search_sql_condition"
/>
group by tv.id
group by tv.id
order by tv.created_date desc
order by tv.created_date desc
...
@@ -182,10 +183,12 @@
...
@@ -182,10 +183,12 @@
tu.username shopName, tu.account shopCode,
tu.username shopName, tu.account shopCode,
group_concat(tvd.sn) sns
group_concat(tvd.sn) sns
from t_vehicle tv
from t_vehicle tv
inner join t_trial_drive_vehicle ttdv on ttdv.vehicle_id = tv.id
left join t_vehicle_device tvd on tv.id = tvd.vehicle_id and tvd.bind_status = 1 and tvd.del_flag = 0 and tvd.trial_type = 1
left join t_vehicle_device tvd on tv.id = tvd.vehicle_id and tvd.bind_status = 1 and tvd.del_flag = 0 and tvd.trial_type = 1
left join t_user tu on tv.created_by = tu.id and tu.del_flag = 0
left join t_user tu on tv.created_by = tu.id and tu.del_flag = 0
left join t_trial_drive_shop ttds on tu.id = ttds.created_by and ttds.del_flag = 0
left join t_trial_drive_shop ttds on tu.id = ttds.created_by and ttds.del_flag = 0
where tv.del_flag = 0
where tv.del_flag = 0
and ttdv.del_flag = 0
<include
refid=
"search_sql_condition"
/>
<include
refid=
"search_sql_condition"
/>
group by tv.id
group by tv.id
order by tv.created_date desc
order by tv.created_date desc
...
...
src/test/java/cn/com/glsx/admin/modules/service/ElectricInStoreDriveServiceTest.java
View file @
b76774c
...
@@ -102,7 +102,7 @@ public class ElectricInStoreDriveServiceTest {
...
@@ -102,7 +102,7 @@ public class ElectricInStoreDriveServiceTest {
// 如果sn不为null 则封装每天具体数据
// 如果sn不为null 则封装每天具体数据
if
(
electricInStoreExport
.
getSn
()
!=
null
)
{
if
(
electricInStoreExport
.
getSn
()
!=
null
)
{
search
.
set
Sn
(
electricInStoreExport
.
getSn
());
search
.
set
VehicleId
(
electricInStoreExport
.
getVehicleId
());
List
<
ElectricInStoreDrive
>
inStoreDataList
=
inStoreDriveMapper
.
getInStoreDataListBySn
(
search
);
List
<
ElectricInStoreDrive
>
inStoreDataList
=
inStoreDriveMapper
.
getInStoreDataListBySn
(
search
);
Integer
num1
=
0
;
Integer
num1
=
0
;
Integer
num2
=
0
;
Integer
num2
=
0
;
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment