| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233 |
- package com.onemap.overlap.controller;
- import cn.hutool.json.JSONObject;
- import com.onemap.common.core.web.domain.RequestResult;
- import com.onemap.overlap.service.DataService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.core.io.InputStreamResource;
- import org.springframework.http.ResponseEntity;
- import org.springframework.web.bind.annotation.*;
- import org.springframework.web.multipart.MultipartFile;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- @RestController
- @RequestMapping("/data")
- public class DataController {
- @Autowired
- private DataService dataService;
- @RequestMapping("/start")
- public void start() {
- try {
- dataService.start();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- /**
- * 导入数据 file/path 二选一 入库到spatialite
- *
- * @param file 前端传入的zip压缩包
- * @param path 前端选择的shp文件的位置
- * @return
- */
- @PostMapping("/import")
- public RequestResult importIn(MultipartFile file, String path, String type, String name, String ufield) {
- try {
- return dataService.importIn(file, path, type, name, ufield);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 获取shp文件字段集合
- *
- * @param path 前端选择的shp文件的位置
- * @return
- */
- @PostMapping("/getShpFields")
- public RequestResult getShpFields(String path) {
- try {
- return dataService.getShpFields(path);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 查询模型列表
- *
- * @return
- */
- @RequestMapping("/modellist")
- public RequestResult modellist() {
- try {
- return dataService.modellist();
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 查询模型列表
- *
- * @return
- */
- @RequestMapping("/modeldetails")
- public RequestResult modeldetails(String modelname) {
- try {
- return dataService.modeldetails(modelname);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 删除分析模型
- *
- * @return
- */
- @RequestMapping("/modeldelete")
- public RequestResult modeldelete(String modelname) {
- try {
- return dataService.modeldelete(modelname);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 修改或新增模型
- *
- * @return
- */
- @RequestMapping("/modelupdate")
- public RequestResult modelupdate(HttpServletRequest request, HttpServletResponse response) {
- try {
- return dataService.modelupdate(request);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 查询所有管控数据
- *
- * @return
- */
- @RequestMapping("/basevector")
- public RequestResult basevector() {
- try {
- return dataService.basevector();
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 删除指定管控数据
- *
- * @return
- */
- @RequestMapping("/basevectordelete")
- public RequestResult basevectordelete(String tablename) {
- try {
- return dataService.basevectordelete(tablename);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 查询所有分析图斑数据列表
- *
- * @return
- */
- @RequestMapping("/analysevector")
- public RequestResult analysevector() {
- try {
- return dataService.analysevector();
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- @GetMapping("/{tiftype}/{tableid}/{uuid}.{filetype}")
- public ResponseEntity<InputStreamResource> getTiff(@PathVariable("tiftype") String tiftype, @PathVariable("tableid") String tableid, @PathVariable("uuid") String uuid, @PathVariable("filetype") String filetype) {
- return dataService.getTiff(tiftype, tableid, uuid, filetype);
- }
- /**
- * 查询图斑前后时相影像地址
- *
- * @return
- */
- @RequestMapping("/getImageUrls")
- public RequestResult getImageUrls(String tableid, String uuid) {
- try {
- return dataService.getImageUrls(tableid, uuid);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 获取空间表的全量空间数据
- *
- * @return
- */
- @RequestMapping("/getTableGeoms")
- public RequestResult getTableGeoms(String tablename) {
- try {
- return dataService.getTableGeoms(tablename);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 根据swid获取空间表的属性信息
- *
- * @return
- */
- @RequestMapping("/getFeatureBySwid")
- public RequestResult getFeatureBySwid(String tablename, String swid) {
- try {
- return dataService.getFeatureBySwid(tablename, swid);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 根据swid获取空间表的属性信息
- *
- * @return
- */
- @RequestMapping("/getTableRecord")
- public RequestResult getTableRecord(String tablename, Integer page, Integer limit) {
- try {
- return dataService.getTableRecord(tablename, page, limit);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- }
|