Compare commits
No commits in common. "6af33ce3b61c5daa44425c725154dd47d3edd352" and "1bd164af25ff910c0e2a81b2dad7586ea4715349" have entirely different histories.
6af33ce3b6
...
1bd164af25
@ -118,7 +118,7 @@ public interface BpmnConstants {
|
||||
String CONFIG_FIELD_META = "field";
|
||||
String CONFIG_FIELD_PERMISSION = "fieldPermission";
|
||||
String CONFIG_CONDITION_PERMISSION = "conditionPermission";
|
||||
String CONFIG_FIELD_OPTIONS = "options";
|
||||
String CONFIG_FIELD_OPTION = "option";
|
||||
String CONFIG_NODE_TYPE = "nodeType";
|
||||
String CONFIG_BUTTON_TYPE_INITIATOR = "initiator";
|
||||
String CONFIG_BUTTON_TYPE_CURRENT = "current";
|
||||
|
||||
@ -27,7 +27,7 @@ public class BpmnFieldOptionConf implements Serializable {
|
||||
* 选项的值
|
||||
*/
|
||||
@ApiModelProperty(value = "选项的值", example = "1")
|
||||
private Object value;
|
||||
private String value;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
@ -37,11 +37,11 @@ public class BpmnFieldOptionConf implements Serializable {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Object getValue() {
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(Object value) {
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,10 +93,4 @@ public class CategoryCreateDTO {
|
||||
@ApiModelProperty(value = "版本号")
|
||||
private Integer version;
|
||||
|
||||
/**
|
||||
* 自定替换未设置的变量为空串
|
||||
*/
|
||||
@ApiModelProperty(value = "是否自动替换变量为空串,默认false")
|
||||
private Boolean autoReplaceVariables;
|
||||
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ public class ConditionPermissionMetaInfo implements Serializable {
|
||||
/**
|
||||
* 前端回显字段,后端不做任何消费逻辑
|
||||
*/
|
||||
private Object value;
|
||||
private String value;
|
||||
|
||||
/**
|
||||
* 类型是单选复选时的选项值
|
||||
|
||||
@ -47,9 +47,6 @@ public class CategoryItemVO {
|
||||
@ApiModelProperty(value = "版本号")
|
||||
private Integer version;
|
||||
|
||||
@ApiModelProperty(value = "自定替换未设置的变量为空串")
|
||||
private Boolean autoReplaceVariables;
|
||||
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateAt;
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_BUTTON_TYPE_
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_BUTTON_TYPE_INITIATOR;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_META;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_OPTIONS;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_OPTION;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_NOTICE;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_SIGN;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_SIGN_TYPE;
|
||||
@ -346,10 +346,22 @@ public final class BpmnJsonConverterUtil {
|
||||
field.addAttribute(fieldCode);
|
||||
|
||||
if (!CollectionUtils.isEmpty(i.getOptions())) {
|
||||
ExtensionAttribute fieldOptions = new ExtensionAttribute();
|
||||
fieldCode.setName(CONFIG_FIELD_OPTIONS);
|
||||
fieldCode.setValue(JSON.toJSONString(i.getOptions()));
|
||||
field.addAttribute(fieldOptions);
|
||||
i.getOptions().forEach(j -> {
|
||||
ExtensionElement option = new ExtensionElement();
|
||||
option.setName(CONFIG_FIELD_OPTION);
|
||||
|
||||
ExtensionAttribute optionName = new ExtensionAttribute();
|
||||
optionName.setName(ELEMENT_ATTRIBUTE_NAME);
|
||||
optionName.setValue(j.getName());
|
||||
option.addAttribute(optionName);
|
||||
|
||||
ExtensionAttribute optionValue = new ExtensionAttribute();
|
||||
optionValue.setName(ELEMENT_ATTRIBUTE_VALUE);
|
||||
optionValue.setValue(j.getValue());
|
||||
option.addAttribute(optionValue);
|
||||
|
||||
field.addChildElement(option);
|
||||
});
|
||||
}
|
||||
fieldConfigElement.addChildElement(field);
|
||||
});
|
||||
|
||||
@ -86,7 +86,7 @@ import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_CARBON_COPY_
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_CONDITION_PERMISSION;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_META;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_OPTIONS;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_OPTION;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_FIELD_PERMISSION;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_INITIATOR_LEADER_RANGE_UNIT;
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.CONFIG_INITIATOR_SPECIFIED_EXCLUDE_COOPERATE_TYPES;
|
||||
@ -433,9 +433,15 @@ public final class BpmnMetaParserHelper {
|
||||
conf.setName(i.getAttributeValue(null, ELEMENT_ATTRIBUTE_NAME));
|
||||
conf.setCode(i.getAttributeValue(null, ELEMENT_ATTRIBUTE_CODE));
|
||||
|
||||
String fieldOptionsJsonStr = i.getAttributeValue(null, CONFIG_FIELD_OPTIONS);
|
||||
if (StringUtils.hasText(fieldOptionsJsonStr)) {
|
||||
conf.setOptions(JSON.parseArray(fieldOptionsJsonStr, BpmnFieldOptionConf.class));
|
||||
List<BpmnFieldOptionConf> options = new ArrayList<>();
|
||||
if (!CollectionUtils.isEmpty(i.getChildElements())) {
|
||||
i.getChildElements().get(CONFIG_FIELD_OPTION).forEach(j -> {
|
||||
BpmnFieldOptionConf option = new BpmnFieldOptionConf();
|
||||
option.setName(j.getAttributeValue(null, ELEMENT_ATTRIBUTE_NAME));
|
||||
option.setValue(j.getAttributeValue(null, ELEMENT_ATTRIBUTE_VALUE));
|
||||
options.add(option);
|
||||
});
|
||||
conf.setOptions(options);
|
||||
}
|
||||
|
||||
fields.add(conf);
|
||||
@ -697,7 +703,6 @@ public final class BpmnMetaParserHelper {
|
||||
return defaultValid(flowElement, CONFIG_CONDITION_PERMISSION).map(element -> JSON.parseObject(element.getElementText(), new TypeReference<List<ConditionPermissionMetaInfo>>() {
|
||||
}.getType()));
|
||||
}
|
||||
|
||||
public static Optional<ImmutableTable<String, String, Integer>> getFormFieldPermissionForCalc(FlowElement flowElement) {
|
||||
List<FormPermissionMetaInfo> fieldMetaInfos = getFormFieldPermissionConf(flowElement).orElse(new ArrayList<>());
|
||||
return getFormFieldPermissionForModel(fieldMetaInfos);
|
||||
|
||||
@ -210,9 +210,6 @@ public class CustomApproveTaskCmd extends AbstractCommand<Void> implements Seria
|
||||
List<AttachmentDTO> attachmentList,
|
||||
String advice,
|
||||
BpmnTaskDelegateAssigner approver) {
|
||||
if (Objects.isNull(approver)) {
|
||||
return;
|
||||
}
|
||||
List<SignatureDTO> signatures = runtimeService.getVariable(task.getProcessInstanceId(), SIGNATURE_COLLECTION, List.class);
|
||||
if (Objects.isNull(signatures)) {
|
||||
signatures = new ArrayList<>();
|
||||
@ -223,16 +220,16 @@ public class CustomApproveTaskCmd extends AbstractCommand<Void> implements Seria
|
||||
.setActivityId(task.getTaskDefinitionKey())
|
||||
.setActivityName(task.getName())
|
||||
.setSignatures(new ArrayList<>()));
|
||||
|
||||
dto.getSignatures().add(0, new SignatureDTO.SignDetail()
|
||||
.setApproverName(approver.getAssignerName())
|
||||
.setSignature(ListUtils.emptyIfNull(attachmentList).stream()
|
||||
.filter(i -> Objects.equals(i.getType(), AttachmentTypeEnum.signature))
|
||||
.findFirst().orElse(new AttachmentDTO()).getUrl())
|
||||
.setAdvice(advice)
|
||||
.setResult(BpmnProcessTaskResultEnum.APPROVED.getDesc())
|
||||
.setOperationTime(new Date())
|
||||
);
|
||||
ListUtils.emptyIfNull(attachmentList).stream()
|
||||
.filter(i -> Objects.equals(i.getType(), AttachmentTypeEnum.signature))
|
||||
.findFirst()
|
||||
.ifPresent(attachment -> dto.getSignatures().add(0,
|
||||
new SignatureDTO.SignDetail()
|
||||
.setApproverName(approver.getAssignerName())
|
||||
.setSignature(attachment.getUrl())
|
||||
.setAdvice(advice)
|
||||
.setResult(BpmnProcessTaskResultEnum.APPROVED.getDesc())
|
||||
.setOperationTime(new Date())));
|
||||
if (!any.isPresent()) {
|
||||
signatures.add(dto);
|
||||
}
|
||||
|
||||
@ -272,7 +272,6 @@ public class CustomGetProcessInstanceVariablesToObjectCmd extends AbstractComman
|
||||
}
|
||||
|
||||
private void addSignature(List<VariableObjectDTO> variables, List<SignatureDTO> signatures) {
|
||||
log.info("addSignature:{}", JSON.toJSONString(signatures));
|
||||
if (CollectionUtils.isEmpty(signatures)) {
|
||||
return;
|
||||
}
|
||||
@ -311,10 +310,15 @@ public class CustomGetProcessInstanceVariablesToObjectCmd extends AbstractComman
|
||||
groupVariables.forEach(group -> {
|
||||
if (!CollectionUtils.isEmpty(group.getVars())) {
|
||||
group.getVars().forEach(variable -> {
|
||||
Object value = bizVariables.getOrDefault(variable.getCode(), null);
|
||||
if (Objects.isNull(value)) {
|
||||
// 目前为了减少 wps 替换耗时,所以将没有值的变量,直接踢出
|
||||
return;
|
||||
}
|
||||
variables.add(VariableObjectDTO.builder()
|
||||
.key(variable.getCode())
|
||||
.desc(group.getGroupName() + variable.getName())
|
||||
.value(bizVariables.getOrDefault(variable.getCode(), null))
|
||||
.value(value)
|
||||
.type(convert(variable.getType()))
|
||||
.build());
|
||||
});
|
||||
|
||||
@ -84,9 +84,4 @@ public class ExtAxDict extends BaseEntity<ExtAxDict> {
|
||||
* 版本号
|
||||
*/
|
||||
private Integer version;
|
||||
|
||||
/**
|
||||
* 自定替换未设置的变量为空串
|
||||
*/
|
||||
private Boolean autoReplaceVariables;
|
||||
}
|
||||
|
||||
@ -119,7 +119,6 @@ public class CategoryServiceImpl extends ServiceImpl<ExtAxDictMapper, ExtAxDict>
|
||||
dict.setIcon(dto.getIcon());
|
||||
dict.setDisplayInitiateMenu(dto.getDisplayInitiateMenu());
|
||||
dict.setVersion(dto.getVersion());
|
||||
dict.setAutoReplaceVariables(Boolean.TRUE.equals(dto.getAutoReplaceVariables()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -22,7 +22,6 @@ import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONException;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.flowable.common.engine.impl.interceptor.CommandExecutor;
|
||||
import org.flowable.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||
import org.springframework.stereotype.Component;
|
||||
@ -30,8 +29,6 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@ -54,7 +51,6 @@ import static cn.axzo.workflow.common.model.dto.VariableObjectDTO.Type.signature
|
||||
* @since 2025-04-09 20:41
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class WpsUtil {
|
||||
public static final List<FileTypeEnum> WPS_SUPPORTED_FILE_TYPES = Lists.newArrayList(FileTypeEnum.WORD, FileTypeEnum.EXCEL);
|
||||
@Resource
|
||||
@ -64,67 +60,6 @@ public class WpsUtil {
|
||||
@Resource
|
||||
private OrganizationalNodeUserQueryApi organizationalNodeUserQueryApi;
|
||||
|
||||
/**
|
||||
* 调用 wps 文件变量替换接口
|
||||
*
|
||||
* @param fileCode 基于该模板进行变量替换
|
||||
* @param fileKey 如果有值,则变量替换完成后,直接将文档覆盖该 fileKey 对应的文件;
|
||||
* @return 返回替换变量后的文件oss 的 fileKey
|
||||
*/
|
||||
public String wpsFileVariableReplace(List<VariableObjectDTO> wpsVariables,
|
||||
String fileCode, String fileKey, String fileName, Boolean autoReplaceVariables) {
|
||||
List<VariableObjectDTO> variables = wpsVariables.stream()
|
||||
.filter(i -> Objects.equals(i.getType().name(), VariableObjectDTO.Type.img.name()) || Objects.equals(i.getType().name(), VariableObjectDTO.Type.text.name()))
|
||||
.filter(i -> {
|
||||
if (Objects.equals(Boolean.TRUE, autoReplaceVariables)) {
|
||||
return true;
|
||||
} else {
|
||||
return Objects.nonNull(i.getValue());
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
List<FileReplaceContent> fileReplaceContents = BeanMapper.copyList(variables, FileReplaceContent.class, (s, t) -> {
|
||||
t.setKey(s.getDesc());
|
||||
if (Objects.equals(s.getType().name(), VariableObjectDTO.Type.img.name())) {
|
||||
List<UploadFieldDTO> uploadFieldDTOS = new ArrayList<>();
|
||||
if (isJson(s.getValue().toString())) {
|
||||
uploadFieldDTOS.addAll(JSON.parseArray(s.getValue().toString(), UploadFieldDTO.class));
|
||||
} else {
|
||||
uploadFieldDTOS.addAll(JSON.parseArray(JSON.toJSONString(s.getValue()), UploadFieldDTO.class));
|
||||
}
|
||||
t.setContent(CollectionUtils.isEmpty(uploadFieldDTOS) ? "" : uploadFieldDTOS.get(0).getFileUrl());
|
||||
} else {
|
||||
t.setContent(Objects.nonNull(s.getValue()) ? s.getValue().toString() : "");
|
||||
}
|
||||
t.setType(s.getType().name());
|
||||
t.setPrefix("[");
|
||||
t.setSuffix("]");
|
||||
});
|
||||
|
||||
// 处理空值
|
||||
if (Objects.equals(Boolean.TRUE, autoReplaceVariables)) {
|
||||
fileReplaceContents.stream()
|
||||
.filter(i -> !StringUtils.hasText(i.getContent()))
|
||||
.forEach(i -> {
|
||||
// TODO 将变量替换未空串
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (StringUtils.hasText(fileCode)) {
|
||||
FileTemplateReplaceRequest request = new FileTemplateReplaceRequest();
|
||||
request.setFileCode(fileCode);
|
||||
request.setFileKey(fileKey);
|
||||
request.setReplaceContentList(fileReplaceContents);
|
||||
return RpcExternalUtil.rpcProcessor(() -> fileTemplateApi.replaceWordText(request), "替换 WPS 文档变量", request);
|
||||
} else {
|
||||
SimpleFileTemplateReplaceRequest request = new SimpleFileTemplateReplaceRequest();
|
||||
request.setFileName(fileName);
|
||||
request.setFileKey(fileKey);
|
||||
request.setReplaceContentList(fileReplaceContents);
|
||||
return RpcExternalUtil.rpcProcessor(() -> fileTemplateApi.replaceWordTextForFileKey(request), "替换 WPS 文档变量(simple)", request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调用 wps 文件变量替换接口
|
||||
*
|
||||
@ -136,19 +71,17 @@ public class WpsUtil {
|
||||
String fileCode, String fileKey, String fileName) {
|
||||
|
||||
List<FileReplaceContent> fileReplaceContents = BeanMapper.copyList(wpsVariables.stream()
|
||||
.filter(i -> Objects.nonNull(i.getValue()) && checkNotEmptyColl(i))
|
||||
.filter(i -> Objects.nonNull(i.getValue()))
|
||||
.filter(i -> !(Objects.equals(i.getType().name(), "img") && !StringUtils.hasText(i.getValue().toString())))
|
||||
.filter(i -> Objects.equals(i.getType().name(), "img") || Objects.equals(i.getType().name(), "text"))
|
||||
.collect(Collectors.toList()), FileReplaceContent.class, (s, t) -> {
|
||||
t.setKey(s.getDesc());
|
||||
if (Objects.equals(s.getType().name(), "img")) {
|
||||
List<UploadFieldDTO> uploadFieldDTOS;
|
||||
if (isJson(s.getValue().toString())) {
|
||||
uploadFieldDTOS = JSON.parseArray(s.getValue().toString(), UploadFieldDTO.class);
|
||||
t.setContent(JSON.parseArray(s.getValue().toString(), UploadFieldDTO.class).get(0).getFileUrl());
|
||||
} else {
|
||||
uploadFieldDTOS = JSON.parseArray(JSON.toJSONString(s.getValue()), UploadFieldDTO.class);
|
||||
t.setContent(JSON.parseArray(JSON.toJSONString(s.getValue()), UploadFieldDTO.class).get(0).getFileUrl());
|
||||
}
|
||||
t.setContent(CollectionUtils.isEmpty(uploadFieldDTOS) ? "" : uploadFieldDTOS.get(0).getFileUrl());
|
||||
} else {
|
||||
t.setContent(Objects.nonNull(s.getValue()) ? s.getValue().toString() : "");
|
||||
}
|
||||
@ -171,14 +104,6 @@ public class WpsUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean checkNotEmptyColl(VariableObjectDTO i) {
|
||||
if (!(i.getValue() instanceof Collection)) {
|
||||
return true;
|
||||
}
|
||||
return !CollectionUtils.isEmpty((Collection<?>) i.getValue());
|
||||
|
||||
}
|
||||
|
||||
public List<VariableObjectDTO> getWpsReplaceVariables(ProcessEngineConfigurationImpl processEngineConfiguration, String processInstanceId) {
|
||||
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
|
||||
List<VariableObjectDTO> wpsVariables =
|
||||
@ -187,7 +112,6 @@ public class WpsUtil {
|
||||
List<VariableObjectDTO> signatureAndAdvices = Lists.newArrayList();
|
||||
wpsVariables.stream().filter(i -> Objects.equals(signatureAndAdvice, i.getType())).forEach(variableObjectDTO -> {
|
||||
List<SignatureDTO.SignDetail> signDetails = (List<SignatureDTO.SignDetail>) variableObjectDTO.getValue();
|
||||
log.info("getWpsReplaceVariables signDetails: {}", JSON.toJSONString(signDetails));
|
||||
if (!CollectionUtils.isEmpty(signDetails)) {
|
||||
SignatureDTO.SignDetail signDetail = signDetails.get(0);
|
||||
signatureAndAdvices.add(VariableObjectDTO.builder()
|
||||
@ -208,7 +132,7 @@ public class WpsUtil {
|
||||
signatureAndAdvices.add(VariableObjectDTO.builder()
|
||||
.key(variableObjectDTO.getKey() + "_signature")
|
||||
.desc(variableObjectDTO.getDesc() + "电子签名")
|
||||
.value(CollectionUtils.isEmpty(signUrl) ? Lists.newArrayList() : Lists.newArrayList(UploadFieldDTO.builder().fileKey(signDetail.getSignature()).fileUrl(CollectionUtils.isEmpty(signUrl) ? null : signUrl.get(0).getSignUrl()).build()))
|
||||
.value(Lists.newArrayList(UploadFieldDTO.builder().fileKey(signDetail.getSignature()).fileUrl(signUrl.get(0).getSignUrl()).build()))
|
||||
.type(VariableObjectDTO.Type.img)
|
||||
.build());
|
||||
signatureAndAdvices.add(VariableObjectDTO.builder()
|
||||
@ -247,7 +171,6 @@ public class WpsUtil {
|
||||
.build());
|
||||
|
||||
});
|
||||
log.info("wpsVariables: {}", JSON.toJSONString(wpsVariables));
|
||||
return wpsVariables;
|
||||
}
|
||||
|
||||
|
||||
@ -4,14 +4,12 @@ import cn.axzo.workflow.common.enums.FileTypeEnum;
|
||||
import cn.axzo.workflow.common.model.dto.SignFileDTO;
|
||||
import cn.axzo.workflow.common.model.dto.VariableObjectDTO;
|
||||
import cn.axzo.workflow.common.model.request.bpmn.BpmnSignConf;
|
||||
import cn.axzo.workflow.common.model.response.category.CategoryItemVO;
|
||||
import cn.axzo.workflow.core.common.context.ProcessOperationContext;
|
||||
import cn.axzo.workflow.core.common.utils.BpmnMetaParserHelper;
|
||||
import cn.axzo.workflow.core.listener.AbstractBpmnEventListener;
|
||||
import cn.axzo.workflow.core.listener.BpmnProcessEventListener;
|
||||
import cn.axzo.workflow.core.repository.entity.ExtAxDocContent;
|
||||
import cn.axzo.workflow.core.repository.entity.ExtAxProcessSign;
|
||||
import cn.axzo.workflow.core.service.CategoryService;
|
||||
import cn.axzo.workflow.core.service.ExtAxDocContentService;
|
||||
import cn.axzo.workflow.core.service.ExtAxModelDocService;
|
||||
import cn.axzo.workflow.core.service.ExtAxProcessSignService;
|
||||
@ -37,8 +35,6 @@ import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.axzo.workflow.common.constant.BpmnConstants.BPM_MODEL_CATEGORY;
|
||||
|
||||
/**
|
||||
* 签署业务,审批完成后,进行文件归档,并对所有工人发送业务待办
|
||||
*
|
||||
@ -59,8 +55,6 @@ public class FileArchiveProcessEventListener extends AbstractBpmnEventListener<P
|
||||
@Resource
|
||||
private ExtAxDocContentService extAxDocContentService;
|
||||
@Resource
|
||||
private CategoryService categoryService;
|
||||
@Resource
|
||||
private WpsUtil wpsUtil;
|
||||
|
||||
|
||||
@ -77,21 +71,19 @@ public class FileArchiveProcessEventListener extends AbstractBpmnEventListener<P
|
||||
HistoricProcessInstance instance = historyService.createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(processInstanceId).includeProcessVariables().singleResult();
|
||||
|
||||
CategoryItemVO category = categoryService.get(BPM_MODEL_CATEGORY, mainProcess.getId()).orElse(new CategoryItemVO());
|
||||
// 文件归档,将审批过程中产生的数据全部替换文档模板变量
|
||||
archiveFinalDocs(instance, category.getAutoReplaceVariables());
|
||||
archiveFinalDocs(instance);
|
||||
}
|
||||
|
||||
private void archiveFinalDocs(HistoricProcessInstance instance, Boolean autoReplaceVariables) {
|
||||
private void archiveFinalDocs(HistoricProcessInstance instance) {
|
||||
ProcessEngineConfigurationImpl processEngineConfiguration = (ProcessEngineConfigurationImpl) getEngineConfiguration();
|
||||
ExtAxProcessSign processSign = extAxProcessSignService.findByProcessInstanceId(instance.getId());
|
||||
List<VariableObjectDTO> wpsReplaceVariables = wpsUtil.getWpsReplaceVariables(processEngineConfiguration, instance.getId());
|
||||
|
||||
processSign.getFileArchive().stream().filter(i -> Objects.equals(i.getFileType(), FileTypeEnum.WORD)
|
||||
|| Objects.equals(i.getFileType(), FileTypeEnum.EXCEL))
|
||||
.filter(i -> Boolean.TRUE.equals(i.getNeedReplaceVariables()))
|
||||
.forEach(docBaseVO -> {
|
||||
String newFileKey = wpsUtil.wpsFileVariableReplace(wpsReplaceVariables, null, docBaseVO.getFileKey(), docBaseVO.getTemplateName() + docBaseVO.getFileType().getSuffix(), autoReplaceVariables);
|
||||
String newFileKey = wpsUtil.wpsFileVariableReplace(wpsReplaceVariables, null, docBaseVO.getFileKey(), docBaseVO.getTemplateName() + docBaseVO.getFileType().getSuffix());
|
||||
docBaseVO.setFileKey(newFileKey);
|
||||
});
|
||||
// 删除非 WPS 的临时文档
|
||||
@ -124,6 +116,6 @@ public class FileArchiveProcessEventListener extends AbstractBpmnEventListener<P
|
||||
|
||||
@Override
|
||||
public int getOrder() {
|
||||
return Integer.MIN_VALUE + 99;
|
||||
return Integer.MIN_VALUE + 3;
|
||||
}
|
||||
}
|
||||
|
||||
@ -168,7 +168,6 @@ public class FirstCopyTemplateFileTaskEvent_105_Listener extends AbstractBpmnEve
|
||||
signFileDTO.setFileTag(template.getFileTag());
|
||||
signFileDTO.setFileType(template.getFileType());
|
||||
signFileDTO.setFileCode(template.getFileCode());
|
||||
signFileDTO.setNeedReplaceVariables(template.getNeedReplaceVariables());
|
||||
if (Objects.equals(template.getFileType(), FileTypeEnum.WORD) || Objects.equals(template.getFileType(), FileTypeEnum.EXCEL)) {
|
||||
String fileKey = wpsUtil.wpsFileVariableReplace(wpsReplaceVariables, template.getFileCode(), template.getFileKey(), template.getTemplateName() + template.getFileType().getSuffix());
|
||||
signFileDTO.setFileKey(fileKey);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user