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
4a683c28
Commit
4a683c28
authored
Jul 11, 2021
by
Jbb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
图层数据上传功能完善
parent
d0cffb90
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
195 additions
and
65 deletions
+195
-65
common/common_utils/src/main/java/com/founder/commonutils/viewEntity/TbStLayer.java
+31
-0
common/common_utils/src/main/java/com/founder/commonutils/viewEntity/TbStLayerData.java
+19
-1
service/view/src/main/java/com/founder/view/config/MybatisBaseDbConfig.java
+4
-4
service/view/src/main/java/com/founder/view/config/MybatisQgDbConfig.java
+4
-4
service/view/src/main/java/com/founder/view/controller/TbStLayerDataController.java
+86
-52
service/view/src/main/java/com/founder/view/mapper/TbStLayerDataMapper.java
+2
-0
service/view/src/main/java/com/founder/view/mapper/TbStLayerMapper.java
+4
-3
service/view/src/main/java/com/founder/view/mapper/xml/TbStLayerDataMapper.xml
+3
-1
service/view/src/main/java/com/founder/view/mapper/xml/TbStLayerMapper.xml
+5
-0
service/view/src/main/java/com/founder/view/service/TbStLayerDataService.java
+2
-0
service/view/src/main/java/com/founder/view/service/TbStLayerService.java
+9
-0
service/view/src/main/java/com/founder/view/service/impl/TbStLayerDataServiceImpl.java
+8
-0
service/view/src/main/java/com/founder/view/service/impl/TbStLayerServiceImpl.java
+18
-0
No files found.
common/common_utils/src/main/java/com/founder/commonutils/viewEntity/TbStLayer.java
0 → 100644
View file @
4a683c28
package
com
.
founder
.
commonutils
.
viewEntity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModel
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
import
lombok.experimental.Accessors
;
import
java.util.Date
;
@Data
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@TableName
(
"tb_st_layer"
)
@ApiModel
(
value
=
"图层对象"
,
description
=
"图层信息数据"
)
public
class
TbStLayer
{
@TableId
(
value
=
"xxzjbh"
)
private
String
xxzjbh
;
private
String
name
;
private
Double
threshold
;
private
String
lrr
;
private
String
lrdwdm
;
private
String
lrdwdc
;
private
Date
lrsj
;
private
String
gxr
;
private
String
gxdwdm
;
private
String
gxdwdc
;
private
Date
gxsj
;
}
common/common_utils/src/main/java/com/founder/commonutils/viewEntity/TbStLayerData.java
View file @
4a683c28
...
@@ -10,13 +10,15 @@ import java.util.Date;
...
@@ -10,13 +10,15 @@ import java.util.Date;
@EqualsAndHashCode
(
callSuper
=
false
)
@EqualsAndHashCode
(
callSuper
=
false
)
@Accessors
(
chain
=
true
)
@Accessors
(
chain
=
true
)
@TableName
(
"
TB_ST_LAYER_DATA
"
)
@TableName
(
"
tb_st_layer_data
"
)
@ApiModel
(
value
=
"图层数据对象"
,
description
=
"图层数据"
)
@ApiModel
(
value
=
"图层数据对象"
,
description
=
"图层数据"
)
public
class
TbStLayerData
implements
Serializable
{
public
class
TbStLayerData
implements
Serializable
{
private
String
xxzjbh
;
private
String
xxzjbh
;
private
String
gl_xxzjbh
;
private
String
gl_xxzjbh
;
private
double
x
;
//经度
private
double
x
;
//经度
private
double
y
;
//纬度
private
double
y
;
//纬度
private
String
xStr
;
//保存错误的经度
private
String
yStr
;
//保存错误的纬度
private
String
title
;
//事故提示
private
String
title
;
//事故提示
private
Date
time
;
//事故时间
private
Date
time
;
//事故时间
...
@@ -52,6 +54,22 @@ public class TbStLayerData implements Serializable {
...
@@ -52,6 +54,22 @@ public class TbStLayerData implements Serializable {
this
.
y
=
y
;
this
.
y
=
y
;
}
}
public
String
getxStr
()
{
return
xStr
;
}
public
void
setxStr
(
String
xStr
)
{
this
.
xStr
=
xStr
;
}
public
String
getyStr
()
{
return
yStr
;
}
public
void
setyStr
(
String
yStr
)
{
this
.
yStr
=
yStr
;
}
public
String
getTitle
()
{
public
String
getTitle
()
{
return
title
;
return
title
;
}
}
...
...
service/view/src/main/java/com/founder/view/config/MybatisBaseDbConfig.java
View file @
4a683c28
...
@@ -16,12 +16,12 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
...
@@ -16,12 +16,12 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import
org.springframework.core.io.support.ResourcePatternResolver
;
import
org.springframework.core.io.support.ResourcePatternResolver
;
@Configuration
@Configuration
@MapperScan
(
basePackages
=
{
"com.founder.view.mapper"
},
/*
@MapperScan(basePackages = {"com.founder.view.mapper"},
sqlSessionTemplateRef
=
"xzxtSqlTemplate"
)
sqlSessionTemplateRef = "xzxtSqlTemplate")
*/
public
class
MybatisBaseDbConfig
{
public
class
MybatisBaseDbConfig
{
@Bean
(
name
=
"xzxtdbDatasource"
)
/*
@Bean(name = "xzxtdbDatasource")
@ConfigurationProperties(prefix = "spring.datasource.xzxtdb")
@ConfigurationProperties(prefix = "spring.datasource.xzxtdb")
public DruidDataSource druidXzxtdbDatasource()
public DruidDataSource druidXzxtdbDatasource()
{
{
...
@@ -51,5 +51,5 @@ public class MybatisBaseDbConfig {
...
@@ -51,5 +51,5 @@ public class MybatisBaseDbConfig {
SqlSessionFactory sqlSessionFactory)
SqlSessionFactory sqlSessionFactory)
{
{
return new SqlSessionTemplate(sqlSessionFactory);
return new SqlSessionTemplate(sqlSessionFactory);
}
}
*/
}
}
service/view/src/main/java/com/founder/view/config/MybatisQgDbConfig.java
View file @
4a683c28
...
@@ -15,11 +15,11 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
...
@@ -15,11 +15,11 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import
org.springframework.core.io.support.ResourcePatternResolver
;
import
org.springframework.core.io.support.ResourcePatternResolver
;
@Configuration
@Configuration
@MapperScan
(
basePackages
=
{
"com.founder.view.qgxzMapper"
},
/*
@MapperScan(basePackages = {"com.founder.view.qgxzMapper"},
sqlSessionTemplateRef
=
"qgSqlTemplate"
)
sqlSessionTemplateRef = "qgSqlTemplate")
*/
public
class
MybatisQgDbConfig
{
public
class
MybatisQgDbConfig
{
@Bean
(
name
=
"qgdbDatasource"
)
/*
@Bean(name = "qgdbDatasource")
@ConfigurationProperties(prefix = "spring.datasource.qgdb")
@ConfigurationProperties(prefix = "spring.datasource.qgdb")
public DruidDataSource druidQgdbDatasource()
public DruidDataSource druidQgdbDatasource()
{
{
...
@@ -43,5 +43,5 @@ public class MybatisQgDbConfig {
...
@@ -43,5 +43,5 @@ public class MybatisQgDbConfig {
SqlSessionFactory sqlSessionFactory)
SqlSessionFactory sqlSessionFactory)
{
{
return new SqlSessionTemplate(sqlSessionFactory);
return new SqlSessionTemplate(sqlSessionFactory);
}
}
*/
}
}
service/view/src/main/java/com/founder/view/controller/TbStLayerDataController.java
View file @
4a683c28
...
@@ -3,12 +3,12 @@ package com.founder.view.controller;
...
@@ -3,12 +3,12 @@ package com.founder.view.controller;
import
com.founder.commonutils.publicEntity.MapRestResult
;
import
com.founder.commonutils.publicEntity.MapRestResult
;
import
com.founder.commonutils.util.KeyUtil
;
import
com.founder.commonutils.util.KeyUtil
;
import
com.founder.commonutils.util.LngLonUtil
;
import
com.founder.commonutils.util.LngLonUtil
;
import
com.founder.commonutils.viewEntity.TbStLayer
;
import
com.founder.commonutils.viewEntity.TbStLayerData
;
import
com.founder.commonutils.viewEntity.TbStLayerData
;
import
com.founder.view.service.TbStLayerDataService
;
import
com.founder.view.service.TbStLayerDataService
;
import
com.founder.view.service.TbStLayerService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
org.apache.poi.hssf.usermodel.HSSFRow
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.hssf.usermodel.HSSFSheet
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.xssf.usermodel.XSSFRow
;
import
org.apache.poi.xssf.usermodel.XSSFRow
;
import
org.apache.poi.xssf.usermodel.XSSFSheet
;
import
org.apache.poi.xssf.usermodel.XSSFSheet
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
...
@@ -20,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -20,6 +20,7 @@ import org.springframework.web.multipart.MultipartFile;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.ServletOutputStream
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.FileInputStream
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.text.DateFormat
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
...
@@ -27,55 +28,76 @@ import java.util.ArrayList;
...
@@ -27,55 +28,76 @@ import java.util.ArrayList;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
@Api
(
description
=
"
经纬度
上传"
)
@Api
(
description
=
"
图层数据
上传"
)
@RestController
@RestController
@RequestMapping
(
"/
xy
"
)
@RequestMapping
(
"/
tbStLayerData
"
)
public
class
TbStLayerDataController
{
public
class
TbStLayerDataController
{
@Resource
@Resource
TbStLayerDataService
accidentPointService
;
TbStLayerDataService
accidentPointService
;
@Resource
TbStLayerService
tbStLayerService
;
@RequestMapping
(
"/uploadExcel"
)
@RequestMapping
(
"/uploadExcel"
)
public
MapRestResult
uploadDown
(
@RequestParam
(
"excelFile"
)
MultipartFile
excelFile
,
HttpServletResponse
response
)
{
public
MapRestResult
uploadDown
(
@RequestParam
(
"excelFile"
)
MultipartFile
excelFile
,
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
Double
threshold
,
@RequestParam
(
required
=
false
)
String
lrr
,
@RequestParam
(
required
=
false
)
String
lrdwdm
,
@RequestParam
(
required
=
false
)
String
lrdwdc
,
HttpServletResponse
response
)
{
TbStLayer
tbStLayer
=
new
TbStLayer
();
String
layerId
=
KeyUtil
.
getUUIDKey
(
"L"
);
try
{
try
{
tbStLayer
.
setXxzjbh
(
layerId
);
tbStLayer
.
setName
(
name
);
tbStLayer
.
setThreshold
(
threshold
);
tbStLayer
.
setLrr
(
lrr
);
tbStLayer
.
setLrdwdm
(
lrdwdm
);
tbStLayer
.
setLrdwdc
(
lrdwdc
);
tbStLayer
.
setLrsj
(
new
Date
());
tbStLayerService
.
save
(
tbStLayer
);
InputStream
is
=
excelFile
.
getInputStream
();
InputStream
is
=
excelFile
.
getInputStream
();
//InputStream is = new FileInputStream("C:\\Users\\JBB\\Desktop\\工作目录\\excel\\error (5).xlsx");
XSSFWorkbook
sheets
=
new
XSSFWorkbook
(
is
);
XSSFWorkbook
sheets
=
new
XSSFWorkbook
(
is
);
XSSFSheet
sheetAt
=
sheets
.
getSheetAt
(
0
);
XSSFSheet
sheetAt
=
sheets
.
getSheetAt
(
0
);
//获取excel有多少行
//获取excel有多少行
int
lastRowNum
=
sheetAt
.
getLastRowNum
();
int
lastRowNum
=
sheetAt
.
getLastRowNum
();
List
<
TbStLayerData
>
pointList
=
new
ArrayList
<>();
List
<
TbStLayerData
>
pointList
=
new
ArrayList
<>();
DateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
DateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
String
id
=
""
;
for
(
int
i
=
1
;
i
<=
lastRowNum
;
i
++)
{
for
(
int
i
=
1
;
i
<=
lastRowNum
;
i
++)
{
TbStLayerData
point
=
new
TbStLayerData
();
TbStLayerData
point
=
new
TbStLayerData
();
String
id
=
KeyUtil
.
getUUIDKey
(
"xy
"
);
id
=
KeyUtil
.
getUUIDKey
(
"D
"
);
point
.
setXxzjbh
(
id
);
point
.
setXxzjbh
(
id
);
point
.
setGl_xxzjbh
(
i
d
);
point
.
setGl_xxzjbh
(
layerI
d
);
XSSFRow
row
=
sheetAt
.
getRow
(
i
);
XSSFRow
row
=
sheetAt
.
getRow
(
i
);
//获取excel有多少列
//获取excel有多少列
short
lastCellNum
=
row
.
getLastCellNum
();
short
lastCellNum
=
row
.
getLastCellNum
();
//判断经纬度是否符合要求
//判断经纬度是否符合要求
//检车一下数据是否能正常读取.....
//检车一下数据是否能正常读取.....
这里忘记了 设置单元格格式了
/*double jd = 0.0;
/*double jd = 0.0;
double wd = 0.0;
double wd = 0.0;
String titleStr = "";
String titleStr = "";
String dateStr = "";
String dateStr = "";
if(row.getCell(0) != null && row.getCell(1) != null){
if(row.getCell(0) != null && row.getCell(1) != null){
jd =
row.getCell(0).getNumericCellValue(
);
jd =
Double.parseDouble(row.getCell(0).getStringCellValue()
);
wd =
row.getCell(1).getNumericCellValue(
);
wd =
Double.parseDouble(row.getCell(1).getStringCellValue()
);
titleStr = row.getCell(2).getStringCellValue();
titleStr = row.getCell(2).getStringCellValue();
dateStr = row.getCell(3).getStringCellValue();
dateStr = row.getCell(3).getStringCellValue();
System.out.println(jd + "====
======" + wd + "=========" + titleStr + "=====
====" + dateStr);
System.out.println(jd + "====
" + wd + "====" + titleStr + "
====" + dateStr);
}*/
}*/
row
.
getCell
(
0
).
setCellType
(
Cell
.
CELL_TYPE_STRING
);
row
.
getCell
(
1
).
setCellType
(
Cell
.
CELL_TYPE_STRING
);
row
.
getCell
(
2
).
setCellType
(
Cell
.
CELL_TYPE_STRING
);
row
.
getCell
(
3
).
setCellType
(
Cell
.
CELL_TYPE_STRING
);
try
{
try
{
//验证经纬度是否是八位小数以内
//验证经纬度是否是八位小数以内
boolean
isTrue
=
LngLonUtil
.
verifyLongAndLat
(
row
.
getCell
(
0
).
getNumericCellValue
(),
row
.
getCell
(
1
).
getNumericCellValue
(
));
boolean
isTrue
=
LngLonUtil
.
verifyLongAndLat
(
Double
.
parseDouble
(
row
.
getCell
(
0
).
getStringCellValue
()),
Double
.
parseDouble
(
row
.
getCell
(
1
).
getStringCellValue
()
));
if
(
isTrue
){
//这里可以不用for循环 因为excel列数比较少
if
(
isTrue
){
//这里可以不用for循环 因为excel列数比较少
for
(
int
j
=
0
;
j
<
lastCellNum
;
j
++)
{
for
(
int
j
=
0
;
j
<
lastCellNum
;
j
++)
{
if
(
j
==
0
){
if
(
j
==
0
){
double
x
=
row
.
getCell
(
0
).
getNumericCellValue
(
);
double
x
=
Double
.
parseDouble
(
row
.
getCell
(
0
).
getStringCellValue
()
);
point
.
setX
(
x
);
point
.
setX
(
x
);
}
}
if
(
j
==
1
){
if
(
j
==
1
){
double
y
=
row
.
getCell
(
1
).
getNumericCellValue
(
);
double
y
=
Double
.
parseDouble
(
row
.
getCell
(
1
).
getStringCellValue
()
);
point
.
setY
(
y
);
point
.
setY
(
y
);
}
}
if
(
j
==
2
){
if
(
j
==
2
){
...
@@ -93,13 +115,17 @@ public class TbStLayerDataController {
...
@@ -93,13 +115,17 @@ public class TbStLayerDataController {
//经度小数点后超过了八位
//经度小数点后超过了八位
double
x
=
0
;
double
x
=
0
;
double
y
=
0
;
double
y
=
0
;
if
(
row
.
getCell
(
0
).
get
NumericCellValue
()
+
""
.
length
()
>
12
){
if
(
row
.
getCell
(
0
).
get
StringCellValue
()
.
length
()
>
12
){
String
xStr
=
row
.
getCell
(
0
).
get
NumericCellValue
()
+
""
.
substring
(
0
,
12
);
String
xStr
=
row
.
getCell
(
0
).
get
StringCellValue
().
substring
(
0
,
12
);
x
=
Double
.
parseDouble
(
xStr
);
x
=
Double
.
parseDouble
(
xStr
);
}
else
{
x
=
Double
.
parseDouble
(
row
.
getCell
(
0
).
getStringCellValue
());
}
}
if
(
row
.
getCell
(
1
).
get
NumericCellValue
()
+
""
.
length
()
>
11
){
if
(
row
.
getCell
(
1
).
get
StringCellValue
()
.
length
()
>
11
){
String
yStr
=
row
.
getCell
(
0
).
getNumericCellValue
()
+
""
.
substring
(
0
,
11
);
String
yStr
=
row
.
getCell
(
1
).
getStringCellValue
()
.
substring
(
0
,
11
);
y
=
Double
.
parseDouble
(
yStr
);
y
=
Double
.
parseDouble
(
yStr
);
}
else
{
y
=
Double
.
parseDouble
(
row
.
getCell
(
1
).
getStringCellValue
());
}
}
for
(
int
j
=
0
;
j
<
lastCellNum
;
j
++)
{
for
(
int
j
=
0
;
j
<
lastCellNum
;
j
++)
{
if
(
j
==
0
){
if
(
j
==
0
){
...
@@ -123,45 +149,53 @@ public class TbStLayerDataController {
...
@@ -123,45 +149,53 @@ public class TbStLayerDataController {
accidentPointService
.
save
(
point
);
accidentPointService
.
save
(
point
);
}
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
//具体的错误数据保存到这里
//具体的错误数据保存到这里
这里就不输出错误信息了
//e.printStackTrace();
//e.printStackTrace();
pointList
.
add
(
point
);
TbStLayerData
errorData
=
new
TbStLayerData
();
errorData
.
setxStr
(
row
.
getCell
(
0
).
getStringCellValue
());
errorData
.
setyStr
(
row
.
getCell
(
1
).
getStringCellValue
());
errorData
.
setTitle
(
row
.
getCell
(
2
).
getStringCellValue
());
errorData
.
setTime
(
df
.
parse
(
row
.
getCell
(
3
).
getStringCellValue
()));
pointList
.
add
(
errorData
);
}
}
}
}
//输出流写入到excel中
if
(
pointList
!=
null
&&
pointList
.
size
()
>
0
){
HSSFWorkbook
wb
=
new
HSSFWorkbook
();
//输出流写入到excel中
HSSFSheet
sheet
=
wb
.
createSheet
();
XSSFWorkbook
wb
=
new
XSSFWorkbook
();
//给个标题头
XSSFSheet
sheet
=
wb
.
createSheet
();
HSSFRow
rowTitle
=
sheet
.
createRow
(
0
);
//给个标题头
rowTitle
.
createCell
(
0
).
setCellValue
(
"经度"
);
XSSFRow
rowTitle
=
sheet
.
createRow
(
0
);
rowTitle
.
createCell
(
1
).
setCellValue
(
"纬度"
);
rowTitle
.
createCell
(
0
).
setCellValue
(
"经度"
);
rowTitle
.
createCell
(
2
).
setCellValue
(
"标题"
);
rowTitle
.
createCell
(
1
).
setCellValue
(
"纬度"
);
rowTitle
.
createCell
(
3
).
setCellValue
(
"时间"
);
rowTitle
.
createCell
(
2
).
setCellValue
(
"标题"
);
for
(
int
i
=
0
;
i
<
pointList
.
size
();
i
++)
{
rowTitle
.
createCell
(
3
).
setCellValue
(
"时间"
);
TbStLayerData
accidentPoint
=
pointList
.
get
(
i
);
for
(
int
i
=
0
;
i
<
pointList
.
size
();
i
++)
{
double
lon
=
accidentPoint
.
getX
();
TbStLayerData
accidentPoint
=
pointList
.
get
(
i
);
double
lat
=
accidentPoint
.
getY
();
String
title
=
accidentPoint
.
getTitle
();
String
title
=
accidentPoint
.
getTitle
();
Date
time
=
accidentPoint
.
getTime
();
Date
time
=
accidentPoint
.
getTime
();
String
timeFormat
=
df
.
format
(
time
);
String
timeFormat
=
df
.
format
(
time
);
XSSFRow
rowData
=
sheet
.
createRow
(
i
+
1
);
HSSFRow
rowData
=
sheet
.
createRow
(
i
+
1
);
rowData
.
createCell
(
0
).
setCellValue
(
accidentPoint
.
getxStr
());
rowData
.
createCell
(
0
).
setCellValue
(
lon
);
rowData
.
createCell
(
1
).
setCellValue
(
accidentPoint
.
getyStr
());
rowData
.
createCell
(
1
).
setCellValue
(
lat
);
rowData
.
createCell
(
2
).
setCellValue
(
title
);
rowData
.
createCell
(
2
).
setCellValue
(
title
);
rowData
.
createCell
(
3
).
setCellValue
(
timeFormat
);
rowData
.
createCell
(
3
).
setCellValue
(
timeFormat
);
}
//通过输出流下载
ServletOutputStream
outputStream
=
response
.
getOutputStream
();
//设置文件响应输出格式
response
.
setContentType
(
"application/vnd.ms-excel"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename=error.xlsx"
);
wb
.
write
(
outputStream
);
outputStream
.
flush
();
outputStream
.
close
();
}
}
//通过输出流下载
return
MapRestResult
.
build
(
200
,
"数据上传成功!"
,
null
);
ServletOutputStream
outputStream
=
response
.
getOutputStream
();
//设置文件响应输出格式
response
.
setContentType
(
"application/vnd.ms-excel"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename=error.xls"
);
wb
.
write
(
outputStream
);
outputStream
.
flush
();
outputStream
.
close
();
wb
.
close
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
//如果失败了就将之前的数据删除....
tbStLayerService
.
removeById
(
layerId
);
accidentPointService
.
deleteByGlId
(
layerId
);
return
MapRestResult
.
build
(
500
,
"数据上传失败!"
,
null
);
}
}
return
MapRestResult
.
build
(
200
,
"数据上传成功!"
,
null
);
}
}
}
}
service/view/src/main/java/com/founder/view/mapper/TbStLayerDataMapper.java
View file @
4a683c28
...
@@ -16,4 +16,6 @@ import org.apache.ibatis.annotations.Mapper;
...
@@ -16,4 +16,6 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
@Mapper
public
interface
TbStLayerDataMapper
extends
BaseMapper
<
TbStLayerData
>
{
public
interface
TbStLayerDataMapper
extends
BaseMapper
<
TbStLayerData
>
{
void
deleteByGlId
(
String
layerId
);
}
}
service/view/src/main/java/com/founder/view/mapper/
AccidentPoint
Mapper.java
→
service/view/src/main/java/com/founder/view/mapper/
TbStLayer
Mapper.java
View file @
4a683c28
...
@@ -2,8 +2,8 @@ package com.founder.view.mapper;
...
@@ -2,8 +2,8 @@ package com.founder.view.mapper;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.founder.commonutils.
publicEntity.SysUs
er
;
import
com.founder.commonutils.
viewEntity.TbStLay
er
;
import
com.founder.commonutils.viewEntity.
AccidentPoint
;
import
com.founder.commonutils.viewEntity.
TbStLayerData
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
/**
...
@@ -15,6 +15,7 @@ import org.apache.ibatis.annotations.Mapper;
...
@@ -15,6 +15,7 @@ import org.apache.ibatis.annotations.Mapper;
* @since 2021-03-11
* @since 2021-03-11
*/
*/
@Mapper
@Mapper
public
interface
AccidentPointMapper
extends
BaseMapper
<
AccidentPoint
>
{
public
interface
TbStLayerMapper
extends
BaseMapper
<
TbStLayer
>
{
}
}
service/view/src/main/java/com/founder/view/mapper/xml/TbStLayerDataMapper.xml
View file @
4a683c28
<?xml version="1.0" encoding="UTF-8"?>
<?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">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.founder.view.mapper.TbStLayerDataMapper"
>
<mapper
namespace=
"com.founder.view.mapper.TbStLayerDataMapper"
>
<delete
id=
"deleteByGlId"
parameterType=
"String"
>
delete from tb_st_layer_data where gl_xxzjbh = #{layerId}
</delete>
</mapper>
</mapper>
service/view/src/main/java/com/founder/view/mapper/xml/TbStLayerMapper.xml
0 → 100644
View file @
4a683c28
<?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.founder.view.mapper.TbStLayerMapper"
>
</mapper>
service/view/src/main/java/com/founder/view/service/TbStLayerDataService.java
View file @
4a683c28
...
@@ -4,4 +4,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
...
@@ -4,4 +4,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
import
com.founder.commonutils.viewEntity.TbStLayerData
;
import
com.founder.commonutils.viewEntity.TbStLayerData
;
public
interface
TbStLayerDataService
extends
IService
<
TbStLayerData
>
{
public
interface
TbStLayerDataService
extends
IService
<
TbStLayerData
>
{
void
deleteByGlId
(
String
layerId
);
}
}
service/view/src/main/java/com/founder/view/service/TbStLayerService.java
0 → 100644
View file @
4a683c28
package
com
.
founder
.
view
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.founder.commonutils.viewEntity.TbStLayer
;
import
com.founder.commonutils.viewEntity.TbStLayerData
;
public
interface
TbStLayerService
extends
IService
<
TbStLayer
>
{
}
service/view/src/main/java/com/founder/view/service/impl/TbStLayerDataServiceImpl.java
View file @
4a683c28
...
@@ -6,7 +6,15 @@ import com.founder.view.mapper.TbStLayerDataMapper;
...
@@ -6,7 +6,15 @@ import com.founder.view.mapper.TbStLayerDataMapper;
import
com.founder.view.service.TbStLayerDataService
;
import
com.founder.view.service.TbStLayerDataService
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
@Service
@Service
public
class
TbStLayerDataServiceImpl
extends
ServiceImpl
<
TbStLayerDataMapper
,
TbStLayerData
>
implements
TbStLayerDataService
{
public
class
TbStLayerDataServiceImpl
extends
ServiceImpl
<
TbStLayerDataMapper
,
TbStLayerData
>
implements
TbStLayerDataService
{
@Resource
TbStLayerDataMapper
tbStLayerDataMapper
;
@Override
public
void
deleteByGlId
(
String
layerId
)
{
tbStLayerDataMapper
.
deleteByGlId
(
layerId
);
}
}
}
service/view/src/main/java/com/founder/view/service/impl/TbStLayerServiceImpl.java
0 → 100644
View file @
4a683c28
package
com
.
founder
.
view
.
service
.
impl
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.founder.commonutils.viewEntity.TbStLayer
;
import
com.founder.commonutils.viewEntity.TbStLayerData
;
import
com.founder.view.mapper.TbStLayerDataMapper
;
import
com.founder.view.mapper.TbStLayerMapper
;
import
com.founder.view.service.TbStLayerDataService
;
import
com.founder.view.service.TbStLayerService
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
@Service
public
class
TbStLayerServiceImpl
extends
ServiceImpl
<
TbStLayerMapper
,
TbStLayer
>
implements
TbStLayerService
{
}
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