| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399 |
- 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();
- }
- }
- /**
- * 上传数据包
- *
- * @param file 前端传入的zip压缩包
- * @return
- */
- @PostMapping("/upload")
- public RequestResult upload(MultipartFile file) {
- try {
- return dataService.upload(file);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 导入数据 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, String style) {
- try {
- return dataService.importIn(file, path, type, name, ufield, style);
- } 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(String name) {
- try {
- return dataService.analysevector(name);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 删除指定分析套合数据
- *
- * @return
- */
- @RequestMapping("/analysevectordelete")
- public RequestResult analysevectordelete(String tablename) {
- try {
- return dataService.analysevectordelete(tablename);
- } 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);
- }
- }
- /**
- * 获取地图配置
- *
- * @return
- */
- @RequestMapping("/getMapConfig")
- public RequestResult getMapConfig(String key) {
- try {
- return dataService.getMapConfig(key);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 获取地图服务器信息
- *
- * @return
- */
- @RequestMapping("/getServerConfig")
- public RequestResult getServerConfig(String key) {
- try {
- return dataService.getServerConfig(key);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 获取地图样式集合
- *
- * @return
- */
- @RequestMapping("/getGeoServerStyles")
- public RequestResult getGeoServerStyles() {
- try {
- return dataService.getGeoServerStyles();
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 修改地图配置
- *
- * @return
- */
- @RequestMapping("/updateMapConfig")
- public RequestResult updateMapConfig(HttpServletRequest request, HttpServletResponse response) {
- try {
- return dataService.updateMapConfig(request);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 修改地图服务器信息
- *
- * @return
- */
- @RequestMapping("/updateServerConfig")
- public RequestResult updateServerConfig(HttpServletRequest request, HttpServletResponse response) {
- try {
- return dataService.updateServerConfig(request);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 执行套合分析
- *
- * @return
- */
- @RequestMapping("/overlapAnalysis")
- public RequestResult overlapAnalysis(String modelname, String tablename) {
- try {
- return dataService.overlapAnalysis(modelname, tablename);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 导出分析报告
- *
- * @return
- */
- @RequestMapping("/exportReport")
- public RequestResult exportReport(String modelname, String tablename, String layername, HttpServletRequest request, HttpServletResponse response) {
- try {
- return dataService.exportReport(modelname, tablename, layername, request, response);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 生成套合分析成果包
- *
- * @return
- */
- @RequestMapping("/exportAchievementPackage")
- public RequestResult exportAchievementPackage(String tablename, String layername, HttpServletRequest request, HttpServletResponse response) {
- try {
- return dataService.exportAchievementPackage(tablename, layername, request, response);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- /**
- * 获取分析结果--制作统计图
- *
- * @return
- */
- @RequestMapping("/getAnalyseResult")
- public RequestResult getAnalyseResult(String tablename) {
- try {
- return dataService.getAnalyseResult(tablename);
- } catch (Exception e) {
- e.printStackTrace();
- return RequestResult.error("失败", null);
- }
- }
- }
|