Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rs-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
周健威
rs-cloud-platform
Commits
c645cf01
Commit
c645cf01
authored
Dec 22, 2021
by
周健威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改代码
parent
0b8fbd79
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
361 additions
and
1 deletion
+361
-1
pom.xml
rs-datacenter/rs-datacenter-api/pom.xml
+17
-0
pom.xml
rs-datacenter/rs-datacenter-server/pom.xml
+58
-0
ShpToGeojson.java
...com/upyuns/platform/rs/datacenter/utils/ShpToGeojson.java
+252
-0
UploadController.java
...ns/platform/rs/universal/controller/UploadController.java
+8
-0
UploadService.java
...m/upyuns/platform/rs/universal/service/UploadService.java
+26
-1
No files found.
rs-datacenter/rs-datacenter-api/pom.xml
View file @
c645cf01
...
...
@@ -14,6 +14,23 @@
<artifactId>
rs-datacenter-api
</artifactId>
<version>
2.0-rscp-SNAPSHOT
</version>
<repositories>
<repository>
<id>
osgeo
</id>
<name>
OSGeo Release Repository
</name>
<url>
https://repo.osgeo.org/repository/release/
</url>
<snapshots><enabled>
false
</enabled></snapshots>
<releases><enabled>
true
</enabled></releases>
</repository>
<repository>
<id>
osgeo-snapshot
</id>
<name>
OSGeo Snapshot Repository
</name>
<url>
https://repo.osgeo.org/repository/snapshot/
</url>
<snapshots><enabled>
true
</enabled></snapshots>
<releases><enabled>
false
</enabled></releases>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>
org.postgresql
</groupId>
...
...
rs-datacenter/rs-datacenter-server/pom.xml
View file @
c645cf01
...
...
@@ -14,6 +14,27 @@
<groupId>
com.upyuns.platform.rs
</groupId>
<artifactId>
rs-datacenter-server
</artifactId>
<repositories>
<repository>
<id>
osgeo
</id>
<name>
OSGeo Release Repository
</name>
<url>
https://repo.osgeo.org/repository/release/
</url>
<snapshots><enabled>
false
</enabled></snapshots>
<releases><enabled>
true
</enabled></releases>
</repository>
<repository>
<id>
osgeo-snapshot
</id>
<name>
OSGeo Snapshot Repository
</name>
<url>
https://repo.osgeo.org/repository/snapshot/
</url>
<snapshots><enabled>
true
</enabled></snapshots>
<releases><enabled>
false
</enabled></releases>
</repository>
</repositories>
<properties>
<geotools.version>
17.0
</geotools.version>
</properties>
<dependencies>
<dependency>
<groupId>
com.github.wxiaoqi
</groupId>
...
...
@@ -44,6 +65,43 @@
<optional>
true
</optional>
<version>
2.8.3
</version>
</dependency>
<dependency>
<groupId>
com.vividsolutions
</groupId>
<artifactId>
jts
</artifactId>
<version>
1.13
</version>
</dependency>
<dependency>
<groupId>
org.geotools
</groupId>
<artifactId>
gt-geojson
</artifactId>
<version>
24.3
</version>
</dependency>
<dependency>
<groupId>
org.geotools
</groupId>
<artifactId>
gt-main
</artifactId>
<version>
24.3
</version>
</dependency>
<dependency>
<groupId>
org.geotools
</groupId>
<artifactId>
gt-shapefile
</artifactId>
<version>
24.3
</version>
</dependency>
<dependency>
<groupId>
org.geotools
</groupId>
<artifactId>
gt-swing
</artifactId>
<version>
24.3
</version>
</dependency>
<!-- 添加geotools-jdbc -->
<dependency>
<groupId>
org.geotools.jdbc
</groupId>
<artifactId>
gt-jdbc-postgis
</artifactId>
<version>
24.3
</version>
</dependency>
</dependencies>
<build>
...
...
rs-datacenter/rs-datacenter-server/src/main/java/com/upyuns/platform/rs/datacenter/utils/ShpToGeojson.java
0 → 100644
View file @
c645cf01
This diff is collapsed.
Click to expand it.
rs-universal/rs-universal-server/src/main/java/com/upyuns/platform/rs/universal/controller/UploadController.java
View file @
c645cf01
...
...
@@ -130,6 +130,14 @@ public class UploadController{
return
JsonResultUtil
.
createSuccessResultWithObj
(
uploadService
.
uploadFile
(
file
,
prefix
));
}
@RequestMapping
(
value
=
"/app/unauth/shp/upload"
,
method
=
RequestMethod
.
POST
)
public
JSONObject
shpUploads
(
@RequestParam
(
"file"
)
MultipartFile
file
,
@RequestParam
(
value
=
"prefix"
,
defaultValue
=
"shp"
)
String
prefix
)
throws
Exception
{
return
JsonResultUtil
.
createSuccessResultWithObj
(
uploadService
.
uploadShpFile
(
file
,
prefix
));
}
@IgnoreUserToken
@RequestMapping
(
value
=
"/app/unauth/download"
,
method
=
RequestMethod
.
GET
)
//匹配的是href中的download请求
public
ResponseEntity
<
byte
[]>
download
(
@RequestParam
(
"realFileRelPath"
)
String
realFileRelPath
)
throws
Exception
{
...
...
rs-universal/rs-universal-server/src/main/java/com/upyuns/platform/rs/universal/service/UploadService.java
View file @
c645cf01
...
...
@@ -42,6 +42,31 @@ public class UploadService {
@Autowired
private
RedisTemplate
redisTemplate
;
/**
* 写入上传文件,返回相对路径
* @param file
* @return
*/
public
String
uploadShpFile
(
MultipartFile
file
,
String
prefix
)
throws
Exception
{
//创建本日存放目录
DateTime
now
=
DateTime
.
now
();
String
dirPathToday
=
"/"
+
prefix
+
"/"
+
now
.
toString
(
DEFAULT_DATE_TIME_FORMATTER
);
String
redisNoKey
=
RedisKey
.
UPLOAD_FILE_NO_PREFIX
+
now
.
toString
(
DEFAULT_DATE_TIME_FORMATTER
);
Long
no
=
redisTemplate
.
opsForValue
().
increment
(
redisNoKey
);
if
(
no
.
equals
(
1
l
)){
redisTemplate
.
expire
(
redisNoKey
,
1
,
TimeUnit
.
DAYS
);
}
String
fileName
=
file
.
getOriginalFilename
();
String
realFileRelPath
=
dirPathToday
+
"/"
+
no
+
fileName
.
substring
(
fileName
.
lastIndexOf
(
"."
));
//文件存放路径
String
filePath
=
baseUploadPath
+
realFileRelPath
;
//将文件写入指定位置
FileUtils
.
copyInputStreamToFile
(
file
.
getInputStream
(),
new
File
(
filePath
));
redisTemplate
.
opsForValue
().
setIfAbsent
(
realFileRelPath
,
filePath
);
// realFileRelPath=xx_url+SystemConfig.XXMP_URL+realFileRelPath;
return
realFileRelPath
;
}
/**
* 写入上传文件,返回相对路径
* @param file
...
...
@@ -61,7 +86,7 @@ public class UploadService {
//文件存放路径
String
filePath
=
baseUploadPath
+
realFileRelPath
;
//将文件写入指定位置
FileUtils
.
copyInputStreamToFile
(
file
.
getInputStream
(),
new
File
(
filePath
));
FileUtils
.
copyInputStreamToFile
(
file
.
getInputStream
(),
new
File
(
filePath
));
realFileRelPath
=
xx_url
+
SystemConfig
.
XXMP_URL
+
realFileRelPath
;
return
realFileRelPath
;
}
...
...
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