| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- #include "filetrans.h"
- #include "wsnumchk.h"
- #include "filesplitter.h"
- #include "resppacktran.h"
- #include "resppackmerge.h"
- #include "respsubminpnum.h"
- FileTrans::FileTrans(QString fileName, QString fileType, QString submitWay, QString memo, QString host, QString port, QString userHash)
- {
- this->fileName = fileName;
- this->fileType = fileType;
- this->submitWay = submitWay;
- this->memo = memo;
- this->host = host;
- this->port = port;
- this->userHash = userHash;
- }
- void FileTrans::run()
- {
- FileSplitter splitter(fileName);
- QStringList list = splitter.getSplitResult();
- WSNumChk numchk(this->host,this->port);
- bool allupload = true;
- QString packName;
- for(int i=0;i<list.size();i++)
- {
- packName = list.at(i);
- QString json = numchk.PackTran(packName,this->userHash);
- RespPackTran response(json);
- if(response.getRtnCode()==1)
- {
- QFile::remove(packName);
- }
- else
- {
- allupload = false;
- qDebug()<<response.getRtnMemo();
- }
- }
- bool succeed = false;
- if(allupload)
- {
- QString json = numchk.PackMerge(packName,this->userHash);
- RespPackMerge response(json);
- if(response.getRtnCode()==1)
- {
- QFileInfo fileinfo(fileName);
- json = numchk.submitPnumFile(fileinfo.fileName(),response.getFileHash(),fileType,submitWay,memo,userHash);
- RespSubminPNum resp(json);
- if(resp.getRtnCode()>0)
- {
- succeed = true;
- splitter.cleanup();
- }
- }
- }
- }
|