From a5f944c2bc0107e5df936937f1c33e5e03eb8fed Mon Sep 17 00:00:00 2001
From: yangys <y_ys79@sina.com>
Date: 星期六, 06 九月 2025 19:15:48 +0800
Subject: [PATCH] 解锁增加解锁原因和展示
---
blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/DNCSendBackService.java | 401 ++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 300 insertions(+), 101 deletions(-)
diff --git a/blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/DNCSendBackService.java b/blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/DNCSendBackService.java
index d85eefd..a9dfc6a 100644
--- a/blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/DNCSendBackService.java
+++ b/blade-service/blade-mdm/src/main/java/org/springblade/mdm/program/service/DNCSendBackService.java
@@ -1,33 +1,36 @@
package org.springblade.mdm.program.service;
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
import lombok.AllArgsConstructor;
+import lombok.Data;
import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.codec.digest.DigestUtils;
-import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
-import org.apache.commons.compress.archivers.zip.ZipFile;
-import org.apache.commons.compress.utils.SeekableInMemoryByteChannel;
+import org.apache.commons.io.FilenameUtils;
import org.apache.commons.lang3.StringUtils;
import org.springblade.core.log.exception.ServiceException;
-import org.springblade.core.mp.base.BizEntity;
import org.springblade.core.mp.base.BizServiceImpl;
import org.springblade.core.oss.OssTemplate;
import org.springblade.core.oss.model.BladeFile;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.FileUtil;
import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.IoUtil;
+import org.springblade.mdm.basesetting.machine.entity.Machine;
+import org.springblade.mdm.basesetting.machine.service.MachineService;
+import org.springblade.mdm.commons.service.ParamService;
+import org.springblade.mdm.flow.entity.FlowProgramFile;
import org.springblade.mdm.flow.service.CureFlowService;
+import org.springblade.mdm.flow.service.FlowCommonService;
+import org.springblade.mdm.program.entity.DncBackFile;
import org.springblade.mdm.program.entity.NcNode;
-import org.springblade.mdm.program.entity.NcProgram;
import org.springblade.mdm.program.entity.NcProgramExchange;
import org.springblade.mdm.program.mapper.NcProgramExchangeMapper;
import org.springblade.mdm.program.vo.DncSendBackData;
-import org.springblade.mdm.utils.CustomBinaryReader;
-import org.springframework.beans.BeanUtils;
+import org.springblade.mdm.program.vo.DncSendBackFile;
+import org.springblade.mdm.program.vo.ProgramAnnotation;
+import org.springblade.mdm.utils.FileContentUtil;
+import org.springblade.mdm.utils.ZipTextFileContentUtil;
+import org.springblade.system.pojo.entity.DictBiz;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
@@ -35,10 +38,11 @@
import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
-import java.nio.file.Paths;
+import java.nio.file.StandardOpenOption;
import java.time.Duration;
-import java.time.LocalDateTime;
import java.util.*;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
/**
* DNC鍥炰紶鏂囦欢澶勭悊鏈嶅姟
@@ -50,13 +54,21 @@
@AllArgsConstructor
public class DNCSendBackService extends BizServiceImpl<NcProgramExchangeMapper, NcProgramExchange> {
private final CureFlowService cureFlowService;
- private final NcProgramService ncProgramService;
+ private final ProgramAnnotationService programAnnotationService;
private final NcNodeService ncNodeService;
private final OssTemplate ossTemplate;
private final BladeRedis bladeRedis;
+ private final FlowCommonService flowCommonService;
+ private final DncBackFileService dncBackFileService;
+ private final MachineService machineService;
+ private final ParamService paramService;
+ /**
+ * 鍋忕鍗曟枃浠舵湯灏剧殑妯″紡锛歅+鏁板瓧
+ */
+ private static final String P_NUMBER_PATTERN = "(?i)P\\d+";
private String getFileKey(){
- return "dncexpfile-"+ AuthUtil.getUserId();
+ return "dncimpfile-"+ AuthUtil.getUserId();
}
/**
* dnc鍥炰紶鏂囦欢涓婁紶
@@ -65,16 +77,21 @@
*/
public List<DncSendBackData> dncSendBackUpload(MultipartFile file) {
List<DncSendBackData> list;
+ if(file == null || file.isEmpty()){
+ throw new ServiceException("鏂囦欢涓虹┖");
+ }
+
+ if(!StringUtils.endsWith(file.getOriginalFilename(),".zip")){
+ throw new ServiceException("鏂囦欢蹇呴』涓簔ip鍖�");
+ }
try {
BladeFile bfile = ossTemplate.putFile(file);//涓婁紶锛屼緵鍚庣画鍏ュ簱浣跨敤
//璁剧疆涓�涓紦瀛橈紝2灏忔椂杩囨湡
bladeRedis.setEx(getFileKey(),bfile.getName(), Duration.ofHours(2));
- InputStream zipFileInputStream = file.getInputStream();//test
-
- byte[] bytes = FileUtil.copyToByteArray(zipFileInputStream);
- list = parseDncZipFromByteArray(bytes);
-
+ try(InputStream zipFileInputStream = ossTemplate.statFileStream(bfile.getName());) {
+ list = parseProgramListFromZip(zipFileInputStream);
+ }
} catch (IOException e) {
log.error("涓婁紶dnc鍥炰紶鏂囦欢澶辫触",e);
throw new ServiceException("瑙f瀽DNC鍥炰紶鏁版嵁澶辫触");
@@ -85,134 +102,316 @@
/**
* 浠庡帇缂╁寘 瑙f瀽鍥炰紶绋嬪簭鍒楄〃锛岃繖閲岃В鏋愮洰褰曞嵆鍙紝鐩綍灏辨槸绋嬪簭鍖呭悕
- * @param zipData 鍘嬬缉鍖呭瓧鑺�
+ * @param inputStream 鍘嬬缉鍖呰緭鍏ユ祦
* @return 鍥炰紶绋嬪簭鍒楄〃
- * @throws IOException
+ * @throws IOException 鏂囦欢鎿嶄綔寮傚父
*/
- List<DncSendBackData> parseDncZipFromByteArray(byte[] zipData) throws IOException {
+ List<DncSendBackData> parseProgramListFromZip(InputStream inputStream) throws IOException {
List<DncSendBackData> list = new ArrayList<>();
+ Path tempZipFile = createTempFile(inputStream);
- //Map<String,String> fileMd5Map = new HashMap<>();
- Map<String,DncSendBackData> fileDataMap = new HashMap<>();
- try (SeekableInMemoryByteChannel channel = new SeekableInMemoryByteChannel(zipData);
- ZipFile zipFile = new ZipFile(channel)) {
+ List<String> fileEntryNameList = new ArrayList<>();
+ List<String> dirEntryNameList = new ArrayList<>();//绋嬪簭鍖呭悕+宸ュ簭鐗堟 浣滀负鏂囦欢澶瑰悕
+ try (ZipFile zipFile = new ZipFile(tempZipFile.toFile())) {
- ZipArchiveEntry entry;
- Enumeration<ZipArchiveEntry> entries = zipFile.getEntries();
- while (entries.hasMoreElements()) {
- entry = entries.nextElement();
- DncSendBackData progData = new DncSendBackData();
- String entryName = entry.getName();
- if (entry.isDirectory()){
- //鐩綍锛屾墠鏄▼搴忓寘锛�
- //鏌ヨ鏁版嵁搴擄紝瀵瑰簲涓婃墠鑳界‘璁ゆ椂鏈夋晥鐨勭▼搴忓寘
- String packageName = StringUtils.removeEnd(entryName,"/");
- List<NcNode> pkgList = ncNodeService.lambdaQuery().eq(NcNode::getNodeType,NcNode.TYPE_PROGRAM_PACKAGE).eq(NcNode::getName, packageName).eq(NcNode::getIsLastEdition,1).list();
- if(!pkgList.isEmpty()) {
- NcNode programPackageNode = pkgList.get(0);
- progData.setId(programPackageNode.getId());
- progData.setProgramName(packageName);
- progData.setFileBackTime(LocalDateTime.now());
- progData.setProgramNo(programPackageNode.getProgramNo());
- list.add(progData);
- }
+ Enumeration<? extends ZipEntry> zipEntries = zipFile.entries();
+ ZipEntry entry;
+ //鑾峰彇鎵�鏈夌殑entry鍚嶇О
+ while (zipEntries.hasMoreElements()) {
+ entry = zipEntries.nextElement();
+
+ if(entry.isDirectory()){
+ dirEntryNameList.add(entry.getName());
+ }else{
+ fileEntryNameList.add(entry.getName());
}
}
+ List<DictBiz> annotionDictList = programAnnotationService.getAnnotionDictList();
+ NcNode programPackageNode;
+ //鐩綍鍒楄〃锛屽嵆绋嬪簭鍖呭垪琛�
+ for(String entryName : dirEntryNameList){
+ DncSendBackData progData = new DncSendBackData();
+ String folderName = StringUtils.removeEnd(entryName,"/");
+
+ PackageAndProcessEdition pkgAndEdition = parseProgramPackageFromFolderName(folderName);
+ String packageName = pkgAndEdition.getProgramPackageName();
+ String processEdition = pkgAndEdition.getProcessEdition();
+ if(StringUtils.isBlank(packageName) || StringUtils.isBlank(processEdition)){
+ throw new ServiceException("鍖呭唴鏂囦欢澶瑰悕鏍煎紡閿欒搴旇涓篬闆剁粍浠跺彿-宸ュ簭鍙�-宸ュ簭鐗堟]:"+folderName);
+ }
+
+ progData.setProgramName(packageName);
+ String statusLine;
+ Optional<String> optFilename = fileEntryNameList.stream().filter(n -> n.startsWith(entryName)).findFirst();
+ if(optFilename.isPresent()){
+ entry = zipFile.getEntry(optFilename.get());
+ InputStream ins = zipFile.getInputStream(entry);
+ progData.setFileBackTime(DateUtil.fromInstant(entry.getLastModifiedTime().toInstant()));
+ statusLine = FileContentUtil.readLineAt(ins,2);
+ if(statusLine.contains("SQ")){
+ //璇曞垏
+ programPackageNode = ncNodeService.getLastEditionTryingProgramPackage(packageName,processEdition);
+ }else if(statusLine.contains("GH")){
+ //鍥哄寲
+ programPackageNode = ncNodeService.getLastEditionCuredProgramPackage(packageName,processEdition);
+ }else if(statusLine.contains("PL")){
+ //鍋忕
+ programPackageNode =ncNodeService.getLastEditionDeviationProgramPackage(packageName,processEdition);
+ }else{
+ //鏌ヨ鏄惁杞﹀簥锛屾槸杞﹀簥鍙互鏀捐繃锛屾寜璇曞垏澶勭悊
+ programPackageNode = ncNodeService.getLastEditionTryingProgramPackage(packageName,processEdition);
+ if(programPackageNode!=null){
+ Machine machine = machineService.getByCode(programPackageNode.getMachineCode());
+ String chechuangVal = paramService.turninngValue();
+ if(StringUtils.equals(machine.getMachineSpec(),chechuangVal)){
+ //杞﹀簥
+ ProgramAnnotation pa = programAnnotationService.getProgramAnnotationFormat(machine.getControlSystem(),annotionDictList);
+ statusLine = pa.addAnnotation(ProgramAnnotationService.SQ);
+ }
+ }
+ }
+
+ if(programPackageNode != null) {
+ progData.setId(programPackageNode.getId());
+ progData.setProgramNo(programPackageNode.getProgramNo());
+
+ List<String> fileEntryNames = fileEntryNameList.stream().filter(n -> n.startsWith(packageName)).toList();
+ List<DncSendBackFile> programFiles = new ArrayList<>();
+ fileEntryNames.forEach( filePath ->{
+ DncSendBackFile backFile = new DncSendBackFile();
+ backFile.setEntryName(filePath);
+ backFile.setName(StringUtils.removeStart(filePath,entryName));
+ programFiles.add(backFile);
+ });
+
+ progData.setFiles(programFiles);
+ list.add(progData);
+ }else{
+ throw new ServiceException("鎵句笉鍒扮▼搴忓寘鍚�:"+packageName);
+ }
+ }else{
+ throw new ServiceException(entryName+"鍖呬笅鏈壘鍒版枃浠�");
+ }
+
+ }
}
return list;
}
+ /**
+ * 浠庢枃浠跺す鍚嶈В鏋愬嚭绋嬪簭鍖呭悕鍜屽拰宸ュ簭鐗堟
+ * @param folderName 鏂囦欢澶瑰悕
+ * @return 缁撴瀯鏁版嵁
+ */
+ PackageAndProcessEdition parseProgramPackageFromFolderName(String folderName){
+ int index = StringUtils.lastIndexOf(folderName,'-');
+ String processEditon = "";
+ String temp;
+ String packageName = "";
+ if(index != -1){
+ processEditon = folderName.substring(index+1);
+ packageName = folderName.substring(0,index);
+ }
+
+ PackageAndProcessEdition result = new PackageAndProcessEdition();;
+ result.setProgramPackageName(packageName);
+ result.setProcessEdition(processEditon);
+ return result;
+ }
/**
* 鍏ュ簱鍥炰紶鏂囦欢,骞跺惎鍔ㄥ浐鍖栨祦绋�
* @param ids id鍒楄〃閫楀彿鍒嗛殧,绋嬪簭鍖呭悕 鑺傜偣鐨刬d
- * @return
*/
@Transactional
public void dncFileAccept(String ids) throws IOException {
- List<Long> idList = Func.toLongList(ids);
+ List<Long> acceptIdList = Func.toLongList(ids);
//
NcProgramExchange exchange;
- String pkgFileName = bladeRedis.get(getFileKey());
- updateNodeDataByDNCBackData(pkgFileName,idList);
- List<NcNode> pkgList = ncNodeService.listByIds(idList);
- for(NcNode pkgNode :pkgList){
- exchange = new NcProgramExchange();
- exchange.setName(pkgNode.getName());
- exchange.setExchangeType(2);//鍥炰紶
- exchange.setNcNodeId(pkgNode.getId());
+ String filekey = getFileKey();
+ String zipFileName = bladeRedis.get(filekey);
+ log.info("filekey={},鏂囦欢鍚�={}",filekey,zipFileName);
- this.save(exchange);
- }
+ Map<Long,List<FlowProgramFile>> pkgIdFileMap = dealWithBackFile(zipFileName,acceptIdList);
- cureFlowService.startCure(pkgList);
+ cureFlowService.startCureNew(pkgIdFileMap);
+
}
/**
- * 鏇存柊鑺傜偣锛屼富瑕佹槸鍒涘缓 绋嬪簭鍖呭悕 鐨勬柊鐗堟湰銆�
- * @param pkgFileName zip鏂囦欢鍚�
- * @param programPackageIdList 绋嬪簭鍖呭悕 鑺傜偣鐨刬d鍒楄〃
- * @throws IOException 璁块棶鏂囦欢寮傚父
+ * 澶勭悊鍥炰紶鏂囦欢
+ * @param ossFileName
+ * @param acceptIdList
+ * @return
+ * @throws IOException
*/
- void updateNodeDataByDNCBackData(String pkgFileName, List<Long> programPackageIdList) throws IOException {
- InputStream inputStream = this.ossTemplate.statFileStream(pkgFileName);
- byte[] bytes = FileUtil.copyToByteArray(inputStream);
+ private Map<Long, List<FlowProgramFile>> dealWithBackFile(String ossFileName, List<Long> acceptIdList) throws IOException{
+ Map<Long, List<FlowProgramFile>> pkgIdFileMap = new HashMap<>();
- List<NcNode> nodeList = new ArrayList<>();
+ InputStream inputStream = this.ossTemplate.statFileStream(ossFileName);
+ Path tempZipFile = createTempFile(inputStream);
List<String> entryNameList = new ArrayList<>();
- try (SeekableInMemoryByteChannel channel = new SeekableInMemoryByteChannel(bytes);
- ZipFile zipFile = new ZipFile(channel)) {
- ZipArchiveEntry entry;
- Enumeration<ZipArchiveEntry> entries = zipFile.getEntries();
- while (entries.hasMoreElements()) {
+ ZipEntry entry;
+ try (java.util.zip.ZipFile zipFile = new java.util.zip.ZipFile(tempZipFile.toFile())) {
+ Enumeration<? extends ZipEntry> entries = zipFile.entries();
+ while(entries.hasMoreElements()) {
entry = entries.nextElement();
entryNameList.add(entry.getName());
}
+ log.info("allentrynames:{}",entryNameList);
+ List<NcNode> allAcceptPackages = this.ncNodeService.lambdaQuery().in(NcNode::getId,acceptIdList).list();
//鏍规嵁鍐呴儴鏂囦欢锛岃鍙栧拰鍒嗘瀽绋嬪簭鍖呭拰绋嬪簭鏂囦欢鏁版嵁
List<String> dirList = entryNameList.stream().filter(s -> s.endsWith("/")).toList();
for(String dir : dirList){
- String programPackageName = StringUtils.removeEnd(dir,"/");
- NcNode oriProgramPkg = this.ncNodeService.getLastEditionProgramPackage(programPackageName);
- if(oriProgramPkg == null){
- log.warn("鏈彂鐜板尮閰嶇殑绋嬪簭鍖呭悕{}",programPackageName);
- continue;
+ String folderName = StringUtils.removeEnd(dir,"/");
+
+ PackageAndProcessEdition pkgAndEdition = parseProgramPackageFromFolderName(folderName);
+ String programPackageName = pkgAndEdition.getProgramPackageName();
+
+ Optional<NcNode> optPackageNode = allAcceptPackages.stream().filter(node -> StringUtils.equals(node.getName(),programPackageName)).findFirst();
+
+ if(optPackageNode.isEmpty()){
+ throw new ServiceException("鎵句笉鍒扮▼搴�"+programPackageName);
}
- //涓存椂娴嬭瘯娉ㄩ噴
- /*
- NcNode newProgramPkg = new NcNode();
- BeanUtils.copyProperties(oriProgramPkg, newProgramPkg);
- newProgramPkg.setId(null);
- newProgramPkg.setIsLastEdition(1);
- newProgramPkg.setCreateTime(null);
- newProgramPkg.setUpdateTime(null);
- newProgramPkg.setCreateUser(null);
- newProgramPkg.setUpdateUser(null);
+ NcNode packageNode = optPackageNode.get();
+ if(packageNode.hasCured()) {
+ throw new ServiceException(programPackageName + "宸茬粡鍥哄寲锛岃鍕块噸澶嶅叆搴撱��");
+ }
+ //鍋忕绋嬪簭鍒ゆ柇鏄惁閲嶅鍥炰紶
+ if(packageNode.isDeviationProgram() && packageNode.hasLocked()) {
+ throw new ServiceException(programPackageName + "宸查攣瀹氱殑绋嬪簭涓嶅彲浠ュ啀娆″洖浼犮��");
+ }
+ //妫�鏌ユ槸鍚﹀湪瀹℃壒杩囩▼涓�
+ boolean active = flowCommonService.isProcessInstanceActive(packageNode.getProcessInstanceId());
+ if(active){
+ throw new ServiceException(programPackageName+"姝e湪瀹℃壒涓紝璇峰嬁绛夊緟瀹℃壒瀹屾垚銆�");
+ }
- ncNodeService.save(newProgramPkg);
+ //楠岃瘉閮借繃浜嗭紝淇濆瓨dncbackFile
+ DncBackFile backFile = new DncBackFile();
+ backFile.setNcNodeId(packageNode.getId());
+ backFile.setOssName(ossFileName);
+ dncBackFileService.save(backFile);
- //鏃ф暟鎹洿鏂颁负鑰佺増鏈�
- oriProgramPkg.setIsLastEdition(0);;
- ncNodeService.save(oriProgramPkg);
- */
+ List<FlowProgramFile> flowFiles = new ArrayList<>();
//鏌ユ壘鍖呬笅鐨勬枃浠舵暟鎹�,
entryNameList.stream().filter(s -> s.startsWith(dir)).forEach(entryName -> {
- log.info(dir+"涓嬬殑鏂囦欢锛歿}",entryName);
- });
- }
+ log.info("{}涓嬬殑鏂囦欢锛歿}",dir,entryName);
+ if(!entryName.endsWith("/")){
+ //瀹為檯鐨勬枃浠�
+ String fileName = StringUtils.removeStart(entryName,dir);//鍘婚櫎鏂囦欢鍚嶈矾寰勯儴鍒�
+ fileName = removeDeviationPart(fileName);
+ try {
+ FlowProgramFile newFlowFile = new FlowProgramFile();
+ newFlowFile.setProgramName(packageNode.getName());
+ newFlowFile.setProcessInstanceId(null);//鍏堢疆涓虹┖锛屽惎鍔ㄦ祦绋嬪悗璁剧疆璇ュ��
+ newFlowFile.setFileType("program");
+ newFlowFile.setName(fileName);
+ InputStream ins = zipFile.getInputStream(zipFile.getEntry(entryName));
+ BladeFile newOssFile = ossTemplate.putFile("mdm",fileName,ins);
+ newFlowFile.setOssName(newOssFile.getName());
+
+ flowFiles.add(newFlowFile);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ });
+
+ pkgIdFileMap.put(packageNode.getId(),flowFiles);
+ }
}
+ return pkgIdFileMap;
}
- void setBaseProperties(BizEntity entity, JSONObject jsonObject){
- entity.setCreateTime(jsonObject.getDate("createTime"));
- entity.setUpdateTime(jsonObject.getDate("updateTime"));
- entity.setStatus(jsonObject.getInteger("status"));
- entity.setCreateUser(jsonObject.getLong("createUser"));
- entity.setUpdateUser(jsonObject.getLong("updateUser"));
+ String removeDeviationPart(String filename){
+ String finalFilename = filename;
+ //鍘绘帀鏂囦欢鍚嶄腑鍙兘甯︽湁鐨勫亸绂诲崟閮ㄥ垎锛�-P[搴忓彿]
+ String ext = FilenameUtils.getExtension(filename);
+ String dotExt = StringUtils.isNotBlank(ext)?"."+ext:ext;//甯︾偣鐨勬墿灞曞悕
+ String notExtName = StringUtils.removeEnd(filename,dotExt);
+ int idx = notExtName.lastIndexOf("-");
+ if(idx != -1){
+ String endPart = notExtName.substring(idx+1);
+ //Pattern.CASE_INSENSITIVE
+ boolean containsPld = endPart.matches(P_NUMBER_PATTERN);
+ if(containsPld){
+ finalFilename = notExtName.substring(0, idx)+dotExt;
+ }
+ }
+
+ return finalFilename;
}
+ /**
+ * 鍒涘缓涓�涓复鏃秡ip鏂囦欢
+ * @param inputStream 鏂囦欢鐨勮緭鍏ユ祦
+ * @return path 鏂囦欢
+ * @throws IOException
+ */
+ Path createTempFile(InputStream inputStream) throws IOException {
+ byte[] zipData = FileUtil.copyToByteArray(inputStream);
+ Path tempFile = Files.createTempFile("tempzip"+System.currentTimeMillis(), ".zip");
+ // 鍐欏叆瀛楄妭鏁版嵁鍒颁复鏃舵枃浠�
+ Files.write(tempFile, zipData, StandardOpenOption.WRITE);
+
+ return tempFile;
+ }
+
+ /**
+ * 鑾峰彇鍥炰紶鏂囦欢鐨勫唴瀹�
+ * @param entryName 鏂囦欢鍦ㄥ帇缂╁寘鍐呯殑璺緞
+ * @return 鏂囦欢鍐呭鏂囨湰
+ */
+ public String getEntryFileContent(String entryName) throws IOException {
+ String result = "";
+ String zipFileName = bladeRedis.get(getFileKey());
+ return ZipTextFileContentUtil.getTextContent(this.ossTemplate.statFileStream(zipFileName),entryName);
+
+ /*
+ try(InputStream inputStream = this.ossTemplate.statFileStream(zipFileName);){
+ Path tempZipFile = createTempFile(inputStream);
+
+ ZipEntry entry;
+ try (java.util.zip.ZipFile zipFile = new java.util.zip.ZipFile(tempZipFile.toFile())) {
+ Enumeration<? extends ZipEntry> entries = zipFile.entries();
+ while (entries.hasMoreElements()) {
+ entry = entries.nextElement();
+ if (!entryName.equals(entry.getName())) {
+ continue;
+ }
+ try (InputStream fileIns = zipFile.getInputStream(zipFile.getEntry(entryName))) {
+ ByteArrayInputStream bos = new ByteArrayInputStream(fileIns.readAllBytes());
+ boolean isText = StringUtils.endsWithIgnoreCase(entryName,".txt") || StringUtils.endsWithIgnoreCase(entryName,".nc")|| StringUtils.endsWithIgnoreCase(entryName,".xml");
+ if(!isText) {
+ isText = FileContentUtil.isTextFile(bos);
+ }
+ if (isText) {
+ bos.reset();
+ result = FileContentUtil.getContentFromStream(bos);
+ } else {
+ result = "<闈炴枃鏈枃浠�>";
+ }
+ }
+
+ }
+ }
+ }
+
+ return result;*/
+ }
+
+}
+
+@Data
+class PackageAndProcessEdition{
+ private String programPackageName;
+ private String processEdition;
+
}
--
Gitblit v1.9.3