RunViewRefresh_AbnormalReport.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #include "RunViewRefresh_AbnormalReport.h"
  2. RunViewRefresh_AbnormalReport::RunViewRefresh_AbnormalReport(InteractiveTask *task, QMutex *mutex)
  3. :RunAbstract(task, mutex)
  4. {
  5. }
  6. void RunViewRefresh_AbnormalReport::run()
  7. {
  8. InteractiveData *pSingletonData = SINGLETON_CREATE(InteractiveData)();
  9. QReadLocker locker(&pSingletonData->m_dataCacheLock);
  10. QJsonDocument jsonDoc;
  11. QJsonObject jsonObjRoot;
  12. QJsonArray jsonArrExceptionTypeDict;
  13. QJsonArray jsonArrSeverityLevelDict;
  14. for (int i = 0; i < pSingletonData->m_dataCacheExceptionTypeDictCode.size(); ++i)
  15. {
  16. QString code = pSingletonData->m_dataCacheExceptionTypeDictCode.at(i);
  17. jsonArrExceptionTypeDict.append( pSingletonData->m_dataCacheExceptionTypeDictLabel.value(code));
  18. }
  19. for (int i = 0; i < pSingletonData->m_dataCacheSeverityLevelDictCode.size(); ++i)
  20. {
  21. QString code = pSingletonData->m_dataCacheSeverityLevelDictCode.at(i);
  22. jsonArrSeverityLevelDict.append( pSingletonData->m_dataCacheSeverityLevelDictLabel.value(code));
  23. }
  24. jsonObjRoot.insert("ExceptionTypeDict", jsonArrExceptionTypeDict);
  25. jsonObjRoot.insert("SeverityLevelDict", jsonArrSeverityLevelDict);
  26. jsonDoc.setObject(jsonObjRoot);
  27. QByteArray json = jsonDoc.toJson(QJsonDocument::Compact);
  28. setRespond(json);
  29. }