| | |
| | | } |
| | | |
| | | @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); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<MetaEntity> selectByIds(String ids) { |
| | | return metaMapper.selectByIds(ids); |
| | | } |
| | | |
| | | @Override |
| | | public List<MetaEntity> selectMetaFiles(List<Integer> ids) { |
| | | return metaMapper.selectMetaFiles(ids); |
| | | } |
| | |
| | | depcode = StringHelper.getRightLike(depcode); |
| | | |
| | | return metaMapper.selectMetaOverflowDep(ids, depcode); |
| | | } |
| | | |
| | | @Override |
| | | public Integer selectCountByPath(String path) { |
| | | return metaMapper.selectCountByPath(path); |
| | | } |
| | | |
| | | @Override |
| | |
| | | */ |
| | | public Integer deletes(List<Integer> list) { |
| | | String ids = StringHelper.join(list, ","); |
| | | List<MetaEntity> metas = selectByIds(ids); |
| | | |
| | | String sql = null; |
| | | List<MetaEntity> metas = selectByIdsForTab(ids); |
| | | if (null != metas && metas.size() > 0) { |
| | | sql = getDelTabsSql(metas); |
| | | List<MetaEntity> tabMetas = selectByIdsForTab(ids); |
| | | if (null != tabMetas && tabMetas.size() > 0) { |
| | | sql = getDelTabsSql(tabMetas); |
| | | } |
| | | |
| | | return deletes(sql, ids); |
| | | int rows = deletes(sql, ids); |
| | | deleteMetaFiles(metas); |
| | | |
| | | return rows; |
| | | } |
| | | |
| | | /** |
| | |
| | | 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++; |
| | | } |
| | |
| | | list.add(String.format("delete from lf.sys_attach where tab='%s' and tab_guid in (%s)", tab, select)); |
| | | |
| | | i++; |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除元数据文件 |
| | | */ |
| | | private void deleteMetaFiles(List<MetaEntity> metas) { |
| | | String uploadPath = pathHelper.getConfig().getUploadPath(); |
| | | for (MetaEntity meta : metas) { |
| | | if (StringHelper.isEmpty(meta.getPath())) { |
| | | continue; |
| | | } |
| | | Integer rows = selectCountByPath(meta.getPath()); |
| | | if (rows > 0) { |
| | | continue; |
| | | } |
| | | |
| | | try { |
| | | String file = uploadPath + File.separator + meta.getPath(); |
| | | switch ("." + meta.getType()) { |
| | | case StaticData.MPT: |
| | | deleteFiles(file, meta.getType(), StaticData.MPT_EXT); |
| | | break; |
| | | case StaticData.JPG: |
| | | deleteFiles(file, meta.getType(), StaticData.JPG_EXT); |
| | | break; |
| | | case StaticData.IMG: |
| | | deleteFiles(file, meta.getType(), StaticData.IMG_EXT); |
| | | break; |
| | | case StaticData.TIF: |
| | | deleteFiles(file, meta.getType(), StaticData.TIF_EXT); |
| | | break; |
| | | case StaticData.TIFF: |
| | | deleteFiles(file, meta.getType(), StaticData.TIFF_EXT); |
| | | break; |
| | | case StaticData.SHP: |
| | | deleteFiles(file, meta.getType(), StaticData.SHP_EXT); |
| | | break; |
| | | case StaticData.GDB: |
| | | case StaticData.OSGB: |
| | | FileHelper.deleteDir(file); |
| | | break; |
| | | default: |
| | | deleteFiles(file, meta.getType(), null); |
| | | break; |
| | | } |
| | | } catch (Exception ex) { |
| | | log.error(ex.getMessage(), ex); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除多个文件 |
| | | */ |
| | | private void deleteFiles(String file, String type, List<String> extList) { |
| | | File f = new File(file); |
| | | if (f.exists() && !f.isDirectory()) { |
| | | f.delete(); |
| | | } |
| | | if (null == extList || extList.isEmpty()) { |
| | | return; |
| | | } |
| | | |
| | | for (String ext : extList) { |
| | | f = new File(file.replace("." + type, ext)); |
| | | if (f.exists() && !f.isDirectory()) { |
| | | f.delete(); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | break; |
| | | case StaticData.JPG: |
| | | addMultiFile(uploadPath, mf, zip, params, StaticData.JPG_EXT); |
| | | break; |
| | | case StaticData.IMG: |
| | | addMultiFile(uploadPath, mf, zip, params, StaticData.IMG_EXT); |
| | | break; |
| | |
| | | addMultiFile(uploadPath, mf, zip, params, StaticData.SHP_EXT); |
| | | break; |
| | | case StaticData.GDB: |
| | | continue; |
| | | case StaticData.OSGB: |
| | | addFolderFile(uploadPath, mf, zip, params); |
| | | break; |
| | | default: |