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
5deb634e
Commit
5deb634e
authored
Nov 19, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
后台导出车辆信息
parent
1c46624e
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
224 additions
and
14 deletions
+224
-14
BranchCompanyVehicleCount.java
...fc/platform/vehicle/entity/BranchCompanyVehicleCount.java
+43
-0
BranchCompanyVehicleCountVo.java
...fc/platform/vehicle/pojo/BranchCompanyVehicleCountVo.java
+2
-1
BranchCompanyVehicleCountDTO.java
...atform/vehicle/pojo/dto/BranchCompanyVehicleCountDTO.java
+15
-0
BranchCompanyVehicleCountBiz.java
...fc/platform/vehicle/biz/BranchCompanyVehicleCountBiz.java
+47
-0
VehicleBiz.java
...c/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
+1
-1
VehicleInformationDownloadBiz.java
...c/platform/vehicle/biz/VehicleInformationDownloadBiz.java
+32
-2
BranchCompanyVehicleCountMapper.java
...tform/vehicle/mapper/BranchCompanyVehicleCountMapper.java
+12
-0
VehicleMapper.java
.../java/com/xxfc/platform/vehicle/mapper/VehicleMapper.java
+1
-1
BranchCompanyVehicleCountController.java
...hicle/rest/admin/BranchCompanyVehicleCountController.java
+21
-0
VehicleInformationDownloadController.java
...icle/rest/admin/VehicleInformationDownloadController.java
+21
-7
BranchCompanyVehicleCountMapper.xml
...main/resources/mapper/BranchCompanyVehicleCountMapper.xml
+26
-0
VehicleMapper.xml
...ehicle-server/src/main/resources/mapper/VehicleMapper.xml
+3
-2
No files found.
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/entity/BranchCompanyVehicleCount.java
0 → 100644
View file @
5deb634e
package
com
.
xxfc
.
platform
.
vehicle
.
entity
;
import
lombok.Data
;
import
javax.persistence.Column
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.util.Date
;
/**
* 分公司停靠车辆统计
*/
@Table
(
name
=
"branch_company_vehicle_count"
)
@Data
public
class
BranchCompanyVehicleCount
{
@Id
private
Long
id
;
/**
* 公司名称
*/
@Column
(
name
=
"company_name"
)
private
String
companyName
;
/**
* 当前停靠车辆数量
*/
@Column
(
name
=
"vehicle_num"
)
private
Integer
vehicleNum
;
/**
* 统计日期
*/
@Column
(
name
=
"count_date"
)
private
Date
countDate
;
/**
* 公司ID
*/
@Column
(
name
=
"company_id"
)
private
Integer
companyId
;
}
\ No newline at end of file
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/BranchCompanyVehicleCount.java
→
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/BranchCompanyVehicleCount
Vo
.java
View file @
5deb634e
...
...
@@ -3,7 +3,8 @@ package com.xxfc.platform.vehicle.pojo;
import
lombok.Data
;
@Data
public
class
BranchCompanyVehicleCount
{
public
class
BranchCompanyVehicleCount
Vo
{
private
String
parkBranchCompanyName
;
private
Integer
count
;
private
Integer
companyId
;
}
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/dto/BranchCompanyVehicleCountDTO.java
0 → 100644
View file @
5deb634e
package
com
.
xxfc
.
platform
.
vehicle
.
pojo
.
dto
;
import
com.github.wxiaoqi.security.common.vo.PageParam
;
import
lombok.Data
;
@Data
public
class
BranchCompanyVehicleCountDTO
extends
PageParam
{
//开始时间 yyyy-MM-dd
private
String
startTime
;
//结束时间
private
String
endTime
;
private
String
companyName
;
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/BranchCompanyVehicleCountBiz.java
0 → 100644
View file @
5deb634e
package
com
.
xxfc
.
platform
.
vehicle
.
biz
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.Query
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.xxfc.platform.vehicle.entity.BranchCompanyVehicleCount
;
import
com.xxfc.platform.vehicle.mapper.BranchCompanyVehicleCountMapper
;
import
com.xxfc.platform.vehicle.pojo.dto.BranchCompanyVehicleCountDTO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
java.util.Iterator
;
import
java.util.List
;
@Service
@Slf4j
public
class
BranchCompanyVehicleCountBiz
extends
BaseBiz
<
BranchCompanyVehicleCountMapper
,
BranchCompanyVehicleCount
>
{
public
ObjectRestResponse
add
(
List
<
BranchCompanyVehicleCount
>
branchCompanyVehicleCounts
)
{
if
(
branchCompanyVehicleCounts
==
null
)
{
return
ObjectRestResponse
.
paramIsEmpty
();
}
Iterator
<
BranchCompanyVehicleCount
>
iterator
=
branchCompanyVehicleCounts
.
iterator
();
while
(
iterator
.
hasNext
())
{
BranchCompanyVehicleCount
newValue
=
iterator
.
next
();
BranchCompanyVehicleCount
oldValue
=
selectOne
(
newValue
);
if
(
oldValue
!=
null
)
{
iterator
.
remove
();
}
}
insertMultiSelective
(
branchCompanyVehicleCounts
);
return
ObjectRestResponse
.
succ
();
}
public
ObjectRestResponse
<
PageDataVO
<
BranchCompanyVehicleCount
>>
findAll
(
BranchCompanyVehicleCountDTO
branchCompanyVehicleCountDTO
)
{
Integer
pageNo
=
branchCompanyVehicleCountDTO
.
getPage
()
==
null
?
1
:
branchCompanyVehicleCountDTO
.
getPage
();
Integer
pageSize
=
branchCompanyVehicleCountDTO
.
getLimit
()
==
null
?
10
:
branchCompanyVehicleCountDTO
.
getLimit
();
branchCompanyVehicleCountDTO
.
setPage
(
pageNo
);
branchCompanyVehicleCountDTO
.
setLimit
(
pageSize
);
Query
query
=
new
Query
(
branchCompanyVehicleCountDTO
);
PageDataVO
<
BranchCompanyVehicleCount
>
pageDataVO
=
PageDataVO
.
pageInfo
(
query
,
()
->
mapper
.
getAllByParam
(
query
.
getSuper
()));
return
ObjectRestResponse
.
succ
(
pageDataVO
);
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
View file @
5deb634e
...
...
@@ -1514,7 +1514,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
return
vehicles
.
stream
().
map
(
Vehicle:
:
getId
).
collect
(
Collectors
.
toList
());
}
public
List
<
BranchCompanyVehicleCount
>
getAllVehicleInfo
()
{
public
List
<
BranchCompanyVehicleCount
Vo
>
getAllVehicleInfo
()
{
return
mapper
.
getAllVehicleInfo
();
}
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleInformationDownloadBiz.java
View file @
5deb634e
...
...
@@ -4,9 +4,10 @@ import com.alibaba.fastjson.JSON;
import
com.github.wxiaoqi.security.admin.feign.dto.UserDTO
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.google.common.collect.Lists
;
import
com.xxfc.platform.vehicle.entity.BranchCompanyVehicleCount
;
import
com.xxfc.platform.vehicle.entity.Vehicle
;
import
com.xxfc.platform.vehicle.mapper.VehicleMapper
;
import
com.xxfc.platform.vehicle.pojo.BranchCompanyVehicleCount
;
import
com.xxfc.platform.vehicle.pojo.BranchCompanyVehicleCount
Vo
;
import
com.xxfc.platform.vehicle.pojo.ResultVehicleVo
;
import
com.xxfc.platform.vehicle.pojo.VehicleExcelVo
;
import
com.xxfc.platform.vehicle.pojo.VehiclePageQueryVo
;
...
...
@@ -14,7 +15,11 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.beanutils.BeanUtilsBean
;
import
org.apache.commons.beanutils.PropertyUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.joda.time.DateTime
;
import
org.joda.time.format.DateTimeFormat
;
import
org.joda.time.format.DateTimeFormatter
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
...
...
@@ -29,7 +34,10 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
@Autowired
private
VehicleBiz
vehicleBiz
;
@Autowired
private
BranchCompanyVehicleCountBiz
branchCompanyVehicleCountBiz
;
public
static
final
DateTimeFormatter
DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd"
);
public
List
getByPageNotAllData
(
VehiclePageQueryVo
vehiclePageQueryVo
,
List
<
Integer
>
companyList
)
throws
Exception
{
...
...
@@ -94,8 +102,30 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
}
public
List
<
BranchCompanyVehicleCount
>
getAllVehicleInfo
()
{
public
List
<
BranchCompanyVehicleCount
Vo
>
getAllVehicleInfo
()
{
return
vehicleBiz
.
getAllVehicleInfo
();
}
@Scheduled
(
cron
=
"0 0 */2 * * *"
)
public
void
add
()
{
ArrayList
<
BranchCompanyVehicleCount
>
arrayList
=
Lists
.
newArrayList
();
List
<
BranchCompanyVehicleCountVo
>
branchCompanyVehicleCountVos
=
vehicleBiz
.
getAllVehicleInfo
();
branchCompanyVehicleCountVos
.
parallelStream
().
forEach
(
result
->{
try
{
BranchCompanyVehicleCount
branchCompanyVehicleCount
=
new
BranchCompanyVehicleCount
();
branchCompanyVehicleCount
.
setCompanyId
(
result
.
getCompanyId
());
branchCompanyVehicleCount
.
setCompanyName
(
result
.
getParkBranchCompanyName
());
branchCompanyVehicleCount
.
setVehicleNum
(
result
.
getCount
());
DateTime
dateTime
=
DateTime
.
now
();
String
dateStr
=
dateTime
.
toString
(
DATE_TIME_FORMATTER
);
branchCompanyVehicleCount
.
setCountDate
(
DateTime
.
parse
(
dateStr
).
toDate
());
arrayList
.
add
(
branchCompanyVehicleCount
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
}
});
branchCompanyVehicleCountBiz
.
add
(
arrayList
);
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/mapper/BranchCompanyVehicleCountMapper.java
0 → 100644
View file @
5deb634e
package
com
.
xxfc
.
platform
.
vehicle
.
mapper
;
import
com.xxfc.platform.vehicle.entity.BranchCompanyVehicleCount
;
import
tk.mybatis.mapper.common.Mapper
;
import
java.util.List
;
import
java.util.Map
;
public
interface
BranchCompanyVehicleCountMapper
extends
Mapper
<
BranchCompanyVehicleCount
>
{
List
<
BranchCompanyVehicleCount
>
getAllByParam
(
Map
<
String
,
Object
>
param
);
}
\ No newline at end of file
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/mapper/VehicleMapper.java
View file @
5deb634e
...
...
@@ -54,5 +54,5 @@ public interface VehicleMapper extends Mapper<Vehicle> {
@Select
(
"select `id` from `vehicle` where `is_del`=0"
)
List
<
String
>
findExistVehicleIds
();
List
<
BranchCompanyVehicleCount
>
getAllVehicleInfo
();
List
<
BranchCompanyVehicleCount
Vo
>
getAllVehicleInfo
();
}
\ No newline at end of file
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/admin/BranchCompanyVehicleCountController.java
0 → 100644
View file @
5deb634e
package
com
.
xxfc
.
platform
.
vehicle
.
rest
.
admin
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.vehicle.biz.BranchCompanyVehicleCountBiz
;
import
com.xxfc.platform.vehicle.common.BaseController
;
import
com.xxfc.platform.vehicle.pojo.dto.BranchCompanyVehicleCountDTO
;
import
org.springframework.stereotype.Controller
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.ResponseBody
;
@Controller
@RequestMapping
(
value
=
"/bg-vehicle/count"
)
public
class
BranchCompanyVehicleCountController
extends
BaseController
<
BranchCompanyVehicleCountBiz
>
{
@GetMapping
(
value
=
"/getAll"
)
@ResponseBody
public
ObjectRestResponse
getAll
(
BranchCompanyVehicleCountDTO
branchCompanyVehicleCountDTO
)
{
return
baseBiz
.
findAll
(
branchCompanyVehicleCountDTO
);
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/admin/VehicleInformationDownloadController.java
View file @
5deb634e
...
...
@@ -7,11 +7,15 @@ import com.github.wxiaoqi.security.admin.feign.UserFeign;
import
com.github.wxiaoqi.security.admin.feign.dto.UserDTO
;
import
com.github.wxiaoqi.security.auth.client.config.UserAuthConfig
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.xxfc.platform.vehicle.biz.BranchCompanyVehicleCountBiz
;
import
com.xxfc.platform.vehicle.biz.VehicleBiz
;
import
com.xxfc.platform.vehicle.biz.VehicleInformationDownloadBiz
;
import
com.xxfc.platform.vehicle.common.BaseController
;
import
com.xxfc.platform.vehicle.
pojo
.BranchCompanyVehicleCount
;
import
com.xxfc.platform.vehicle.
entity
.BranchCompanyVehicleCount
;
import
com.xxfc.platform.vehicle.pojo.VehicleExcelVo
;
import
com.xxfc.platform.vehicle.pojo.dto.BranchCompanyVehicleCountDTO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -30,7 +34,7 @@ import java.util.List;
public
class
VehicleInformationDownloadController
extends
BaseController
<
VehicleInformationDownloadBiz
>
{
@Autowired
UserFeign
userFeign
;
private
UserFeign
userFeign
;
@Autowired
private
UserAuthConfig
userAuthConfig
;
...
...
@@ -39,7 +43,10 @@ public class VehicleInformationDownloadController extends BaseController<Vehicle
private
VehicleBiz
vehicleBiz
;
@Autowired
HttpServletResponse
response
;
private
BranchCompanyVehicleCountBiz
branchCompanyVehicleCountBiz
;
@Autowired
private
HttpServletResponse
response
;
@GetMapping
(
"/excel"
)
public
void
downloadExcel
(
@RequestParam
(
value
=
"vehiclePageQueryVoJson"
,
required
=
false
)
String
vehiclePageQueryVoJson
)
throws
Exception
{
...
...
@@ -70,11 +77,17 @@ public class VehicleInformationDownloadController extends BaseController<Vehicle
}
@GetMapping
(
"/app/unauth/export"
)
public
void
exportVehicleInfo
()
throws
Exception
{
List
<
BranchCompanyVehicleCount
>
rows
=
baseBiz
.
getAllVehicleInfo
();
public
void
exportVehicleInfo
(
BranchCompanyVehicleCountDTO
branchCompanyVehicleCountDTO
)
throws
Exception
{
PageDataVO
<
BranchCompanyVehicleCount
>
pageDataVO
=
branchCompanyVehicleCountBiz
.
findAll
(
branchCompanyVehicleCountDTO
).
getData
();
if
(
pageDataVO
==
null
||
pageDataVO
.
getData
()
==
null
)
{
throw
new
BaseException
(
ResultCode
.
getMsg
(
ResultCode
.
NOTEXIST_CODE
),
ResultCode
.
NOTEXIST_CODE
);
}
List
<
BranchCompanyVehicleCount
>
rows
=
pageDataVO
.
getData
();
ExcelWriter
writer
=
ExcelUtil
.
getWriter
(
true
);
writer
.
addHeaderAlias
(
"parkBranchCompanyName"
,
"停靠分公司"
);
writer
.
addHeaderAlias
(
"count"
,
"车辆数量"
);
writer
.
merge
(
2
,
"导出车辆数据"
);
writer
.
addHeaderAlias
(
"countDate"
,
"日期"
);
writer
.
addHeaderAlias
(
"companyName"
,
"停靠分公司"
);
writer
.
addHeaderAlias
(
"vehicleNum"
,
"车辆数量"
);
// 一次性写出内容,使用默认样式,强制输出标题
writer
.
write
(
rows
,
true
);
//response为HttpServletResponse对象
...
...
@@ -89,4 +102,5 @@ public class VehicleInformationDownloadController extends BaseController<Vehicle
//此处记得关闭输出Servlet流
IoUtil
.
close
(
out
);
}
}
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/BranchCompanyVehicleCountMapper.xml
0 → 100644
View file @
5deb634e
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.xxfc.platform.vehicle.mapper.BranchCompanyVehicleCountMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.xxfc.platform.vehicle.entity.BranchCompanyVehicleCount"
>
<!--
WARNING - @mbg.generated
-->
<id
column=
"id"
property=
"id"
jdbcType=
"BIGINT"
/>
<result
column=
"company_name"
property=
"companyName"
jdbcType=
"VARCHAR"
/>
<result
column=
"vehicle_num"
property=
"vehicleNum"
jdbcType=
"INTEGER"
/>
<result
column=
"count_date"
property=
"countDate"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"company_id"
property=
"companyId"
jdbcType=
"INTEGER"
/>
</resultMap>
<select
id=
"getAllByParam"
parameterType=
"Map"
resultType=
"com.xxfc.platform.vehicle.entity.BranchCompanyVehicleCount"
>
select * from branch_company_vehicle_count
<where>
<if
test=
"companyName != null and companyName != ''"
>
and company_name like concat('%', #{companyName}, '%')
</if>
<if
test=
"startTime != null and startTime != ''"
>
and count_date
>
#{startTime} and count_date
<
#{endTime}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleMapper.xml
View file @
5deb634e
...
...
@@ -591,10 +591,11 @@
</select>
<!--导出分公司停靠所有车辆-->
<select
id=
"getAllVehicleInfo"
resultType=
"com.xxfc.platform.vehicle.pojo.BranchCompanyVehicleCount"
>
<select
id=
"getAllVehicleInfo"
resultType=
"com.xxfc.platform.vehicle.pojo.BranchCompanyVehicleCount
Vo
"
>
SELECT
b1. NAME AS parkBranchCompanyName,
count(v1.id) as count
count(v1.id) as count,
b1.id as companyId
FROM
branch_company b1
LEFT JOIN vehicle v1 ON v1.park_branch_company_id = b1.id
...
...
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