流程触发器http的list参数改成json
This commit is contained in:
parent
829d120344
commit
8e8bee8b13
@ -2,6 +2,7 @@ package com.wflow.workflow.task;
|
|||||||
|
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
import cn.hutool.http.HttpResponse;
|
import cn.hutool.http.HttpResponse;
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.wflow.utils.BeanUtil;
|
import com.wflow.utils.BeanUtil;
|
||||||
import com.wflow.utils.EmailUtil;
|
import com.wflow.utils.EmailUtil;
|
||||||
@ -15,6 +16,7 @@ import org.flowable.engine.delegate.DelegateExecution;
|
|||||||
import org.flowable.engine.delegate.JavaDelegate;
|
import org.flowable.engine.delegate.JavaDelegate;
|
||||||
|
|
||||||
import javax.mail.MessagingException;
|
import javax.mail.MessagingException;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
@ -115,9 +117,18 @@ public class TriggerServiceTask implements JavaDelegate {
|
|||||||
//处理请求体
|
//处理请求体
|
||||||
if ("FORM".equals(http.getContentType())) {
|
if ("FORM".equals(http.getContentType())) {
|
||||||
http.getParams().stream().filter(o -> o != null && o.getName() != null && !"".equals(o.getName())).forEach(hd -> {
|
http.getParams().stream().filter(o -> o != null && o.getName() != null && !"".equals(o.getName())).forEach(hd -> {
|
||||||
request.form(hd.getName(), hd.getIsField() ?
|
String v;
|
||||||
String.valueOf(variables.getOrDefault(String.valueOf(hd.getValue()), ""))
|
if (hd.getIsField()) {
|
||||||
: getStrByRegex(String.valueOf(hd.getValue()), variables));
|
Object orDefault = variables.getOrDefault(String.valueOf(hd.getValue()), "");
|
||||||
|
if (orDefault instanceof List) {
|
||||||
|
v = JSON.toJSONString(orDefault);
|
||||||
|
} else {
|
||||||
|
v = String.valueOf(orDefault);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
v = getStrByRegex(String.valueOf(hd.getValue()), variables);
|
||||||
|
}
|
||||||
|
request.form(hd.getName(), v);
|
||||||
});
|
});
|
||||||
request.form("dfInstanceId", execution.getProcessInstanceId());
|
request.form("dfInstanceId", execution.getProcessInstanceId());
|
||||||
request.form("dfNodeId", execution.getCurrentActivityId());
|
request.form("dfNodeId", execution.getCurrentActivityId());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user