Commit fbf2f1e3 by 朽木不可雕也

backup

parent d4afaed1
package com.zhiweidata.automatictest.barragecrawlerserver.exporttasks;
import com.zhiweidata.automatictest.barragecrawlerserver.entity.ServerResponseMessage;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
......@@ -68,4 +69,11 @@ public interface BarrageExportTaskJob extends Job {
// 删除文件夹或文件
if (!file.delete()) log.error("文件夹:{}删除失败", file.getName());
}
/**
* 保存服务器的响应信息
*/
default void saveResponseMessage(ServerResponseMessage message) {
}
}
......@@ -5,6 +5,7 @@ import com.alibaba.excel.event.SyncReadListener;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.zhiweidata.automatictest.barragecrawlerserver.entity.BarrageCollectionTestTask;
import com.zhiweidata.automatictest.barragecrawlerserver.entity.BarrageExportInfo;
import com.zhiweidata.automatictest.barragecrawlerserver.entity.ServerResponseMessage;
import java.io.File;
import java.io.IOException;
import java.util.List;
......@@ -85,9 +86,10 @@ public class BiliBiliExportTaskJob implements BarrageExportTaskJob {
String contentType = response.getFirstHeader("Content-Type").getValue();
if (ContentType.APPLICATION_JSON.getMimeType().equals(contentType)) {
ObjectMapper jsonMapper = new ObjectMapper();
Map<?, ?> jsonMap = jsonMapper.readValue(response.getEntity().getContent(), Map.class);
String message = (String) jsonMap.get("message");
log.info(message);
ServerResponseMessage responseMessage = jsonMapper.readValue(response.getEntity().getContent(), ServerResponseMessage.class);
log.info(responseMessage.getMessage());
responseMessage.setName(collectionTask.getName());
this.saveResponseMessage(responseMessage);
} else {
final File cacheDir = new File(CACHE_DIR, taskResponse.getId());
List<File> excelFiles = this.write(cacheDir, response.getEntity().getContent());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment