From 91f693e9fb8e2b85ba667398fc5c2e67d4f0676f Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期三, 13 九月 2023 17:17:05 +0800
Subject: [PATCH] 添加根据图层id查询发布值

---
 src/main/java/com/moon/server/entity/ctrl/PubEntity.java             |   13 +
 src/main/java/com/moon/server/entity/shujian/ImageResultEntity.java  |  523 +++++++++++++++++++++++++++++++++++++++++++++++
 src/main/java/com/moon/server/service/data/PublishService.java       |    5 
 src/main/java/com/moon/server/mapper/data/PublishMapper.java         |    8 
 src/main/java/com/moon/server/service/data/ShuJianService.java       |   34 +++
 src/main/java/com/moon/server/controller/data/PublishController.java |   21 +
 src/main/resources/mapper/data/PublishMapper.xml                     |    8 
 7 files changed, 611 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/moon/server/controller/data/PublishController.java b/src/main/java/com/moon/server/controller/data/PublishController.java
index 6ac7752..172d0c9 100644
--- a/src/main/java/com/moon/server/controller/data/PublishController.java
+++ b/src/main/java/com/moon/server/controller/data/PublishController.java
@@ -311,4 +311,25 @@
             return fail(ex.getMessage(), -1);
         }
     }
+
+    @SysLog()
+    @ApiOperation(value = "鏇存柊鏁扮畝鍥惧眰鐨勬媺浼告柟寮�")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "entity", value = "瀹炰綋绫�", dataType = "PubEntity", paramType = "body")
+    })
+    @ResponseBody
+    @PostMapping(value = "/updateSjLayerStretch", produces = "application/json; charset=UTF-8")
+    public ResponseMsg<Integer> updateSjLayerStretch(@RequestBody PubEntity entity, HttpServletRequest req) {
+        try {
+            if (null == entity || null == entity.getLayerId()) {
+                return fail("瀹炰綋绫讳负绌烘垨鍥惧眰ID涓虹┖", 0);
+            }
+
+            Integer rows = shuJianService.updateSjLayerStretch(entity);
+
+            return success(rows);
+        } catch (Exception ex) {
+            return fail(ex.getMessage(), -1);
+        }
+    }
 }
diff --git a/src/main/java/com/moon/server/entity/ctrl/PubEntity.java b/src/main/java/com/moon/server/entity/ctrl/PubEntity.java
index 8ce0554..5005951 100644
--- a/src/main/java/com/moon/server/entity/ctrl/PubEntity.java
+++ b/src/main/java/com/moon/server/entity/ctrl/PubEntity.java
@@ -52,6 +52,11 @@
     private Integer pubid;
 
     /**
+     * 鍥惧眰ID
+     */
+    private Integer layerId;
+
+    /**
      * 鍞竴閿�
      */
     private String uuid;
@@ -144,6 +149,14 @@
         this.pubid = pubid;
     }
 
+    public Integer getLayerId() {
+        return layerId;
+    }
+
+    public void setLayerId(Integer layerId) {
+        this.layerId = layerId;
+    }
+
     public String getUuid() {
         return uuid;
     }
diff --git a/src/main/java/com/moon/server/entity/shujian/ImageResultEntity.java b/src/main/java/com/moon/server/entity/shujian/ImageResultEntity.java
index 58ac3de..adb6d6f 100644
--- a/src/main/java/com/moon/server/entity/shujian/ImageResultEntity.java
+++ b/src/main/java/com/moon/server/entity/shujian/ImageResultEntity.java
@@ -1,10 +1,531 @@
 package com.moon.server.entity.shujian;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * 鏁扮畝.褰卞儚缁撴灉绫�
  * @author WWW
- * @date 2023-08-31
+ * @date 2023-09-13
  */
 @SuppressWarnings("AlibabaLowerCamelCaseVariableNaming")
 public class ImageResultEntity {
+    public ImageResultEntity() {
+    }
+
+    private String command;
+
+    private String status;
+
+    private Result result;
+
+    public String getCommand() {
+        return command;
+    }
+
+    public void setCommand(String command) {
+        this.command = command;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public Result getResult() {
+        return result;
+    }
+
+    public void setResult(Result result) {
+        this.result = result;
+    }
+
+    public class Result {
+        public Result() {
+            this.item_list = new ArrayList<>();
+        }
+
+        private Integer page_count;
+
+        private Integer page_num;
+
+        private Integer total_count;
+
+        private List<Image> item_list;
+
+        public Integer getPage_count() {
+            return page_count;
+        }
+
+        public void setPage_count(Integer page_count) {
+            this.page_count = page_count;
+        }
+
+        public Integer getPage_num() {
+            return page_num;
+        }
+
+        public void setPage_num(Integer page_num) {
+            this.page_num = page_num;
+        }
+
+        public Integer getTotal_count() {
+            return total_count;
+        }
+
+        public void setTotal_count(Integer total_count) {
+            this.total_count = total_count;
+        }
+
+        public List<Image> getItem_list() {
+            return item_list;
+        }
+
+        public void setItem_list(List<Image> item_list) {
+            this.item_list = item_list;
+        }
+    }
+
+    public class Image {
+        public Image() {
+        }
+
+        private Integer layer_id;
+
+        private Double resolution;
+
+        private Integer type;
+
+        private Integer data_version;
+
+        private Integer cloud_cover;
+
+        private Integer solar_azimuth;
+
+        private Double solar_elevation;
+
+        private String is_color_normal;
+
+        private Integer color_normal_prob;
+
+        private Integer enhance_type;
+
+        private Double enhance_factor;
+
+        private Integer stats_type;
+
+        private Integer overview_count;
+
+        private Integer pub_status;
+
+        private Long file_size;
+
+        private List<BandInfo> band_info;
+
+        private Integer data_id;
+
+        private Integer width;
+
+        private String thumbnail;
+
+        private Integer start_scale;
+
+        private String image_uuid;
+
+        private Integer band_size;
+
+        private Integer height;
+
+        private String trans_color;
+
+        private String projection;
+
+        private Integer sensor_id;
+
+        private String image_url;
+
+        private Integer sat_id;
+
+        private String tile_rgb;
+
+        private Double rect_minx;
+
+        private Double rect_miny;
+
+        private Double rect_maxx;
+
+        private Double rect_maxy;
+
+        private String data_update_time;
+
+        private Integer priority;
+
+        private Integer data_update_user;
+
+        private Integer data_status;
+
+        private Integer image_type;
+
+        private Integer end_scale;
+
+        public Integer getLayer_id() {
+            return layer_id;
+        }
+
+        public void setLayer_id(Integer layer_id) {
+            this.layer_id = layer_id;
+        }
+
+        public Double getResolution() {
+            return resolution;
+        }
+
+        public void setResolution(Double resolution) {
+            this.resolution = resolution;
+        }
+
+        public Integer getType() {
+            return type;
+        }
+
+        public void setType(Integer type) {
+            this.type = type;
+        }
+
+        public Integer getData_version() {
+            return data_version;
+        }
+
+        public void setData_version(Integer data_version) {
+            this.data_version = data_version;
+        }
+
+        public Integer getCloud_cover() {
+            return cloud_cover;
+        }
+
+        public void setCloud_cover(Integer cloud_cover) {
+            this.cloud_cover = cloud_cover;
+        }
+
+        public Integer getSolar_azimuth() {
+            return solar_azimuth;
+        }
+
+        public void setSolar_azimuth(Integer solar_azimuth) {
+            this.solar_azimuth = solar_azimuth;
+        }
+
+        public Double getSolar_elevation() {
+            return solar_elevation;
+        }
+
+        public void setSolar_elevation(Double solar_elevation) {
+            this.solar_elevation = solar_elevation;
+        }
+
+        public String getIs_color_normal() {
+            return is_color_normal;
+        }
+
+        public void setIs_color_normal(String is_color_normal) {
+            this.is_color_normal = is_color_normal;
+        }
+
+        public Integer getColor_normal_prob() {
+            return color_normal_prob;
+        }
+
+        public void setColor_normal_prob(Integer color_normal_prob) {
+            this.color_normal_prob = color_normal_prob;
+        }
+
+        public Integer getEnhance_type() {
+            return enhance_type;
+        }
+
+        public void setEnhance_type(Integer enhance_type) {
+            this.enhance_type = enhance_type;
+        }
+
+        public Double getEnhance_factor() {
+            return enhance_factor;
+        }
+
+        public void setEnhance_factor(Double enhance_factor) {
+            this.enhance_factor = enhance_factor;
+        }
+
+        public Integer getStats_type() {
+            return stats_type;
+        }
+
+        public void setStats_type(Integer stats_type) {
+            this.stats_type = stats_type;
+        }
+
+        public Integer getOverview_count() {
+            return overview_count;
+        }
+
+        public void setOverview_count(Integer overview_count) {
+            this.overview_count = overview_count;
+        }
+
+        public Integer getPub_status() {
+            return pub_status;
+        }
+
+        public void setPub_status(Integer pub_status) {
+            this.pub_status = pub_status;
+        }
+
+        public Long getFile_size() {
+            return file_size;
+        }
+
+        public void setFile_size(Long file_size) {
+            this.file_size = file_size;
+        }
+
+        public List<BandInfo> getBand_info() {
+            return band_info;
+        }
+
+        public void setBand_info(List<BandInfo> band_info) {
+            this.band_info = band_info;
+        }
+
+        public Integer getData_id() {
+            return data_id;
+        }
+
+        public void setData_id(Integer data_id) {
+            this.data_id = data_id;
+        }
+
+        public Integer getWidth() {
+            return width;
+        }
+
+        public void setWidth(Integer width) {
+            this.width = width;
+        }
+
+        public String getThumbnail() {
+            return thumbnail;
+        }
+
+        public void setThumbnail(String thumbnail) {
+            this.thumbnail = thumbnail;
+        }
+
+        public Integer getStart_scale() {
+            return start_scale;
+        }
+
+        public void setStart_scale(Integer start_scale) {
+            this.start_scale = start_scale;
+        }
+
+        public String getImage_uuid() {
+            return image_uuid;
+        }
+
+        public void setImage_uuid(String image_uuid) {
+            this.image_uuid = image_uuid;
+        }
+
+        public Integer getBand_size() {
+            return band_size;
+        }
+
+        public void setBand_size(Integer band_size) {
+            this.band_size = band_size;
+        }
+
+        public Integer getHeight() {
+            return height;
+        }
+
+        public void setHeight(Integer height) {
+            this.height = height;
+        }
+
+        public String getTrans_color() {
+            return trans_color;
+        }
+
+        public void setTrans_color(String trans_color) {
+            this.trans_color = trans_color;
+        }
+
+        public String getProjection() {
+            return projection;
+        }
+
+        public void setProjection(String projection) {
+            this.projection = projection;
+        }
+
+        public Integer getSensor_id() {
+            return sensor_id;
+        }
+
+        public void setSensor_id(Integer sensor_id) {
+            this.sensor_id = sensor_id;
+        }
+
+        public String getImage_url() {
+            return image_url;
+        }
+
+        public void setImage_url(String image_url) {
+            this.image_url = image_url;
+        }
+
+        public Integer getSat_id() {
+            return sat_id;
+        }
+
+        public void setSat_id(Integer sat_id) {
+            this.sat_id = sat_id;
+        }
+
+        public String getTile_rgb() {
+            return tile_rgb;
+        }
+
+        public void setTile_rgb(String tile_rgb) {
+            this.tile_rgb = tile_rgb;
+        }
+
+        public Double getRect_minx() {
+            return rect_minx;
+        }
+
+        public void setRect_minx(Double rect_minx) {
+            this.rect_minx = rect_minx;
+        }
+
+        public Double getRect_miny() {
+            return rect_miny;
+        }
+
+        public void setRect_miny(Double rect_miny) {
+            this.rect_miny = rect_miny;
+        }
+
+        public Double getRect_maxx() {
+            return rect_maxx;
+        }
+
+        public void setRect_maxx(Double rect_maxx) {
+            this.rect_maxx = rect_maxx;
+        }
+
+        public Double getRect_maxy() {
+            return rect_maxy;
+        }
+
+        public void setRect_maxy(Double rect_maxy) {
+            this.rect_maxy = rect_maxy;
+        }
+
+        public String getData_update_time() {
+            return data_update_time;
+        }
+
+        public void setData_update_time(String data_update_time) {
+            this.data_update_time = data_update_time;
+        }
+
+        public Integer getPriority() {
+            return priority;
+        }
+
+        public void setPriority(Integer priority) {
+            this.priority = priority;
+        }
+
+        public Integer getData_update_user() {
+            return data_update_user;
+        }
+
+        public void setData_update_user(Integer data_update_user) {
+            this.data_update_user = data_update_user;
+        }
+
+        public Integer getData_status() {
+            return data_status;
+        }
+
+        public void setData_status(Integer data_status) {
+            this.data_status = data_status;
+        }
+
+        public Integer getImage_type() {
+            return image_type;
+        }
+
+        public void setImage_type(Integer image_type) {
+            this.image_type = image_type;
+        }
+
+        public Integer getEnd_scale() {
+            return end_scale;
+        }
+
+        public void setEnd_scale(Integer end_scale) {
+            this.end_scale = end_scale;
+        }
+    }
+
+    public class BandInfo {
+        public BandInfo() {
+        }
+
+        private Double max;
+
+        private Integer nodata;
+
+        private Integer band_id;
+
+        private Integer min;
+
+        public Double getMax() {
+            return max;
+        }
+
+        public void setMax(Double max) {
+            this.max = max;
+        }
+
+        public Integer getNodata() {
+            return nodata;
+        }
+
+        public void setNodata(Integer nodata) {
+            this.nodata = nodata;
+        }
+
+        public Integer getBand_id() {
+            return band_id;
+        }
+
+        public void setBand_id(Integer band_id) {
+            this.band_id = band_id;
+        }
+
+        public Integer getMin() {
+            return min;
+        }
+
+        public void setMin(Integer min) {
+            this.min = min;
+        }
+    }
 }
diff --git a/src/main/java/com/moon/server/mapper/data/PublishMapper.java b/src/main/java/com/moon/server/mapper/data/PublishMapper.java
index 0febf31..0408083 100644
--- a/src/main/java/com/moon/server/mapper/data/PublishMapper.java
+++ b/src/main/java/com/moon/server/mapper/data/PublishMapper.java
@@ -76,6 +76,14 @@
     public List<PublishEntity> selectRaster();
 
     /**
+     * 鏍规嵁鍥惧眰ID鏌ヨ
+     *
+     * @param layerId 鍥惧眰ID
+     * @return 鍙戝竷瀹炰綋绫�
+     */
+    public PublishEntity selectByLayerId(Integer layerId);
+
+    /**
      * 鏍规嵁鐩綍鏌ヨDOM鍜孌EM鐨勭紪鐮�
      *
      * @param dircode 鐩綍
diff --git a/src/main/java/com/moon/server/service/data/PublishService.java b/src/main/java/com/moon/server/service/data/PublishService.java
index 10c11ed..5dc59d8 100644
--- a/src/main/java/com/moon/server/service/data/PublishService.java
+++ b/src/main/java/com/moon/server/service/data/PublishService.java
@@ -78,6 +78,11 @@
     }
 
     @Override
+    public PublishEntity selectByLayerId(Integer layerId) {
+        return null;
+    }
+
+    @Override
     public List<String> selectCodesForDir(String dircode, Integer isDom) {
         return publishMapper.selectCodesForDir(dircode, isDom);
     }
diff --git a/src/main/java/com/moon/server/service/data/ShuJianService.java b/src/main/java/com/moon/server/service/data/ShuJianService.java
index c809e65..8c8a3cb 100644
--- a/src/main/java/com/moon/server/service/data/ShuJianService.java
+++ b/src/main/java/com/moon/server/service/data/ShuJianService.java
@@ -19,6 +19,7 @@
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.*;
 import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.client.RestTemplate;
 
 import javax.annotation.Resource;
@@ -76,6 +77,8 @@
     private final static String MISSION_STATUS = "%s/sj_raster/v6/api/mission/%d?op=get_status&%s";
 
     private final static String COLOR_TABLE = "%s/sj_raster/v6/api/color_table?%s&page_count=%d&page_num=%d&key=";
+
+    private final static String IMAGE_INFO = "%s/sj_raster/v6/api/image?%s&key=&page_num=1&page_count=1000&layer_id=%d";
 
     /**
      * 鍒嗛〉鏌ヨ鏁扮畝鐨勯鑹茶〃
@@ -636,4 +639,35 @@
 
         return flag ? null : rs.getResult();
     }
+
+    /**
+     * 鏇存柊鏁扮畝鍥惧眰鐨勬媺浼告柟寮�
+     */
+    public Integer updateSjLayerStretch(PubEntity entity) {
+        PublishEntity pub = publishService.selectByLayerId(entity.getLayerId());
+        if (null == pub || null == pub.getLayerid()) {
+            return 0;
+        }
+
+        ImageResultEntity ir = selectImageInfo(pub.getLayerid());
+
+        return 0;
+    }
+
+    /**
+     * 鏍规嵁鍥惧眰ID鏌ヨ褰卞儚淇℃伅
+     */
+    public ImageResultEntity selectImageInfo(Integer layerId) {
+        try {
+            String url = String.format(IMAGE_INFO, sjUrl5, ak, layerId);
+
+            RestTemplate rest = RestHelper.getRestTemplate();
+            ResponseEntity<ImageResultEntity> resp = rest.getForEntity(url, ImageResultEntity.class);
+
+            return resp.getBody();
+        } catch (Exception ex) {
+            log.error(ex.getMessage(), ex);
+            return null;
+        }
+    }
 }
diff --git a/src/main/resources/mapper/data/PublishMapper.xml b/src/main/resources/mapper/data/PublishMapper.xml
index 507ace3..fe1b636 100644
--- a/src/main/resources/mapper/data/PublishMapper.xml
+++ b/src/main/resources/mapper/data/PublishMapper.xml
@@ -106,6 +106,14 @@
         select * from lf.sys_publish where status = 3 and type in ('DOM', 'DEM');
     </select>
 
+    <select id="selectByLayerId" resultType="com.moon.server.entity.data.PublishEntity">
+        select a.*
+        from lf.sys_publish a inner join lf.sys_res b on a.id = b.pubid
+        inner join lf.sys_layer c on b.id = c.resid
+        where c.id = #{layerId}
+        limit 1;
+    </select>
+
     <select id="selectCodesForDir" resultType="java.lang.String">
         select code
         from lf.sys_dir

--
Gitblit v1.9.3