正在显示
14 个修改的文件
包含
55 行增加
和
14 行删除
... | ... | @@ -37,7 +37,7 @@ class Api(ApiTemplate): |
37 | 37 | download_process.start() |
38 | 38 | |
39 | 39 | task = Task(guid=task_guid, |
40 | - name="{}下载".format(self.para.get("table_name")), | |
40 | + name="下载|{}".format(self.para.get("table_name")), | |
41 | 41 | create_time=datetime.datetime.now(), |
42 | 42 | state=0, |
43 | 43 | task_type=4, | ... | ... |
... | ... | @@ -83,7 +83,7 @@ class Api(ApiTemplate): |
83 | 83 | # 录入数据后台进程,录入主函数为entry |
84 | 84 | # 初始化task |
85 | 85 | task = Task(guid=self.para.get("task_guid"), |
86 | - name=self.para.get("task_name"), | |
86 | + name="入库|{}".format(self.para.get("task_name")), | |
87 | 87 | create_time=datetime.datetime.now(), |
88 | 88 | state=0, |
89 | 89 | task_type=1, | ... | ... |
... | ... | @@ -79,7 +79,8 @@ class Api(ApiTemplate): |
79 | 79 | |
80 | 80 | |
81 | 81 | task = Task(guid=task_guid, |
82 | - name="{}构建矢量金字塔,网格大小:{}".format(table.name,self.para.get("grids")), | |
82 | + # name="矢量金字塔|{},网格大小:{}".format(table.name,self.para.get("grids")), | |
83 | + name="矢量金字塔|{}".format(table.name), | |
83 | 84 | table_guid=table_guid, |
84 | 85 | create_time=datetime.datetime.now(), |
85 | 86 | state=0, | ... | ... |
... | ... | @@ -7,7 +7,7 @@ from flask import current_app as app |
7 | 7 | import socket |
8 | 8 | |
9 | 9 | from app.util.component.ApiTemplate import ApiTemplate |
10 | -from app.modules.data.models import Task,InsertingLayerName,db | |
10 | +from app.modules.data.models import Task,InsertingLayerName,db,Table | |
11 | 11 | import datetime |
12 | 12 | import traceback |
13 | 13 | from sqlalchemy import or_ |
... | ... | @@ -22,6 +22,23 @@ class Api(ApiTemplate): |
22 | 22 | if last_lins: |
23 | 23 | for lin in last_lins: |
24 | 24 | db.session.delete(lin) |
25 | + | |
26 | + vacuate_tasks = db.session.query(Task).filter(or_(Task.state == 0, Task.state == 2)).filter_by(task_type = 2).all() | |
27 | + for t in vacuate_tasks: | |
28 | + table = Table.query.filter_by(guid=t.table_guid).one_or_none() | |
29 | + if len(table.relate_table_vacuates.all()) > 0: | |
30 | + Table.query.filter_by(guid=t.table_guid).update({"is_vacuate": 1}) | |
31 | + else: | |
32 | + Table.query.filter_by(guid=t.table_guid).update({"is_vacuate": 0}) | |
33 | + | |
34 | + vacutateing_table = Table.query.filter_by(is_vacuate=2).all() | |
35 | + | |
36 | + for vit in vacutateing_table: | |
37 | + if len(vit.relate_table_vacuates.all()) > 0: | |
38 | + vit.is_vacuate = 1 | |
39 | + else: | |
40 | + vit.is_vacuate = 0 | |
41 | + | |
25 | 42 | db.session.commit() |
26 | 43 | except Exception as e: |
27 | 44 | # print(e) | ... | ... |
... | ... | @@ -32,7 +32,7 @@ class Api(ApiTemplate): |
32 | 32 | "title":self.para.get("title"), |
33 | 33 | "type":"mapserver", |
34 | 34 | "capabilities":2, |
35 | - "project":self.para.get("project")} | |
35 | + "project":self.para.get("project"),"state":1} | |
36 | 36 | |
37 | 37 | map_service_register_url = "{}/dmap/api/manager/regservice".format(configure.dmap_engine) |
38 | 38 | resp: requests.Response = requests.post(map_service_register_url,data=json.dumps(para), | ... | ... |
... | ... | @@ -28,13 +28,16 @@ class Api(ApiTemplate): |
28 | 28 | project_file = ProjectFile.create(ModelVisitor.object_to_json(ts)) |
29 | 29 | service:Service = Service.query.filter_by(guid=ts.service_guid).one_or_none() |
30 | 30 | para = {"name":service.name,"title":service.title, |
31 | - "type":"tileserver","capabilities":1 if ts.tile_type=="WMTS" else 16,"project":project_file} | |
31 | + "type":"tileserver","capabilities":1 if ts.tile_type=="WMTS" else 16,"project":project_file, | |
32 | + "state":service.state} | |
32 | 33 | res["data"]["list"].append(para) |
33 | 34 | |
34 | 35 | #地图服务 |
35 | 36 | map_services = MapService.query.all() |
36 | 37 | for ms in map_services: |
38 | + service: Service = Service.query.filter_by(guid=ms.service_guid).one_or_none() | |
37 | 39 | para = ModelVisitor.object_to_json(ms) |
40 | + para["state"] = service.state | |
38 | 41 | res["data"]["list"].append(para) |
39 | 42 | res["data"]["count"] = len(tile_services)+len(map_services) |
40 | 43 | res["result"] = True | ... | ... |
... | ... | @@ -8,7 +8,7 @@ from app.util.component.ApiTemplate import ApiTemplate |
8 | 8 | from .models import Service,db |
9 | 9 | import requests |
10 | 10 | from .util.ServiceType import ServiceType |
11 | - | |
11 | +import configure | |
12 | 12 | |
13 | 13 | class Api(ApiTemplate): |
14 | 14 | api_name = "修改服务状态" |
... | ... | @@ -27,6 +27,19 @@ class Api(ApiTemplate): |
27 | 27 | if service: |
28 | 28 | service.state = state |
29 | 29 | db.session.commit() |
30 | + | |
31 | + # operate = "startService" if state == 1 else "stopService" | |
32 | + # server_type = "tileserver" if s_type == "电子地图" else "mapserver" | |
33 | + # dmap_engine_url = "{}/dmap/api/manager/{}?servicename={}&servername={}".format(configure.dmap_engine, | |
34 | + # operate,service.name, | |
35 | + # server_type) | |
36 | + # state_result = requests.get(dmap_engine_url) | |
37 | + # if state_result.status_code == 200: | |
38 | + # if not state_result.json().get("result"): | |
39 | + # raise Exception("修改服务状态失败!") | |
40 | + # else: | |
41 | + # raise Exception("修改服务状态失败!") | |
42 | + | |
30 | 43 | res["result"] = True |
31 | 44 | else: |
32 | 45 | raise Exception("服务不存在!") |
... | ... | @@ -76,7 +89,7 @@ class Api(ApiTemplate): |
76 | 89 | {"name": "state", |
77 | 90 | "in": "formData", |
78 | 91 | "type": "int", |
79 | - "description": "state"}, | |
92 | + "description": "state","enum":[0,1]}, | |
80 | 93 | ], |
81 | 94 | "responses": { |
82 | 95 | 200: { | ... | ... |
... | ... | @@ -35,7 +35,7 @@ class Api(ApiTemplate): |
35 | 35 | "title":self.para.get("title"), |
36 | 36 | "type":"tileserver", |
37 | 37 | "capabilities":1 if self.para.get("tile_type") == "WMTS" else 16, |
38 | - "project":project_file} | |
38 | + "project":project_file,"state":1} | |
39 | 39 | |
40 | 40 | tile_service_register_url = "{}/dmap/api/manager/RegService".format(configure.dmap_engine) |
41 | 41 | resp: Response = requests.post(tile_service_register_url,data=json.dumps(para), | ... | ... |
... | ... | @@ -30,7 +30,8 @@ class Api(ApiTemplate): |
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() |
32 | 32 | para = {"name":service.name,"title":service.title, |
33 | - "type":"tileserver","capabilities":1 if ts.tile_type=="WMTS" else 16,"project":project_file} | |
33 | + "type":"tileserver","capabilities":1 if ts.tile_type=="WMTS" else 16,"project":project_file, | |
34 | + "state":service.state} | |
34 | 35 | res["data"]["list"].append(para) |
35 | 36 | |
36 | 37 | res["data"]["count"] = len(tile_services) | ... | ... |
... | ... | @@ -11,9 +11,15 @@ fn = "PG: user=%s password=%s host=%s port=%s dbname=%s " % ("postgres","chinadc |
11 | 11 | driver = ogr.GetDriverByName("PostgreSQL") |
12 | 12 | if driver is None: |
13 | 13 | raise Exception("打开PostgreSQL驱动失败,可能是当前GDAL未支持PostgreSQL驱动!") |
14 | + | |
14 | 15 | ds:DataSource = driver.Open(fn, 1) |
15 | 16 | |
16 | 17 | layer:Layer = ds.GetLayerByName("BeijingBusStops") |
17 | 18 | |
18 | 19 | |
19 | -dd = gdal.Grid('outcome.tif',"J:\Data\矢量数据\北京\北京公交线路和公交站点shp\stops\BeijingBusStops.shp",algorithm = 'linear:radius=0') | |
\ No newline at end of file | ||
20 | +# dd = gdal.Grid('outcome.tif',"J:\Data\矢量数据\北京\北京公交线路和公交站点shp\stops\BeijingBusStops.shp",algorithm = 'linear:radius=0') | |
21 | +# layers='test', | |
22 | + | |
23 | +opts = gdal.GridOptions() | |
24 | + | |
25 | +dd = gdal.Grid('outcome.tif',ds,layers=['BeijingBusStops'],algorithm = 'linear:radius=0') | ... | ... |
test/outcome.tif
deleted
100644 → 0
不能预览此文件类型
请
注册
或
登录
后发表评论