正在显示
33 个修改的文件
包含
121 行增加
和
49 行删除
| ... | ... | @@ -12,7 +12,7 @@ from app.models import db |
| 12 | 12 | from app.modules.auth.oauth2 import config_oauth, myCodeIDToken |
| 13 | 13 | from flasgger import Swagger |
| 14 | 14 | import logging |
| 15 | -from app.util.component.StructuredPrint import StructurePrint | |
| 15 | +from app.util.component.StructurePrint import StructurePrint | |
| 16 | 16 | from app.util.component.PGUtil import PGUtil |
| 17 | 17 | import os |
| 18 | 18 | from app.modules.monitor.schedule import start_schedule | ... | ... |
| ... | ... | @@ -15,7 +15,7 @@ from app.util.component.ApiTemplate import ApiTemplate |
| 15 | 15 | from app.util.component.PGUtil import PGUtil |
| 16 | 16 | from app.util.component.SQLUtil import SQLUtil |
| 17 | 17 | from app.util.component.GeometryAdapter import GeometryAdapter |
| 18 | -from app.util.component.StructuredPrint import StructurePrint | |
| 18 | +from app.util.component.StructurePrint import StructurePrint | |
| 19 | 19 | |
| 20 | 20 | |
| 21 | 21 | class Api(ApiTemplate): | ... | ... |
| ... | ... | @@ -16,7 +16,7 @@ import configure |
| 16 | 16 | from app.util.component.ApiTemplate import ApiTemplate |
| 17 | 17 | from app.util.component.PGUtil import PGUtil |
| 18 | 18 | from app.util.component.ZipUtil import ZipUtil |
| 19 | -from app.util.component.StructuredPrint import StructurePrint | |
| 19 | +from app.util.component.StructurePrint import StructurePrint | |
| 20 | 20 | import multiprocessing |
| 21 | 21 | import datetime |
| 22 | 22 | from app.util.component.TaskController import TaskController | ... | ... |
| ... | ... | @@ -13,7 +13,7 @@ import json |
| 13 | 13 | import re |
| 14 | 14 | from app.util.component.ApiTemplate import ApiTemplate |
| 15 | 15 | from app.util.component.PGUtil import PGUtil |
| 16 | -from app.util.component.StructuredPrint import StructurePrint | |
| 16 | +from app.util.component.StructurePrint import StructurePrint | |
| 17 | 17 | from sqlalchemy.orm import Session |
| 18 | 18 | import configure |
| 19 | 19 | import datetime | ... | ... |
| ... | ... | @@ -7,7 +7,7 @@ import uuid |
| 7 | 7 | import shutil |
| 8 | 8 | from app.modules.data.models import * |
| 9 | 9 | from app.util.component.PGUtil import PGUtil |
| 10 | -from app.util.component.StructuredPrint import StructurePrint | |
| 10 | +from app.util.component.StructurePrint import StructurePrint | |
| 11 | 11 | from sqlalchemy.orm import Session |
| 12 | 12 | import configure |
| 13 | 13 | import traceback | ... | ... |
| ... | ... | @@ -20,6 +20,7 @@ from . import table_view |
| 20 | 20 | from . import table_vacuate |
| 21 | 21 | from . import table_vacuate_one |
| 22 | 22 | from . import table_vacuate_info |
| 23 | +from . import table_vacuate_detail | |
| 23 | 24 | from . import table_vacuate_ref |
| 24 | 25 | from . import table_vacuate_delete |
| 25 | 26 | from . import field_value |
| ... | ... | @@ -163,6 +164,15 @@ class DataManager(BlueprintApi): |
| 163 | 164 | return table_vacuate_info.Api().result |
| 164 | 165 | |
| 165 | 166 | @staticmethod |
| 167 | + @bp.route('/TableVacuateDetail', methods=['GET']) | |
| 168 | + @swag_from(table_vacuate_detail.Api.api_doc) | |
| 169 | + def api_table_vacuate_detail(): | |
| 170 | + """ | |
| 171 | + 数据抽稀详情 | |
| 172 | + """ | |
| 173 | + return table_vacuate_detail.Api().result | |
| 174 | + | |
| 175 | + @staticmethod | |
| 166 | 176 | @bp.route('/TableVacuateRef', methods=['POST']) |
| 167 | 177 | @swag_from(table_vacuate_ref.Api.api_doc) |
| 168 | 178 | def api_table_vacuate_ref(): | ... | ... |
| ... | ... | @@ -21,6 +21,8 @@ class Api(ApiTemplate): |
| 21 | 21 | raise Exception("数据不存在!") |
| 22 | 22 | pg_ds = PGUtil.open_pg_data_source(0,DES.decode(table.relate_database.sqlalchemy_uri)) |
| 23 | 23 | layer:Layer = pg_ds.GetLayerByName(table.name) |
| 24 | + if not layer: | |
| 25 | + raise Exception("数据异常!") | |
| 24 | 26 | append_dict ={"srid":None,"sr_wkt":None,"sr_proj4":None,"exist":1,"schema":"public","geomfield":layer.GetGeometryColumn()} |
| 25 | 27 | if layer: |
| 26 | 28 | sr:SpatialReference = layer.GetSpatialRef() | ... | ... |
| ... | ... | @@ -10,7 +10,7 @@ import uuid |
| 10 | 10 | from sqlalchemy.orm import Session |
| 11 | 11 | from app.util.component.SQLUtil import SQLUtil |
| 12 | 12 | from app.util.component.PGUtil import PGUtil |
| 13 | -from app.util.component.StructuredPrint import StructurePrint | |
| 13 | +from app.util.component.StructurePrint import StructurePrint | |
| 14 | 14 | from app.util.component.ApiTemplate import ApiTemplate |
| 15 | 15 | from app.util.component.GeometryAdapter import GeometryAdapter |
| 16 | 16 | from app.util.component.TaskController import TaskController | ... | ... |
| ... | ... | @@ -12,7 +12,7 @@ import configure |
| 12 | 12 | from ..models import Table, Database, Task,db,TableVacuate,Process,DES |
| 13 | 13 | |
| 14 | 14 | from app.util.component.ApiTemplate import ApiTemplate |
| 15 | -from app.util.component.StructuredPrint import StructurePrint | |
| 15 | +from app.util.component.StructurePrint import StructurePrint | |
| 16 | 16 | from app.util.component.PGUtil import PGUtil |
| 17 | 17 | from app.util.component.VacuateConf import VacuateConf |
| 18 | 18 | from app.util.component.GeometryAdapter import GeometryAdapter | ... | ... |
| 1 | +# author: 4N | |
| 2 | +# createtime: 2021/1/27 | |
| 3 | +# email: nheweijun@sina.com | |
| 4 | + | |
| 5 | + | |
| 6 | +from ..models import Table,TableVacuate,Task | |
| 7 | +from app.util.component.ApiTemplate import ApiTemplate | |
| 8 | +from app.util.component.VacuateConf import VacuateConf | |
| 9 | + | |
| 10 | + | |
| 11 | +import copy | |
| 12 | +class Api(ApiTemplate): | |
| 13 | + api_name = "抽稀Detail" | |
| 14 | + def process(self): | |
| 15 | + | |
| 16 | + res = {} | |
| 17 | + try: | |
| 18 | + res["data"] = [] | |
| 19 | + table_guids = self.para.get("table_guids") | |
| 20 | + | |
| 21 | + for table_guid in table_guids.split(","): | |
| 22 | + | |
| 23 | + detail = {"table_guid":table_guid} | |
| 24 | + table: Table = Table.query.filter_by(guid=table_guid).one_or_none() | |
| 25 | + if table: | |
| 26 | + tvs = TableVacuate.query.filter_by(table_guid=table_guid).all() | |
| 27 | + detail["table_name"] = table.name | |
| 28 | + detail["vacuate_count"] = len(tvs) | |
| 29 | + detail["table_vacuate"] = [{"name":tv.name,"pixel_distance":tv.pixel_distance,"connectstr":tv.connectstr} for tv in tvs] | |
| 30 | + | |
| 31 | + res["data"].append(detail) | |
| 32 | + res["result"] = True | |
| 33 | + except Exception as e: | |
| 34 | + raise e | |
| 35 | + return res | |
| 36 | + | |
| 37 | + api_doc = { | |
| 38 | + "tags": ["管理接口"], | |
| 39 | + "parameters": [ | |
| 40 | + {"name": "table_guids", | |
| 41 | + "in": "formData", | |
| 42 | + "type": "string", | |
| 43 | + "description": "表guid", "required": "true"}, | |
| 44 | + ], | |
| 45 | + "responses": { | |
| 46 | + 200: { | |
| 47 | + "schema": { | |
| 48 | + "properties": { | |
| 49 | + } | |
| 50 | + } | |
| 51 | + } | |
| 52 | + } | |
| 53 | + } | |
| \ No newline at end of file | ... | ... |
| ... | ... | @@ -8,7 +8,7 @@ import traceback |
| 8 | 8 | from ..models import Table, Database, DES,Task,db,TableVacuate |
| 9 | 9 | from app.util.component.ApiTemplate import ApiTemplate |
| 10 | 10 | from app.util.component.PGUtil import PGUtil |
| 11 | -from app.util.component.StructuredPrint import StructurePrint | |
| 11 | +from app.util.component.StructurePrint import StructurePrint | |
| 12 | 12 | import multiprocessing |
| 13 | 13 | import uuid |
| 14 | 14 | import configure | ... | ... |
| ... | ... | @@ -10,7 +10,7 @@ from app.util.component.ApiTemplate import ApiTemplate |
| 10 | 10 | from app.util.component.PGUtil import PGUtil |
| 11 | 11 | |
| 12 | 12 | from app.util.component.GeometryAdapter import GeometryAdapter |
| 13 | -from app.util.component.StructuredPrint import StructurePrint | |
| 13 | +from app.util.component.StructurePrint import StructurePrint | |
| 14 | 14 | |
| 15 | 15 | from osgeo.ogr import DataSource |
| 16 | 16 | ... | ... |
| ... | ... | @@ -19,7 +19,7 @@ import datetime |
| 19 | 19 | |
| 20 | 20 | from ..models import Table, Database, DES,Task,db,TableVacuate,Process |
| 21 | 21 | |
| 22 | -from app.util.component.StructuredPrint import StructurePrint | |
| 22 | +from app.util.component.StructurePrint import StructurePrint | |
| 23 | 23 | |
| 24 | 24 | from osgeo.ogr import DataSource,Layer,Geometry |
| 25 | 25 | ... | ... |
| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | |
| 6 | 6 | from ..models import db,Task,Table,InsertingLayerName,Process |
| 7 | 7 | from app.util.component.ApiTemplate import ApiTemplate |
| 8 | -from app.util.component.StructuredPrint import StructurePrint | |
| 8 | +from app.util.component.StructurePrint import StructurePrint | |
| 9 | 9 | import os |
| 10 | 10 | import signal |
| 11 | 11 | import platform | ... | ... |
| ... | ... | @@ -8,7 +8,7 @@ import socket |
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | from app.util.component.ApiTemplate import ApiTemplate |
| 11 | -from app.util.component.StructuredPrint import StructurePrint | |
| 11 | +from app.util.component.StructurePrint import StructurePrint | |
| 12 | 12 | class Api(ApiTemplate): |
| 13 | 13 | |
| 14 | 14 | def process(self): | ... | ... |
| ... | ... | @@ -13,7 +13,7 @@ import schedule |
| 13 | 13 | from app.util.component.RunContinuous import run_continuously |
| 14 | 14 | from app.util.component.PGUtil import PGUtil |
| 15 | 15 | import configure |
| 16 | -from app.util.component.StructuredPrint import StructurePrint | |
| 16 | +from app.util.component.StructurePrint import StructurePrint | |
| 17 | 17 | import traceback |
| 18 | 18 | import requests |
| 19 | 19 | ... | ... |
| ... | ... | @@ -31,8 +31,6 @@ class Api(ApiTemplate): |
| 31 | 31 | else: |
| 32 | 32 | image_services.extend(response.json()["data"]["list"]) |
| 33 | 33 | |
| 34 | - | |
| 35 | - | |
| 36 | 34 | for cata in catalogs: |
| 37 | 35 | catalog_guids = [c.guid for c in ServiceCatalog.query.filter(ServiceCatalog.path.like("%" + cata.guid + "%")).all()] |
| 38 | 36 | service_count = Service.query.filter(Service.catalog_guid.in_(catalog_guids)).count() | ... | ... |
| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | |
| 6 | 6 | from app.util.component.ApiTemplate import ApiTemplate |
| 7 | 7 | from app.modules.service.models import ServiceEngine |
| 8 | -from app.util.component.StructuredPrint import StructurePrint | |
| 8 | +from app.util.component.StructurePrint import StructurePrint | |
| 9 | 9 | import requests |
| 10 | 10 | import uuid |
| 11 | 11 | ... | ... |
| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | |
| 6 | 6 | |
| 7 | 7 | from app.util.component.ApiTemplate import ApiTemplate |
| 8 | -from app.util.component.StructuredPrint import StructurePrint | |
| 8 | +from app.util.component.StructurePrint import StructurePrint | |
| 9 | 9 | from app.models import db |
| 10 | 10 | from app.modules.data.models import Task |
| 11 | 11 | import multiprocessing | ... | ... |
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | |
| 7 | 7 | from app.modules.service.models import TileScheme |
| 8 | 8 | from app.util.component.ModelVisitor import ModelVisitor |
| 9 | -from app.util.component.StructuredPrint import StructurePrint | |
| 9 | +from app.util.component.StructurePrint import StructurePrint | |
| 10 | 10 | import json |
| 11 | 11 | import base64 |
| 12 | 12 | ... | ... |
| ... | ... | @@ -9,7 +9,7 @@ import os |
| 9 | 9 | from app.util.component.FileProcess import FileProcess |
| 10 | 10 | from app.util.component.SliceScheme import SliceScheme |
| 11 | 11 | import shutil |
| 12 | -from app.util.component.StructuredPrint import StructurePrint | |
| 12 | +from app.util.component.StructurePrint import StructurePrint | |
| 13 | 13 | |
| 14 | 14 | class Api(ApiTemplate): |
| 15 | 15 | api_name = "解析方案" | ... | ... |
| ... | ... | @@ -64,26 +64,29 @@ class Api(ApiTemplate): |
| 64 | 64 | |
| 65 | 65 | for ie in image_engines: |
| 66 | 66 | url = "{}/API/Service/List".format(ie.url) |
| 67 | - response:requests.Response = requests.post(url,{"page_size":"9999","page_index":"0"}) | |
| 68 | - if not response.json().get("result"): | |
| 69 | - raise Exception("获取影像地图失败!") | |
| 70 | - else: | |
| 71 | - raw_json = response.json()["data"]["list"] | |
| 72 | - if state: | |
| 73 | - raw_json = [ service for service in raw_json if service["state"] == int(state)] | |
| 74 | - if type: | |
| 75 | - raw_json = [service for service in raw_json if service["type"] == type] | |
| 76 | - if catalog_guid: | |
| 77 | - raw_json = [service for service in raw_json if service["catalog_guid"] == catalog_guid] | |
| 78 | - # 并集 | |
| 79 | - if title and name: | |
| 80 | - raw_json = [service for service in raw_json if re.search(name, service["name"]) or re.search(title, service["title"])] | |
| 67 | + try: | |
| 68 | + response:requests.Response = requests.post(url,{"page_size":"9999","page_index":"0"}) | |
| 69 | + if not response.json().get("result"): | |
| 70 | + raise Exception("获取影像地图失败!") | |
| 81 | 71 | else: |
| 82 | - if title: | |
| 83 | - raw_json = [service for service in raw_json if re.search(title, service["title"])] | |
| 84 | - if name: | |
| 85 | - raw_json = [service for service in raw_json if re.search(name, service["name"])] | |
| 86 | - services_json.extend(raw_json) | |
| 72 | + raw_json = response.json()["data"]["list"] | |
| 73 | + if state: | |
| 74 | + raw_json = [ service for service in raw_json if service["state"] == int(state)] | |
| 75 | + if type: | |
| 76 | + raw_json = [service for service in raw_json if service["type"] == type] | |
| 77 | + if catalog_guid: | |
| 78 | + raw_json = [service for service in raw_json if service["catalog_guid"] == catalog_guid] | |
| 79 | + # 并集 | |
| 80 | + if title and name: | |
| 81 | + raw_json = [service for service in raw_json if re.search(name, service["name"]) or re.search(title, service["title"])] | |
| 82 | + else: | |
| 83 | + if title: | |
| 84 | + raw_json = [service for service in raw_json if re.search(title, service["title"])] | |
| 85 | + if name: | |
| 86 | + raw_json = [service for service in raw_json if re.search(name, service["name"])] | |
| 87 | + services_json.extend(raw_json) | |
| 88 | + except: | |
| 89 | + pass | |
| 87 | 90 | |
| 88 | 91 | # 筛选服务能力 |
| 89 | 92 | if function_type: | ... | ... |
| ... | ... | @@ -34,7 +34,13 @@ class Api(ApiTemplate): |
| 34 | 34 | #地图服务 |
| 35 | 35 | map_services = MapService.query.all() |
| 36 | 36 | for ms in map_services: |
| 37 | - res["data"]["list"].append(ModelVisitor.object_to_json(ms)) | |
| 37 | + para = ModelVisitor.object_to_json(ms) | |
| 38 | + para[""] | |
| 39 | + | |
| 40 | + res["data"]["list"].append(para) | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 38 | 44 | |
| 39 | 45 | res["data"]["count"] = len(tile_services)+len(map_services) |
| 40 | 46 | res["result"] = True | ... | ... |
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | #email: nheweijun@sina.com |
| 5 | 5 | |
| 6 | 6 | from app.util.component.ApiTemplate import ApiTemplate |
| 7 | -from app.util.component.StructuredPrint import StructurePrint | |
| 7 | +from app.util.component.StructurePrint import StructurePrint | |
| 8 | 8 | from app.util.component.ModelVisitor import ModelVisitor |
| 9 | 9 | import uuid |
| 10 | 10 | from ..models import TileService,Service,db,ServiceFunction,TileScheme | ... | ... |
| ... | ... | @@ -5,7 +5,7 @@ |
| 5 | 5 | |
| 6 | 6 | |
| 7 | 7 | from app.util.component.ApiTemplate import ApiTemplate |
| 8 | -from app.util.component.StructuredPrint import StructurePrint | |
| 8 | +from app.util.component.StructurePrint import StructurePrint | |
| 9 | 9 | import uuid |
| 10 | 10 | from ..models import TileService,Service,db,ServiceFunction,TileScheme |
| 11 | 11 | ... | ... |
| ... | ... | @@ -10,7 +10,7 @@ import configure |
| 10 | 10 | from app.util.component.ModelVisitor import ModelVisitor |
| 11 | 11 | |
| 12 | 12 | from .util.ProjectFile import ProjectFile |
| 13 | - | |
| 13 | +from ..util.ServiceType import ServiceType | |
| 14 | 14 | |
| 15 | 15 | class Api(ApiTemplate): |
| 16 | 16 | |
| ... | ... | @@ -25,7 +25,7 @@ class Api(ApiTemplate): |
| 25 | 25 | res["data"]["list"] = [] |
| 26 | 26 | |
| 27 | 27 | #切片服务 |
| 28 | - tile_services = TileService.query.join(Service).filter(Service.type == "切片服务").all() | |
| 28 | + tile_services = TileService.query.join(Service).filter(Service.type == ServiceType.tile_service.value).all() | |
| 29 | 29 | for ts in tile_services: |
| 30 | 30 | project_file = ProjectFile.create(ModelVisitor.object_to_json(ts)) |
| 31 | 31 | service:Service = Service.query.filter_by(guid=ts.service_guid).one_or_none() | ... | ... |
| ... | ... | @@ -9,7 +9,7 @@ import os |
| 9 | 9 | from app.util.component.FileProcess import FileProcess |
| 10 | 10 | from app.util.component.SliceScheme import SliceScheme |
| 11 | 11 | import shutil |
| 12 | -from app.util.component.StructuredPrint import StructurePrint | |
| 12 | +from app.util.component.StructurePrint import StructurePrint | |
| 13 | 13 | from flask import request |
| 14 | 14 | import uuid |
| 15 | 15 | import configure | ... | ... |
| ... | ... | @@ -6,7 +6,7 @@ |
| 6 | 6 | |
| 7 | 7 | from app.modules.service.models import TileScheme |
| 8 | 8 | from app.util.component.ModelVisitor import ModelVisitor |
| 9 | -from app.util.component.StructuredPrint import StructurePrint | |
| 9 | +from app.util.component.StructurePrint import StructurePrint | |
| 10 | 10 | import json |
| 11 | 11 | import base64 |
| 12 | 12 | ... | ... |
| ... | ... | @@ -4,7 +4,7 @@ |
| 4 | 4 | #email: nheweijun@sina.com |
| 5 | 5 | |
| 6 | 6 | from app.modules.data.models import Task |
| 7 | -from app.util.component.StructuredPrint import StructurePrint | |
| 7 | +from app.util.component.StructurePrint import StructurePrint | |
| 8 | 8 | import configure |
| 9 | 9 | import time |
| 10 | 10 | from app.util.component.PGUtil import PGUtil | ... | ... |
请
注册
或
登录
后发表评论