feat(RDMP-3845) - 新增单选、复选的代码逻辑
This commit is contained in:
parent
ce0630f831
commit
4833b4b85e
@ -41,6 +41,8 @@ import org.flowable.form.api.FormRepositoryService;
|
|||||||
import org.flowable.form.model.FormContainer;
|
import org.flowable.form.model.FormContainer;
|
||||||
import org.flowable.form.model.FormField;
|
import org.flowable.form.model.FormField;
|
||||||
import org.flowable.form.model.FormFieldTypes;
|
import org.flowable.form.model.FormFieldTypes;
|
||||||
|
import org.flowable.form.model.Option;
|
||||||
|
import org.flowable.form.model.OptionFormField;
|
||||||
import org.flowable.form.model.SimpleFormModel;
|
import org.flowable.form.model.SimpleFormModel;
|
||||||
import org.flowable.spring.SpringProcessEngineConfiguration;
|
import org.flowable.spring.SpringProcessEngineConfiguration;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
@ -352,7 +354,15 @@ public class PrintAdminController implements PrintAdminApi {
|
|||||||
if (!(value instanceof String)) {
|
if (!(value instanceof String)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (((String) value).startsWith("[")) {
|
|
||||||
|
if (stringFormFieldMap.containsKey(key) && stringFormFieldMap.get(key) instanceof OptionFormField) {
|
||||||
|
OptionFormField optionFormField = (OptionFormField) stringFormFieldMap.get(key);
|
||||||
|
if (Objects.equals("checkbox", optionFormField.getType())) {
|
||||||
|
result.put(key, buildOptionFieldValue(optionFormField, JSONObject.parseArray((String) value, String.class)));
|
||||||
|
} else if (Objects.equals("radio", optionFormField.getType())) {
|
||||||
|
result.put(key, buildOptionFieldValue(optionFormField, Lists.newArrayList((String) value)));
|
||||||
|
}
|
||||||
|
} else if (((String) value).startsWith("[")) {
|
||||||
result.put(key, JSONArray.parseArray((String) value));
|
result.put(key, JSONArray.parseArray((String) value));
|
||||||
} else if (((String) value).startsWith("{")) {
|
} else if (((String) value).startsWith("{")) {
|
||||||
result.put(key, JSONObject.parseObject((String) value));
|
result.put(key, JSONObject.parseObject((String) value));
|
||||||
@ -360,6 +370,16 @@ public class PrintAdminController implements PrintAdminApi {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String buildOptionFieldValue(OptionFormField optionFormField, List<String> selectedValues) {
|
||||||
|
if (CollectionUtils.isEmpty(optionFormField.getOptions())) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return optionFormField.getOptions().stream()
|
||||||
|
.filter(i -> selectedValues.contains(i.getId()))
|
||||||
|
.map(Option::getName)
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
}
|
||||||
|
|
||||||
private void generateSystemFieldVariables(String processInstanceId, Map<String, Object> result) {
|
private void generateSystemFieldVariables(String processInstanceId, Map<String, Object> result) {
|
||||||
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
|
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
|
||||||
Map<String, Object> variables = commandExecutor.execute(new CustomGetProcessInstanceVariablesCmd(processInstanceId));
|
Map<String, Object> variables = commandExecutor.execute(new CustomGetProcessInstanceVariablesCmd(processInstanceId));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user