|
@@ -50,9 +50,11 @@ public class NsqMesgDeal implements NSQMessageCallback {
|
|
|
try {
|
|
|
String path = data.getPath();
|
|
|
String fileHash = data.getFileHash();
|
|
|
- String localPath = BD_BASE_PATH + fileHash + File.separator + fileHash + ".zip";
|
|
|
+ String filename = data.getFilename();
|
|
|
+ String localPath = BD_BASE_PATH + fileHash + File.separator + filename + ".zip";
|
|
|
HttpUtil.downloadFile(path, new File(localPath), 1000 * 60 * 60 * 4);
|
|
|
String md5 = MD5.create().digestHex(new File(localPath));
|
|
|
+ log.info("localPath:{},md5:{}", localPath, md5);
|
|
|
data.setLocalPath(localPath);
|
|
|
//比对md5是否一致
|
|
|
if(!md5.equals(fileHash)){
|
|
@@ -78,8 +80,12 @@ public class NsqMesgDeal implements NSQMessageCallback {
|
|
|
//通知平台文件已下载(删除文件)
|
|
|
JSONObject param = new JSONObject();
|
|
|
param.put("filename", data.getFilename());
|
|
|
- Result notify = mjHttpClient.notify(param);
|
|
|
- log.info("distributeDetail-notify:{}", notify);
|
|
|
+ try {
|
|
|
+ Result notify = mjHttpClient.notify(param);
|
|
|
+ log.info("distributeDetail-notify:{}", notify);
|
|
|
+ }catch (Exception e){
|
|
|
+ log.error("通知明镜删除文件失败, filename:{}", data.getFilename(), e);
|
|
|
+ }
|
|
|
}catch (Exception e){
|
|
|
data.setReason(ExceptionUtil.stacktraceToString(e, 5000));
|
|
|
data.setStatus(CommonSuccessStatus.FAIL.code());
|
|
@@ -91,17 +97,21 @@ public class NsqMesgDeal implements NSQMessageCallback {
|
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
|
- try (
|
|
|
- ZipFile zipFile = new ZipFile("D:\\Downloads\\916ed6689_202501101516307030\\916ed6689_202501101516307030.zip");
|
|
|
- InputStream ins = ZipUtil.get(zipFile, "data.fdage")
|
|
|
- ){
|
|
|
- String tempFdagePath = "D:\\Downloads\\aaa.fdage";
|
|
|
- FileUtil.writeFromStream(ins, tempFdagePath);
|
|
|
- JSONObject dataFdage = JSON.parseObject(FileUtil.readUtf8String(tempFdagePath));
|
|
|
- String unicode = dataFdage.getString("creator") + "_" + dataFdage.getString("uuidtime");
|
|
|
- System.out.println(unicode);
|
|
|
- } catch (IOException e) {
|
|
|
- throw new RuntimeException(e);
|
|
|
- }
|
|
|
+// try (
|
|
|
+// ZipFile zipFile = new ZipFile("D:\\Downloads\\916ed6689_202501101516307030\\916ed6689_202501101516307030.zip");
|
|
|
+// InputStream ins = ZipUtil.get(zipFile, "data.fdage")
|
|
|
+// ){
|
|
|
+// String tempFdagePath = "D:\\Downloads\\aaa.fdage";
|
|
|
+// FileUtil.writeFromStream(ins, tempFdagePath);
|
|
|
+// JSONObject dataFdage = JSON.parseObject(FileUtil.readUtf8String(tempFdagePath));
|
|
|
+// String unicode = dataFdage.getString("creator") + "_" + dataFdage.getString("uuidtime");
|
|
|
+// System.out.println(unicode);
|
|
|
+// } catch (IOException e) {
|
|
|
+// throw new RuntimeException(e);
|
|
|
+// }
|
|
|
+
|
|
|
+ String s = MD5.create().digestHex(new File("D:\\Downloads\\log(2)(1)\\123456789\\b0147t287_202505151654414730\\b0147t287_202505151654414730.zip"));
|
|
|
+ System.out.println(s);
|
|
|
+
|
|
|
}
|
|
|
}
|