mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Сделал выдачу tasksFIM.xml из сервера по запросу GUI-клиента
This commit is contained in:
@@ -43,6 +43,11 @@ void ProcessParser::read(ClientHandler *client, QByteArray array)
|
||||
|
||||
queryToDb(xmlReader,client);
|
||||
}
|
||||
else if(xmlReader.name() == "QueryTasksXML")
|
||||
{//Запрос файла XML с задачами
|
||||
|
||||
queryTasksXML(xmlReader,client);
|
||||
}
|
||||
else if(xmlReader.name() == "ClientMessage")
|
||||
{//Сообщение от клиента
|
||||
|
||||
@@ -223,6 +228,24 @@ void ProcessParser::queryToDb(QXmlStreamReader &xmlReader,ClientHandler *client)
|
||||
processingSystem->processingClientQueryToDB(client, queryToDB, id, data);
|
||||
}
|
||||
|
||||
void ProcessParser::queryTasksXML(QXmlStreamReader &xmlReader, ClientHandler *client)
|
||||
{
|
||||
ClientQueryTasksXML clientQueryTasksXML;
|
||||
|
||||
/*Перебираем все атрибуты тега*/
|
||||
foreach(const QXmlStreamAttribute &attr, xmlReader.attributes())
|
||||
{
|
||||
QString name = attr.name().toString();
|
||||
QString value = attr.value().toString();
|
||||
//addTextToLogger(name + ": " + value);
|
||||
|
||||
if(name == "Type")
|
||||
clientQueryTasksXML.Type = value;
|
||||
}
|
||||
|
||||
processingSystem->processingClientQueryTasksXML(client, clientQueryTasksXML);
|
||||
}
|
||||
|
||||
void ProcessParser::clientMessage(QXmlStreamReader &xmlReader,ClientHandler *client)
|
||||
{
|
||||
ClientMessage clientMessage;
|
||||
|
||||
@@ -23,6 +23,7 @@ private:
|
||||
void clientDeAuth(QXmlStreamReader &xmlReader,ClientHandler *client);
|
||||
void toClientMessage(QXmlStreamReader &xmlReader,ClientHandler *client);
|
||||
void queryToDb(QXmlStreamReader &xmlReader,ClientHandler *client);
|
||||
void queryTasksXML(QXmlStreamReader &xmlReader,ClientHandler *client);
|
||||
void clientMessage(QXmlStreamReader &xmlReader,ClientHandler *client);
|
||||
void clientNotify(QXmlStreamReader &xmlReader,ClientHandler *client);
|
||||
};
|
||||
|
||||
@@ -2,10 +2,13 @@
|
||||
|
||||
#include <clienthandler.h>
|
||||
|
||||
ProcessingSystem::ProcessingSystem(ProviderDBLMS* providerDBLMS, QObject *parent):
|
||||
QObject(parent)
|
||||
ProcessingSystem::ProcessingSystem(ProviderDBLMS* providerDBLMS, UpdateController* updateController, QObject *parent):
|
||||
QObject(parent),
|
||||
providerDBLMS(nullptr),
|
||||
updateController(nullptr)
|
||||
{
|
||||
this->providerDBLMS = providerDBLMS;
|
||||
this->updateController = updateController;
|
||||
}
|
||||
|
||||
void ProcessingSystem::initialize(ServerLMSWidget *server, DataParser *dataParser, CommonClientHandler *commonClientHandler,Logger *logger)
|
||||
@@ -226,6 +229,21 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu
|
||||
//logger->addTextToLogger("To Client: " + str);
|
||||
}
|
||||
|
||||
void ProcessingSystem::processingClientQueryTasksXML(ClientHandler *client, ClientQueryTasksXML clientQueryTasksXML)
|
||||
{
|
||||
QByteArray arrayAnswer;
|
||||
|
||||
QString nameFile = "";
|
||||
if(clientQueryTasksXML.Type == "fim")
|
||||
nameFile = tasksFIMfileName;
|
||||
else if(clientQueryTasksXML.Type == "amm")
|
||||
nameFile = tasksAMMfileName;
|
||||
|
||||
arrayAnswer = updateController->getAdditionalFile(nameFile);
|
||||
|
||||
client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_XML_FIM);
|
||||
}
|
||||
|
||||
void ProcessingSystem::processingToClientMessage(ClientHandler *client, ToClientMessage toClientMessage)
|
||||
{
|
||||
signal_msgToClientReady(toClientMessage.Login, toClientMessage.Text);
|
||||
|
||||
@@ -21,12 +21,13 @@ class ProcessingSystem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ProcessingSystem(ProviderDBLMS* providerDBLMS, QObject *parent = nullptr);
|
||||
explicit ProcessingSystem(ProviderDBLMS* providerDBLMS, UpdateController* updateController, QObject *parent = nullptr);
|
||||
|
||||
void initialize(ServerLMSWidget *server,DataParser* dataParser,CommonClientHandler *commonClientServer,Logger *logger);
|
||||
void processingClientAutorization(ClientHandler *client, ClientAutorization clientAutorization);
|
||||
void processingClientDeAutorization(ClientHandler *client, ClientDeAutorization clientDeAutorization);
|
||||
void processingClientQueryToDB(ClientHandler *client, ClientQueryToDB clientQueryToDB, int id = 0, void* data = nullptr);
|
||||
void processingClientQueryTasksXML(ClientHandler *client, ClientQueryTasksXML clientQueryTasksXML);
|
||||
void processingToClientMessage(ClientHandler *client, ToClientMessage toClientMessage);
|
||||
|
||||
void processingFromClientMessage(ClientHandler *client, ClientMessage clientMessage);
|
||||
@@ -46,6 +47,7 @@ private:
|
||||
DataParser *dataParser;
|
||||
//InstructorsAndTraineesWidget *pInstructorsAndTrainees;
|
||||
ProviderDBLMS* providerDBLMS;
|
||||
UpdateController* updateController;
|
||||
};
|
||||
|
||||
#endif // PROCESSINGSYSTEM_H
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
static const QString staticDataFolderName = "StaticData";
|
||||
static const QString applicationFolderName = "Application";
|
||||
static const QString sharedDataFolderName = "SharedData";
|
||||
static const QString additionalFilesFolderName = "AdditionalFiles";
|
||||
static const QString streamingAssetsFolderName = "StreamingAssets";
|
||||
static const QString tempFile = staticDataFolderName + "/save.xml";
|
||||
static const QString version = staticDataFolderName + "/version.xml";
|
||||
@@ -22,6 +23,8 @@ static const QString versionListFile = staticDataFolderName + "/versionList.xml"
|
||||
static const QString hashFileName = staticDataFolderName + "/serverHash.xml";
|
||||
static const QString buildHashName = staticDataFolderName + "/buildHash.xml";
|
||||
static const QString buildDataPath = "/Application/RRJLoader/RRJ_Data/";
|
||||
static const QString tasksAMMfileName = "/tasksAmm.xml";
|
||||
static const QString tasksFIMfileName = "/tasksFIM.xml";
|
||||
|
||||
static const QString baseNameVersion = "base";//может вынести комманды куда нибудь?
|
||||
|
||||
|
||||
@@ -355,6 +355,19 @@ QList<FileData>* UpdateController::calculateHash(QString path)
|
||||
return files;
|
||||
}
|
||||
|
||||
QByteArray UpdateController::getAdditionalFile(QString name)
|
||||
{
|
||||
QString path = Tools::createSharedPath("/" + assetManager->getCurrentVersionData()->getViewName() + "/AdditionalFiles" + name);
|
||||
QFile addFile(path);
|
||||
QByteArray array;
|
||||
if(addFile.open(QIODevice::ReadOnly)){
|
||||
array = addFile.readAll();
|
||||
addFile.close();
|
||||
}
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
QByteArray UpdateController::getLocalHash()
|
||||
{
|
||||
QFile hashFile(hashFileName);
|
||||
|
||||
@@ -55,6 +55,9 @@ public:
|
||||
void createVersionListXmlAnswer(QList<StreamingVersionData *> version);
|
||||
void saveVersionToFile(StreamingVersionData *streamingVersion);
|
||||
void xmlFileDataParse(QByteArray array);
|
||||
|
||||
QByteArray getAdditionalFile(QString name);
|
||||
|
||||
public slots:
|
||||
void changeAssetVersion(QString versionName);
|
||||
void createCopyVersion(QString versionName,QString newVersionName);
|
||||
|
||||
Reference in New Issue
Block a user