respgetjsjcinfo.cpp 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #include "respgetjsjcinfo.h"
  2. #include <QScriptValue>
  3. #include <QScriptEngine>
  4. #include <QScriptValueIterator>
  5. RespGetJSJCinfo::RespGetJSJCinfo(QString json)
  6. {
  7. this->json = json;
  8. QScriptEngine engine;
  9. QScriptValue sv = engine.evaluate("value = " + this->json);
  10. QScriptValueIterator it(sv);
  11. this->rsCount = 0;
  12. if(json.isEmpty())
  13. {
  14. rtnCode = RTNCODE_NETWORK_NOTAVAILABLE;
  15. rtnMemo = RTNMEMO_NETWORK_NOTAVAILABLE;
  16. }
  17. else if(json=="ABORT")
  18. {
  19. rtnCode = RTNCODE_NETWORK_ABORT;
  20. rtnMemo = RTNMEMO_NETWORK_ABORT;
  21. }
  22. else
  23. {
  24. rtnCode = RTNCODE_INVALID_FORMAT;
  25. rtnMemo = RTNMEMO_INVALID_FORMAT;
  26. while (it.hasNext())
  27. {
  28. it.next();
  29. if(it.name()=="rtnCode")
  30. {
  31. this->rtnCode = it.value().toInt32();
  32. }
  33. else if(it.name()=="rtnMemo")
  34. {
  35. this->rtnMemo = it.value().toString();
  36. }
  37. else if(it.name()=="rsCount")
  38. {
  39. this->rsCount = it.value().toInt32();
  40. }
  41. else
  42. {
  43. QScriptValue sv1 = it.value();
  44. map.insert("serialnum",sv1.property("serialnum").toString());
  45. map.insert("ltfid",sv1.property("ltfid").toString());
  46. map.insert("uqrycode",sv1.property("uqrycode").toString());
  47. map.insert("detail",sv1.property("detail").toString());
  48. map.insert("batchsrc",sv1.property("batchsrc").toString());
  49. map.insert("batchid",sv1.property("batchid").toString());
  50. map.insert("ltf_tj",sv1.property("ltf_tj").toString());
  51. map.insert("ltf_list",sv1.property("ltf_list").toString());
  52. map.insert("forecast_tj",sv1.property("forecast_tj").toString());
  53. map.insert("forecast_list",sv1.property("forecast_list").toString());
  54. map.insert("hmzs",sv1.property("hmzs").toString());
  55. map.insert("inserttime",sv1.property("inserttime").toString());
  56. map.insert("finishtime",sv1.property("finishtime").toString());
  57. map.insert("dealstatus",sv1.property("dealstatus").toString());
  58. }
  59. }
  60. }
  61. }
  62. int RespGetJSJCinfo::getRtnCode()
  63. {
  64. return this->rtnCode;
  65. }
  66. QString RespGetJSJCinfo::getRtnMemo()
  67. {
  68. return this->rtnMemo;
  69. }
  70. int RespGetJSJCinfo::getRsCount()
  71. {
  72. return this->rsCount;
  73. }
  74. QMultiMap<QString,QString> RespGetJSJCinfo::getRs()
  75. {
  76. return this->map;
  77. }