浏览代码

git-svn-id: file:///srv/xfl/svn/SVN/wzx/SpeedNumCube@19059 2e29f1fe-100b-dc43-ad61-23effca57775

wzx 7 年之前
父节点
当前提交
d7ea122c41
共有 76 个文件被更改,包括 9058 次插入13 次删除
  1. 381 2
      sncprojects/lib/SNCDataBase/sncdatabase.cpp
  2. 21 7
      sncprojects/lib/SNCDataBase/sncdatabase.h
  3. 17 4
      sncprojects/lib/SNCMain/mainwindow.cpp
  4. 2 0
      sncprojects/lib/SNCMain/mainwindow.h
  5. 2 0
      sncprojects/lib/SNCMain/sncmain.pro
  6. 79 0
      sncprojects/lib/SNCWool/SNCWool.pro
  7. 12 0
      sncprojects/lib/SNCWool/SNCWool_global.h
  8. 165 0
      sncprojects/lib/SNCWool/autosyncdata.cpp
  9. 45 0
      sncprojects/lib/SNCWool/autosyncdata.h
  10. 241 0
      sncprojects/lib/SNCWool/autouploadfile.cpp
  11. 42 0
      sncprojects/lib/SNCWool/autouploadfile.h
  12. 42 0
      sncprojects/lib/SNCWool/dialogsubmit.cpp
  13. 29 0
      sncprojects/lib/SNCWool/dialogsubmit.h
  14. 38 0
      sncprojects/lib/SNCWool/dialogsubmit.ui
  15. 102 0
      sncprojects/lib/SNCWool/dialogsubmitresponsedetail.cpp
  16. 24 0
      sncprojects/lib/SNCWool/dialogsubmitresponsedetail.h
  17. 179 0
      sncprojects/lib/SNCWool/dialogsubmitresponsedetail.ui
  18. 309 0
      sncprojects/lib/SNCWool/formaccountinfo.cpp
  19. 61 0
      sncprojects/lib/SNCWool/formaccountinfo.h
  20. 331 0
      sncprojects/lib/SNCWool/formaccountinfo.ui
  21. 79 0
      sncprojects/lib/SNCWool/formad.cpp
  22. 34 0
      sncprojects/lib/SNCWool/formad.h
  23. 27 0
      sncprojects/lib/SNCWool/formad.ui
  24. 247 0
      sncprojects/lib/SNCWool/formupload.cpp
  25. 41 0
      sncprojects/lib/SNCWool/formupload.h
  26. 210 0
      sncprojects/lib/SNCWool/formupload.ui
  27. 208 0
      sncprojects/lib/SNCWool/formwool.cpp
  28. 69 0
      sncprojects/lib/SNCWool/formwool.h
  29. 104 0
      sncprojects/lib/SNCWool/formwool.ui
  30. 352 0
      sncprojects/lib/SNCWool/formwoolcharge.cpp
  31. 60 0
      sncprojects/lib/SNCWool/formwoolcharge.h
  32. 75 0
      sncprojects/lib/SNCWool/formwoolcharge.ui
  33. 542 0
      sncprojects/lib/SNCWool/formwooldealing.cpp
  34. 60 0
      sncprojects/lib/SNCWool/formwooldealing.h
  35. 37 0
      sncprojects/lib/SNCWool/formwooldealing.ui
  36. 358 0
      sncprojects/lib/SNCWool/formwoolfee.cpp
  37. 61 0
      sncprojects/lib/SNCWool/formwoolfee.h
  38. 75 0
      sncprojects/lib/SNCWool/formwoolfee.ui
  39. 909 0
      sncprojects/lib/SNCWool/formwoolfinished.cpp
  40. 86 0
      sncprojects/lib/SNCWool/formwoolfinished.h
  41. 873 0
      sncprojects/lib/SNCWool/formwoolfinished.ui
  42. 521 0
      sncprojects/lib/SNCWool/formwoolupload.cpp
  43. 63 0
      sncprojects/lib/SNCWool/formwoolupload.h
  44. 65 0
      sncprojects/lib/SNCWool/formwoolupload.ui
  45. 6 0
      sncprojects/lib/SNCWool/sncwool.cpp
  46. 12 0
      sncprojects/lib/SNCWool/sncwool.h
  47. 43 0
      sncprojects/lib/SNCWool/xprogressbar.cpp
  48. 23 0
      sncprojects/lib/SNCWool/xprogressbar.h
  49. 53 0
      sncprojects/lib/WSWool/WSWool.pro
  50. 19 0
      sncprojects/lib/WSWool/WSWool_global.h
  51. 48 0
      sncprojects/lib/WSWool/respchkuserfeestatus.cpp
  52. 18 0
      sncprojects/lib/WSWool/respchkuserfeestatus.h
  53. 72 0
      sncprojects/lib/WSWool/respdlresultfile.cpp
  54. 24 0
      sncprojects/lib/WSWool/respdlresultfile.h
  55. 80 0
      sncprojects/lib/WSWool/respgetchargeinfo.cpp
  56. 22 0
      sncprojects/lib/WSWool/respgetchargeinfo.h
  57. 79 0
      sncprojects/lib/WSWool/respgetcostinfo.cpp
  58. 23 0
      sncprojects/lib/WSWool/respgetcostinfo.h
  59. 82 0
      sncprojects/lib/WSWool/respgetdealinfo.cpp
  60. 23 0
      sncprojects/lib/WSWool/respgetdealinfo.h
  61. 80 0
      sncprojects/lib/WSWool/respgetfinishedinfo.cpp
  62. 22 0
      sncprojects/lib/WSWool/respgetfinishedinfo.h
  63. 71 0
      sncprojects/lib/WSWool/respgetsysparam.cpp
  64. 22 0
      sncprojects/lib/WSWool/respgetsysparam.h
  65. 82 0
      sncprojects/lib/WSWool/respgetuserblance.cpp
  66. 26 0
      sncprojects/lib/WSWool/respgetuserblance.h
  67. 55 0
      sncprojects/lib/WSWool/resppackmerge.cpp
  68. 20 0
      sncprojects/lib/WSWool/resppackmerge.h
  69. 47 0
      sncprojects/lib/WSWool/resppacktran.cpp
  70. 18 0
      sncprojects/lib/WSWool/resppacktran.h
  71. 72 0
      sncprojects/lib/WSWool/respsubminpnum.cpp
  72. 26 0
      sncprojects/lib/WSWool/respsubminpnum.h
  73. 292 0
      sncprojects/lib/WSWool/wool.cpp
  74. 80 0
      sncprojects/lib/WSWool/wool.h
  75. 186 0
      sncprojects/lib/WSWool/wswool.cpp
  76. 54 0
      sncprojects/lib/WSWool/wswool.h

+ 381 - 2
sncprojects/lib/SNCDataBase/sncdatabase.cpp

@@ -20,6 +20,7 @@ bool SNCDataBase::createConnection(QString password, QString path)
         qDebug()<<"DB Open Error;"<<db.lastError();
         return false;
     }
+
     QSqlQuery query;
     query.exec(QString("ATTACH DATABASE 'mseg.db' AS num"));
     query.exec(QString("ATTACH DATABASE 'sys.db' AS sys"));
@@ -33,16 +34,19 @@ bool SNCDataBase::createConnection(QString password, QString path)
     {
         return false;
     }
+
     query.exec("select name from num.sqlite_master where type='table' and name='MSEG'");
     if(!query.next())
     {
         return false;
     }
+
     query.exec("select name from user.sqlite_master where type='table' and name='NUMBER_RULES_USER'");
     if(!query.next())
     {
         return false;
     }
+
     query.exec("select name from user.sqlite_master where type='table' and name='FILE_UPLOAD'");
     if(!query.next())
     {
@@ -55,6 +59,7 @@ bool SNCDataBase::createConnection(QString password, QString path)
                    RTN_MSG VARCHAR(1000),RTN_DETAIL TEXT\
                    )");
     }
+
     query.exec("select name from user.sqlite_master where type='table' and name='SHKJ_CHECK'");
     if(!query.next())
     {
@@ -65,6 +70,7 @@ bool SNCDataBase::createConnection(QString password, QString path)
                    DEAL_STATUS CHAR(1),CACHE_LOCAL_PATH VARCHAR(1000)\
                    )");
     }
+
     //query.exec("drop table USER.SHXZ_SHKJ");
     query.exec("select name from user.sqlite_master where type='table' and name='SHXZ_SHKJ'");
     if(!query.next())
@@ -76,6 +82,7 @@ bool SNCDataBase::createConnection(QString password, QString path)
                    DEAL_STATUS CHAR(1),CACHE_LOCAL_PATH VARCHAR(1000),MEMO VARCHAR(1000),ISDEL CHAR(1)\
                    )");
     }
+
     query.exec("select name from user.sqlite_master where type='table' and name='USER_LOGON'");
     if(!query.next())
     {
@@ -84,6 +91,7 @@ bool SNCDataBase::createConnection(QString password, QString path)
                    ISAUTO CHAR(1),ISREMEMBER CHAR(1),LAST_LOGIN_TIME VARCHAR(100)\
                    )");
     }
+
     query.exec("select name from user.sqlite_master where type='table' and name='BZJC_CHECK_DEALING'");
     if(!query.next())
     {
@@ -94,6 +102,7 @@ bool SNCDataBase::createConnection(QString password, QString path)
                    NUM_COUNT INTEGER,DOWNLOAD_COUNT INTEGER,FINISH_COUNT INTEGER, OPT_STATUS CHAR(1)\
                    )");
     }
+
     query.exec("select name from user.sqlite_master where type='table' and name='BZJC_CHECK_FINISHED'");
     if(!query.next())
     {
@@ -129,6 +138,7 @@ bool SNCDataBase::createConnection(QString password, QString path)
                    DEALSTATUS CHAR(1),\
                    ISDEL CHAR(1))");
     }
+
     //query.exec("drop table USER.SHKJ_ZXSH_TASK_PACKNO");
     query.exec("select name from user.sqlite_master where type='table' and name='SHKJ_ZXSH_TASK_PACKNO'");
     if(!query.next())
@@ -141,6 +151,7 @@ bool SNCDataBase::createConnection(QString password, QString path)
                    INSERTTIME VARCHAR(100),\
                    USERCODE VARCHAR(100))");
     }
+
 //    query.exec("select name from user.sqlite_master where type='table' and name='SHKJ_ZXSH_TASK_SERVER'");
 //    if(!query.next())
 //    {
@@ -151,6 +162,49 @@ bool SNCDataBase::createConnection(QString password, QString path)
 //    }
 //    query.exec("insert into user.shkj_zxsh_task (ssid,optime,uptime,user_code,province,city,isp,dlnum,deal_status,isdel)\
 //               values('ssid','2014-12-21 13:13:13',7,'xxw','ɽ¶«','¼ÃÄÏ','1',130,'1','N')");
+
+
+    //query.exec("drop table USER.WOOL_CHECK_DEALING");
+    query.exec("select name from user.sqlite_master where type='table' and name='WOOL_CHECK_DEALING'");
+    if(!query.next())
+    {
+        query.exec("CREATE TABLE USER.WOOL_CHECK_DEALING( \
+                   TASKID VARCHAR(100) PRIMARY KEY, \
+                   USERCODE VARCHAR(100), \
+                   HMZS INTEGER, \
+                   FEE_COUNT INTEGER, \
+                   CREATE_TIME VARCHAR(100), \
+                   STATE VARCHAR(10), \
+                   STATESTR VARCHAR(100), \
+                   SETTLEFEE NUMERIC, \
+                   GIFTFEE NUMERIC, \
+                   MEMO VARCHAR(100) \
+                   )");
+    }
+
+    //query.exec("drop table USER.WOOL_CHECK_FINISHED");
+    query.exec("select name from user.sqlite_master where type='table' and name='WOOL_CHECK_FINISHED'");
+    if(!query.next())
+    {
+        query.exec("CREATE TABLE USER.WOOL_CHECK_FINISHED(\
+                   TASKID VARCHAR(100) PRIMARY KEY, \
+                   USERCODE VARCHAR(100), \
+                   HMZS INTEGER, \
+                   ZCSL INTEGER, \
+                   YCSL INTEGER, \
+                   WZSL INTEGER, \
+                   FEE_COUNT INTEGER, \
+                   CREATE_TIME VARCHAR(100), \
+                   FINISH_TIME VARCHAR(100), \
+                   STATE VARCHAR(10), \
+                   STATESTR VARCHAR(100), \
+                   SETTLEFEE NUMERIC, \
+                   GIFTFEE NUMERIC, \
+                   MEMO VARCHAR(100), \
+                   CACHE_LOCAL_PATH VARCHAR(1000) \
+                   )");
+    }
+
     return true;
 }
 
@@ -2494,7 +2548,6 @@ int SNCDataBase::updateBzjcCheckDealInfos(QMultiMap<QString, QString> maps, QStr
         query.exec();
     }
 
-
     QSqlDatabase::database().commit();
     return 0;
 }
@@ -2757,6 +2810,331 @@ int SNCDataBase::deleteBzjcFinishExceptSrvIDs(QString clientID, QString userCode
     QSqlDatabase::database().commit();
     return 0;
 }
+
+
+
+///////////////////////////////////////////
+
+int SNCDataBase::updateWoolCheckDealInfos(QMultiMap<QString, QString> maps, QString userCode, QString clientID)
+{
+    QSqlQuery query;
+    QSqlDatabase::database().transaction();
+    int cols = maps.uniqueKeys().size();
+    int rows = 0;
+    if(cols!=0)
+    {
+        rows = maps.size()/cols;
+    }
+    query.clear();
+    query.exec("delete  from  user.bzjc_check_dealing where client_id = '" + clientID+ "'");
+    for(int i=0;i<rows;i++)
+    {
+        QString batchid = maps.values("batchid").at(i);
+        QString batchtype = maps.values("batchtype").at(i);
+        QString detail = maps.values("detail").at(i);
+        QString resulttj = maps.values("resulttj").at(i);
+        QString submittime = maps.values("submittime").at(i);
+        QString tftime = maps.values("tftime").at(i);
+        QString vftime = maps.values("vftime").at(i);
+        QString isverify = maps.values("isverify").at(i);
+        QString settlefee = maps.values("settlefee").at(i);
+        QString giftfee = maps.values("giftfee").at(i);
+        int numcount = maps.values("numcount").at(i).toInt();
+        int dlcount = maps.values("dlcount").at(i).toInt();
+        int finishcount = maps.values("finishcount").at(i).toInt();
+        QString optstatus = maps.values("optstatus").at(i);
+
+        query.clear();
+        query.prepare("delete  from  user.file_upload where server_fid = ?");
+        query.addBindValue(batchid);
+        query.exec();
+
+        double percent = 0;
+        if(numcount!=0)
+            percent = finishcount * 100.0 / numcount;
+        query.clear();
+        query.prepare("insert into user.bzjc_check_dealing( \
+                      BATCH_ID ,BATCH_TYPE ,CLIENT_ID,USER_CODE ,\
+                      DETAIL ,RESULT_TJ ,SUBMIT_TIME,TF_TIME,\
+                      VF_TIME ,ISVERIFY,SETTLE_FEE,GIFT_FEE ,\
+                      NUM_COUNT ,DOWNLOAD_COUNT ,FINISH_COUNT , OPT_STATUS) \
+                      VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
+        QVariantList vars;
+        vars<<batchid<<batchtype<<clientID<<userCode<<detail<<resulttj<<submittime<<tftime<<vftime<<isverify;
+        vars<<settlefee<<giftfee<<numcount<<dlcount<<finishcount<<optstatus;
+        for(int i=0;i<vars.size();i++)
+        {
+            query.addBindValue(vars.at(i));
+        }
+        query.exec();
+    }
+
+    QSqlDatabase::database().commit();
+    return 0;
+}
+
+int SNCDataBase::updateWoolCheckFinishInfos(QMultiMap<QString, QString> maps, QString userCode, QString clientID)
+{
+    QSqlQuery query;
+    QSqlDatabase::database().transaction();
+    int cols = maps.uniqueKeys().size();
+    int rows = 0;
+    if(cols!=0)
+    {
+        rows = maps.size()/cols;
+    }
+    for(int i=0;i<rows;i++)
+    {
+        QString batchid = maps.values("batchid").at(i);
+        QString batchtype = maps.values("batchtype").at(i);
+        QString detail = maps.values("detail").at(i);
+        QString resulttj = maps.values("resulttj").at(i);
+        QString submittime = maps.values("submittime").at(i);
+        QString finishtime = maps.values("finishtime").at(i);
+        QString settlefee = maps.values("settlefee").at(i);
+        QString giftfee = maps.values("giftfee").at(i);
+        QString numcount = maps.values("numcount").at(i);
+        QString dlcount = maps.values("dlcount").at(i);
+        QString finishcount = maps.values("finishcount").at(i);
+        QString optstatus = maps.values("optstatus").at(i);
+        QString ispass = maps.values("ispass").at(i);
+        QString isdeliver = maps.values("isdeliver").at(i);
+        QString delivertime = maps.values("delivertime").at(i);
+
+//        query.clear();
+//        query.prepare("delete  from  user.file_upload where server_fid = ?");
+//        query.addBindValue(batchid);
+//        query.exec();
+
+        query.clear();
+        query.prepare("select CACHE_LOCAL_PATH  from  user.bzjc_check_finished where BATCH_ID = ?");
+        query.addBindValue(batchid);
+        query.exec();
+
+        if(query.next())
+        {
+            if(!query.value(0).toString().isEmpty())
+                continue;
+        }
+        query.clear();
+        query.prepare("delete  from  user.bzjc_check_finished where BATCH_ID = ?");
+        query.addBindValue(batchid);
+        query.exec();
+        query.clear();
+        query.prepare("insert into user.bzjc_check_finished( \
+                      BATCH_ID ,BATCH_TYPE ,CLIENT_ID,USER_CODE ,\
+                      DETAIL ,RESULT_TJ ,SUBMIT_TIME,FINISH_TIME,\
+                      SETTLE_FEE,GIFT_FEE ,\
+                      NUM_COUNT ,DOWNLOAD_COUNT ,FINISH_COUNT , OPT_STATUS,\
+                      ISPASS,ISDELIVER,DELIVER_TIME) \
+                      VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
+        QVariantList vars;
+        vars<<batchid<<batchtype<<clientID<<userCode<<detail<<resulttj<<submittime<<finishtime;
+        vars<<settlefee<<giftfee<<numcount<<dlcount<<finishcount<<optstatus<<ispass<<isdeliver<<delivertime;
+        for(int i=0;i<vars.size();i++)
+        {
+            query.addBindValue(vars.at(i));
+        }
+        query.exec();
+    }
+    QSqlDatabase::database().commit();
+    return 0;
+}
+
+QMultiMap<QString, QString> SNCDataBase::getWoolCheckFinishInfos(QString userCode, QString clientID, QString isdeliver)
+{
+    QMultiMap<QString ,QString> values;
+    QSqlQuery query;
+    QVariantList vars;
+    if(isdeliver.isEmpty())
+    {
+        query.prepare("select BATCH_ID ,BATCH_TYPE ,\
+                      DETAIL ,RESULT_TJ ,SUBMIT_TIME,FINISH_TIME,\
+                      SETTLE_FEE,GIFT_FEE ,\
+                      NUM_COUNT ,DOWNLOAD_COUNT ,FINISH_COUNT , OPT_STATUS,\
+                      ISPASS,ISDELIVER,DELIVER_TIME \
+                      from user.bzjc_check_finished where user_code=? and client_id = ? ");
+        vars<<userCode<<clientID;
+    }
+    else
+    {
+        query.prepare("select BATCH_ID ,BATCH_TYPE ,\
+                      DETAIL ,RESULT_TJ ,SUBMIT_TIME,FINISH_TIME,\
+                      SETTLE_FEE,GIFT_FEE ,\
+                      NUM_COUNT ,DOWNLOAD_COUNT ,FINISH_COUNT , OPT_STATUS,\
+                      ISPASS,ISDELIVER,DELIVER_TIME \
+                      from user.bzjc_check_finished where user_code=? and client_id = ?  and isdeliver = ?");
+        vars<<userCode<<clientID<<isdeliver;
+    }
+    for(int i=0;i<vars.size();i++)
+    {
+        query.addBindValue(vars.at(i));
+    }
+    query.exec();
+    while(query.next())
+    {
+        int i=0;
+        values.insert("batchid",query.value(i++).toString());
+        values.insert("batchtype",query.value(i++).toString());
+        values.insert("detail",query.value(i++).toString());
+        values.insert("resulttj",query.value(i++).toString());
+        values.insert("submittime",query.value(i++).toString());
+        values.insert("finishtime",query.value(i++).toString());
+        values.insert("settlefee",query.value(i++).toString());
+        values.insert("giftfee",query.value(i++).toString());
+        values.insert("numcount",query.value(i++).toString());
+        values.insert("dlcount",query.value(i++).toString());
+        values.insert("finishcount",query.value(i++).toString());
+        values.insert("optstatus",query.value(i++).toString());
+        values.insert("ispass",query.value(i++).toString());
+        values.insert("isdeliver",query.value(i++).toString());
+        values.insert("delivertime",query.value(i++).toString());
+    }
+    return values;
+}
+
+QMultiMap<QString, QString> SNCDataBase::getWoolCheckDealingInfos(QString userCode, QString clientID)
+{
+    QMultiMap<QString ,QString> values;
+    QSqlQuery query;
+    QVariantList vars;
+    query.prepare("select BATCH_ID ,BATCH_TYPE ,\
+                  DETAIL ,RESULT_TJ ,SUBMIT_TIME,\
+                  SETTLE_FEE,GIFT_FEE ,\
+                  NUM_COUNT ,DOWNLOAD_COUNT ,FINISH_COUNT , OPT_STATUS,isverify,tf_time \
+                  from user.BZJC_CHECK_DEALING where user_code=? and client_id = ? ");
+    vars<<userCode<<clientID;
+    for(int i=0;i<vars.size();i++)
+    {
+        query.addBindValue(vars.at(i));
+    }
+    query.exec();
+    while(query.next())
+    {
+        int i=0;
+        values.insert("batchid",query.value(i++).toString());
+        values.insert("batchtype",query.value(i++).toString());
+        values.insert("detail",query.value(i++).toString());
+        values.insert("resulttj",query.value(i++).toString());
+        values.insert("submittime",query.value(i++).toString());
+        values.insert("settlefee",query.value(i++).toString());
+        values.insert("giftfee",query.value(i++).toString());
+        values.insert("numcount",query.value(i++).toString());
+        values.insert("dlcount",query.value(i++).toString());
+        values.insert("finishcount",query.value(i++).toString());
+        values.insert("optstatus",query.value(i++).toString());
+        values.insert("isverify",query.value(i++).toString());
+        values.insert("tftime",query.value(i++).toString());
+    }
+    return values;
+}
+
+int SNCDataBase::getWoolToDown(QString userCode, QString clientID)
+{
+    QSqlQuery query;
+    query.prepare("select count(*) from user.bzjc_check_finished where user_code=?  and client_id = ? and isdeliver='0'");
+    QVariantList vars;
+    vars<<userCode<<clientID;
+    for(int i=0;i<vars.size();i++)
+    {
+        query.addBindValue(vars.at(i));
+    }
+    query.exec();
+    int value = 0;
+    if(query.next())
+    {
+        value = query.value(0).toInt();
+    }
+    return value;
+}
+
+int SNCDataBase::delWoolByID(QString srvID)
+{
+    QSqlDatabase::database().transaction();
+    QSqlQuery query;
+    query.prepare("delete from user.BZJC_CHECK_FINISHED  where batch_ID=? ");
+    QVariantList vars;
+    vars<<srvID;
+    for(int i=0;i<vars.size();i++)
+    {
+        query.addBindValue(vars.at(i));
+    }
+    query.exec();
+    QSqlDatabase::database().commit();
+
+    return 0;
+}
+
+int SNCDataBase::updateWoolCachePath(QString srvID, QString cachePath)
+{
+    QSqlDatabase::database().transaction();
+    QSqlQuery query;
+    query.prepare("update user.BZJC_CHECK_FINISHED set CACHE_LOCAL_PATH = ?,ISDELIVER='1'  where batch_ID=? ");
+    QVariantList vars;
+    vars<<cachePath<<srvID;
+    for(int i=0;i<vars.size();i++)
+    {
+        query.addBindValue(vars.at(i));
+    }
+    query.exec();
+    QSqlDatabase::database().commit();
+
+    return 0;
+}
+
+QString SNCDataBase::getWoolCachePath(QString srvID)
+{
+    QSqlQuery query;
+    query.prepare("select CACHE_LOCAL_PATH from user.BZJC_CHECK_FINISHED where batch_ID=? ");
+    QVariantList vars;
+    vars<<srvID;
+    for(int i=0;i<vars.size();i++)
+    {
+        query.addBindValue(vars.at(i));
+    }
+    query.exec();
+    QString value = "";
+    if(query.next())
+    {
+        value = query.value(0).toString();
+    }
+    return value;
+}
+
+int SNCDataBase::deleteWoolFinishExceptSrvIDs(QString clientID, QString userCode, QStringList ids)
+{
+    QString where;
+    for(int i=0;i<ids.size();i++)
+    {
+        if(i==ids.size()-1)
+            where += QString("'%1'").arg(ids.at(i));
+        else
+            where += QString("'%1',").arg(ids.at(i));
+    }
+    if(where.isEmpty())
+    {
+        where = " where client_id = ? and user_code = ?  ";
+    }
+    else
+    {
+        where = " where client_id = ? and user_code = ?  and \
+                BATCH_ID not in (" + where + ")";
+    }
+
+    QString sql = " delete from BZJC_CHECK_FINISHED " + where;
+    QSqlQuery query;
+    QSqlDatabase::database().transaction();
+    query.prepare(sql);
+    query.addBindValue(clientID);
+    query.addBindValue(userCode);
+    query.exec();
+    QSqlDatabase::database().commit();
+    return 0;
+}
+///////////////////////////////////////////
+
+
+
 QMultiMap<QString, QString> SNCDataBase::getSegRecInfos()
 {
     QMultiMap<QString ,QString> values;
@@ -2780,6 +3158,7 @@ QMultiMap<QString, QString> SNCDataBase::getSegRecInfos()
 
     return values;
 }
+
 QMultiMap<QString, QString> SNCDataBase::getSegRecInfosByCity(QString city)
 {
     QMultiMap<QString ,QString> values;
@@ -2807,6 +3186,7 @@ QMultiMap<QString, QString> SNCDataBase::getSegRecInfosByCity(QString city)
 
     return values;
 }
+
 QStringList SNCDataBase::getSegAreaCodes()
 {
     QStringList values;
@@ -2835,7 +3215,6 @@ QStringList SNCDataBase::getRecSegs()
     return values;
 }
 
-
 QMultiMap<QString, QString> SNCDataBase::getSegRecInfosByProvince(QString province)
 {
     QMultiMap<QString ,QString> values;

+ 21 - 7
sncprojects/lib/SNCDataBase/sncdatabase.h

@@ -128,6 +128,7 @@ public:
     static int deleteFileByFileID(int fileID);
     static QMultiMap<QString,QString> getAllUpload(QString moduleID,QString clientID,QString userCode);
     static int updateFileUploadOutdateDataBySrvIDs(QString moduleID,QString clientID,QString userCode,QStringList ids);
+
     //实号快检模块所需要的数据库访问接口
     static int updateShkjCheckInfos(QMultiMap<QString,QString> maps,QString userCode);
         //add-on-2014-11-08 for sync zxsh-task
@@ -142,6 +143,7 @@ public:
     static QMultiMap<QString,QString> getShkjZxshTasksByUser(QString userCode);
     static int addShkjZxshTask(QString ssid, QString userCode, QString province,QString city,
                                QString inserttime,QString updatedays, QString isp, QString seg, int neednum);
+
     //自动登录所需要的数据库访问接口
     static int updateLoginInfo(QString userCode,QString password,QString isAuto,QString isRemember,QString lastLoginTime);
     static QMultiMap<QString,QString> getDefaultLoginInfo();
@@ -155,13 +157,25 @@ public:
     static int delBzjcByID(QString srvID);
     static int updateBzjcCachePath(QString srvID,QString cachePath);
     static QString getBzjcCachePath(QString srvID);
-     static int deleteBzjcFinishExceptSrvIDs(QString clientID,QString userCode,QStringList ids);
-     //号码推荐获取检测接口
-      static QMultiMap<QString,QString> getSegRecInfos();
-      static QMultiMap<QString,QString> getSegRecInfosByCity(QString city);
-      static QMultiMap<QString,QString> getSegRecInfosByProvince(QString province);
-      static QStringList getSegAreaCodes();
-      static QStringList getRecSegs();
+    static int deleteBzjcFinishExceptSrvIDs(QString clientID,QString userCode,QStringList ids);
+
+    //防薅羊毛检测模块所需要的数据库访问接口
+    static int updateWoolCheckDealInfos(QMultiMap<QString,QString> maps,QString userCode,QString clientID);
+    static int updateWoolCheckFinishInfos(QMultiMap<QString,QString> maps,QString userCode,QString clientID);
+    static QMultiMap<QString,QString> getWoolCheckFinishInfos(QString userCode,QString clientID,QString isdeliver);
+    static QMultiMap<QString,QString> getWoolCheckDealingInfos(QString userCode,QString clientID);
+    static int getWoolToDown(QString userCode,QString clientID);
+    static int delWoolByID(QString srvID);
+    static int updateWoolCachePath(QString srvID,QString cachePath);
+    static QString getWoolCachePath(QString srvID);
+    static int deleteWoolFinishExceptSrvIDs(QString clientID,QString userCode,QStringList ids);
+
+    //号码推荐获取检测接口
+    static QMultiMap<QString,QString> getSegRecInfos();
+    static QMultiMap<QString,QString> getSegRecInfosByCity(QString city);
+    static QMultiMap<QString,QString> getSegRecInfosByProvince(QString province);
+    static QStringList getSegAreaCodes();
+    static QStringList getRecSegs();
 };
 
 #endif // SNCDATABASE_H

+ 17 - 4
sncprojects/lib/SNCMain/mainwindow.cpp

@@ -64,6 +64,9 @@ void MainWindow::initVariables()
     connect(m_formMINGYUAN,SIGNAL(buttonLoginClick()),this,SLOT(onPushButtonLoginClick()));
     m_formMINGYUAN->setClientID("mykh");
 
+    m_formWool = new FormWool();
+    connect(m_formWool,SIGNAL(buttonLoginClick()),this,SLOT(onPushButtonLoginClick()));
+
     m_labelAppVersion = new QLabel("  主程序版本:"+SNCDataBase::getAppVersion2()+"  ");
     m_labelSegVersion = new ClickLabel();
     m_labelSegVersion->setText("  号段版本:正在检查更新...");
@@ -76,10 +79,10 @@ void MainWindow::initVariables()
     m_buttonGroup = new QButtonGroup();
 
     QStringList btnNames;
-    btnNames<<"号码魔方"<<"实号快检"<<"实号快‘拣’"<<"智能号码检测"<<"关于";
+    btnNames<<"号码魔方"<<"实号快检"<<"实号快‘拣’"<<"智能号码检测"<<"防薅羊毛检测"<<"关于";
     QStringList btnIcons;
     btnIcons<<":/snc.png"<<":/riddle.png"<<":/zxsh.png"
-           <<":/shunshi.png"<<":/about.png";
+           <<":/shunshi.png"<<":/wool.png"<<":/about.png";
     for(int i=0;i<btnNames.size();i++)
     {
         QToolButton *button = new QToolButton();
@@ -92,7 +95,7 @@ void MainWindow::initVariables()
         ui->toolBar->addWidget(button);
         connect(button,SIGNAL(clicked()),this,SLOT(onToolButtonClick()));
         m_toolButtons.append(button);
-        if(i<=4)
+        if(i<=5)
             m_buttonGroup->addButton(button);
     }
     m_pushButtonLogin = new QPushButton("登录");
@@ -131,6 +134,7 @@ void MainWindow::initUI()
     ui->verticalLayout->addWidget(m_formMINGYUAN);
     ui->verticalLayout->addWidget(m_formZxsh);
     ui->verticalLayout->addWidget(m_formRiddle);
+    ui->verticalLayout->addWidget(m_formWool);
     ui->verticalLayout->setSpacing(0);
 
     ui->statusBar->setLayoutDirection(Qt::RightToLeft);
@@ -172,6 +176,7 @@ void MainWindow::initUI()
     m_formMINGYUAN->hide();
     m_formRiddle->hide();
     m_formZxsh->hide();
+    m_formWool->hide();
     m_toolButtons[0]->setChecked(true);
 }
 MainWindow::~MainWindow()
@@ -201,6 +206,7 @@ void MainWindow::logout()
     m_formZxsh->setAccountInfo(nothing);
     m_formSHUNSHI->setAccountInfo(nothing);
     m_formMINGYUAN->setAccountInfo(nothing);
+    m_formWool->setAccountInfo(nothing);
     WSSSO sso;
     QString src = "mf-" +  SNCDataBase::getAppVersion();
     qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
@@ -262,6 +268,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
     delete m_formMINGYUAN;
     delete m_formRiddle;
     delete m_formZxsh;
+    delete m_formWool;
     delete m_buttonGroup;
     for(int i=0;i<m_toolButtons.size();i++)
     {
@@ -323,6 +330,7 @@ void MainWindow::onSSOLoginSucceed(QMap<QString, QString> info)
     m_ssoManage->start();
     m_formRiddle->setAccountInfo(m_accountInfo);
     m_formZxsh->setAccountInfo(m_accountInfo);
+    m_formWool->setAccountInfo(m_accountInfo);
 }
 
 void MainWindow::onAutoLoginOK(QMap<QString,QString> accountInfo)
@@ -383,6 +391,8 @@ void MainWindow::onToolButtonClick()
         m_formMINGYUAN->hide();
         m_formRiddle->hide();
         m_formZxsh->hide();
+        m_formWool->hide();
+
         if(name=="号码魔方")
         {
             m_formCube->show();
@@ -402,8 +412,11 @@ void MainWindow::onToolButtonClick()
                 m_formSHUNSHI->show();
             else
                 m_formMINGYUAN->show();
+        }       
+        else if(name=="防薅羊毛检测")
+        {
+            m_formWool->show();
         }
-
     }
 }
 

+ 2 - 0
sncprojects/lib/SNCMain/mainwindow.h

@@ -6,6 +6,7 @@
 #include "formnumcheck.h"
 #include "formriddle.h"
 #include "formzxsh.h"
+#include "formwool.h"
 #include "dialogupdateseg.h"
 #include "clicklabel.h"
 #include "snctimer.h"
@@ -54,6 +55,7 @@ private:
     FormNumCheck *m_formMINGYUAN;
     FormRiddle *m_formRiddle;
     FormZxsh *m_formZxsh;
+    FormWool *m_formWool;
 
     DialogUpdateSeg *m_dialogUpdate;
 

+ 2 - 0
sncprojects/lib/SNCMain/sncmain.pro

@@ -19,6 +19,7 @@ INCLUDEPATH +=../SNCCube
 INCLUDEPATH +=../SNCNumCheck
 INCLUDEPATH +=../SNCRiddle
 INCLUDEPATH +=../SNCzxsh
+INCLUDEPATH +=../SNCWool
 INCLUDEPATH +=../SNCZip
 DEFINES += SNCMAIN_LIBRARY
 LIBS += ../../output/sncdatabase.dll\
@@ -27,6 +28,7 @@ LIBS += ../../output/sncdatabase.dll\
         ../../output/sncnumcheck.dll\
         ../../output/sncriddle.dll\
         ../../output/snczxsh.dll\
+        ../../output/sncwool.dll\
         ../../output/wsnumchk.dll\
         ../../output/sncuser.dll\
         ../../output/wssso.dll\

+ 79 - 0
sncprojects/lib/SNCWool/SNCWool.pro

@@ -0,0 +1,79 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2019-07-12T16:18:26
+#
+#-------------------------------------------------
+
+QT       += gui script webkit
+TARGET = SNCWool
+TEMPLATE = lib
+DESTDIR = ../../output
+INCLUDEPATH +=../SNCDatabase
+INCLUDEPATH +=../SNCZip
+INCLUDEPATH +=../SNCCore
+INCLUDEPATH +=../WSSSO
+INCLUDEPATH +=../WSWOOL
+DEFINES += SNCWOOL_LIBRARY
+
+LIBS += ../../output/sncdatabase.dll\
+        ../../output/snczip.dll\
+        ../../output/snccore.dll\
+        ../../output/wsnumchk.dll\
+        ../../output/wssso.dll \
+        ../../output/wswool.dll
+
+SOURCES += sncwool.cpp \
+    autosyncdata.cpp \
+    autouploadfile.cpp \
+    dialogsubmit.cpp \
+    dialogsubmitresponsedetail.cpp \
+    formupload.cpp \
+    formwool.cpp \
+    formad.cpp \
+    formaccountinfo.cpp \
+    formwoolcharge.cpp \
+    formwooldealing.cpp \
+    formwoolfee.cpp \
+    formwoolfinished.cpp \
+    formwoolupload.cpp \
+    xprogressbar.cpp \
+
+HEADERS += sncwool.h\
+        SNCWool_global.h \
+    autosyncdata.h \
+    autouploadfile.h \
+    dialogsubmit.h \
+    dialogsubmitresponsedetail.h \
+    formupload.h \
+    formwool.h \
+    formad.h \
+    formaccountinfo.h \
+    formwoolcharge.h \
+    formwooldealing.h \
+    formwoolfee.h \
+    formwoolfinished.h \
+    formwoolupload.h \
+    xprogressbar.h \
+
+FORMS += \
+    dialogsubmit.ui \
+    dialogsubmitresponsedetail.ui \
+    formupload.ui \
+    formwool.ui \
+    formad.ui \
+    formaccountinfo.ui \
+    formwoolcharge.ui \
+    formwooldealing.ui \
+    formwoolfee.ui \
+    formwoolfinished.ui \
+    formwoolupload.ui \
+
+unix:!symbian {
+    maemo5 {
+        target.path = /opt/usr/lib
+    } else {
+        target.path = /usr/lib
+    }
+    INSTALLS += target
+}
+

+ 12 - 0
sncprojects/lib/SNCWool/SNCWool_global.h

@@ -0,0 +1,12 @@
+#ifndef SNCWOOL_GLOBAL_H
+#define SNCWOOL_GLOBAL_H
+
+#include <QtCore/qglobal.h>
+
+#if defined(SNCWOOL_LIBRARY)
+#  define SNCWOOLSHARED_EXPORT Q_DECL_EXPORT
+#else
+#  define SNCWOOLSHARED_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // SNCWOOL_GLOBAL_H

+ 165 - 0
sncprojects/lib/SNCWool/autosyncdata.cpp

@@ -0,0 +1,165 @@
+#include "autosyncdata.h"
+#include "respgetfinishedinfo.h"
+#include "respgetdealinfo.h"
+#include "sncdatabase.h"
+
+AutoSyncData::AutoSyncData()
+{
+    m_stop = false;
+    m_moduleID = "wool";
+    m_first = true;
+    m_skip = false;
+    m_wool = new WSWool();
+}
+
+AutoSyncData::~AutoSyncData()
+{
+    m_wool->abort();
+    delete m_wool;
+    qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
+           <<"FormWool.AutoSyncData Destroyed.";
+}
+
+void AutoSyncData::setSkip(bool skip)
+{
+    m_skip = skip;
+}
+
+void AutoSyncData::abort()
+{
+    m_stop = true;
+    m_wool->abort();
+}
+
+void AutoSyncData::run()
+{
+    if(m_skip)
+        return ;
+    m_stop = false;
+
+    sync();
+}
+
+void AutoSyncData::setClientID(QString clientID)
+{
+    m_clientID = clientID;
+}
+
+void AutoSyncData::setHost(QString host, QString port)
+{
+    m_host = host;
+    m_port = port;
+//    m_wool->setHost(m_host,m_port);
+}
+
+void AutoSyncData::setAccountInfo(QMap<QString, QString> accountInfo)
+{
+    m_account = accountInfo;
+    m_first = true;
+}
+
+void AutoSyncData::sync()
+{
+    QString userHash = m_account.value("userhash");
+    QString userCode = m_account.value("usercode");
+    if(userHash.isEmpty() || m_clientID.isEmpty() || userCode.isEmpty())
+        return ;
+
+    if(!checkSynCondition())
+        return;
+    bool isSync1 = false;
+    bool isSync2 = false;
+    QString json = m_wool->GetfhymTask(userHash);
+//    QString fileName = "d:/test/json.txt";
+//    QFile file(fileName);
+//    if(!file.open(QIODevice::ReadOnly))
+//    {
+//        return ;
+//    }
+//    QTextStream in(&file);
+//    json = in.readAll();
+    //qDebug()<<"json:"<<json;
+    RespGetDealInfo response(json);
+    if(response.getRtnCode()>=0)
+    {
+        SNCDataBase::updateBzjcCheckDealInfos(response.getRs(),userCode,m_clientID);
+        isSync1 = true;
+    }
+    if(m_stop)
+        return;
+
+    int indate = 3;
+    json = m_wool->GetfhymHt(indate,userHash);
+
+    RespGetFinishedInfo response2(json);
+    if(response2.getRtnCode()>=0)
+    {
+        QStringList srvids = response2.getRs().values("batchid");
+        SNCDataBase::deleteBzjcFinishExceptSrvIDs(m_clientID,userCode,srvids);
+        SNCDataBase::updateBzjcCheckFinishInfos(response2.getRs(),userCode,m_clientID);
+        isSync2 = true;
+    }
+
+
+    if(isSync1||isSync2)
+    {
+        //QStringList srvids = response.getRs().values("batchid");
+        //srvids.append(response2.getRs().values("batchid"));
+        //SNCDataBase::updateFileUploadOutdateDataBySrvIDs("bzjc",m_clientID,userCode,srvids);
+        emit dataSync();
+    }
+}
+
+bool AutoSyncData::checkSynCondition()
+{
+    //从服务器同步的条件
+    //1、用户每次登陆时
+    //2、bzjc_check_dealing表里有数据
+    //3、bzjc_check_finished表,ispass = 0;
+    //4、upload表里,有upload_state = 3;
+    if(m_first)
+    {
+        m_first = false;
+        return true;
+    }
+    QString userHash = m_account.value("userhash");
+    QString userCode = m_account.value("usercode");
+    if(userHash.isEmpty() || m_clientID.isEmpty() || userCode.isEmpty())
+        return false ;
+
+    QMultiMap<QString,QString> list = SNCDataBase::getAllUpload(m_moduleID,m_clientID,userCode);
+    int cols = list.uniqueKeys().size();
+    int rows = 0;
+    if(cols!=0)
+        rows = list.size()/cols;
+    for(int i=0;i<rows;i++)
+    {
+        int state = list.values("uploadstate").at(i).toInt();
+        if(state==3 )
+        {
+            return true;
+        }
+    }
+
+    list = SNCDataBase::getBzjcCheckDealingInfos(userCode,m_clientID);
+    if(list.size()>0)
+    {
+        return true;
+    }
+
+    list = SNCDataBase::getBzjcCheckFinishInfos(userCode,m_clientID,"");
+
+    cols = list.uniqueKeys().size();
+    rows = 0;
+    if(cols!=0)
+        rows = list.size()/cols;
+    for(int i=0;i<rows;i++)
+    {
+        int ispass = list.values("ispass").at(i).toInt();
+        if(ispass==0)
+        {
+            return true;
+        }
+    }
+    return false;
+}

+ 45 - 0
sncprojects/lib/SNCWool/autosyncdata.h

@@ -0,0 +1,45 @@
+#ifndef AUTOSYNCDATA_H
+#define AUTOSYNCDATA_H
+
+#include <QThread>
+#include <QtCore>
+#include "wswool.h"
+class AutoSyncData : public QThread
+{
+    Q_OBJECT
+public:
+    explicit AutoSyncData();
+    ~AutoSyncData();
+    void abort();
+    void setSkip(bool skip);
+    void setClientID(QString clientID);
+    void setHost(QString host,QString port);
+public slots:
+    void setAccountInfo(QMap<QString,QString> accountInfo);
+protected:
+    void run();
+signals:
+    void dataSync();
+private:
+    void sync();
+    bool checkSynCondition();
+private:
+    QMap<QString,QString> m_account;
+
+    QString m_clientID;
+    QString m_moduleID;
+    QString m_host;
+    QString m_port;
+
+    int m_errCode;
+    QString m_errMsg;
+    QString m_errDetail;
+
+    bool m_stop;
+
+    bool m_first;
+    bool m_skip;
+    WSWool *m_wool;
+};
+
+#endif // AUTOSYNCDATA_H

+ 241 - 0
sncprojects/lib/SNCWool/autouploadfile.cpp

@@ -0,0 +1,241 @@
+#include "autouploadfile.h"
+#include "sncdatabase.h"
+#include "wswool.h"
+#include "respsubminpnum.h"
+#include "resppackmerge.h"
+#include "respchkuserfeestatus.h"
+#include "resppacktran.h"
+#include "fileprepare.h"
+#include "filesplitter.h"
+
+AutoUploadFile::AutoUploadFile()
+{
+    m_stop = false;
+    m_skip = false;
+    m_moduleID = "wool";
+    m_wool = new WSWool();
+}
+
+AutoUploadFile::~AutoUploadFile()
+{
+    m_wool->abort();
+    delete m_wool;
+    qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
+           <<"FormWool.AutoUpload Destroyed.";
+}
+
+void AutoUploadFile::abort()
+{
+    m_stop = true;
+    m_wool->abort();
+}
+
+void AutoUploadFile::setSkip(bool skip)
+{
+
+    m_skip = skip;
+}
+
+void AutoUploadFile::setClientID(QString clientID)
+{
+    m_clientID = clientID;
+}
+
+void AutoUploadFile::setHost(QString host, QString port)
+{
+    m_host = host;
+    m_port = port;
+//    m_wool->setHost(m_host,m_port);
+}
+
+void AutoUploadFile::setAccountInfo(QMap<QString, QString> accountInfo)
+{
+    m_account = accountInfo;
+}
+
+void AutoUploadFile::run()
+{
+    if(m_skip)
+        return;
+    m_stop = false;
+    QString userCode = m_account.value("usercode");
+    QString userHash = m_account.value("ssohash");
+    if(userHash.isEmpty()||userCode.isEmpty()||m_clientID.isEmpty())
+        return ;
+    QMultiMap<QString,QString> list = SNCDataBase::getAllUpload(m_moduleID,m_clientID,userCode);
+    int cols = list.uniqueKeys().size();
+    int rows = 0;
+    if(cols!=0)
+        rows = list.size()/cols;
+    for(int i=0;i<rows;i++)
+    {
+        if(m_stop)
+            break;
+
+        int fileid = list.values("fileid").at(i).toInt();
+        QString filepath = list.values("filepath").at(i);
+        QString filetype = list.values("filetype").at(i);
+        QString memo = list.values("memo").at(i);
+        int state = list.values("uploadstate").at(i).toInt();
+        QString tasktype = list.values("tasktype").at(i);
+        if(state==0 || state == 2)
+        {
+            m_errCode = 0;
+            m_errMsg = "";
+            m_errDetail = "";
+            SNCDataBase::updateFileUploadState(fileid,1,m_errMsg,m_errDetail);
+            int ret = upload(fileid,filepath,filetype,tasktype,memo);
+            switch(ret)
+            {
+                case 0:
+                    SNCDataBase::updateFileUploadState(fileid,2,m_errMsg,m_errDetail);
+                    break;
+                case 1:
+                    SNCDataBase::updateFileUploadState(fileid,3,m_errMsg,m_errDetail);
+                    emit uploadSucceed();
+                    break;
+                case -1:
+                    SNCDataBase::updateFileUploadState(fileid,m_errCode,m_errMsg,m_errDetail);
+                    emit uploadFailed();
+                    break;
+            }
+        }
+
+    }
+}
+
+int AutoUploadFile::upload(int fileid,QString filePath, QString fileType,QString taskType, QString memo)
+{
+
+    bool multi;
+    if(taskType=="1")
+        multi = false;
+    else
+        multi = true;
+    FilePrepare filePrepare(filePath,fileType,multi,this->m_moduleID,this->m_clientID);
+    if(!filePrepare.prepare())
+    {
+        m_errCode = -1;
+        m_errMsg = filePrepare.getRtnMsg();
+        return -1;
+    }
+    if(m_stop)
+    {
+        return 0;
+    }
+    QString userHash = m_account.value("ssohash");
+    QString funcName = "SubmitfhymFile";
+    QString json = m_wool->UserServiceVerify(funcName, QString("%1").arg(filePrepare.getCount()), userHash);
+    RespChkUserFeeStatus    response(json);
+    if(response.getRtnCode()<=0)
+    {
+        m_errMsg = response.getRtnMemo();
+        m_errCode = -4;
+        if(response.getRtnCode()==RTNCODE_NETWORK_ABORT)
+        {
+            return 0;
+        }
+        else if(response.getRtnCode()==RTNCODE_NETWORK_NOTAVAILABLE)
+        {
+            m_errCode = -2;
+            return -1;
+        }
+    }
+    FileSplitter splitter(filePrepare.getLastUploadFileName(),QString::number(fileid));
+    QStringList list = splitter.getSplitResult();
+
+    bool allupload = true;
+    QString packName;
+    for(int i=0;i<list.size();i++)
+    {
+        if(m_stop)
+        {
+            return 0;
+        }
+        packName = list.at(i);
+        QString json = m_wool->PackTran(packName,userHash);
+        RespPackTran response(json);
+        if(response.getRtnCode()==1)
+        {
+            QFile::remove(packName);
+        }
+        else
+        {
+            m_errMsg = response.getRtnMemo();
+            m_errCode = -4;
+            if(response.getRtnCode()==RTNCODE_NETWORK_ABORT)
+            {
+                return 0;
+            }
+            else if(response.getRtnCode()==RTNCODE_NETWORK_NOTAVAILABLE)
+            {
+                m_errCode = -2;
+                return -1;
+            }
+            allupload = false;
+            break;
+        }
+        SNCDataBase::updateFileUploadPercent(fileid,(i+1)*100.0/list.size());
+        emit uploadProgressUpdated();
+    }
+
+    if(allupload)
+    {
+        splitter.cleanup();
+        QString json = m_wool->PackMerge(packName,userHash);
+        RespPackMerge response(json);
+        if(response.getRtnCode()==1)
+        {
+            json = m_wool->SubmitfhymFile(filePrepare.getLastUploadFileName(), response.getFileHash(), fileType, memo, userHash);
+            RespSubminPNum response(json);
+            if(response.getRtnCode()==2)
+            {
+                m_errCode = 1;
+                m_errMsg = "上传成功,号码全部接收。";
+                m_errDetail = response.getRtnMemo();
+                SNCDataBase::updateFileUploadSrvInfo(fileid,response.getBatchID(),response.getSubmitTime());
+            }
+            else if(response.getRtnCode()==1)
+            {
+                m_errCode = 1;
+                m_errMsg = "上传成功,文件中含有部分非法数据。";
+                m_errDetail = response.getRtnMemo();
+                SNCDataBase::updateFileUploadSrvInfo(fileid,response.getBatchID(),response.getSubmitTime());
+            }
+            else
+            {
+                m_errMsg = response.getRtnMemo();
+                m_errCode = -4;
+                if(response.getRtnCode()==RTNCODE_NETWORK_ABORT)
+                {
+                    return 0;
+                }
+                else if(response.getRtnCode()==RTNCODE_NETWORK_NOTAVAILABLE)
+                {
+                    m_errCode = -2;
+                    return -1;
+                }
+            }
+
+        }
+        else
+        {
+            m_errMsg = response.getRtnMemo();
+            m_errCode = -4;
+            if(response.getRtnCode()==RTNCODE_NETWORK_ABORT)
+            {
+                return 0;
+            }
+            else if(response.getRtnCode()==RTNCODE_NETWORK_NOTAVAILABLE)
+            {
+                m_errCode = -2;
+                return -1;
+            }
+        }
+    }
+    if(m_errCode<0)
+        return -1;
+    else
+        return 1;
+}
+

+ 42 - 0
sncprojects/lib/SNCWool/autouploadfile.h

@@ -0,0 +1,42 @@
+#ifndef AUTOUPLOADFILE_H
+#define AUTOUPLOADFILE_H
+
+#include <QThread>
+#include <QtCore>
+#include "wswool.h"
+class AutoUploadFile : public QThread
+{
+    Q_OBJECT
+public:
+    AutoUploadFile();
+    ~AutoUploadFile();
+    void abort();
+    void setSkip(bool skip);
+    void setClientID(QString clientID);
+    void setHost(QString host,QString port);
+public slots:
+    void setAccountInfo(QMap<QString,QString> accountInfo);
+signals:
+    void uploadSucceed();
+    void uploadFailed();
+    void uploadProgressUpdated();
+protected:
+    void run();
+private:
+    int upload(int fileid,QString filePath,QString fileType,QString taskType,QString memo);
+private:
+    QMap<QString,QString> m_account;
+    QString m_clientID;
+    QString m_moduleID;
+    QString m_host;
+    QString m_port;
+    int m_errCode;
+    QString m_errMsg;
+    QString m_errDetail;
+    bool m_stop;
+    WSWool *m_wool;
+    bool m_skip;
+    
+};
+
+#endif // FILEAUTOUPLOAD_H

+ 42 - 0
sncprojects/lib/SNCWool/dialogsubmit.cpp

@@ -0,0 +1,42 @@
+#include "dialogsubmit.h"
+#include "ui_dialogsubmit.h"
+
+DialogSubmit::DialogSubmit(QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::DialogSubmit)
+{
+    ui->setupUi(this);
+    m_formUpload = new FormUpload();
+    connect(m_formUpload,SIGNAL(buttonCloseClicked()),this,SLOT(close()));
+    connect(m_formUpload,SIGNAL(dataUpdated()),this,SLOT(onDataUpdated()));
+    ui->verticalLayout->addWidget(m_formUpload);
+    setWindowFlags(windowFlags()&~Qt::WindowContextHelpButtonHint);
+}
+
+void DialogSubmit::setUserCode(QString userCode)
+{
+    m_formUpload->setUserCode(userCode);
+}
+
+void DialogSubmit::setClientID(QString clientID)
+{
+    m_formUpload->setClientID(clientID);
+}
+
+DialogSubmit::~DialogSubmit()
+{
+    delete ui;
+    delete m_formUpload;
+    qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
+           <<"FormNumcheck.DialogSubmit Destroyed.";
+}
+
+void DialogSubmit::closeEvent(QCloseEvent *event)
+{
+    event->accept();
+}
+
+void DialogSubmit::onDataUpdated()
+{
+    emit dataUpdated();
+}

+ 29 - 0
sncprojects/lib/SNCWool/dialogsubmit.h

@@ -0,0 +1,29 @@
+#ifndef DIALOGSUBMIT_H
+#define DIALOGSUBMIT_H
+
+#include <QDialog>
+#include "formupload.h"
+namespace Ui {
+class DialogSubmit;
+}
+
+class DialogSubmit : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit DialogSubmit(QWidget *parent = 0);
+    void setUserCode(QString userCode);
+    void setClientID(QString clientID);
+    ~DialogSubmit();
+    void closeEvent(QCloseEvent *event);
+signals:
+    void dataUpdated();
+private slots:
+    void onDataUpdated();
+private:
+    Ui::DialogSubmit *ui;
+    FormUpload *m_formUpload;
+};
+
+#endif // DIALOGSUBMIT_H

+ 38 - 0
sncprojects/lib/SNCWool/dialogsubmit.ui

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogSubmit</class>
+ <widget class="QDialog" name="DialogSubmit">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>180</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>400</width>
+    <height>180</height>
+   </size>
+  </property>
+  <property name="maximumSize">
+   <size>
+    <width>400</width>
+    <height>180</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>上传数据</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout"/>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 102 - 0
sncprojects/lib/SNCWool/dialogsubmitresponsedetail.cpp

@@ -0,0 +1,102 @@
+#include "dialogsubmitresponsedetail.h"
+#include "ui_dialogsubmitresponsedetail.h"
+#include <QtGui>
+
+DialogSubmitResponseDetail::DialogSubmitResponseDetail(QWidget *parent) :
+    QDialog(parent),
+    ui(new Ui::DialogSubmitResponseDetail)
+{
+    ui->setupUi(this);
+    ui->buttonBox->button(QDialogButtonBox::Ok)->setText("复制");
+    ui->buttonBox->button(QDialogButtonBox::Cancel)->setText("关闭");
+    connect(ui->buttonBox,SIGNAL(accepted()),this,SLOT(onCopy()));
+}
+
+void DialogSubmitResponseDetail::setDetailText(QString str)
+{
+    str = str.replace("\\r\\n","\r\n");
+    QStringList list = str.split("\r\n");
+    //获取日期时间
+    QString date,time,detail,valid,invalid,black,remark,diaplay;
+    if(list.size()>0)
+    {
+        date= list.at(0).mid(1,10);
+        time = list.at(0).mid(12,8);
+        detail = list.at(0).mid(22,list.at(0).size()-22);
+        detail = detail.split("[").at(0);
+    }
+    else
+    {
+        date = "N/A";
+        time = "N/A";
+        detail = "N/A";
+    }
+    //获取号码总数
+    QStringList numbers;
+    QString line;
+    if(list.size()>1)
+    {
+        line = list.at(1);
+    }
+    else if(list.size()==1)
+    {
+        line = list.at(0).mid(22,list.at(0).size()-22);
+    }
+
+    int count = 0;
+    int pos = 0;
+    QRegExp rx("\\d+");
+    while ((pos = rx.indexIn(line, pos)) != -1)
+    {
+        ++count;
+        pos += rx.matchedLength();
+        numbers.append(rx.capturedTexts().at(0));
+    }
+    if(numbers.size()!=3)
+    {
+        valid = numbers.at(0);
+        invalid = "0";
+        black = "0";
+    }
+    else
+    {
+        valid = numbers.at(0);
+        invalid = numbers.at(1);
+        black = numbers.at(2);
+    }
+//    //获取备注信息
+//    if(list.size()>2)
+//        remark = list.at(2);
+//    else
+//        remark = "以下是无效号码列表:(数量:0)";
+    ui->labelDate->setText(date);
+    ui->labelTime->setText(time);
+    ui->labelTotalValid->setText(valid);
+    ui->labelTotalInvalid->setText(invalid);
+    ui->labelBlack->setText(black);
+    ui->labelResult->setText(detail);
+    //ui->labelRemark->setText(remark);
+    QString display;
+    for(int i=2;i<list.size();i++)
+    {
+        display += list.at(i) + "\r\n";
+    }
+    ui->textBrowser->setText(display);
+//    this->setSizePolicy(QSizePolicy::Fixed,QSizePolicy::Fixed);
+//    this->setMinimumHeight(this->height());
+//    this->setMaximumHeight(this->height());
+//    this->setMinimumWidth(this->width());
+//    this->setMaximumWidth(this->width());
+}
+
+DialogSubmitResponseDetail::~DialogSubmitResponseDetail()
+{
+    delete ui;
+}
+
+void DialogSubmitResponseDetail::onCopy()
+{
+    QClipboard *board = QApplication::clipboard();
+    board->setText(ui->textBrowser->toPlainText());
+    QMessageBox::information(this,"完成","无效号码已经复制到剪贴板!",QMessageBox::Ok);
+}

+ 24 - 0
sncprojects/lib/SNCWool/dialogsubmitresponsedetail.h

@@ -0,0 +1,24 @@
+#ifndef DIALOGSUBMITRESPONSEDETAIL_H
+#define DIALOGSUBMITRESPONSEDETAIL_H
+
+#include <QDialog>
+#include <QtCore>
+namespace Ui {
+class DialogSubmitResponseDetail;
+}
+
+class DialogSubmitResponseDetail : public QDialog
+{
+    Q_OBJECT
+    
+public:
+    explicit DialogSubmitResponseDetail(QWidget *parent = 0);
+    void setDetailText(QString str);
+    ~DialogSubmitResponseDetail();
+private slots:
+    void onCopy();
+private:
+    Ui::DialogSubmitResponseDetail *ui;
+};
+
+#endif // DIALOGSUBMITRESPONSEDETAIL_H

+ 179 - 0
sncprojects/lib/SNCWool/dialogsubmitresponsedetail.ui

@@ -0,0 +1,179 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>DialogSubmitResponseDetail</class>
+ <widget class="QDialog" name="DialogSubmitResponseDetail">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>475</width>
+    <height>319</height>
+   </rect>
+  </property>
+  <property name="minimumSize">
+   <size>
+    <width>475</width>
+    <height>319</height>
+   </size>
+  </property>
+  <property name="maximumSize">
+   <size>
+    <width>475</width>
+    <height>319</height>
+   </size>
+  </property>
+  <property name="windowTitle">
+   <string>详细信息</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QGridLayout" name="gridLayout">
+     <item row="1" column="1">
+      <widget class="QLabel" name="labelTotalInvalid">
+       <property name="text">
+        <string>TextLabel</string>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="1">
+      <widget class="QLabel" name="labelTotalValid">
+       <property name="text">
+        <string>TextLabel</string>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="3">
+      <widget class="QLabel" name="labelTime">
+       <property name="text">
+        <string>TextLabel</string>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="3">
+      <widget class="QLabel" name="labelDate">
+       <property name="text">
+        <string>TextLabel</string>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="2">
+      <widget class="QLabel" name="label">
+       <property name="text">
+        <string>提交日期:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="0" column="0">
+      <widget class="QLabel" name="label_9">
+       <property name="text">
+        <string>有效号码总数:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="0">
+      <widget class="QLabel" name="label_6">
+       <property name="text">
+        <string>无效号码总数:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="0">
+      <widget class="QLabel" name="label_11">
+       <property name="text">
+        <string>黑名单号码总数:</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+       </property>
+      </widget>
+     </item>
+     <item row="1" column="2">
+      <widget class="QLabel" name="label_3">
+       <property name="text">
+        <string>提交时间:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="1">
+      <widget class="QLabel" name="labelBlack">
+       <property name="text">
+        <string>TextLabel</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="2">
+      <widget class="QLabel" name="label_8">
+       <property name="text">
+        <string>返回结果:</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="3">
+      <widget class="QLabel" name="labelResult">
+       <property name="sizePolicy">
+        <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+         <horstretch>0</horstretch>
+         <verstretch>0</verstretch>
+        </sizepolicy>
+       </property>
+       <property name="text">
+        <string>TextLabel</string>
+       </property>
+       <property name="alignment">
+        <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+       </property>
+       <property name="wordWrap">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QLabel" name="labelRemark">
+     <property name="text">
+      <string>被过滤的号码:</string>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QTextBrowser" name="textBrowser"/>
+   </item>
+   <item>
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+     </property>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections>
+  <connection>
+   <sender>buttonBox</sender>
+   <signal>rejected()</signal>
+   <receiver>DialogSubmitResponseDetail</receiver>
+   <slot>reject()</slot>
+   <hints>
+    <hint type="sourcelabel">
+     <x>316</x>
+     <y>260</y>
+    </hint>
+    <hint type="destinationlabel">
+     <x>286</x>
+     <y>274</y>
+    </hint>
+   </hints>
+  </connection>
+ </connections>
+</ui>

+ 309 - 0
sncprojects/lib/SNCWool/formaccountinfo.cpp

@@ -0,0 +1,309 @@
+#include "formaccountinfo.h"
+#include "ui_formaccountinfo.h"
+#include "respgetservertime.h"
+#include "respencrypt.h"
+#include "respgetuserblance.h"
+#include "sncdatabase.h"
+//#include "dialogbindsystem.h"
+
+FormAccountInfo::FormAccountInfo(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::FormAccountInfo)
+{
+    ui->setupUi(this);
+    initVariables();
+    initUI();
+}
+
+FormAccountInfo::~FormAccountInfo()
+{
+    m_wool->abort();
+    m_ssows->abort();
+    m_movie->stop();
+    delete m_movie;
+    delete m_ssows;
+    delete m_wool;
+    delete ui;
+    qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
+           <<"FormWool.FormAccountInfo Destroyed.";
+}
+
+void FormAccountInfo::setAccountInfo(QMap<QString, QString> info)
+{
+    m_account = info;
+    QString ssoHash = info.value("ssohash");
+    QString userCode = info.value("usercode");
+    if(!ssoHash.isEmpty())
+    {
+        setAccountAreaUI(LoginOk);
+    }
+    else
+    {
+        if(userCode.isEmpty())
+        {
+            setAccountAreaUI(NotLogin);
+        }
+        else
+        {
+            setAccountAreaUI(LoginError);
+        }
+    }
+}
+
+void FormAccountInfo::initVariables()
+{
+    m_wool = new WSWool();
+    m_ssows = new WSSSO();
+    m_movie = new QMovie(":/working.gif");
+    m_movie->start();
+}
+
+void FormAccountInfo::initUI()
+{
+    //初始化背景效果
+    ui->widgetBackground->setProperty("class","silverbg");
+
+    //初始化登录后显示的账户相关信息区域的样式
+    ui->pushButtonCharge->setProperty("class","small-red-bg");
+    ui->pushButtonLogin->setProperty("class","txt-green");
+    ui->pushButtonBind->setProperty("class","txt-green-bold");
+    ui->pushButtonRefreshUserState->setProperty("class","txt-green");
+    ui->pushButtonPay->setProperty("class","txt-green-bold");
+
+    ui->labelToPay->setStyleSheet("color:red");
+
+    setAccountAreaUI(NotLogin);
+}
+
+void FormAccountInfo::setAccountAreaUI(AccountLoginState state)
+{
+    switch(state)
+    {
+        case LoginOk:
+            ui->labelTip->setText("");
+            ui->widgetAccountInfo->setVisible(true);
+            ui->pushButtonLogin->setVisible(false);
+            ui->labelTip2->setText("");
+            ui->labelTip3->setText("");
+            ui->widgetDefault->setVisible(false);
+            refreshAccountInfo();
+            break;
+        case NotLogin:
+            ui->labelTip->setText("您需要");
+            ui->widgetAccountInfo->setVisible(false);
+            ui->pushButtonLogin->setVisible(true);
+            ui->pushButtonBind->setVisible(false);
+            ui->labelTip2->setText("才可以使用该功能!");
+            ui->widgetDefault->setVisible(true);
+            ui->labelTip3->setText("");
+            break;
+        case NotBind:
+            ui->labelTip->setText("尚未开通");
+            ui->widgetAccountInfo->setVisible(false);
+            ui->pushButtonLogin->setVisible(false);
+            ui->pushButtonBind->setVisible(true);
+            ui->labelTip2->setText("防薅羊毛检测服务!请点击此处[ ");
+            ui->widgetDefault->setVisible(true);
+            ui->labelTip3->setText(" ]");
+            break;
+        case LoginError:
+            ui->labelTip->setText("防薅羊毛检测服务无法连接!");
+            ui->widgetAccountInfo->setVisible(false);
+            ui->pushButtonLogin->setVisible(false);
+            ui->pushButtonBind->setVisible(false);
+            ui->widgetDefault->setVisible(true);
+            ui->labelTip2->setText("");
+            ui->labelTip3->setText("");
+            break;
+    }
+    changeImage(state);
+}
+
+void FormAccountInfo::changeImage(AccountLoginState state)
+{
+    m_state = state;
+    QPixmap pixamp(":/service_state.png");
+    int nHeight = pixamp.height();
+    int nWidth = pixamp.width()/4;
+    ui->labelStateImage->setPixmap(pixamp.copy(QRect(state * nWidth , 0, nWidth, nHeight)));
+}
+
+void FormAccountInfo::refreshAccountInfo()
+{
+    bool succeed =false;
+    QString userHash = m_account.value("ssohash");
+    ui->labelStateImage->setMovie(m_movie);
+    QString json = m_wool->GetUserBalance(userHash);
+    changeImage(m_state);
+    RespGetUserBlance response (json);
+    if(response.getRtnCode()==1){
+        ui->labelGiftBalance->setText("¥" + response.getGiftMoney());
+        ui->labelUserBlance->setText("¥" + response.getBlance());
+        ui->labelValidNum->setText(response.getValidNum());
+        ui->labelToPay->setText("待付金额:¥" + response.getToPayMoney());
+        if(response.getToPayMoney()>response.getBlance())
+            emit blanceOut();
+        else
+            emit blanceIn();
+//        if(response.getToPayMoney().toDouble()==0)
+//        {
+//            ui->labelToPay->setVisible(false);
+//            ui->pushButtonPay->setVisible(false);
+//        }
+//        else
+//        {
+//            ui->labelToPay->setVisible(true);
+//            ui->pushButtonPay->setVisible(true);
+//        }
+        succeed = true;
+    }
+    if(!succeed)
+    {
+        ui->labelGiftBalance->setText("N/A");
+        ui->labelUserBlance->setText("N/A");
+        ui->labelValidNum->setText("N/A");
+        ui->labelToPay->setText("待付金额:N/A");
+    }
+
+}
+
+void FormAccountInfo::on_pushButtonLogin_clicked()
+{
+    emit buttonLoginClick();
+}
+
+void FormAccountInfo::on_pushButtonCharge_clicked()
+{
+    QString ssoHash = m_account.value("ssohash");
+    if(ssoHash.isEmpty())
+    {
+        QMessageBox::critical(this,"提示","您现在还没有登录系统,请登录后再操作!",QMessageBox::Ok);
+        return;
+    }
+    if(!checkLastClickTime(sender()))
+        return ;
+
+    QString json = m_ssows->encrypt(ssoHash);
+    RespEncrypt resp1(json);
+    QString data = resp1.getEncryptData();
+
+    json = m_ssows->getServerTime();
+    RespGetServerTime resp2(json);
+
+    QString authCode;
+    QByteArray ba;
+    QString str = SNCDataBase::getAuthCodeUrl().arg(resp2.getServerTime().mid(0,16));
+    ba = QCryptographicHash::hash ( str.toAscii(), QCryptographicHash::Md5 );
+    authCode.append(ba.toHex());
+
+    QString url = SNCDataBase::getSSOPayUrl() + "?s=mf&r="+authCode+"&u="+data+"&p=zxcz_wool";
+    QDesktopServices::openUrl(QUrl(url));
+}
+
+void FormAccountInfo::on_pushButtonRefreshUserState_clicked()
+{
+    QString userHash = m_account.value("ssohash");
+    if(userHash.isEmpty())
+    {
+        QMessageBox::critical(this,"提示","您现在还没有登录系统,请登录后再操作!",QMessageBox::Ok);
+        return;
+    }
+    if(!checkLastClickTime(sender()))
+        return ;
+    setCursor(Qt::WaitCursor);
+    refreshAccountInfo();
+    setCursor(Qt::ArrowCursor);
+}
+
+void FormAccountInfo::onDataUpdated()
+{
+    refreshAccountInfo();
+}
+
+bool FormAccountInfo::checkLastClickTime(QObject *button)
+{
+    QPushButton *btn = qobject_cast<QPushButton*>(button);
+
+    QDateTime lasttime = m_clickTime.value(btn->objectName());
+    if(!lasttime.isNull())
+    {
+        if(lasttime.addSecs(30)>QDateTime::currentDateTime())
+        {
+            QMessageBox::critical(this,"提示","您不可以频繁点击!",QMessageBox::Ok);
+            return false;
+        }
+    }
+    m_clickTime.insert(btn->objectName(),QDateTime::currentDateTime());
+    return true;
+}
+
+void FormAccountInfo::on_pushButtonPay_clicked()
+{
+    QString userHash = m_account.value("ssohash");
+    if(userHash.isEmpty())
+    {
+        QMessageBox::critical(this,"提示","您现在还没有登录系统,请登录后再操作!",QMessageBox::Ok);
+        return;
+    }
+    if(!checkLastClickTime(sender()))
+        return ;
+    QString json = m_ssows->encrypt(userHash);
+    RespEncrypt resp1(json);
+    QString data = resp1.getEncryptData();
+
+    json = m_ssows->getServerTime();
+    RespGetServerTime resp2(json);
+
+    QString authCode;
+    QByteArray ba;
+    QString str = SNCDataBase::getAuthCodeUrl().arg(resp2.getServerTime().mid(0,16));
+    ba = QCryptographicHash::hash ( str.toAscii(), QCryptographicHash::Md5 );
+    authCode.append(ba.toHex());
+
+    QString url = SNCDataBase::getSSOPayUrl() + "?s=mf&r="+authCode+"&u="+data+"&p=fk_wool";
+    QDesktopServices::openUrl(QUrl(url));
+}
+
+void FormAccountInfo::on_pushButtonBind_clicked()
+{
+/*
+    DialogBindSystem dialog(this);
+    QString ssoHash = m_account.value("ssohash");
+    QString syscode = "";
+    if(m_clientID=="sskh")
+    {
+        syscode = "1";
+    }
+    else if(m_clientID=="mykh")
+    {
+        syscode = "2";
+    }
+    dialog.setSysRegInfo(syscode,ssoHash);
+    dialog.exec();
+    if(dialog.serviceIsOpen())
+    {
+//        refreshSrvInfo();
+//        WSSSO sso2;
+//        QString json = sso2.getSysAccount(syscode,this->userHash);
+//        RespGetSysAccount response2(json);
+
+//        if(response2.getRtnCode() == 1)
+//        {
+//            QMap<QString,QString> shunshiInfo,mingyuanInfo;
+
+//            if(syscode=="1")
+//            {
+//                shunshiInfo.insert("usercode",response2.getUserCode());
+//                shunshiInfo.insert("userpwd",response2.getUserPwd());
+//                emit updateShunShiAccount(shunshiInfo);
+//            }
+//            else if(syscode=="2")
+//            {
+//                mingyuanInfo.insert("usercode",response2.getUserCode());
+//                mingyuanInfo.insert("userpwd",response2.getUserPwd());
+//                emit updateMingYuanAccount(mingyuanInfo);
+//            }
+//        }
+    }
+*/
+}

+ 61 - 0
sncprojects/lib/SNCWool/formaccountinfo.h

@@ -0,0 +1,61 @@
+#ifndef FORMACCOUNTINFO_H
+#define FORMACCOUNTINFO_H
+
+#include <QWidget>
+#include <QtGui>
+#include "snccore.h"
+//#include "wsnumchk.h"
+#include "wssso.h"
+#include "wswool.h"
+namespace Ui {
+class FormAccountInfo;
+}
+
+class FormAccountInfo : public QWidget
+{
+    Q_OBJECT
+    
+public:
+    explicit FormAccountInfo(QWidget *parent = 0);
+    void setHost(QString host,QString port);
+    ~FormAccountInfo();
+signals:
+    void buttonLoginClick();
+    void blanceOut();
+    void blanceIn();
+public slots:
+    void setAccountInfo(QMap<QString,QString> info);
+private slots:
+    void on_pushButtonLogin_clicked();
+
+    void on_pushButtonCharge_clicked();
+
+    void on_pushButtonRefreshUserState_clicked();
+
+    void onDataUpdated();
+
+    void on_pushButtonPay_clicked();
+
+    void on_pushButtonBind_clicked();
+
+private:
+    void initVariables();                                                       //初始化成员变量
+    void initUI();                                                              //初始化UI样式
+    void setAccountAreaUI(AccountLoginState state);                             //设置账户区域UI;
+    void changeImage(AccountLoginState state);                                  //切换在不同的用户登录状态时,tip所对应的图片
+    void refreshAccountInfo();
+    bool checkLastClickTime(QObject *button);
+private:
+    Ui::FormAccountInfo *ui;
+    QMap<QString,QString> m_account;
+    WSSSO *m_ssows;
+//    WSNumChk *m_numchk;
+    WSWool *m_wool;
+    QString m_host;
+    QString m_port;
+    QMap<QString,QDateTime> m_clickTime;
+    QMovie *m_movie;
+    AccountLoginState m_state;
+};
+
+#endif // FORMACCOUNTINFO_H

+ 331 - 0
sncprojects/lib/SNCWool/formaccountinfo.ui

@@ -0,0 +1,331 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>FormAccountInfo</class>
+ <widget class="QWidget" name="FormAccountInfo">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>908</width>
+    <height>30</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="spacing">
+    <number>0</number>
+   </property>
+   <property name="margin">
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QWidget" name="widgetBackground" native="true">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>30</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>16777215</width>
+       <height>30</height>
+      </size>
+     </property>
+     <layout class="QHBoxLayout" name="horizontalLayout_3">
+      <property name="spacing">
+       <number>0</number>
+      </property>
+      <property name="leftMargin">
+       <number>5</number>
+      </property>
+      <property name="topMargin">
+       <number>0</number>
+      </property>
+      <property name="rightMargin">
+       <number>0</number>
+      </property>
+      <property name="bottomMargin">
+       <number>0</number>
+      </property>
+      <item>
+       <widget class="QLabel" name="labelStateImage">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <property name="minimumSize">
+         <size>
+          <width>16</width>
+          <height>16</height>
+         </size>
+        </property>
+        <property name="maximumSize">
+         <size>
+          <width>16</width>
+          <height>16</height>
+         </size>
+        </property>
+        <property name="text">
+         <string>TextLabel</string>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QWidget" name="widgetAccountInfo" native="true">
+        <property name="sizePolicy">
+         <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+          <horstretch>0</horstretch>
+          <verstretch>0</verstretch>
+         </sizepolicy>
+        </property>
+        <layout class="QHBoxLayout" name="horizontalLayout">
+         <property name="spacing">
+          <number>0</number>
+         </property>
+         <property name="leftMargin">
+          <number>5</number>
+         </property>
+         <property name="topMargin">
+          <number>0</number>
+         </property>
+         <property name="rightMargin">
+          <number>9</number>
+         </property>
+         <property name="bottomMargin">
+          <number>0</number>
+         </property>
+         <item>
+          <widget class="QLabel" name="labelToPay">
+           <property name="text">
+            <string>待付金额:N/A</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="label">
+           <property name="text">
+            <string> [</string>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="pushButtonPay">
+           <property name="cursor">
+            <cursorShape>PointingHandCursor</cursorShape>
+           </property>
+           <property name="toolTip">
+            <string>点击打开付款页面</string>
+           </property>
+           <property name="text">
+            <string> 付款 </string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="label_5">
+           <property name="text">
+            <string>] </string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="label_12">
+           <property name="text">
+            <string>用户余额:</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="labelUserBlance">
+           <property name="text">
+            <string>N/A</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="label_10">
+           <property name="text">
+            <string>  赠送余额:</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="labelGiftBalance">
+           <property name="text">
+            <string>N/A</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="label_4">
+           <property name="text">
+            <string>  可用条数:</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="labelValidNum">
+           <property name="text">
+            <string>N/A</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer_5">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+         <item>
+          <widget class="QPushButton" name="pushButtonCharge">
+           <property name="cursor">
+            <cursorShape>PointingHandCursor</cursorShape>
+           </property>
+           <property name="toolTip">
+            <string>点击打开充值页面</string>
+           </property>
+           <property name="text">
+            <string>充值</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="label_11">
+           <property name="text">
+            <string>[</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="pushButtonRefreshUserState">
+           <property name="cursor">
+            <cursorShape>PointingHandCursor</cursorShape>
+           </property>
+           <property name="toolTip">
+            <string>点击刷新账户信息</string>
+           </property>
+           <property name="text">
+            <string>刷新</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="label_13">
+           <property name="text">
+            <string>]</string>
+           </property>
+          </widget>
+         </item>
+        </layout>
+       </widget>
+      </item>
+      <item>
+       <widget class="QWidget" name="widgetDefault" native="true">
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <property name="spacing">
+          <number>0</number>
+         </property>
+         <property name="margin">
+          <number>0</number>
+         </property>
+         <item>
+          <widget class="QLabel" name="labelTip">
+           <property name="text">
+            <string>TextLabel</string>
+           </property>
+           <property name="alignment">
+            <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="pushButtonLogin">
+           <property name="cursor">
+            <cursorShape>PointingHandCursor</cursorShape>
+           </property>
+           <property name="toolTip">
+            <string>点击打开登录窗口</string>
+           </property>
+           <property name="text">
+            <string>登录</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="labelTip2">
+           <property name="text">
+            <string>TextLabel</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QPushButton" name="pushButtonBind">
+           <property name="cursor">
+            <cursorShape>PointingHandCursor</cursorShape>
+           </property>
+           <property name="toolTip">
+            <string>点击打开服务绑定窗口</string>
+           </property>
+           <property name="text">
+            <string>开通</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QLabel" name="labelTip3">
+           <property name="text">
+            <string>]</string>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+        <zorder>labelTip</zorder>
+        <zorder>pushButtonLogin</zorder>
+        <zorder>labelTip2</zorder>
+        <zorder>horizontalSpacer</zorder>
+        <zorder>pushButtonBind</zorder>
+        <zorder>labelTip3</zorder>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 79 - 0
sncprojects/lib/SNCWool/formad.cpp

@@ -0,0 +1,79 @@
+#include "formad.h"
+#include "ui_formad.h"
+#include "sncdatabase.h"
+#include "respencrypt.h"
+#include "respgetservertime.h"
+FormAd::FormAd(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::FormAd)
+{
+    ui->setupUi(this);
+
+    page_ads = SNCDataBase::getLocalPageAds();
+
+    m_webview = new CacheWebView(this);
+    m_webview->setMinimumWidth(280);
+    m_webview->setMaximumWidth(280);
+
+    QString url = "";
+    if(page_ads.count()>0)
+    {
+        url = page_ads.value("ad_app2_wool");
+    }
+    m_webview->setPageUrl(url,QCoreApplication::applicationDirPath()+"/../cache");
+
+    ui->verticalLayout->addWidget(m_webview);
+    m_ssows = new WSSSO();
+}
+
+FormAd::~FormAd()
+{
+    if(m_ssows)
+    {
+        m_ssows->abort();
+        delete m_ssows;
+    }
+    delete m_webview;
+    delete ui;
+    qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
+           <<"FormNumchk.FormAd Destroyed.";
+}
+
+
+void FormAd::setAccountInfo(QMap<QString, QString> info)
+{
+    QString userHash = info.value("userhash");
+    m_account = info;
+    if(userHash.isEmpty())
+    {
+        m_webview->setPageUrl(m_pageUrl,QCoreApplication::applicationDirPath()+"/../cache");
+    }
+    else
+    {
+        QString url = getUserCenterUrl();
+        m_webview->setPageUrl(url,QCoreApplication::applicationDirPath()+"/../cache");
+    }
+}
+
+
+QString FormAd::getUserCenterUrl()
+{
+    QString ssoHash = m_account.value("ssohash");
+
+    QString json = m_ssows->encrypt(ssoHash);
+    RespEncrypt resp1(json);
+    QString data = resp1.getEncryptData();
+
+    json = m_ssows->getServerTime();
+    RespGetServerTime resp2(json);
+
+    QString authCode;
+    QByteArray ba;
+    QString str = SNCDataBase::getAuthCodeUrl().arg(resp2.getServerTime().mid(0,16));
+    ba = QCryptographicHash::hash ( str.toAscii(), QCryptographicHash::Md5 );
+    authCode.append(ba.toHex());
+
+    QString url = SNCDataBase::getSSOAccountUrl() + "?s=mf&r="+authCode+"&u="+data+"&p=ad_"+m_clientID;
+
+    return url;
+}

+ 34 - 0
sncprojects/lib/SNCWool/formad.h

@@ -0,0 +1,34 @@
+#ifndef FORMAD_H
+#define FORMAD_H
+
+#include <QWidget>
+#include <QtGui>
+#include "wssso.h"
+#include "cachewebview.h"
+namespace Ui {
+class FormAd;
+}
+
+class FormAd : public QWidget
+{
+    Q_OBJECT
+    
+public:
+    explicit FormAd(QWidget *parent = 0);
+    ~FormAd();
+public slots:
+    void setAccountInfo(QMap<QString,QString> info);
+private slots:
+private:
+    QString getUserCenterUrl();
+private:
+    Ui::FormAd *ui;
+    QString m_pageUrl;
+    CacheWebView *m_webview;
+    QMap<QString,QString> m_account;
+    QString m_clientID;
+    WSSSO *m_ssows;
+    QMap<QString,QString> page_ads;
+};
+
+#endif // FORMAD_H

+ 27 - 0
sncprojects/lib/SNCWool/formad.ui

@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>FormAd</class>
+ <widget class="QWidget" name="FormAd">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="spacing">
+    <number>0</number>
+   </property>
+   <property name="margin">
+    <number>0</number>
+   </property>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 247 - 0
sncprojects/lib/SNCWool/formupload.cpp

@@ -0,0 +1,247 @@
+#include "formupload.h"
+#include "ui_formupload.h"
+#include "sncdatabase.h"
+#include "dialogsubmitresponsedetail.h"
+
+FormUpload::FormUpload(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::FormUpload)
+{
+    ui->setupUi(this);
+
+    initVariables();
+    resetUI();
+}
+
+void FormUpload::initVariables()
+{
+
+}
+
+FormUpload::~FormUpload()
+{
+    delete ui;
+    qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
+           <<"FormNumchk.FormUpload Destroyed.";
+}
+
+void FormUpload::resetUI()
+{
+    ui->lineEditFilePath->setText("");
+    ui->lineEditMemo->setText("");
+    ui->lineEditFilePath->setReadOnly(true);
+}
+
+void FormUpload::setUserCode(QString userCode)
+{
+    m_userCode = userCode;
+}
+
+void FormUpload::setClientID(QString clientID)
+{
+    m_clientID = clientID;
+}
+
+void FormUpload::on_pushButtonOpen_clicked()
+{
+    QString selectedFilter;
+    QFileDialog::Options options;
+    QString suffix = "Text Files;Zip File (*.txt;*.zip;*.7z;*.rar)";
+    QString importDir = SNCDataBase::getImportDir();
+    if(importDir.isEmpty())
+    {
+        importDir = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation);
+    }
+    QString fileName = QFileDialog::getOpenFileName(this,"打开文件",importDir,suffix,&selectedFilter,options);
+    QFileInfo fileInfo(fileName);
+    if(!fileInfo.absolutePath().isEmpty())
+        SNCDataBase::updateImportDir(fileInfo.absolutePath());
+    if(fileName.isEmpty())
+        return ;
+    resetUI();
+    ui->lineEditFilePath->setText(fileName);
+}
+
+void FormUpload::on_pushButtonSubmit_clicked()
+{
+    QString filePath = ui->lineEditFilePath->text();
+    if(!QFile::exists(filePath))
+    {
+        QMessageBox::critical(this,"提示","文件不存在!",QMessageBox::Ok);
+        return ;
+    }
+    QString memo = ui->lineEditMemo->text();
+    QString fileType ;
+    QString taskType ;
+    if(ui->radioButtonNum->isChecked())
+        fileType = "1";
+    if(ui->radioButtonSeg->isChecked())
+        fileType = "2";
+    if(this->ui->checkBoxMultiTask->isChecked())
+        taskType = "2";
+    else
+        taskType = "1";
+    if(!prepareAddFile(filePath,fileType,taskType,memo))
+        return ;
+    emit dataUpdated();
+    emit buttonCloseClicked();
+}
+
+bool FormUpload::prepareAddFile(QString filePath,QString fileType,QString taskType,QString memo)
+{
+    QFileInfo fileInfo(filePath);
+    QString suffix = fileInfo.suffix();
+    int size = fileInfo.size()/1024/1024;
+    QStringList cacheFiles;
+    if(taskType=="1")//如果是单任务
+    {
+        cacheFiles << filePath;
+    }
+    else//如果是多任务
+    {
+        if(fileType=="2")//当文件类型为号段文件时,文件必须是文本格式,且到不能大于1M
+        {
+            if(suffix.toLower()!="txt" || size > 1)
+            {
+                QMessageBox::critical(this,"提示","号段文件必须文本格式,且文件大小不能大于1M",QMessageBox::Ok);
+                return false;
+            }
+            cacheFiles = createCacheFilesBySegment(filePath);
+        }
+        else//当文件类型为号码文件时
+        {
+            if(suffix.toLower()=="txt")
+            {
+                cacheFiles << filePath;
+            }
+            else
+            {
+                cacheFiles = createCacheFilesByUnzip(filePath);
+            }
+        }
+    }
+    if(cacheFiles.size()==0)
+    {
+        QMessageBox::critical(this,"提示","您选择多任务模式,但无法对文件进行拆分,请检查文件格式是否有效",QMessageBox::Ok);
+        return false;
+    }
+    addUploadFile(cacheFiles,memo,fileType);
+    return true;
+}
+
+QString FormUpload::prepareTempDir()
+{
+    QString userCode = m_userCode;
+    QString timeStamp = QDateTime::currentDateTime().toString("yyyyMMddhhmmss");
+    QString cachePath = QCoreApplication::applicationDirPath()+\
+            QString("/../data/%1/cache/bzjc/upload/%2/").arg(userCode).arg(timeStamp);
+    QDir dir;
+    dir.mkpath(cachePath);
+    return cachePath;
+}
+
+QStringList FormUpload::createCacheFilesBySegment(QString filePath)
+{
+    //读取文件内容并按照行分拆成单个文件
+    QFile fileRead(filePath);
+    QString cachePath = prepareTempDir();
+    QStringList cacheFiles;
+    bool succeed = true;
+    if(cachePath.isEmpty())
+    {
+        QMessageBox::critical(this,"提示","创建缓存目录失败",QMessageBox::Ok);
+        succeed = false;
+    }
+    if(!fileRead.open(QIODevice::ReadOnly))
+    {
+        QMessageBox::critical(this,"提示","文件读取失败",QMessageBox::Ok);
+        fileRead.close();
+        succeed = false;
+    }
+    if(!succeed)
+    {
+        cacheFiles.clear();
+        return cacheFiles;
+    }
+    QTextStream in(&fileRead);
+    while(!in.atEnd())
+    {
+        QString line = in.readLine().trimmed();
+        if(!line.isEmpty())
+        {
+            QString cacheFile = cachePath + line + ".txt";
+            QFile fileWrite(cacheFile);
+            if(!fileWrite.open(QIODevice::WriteOnly))
+            {
+                QMessageBox::critical(this,"提示","创建缓存文件失败",QMessageBox::Ok);
+                fileWrite.close();
+                succeed = false;
+                break;
+            }
+            QTextStream out(&fileWrite);
+            out<<line;
+            fileWrite.close();
+            cacheFiles<<cacheFile;
+        }
+    }
+    if(!succeed)
+    {
+        cacheFiles.clear();
+    }
+    return cacheFiles;
+}
+
+QStringList FormUpload::createCacheFilesByUnzip(QString filePath)
+{
+    QString cachePath = prepareTempDir();
+    QStringList cacheFiles;
+    bool succeed = true;
+    if(cachePath.isEmpty())
+    {
+        QMessageBox::critical(this,"提示","创建缓存目录失败",QMessageBox::Ok);
+        succeed = false;
+    }
+    if(!succeed)
+    {
+        cacheFiles.clear();
+        return cacheFiles;
+    }
+    //调用7z进行解压缩
+    QProcess process;
+    process.setWorkingDirectory(QCoreApplication::applicationDirPath());
+    process.start("\"" + QCoreApplication::applicationDirPath() + "/7ze.exe\" e \"" + filePath\
+                  + "\" -o\"" + cachePath +"\" -y");
+    process.waitForFinished();
+    QDir dir(cachePath);
+    QFileInfoList list = dir.entryInfoList();
+    for(int i=0;i<list.size();i++)
+    {
+        if(list.at(i).isFile())
+        {
+            if(list.at(i).suffix().toLower()=="txt")
+                cacheFiles<<list.at(i).absoluteFilePath();
+        }
+    }
+    if(cacheFiles.size()==0)
+    {
+        QMessageBox::critical(this,"提示","压缩包无法解压或者没有包含有效的TXT文件",QMessageBox::Ok);
+    }
+    return cacheFiles;
+}
+
+void FormUpload::addUploadFile(QStringList filePaths, QString memo, QString fileType)
+{
+    for(int i=0;i<filePaths.size();i++)
+    {
+        QString filePath = filePaths.at(i);
+        QFileInfo fileInfo(filePath);
+        QString fileName = fileInfo.fileName();
+        SNCDataBase::addFileUpload("bzjc",m_clientID,m_userCode,fileName,filePath,fileType,"1",memo);
+    }
+}
+
+void FormUpload::on_pushButtonClose_clicked()
+{
+    emit buttonCloseClicked();
+}
+

+ 41 - 0
sncprojects/lib/SNCWool/formupload.h

@@ -0,0 +1,41 @@
+#ifndef FORMUPLOAD_H
+#define FORMUPLOAD_H
+#include <QtGui>
+#include <QWidget>
+namespace Ui {
+class FormUpload;
+}
+
+class FormUpload : public QWidget
+{
+    Q_OBJECT
+    
+public:
+    explicit FormUpload(QWidget *parent = 0);
+    void setUserCode(QString userCode);
+    void setClientID(QString clientID);
+    ~FormUpload();
+signals:
+    void dataUpdated();
+    void buttonCloseClicked();
+private slots:
+    void on_pushButtonClose_clicked();
+    void on_pushButtonSubmit_clicked();
+    void on_pushButtonOpen_clicked();
+
+private:
+    void initVariables();
+    void resetUI();
+    bool prepareAddFile(QString filePath,QString fileType,QString taskType,QString memo);
+    QString prepareTempDir();
+    QStringList createCacheFilesBySegment(QString filePath);
+    QStringList createCacheFilesByUnzip(QString filePath);
+    void addUploadFile(QStringList filePaths,QString memo,QString fileType);
+
+private:
+    Ui::FormUpload *ui;
+    QString m_userCode;
+    QString m_clientID;
+};
+
+#endif // FORMUPLOAD_H

+ 210 - 0
sncprojects/lib/SNCWool/formupload.ui

@@ -0,0 +1,210 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>FormUpload</class>
+ <widget class="QWidget" name="FormUpload">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>409</width>
+    <height>195</height>
+   </rect>
+  </property>
+  <property name="sizePolicy">
+   <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+    <horstretch>0</horstretch>
+    <verstretch>0</verstretch>
+   </sizepolicy>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_5">
+   <property name="topMargin">
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QWidget" name="widget" native="true">
+     <layout class="QVBoxLayout" name="verticalLayout_2">
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout">
+        <item>
+         <widget class="QLabel" name="label">
+          <property name="text">
+           <string>文件信息:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLineEdit" name="lineEditFilePath"/>
+        </item>
+        <item>
+         <widget class="QPushButton" name="pushButtonOpen">
+          <property name="minimumSize">
+           <size>
+            <width>0</width>
+            <height>20</height>
+           </size>
+          </property>
+          <property name="maximumSize">
+           <size>
+            <width>16777215</width>
+            <height>20</height>
+           </size>
+          </property>
+          <property name="text">
+           <string>打开...</string>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_5">
+        <item>
+         <widget class="QLabel" name="label_2">
+          <property name="text">
+           <string>备注信息:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLineEdit" name="lineEditMemo"/>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_6">
+        <item>
+         <widget class="QLabel" name="label_3">
+          <property name="text">
+           <string>任务类型:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QRadioButton" name="radioButtonNum">
+          <property name="text">
+           <string>号码文件</string>
+          </property>
+          <property name="checked">
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QRadioButton" name="radioButtonSeg">
+          <property name="text">
+           <string>号段文件</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <spacer name="horizontalSpacer_9">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item>
+         <widget class="QCheckBox" name="checkBoxMultiTask">
+          <property name="text">
+           <string>启用多任务模式</string>
+          </property>
+          <property name="checked">
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <widget class="QWidget" name="widget_3" native="true">
+        <layout class="QHBoxLayout" name="horizontalLayout_8">
+         <property name="margin">
+          <number>0</number>
+         </property>
+        </layout>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLabel" name="label_4">
+        <property name="text">
+         <string>注:多任务模式是指当文件为“号段文件”,或者是“号码文件”(必须是压缩包格式)被拆分成多个文件进行处理。</string>
+        </property>
+        <property name="wordWrap">
+         <bool>true</bool>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <spacer name="verticalSpacer">
+        <property name="orientation">
+         <enum>Qt::Vertical</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>0</width>
+          <height>0</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_3">
+     <item>
+      <spacer name="horizontalSpacer_3">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="pushButtonSubmit">
+       <property name="text">
+        <string>确定</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="pushButtonClose">
+       <property name="text">
+        <string>取消</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 208 - 0
sncprojects/lib/SNCWool/formwool.cpp

@@ -0,0 +1,208 @@
+#include "formwool.h"
+#include "ui_formwool.h"
+#include "sncdatabase.h"
+#include "respgetsysparam.h"
+
+FormWool::FormWool(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::FormWool)
+{
+    qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
+           <<"FormWool Creating.";
+    ui->setupUi(this);
+
+    initVariables();
+    initUI();
+
+    qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
+           <<"FormWool Created.";
+}
+
+FormWool::~FormWool()
+{
+    stopService();
+    delete m_timerTask;
+    delete m_upload;
+    delete m_sync;
+    delete m_formDealing;
+    delete m_formAd;
+    delete m_formCharge;
+    delete m_formFee;
+    delete m_formUpload;
+    delete ui;
+
+    qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
+           <<"FormWool Destroyed.";
+}
+
+void FormWool::initVariables()
+{
+
+    m_timerTask = new QTimer();
+//    m_timerHeartBeat = new QTimer();
+
+//    m_login = new AutoLogin();
+
+    m_upload = new AutoUploadFile();
+    m_sync = new AutoSyncData();
+    m_formDealing = new FormWoolDealing();
+
+    m_formAd = new FormAd();
+    m_formAccount = new FormAccountInfo();
+
+    m_formFinished = new FormWoolFinished();
+    m_formFee = new FormWoolFee();
+    m_formCharge = new FormWoolCharge();
+    m_formUpload = new FormWoolUpload();
+
+    connect(m_timerTask,SIGNAL(timeout()),this,SLOT(onTimeOutTask()));
+//    connect(m_timerHeartBeat,SIGNAL(timeout()),this,SLOT(onTimeOutHeartBeat()));
+
+    connect(m_upload,SIGNAL(uploadFailed()),m_formUpload,SLOT(onDataUpdated()));
+    connect(m_upload,SIGNAL(uploadSucceed()),m_formUpload,SLOT(onDataUpdated()));
+    connect(m_upload,SIGNAL(uploadProgressUpdated()),m_formUpload,SLOT(onDataUpdated()));
+
+    connect(m_upload,SIGNAL(uploadSucceed()),m_formAccount,SLOT(onDataUpdated()));
+
+    connect(m_sync,SIGNAL(dataSync()),m_formDealing,SLOT(onDataUpdated()));
+    connect(m_sync,SIGNAL(dataSync()),m_formFinished,SLOT(onDataUpdated()));
+    connect(m_sync,SIGNAL(dataSync()),m_formUpload,SLOT(onDataUpdated()));
+
+//    connect(m_login,SIGNAL(loginFinished(QMap<QString,QString>)),m_formDealing,SLOT(setAccountInfo(QMap<QString,QString>)));
+//    connect(m_login,SIGNAL(loginFinished(QMap<QString,QString>)),m_formUpload,SLOT(setAccountInfo(QMap<QString,QString>)));
+//    connect(m_login,SIGNAL(loginFinished(QMap<QString,QString>)),m_upload,SLOT(setAccountInfo(QMap<QString,QString>)));
+
+//    connect(m_login,SIGNAL(loginFinished(QMap<QString,QString>)),m_formAd,SLOT(setAccountInfo(QMap<QString,QString>)));
+//    connect(m_login,SIGNAL(loginFinished(QMap<QString,QString>)),m_formAccount,SLOT(setAccountInfo(QMap<QString,QString>)));
+
+//    connect(m_login,SIGNAL(loginFinished(QMap<QString,QString>)),m_formFinished,SLOT(setAccountInfo(QMap<QString,QString>)));
+//    connect(m_login,SIGNAL(loginFinished(QMap<QString,QString>)),m_formCharge,SLOT(setAccountInfo(QMap<QString,QString>)));
+//    connect(m_login,SIGNAL(loginFinished(QMap<QString,QString>)),m_formFee,SLOT(setAccountInfo(QMap<QString,QString>)));
+
+//    connect(m_login,SIGNAL(loginFinished(QMap<QString,QString>)),m_upload,SLOT(setAccountInfo(QMap<QString,QString>)));
+//    connect(m_login,SIGNAL(loginFinished(QMap<QString,QString>)),m_sync,SLOT(setAccountInfo(QMap<QString,QString>)));
+//    connect(m_login,SIGNAL(loginFinished(QMap<QString,QString>)),m_heartbeat,SLOT(setAccountInfo(QMap<QString,QString>)));
+
+//    connect(m_login,SIGNAL(loginFinished(QMap<QString,QString>)),this,SLOT(onLoginFinished(QMap<QString,QString>)));
+
+
+    connect(m_formAccount,SIGNAL(buttonLoginClick()),this,SIGNAL(buttonLoginClick()));
+    connect(m_formAccount,SIGNAL(blanceIn()),m_formDealing,SLOT(onBalanceIn()));
+    connect(m_formAccount,SIGNAL(blanceOut()),m_formDealing,SLOT(onBalanceOut()));
+
+}
+
+void FormWool::initUI()
+{
+    ui->verticalLayoutAd->addWidget(m_formAd);
+    ui->horizontalLayoutAccount->addWidget(m_formAccount);
+    ui->verticalLayoutUpload->addWidget(m_formUpload);
+    ui->verticalLayoutUpload->addWidget(m_formDealing);
+
+    ui->verticalLayoutFinished->addWidget(m_formFinished);
+    ui->verticalLayoutCharge->addWidget(m_formCharge);
+    ui->verticalLayoutFee->addWidget(m_formFee);
+
+}
+
+void FormWool::setAccountInfo(QMap<QString, QString> info)
+{
+    if(!info.value("ssohash").isEmpty())
+    {
+        m_account = info;
+//        stopService();
+        m_upload->setAccountInfo(info);
+        m_sync->setAccountInfo(info);
+
+        m_formDealing->setAccountInfo(info);
+        m_formUpload->setAccountInfo(info);
+        m_formFinished->setAccountInfo(info);
+        m_formAccount->setAccountInfo(info);
+        m_formAd->setAccountInfo(info);
+        m_formCharge->setAccountInfo(info);
+        m_formFee->setAccountInfo(info);
+
+//        m_heartbeat->setAccountInfo(info);
+    }
+    else
+    {/*
+        m_login->setAccountInfo(info);
+        if(!m_login->isRunning())
+        {
+            m_login->start();
+        }*/
+    }
+}
+
+void FormWool::onSyncPause()
+{
+    m_sync->setSkip(true);
+    m_upload->setSkip(true);
+//    m_login->setSkip(true);
+}
+
+void FormWool::onSyncResume()
+{
+    m_sync->setSkip(false);
+    m_upload->setSkip(false);
+//    m_login->setSkip(false);
+}
+
+void FormWool::stopService()
+{
+    if(m_timerTask)
+    {
+        m_timerTask->stop();
+    }
+//    if(m_timerHeartBeat)
+//    {
+//        m_timerHeartBeat->stop();
+//    }
+    if(m_sync)
+    {
+        m_sync->abort();
+        m_sync->wait();
+    }
+    if(m_upload)
+    {
+        m_upload->abort();
+        m_upload->wait();
+    }
+//    if(m_heartbeat)
+//    {
+//        m_heartbeat->abort();
+//        m_heartbeat->wait();
+//    }
+//    if(m_login)
+//    {
+//        m_login->abort();
+//        m_login->wait();
+//    }
+}
+
+void FormWool::onLoginFinished(QMap<QString, QString> info)
+{
+    m_account = info;
+    if(!m_timerTask->isActive())
+    {
+        int interval = 5;
+        m_timerTask->start(interval*1000);
+    }
+//    if(!m_timerHeartBeat->isActive())
+//    {
+//        int interval = 30;
+//        m_timerHeartBeat->start(interval*1000);
+//    }
+}
+
+void FormWool::onTimeOutTask()
+{
+    if(!m_upload->isRunning())
+    {
+        m_upload->start();
+    }
+    if(!m_sync->isRunning())
+    {
+        m_sync->start();
+    }
+}

+ 69 - 0
sncprojects/lib/SNCWool/formwool.h

@@ -0,0 +1,69 @@
+#ifndef FORMWOOL_H
+#define FORMWOOL_H
+
+#include "SNCWool_global.h"
+#include <QWidget>
+#include <QtGui>
+//#include "autologin.h"
+#include "autouploadfile.h"
+#include "autosyncdata.h"
+#include "formwooldealing.h"
+#include "formad.h"
+#include "formaccountinfo.h"
+#include "formwoolfinished.h"
+#include "formwoolcharge.h"
+#include "formwoolfee.h"
+#include "formwoolupload.h"
+
+namespace Ui {
+class FormWool;
+}
+
+class SNCWOOLSHARED_EXPORT FormWool : public QWidget
+{
+    Q_OBJECT
+    
+public:
+    explicit FormWool(QWidget *parent = 0);
+    void stopService();
+    ~FormWool();
+
+public slots:
+    void setAccountInfo(QMap<QString,QString> info);
+    void onSyncPause();
+    void onSyncResume();
+
+signals:
+    void buttonLoginClick();
+
+private:
+    void initVariables();
+    void initUI();
+
+private slots:
+    void onTimeOutTask();
+    void onLoginFinished(QMap<QString,QString> info);
+
+private:
+    Ui::FormWool *ui;
+
+    QString m_host;
+    QString m_port;
+    QMap<QString,QString> m_account;
+
+//    QTimer *m_timerHeartBeat;
+    QTimer *m_timerTask;
+
+    FormWoolDealing *m_formDealing;
+    FormAd *m_formAd;
+    FormAccountInfo *m_formAccount;
+    FormWoolFinished *m_formFinished;
+    FormWoolCharge *m_formCharge;
+    FormWoolFee *m_formFee;
+    FormWoolUpload *m_formUpload;
+    AutoUploadFile *m_upload;
+    AutoSyncData *m_sync;
+//    AutoLogin *m_login;
+};
+
+#endif // FORMWOOL_H

+ 104 - 0
sncprojects/lib/SNCWool/formwool.ui

@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>FormWool</class>
+ <widget class="QWidget" name="FormWool">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QHBoxLayout" name="horizontalLayout">
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayoutBody">
+     <property name="spacing">
+      <number>6</number>
+     </property>
+     <property name="topMargin">
+      <number>0</number>
+     </property>
+     <item>
+      <layout class="QHBoxLayout" name="horizontalLayoutAccount">
+       <property name="spacing">
+        <number>0</number>
+       </property>
+      </layout>
+     </item>
+     <item>
+      <widget class="QTabWidget" name="tabWidget">
+       <property name="currentIndex">
+        <number>0</number>
+       </property>
+       <widget class="QWidget" name="tabUpload">
+        <attribute name="title">
+         <string>上传数据</string>
+        </attribute>
+        <layout class="QVBoxLayout" name="verticalLayoutUpload">
+         <property name="spacing">
+          <number>0</number>
+         </property>
+         <property name="margin">
+          <number>0</number>
+         </property>
+        </layout>
+       </widget>
+       <widget class="QWidget" name="tabDownload">
+        <attribute name="title">
+         <string>下载数据</string>
+        </attribute>
+        <layout class="QVBoxLayout" name="verticalLayoutFinished">
+         <property name="spacing">
+          <number>0</number>
+         </property>
+         <property name="margin">
+          <number>0</number>
+         </property>
+        </layout>
+       </widget>
+       <widget class="QWidget" name="tabFee">
+        <attribute name="title">
+         <string>费用查询</string>
+        </attribute>
+        <layout class="QVBoxLayout" name="verticalLayoutFee">
+         <property name="spacing">
+          <number>0</number>
+         </property>
+         <property name="margin">
+          <number>0</number>
+         </property>
+        </layout>
+       </widget>
+       <widget class="QWidget" name="tabCharge">
+        <attribute name="title">
+         <string>充值查询</string>
+        </attribute>
+        <layout class="QVBoxLayout" name="verticalLayoutCharge">
+         <property name="spacing">
+          <number>0</number>
+         </property>
+         <property name="margin">
+          <number>0</number>
+         </property>
+        </layout>
+       </widget>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <layout class="QVBoxLayout" name="verticalLayoutAd">
+     <property name="spacing">
+      <number>0</number>
+     </property>
+    </layout>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 352 - 0
sncprojects/lib/SNCWool/formwoolcharge.cpp

@@ -0,0 +1,352 @@
+#include "formwoolcharge.h"
+#include "ui_formwoolcharge.h"
+#include "dialogsubmitresponsedetail.h"
+#include "respgetchargeinfo.h"
+FormWoolCharge::FormWoolCharge(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::FormWoolCharge)
+{
+    ui->setupUi(this);
+    initVariables();
+    initUI();
+    setTableWidgetNoData(ui->tableWidget);
+}
+
+FormWoolCharge::~FormWoolCharge()
+{
+    m_movie->stop();
+    m_wool->abort();
+    delete m_wool;
+    delete m_movie;
+    delete ui;
+    qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
+           <<"FormWool.FormWoolCharge Destroyed.";
+}
+void FormWoolCharge::initVariables()
+{
+    ui->dateEditStart->setDate(QDate::currentDate().addDays(-30));
+    ui->dateEditEnd->setDate(QDate::currentDate());
+
+    m_state = NotLogin;
+    m_movie = new QMovie(":/working.gif");
+    m_movie->start();
+    m_wool = new WSWool();
+
+    m_keys<<"chargeid"<<"usercode"<<"chargetime"<<"chargemoney"<<"giftmoney";
+
+    m_headers<<"编号"<<"所属用户"<<"充值时间"<<"充值金额"<<"赠送金额";
+}
+void FormWoolCharge::setAccountInfo(QMap<QString, QString> info)
+{
+    m_account = info;
+    QString ssoHash = info.value("ssohash");
+    QString userCode = info.value("usercode");
+    QString userHash = info.value("userhash");
+    if(!ssoHash.isEmpty())
+    {
+        if(!userHash.isEmpty())
+        {
+            m_state = LoginOk;
+        }
+        else
+        {
+            if(!userCode.isEmpty())
+            {
+                m_state = LoginError;
+            }
+            else
+            {
+                m_state = NotBind;
+            }
+        }
+    }
+    else
+    {
+        m_state = NotLogin;
+    }
+    if(m_state!=LoginOk)
+    {
+        setTableWidgetNoData(ui->tableWidget);
+    }
+}
+
+void FormWoolCharge::setClientName(QString name)
+{
+    m_clientName = name;
+}
+
+void FormWoolCharge::setClientID(QString clientID)
+{
+    m_clientID = clientID;
+}
+
+void FormWoolCharge::setHost(QString host, QString port)
+{
+    m_host = host;
+    m_port = port;
+//    m_wool->setHost(host,port);
+}
+
+void FormWoolCharge::initUI()
+{
+    ui->tableWidget->setColumnCount(m_headers.size());
+    ui->tableWidget->setHorizontalHeaderLabels(m_headers);
+
+    ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
+    ui->tableWidget->setShowGrid(false);
+    ui->tableWidget->setAlternatingRowColors(true);
+    ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
+    ui->tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
+    ui->tableWidget->verticalHeader()->setVisible(false);
+    ui->tableWidget->horizontalHeader()->setStyleSheet("font:12px");
+    ui->tableWidget->horizontalHeader()->setResizeMode(QHeaderView::Fixed);
+    ui->tableWidget->verticalHeader()->setResizeMode(QHeaderView::Fixed);
+    ui->tableWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    ui->tableWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
+    ui->tableWidget->verticalHeader()->setFixedWidth(30);
+    ui->tableWidget->setSortingEnabled(true);
+
+    ui->tableWidget->setColumnWidth(0,50);
+    ui->tableWidget->setColumnWidth(1,115);
+    ui->tableWidget->setColumnWidth(2,140);
+    ui->tableWidget->setColumnWidth(3,195);
+    ui->tableWidget->setColumnWidth(4,175);
+}
+
+void FormWoolCharge::setTableWidgetNoData(QTableWidget *tableWidget)
+{
+    prepareTableWidgetCells(tableWidget,15);
+    tableWidget->setEnabled(false);
+    QTableWidgetItem *item = new QTableWidgetItem();
+    item->setTextAlignment(Qt::AlignLeft|Qt::AlignVCenter);
+    item->setText("暂无信息");
+    tableWidget->setItem(6,3,item);
+}
+
+void FormWoolCharge::prepareTableWidgetCells(QTableWidget *tableWidget, int rows)
+{
+    tableWidget->setRowCount(0);
+    tableWidget->setRowCount(rows);
+}
+
+void FormWoolCharge::fillDataList(QTableWidget *tableWidget,QStringList keys,
+                                   QMultiMap<QString, QString> list, int rowCount)
+{
+    setTableWidgetNoData(tableWidget);
+    if(rowCount==0)
+    {
+        return ;
+    }
+    prepareTableWidgetCells(tableWidget,rowCount);
+    tableWidget->setEnabled(true);
+    for(int row = 0;row < rowCount;row++)
+    {
+        QMap<QString,QString> map;
+        for(int col=0;col<keys.size();col++)
+        {
+            QString key = keys.at(col);
+            QString value = list.values(key).at(row);
+            map.insert(key,value);
+        }
+        for(int col=0;col<keys.size();col++)
+        {
+            QString key = keys.at(col);
+            QString value = list.values(key).at(row);
+            setCellElement(tableWidget,row,col,key,value,map);
+        }
+    }
+
+    tableWidget->sortByColumn(0);
+    tableWidget->sortByColumn(0);
+}
+void FormWoolCharge::setCellElement(QTableWidget *tableWidget, int row, int col,
+                                     QString key,QString value,QMap<QString,QString> data)
+{
+    QTableWidgetItem* item = new QTableWidgetItem();
+    QVariant display = value;
+    QVariant tooltip = value;
+    item->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
+    //进行数据翻译
+    if(key=="chargeid")
+    {
+        display = value.toInt();
+    }
+    else if(key=="chargemoney")
+    {
+        display = value.toDouble();
+    }
+    else if(key=="giftmoney")
+    {
+        display = value.toDouble();
+    }
+
+    //设置单元格显示形式,是用item填充还是widget填充
+
+    item->setData(Qt::DisplayRole,display);
+    item->setData(Qt::UserRole,value);
+    item->setData(Qt::ToolTipRole,tooltip);
+    tableWidget->setItem(row,col,item);
+
+}
+void FormWoolCharge::query()
+{
+    QString dateStart = ui->dateEditStart->text();
+    QString dateEnd = ui->dateEditEnd->text();
+    QString userHash = m_account.value("userhash");
+    QString json = m_wool->GetChargeInfo(dateStart, dateEnd, userHash);
+    QMultiMap<QString,QString> list;
+    RespGetChargeInfo response(json);
+    if(response.getRtnCode()>=0)
+    {
+        list = response.getRs();
+    }
+    else
+    {
+        QMessageBox::critical(this,"提示",response.getRtnMemo(),QMessageBox::Ok);
+        return ;
+    }
+    int cols = list.uniqueKeys().size();
+    int rows = 0;
+    if(cols!=0)
+        rows = list.size()/cols;
+    if(list.size()==0)
+    {
+        setTableWidgetNoData(ui->tableWidget);
+        return ;
+    }
+    QStringList ids;
+    QString curId;
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            if(item->checkState()==Qt::Checked)
+            {
+                ids<<item->data(Qt::UserRole).toString();
+            }
+            if(item->isSelected())
+            {
+                curId = item->data(Qt::UserRole).toString();
+            }
+        }
+    }
+    fillDataList(ui->tableWidget,m_keys,list,rows);
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        if(curId.isEmpty())
+        {
+            ui->tableWidget->selectRow(i);
+            ui->tableWidget->setFocus();
+            break;
+        }
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            QString id = item->data(Qt::UserRole).toString();
+            if(curId==id)
+            {
+                ui->tableWidget->selectRow(i);
+                ui->tableWidget->setFocus();
+            }
+            for(int i=0;i<ids.size();i++)
+            {
+                if(id==ids.at(i))
+                {
+                    item->setCheckState(Qt::Checked);
+                    break;
+                }
+            }
+        }
+    }
+}
+
+void FormWoolCharge::showRtnMessage(int row)
+{
+    QTableWidgetItem *itemMsg = ui->tableWidget->item(row,8);
+    QTableWidgetItem *itemDetail = ui->tableWidget->item(row,9);
+    QString errMsg = "";
+    QString errDetail = "";
+    if(itemMsg)
+    {
+        errMsg = itemMsg->data(Qt::UserRole).toString();
+    }
+    if(itemDetail)
+    {
+        errDetail = itemDetail->data(Qt::UserRole).toString();
+    }
+    if(errDetail.isEmpty())
+    {
+        if(!errMsg.isEmpty())
+        {
+             QMessageBox::critical(this,"提示",errMsg,QMessageBox::Ok);
+        }
+    }
+    else
+    {
+        DialogSubmitResponseDetail dialog;
+        dialog.setDetailText(errDetail);
+        dialog.exec();
+    }
+}
+
+
+
+
+void FormWoolCharge::onDataUpdated()
+{
+    query();
+}
+bool FormWoolCharge::chkAccountState(AccountLoginState state)
+{
+
+    bool ret = false;
+    switch(state)
+    {
+        case NotLogin:
+            QMessageBox::critical(this,"提示","您现在还没有登录系统,请登录后再操作!",QMessageBox::Ok);
+            break;
+        case NotBind:
+            QMessageBox::critical(this,"提示","此项服务尚未开通,请开通后再操作!",QMessageBox::Ok);
+            break;
+        case LoginError:
+            QMessageBox::critical(this,"提示","此项服务暂时无法连接,请稍候重试!",QMessageBox::Ok);
+            break;
+        default:
+            ret = true;
+    }
+    return ret;
+}
+void FormWoolCharge::on_pushButtonQuery_clicked()
+{
+    if(!chkAccountState(m_state))
+        return;
+    if(!checkLastClickTime(sender()))
+        return ;
+
+    ui->labelState->setText("正在查询,请稍候...");
+    ui->labelState->setStyleSheet("QLabel{color:#08a61b;font:12px;font-weight: bold;}");
+    ui->pushButtonQuery->setEnabled(false);
+    setCursor(Qt::WaitCursor);
+    query();
+    setCursor(Qt::ArrowCursor);
+    ui->labelState->setText("");
+    ui->pushButtonQuery->setEnabled(true);
+}
+bool FormWoolCharge::checkLastClickTime(QObject *button)
+{
+    QPushButton *btn = qobject_cast<QPushButton*>(button);
+
+    QDateTime lasttime = m_clickTime.value(btn->objectName());
+    if(!lasttime.isNull())
+    {
+        if(lasttime.addSecs(30)>QDateTime::currentDateTime())
+        {
+            QMessageBox::critical(this,"提示","您不可以频繁点击!",QMessageBox::Ok);
+            return false;
+        }
+    }
+    m_clickTime.insert(btn->objectName(),QDateTime::currentDateTime());
+    return true;
+
+}

+ 60 - 0
sncprojects/lib/SNCWool/formwoolcharge.h

@@ -0,0 +1,60 @@
+#ifndef FORMWOOLCHARGE_H
+#define FORMWOOLCHARGE_H
+
+#include <QWidget>
+#include <QtGui>
+#include "snccore.h"
+#include "wswool.h"
+namespace Ui {
+class FormWoolCharge;
+}
+
+class FormWoolCharge : public QWidget
+{
+    Q_OBJECT
+    
+public:
+    explicit FormWoolCharge(QWidget *parent = 0);
+    void setClientID(QString clientID);
+    void setHost(QString host,QString port);
+    ~FormWoolCharge();
+public slots:
+    void setAccountInfo(QMap<QString,QString> info);
+    void setClientName(QString name);
+private slots:
+
+    void onDataUpdated();
+
+    void on_pushButtonQuery_clicked();
+
+private:
+    void initVariables();                                                       //初始化成员变量
+    void initUI();                                                              //初始化UI样式
+    void setTableWidgetNoData(QTableWidget *tableWidget);                       //设置数据区列表信息为默认状态
+    void prepareTableWidgetCells(QTableWidget *tableWidget,int rows);           //设置table widget单元格
+    void fillDataList(QTableWidget *tableWidget,QStringList keys,
+                      QMultiMap<QString,QString> list,int rowCount);            //填充数据表
+    void setCellElement(QTableWidget *tableWidget, int row, int col,
+                        QString key,QString value,QMap<QString,QString> data);  //设置单元格内容
+    void query();
+    void showRtnMessage(int row);
+    bool chkAccountState(AccountLoginState state);
+    bool checkLastClickTime(QObject *button);
+private:
+    Ui::FormWoolCharge *ui;
+
+    QString m_host;
+    QString m_port;
+    QString m_clientName;
+    QString m_clientID;
+
+    QMap<QString,QString> m_account;
+    QMovie *m_movie;
+    QStringList m_keys;
+    QStringList m_headers;
+    AccountLoginState m_state;
+    WSWool *m_wool;
+    QMap<QString,QDateTime> m_clickTime;
+};
+
+#endif // FORMWOOLCHARGE_H

+ 75 - 0
sncprojects/lib/SNCWool/formwoolcharge.ui

@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>FormWoolCharge</class>
+ <widget class="QWidget" name="FormWoolCharge">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>449</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <spacer name="horizontalSpacer_2">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QLabel" name="labelState">
+       <property name="text">
+        <string/>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLabel" name="label_5">
+       <property name="text">
+        <string>开始日期:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QDateEdit" name="dateEditStart"/>
+     </item>
+     <item>
+      <widget class="QLabel" name="label_6">
+       <property name="text">
+        <string>结束日期:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QDateEdit" name="dateEditEnd"/>
+     </item>
+     <item>
+      <widget class="QPushButton" name="pushButtonQuery">
+       <property name="text">
+        <string>查询</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QTableWidget" name="tableWidget"/>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 542 - 0
sncprojects/lib/SNCWool/formwooldealing.cpp

@@ -0,0 +1,542 @@
+#include "formwooldealing.h"
+#include "ui_formwooldealing.h"
+#include "xprogressbar.h"
+#include "sncdatabase.h"
+#include "dialogsubmitresponsedetail.h"
+#include "dialogsubmit.h"
+
+FormWoolDealing::FormWoolDealing(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::FormWoolDealing)
+{
+    ui->setupUi(this);
+    initVariables();
+    initUI();
+    setTableWidgetNoData(ui->tableWidget);
+}
+
+FormWoolDealing::~FormWoolDealing()
+{
+    m_movie->stop();
+    m_movieBig->stop();
+    delete m_movieBig;
+    delete m_movie;
+    delete ui;
+    qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
+           <<"FormWool.FormWoolDealing Destroyed.";
+}
+
+void FormWoolDealing::initVariables()
+{
+    m_movie = new QMovie(":/working.gif");
+    m_movie->start();
+    m_movieBig = new QMovie(":/fetchfromserver.gif");
+    m_movieBig->start();
+    m_blanceOut = false;
+    m_state = NotLogin;
+    m_keys<<"optstatus"<<"batchid"<<"detail"<<"submittime"<<"numcount"<<"dlcount"<<"isverify"<<"tftime"<<"finishcount";
+
+    m_headers<<"状态"<<"任务单号"<<"详情"<<"提交时间"<<"号码总数"<<"已检测"<<"是否审核"<<"交付时间"<<"检测进度";
+
+}
+
+void FormWoolDealing::setAccountInfo(QMap<QString, QString> info)
+{
+    m_account = info;
+    QString ssoHash = info.value("ssohash");
+    QString userCode = info.value("usercode");
+    QString userHash = info.value("userhash");
+    if(!ssoHash.isEmpty())
+    {
+        if(!userHash.isEmpty())
+        {
+            m_state = LoginOk;
+            setTableWidgetSyncData(ui->tableWidget);
+        }
+        else
+        {
+            if(!userCode.isEmpty())
+            {
+                m_state = LoginError;
+            }
+            else
+            {
+                m_state = NotBind;
+            }
+        }
+    }
+    else
+    {
+        m_state = NotLogin;
+    }
+    if(m_state!=LoginOk)
+    {
+        setTableWidgetNoData(ui->tableWidget);
+    }
+}
+
+void FormWoolDealing::setClientName(QString name)
+{
+    m_clientName = name;
+}
+
+void FormWoolDealing::setClientID(QString clientID)
+{
+    m_clientID = clientID;
+}
+
+void FormWoolDealing::initUI()
+{
+    ui->tableWidget->setColumnCount(m_headers.size());
+    ui->tableWidget->setHorizontalHeaderLabels(m_headers);
+
+    ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
+    ui->tableWidget->setShowGrid(false);
+    ui->tableWidget->setAlternatingRowColors(true);
+    ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
+    ui->tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
+    ui->tableWidget->verticalHeader()->setVisible(false);
+    ui->tableWidget->horizontalHeader()->setStyleSheet("font:12px");
+    ui->tableWidget->horizontalHeader()->setResizeMode(QHeaderView::Fixed);
+    ui->tableWidget->verticalHeader()->setResizeMode(QHeaderView::Fixed);
+    ui->tableWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    ui->tableWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
+    ui->tableWidget->verticalHeader()->setFixedWidth(30);
+    ui->tableWidget->setSortingEnabled(true);
+
+    ui->tableWidget->setColumnWidth(0,30);
+    ui->tableWidget->setColumnWidth(1,135);
+    ui->tableWidget->setColumnWidth(2,0);//
+    ui->tableWidget->setColumnWidth(3,130);
+    ui->tableWidget->setColumnWidth(4,130);
+    ui->tableWidget->setColumnWidth(5,79);//
+    ui->tableWidget->setColumnWidth(6,0);
+    ui->tableWidget->setColumnWidth(7,0);
+    ui->tableWidget->setColumnWidth(8,170);
+
+    m_headers<<"状态"<<"任务单号"<<"详情"<<"提交时间"<<"号码总数"<<"已检测"<<"是否审核"<<"交付时间"<<"检测进度";
+}
+
+void FormWoolDealing::setTableWidgetNoData(QTableWidget *tableWidget)
+{
+    prepareTableWidgetCells(tableWidget,10);
+    tableWidget->setEnabled(false);
+    QTableWidgetItem *item = new QTableWidgetItem();
+    item->setTextAlignment(Qt::AlignLeft|Qt::AlignVCenter);
+    item->setText("   暂无信息");
+    tableWidget->setItem(5,4,item);
+}
+
+void FormWoolDealing::setTableWidgetSyncData(QTableWidget *tableWidget)
+{
+    prepareTableWidgetCells(tableWidget,10);
+    tableWidget->setEnabled(false);
+    QLabel *lbl = new QLabel();
+
+    QTableWidgetItem *item = new QTableWidgetItem("  正在读取...");
+    lbl->setMovie(m_movieBig);
+    item->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
+    tableWidget->setItem(5,4,item);
+    tableWidget->setCellWidget(5,4,lbl);
+}
+
+void FormWoolDealing::prepareTableWidgetCells(QTableWidget *tableWidget, int rows)
+{
+    tableWidget->setRowCount(0);
+    tableWidget->setRowCount(rows);
+}
+
+void FormWoolDealing::fillDataList(QTableWidget *tableWidget,QStringList keys,
+                                   QMultiMap<QString, QString> list, int rowCount)
+{
+    setTableWidgetNoData(tableWidget);
+    if(rowCount==0)
+    {
+        return ;
+    }
+    prepareTableWidgetCells(tableWidget,rowCount);
+    tableWidget->setEnabled(true);
+    for(int row = 0;row < rowCount;row++)
+    {
+        QMap<QString,QString> map;
+        for(int col=0;col<keys.size();col++)
+        {
+            QString key = keys.at(col);
+
+            QString value = list.values(key).at(row);
+
+            map.insert(key,value);
+
+        }
+        for(int col=0;col<keys.size();col++)
+        {
+            QString key = keys.at(col);
+            QString value = list.values(key).at(row);
+            setCellElement(tableWidget,row,col,key,value,map);
+        }
+    }
+
+    tableWidget->sortByColumn(0);
+    tableWidget->sortByColumn(0);
+}
+
+void FormWoolDealing::setCellElement(QTableWidget *tableWidget, int row, int col,
+                                     QString key,QString value,QMap<QString,QString> data)
+{
+    QTableWidgetItem* item = new QTableWidgetItem();
+    QVariant display = value;
+    QVariant tooltip = value;
+    item->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
+    //进行数据翻译
+    if(key=="batchid")
+    {
+        QString detail = data.value("detail");
+        tooltip =  detail;
+    }
+    else if(key=="numcount")
+    {
+        display = data.value("numcount").toInt();
+        tooltip =  data.value("numcount");
+    }
+    else if(key=="dlcount")
+    {
+        display = data.value("finishcount").toInt();
+        tooltip =  data.value("finishcount");
+    }
+    //设置单元格显示形式,是用item填充还是widget填充
+    if(key=="optstatus")
+    {
+        delete item;
+        QLabel *lbl = new QLabel();
+        lbl->setAlignment(Qt::AlignCenter|Qt::AlignHCenter);
+        QString optstatus = data.value("optstatus");
+        QString isverify = data.value("isverify");
+        QString tftime = data.value("tftime");
+        if(isverify == "0")
+        {
+            if(tftime.isEmpty())
+            {
+
+                if(m_blanceOut)
+                    lbl->setToolTip("等待付款");
+                else
+                    lbl->setToolTip("等待审核");
+                lbl->setPixmap(QPixmap(":/task_lock.png"));
+            }
+            else if(tftime>"2000-01-01 00:00:00")
+            {
+                lbl->setToolTip("等待检测");
+                lbl->setPixmap(QPixmap(":/task_hourglass.png"));
+            }
+            else
+            {
+                if(m_blanceOut)
+                    lbl->setToolTip("等待付款");
+                else
+                    lbl->setToolTip("等待审核");
+                lbl->setPixmap(QPixmap(":/task_lock.png"));
+            }
+            if(optstatus=="-1")
+            {
+                lbl->setToolTip("服务端已经删除或失效");
+                lbl->setPixmap(QPixmap(":/task_error.png"));
+            }
+        }
+        else if(isverify == "2")
+        {
+            lbl->setPixmap(QPixmap(":/task_error.png"));
+            lbl->setToolTip("审核未通过");
+        }
+        else // if(isverify == "1")
+        {
+            if(optstatus == "-1")
+            {
+                lbl->setToolTip("文件已经失效");
+                lbl->setPixmap(QPixmap(":/task_warning.png"));
+            }
+            else if(optstatus == "0")
+            {
+                lbl->setToolTip("停止");
+                //lbl->setPixmap(QPixmap(":/task_stop.png"));
+            }
+            else if(optstatus == "1")
+            {
+                lbl->setToolTip("暂停");
+                lbl->setPixmap(QPixmap(":/task_pause.png"));
+            }
+            else if(optstatus == "2")
+            {
+                lbl->setToolTip("正在检测");
+                lbl->setPixmap(QPixmap(":/task_play.png"));
+            }
+            else if(optstatus == "3")
+            {
+                lbl->setToolTip("正在处理");
+                lbl->setPixmap(QPixmap(":/task_play.png"));
+            }
+            else if(optstatus == "4" || optstatus == "5" || optstatus == "6")
+            {
+                lbl->setToolTip("发生错误");
+                lbl->setPixmap(QPixmap(":/task_error.png"));
+            }
+            else
+            {
+                lbl->setToolTip("上传成功");
+                lbl->setPixmap(QPixmap(":/task_ok.png"));
+            }
+        }
+
+        tableWidget->setCellWidget(row,col,lbl);
+    }
+    else if(key=="finishcount")
+    {
+        delete item;
+        int numcount = data.value("numcount").toInt();
+        int finishcount = data.value("finishcount").toInt();
+        double percent =0;
+        if(numcount>0)
+            percent = finishcount*100.0/numcount;
+        QLabel *lbl = new QLabel();
+        lbl->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
+        XProgressBar *progress = 0;
+
+        QString optstatus = data.value("optstatus");
+        QString isverify = data.value("isverify");
+        QString tftime = data.value("tftime");
+        if(isverify == "0")
+        {
+            if(tftime.isEmpty())
+            {
+                if(m_blanceOut)
+                    lbl->setText("等待付款");
+                else
+                    lbl->setText("等待审核");
+            }
+            else if(tftime>"2000-01-01 00:00:00")
+            {
+                lbl->setText("等待检测");
+            }
+            else
+            {
+                if(m_blanceOut)
+                    lbl->setText("等待付款");
+                else
+                    lbl->setText("等待审核");
+            }
+            if(optstatus=="-1")
+            {
+                lbl->setText("服务端已经删除或失效");
+            }
+
+        }
+        else if(isverify == "2")
+        {
+            lbl->setText("审核未通过");
+        }
+        else // if(isverify == "1")
+        {
+            if(optstatus == "-1")
+            {
+                lbl->setText("文件已经失效");
+            }
+            else if(optstatus == "0")
+            {
+                lbl->setText("停止");
+                //modify by xxw on 2016-7-23
+                //把停止改为状态显示
+                delete lbl;
+                lbl = 0;
+                progress = new XProgressBar();
+            }
+            else if(optstatus == "1")
+            {
+                lbl->setText("暂停");
+            }
+            else if(optstatus == "2")
+            {
+                lbl->setText("正在检测");
+                delete lbl;
+                lbl = 0;
+                progress = new XProgressBar();
+            }
+            else if(optstatus == "3")
+            {
+                lbl->setText("正在处理");
+            }
+            else if(optstatus == "4" || optstatus == "5" || optstatus == "6")
+            {
+                lbl->setText("发生错误");
+            }
+            else
+            {
+                lbl->setText("未知" + optstatus);
+            }
+        }
+
+        if(lbl)
+        {
+            tableWidget->setCellWidget(row,col,lbl);
+        }
+        else
+        {
+            progress->setProgress(3,percent);
+            tableWidget->setCellWidget(row,col,progress);
+        }
+    }
+    else
+    {
+        item->setData(Qt::DisplayRole,display);
+        item->setData(Qt::UserRole,value);
+        item->setData(Qt::ToolTipRole,tooltip);
+        tableWidget->setItem(row,col,item);
+    }
+}
+
+void FormWoolDealing::query()
+{
+    QString userCode = m_account.value("usercode");
+    QMultiMap<QString,QString> list = SNCDataBase::getWoolCheckDealingInfos(userCode,m_clientID);
+    int cols = list.uniqueKeys().size();
+    int rows = 0;
+    if(cols!=0)
+        rows = list.size()/cols;
+    if(list.size()==0)
+    {
+        setTableWidgetNoData(ui->tableWidget);
+        return ;
+    }
+    QStringList ids;
+    QString curId;
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            if(item->checkState()==Qt::Checked)
+            {
+                ids<<item->data(Qt::UserRole).toString();
+            }
+            if(item->isSelected())
+            {
+                curId = item->data(Qt::UserRole).toString();
+            }
+        }
+    }
+    fillDataList(ui->tableWidget,m_keys,list,rows);
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        if(curId.isEmpty())
+        {
+            ui->tableWidget->selectRow(i);
+            ui->tableWidget->setFocus();
+            break;
+        }
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            QString id = item->data(Qt::UserRole).toString();
+            if(curId==id)
+            {
+                ui->tableWidget->selectRow(i);
+                ui->tableWidget->setFocus();
+            }
+            for(int i=0;i<ids.size();i++)
+            {
+                if(id==ids.at(i))
+                {
+                    item->setCheckState(Qt::Checked);
+                    break;
+                }
+            }
+        }
+    }
+}
+
+void FormWoolDealing::showRtnMessage(int row)
+{
+    QTableWidgetItem *itemMsg = ui->tableWidget->item(row,8);
+    QTableWidgetItem *itemDetail = ui->tableWidget->item(row,9);
+    QString errMsg = "";
+    QString errDetail = "";
+    if(itemMsg)
+    {
+        errMsg = itemMsg->data(Qt::UserRole).toString();
+    }
+    if(itemDetail)
+    {
+        errDetail = itemDetail->data(Qt::UserRole).toString();
+    }
+    if(errDetail.isEmpty())
+    {
+        if(!errMsg.isEmpty())
+        {
+             QMessageBox::critical(this,"提示",errMsg,QMessageBox::Ok);
+        }
+    }
+    else
+    {
+        DialogSubmitResponseDetail dialog;
+        dialog.setDetailText(errDetail);
+        dialog.exec();
+    }
+}
+
+void FormWoolDealing::onPushButtonViewsClicked()
+{
+    QPushButton *btn = qobject_cast<QPushButton*>(sender());
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+       QWidget *widget = ui->tableWidget->cellWidget(i,ui->tableWidget->columnCount()-1);
+       if(widget)
+       {
+           if(btn==qobject_cast<QPushButton*>(widget))
+           {
+               showRtnMessage(i);
+               break;
+           }
+       }
+    }
+}
+
+void FormWoolDealing::onDataUpdated()
+{
+    query();
+}
+
+void FormWoolDealing::on_tableWidget_cellDoubleClicked(int row, int column)
+{
+    showRtnMessage(row);
+}
+
+bool FormWoolDealing::chkAccountState(AccountLoginState state)
+{
+
+    bool ret = false;
+    switch(state)
+    {
+        case NotLogin:
+            QMessageBox::critical(this,"提示","您现在还没有登录系统,请登录后再操作!",QMessageBox::Ok);
+            break;
+        case NotBind:
+            QMessageBox::critical(this,"提示","此项服务尚未开通,请开通后再操作!",QMessageBox::Ok);
+            break;
+        case LoginError:
+            QMessageBox::critical(this,"提示","此项服务暂时无法连接,请稍候重试!",QMessageBox::Ok);
+            break;
+        default:
+            ret = true;
+    }
+    return ret;
+}
+
+//add by xw on 2015-11-1 for 5.4.8
+//客户如果余额不足,上传完数据后检测进度的状态请改为“等待付款”,如果余额够就显示为“等待审核”
+void FormWoolDealing::onBalanceOut()
+{
+    m_blanceOut = true;
+}
+
+void FormWoolDealing::onBalanceIn()
+{
+    m_blanceOut = false;
+}

+ 60 - 0
sncprojects/lib/SNCWool/formwooldealing.h

@@ -0,0 +1,60 @@
+#ifndef FORMWOOLDEALING_H
+#define FORMWOOLDEALING_H
+
+#include <QWidget>
+#include <QtGui>
+#include "snccore.h"
+namespace Ui {
+class FormWoolDealing;
+}
+
+class FormWoolDealing : public QWidget
+{
+    Q_OBJECT
+    
+public:
+    explicit FormWoolDealing(QWidget *parent = 0);
+    ~FormWoolDealing();
+public slots:
+    void setAccountInfo(QMap<QString,QString> info);
+    void setClientName(QString name);
+    void setClientID(QString clientID);
+private slots:
+
+    void onPushButtonViewsClicked();
+    void onDataUpdated();
+
+    void on_tableWidget_cellDoubleClicked(int row, int column);
+    void onBalanceOut();
+    void onBalanceIn();
+private:
+    void initVariables();                                                       //初始化成员变量
+    void initUI();                                                              //初始化UI样式
+    void setTableWidgetNoData(QTableWidget *tableWidget);                       //设置数据区列表信息为默认状态
+    void setTableWidgetSyncData(QTableWidget *tableWidget);                       //设置数据区列表信息为同步状态
+    void prepareTableWidgetCells(QTableWidget *tableWidget,int rows);           //设置table widget单元格
+    void fillDataList(QTableWidget *tableWidget,QStringList keys,
+                      QMultiMap<QString,QString> list,int rowCount);            //填充数据表
+    void setCellElement(QTableWidget *tableWidget, int row, int col,
+                        QString key,QString value,QMap<QString,QString> data);  //设置单元格内容
+    void query();
+    void showRtnMessage(int row);
+    bool chkAccountState(AccountLoginState state);
+private:
+    Ui::FormWoolDealing *ui;
+
+    QString m_host;
+    QString m_port;
+    QString m_clientName;
+    QString m_clientID;
+
+    QMap<QString,QString> m_account;
+    QMovie *m_movie;
+    QMovie *m_movieBig;
+    QStringList m_keys;
+    QStringList m_headers;
+    AccountLoginState m_state;
+    bool m_blanceOut;
+};
+
+#endif // FORMWOOLDEALING_H

+ 37 - 0
sncprojects/lib/SNCWool/formwooldealing.ui

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>FormWoolDealing</class>
+ <widget class="QWidget" name="FormWoolDealing">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <property name="topMargin">
+    <number>0</number>
+   </property>
+   <item>
+    <widget class="QLabel" name="label">
+     <property name="text">
+      <string>检测状态监控</string>
+     </property>
+     <property name="alignment">
+      <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+     </property>
+    </widget>
+   </item>
+   <item>
+    <widget class="QTableWidget" name="tableWidget"/>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 358 - 0
sncprojects/lib/SNCWool/formwoolfee.cpp

@@ -0,0 +1,358 @@
+#include "formwoolfee.h"
+#include "ui_formwoolfee.h"
+#include "dialogsubmitresponsedetail.h"
+#include "respgetcostinfo.h"
+
+FormWoolFee::FormWoolFee(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::FormWoolFee)
+{
+    ui->setupUi(this);
+    initVariables();
+    initUI();
+    setTableWidgetNoData(ui->tableWidget);
+}
+
+FormWoolFee::~FormWoolFee()
+{
+    m_movie->stop();
+    m_wool->abort();
+    delete m_wool;
+    delete m_movie;
+    delete ui;
+    qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
+           <<"FormWool.FormWoolFee Destroyed.";
+}
+void FormWoolFee::initVariables()
+{
+    ui->dateEditStart->setDate(QDate::currentDate().addDays(-30));
+    ui->dateEditEnd->setDate(QDate::currentDate());
+
+    m_state = NotLogin;
+    m_movie = new QMovie(":/working.gif");
+    m_movie->start();
+    m_wool = new WSWool();
+
+    m_keys<<"batchid"<<"usercode"<<"submittime"<<"finishtime"<<"numcount"\
+            <<"finishcount"<<"price"<<"settlefee"<<"giftfee";
+
+    m_headers<<"编号"<<"所属用户"<<"提交时间"<<"完成时间"<<"提交数"<<"已检测"<<"单价"<<"费用"<<"赠送消耗";
+}
+void FormWoolFee::setAccountInfo(QMap<QString, QString> info)
+{
+    m_account = info;
+    QString ssoHash = info.value("ssohash");
+    QString userCode = info.value("usercode");
+    QString userHash = info.value("userhash");
+    if(!ssoHash.isEmpty())
+    {
+        if(!userHash.isEmpty())
+        {
+            m_state = LoginOk;
+        }
+        else
+        {
+            if(!userCode.isEmpty())
+            {
+                m_state = LoginError;
+            }
+            else
+            {
+                m_state = NotBind;
+            }
+        }
+    }
+    else
+    {
+        m_state = NotLogin;
+    }
+    if(m_state!=LoginOk)
+    {
+        setTableWidgetNoData(ui->tableWidget);
+    }
+}
+
+void FormWoolFee::setClientName(QString name)
+{
+    m_clientName = name;
+}
+
+void FormWoolFee::setClientID(QString clientID)
+{
+    m_clientID = clientID;
+}
+
+void FormWoolFee::setHost(QString host, QString port)
+{
+    m_host = host;
+    m_port = port;
+//    m_wool->setHost(host,port);
+}
+
+void FormWoolFee::initUI()
+{
+    ui->tableWidget->setColumnCount(m_headers.size());
+    ui->tableWidget->setHorizontalHeaderLabels(m_headers);
+
+    ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
+    ui->tableWidget->setShowGrid(false);
+    ui->tableWidget->setAlternatingRowColors(true);
+    ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
+    ui->tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
+    ui->tableWidget->verticalHeader()->setVisible(false);
+    ui->tableWidget->horizontalHeader()->setStyleSheet("font:12px");
+    ui->tableWidget->horizontalHeader()->setResizeMode(QHeaderView::Fixed);
+    ui->tableWidget->verticalHeader()->setResizeMode(QHeaderView::Fixed);
+    ui->tableWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    ui->tableWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
+    ui->tableWidget->verticalHeader()->setFixedWidth(30);
+    ui->tableWidget->setSortingEnabled(true);
+
+    ui->tableWidget->setColumnWidth(0,50);
+    ui->tableWidget->setColumnWidth(1,115);
+    ui->tableWidget->setColumnWidth(2,140);
+    ui->tableWidget->setColumnWidth(3,125);
+    ui->tableWidget->setColumnWidth(4,45);
+    ui->tableWidget->setColumnWidth(5,45);
+    ui->tableWidget->setColumnWidth(6,50);
+    ui->tableWidget->setColumnWidth(7,50);
+    ui->tableWidget->setColumnWidth(8,55);
+}
+
+void FormWoolFee::setTableWidgetNoData(QTableWidget *tableWidget)
+{
+    prepareTableWidgetCells(tableWidget,15);
+    tableWidget->setEnabled(false);
+    QTableWidgetItem *item = new QTableWidgetItem();
+    item->setTextAlignment(Qt::AlignLeft|Qt::AlignVCenter);
+    item->setText("暂无信息");
+    tableWidget->setItem(6,3,item);
+}
+
+void FormWoolFee::prepareTableWidgetCells(QTableWidget *tableWidget, int rows)
+{
+    tableWidget->setRowCount(0);
+    tableWidget->setRowCount(rows);
+}
+
+void FormWoolFee::fillDataList(QTableWidget *tableWidget,QStringList keys,
+                                   QMultiMap<QString, QString> list, int rowCount)
+{
+    setTableWidgetNoData(tableWidget);
+    if(rowCount==0)
+    {
+        return ;
+    }
+    prepareTableWidgetCells(tableWidget,rowCount);
+    tableWidget->setEnabled(true);
+    for(int row = 0;row < rowCount;row++)
+    {
+        QMap<QString,QString> map;
+        for(int col=0;col<keys.size();col++)
+        {
+            QString key = keys.at(col);
+            QString value = list.values(key).at(row);
+            map.insert(key,value);
+        }
+        for(int col=0;col<keys.size();col++)
+        {
+            QString key = keys.at(col);
+            QString value = list.values(key).at(row);
+            setCellElement(tableWidget,row,col,key,value,map);
+        }
+    }
+
+    tableWidget->sortByColumn(0);
+    tableWidget->sortByColumn(0);
+}
+void FormWoolFee::setCellElement(QTableWidget *tableWidget, int row, int col,
+                                     QString key,QString value,QMap<QString,QString> data)
+{
+    QTableWidgetItem* item = new QTableWidgetItem();
+    QVariant display = value;
+    QVariant tooltip = value;
+    item->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
+    //进行数据翻译
+    if(key=="chargeid")
+    {
+        display = value.toInt();
+    }
+    else if(key=="chargemoney")
+    {
+        display = value.toDouble();
+    }
+    else if(key=="giftmoney")
+    {
+        display = value.toDouble();
+    }
+
+    //设置单元格显示形式,是用item填充还是widget填充
+
+    item->setData(Qt::DisplayRole,display);
+    item->setData(Qt::UserRole,value);
+    item->setData(Qt::ToolTipRole,tooltip);
+    tableWidget->setItem(row,col,item);
+
+}
+void FormWoolFee::query()
+{
+    QString dateStart = ui->dateEditStart->text();
+    QString dateEnd = ui->dateEditEnd->text();
+    QString userHash = m_account.value("userhash");
+    QString json = m_wool->GetCostInfo(dateStart,dateEnd,userHash);
+    QMultiMap<QString,QString> list;
+    RespGetCostInfo response(json);
+    if(response.getRtnCode()>=0)
+    {
+        list = response.getRs();
+    }
+    else
+    {
+        QMessageBox::critical(this,"提示",response.getRtnMemo(),QMessageBox::Ok);
+        return ;
+    }
+    int cols = list.uniqueKeys().size();
+    int rows = 0;
+    if(cols!=0)
+        rows = list.size()/cols;
+    if(list.size()==0)
+    {
+        setTableWidgetNoData(ui->tableWidget);
+        return ;
+    }
+    QStringList ids;
+    QString curId;
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            if(item->checkState()==Qt::Checked)
+            {
+                ids<<item->data(Qt::UserRole).toString();
+            }
+            if(item->isSelected())
+            {
+                curId = item->data(Qt::UserRole).toString();
+            }
+        }
+    }
+    fillDataList(ui->tableWidget,m_keys,list,rows);
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        if(curId.isEmpty())
+        {
+            ui->tableWidget->selectRow(i);
+            ui->tableWidget->setFocus();
+            break;
+        }
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            QString id = item->data(Qt::UserRole).toString();
+            if(curId==id)
+            {
+                ui->tableWidget->selectRow(i);
+                ui->tableWidget->setFocus();
+            }
+            for(int i=0;i<ids.size();i++)
+            {
+                if(id==ids.at(i))
+                {
+                    item->setCheckState(Qt::Checked);
+                    break;
+                }
+            }
+        }
+    }
+}
+
+void FormWoolFee::showRtnMessage(int row)
+{
+    QTableWidgetItem *itemMsg = ui->tableWidget->item(row,8);
+    QTableWidgetItem *itemDetail = ui->tableWidget->item(row,9);
+    QString errMsg = "";
+    QString errDetail = "";
+    if(itemMsg)
+    {
+        errMsg = itemMsg->data(Qt::UserRole).toString();
+    }
+    if(itemDetail)
+    {
+        errDetail = itemDetail->data(Qt::UserRole).toString();
+    }
+    if(errDetail.isEmpty())
+    {
+        if(!errMsg.isEmpty())
+        {
+             QMessageBox::critical(this,"提示",errMsg,QMessageBox::Ok);
+        }
+    }
+    else
+    {
+        DialogSubmitResponseDetail dialog;
+        dialog.setDetailText(errDetail);
+        dialog.exec();
+    }
+}
+
+
+
+
+void FormWoolFee::onDataUpdated()
+{
+    query();
+}
+bool FormWoolFee::chkAccountState(AccountLoginState state)
+{
+
+    bool ret = false;
+    switch(state)
+    {
+        case NotLogin:
+            QMessageBox::critical(this,"提示","您现在还没有登录系统,请登录后再操作!",QMessageBox::Ok);
+            break;
+        case NotBind:
+            QMessageBox::critical(this,"提示","此项服务尚未开通,请开通后再操作!",QMessageBox::Ok);
+            break;
+        case LoginError:
+            QMessageBox::critical(this,"提示","此项服务暂时无法连接,请稍候重试!",QMessageBox::Ok);
+            break;
+        default:
+            ret = true;
+    }
+    return ret;
+}
+void FormWoolFee::on_pushButtonQuery_clicked()
+{
+    if(!chkAccountState(m_state))
+        return;
+    if(!checkLastClickTime(sender()))
+        return ;
+
+    ui->labelState->setText("正在查询,请稍候...");
+    ui->labelState->setStyleSheet("QLabel{color:#08a61b;font:12px;font-weight: bold;}");
+    ui->pushButtonQuery->setEnabled(false);
+    setCursor(Qt::WaitCursor);
+    query();
+    setCursor(Qt::ArrowCursor);
+    ui->labelState->setText("");
+    ui->pushButtonQuery->setEnabled(true);
+}
+bool FormWoolFee::checkLastClickTime(QObject *button)
+{
+    QPushButton *btn = qobject_cast<QPushButton*>(button);
+
+    QDateTime lasttime = m_clickTime.value(btn->objectName());
+    if(!lasttime.isNull())
+    {
+        if(lasttime.addSecs(30)>QDateTime::currentDateTime())
+        {
+            QMessageBox::critical(this,"提示","您不可以频繁点击!",QMessageBox::Ok);
+            return false;
+        }
+    }
+    m_clickTime.insert(btn->objectName(),QDateTime::currentDateTime());
+    return true;
+
+}

+ 61 - 0
sncprojects/lib/SNCWool/formwoolfee.h

@@ -0,0 +1,61 @@
+#ifndef FORMWOOLFEE_H
+#define FORMWOOLFEE_H
+
+#include <QWidget>
+#include "snccore.h"
+#include <QtGui>
+#include "wswool.h"
+namespace Ui {
+class FormWoolFee;
+}
+
+class FormWoolFee : public QWidget
+{
+    Q_OBJECT
+    
+public:
+    explicit FormWoolFee(QWidget *parent = 0);
+    void setClientID(QString clientID);
+    void setHost(QString host,QString port);
+    ~FormWoolFee();
+public slots:
+    void setAccountInfo(QMap<QString,QString> info);
+    void setClientName(QString name);
+private slots:
+
+    void onDataUpdated();
+
+    void on_pushButtonQuery_clicked();
+
+private:
+    void initVariables();                                                       //初始化成员变量
+    void initUI();                                                              //初始化UI样式
+    void setTableWidgetNoData(QTableWidget *tableWidget);                       //设置数据区列表信息为默认状态
+    void prepareTableWidgetCells(QTableWidget *tableWidget,int rows);           //设置table widget单元格
+    void fillDataList(QTableWidget *tableWidget,QStringList keys,
+                      QMultiMap<QString,QString> list,int rowCount);            //填充数据表
+    void setCellElement(QTableWidget *tableWidget, int row, int col,
+                        QString key,QString value,QMap<QString,QString> data);  //设置单元格内容
+    void query();
+    void showRtnMessage(int row);
+    bool chkAccountState(AccountLoginState state);
+    bool checkLastClickTime(QObject *button);
+private:
+    Ui::FormWoolFee *ui;
+
+    QString m_host;
+    QString m_port;
+    QString m_clientName;
+    QString m_clientID;
+
+    QMap<QString,QString> m_account;
+    QMovie *m_movie;
+    QStringList m_keys;
+    QStringList m_headers;
+    AccountLoginState m_state;
+    WSWool *m_wool;
+    QMap<QString,QDateTime> m_clickTime;
+
+};
+
+#endif // FORMWOOLFEE_H

+ 75 - 0
sncprojects/lib/SNCWool/formwoolfee.ui

@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>FormWoolFee</class>
+ <widget class="QWidget" name="FormWoolFee">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>449</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_2">
+     <item>
+      <spacer name="horizontalSpacer_2">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QLabel" name="labelState">
+       <property name="text">
+        <string/>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QLabel" name="label_5">
+       <property name="text">
+        <string>开始日期:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QDateEdit" name="dateEditStart"/>
+     </item>
+     <item>
+      <widget class="QLabel" name="label_6">
+       <property name="text">
+        <string>结束日期:</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QDateEdit" name="dateEditEnd"/>
+     </item>
+     <item>
+      <widget class="QPushButton" name="pushButtonQuery">
+       <property name="text">
+        <string>查询</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QTableWidget" name="tableWidget"/>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 909 - 0
sncprojects/lib/SNCWool/formwoolfinished.cpp

@@ -0,0 +1,909 @@
+#include "formwoolfinished.h"
+#include "ui_formwoolfinished.h"
+#include "sncdatabase.h"
+#include "respdlresultfile.h"
+#include "zip.h"
+FormWoolFinished::FormWoolFinished(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::FormWoolFinished)
+{
+    ui->setupUi(this);
+    initVariables();
+    initUI();
+    setTableWidgetNoData(ui->tableWidget);
+    setDetailNoData();
+}
+
+void FormWoolFinished::setClientID(QString clientID)
+{
+    m_clientID = clientID;
+}
+
+void FormWoolFinished::setClientName(QString clientName)
+{
+    m_clientName = clientName;
+}
+
+void FormWoolFinished::setHost(QString host, QString port)
+{
+    m_host = host;
+    m_port = port;
+//    m_wool->setHost(m_host,m_port);
+}
+
+FormWoolFinished::~FormWoolFinished()
+{
+    m_wool->abort();
+    m_movieBig->stop();
+    delete m_movieBig;
+    delete m_wool;
+    delete ui;
+    qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
+           <<"FormWool.FormWoolFinished Destroyed.";
+}
+void FormWoolFinished::initVariables()
+{
+    m_movieBig = new QMovie(":/fetchfromserver.gif");
+    m_movieBig->start();
+
+
+    m_keys<<"batchid"<<"isdeliver"<<"ispass"<<"detail"<<"resulttj"<<"submittime"<<"finishtime"\
+         <<"finishcount"<<"settlefee"<<"giftfee";
+
+    m_headers<<""<<"状态"<<"是否放行"<<"原始文件"<<"详细统计"<<"提交时间"<<"完成时间"\
+            <<"已检测"<<"费用"<<"赠送消耗"<<"下载";
+    m_state = NotLogin;
+    m_curLtfid = "";
+    m_curQryid = "";
+    m_lastLtfid = "";
+
+    m_wool = new WSWool();
+}
+void FormWoolFinished::setAccountInfo(QMap<QString, QString> info)
+{
+    m_account = info;
+    QString ssoHash = info.value("ssohash");
+    QString userCode = info.value("usercode");
+    QString userHash = info.value("userhash");
+    if(!ssoHash.isEmpty())
+    {
+        if(!userHash.isEmpty())
+        {
+            m_state = LoginOk;
+            setTableWidgetSyncData(ui->tableWidget);
+        }
+        else
+        {
+            if(!userCode.isEmpty())
+            {
+                m_state = LoginError;
+            }
+            else
+            {
+                m_state = NotBind;
+            }
+        }
+    }
+    else
+    {
+        m_state = NotLogin;
+    }
+    if(m_state!=LoginOk)
+    {
+        setTableWidgetNoData(ui->tableWidget);
+        setDetailNoData();
+    }
+}
+
+void FormWoolFinished::initUI()
+{
+    ui->tableWidget->setColumnCount(m_headers.size());
+    ui->tableWidget->setHorizontalHeaderLabels(m_headers);
+
+    ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
+    ui->tableWidget->setShowGrid(false);
+    ui->tableWidget->setAlternatingRowColors(true);
+    ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
+    ui->tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
+    ui->tableWidget->verticalHeader()->setVisible(false);
+    ui->tableWidget->horizontalHeader()->setStyleSheet("font:12px");
+    ui->tableWidget->horizontalHeader()->setResizeMode(QHeaderView::Fixed);
+    ui->tableWidget->verticalHeader()->setResizeMode(QHeaderView::Fixed);
+    ui->tableWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    ui->tableWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
+    ui->tableWidget->verticalHeader()->setFixedWidth(30);
+    ui->tableWidget->setSortingEnabled(true);
+
+    int col = 0;
+    ui->tableWidget->setColumnWidth(col++,20);
+    ui->tableWidget->setColumnWidth(col++,30);
+    ui->tableWidget->setColumnWidth(col++,0);
+    ui->tableWidget->setColumnWidth(col++,110);
+    ui->tableWidget->setColumnWidth(col++,0);//
+    ui->tableWidget->setColumnWidth(col++,140);
+    ui->tableWidget->setColumnWidth(col++,140);
+    ui->tableWidget->setColumnWidth(col++,73);
+    ui->tableWidget->setColumnWidth(col++,61);
+    ui->tableWidget->setColumnWidth(col++,60);
+    ui->tableWidget->setColumnWidth(col++,40);
+
+    ui->widgetExactCheck->setProperty("class","lowframe2");
+
+    //初始化预检测 实号、空、停、关机对应的显示图片exact_result_bg.jpg
+    QPixmap exact_result_bg(":/exact_result_bg.jpg");
+    int nHeight = exact_result_bg.height()/10;
+    int nWidth = exact_result_bg.width();
+
+    ui->labelBarQwld->setPixmap(exact_result_bg.copy(QRect(0 , 0 * nHeight, nWidth, nHeight)));
+    ui->labelBarLaji->setPixmap(exact_result_bg.copy(QRect(0 , 1 * nHeight, nWidth, nHeight)));
+    ui->labelBarShiHao->setPixmap(exact_result_bg.copy(QRect(0 , 2 * nHeight, nWidth, nHeight)));
+    ui->labelBarKong->setPixmap(exact_result_bg.copy(QRect(0 , 3 * nHeight, nWidth, nHeight)));
+    ui->labelBarTing->setPixmap(exact_result_bg.copy(QRect(0 , 4 * nHeight, nWidth, nHeight)));
+    ui->labelBarGuan->setPixmap(exact_result_bg.copy(QRect(0 , 5 * nHeight, nWidth, nHeight)));
+
+    ui->labelBarHrxz->setPixmap(exact_result_bg.copy(QRect(0 , 6 * nHeight, nWidth, nHeight)));
+    ui->labelBarWfjt->setPixmap(exact_result_bg.copy(QRect(0 , 7 * nHeight, nWidth, nHeight)));
+    ui->labelBarLdtx->setPixmap(exact_result_bg.copy(QRect(0 , 8 * nHeight, nWidth, nHeight)));
+    ui->labelBarOther->setPixmap(exact_result_bg.copy(QRect(0 , 9 * nHeight, nWidth, nHeight)));
+
+    //初始化图例图标实号、空、停、关机对应的显示图片sample_small.jpg
+    QPixmap sample_small(":/sample_small.jpg");
+    nHeight = sample_small.height();
+    nWidth = sample_small.width()/10;
+
+    ui->labelSampleQwdr->setPixmap(sample_small.copy(QRect(0 * nWidth , 0 , nWidth, nHeight)));
+    ui->labelSampleLaji->setPixmap(sample_small.copy(QRect(1 * nWidth , 0 , nWidth, nHeight)));
+    ui->labelSampleShiHao->setPixmap(sample_small.copy(QRect(2 * nWidth , 0 , nWidth, nHeight)));
+    ui->labelSampleKong->setPixmap(sample_small.copy(QRect(3 * nWidth , 0 , nWidth, nHeight)));
+    ui->labelSampleTing->setPixmap(sample_small.copy(QRect(4 * nWidth , 0 , nWidth, nHeight)));
+    ui->labelSampleGuan->setPixmap(sample_small.copy(QRect(5 * nWidth , 0 , nWidth, nHeight)));
+    ui->labelSampleHrxz->setPixmap(sample_small.copy(QRect(6 * nWidth , 0 , nWidth, nHeight)));
+    ui->labelSampleWfjt->setPixmap(sample_small.copy(QRect(7 * nWidth , 0 , nWidth, nHeight)));
+    ui->labelSampleLdtx->setPixmap(sample_small.copy(QRect(8 * nWidth , 0 , nWidth, nHeight)));
+    ui->labelSampleOther->setPixmap(sample_small.copy(QRect(9 * nWidth , 0 , nWidth, nHeight)));
+
+    ui->pushButtonDel->setVisible(false);
+}
+
+void FormWoolFinished::setTableWidgetNoData(QTableWidget *tableWidget)
+{
+    prepareTableWidgetCells(tableWidget,8);
+    tableWidget->setEnabled(false);
+    QTableWidgetItem *item = new QTableWidgetItem();
+    item->setTextAlignment(Qt::AlignLeft|Qt::AlignVCenter);
+    item->setText("暂无信息");
+    tableWidget->setItem(4,6,item);
+}
+
+void FormWoolFinished::setDetailNoData()
+{
+    ui->labelShiHao->setText("实号");
+    ui->labelKong->setText("空号");
+    ui->labelTing->setText("停机");
+    ui->labelGuan->setText("关机");
+    ui->labelWfjt->setText("无法接通");
+    ui->labelLdtx->setText("来电提醒");
+    ui->labelHrxz->setText("呼入限制");
+    ui->labelQwld->setText("请勿来电");
+    ui->labelLaji->setText("垃圾号码");
+    ui->labelOther->setText("其他");
+
+    //设置上述状态比例的默认宽度为0
+    ui->labelBarShiHao->setFixedWidth(0);
+    ui->labelBarKong->setFixedWidth(0);
+    ui->labelBarTing->setFixedWidth(0);
+    ui->labelBarGuan->setFixedWidth(0);
+    ui->labelBarWfjt->setFixedWidth(0);
+    ui->labelBarLdtx->setFixedWidth(0);
+    ui->labelBarHrxz->setFixedWidth(0);
+    ui->labelBarQwld->setFixedWidth(0);
+    ui->labelBarLaji->setFixedWidth(0);
+    ui->labelBarOther->setFixedWidth(0);
+}
+
+void FormWoolFinished::setTableWidgetSyncData(QTableWidget *tableWidget)
+{
+    prepareTableWidgetCells(tableWidget,8);
+    tableWidget->setEnabled(false);
+    QLabel *lbl = new QLabel();
+
+    QTableWidgetItem *item = new QTableWidgetItem("正在读取...");
+    lbl->setMovie(m_movieBig);
+    lbl->setAlignment(Qt::AlignRight);
+    item->setTextAlignment(Qt::AlignLeft|Qt::AlignVCenter);
+    tableWidget->setItem(4,6,item);
+    tableWidget->setCellWidget(4,5,lbl);
+}
+
+void FormWoolFinished::prepareTableWidgetCells(QTableWidget *tableWidget, int rows)
+{
+    tableWidget->setRowCount(0);
+    tableWidget->setRowCount(rows);
+}
+
+void FormWoolFinished::fillDataList(QTableWidget *tableWidget,QStringList keys,
+                                   QMultiMap<QString, QString> list, int rowCount)
+{
+    setTableWidgetNoData(tableWidget);
+    if(rowCount==0)
+    {
+        return ;
+    }
+    prepareTableWidgetCells(tableWidget,rowCount);
+    tableWidget->setEnabled(true);
+    for(int row = 0;row < rowCount;row++)
+    {
+        QMap<QString,QString> map;
+        for(int col=0;col<keys.size();col++)
+        {
+            QString key = keys.at(col);
+            QString value = list.values(key).at(row);
+            map.insert(key,value);
+        }
+        for(int col=0;col<keys.size();col++)
+        {
+            QString key = keys.at(col);
+            QString value = list.values(key).at(row);
+            setCellElement(tableWidget,row,col,key,value,map);
+        }
+    }
+    //添加按钮
+    for(int row = 0;row < rowCount;row++)
+    {
+        QPushButton *button = new QPushButton();
+        button->setCursor(Qt::PointingHandCursor);
+        button->setProperty("class","imagebutton");
+        connect(button,SIGNAL(clicked()),this,SLOT(onSingleDownloadClick()));
+
+        ui->tableWidget->setCellWidget(row,tableWidget->columnCount()-1,button);
+    }
+    tableWidget->sortByColumn(0);
+    tableWidget->sortByColumn(0);
+}
+void FormWoolFinished::setCellElement(QTableWidget *tableWidget, int row, int col,
+                                     QString key,QString value,QMap<QString,QString> data)
+{
+    QTableWidgetItem* item = new QTableWidgetItem();
+    QVariant display = value;
+    QVariant tooltip = value;
+    item->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
+    //进行数据翻译
+
+    if(key=="batchid")
+    {
+        display = "";
+        tooltip = "";
+        item->setCheckState(Qt::Unchecked);
+    }
+    else if(key=="detail")
+    {
+        QStringList info = display.toString().split("\r\n");
+        QString filename;
+        if(info.size()>4)
+        {
+            if(info.at(4).split(":").size()>1)
+            {
+                filename = info.at(4).split(":").at(1);
+            }
+            display = filename;
+        }
+        item->setTextAlignment(Qt::AlignLeft|Qt::AlignVCenter);
+    }
+    else if(key=="finishcount")
+    {
+        display = value.toInt();
+        tooltip = display;
+    }
+    else if(key=="settlefee")
+    {
+        display = value.toDouble();
+        tooltip = display;
+    }
+    else if(key=="giftfee")
+    {
+        display = value.toDouble();
+        tooltip = display;
+    }
+    //设置单元格显示形式,是用item填充还是widget填充
+
+    if(key == "isdeliver")
+    {
+        delete item;
+        QLabel *lbl = new QLabel(this);
+        lbl->setAlignment(Qt::AlignCenter|Qt::AlignHCenter);
+        lbl->setProperty("value",value);
+        if(value=="0")
+        {
+            QString ispass = data.value("ispass");
+            if(ispass=="0")
+            {
+                lbl->setPixmap(QPixmap(":/task_nopass.png"));
+                lbl->setToolTip("未放行");
+            }
+            else
+            {
+                lbl->setPixmap(QPixmap(":/todown.png"));
+                lbl->setToolTip("未下载");
+            }
+        }
+        else if(value=="1")
+        {
+            lbl->setPixmap(QPixmap(":/task_ok.png"));
+            lbl->setToolTip("已下载");
+        }
+        tableWidget->setCellWidget(row,col,lbl);
+    }
+    else
+    {
+        item->setData(Qt::DisplayRole,display);
+        item->setData(Qt::UserRole,value);
+        item->setData(Qt::ToolTipRole,tooltip);
+        tableWidget->setItem(row,col,item);
+    }
+
+
+}
+void FormWoolFinished::query(QString dealstatus)
+{
+    QString userCode = m_account.value("usercode");
+    QMultiMap<QString,QString> list = SNCDataBase::getWoolCheckFinishInfos(userCode,m_clientID,dealstatus);
+    int cols = list.uniqueKeys().size();
+    int rows = 0;
+    if(cols!=0)
+        rows = list.size()/cols;
+    if(list.size()==0)
+    {
+        setTableWidgetNoData(ui->tableWidget);
+        setDetailNoData();
+        return ;
+    }
+    QStringList ids;
+    QString curId;
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            if(item->checkState()==Qt::Checked)
+            {
+                ids<<item->data(Qt::UserRole).toString();
+            }
+            if(item->isSelected())
+            {
+                curId = item->data(Qt::UserRole).toString();
+            }
+        }
+    }
+    fillDataList(ui->tableWidget,m_keys,list,rows);
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        if(curId.isEmpty())
+        {
+            ui->tableWidget->selectRow(i);
+            on_tableWidget_cellClicked(i,0);
+            ui->tableWidget->setFocus();
+            break;
+        }
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            QString id = item->data(Qt::UserRole).toString();
+            if(curId==id)
+            {
+                ui->tableWidget->selectRow(i);
+                on_tableWidget_cellClicked(i,0);
+                ui->tableWidget->setFocus();
+            }
+            for(int i=0;i<ids.size();i++)
+            {
+                if(id==ids.at(i))
+                {
+                    item->setCheckState(Qt::Checked);
+                    break;
+                }
+            }
+        }
+    }
+}
+
+void FormWoolFinished::showRtnMessage(int row)
+{
+
+}
+
+bool FormWoolFinished::addFileToZip(QString zipName, QStringList files)
+{
+    Zip::ErrorCode ec;
+    Zip uz;
+
+    QFile file(zipName);
+    if(!file.open(QIODevice::WriteOnly)){
+        return false ;
+    }
+    file.close();
+    ec = uz.createArchive(zipName);
+    if (ec != Zip::Ok) {
+        return false;
+    }
+    ec = uz.addFiles(files);
+    if (ec != Zip::Ok) {
+        uz.closeArchive();
+        return false;
+    }
+    if (uz.closeArchive() != Zip::Ok) {
+        return false;
+    }
+    return true;
+}
+
+void FormWoolFinished::displaySelected(QString detail)
+{
+    QStringList list = detail.split("\r\n");
+    qDebug()<<list.size()<<list;
+    int i=0;
+    int k = 0;
+    if(list.size()==10)
+    {
+        k=0;
+    }
+    else
+    {
+        setDetailNoData();
+        return;
+    }
+
+    QStringList rates;
+    for(int i=0;i<list.size();i++)
+    {
+        QRegExp rx("\\((.+)\\)");
+        int pos = rx.indexIn(list.at(i));
+        if(pos>0)
+        {
+            QString match = rx.capturedTexts().at(1);
+            rates<<match.replace("%","");
+        }
+        else
+        {
+            rates<<"0";
+        }
+    }
+    i = k;
+    ui->labelKong->setText(list.at(i++));
+    ui->labelTing->setText(list.at(i++));
+    ui->labelGuan->setText(list.at(i++));
+    ui->labelHrxz->setText(list.at(i++));
+    ui->labelWfjt->setText(list.at(i++));
+    ui->labelLdtx->setText(list.at(i++));
+    ui->labelShiHao->setText(list.at(i++));
+    ui->labelQwld->setText(list.at(i++));
+    ui->labelLaji->setText(list.at(i++));
+    ui->labelOther->setText(list.at(i++));
+    i = k;
+    int barLength = 650;
+
+    ui->labelBarKong->setFixedWidth(rates.at(i++).toDouble()*barLength/100);
+    ui->labelBarTing->setFixedWidth(rates.at(i++).toDouble()*barLength/100);
+    ui->labelBarGuan->setFixedWidth(rates.at(i++).toDouble()*barLength/100);
+    ui->labelBarWfjt->setFixedWidth(rates.at(i++).toDouble()*barLength/100);
+    ui->labelBarHrxz->setFixedWidth(rates.at(i++).toDouble()*barLength/100);
+    ui->labelBarLdtx->setFixedWidth(rates.at(i++).toDouble()*barLength/100);
+    ui->labelBarShiHao->setFixedWidth(rates.at(i++).toDouble()*barLength/100);
+    ui->labelBarQwld->setFixedWidth(rates.at(i++).toDouble()*barLength/100);
+    ui->labelBarLaji->setFixedWidth(rates.at(i++).toDouble()*barLength/100);
+    ui->labelBarOther->setFixedWidth(rates.at(i++).toDouble()*barLength/100);
+
+}
+
+
+void FormWoolFinished::onDataUpdated()
+{
+    if(ui->radioButtonAll->isChecked())
+    {
+        query("");
+    }
+    else if(ui->radioButtonUndown->isChecked())
+    {
+        query("0");
+    }
+    else if(ui->radioButtonDown->isChecked())
+    {
+        query("1");
+    }
+}
+
+QString FormWoolFinished::getSingleZipFileName(QString id)
+{
+    QFileDialog::Options options;
+    QString selectedFilter;
+    QString exportDir = SNCDataBase::getExportDir();
+
+    QString defaultZipFileName = m_clientName + "_" + id   ;
+    QString saveZipFileName = QFileDialog::getSaveFileName(this,"另存为",exportDir + "\\" + defaultZipFileName,
+                                                           tr("ZIP Files (*.zip)"),
+                                                           &selectedFilter,
+                                                           options);
+    if(!saveZipFileName.isEmpty())
+    {
+        QFileInfo fileInfo(saveZipFileName);
+        exportDir = fileInfo.absolutePath();
+        SNCDataBase::updateExportDir(exportDir);
+    }
+    return saveZipFileName;
+}
+
+void FormWoolFinished::on_pushButtonDownload_clicked()
+{
+    if(!chkAccountState(m_state))
+        return;
+    int selected = 0;
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            if(item->checkState()==Qt::Checked)
+                selected++;
+        }
+    }
+    if(selected==0)
+    {
+        QMessageBox::critical(this,"提示","请选择要下载的数据!",QMessageBox::Ok);
+        return ;
+    }
+    QString saveZipFileName = getPackZipFileName();
+    if(saveZipFileName.isEmpty())
+        return ;
+
+    QDir dir;
+    if(!dir.exists(QDir::tempPath()+"/speednumcube"))
+    {
+        dir.mkdir(QDir::tempPath()+"/speednumcube");
+    }
+    QString tmpDir = QDir::tempPath()+"/speednumcube/";
+    QStringList files;
+    ui->pushButtonDownload->setEnabled(false);
+    this->setCursor(Qt::WaitCursor);
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item->checkState()==Qt::Checked)
+        {
+            QString id = item->data(Qt::UserRole).toString();
+            QString fileName = tmpDir + id + ".zip";
+            QFile::remove(fileName);
+            if(download(id,fileName,false))
+            {
+                files.append(fileName);
+            }
+        }
+    }
+    this->setCursor(Qt::ArrowCursor);
+    if(files.size()>0)
+    {
+        if(addFileToZip(saveZipFileName,files))
+        {
+            QMessageBox::information(this,"结果",QString("您选择%1个文件,%2个文件下载成功!")\
+                                     .arg(selected).arg(files.size()),QMessageBox::Ok);
+            QFileInfo fileinfo(saveZipFileName);
+            SNCDataBase::updateExportDir(fileinfo.absolutePath());
+        }
+        else
+        {
+            QMessageBox::critical(this,"结果","检测结果文件下载失败!",QMessageBox::Ok);
+        }
+    }
+    else
+    {
+        QMessageBox::critical(this,"结果","检测结果文件下载失败!",QMessageBox::Ok);
+    }
+    ui->pushButtonDownload->setEnabled(true);
+}
+
+void FormWoolFinished::on_tableWidget_cellClicked(int row, int column)
+{
+    if(row>=0&&column>=0)
+    {
+        QString detail = ui->tableWidget->item(row,4)->data(Qt::UserRole).toString();
+        displaySelected(detail);
+    }
+}
+
+void FormWoolFinished::on_radioButtonAll_clicked()
+{
+    if(!chkAccountState(m_state))
+            return;
+    if(ui->radioButtonAll->isChecked())
+    {
+        query("");
+    }
+    else if(ui->radioButtonUndown->isChecked())
+    {
+        query("0");
+    }
+    else if(ui->radioButtonDown->isChecked())
+    {
+        query("1");
+    }
+}
+
+void FormWoolFinished::on_radioButtonUndown_clicked()
+{
+    if(!chkAccountState(m_state))
+            return;
+    on_radioButtonAll_clicked();
+}
+
+void FormWoolFinished::on_radioButtonDown_clicked()
+{
+    if(!chkAccountState(m_state))
+            return;
+    on_radioButtonAll_clicked();
+}
+
+
+
+void FormWoolFinished::on_checkBoxAll_clicked()
+{
+    Qt::CheckState state;
+    state = ui->checkBoxAll->checkState();
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            item->setCheckState(state);
+        }
+    }
+}
+
+void FormWoolFinished::on_tableWidget_cellDoubleClicked(int row, int column)
+{
+    QString id = "";
+    QString ispass = "";
+
+    QTableWidgetItem *item;
+    item = ui->tableWidget->item(row,0);
+    if(item)
+    {
+        id = item->data(Qt::UserRole).toString();
+    }
+    item = ui->tableWidget->item(row,2);
+    if(item)
+    {
+        ispass = item->data(Qt::UserRole).toString();
+    }
+    if(id.isEmpty())
+    {
+        QMessageBox::critical(this,"结果","未能获取有效的文件编号!",QMessageBox::Ok);
+        return ;
+    }
+    if(ispass!="1")
+    {
+        QMessageBox::critical(this,"结果","单子还未放行!",QMessageBox::Ok);
+        return ;
+    }
+    QString saveFile = getSingleZipFileName(id);
+    if(saveFile.isEmpty())
+        return ;
+    this->setCursor(Qt::WaitCursor);
+    download(id,saveFile,true);
+    this->setCursor(Qt::ArrowCursor);
+
+}
+bool FormWoolFinished::download(QString srvID,QString saveZipFileName,bool show)
+{
+
+    QString cachePath = SNCDataBase::getWoolCachePath(srvID);
+    bool iscached = false;
+
+    if(!cachePath.isEmpty())
+    {
+        if(QFile::exists(cachePath))
+        {
+            iscached = true;
+        }
+    }
+    if(iscached)
+    {
+        return downloadFromLocal(saveZipFileName,cachePath,show);
+    }
+    else
+    {
+        return downloadFromServer(saveZipFileName,srvID,show);
+    }
+}
+bool FormWoolFinished::downloadFromLocal(QString saveFileName,QString cacheFile,bool show)
+{
+
+    QFile::copy(cacheFile,saveFileName);
+    if(show)
+        QMessageBox::information(this,"提示","下载成功!",QMessageBox::Ok);
+    return true;
+}
+
+bool FormWoolFinished::downloadFromServer(QString saveFileName, QString srvID, bool show)
+{
+    QString userHash = m_account.value("userhash");
+    QString json = m_wool->dlResultFile(srvID,userHash);
+
+    RespDlResultFile response(json);
+    if(response.getRtnCode()==2)
+    {
+        QString fileContent = response.getFileContent();
+        QByteArray array = QByteArray::fromBase64(fileContent.toAscii());
+        QFile file(saveFileName);
+        file.open(QIODevice::WriteOnly);
+        file.write(array);
+        file.close();
+        QString cachPath = cacheDownloadFile(saveFileName);
+        SNCDataBase::updateWoolCachePath(srvID,cachPath);
+        if(show)
+            QMessageBox::information(this,"结果","单子下载成功",QMessageBox::Ok);
+        return true;
+    }
+    else
+    {
+        if(show)
+            QMessageBox::critical(this,"结果",response.getRtnMemo(),QMessageBox::Ok);
+       return false;
+    }
+}
+QString FormWoolFinished::cacheDownloadFile(QString fileName)
+{
+    QString userCode = m_account.value("usercode");
+    QString date = QDate::currentDate().toString("yyyyMM");
+    QString cachePath = QCoreApplication::applicationDirPath()+\
+            QString("/../data/%1/cache/Wool/download/%2/").arg(userCode).arg(date);
+    QDir dir;
+    dir.mkpath(cachePath);
+    QFileInfo fileinfo(fileName);
+    QFile::copy(fileName,cachePath + fileinfo.fileName());
+    return cachePath + fileinfo.fileName();
+}
+
+bool FormWoolFinished::chkAccountState(AccountLoginState state)
+{
+
+    bool ret = false;
+    switch(state)
+    {
+        case NotLogin:
+            QMessageBox::critical(this,"提示","您现在还没有登录系统,请登录后再操作!",QMessageBox::Ok);
+            break;
+        case NotBind:
+            QMessageBox::critical(this,"提示","此项服务尚未开通,请开通后再操作!",QMessageBox::Ok);
+            break;
+        case LoginError:
+            QMessageBox::critical(this,"提示","此项服务暂时无法连接,请稍候重试!",QMessageBox::Ok);
+            break;
+        default:
+            ret = true;
+    }
+    return ret;
+}
+QString FormWoolFinished::getPackZipFileName()
+{
+    QFileDialog::Options options;
+    QString selectedFilter;
+    QString exportDir = SNCDataBase::getExportDir();
+
+    QString defaultZipFileName = QString(m_clientName);
+    int count = 0;
+    QString str ="";
+    QString download = "";
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            if(item->checkState()==Qt::Checked)
+            {
+                count++;
+                str +=   "_" + item->text();
+                QTableWidgetItem *item2 = ui->tableWidget->item(i,2);
+                if(item2)
+                {
+                    if(item2->data(Qt::UserRole).toString()!="1")
+                    {
+                        download += item->data(Qt::UserRole).toString()+ " ";
+                    }
+                }
+            }
+        }
+    }
+    if(count==0)
+        return "";
+    if(!download.isEmpty())
+    {
+        QMessageBox::critical(this,"提示","您选择的单子" + download + "现在还没有放行,暂时无法下载,请稍候再试!",QMessageBox::Ok);
+        return "";
+    }
+    defaultZipFileName += "_" + QString::number(count) + str  ;
+    QString saveZipFileName = QFileDialog::getSaveFileName(this,"另存为",exportDir + "\\" + defaultZipFileName,
+                                                           tr("ZIP Files (*.zip)"),
+                                                           &selectedFilter,
+                                                           options);
+    if(!saveZipFileName.isEmpty())
+    {
+        QFileInfo fileInfo(saveZipFileName);
+        exportDir = fileInfo.absolutePath();
+        SNCDataBase::updateExportDir(exportDir);
+    }
+    return saveZipFileName;
+}
+
+
+void FormWoolFinished::on_pushButtonDel_clicked()
+{
+    if(!chkAccountState(m_state))
+        return ;
+    bool nodata = true;
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            if(item->checkState()==Qt::Checked)
+            {
+                nodata = false;
+            }
+        }
+    }
+    if(nodata)
+    {
+        QMessageBox::critical(this,"提示","请选择要删除的单子",QMessageBox::Ok);
+        return ;
+    }
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            if(item->checkState()==Qt::Checked)
+            {
+                QTableWidgetItem *item = ui->tableWidget->item(i,6);
+                if(item)
+                {
+                    QDateTime datetime = QDateTime::currentDateTime();
+                    QDateTime datetime2 = QDateTime::fromString(item->data(Qt::UserRole).toString(),"yyyy-MM-dd hh:mm:ss");
+                    if(datetime2>datetime.addDays(-3))
+                    {
+                        QMessageBox::critical(this,"提示","你只能删除3天前的单子,3天内的单子系统会自动同步",QMessageBox::Ok);
+                        return ;
+                    }
+                }
+            }
+        }
+    }
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            if(item->checkState()==Qt::Checked)
+            {
+                QString id = item->data(Qt::UserRole).toString();
+                SNCDataBase::delShkjByID(id);
+            }
+        }
+    }
+    on_radioButtonAll_clicked();
+}
+
+void FormWoolFinished::onSingleDownloadClick()
+{
+     QPushButton *btn = qobject_cast<QPushButton*>(sender());
+     for(int i=0;i<ui->tableWidget->rowCount();i++)
+     {
+        QWidget *widget = ui->tableWidget->cellWidget(i,10);
+        if(widget)
+        {
+            if(btn==qobject_cast<QPushButton*>(widget))
+            {
+                on_tableWidget_cellDoubleClicked(i,1);
+                break;
+            }
+        }
+     }
+
+}

+ 86 - 0
sncprojects/lib/SNCWool/formwoolfinished.h

@@ -0,0 +1,86 @@
+#ifndef FORMWOOLFINISHED_H
+#define FORMWOOLFINISHED_H
+
+#include <QWidget>
+#include <QtGui>
+#include "wswool.h"
+#include "snccore.h"
+namespace Ui {
+class FormWoolFinished;
+}
+
+class FormWoolFinished : public QWidget
+{
+    Q_OBJECT
+    
+public:
+    explicit FormWoolFinished(QWidget *parent = 0);
+    void setClientID(QString clientID);
+    void setClientName(QString clientName);
+    void setHost(QString host,QString port);
+    ~FormWoolFinished();
+public slots:
+    void setAccountInfo(QMap<QString,QString> info);
+signals:
+    void dataDownload();
+private slots:
+    void onDataUpdated();
+    void on_tableWidget_cellClicked(int row, int column);
+
+    void on_radioButtonAll_clicked();
+
+    void on_radioButtonUndown_clicked();
+
+    void on_radioButtonDown_clicked();
+
+    void on_pushButtonDownload_clicked();
+
+    void on_checkBoxAll_clicked();
+
+    void on_tableWidget_cellDoubleClicked(int row, int column);
+
+    void on_pushButtonDel_clicked();
+    void onSingleDownloadClick();
+
+private:
+    void initVariables();                                                       //初始化成员变量
+    void initUI();                                                              //初始化UI样式
+    void setTableWidgetNoData(QTableWidget *tableWidget);                       //设置数据区列表信息为默认状态
+    void setDetailNoData();                                                     //设置数据区详细信息为默认状态
+    void setTableWidgetSyncData(QTableWidget *tableWidget);                       //设置数据区列表信息为同步状态
+    void prepareTableWidgetCells(QTableWidget *tableWidget,int rows);           //设置table widget单元格
+    void fillDataList(QTableWidget *tableWidget,QStringList keys,
+                      QMultiMap<QString,QString> list,int rowCount);            //填充数据表
+    void setCellElement(QTableWidget *tableWidget, int row, int col,
+                        QString key,QString value,QMap<QString,QString> data);  //设置单元格内容
+    void query(QString dealstatus);
+    void showRtnMessage(int row);
+    bool addFileToZip(QString zipName,QStringList files);
+    void displaySelected(QString detail);                                       //当用户点击时,以图形化方式显示单子详细信息
+    bool download(QString srvID,QString saveFileName,bool show);
+    bool downloadFromLocal(QString saveFileName,QString cacheFile,bool show);
+    bool downloadFromServer(QString saveFileName,QString srvID,bool show);
+    QString getPackZipFileName();                                               //用于用户下载检测结果文件时,生成格式化的文件名
+    QString getSingleZipFileName(QString id);
+    QString cacheDownloadFile(QString fileName);
+    bool chkAccountState(AccountLoginState state);
+private:
+    Ui::FormWoolFinished *ui;
+    QString m_clientID;
+    QString m_clientName;
+    QString m_host;
+    QString m_port;
+    QMap<QString,QString> m_account;
+
+    QStringList m_keys;
+    QStringList m_headers;
+    QString m_curLtfid;
+    QString m_curQryid;
+    QString m_lastLtfid;
+    QMovie *m_movieBig;
+    WSWool *m_wool;
+    AccountLoginState m_state;
+
+};
+
+#endif // FORMWOOLFINISHED_H

+ 873 - 0
sncprojects/lib/SNCWool/formwoolfinished.ui

@@ -0,0 +1,873 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>FormWoolFinished</class>
+ <widget class="QWidget" name="FormWoolFinished">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>816</width>
+    <height>571</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout_2">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout_7">
+     <property name="leftMargin">
+      <number>3</number>
+     </property>
+     <item>
+      <widget class="QCheckBox" name="checkBoxAll">
+       <property name="text">
+        <string>全选</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QRadioButton" name="radioButtonAll">
+       <property name="text">
+        <string>全部</string>
+       </property>
+       <property name="checked">
+        <bool>true</bool>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QRadioButton" name="radioButtonUndown">
+       <property name="text">
+        <string>未下载</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QRadioButton" name="radioButtonDown">
+       <property name="text">
+        <string>已下载</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer_5">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="pushButtonDownload">
+       <property name="text">
+        <string>批量下载</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="pushButtonDel">
+       <property name="text">
+        <string>删除</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QTableWidget" name="tableWidget"/>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+       <horstretch>0</horstretch>
+       <verstretch>150</verstretch>
+      </sizepolicy>
+     </property>
+     <property name="minimumSize">
+      <size>
+       <width>0</width>
+       <height>150</height>
+      </size>
+     </property>
+     <property name="maximumSize">
+      <size>
+       <width>16777215</width>
+       <height>200</height>
+      </size>
+     </property>
+     <property name="title">
+      <string>检测结果</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout">
+      <item>
+       <layout class="QVBoxLayout" name="verticalLayout_11">
+        <property name="leftMargin">
+         <number>0</number>
+        </property>
+        <property name="topMargin">
+         <number>6</number>
+        </property>
+        <property name="rightMargin">
+         <number>6</number>
+        </property>
+        <property name="bottomMargin">
+         <number>6</number>
+        </property>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_29">
+          <property name="rightMargin">
+           <number>0</number>
+          </property>
+          <item>
+           <widget class="QWidget" name="widgetExactCheck" native="true">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <property name="minimumSize">
+             <size>
+              <width>650</width>
+              <height>14</height>
+             </size>
+            </property>
+            <property name="maximumSize">
+             <size>
+              <width>650</width>
+              <height>14</height>
+             </size>
+            </property>
+            <layout class="QHBoxLayout" name="horizontalLayout_30">
+             <property name="spacing">
+              <number>0</number>
+             </property>
+             <property name="margin">
+              <number>0</number>
+             </property>
+             <item>
+              <widget class="QLabel" name="labelBarKong">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="text">
+                <string>kong</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelBarTing">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="text">
+                <string>ting</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelBarGuan">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="text">
+                <string>guan</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelBarHrxz">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="text">
+                <string>hrxz</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelBarWfjt">
+               <property name="text">
+                <string>wfjt</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelBarLdtx">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="text">
+                <string>ldtx</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelBarShiHao">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="text">
+                <string>shihao</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelBarQwld">
+               <property name="text">
+                <string>qwld</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelBarLaji">
+               <property name="text">
+                <string>laji</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelBarOther">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="text">
+                <string>qita</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <spacer name="horizontalSpacer_16">
+               <property name="orientation">
+                <enum>Qt::Horizontal</enum>
+               </property>
+               <property name="sizeHint" stdset="0">
+                <size>
+                 <width>40</width>
+                 <height>20</height>
+                </size>
+               </property>
+              </spacer>
+             </item>
+            </layout>
+           </widget>
+          </item>
+          <item>
+           <spacer name="horizontalSpacer_3">
+            <property name="orientation">
+             <enum>Qt::Horizontal</enum>
+            </property>
+            <property name="sizeHint" stdset="0">
+             <size>
+              <width>40</width>
+              <height>20</height>
+             </size>
+            </property>
+           </spacer>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_31">
+          <property name="spacing">
+           <number>0</number>
+          </property>
+          <item>
+           <widget class="QWidget" name="widget" native="true">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <layout class="QHBoxLayout" name="horizontalLayout_32">
+             <property name="spacing">
+              <number>6</number>
+             </property>
+             <property name="margin">
+              <number>0</number>
+             </property>
+             <item>
+              <widget class="QLabel" name="labelSampleKong">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="minimumSize">
+                <size>
+                 <width>10</width>
+                 <height>20</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>10</width>
+                 <height>20</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>空号</string>
+               </property>
+               <property name="alignment">
+                <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelKong">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="minimumSize">
+                <size>
+                 <width>150</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>150</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>空号</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelSampleTing">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="minimumSize">
+                <size>
+                 <width>10</width>
+                 <height>20</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>10</width>
+                 <height>20</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>停机</string>
+               </property>
+               <property name="alignment">
+                <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelTing">
+               <property name="minimumSize">
+                <size>
+                 <width>150</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>150</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>停机</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelSampleGuan">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="minimumSize">
+                <size>
+                 <width>10</width>
+                 <height>20</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>10</width>
+                 <height>20</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>关机</string>
+               </property>
+               <property name="alignment">
+                <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelGuan">
+               <property name="minimumSize">
+                <size>
+                 <width>150</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>150</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>关机</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <spacer name="horizontalSpacer_19">
+               <property name="orientation">
+                <enum>Qt::Horizontal</enum>
+               </property>
+               <property name="sizeHint" stdset="0">
+                <size>
+                 <width>40</width>
+                 <height>20</height>
+                </size>
+               </property>
+              </spacer>
+             </item>
+            </layout>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout_33">
+          <property name="spacing">
+           <number>0</number>
+          </property>
+          <item>
+           <widget class="QWidget" name="widget_2" native="true">
+            <property name="sizePolicy">
+             <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+              <horstretch>0</horstretch>
+              <verstretch>0</verstretch>
+             </sizepolicy>
+            </property>
+            <layout class="QHBoxLayout" name="horizontalLayout_34">
+             <property name="spacing">
+              <number>6</number>
+             </property>
+             <property name="margin">
+              <number>0</number>
+             </property>
+             <item>
+              <widget class="QLabel" name="labelSampleHrxz">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="minimumSize">
+                <size>
+                 <width>10</width>
+                 <height>20</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>10</width>
+                 <height>20</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>实号</string>
+               </property>
+               <property name="alignment">
+                <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelHrxz">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="minimumSize">
+                <size>
+                 <width>150</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>150</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>呼入限制</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelSampleWfjt">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="minimumSize">
+                <size>
+                 <width>10</width>
+                 <height>20</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>10</width>
+                 <height>20</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>空号</string>
+               </property>
+               <property name="alignment">
+                <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelWfjt">
+               <property name="minimumSize">
+                <size>
+                 <width>150</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>150</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>无法接通</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelSampleLdtx">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="minimumSize">
+                <size>
+                 <width>10</width>
+                 <height>20</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>10</width>
+                 <height>20</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>提醒</string>
+               </property>
+               <property name="alignment">
+                <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelLdtx">
+               <property name="minimumSize">
+                <size>
+                 <width>150</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>150</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>来电提醒</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <spacer name="horizontalSpacer_20">
+               <property name="orientation">
+                <enum>Qt::Horizontal</enum>
+               </property>
+               <property name="sizeHint" stdset="0">
+                <size>
+                 <width>40</width>
+                 <height>20</height>
+                </size>
+               </property>
+              </spacer>
+             </item>
+            </layout>
+           </widget>
+          </item>
+         </layout>
+        </item>
+        <item>
+         <layout class="QHBoxLayout" name="horizontalLayout">
+          <item>
+           <widget class="QWidget" name="widget_3" native="true">
+            <layout class="QHBoxLayout" name="horizontalLayout_2">
+             <property name="margin">
+              <number>0</number>
+             </property>
+             <item>
+              <widget class="QLabel" name="labelSampleShiHao">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="minimumSize">
+                <size>
+                 <width>10</width>
+                 <height>20</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>10</width>
+                 <height>20</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>实号</string>
+               </property>
+               <property name="alignment">
+                <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelShiHao">
+               <property name="minimumSize">
+                <size>
+                 <width>150</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>150</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>实号</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelSampleQwdr">
+               <property name="minimumSize">
+                <size>
+                 <width>10</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>10</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>勿</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelQwld">
+               <property name="minimumSize">
+                <size>
+                 <width>150</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>150</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>请勿来单</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelSampleLaji">
+               <property name="minimumSize">
+                <size>
+                 <width>10</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>10</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>垃圾</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelLaji">
+               <property name="minimumSize">
+                <size>
+                 <width>150</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>150</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>垃圾</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelSampleOther">
+               <property name="sizePolicy">
+                <sizepolicy hsizetype="Fixed" vsizetype="Preferred">
+                 <horstretch>0</horstretch>
+                 <verstretch>0</verstretch>
+                </sizepolicy>
+               </property>
+               <property name="minimumSize">
+                <size>
+                 <width>10</width>
+                 <height>20</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>10</width>
+                 <height>20</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>它</string>
+               </property>
+               <property name="alignment">
+                <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <widget class="QLabel" name="labelOther">
+               <property name="minimumSize">
+                <size>
+                 <width>120</width>
+                 <height>0</height>
+                </size>
+               </property>
+               <property name="maximumSize">
+                <size>
+                 <width>120</width>
+                 <height>16777215</height>
+                </size>
+               </property>
+               <property name="text">
+                <string>其他</string>
+               </property>
+              </widget>
+             </item>
+             <item>
+              <spacer name="horizontalSpacer">
+               <property name="orientation">
+                <enum>Qt::Horizontal</enum>
+               </property>
+               <property name="sizeHint" stdset="0">
+                <size>
+                 <width>40</width>
+                 <height>20</height>
+                </size>
+               </property>
+              </spacer>
+             </item>
+            </layout>
+           </widget>
+          </item>
+         </layout>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 521 - 0
sncprojects/lib/SNCWool/formwoolupload.cpp

@@ -0,0 +1,521 @@
+#include "formwoolupload.h"
+#include "ui_formwoolupload.h"
+#include "xprogressbar.h"
+#include "sncdatabase.h"
+#include "dialogsubmitresponsedetail.h"
+#include "dialogsubmit.h"
+
+FormWoolUpload::FormWoolUpload(QWidget *parent) :
+    QWidget(parent),
+    ui(new Ui::FormWoolUpload)
+{
+    ui->setupUi(this);
+    initVariables();
+    initUI();
+    setTableWidgetNoData(ui->tableWidget);
+}
+
+FormWoolUpload::~FormWoolUpload()
+{
+    m_movie->stop();
+    m_movieBig->stop();
+    delete m_movieBig;
+    delete m_movie;
+    delete ui;
+    qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
+           <<"FormWool.FormWoolUpload Destroyed.";
+}
+void FormWoolUpload::initVariables()
+{
+    m_movie = new QMovie(":/working.gif");
+    m_movie->start();
+    m_movieBig = new QMovie(":/fetchfromserver.gif");
+    m_movieBig->start();
+
+    m_state = NotLogin;
+    m_keys<<"fileid"<<"uploadstate"<<"filetype"<<"filename"<<"filepath"\
+         <<"memo"<<"srvrtime"<<"percent"<<"rtnmsg"<<"rtndetail"<<"optstatus"<<"isverify"<<"tftime";
+
+    m_headers<<""<<"状态"<<"文件类型"<<"文件名"<<"文件路径"<<"备注"\
+            <<"提交时间"<<"上传进度"<<"返回信息"<<"返回详情"<<"服务端操作状态"<<""<<""<<"返回详情";
+}
+void FormWoolUpload::setAccountInfo(QMap<QString, QString> info)
+{
+    m_account = info;
+    QString ssoHash = info.value("ssohash");
+    QString userCode = info.value("usercode");
+    QString userHash = info.value("userhash");
+    if(!ssoHash.isEmpty())
+    {
+        if(!userHash.isEmpty())
+        {
+            m_state = LoginOk;
+            setTableWidgetSyncData(ui->tableWidget);
+        }
+        else
+        {
+            if(!userCode.isEmpty())
+            {
+                m_state = LoginError;
+            }
+            else
+            {
+                m_state = NotBind;
+            }
+        }
+    }
+    else
+    {
+        m_state = NotLogin;
+    }
+    if(m_state!=LoginOk)
+    {
+        setTableWidgetNoData(ui->tableWidget);
+    }
+}
+
+void FormWoolUpload::setClientName(QString name)
+{
+    m_clientName = name;
+}
+
+void FormWoolUpload::setClientID(QString clientID)
+{
+    m_clientID = clientID;
+}
+
+void FormWoolUpload::initUI()
+{
+    ui->tableWidget->setColumnCount(m_headers.size());
+    ui->tableWidget->setHorizontalHeaderLabels(m_headers);
+
+    ui->tableWidget->setEditTriggers(QAbstractItemView::NoEditTriggers);
+    ui->tableWidget->setShowGrid(false);
+    ui->tableWidget->setAlternatingRowColors(true);
+    ui->tableWidget->setSelectionBehavior(QAbstractItemView::SelectRows);
+    ui->tableWidget->setSelectionMode(QAbstractItemView::SingleSelection);
+    ui->tableWidget->verticalHeader()->setVisible(false);
+    ui->tableWidget->horizontalHeader()->setStyleSheet("font:12px");
+    ui->tableWidget->horizontalHeader()->setResizeMode(QHeaderView::Fixed);
+    ui->tableWidget->verticalHeader()->setResizeMode(QHeaderView::Fixed);
+    ui->tableWidget->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
+    ui->tableWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
+    ui->tableWidget->verticalHeader()->setFixedWidth(30);
+    ui->tableWidget->setSortingEnabled(true);
+
+    ui->tableWidget->setColumnWidth(0,20);
+    ui->tableWidget->setColumnWidth(1,30);
+    ui->tableWidget->setColumnWidth(2,70);//
+    ui->tableWidget->setColumnWidth(3,175);
+    ui->tableWidget->setColumnWidth(4,0);
+    ui->tableWidget->setColumnWidth(5,0);//
+    ui->tableWidget->setColumnWidth(6,130);
+    ui->tableWidget->setColumnWidth(7,170);
+    ui->tableWidget->setColumnWidth(8,0);
+    ui->tableWidget->setColumnWidth(9,0);
+    ui->tableWidget->setColumnWidth(10,0);
+    ui->tableWidget->setColumnWidth(11,0);
+    ui->tableWidget->setColumnWidth(12,0);
+    ui->tableWidget->setColumnWidth(13,79);
+
+    this->setFixedHeight(170);
+}
+
+void FormWoolUpload::setTableWidgetNoData(QTableWidget *tableWidget)
+{
+    prepareTableWidgetCells(tableWidget,3);
+    tableWidget->setEnabled(false);
+    QTableWidgetItem *item = new QTableWidgetItem();
+    item->setTextAlignment(Qt::AlignLeft|Qt::AlignVCenter);
+    item->setText("   暂无信息");
+    tableWidget->setItem(1,6,item);
+}
+
+void FormWoolUpload::setTableWidgetSyncData(QTableWidget *tableWidget)
+{
+    prepareTableWidgetCells(tableWidget,3);
+    tableWidget->setEnabled(false);
+    QLabel *lbl = new QLabel();
+
+    QTableWidgetItem *item = new QTableWidgetItem("  正在读取...");
+    lbl->setMovie(m_movieBig);
+    item->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
+    tableWidget->setItem(1,6,item);
+    tableWidget->setCellWidget(1,6,lbl);
+}
+
+void FormWoolUpload::prepareTableWidgetCells(QTableWidget *tableWidget, int rows)
+{
+    tableWidget->setRowCount(0);
+    tableWidget->setRowCount(rows);
+}
+
+void FormWoolUpload::fillDataList(QTableWidget *tableWidget,QStringList keys,
+                                   QMultiMap<QString, QString> list, int rowCount)
+{
+    setTableWidgetNoData(tableWidget);
+    if(rowCount==0)
+    {
+        return ;
+    }
+    prepareTableWidgetCells(tableWidget,rowCount);
+    tableWidget->setEnabled(true);
+    for(int row = 0;row < rowCount;row++)
+    {
+        QMap<QString,QString> map;
+        for(int col=0;col<keys.size();col++)
+        {
+            QString key = keys.at(col);
+            QString value = list.values(key).at(row);
+            map.insert(key,value);
+        }
+        for(int col=0;col<keys.size();col++)
+        {
+            QString key = keys.at(col);
+            QString value = list.values(key).at(row);
+            setCellElement(tableWidget,row,col,key,value,map);
+        }
+    }
+    //添加按钮
+    for(int row = 0;row < rowCount;row++)
+    {
+        QPushButton *button = new QPushButton();
+        button->setText("查看");
+        button->setProperty("class","txt-green");
+        button->setCursor(Qt::PointingHandCursor);
+        connect(button,SIGNAL(clicked()),this,SLOT(onPushButtonViewsClicked()));
+        QTableWidgetItem *item = tableWidget->item(row,8);
+        if(item)
+        {
+            if(item->data(Qt::UserRole).toString().isEmpty())
+            {
+                button->setEnabled(false);
+            }
+        }
+        ui->tableWidget->setCellWidget(row,tableWidget->columnCount()-1,button);
+    }
+    tableWidget->sortByColumn(0);
+    tableWidget->sortByColumn(0);
+}
+void FormWoolUpload::setCellElement(QTableWidget *tableWidget, int row, int col,
+                                     QString key,QString value,QMap<QString,QString> data)
+{
+    QTableWidgetItem* item = new QTableWidgetItem();
+    QVariant display = value;
+    QVariant tooltip = value;
+    item->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
+    //进行数据翻译
+    if(key=="filetype")
+    {
+        if(value=="1")
+            display = "号码文件";
+        else if(value=="2")
+            display = "号段文件";
+        else
+            display = "未知";
+        tooltip = display;
+    }
+    else if(key=="fileid")
+    {
+        display = "";
+        tooltip = "";
+        item->setCheckState(Qt::Unchecked);
+    }
+    else if(key=="filename")
+    {
+        QString filePath = data.value("filepath");
+        QString fileMemo = data.value("memo");
+        tooltip =  QString("文件:%1\r\n备注:%2").arg(filePath).arg(fileMemo);
+        item->setTextAlignment(Qt::AlignLeft|Qt::AlignVCenter);
+    }
+
+    //设置单元格显示形式,是用item填充还是widget填充
+    if(key=="uploadstate")
+    {
+        delete item;
+
+        int uploadstate = value.toInt();
+        QLabel *lbl = new QLabel();
+        lbl->setAlignment(Qt::AlignCenter|Qt::AlignHCenter);
+        lbl->setProperty("value",uploadstate);
+        if(uploadstate < 0 )//上传失败,发生了错误
+        {
+            lbl->setPixmap(QPixmap(":/task_error.png"));
+            lbl->setToolTip("上传失败,详细原因请点击查看按钮");
+        }
+        else if(uploadstate>=0 && uploadstate<3)//等待上传或上传中
+        {
+            lbl->setToolTip("正在上传,请稍候");
+            lbl->setMovie(m_movie);
+        }
+        else if(uploadstate>3)//未知状态
+        {
+           lbl->setText("未知");
+        }
+        else  //(uploadstate == 3)
+        {
+            lbl->setPixmap(QPixmap(":/task_ok.png"));
+            lbl->setToolTip("上传成功");
+        }
+        tableWidget->setCellWidget(row,col,lbl);
+    }
+    else if(key=="percent")
+    {
+        delete item;
+        int uploadstate = data.value("uploadstate").toInt();
+        double percent = value.toDouble();
+        QLabel *lbl = new QLabel();
+        lbl->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
+        XProgressBar *progress = 0;
+        if(uploadstate<0)
+        {
+            lbl->setText("<font color=red>上传失败</>");
+        }
+        else if(uploadstate>=0 && uploadstate<3)//等待上传或上传中
+        {
+            delete lbl;
+            lbl = 0;
+            progress = new XProgressBar();
+        }
+        else
+        {
+            lbl->setText("上传成功");
+        }
+        if(lbl)
+        {
+            tableWidget->setCellWidget(row,col,lbl);
+        }
+        else
+        {
+            progress->setProgress(uploadstate,percent);
+            tableWidget->setCellWidget(row,col,progress);
+        }
+    }
+    else
+    {
+        item->setData(Qt::DisplayRole,display);
+        item->setData(Qt::UserRole,value);
+        item->setData(Qt::ToolTipRole,tooltip);
+        tableWidget->setItem(row,col,item);
+    }
+}
+void FormWoolUpload::query()
+{
+    QString userCode = m_account.value("usercode");
+    QMultiMap<QString,QString> list = SNCDataBase::getAllUpload("Wool",m_clientID,userCode);
+    int cols = list.uniqueKeys().size();
+    int rows = 0;
+    if(cols!=0)
+        rows = list.size()/cols;
+    if(list.size()==0)
+    {
+        setTableWidgetNoData(ui->tableWidget);
+        return ;
+    }
+    QStringList ids;
+    QString curId;
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            if(item->checkState()==Qt::Checked)
+            {
+                ids<<item->data(Qt::UserRole).toString();
+            }
+            if(item->isSelected())
+            {
+                curId = item->data(Qt::UserRole).toString();
+            }
+        }
+    }
+    fillDataList(ui->tableWidget,m_keys,list,rows);
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        if(curId.isEmpty())
+        {
+            ui->tableWidget->selectRow(i);
+            ui->tableWidget->setFocus();
+            break;
+        }
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            QString id = item->data(Qt::UserRole).toString();
+            if(curId==id)
+            {
+                ui->tableWidget->selectRow(i);
+                ui->tableWidget->setFocus();
+            }
+            for(int i=0;i<ids.size();i++)
+            {
+                if(id==ids.at(i))
+                {
+                    item->setCheckState(Qt::Checked);
+                    break;
+                }
+            }
+        }
+    }
+}
+
+void FormWoolUpload::showRtnMessage(int row)
+{
+    QTableWidgetItem *itemMsg = ui->tableWidget->item(row,8);
+    QTableWidgetItem *itemDetail = ui->tableWidget->item(row,9);
+    QString errMsg = "";
+    QString errDetail = "";
+    if(itemMsg)
+    {
+        errMsg = itemMsg->data(Qt::UserRole).toString();
+    }
+    if(itemDetail)
+    {
+        errDetail = itemDetail->data(Qt::UserRole).toString();
+    }
+    if(errDetail.isEmpty())
+    {
+        if(!errMsg.isEmpty())
+        {
+             QMessageBox::critical(this,"提示",errMsg,QMessageBox::Ok);
+        }
+    }
+    else
+    {
+        DialogSubmitResponseDetail dialog;
+        dialog.setDetailText(errDetail);
+        dialog.exec();
+    }
+}
+
+void FormWoolUpload::on_pushButtonAddFile_clicked()
+{
+    if(!chkAccountState(m_state))
+            return;
+    QString userCode = m_account.value("usercode");
+
+    DialogSubmit dialog(this);
+    connect(&dialog,SIGNAL(dataUpdated()),this,SLOT(onDataUpdated()));
+    dialog.setUserCode(userCode);
+    dialog.setClientID(m_clientID);
+    dialog.exec();
+}
+void FormWoolUpload::onPushButtonViewsClicked()
+{
+    QPushButton *btn = qobject_cast<QPushButton*>(sender());
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+       QWidget *widget = ui->tableWidget->cellWidget(i,ui->tableWidget->columnCount()-1);
+       if(widget)
+       {
+           if(btn==qobject_cast<QPushButton*>(widget))
+           {
+               showRtnMessage(i);
+               break;
+           }
+       }
+    }
+}
+
+void FormWoolUpload::onDataUpdated()
+{
+    query();
+}
+
+void FormWoolUpload::on_checkBox_clicked()
+{
+    Qt::CheckState state;
+    state = ui->checkBox->checkState();
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            item->setCheckState(state);
+        }
+    }
+}
+
+void FormWoolUpload::on_pushButtonDel_clicked()
+{
+    if(!chkAccountState(m_state))
+        return ;
+    bool nodata = true;
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            if(item->checkState()==Qt::Checked)
+            {
+                nodata = false;
+            }
+        }
+    }
+    if(nodata)
+    {
+        QMessageBox::critical(this,"提示","请选择要删除的单子",QMessageBox::Ok);
+        return ;
+    }
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            if(item->checkState()==Qt::Checked)
+            {
+                QWidget *widget = ui->tableWidget->cellWidget(i,1);
+                if(widget)
+                {
+                    QLabel *lbl = qobject_cast<QLabel*>(widget);
+                    int state = lbl->property("value").toInt();
+                    if(state>=0 && state<=2)
+                    {
+                        QMessageBox::critical(this,"提示","只能删除上传任务已经结束的单子!",QMessageBox::Ok);
+                        return ;
+
+                    }
+                }
+            }
+        }
+    }
+    for(int i=0;i<ui->tableWidget->rowCount();i++)
+    {
+        QTableWidgetItem *item = ui->tableWidget->item(i,0);
+        if(item)
+        {
+            if(item->checkState()==Qt::Checked)
+            {
+                int fileid = item->data(Qt::UserRole).toInt();
+                SNCDataBase::deleteFileByFileID(fileid);
+            }
+        }
+    }
+    query();
+}
+
+
+void FormWoolUpload::on_tableWidget_cellDoubleClicked(int row, int column)
+{
+    showRtnMessage(row);
+}
+bool FormWoolUpload::chkAccountState(AccountLoginState state)
+{
+
+    bool ret = false;
+    switch(state)
+    {
+        case NotLogin:
+            QMessageBox::critical(this,"提示","您现在还没有登录系统,请登录后再操作!",QMessageBox::Ok);
+            break;
+        case NotBind:
+            QMessageBox::critical(this,"提示","此项服务尚未开通,请开通后再操作!",QMessageBox::Ok);
+            break;
+        case LoginError:
+            QMessageBox::critical(this,"提示","此项服务暂时无法连接,请稍候重试!",QMessageBox::Ok);
+            break;
+        default:
+            ret = true;
+    }
+    return ret;
+}

+ 63 - 0
sncprojects/lib/SNCWool/formwoolupload.h

@@ -0,0 +1,63 @@
+#ifndef FORMWOOLUPLOAD_H
+#define FORMWOOLUPLOAD_H
+
+#include <QWidget>
+#include <QtGui>
+#include "snccore.h"
+namespace Ui {
+class FormWoolUpload;
+}
+
+class FormWoolUpload : public QWidget
+{
+    Q_OBJECT
+    
+public:
+    explicit FormWoolUpload(QWidget *parent = 0);
+    ~FormWoolUpload();
+public slots:
+    void setAccountInfo(QMap<QString,QString> info);
+    void setClientName(QString name);
+    void setClientID(QString clientID);
+private slots:
+
+    void onPushButtonViewsClicked();
+    void onDataUpdated();
+
+    void on_checkBox_clicked();
+    void on_pushButtonAddFile_clicked();
+    void on_pushButtonDel_clicked();
+
+    void on_tableWidget_cellDoubleClicked(int row, int column);
+
+
+private:
+    void initVariables();                                                       //初始化成员变量
+    void initUI();                                                              //初始化UI样式
+    void setTableWidgetNoData(QTableWidget *tableWidget);                       //设置数据区列表信息为默认状态
+    void setTableWidgetSyncData(QTableWidget *tableWidget);                       //设置数据区列表信息为同步状态
+    void prepareTableWidgetCells(QTableWidget *tableWidget,int rows);           //设置table widget单元格
+    void fillDataList(QTableWidget *tableWidget,QStringList keys,
+                      QMultiMap<QString,QString> list,int rowCount);            //填充数据表
+    void setCellElement(QTableWidget *tableWidget, int row, int col,
+                        QString key,QString value,QMap<QString,QString> data);  //设置单元格内容
+    void query();
+    void showRtnMessage(int row);
+    bool chkAccountState(AccountLoginState state);
+private:
+    Ui::FormWoolUpload *ui;
+
+    QString m_host;
+    QString m_port;
+    QString m_clientName;
+    QString m_clientID;
+
+    QMap<QString,QString> m_account;
+    QMovie *m_movie;
+    QMovie *m_movieBig;
+    QStringList m_keys;
+    QStringList m_headers;
+    AccountLoginState m_state;
+};
+
+#endif // FORMWOOLUPLOAD_H

+ 65 - 0
sncprojects/lib/SNCWool/formwoolupload.ui

@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>FormWoolUpload</class>
+ <widget class="QWidget" name="FormWoolUpload">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>400</width>
+    <height>300</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Form</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <layout class="QHBoxLayout" name="horizontalLayout">
+     <property name="leftMargin">
+      <number>3</number>
+     </property>
+     <item>
+      <widget class="QCheckBox" name="checkBox">
+       <property name="text">
+        <string>全选</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <spacer name="horizontalSpacer">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item>
+      <widget class="QPushButton" name="pushButtonAddFile">
+       <property name="text">
+        <string>添加...</string>
+       </property>
+      </widget>
+     </item>
+     <item>
+      <widget class="QPushButton" name="pushButtonDel">
+       <property name="text">
+        <string>删除</string>
+       </property>
+      </widget>
+     </item>
+    </layout>
+   </item>
+   <item>
+    <widget class="QTableWidget" name="tableWidget"/>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>

+ 6 - 0
sncprojects/lib/SNCWool/sncwool.cpp

@@ -0,0 +1,6 @@
+#include "sncwool.h"
+
+
+SNCWool::SNCWool()
+{
+}

+ 12 - 0
sncprojects/lib/SNCWool/sncwool.h

@@ -0,0 +1,12 @@
+#ifndef SNCWOOL_H
+#define SNCWOOL_H
+
+#include "SNCWool_global.h"
+
+class SNCWOOLSHARED_EXPORT SNCWool
+{
+public:
+    SNCWool();
+};
+
+#endif // SNCWOOL_H

+ 43 - 0
sncprojects/lib/SNCWool/xprogressbar.cpp

@@ -0,0 +1,43 @@
+#include "xprogressbar.h"
+
+XProgressBar::XProgressBar(QWidget *parent) :
+    QWidget(parent)
+{
+    m_progress = new QProgressBar();
+    m_layout = new QHBoxLayout();
+    m_layout->addWidget(m_progress);
+    m_layout->setMargin(0);
+    m_progress->setFixedHeight(15);
+    m_progress->setTextVisible(true);
+    this->setLayout(m_layout);
+}
+
+XProgressBar::~XProgressBar()
+{
+    delete m_progress;
+    delete m_layout;
+}
+
+void XProgressBar::setProgress(int state,int value)
+{
+
+    if(state>=0 && state<3)
+    {
+        m_progress->setValue(value);
+        m_progress->setFormat("ÉÏ´«£º"+QString::number(value)+"%");
+        m_progress->setProperty("class","upload");
+    }
+    else if(state==3)
+    {
+
+        m_progress->setValue(value);
+        m_progress->setFormat("¼ì²â£º"+QString::number(value)+"%");
+        m_progress->setProperty("class","check");
+    }
+    else
+    {
+        m_progress->setValue(value);
+        m_progress->setFormat(QString::number(value)+"%");
+        m_progress->setProperty("class","normal");
+    }
+}

+ 23 - 0
sncprojects/lib/SNCWool/xprogressbar.h

@@ -0,0 +1,23 @@
+#ifndef XPROGRESSBAR_H
+#define XPROGRESSBAR_H
+
+#include <QWidget>
+#include <QtGui>
+class XProgressBar : public QWidget
+{
+    Q_OBJECT
+public:
+    explicit XProgressBar(QWidget *parent = 0);
+    ~XProgressBar();
+    void setProgress(int state,int value);
+signals:
+
+public slots:
+
+private:
+    QHBoxLayout *m_layout;
+    QProgressBar *m_progress;
+    int  *m_state;
+};
+
+#endif // XPROGRESSBAR_H

+ 53 - 0
sncprojects/lib/WSWool/WSWool.pro

@@ -0,0 +1,53 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2019-07-14T13:35:37
+#
+#-------------------------------------------------
+
+QT       += network script
+QT       -= gui
+include(../../3rdparty/qtsoap/src/qtsoap.pri)
+TARGET = WSWool
+TEMPLATE = lib
+INCLUDEPATH += ../SNCDatabase
+DESTDIR = ../../output
+DEFINES += WSWOOL_LIBRARY
+LIBS += ../../output/sncdatabase.dll
+
+SOURCES += wswool.cpp \
+    wool.cpp \
+    respchkuserfeestatus.cpp \
+    respdlresultfile.cpp \
+    respgetchargeinfo.cpp \
+    respgetcostinfo.cpp \
+    respgetdealinfo.cpp \
+    respgetfinishedinfo.cpp \
+    respgetsysparam.cpp \
+    respgetuserblance.cpp \
+    resppackmerge.cpp \
+    resppacktran.cpp \
+    respsubminpnum.cpp \
+
+HEADERS += wswool.h\
+        WSWool_global.h \
+    wool.h \
+    respchkuserfeestatus.h \
+    respdlresultfile.h \
+    respgetchargeinfo.h \
+    respgetcostinfo.h \
+    respgetdealinfo.h \
+    respgetfinishedinfo.h \
+    respgetsysparam.h \
+    respgetuserblance.h \
+    resppackmerge.h \
+    resppacktran.h \
+    respsubminpnum.h \
+
+unix:!symbian {
+    maemo5 {
+        target.path = /opt/usr/lib
+    } else {
+        target.path = /usr/lib
+    }
+    INSTALLS += target
+}

+ 19 - 0
sncprojects/lib/WSWool/WSWool_global.h

@@ -0,0 +1,19 @@
+#ifndef WSWOOL_GLOBAL_H
+#define WSWOOL_GLOBAL_H
+
+#include <QtCore/qglobal.h>
+
+#define RTNCODE_NETWORK_NOTAVAILABLE    -10000
+#define RTNCODE_NETWORK_ABORT           -10001
+#define RTNCODE_INVALID_FORMAT          -10002
+#define RTNMEMO_NETWORK_NOTAVAILABLE    "网络连接不可用"
+#define RTNMEMO_NETWORK_ABORT           "操作被系统中止或暂停"
+#define RTNMEMO_INVALID_FORMAT          "参数无效或非法的数据格式"
+
+#if defined(WSWOOL_LIBRARY)
+#  define WSWOOLSHARED_EXPORT Q_DECL_EXPORT
+#else
+#  define WSWOOLSHARED_EXPORT Q_DECL_IMPORT
+#endif
+
+#endif // WSWOOL_GLOBAL_H

+ 48 - 0
sncprojects/lib/WSWool/respchkuserfeestatus.cpp

@@ -0,0 +1,48 @@
+#include "respchkuserfeestatus.h"
+#include <QScriptValue>
+#include <QScriptEngine>
+#include <QScriptValueIterator>
+RespChkUserFeeStatus::RespChkUserFeeStatus(QString json)
+{
+    this->json = json;
+    QScriptEngine engine;
+    QScriptValue sv = engine.evaluate("value = " + this->json);
+    QScriptValueIterator it(sv);
+
+    this->rtnMemo = "";
+    if(json.isEmpty())
+    {
+        rtnCode = RTNCODE_NETWORK_NOTAVAILABLE;
+        rtnMemo = RTNMEMO_NETWORK_NOTAVAILABLE;
+    }
+    else if(json=="ABORT")
+    {
+        rtnCode = RTNCODE_NETWORK_ABORT;
+        rtnMemo = RTNMEMO_NETWORK_ABORT;
+    }
+    else
+    {
+        rtnCode = RTNCODE_INVALID_FORMAT;
+        rtnMemo = RTNMEMO_INVALID_FORMAT;
+        while (it.hasNext())
+        {
+            it.next();
+            if(it.name()=="rtnCode")
+            {
+                this->rtnCode = it.value().toInt32();
+            }
+            else if(it.name()=="rtnMemo")
+            {
+                this->rtnMemo = it.value().toString();
+            }
+        }
+    }
+}
+int RespChkUserFeeStatus::getRtnCode()
+{
+    return this->rtnCode;
+}
+QString RespChkUserFeeStatus::getRtnMemo()
+{
+    return this->rtnMemo;
+}

+ 18 - 0
sncprojects/lib/WSWool/respchkuserfeestatus.h

@@ -0,0 +1,18 @@
+#ifndef RESPCHKUSERFEESTATUS_H
+#define RESPCHKUSERFEESTATUS_H
+#include <QtCore>
+#include "WSWool_global.h"
+
+class WSWOOLSHARED_EXPORT RespChkUserFeeStatus
+{
+public:
+    RespChkUserFeeStatus(QString json);
+    int getRtnCode();
+    QString getRtnMemo();
+private:
+    int rtnCode;
+    QString rtnMemo;
+    QString json;
+};
+
+#endif // RESPCHKUSERFEESTATUS_H

+ 72 - 0
sncprojects/lib/WSWool/respdlresultfile.cpp

@@ -0,0 +1,72 @@
+#include "respdlresultfile.h"
+#include <QScriptValue>
+#include <QScriptEngine>
+#include <QScriptValueIterator>
+RespDlResultFile::RespDlResultFile(QString json)
+{
+    this->json = json;
+    QScriptEngine engine;
+    QScriptValue sv = engine.evaluate("value = " + this->json);
+    QScriptValueIterator it(sv);
+    if(json.isEmpty())
+    {
+        rtnCode = RTNCODE_NETWORK_NOTAVAILABLE;
+        rtnMemo = RTNMEMO_NETWORK_NOTAVAILABLE;
+    }
+    else if(json=="ABORT")
+    {
+        rtnCode = RTNCODE_NETWORK_ABORT;
+        rtnMemo = RTNMEMO_NETWORK_ABORT;
+    }
+    else
+    {
+        rtnCode = RTNCODE_INVALID_FORMAT;
+        rtnMemo = RTNMEMO_INVALID_FORMAT;
+
+        while (it.hasNext())
+        {
+            it.next();
+            if(it.name()=="rtnCode")
+            {
+                this->rtnCode = it.value().toInt32();
+            }
+            else if(it.name()=="rtnMemo")
+            {
+                this->rtnMemo = it.value().toString();
+            }
+            else if(it.name()=="fileName")
+            {
+                this->fileName = it.value().toString();
+            }
+            else if(it.name()=="fileContent")
+            {
+                this->fileContent = it.value().toString();
+            }
+            else if(it.name()=="fcEncodeType")
+            {
+                this->fcEncodeType = it.value().toString();
+            }
+        }
+    }
+
+}
+int RespDlResultFile::getRtnCode()
+{
+    return this->rtnCode;
+}
+QString RespDlResultFile::getRtnMemo()
+{
+    return this->rtnMemo;
+}
+QString RespDlResultFile::getFileName()
+{
+    return this->fileName;
+}
+QString RespDlResultFile::getFileContent()
+{
+    return this->fileContent;
+}
+QString RespDlResultFile::getFcEncodeType()
+{
+    return this->fcEncodeType;
+}

+ 24 - 0
sncprojects/lib/WSWool/respdlresultfile.h

@@ -0,0 +1,24 @@
+#ifndef RESPDLRESULTFILE_H
+#define RESPDLRESULTFILE_H
+#include <QtCore>
+#include "WSWool_global.h"
+
+class WSWOOLSHARED_EXPORT RespDlResultFile
+{
+public:
+    RespDlResultFile(QString json);
+    int getRtnCode();
+    QString getRtnMemo();
+    QString getFileName();
+    QString getFileContent();
+    QString getFcEncodeType();
+
+private:
+    int rtnCode;
+    QString rtnMemo;
+    QString json;
+    QString fileName;
+    QString fileContent;
+    QString fcEncodeType;
+};
+#endif // RESPDLRESULTFILE_H

+ 80 - 0
sncprojects/lib/WSWool/respgetchargeinfo.cpp

@@ -0,0 +1,80 @@
+#include "respgetchargeinfo.h"
+#include <QScriptValue>
+#include <QScriptEngine>
+#include <QScriptValueIterator>
+RespGetChargeInfo::RespGetChargeInfo(QString json)
+{
+    this->json = json;
+    QScriptEngine engine;
+    QScriptValue sv = engine.evaluate("value = " + this->json);
+    QScriptValueIterator it(sv);
+    if(json.isEmpty())
+    {
+        rtnCode = RTNCODE_NETWORK_NOTAVAILABLE;
+        rtnMemo = RTNMEMO_NETWORK_NOTAVAILABLE;
+    }
+    else if(json=="ABORT")
+    {
+        rtnCode = RTNCODE_NETWORK_ABORT;
+        rtnMemo = RTNMEMO_NETWORK_ABORT;
+    }
+    else
+    {
+        rtnCode = RTNCODE_INVALID_FORMAT;
+        rtnMemo = RTNMEMO_INVALID_FORMAT;
+        while (it.hasNext())
+        {
+            it.next();
+            if(it.name()=="rtnCode")
+            {
+                this->rtnCode = it.value().toInt32();
+            }
+            else if(it.name()=="rtnMemo")
+            {
+                this->rtnMemo = it.value().toString();
+            }
+            else if(it.name()=="rsCount")
+            {
+                this->rsCount = it.value().toInt32();
+            }
+            else if(it.name()=="sum_chargemoney")
+            {
+                this->totalMoney = it.value().toInt32();
+            }
+            else
+            {
+                QScriptValue sv1 = it.value();
+                map.insert("serialnum",sv1.property("serialnum").toString());
+                map.insert("chargeid",sv1.property("chargeid").toString());
+//                map.insert("batchtype",sv1.property("batchtype").toString());
+                map.insert("usercode",sv1.property("usercode").toString());
+                map.insert("premoney",sv1.property("premoney").toString());
+                map.insert("chargemoney",sv1.property("chargemoney").toString());
+                map.insert("aftermoney",sv1.property("aftermoney").toString());
+                map.insert("chargetime",sv1.property("chargetime").toString());
+                map.insert("memo",sv1.property("memo").toString());
+                map.insert("discountset",sv1.property("discountset").toString());
+                map.insert("pregiftmoney",sv1.property("pregiftmoney").toString());
+                map.insert("aftergiftmoney",sv1.property("aftergiftmoney").toString());
+                map.insert("giftmoney",sv1.property("giftmoney").toString());
+            }
+        }
+    }
+
+}
+int RespGetChargeInfo::getRtnCode()
+{
+    return this->rtnCode;
+}
+QString RespGetChargeInfo::getRtnMemo()
+{
+    return this->rtnMemo;
+}
+int RespGetChargeInfo::getRsCount()
+{
+    return this->rsCount;
+}
+QMultiMap<QString,QString> RespGetChargeInfo::getRs()
+{
+    return this->map;
+}

+ 22 - 0
sncprojects/lib/WSWool/respgetchargeinfo.h

@@ -0,0 +1,22 @@
+#ifndef RESPGETCHARGEINFO_H
+#define RESPGETCHARGEINFO_H
+#include <QtCore>
+#include "WSWool_global.h"
+
+class WSWOOLSHARED_EXPORT RespGetChargeInfo
+{
+public:
+    RespGetChargeInfo(QString json);
+    int getRtnCode();
+    QString getRtnMemo();
+    int getRsCount();
+    QMultiMap<QString,QString> getRs();
+private:
+    int rtnCode;
+    QString rtnMemo;
+    QString json;
+    QMultiMap<QString,QString> map;
+    int rsCount;
+    int totalMoney;
+};
+#endif // RESPGETCHARGEINFO_H

+ 79 - 0
sncprojects/lib/WSWool/respgetcostinfo.cpp

@@ -0,0 +1,79 @@
+#include "respgetcostinfo.h"
+#include <QScriptValue>
+#include <QScriptEngine>
+#include <QScriptValueIterator>
+RespGetCostInfo::RespGetCostInfo(QString json)
+{
+    this->json = json;
+    QScriptEngine engine;
+    QScriptValue sv = engine.evaluate("value = " + this->json);
+    QScriptValueIterator it(sv);
+    if(json.isEmpty())
+    {
+        rtnCode = RTNCODE_NETWORK_NOTAVAILABLE;
+        rtnMemo = RTNMEMO_NETWORK_NOTAVAILABLE;
+    }
+    else if(json=="ABORT")
+    {
+        rtnCode = RTNCODE_NETWORK_ABORT;
+        rtnMemo = RTNMEMO_NETWORK_ABORT;
+    }
+    else
+    {
+        rtnCode = RTNCODE_INVALID_FORMAT;
+        rtnMemo = RTNMEMO_INVALID_FORMAT;
+        while (it.hasNext())
+        {
+            it.next();
+            if(it.name()=="rtnCode")
+            {
+                this->rtnCode = it.value().toInt32();
+            }
+            else if(it.name()=="rtnMemo")
+            {
+                this->rtnMemo = it.value().toString();
+            }
+            else if(it.name()=="rsCount")
+            {
+                this->rsCount = it.value().toInt32();
+            }
+            else if(it.name()=="sum_settlefee")
+            {
+                this->totalFee = it.value().toString();
+            }
+            else
+            {
+                QScriptValue sv1 = it.value();
+                map.insert("serialnum",sv1.property("serialnum").toString());
+                map.insert("batchid",sv1.property("batchid").toString());
+                map.insert("batchtype",sv1.property("batchtype").toString());
+                map.insert("detail",sv1.property("detail").toString());
+                map.insert("usercode",sv1.property("usercode").toString());
+                map.insert("submittime",sv1.property("submittime").toString());
+                map.insert("finishtime",sv1.property("finishtime").toString());
+                map.insert("numcount",sv1.property("numcount").toString());
+                map.insert("finishcount",sv1.property("finishcount").toString());
+                map.insert("price",sv1.property("price").toString());
+                map.insert("settlefee",sv1.property("settlefee").toString());
+                map.insert("giftfee",sv1.property("giftfee").toString());
+            }
+        }
+    }
+
+}
+int RespGetCostInfo::getRtnCode()
+{
+    return this->rtnCode;
+}
+QString RespGetCostInfo::getRtnMemo()
+{
+    return this->rtnMemo;
+}
+int RespGetCostInfo::getRsCount()
+{
+    return this->rsCount;
+}
+QMultiMap<QString,QString> RespGetCostInfo::getRs()
+{
+    return this->map;
+}

+ 23 - 0
sncprojects/lib/WSWool/respgetcostinfo.h

@@ -0,0 +1,23 @@
+#ifndef RESPGETCOSTINFO_H
+#define RESPGETCOSTINFO_H
+#include <QtCore>
+#include "WSWool_global.h"
+
+class WSWOOLSHARED_EXPORT RespGetCostInfo
+{
+public:
+    RespGetCostInfo(QString json);
+    int getRtnCode();
+    QString getRtnMemo();
+    QString getTotalFee();
+    int getRsCount();
+    QMultiMap<QString,QString> getRs();
+private:
+    int rtnCode;
+    QString rtnMemo;
+    QString json;
+    QMultiMap<QString,QString> map;
+    QString totalFee;
+    int rsCount;
+};
+#endif // RESPGETCOSTINFO_H

+ 82 - 0
sncprojects/lib/WSWool/respgetdealinfo.cpp

@@ -0,0 +1,82 @@
+#include "respgetdealinfo.h"
+#include <QScriptValue>
+#include <QScriptEngine>
+#include <QScriptValueIterator>
+RespGetDealInfo::RespGetDealInfo(QString json)
+{
+    this->json = json;
+    QScriptEngine engine;
+    QScriptValue sv = engine.evaluate("value = " + this->json);
+    QScriptValueIterator it(sv);
+    if(json.isEmpty())
+    {
+        rtnCode = RTNCODE_NETWORK_NOTAVAILABLE;
+        rtnMemo = RTNMEMO_NETWORK_NOTAVAILABLE;
+    }
+    else if(json=="ABORT")
+    {
+        rtnCode = RTNCODE_NETWORK_ABORT;
+        rtnMemo = RTNMEMO_NETWORK_ABORT;
+    }
+    else
+    {
+        rtnCode = RTNCODE_INVALID_FORMAT;
+        rtnMemo = RTNMEMO_INVALID_FORMAT;
+        while (it.hasNext())
+        {
+            it.next();
+            if(it.name()=="rtnCode")
+            {
+                this->rtnCode = it.value().toInt32();
+            }
+            else if(it.name()=="rtnMemo")
+            {
+                this->rtnMemo = it.value().toString();
+            }
+            else if(it.name()=="rsCount")
+            {
+                this->rsCount = it.value().toInt32();
+            }
+            else
+            {
+                QScriptValue sv1 = it.value();
+                map.insert("serialnum",sv1.property("serialnum").toString());
+                map.insert("batchid",sv1.property("batchid").toString());
+                map.insert("batchtype",sv1.property("batchtype").toString());
+                map.insert("detail",sv1.property("detail").toString());
+                map.insert("resulttj",sv1.property("resulttj").toString());
+                map.insert("usercode",sv1.property("usercode").toString());
+                map.insert("submittime",sv1.property("submittime").toString());
+                map.insert("tftime",sv1.property("tftime").toString());
+                map.insert("vftime",sv1.property("vftime").toString());
+                map.insert("isverify",sv1.property("isverify").toString());
+                if(sv1.property("settlefee").toString()=="null")
+                    map.insert("settlefee","");
+                else
+                    map.insert("settlefee",sv1.property("settlefee").toString());
+                map.insert("giftfee",sv1.property("giftfee").toString());
+                map.insert("numcount",sv1.property("numcount").toString());
+                map.insert("dlcount",sv1.property("dlcount").toString());
+                map.insert("finishcount",sv1.property("finishcount").toString());
+                map.insert("optstatus",sv1.property("optstatus").toString());
+            }
+        }
+    }
+
+}
+int RespGetDealInfo::getRtnCode()
+{
+    return this->rtnCode;
+}
+QString RespGetDealInfo::getRtnMemo()
+{
+    return this->rtnMemo;
+}
+int RespGetDealInfo::getRsCount()
+{
+    return this->rsCount;
+}
+QMultiMap<QString,QString> RespGetDealInfo::getRs()
+{
+    return this->map;
+}

+ 23 - 0
sncprojects/lib/WSWool/respgetdealinfo.h

@@ -0,0 +1,23 @@
+#ifndef RESPGETDEALINFO_H
+#define RESPGETDEALINFO_H
+#include <QtCore>
+#include "WSWool_global.h"
+
+class WSWOOLSHARED_EXPORT RespGetDealInfo
+{
+public:
+    RespGetDealInfo(QString json);
+    int getRtnCode();
+    QString getRtnMemo();
+    int getRsCount();
+    QMultiMap<QString,QString> getRs();
+private:
+    int rtnCode;
+    QString rtnMemo;
+    QString json;
+    QMultiMap<QString,QString> map;
+    int rsCount;
+};
+
+
+#endif // RESPGETDEALINFO_H

+ 80 - 0
sncprojects/lib/WSWool/respgetfinishedinfo.cpp

@@ -0,0 +1,80 @@
+#include "respgetfinishedinfo.h"
+#include <QScriptValue>
+#include <QScriptEngine>
+#include <QScriptValueIterator>
+RespGetFinishedInfo::RespGetFinishedInfo(QString json)
+{
+    this->json = json;
+    QScriptEngine engine;
+    QScriptValue sv = engine.evaluate("value = " + this->json);
+    QScriptValueIterator it(sv);
+    if(json.isEmpty())
+    {
+        rtnCode = RTNCODE_NETWORK_NOTAVAILABLE;
+        rtnMemo = RTNMEMO_NETWORK_NOTAVAILABLE;
+    }
+    else if(json=="ABORT")
+    {
+        rtnCode = RTNCODE_NETWORK_ABORT;
+        rtnMemo = RTNMEMO_NETWORK_ABORT;
+    }
+    else
+    {
+        rtnCode = RTNCODE_INVALID_FORMAT;
+        rtnMemo = RTNMEMO_INVALID_FORMAT;
+        while (it.hasNext())
+        {
+            it.next();
+            if(it.name()=="rtnCode")
+            {
+                this->rtnCode = it.value().toInt32();
+            }
+            else if(it.name()=="rtnMemo")
+            {
+                this->rtnMemo = it.value().toString();
+            }
+            else if(it.name()=="rsCount")
+            {
+                this->rsCount = it.value().toInt32();
+            }
+            else
+            {
+                QScriptValue sv1 = it.value();
+                map.insert("serialnum",sv1.property("serialnum").toString());
+                map.insert("batchid",sv1.property("batchid").toString());
+                map.insert("batchtype",sv1.property("batchtype").toString());
+                map.insert("detail",sv1.property("detail").toString());
+                map.insert("resulttj",sv1.property("resulttj").toString());
+                map.insert("usercode",sv1.property("usercode").toString());
+                map.insert("submittime",sv1.property("submittime").toString());
+                map.insert("finishtime",sv1.property("finishtime").toString());
+                map.insert("settlefee",sv1.property("settlefee").toString());
+                map.insert("giftfee",sv1.property("giftfee").toString());
+                map.insert("numcount",sv1.property("numcount").toString());
+                map.insert("dlcount",sv1.property("dlcount").toString());
+                map.insert("finishcount",sv1.property("finishcount").toString());
+                map.insert("optstatus",sv1.property("optstatus").toString());
+                map.insert("ispass",sv1.property("ispass").toString());
+                map.insert("isdeliver",sv1.property("isdeliver").toString());
+                map.insert("delivertime",sv1.property("delivertime").toString());
+            }
+        }
+    }
+
+}
+int RespGetFinishedInfo::getRtnCode()
+{
+    return this->rtnCode;
+}
+QString RespGetFinishedInfo::getRtnMemo()
+{
+    return this->rtnMemo;
+}
+int RespGetFinishedInfo::getRsCount()
+{
+    return this->rsCount;
+}
+QMultiMap<QString,QString> RespGetFinishedInfo::getRs()
+{
+    return this->map;
+}

+ 22 - 0
sncprojects/lib/WSWool/respgetfinishedinfo.h

@@ -0,0 +1,22 @@
+#ifndef RESPGETFINISHEDINFO_H
+#define RESPGETFINISHEDINFO_H
+#include <QtCore>
+#include "WSWool_global.h"
+
+class WSWOOLSHARED_EXPORT RespGetFinishedInfo
+{
+public:
+    RespGetFinishedInfo(QString json);
+    int getRtnCode();
+    QString getRtnMemo();
+    int getRsCount();
+    QMultiMap<QString,QString> getRs();
+private:
+    int rtnCode;
+    QString rtnMemo;
+    QString json;
+    QMultiMap<QString,QString> map;
+    int rsCount;
+};
+
+#endif // RESPGETFINISHEDINFO_H

+ 71 - 0
sncprojects/lib/WSWool/respgetsysparam.cpp

@@ -0,0 +1,71 @@
+#include "respgetsysparam.h"
+#include <QScriptValue>
+#include <QScriptEngine>
+#include <QScriptValueIterator>
+RespGetSysParam::RespGetSysParam(QString json)
+{
+    this->json = json;
+    QScriptEngine engine;
+    QScriptValue sv = engine.evaluate("value = " + this->json);
+    QScriptValueIterator it(sv);
+    if(json.isEmpty())
+    {
+        rtnCode = RTNCODE_NETWORK_NOTAVAILABLE;
+        rtnMemo = RTNMEMO_NETWORK_NOTAVAILABLE;
+    }
+    else if(json=="ABORT")
+    {
+        rtnCode = RTNCODE_NETWORK_ABORT;
+        rtnMemo = RTNMEMO_NETWORK_ABORT;
+    }
+    else
+    {
+        rtnCode = RTNCODE_INVALID_FORMAT;
+        rtnMemo = RTNMEMO_INVALID_FORMAT;
+        while (it.hasNext())
+        {
+            it.next();
+            if(it.name()=="rtnCode")
+            {
+                this->rtnCode = it.value().toInt32();
+            }
+            else if(it.name()=="rtnMemo")
+            {
+                this->rtnMemo = it.value().toString();
+            }
+            else if(it.name()=="rsCount")
+            {
+                this->rsCount = it.value().toInt32();
+            }
+            else if(it.name()=="FhymPnumMinSize")
+            {
+                this->map.insert("FhymPnumMinSize",it.value().toString());
+            }
+            else if(it.name()=="FhymPnumMaxSize")
+            {
+                this->map.insert("FhymPnumMaxSize",it.value().toString());
+            }
+            else if(it.name()=="FhymPnumPrice")
+            {
+                this->map.insert("FhymPnumPrice",it.value().toString());
+            }
+        }
+    }
+
+}
+int RespGetSysParam::getRtnCode()
+{
+    return this->rtnCode;
+}
+QString RespGetSysParam::getRtnMemo()
+{
+    return this->rtnMemo;
+}
+int RespGetSysParam::getRsCount()
+{
+    return this->rsCount;
+}
+QMap<QString,QString> RespGetSysParam::getRs()
+{
+    return this->map;
+}

+ 22 - 0
sncprojects/lib/WSWool/respgetsysparam.h

@@ -0,0 +1,22 @@
+#ifndef RESPGETSYSPARAM_H
+#define RESPGETSYSPARAM_H
+#include <QtCore>
+#include "WSWool_global.h"
+
+class WSWOOLSHARED_EXPORT  RespGetSysParam
+{
+public:
+    RespGetSysParam(QString json);
+    int getRtnCode();
+    QString getRtnMemo();
+    int getRsCount();
+    QMap<QString,QString> getRs();
+private:
+    int rtnCode;
+    QString rtnMemo;
+    QString json;
+    QMap<QString,QString> map;
+    int rsCount;
+};
+
+#endif // RESPGETSYSPARAM_H

+ 82 - 0
sncprojects/lib/WSWool/respgetuserblance.cpp

@@ -0,0 +1,82 @@
+#include "respgetuserblance.h"
+#include <QScriptValue>
+#include <QScriptEngine>
+#include <QScriptValueIterator>
+
+RespGetUserBlance::RespGetUserBlance(QString json)
+{
+    this->json = json;
+    QScriptEngine engine;
+    QScriptValue sv = engine.evaluate("value = " + this->json);
+    QScriptValueIterator it(sv);
+    if(json.isEmpty())
+    {
+        rtnCode = RTNCODE_NETWORK_NOTAVAILABLE;
+        rtnMemo = RTNMEMO_NETWORK_NOTAVAILABLE;
+    }
+    else if(json=="ABORT")
+    {
+        rtnCode = RTNCODE_NETWORK_ABORT;
+        rtnMemo = RTNMEMO_NETWORK_ABORT;
+    }
+    else
+    {
+        rtnCode = RTNCODE_INVALID_FORMAT;
+        rtnMemo = RTNMEMO_INVALID_FORMAT;
+        while (it.hasNext())
+        {
+            it.next();
+            if(it.name()=="rtnCode")
+            {
+                this->rtnCode = it.value().toInt32();
+            }
+            else if(it.name()=="rtnMemo")
+            {
+                this->rtnMemo = it.value().toString();
+            }
+            else if(it.name()=="remainmoney")
+            {
+                this->blance = it.value().toString();
+            }
+            else if(it.name()=="giftmoney")
+            {
+                this->giftMoney = it.value().toString();
+            }
+            else if(it.name()=="topaymoney")
+            {
+                this->toPayMoney = it.value().toString();
+            }
+            else if(it.name()=="validnum")
+            {
+                this->validNum = it.value().toString();
+            }
+        }
+    }
+}
+int RespGetUserBlance::getRtnCode()
+{
+    return this->rtnCode;
+}
+QString RespGetUserBlance::getRtnMemo()
+{
+    return this->rtnMemo;
+}
+QString RespGetUserBlance::getBlance()
+{
+    return this->blance;
+}
+
+QString RespGetUserBlance::getGiftMoney()
+{
+    return this->giftMoney;
+}
+
+QString RespGetUserBlance::getToPayMoney()
+{
+    return this->toPayMoney;
+}
+
+QString RespGetUserBlance::getValidNum()
+{
+    return this->validNum;
+}

+ 26 - 0
sncprojects/lib/WSWool/respgetuserblance.h

@@ -0,0 +1,26 @@
+#ifndef RESPGETUSERBLANCE_H
+#define RESPGETUSERBLANCE_H
+#include <QtCore>
+#include "WSWool_global.h"
+
+class WSWOOLSHARED_EXPORT RespGetUserBlance
+{
+public:
+    RespGetUserBlance(QString json);
+    int getRtnCode();
+    QString getRtnMemo();
+    QString getBlance();
+    QString getGiftMoney();
+    QString getToPayMoney();
+    QString getValidNum();
+private:
+    QString json;
+    int rtnCode;
+    QString rtnMemo;
+    QString blance;
+    QString giftMoney;
+    QString toPayMoney;
+    QString validNum;
+
+};
+#endif // RESPGETUSERBLANCE_H

+ 55 - 0
sncprojects/lib/WSWool/resppackmerge.cpp

@@ -0,0 +1,55 @@
+#include "resppackmerge.h"
+#include <QScriptValue>
+#include <QScriptEngine>
+#include <QScriptValueIterator>
+RespPackMerge::RespPackMerge(QString json)
+{
+    this->json = json;
+    QScriptEngine engine;
+    QScriptValue sv = engine.evaluate("value = " + this->json);
+    QScriptValueIterator it(sv);
+    if(json.isEmpty())
+    {
+        rtnCode = RTNCODE_NETWORK_NOTAVAILABLE;
+        rtnMemo = RTNMEMO_NETWORK_NOTAVAILABLE;
+    }
+    else if(json=="ABORT")
+    {
+        rtnCode = RTNCODE_NETWORK_ABORT;
+        rtnMemo = RTNMEMO_NETWORK_ABORT;
+    }
+    else
+    {
+        rtnCode = RTNCODE_INVALID_FORMAT;
+        rtnMemo = RTNMEMO_INVALID_FORMAT;
+        while (it.hasNext())
+        {
+            it.next();
+            if(it.name()=="rtnCode")
+            {
+                this->rtnCode = it.value().toInt32();
+            }
+            else if(it.name()=="rtnMemo")
+            {
+                this->rtnMemo = it.value().toString();
+            }
+            else if(it.name()=="fileHash")
+            {
+                this->fileHash = it.value().toString();
+            }
+        }
+    }
+
+}
+int RespPackMerge::getRtnCode()
+{
+    return this->rtnCode;
+}
+QString RespPackMerge::getRtnMemo()
+{
+    return this->rtnMemo;
+}
+QString RespPackMerge::getFileHash()
+{
+    return this->fileHash;
+}

+ 20 - 0
sncprojects/lib/WSWool/resppackmerge.h

@@ -0,0 +1,20 @@
+#ifndef RESPPACKMERGE_H
+#define RESPPACKMERGE_H
+#include <QtCore>
+#include "WSWool_global.h"
+
+class WSWOOLSHARED_EXPORT RespPackMerge
+{
+public:
+    RespPackMerge(QString json);
+    int getRtnCode();
+    QString getRtnMemo();
+    QString getFileHash();
+private:
+    int rtnCode;
+    QString rtnMemo;
+    QString json;
+    QString fileHash;
+};
+
+#endif // RESPPACKMERGE_H

+ 47 - 0
sncprojects/lib/WSWool/resppacktran.cpp

@@ -0,0 +1,47 @@
+#include "resppacktran.h"
+#include <QScriptValue>
+#include <QScriptEngine>
+#include <QScriptValueIterator>
+RespPackTran::RespPackTran(QString json)
+{
+    this->json = json;
+    QScriptEngine engine;
+    QScriptValue sv = engine.evaluate("value = " + this->json);
+    QScriptValueIterator it(sv);
+    if(json.isEmpty())
+    {
+        rtnCode = RTNCODE_NETWORK_NOTAVAILABLE;
+        rtnMemo = RTNMEMO_NETWORK_NOTAVAILABLE;
+    }
+    else if(json=="ABORT")
+    {
+        rtnCode = RTNCODE_NETWORK_ABORT;
+        rtnMemo = RTNMEMO_NETWORK_ABORT;
+    }
+    else
+    {
+        rtnCode = RTNCODE_INVALID_FORMAT;
+        rtnMemo = RTNMEMO_INVALID_FORMAT;
+        while (it.hasNext())
+        {
+            it.next();
+            if(it.name()=="rtnCode")
+            {
+                this->rtnCode = it.value().toInt32();
+            }
+            else if(it.name()=="rtnMemo")
+            {
+                this->rtnMemo = it.value().toString();
+            }
+        }
+    }
+
+}
+int RespPackTran::getRtnCode()
+{
+    return this->rtnCode;
+}
+QString RespPackTran::getRtnMemo()
+{
+    return this->rtnMemo;
+}

+ 18 - 0
sncprojects/lib/WSWool/resppacktran.h

@@ -0,0 +1,18 @@
+#ifndef RESPPACKTRAN_H
+#define RESPPACKTRAN_H
+#include <Qtcore>
+#include "WSWool_global.h"
+
+class WSWOOLSHARED_EXPORT RespPackTran
+{
+public:
+    RespPackTran(QString json);
+    int getRtnCode();
+    QString getRtnMemo();
+private:
+    int rtnCode;
+    QString rtnMemo;
+    QString json;
+};
+
+#endif // RESPPACKTRAN_H

+ 72 - 0
sncprojects/lib/WSWool/respsubminpnum.cpp

@@ -0,0 +1,72 @@
+#include "respsubminpnum.h"
+#include <QScriptValue>
+#include <QScriptEngine>
+#include <QScriptValueIterator>
+
+RespSubminPNum::RespSubminPNum(QString json)
+{
+    this->json = json;
+    QScriptEngine engine;
+    QScriptValue sv = engine.evaluate("value = " + this->json);
+    QScriptValueIterator it(sv);
+    if(json.isEmpty())
+    {
+        rtnCode = RTNCODE_NETWORK_NOTAVAILABLE;
+        rtnMemo = RTNMEMO_NETWORK_NOTAVAILABLE;
+    }
+    else if(json=="ABORT")
+    {
+        rtnCode = RTNCODE_NETWORK_ABORT;
+        rtnMemo = RTNMEMO_NETWORK_ABORT;
+    }
+    else
+    {
+        rtnCode = RTNCODE_INVALID_FORMAT;
+        rtnMemo = RTNMEMO_INVALID_FORMAT;
+        while (it.hasNext())
+        {
+            it.next();
+            if(it.name()=="rtnCode")
+            {
+                this->rtnCode = it.value().toInt32();
+            }
+            else if(it.name()=="rtnMemo")
+            {
+                this->rtnMemo = it.value().toString();
+            }
+            else if(it.name()=="batchid")
+            {
+                this->batchid = it.value().toString();
+            }
+            else if(it.name()=="submittime")
+            {
+                this->submitTime = it.value().toString();
+            }
+            else if(it.name()=="submitNum")
+            {
+                this->submitNum = it.value().toInt32();
+            }
+        }
+    }
+}
+int RespSubminPNum::getRtnCode()
+{
+    return this->rtnCode;
+}
+QString RespSubminPNum::getRtnMemo()
+{
+    return this->rtnMemo;
+}
+int RespSubminPNum::getSubmitNum()
+{
+    return this->submitNum;
+}
+
+QString RespSubminPNum::getSubmitTime()
+{
+    return this->submitTime;
+}
+QString RespSubminPNum::getBatchID()
+{
+    return this->batchid;
+}

+ 26 - 0
sncprojects/lib/WSWool/respsubminpnum.h

@@ -0,0 +1,26 @@
+#ifndef RESPSUBMINPNUM_H
+#define RESPSUBMINPNUM_H
+#include <QtCore>
+#include "WSWool_global.h"
+
+class WSWOOLSHARED_EXPORT RespSubminPNum
+{
+public:
+    RespSubminPNum(QString json);
+    int getRtnCode();
+    QString getRtnMemo();
+    QString getBatchID();
+    int getSubmitNum();
+    QString getSubmitTime();
+private:
+    QString json;
+    int rtnCode;
+    QString rtnMemo;
+    QString batchid;
+    QString submitTime;
+    int submitNum;
+
+};
+
+
+#endif // RESPSUBMINPNUM_H

+ 292 - 0
sncprojects/lib/WSWool/wool.cpp

@@ -0,0 +1,292 @@
+#include "wool.h"
+
+WOOL::WOOL(QString host, QString port)
+{
+    this->server_host = host;
+    this->server_path = "/wsdl";
+    this->server_url = "http://"+this->server_host+this->server_path;
+    QRegExp exp("\\d{1,4}");
+    if(exp.exactMatch(port))
+    {
+        //this->server_port = port.toInt();
+        this->server_port = 86;
+    }
+    else
+    {
+        this->server_port = 80;
+    }
+    m_cancel = false;
+}
+
+void WOOL::onCanceled()
+{
+    m_cancel = true;
+    emit responseProcessed();
+    if(json.isEmpty())
+        json = "ABORT";
+}
+
+void WOOL::getResponse()
+{
+    // Get the response, check for error.
+    const QtSoapMessage &message = http.getResponse();
+    if (message.isFault()) {
+        qDebug()<<message.faultString().value().toString();
+        json = "";
+        emit responseProcessed();
+        return;
+    }
+    const QtSoapType &response = message.returnValue();
+    json = response.value().toString();
+//    qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")<<json;
+    emit responseProcessed();
+    return;
+}
+
+//获取系统参数
+QString WOOL::GetSysParam(QString src, QString authCode)
+{
+    this->json = "";
+    QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit()));
+    setGetSysParamRequest(src, authCode);
+    loop.exec();
+    QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    return json;
+}
+
+//分包传送文件
+QString WOOL::PackTran(QString fileName, QString packKey, QString packNo, QString packContent, QString packMD5, QString userHash)
+{
+    this->json = "";
+    QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit()));
+    setPackTranRequest(fileName, packKey, packNo, packContent, packMD5, userHash);
+    loop.exec();
+    QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    return json;
+}
+
+//分包文件整合
+QString WOOL::PackMerge(QString fileName, QString packKey, QString packCount, QString fileMD5, QString userHash)
+{
+    this->json = "";
+    QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit()));
+    setPackMergeRequest(fileName, packKey, packCount, fileMD5, userHash);
+    loop.exec();
+    QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    return json;
+}
+
+//用户服务验证
+QString WOOL::UserServiceVerify(QString funcName, QString paraList, QString userHash)
+{
+    this->json = "";
+    QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit()));
+    setUserServiceVerifyRequest(funcName, paraList, userHash);
+    loop.exec();
+    QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    return json;
+}
+
+//提交防薅羊毛检测号码文件
+QString WOOL::SubmitfhymFile(QString params, QString userHash)
+{
+    this->json = "";
+    QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit()));
+    setSubmitfhymFileRequest(params, userHash);
+    loop.exec();
+    QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    return json;
+}
+
+//下载防薅羊毛检测结果
+QString WOOL::DlfhymResultFile(QString taskid, QString userHash)
+{
+    this->json = "";
+    QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit()));
+    setDlfhymResultFileRequest(taskid, userHash);
+    loop.exec();
+    QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    return json;
+}
+
+//查询防薅羊毛当前检测任务信息
+QString WOOL::GetfhymTask(QString userHash)
+{
+    this->json = "";
+    QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit()));
+    setGetfhymTaskRequest(userHash);
+    loop.exec();
+    QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    return json;
+}
+
+//查询防薅羊毛历史检测任务信息
+QString WOOL::GetfhymHt(QString params, QString userHash)
+{
+    this->json = "";
+    QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit()));
+    setGetfhymHtRequest(params, userHash);
+    loop.exec();
+    QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    return json;
+}
+
+//查询用户自己余额
+QString WOOL::GetUserBalance(QString userHash)
+{
+    this->json = "";
+    QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit()));
+    setGetUserBalanceRequest(userHash);
+    loop.exec();
+    QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    return json;
+}
+
+//查询充值记录
+QString WOOL::GetChargeInfo(QString params, QString userHash)
+{
+    this->json = "";
+    QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit()));
+    setGetChargeInfoRequest(params, userHash);
+    loop.exec();
+    QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    return json;
+}
+
+//查询消费记录
+QString WOOL::GetCostInfo(QString params, QString userHash)
+{
+    this->json = "";
+    QObject::connect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    QObject::connect(this, SIGNAL(responseProcessed()), &loop, SLOT(quit()));
+    setGetCostInfoRequest(params, userHash);
+    loop.exec();
+    QObject::disconnect(&http, SIGNAL(responseReady()), this, SLOT(getResponse()));
+    return json;
+}
+
+void WOOL::setGetSysParamRequest(QString src, QString authCode)
+{
+    QtSoapMessage request;
+    request.setMethod("GetSysParam", this->server_url);
+    request.addMethodArgument("src","",src);
+    request.addMethodArgument("authCode","",authCode);
+    http.setHost(this->server_host,this->server_port);
+    http.submitRequest(request,this->server_path);
+}
+
+void WOOL::setPackTranRequest(QString fileName, QString packKey, QString packNo, QString packContent, QString packMD5, QString userHash)
+{
+    QtSoapMessage request;
+    request.setMethod("PackTran", this->server_url);
+    request.addMethodArgument("fileName","",fileName);
+    request.addMethodArgument("packKey","",packKey);
+    request.addMethodArgument("packNo","",packNo);
+    request.addMethodArgument("packContent","",packContent);
+    request.addMethodArgument("packMD5","",packMD5);
+    request.addMethodArgument("userHash","",userHash);
+    http.setHost(this->server_host,this->server_port);
+    http.submitRequest(request,this->server_path);
+}
+
+void WOOL::setPackMergeRequest(QString fileName, QString packKey, QString packCount, QString fileMD5, QString userHash)
+{
+    QtSoapMessage request;
+    request.setMethod("PackMerge", this->server_url);
+    request.addMethodArgument("fileName","",fileName);
+    request.addMethodArgument("packKey","",packKey);
+    request.addMethodArgument("packCount","",packCount);
+    request.addMethodArgument("fileMD5","",fileMD5);
+    request.addMethodArgument("userHash","",userHash);
+    http.setHost(this->server_host,this->server_port);
+    http.submitRequest(request,this->server_path);
+}
+
+void WOOL::setUserServiceVerifyRequest(QString funcName, QString paraList, QString userHash)
+{
+    QtSoapMessage request;
+    request.setMethod("UserServiceVerify", this->server_url);
+    request.addMethodArgument("funcName","",funcName);
+    request.addMethodArgument("paraList","",paraList);
+    request.addMethodArgument("userHash","",userHash);
+    http.setHost(this->server_host,this->server_port);
+    http.submitRequest(request,this->server_path);
+}
+
+void WOOL::setSubmitfhymFileRequest(QString params, QString userHash)
+{
+    QtSoapMessage request;
+    request.setMethod("SubmitfhymFile", this->server_url);
+    request.addMethodArgument("params","",params);
+    request.addMethodArgument("userHash","",userHash);
+    http.setHost(this->server_host,this->server_port);
+    http.submitRequest(request,this->server_path);
+}
+
+void WOOL::setDlfhymResultFileRequest(QString taskid, QString userHash)
+{
+    QtSoapMessage request;
+    request.setMethod("DlfhymResultFile", this->server_url);
+    request.addMethodArgument("taskid","",taskid);
+    request.addMethodArgument("userHash","",userHash);
+    http.setHost(this->server_host,this->server_port);
+    http.submitRequest(request,this->server_path);
+}
+
+void WOOL::setGetfhymTaskRequest(QString userHash)
+{
+    QtSoapMessage request;
+    request.setMethod("GetfhymTask", this->server_url);
+    request.addMethodArgument("userHash","",userHash);
+    http.setHost(this->server_host,this->server_port);
+    http.submitRequest(request,this->server_path);
+}
+
+void WOOL::setGetfhymHtRequest(QString params, QString userHash)
+{
+    QtSoapMessage request;
+    request.setMethod("GetfhymHt", this->server_url);
+    request.addMethodArgument("params","",params);
+    request.addMethodArgument("userHash","",userHash);
+    http.setHost(this->server_host,this->server_port);
+    http.submitRequest(request,this->server_path);
+}
+
+void WOOL::setGetUserBalanceRequest(QString userHash)
+{
+    QtSoapMessage request;
+    request.setMethod("GetUserBalance", this->server_url);
+    request.addMethodArgument("userHash","",userHash);
+    http.setHost(this->server_host,this->server_port);
+    http.submitRequest(request,this->server_path);
+}
+
+void WOOL::setGetChargeInfoRequest(QString params, QString userHash)
+{
+    QtSoapMessage request;
+    request.setMethod("GetChargeInfo", this->server_url);
+    request.addMethodArgument("params","",params);
+    request.addMethodArgument("userHash","",userHash);
+    http.setHost(this->server_host,this->server_port);
+    http.submitRequest(request,this->server_path);
+}
+
+void WOOL::setGetCostInfoRequest(QString params, QString userHash)
+{
+    QtSoapMessage request;
+    request.setMethod("GetCostInfo", this->server_url);
+    request.addMethodArgument("params","",params);
+    request.addMethodArgument("userHash","",userHash);
+    http.setHost(this->server_host,this->server_port);
+    http.submitRequest(request,this->server_path);
+}

+ 80 - 0
sncprojects/lib/WSWool/wool.h

@@ -0,0 +1,80 @@
+#ifndef WOOL_H
+#define WOOL_H
+
+#include <QtCore>
+#include <QObject>
+#include "qtsoap.h"
+
+class WOOL : public QObject
+{
+    Q_OBJECT
+public:
+    explicit WOOL(QString host = "wool.iyoogo.com", QString port = "80");
+
+public slots:
+
+    //获取系统参数
+    QString GetSysParam(QString src, QString authCode);
+
+    //分包传送文件
+    QString PackTran(QString fileName, QString packKey, QString packNo, QString packContent, QString packMD5, QString userHash);
+
+    //分包文件整合
+    QString PackMerge(QString fileName, QString packKey, QString packCount, QString fileMD5, QString userHash);
+
+    //用户服务验证
+    QString UserServiceVerify(QString funcName, QString paraList, QString userHash);
+
+    //提交防薅羊毛检测号码文件
+    QString SubmitfhymFile(QString params, QString userHash);
+
+    //下载防薅羊毛检测结果
+    QString DlfhymResultFile(QString taskid, QString userHash);
+
+    //查询防薅羊毛当前检测任务信息
+    QString GetfhymTask(QString userHash);
+
+    //查询防薅羊毛历史检测任务信息
+    QString GetfhymHt(QString params, QString userHash);
+
+    //查询用户自己余额
+    QString GetUserBalance(QString userHash);
+
+    //查询充值记录
+    QString GetChargeInfo(QString params, QString userHash);
+
+    //查询消费记录
+    QString GetCostInfo(QString params, QString userHash);
+
+signals:
+    void responseProcessed();
+
+private:
+    QtSoapHttpTransport http;
+    QString json;
+    QEventLoop loop;
+    QString server_host;
+    QString server_path;
+    QString server_url;
+    int server_port ;
+    bool m_cancel;
+
+private slots:
+    void getResponse();
+    void onCanceled();
+
+private:
+    void setGetSysParamRequest(QString src, QString authCode);
+    void setPackTranRequest(QString fileName, QString packKey, QString packNo, QString packContent, QString packMD5, QString userHash);
+    void setPackMergeRequest(QString fileName, QString packKey, QString packCount, QString fileMD5, QString userHash);
+    void setUserServiceVerifyRequest(QString funcName, QString paraList, QString userHash);
+    void setSubmitfhymFileRequest(QString params, QString userHash);
+    void setDlfhymResultFileRequest(QString taskid, QString userHash);
+    void setGetfhymTaskRequest(QString userHash);
+    void setGetfhymHtRequest(QString params, QString userHash);
+    void setGetUserBalanceRequest(QString userHash);
+    void setGetChargeInfoRequest(QString params, QString userHash);
+    void setGetCostInfoRequest(QString params, QString userHash);
+};
+
+#endif // WOOL_H

+ 186 - 0
sncprojects/lib/WSWool/wswool.cpp

@@ -0,0 +1,186 @@
+#include "wswool.h"
+#include "wool.h"
+#include "sncdatabase.h"
+
+WSWool::WSWool()
+{
+}
+
+void WSWool::abort()
+{
+    emit canceled();
+}
+
+//获取系统参数
+QString WSWool::GetSysParam(QString src, QString authCode)
+{
+    WOOL wool;
+    connect(this,SIGNAL(canceled()),&wool,SLOT(onCanceled()));
+    return wool.GetSysParam(src, authCode);
+}
+
+//分包传送文件
+QString WSWool::PackTran(QString packName,QString userHash)
+{
+    WOOL wool;
+    connect(this,SIGNAL(canceled()),&wool,SLOT(onCanceled()));
+
+    QString fileName, packKey, packNo, packMD5, packContent;
+    QFile file(packName);
+
+    file.open(QIODevice::ReadOnly);
+    QByteArray ba = file.readAll();
+    packContent = QString(ba.toBase64());
+    file.close();
+    packMD5 = QCryptographicHash::hash ( packContent.toAscii(), QCryptographicHash::Md5 ).toHex();
+
+    QFileInfo fileinfo(packName);
+    QStringList packinfo = fileinfo.suffix().split("_");
+    QString basename = fileinfo.completeBaseName();
+    QTextCodec *codec = QTextCodec::codecForLocale();
+    fileName = codec->toUnicode(basename.toLocal8Bit());
+
+    if(packinfo.size()==4)
+    {
+        packKey = packinfo.at(0);
+        packNo = QString::number(packinfo.at(2).toInt());
+    }
+
+    return wool.PackTran(fileName, packKey, packNo, packContent, packMD5, userHash);
+}
+
+//分包文件整合
+QString WSWool::PackMerge(QString packName, QString userHash)
+{
+    WOOL wool;
+    connect(this,SIGNAL(canceled()),&wool,SLOT(onCanceled()));
+
+    QString fileName,packKey, packCount, fileMD5;
+    QFileInfo fileinfo(packName);
+    QStringList packinfo = fileinfo.suffix().split("_");
+    QString basename = fileinfo.completeBaseName();
+    QTextCodec *codec = QTextCodec::codecForLocale();
+    fileName = codec->toUnicode(basename.toLocal8Bit());
+
+    if(packinfo.size()==4)
+    {
+        packKey = packinfo.at(0);
+        packCount = packinfo.at(1);
+        fileMD5 = packinfo.at(3);
+    }
+
+    return wool.PackMerge(fileName, packKey, packCount, fileMD5, userHash);
+}
+
+//用户服务验证
+QString WSWool::UserServiceVerify(QString funcName, QString paraList, QString userHash)
+{
+    WOOL wool;
+    connect(this,SIGNAL(canceled()),&wool,SLOT(onCanceled()));
+    return wool.UserServiceVerify(funcName, paraList, userHash);
+}
+
+//提交防薅羊毛检测号码文件 非分包传送方式
+QString WSWool::SubmitfhymFile(QString fileName, QString fileType, QString memo, QString userHash)
+{
+    WOOL wool;
+    connect(this,SIGNAL(canceled()),&wool,SLOT(onCanceled()));
+
+    QString fileContent;
+    QFile file(fileName);
+    QFileInfo fileinfo(fileName);
+    if(file.open(QIODevice::ReadOnly)) {
+        fileContent = QString(file.readAll().toBase64());
+    }
+    file.close();
+
+    QTextCodec *codec = QTextCodec::codecForLocale();
+    // QString fileName_utf8 = codec->toUnicode(fileName.toLocal8Bit());
+    QString fileName_utf8 = codec->toUnicode(fileinfo.fileName().toLocal8Bit());
+    QString fcEncodeType = "BASE64";
+    QString src = "1";    //来源 1:魔方 2:网页平台
+    QString dealstate = "0";   //0:立即开始 1:手动开始
+
+    QString str = "{fileName:%1, fileContent:%2, fcEncodeType:%3, fileType:%4, memo:%5, src:%6, dealstate:%7}";
+    QString params = str.arg(fileName_utf8).arg(fileContent).arg(fcEncodeType).arg(fileType).arg(memo).arg(src).arg(dealstate);
+
+    return wool.SubmitfhymFile(params, userHash);
+}
+
+//提交防薅羊毛检测号码文件 分包传送方式
+QString WSWool::SubmitfhymFile(QString fileName, QString fileHash, QString fileType, QString memo, QString userHash)
+{
+    WOOL wool;
+    connect(this,SIGNAL(canceled()),&wool,SLOT(onCanceled()));
+
+    QTextCodec *codec = QTextCodec::codecForLocale();
+    QString fileName_utf8 = codec->toUnicode(fileName.toLocal8Bit());
+    QString fcEncodeType = "PackMerge";
+    QString src = "1";    //来源 1:魔方 2:网页平台
+    QString dealstate = "0";   //0:立即开始 1:手动开始
+
+    QString str = "{fileName:%1, fileContent:%2, fcEncodeType:%3, fileType:%4, memo:%5, src:%6, dealstate:%7}";
+    QString params = str.arg(fileName_utf8).arg(fileHash).arg(fcEncodeType).arg(fileType).arg(memo).arg(src).arg(dealstate);
+
+    return wool.SubmitfhymFile(params, userHash);
+}
+
+//下载防薅羊毛检测结果
+QString WSWool::DlfhymResultFile(QString taskid, QString userHash)
+{
+    WOOL wool;
+    connect(this,SIGNAL(canceled()),&wool,SLOT(onCanceled()));
+    return wool.DlfhymResultFile(taskid, userHash);
+}
+
+//查询防薅羊毛当前检测任务信息
+QString WSWool::GetfhymTask(QString userHash)
+{
+    WOOL wool;
+    connect(this,SIGNAL(canceled()),&wool,SLOT(onCanceled()));
+    return wool.GetfhymTask(userHash);
+}
+
+//查询防薅羊毛历史检测任务信息
+QString WSWool::GetfhymHt(int indate, QString userHash)
+{
+    WOOL wool;
+    connect(this,SIGNAL(canceled()),&wool,SLOT(onCanceled()));
+
+    QString str = "{indate:%1}";
+    QString params = str.arg(indate);
+
+    return wool.GetfhymHt(params, userHash);
+}
+
+//查询用户自己余额
+QString WSWool::GetUserBalance(QString userHash)
+{
+    WOOL wool;
+    connect(this,SIGNAL(canceled()),&wool,SLOT(onCanceled()));
+    return wool.GetUserBalance(userHash);
+}
+
+//查询充值记录
+QString WSWool::GetChargeInfo(QString dateStart, QString dateEnd, QString userHash)
+{
+    WOOL wool;
+    connect(this,SIGNAL(canceled()),&wool,SLOT(onCanceled()));
+
+    QString str = "{dateStart:%1, dateEnd:%2}";
+    QString params = str.arg(dateStart).arg(dateEnd);
+
+    return wool.GetChargeInfo(params, userHash);
+}
+
+//查询消费记录
+QString WSWool::GetCostInfo(QString dateStart, QString dateEnd, QString userHash)
+{
+    WOOL wool;
+    connect(this,SIGNAL(canceled()),&wool,SLOT(onCanceled()));
+
+    QString str = "{dateStart:%1, dateEnd:%2}";
+    QString params = str.arg(dateStart).arg(dateEnd);
+
+    return wool.GetCostInfo(params, userHash);
+}

+ 54 - 0
sncprojects/lib/WSWool/wswool.h

@@ -0,0 +1,54 @@
+#ifndef WSWOOL_H
+#define WSWOOL_H
+#include <QtCore>
+#include "WSWool_global.h"
+
+class WSWOOLSHARED_EXPORT WSWool : public QObject
+{
+    Q_OBJECT
+
+public:
+    WSWool();
+    void abort();
+
+    //获取系统参数
+    QString GetSysParam(QString src, QString authCode);
+
+    //分包传送文件
+    QString PackTran(QString packName,QString userHash);
+
+    //分包文件整合
+    QString PackMerge(QString packName, QString userHash);
+
+    //用户服务验证
+    QString UserServiceVerify(QString funcName, QString paraList, QString userHash);
+
+    //提交防薅羊毛检测号码文件 非分包传送方式
+    QString SubmitfhymFile(QString fileName, QString fileType, QString memo, QString userHash);
+
+    //提交防薅羊毛检测号码文件 分包传送方式
+    QString SubmitfhymFile(QString fileName, QString fileHash, QString fileType, QString memo, QString userHash);
+
+    //下载防薅羊毛检测结果
+    QString DlfhymResultFile(QString taskid, QString userHash);
+
+    //查询防薅羊毛当前检测任务信息
+    QString GetfhymTask(QString userHash);
+
+    //查询防薅羊毛历史检测任务信息
+    QString GetfhymHt(int indate, QString userHash);
+
+    //查询用户自己余额
+    QString GetUserBalance(QString userHash);
+
+    //查询充值记录
+    QString GetChargeInfo(QString dateStart, QString dateEnd, QString userHash);
+
+    //查询消费记录
+    QString GetCostInfo(QString dateStart, QString dateEnd, QString userHash);
+
+signals:
+    void canceled();
+};
+
+#endif // WSWOOL_H