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
db7c7d6c
Commit
db7c7d6c
authored
Oct 24, 2019
by
hanfeng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加车辆信息下载
parent
8c61cc63
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
272 additions
and
27 deletions
+272
-27
ResultVehicleVo.java
.../java/com/xxfc/platform/vehicle/pojo/ResultVehicleVo.java
+1
-1
VehicleExcelVo.java
...n/java/com/xxfc/platform/vehicle/pojo/VehicleExcelVo.java
+8
-4
VehicleInformationDownloadBiz.java
...c/platform/vehicle/biz/VehicleInformationDownloadBiz.java
+10
-7
VehicleMapper.java
.../java/com/xxfc/platform/vehicle/mapper/VehicleMapper.java
+4
-0
VehicleInformationDownloadController.java
...icle/rest/admin/VehicleInformationDownloadController.java
+6
-15
VehicleMapper.xml
...ehicle-server/src/main/resources/mapper/VehicleMapper.xml
+243
-0
No files found.
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/ResultVehicleVo.java
View file @
db7c7d6c
...
...
@@ -5,7 +5,7 @@ import lombok.Data;
import
java.util.Date
;
@Data
public
class
ResultVehicleVo
extends
VehicleExcelVo
{
public
class
ResultVehicleVo
{
/**
* 主键(uuid)
*/
...
...
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/pojo/VehicleExcelVo.java
View file @
db7c7d6c
...
...
@@ -2,9 +2,13 @@ package com.xxfc.platform.vehicle.pojo;
import
lombok.Data
;
import
java.util.HashMap
;
import
java.util.Map
;
@Data
public
class
VehicleExcelVo
{
/**
* 车牌号,空字符串-没有
*/
...
...
@@ -23,15 +27,15 @@ public class VehicleExcelVo {
/**
*
用途类型:租赁房车(1)、展车等,对应关系见车辆常量表
*
*/
private
Integer
useType
;
private
String
useType
;
/**
* 停靠分支机构(
id
)
* 停靠分支机构(
名
)
*/
private
Integer
parkBranchCompanyId
;
private
String
parkBranchCompanyName
;
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleInformationDownloadBiz.java
View file @
db7c7d6c
...
...
@@ -5,15 +5,19 @@ import com.github.pagehelper.PageHelper;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
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.Vehicle
;
import
com.xxfc.platform.vehicle.mapper.VehicleMapper
;
import
com.xxfc.platform.vehicle.pojo.ResultVehicleVo
;
import
com.xxfc.platform.vehicle.pojo.VehicleExcelVo
;
import
com.xxfc.platform.vehicle.pojo.VehiclePageQueryVo
;
import
org.apache.commons.beanutils.BeanUtilsBean
;
import
org.apache.commons.beanutils.PropertyUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.List
;
...
...
@@ -28,7 +32,7 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
public
List
getByPageNotAllData
(
VehiclePageQueryVo
vehiclePageQueryVo
,
List
<
Integer
>
companyList
)
throws
Exception
{
public
List
<
VehicleExcelVo
>
getByPageNotAllData
(
VehiclePageQueryVo
vehiclePageQueryVo
,
List
<
Integer
>
companyList
)
throws
Exception
{
Map
<
String
,
Object
>
params
=
PropertyUtils
.
describe
(
vehiclePageQueryVo
);
//处理预定日期相关参数
vehicleBiz
.
adjustBookedInfoParam
(
params
,
vehiclePageQueryVo
);
...
...
@@ -38,10 +42,10 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
params
.
put
(
"companyList"
,
Arrays
.
asList
(-
1
));
}
return
mapper
.
get
ByPage
NotAllData
(
params
);
return
mapper
.
get
VehicleExcelVo
NotAllData
(
params
);
}
public
List
getByPage
(
VehiclePageQueryVo
vehiclePageQueryVo
)
throws
Exception
{
public
List
<
VehicleExcelVo
>
getByPage
(
VehiclePageQueryVo
vehiclePageQueryVo
)
throws
Exception
{
Map
<
String
,
Object
>
params
=
PropertyUtils
.
describe
(
vehiclePageQueryVo
);
//处理预定日期相关参数
...
...
@@ -50,7 +54,7 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
if
(
vehiclePageQueryVo
.
getModelId
()
==
null
)
{
params
.
remove
(
"modelId"
);
}
return
mapper
.
get
ByPage
(
params
);
return
mapper
.
get
VehicleExcelVo
(
params
);
}
public
List
<
VehicleExcelVo
>
getList
(
String
vehiclePageQueryVoJson
,
UserDTO
userDTO
)
{
...
...
@@ -59,17 +63,16 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
if
(
StringUtils
.
isNotBlank
(
vehiclePageQueryVoJson
)){
vehiclePageQueryVo
=
JSON
.
parseObject
(
vehiclePageQueryVoJson
,
VehiclePageQueryVo
.
class
);
}
if
(
userDTO
!=
null
)
{
if
(
userDTO
.
getDataAll
()
==
2
)
{
List
<
Integer
>
companyList
=
vehicleBiz
.
dataCompany
(
userDTO
.
getDataZone
(),
userDTO
.
getDataCompany
());
return
getByPageNotAllData
(
vehiclePageQueryVo
,
companyList
);
}
}
return
getByPage
(
vehiclePageQueryVo
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
new
ArrayList
();
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/mapper/VehicleMapper.java
View file @
db7c7d6c
...
...
@@ -16,6 +16,10 @@ public interface VehicleMapper extends Mapper<Vehicle> {
public
List
<
ResultVehicleVo
>
getByPageNotAllData
(
Map
<
String
,
Object
>
params
);
List
<
VehicleExcelVo
>
getVehicleExcelVo
(
Map
<
String
,
Object
>
params
);
List
<
VehicleExcelVo
>
getVehicleExcelVoNotAllData
(
Map
<
String
,
Object
>
params
);
public
int
updateStatusById
(
Map
<
String
,
Object
>
params
);
/**
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/admin/VehicleInformationDownloadController.java
View file @
db7c7d6c
...
...
@@ -3,24 +3,15 @@ package com.xxfc.platform.vehicle.rest.admin;
import
cn.hutool.core.io.IoUtil
;
import
cn.hutool.poi.excel.ExcelUtil
;
import
cn.hutool.poi.excel.ExcelWriter
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONException
;
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.g
oogle.common.collect.Lists
;
import
com.g
ithub.wxiaoqi.security.common.exception.BaseException
;
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.common.CustomIllegalParamException
;
import
com.xxfc.platform.vehicle.common.RestResponse
;
import
com.xxfc.platform.vehicle.constant.ResCode.ResCode
;
import
com.xxfc.platform.vehicle.entity.Vehicle
;
import
com.xxfc.platform.vehicle.pojo.ResultVehicleVo
;
import
com.xxfc.platform.vehicle.pojo.VehicleExcelVo
;
import
com.xxfc.platform.vehicle.pojo.VehiclePageQueryVo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.beanutils.BeanUtilsBean
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
...
...
@@ -29,9 +20,6 @@ import org.springframework.web.bind.annotation.RestController;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.IOException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -53,15 +41,18 @@ public class VehicleInformationDownloadController extends BaseController<Vehicle
HttpServletResponse
response
;
@GetMapping
(
"/excel"
)
public
void
downloadExcel
(
@RequestParam
(
value
=
"vehiclePageQueryVoJson"
,
required
=
false
)
String
vehiclePageQueryVoJson
)
throws
IOException
,
InvocationTargetException
,
IllegalAccess
Exception
{
public
void
downloadExcel
(
@RequestParam
(
value
=
"vehiclePageQueryVoJson"
,
required
=
false
)
String
vehiclePageQueryVoJson
)
throws
Exception
{
UserDTO
userDTO
=
userFeign
.
userinfoByToken
(
userAuthConfig
.
getToken
(
request
)).
getData
();
if
(
userDTO
==
null
)
{
throw
new
BaseException
(
"token已失效"
);
}
List
<
VehicleExcelVo
>
rows
=
baseBiz
.
getList
(
vehiclePageQueryVoJson
,
userDTO
);
ExcelWriter
writer
=
ExcelUtil
.
getWriter
(
true
);
writer
.
addHeaderAlias
(
"numberPlate"
,
"车牌号"
);
writer
.
addHeaderAlias
(
"code"
,
"车辆编码"
);
writer
.
addHeaderAlias
(
"vehicleType"
,
"车型"
);
writer
.
addHeaderAlias
(
"useType"
,
"用途"
);
writer
.
addHeaderAlias
(
"parkBranchCompany
Id
"
,
"停靠分公司"
);
writer
.
addHeaderAlias
(
"parkBranchCompany
Name
"
,
"停靠分公司"
);
// 一次性写出内容,使用默认样式,强制输出标题
writer
.
write
(
rows
,
true
);
//response为HttpServletResponse对象
...
...
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleMapper.xml
View file @
db7c7d6c
This diff is collapsed.
Click to expand it.
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