| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.flowable.engine.HistoryService; |
| | | import org.flowable.engine.ProcessEngine; |
| | | import org.springblade.core.log.exception.ServiceException; |
| | | import org.springblade.core.mp.base.BizServiceImpl; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.oss.OssTemplate; |
| | | import org.springblade.core.oss.model.BladeFile; |
| | | import org.springblade.core.tool.utils.FileUtil; |
| | | import org.springblade.mdm.flow.entity.FlowProgramFile; |
| | | import org.springblade.mdm.flow.service.FlowBusinessService; |
| | | import org.springblade.mdm.program.entity.DncBackFile; |
| | | import org.springblade.mdm.program.entity.NcNode; |
| | | import org.springblade.mdm.program.entity.NcNodeHis; |
| | | import org.springblade.mdm.program.mapper.DncBackFileMapper; |
| | | import org.springblade.mdm.program.vo.DncBackFileQueryVO; |
| | | import org.springblade.mdm.program.vo.DncBackFileVO; |
| | | import org.springblade.mdm.program.vo.DncSendBackFile; |
| | | import org.springblade.mdm.utils.FileContentUtil; |
| | | import org.springblade.mdm.utils.ZipTextFileContentUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.nio.file.Files; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Enumeration; |
| | | import java.util.List; |
| | | import java.util.Optional; |
| | | import java.util.zip.ZipEntry; |
| | | |
| | | /** |
| | |
| | | @AllArgsConstructor |
| | | public class DncBackFileService extends BizServiceImpl<DncBackFileMapper, DncBackFile> { |
| | | private final NcNodeService ncNodeService; |
| | | private final NcNodeHisService nodeHisService; |
| | | private final OssTemplate ossTemplate; |
| | | private final HistoryService historyService; |
| | | private final FlowBusinessService businessService; |
| | |
| | | * 检查流程实例是否被执行过(通过历史记录) |
| | | */ |
| | | public boolean isProcessExecuted(String processInstanceId) { |
| | | // 检查是否有历史活动记录 |
| | | /* |
| | | long activityCount = historyService.createHistoricActivityInstanceQuery() |
| | | .processInstanceId(processInstanceId) |
| | | .count(); |
| | | */ |
| | | if(StringUtils.isBlank(processInstanceId)){ |
| | | //空流程实例id,说明节点已经没有了 |
| | | return true; |
| | | } |
| | | // 检查是否有历史任务记录 |
| | | long taskCount = historyService.createHistoricTaskInstanceQuery() |
| | | .processInstanceId(processInstanceId) |
| | |
| | | |
| | | InputStream inputStream = this.ossTemplate.statFileStream(backFIle.getOssName()); |
| | | Path tempZipFile = createTempFile(inputStream); |
| | | List<String> entryNameList = new ArrayList<>(); |
| | | NcNode packageNode = this.ncNodeService.getById(backFIle.getNcNodeId()); |
| | | String targetFolder = packageNode.getName()+"-"+packageNode.getProcessEdition()+"/"; |
| | | NcNodeHis packageNode = nodeHisService.getById(backFIle.getNcNodeId()); |
| | | //String targetFolder = packageNode.getName()+"-"+packageNode.getProcessEdition()+"/"; |
| | | String targetFolder = packageNode.getName()+"/"; |
| | | ZipEntry entry; |
| | | try (java.util.zip.ZipFile zipFile = new java.util.zip.ZipFile(tempZipFile.toFile())) { |
| | | Enumeration<? extends ZipEntry> entries = zipFile.entries(); |