map, HttpRequestType httpRequestType) throws IOException {
+ return executeAndParse(HttpRequest
+ .custom()
+ .url(url)
+ .headers(map)
+ .method(httpRequestType)
+ .httpEntity(httpEntity)
+ .encoding(charset.toString())
+ .build(),
+ TextResponseHandle.DEFAULT);
+ }
+
+ /**
+ * 请求资源或服务,使用默认文本http解析器,UTF-8编码
+ *
+ * @param httpRequest httpRequest
+ * @return 返回处理结果
+ */
+ public static String executeAndParse(HttpRequest httpRequest) throws IOException {
+ return executeAndParse(httpRequest, TextResponseHandle.DEFAULT);
+ }
+
+ /**
+ * 请求资源或服务,自请求参数,并指定 http 响应处理器
+ * 例:
+ *
+ * String res = HttpToolbox.executeAndParse(HttpRequest
+ * .custom()
+ * .url("")
+ * .build(),
+ * TextResponseHandle.DEFAULT);
+ *
+ *
+ * @param httpRequest httpRequest
+ * @param handle http 解析器
+ * @return 返回处理结果
+ */
+ public static T executeAndParse(HttpRequest httpRequest, BaseHttpResponseHandle handle) throws IOException {
+ return handle.parse(execute(httpRequest));
+ }
+
+ /**
+ * 请求资源或服务,传入请求参数
+ *
+ * @param httpRequest httpRequest
+ * @return 返回处理结果
+ */
+ public static CloseableHttpResponse execute(HttpRequest httpRequest) throws IOException {
+ return execute(getHttpClient(httpRequest.getUrl()), httpRequest);
+ }
+
+ /**
+ * 请求资源或服务,自定义client对象,传入请求参数
+ *
+ * @param httpClient http客户端
+ * @param httpRequest httpRequest
+ * @return 返回处理结果
+ */
+ public static CloseableHttpResponse execute(CloseableHttpClient httpClient, HttpRequest httpRequest) throws IOException {
+ String url = httpRequest.getUrl();
+
+ // 创建请求对象
+ HttpRequestBase httpRequestBase = httpRequest.getMethod().createHttpRequest(url);
+
+ // 设置header信息
+ httpRequestBase.setHeader("User-Agent", "Mozilla/5.0");
+ Map headers = httpRequest.getHeaders();
+ if (headers != null && !headers.isEmpty()) {
+ for (Map.Entry entry : headers.entrySet()) {
+ httpRequestBase.setHeader(entry.getKey(), entry.getValue());
+ }
+ }
+
+ // 配置请求的设置
+ RequestConfig requestConfig = httpRequest.getConfig();
+ if (requestConfig != null) {
+ httpRequestBase.setConfig(requestConfig);
+ }
+
+ // 判断是否支持设置entity(仅HttpPost、HttpPut、HttpPatch支持)
+ if (HttpEntityEnclosingRequestBase.class.isAssignableFrom(httpRequestBase.getClass())) {
+ setHttpEntity((HttpEntityEnclosingRequestBase) httpRequestBase, httpRequest);
+ } else {
+ Map params = httpRequest.getParams();
+ if (params != null && !params.isEmpty()) {
+ // 注意get等不支持设置entity需要更新拼接之后的URL,但是url变量没有更新
+ httpRequestBase.setURI(URI.create(buildUrl(url, params, httpRequest.getEncoding())));
+ }
+ }
+
+ return httpClient.execute(httpRequestBase);
+ }
+
+ /**
+ * 构建 Url
+ *
+ * @param url 请求地址
+ * @param params 参数
+ * @return 拼接之后的地址
+ */
+ public static String buildUrl(String url, Map params) {
+ try {
+ return buildUrl(url, params, EncodeConstants.ENCODING_UTF_8);
+ } catch (UnsupportedEncodingException ignore) {
+ }
+ return url;
+ }
+
+
+ /**
+ * 构建 Url
+ *
+ * @param url 请求地址
+ * @param params 参数
+ * @return 拼接之后的地址
+ * @throws UnsupportedEncodingException 不支持的编码
+ */
+ private static String buildUrl(String url, Map params, String paramsEncoding) throws UnsupportedEncodingException {
+ if (params == null || params.isEmpty()) {
+ return url;
+ }
+ URIBuilder builder;
+ try {
+ builder = new URIBuilder(url);
+ for (Map.Entry entry : params.entrySet()) {
+ String key = URLEncoder.encode(entry.getKey(), paramsEncoding);
+ String value = URLEncoder.encode(entry.getValue(), paramsEncoding);
+ builder.setParameter(key, value);
+ }
+ return builder.build().toString();
+ } catch (URISyntaxException e) {
+ LogKit.debug("Error to build url, please check the arguments.");
+ }
+ return url;
+ }
+ }
\ No newline at end of file
diff --git a/src/main/java/com/fr/plugin/idfh/web/HttpOutputActionHandler.java b/src/main/java/com/fr/plugin/idfh/web/HttpOutputActionHandler.java
new file mode 100644
index 0000000..9528e8d
--- /dev/null
+++ b/src/main/java/com/fr/plugin/idfh/web/HttpOutputActionHandler.java
@@ -0,0 +1,49 @@
+ /*
+ * Copyright (C), 2018-2021
+ * Project: starter
+ * FileName: HttpOutputActionHandler
+ * Author: Louis
+ * Date: 2021/4/6 15:43
+ */
+ package com.fr.plugin.idfh.web;
+
+ import com.fanruan.api.i18n.I18nKit;
+ import com.fr.general.GeneralUtils;
+ import com.fr.plugin.context.PluginContexts;
+ import com.fr.plugin.idfh.action.*;
+ import com.fr.schedule.feature.output.OutputActionHandler;
+
+ import java.util.LinkedHashMap;
+ import java.util.Map;
+
+ /**
+ *
+ *
+ *
+ * @author fr.open
+ * @since 1.0.0
+ */
+ public class HttpOutputActionHandler extends OutputActionHandler {
+ public static final Map httpTypeMap = new LinkedHashMap() {
+ private static final long serialVersionUID = -5593329532670407219L;
+
+ {
+ put(I18nKit.getLocText("Plugin-httpaction_ClassName_Get"), new GetOutput());
+ put(I18nKit.getLocText("Plugin-httpaction_ClassName_Post"), new PostOutput());
+ put(I18nKit.getLocText("Plugin-httpaction_ClassName_Post_Json"), new PostJsonOutput());
+ put(I18nKit.getLocText("Plugin-httpaction_ClassName_Soap"), new SoapOutput());
+ }
+ };
+
+ public HttpOutputActionHandler() {
+ }
+
+ @Override
+ public void doAction(OutputHttp outputHttp, Map params) throws Exception {
+ if (!PluginContexts.currentContext().isAvailable()) {
+ return;
+ }
+ AbstractDataOutput outputActionHandler = httpTypeMap.get(outputHttp.getHttpType());
+ outputActionHandler.doAction(outputHttp, params);
+ }
+ }
\ No newline at end of file
diff --git a/src/main/resources/com/fr/plugin/idfh/locale/lang.properties b/src/main/resources/com/fr/plugin/idfh/locale/lang.properties
new file mode 100644
index 0000000..f780744
--- /dev/null
+++ b/src/main/resources/com/fr/plugin/idfh/locale/lang.properties
@@ -0,0 +1,17 @@
+Plugin-httpaction=Schedule Http Action
+Plugin-httpaction_ClassPath_Title=Submit Method
+Plugin-httpaction_Url=API Url
+Plugin-httpaction_Header_Property=Header Property
+Plugin-httpaction_Body_Property=Body Property
+Plugin-httpaction_Body_Content=Body Content
+Plugin-httpaction_ClassName_Get_Submit=Get
+Plugin-httpaction_ClassName_Post_Submit=Post
+Plugin-httpaction_ClassName_Post_Json_Submit=PostJson
+Plugin-httpaction_ClassName_Soap_Submit=Soap
+Plugin-httpaction_Handing_Way=HTTP API
+Plugin-httpaction_Link_Valid=URL is not empty
+Plugin-httpaction_Body_Content_Valid=Body Template is not empty
+Plugin-httpaction_Body_Content_Format_Valid=body Template Error
+Plugin-httpaction_Header_Content-Type_Valid=Header Content-Type Error
+Plugin-httpaction_Header_SOAPAction_Valid=Header SOAPAction Error
+Plugin-httpaction_Result_Message=Result:
\ No newline at end of file
diff --git a/src/main/resources/com/fr/plugin/idfh/locale/lang_zh_CN.properties b/src/main/resources/com/fr/plugin/idfh/locale/lang_zh_CN.properties
new file mode 100644
index 0000000..6544502
--- /dev/null
+++ b/src/main/resources/com/fr/plugin/idfh/locale/lang_zh_CN.properties
@@ -0,0 +1,17 @@
+Plugin-httpaction=\u5B9A\u65F6\u8C03\u5EA6\u6570\u636E\u63A5\u53E3\u5904\u7406
+Plugin-httpaction_ClassPath_Title=\u63D0\u4EA4\u65B9\u5F0F
+Plugin-httpaction_Url=\u63A5\u53E3\u5730\u5740
+Plugin-httpaction_Header_Property=Header\u53C2\u6570
+Plugin-httpaction_Body_Property=Body\u53C2\u6570
+Plugin-httpaction_Body_Content=Body\u5185\u5BB9
+Plugin-httpaction_ClassName_Get=Get
+Plugin-httpaction_ClassName_Post=Post
+Plugin-httpaction_ClassName_Post_Json=PostJson
+Plugin-httpaction_ClassName_Soap=Soap
+Plugin-httpaction_Handing_Way=HTTP\u63A5\u53E3
+Plugin-httpaction_Link_Valid=\u94FE\u63A5\u4E0D\u80FD\u4E3A\u7A7A
+Plugin-httpaction_Body_Content_Valid=body\u6A21\u677F\u4E0D\u80FD\u4E3A\u7A7A
+Plugin-httpaction_Body_Content_Format_Valid=body\u6A21\u677F\u683C\u5F0F\u9519\u8BEF
+Plugin-httpaction_Header_Content-Type_Valid=Header\u53C2\u6570Content-Type\u4E3A\u7A7A\u6216\u9519\u8BEF
+Plugin-httpaction_Header_SOAPAction_Valid=Header\u53C2\u6570SOAPAction\u4E3A\u7A7A\u6216\u9519\u8BEF
+Plugin-httpaction_Result_Message=\u7ED3\u679C:
\ No newline at end of file
diff --git a/src/main/resources/com/fr/plugin/idfh/web/dist/js/httpaction.js b/src/main/resources/com/fr/plugin/idfh/web/dist/js/httpaction.js
new file mode 100644
index 0000000..5b0f9c4
--- /dev/null
+++ b/src/main/resources/com/fr/plugin/idfh/web/dist/js/httpaction.js
@@ -0,0 +1,259 @@
+!(function () {
+ var HttpAction = BI.inherit(BI.Widget, {
+ props: {
+ baseCls: ""
+ },
+ _store: function () {
+ return BI.Models.getModel("dec.model.schedule.task.file.handling.httpaction")
+ },
+ watch: {
+ httpType: function (e) {
+ this.httpType.setValue(e);
+ },
+ apiUrl: function (e) {
+ this.apiUrl.setValue(e)
+ },
+ headers: function (e) {
+ this.headers.setValue(e)
+ },
+ bodyParameters: function (e) {
+ this.bodyParameters.setValue(e)
+ },
+ bodyContent: function (e) {
+ this.bodyContent.setValue(e)
+ },
+ previewAttach: function (e) {
+ this.previewAttach.setSelected(e)
+ }
+ },
+ mounted: function () {
+ var e = this.options.value;
+ BI.isEmpty(e) || this.setValue(e)
+ },
+ render: function () {
+ var self = this;
+ return {
+ type: "bi.vertical",
+ tgap: 15,
+ items: [{//提交方式
+ type: "bi.horizontal",
+ items: [{
+ type: "bi.label",
+ cls: "dec-font-weight-bold",
+ width: 115,
+ height: 24,
+ textAlign: "left",
+ text: BI.i18nText("Plugin-httpaction_ClassPath_Title")
+ },
+ {
+ type: "bi.text_value_combo",
+ width: 300,
+ value: self.model.httpType,
+ ref: function (e) {
+ self.httpType = e
+ },
+ listeners: [{
+ eventName: BI.TextValueCombo.EVENT_CHANGE,
+ action: function () {
+ var e = this.getValue()[0];
+ self.store.setHttpType(e)
+ }
+ }],
+ items: [{
+ text: BI.i18nText("Plugin-httpaction_ClassName_Post_Json"),
+ value: BI.i18nText("Plugin-httpaction_ClassName_Post_Json")
+ }]
+ }]
+ },
+ {//接口地址
+ type: "dec.label.editor.item",
+ text: BI.i18nText("Plugin-httpaction_Url"),
+ textCls: "dec-font-weight-bold",
+ textWidth: 115,
+ editorWidth: 300,
+ watermark: BI.i18nText("Dec-Basic_Support_Formula_Input"),
+ ref: function (e) {
+ self.apiUrl = e
+ },
+ allowBlank: false,
+ bubbleError: false,
+ errorText: BI.i18nText("Plugin-httpaction_Link_Valid"),
+ listeners: [{
+ eventName: BI.Editor.EVENT_CHANGE,
+ action: function () {
+ self.store.setApiUrl(this.getValue());
+ }
+ }]
+ },
+ {//header参数
+ type: "dec.label.editor.item",
+ text: BI.i18nText("Plugin-httpaction_Header_Property"),
+ textCls: "dec-font-weight-bold",
+ textWidth: 115,
+ editorWidth: 300,
+ watermark: BI.i18nText("Dec-Basic_Support_Formula_Input"),
+ ref: function (e) {
+ self.headers = e
+ },
+ allowBlank: false,
+ bubbleError: false,
+ errorText: BI.i18nText("Dec-Error_Null"),
+ listeners: [{
+ eventName: BI.Editor.EVENT_CHANGE,
+ action: function () {
+ self.store.setHeaders(this.getValue());
+ }
+ }]
+ },
+ {//body参数
+ type: "dec.label.editor.item",
+ text: BI.i18nText("Plugin-httpaction_Body_Property"),
+ textCls: "dec-font-weight-bold",
+ textWidth: 115,
+ editorWidth: 300,
+ watermark: BI.i18nText("Dec-Basic_Support_Formula_Input"),
+ ref: function (e) {
+ self.bodyParameters = e
+ },
+ allowBlank: false,
+ bubbleError: false,
+ errorText: BI.i18nText("Dec-Error_Null"),
+ listeners: [{
+ eventName: BI.Editor.EVENT_CHANGE,
+ action: function () {
+ self.store.setBodyParameters(this.getValue());
+ }
+ }]
+ },
+ {//bodyContent
+ type: "dec.label.textarea.item",
+ text: BI.i18nText("Plugin-httpaction_Body_Content"),
+ textCls: "dec-font-weight-bold",
+ watermark: BI.i18nText("Dec-Basic_Support_Formula_Input"),
+ textWidth: 100,
+ editorWidth: 390,
+ editorHeight: 100,
+ ref: function (e) {
+ self.bodyContent = e
+ },
+ allowBlank: false,
+ bubbleError: false,
+ errorText: BI.i18nText("Plugin-httpaction_Body_Content_Valid"),
+ listeners: [{
+ eventName: BI.Editor.EVENT_CHANGE,
+ action: function () {
+ self.store.setBodyContent(this.getValue());
+ }
+ }]
+ },
+ {//PreviewTemplate
+ type: "bi.multi_select_item",
+ selected: self.model.previewAttach,
+ logic: {
+ dynamic: !0
+ },
+ text: BI.i18nText("Dec-Task_Preview_Template_Content"),
+ ref: function (e) {
+ self.previewAttach = e
+ },
+ listeners: [{
+ eventName: BI.MultiSelectItem.EVENT_CHANGE,
+ action: function () {
+ self.store.setPreviewAttach(this.isSelected());
+ }
+ }]
+ }]
+ };
+ },
+ /**
+ * 设定各项值
+ */
+ setValue: function (e) {
+ var self = this;
+ BI.map(e, function (e, t) {
+ self.store.setHttpType(t.httpType);
+ self.store.setApiUrl(t.apiUrl);
+ self.store.setHeaders(t.headers);
+ self.store.setBodyParameters(t.bodyParameters);
+ self.store.setBodyContent(t.bodyContent);
+ self.store.setPreviewAttach(t.previewAttach);
+ });
+ },
+ /**
+ * 校验函数,可选
+ * 返回值当前处理方式是否通过校验
+ * @returns {boolean}
+ */
+ validation: function () {
+ return true;
+ },
+ /**
+ * 取值函数,必选
+ * 返回的值放到outputActionList中
+ * @returns {{}}
+ */
+ getValue: function () {
+ var self = this;
+ return {
+ OutputHttp: BI.extend(self.value, {
+ "@class": "com.fr.plugin.idfh.action.OutputHttp",
+ actionName: "com.fr.plugin.idfh.action.OutputHttp",
+ httpType: self.model.httpType,
+ apiUrl: self.model.apiUrl,
+ headers: self.model.headers,
+ bodyParameters: self.model.bodyParameters,
+ bodyContent: self.model.bodyContent,
+ previewAttach: self.model.previewAttach
+ })
+ };
+ }
+ });
+ BI.shortcut("dec.schedule.task.file.handling.httpaction", HttpAction);
+}) ();
+!(function() {
+ var HttpActionModel = BI.inherit(Fix.Model, {
+ context: ["currTask"],
+ state: function() {
+ return {
+ httpType: BI.i18nText("Plugin-httpaction_ClassName_Get"),
+ apiUrl: '',
+ headers: '',
+ bodyParameters: '',
+ bodyContent: '',
+ previewAttach: false
+ }
+ },
+ actions: {
+ setHttpType: function (e) {
+ this.model.httpType = e
+ },
+ setApiUrl: function (e) {
+ this.model.apiUrl = e
+ },
+ setHeaders: function (e) {
+ this.model.headers = e
+ },
+ setBodyParameters: function (e) {
+ this.model.bodyParameters = e
+ },
+ setBodyContent: function (e) {
+ this.model.bodyContent = e
+ },
+ setPreviewAttach: function (e) {
+ e ? this.model.currTask.scheduleOutput.formats = BI.union(this.model.currTask.scheduleOutput.formats, [DecCst.Schedule.Template.Accessory.PREVIEW]) : BI.remove(this.model.currTask.scheduleOutput.formats, DecCst.Schedule.Template.Accessory.PREVIEW)
+ this.model.previewAttach = e;
+ }
+ }
+ });
+ BI.model("dec.model.schedule.task.file.handling.httpaction", HttpActionModel);
+}) ();
+!(function () {
+ BI.config("dec.provider.schedule", function (provider) {
+ provider.registerHandingWay({
+ text: BI.i18nText("Plugin-httpaction_Handing_Way"),
+ value: "com.fr.plugin.idfh.action.OutputHttp",
+ cardType: "dec.schedule.task.file.handling.httpaction",
+ actions: []
+ }, [DecCst.Schedule.TaskType.DEFAULT, DecCst.Schedule.TaskType.REPORT, DecCst.Schedule.TaskType.BI]);
+ });
+}) ();
diff --git a/src/main/resources/com/fr/plugin/idfh/web/dist/js/httpaction.min.js b/src/main/resources/com/fr/plugin/idfh/web/dist/js/httpaction.min.js
new file mode 100644
index 0000000..467a23b
--- /dev/null
+++ b/src/main/resources/com/fr/plugin/idfh/web/dist/js/httpaction.min.js
@@ -0,0 +1,2 @@
+/** com.fr.plugin.httpaction 22-03-23 00:31:53 */
+!function(){var t=BI.inherit(BI.Widget,{props:{baseCls:""},_store:function(){return BI.Models.getModel("dec.model.schedule.task.file.handling.httpaction")},watch:{httpType:function(t){this.httpType.setValue(t)},apiUrl:function(t){this.apiUrl.setValue(t)},headers:function(t){this.headers.setValue(t)},bodyParameters:function(t){this.bodyParameters.setValue(t)},bodyContent:function(t){this.bodyContent.setValue(t)},previewAttach:function(t){this.previewAttach.setSelected(t)}},mounted:function(){var t=this.options.value;BI.isEmpty(t)||this.setValue(t)},render:function(){var e=this;return{type:"bi.vertical",tgap:15,items:[{type:"bi.horizontal",items:[{type:"bi.label",cls:"dec-font-weight-bold",width:115,height:24,textAlign:"left",text:BI.i18nText("Plugin-httpaction_ClassPath_Title")},{type:"bi.text_value_combo",width:300,value:e.model.httpType,ref:function(t){e.httpType=t},listeners:[{eventName:BI.TextValueCombo.EVENT_CHANGE,action:function(){var t=this.getValue()[0];e.store.setHttpType(t)}}],items:[{text:BI.i18nText("Plugin-httpaction_ClassName_Post_Json"),value:BI.i18nText("Plugin-httpaction_ClassName_Post_Json")}]}]},{type:"dec.label.editor.item",text:BI.i18nText("Plugin-httpaction_Url"),textCls:"dec-font-weight-bold",textWidth:115,editorWidth:300,watermark:BI.i18nText("Dec-Basic_Support_Formula_Input"),ref:function(t){e.apiUrl=t},allowBlank:!1,bubbleError:!1,errorText:BI.i18nText("Plugin-httpaction_Link_Valid"),listeners:[{eventName:BI.Editor.EVENT_CHANGE,action:function(){e.store.setApiUrl(this.getValue())}}]},{type:"dec.label.editor.item",text:BI.i18nText("Plugin-httpaction_Header_Property"),textCls:"dec-font-weight-bold",textWidth:115,editorWidth:300,watermark:BI.i18nText("Dec-Basic_Support_Formula_Input"),ref:function(t){e.headers=t},allowBlank:!1,bubbleError:!1,errorText:BI.i18nText("Dec-Error_Null"),listeners:[{eventName:BI.Editor.EVENT_CHANGE,action:function(){e.store.setHeaders(this.getValue())}}]},{type:"dec.label.editor.item",text:BI.i18nText("Plugin-httpaction_Body_Property"),textCls:"dec-font-weight-bold",textWidth:115,editorWidth:300,watermark:BI.i18nText("Dec-Basic_Support_Formula_Input"),ref:function(t){e.bodyParameters=t},allowBlank:!1,bubbleError:!1,errorText:BI.i18nText("Dec-Error_Null"),listeners:[{eventName:BI.Editor.EVENT_CHANGE,action:function(){e.store.setBodyParameters(this.getValue())}}]},{type:"dec.label.textarea.item",text:BI.i18nText("Plugin-httpaction_Body_Content"),textCls:"dec-font-weight-bold",watermark:BI.i18nText("Dec-Basic_Support_Formula_Input"),textWidth:100,editorWidth:390,editorHeight:100,ref:function(t){e.bodyContent=t},allowBlank:!1,bubbleError:!1,errorText:BI.i18nText("Plugin-httpaction_Body_Content_Valid"),listeners:[{eventName:BI.Editor.EVENT_CHANGE,action:function(){e.store.setBodyContent(this.getValue())}}]},{type:"bi.multi_select_item",selected:e.model.previewAttach,logic:{dynamic:!0},text:BI.i18nText("Dec-Task_Preview_Template_Content"),ref:function(t){e.previewAttach=t},listeners:[{eventName:BI.MultiSelectItem.EVENT_CHANGE,action:function(){e.store.setPreviewAttach(this.isSelected())}}]}]}},setValue:function(t){var i=this;BI.map(t,function(t,e){i.store.setHttpType(e.httpType),i.store.setApiUrl(e.apiUrl),i.store.setHeaders(e.headers),i.store.setBodyParameters(e.bodyParameters),i.store.setBodyContent(e.bodyContent),i.store.setPreviewAttach(e.previewAttach)})},validation:function(){return!0},getValue:function(){var t=this;return{OutputHttp:BI.extend(t.value,{"@class":"com.fr.plugin.idfh.action.OutputHttp",actionName:"com.fr.plugin.idfh.action.OutputHttp",httpType:t.model.httpType,apiUrl:t.model.apiUrl,headers:t.model.headers,bodyParameters:t.model.bodyParameters,bodyContent:t.model.bodyContent,previewAttach:t.model.previewAttach})}}});BI.shortcut("dec.schedule.task.file.handling.httpaction",t)}(),function(){var t=BI.inherit(Fix.Model,{context:["currTask"],state:function(){return{httpType:BI.i18nText("Plugin-httpaction_ClassName_Get"),apiUrl:"",headers:"",bodyParameters:"",bodyContent:"",previewAttach:!1}},actions:{setHttpType:function(t){this.model.httpType=t},setApiUrl:function(t){this.model.apiUrl=t},setHeaders:function(t){this.model.headers=t},setBodyParameters:function(t){this.model.bodyParameters=t},setBodyContent:function(t){this.model.bodyContent=t},setPreviewAttach:function(t){t?this.model.currTask.scheduleOutput.formats=BI.union(this.model.currTask.scheduleOutput.formats,[DecCst.Schedule.Template.Accessory.PREVIEW]):BI.remove(this.model.currTask.scheduleOutput.formats,DecCst.Schedule.Template.Accessory.PREVIEW),this.model.previewAttach=t}}});BI.model("dec.model.schedule.task.file.handling.httpaction",t)}(),BI.config("dec.provider.schedule",function(t){t.registerHandingWay({text:BI.i18nText("Plugin-httpaction_Handing_Way"),value:"com.fr.plugin.idfh.action.OutputHttp",cardType:"dec.schedule.task.file.handling.httpaction",actions:[]},[DecCst.Schedule.TaskType.DEFAULT,DecCst.Schedule.TaskType.REPORT,DecCst.Schedule.TaskType.BI])});
\ No newline at end of file
diff --git a/src/main/resources/com/fr/plugin/idfh/web/dist/js/schedule.js b/src/main/resources/com/fr/plugin/idfh/web/dist/js/schedule.js
new file mode 100644
index 0000000..5b0f9c4
--- /dev/null
+++ b/src/main/resources/com/fr/plugin/idfh/web/dist/js/schedule.js
@@ -0,0 +1,259 @@
+!(function () {
+ var HttpAction = BI.inherit(BI.Widget, {
+ props: {
+ baseCls: ""
+ },
+ _store: function () {
+ return BI.Models.getModel("dec.model.schedule.task.file.handling.httpaction")
+ },
+ watch: {
+ httpType: function (e) {
+ this.httpType.setValue(e);
+ },
+ apiUrl: function (e) {
+ this.apiUrl.setValue(e)
+ },
+ headers: function (e) {
+ this.headers.setValue(e)
+ },
+ bodyParameters: function (e) {
+ this.bodyParameters.setValue(e)
+ },
+ bodyContent: function (e) {
+ this.bodyContent.setValue(e)
+ },
+ previewAttach: function (e) {
+ this.previewAttach.setSelected(e)
+ }
+ },
+ mounted: function () {
+ var e = this.options.value;
+ BI.isEmpty(e) || this.setValue(e)
+ },
+ render: function () {
+ var self = this;
+ return {
+ type: "bi.vertical",
+ tgap: 15,
+ items: [{//提交方式
+ type: "bi.horizontal",
+ items: [{
+ type: "bi.label",
+ cls: "dec-font-weight-bold",
+ width: 115,
+ height: 24,
+ textAlign: "left",
+ text: BI.i18nText("Plugin-httpaction_ClassPath_Title")
+ },
+ {
+ type: "bi.text_value_combo",
+ width: 300,
+ value: self.model.httpType,
+ ref: function (e) {
+ self.httpType = e
+ },
+ listeners: [{
+ eventName: BI.TextValueCombo.EVENT_CHANGE,
+ action: function () {
+ var e = this.getValue()[0];
+ self.store.setHttpType(e)
+ }
+ }],
+ items: [{
+ text: BI.i18nText("Plugin-httpaction_ClassName_Post_Json"),
+ value: BI.i18nText("Plugin-httpaction_ClassName_Post_Json")
+ }]
+ }]
+ },
+ {//接口地址
+ type: "dec.label.editor.item",
+ text: BI.i18nText("Plugin-httpaction_Url"),
+ textCls: "dec-font-weight-bold",
+ textWidth: 115,
+ editorWidth: 300,
+ watermark: BI.i18nText("Dec-Basic_Support_Formula_Input"),
+ ref: function (e) {
+ self.apiUrl = e
+ },
+ allowBlank: false,
+ bubbleError: false,
+ errorText: BI.i18nText("Plugin-httpaction_Link_Valid"),
+ listeners: [{
+ eventName: BI.Editor.EVENT_CHANGE,
+ action: function () {
+ self.store.setApiUrl(this.getValue());
+ }
+ }]
+ },
+ {//header参数
+ type: "dec.label.editor.item",
+ text: BI.i18nText("Plugin-httpaction_Header_Property"),
+ textCls: "dec-font-weight-bold",
+ textWidth: 115,
+ editorWidth: 300,
+ watermark: BI.i18nText("Dec-Basic_Support_Formula_Input"),
+ ref: function (e) {
+ self.headers = e
+ },
+ allowBlank: false,
+ bubbleError: false,
+ errorText: BI.i18nText("Dec-Error_Null"),
+ listeners: [{
+ eventName: BI.Editor.EVENT_CHANGE,
+ action: function () {
+ self.store.setHeaders(this.getValue());
+ }
+ }]
+ },
+ {//body参数
+ type: "dec.label.editor.item",
+ text: BI.i18nText("Plugin-httpaction_Body_Property"),
+ textCls: "dec-font-weight-bold",
+ textWidth: 115,
+ editorWidth: 300,
+ watermark: BI.i18nText("Dec-Basic_Support_Formula_Input"),
+ ref: function (e) {
+ self.bodyParameters = e
+ },
+ allowBlank: false,
+ bubbleError: false,
+ errorText: BI.i18nText("Dec-Error_Null"),
+ listeners: [{
+ eventName: BI.Editor.EVENT_CHANGE,
+ action: function () {
+ self.store.setBodyParameters(this.getValue());
+ }
+ }]
+ },
+ {//bodyContent
+ type: "dec.label.textarea.item",
+ text: BI.i18nText("Plugin-httpaction_Body_Content"),
+ textCls: "dec-font-weight-bold",
+ watermark: BI.i18nText("Dec-Basic_Support_Formula_Input"),
+ textWidth: 100,
+ editorWidth: 390,
+ editorHeight: 100,
+ ref: function (e) {
+ self.bodyContent = e
+ },
+ allowBlank: false,
+ bubbleError: false,
+ errorText: BI.i18nText("Plugin-httpaction_Body_Content_Valid"),
+ listeners: [{
+ eventName: BI.Editor.EVENT_CHANGE,
+ action: function () {
+ self.store.setBodyContent(this.getValue());
+ }
+ }]
+ },
+ {//PreviewTemplate
+ type: "bi.multi_select_item",
+ selected: self.model.previewAttach,
+ logic: {
+ dynamic: !0
+ },
+ text: BI.i18nText("Dec-Task_Preview_Template_Content"),
+ ref: function (e) {
+ self.previewAttach = e
+ },
+ listeners: [{
+ eventName: BI.MultiSelectItem.EVENT_CHANGE,
+ action: function () {
+ self.store.setPreviewAttach(this.isSelected());
+ }
+ }]
+ }]
+ };
+ },
+ /**
+ * 设定各项值
+ */
+ setValue: function (e) {
+ var self = this;
+ BI.map(e, function (e, t) {
+ self.store.setHttpType(t.httpType);
+ self.store.setApiUrl(t.apiUrl);
+ self.store.setHeaders(t.headers);
+ self.store.setBodyParameters(t.bodyParameters);
+ self.store.setBodyContent(t.bodyContent);
+ self.store.setPreviewAttach(t.previewAttach);
+ });
+ },
+ /**
+ * 校验函数,可选
+ * 返回值当前处理方式是否通过校验
+ * @returns {boolean}
+ */
+ validation: function () {
+ return true;
+ },
+ /**
+ * 取值函数,必选
+ * 返回的值放到outputActionList中
+ * @returns {{}}
+ */
+ getValue: function () {
+ var self = this;
+ return {
+ OutputHttp: BI.extend(self.value, {
+ "@class": "com.fr.plugin.idfh.action.OutputHttp",
+ actionName: "com.fr.plugin.idfh.action.OutputHttp",
+ httpType: self.model.httpType,
+ apiUrl: self.model.apiUrl,
+ headers: self.model.headers,
+ bodyParameters: self.model.bodyParameters,
+ bodyContent: self.model.bodyContent,
+ previewAttach: self.model.previewAttach
+ })
+ };
+ }
+ });
+ BI.shortcut("dec.schedule.task.file.handling.httpaction", HttpAction);
+}) ();
+!(function() {
+ var HttpActionModel = BI.inherit(Fix.Model, {
+ context: ["currTask"],
+ state: function() {
+ return {
+ httpType: BI.i18nText("Plugin-httpaction_ClassName_Get"),
+ apiUrl: '',
+ headers: '',
+ bodyParameters: '',
+ bodyContent: '',
+ previewAttach: false
+ }
+ },
+ actions: {
+ setHttpType: function (e) {
+ this.model.httpType = e
+ },
+ setApiUrl: function (e) {
+ this.model.apiUrl = e
+ },
+ setHeaders: function (e) {
+ this.model.headers = e
+ },
+ setBodyParameters: function (e) {
+ this.model.bodyParameters = e
+ },
+ setBodyContent: function (e) {
+ this.model.bodyContent = e
+ },
+ setPreviewAttach: function (e) {
+ e ? this.model.currTask.scheduleOutput.formats = BI.union(this.model.currTask.scheduleOutput.formats, [DecCst.Schedule.Template.Accessory.PREVIEW]) : BI.remove(this.model.currTask.scheduleOutput.formats, DecCst.Schedule.Template.Accessory.PREVIEW)
+ this.model.previewAttach = e;
+ }
+ }
+ });
+ BI.model("dec.model.schedule.task.file.handling.httpaction", HttpActionModel);
+}) ();
+!(function () {
+ BI.config("dec.provider.schedule", function (provider) {
+ provider.registerHandingWay({
+ text: BI.i18nText("Plugin-httpaction_Handing_Way"),
+ value: "com.fr.plugin.idfh.action.OutputHttp",
+ cardType: "dec.schedule.task.file.handling.httpaction",
+ actions: []
+ }, [DecCst.Schedule.TaskType.DEFAULT, DecCst.Schedule.TaskType.REPORT, DecCst.Schedule.TaskType.BI]);
+ });
+}) ();
diff --git a/src/main/resources/com/fr/plugin/idfh/web/dist/js/schedule.min.js b/src/main/resources/com/fr/plugin/idfh/web/dist/js/schedule.min.js
new file mode 100644
index 0000000..467a23b
--- /dev/null
+++ b/src/main/resources/com/fr/plugin/idfh/web/dist/js/schedule.min.js
@@ -0,0 +1,2 @@
+/** com.fr.plugin.httpaction 22-03-23 00:31:53 */
+!function(){var t=BI.inherit(BI.Widget,{props:{baseCls:""},_store:function(){return BI.Models.getModel("dec.model.schedule.task.file.handling.httpaction")},watch:{httpType:function(t){this.httpType.setValue(t)},apiUrl:function(t){this.apiUrl.setValue(t)},headers:function(t){this.headers.setValue(t)},bodyParameters:function(t){this.bodyParameters.setValue(t)},bodyContent:function(t){this.bodyContent.setValue(t)},previewAttach:function(t){this.previewAttach.setSelected(t)}},mounted:function(){var t=this.options.value;BI.isEmpty(t)||this.setValue(t)},render:function(){var e=this;return{type:"bi.vertical",tgap:15,items:[{type:"bi.horizontal",items:[{type:"bi.label",cls:"dec-font-weight-bold",width:115,height:24,textAlign:"left",text:BI.i18nText("Plugin-httpaction_ClassPath_Title")},{type:"bi.text_value_combo",width:300,value:e.model.httpType,ref:function(t){e.httpType=t},listeners:[{eventName:BI.TextValueCombo.EVENT_CHANGE,action:function(){var t=this.getValue()[0];e.store.setHttpType(t)}}],items:[{text:BI.i18nText("Plugin-httpaction_ClassName_Post_Json"),value:BI.i18nText("Plugin-httpaction_ClassName_Post_Json")}]}]},{type:"dec.label.editor.item",text:BI.i18nText("Plugin-httpaction_Url"),textCls:"dec-font-weight-bold",textWidth:115,editorWidth:300,watermark:BI.i18nText("Dec-Basic_Support_Formula_Input"),ref:function(t){e.apiUrl=t},allowBlank:!1,bubbleError:!1,errorText:BI.i18nText("Plugin-httpaction_Link_Valid"),listeners:[{eventName:BI.Editor.EVENT_CHANGE,action:function(){e.store.setApiUrl(this.getValue())}}]},{type:"dec.label.editor.item",text:BI.i18nText("Plugin-httpaction_Header_Property"),textCls:"dec-font-weight-bold",textWidth:115,editorWidth:300,watermark:BI.i18nText("Dec-Basic_Support_Formula_Input"),ref:function(t){e.headers=t},allowBlank:!1,bubbleError:!1,errorText:BI.i18nText("Dec-Error_Null"),listeners:[{eventName:BI.Editor.EVENT_CHANGE,action:function(){e.store.setHeaders(this.getValue())}}]},{type:"dec.label.editor.item",text:BI.i18nText("Plugin-httpaction_Body_Property"),textCls:"dec-font-weight-bold",textWidth:115,editorWidth:300,watermark:BI.i18nText("Dec-Basic_Support_Formula_Input"),ref:function(t){e.bodyParameters=t},allowBlank:!1,bubbleError:!1,errorText:BI.i18nText("Dec-Error_Null"),listeners:[{eventName:BI.Editor.EVENT_CHANGE,action:function(){e.store.setBodyParameters(this.getValue())}}]},{type:"dec.label.textarea.item",text:BI.i18nText("Plugin-httpaction_Body_Content"),textCls:"dec-font-weight-bold",watermark:BI.i18nText("Dec-Basic_Support_Formula_Input"),textWidth:100,editorWidth:390,editorHeight:100,ref:function(t){e.bodyContent=t},allowBlank:!1,bubbleError:!1,errorText:BI.i18nText("Plugin-httpaction_Body_Content_Valid"),listeners:[{eventName:BI.Editor.EVENT_CHANGE,action:function(){e.store.setBodyContent(this.getValue())}}]},{type:"bi.multi_select_item",selected:e.model.previewAttach,logic:{dynamic:!0},text:BI.i18nText("Dec-Task_Preview_Template_Content"),ref:function(t){e.previewAttach=t},listeners:[{eventName:BI.MultiSelectItem.EVENT_CHANGE,action:function(){e.store.setPreviewAttach(this.isSelected())}}]}]}},setValue:function(t){var i=this;BI.map(t,function(t,e){i.store.setHttpType(e.httpType),i.store.setApiUrl(e.apiUrl),i.store.setHeaders(e.headers),i.store.setBodyParameters(e.bodyParameters),i.store.setBodyContent(e.bodyContent),i.store.setPreviewAttach(e.previewAttach)})},validation:function(){return!0},getValue:function(){var t=this;return{OutputHttp:BI.extend(t.value,{"@class":"com.fr.plugin.idfh.action.OutputHttp",actionName:"com.fr.plugin.idfh.action.OutputHttp",httpType:t.model.httpType,apiUrl:t.model.apiUrl,headers:t.model.headers,bodyParameters:t.model.bodyParameters,bodyContent:t.model.bodyContent,previewAttach:t.model.previewAttach})}}});BI.shortcut("dec.schedule.task.file.handling.httpaction",t)}(),function(){var t=BI.inherit(Fix.Model,{context:["currTask"],state:function(){return{httpType:BI.i18nText("Plugin-httpaction_ClassName_Get"),apiUrl:"",headers:"",bodyParameters:"",bodyContent:"",previewAttach:!1}},actions:{setHttpType:function(t){this.model.httpType=t},setApiUrl:function(t){this.model.apiUrl=t},setHeaders:function(t){this.model.headers=t},setBodyParameters:function(t){this.model.bodyParameters=t},setBodyContent:function(t){this.model.bodyContent=t},setPreviewAttach:function(t){t?this.model.currTask.scheduleOutput.formats=BI.union(this.model.currTask.scheduleOutput.formats,[DecCst.Schedule.Template.Accessory.PREVIEW]):BI.remove(this.model.currTask.scheduleOutput.formats,DecCst.Schedule.Template.Accessory.PREVIEW),this.model.previewAttach=t}}});BI.model("dec.model.schedule.task.file.handling.httpaction",t)}(),BI.config("dec.provider.schedule",function(t){t.registerHandingWay({text:BI.i18nText("Plugin-httpaction_Handing_Way"),value:"com.fr.plugin.idfh.action.OutputHttp",cardType:"dec.schedule.task.file.handling.httpaction",actions:[]},[DecCst.Schedule.TaskType.DEFAULT,DecCst.Schedule.TaskType.REPORT,DecCst.Schedule.TaskType.BI])});
\ No newline at end of file