Merge branch 'main' of git.veypi.com:ruoyunbai/node-red

This commit is contained in:
ruoyunbai 2025-10-21 16:42:58 +08:00
commit 4116b5f260
3 changed files with 643 additions and 24 deletions

View File

@ -27,6 +27,9 @@
"name": "gongwenxin",
"email": "gongwenxin@buaa.edu.cn"
}
},
"debug": {
"clearType": "all"
}
}
}

View File

@ -2,7 +2,15 @@
{
"id": "0ac020c7380665e7",
"type": "tab",
"label": "流程 1",
"label": "测试流程",
"disabled": false,
"info": "",
"env": []
},
{
"id": "78d15f59dee4b6d8",
"type": "tab",
"label": "流程 2",
"disabled": false,
"info": "",
"env": []
@ -37,11 +45,13 @@
"authType": "",
"senderr": false,
"headers": [],
"x": 350,
"y": 60,
"x": 1030,
"y": 560,
"wires": [
[
"6f07c9e60472a814"
"6f07c9e60472a814",
"2220f90bcc99b3a4",
"df389955c2ae3156"
]
]
},
@ -49,7 +59,7 @@
"id": "96fbb1fa63a1cb8b",
"type": "inject",
"z": "0ac020c7380665e7",
"name": "",
"name": "创建",
"props": [
{
"p": "payload"
@ -72,11 +82,11 @@
"topic": "",
"payload": "{\"version\":\"1.0.0\",\"act\":-1,\"data\":[{\"dsid\":\"testid2\",\"wellId\":\"WELL-zzlhTEST-002\",\"wellCommonName\":\"zzlh测试用井名\",\"wellLegalName\":\"zzlh-test-01\",\"wellPurpose\":\"开发井\",\"wellType\":\"直井\",\"dataRegion\":\"ZZLH\",\"projectId\":\"PROJ-ZZLH-001\",\"projectName\":\"zzlh测试地质单元\",\"orgId\":\"ORG-ZZLH-01\",\"orgName\":\"zzlh采油厂\",\"bsflag\":1,\"wellState\":\"生产中\",\"spudDate\":\"2024-01-15\",\"completionDate\":\"2024-05-20\",\"prodDate\":\"2024-06-01\",\"egl\":145.5,\"kbd\":5.2,\"kb\":150.7,\"actualXAxis\":550123.45,\"actualYAxis\":4998765.32,\"coordinateSystemName\":\"zzlh测试坐标系\",\"geoDescription\":\"位于zzlh测试区域\",\"remarks\":\"这是一口用于系统测试的生产井。\",\"createUserId\":\"testuser001\",\"createDate\":\"2025-09-12T10:00:00Z\",\"updateUserId\":\"testuser001\",\"updateDate\":\"2025-09-12T10:00:00Z\"}]}",
"payloadType": "json",
"x": 190,
"y": 80,
"x": 850,
"y": 400,
"wires": [
[
"be9c605d4cdaa297"
"013f3a0718a44e18"
]
]
},
@ -85,7 +95,7 @@
"type": "debug",
"z": "0ac020c7380665e7",
"name": "创建结果",
"active": true,
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
@ -93,15 +103,15 @@
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 520,
"y": 80,
"x": 1180,
"y": 440,
"wires": []
},
{
"id": "1b18d7419c63f2b5",
"type": "inject",
"z": "0ac020c7380665e7",
"name": "",
"name": "查询详情",
"props": [
{
"p": "headers",
@ -124,7 +134,7 @@
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 150,
"x": 160,
"y": 220,
"wires": [
[
@ -201,7 +211,7 @@
"id": "7f1ff1fda219baaa",
"type": "inject",
"z": "0ac020c7380665e7",
"name": "",
"name": "更新",
"props": [
{
"p": "payload"
@ -253,7 +263,7 @@
"id": "c3514fbf44147aed",
"type": "inject",
"z": "0ac020c7380665e7",
"name": "",
"name": "删除",
"props": [
{
"p": "headers",
@ -281,7 +291,7 @@
"topic": "",
"payload": "{\"version\":\"1.0.0\",\"data\":[\"testid2\"]}",
"payloadType": "json",
"x": 70,
"x": 90,
"y": 380,
"wires": [
[
@ -319,7 +329,7 @@
"persist": true,
"proxy": "",
"insecureHTTPParser": false,
"authType": "basic",
"authType": "",
"senderr": false,
"headers": [],
"x": 230,
@ -334,7 +344,7 @@
"id": "044945e983586ce5",
"type": "inject",
"z": "0ac020c7380665e7",
"name": "",
"name": "查询列表",
"props": [
{
"p": "headers",
@ -362,7 +372,7 @@
"topic": "",
"payload": "{}",
"payloadType": "json",
"x": 110,
"x": 120,
"y": 480,
"wires": [
[
@ -375,7 +385,7 @@
"type": "debug",
"z": "0ac020c7380665e7",
"name": "查询",
"active": true,
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
@ -383,7 +393,7 @@
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 430,
"x": 490,
"y": 480,
"wires": []
},
@ -400,14 +410,619 @@
"persist": true,
"proxy": "",
"insecureHTTPParser": false,
"authType": "basic",
"authType": "",
"senderr": false,
"headers": [],
"x": 290,
"y": 500,
"wires": [
[
"286d3b129ca1b756"
"286d3b129ca1b756",
"819906f13bb83e88"
]
]
},
{
"id": "819906f13bb83e88",
"type": "function",
"z": "0ac020c7380665e7",
"name": "function 1",
"func": "try {\n \n const payload = JSON.parse(msg.payload);\n if (payload && payload.data && Array.isArray(payload.data.list)) {\n msg.isEmpty = payload.data.list.length === 0;\n } else {\n msg.isEmpty = false; \n }\n} catch (e) {\n \n \n msg.isEmpty = false\n}\n\n\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 300,
"y": 600,
"wires": [
[
"7b828761c4ae4f35"
]
]
},
{
"id": "7b828761c4ae4f35",
"type": "switch",
"z": "0ac020c7380665e7",
"name": "",
"property": "isEmpty",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "true",
"vt": "jsonata"
},
{
"t": "neq",
"v": "true",
"vt": "jsonata"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 470,
"y": 580,
"wires": [
[
"e308201b5e361b2e",
"013f3a0718a44e18"
],
[
"5712828285fd7a38"
]
]
},
{
"id": "5712828285fd7a38",
"type": "debug",
"z": "0ac020c7380665e7",
"name": "debug 1",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "\"初始不为空,错误\"",
"targetType": "jsonata",
"statusVal": "",
"statusType": "auto",
"x": 490,
"y": 680,
"wires": []
},
{
"id": "e308201b5e361b2e",
"type": "debug",
"z": "0ac020c7380665e7",
"name": "debug 2",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "\"初始为空,正确\"",
"targetType": "jsonata",
"statusVal": "",
"statusType": "auto",
"x": 690,
"y": 640,
"wires": []
},
{
"id": "013f3a0718a44e18",
"type": "change",
"z": "0ac020c7380665e7",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"version\":\"1.0.0\",\"act\":-1,\"data\":[{\"dsid\":\"testid2\",\"wellId\":\"WELL-zzlhTEST-002\",\"wellCommonName\":\"zzlh测试用井名\",\"wellLegalName\":\"zzlh-test-01\",\"wellPurpose\":\"开发井\",\"wellType\":\"直井\",\"dataRegion\":\"ZZLH\",\"projectId\":\"PROJ-ZZLH-001\",\"projectName\":\"zzlh测试地质单元\",\"orgId\":\"ORG-ZZLH-01\",\"orgName\":\"zzlh采油厂\",\"bsflag\":1,\"wellState\":\"生产中\",\"spudDate\":\"2024-01-15\",\"completionDate\":\"2024-05-20\",\"prodDate\":\"2024-06-01\",\"egl\":145.5,\"kbd\":5.2,\"kb\":150.7,\"actualXAxis\":550123.45,\"actualYAxis\":4998765.32,\"coordinateSystemName\":\"zzlh测试坐标系\",\"geoDescription\":\"位于zzlh测试区域\",\"remarks\":\"这是一口用于系统测试的生产井。\",\"createUserId\":\"testuser001\",\"createDate\":\"2025-09-12T10:00:00Z\",\"updateUserId\":\"testuser001\",\"updateDate\":\"2025-09-12T10:00:00Z\"}]}",
"tot": "json"
},
{
"t": "set",
"p": "headers",
"pt": "msg",
"to": "{\"Content-Type\":\"application/json\",\"Authorization\":\"1\",\"Dataregion\":\"ZZLH\"}",
"tot": "json"
},
{
"t": "set",
"p": "rejectUnauthorized",
"pt": "msg",
"to": "false",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 880,
"y": 560,
"wires": [
[
"be9c605d4cdaa297"
]
]
},
{
"id": "8f574d489345a331",
"type": "switch",
"z": "0ac020c7380665e7",
"name": "",
"property": "isCreated",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "true",
"vt": "jsonata"
},
{
"t": "eq",
"v": "false",
"vt": "jsonata"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 1330,
"y": 620,
"wires": [
[
"23f668f265c1db5c",
"8f280fa3aac33505"
],
[
"4fd140a8f2df7e53"
]
]
},
{
"id": "2220f90bcc99b3a4",
"type": "function",
"z": "0ac020c7380665e7",
"name": "function 2",
"func": "try {\n const payloadObject = JSON.parse(msg.payload);\n msg.isCreated = (payloadObject.code === 0);\n\n} catch (e) {\n msg.isCreated = false;\n}\n\n// 返回更新后的 msg 对象\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1160,
"y": 620,
"wires": [
[
"8f574d489345a331"
]
]
},
{
"id": "23f668f265c1db5c",
"type": "debug",
"z": "0ac020c7380665e7",
"name": "debug 3",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "\"创建成功\"",
"targetType": "jsonata",
"statusVal": "",
"statusType": "auto",
"x": 1390,
"y": 460,
"wires": []
},
{
"id": "4fd140a8f2df7e53",
"type": "debug",
"z": "0ac020c7380665e7",
"name": "debug 4",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "创建失败",
"targetType": "jsonata",
"statusVal": "",
"statusType": "auto",
"x": 1410,
"y": 740,
"wires": []
},
{
"id": "df389955c2ae3156",
"type": "debug",
"z": "0ac020c7380665e7",
"name": "debug 6",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "msg",
"targetType": "jsonata",
"statusVal": "",
"statusType": "auto",
"x": 1000,
"y": 680,
"wires": []
},
{
"id": "39c28a10430cce71",
"type": "debug",
"z": "0ac020c7380665e7",
"name": "debug 5",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 800,
"y": 740,
"wires": []
},
{
"id": "551a78c76ae2bccf",
"type": "http request",
"z": "0ac020c7380665e7",
"name": "删除井",
"method": "DELETE",
"ret": "txt",
"paytoqs": "ignore",
"url": "",
"tls": "",
"persist": true,
"proxy": "",
"insecureHTTPParser": false,
"authType": "",
"senderr": false,
"headers": [],
"x": 1770,
"y": 660,
"wires": [
[
"99f3d98419231d12",
"e3cc68ad6021510f"
]
]
},
{
"id": "99f3d98419231d12",
"type": "debug",
"z": "0ac020c7380665e7",
"name": "删除结果",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1960,
"y": 540,
"wires": []
},
{
"id": "7d94b96bcc85d684",
"type": "inject",
"z": "0ac020c7380665e7",
"name": "删除",
"props": [
{
"p": "headers",
"v": "{\"Content-Type\":\"application/json\",\"Authorization\":\"1\",\"Dataregion\":\"ZZLH\"}",
"vt": "json"
},
{
"p": "rejectUnauthorized",
"v": "false",
"vt": "str"
},
{
"p": "url",
"v": "https://www.dev.ideas.cnpc/api/dms/well_kd_wellbore_ideas01/v1/cd_well",
"vt": "str"
},
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "{\"version\":\"1.0.0\",\"data\":[\"testid2\"]}",
"payloadType": "json",
"x": 1710,
"y": 480,
"wires": [
[
"551a78c76ae2bccf"
]
]
},
{
"id": "8f280fa3aac33505",
"type": "change",
"z": "0ac020c7380665e7",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "{\"version\":\"1.0.0\",\"data\":[\"testid2\"]}",
"tot": "json"
},
{
"t": "set",
"p": "headers",
"pt": "msg",
"to": "{\"Content-Type\":\"application/json\",\"Authorization\":\"1\",\"Dataregion\":\"ZZLH\"}",
"tot": "json"
},
{
"t": "set",
"p": "rejectUnauthorized",
"pt": "msg",
"to": "false",
"tot": "str"
},
{
"t": "set",
"p": "url",
"pt": "msg",
"to": "https://www.dev.ideas.cnpc/api/dms/well_kd_wellbore_ideas01/v1/cd_well",
"tot": "str"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1580,
"y": 620,
"wires": [
[
"551a78c76ae2bccf"
]
]
},
{
"id": "6585c529e8732137",
"type": "debug",
"z": "0ac020c7380665e7",
"name": "debug 7",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "\"删除成功\"",
"targetType": "jsonata",
"statusVal": "",
"statusType": "auto",
"x": 2170,
"y": 540,
"wires": []
},
{
"id": "3b9a9af3fb68645f",
"type": "switch",
"z": "0ac020c7380665e7",
"name": "",
"property": "isDeleted",
"propertyType": "msg",
"rules": [
{
"t": "eq",
"v": "true",
"vt": "jsonata"
},
{
"t": "eq",
"v": "false",
"vt": "jsonata"
}
],
"checkall": "true",
"repair": false,
"outputs": 2,
"x": 2110,
"y": 700,
"wires": [
[
"6585c529e8732137",
"cfbf5ff4275a974e"
],
[
"f80987279214f312"
]
]
},
{
"id": "f80987279214f312",
"type": "debug",
"z": "0ac020c7380665e7",
"name": "debug 8",
"active": true,
"tosidebar": true,
"console": true,
"tostatus": false,
"complete": "删除失败",
"targetType": "jsonata",
"statusVal": "",
"statusType": "auto",
"x": 2190,
"y": 820,
"wires": []
},
{
"id": "e3cc68ad6021510f",
"type": "function",
"z": "0ac020c7380665e7",
"name": "function 3",
"func": "try {\n const payloadObject = JSON.parse(msg.payload);\n msg.isDeleted = (payloadObject.code === 0);\n\n} catch (e) {\n msg.isDeleted = false;\n}\n\n// 返回更新后的 msg 对象\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1920,
"y": 700,
"wires": [
[
"3b9a9af3fb68645f",
"f92150ebdd4ca3ff"
]
]
},
{
"id": "f92150ebdd4ca3ff",
"type": "debug",
"z": "0ac020c7380665e7",
"name": "debug 9",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "msg",
"targetType": "jsonata",
"statusVal": "",
"statusType": "auto",
"x": 2000,
"y": 760,
"wires": []
},
{
"id": "c281f9583e262827",
"type": "function",
"z": "0ac020c7380665e7",
"name": "function 4",
"func": "msg.headers = { \"Content-Type\": \"application/json\", \"Authorization\": \"1\", \"Dataregion\": \"ZZLH\" }\nmsg.body={}\nmsg.rejectUnauthorized=false\nmsg.url = \"https://www.dev.ideas.cnpc/api/dms/well_kd_wellbore_ideas01/v1/cd_well/1.0.0\"\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 100,
"y": 580,
"wires": [
[
"5921574867140eb3"
]
]
},
{
"id": "ea8a01974cede86a",
"type": "http in",
"z": "0ac020c7380665e7",
"name": "",
"url": "/test",
"method": "get",
"upload": false,
"skipBodyParsing": false,
"swaggerDoc": "",
"x": 80,
"y": 660,
"wires": [
[
"c281f9583e262827"
]
]
},
{
"id": "fdf4a7a6166cf05c",
"type": "http response",
"z": "0ac020c7380665e7",
"name": "",
"statusCode": "",
"headers": {},
"x": 2370,
"y": 700,
"wires": []
},
{
"id": "cfbf5ff4275a974e",
"type": "function",
"z": "0ac020c7380665e7",
"name": "function 5",
"func": "msg.payload = { \"code\": 0, \"message\": \"井创建删除流程测试成功\",}\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 2260,
"y": 640,
"wires": [
[
"fdf4a7a6166cf05c"
]
]
},
{
"id": "fd3672b8ebb314ee",
"type": "http in",
"z": "78d15f59dee4b6d8",
"name": "单接口测试",
"url": "/single_test",
"method": "post",
"upload": false,
"skipBodyParsing": false,
"swaggerDoc": "",
"x": 200,
"y": 240,
"wires": [
[
"f414ed448fcf544b"
]
]
},
{
"id": "d666851b16cf6482",
"type": "http response",
"z": "78d15f59dee4b6d8",
"name": "",
"statusCode": "",
"headers": {},
"x": 670,
"y": 240,
"wires": []
},
{
"id": "f414ed448fcf544b",
"type": "function",
"z": "78d15f59dee4b6d8",
"name": "function 6",
"func": "msg.payload = { \"code\": 0, \"message\": \"单接口测试成功\",}\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 460,
"y": 300,
"wires": [
[
"d666851b16cf6482"
]
]
}

View File

@ -5,5 +5,6 @@
"70a49687f823bf4e": {},
"ae5c8d27d69b77ed": {},
"0d437a2a77570c57": {},
"5921574867140eb3": {}
"5921574867140eb3": {},
"551a78c76ae2bccf": {}
}