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
ce3dbc1a
Commit
ce3dbc1a
authored
Jan 03, 2020
by
jiaorz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
车辆统计修改导出数据
parent
fefa6908
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
6 deletions
+37
-6
BranchCompanyVehicleCountBiz.java
...fc/platform/vehicle/biz/BranchCompanyVehicleCountBiz.java
+30
-0
VehicleCountRecordBiz.java
.../com/xxfc/platform/vehicle/biz/VehicleCountRecordBiz.java
+2
-1
BranchCompanyVehicleCountController.java
...hicle/rest/admin/BranchCompanyVehicleCountController.java
+4
-4
VehicleMapper.xml
...ehicle-server/src/main/resources/mapper/VehicleMapper.xml
+1
-1
No files found.
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/BranchCompanyVehicleCountBiz.java
View file @
ce3dbc1a
...
@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -20,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
@Service
@Service
...
@@ -120,4 +121,33 @@ public class BranchCompanyVehicleCountBiz extends BaseBiz<BranchCompanyVehicleCo
...
@@ -120,4 +121,33 @@ public class BranchCompanyVehicleCountBiz extends BaseBiz<BranchCompanyVehicleCo
return
ObjectRestResponse
.
succ
(
new
PageDataVO
<>());
return
ObjectRestResponse
.
succ
(
new
PageDataVO
<>());
}
}
public
List
<
BranchCompanyVehicleCountVo
>
exportAllDate
(
BranchCompanyVehicleCountDTO
branchCompanyVehicleCountDTO
)
{
if
(
StringUtils
.
isBlank
(
branchCompanyVehicleCountDTO
.
getStartTime
())
||
StringUtils
.
isBlank
(
branchCompanyVehicleCountDTO
.
getEndTime
()))
{
branchCompanyVehicleCountDTO
.
setStartTime
(
DateTime
.
now
().
minusDays
(
1
).
toString
(
DATE_TIME_FORMATTER
));
branchCompanyVehicleCountDTO
.
setEndTime
(
DateTime
.
now
().
minusDays
(
1
).
toString
(
DATE_TIME_FORMATTER
));
}
Integer
type
=
branchCompanyVehicleCountDTO
.
getType
()
==
null
?
1
:
branchCompanyVehicleCountDTO
.
getType
();
Query
query
=
new
Query
(
branchCompanyVehicleCountDTO
);
if
(
type
==
1
)
{
//按天
return
mapper
.
getAllCountInfo
(
query
.
getSuper
());
}
if
(
type
==
2
)
{
//按周
List
<
BranchCompanyVehicleCountVo
>
pageDataVO
=
mapper
.
countByWeek
(
query
.
getSuper
());
if
(
pageDataVO
!=
null
&&
pageDataVO
.
size
()
>
0
)
{
pageDataVO
.
parallelStream
().
forEach
(
result
->
{
String
weekStartDate
=
OrderDateUtils
.
getStartDayOfWeekNo
(
result
.
getCountYear
(),
result
.
getCountWeek
());
String
weekEndDate
=
OrderDateUtils
.
getEndDayOfWeekNo
(
result
.
getCountYear
(),
result
.
getCountWeek
());
result
.
setWeekStartDate
(
weekStartDate
);
result
.
setWeekEndDate
(
weekEndDate
);
});
}
return
pageDataVO
;
}
if
(
type
==
3
)
{
//按月
return
mapper
.
countByMonth
(
query
.
getSuper
());
}
return
new
ArrayList
<>();
}
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleCountRecordBiz.java
View file @
ce3dbc1a
...
@@ -123,7 +123,8 @@ public class VehicleCountRecordBiz extends BaseBiz<VehicleCountRecordMapper, Veh
...
@@ -123,7 +123,8 @@ public class VehicleCountRecordBiz extends BaseBiz<VehicleCountRecordMapper, Veh
DateTime
startDay
=
DateTime
.
parse
(
startDate
,
DEFAULT_DATE_TIME_FORMATTER
);
DateTime
startDay
=
DateTime
.
parse
(
startDate
,
DEFAULT_DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
endDate
,
DEFAULT_DATE_TIME_FORMATTER
);
DateTime
endDay
=
DateTime
.
parse
(
endDate
,
DEFAULT_DATE_TIME_FORMATTER
);
int
i
=
0
;
int
i
=
0
;
for
(
DateTime
curDate
=
startDay
;
i
<
30
;
curDate
=
curDate
.
minusDays
(
1
))
{
int
monthDay
=
endDay
.
getDayOfMonth
()
-
startDay
.
getDayOfMonth
()
+
1
;
for
(
DateTime
curDate
=
startDay
;
i
<
monthDay
;
curDate
=
curDate
.
minusDays
(
1
))
{
i
++;
i
++;
nowTime
=
curDate
.
getMillis
();
nowTime
=
curDate
.
getMillis
();
lastTime
=
nowTime
+
24
*
3600
*
1000
-
1
;
lastTime
=
nowTime
+
24
*
3600
*
1000
-
1
;
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/admin/BranchCompanyVehicleCountController.java
View file @
ce3dbc1a
...
@@ -4,7 +4,6 @@ import cn.hutool.core.io.IoUtil;
...
@@ -4,7 +4,6 @@ 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.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.xxfc.platform.vehicle.biz.BranchCompanyVehicleCountBiz
;
import
com.xxfc.platform.vehicle.biz.BranchCompanyVehicleCountBiz
;
import
com.xxfc.platform.vehicle.common.BaseController
;
import
com.xxfc.platform.vehicle.common.BaseController
;
import
com.xxfc.platform.vehicle.pojo.BranchCompanyVehicleCountVo
;
import
com.xxfc.platform.vehicle.pojo.BranchCompanyVehicleCountVo
;
...
@@ -17,6 +16,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
...
@@ -17,6 +16,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
@Controller
@Controller
@RequestMapping
(
value
=
"/bg-vehicle/count"
)
@RequestMapping
(
value
=
"/bg-vehicle/count"
)
...
@@ -33,8 +33,8 @@ public class BranchCompanyVehicleCountController extends BaseController<BranchCo
...
@@ -33,8 +33,8 @@ public class BranchCompanyVehicleCountController extends BaseController<BranchCo
}
}
@GetMapping
(
"/app/unauth/export"
)
@GetMapping
(
"/app/unauth/export"
)
public
void
exportVehicleInfo
(
BranchCompanyVehicleCountDTO
branchCompanyVehicleCountDTO
)
throws
Exception
{
public
void
exportVehicleInfo
(
BranchCompanyVehicleCountDTO
branchCompanyVehicleCountDTO
)
throws
Exception
{
PageDataVO
<
BranchCompanyVehicleCountVo
>
pageDataVO
=
baseBiz
.
getAllCountInfo
(
branchCompanyVehicleCountDTO
).
getData
(
);
List
<
BranchCompanyVehicleCountVo
>
pageDataVO
=
baseBiz
.
exportAllDate
(
branchCompanyVehicleCountDTO
);
if
(
pageDataVO
!=
null
&&
pageDataVO
.
getData
()
!=
null
)
{
if
(
pageDataVO
!=
null
&&
pageDataVO
.
size
()
>
0
)
{
ExcelWriter
writer
=
ExcelUtil
.
getWriter
(
true
);
ExcelWriter
writer
=
ExcelUtil
.
getWriter
(
true
);
writer
.
addHeaderAlias
(
"companyId"
,
"公司ID"
);
writer
.
addHeaderAlias
(
"companyId"
,
"公司ID"
);
writer
.
addHeaderAlias
(
"companyName"
,
"公司名"
);
writer
.
addHeaderAlias
(
"companyName"
,
"公司名"
);
...
@@ -50,7 +50,7 @@ public class BranchCompanyVehicleCountController extends BaseController<BranchCo
...
@@ -50,7 +50,7 @@ public class BranchCompanyVehicleCountController extends BaseController<BranchCo
writer
.
setColumnWidth
(
6
,
17
);
writer
.
setColumnWidth
(
6
,
17
);
writer
.
setColumnWidth
(
1
,
17
);
writer
.
setColumnWidth
(
1
,
17
);
// 一次性写出内容,使用默认样式,强制输出标题
// 一次性写出内容,使用默认样式,强制输出标题
writer
.
write
(
pageDataVO
.
getData
()
,
true
);
writer
.
write
(
pageDataVO
,
true
);
//response为HttpServletResponse对象
//response为HttpServletResponse对象
response
.
setContentType
(
"application/vnd.ms-excel;charset=utf-8"
);
response
.
setContentType
(
"application/vnd.ms-excel;charset=utf-8"
);
//test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
//test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
...
...
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleMapper.xml
View file @
ce3dbc1a
...
@@ -608,7 +608,7 @@
...
@@ -608,7 +608,7 @@
FROM
FROM
vehicle v
vehicle v
LEFT JOIN branch_company b ON b.id = v.park_branch_company_id
LEFT JOIN branch_company b ON b.id = v.park_branch_company_id
where v.i
d
_del = 0
where v.i
s
_del = 0
GROUP BY
GROUP BY
b.id
b.id
</select>
</select>
...
...
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