|
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.flow.common.core.util.ApplicationContextUtil;
|
|
|
-import com.flow.enums.TimeUnitEnum;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import lombok.Data;
|
|
|
import lombok.EqualsAndHashCode;
|
|
@@ -20,9 +19,6 @@ public class HttpNode extends Node {
|
|
|
private List<Map<String, Object>> headers;
|
|
|
private List<Map<String, Object>> body;
|
|
|
private Long requestTimeout = 0L;
|
|
|
- private Integer retryCount;
|
|
|
- private TimeUnitEnum unit = TimeUnitEnum.MINUTE;
|
|
|
- private Integer duration;
|
|
|
private List<String> errorUsers;
|
|
|
|
|
|
@Override
|
|
@@ -36,21 +32,16 @@ public class HttpNode extends Node {
|
|
|
// httpServiceTask.setAsynchronous(true);
|
|
|
// httpServiceTask.setParallelInSameTransaction(true);
|
|
|
// 失败重试
|
|
|
- boolean isRetry = Objects.nonNull(this.retryCount) && this.retryCount > 0;
|
|
|
+ /*boolean isRetry = Objects.nonNull(this.retryCount) && this.retryCount > 0;
|
|
|
if (isRetry) {
|
|
|
StringBuilder retry = new StringBuilder();
|
|
|
retry.append(String.format("R%s", this.retryCount));
|
|
|
if (Objects.nonNull(this.duration)) {
|
|
|
retry.append("/")
|
|
|
.append(String.format(this.unit.getUnit(), this.duration));
|
|
|
- ExtensionElement retryElement = new ExtensionElement();
|
|
|
- retryElement.setNamespace("https://flowable.org/model");
|
|
|
- retryElement.setNamespacePrefix("flowable");
|
|
|
- retryElement.setName("failedJobRetryTimeCycle");
|
|
|
- retryElement.setElementText(retry.toString());
|
|
|
- httpServiceTask.addExtensionElement(retryElement);
|
|
|
+ httpServiceTask.setFailedJobRetryTimeCycleValue(retry.toString());
|
|
|
}
|
|
|
- }
|
|
|
+ }*/
|
|
|
// 请求参数
|
|
|
ArrayList<FieldExtension> fieldExtensions = new ArrayList<>();
|
|
|
FieldExtension urlExtension = new FieldExtension();
|
|
@@ -104,10 +95,12 @@ public class HttpNode extends Node {
|
|
|
failCodesExtension.setFieldName("failStatusCodes");
|
|
|
failCodesExtension.setStringValue("400,401,403,404,500,503");
|
|
|
fieldExtensions.add(failCodesExtension);
|
|
|
- FieldExtension handleCodesExtension = new FieldExtension();
|
|
|
- handleCodesExtension.setFieldName("handleStatusCodes");
|
|
|
- handleCodesExtension.setStringValue("400,401,403,404,500,503");
|
|
|
- fieldExtensions.add(handleCodesExtension);
|
|
|
+ if (CollectionUtils.isNotEmpty(this.errorUsers)) {
|
|
|
+ FieldExtension handleCodesExtension = new FieldExtension();
|
|
|
+ handleCodesExtension.setFieldName("handleStatusCodes");
|
|
|
+ handleCodesExtension.setStringValue("400,401,403,404,500,503");
|
|
|
+ fieldExtensions.add(handleCodesExtension);
|
|
|
+ }
|
|
|
FieldExtension saveResponseBodyExtension = new FieldExtension();
|
|
|
saveResponseBodyExtension.setFieldName("saveResponseVariableAsJson");
|
|
|
saveResponseBodyExtension.setStringValue("true");
|
|
@@ -119,7 +112,7 @@ public class HttpNode extends Node {
|
|
|
httpServiceTask.setFieldExtensions(fieldExtensions);
|
|
|
FieldExtension ignoreExtension = new FieldExtension();
|
|
|
ignoreExtension.setFieldName("ignoreException");
|
|
|
- ignoreExtension.setStringValue(Boolean.toString(isRetry));
|
|
|
+ ignoreExtension.setStringValue(Boolean.toString(false));
|
|
|
fieldExtensions.add(ignoreExtension);
|
|
|
elements.add(httpServiceTask);
|
|
|
if (CollectionUtils.isNotEmpty(this.errorUsers)) {
|
|
@@ -145,7 +138,7 @@ public class HttpNode extends Node {
|
|
|
String boundaryId = String.format("%s_boundary", activity.getId());
|
|
|
boundaryEvent.setId(boundaryId);
|
|
|
boundaryEvent.setName("错误处理");
|
|
|
- boundaryEvent.setCancelActivity(false);
|
|
|
+ boundaryEvent.setCancelActivity(true);
|
|
|
boundaryEvent.setAttachedToRef(activity);
|
|
|
ErrorEventDefinition errorEventDefinition = new ErrorEventDefinition();
|
|
|
// errorEventDefinition.setErrorCode("HTTP400");
|