|
@@ -4,6 +4,7 @@ import cn.hutool.core.codec.Base64;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import cn.hutool.core.lang.UUID;
|
|
|
+import cn.hutool.core.util.ZipUtil;
|
|
|
import cn.hutool.http.HttpUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
@@ -25,6 +26,7 @@ import com.fdkankan.model.constants.ConstantFilePath;
|
|
|
import com.fdkankan.rabbitmq.util.RabbitMqProducer;
|
|
|
import com.fdkankan.web.util.RSAEncrypt;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import net.lingala.zip4j.core.ZipFile;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -205,14 +207,20 @@ public class JmgaServiceImpl implements IJmgaService {
|
|
|
String uuid = UUID.randomUUID().toString();
|
|
|
String zipName = uuid + ".zip";
|
|
|
String zipDir = "/oss/4dkankan/bd_server/";
|
|
|
- String zipKey = param.getFilePath().replace("/oss/", "");
|
|
|
- fYunFileService.downloadFileByCommand(zipDir + zipName, zipKey);
|
|
|
- fYunFileService.deleteFile(zipKey);
|
|
|
+ fYunFileService.downloadFileByCommand(zipDir + zipName, param.getFilePath());
|
|
|
+// fYunFileService.deleteFile(param.getFilePath());
|
|
|
|
|
|
//解压缩
|
|
|
- String unzipCmd = "unzip -P " + ZipConstant.zipPassword + " " + zipDir + zipName + " -d " + zipDir + uuid;
|
|
|
- CmdUtils.callLineSh(unzipCmd);
|
|
|
- FileUtil.del(zipDir + zipName);
|
|
|
+// String unzipCmd = "unzip -P " + ZipConstant.zipPassword + " " + zipDir + zipName + " -d " + zipDir + uuid;
|
|
|
+// CmdUtils.callLineSh(unzipCmd);
|
|
|
+ ZipFile zipFile = new ZipFile(new File(zipDir + zipName));
|
|
|
+ if (zipFile.isEncrypted()) {
|
|
|
+ zipFile.setPassword(ZipConstant.zipPassword);
|
|
|
+ zipFile.extractAll(zipDir + uuid);
|
|
|
+ } else {
|
|
|
+ ZipUtil.unzip(zipDir + zipName, zipDir + uuid);
|
|
|
+ }
|
|
|
+// FileUtil.del(zipDir + zipName);
|
|
|
|
|
|
//去读data.fdage
|
|
|
File dataFdageFile = FileUtil.loopFiles(zipDir + uuid).stream().filter(v -> v.getName().equals("data.fdage")).findFirst().get();
|
|
@@ -229,7 +237,7 @@ public class JmgaServiceImpl implements IJmgaService {
|
|
|
FileUtil.mkdir(homePath);
|
|
|
String cpCmd = "cp -p -r " + zipDir + uuid + "/*/* " + homePath;
|
|
|
CmdUtils.callLineSh(cpCmd);
|
|
|
- FileUtil.del(zipDir + uuid);
|
|
|
+// FileUtil.del(zipDir + uuid);
|
|
|
|
|
|
String params = snCode + "#" + fileId + "#" + uniCode;
|
|
|
String encode = Base64.encode(RSAEncrypt.encrypt(RSAEncrypt.loadPublicKeyByStr(RSAEncrypt.loadPublicKeyByFile()), params.getBytes(StandardCharsets.UTF_8)));
|