|
|
@ -16,6 +16,7 @@ |
|
|
|
|
|
|
|
#include "appbase/appbean/disinfection_record_csv_header.hpp"
|
|
|
|
#include "appbase/utils/zsimplepdf.hpp"
|
|
|
|
#include "appdep/components/ziconv.hpp"
|
|
|
|
using namespace std; |
|
|
|
using namespace iflytop; |
|
|
|
typedef DisinfectionRecordCSVHeader CSVHeader; |
|
|
@ -251,6 +252,7 @@ void DisinfectionLogsService::onAppDisinfectionFinishedEvent(shared_ptr<Disinfec |
|
|
|
* 1.创建打印文件缓存 |
|
|
|
* 2.创建PDF文件缓存 |
|
|
|
*/ |
|
|
|
printRecordFile(m_sessionId); |
|
|
|
} |
|
|
|
|
|
|
|
/**
|
|
|
@ -470,6 +472,26 @@ void DisinfectionLogsService::deleteRecordFile(string file) { |
|
|
|
dosystem(fmt::format("rm -rf {}", filepath)); |
|
|
|
m_recordFiles.remove_if([file](const string& s) { return s == file; }); |
|
|
|
} |
|
|
|
void DisinfectionLogsService::printRecordFile(string file) { |
|
|
|
string filepath = fmt::format("{}{}.log", LOG_STORGE_PATH, file); |
|
|
|
string content = FileUtils().readFileAsString(filepath); |
|
|
|
|
|
|
|
// 对dump进行分行处理
|
|
|
|
vector<string> textlist; |
|
|
|
|
|
|
|
istringstream stream(content); |
|
|
|
string line; |
|
|
|
while (getline(stream, line)) { |
|
|
|
textlist.push_back(line); |
|
|
|
} |
|
|
|
|
|
|
|
ZASSERT(GET_SERVICE(UartPrinter)); |
|
|
|
for (auto& text : textlist) { |
|
|
|
GET_SERVICE(UartPrinter)->print(ZIconv::utf8_to_gb2312(text + "\n")); |
|
|
|
logger->info("print: {}", text); |
|
|
|
this_thread::sleep_for(chrono::milliseconds(200)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
int32_t DisinfectionLogsService::exportDisinfectionData(vector<string> files) { |
|
|
|
string diskpath; |
|
|
@ -567,6 +589,8 @@ void DisinfectionLogsService::fn_exportRecord(shared_ptr<MsgProcessContext> cxt) |
|
|
|
} |
|
|
|
void DisinfectionLogsService::fn_printRecord(shared_ptr<MsgProcessContext> cxt) { |
|
|
|
//
|
|
|
|
string logName = cxt->params["logName"]; |
|
|
|
printRecordFile(logName); |
|
|
|
} |
|
|
|
|
|
|
|
chrono::system_clock::time_point time_point_increment(chrono::system_clock::time_point& tp, int seconds) { |
|
|
|