Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
map-parent
Overview
Overview
Details
Activity
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
常超
map-parent
Commits
59cb21c4
Commit
59cb21c4
authored
Mar 03, 2022
by
Jiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
轨迹、点位查询列表接口,修改、新增采用图片,修改轨迹模板,解决导入bug
parent
86d36947
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
371 additions
and
76 deletions
+371
-76
service/publicapi/src/main/java/com/founder/publicapi/controller/ExcelController.java
+58
-13
service/publicapi/src/main/java/com/founder/publicapi/controller/SkPointlocationController.java
+71
-25
service/publicapi/src/main/java/com/founder/publicapi/controller/SkTrailController.java
+82
-30
service/publicapi/src/main/java/com/founder/publicapi/entity/SkPointlocation.java
+1
-1
service/publicapi/src/main/java/com/founder/publicapi/entity/SkTrail.java
+1
-1
service/publicapi/src/main/java/com/founder/publicapi/util/Base64Util.java
+23
-0
service/publicapi/src/main/java/com/founder/publicapi/util/ExcelUtil.java
+21
-4
service/publicapi/src/main/java/com/founder/publicapi/vo/param/SkPointlocationParam.java
+38
-1
service/publicapi/src/main/java/com/founder/publicapi/vo/param/SkTrailParam.java
+22
-1
service/publicapi/src/main/java/com/founder/publicapi/vo/response/SkTrailVO.java
+54
-0
service/publicapi/src/main/resources/excel/sk_trail.xlsx
+0
-0
No files found.
service/publicapi/src/main/java/com/founder/publicapi/controller/ExcelController.java
View file @
59cb21c4
...
...
@@ -8,6 +8,7 @@ import org.springframework.core.io.ClassPathResource;
import
org.springframework.core.io.Resource
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
sun.misc.BASE64Encoder
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletRequest
;
...
...
@@ -76,10 +77,39 @@ public class ExcelController {
* @author jlt
* @date 2022/3/2
*/
@GetMapping
(
"download"
)
// @GetMapping("download")
// @ResponseBody
// public void download(Integer type, HttpServletResponse response) {
// String fileName = "";
// switch (type) {
// case 1:
// fileName = "sk_trail.xlsx";
// break;//轨迹
// case 2:
// fileName = "sk_pointlocation.xlsx";
// break;//点位
// }
//
// if (StringUtils.isNotEmpty(fileName)) {//文件名不能为空
// try {
// FileUtil.downFile(response, fileName);
// System.out.println("下载文件:" + fileName + "----------------");
// } catch (Exception e) {
// e.printStackTrace();
// }
// } else {
// System.out.println("对应文件不存在");
// }
//
//
// }
@GetMapping
(
"/download"
)
@ResponseBody
public
void
download
(
Integer
type
,
HttpServletResponse
response
)
{
public
void
scheduleDownload
(
Integer
type
,
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
String
fileName
=
""
;
//1代表轨迹模板,2代表点位模板
switch
(
type
)
{
case
1
:
fileName
=
"sk_trail.xlsx"
;
...
...
@@ -88,19 +118,34 @@ public class ExcelController {
fileName
=
"sk_pointlocation.xlsx"
;
break
;
//点位
}
if
(
StringUtils
.
isNotEmpty
(
fileName
))
{
//文件名不能为空
try
{
FileUtil
.
downFile
(
response
,
fileName
);
System
.
out
.
println
(
"下载文件:"
+
fileName
+
"----------------"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
else
{
System
.
out
.
println
(
"对应文件不存在"
);
String
name
=
fileName
;
String
userAgent
=
request
.
getHeader
(
"User-Agent"
);
// name.getBytes("UTF-8")处理safari的乱码问题
byte
[]
bytes
=
userAgent
.
contains
(
"MSIE"
)
?
name
.
getBytes
()
:
name
.
getBytes
(
"UTF-8"
);
// 各浏览器基本都支持ISO编码
name
=
new
String
(
bytes
,
"ISO-8859-1"
);
// 文件名外的双引号处理firefox的空格截断问题
// codes..
response
.
setCharacterEncoding
(
"UTF-8"
);
//设置Content-Disposition
response
.
setHeader
(
"Content-disposition"
,
String
.
format
(
"attachment; filename=\"%s\""
,
name
));
//读取目标文件,通过response将目标文件写到客户端
//获取目标文件的绝对路径;
ClassPathResource
resource
=
new
ClassPathResource
(
"/excel/"
+
fileName
);
//String fullFileName = request.getSession().getServletContext().getRealPath("/") + "/download/yhsc.docx";
//读取文件
InputStream
in
=
resource
.
getInputStream
();
OutputStream
out
=
response
.
getOutputStream
();
byte
[]
buffer
=
new
byte
[
1024
];
int
len
;
//循环取出流中的数据
while
((
len
=
in
.
read
(
buffer
))
!=
-
1
){
out
.
write
(
buffer
,
0
,
len
);
}
in
.
close
();
out
.
close
();
}
...
...
service/publicapi/src/main/java/com/founder/publicapi/controller/SkPointlocationController.java
View file @
59cb21c4
...
...
@@ -14,7 +14,9 @@ import com.founder.publicapi.vo.param.SkTrailParam;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -25,7 +27,7 @@ import java.util.List;
*/
@RestController
@RequestMapping
(
"pointlocation"
)
public
class
SkPointlocationController
extends
ApiController
implements
ExcelControllerInterface
{
public
class
SkPointlocationController
extends
ApiController
implements
ExcelControllerInterface
{
/**
* 服务对象
*/
...
...
@@ -36,11 +38,11 @@ public class SkPointlocationController extends ApiController implements ExcelCon
* 新增点位
*/
@PostMapping
(
"save"
)
public
MapRestResult
save
(
@RequestBody
SkPointlocation
skPointlocation
)
{
public
MapRestResult
save
(
SkPointlocation
skPointlocation
)
{
boolean
save
=
skPointlocationService
.
save
(
skPointlocation
);
if
(
save
){
if
(
save
)
{
return
new
MapRestResult
();
}
else
{
}
else
{
return
new
MapRestResult
().
error
(
"保存失败"
);
}
}
...
...
@@ -49,11 +51,11 @@ public class SkPointlocationController extends ApiController implements ExcelCon
* 修改点位
*/
@PostMapping
(
"update"
)
public
MapRestResult
update
(
@RequestBody
SkPointlocation
skPointlocation
)
{
public
MapRestResult
update
(
SkPointlocation
skPointlocation
)
{
boolean
update
=
skPointlocationService
.
updateById
(
skPointlocation
);
if
(
update
){
if
(
update
)
{
return
new
MapRestResult
();
}
else
{
}
else
{
return
new
MapRestResult
().
error
(
"更新失败"
);
}
}
...
...
@@ -62,15 +64,15 @@ public class SkPointlocationController extends ApiController implements ExcelCon
* 删除点位
*/
@PostMapping
(
"remove"
)
public
MapRestResult
deleteById
(
Integer
xxzjbh
){
SkPointlocation
skPointlocation
=
new
SkPointlocation
();
public
MapRestResult
deleteById
(
Integer
xxzjbh
)
{
SkPointlocation
skPointlocation
=
new
SkPointlocation
();
skPointlocation
.
setXxzjbh
(
xxzjbh
);
skPointlocation
.
setIsDeleted
(
1
);
boolean
update
=
skPointlocationService
.
updateById
(
skPointlocation
);
if
(
update
){
if
(
update
)
{
return
new
MapRestResult
();
}
else
{
}
else
{
return
new
MapRestResult
().
error
(
"更新失败"
);
}
}
...
...
@@ -79,11 +81,11 @@ public class SkPointlocationController extends ApiController implements ExcelCon
* 查询详情
*/
@PostMapping
(
"detail"
)
public
MapRestResult
detail
(
Integer
xxzjbh
){
public
MapRestResult
detail
(
Integer
xxzjbh
)
{
SkPointlocation
byId
=
skPointlocationService
.
getById
(
xxzjbh
);
if
(
byId
==
null
)
{
if
(
byId
==
null
)
{
return
new
MapRestResult
().
error
(
"不存在该数据"
);
}
else
{
}
else
{
return
new
MapRestResult
(
byId
);
}
}
...
...
@@ -92,15 +94,59 @@ public class SkPointlocationController extends ApiController implements ExcelCon
* 查询列表(分页)
*/
@PostMapping
(
"query"
)
public
MapRestResult
query
(
@RequestBody
SkPointlocationParam
skPointlocationParam
){
public
MapRestResult
query
(
@RequestBody
SkPointlocationParam
skPointlocationParam
)
{
//分页
Page
page
=
new
Page
(
skPointlocationParam
.
getPage
(),
skPointlocationParam
.
getLimit
());
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
queryWrapper
.
eq
(
"is_deleted"
,
0
);
Page
page
=
new
Page
(
skPointlocationParam
.
getPage
(),
skPointlocationParam
.
getPageSize
());
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
queryWrapper
.
eq
(
"is_deleted"
,
0
);
if
(
skPointlocationParam
.
getLikeField
()
!=
null
&&
!
skPointlocationParam
.
getLikeField
().
equals
(
""
))
{
queryWrapper
.
eq
(
"objectType"
,
skPointlocationParam
.
getLikeField
());
}
if
(
skPointlocationParam
.
getLikeValue
()
!=
null
&&
!
skPointlocationParam
.
getLikeValue
().
equals
(
""
))
{
queryWrapper
.
like
(
"name"
,
skPointlocationParam
.
getLikeValue
());
}
//纬度
if
(
skPointlocationParam
.
getStartLat
()
!=
null
&&
!
skPointlocationParam
.
getStartLat
().
equals
(
""
))
{
queryWrapper
.
ge
(
"CAST(y AS decimal(9,8))"
,
Double
.
parseDouble
(
skPointlocationParam
.
getStartLat
()));
}
if
(
skPointlocationParam
.
getEndLat
()
!=
null
&&
!
skPointlocationParam
.
getEndLat
().
equals
(
""
))
{
queryWrapper
.
le
(
"CAST(y AS decimal(9,8))"
,
Double
.
parseDouble
(
skPointlocationParam
.
getEndLat
()));
}
//经度
if
(
skPointlocationParam
.
getStartLng
()
!=
null
&&
!
skPointlocationParam
.
getStartLng
().
equals
(
""
))
{
queryWrapper
.
ge
(
"CAST(x AS decimal(9,8))"
,
Double
.
parseDouble
(
skPointlocationParam
.
getStartLng
()));
}
if
(
skPointlocationParam
.
getEndLng
()
!=
null
&&
!
skPointlocationParam
.
getEndLng
().
equals
(
""
))
{
queryWrapper
.
le
(
"CAST(x AS decimal(9,8))"
,
Double
.
parseDouble
(
skPointlocationParam
.
getEndLng
()));
}
//时间
if
(
skPointlocationParam
.
getKssj
()
!=
null
)
{
queryWrapper
.
ge
(
"str_to_date(date,'%Y-%m-%d %H:%i:%s')"
,
skPointlocationParam
.
getKssj
()
);
}
if
(
skPointlocationParam
.
getJssj
()
!=
null
)
{
queryWrapper
.
le
(
"str_to_date(date,'%Y-%m-%d %H:%i:%s')"
,
skPointlocationParam
.
getJssj
()
);
}
IPage
page1
=
skPointlocationService
.
page
(
page
,
queryWrapper
);
return
new
MapRestResult
(
200
,
"OK"
,
page1
.
getTotal
(),
page1
.
getRecords
());
return
new
MapRestResult
(
200
,
"OK"
,
page1
.
getTotal
(),
page1
.
getRecords
());
}
/**
* 按照标识号查询对应点
*/
public
List
<
SkPointlocation
>
findByBh
(
String
bh
){
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
queryWrapper
.
eq
(
"is_deleted"
,
0
);
//未删除
queryWrapper
.
eq
(
"bh"
,
bh
);
//编号
queryWrapper
.
orderByAsc
(
"str_to_date(date,'%Y-%m-%d %H:%i:%s')"
);
return
skPointlocationService
.
list
(
queryWrapper
);
}
...
...
@@ -114,18 +160,18 @@ public class SkPointlocationController extends ApiController implements ExcelCon
@Override
public
String
saveBatch
(
List
<
Object
>
objs
)
{
List
<
SkPointlocation
>
list
=
new
ArrayList
<>();
List
<
SkPointlocation
>
list
=
new
ArrayList
<>();
try
{
for
(
Object
obj
:
objs
)
{
list
.
add
((
SkPointlocation
)
obj
);
for
(
Object
obj
:
objs
)
{
list
.
add
((
SkPointlocation
)
obj
);
}
boolean
flag
=
skPointlocationService
.
saveBatch
(
list
);
if
(
flag
){
if
(
flag
)
{
return
"插入成功"
;
}
else
{
}
else
{
return
"插入失败"
;
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
"转化格式错误"
;
}
...
...
service/publicapi/src/main/java/com/founder/publicapi/controller/SkTrailController.java
View file @
59cb21c4
package
com
.
founder
.
publicapi
.
controller
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.api.ApiController
;
...
...
@@ -9,11 +8,15 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
com.founder.commonutils.publicEntity.MapRestResult
;
import
com.founder.publicapi.entity.SkTrail
;
import
com.founder.publicapi.service.SkTrailService
;
import
com.founder.publicapi.util.Base64Util
;
import
com.founder.publicapi.util.SpringUtil
;
import
com.founder.publicapi.vo.param.SkTrailParam
;
import
com.founder.publicapi.vo.response.SkTrailVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
...
...
@@ -25,33 +28,59 @@ import java.util.List;
*/
@RestController
@RequestMapping
(
"trail"
)
public
class
SkTrailController
extends
ApiController
implements
ExcelControllerInterface
{
public
class
SkTrailController
extends
ApiController
implements
ExcelControllerInterface
{
@Autowired
private
SkTrailService
skTrailService
;
@Autowired
private
SkPointlocationController
skPointlocationController
;
/**
* 新增轨迹
*/
*/
@PostMapping
(
"save"
)
public
MapRestResult
save
(
@RequestBody
SkTrail
skTrail
){
public
MapRestResult
save
(
SkTrail
skTrail
,
@RequestParam
(
"farimg"
)
MultipartFile
farimg
,
@RequestParam
(
"nearimg"
)
MultipartFile
nearimg
)
throws
IOException
{
if
(
farimg
!=
null
)
{
String
far
=
Base64Util
.
getBase64
(
farimg
);
skTrail
.
setFarimglist
(
far
);
}
if
(
nearimg
!=
null
)
{
String
near
=
Base64Util
.
getBase64
(
nearimg
);
skTrail
.
setNearimglist
(
near
);
}
boolean
save
=
skTrailService
.
save
(
skTrail
);
if
(
save
){
if
(
save
)
{
return
new
MapRestResult
();
}
else
{
}
else
{
return
new
MapRestResult
().
error
(
"保存失败"
);
}
}
/**
* 修改轨迹
*/
*/
@PostMapping
(
"update"
)
public
MapRestResult
update
(
@RequestBody
SkTrail
skTrail
){
public
MapRestResult
update
(
SkTrail
skTrail
,
@RequestParam
(
"farimg"
)
MultipartFile
farimg
,
@RequestParam
(
"nearimg"
)
MultipartFile
nearimg
)
throws
IOException
{
if
(
farimg
!=
null
)
{
String
far
=
Base64Util
.
getBase64
(
farimg
);
skTrail
.
setFarimglist
(
far
);
}
if
(
nearimg
!=
null
)
{
String
near
=
Base64Util
.
getBase64
(
nearimg
);
skTrail
.
setNearimglist
(
near
);
}
boolean
update
=
skTrailService
.
updateById
(
skTrail
);
if
(
update
){
if
(
update
)
{
return
new
MapRestResult
();
}
else
{
}
else
{
return
new
MapRestResult
().
error
(
"更新失败"
);
}
}
...
...
@@ -60,44 +89,67 @@ public class SkTrailController extends ApiController implements ExcelControllerI
* 删除轨迹
*/
@PostMapping
(
"remove"
)
public
MapRestResult
deleteById
(
Integer
xxzjbh
){
SkTrail
skTrail
=
new
SkTrail
();
public
MapRestResult
deleteById
(
Integer
xxzjbh
)
{
SkTrail
skTrail
=
new
SkTrail
();
skTrail
.
setXxzjbh
(
xxzjbh
);
skTrail
.
setIsDeleted
(
1
);
boolean
update
=
skTrailService
.
updateById
(
skTrail
);
if
(
update
){
if
(
update
)
{
return
new
MapRestResult
();
}
else
{
}
else
{
return
new
MapRestResult
().
error
(
"更新失败"
);
}
}
/**
* 查询详情
*/
*/
@PostMapping
(
"detail"
)
public
MapRestResult
detail
(
Integer
xxzjbh
){
public
MapRestResult
detail
(
Integer
xxzjbh
)
{
SkTrail
byId
=
skTrailService
.
getById
(
xxzjbh
);
if
(
byId
==
null
)
{
if
(
byId
==
null
)
{
return
new
MapRestResult
().
error
(
"不存在该数据"
);
}
else
{
}
else
{
return
new
MapRestResult
(
byId
);
}
}
/**
* 查询列表(分页)
*/
*/
@PostMapping
(
"query"
)
public
MapRestResult
query
(
@RequestBody
SkTrailParam
sktrailParam
){
public
MapRestResult
query
(
@RequestBody
SkTrailParam
sktrailParam
)
{
//分页
Page
page
=
new
Page
(
sktrailParam
.
getPage
(),
sktrailParam
.
getLimit
());
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
queryWrapper
.
eq
(
"is_deleted"
,
0
);
Page
page
=
new
Page
(
sktrailParam
.
getPage
(),
sktrailParam
.
getPageSize
());
QueryWrapper
queryWrapper
=
new
QueryWrapper
();
queryWrapper
.
eq
(
"is_deleted"
,
0
);
if
(
sktrailParam
.
getLikeField
()
!=
null
&&
!
sktrailParam
.
getLikeField
().
equals
(
""
))
{
queryWrapper
.
eq
(
"objectType"
,
sktrailParam
.
getLikeField
());
}
if
(
sktrailParam
.
getLikeValue
()
!=
null
&&
!
sktrailParam
.
getLikeValue
().
equals
(
""
))
{
queryWrapper
.
like
(
"objectValue"
,
sktrailParam
.
getLikeValue
());
}
//时间
if
(
sktrailParam
.
getKssj
()
!=
null
)
{
queryWrapper
.
ge
(
"str_to_date(date,'%Y-%m-%d %H:%i:%s')"
,
sktrailParam
.
getKssj
()
);
}
if
(
sktrailParam
.
getJssj
()
!=
null
)
{
queryWrapper
.
le
(
"str_to_date(date,'%Y-%m-%d %H:%i:%s')"
,
sktrailParam
.
getJssj
()
);
}
IPage
page1
=
skTrailService
.
page
(
page
,
queryWrapper
);
return
new
MapRestResult
(
200
,
"OK"
,
page1
.
getTotal
(),
page1
.
getRecords
());
List
<
SkTrail
>
records
=
page1
.
getRecords
();
List
<
SkTrailVO
>
list
=
new
ArrayList
<>();
for
(
SkTrail
skTrail:
records
)
{
list
.
add
(
new
SkTrailVO
(
skTrail
,
skPointlocationController
.
findByBh
(
skTrail
.
getObjectvalue
())));
}
return
new
MapRestResult
(
200
,
"OK"
,
page1
.
getTotal
(),
list
);
}
...
...
@@ -112,18 +164,18 @@ public class SkTrailController extends ApiController implements ExcelControllerI
@Override
public
String
saveBatch
(
List
<
Object
>
objs
)
{
List
<
SkTrail
>
list
=
new
ArrayList
<>();
List
<
SkTrail
>
list
=
new
ArrayList
<>();
try
{
for
(
Object
obj
:
objs
)
{
list
.
add
((
SkTrail
)
obj
);
for
(
Object
obj
:
objs
)
{
list
.
add
((
SkTrail
)
obj
);
}
boolean
flag
=
skTrailService
.
saveBatch
(
list
);
if
(
flag
){
if
(
flag
)
{
return
"插入成功"
;
}
else
{
}
else
{
return
"插入失败"
;
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
"转化格式错误"
;
}
...
...
service/publicapi/src/main/java/com/founder/publicapi/entity/SkPointlocation.java
View file @
59cb21c4
...
...
@@ -26,7 +26,7 @@ public class SkPointlocation extends Model<SkPointlocation> {
*/
private
Integer
xxzjbh
;
/**
*
编号
*
标识号,对应轨迹表的号码
*/
private
String
bh
;
/**
...
...
service/publicapi/src/main/java/com/founder/publicapi/entity/SkTrail.java
View file @
59cb21c4
...
...
@@ -24,7 +24,7 @@ public class SkTrail extends Model<SkTrail> {
*/
private
Integer
xxzjbh
;
/**
*
车牌号
*
号码
*/
private
String
objectvalue
;
/**
...
...
service/publicapi/src/main/java/com/founder/publicapi/util/Base64Util.java
0 → 100644
View file @
59cb21c4
package
com
.
founder
.
publicapi
.
util
;
import
org.springframework.web.multipart.MultipartFile
;
import
sun.misc.BASE64Encoder
;
import
java.io.IOException
;
/**
* base64工具类
* @author jlt
* @date 2022/03/03/
*/
public
class
Base64Util
{
/**
* 图片转成base64字符串
*/
public
static
String
getBase64
(
MultipartFile
imageFile
)
throws
IOException
{
BASE64Encoder
base64Encoder
=
new
BASE64Encoder
();
String
base64EncoderImg
=
base64Encoder
.
encode
(
imageFile
.
getBytes
());
return
base64EncoderImg
;
}
}
service/publicapi/src/main/java/com/founder/publicapi/util/ExcelUtil.java
View file @
59cb21c4
...
...
@@ -78,7 +78,8 @@ public class ExcelUtil {
Field
[]
fields
=
o
.
getClass
().
getDeclaredFields
();
int
coloumNum
=
sheet
.
getRow
(
0
).
getPhysicalNumberOfCells
();
//获得总列数
if
(
coloumNum
!=
fields
.
length
-
1
)
{
//添加列数检验,没主键
int
exportNum
=
getExportNum
(
fields
);
if
(
coloumNum
!=
fields
.
length
-
exportNum
)
{
//添加列数检验,没主键,和判断标识
map
.
put
(
"success"
,
false
);
map
.
put
(
"error"
,
"列数不正确,请按照模板格式填写"
);
return
map
;
...
...
@@ -88,7 +89,7 @@ public class ExcelUtil {
// if (fields[0].getType().isInstance(1)) {//整形主键(使用自增)
// fields[0].set(o, (int) (1 + Math.random() * 10000));
// } else {//字符串主键
if
(
fields
[
0
].
getType
().
isInstance
(
""
)){
if
(
fields
[
0
].
getType
().
isInstance
(
""
))
{
fields
[
0
].
set
(
o
,
KeyUtil
.
getUniqueKey
(
"A"
));
}
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
...
...
@@ -193,6 +194,18 @@ public class ExcelUtil {
return
map
;
}
private
static
int
getExportNum
(
Field
[]
fields
)
{
//首先去除主键
int
num
=
1
;
for
(
Field
field:
fields
)
{
if
(
field
.
getName
().
equals
(
"isDeleted"
)){
num
++;
}
}
return
num
;
}
/**
* 读取数据并插入(xls)
...
...
@@ -387,7 +400,11 @@ public class ExcelUtil {
public
static
String
getClassName
(
String
name
)
{
String
className
=
""
;
//去除后缀
name
=
name
.
substring
(
0
,
name
.
lastIndexOf
(
"."
));
if
(
name
.
contains
(
"("
)
||
name
.
contains
(
"("
))
{
//如tb_st_sjgj(1).xls的文件
name
=
name
.
substring
(
0
,
name
.
lastIndexOf
(
"("
));
}
else
{
name
=
name
.
substring
(
0
,
name
.
lastIndexOf
(
"."
));
}
char
[]
chars
=
name
.
toCharArray
();
for
(
int
i
=
0
;
i
<
chars
.
length
;
i
++)
{
if
(
i
==
0
)
{
...
...
@@ -406,7 +423,7 @@ public class ExcelUtil {
}
className
=
new
String
(
chars
);
return
className
.
replace
(
"_"
,
""
);
return
className
.
replace
(
"_"
,
""
)
.
trim
()
;
}
}
service/publicapi/src/main/java/com/founder/publicapi/vo/param/SkPointlocationParam.java
View file @
59cb21c4
package
com
.
founder
.
publicapi
.
vo
.
param
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
/**
* 点位传参类
...
...
@@ -10,11 +13,45 @@ import lombok.Data;
@Data
public
class
SkPointlocationParam
{
/**
* 请求类型
*/
private
String
likeField
;
/**
* 名称
*/
private
String
likeValue
;
/**
* 开始时间
*/
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
kssj
;
/**
* 结束时间
*/
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
jssj
;
/**
* 结束纬度
*/
private
String
endLat
;
/**
* 结束经度
*/
private
String
endLng
;
/**
* 开始纬度
*/
private
String
startLat
;
/**
* 开始经度
*/
private
String
startLng
;
/**
* 行数
*/
private
Integer
page
;
/**
* 列数
*/
private
Integer
limit
;
private
Integer
pageSize
;
}
service/publicapi/src/main/java/com/founder/publicapi/vo/param/SkTrailParam.java
View file @
59cb21c4
package
com
.
founder
.
publicapi
.
vo
.
param
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
/**
* 轨迹传参类
...
...
@@ -10,11 +13,29 @@ import lombok.Data;
@Data
public
class
SkTrailParam
{
/**
* 请求类型
*/
private
String
likeField
;
/**
* 号码
*/
private
String
likeValue
;
/**
* 开始时间
*/
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
kssj
;
/**
* 结束时间
*/
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
jssj
;
/**
* 行数
*/
private
Integer
page
;
/**
* 列数
*/
private
Integer
limit
;
private
Integer
pageSize
;
}
service/publicapi/src/main/java/com/founder/publicapi/vo/response/SkTrailVO.java
0 → 100644
View file @
59cb21c4
package
com
.
founder
.
publicapi
.
vo
.
response
;
import
com.founder.publicapi.entity.SkPointlocation
;
import
com.founder.publicapi.entity.SkTrail
;
import
lombok.Data
;
import
org.springframework.beans.BeanUtils
;
import
java.util.List
;
/**
* 轨迹返回值
* @author jlt
* @date 2022/03/03/
*/
@Data
public
class
SkTrailVO
{
/**
*号码
*/
private
String
objectvalue
;
/**
*名字
*/
private
String
name
;
/**
*类型 网吧轨迹wbgj 旅店ldgj 火车hcgj 机场jcgj 基站jzgj 卡口kkgj 视频spgj
*/
private
String
objecttype
;
/**
* 开始时间
*/
private
String
kssj
;
/**
* 结束时间
*/
private
String
jssj
;
/**
* 对应点位
*/
private
List
<
SkPointlocation
>
points
;
public
SkTrailVO
(){}
public
SkTrailVO
(
SkTrail
skTrail
,
List
<
SkPointlocation
>
groupByBh
)
{
BeanUtils
.
copyProperties
(
skTrail
,
this
);
if
(
groupByBh
!=
null
&&
groupByBh
.
size
()!=
0
){
name
=
groupByBh
.
get
(
0
).
getName
();
kssj
=
groupByBh
.
get
(
0
).
getDate
();
//以时间升序
jssj
=
groupByBh
.
get
(
groupByBh
.
size
()-
1
).
getDate
();
}
points
=
groupByBh
;
}
}
service/publicapi/src/main/resources/excel/sk_trail.xlsx
View file @
59cb21c4
No preview for this file type
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