Commit 50e16a59 authored by 周健威's avatar 周健威

修改代码

parent 06e03c4a
...@@ -131,11 +131,11 @@ public class UploadController{ ...@@ -131,11 +131,11 @@ public class UploadController{
} }
@RequestMapping(value = "/app/unauth/shp/upload", method = RequestMethod.POST) @RequestMapping(value = "/app/unauth/shp/upload", method = RequestMethod.POST)
public JSONObject shpUploads( public ObjectRestResponse shpUploads(
@RequestParam("file") MultipartFile file, @RequestParam("file") MultipartFile file,
@RequestParam(value = "prefix",defaultValue = "shp")String prefix @RequestParam(value = "prefix",defaultValue = "shp")String prefix
)throws Exception { ) throws Exception{
return JsonResultUtil.createSuccessResultWithObj(uploadService.uploadShpFile(file,prefix)); return ObjectRestResponse.succ(uploadService.uploadShpFile(file,prefix));
} }
@IgnoreUserToken @IgnoreUserToken
......
package com.upyuns.platform.rs.universal.service; package com.upyuns.platform.rs.universal.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.img.ImgUtil; import cn.hutool.core.img.ImgUtil;
import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.FileUtil;
import com.github.wxiaoqi.security.common.util.UUIDUtils; import com.github.wxiaoqi.security.common.util.UUIDUtils;
...@@ -27,6 +28,7 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -27,6 +28,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.awt.*; import java.awt.*;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.File; import java.io.File;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
...@@ -49,7 +51,7 @@ public class UploadService { ...@@ -49,7 +51,7 @@ public class UploadService {
* @param file * @param file
* @return * @return
*/ */
public String uploadShpFile(MultipartFile file,String prefix) throws Exception{ public Map<String, String> uploadShpFile(MultipartFile file, String prefix) throws Exception{
//创建本日存放目录 //创建本日存放目录
DateTime now = DateTime.now(); DateTime now = DateTime.now();
String dirPathToday = "/"+prefix+ "/" + now.toString(DEFAULT_DATE_TIME_FORMATTER); String dirPathToday = "/"+prefix+ "/" + now.toString(DEFAULT_DATE_TIME_FORMATTER);
...@@ -68,7 +70,11 @@ public class UploadService { ...@@ -68,7 +70,11 @@ public class UploadService {
String geomJson = ShpToGeojson.shp2geojson(filePath); String geomJson = ShpToGeojson.shp2geojson(filePath);
redisTemplate.opsForValue().set(key, geomJson); redisTemplate.opsForValue().set(key, geomJson);
// realFileRelPath=xx_url+SystemConfig.XXMP_URL+realFileRelPath; // realFileRelPath=xx_url+SystemConfig.XXMP_URL+realFileRelPath;
return key;
Map map = CollUtil.newHashMap();
map.put("shpKey", key);
map.put("geom", geomJson);
return map;
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment