修改文件上传、GDB/Shp数据读取、数据入库、元数据管理等接口
| | |
| | | public String getTilePath() { |
| | | return tilePath; |
| | | } |
| | | |
| | | public String getLfData() { |
| | | return tilePath.replace("2d\\tiles", ""); |
| | | } |
| | | } |
| | |
| | | @ConditionalOnClass(value = {RestTemplate.class, HttpClient.class}) |
| | | public class RestTemplateConfig { |
| | | /** |
| | | * è¿æ¥æ± çæå¤§è¿æ¥æ°é»è®¤ä¸º0 |
| | | * è¿æ¥æ± çæå¤§è¿æ¥æ°é»è®¤ä¸º0ï¼ä¸éå¶ |
| | | */ |
| | | @Value("${remote.maxTotalConnect:0}") |
| | | private int maxTotalConnect; |
| | |
| | | private int maxConnectPerRoute; |
| | | |
| | | /** |
| | | * è¿æ¥è¶
æ¶é»è®¤5s |
| | | * è¿æ¥è¶
æ¶é»è®¤5sï¼-1为ä¸éå¶ |
| | | */ |
| | | @Value("${remote.connectTimeout:5000}") |
| | | private int connectTimeout; |
| | | |
| | | /** |
| | | * 读åè¶
æ¶é»è®¤30s |
| | | * 读åè¶
æ¶é»è®¤30sï¼-1为ä¸éå¶ |
| | | */ |
| | | @Value("${remote.readTimeout:30000}") |
| | | private int readTimeout; |
| | |
| | | if (StringHelper.isEmpty(wkt)) { |
| | | return fail("WKTä¸è½ä¸ºç©º", null); |
| | | } |
| | | if (null == limit || limit < 1 || limit > StaticData.ONE_HUNDRED) { |
| | | if (null == limit || limit < 1 || limit > StaticData.I100) { |
| | | limit = 20; |
| | | } |
| | | if (null == buffer || buffer < 0 || buffer > StaticData.ONE_HUNDRED_THOUSAND) { |
| | |
| | | @ApiImplicitParam(name = "depcode", value = "åä½ç¼ç ", dataType = "String", paramType = "query", example = "00"), |
| | | @ApiImplicitParam(name = "dirs", value = "ç®å½ç¼ç ", dataType = "String", paramType = "query", example = "00,01"), |
| | | @ApiImplicitParam(name = "tab", value = "表å", dataType = "String", paramType = "query", example = "dlg_"), |
| | | @ApiImplicitParam(name = "types", value = "ç±»å«", dataType = "String", paramType = "query", example = "æµç»ï¼ESVï¼"), |
| | | @ApiImplicitParam(name = "hasGeom", value = "嫿Geomåæ®µ", dataType = "Boolean", paramType = "query", example = "false"), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯é¡µæ¡æ°", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "å页æ°ï¼ä»1å¼å§ï¼", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | public ResponseMsg<Object> selectTabsByPage(String depcode, String dirs, String tab, Boolean hasGeom, Integer pageSize, Integer pageIndex) { |
| | | public ResponseMsg<Object> selectTabsByPage(String depcode, String dirs, String tab, String types, Boolean hasGeom, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("æ¯é¡µé¡µæ°æå页æ°å°äº1", null); |
| | |
| | | if (dirs != null) { |
| | | filters += String.format(" and %s", dirs); |
| | | } |
| | | String typesFilter = getTypesFilter(types); |
| | | |
| | | String field = null == hasGeom || !hasGeom ? "gid" : "geom"; |
| | | int count = baseQueryService.selectTabsForCount(tab, field); |
| | | int count = baseQueryService.selectTabsForCount(tab, typesFilter, field); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | |
| | | List<TabEntity> rs = baseQueryService.selectTabsByPage(tab, field, filters, pageSize, pageSize * (pageIndex - 1)); |
| | | List<TabEntity> rs = baseQueryService.selectTabsByPage(tab, typesFilter, field, filters, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åç±»å«è¿æ»¤æ¡ä»¶ |
| | | */ |
| | | private String getTypesFilter(String types) { |
| | | if (StringHelper.isEmpty(types)) { |
| | | return null; |
| | | } |
| | | |
| | | List<String> list = new ArrayList<>(); |
| | | for (String type : types.split(StaticData.COMMA)) { |
| | | switch (type) { |
| | | case "æµç»ï¼ESVï¼": |
| | | list.add("bak like 'å·¥ç¨æ°æ®/æµç»%'"); |
| | | break; |
| | | case "åå¯ï¼EGEï¼": |
| | | list.add("bak like 'å·¥ç¨æ°æ®/åå¯%'"); |
| | | break; |
| | | case "å°ç¾ï¼EGDï¼": |
| | | list.add("bak like 'å·¥ç¨æ°æ®/å°ç¾%'"); |
| | | break; |
| | | case "æ´åºï¼EGDï¼": |
| | | list.add("bak like 'å·¥ç¨æ°æ®/æ´åº%'"); |
| | | break; |
| | | case "åºç¡æµç»": |
| | | list.add("bak like 'åºç¡æ°æ®/æµç»%'"); |
| | | break; |
| | | case "åºç¡å°ç¾": |
| | | list.add("bak like 'åºç¡æ°æ®/å°ç¾%'"); |
| | | break; |
| | | case "åºç¡åå¯": |
| | | list.add("bak like 'åºç¡æ°æ®/åå¯%'"); |
| | | break; |
| | | case "åè§æ°æ®": |
| | | case "ç®¡çæ°æ®": |
| | | default: |
| | | break; |
| | | } |
| | | } |
| | | |
| | | return list.isEmpty() ? null : StringHelper.join(list, " or "); |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢å段信æ¯") |
| | | @ApiImplicitParams({ |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "ææä»¶ç±»åç»è®¡") |
| | | @GetMapping(value = "/countSizesByType") |
| | | public ResponseMsg<Object> countSizesByType() { |
| | | try { |
| | | List<CountEntity> list = reportService.countSizesByType(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢æå¡è°ç¨éç»è®¡") |
| | | @GetMapping(value = "/selectCountServices") |
| | | public ResponseMsg<Object> selectCountServices() { |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æé¡¹ç®ç»è®¡æ°æ®") |
| | | @GetMapping(value = "/countSizesByPrj") |
| | | public ResponseMsg<Object> countSizesByPrj() { |
| | | try { |
| | | List<CountEntity> list = reportService.countSizesByPrj(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "ä¸è½½æ¥å") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "æ¥åID", dataType = "Integer", paramType = "7") |
| | |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ ¹æ®GUIDæ¥è¯¢GDB") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "guid", value = "GUID", dataType = "String", paramType = "query", example = "d58e66d9606a4b85e7c8ab43b3db0b55") |
| | | }) |
| | | @GetMapping(value = "/selectGdbByGuid") |
| | | public ResponseMsg<Object> selectGdbByGuid(String guid) { |
| | | try { |
| | | if (StringHelper.isEmpty(guid)) { |
| | | return fail("æä»¶GUIDå¼ä¸è½ä¸ºç©º", null); |
| | | } |
| | | |
| | | List<MetaEntity> rs = metaService.selectGdbByGuid(guid); |
| | | |
| | | return success(null == rs ? 0 : rs.size(), rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex, null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ ¹æ®ç¶IDå页æ¥è¯¢å¹¶è¿åè®°å½æ°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "metaid", value = "ç¶ID", dataType = "String", paramType = "query", example = "0"), |
| | |
| | | import com.moon.server.entity.sys.UserEntity; |
| | | import com.moon.server.helper.StringHelper; |
| | | import com.moon.server.helper.WebHelper; |
| | | import com.moon.server.service.all.PermsService; |
| | | import com.moon.server.service.data.PublishService; |
| | | import com.moon.server.service.sys.TokenService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | @RestController |
| | | @RequestMapping("/publish") |
| | | public class PublishController extends BaseController { |
| | | @Autowired |
| | | @Resource |
| | | PublishService publishService; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | TokenService tokenService; |
| | | |
| | | @Resource |
| | | PermsService permsService; |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "å页æ¥è¯¢å
æ°æ®") |
| | |
| | | return fail("æ°æ®ç±»å«ä¸ºç©º", null); |
| | | } |
| | | |
| | | String types = getType(type); |
| | | String types = getType(dircode, type); |
| | | int count = publishService.selectMetasByCount(depcode, dircode, verid, types, name); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | |
| | | /** |
| | | * è·åç±»å |
| | | */ |
| | | private String getType(String type) throws Exception { |
| | | private String getType(String dircode, String type) throws Exception { |
| | | switch (type) { |
| | | case "DOM": |
| | | return "type in ('tif', 'tiff', 'img')"; |
| | | return "type in ('tif', 'tiff', 'img')" + getFilter(dircode, type); |
| | | case "DEM": |
| | | return "type in ('tif', 'tiff')"; |
| | | return "type in ('tif', 'tiff')" + getFilter(dircode, type); |
| | | case "MPT": |
| | | return "type = 'mpt'"; |
| | | case "3DML": |
| | | return "type = '3dml'"; |
| | | case "CPT": |
| | | return "type = 'cpt'"; |
| | | case "BIM": |
| | | return "type in ('ifc', 'fbx', 'rvt')"; |
| | | case "LAS": |
| | | return "type in ('las', 'laz')"; |
| | | case "OSGB": |
| | | return "type = 'osgb'"; |
| | | default: |
| | | throw new Exception("æ°æ®ç±»åä¸å¹é
"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åè¿æ»¤æ¡ä»¶ |
| | | */ |
| | | private String getFilter(String dircode, String type) { |
| | | dircode = StringHelper.isEmpty(dircode) ? "" : StringHelper.getRightLike(dircode); |
| | | |
| | | List<String> list = null; |
| | | switch (type) { |
| | | case "DOM": |
| | | list = publishService.selectCodesForDir(dircode, 0); |
| | | break; |
| | | case "DEM": |
| | | list = publishService.selectCodesForDir(dircode, 1); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | | if (null == list || list.isEmpty()) { |
| | | return ""; |
| | | } |
| | | |
| | | for (int i = 0, c = list.size(); i < c; i++) { |
| | | list.set(i, "'" + list.get(i) + "'"); |
| | | } |
| | | |
| | | return " and dircode not in (" + StringHelper.join(list, ",") + ")"; |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "å页æ¥è¯¢å¹¶è¿åè®°å½æ°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "name", value = "åç§°", dataType = "String", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "dircode", value = "ç®å½", dataType = "String", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "type", value = "ç±»å«", dataType = "String", paramType = "query", example = ""), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯é¡µæ¡æ°", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "å页æ°ï¼ä»1å¼å§ï¼", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectByPageAndCount") |
| | | public ResponseMsg<List<PublishEntity>> selectByPageAndCount(String name, Integer pageSize, Integer pageIndex) { |
| | | public ResponseMsg<List<PublishEntity>> selectByPageAndCount(String name, String dircode, String type, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("æ¯é¡µé¡µæ°æå页æ°å°äº1", null); |
| | | } |
| | | type = getPubType(type); |
| | | |
| | | int count = publishService.selectCount(name); |
| | | int count = publishService.selectCount(name, dircode, type); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | |
| | | List<PublishEntity> rs = publishService.selectByPage(name, pageSize, pageSize * (pageIndex - 1)); |
| | | List<PublishEntity> rs = publishService.selectByPage(name, dircode, type, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·ååå¸ç±»å |
| | | */ |
| | | private String getPubType(String type) { |
| | | if (StringHelper.isEmpty(type)) { |
| | | return null; |
| | | } |
| | | |
| | | switch (type) { |
| | | case "DOM": |
| | | return "type = 'DOM'"; |
| | | case "DEM": |
| | | return "type = 'DEM'"; |
| | | case "MPT": |
| | | return "type = 'mpt'"; |
| | | case "3DML": |
| | | return "type = '3dml'"; |
| | | case "CPT": |
| | | return "type = 'cpt'"; |
| | | case "BIM": |
| | | return "type in ('ifc', 'fbx', 'rvt')"; |
| | | case "LAS": |
| | | return "type in ('las', 'laz')"; |
| | | case "OSGB": |
| | | return "type = 'osgb'"; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | |
| | | PublishEntity entity = publishService.selectById(id); |
| | | |
| | | return success(entity); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢Lasæä»¶åæ ç³»ID") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ids", value = "å
æ°æ®IDéå", dataType = "Integer[]", paramType = "query", example = "10483,10481,10456,10285") |
| | | }) |
| | | @GetMapping(value = "/selectLasCs") |
| | | public ResponseMsg<Object> selectLasCs(Integer[] ids, HttpServletRequest req) { |
| | | try { |
| | | if (null == ids || ids.length == 0) { |
| | | return fail("å
æ°æ®IDéåä¸è½ä¸ºç©º"); |
| | | } |
| | | |
| | | PubEntity entity = new PubEntity(); |
| | | entity.setIds(Arrays.asList(ids)); |
| | | entity.setDircode("00"); |
| | | entity.setToken(WebHelper.getToken(req)); |
| | | |
| | | List<Integer> list = publishService.selectLasCs(entity, "/Convert/ReadLasCs", req); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | |
| | | entity.setToken(WebHelper.getToken(req)); |
| | | } |
| | | |
| | | permsService.clearLayerCache(); |
| | | String method = getConvertMethod(entity.getType()); |
| | | long count = publishService.postForPub(entity, method, req); |
| | | |
| | |
| | | return "/Convert/ToTerra"; |
| | | case "MPT": |
| | | case "3DML": |
| | | case "CPT": |
| | | return "/Convert/ToSG"; |
| | | case "BIM": |
| | | return "/Convert/ToTileset"; |
| | | case "LAS": |
| | | return "/Convert/ToLasByPy"; |
| | | case "OSGB": |
| | | return "/Convert/ToOsgb"; |
| | | default: |
| | | throw new Exception("æ°æ®ç±»åä¸å¹é
"); |
| | | } |
| | |
| | | if (ids == null || ids.isEmpty()) { |
| | | return fail("idæ°ç»ä¸è½ä¸ºç©º", -1); |
| | | } |
| | | |
| | | String strs = StringHelper.join(ids, ","); |
| | | List<PublishEntity> list = publishService.selectByIds(strs); |
| | | if (null == list || list.isEmpty()) { |
| | | return fail("æ²¡ææ¾å°è¦å é¤çæ°æ®", -1); |
| | | } |
| | | |
| | | // publishService.deleteFiles(list) |
| | | permsService.clearLayerCache(); |
| | | publishService.deleteFiles(ids, req); |
| | | |
| | | int count = publishService.deletes(ids, req); |
| | | |
| | |
| | | entity.setUpdateUser(ue.getId()); |
| | | } |
| | | |
| | | permsService.clearLayerCache(); |
| | | int count = publishService.update(entity); |
| | | |
| | | return success(count); |
| | |
| | | @GetMapping(value = "/selectFiles") |
| | | public ResponseMsg<List<MetaFileEntity>> selectFiles(String path) { |
| | | try { |
| | | List<MetaFileEntity> list = uploadService.selectFiles(path); |
| | | List<MetaFileEntity> list = uploadService.selectFiles(path, false); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | |
| | | @SysLog() |
| | | @ApiOperation(value = "æ¥è¯¢æ å°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "path", value = "è·¯å¾", dataType = "String", paramType = "query", example = "20230110010101"), |
| | | @ApiImplicitParam(name = "dirid", value = "ç®å½ID", dataType = "Integer", paramType = "query", example = "163"), |
| | | @ApiImplicitParam(name = "path", value = "è·¯å¾", dataType = "String", paramType = "query", example = "20230722"), |
| | | @ApiImplicitParam(name = "dirid", value = "ç®å½ID", dataType = "Integer", paramType = "query", example = "1"), |
| | | @ApiImplicitParam(name = "verid", value = "çæ¬ID", dataType = "Integer", paramType = "query", example = "0"), |
| | | @ApiImplicitParam(name = "epsgCode", value = "åæ ç¼ç ", dataType = "String", paramType = "query", example = "EPSG:4490") |
| | | }) |
| | |
| | | |
| | | public final static int ONE_HUNDRED_THOUSAND = 100000; |
| | | |
| | | public static final double D90 = 90.0; |
| | | |
| | | public static final double D100 = 100.0; |
| | | |
| | | public static final double D1024 = 1024.0; |
| | | |
| | | public static final double D1050 = 1050.0; |
| | |
| | | |
| | | public static final int I31 = 31; |
| | | |
| | | public static final int I50 = 50; |
| | | |
| | | public static final int I60 = 60; |
| | | |
| | | public static final int I90 = 90; |
| | | |
| | | public static final int I90_NEG = -90; |
| | | |
| | | public final static int I100 = 100; |
| | | |
| | | public static final int I120 = 120; |
| | | |
| | |
| | | public static final int I1000 = 1000; |
| | | |
| | | public static final int I2050 = 2050; |
| | | |
| | | public static final int I4326 = 4326; |
| | | |
| | | public static final int I4490 = 4490; |
| | | |
| | |
| | | */ |
| | | public final static String COMMA = ","; |
| | | |
| | | public final static String AK = "?ak="; |
| | | |
| | | public final static String REST_LAYER = "/v6/rest/"; |
| | | /** |
| | | * æ³¢æµªå· |
| | | */ |
| | | public final static String TILDE = "~"; |
| | | |
| | | /** |
| | | * åå¼å· |
| | |
| | | public final static String SINGLE_QUOTES = "'"; |
| | | |
| | | public final static String BBOREHOLE = "bborehole"; |
| | | |
| | | public final static String AK = "?ak="; |
| | | |
| | | public final static String REST_LAYER = "/v6/rest/"; |
| | | |
| | | public final static String TEXT_XML = "text/xml"; |
| | | |
| | |
| | | |
| | | public final static String SHP = ".shp"; |
| | | |
| | | public final static String NGDB = "gdb"; |
| | | |
| | | public final static String GDB = ".gdb"; |
| | | |
| | | public final static String JPG = ".jpg"; |
| | |
| | | public final static String TIF = ".tif"; |
| | | |
| | | public final static String TIFF = ".tiff"; |
| | | |
| | | public final static String LAS = ".las"; |
| | | |
| | | public final static String OSGB = ".osgb"; |
| | | |
| | | public static String ADMIN = "admin"; |
| | | |
| | |
| | | |
| | | public final static String MULTIPOLYGON = "MULTIPOLYGON"; |
| | | |
| | | public final static String MULTICURVE = "MULTICURVE"; |
| | | |
| | | public final static String COMPOUNDCURVE = "COMPOUNDCURVE"; |
| | | |
| | | public static final String NO_FILE = JSON.toJSONString(new ResponseMsg<String>(HttpStatus.NOT_FOUND, "æä»¶æ¾ä¸å°")); |
| | | |
| | | /** |
| | |
| | | /** |
| | | * TIFæä»¶æ©å±å |
| | | */ |
| | | public final static List<String> TIF_EXT = new ArrayList<>(Arrays.asList(".prj", ".tfw", ".tif.ovr", ".tif.aux.xml", ".tif.enp", ".tif.xml")); |
| | | public final static List<String> TIF_EXT = new ArrayList<>(Arrays.asList(".prj", ".tfw", ".aux", ".tif.ovr", ".tif.aux.xml", ".tif.xml")); |
| | | |
| | | /** |
| | | * TIFFæä»¶æ©å±å |
| | | */ |
| | | public final static List<String> TIFF_EXT = new ArrayList<>(Arrays.asList(".prj", ".tfw", ".tiff.ovr", ".tiff.aux.xml", ".tiff.enp", ".tiff.xml")); |
| | | public final static List<String> TIFF_EXT = new ArrayList<>(Arrays.asList(".prj", ".tfw", ".aux", ".tiff.ovr", ".tiff.aux.xml", ".tiff.xml")); |
| | | |
| | | /** |
| | | * SHPæä»¶æ©å±å |
| | |
| | | /** |
| | | * Mapperæé¤æ©å±å |
| | | */ |
| | | public final static List<String> MAPPER_EXCLUDE_EXT = new ArrayList<>(Arrays.asList(".img.aux.xml", ".img.xml", ".tif.aux.xml", ".tif.xml", ".tiff.aux.xml", ".tiff.xml", ".shp.xml")); |
| | | public final static List<String> MAPPER_EXCLUDE_EXT = new ArrayList<>(Arrays.asList(".jpg.aux.xml", ".jpg.xml", ".img.aux.xml", ".img.xml", ".tif.aux.xml", ".tif.xml", ".tiff.aux.xml", ".tiff.xml", ".shp.xml")); |
| | | |
| | | /** |
| | | * æææä»¶æ©å±å |
| | |
| | | |
| | | private String depcode; |
| | | |
| | | private List<String> ids; |
| | | private List<Integer> ids; |
| | | |
| | | private List<Integer> models; |
| | | |
| | | private List<Integer> srids; |
| | | |
| | | private List<Double> zs; |
| | | |
| | | public String getType() { |
| | | return type; |
| | |
| | | this.depcode = depcode; |
| | | } |
| | | |
| | | public List<String> getIds() { |
| | | public List<Integer> getIds() { |
| | | return ids; |
| | | } |
| | | |
| | | public void setIds(List<String> ids) { |
| | | public void setIds(List<Integer> ids) { |
| | | this.ids = ids; |
| | | } |
| | | |
| | | public List<Integer> getModels() { |
| | | return models; |
| | | } |
| | | |
| | | public void setModels(List<Integer> models) { |
| | | this.models = models; |
| | | } |
| | | |
| | | public List<Integer> getSrids() { |
| | | return srids; |
| | | } |
| | | |
| | | public void setSrids(List<Integer> srids) { |
| | | this.srids = srids; |
| | | } |
| | | |
| | | public List<Double> getZs() { |
| | | return zs; |
| | | } |
| | | |
| | | public void setZs(List<Double> zs) { |
| | | this.zs = zs; |
| | | } |
| | | } |
| | |
| | | |
| | | private int rows; |
| | | |
| | | private int records; |
| | | |
| | | private String msg; |
| | | |
| | | private Boolean isMeta; |
| | |
| | | this.rows = rows; |
| | | } |
| | | |
| | | public int getRecords() { |
| | | return records; |
| | | } |
| | | |
| | | public void setRecords(int records) { |
| | | this.records = records; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | |
| | | /** |
| | | * æ ¹æ®è·¯å¾è·åæä»¶ |
| | | */ |
| | | public static void getFilesByPath(List<File> list, String path) { |
| | | public static void getFilesByPath(List<String> list, String path) { |
| | | File file = new File(path); |
| | | if (file.isDirectory()) { |
| | | File[] files = file.listFiles(); |
| | |
| | | if (f.isDirectory()) { |
| | | getFilesByPath(list, f.getPath()); |
| | | } else { |
| | | list.add(f); |
| | | list.add(f.getPath()); |
| | | } |
| | | } |
| | | } else { |
| | | list.add(file); |
| | | list.add(file.getPath()); |
| | | } |
| | | } |
| | | |
| | |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.gdal.ogr.*; |
| | | import org.gdal.osr.CoordinateTransformation; |
| | | import org.gdal.osr.SpatialReference; |
| | | import org.gdal.osr.osr; |
| | | |
| | | import java.lang.reflect.Field; |
| | | import java.math.BigDecimal; |
| | |
| | | /** |
| | | * è¯»åæ°æ® |
| | | */ |
| | | public static <T> List<T> readData(Class clazz, String filePath, String layerName) { |
| | | public static <T> List<T> readData(Class clazz, String filePath, String layerName, boolean isTransform) { |
| | | List<T> list = new ArrayList<>(); |
| | | |
| | | Driver driver = null; |
| | |
| | | for (int i = 0, count = dataSource.GetLayerCount(); i < count; i++) { |
| | | Layer layer = dataSource.GetLayer(i); |
| | | if (layer.GetName().equals(layerName)) { |
| | | GdbHelper.readLayer(clazz, layer, list); |
| | | GdbHelper.readLayer(clazz, layer, list, isTransform); |
| | | break; |
| | | } |
| | | |
| | |
| | | /** |
| | | * 读åå¾å± |
| | | */ |
| | | public static <T> void readLayer(Class clazz, Layer layer, List<T> list) { |
| | | public static <T> void readLayer(Class clazz, Layer layer, List<T> list, boolean isTransform) { |
| | | try { |
| | | Field gField = getGeomField(clazz); |
| | | |
| | |
| | | return; |
| | | } |
| | | |
| | | CoordinateTransformation ct = getCoordinateTransformation(layer, isTransform); |
| | | |
| | | do { |
| | | Feature f = layer.GetNextFeature(); |
| | | if (null == f) { |
| | |
| | | } |
| | | |
| | | T t = (T) clazz.newInstance(); |
| | | readFeature(t, f, map, gField); |
| | | readFeature(t, f, map, gField, ct); |
| | | list.add(t); |
| | | } while (true); |
| | | } catch (Exception ex) { |
| | |
| | | } finally { |
| | | GdbHelper.delete(layer); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·ååæ è½¬æ¢å¨ |
| | | */ |
| | | private static CoordinateTransformation getCoordinateTransformation(Layer layer, boolean isTransform) { |
| | | if (!isTransform) { |
| | | return null; |
| | | } |
| | | |
| | | String epsg = layer.GetSpatialRef().GetAttrValue("AUTHORITY", 1); |
| | | if (StringHelper.isEmpty(epsg)) { |
| | | return null; |
| | | } |
| | | |
| | | int epsgId = Integer.parseInt(epsg); |
| | | if (StaticData.I4326 == epsgId || StaticData.I4490 == epsgId) { |
| | | return null; |
| | | } |
| | | |
| | | SpatialReference srTarget = new SpatialReference(); |
| | | srTarget.ImportFromEPSG(StaticData.I4490); |
| | | |
| | | layer.GetSpatialRef().SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER); |
| | | srTarget.SetAxisMappingStrategy(osr.OAMS_TRADITIONAL_GIS_ORDER); |
| | | |
| | | return CoordinateTransformation.CreateCoordinateTransformation(layer.GetSpatialRef(), srTarget); |
| | | } |
| | | |
| | | /** |
| | |
| | | try { |
| | | FeatureDefn fd = layer.GetLayerDefn(); |
| | | for (int i = 0, count = fd.GetFieldCount(); i < count; i++) { |
| | | FieldDefn fieldDefn = fd.GetFieldDefn(i); |
| | | try { |
| | | String name = fieldDefn.GetName().toLowerCase(); |
| | | String name = fd.GetFieldDefn(i).GetName().toLowerCase(); |
| | | if (StaticData.READ_EXCLUDE_FIELDS.contains(name)) { |
| | | continue; |
| | | } |
| | | |
| | | Field field = clazz.getDeclaredField(name); |
| | | Field field = clazz.getDeclaredField("gbcode".equals(name) ? "gb" : name); |
| | | field.setAccessible(true); |
| | | |
| | | map.put(i, field); |
| | |
| | | getFieldMapper(clazz.getSuperclass(), layer, map); |
| | | } |
| | | } catch (Exception ex) { |
| | | // |
| | | log.error(ex); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 读åFeature |
| | | */ |
| | | private static <T> void readFeature(T t, Feature f, Map<Integer, Field> map, Field gField) { |
| | | private static <T> void readFeature(T t, Feature f, Map<Integer, Field> map, Field gField, CoordinateTransformation ct) { |
| | | for (Integer i : map.keySet()) { |
| | | try { |
| | | Field field = map.get(i); |
| | |
| | | } |
| | | |
| | | if (null != gField) { |
| | | setGeom(t, f, gField); |
| | | setGeom(t, gField, f.GetGeometryRef(), ct); |
| | | } |
| | | } |
| | | |
| | |
| | | * wkbNone = 100, |
| | | * wkbLinearRing = 101 |
| | | */ |
| | | private static <T> void setGeom(T t, Feature f, Field gField) { |
| | | private static <T> void setGeom(T t, Field gField, Geometry geometry, CoordinateTransformation ct) { |
| | | try { |
| | | String geo = "null"; |
| | | if (null != f.GetGeometryRef()) { |
| | | String wkt = f.GetGeometryRef().ExportToWkt(); |
| | | // f.GetGeometryRef().GetGeometryType() |
| | | if (null == geometry) { |
| | | gField.set(t, "null"); |
| | | return; |
| | | } |
| | | if (null != ct) { |
| | | int flag = geometry.Transform(ct); |
| | | } |
| | | |
| | | String wkt = geometry.ExportToWkt(); |
| | | if (wkt.contains(StaticData.LINESTRING) && !wkt.contains(StaticData.MULTILINESTRING)) { |
| | | wkt = wkt.replace("LINESTRING (", "MULTILINESTRING ((") + ")"; |
| | | } |
| | |
| | | wkt = wkt.replace("POLYGON (", "MULTIPOLYGON ((") + ")"; |
| | | } |
| | | wkt = wkt.replace(" 0,", ",").replace(" 0)", ")"); |
| | | |
| | | geo = String.format("ST_GeomFromText('%s')", wkt); |
| | | if (wkt.contains(StaticData.MULTICURVE)) { |
| | | wkt = wkt.replace("MULTICURVE (", "MULTILINESTRING (").replace("CIRCULARSTRING ", ""); |
| | | if (wkt.contains(StaticData.COMPOUNDCURVE)) { |
| | | wkt = wkt.replace("COMPOUNDCURVE (", "").replace(")))", "))"); |
| | | } |
| | | } |
| | | |
| | | gField.set(t, geo); |
| | | gField.set(t, String.format("ST_GeomFromText('%s')", wkt)); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | |
| | | for (int i = 0, count = dataSource.GetLayerCount(); i < count; i++) { |
| | | Layer layer = dataSource.GetLayer(i); |
| | | if (layer.GetName().equals(layerName)) { |
| | | GdbHelper.readLayer(clazz, layer, list); |
| | | GdbHelper.readLayer(clazz, layer, list, true); |
| | | break; |
| | | } |
| | | |
| | |
| | | |
| | | import com.moon.server.config.PropertiesConfig; |
| | | import com.moon.server.entity.all.SettingData; |
| | | import com.moon.server.entity.all.StaticData; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private static int downloadPath = 1; |
| | | |
| | | private static int uploadPath = 1; |
| | | |
| | | private final static double D90 = 90; |
| | | |
| | | private final static Log log = LogFactory.getLog(PathHelper.class); |
| | | |
| | |
| | | public void deleteOldPath(String tempPath) { |
| | | try { |
| | | double ran = Math.random() * 99; |
| | | if (ran < D90) { |
| | | if (ran < StaticData.D90) { |
| | | return; |
| | | } |
| | | |
| | |
| | | /** |
| | | * è¯»åæ°æ® |
| | | */ |
| | | public static <T> List<T> readData(Class clazz, String filePath) { |
| | | public static <T> List<T> readData(Class clazz, String filePath, boolean isTransform) { |
| | | List<T> list = new ArrayList<>(); |
| | | |
| | | Driver driver = null; |
| | |
| | | } |
| | | |
| | | Layer layer = dataSource.GetLayer(0); |
| | | GdbHelper.readLayer(clazz, layer, list); |
| | | GdbHelper.readLayer(clazz, layer, list, isTransform); |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | } finally { |
| | |
| | | import com.moon.server.entity.all.StaticData; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | |
| | | |
| | | return sb.toString(); |
| | | } |
| | | |
| | | /** |
| | | * åç¬¦ä¸²è½¬æ´æ°éå |
| | | */ |
| | | public static List<Integer> strToIntegers(String str) { |
| | | if (StringHelper.isEmpty(str)) { |
| | | return null; |
| | | } |
| | | |
| | | List<Integer> list = new ArrayList<>(); |
| | | for (String s : str.split(StaticData.COMMA)) { |
| | | list.add(Integer.parseInt(s)); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | } |
| | |
| | | * æ ¹æ®è¡¨åæ¥è¯¢è®°å½æ° |
| | | * |
| | | * @param tab 表å |
| | | * @param typesFilter ç±»å« |
| | | * @param field åæ®µ |
| | | * @return |
| | | */ |
| | | public Integer selectTabsForCount(String tab, String field); |
| | | public Integer selectTabsForCount(String tab, String typesFilter, String field); |
| | | |
| | | /** |
| | | * æ ¹æ®è¡¨åå页æ¥è¯¢ |
| | | * |
| | | * @param tab 表å |
| | | * @param typesFilter ç±»å« |
| | | * @param field åæ®µ |
| | | * @param filters è¿æ»¤æ¡ä»¶ |
| | | * @param limit è®°å½æ° |
| | | * @param offset åç§»é |
| | | * @return |
| | | */ |
| | | public List<TabEntity> selectTabsByPage(String tab, String field, String filters, Integer limit, Integer offset); |
| | | public List<TabEntity> selectTabsByPage(String tab, String typesFilter, String field, String filters, Integer limit, Integer offset); |
| | | |
| | | /** |
| | | * æ¥è¯¢åæ®µä¿¡æ¯ |
| | |
| | | public List<MetaEntity> selectByPage(String depcode, String dircode, Integer verid, String name, Integer limit, Integer offset); |
| | | |
| | | /** |
| | | * æ ¹æ®GUIDæ¥è¯¢GDB |
| | | * |
| | | * @param guid |
| | | * @return |
| | | */ |
| | | public List<MetaEntity> selectGdbByGuid(String guid); |
| | | |
| | | /** |
| | | * æ¥è¯¢è®°å½æ° |
| | | * |
| | | * @param depcode |
| | |
| | | * æ¥è¯¢è®°å½æ° |
| | | * |
| | | * @param name åç§° |
| | | * @param dircode ç®å½ç¼ç |
| | | * @param type ç±»å« |
| | | * @return è®°å½æ° |
| | | */ |
| | | public Integer selectCount(String name); |
| | | public Integer selectCount(String name, String dircode, String type); |
| | | |
| | | /** |
| | | * å页æ¥è¯¢ |
| | | * |
| | | * @param name åç§° |
| | | * @param dircode ç®å½ç¼ç |
| | | * @param type ç±»å« |
| | | * @param limit è®°å½æ° |
| | | * @param offset åç§»é |
| | | * @return å表 |
| | | */ |
| | | public List<PublishEntity> selectByPage(String name, Integer limit, Integer offset); |
| | | public List<PublishEntity> selectByPage(String name, String dircode, String type, Integer limit, Integer offset); |
| | | |
| | | /** |
| | | * æ¥è¯¢ææ |
| | |
| | | public List<PublishEntity> selectByIds(String ids); |
| | | |
| | | /** |
| | | * æ ¹æ®ç®å½æ¥è¯¢DOMåDEMçç¼ç |
| | | * |
| | | * @param dircode ç®å½ |
| | | * @param isDom 1-DOMï¼0-DEM |
| | | * @return |
| | | */ |
| | | public List<String> selectCodesForDir(String dircode, Integer isDom); |
| | | |
| | | /** |
| | | * æå
¥ä¸æ¡ |
| | | * |
| | | * @param entity |
| | |
| | | public List<CountEntity> countSizes(); |
| | | |
| | | /** |
| | | * ææä»¶ç±»åç»è®¡ |
| | | * |
| | | * @return |
| | | */ |
| | | public List<CountEntity> countSizesByType(); |
| | | |
| | | /** |
| | | * æå¡è°ç¨éç»è®¡ |
| | | * |
| | | * @return |
| | |
| | | * @return |
| | | */ |
| | | public List<CountEntity> countOperates(); |
| | | |
| | | /** |
| | | * æé¡¹ç®ç»è®¡æ°æ® |
| | | * |
| | | * @return |
| | | */ |
| | | public List<CountEntity> countSizesByPrj(); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectTabsForCount(String tab, String field) { |
| | | public Integer selectTabsForCount(String tab, String typesFilter, String field) { |
| | | tab = StringHelper.getLikeUpperStr(tab); |
| | | |
| | | return baseQueryMapper.selectTabsForCount(tab, field); |
| | | return baseQueryMapper.selectTabsForCount(tab, typesFilter, field); |
| | | } |
| | | |
| | | @Override |
| | | public List<TabEntity> selectTabsByPage(String tab, String field, String filters, Integer limit, Integer offset) { |
| | | public List<TabEntity> selectTabsByPage(String tab, String typesFilter, String field, String filters, Integer limit, Integer offset) { |
| | | tab = StringHelper.getLikeUpperStr(tab); |
| | | |
| | | return baseQueryMapper.selectTabsByPage(tab, field, filters, limit, offset); |
| | | return baseQueryMapper.selectTabsByPage(tab, typesFilter, field, filters, limit, offset); |
| | | } |
| | | |
| | | @Override |
| | |
| | | /** |
| | | * æ¥è¯¢æä»¶ |
| | | */ |
| | | public List<MetaFileEntity> selectFiles(String subPath) { |
| | | public List<MetaFileEntity> selectFiles(String subPath, boolean hasMd5) { |
| | | String root = pathHelper.getConfig().getTempPath() + File.separator + subPath; |
| | | |
| | | File file = new File(root); |
| | |
| | | for (File f : files) { |
| | | String fileName = FileHelper.getFileName(f.getPath()); |
| | | String extName = FileHelper.getExtension(fileName); |
| | | if (!isExtValid(extName)) { |
| | | if (!isFileValid(f.getName())) { |
| | | continue; |
| | | } |
| | | |
| | |
| | | mf.setExtName(extName); |
| | | mf.setSizes(FileHelper.sizeToMb(f.length())); |
| | | mf.setPath(subPath + File.separator + fileName); |
| | | if (!StaticData.ZIP.equals(extName)) { |
| | | if (hasMd5 && !StaticData.ZIP.equals(extName)) { |
| | | mf.setGuid(FileHelper.getFileMd5(f.getPath())); |
| | | } |
| | | |
| | |
| | | * æ¥è¯¢æ å° |
| | | */ |
| | | public List<MetaFileEntity> selectMappers(UserEntity ue, String path, DirEntity dir, VerEntity ver, String epsgCode) { |
| | | List<MetaFileEntity> metas = selectFiles(path); |
| | | List<MetaFileEntity> metas = selectFiles(path, true); |
| | | if (null == metas || metas.isEmpty()) { |
| | | return null; |
| | | } |
| | |
| | | private void getFilesByPath(List<File> list, String path) { |
| | | File file = new File(path); |
| | | if (!file.isDirectory()) { |
| | | String extName = FileHelper.getExtension(file); |
| | | if (isExtValid(extName)) { |
| | | if (isFileValid(file.getName())) { |
| | | list.add(file); |
| | | } |
| | | return; |
| | | } |
| | | |
| | | if (isGdbFile(file)) { |
| | | if (isGdbFile(file) || isOsgbFile(file)) { |
| | | list.add(file); |
| | | return; |
| | | } |
| | |
| | | if (f.isDirectory()) { |
| | | getFilesByPath(list, f.getPath()); |
| | | } else { |
| | | String extName = FileHelper.getExtension(f); |
| | | if (isExtValid(extName)) { |
| | | if (isFileValid(f.getName())) { |
| | | list.add(f); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | /** |
| | | * æ©å±æ¯å¦ææ |
| | | * æä»¶æ¯/妿æ |
| | | */ |
| | | private boolean isExtValid(String extName) { |
| | | return StaticData.ALL_EXTENSION.contains(extName) && !StaticData.MAPPER_EXCLUDE_EXT.contains(extName); |
| | | private boolean isFileValid(String fileName) { |
| | | String extName = FileHelper.getExtension(fileName); |
| | | if (fileName.startsWith(StaticData.TILDE) || !StaticData.ALL_EXTENSION.contains(extName)) { |
| | | return false; |
| | | } |
| | | |
| | | fileName = fileName.toLowerCase(); |
| | | for (String ext : StaticData.MAPPER_EXCLUDE_EXT) { |
| | | if (fileName.contains(ext)) { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | |
| | | List<MetaFileEntity> list = new ArrayList<>(); |
| | | for (File f : files) { |
| | | boolean isGdb = isGdbFile(f); |
| | | if (!isGdb && f.isDirectory()) { |
| | | boolean isOsgb = isOsgbFile(f); |
| | | boolean isFile = isGdb || isOsgb; |
| | | if (f.isDirectory() && !isFile) { |
| | | continue; |
| | | } |
| | | |
| | | String fileName = FileHelper.getFileName(f.getPath()); |
| | | String extName = FileHelper.getExtension(fileName); |
| | | if (!isExtValid(extName) || fileName.startsWith("~")) { |
| | | String extName = isOsgb ? StaticData.OSGB : FileHelper.getExtension(fileName); |
| | | if (!isFileValid(f.getName())) { |
| | | continue; |
| | | } |
| | | |
| | | String dircode = getDirByPath(f.getPath(), fileName, dir, dirs); |
| | | boolean isShp = StaticData.SHP.equals(extName); |
| | | if (isGdb) { |
| | | List<MetaFileEntity> rs = getGdbMappers(f, meta, dircode, start); |
| | | if (null != rs && rs.size() > 0) { |
| | |
| | | } |
| | | continue; |
| | | } |
| | | if (isOsgb) { |
| | | list.add(getOsgbMapper(f, meta, dircode, start)); |
| | | continue; |
| | | } |
| | | |
| | | MetaFileEntity mf = createMetaFileEntity(f, meta, fileName, extName); |
| | | mf.setPath(f.getPath().substring(start)); |
| | | mf.setDircode(dircode); |
| | | list.add(mf); |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * å建å
æ°æ®æä»¶å®ä½ç±» |
| | | */ |
| | | private MetaFileEntity createMetaFileEntity(File f, MetaFileEntity meta, String fileName, String extName) { |
| | | boolean isShp = StaticData.SHP.equals(extName); |
| | | |
| | | MetaFileEntity mf = createMetaFileEntity(meta); |
| | | mf.setDircode(dircode); |
| | | mf.setEventid(StringHelper.getGuid()); |
| | | mf.setName(fileName); |
| | | mf.setExtName(extName); |
| | | mf.setPath(f.getPath().substring(start)); |
| | | |
| | | if (isShp) { |
| | | List<String> shpFiles = getShpFiles(f.getPath()); |
| | |
| | | mf.setSizes(FileHelper.sizeToMb(f.length())); |
| | | mf.setGuid(FileHelper.getFileMd5(f.getPath())); |
| | | } |
| | | list.add(mf); |
| | | } |
| | | |
| | | return list; |
| | | return mf; |
| | | } |
| | | |
| | | /** |
| | |
| | | MetaFileEntity mf = createMetaFileEntity(meta); |
| | | mf.setDircode(dircode); |
| | | mf.setEventid(StringHelper.getGuid()); |
| | | mf.setName(fileName); |
| | | mf.setName(fileName + "\\" + tab); |
| | | mf.setExtName(extName); |
| | | mf.setSizes(FileHelper.sizeToMb(f.length())); |
| | | mf.setPath(f.getPath().substring(start)); |
| | |
| | | */ |
| | | private boolean isGdbFile(File f) { |
| | | if (f.isDirectory() && f.getName().toLowerCase().endsWith(StaticData.GDB)) { |
| | | File[] files = f.listFiles(); |
| | | if (null == files || files.length == 0) { |
| | | return false; |
| | | } |
| | | File gdb = new File(f.getPath() + File.separator + "gdb"); |
| | | |
| | | for (File file : files) { |
| | | if ("gdb".equals(file.getName())) { |
| | | return true; |
| | | } |
| | | } |
| | | return gdb.exists() && !gdb.isDirectory(); |
| | | } |
| | | |
| | | return false; |
| | |
| | | } |
| | | |
| | | /** |
| | | * æ¯/å¦ä¸ºOSGBæä»¶ |
| | | */ |
| | | private boolean isOsgbFile(File f) { |
| | | if (f.isDirectory()) { |
| | | File meta = new File(f.getPath() + File.separator + "metadata.xml"); |
| | | File data = new File(f.getPath() + File.separator + "Data"); |
| | | |
| | | return meta.exists() && !meta.isDirectory() && data.exists() && data.isDirectory(); |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * è·åOSGBæä»¶æ å° |
| | | */ |
| | | private MetaFileEntity getOsgbMapper(File f, MetaFileEntity meta, String dircode, int start) { |
| | | String fileName = FileHelper.getFileName(f.getPath()); |
| | | |
| | | List<String> files = new ArrayList<>(); |
| | | FileHelper.getFilesByPath(files, f.getPath()); |
| | | |
| | | String md5 = getFilesMd5(files); |
| | | double sizes = getFilesSize(files); |
| | | |
| | | MetaFileEntity mf = createMetaFileEntity(meta); |
| | | mf.setDircode(dircode); |
| | | mf.setEventid(StringHelper.getGuid()); |
| | | mf.setName(fileName); |
| | | mf.setExtName(StaticData.OSGB); |
| | | mf.setSizes(FileHelper.sizeToMb(f.length())); |
| | | mf.setPath(f.getPath().substring(start)); |
| | | mf.setSizes(sizes); |
| | | mf.setGuid(md5); |
| | | |
| | | return mf; |
| | | } |
| | | |
| | | /** |
| | | * è·ååæ° * |
| | | * Enumeration<String> headers = req.getHeaderNames(); |
| | | * Enumeration<String> attributes = req.getAttributeNames(); |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.moon.server.controller.all.BaseController; |
| | | import com.moon.server.entity.all.ResponseMsg; |
| | | import com.moon.server.entity.all.SettingData; |
| | | import com.moon.server.entity.all.*; |
| | | import com.moon.server.entity.ctrl.KeyValueEntity; |
| | | import com.moon.server.entity.data.DownloadEntity; |
| | | import com.moon.server.entity.data.MetaEntity; |
| | | import com.moon.server.entity.data.MetaFileEntity; |
| | | import com.moon.server.entity.sys.AttachEntity; |
| | | import com.moon.server.entity.sys.UserEntity; |
| | | import com.moon.server.helper.*; |
| | | import com.moon.server.mapper.all.BasicMapper; |
| | | import com.moon.server.mapper.data.DownloadMapper; |
| | | import com.moon.server.service.sys.AttachService; |
| | | import com.moon.server.entity.all.BaseEntity; |
| | | import com.moon.server.entity.all.StaticData; |
| | | import com.moon.server.helper.*; |
| | | import net.lingala.zip4j.ZipFile; |
| | | import net.lingala.zip4j.model.FileHeader; |
| | | import net.lingala.zip4j.model.ZipParameters; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<MetaEntity> selectGdbByGuid(String guid) { |
| | | return metaMapper.selectGdbByGuid(guid); |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectMetasForCount(String depcode, String dirs, String name) { |
| | | depcode = StringHelper.getRightLike(depcode); |
| | | name = StringHelper.getLikeUpperStr(name); |
| | |
| | | } |
| | | if (str.contains("bs.s_explorationpoint ")) { |
| | | list.add(str.replace("bs.s_explorationpoint ", "bs.s_surveyworksite ")); |
| | | } |
| | | if (str.contains("bs.m_surface_deformation_data ")) { |
| | | list.add(str.replace("bs.m_surface_deformation_data ", "bs.m_surface_deformation_data_date ")); |
| | | } |
| | | |
| | | i++; |
| | |
| | | addMultiFile(uploadPath, mf, zip, params, StaticData.SHP_EXT); |
| | | break; |
| | | case StaticData.GDB: |
| | | continue; |
| | | case StaticData.OSGB: |
| | | addFolderFile(uploadPath, mf, zip, params); |
| | | break; |
| | | default: |
| | |
| | | import com.moon.server.entity.ctrl.RegisterEntity; |
| | | import com.moon.server.entity.data.MetaEntity; |
| | | import com.moon.server.entity.data.PublishEntity; |
| | | import com.moon.server.entity.sys.UserEntity; |
| | | import com.moon.server.helper.PathHelper; |
| | | import com.moon.server.helper.RestHelper; |
| | | import com.moon.server.helper.StringHelper; |
| | | import com.moon.server.helper.WebHelper; |
| | | import com.moon.server.mapper.data.PublishMapper; |
| | | import com.moon.server.service.sys.TokenService; |
| | | import org.apache.commons.logging.Log; |
| | | import org.apache.commons.logging.LogFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.File; |
| | | import java.lang.reflect.Field; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | @Value("${sys.iisHost}") |
| | | private String iisHost; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | PublishMapper publishMapper; |
| | | |
| | | @Autowired |
| | | @Resource |
| | | FmeService fmeService; |
| | | |
| | | @Resource |
| | | PathHelper pathHelper; |
| | | |
| | | @Resource |
| | | TokenService tokenService; |
| | | |
| | | private final static Log log = LogFactory.getLog(PublishService.class); |
| | | |
| | | @Override |
| | | public Integer selectCount(String name) { |
| | | public Integer selectCount(String name, String dircode, String type) { |
| | | name = StringHelper.getLikeUpperStr(name); |
| | | dircode = StringHelper.getRightLike(dircode); |
| | | |
| | | return publishMapper.selectCount(name); |
| | | return publishMapper.selectCount(name, dircode, type); |
| | | } |
| | | |
| | | @Override |
| | | public List<PublishEntity> selectByPage(String name, Integer limit, Integer offset) { |
| | | public List<PublishEntity> selectByPage(String name, String dircode, String type, Integer limit, Integer offset) { |
| | | name = StringHelper.getLikeUpperStr(name); |
| | | dircode = StringHelper.getRightLike(dircode); |
| | | |
| | | return publishMapper.selectByPage(name, limit, offset); |
| | | return publishMapper.selectByPage(name, dircode, type, limit, offset); |
| | | } |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public List<PublishEntity> selectByIds(String ids) { |
| | | return publishMapper.selectByIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public List<String> selectCodesForDir(String dircode, Integer isDom) { |
| | | return publishMapper.selectCodesForDir(dircode, isDom); |
| | | } |
| | | |
| | | @Override |
| | |
| | | name = StringHelper.getLikeUpperStr(name); |
| | | |
| | | return publishMapper.selectMetasByPage(depcode, dircode, verid, types, name, limit, offset); |
| | | } |
| | | |
| | | public List<Integer> selectLasCs(PubEntity entity, String method, HttpServletRequest req) { |
| | | Map<String, Object> map = getMapData(entity); |
| | | |
| | | String str = RestHelper.postForRest(exportServer + method, map); |
| | | if (StringHelper.isEmpty(str)) { |
| | | return null; |
| | | } |
| | | |
| | | ResponseMsg<String> msg = JSON.parseObject(str, ResponseMsg.class); |
| | | if (msg == null || msg.getCode() != StaticData.TWO_HUNDRED) { |
| | | return null; |
| | | } |
| | | |
| | | String rs = msg.getResult(); |
| | | if (StringHelper.isEmpty(rs)) { |
| | | return null; |
| | | } |
| | | |
| | | return StringHelper.strToIntegers(rs); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | |
| | | for (PublishEntity entity : list) { |
| | | // é¿å
é夿³¨å |
| | | if (null != entity.getUpdateTime()) { |
| | | continue; |
| | | } |
| | | |
| | | String url = entity.getUrl().replace("{host}", iisHost); |
| | | String type = getServerType(entity); |
| | | |
| | |
| | | return "ä¸ç»´å°å½¢æå¡"; |
| | | case "mpt": |
| | | return "ä¸ç»´åºæ¯æå¡"; |
| | | case "las": |
| | | case "laz": |
| | | case "cpt": |
| | | return "ä¸ç»´ç¹äºæå¡"; |
| | | default: |
| | | return "ä¸ç»´æ¨¡åæå¡"; |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å é¤å叿件 |
| | | */ |
| | | public void deleteFiles(List<PublishEntity> list) { |
| | | String lfData = pathHelper.getConfig().getLfData(); |
| | | for (PublishEntity pub : list) { |
| | | if (null != pub.getUrl() && pub.getUrl().contains("/SG/")) { |
| | | continue; |
| | | } |
| | | |
| | | String path = lfData + pub.getPath().replace("\\tileset.json", ""); |
| | | File file = new File(path); |
| | | if (!file.exists() || !file.isDirectory()) { |
| | | continue; |
| | | } |
| | | |
| | | String cmd = String.format("cmd /c rd \"%s\" /s /q", path); |
| | | WebHelper.exec(cmd); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * å é¤å叿件 |
| | | */ |
| | | public void deleteFiles(List<Integer> ids, HttpServletRequest req) { |
| | | PubEntity entity = new PubEntity(); |
| | | entity.setIds(ids); |
| | | entity.setDircode("00"); |
| | | |
| | | UserEntity ue = tokenService.getCurrentUser(req); |
| | | if (ue != null) { |
| | | entity.setUserId(ue.getId()); |
| | | entity.setToken(WebHelper.getToken(req)); |
| | | } |
| | | |
| | | long rows = postForPub(entity, "/Convert/DeleteFiles"); |
| | | } |
| | | |
| | | /** |
| | | * åéåå¸è¯·æ± |
| | | */ |
| | | public long postForPub(PubEntity entity, String method) { |
| | | Map<String, Object> map = getMapData(entity); |
| | | |
| | | String str = RestHelper.postForRest(exportServer + method, map); |
| | | if (StringHelper.isEmpty(str)) { |
| | | return 0; |
| | | } |
| | | |
| | | ResponseMsg<String> msg = JSON.parseObject(str, ResponseMsg.class); |
| | | if (msg == null || msg.getCode() != StaticData.TWO_HUNDRED) { |
| | | return 0; |
| | | } |
| | | |
| | | return msg.getCount(); |
| | | } |
| | | } |
| | |
| | | package com.moon.server.service.data; |
| | | |
| | | import com.google.common.collect.Lists; |
| | | import com.moon.server.entity.all.BaseEntity; |
| | | import com.moon.server.entity.all.StaticData; |
| | | import com.moon.server.entity.data.*; |
| | | import com.moon.server.entity.sys.UserEntity; |
| | | import com.moon.server.helper.*; |
| | | import com.moon.server.mapper.all.BasicMapper; |
| | | import com.moon.server.mapper.data.UploadMapper; |
| | | import com.moon.server.service.all.BaseQueryService; |
| | | import com.moon.server.service.all.BaseUploadService; |
| | | import com.moon.server.service.sys.DepService; |
| | | import com.moon.server.entity.data.*; |
| | | import com.moon.server.helper.*; |
| | | import org.apache.commons.io.FileUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | File f = new File(mf.getPath()); |
| | | if (!f.exists()) { |
| | | mf.setMsg("æä»¶ä¸¢å¤±"); |
| | | } |
| | | if (f.exists() && StringHelper.isNull(mf.getGuid())) { |
| | | mf.setGuid(FileHelper.getFileMd5(f.getPath())); |
| | | } |
| | | |
| | | MetaEntity old = metaService.selectByGuid(mf.getGuid(), getDirCode(mf), null); |
| | |
| | | |
| | | List<?> list; |
| | | if (StaticData.SHP.equals(mf.getExtName())) { |
| | | list = ShpHelper.readData(clazz, mf.getPath()); |
| | | list = ShpHelper.readData(clazz, mf.getPath(), true); |
| | | } else { |
| | | list = GdbHelper.readData(clazz, mf.getPath(), mf.getTab()); |
| | | list = GdbHelper.readData(clazz, mf.getPath(), mf.getTab(), true); |
| | | } |
| | | if (null == list || list.isEmpty()) { |
| | | return; |
| | | } |
| | | mf.setRecords(list.size()); |
| | | setCreateInfo(list, mf); |
| | | |
| | | int rows = basicMapper.insertBatch(list); |
| | | int rows = batchInserts(basicMapper, list); |
| | | if (rows > 0) { |
| | | mf.setEntity(mf.getTab()); |
| | | mf.setTab(tabName); |
| | | mf.setRows(rows); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¹éæå
¥ |
| | | */ |
| | | private <T> int batchInserts(BasicMapper basicMapper, List<T> list) { |
| | | int rows = 0; |
| | | //int count = (int) Math.ceil(list.size() / StaticData.D100) |
| | | List<List<T>> subLists = Lists.partition(list, StaticData.I50); |
| | | for (List<T> sub : subLists) { |
| | | try { |
| | | rows += basicMapper.insertBatch(sub); |
| | | } catch (Exception ex) { |
| | | log.error(ex); |
| | | } |
| | | } |
| | | |
| | | return rows; |
| | | } |
| | | |
| | | /** |
| | |
| | | break; |
| | | case StaticData.SHP: |
| | | copyMultiFile(mf, StaticData.SHP_EXT); |
| | | break; |
| | | case StaticData.OSGB: |
| | | copyFolderFile(mf); |
| | | break; |
| | | case StaticData.GDB: |
| | | if (gdbList.contains(mf.getPath())) { |
| | |
| | | return; |
| | | } |
| | | |
| | | newFile.mkdirs(); |
| | | File[] files = file.listFiles(); |
| | | if (null == files || files.length == 0) { |
| | | return; |
| | | } |
| | | |
| | | for (File f : files) { |
| | | String subFile = targetPath + File.separator + FileHelper.getFileName(f.getPath()); |
| | | f.renameTo(new File(subFile)); |
| | | try { |
| | | // newFile.mkdirs() |
| | | FileUtils.moveDirectory(file, newFile); |
| | | } catch (Exception ex) { |
| | | log.error(ex); |
| | | } |
| | | mf.setPath(subPath); |
| | | } |
| | |
| | | */ |
| | | private void insertMetas(List<MetaFileEntity> list) { |
| | | int metaId = insertParentMeta(list); |
| | | |
| | | List<String> guids = new ArrayList<>(); |
| | | for (MetaFileEntity mf : list) { |
| | | if (null != mf.getMsg()) { |
| | | continue; |
| | | } |
| | | |
| | | MetaEntity me = createMeta(mf, metaId); |
| | | metaService.insert(me); |
| | | if (StaticData.NGDB.equals(me.getType())) { |
| | | if (guids.contains(me.getGuid())) { |
| | | me.setIsmeta((short)-1); |
| | | } else { |
| | | guids.add(me.getGuid()); |
| | | } |
| | | } |
| | | |
| | | mf.setMsg(me.getId() > 0 ? "æå" : "失败"); |
| | | metaService.insert(me); |
| | | String err = mf.getRows() < mf.getRecords() ? "(" + (mf.getRecords() - mf.getRows()) + " æ¡å¤±è´¥)" : ""; |
| | | mf.setMsg(me.getId() > 0 ? String.format("æå%s", err) : "失败"); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | List<String> list = codesAsList(codes); |
| | | removeDuplicate(list); |
| | | list = copeDirCodes(list); |
| | | setRightLike(list, field); |
| | | |
| | | return "(" + StringHelper.join(list, " or ") + ")"; |
| | |
| | | } |
| | | |
| | | /** |
| | | * å»é¤éå¤ |
| | | * å¤çç®å½ç¼ç |
| | | */ |
| | | private static void removeDuplicate(List<String> list) { |
| | | int i = 0; |
| | | while (i < list.size()) { |
| | | int j = findStr(list, i); |
| | | if (j > -1) { |
| | | list.remove(j); |
| | | continue; |
| | | private static List<String> copeDirCodes(List<String> list) { |
| | | List<String> prjList = getDirCodesByLen(list, 0, 2); |
| | | List<String> appList = getDirCodesByLen(list, 3, 30); |
| | | if (prjList.isEmpty() && appList.isEmpty()) { |
| | | return list; |
| | | } |
| | | if (prjList.isEmpty()) { |
| | | return appList; |
| | | } |
| | | if (appList.isEmpty()) { |
| | | return prjList; |
| | | } |
| | | |
| | | i++; |
| | | } |
| | | return filterCodes(prjList, appList); |
| | | } |
| | | |
| | | /** |
| | | * æ¥æ¾å符串 |
| | | * æ ¹æ®é¿åº¦è·ååä½ç¼ç |
| | | */ |
| | | private static int findStr(List<String> list, int i) { |
| | | String source = list.get(i); |
| | | for (int j = i + 1, c = list.size(); j < c; j++) { |
| | | if (list.get(j).startsWith(source)) { |
| | | return j; |
| | | private static List<String> getDirCodesByLen(List<String> list, int start, int end) { |
| | | List<String> rs = new ArrayList<>(); |
| | | for (String code : list) { |
| | | if (StringHelper.isEmpty(code)) { |
| | | continue; |
| | | } |
| | | |
| | | if (code.length() >= start && code.length() <= end) { |
| | | rs.add(code); |
| | | } |
| | | } |
| | | |
| | | return -1; |
| | | return rs; |
| | | } |
| | | |
| | | /** |
| | | * è¿æ»¤é¡¹ç®ç¼ç |
| | | */ |
| | | private static List<String> filterCodes(List<String> prjList, List<String> appList) { |
| | | int i = 0; |
| | | while (i < appList.size()) { |
| | | boolean flag = false; |
| | | for (String prj : prjList) { |
| | | if (appList.get(i).startsWith(prj)) { |
| | | flag = true; |
| | | break; |
| | | } |
| | | } |
| | | |
| | | if (!flag) { |
| | | appList.remove(i); |
| | | continue; |
| | | } |
| | | i++; |
| | | } |
| | | |
| | | return appList; |
| | | } |
| | | |
| | | /** |
| | | * 设置 å³like |
| | | */ |
| | | private static void setRightLike(List<String> list, String field) { |
| | | if (list.isEmpty()) { |
| | | list.add("1 = 2"); |
| | | return; |
| | | } |
| | | |
| | | for (int i = 0, c = list.size(); i < c; i++) { |
| | | String str = String.format("%s like '%s%%'", field, list.get(i)); |
| | | list.set(i, str); |
| | |
| | | * ç¦çè·¯å¾æ¯å¦åå¨ |
| | | */ |
| | | private boolean isTilePathExist(PublishEntity pub) { |
| | | String tilePath = pathHelper.getConfig().getTilePath().replace("2d\\tiles", "") + pub.getPath(); |
| | | String tilePath = pathHelper.getConfig().getTilePath() + pub.getPath(); |
| | | |
| | | File f = new File(tilePath); |
| | | if (!f.exists() || !f.isDirectory()) { |
| | |
| | | */ |
| | | private List<File> findTiles(DownloadTileEntity dt, PublishEntity pub) { |
| | | List<File> list = new ArrayList<>(); |
| | | |
| | | File view = new File(pub.getPath() + File.separator + "view.htm"); |
| | | if (view.exists() && !view.isDirectory()) { |
| | | list.add(view); |
| | | } |
| | | |
| | | for (int i = 0; i < StaticData.I23; i++) { |
| | | List<File> files = findTilesByZoom(dt, pub, i); |
| | | if (files.size() > 0) { |
| | |
| | | |
| | | // 9.è·åèµæºå®ä½ |
| | | ResEntity entity = getResEntity(ue, resId); |
| | | if (null == entity || StaticData.TWO != entity.getType() || StringHelper.isNull(entity.getProxy()) || StringHelper.isNull(entity.getUrl())) { |
| | | if (null == entity || StaticData.TWO != entity.getStatus() || StringHelper.isNull(entity.getProxy()) || StringHelper.isNull(entity.getUrl())) { |
| | | WebHelper.writeStr2Page(res, ILLEGAL_RESOURCE); |
| | | return; |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<CountEntity> countSizesByType() { |
| | | return reportMapper.countSizesByType(); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountEntity> countServices() { |
| | | return reportMapper.countServices(); |
| | | } |
| | |
| | | return reportMapper.countOperates(); |
| | | } |
| | | |
| | | @Override |
| | | public List<CountEntity> countSizesByPrj() { |
| | | return reportMapper.countSizesByPrj(); |
| | | } |
| | | |
| | | /** |
| | | * å建æ¥å |
| | | */ |
| | |
| | | <if test="tab != null"> |
| | | and upper(tab) like #{tab} or upper(tab_desc) like #{tab} |
| | | </if> |
| | | <if test="typesFilter != null"> |
| | | and (${typesFilter}) |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | <if test="tab != null"> |
| | | and (upper(tab) like #{tab} or upper(tab_desc) like #{tab}) |
| | | </if> |
| | | <if test="typesFilter != null"> |
| | | and (${typesFilter}) |
| | | </if> |
| | | </where> |
| | | order by id |
| | | limit #{limit} offset #{offset}; |
| | |
| | | <select id="selectCount" resultType="java.lang.Integer"> |
| | | select count(*) from lf.sys_meta |
| | | <where> |
| | | 1 = 1 |
| | | ismeta between 0 and 1 |
| | | <if test="depcode != null"> |
| | | and depcode like #{depcode} |
| | | </if> |
| | |
| | | select a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName |
| | | from lf.sys_meta a |
| | | <where> |
| | | 1 = 1 |
| | | ismeta between 0 and 1 |
| | | <if test="depcode != null"> |
| | | and depcode like #{depcode} |
| | | </if> |
| | |
| | | limit #{limit} offset #{offset} |
| | | </select> |
| | | |
| | | <select id="selectGdbByGuid" resultType="com.moon.server.entity.data.MetaEntity"> |
| | | select a.*,fn_uname(a.create_user) uname,fn_get_fullname(a.depcode, 1) depName,fn_ver(a.verid) verName,fn_get_fullname(a.dircode, 2) dirName |
| | | from lf.sys_meta a |
| | | where type = 'gdb' and guid = #{guid}; |
| | | </select> |
| | | |
| | | <select id="selectMetasForCount" resultType="java.lang.Integer"> |
| | | select count(*) from lf.sys_meta |
| | | <where> |
ÎļþÃû´Ó src/main/resources/mapper/show/PublishMapper.xml ÐÞ¸Ä |
| | |
| | | <select id="selectCount" resultType="java.lang.Integer"> |
| | | select count(*) from lf.sys_publish |
| | | <where> |
| | | 1 = 1 |
| | | <if test="name != null"> |
| | | upper(name) like #{name} |
| | | and upper(name) like #{name} |
| | | </if> |
| | | <if test="dircode != null"> |
| | | and dirid like #{dircode} |
| | | </if> |
| | | <if test="type != null"> |
| | | and ${type} |
| | | </if> |
| | | </where> |
| | | </select> |
| | |
| | | select ST_AsText(geom) "geom", a.*, fn_get_fullname(a.depid, 1) depName, fn_get_fullname(a.dirid, 2) dirName, fn_uname(create_user) createName, fn_uname(update_user) updateName |
| | | from lf.sys_publish a |
| | | <where> |
| | | 1 = 1 |
| | | <if test="name != null"> |
| | | upper(name) like #{name} |
| | | and upper(name) like #{name} |
| | | </if> |
| | | <if test="dircode != null"> |
| | | and dirid like #{dircode} |
| | | </if> |
| | | <if test="type != null"> |
| | | and ${type} |
| | | </if> |
| | | </where> |
| | | order by id desc |
| | | order by a.update_time desc, a.create_time desc |
| | | limit #{limit} offset #{offset} |
| | | </select> |
| | | |
| | |
| | | select * from lf.sys_publish where id in (${ids}) order by id desc; |
| | | </select> |
| | | |
| | | <select id="selectCodesForDir" resultType="java.lang.String"> |
| | | select code |
| | | from lf.sys_dir |
| | | <where> |
| | | <choose> |
| | | <when test="isDom > 0"> |
| | | name in ('DOM', 'æ°åæ£å°å½±åå¾') |
| | | </when> |
| | | <otherwise> |
| | | name in ('DEM', 'æ°åé«ç¨æ¨¡å') |
| | | </otherwise> |
| | | </choose> |
| | | <if test="dircode != null"> |
| | | and code like #{dircode} |
| | | </if> |
| | | </where> |
| | | order by code; |
| | | </select> |
| | | |
| | | <insert id="insert" parameterType="com.moon.server.entity.data.PublishEntity"> |
| | | insert into lf.sys_publish |
| | | (regid,name,url,path,type,status,dirid,depid,min,max,json,create_user,create_time,bak) |
| | |
| | | <select id="countProjectTour" resultType="java.util.Map"> |
| | | SELECT st_astext(geom) AS wkt,* FROM bs.m_pipeline |
| | | <where> |
| | | <if test="pipename != null and pipename != ''"> and pipename = #{pipename}</if> |
| | | <if test="pipename != null and pipename != ''"> |
| | | pipename = #{pipename} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | |
| | | order by depcode; |
| | | </select> |
| | | |
| | | <!-- ææä»¶ç±»åç»è®¡ --> |
| | | <select id="countSizesByType" resultType="com.moon.server.entity.ctrl.CountEntity"> |
| | | select type "m1", cast(sum(sizes) as decimal(18, 3)) "sizes", count(*) "count" |
| | | from lf.sys_meta |
| | | group by type |
| | | order by type; |
| | | </select> |
| | | |
| | | <!-- æå¡è°ç¨éç»è®¡ --> |
| | | <select id="countServices" resultType="com.moon.server.entity.ctrl.CountEntity"> |
| | | select name "m1", count(*) "count" |
| | |
| | | group by modular1,modular2 |
| | | order by modular1 desc,modular2; |
| | | </select> |
| | | |
| | | <!-- æé¡¹ç®ç»è®¡æ°æ® --> |
| | | <select id="countSizesByPrj" resultType="com.moon.server.entity.ctrl.CountEntity"> |
| | | select name "m1", coalesce((select sum(sizes) from lf.sys_meta b where b.dircode like a.code || '%'), 0) "sizes", |
| | | (select count(*) from lf.sys_meta b where b.dircode like a.code || '%') "count" |
| | | from lf.sys_dir a |
| | | where pid = 0 |
| | | order by a.code; |
| | | </select> |
| | | </mapper> |