| | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 查询服务类 |
| | | * @author WWW |
| | | */ |
| | | @Service |
| | | @SuppressWarnings("ALL") |
| | | public class InquiryService { |
| | | @Resource |
| | | PathHelper pathHelper; |
| | |
| | | |
| | | private final static Log log = LogFactory.getLog(InquiryService.class); |
| | | |
| | | /** |
| | | * 读取Shp第一条记录的WKT |
| | | */ |
| | | public ShpRecordEntity readShpFirstRecord(List<MetaFileEntity> list) { |
| | | String fileName = null; |
| | | for (MetaFileEntity mf : list) { |
| | |
| | | return sr; |
| | | } |
| | | |
| | | /** |
| | | * 打包瓦片 |
| | | */ |
| | | public String zipTiles(DownloadTileEntity dt, PublishEntity pub, UserEntity ue) { |
| | | if (!isTilePathExist(pub)) { |
| | | return null; |
| | |
| | | return rows > 0 ? de.getGuid() : null; |
| | | } |
| | | |
| | | /** |
| | | * 瓦片路径是否存在 |
| | | */ |
| | | private boolean isTilePathExist(PublishEntity pub) { |
| | | String tilePath = pathHelper.getConfig().getTilePath() + pub.getPath(); |
| | | |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 查找瓦片 |
| | | */ |
| | | private List<File> findTiles(DownloadTileEntity dt, PublishEntity pub) { |
| | | List<File> list = new ArrayList<>(); |
| | | |
| | |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 根据层次查找瓦片 |
| | | */ |
| | | private List<File> findTilesByZoom(DownloadTileEntity dt, PublishEntity pub, int zoom) { |
| | | List<File> list = new ArrayList<>(); |
| | | File f = new File(pub.getPath() + File.separator + zoom); |
| | |
| | | return list; |
| | | } |
| | | |
| | | /** |
| | | * 角度转数值 |
| | | */ |
| | | private int[] deg2num(int zoom, double x, double y) { |
| | | double yRad = Math.toRadians(y); |
| | | double n = Math.pow(2.0, zoom); |
| | |
| | | return new int[]{xTile, yTile}; |
| | | } |
| | | |
| | | /** |
| | | * 添加文件至压缩包 |
| | | */ |
| | | private void addFiles(ZipFile zip, ZipParameters params, List<File> list, String basePath) { |
| | | for (File f : list) { |
| | | try { |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 获取下载实体类 |
| | | */ |
| | | private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) { |
| | | DownloadEntity de = new DownloadEntity(); |
| | | de.setName(FileHelper.getFileName(file)); |
| | |
| | | return de; |
| | | } |
| | | |
| | | /** |
| | | * 插入数据发布-下载表 |
| | | */ |
| | | private void insertPubDown(PublishEntity pub, DownloadEntity de, UserEntity ue) { |
| | | publishService.insertPubDown(pub.getId(), de.getId(), ue.getId()); |
| | | } |