| | |
| | | package com.dji.sample.patches.controller; |
| | | |
| | | import cn.hutool.core.io.FileUtil; |
| | | import com.dji.sample.common.model.ResponseResult; |
| | | import com.dji.sample.patches.model.entity.LotInfo; |
| | | import com.dji.sample.patches.service.impl.ShpToDataSourceServiceImpl; |
| | | import com.dji.sample.patches.utils.ZipUtil; |
| | | import org.apache.tomcat.util.http.fileupload.UploadContext; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.core.io.FileSystemResource; |
| | | import org.springframework.core.io.Resource; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.MediaType; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | |
| | | import java.io.IOException; |
| | | import javax.servlet.ServletOutputStream; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.util.List; |
| | | |
| | | import static org.springframework.http.MediaType.parseMediaType; |
| | | |
| | | @RestController |
| | | @RequestMapping("${url.patches.prefix}${url.patches.version}") |
| | | public class ShpToDataSourceController { |
| | | @Autowired |
| | | private ShpToDataSourceServiceImpl shpToDataSourceServiceImpl; |
| | | |
| | | @PostMapping("/getGeo") |
| | | public ResponseResult<List<LotInfo>> getGeo (@RequestParam("file") MultipartFile file,@RequestParam String workspaceId) throws IOException { |
| | | List<LotInfo> list=shpToDataSourceServiceImpl.insertGeo(file,workspaceId); |
| | | return ResponseResult.success(list); |
| | | public ResponseResult<List<LotInfo>> getGeo(@RequestParam("file") MultipartFile file, |
| | | @RequestParam String waylineName, |
| | | @RequestParam String workspaceId) throws IOException { |
| | | List<LotInfo> list = shpToDataSourceServiceImpl.insertGeo(file, workspaceId,waylineName); |
| | | return ResponseResult.success(list); |
| | | } |
| | | |
| | | |
| | | } |
| | | @GetMapping("/getFile") |
| | | public ResponseEntity<Resource> download(String waylineName) throws UnsupportedEncodingException { |
| | | return shpToDataSourceServiceImpl.backWayline(waylineName); |
| | | } |
| | | } |
| | | |