| | |
| | | import com.lf.server.annotation.SysLog; |
| | | import com.lf.server.controller.all.BaseController; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.all.StaticData; |
| | | import com.lf.server.entity.ctrl.PubEntity; |
| | | import com.lf.server.entity.data.MetaEntity; |
| | | import com.lf.server.entity.data.MetaFileEntity; |
| | | import com.lf.server.entity.data.PublishEntity; |
| | | import com.lf.server.entity.sys.UserEntity; |
| | | import com.lf.server.helper.PathHelper; |
| | | import com.lf.server.helper.StringHelper; |
| | | import com.lf.server.helper.WebHelper; |
| | | import com.lf.server.service.data.LayerService; |
| | | import com.lf.server.service.data.MetaService; |
| | | import com.lf.server.service.data.PublishService; |
| | | import com.lf.server.service.data.RasterService; |
| | | import com.lf.server.service.sys.TokenService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.File; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | @Resource |
| | | LayerService layerService; |
| | | |
| | | @Resource |
| | | MetaService metaService; |
| | | |
| | | @Resource |
| | | RasterService rasterService; |
| | | |
| | | @Resource |
| | | PathHelper pathHelper; |
| | | |
| | | @ApiOperation(value = "测试查询") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "seconds", value = "秒", dataType = "Integer", paramType = "query", example = "30") |
| | | }) |
| | | @GetMapping(value = "/selectForTest") |
| | | public ResponseMsg<Object> selectForTest(Integer seconds) { |
| | | try { |
| | | if (null == seconds || seconds < 1) { |
| | | seconds = 1; |
| | | } |
| | | |
| | | String str = publishService.selectForTest(seconds); |
| | | |
| | | return success(str); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "分页查询元数据") |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询栅格数据的坐标系ID") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ids", value = "元数据ID集合", dataType = "Integer[]", paramType = "query", example = "10531,10527,10526") |
| | | }) |
| | | @GetMapping(value = "/selectRasterCs") |
| | | public ResponseMsg<Object> selectRasterCs(Integer[] ids, HttpServletRequest req) { |
| | | try { |
| | | if (null == ids || ids.length == 0) { |
| | | return fail("元数据ID集合不能为空"); |
| | | } |
| | | |
| | | List<MetaEntity> list = metaService.selectByIds(StringHelper.join(Arrays.asList(ids), ",")); |
| | | if (null == list || list.isEmpty()) { |
| | | return fail("查无数据"); |
| | | } |
| | | |
| | | String basePath = pathHelper.getConfig().getUploadPath() + File.separator; |
| | | List<MetaEntity> errList = new ArrayList<>(); |
| | | for (MetaEntity me : list) { |
| | | if (!StaticData.RASTER_EXT.contains("." + me.getType())) { |
| | | me.setBak("不是栅格数据"); |
| | | errList.add(me); |
| | | continue; |
| | | } |
| | | |
| | | String filePath = basePath + me.getPath(); |
| | | File f = new File(filePath); |
| | | if (!f.exists() || f.isDirectory()) { |
| | | me.setBak("文件不存在"); |
| | | errList.add(me); |
| | | continue; |
| | | } |
| | | |
| | | // Integer epsg = rasterService.getRaterEpsg(filePath) |
| | | Integer epsg = rasterService.getEpsgByGdal(filePath); |
| | | if (null == epsg || epsg < 1) { |
| | | me.setBak("坐标系ID无效"); |
| | | errList.add(me); |
| | | } |
| | | } |
| | | |
| | | return success(errList.size(), errList); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "查询坐标转换") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "x", value = "X坐标", dataType = "double", paramType = "query", example = "400925.079"), |
| | | @ApiImplicitParam(name = "y", value = "Y坐标", dataType = "double", paramType = "query", example = "2541768.173"), |
| | | @ApiImplicitParam(name = "epsg", value = "EPSG编码", dataType = "int", paramType = "query", example = "4548") |
| | | }) |
| | | @GetMapping(value = "/selectCsTransform") |
| | | public Object selectCsTransform(double x, double y, int epsg) { |
| | | try { |
| | | return rasterService.transformByProj4j(x, y, epsg); |
| | | } catch (Exception ex) { |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "插入发布数据") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "entity", value = "实体类", dataType = "PubEntity", paramType = "body") |
| | |
| | | case "BIM": |
| | | return "/Convert/ToTileset"; |
| | | case "LAS": |
| | | return "/Convert/ToLas"; |
| | | return "/Convert/ToLasByPy"; |
| | | case "OSGB": |
| | | return "/Convert/ToOsgb"; |
| | | default: |