月球大数据地理空间分析展示平台-【后端】-月球后台服务
1
13693261870
2024-11-17 796b44ea813a1133beae4f3a67f1c0263510c0c7
src/main/java/com/moon/server/service/show/InquiryService.java
@@ -23,11 +23,8 @@
import java.util.Date;
import java.util.List;
/**
 * 查询服务类
 * @author WWW
 */
@Service
@SuppressWarnings("ALL")
public class InquiryService {
    @Resource
    PathHelper pathHelper;
@@ -40,9 +37,6 @@
    private final static Log log = LogFactory.getLog(InquiryService.class);
    /**
     * 读取Shp第一条记录的WKT
     */
    public ShpRecordEntity readShpFirstRecord(List<MetaFileEntity> list) {
        String fileName = null;
        for (MetaFileEntity mf : list) {
@@ -61,9 +55,6 @@
        return sr;
    }
    /**
     * 打包瓦片
     */
    public String zipTiles(DownloadTileEntity dt, PublishEntity pub, UserEntity ue) {
        if (!isTilePathExist(pub)) {
            return null;
@@ -91,11 +82,8 @@
        return rows > 0 ? de.getGuid() : null;
    }
    /**
     * 瓦片路径是否存在
     */
    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()) {
@@ -107,11 +95,14 @@
        return true;
    }
    /**
     * 查找瓦片
     */
    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) {
@@ -122,9 +113,6 @@
        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);
@@ -149,9 +137,6 @@
        return list;
    }
    /**
     * 角度转数值
     */
    private int[] deg2num(int zoom, double x, double y) {
        double yRad = Math.toRadians(y);
        double n = Math.pow(2.0, zoom);
@@ -162,9 +147,6 @@
        return new int[]{xTile, yTile};
    }
    /**
     * 添加文件至压缩包
     */
    private void addFiles(ZipFile zip, ZipParameters params, List<File> list, String basePath) {
        for (File f : list) {
            try {
@@ -176,9 +158,6 @@
        }
    }
    /**
     * 获取下载实体类
     */
    private DownloadEntity getDownloadEntity(UserEntity ue, String file, String pwd) {
        DownloadEntity de = new DownloadEntity();
        de.setName(FileHelper.getFileName(file));
@@ -197,9 +176,6 @@
        return de;
    }
    /**
     * 插入数据发布-下载表
     */
    private void insertPubDown(PublishEntity pub, DownloadEntity de, UserEntity ue) {
        publishService.insertPubDown(pub.getId(), de.getId(), ue.getId());
    }