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
3a272edc
Commit
3a272edc
authored
Nov 18, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master-vehicle-bg' into dev
parents
6b916523
c4bdf3dc
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
49 additions
and
8 deletions
+49
-8
ImportVehicleDataBiz.java
...a/com/xxfc/platform/vehicle/biz/ImportVehicleDataBiz.java
+2
-4
VehicleBiz.java
...c/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
+4
-0
VehicleInformationDownloadBiz.java
...c/platform/vehicle/biz/VehicleInformationDownloadBiz.java
+5
-0
VehicleMapper.java
.../java/com/xxfc/platform/vehicle/mapper/VehicleMapper.java
+2
-0
VehicleInformationDownloadController.java
...icle/rest/admin/VehicleInformationDownloadController.java
+30
-3
VehicleMapper.xml
...ehicle-server/src/main/resources/mapper/VehicleMapper.xml
+6
-1
No files found.
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/ImportVehicleDataBiz.java
View file @
3a272edc
package
com
.
xxfc
.
platform
.
vehicle
.
biz
;
package
com
.
xxfc
.
platform
.
vehicle
.
biz
;
import
cn.hutool.core.date.DateField
;
import
cn.hutool.core.date.DateTime
;
import
cn.hutool.core.date.DateTime
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.xxfc.platform.vehicle.entity.Constant
;
import
com.xxfc.platform.vehicle.entity.Constant
;
...
@@ -15,7 +14,6 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -15,7 +14,6 @@ import org.springframework.transaction.annotation.Transactional;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -138,8 +136,8 @@ public class ImportVehicleDataBiz extends BaseBiz<VehicleMapper, Vehicle> {
...
@@ -138,8 +136,8 @@ public class ImportVehicleDataBiz extends BaseBiz<VehicleMapper, Vehicle> {
}
}
}
}
System
.
out
.
println
(
"stringBuffer:"
+
stringBuffer
);
log
.
info
(
"stringBuffer:"
+
stringBuffer
);
System
.
out
.
println
(
"stringBuffer2:"
+
stringBuffer2
);
log
.
info
(
"stringBuffer2:"
+
stringBuffer2
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
());
log
.
error
(
e
.
getMessage
());
log
.
error
(
e
.
getMessage
(),
e
);
log
.
error
(
e
.
getMessage
(),
e
);
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
View file @
3a272edc
...
@@ -1516,4 +1516,8 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
...
@@ -1516,4 +1516,8 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
return
vehicles
.
stream
().
map
(
Vehicle:
:
getId
).
collect
(
Collectors
.
toList
());
return
vehicles
.
stream
().
map
(
Vehicle:
:
getId
).
collect
(
Collectors
.
toList
());
}
}
public
List
<
VehicleExcelVo
>
getAllVehicleInfo
()
{
return
mapper
.
getAllVehicleInfo
();
}
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleInformationDownloadBiz.java
View file @
3a272edc
...
@@ -92,4 +92,9 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
...
@@ -92,4 +92,9 @@ public class VehicleInformationDownloadBiz extends BaseBiz<VehicleMapper, Vehicl
return
arrayList
;
return
arrayList
;
}
}
public
List
<
VehicleExcelVo
>
getAllVehicleInfo
()
{
return
vehicleBiz
.
getAllVehicleInfo
();
}
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/mapper/VehicleMapper.java
View file @
3a272edc
...
@@ -53,4 +53,6 @@ public interface VehicleMapper extends Mapper<Vehicle> {
...
@@ -53,4 +53,6 @@ public interface VehicleMapper extends Mapper<Vehicle> {
@Select
(
"select `id` from `vehicle` where `is_del`=0"
)
@Select
(
"select `id` from `vehicle` where `is_del`=0"
)
List
<
String
>
findExistVehicleIds
();
List
<
String
>
findExistVehicleIds
();
List
<
VehicleExcelVo
>
getAllVehicleInfo
();
}
}
\ No newline at end of file
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/admin/VehicleInformationDownloadController.java
View file @
3a272edc
...
@@ -7,6 +7,7 @@ import com.github.wxiaoqi.security.admin.feign.UserFeign;
...
@@ -7,6 +7,7 @@ import com.github.wxiaoqi.security.admin.feign.UserFeign;
import
com.github.wxiaoqi.security.admin.feign.dto.UserDTO
;
import
com.github.wxiaoqi.security.admin.feign.dto.UserDTO
;
import
com.github.wxiaoqi.security.auth.client.config.UserAuthConfig
;
import
com.github.wxiaoqi.security.auth.client.config.UserAuthConfig
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.xxfc.platform.vehicle.biz.VehicleBiz
;
import
com.xxfc.platform.vehicle.biz.VehicleBiz
;
import
com.xxfc.platform.vehicle.biz.VehicleInformationDownloadBiz
;
import
com.xxfc.platform.vehicle.biz.VehicleInformationDownloadBiz
;
import
com.xxfc.platform.vehicle.common.BaseController
;
import
com.xxfc.platform.vehicle.common.BaseController
;
...
@@ -41,10 +42,10 @@ public class VehicleInformationDownloadController extends BaseController<Vehicle
...
@@ -41,10 +42,10 @@ public class VehicleInformationDownloadController extends BaseController<Vehicle
HttpServletResponse
response
;
HttpServletResponse
response
;
@GetMapping
(
"/excel"
)
@GetMapping
(
"/excel"
)
public
void
downloadExcel
(
@RequestParam
(
value
=
"vehiclePageQueryVoJson"
,
required
=
false
)
String
vehiclePageQueryVoJson
)
throws
Exception
{
public
void
downloadExcel
(
@RequestParam
(
value
=
"vehiclePageQueryVoJson"
,
required
=
false
)
String
vehiclePageQueryVoJson
)
throws
Exception
{
UserDTO
userDTO
=
userFeign
.
userinfoByToken
(
userAuthConfig
.
getToken
(
request
)).
getData
();
UserDTO
userDTO
=
userFeign
.
userinfoByToken
(
userAuthConfig
.
getToken
(
request
)).
getData
();
if
(
userDTO
==
null
)
{
if
(
userDTO
==
null
)
{
throw
new
BaseException
(
"token已失效"
);
throw
new
BaseException
(
"token已失效"
);
}
}
List
<
VehicleExcelVo
>
rows
=
baseBiz
.
getList
(
vehiclePageQueryVoJson
,
userDTO
);
List
<
VehicleExcelVo
>
rows
=
baseBiz
.
getList
(
vehiclePageQueryVoJson
,
userDTO
);
ExcelWriter
writer
=
ExcelUtil
.
getWriter
(
true
);
ExcelWriter
writer
=
ExcelUtil
.
getWriter
(
true
);
...
@@ -67,4 +68,30 @@ public class VehicleInformationDownloadController extends BaseController<Vehicle
...
@@ -67,4 +68,30 @@ public class VehicleInformationDownloadController extends BaseController<Vehicle
//此处记得关闭输出Servlet流
//此处记得关闭输出Servlet流
IoUtil
.
close
(
out
);
IoUtil
.
close
(
out
);
}
}
@GetMapping
(
"/import"
)
public
void
exportVehicleInfo
()
throws
Exception
{
UserDTO
userDTO
=
userFeign
.
userinfoByToken
(
userAuthConfig
.
getToken
(
request
)).
getData
();
if
(
userDTO
==
null
)
{
throw
new
BaseException
(
ResultCode
.
getMsg
(
ResultCode
.
RSTOKEN_EXPIRED_CODE
),
ResultCode
.
RSTOKEN_EXPIRED_CODE
);
}
List
<
VehicleExcelVo
>
rows
=
baseBiz
.
getAllVehicleInfo
();
ExcelWriter
writer
=
ExcelUtil
.
getWriter
(
true
);
writer
.
addHeaderAlias
(
"numberPlate"
,
"车牌号"
);
writer
.
addHeaderAlias
(
"code"
,
"车辆编码"
);
writer
.
addHeaderAlias
(
"parkBranchCompanyName"
,
"停靠分公司"
);
// 一次性写出内容,使用默认样式,强制输出标题
writer
.
write
(
rows
,
true
);
//response为HttpServletResponse对象
response
.
setContentType
(
"application/vnd.ms-excel;charset=utf-8"
);
//test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename=vehicleInfo.xlsx"
);
//out为OutputStream,需要写出到的目标流
ServletOutputStream
out
=
response
.
getOutputStream
();
writer
.
flush
(
out
,
true
);
// 关闭writer,释放内存
writer
.
close
();
//此处记得关闭输出Servlet流
IoUtil
.
close
(
out
);
}
}
}
xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleMapper.xml
View file @
3a272edc
...
@@ -590,7 +590,12 @@
...
@@ -590,7 +590,12 @@
) r ORDER BY r.parkBranchCompanyName
) r ORDER BY r.parkBranchCompanyName
</select>
</select>
<!--导出分公司停靠所有车辆-->
<select
id=
"getAllVehicleInfo"
resultType=
"com.xxfc.platform.vehicle.pojo.VehicleExcelVo"
>
select b1.name as parkBranchCompanyName, v1.number_plate as numberPlate, v1.code as code from branch_company b1
left join vehicle v1 on v1.park_branch_company_id on b1.id
where b1.is_del = 0 and v1.is_del = 0
</select>
<select
id=
"lockByCode"
resultType=
"com.xxfc.platform.vehicle.entity.Vehicle"
<select
id=
"lockByCode"
resultType=
"com.xxfc.platform.vehicle.entity.Vehicle"
parameterType=
"com.xxfc.platform.vehicle.pojo.AddOrUpdateVehicleVo"
>
parameterType=
"com.xxfc.platform.vehicle.pojo.AddOrUpdateVehicleVo"
>
...
...
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