|
|
@@ -39,17 +39,19 @@ public class UploadSceneListener {
|
|
|
public void handler(Channel channel, Message message) throws Exception {
|
|
|
String msg = new String(message.getBody(), StandardCharsets.UTF_8);
|
|
|
log.info("开始处理管理后台上传场景,content:{}", msg);
|
|
|
- String num = null;
|
|
|
- String zipPath = null;
|
|
|
+ JSONObject jsonObject = JSON.parseObject(msg);
|
|
|
+ String num = jsonObject.getString("num");;
|
|
|
+ String zipPath = jsonObject.getString("zipPath");
|
|
|
+ String sourceType = jsonObject.getString("sourceType");
|
|
|
+ String zipDir = FileUtil.getParent(zipPath, 1) + File.separator;
|
|
|
+ String zipName = FileUtil.getName(zipPath);
|
|
|
+ String uuid = FileUtil.getPrefix(zipName);
|
|
|
try {
|
|
|
- JSONObject jsonObject = JSON.parseObject(msg);
|
|
|
- num = jsonObject.getString("num");
|
|
|
- zipPath = jsonObject.getString("zipPath");
|
|
|
//解压缩
|
|
|
ZipFile zipFile = new ZipFile(new File(zipPath));
|
|
|
if (zipFile.isEncrypted()) {
|
|
|
zipFile.setPassword(ZipConstant.zipPassword);
|
|
|
- zipFile.extractAll(zipPath);
|
|
|
+ zipFile.extractAll(zipDir + uuid);
|
|
|
} else {
|
|
|
ZipUtil.unzip(zipPath, zipDir + uuid);
|
|
|
}
|