From bfaeb50139d7b281e7a5760f609ffa969cc40122 Mon Sep 17 00:00:00 2001 From: yanyan Date: Wed, 21 Feb 2024 10:12:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E8=A7=86=E9=A2=91?= =?UTF-8?q?=E7=AD=94=E9=A2=98=E8=8E=B7=E5=8F=96=E5=AF=B9=E5=BA=94=E7=AD=94?= =?UTF-8?q?=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/zdxt/common/util/http/HttpUtils.java | 37 ++++++-- .../resources/static/drawflow/src/drawflow.js | 7 +- .../templates/project/question/addNew.html | 11 +++ .../templates/project/question/index.html | 52 ++++++----- .../controller/SceneManageController.java | 12 ++- .../knowledge/mapper/SceneManageMapper.java | 3 + .../service/ISceneManageService.java | 13 +++ .../service/impl/SceneManageServiceImpl.java | 87 +++++++++++++++++++ .../impl/SceneQuestionServiceImpl.java | 40 ++++++++- .../resources/mapper/SceneQuestionMapper.xml | 2 +- 10 files changed, 230 insertions(+), 34 deletions(-) diff --git a/lib/EmergencyBaseLib/EmergencyCommon/src/main/java/com/zdxt/common/util/http/HttpUtils.java b/lib/EmergencyBaseLib/EmergencyCommon/src/main/java/com/zdxt/common/util/http/HttpUtils.java index c7de22a3..86b6d956 100644 --- a/lib/EmergencyBaseLib/EmergencyCommon/src/main/java/com/zdxt/common/util/http/HttpUtils.java +++ b/lib/EmergencyBaseLib/EmergencyCommon/src/main/java/com/zdxt/common/util/http/HttpUtils.java @@ -5,10 +5,7 @@ import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.PrintWriter; -import java.net.ConnectException; -import java.net.SocketTimeoutException; -import java.net.URL; -import java.net.URLConnection; +import java.net.*; import java.security.cert.X509Certificate; import javax.net.ssl.HostnameVerifier; import javax.net.ssl.HttpsURLConnection; @@ -16,12 +13,15 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSession; import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; + +import cn.hutool.core.io.IoUtil; +import cn.hutool.json.JSONObject; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * 通用http发送方法 - * + * * @author ruoyi */ public class HttpUtils @@ -245,4 +245,31 @@ public class HttpUtils return true; } } + + public static InputStream postInputStream(String urlStr , JSONObject paramJson) throws Exception { + //获取小程序码,通过该接口生成的小程序码,永久有效,有数量限制 + URL url = new URL(urlStr); + + HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection(); + httpURLConnection.setRequestMethod("POST");// 提交模式 + // 发送POST请求必须设置如下两行 + httpURLConnection.setDoOutput(true); + httpURLConnection.setDoInput(true); + // 获取URLConnection对象对应的输出流 + PrintWriter printWriter = new PrintWriter(httpURLConnection.getOutputStream()); + + printWriter.write(paramJson.toString()); + // flush输出流的缓冲 + printWriter.flush(); + String contentType = httpURLConnection.getContentType(); + if (contentType.contains("json")) { + IoUtil.copy(httpURLConnection.getInputStream(), System.out); + throw new IllegalArgumentException("调用微信小程序生成接口出错"); + } else { + //开始获取数据 + return httpURLConnection.getInputStream(); + } + + } + } \ No newline at end of file diff --git a/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/static/drawflow/src/drawflow.js b/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/static/drawflow/src/drawflow.js index 94423795..73fa2fe4 100644 --- a/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/static/drawflow/src/drawflow.js +++ b/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/static/drawflow/src/drawflow.js @@ -1167,7 +1167,8 @@ export default class Drawflow { var moduleName = this.getModuleFromNodeId(id) return JSON.parse(JSON.stringify(this.drawflow.drawflow[moduleName].data[id])); } - getNodesFromName(name) { + + getNodesFromName(name,val) { var nodes = []; const editor = this.drawflow.drawflow Object.keys(editor).map(function(moduleName, index) { @@ -1177,6 +1178,9 @@ export default class Drawflow { } } }); + // let nodeId = nodes.at(0); + // var moduleName = this.getModuleFromNodeId(nodeId) + // this.drawflow.drawflow[moduleName].data[id].data = {option: val+'', value: '', channel: val+''}; return nodes; } @@ -1492,6 +1496,7 @@ export default class Drawflow { } updateNodeDataFromId(id, data) { + debugger var moduleName = this.getModuleFromNodeId(id) this.drawflow.drawflow[moduleName].data[id].data = data; if(this.module === moduleName) { diff --git a/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/addNew.html b/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/addNew.html index 755a7179..bf5c1027 100644 --- a/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/addNew.html +++ b/lib/EmergencyService/zdxtEmergencyBootStart/src/main/resources/templates/project/question/addNew.html @@ -4,6 +4,7 @@ +
@@ -69,6 +70,8 @@