ResultUploader.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #pragma once
  2. #include "ResultHandler.h"
  3. #include "..\sqlite\CppSQLite3.h"
  4. #include "DataBaseHolder.h"
  5. #include "DataBaseManagerHolder.h"
  6. /************************************************************************/
  7. /* 成绩上传服务 */
  8. /* 2014年12月9日16:04:06 */
  9. /* 作者:唐林 */
  10. /************************************************************************/
  11. class CResultUploader:public IService,public CDataBaseHolder,public CDataBaseManagerHolder
  12. {
  13. public:
  14. CResultUploader(void);
  15. ~CResultUploader(void);
  16. void SetResultHandler(CResultHandler * m_result_hadler);
  17. void SetResultHandler(boost::shared_ptr<CResultHandler> pPtr);
  18. int SetHandlerWnd(HWND hwnd);
  19. void SetBatchCode(const CString&strBatchCode){ m_batch_code = strBatchCode; }
  20. CString MarkHttpHeaderData();
  21. protected:
  22. virtual ServiceState OnStarting(void);
  23. virtual ServiceState OnRunning(void);
  24. virtual ServiceState OnStoping(void);
  25. private:
  26. CResultHandler * m_result_hadler;
  27. boost::weak_ptr<CResultHandler> m_pWeakResult;
  28. HWND m_hwnd;
  29. CString url_str;
  30. int m_total;
  31. int m_current_count;
  32. int m_sccuss_count;
  33. int last_student_paper_id;
  34. BOOL m_failtrue;
  35. CppSQLite3DB upload_database_db;
  36. bool m_bOnlineCard;
  37. int m_nSubjectID;
  38. int m_nOnlineScanType;
  39. bool m_bErrorHandle;
  40. CString m_batch_code;
  41. bool m_bUploadOnScanModel;// 是否是边扫描边上传模式
  42. std::map<int,bool> m_vctUploadOnScanPapers;//待上传的paperid
  43. CRITICAL_SECTION m_csUploadOnScanPapers;
  44. public:
  45. string m_strMsg;
  46. // 因之前服务器容量有限,需要换个服务器
  47. CString m_strNewUploadUrl;
  48. void readNewUploadUrl();
  49. int m_nCourseId;
  50. int readCourseId();
  51. void logForDbg(string strLog);
  52. void getupLoadUrl(char *strUrl, int &len);
  53. void EnableOnLineCard(bool bEnable, int nSubjectID, int nOnlineScanType){ m_bOnlineCard = bEnable; m_nSubjectID = nSubjectID; m_nOnlineScanType = nOnlineScanType; };
  54. void SetErrorHandle(bool bErrorHandl){ m_bErrorHandle = bErrorHandl; };
  55. void SetUploadOnScan(bool bUploadOnScan, int student_paper_id,bool bErrorPaper);
  56. std::string get_ucloud_key(const std::string&eid);
  57. std::string bucket_name;
  58. };