mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Merge branch 'DEV' of https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer into DEV
# Conflicts: # DOCS/MainScheme.md
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <Systems/Parsers/dataparser.h>
|
||||
#include <Data/typesDataServerClient.h>
|
||||
|
||||
class DataParser;
|
||||
|
||||
class ClientAnswerParser : public QObject
|
||||
{
|
||||
|
||||
@@ -3,11 +3,12 @@
|
||||
#include <QFile>
|
||||
#include <QDomDocument>
|
||||
|
||||
DataParser::DataParser(AssetsManager *assetManager,ProcessingSystem *processingSystem,QObject *parent) :
|
||||
DataParser::DataParser(ProcessingSystem *processingSystem,QObject *parent) :
|
||||
QObject(parent)
|
||||
{
|
||||
qDebug() << "DataParser init thread ID " << QThread::currentThreadId();
|
||||
|
||||
this->processingSystem = processingSystem;
|
||||
this->assetsManager = assetManager;
|
||||
|
||||
clientAnswer = new ClientAnswerParser;
|
||||
clientAnswer->initialize(this);
|
||||
@@ -21,8 +22,6 @@ QObject(parent)
|
||||
processParser->initialize(processingSystem);
|
||||
|
||||
mutex = new QMutex;
|
||||
|
||||
qDebug() << "ParserThread: " << QThread::currentThreadId();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
|
||||
#include "Systems/processingsystem.h"
|
||||
#include "Systems/tools.h"
|
||||
#include "Systems/assetsmanager.h"
|
||||
#include "Systems/logger.h"
|
||||
#include "Systems/Parsers/clientanswerparser.h"
|
||||
#include "dbanswerparser.h"
|
||||
@@ -21,7 +20,6 @@
|
||||
|
||||
class ProcessingSystem;
|
||||
class ClientHandler;
|
||||
class AssetsManager;
|
||||
class ClientAnswerParser;
|
||||
class DBAnswerParser;
|
||||
class DocsAnswerParser;
|
||||
@@ -32,7 +30,7 @@ class DataParser : public QObject
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
DataParser(AssetsManager *assetManager,ProcessingSystem *processingSystem,QObject* parent = nullptr);
|
||||
DataParser(ProcessingSystem *processingSystem,QObject* parent = nullptr);
|
||||
void xmlParser(ClientHandler *client, QByteArray array);
|
||||
void xmlFileDataParse(QByteArray array);
|
||||
|
||||
@@ -53,7 +51,6 @@ private:
|
||||
QMutex *mutex;
|
||||
|
||||
ProcessingSystem *processingSystem;
|
||||
AssetsManager *assetsManager;
|
||||
ClientAnswerParser *clientAnswer;
|
||||
DBAnswerParser *dbAnswer;
|
||||
DocsAnswerParser* docsAnswer;
|
||||
|
||||
@@ -261,3 +261,136 @@ QByteArray DBAnswerParser::listTasksFIMofTrainee(bool result, QList<TaskAmmFim>
|
||||
|
||||
return commonDOM.toByteArray();
|
||||
}
|
||||
|
||||
QByteArray DBAnswerParser::listsTasksAMMofAllTrainees(QMap<int, QList<TaskAmmFim> > *mapOfLists)
|
||||
{
|
||||
QDomDocument commonDOM;
|
||||
if(! Tools::loadFileXMLtoDOM(":/resources/blankXML/ListsTasksAMMofAllTrainees.xml", &commonDOM))
|
||||
return QByteArray();
|
||||
|
||||
QDomNode listsAllNode = commonDOM.namedItem("ListsTasksAMMofAllTrainees");
|
||||
|
||||
for(int key : mapOfLists->keys())
|
||||
{
|
||||
QList<TaskAmmFim> listOne = mapOfLists->value(key);
|
||||
|
||||
QDomNode listOneNode = commonDOM.createElement("ListTasksAMM");
|
||||
listsAllNode.appendChild(listOneNode);
|
||||
|
||||
listOneNode.toElement().setAttribute("trainee_id", QString::number(key));
|
||||
|
||||
for(TaskAmmFim task : listOne)
|
||||
{
|
||||
//Задача
|
||||
QDomNode taskNode = commonDOM.createElement("taskAMM");
|
||||
listOneNode.appendChild(taskNode);
|
||||
taskNode.toElement().setAttribute("task_id", QString::number(task.getID()));
|
||||
taskNode.toElement().setAttribute("title", task.ammProcedure.title);
|
||||
taskNode.toElement().setAttribute("dmCode", task.ammProcedure.dmCode);
|
||||
taskNode.toElement().setAttribute("status", task.status);
|
||||
|
||||
for(SubProc subProc : task.listSubProc)
|
||||
{//Подпроцедура
|
||||
QDomNode subProcNode = commonDOM.createElement("SubProc");
|
||||
taskNode.appendChild(subProcNode);
|
||||
|
||||
subProcNode.toElement().setAttribute("dmCode", subProc.getDmCode());
|
||||
subProcNode.toElement().setAttribute("title", subProc.getTitle());
|
||||
subProcNode.toElement().setAttribute("canplay", subProc.getModeListStr());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Tools::saveDOMtoFileXML("ListsTasksAMMofAllTrainees.xml", &commonDOM);
|
||||
|
||||
return commonDOM.toByteArray();
|
||||
}
|
||||
|
||||
QByteArray DBAnswerParser::listsTasksFIMofAllTrainees(QMap<int, QList<TaskAmmFim> > *mapOfLists)
|
||||
{
|
||||
QDomDocument commonDOM;
|
||||
if(! Tools::loadFileXMLtoDOM(":/resources/blankXML/ListsTasksFIMofAllTrainees.xml", &commonDOM))
|
||||
return QByteArray();
|
||||
|
||||
QDomNode listsAllNode = commonDOM.namedItem("ListsTasksFIMofAllTrainees");
|
||||
|
||||
for(int key : mapOfLists->keys())
|
||||
{
|
||||
QList<TaskAmmFim> listOne = mapOfLists->value(key);
|
||||
|
||||
QDomNode listOneNode = commonDOM.createElement("ListTasksFIM");
|
||||
listsAllNode.appendChild(listOneNode);
|
||||
|
||||
listOneNode.toElement().setAttribute("trainee_id", QString::number(key));
|
||||
|
||||
for(TaskAmmFim task : listOne)
|
||||
{
|
||||
//Задача
|
||||
QDomNode taskNode = commonDOM.createElement("taskFIM");
|
||||
listOneNode.appendChild(taskNode);
|
||||
taskNode.toElement().setAttribute("task_id", QString::number(task.getID()));
|
||||
taskNode.toElement().setAttribute("title", task.title);
|
||||
taskNode.toElement().setAttribute("status", task.status);
|
||||
|
||||
for(Malfunction malfunction : task.malfunctionList)
|
||||
{//Неисправность
|
||||
QDomNode malfunctionNode = commonDOM.createElement("malfunction");
|
||||
taskNode.appendChild(malfunctionNode);
|
||||
malfunctionNode.toElement().setAttribute("dmCode", malfunction.dmCode);
|
||||
malfunctionNode.toElement().setAttribute("num", malfunction.num);
|
||||
malfunctionNode.toElement().setAttribute("description", malfunction.description);
|
||||
malfunctionNode.toElement().setAttribute("goName", malfunction.goName);
|
||||
malfunctionNode.toElement().setAttribute("objName", malfunction.objName);
|
||||
|
||||
for(MalfunctionSign sign : malfunction.malfunctionSigns)
|
||||
{//Сигналы
|
||||
QDomNode signNode = commonDOM.createElement("malfunctionSign");
|
||||
malfunctionNode.appendChild(signNode);
|
||||
signNode.toElement().setAttribute("type", sign.type);
|
||||
signNode.toElement().setAttribute("description", sign.description);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{//FIMReport
|
||||
FIMReport report = task.report;
|
||||
QDomNode reportNode = commonDOM.createElement("report");
|
||||
taskNode.appendChild(reportNode);
|
||||
reportNode.toElement().setAttribute("report_id", report.id);
|
||||
reportNode.toElement().setAttribute("mmel", report.mmel ? "true" : "false");
|
||||
|
||||
for(FIMReportItem reportItem : task.report.itemList)
|
||||
{//FIMReportItem
|
||||
QDomNode reportItemNode = commonDOM.createElement("reportItem");
|
||||
reportNode.appendChild(reportItemNode);
|
||||
reportItemNode.toElement().setAttribute("item_id", reportItem.id);
|
||||
reportItemNode.toElement().setAttribute("text", reportItem.text);
|
||||
|
||||
//ProcedureID
|
||||
QDomNode procedureIDNode = commonDOM.createElement("procedureID");
|
||||
reportItemNode.appendChild(procedureIDNode);
|
||||
|
||||
procedureIDNode.toElement().setAttribute("doc", reportItem.procedure.doc);
|
||||
procedureIDNode.toElement().setAttribute("title", reportItem.procedure.title);
|
||||
procedureIDNode.toElement().setAttribute("dmCode", reportItem.procedure.dmCode);
|
||||
procedureIDNode.toElement().setAttribute("result", reportItem.procedure.result);
|
||||
}
|
||||
|
||||
for(FIMReportWarehouseItem reportWhItem : task.report.warehouseItemList)
|
||||
{//FIMReportWarehouseItem
|
||||
QDomNode reportWhItemNode = commonDOM.createElement("reportWHItem");
|
||||
reportNode.appendChild(reportWhItemNode);
|
||||
reportWhItemNode.toElement().setAttribute("wh_item_id", reportWhItem.id);
|
||||
reportWhItemNode.toElement().setAttribute("status", reportWhItem.status);
|
||||
reportWhItemNode.toElement().setAttribute("goName", reportWhItem.goName);
|
||||
reportWhItemNode.toElement().setAttribute("objName", reportWhItem.objName);
|
||||
reportWhItemNode.toElement().setAttribute("code", reportWhItem.code);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Tools::saveDOMtoFileXML("ListsTasksFIMofAllTrainees.xml", &commonDOM);
|
||||
|
||||
return commonDOM.toByteArray();
|
||||
}
|
||||
|
||||
@@ -23,6 +23,9 @@ public:
|
||||
|
||||
QByteArray listTasksAMMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list);
|
||||
QByteArray listTasksFIMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list);
|
||||
|
||||
QByteArray listsTasksAMMofAllTrainees(QMap<int, QList<TaskAmmFim> > *mapOfLists);
|
||||
QByteArray listsTasksFIMofAllTrainees(QMap<int, QList<TaskAmmFim> > *mapOfLists);
|
||||
signals:
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
#include <QThread>
|
||||
#include <QXmlStreamReader>
|
||||
#include "assetsmanager.h"
|
||||
|
||||
AssetsManager::AssetsManager(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
qDebug() << "AssetsManager init thread ID " << QThread::currentThreadId();
|
||||
}
|
||||
|
||||
void AssetsManager::initialize(UpdateController* updateContoller,DataParser *dataParser)
|
||||
void AssetsManager::initialize(UpdateController* updateContoller)
|
||||
{
|
||||
qDebug() << "AssetsManager::initialize thread ID " << QThread::currentThreadId();
|
||||
|
||||
this->updateController = updateContoller;
|
||||
//connect(this,&AssetsManager::sigSaveVersion,updateContoller,&UpdateController::saveVersionToFile);
|
||||
datas = new QList<StreamingVersionData*>;
|
||||
@@ -110,6 +114,8 @@ QString AssetsManager::setVersion(QString versionName)
|
||||
currentVersionData = version;
|
||||
saveVersionToFile(currentVersionData);
|
||||
|
||||
Logger::instance().log("Set Version of materials: " + versionName);
|
||||
|
||||
emit signal_setVersion(versionName);
|
||||
|
||||
return version->getAbsolutPath();
|
||||
@@ -172,7 +178,7 @@ void AssetsManager::addVersion(StreamingVersionData *data)
|
||||
|
||||
void AssetsManager::createCopyVersion(QString versionName,QString newVersionName,QString author)
|
||||
{
|
||||
qDebug() << "assetManager thread ID " << QThread::currentThreadId();
|
||||
qDebug() << "AssetsManager::createCopyVersion thread ID " << QThread::currentThreadId();
|
||||
StreamingVersionData* data = new StreamingVersionData;
|
||||
|
||||
data->setAbsolutePath(Tools::createSharedPath("/" + newVersionName));
|
||||
|
||||
@@ -5,13 +5,14 @@
|
||||
#include <Systems/updatecontroller.h>
|
||||
#include <Data/StreamingVersionData.h>
|
||||
|
||||
class UpdateController;
|
||||
|
||||
class AssetsManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AssetsManager(QObject *parent = nullptr);
|
||||
void initialize(UpdateController* updateContoller,DataParser *dataParser);
|
||||
void initialize(UpdateController* updateContoller);
|
||||
void addVersion(StreamingVersionData *data);
|
||||
void createCopyVersion(QString versionName,QString newName,QString author);
|
||||
void deleteVersion(QString version);
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
ChatSystem::ChatSystem()
|
||||
{
|
||||
|
||||
qDebug() << "ChatSystem init thread ID " << QThread::currentThreadId();
|
||||
}
|
||||
|
||||
void ChatSystem::initialize(CommonClientHandler *commonClientHandler, DataParser *dataParser, QMap<int, ClientHandler*> *clientsMap)
|
||||
{
|
||||
qDebug() << "ChatSystem::initialize thread ID " << QThread::currentThreadId();
|
||||
|
||||
this->commonClientHandler = commonClientHandler;
|
||||
this->dataParser = dataParser;
|
||||
this->clientsMap = clientsMap;
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
#include <QObject>
|
||||
#include <Data/typesDataServerClient.h>
|
||||
|
||||
class CommonClientHandler;
|
||||
|
||||
class ChatSystem : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
|
||||
CommonClientHandler::CommonClientHandler(QObject *parent) : QObject(parent)
|
||||
{
|
||||
|
||||
qDebug() << "CommonClientHandler init thread ID " << QThread::currentThreadId();
|
||||
}
|
||||
|
||||
void CommonClientHandler::initialize(QMap<int, ClientHandler *> *clientsMap, ProcessingSystem *processingSystem, DataParser *dataParser)
|
||||
{
|
||||
qDebug() << "CommonClientHandler::initialize thread ID " << QThread::currentThreadId();
|
||||
|
||||
this->clientsMap = clientsMap;
|
||||
this->processingSystem = processingSystem;
|
||||
this->dataParser = dataParser;
|
||||
@@ -36,7 +38,32 @@ void CommonClientHandler::sendCurrentVersionToAllClient()
|
||||
}
|
||||
}
|
||||
|
||||
void CommonClientHandler::slot_ListsInstructorsTraineesChanged()
|
||||
void CommonClientHandler::slot_ListsInstructorsTraineesChanged_forUserID(int id_user)
|
||||
{
|
||||
//Проходим все открытые сокеты
|
||||
foreach(int idSocket, clientsMap->keys())
|
||||
{
|
||||
ClientHandler *handler = clientsMap->value(idSocket);
|
||||
//Проверяем, есть ли клиенты TYPE_GUI с нужным ID
|
||||
if(handler->getClient()->getTypeClient() == TypeClientAutorization::TYPE_GUI &&
|
||||
handler->getClient()->getId() == QString::number(id_user))
|
||||
{//Отправляем этому клиенту обновление списков
|
||||
ClientQueryToDB queryToDB;
|
||||
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_ALL_LISTS;
|
||||
processingSystem->processingClientQueryToDB(handler, queryToDB);
|
||||
}
|
||||
|
||||
/*
|
||||
if(handler->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
|
||||
{
|
||||
ClientQueryToDB queryToDB;
|
||||
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_CONTACT_LIST;
|
||||
processingSystem->processingClientQueryToDB(handler, queryToDB);
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
||||
void CommonClientHandler::slot_ListInstructorsChanged()
|
||||
{
|
||||
//Проходим все открытые сокеты
|
||||
foreach(int idSocket, clientsMap->keys())
|
||||
@@ -46,7 +73,53 @@ void CommonClientHandler::slot_ListsInstructorsTraineesChanged()
|
||||
if(handler->getClient()->getTypeClient() == TypeClientAutorization::TYPE_GUI)
|
||||
{//Отправляем этому клиенту обновление списков
|
||||
ClientQueryToDB queryToDB;
|
||||
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_ALL_LISTS;
|
||||
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_ALL_INSTRUCTORS;
|
||||
processingSystem->processingClientQueryToDB(handler, queryToDB);
|
||||
}
|
||||
|
||||
if(handler->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
|
||||
{
|
||||
ClientQueryToDB queryToDB;
|
||||
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_CONTACT_LIST;
|
||||
processingSystem->processingClientQueryToDB(handler, queryToDB);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CommonClientHandler::slot_ListTraineesChanged()
|
||||
{
|
||||
//Проходим все открытые сокеты
|
||||
foreach(int idSocket, clientsMap->keys())
|
||||
{
|
||||
ClientHandler *handler = clientsMap->value(idSocket);
|
||||
//Проверяем, есть ли клиенты TYPE_GUI
|
||||
if(handler->getClient()->getTypeClient() == TypeClientAutorization::TYPE_GUI)
|
||||
{//Отправляем этому клиенту обновление списков
|
||||
ClientQueryToDB queryToDB;
|
||||
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_ALL_TRAINEES;
|
||||
processingSystem->processingClientQueryToDB(handler, queryToDB);
|
||||
}
|
||||
|
||||
if(handler->getClient()->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
|
||||
{
|
||||
ClientQueryToDB queryToDB;
|
||||
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_CONTACT_LIST;
|
||||
processingSystem->processingClientQueryToDB(handler, queryToDB);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CommonClientHandler::slot_ListGroupsChanged()
|
||||
{
|
||||
//Проходим все открытые сокеты
|
||||
foreach(int idSocket, clientsMap->keys())
|
||||
{
|
||||
ClientHandler *handler = clientsMap->value(idSocket);
|
||||
//Проверяем, есть ли клиенты TYPE_GUI
|
||||
if(handler->getClient()->getTypeClient() == TypeClientAutorization::TYPE_GUI)
|
||||
{//Отправляем этому клиенту обновление списков
|
||||
ClientQueryToDB queryToDB;
|
||||
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_ALL_GROUPS;
|
||||
processingSystem->processingClientQueryToDB(handler, queryToDB);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
class ProcessingSystem;
|
||||
class DataParser;
|
||||
class ClientHandler;
|
||||
class Logger;
|
||||
|
||||
class CommonClientHandler : public QObject
|
||||
@@ -19,7 +20,10 @@ public:
|
||||
|
||||
void sendNewVersionListToAllClient();
|
||||
void sendCurrentVersionToAllClient();
|
||||
void slot_ListsInstructorsTraineesChanged();
|
||||
void slot_ListsInstructorsTraineesChanged_forUserID(int id_user);
|
||||
void slot_ListInstructorsChanged();
|
||||
void slot_ListTraineesChanged();
|
||||
void slot_ListGroupsChanged();
|
||||
void slot_StatusTasksAMMofTraineeChanged(int trainee_id);
|
||||
void slot_StatusTasksFIMofTraineeChanged(int trainee_id);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ DocsUpdater::DocsUpdater(UpdateController* updateController, QObject *parent):
|
||||
updateController(updateController),
|
||||
flagStop(false)
|
||||
{
|
||||
|
||||
qDebug() << "DocsUpdater init thread ID " << QThread::currentThreadId();
|
||||
}
|
||||
|
||||
DocsUpdater::~DocsUpdater()
|
||||
@@ -37,8 +37,10 @@ QList<SubProc> DocsUpdater::getListSubProcForDMcode(QString dmCode)
|
||||
return listSubProcMap.value(dmCode);
|
||||
}
|
||||
|
||||
bool DocsUpdater::updateDocsXML()
|
||||
bool DocsUpdater::slot_updateDocsXML()
|
||||
{
|
||||
qDebug() << "DocsUpdater::slot_updateDocsXML thread ID " << QThread::currentThreadId();
|
||||
|
||||
QMutexLocker locker(&mtxAccess);
|
||||
|
||||
QString pathDocsFile = updateController->getPathAdditionalFile(tasksAMMfileName);
|
||||
@@ -97,6 +99,8 @@ bool DocsUpdater::updateDocsXML()
|
||||
}
|
||||
}
|
||||
|
||||
emit signal_DocsChanged();
|
||||
emit signal_UpdateDocsCompleted();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,9 +16,10 @@ public:
|
||||
void lockAccessToDocsXML();
|
||||
void unLockAccessToDocsXML();
|
||||
|
||||
QList<SubProc> getListSubProcForDMcode(QString dmCode);
|
||||
QList<SubProc> getListSubProcForDMcode(QString dmCode);
|
||||
|
||||
bool updateDocsXML();
|
||||
public slots:
|
||||
bool slot_updateDocsXML();
|
||||
|
||||
private:
|
||||
void domElementParserAMM(QDomElement element, Module* moduleParent);
|
||||
@@ -27,6 +28,10 @@ private:
|
||||
void selectSubProc(QDomElement& modeElement, QList<SubProc>& listSubProc);
|
||||
DM* getDMmoduleByDMcode(QString dmCode);
|
||||
|
||||
signals:
|
||||
void signal_DocsChanged();
|
||||
void signal_UpdateDocsCompleted();
|
||||
|
||||
private:
|
||||
UpdateController* updateController;
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "providerdblms.h"
|
||||
|
||||
#include <clienthandler.h>
|
||||
#include <QMap>
|
||||
|
||||
ProcessingSystem::ProcessingSystem(ProviderDBLMS* providerDBLMS, UpdateController* updateController, DocsUpdater* docsUpdater, CfiController* cfiController, QObject *parent):
|
||||
QObject(parent),
|
||||
@@ -10,6 +11,8 @@ ProcessingSystem::ProcessingSystem(ProviderDBLMS* providerDBLMS, UpdateControlle
|
||||
cfiController(nullptr),
|
||||
providerDBLMS(nullptr)
|
||||
{
|
||||
qDebug() << "ProcessingSystem init thread ID " << QThread::currentThreadId();
|
||||
|
||||
this->providerDBLMS = providerDBLMS;
|
||||
this->updateController = updateController;
|
||||
this->docsUpdater = docsUpdater;
|
||||
@@ -21,13 +24,18 @@ void ProcessingSystem::initialize(MultiThreadServer *server, DataParser *dataPar
|
||||
UpdateController *updateController,
|
||||
ChatSystem *chatSystem)
|
||||
{
|
||||
qDebug() << "ProcessingSystem::initialize thread ID " << QThread::currentThreadId();
|
||||
|
||||
this->commonClientServer = commonClientHandler;
|
||||
this->dataParser = dataParser;
|
||||
this->server = server;
|
||||
this->updateController = updateController;
|
||||
this->chatSystem = chatSystem;
|
||||
|
||||
connect(this,&ProcessingSystem::sigListsInstructorsTraineesChanged,commonClientHandler, &CommonClientHandler::slot_ListsInstructorsTraineesChanged,Qt::AutoConnection);
|
||||
connect(this,&ProcessingSystem::sigListsInstructorsTraineesChanged_forUserID,commonClientHandler, &CommonClientHandler::slot_ListsInstructorsTraineesChanged_forUserID,Qt::AutoConnection);
|
||||
connect(this,&ProcessingSystem::sigListInstructorsChanged,commonClientHandler, &CommonClientHandler::slot_ListInstructorsChanged,Qt::AutoConnection);
|
||||
connect(this,&ProcessingSystem::sigListTraineesChanged,commonClientHandler, &CommonClientHandler::slot_ListTraineesChanged,Qt::AutoConnection);
|
||||
connect(this,&ProcessingSystem::sigListGroupsChanged,commonClientHandler, &CommonClientHandler::slot_ListGroupsChanged,Qt::AutoConnection);
|
||||
|
||||
connect(this,&ProcessingSystem::sigStatusTasksAMMofTraineeChanged,commonClientHandler, &CommonClientHandler::slot_StatusTasksAMMofTraineeChanged,Qt::AutoConnection);
|
||||
connect(this,&ProcessingSystem::sigStatusTasksFIMofTraineeChanged,commonClientHandler, &CommonClientHandler::slot_StatusTasksFIMofTraineeChanged,Qt::AutoConnection);
|
||||
@@ -98,6 +106,18 @@ void ProcessingSystem::processingClientAutorization(ClientHandler *client, Clien
|
||||
{
|
||||
client->sendVersion();
|
||||
|
||||
|
||||
if(clientAutorization.TypeClient == TypeClientAutorization::TYPE_GUI)
|
||||
{//Отправляем этому клиенту обновление ВСЕХ списков
|
||||
emit sigListsInstructorsTraineesChanged_forUserID(clientID);
|
||||
|
||||
ClientQueryTasksXML clientQueryTasksXML;
|
||||
clientQueryTasksXML.Type = "fim";
|
||||
processingClientQueryTasksXML(client, clientQueryTasksXML);
|
||||
clientQueryTasksXML.Type = "amm";
|
||||
processingClientQueryTasksXML(client, clientQueryTasksXML);
|
||||
}
|
||||
|
||||
//Отправляем состояние блокировки
|
||||
/*
|
||||
if(server->getStateBlockAutorization() == EStateBlockAutorization::blocked)
|
||||
@@ -110,7 +130,13 @@ void ProcessingSystem::processingClientAutorization(ClientHandler *client, Clien
|
||||
//client->sendPacketType(PacketType::FREE);
|
||||
|
||||
//Извещаем об изменениях в авторизации
|
||||
emit sigListsInstructorsTraineesChanged();
|
||||
if(client->getClient()->getAccessType() == UserType::INSTRUCTOR)
|
||||
{
|
||||
//emit sigListGroupsChanged();
|
||||
emit sigListInstructorsChanged();
|
||||
}
|
||||
else if(client->getClient()->getAccessType() == UserType::TRAINEE)
|
||||
emit sigListTraineesChanged();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -169,7 +195,7 @@ void ProcessingSystem::processingClientDeAutorization(ClientHandler *client, Cli
|
||||
client->sendXmlAnswer(arrayAnswer);
|
||||
|
||||
//Извещаем об изменениях в авторизации
|
||||
emit sigListsInstructorsTraineesChanged();
|
||||
emit sigListTraineesChanged();
|
||||
}
|
||||
else if(providerDBLMS->deAuthorizationInstructor(clientDeAutorization.Login))
|
||||
{//ДеАвторизуется инструктор
|
||||
@@ -187,7 +213,7 @@ void ProcessingSystem::processingClientDeAutorization(ClientHandler *client, Cli
|
||||
providerDBLMS->signal_BlockAutorization(false, fullName, "DeAuthorizationInstructor");
|
||||
|
||||
//Извещаем об изменениях в авторизации
|
||||
emit sigListsInstructorsTraineesChanged();
|
||||
emit sigListInstructorsChanged();
|
||||
}
|
||||
else
|
||||
{//Никто не ДеАвторизовался
|
||||
@@ -277,7 +303,7 @@ void ProcessingSystem::processingExitUnityClient(ClientHandler *client)
|
||||
|
||||
void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQueryToDB clientQueryToDB, int id, void* data)
|
||||
{
|
||||
qDebug() << "ProcessingQueryThread " << QThread::currentThreadId();
|
||||
qDebug() << "ProcessingSystem::processingClientQueryToDB thread ID " << QThread::currentThreadId();
|
||||
|
||||
switch (clientQueryToDB.typeQuery)
|
||||
{
|
||||
@@ -301,16 +327,53 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu
|
||||
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_TRAINEES);
|
||||
client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_TRAINEES);
|
||||
|
||||
for(Trainee trainee : listTrainees)
|
||||
if(listTrainees.count())
|
||||
{
|
||||
//Отправка списка задач AMM этого обучаемого клиенту GUI
|
||||
sendListTasksAMMofTraineetoClient(client, trainee.getID());
|
||||
//Отправка списка задач FIM этого обучаемого клиенту GUI
|
||||
sendListTasksFIMofTraineetoClient(client, trainee.getID());
|
||||
//Отправка списка задач FIM всех обучаемых клиенту GUI
|
||||
sendListsTasksFIMofAllTraineestoClient(client, listTrainees);
|
||||
//Отправка списка задач AMM всех обучаемых клиенту GUI
|
||||
sendListsTasksAMMofAllTraineestoClient(client, listTrainees);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case TypeQueryToDB::TYPE_QUERY_GET_ALL_INSTRUCTORS:
|
||||
{
|
||||
QList<Instructor> listInstructors = providerDBLMS->GetListAllInstructors();
|
||||
|
||||
QByteArray arrayAnswer;
|
||||
|
||||
arrayAnswer = dataParser->DbAnswer()->listInstructors(true, &listInstructors);
|
||||
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_INSTRUCTORS);
|
||||
client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_INSTRUCTORS);
|
||||
|
||||
break;
|
||||
}
|
||||
case TypeQueryToDB::TYPE_QUERY_GET_ALL_TRAINEES:
|
||||
{
|
||||
QList<Trainee> listTrainees = providerDBLMS->GetListAllTrainees();
|
||||
|
||||
QByteArray arrayAnswer;
|
||||
|
||||
arrayAnswer = dataParser->DbAnswer()->listTrainees(true, &listTrainees);
|
||||
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_TRAINEES);
|
||||
client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_TRAINEES);
|
||||
|
||||
break;
|
||||
}
|
||||
case TypeQueryToDB::TYPE_QUERY_GET_ALL_GROUPS:
|
||||
{
|
||||
QList<Group> listGroups = providerDBLMS->GetListAllGroups();
|
||||
|
||||
QByteArray arrayAnswer;
|
||||
|
||||
arrayAnswer = dataParser->DbAnswer()->listGroups(true, &listGroups);
|
||||
//client->sendXmlAnswer(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_GROUPS);
|
||||
client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_DB__LIST_GROUPS);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case TypeQueryToDB::TYPE_QUERY_NEW_INSTRUCTOR:
|
||||
{
|
||||
int id_new;
|
||||
@@ -320,19 +383,19 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu
|
||||
(*(Instructor*)data).setID(id_new);
|
||||
providerDBLMS->editInstructor(*(Instructor*)data);
|
||||
}
|
||||
emit sigListsInstructorsTraineesChanged();
|
||||
emit sigListInstructorsChanged();
|
||||
break;
|
||||
}
|
||||
case TypeQueryToDB::TYPE_QUERY_DEL_INSTRUCTOR:
|
||||
{
|
||||
providerDBLMS->delInstructor(id);
|
||||
emit sigListsInstructorsTraineesChanged();
|
||||
emit sigListInstructorsChanged();
|
||||
break;
|
||||
}
|
||||
case TypeQueryToDB::TYPE_QUERY_EDIT_INSTRUCTOR:
|
||||
{
|
||||
providerDBLMS->editInstructor(*(Instructor*)data);
|
||||
emit sigListsInstructorsTraineesChanged();
|
||||
emit sigListInstructorsChanged();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -345,19 +408,19 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu
|
||||
(*(Trainee*)data).setID(id_new);
|
||||
providerDBLMS->editTrainee(*(Trainee*)data);
|
||||
}
|
||||
emit sigListsInstructorsTraineesChanged();
|
||||
emit sigListTraineesChanged();
|
||||
break;
|
||||
}
|
||||
case TypeQueryToDB::TYPE_QUERY_DEL_TRAINEE:
|
||||
{
|
||||
providerDBLMS->delTrainee(id);
|
||||
emit sigListsInstructorsTraineesChanged();
|
||||
emit sigListTraineesChanged();
|
||||
break;
|
||||
}
|
||||
case TypeQueryToDB::TYPE_QUERY_EDIT_TRAINEE:
|
||||
{
|
||||
providerDBLMS->editTrainee(*(Trainee*)data);
|
||||
emit sigListsInstructorsTraineesChanged();
|
||||
emit sigListTraineesChanged();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -370,19 +433,19 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu
|
||||
(*(Group*)data).setID(id_new);
|
||||
providerDBLMS->editGroup(*(Group*)data);
|
||||
}
|
||||
emit sigListsInstructorsTraineesChanged();
|
||||
emit sigListGroupsChanged();
|
||||
break;
|
||||
}
|
||||
case TypeQueryToDB::TYPE_QUERY_DEL_GROUP:
|
||||
{
|
||||
providerDBLMS->delGroup(id);
|
||||
emit sigListsInstructorsTraineesChanged();
|
||||
emit sigListGroupsChanged();
|
||||
break;
|
||||
}
|
||||
case TypeQueryToDB::TYPE_QUERY_EDIT_GROUP:
|
||||
{
|
||||
providerDBLMS->editGroup(*(Group*)data);
|
||||
emit sigListsInstructorsTraineesChanged();
|
||||
emit sigListGroupsChanged();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -637,8 +700,6 @@ void ProcessingSystem::processingClientNotify(ClientHandler *client, ClientNotif
|
||||
}
|
||||
else if(clientNotify.Code == commandDisableClient)
|
||||
{
|
||||
qDebug() << "processing thread: " << QThread::currentThreadId();
|
||||
|
||||
//Фиксируем время выхода Юнити-клиента
|
||||
if (clientData->getClientType() == TypeClientAutorization::TYPE_UNITY_CLIENT)
|
||||
{
|
||||
@@ -697,6 +758,36 @@ void ProcessingSystem::sendListTasksFIMofTraineetoClient(ClientHandler *client,
|
||||
client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_TRAINEE);
|
||||
}
|
||||
|
||||
void ProcessingSystem::sendListsTasksAMMofAllTraineestoClient(ClientHandler *client, QList<Trainee> listTrainees)
|
||||
{
|
||||
QMap<int, QList<TaskAmmFim>> mapOfLists;
|
||||
for(Trainee trainee : listTrainees)
|
||||
{
|
||||
int id_trainee = trainee.getID();
|
||||
QList<TaskAmmFim> listTasksOneTrainee = providerDBLMS->GetListTasksAMMofTrainee(id_trainee);
|
||||
if(listTasksOneTrainee.count())
|
||||
mapOfLists.insert(id_trainee, listTasksOneTrainee);
|
||||
}
|
||||
|
||||
QByteArray arrayAnswer = dataParser->DbAnswer()->listsTasksAMMofAllTrainees(&mapOfLists);
|
||||
client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_AMM_OF_ALL_TRAINEES);
|
||||
}
|
||||
|
||||
void ProcessingSystem::sendListsTasksFIMofAllTraineestoClient(ClientHandler *client, QList<Trainee> listTrainees)
|
||||
{
|
||||
QMap<int, QList<TaskAmmFim>> mapOfLists;
|
||||
for(Trainee trainee : listTrainees)
|
||||
{
|
||||
int id_trainee = trainee.getID();
|
||||
QList<TaskAmmFim> listTasksOneTrainee = providerDBLMS->GetListTasksFIMofTrainee(id_trainee);
|
||||
if(listTasksOneTrainee.count())
|
||||
mapOfLists.insert(id_trainee, listTasksOneTrainee);
|
||||
}
|
||||
|
||||
QByteArray arrayAnswer = dataParser->DbAnswer()->listsTasksFIMofAllTrainees(&mapOfLists);
|
||||
client->sendFileBlockByteArray(arrayAnswer, PacketType::TYPE_XMLANSWER_QUERY_TASKS_FIM_OF_ALL_TRAINEES);
|
||||
}
|
||||
|
||||
void ProcessingSystem::sendListTasksAMMofTraineeByIDtoClient(ClientHandler *client, int id_trainee, QList<int> listID)
|
||||
{
|
||||
QList<TaskAmmFim> listTasksNeed;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <Data/typesDataServerClient.h>
|
||||
|
||||
#include <clienthandler.h>
|
||||
#include <serverlmswidget.h>
|
||||
#include "multithreadserver.h"
|
||||
//#include "instructorsandtraineeswidget.h"
|
||||
#include "chatsystem.h"
|
||||
@@ -22,6 +21,7 @@ class ClientHandler;
|
||||
class CommonClientHandler;
|
||||
class MultiThreadServer;
|
||||
class CfiController;
|
||||
class ChatSystem;
|
||||
|
||||
class ProcessingSystem : public QObject
|
||||
{
|
||||
@@ -50,6 +50,10 @@ public:
|
||||
void sendListTasksAMMofTraineetoClient(ClientHandler* client, int id_trainee);
|
||||
void sendListTasksFIMofTraineetoClient(ClientHandler* client, int id_trainee);
|
||||
|
||||
void sendListsTasksAMMofAllTraineestoClient(ClientHandler *client, QList<Trainee> listTrainees);
|
||||
void sendListsTasksFIMofAllTraineestoClient(ClientHandler* client, QList<Trainee> listTrainees);
|
||||
|
||||
|
||||
void sendListTasksAMMofTraineeByIDtoClient(ClientHandler* client, int id_trainee, QList<int> listID);
|
||||
void sendListTasksFIMofTraineeByIDtoClient(ClientHandler* client, int id_trainee, QList<int> listID);
|
||||
|
||||
@@ -65,7 +69,10 @@ public:
|
||||
void processingExitUnityClient(ClientHandler *client);
|
||||
signals:
|
||||
void sigUpdateListClients();
|
||||
void sigListsInstructorsTraineesChanged();
|
||||
void sigListsInstructorsTraineesChanged_forUserID(int id_user);
|
||||
void sigListInstructorsChanged();
|
||||
void sigListTraineesChanged();
|
||||
void sigListGroupsChanged();
|
||||
void sigStatusTasksAMMofTraineeChanged(int trainee_id);
|
||||
void sigStatusTasksFIMofTraineeChanged(int trainee_id);
|
||||
void sigAddToMessanger(QString login,QString text);
|
||||
|
||||
@@ -13,12 +13,12 @@ QObject(parent)
|
||||
|
||||
}
|
||||
|
||||
void RecognizeSystem::initialize(UpdateController *updateController,DataParser* dataParser,
|
||||
ServerLMSWidget *server,SendSystem *sendSystem, ClientHandler *handler)
|
||||
void RecognizeSystem::initialize(UpdateController *updateController,DataParser* dataParser,SendSystem *sendSystem, ClientHandler *handler)
|
||||
{
|
||||
qDebug() << "RecognizeSystem::initialize thread ID " << QThread::currentThreadId();
|
||||
|
||||
this->updateController = updateController;
|
||||
this->dataParser = dataParser;
|
||||
this->server = server;
|
||||
this->clientHandler = handler;
|
||||
this->sendSystem = sendSystem;
|
||||
socket = handler->getSocket();
|
||||
@@ -28,16 +28,14 @@ void RecognizeSystem::initialize(UpdateController *updateController,DataParser*
|
||||
connect(this,&RecognizeSystem::sigDeleteVersion,updateController,&UpdateController::deleteAssetVersion,Qt::AutoConnection);
|
||||
connect(this,&RecognizeSystem::sigCopyVersion,updateController,&UpdateController::createCopyVersion,Qt::AutoConnection);
|
||||
connect(this,&RecognizeSystem::sigXmlParser,dataParser->getProcessParser(),&ProcessParser::slot_read,Qt::AutoConnection);
|
||||
connect(this,&RecognizeSystem::sigRecalculateDocs,server,&ServerLMSWidget::slot_UpdateDocs,Qt::AutoConnection);
|
||||
connect(this,&RecognizeSystem::sigSendDocs,sendSystem,&SendSystem::sendDocs,Qt::AutoConnection);
|
||||
|
||||
qDebug() << "Recognize init thread ID " << QThread::currentThreadId();
|
||||
//connect(this,&RecognizeSystem::sigRecalculateDocs,server,&ServerLMSWidget::slot_UpdateDocs,Qt::AutoConnection);
|
||||
connect(this,&RecognizeSystem::sigSendDocs,sendSystem,&SendSystem::sendDocs,Qt::AutoConnection);
|
||||
}
|
||||
|
||||
void RecognizeSystem::recognize()
|
||||
{
|
||||
QMutexLocker locker(mutex);
|
||||
qDebug() << "Recognize thread ID " << QThread::currentThreadId();
|
||||
qDebug() << "RecognizeSystem::recognize thread ID " << QThread::currentThreadId();
|
||||
QMutexLocker locker(mutex);
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
QByteArray data;
|
||||
@@ -448,7 +446,8 @@ void RecognizeSystem::recognize()
|
||||
if(packetType == PacketType::RECALCULATE_DOCS)
|
||||
{
|
||||
emit sigCalculateHash();
|
||||
emit sigRecalculateDocs();
|
||||
//emit sigRecalculateDocs();
|
||||
emit signal_updateDocsXML();
|
||||
}
|
||||
|
||||
if(packetType == PacketType::GET_DOCS)
|
||||
|
||||
@@ -12,10 +12,7 @@
|
||||
#include <Data/Client.h>
|
||||
#include <Data/PacketType.h>
|
||||
|
||||
#include "serverlmswidget.h"
|
||||
|
||||
class UpdateController;
|
||||
class ServerLMSWidget;
|
||||
class ClientHandler;
|
||||
|
||||
class RecognizeSystem : public QObject
|
||||
@@ -25,8 +22,7 @@ class RecognizeSystem : public QObject
|
||||
|
||||
public:
|
||||
RecognizeSystem(QObject *parent = nullptr);
|
||||
void initialize(UpdateController *updateController,DataParser *dataParser,
|
||||
ServerLMSWidget *server,SendSystem *sendSystem, ClientHandler *handler);
|
||||
void initialize(UpdateController *updateController,DataParser *dataParser, SendSystem *sendSystem, ClientHandler *handler);
|
||||
void recognize();
|
||||
~RecognizeSystem();
|
||||
|
||||
@@ -37,14 +33,15 @@ signals:
|
||||
void sigChangeVersion(QString versionName);
|
||||
void sigDeleteVersion(QString versionName);
|
||||
void sigCopyVersion(QString versionName,QString newVersionName,QString author);
|
||||
void sigRecalculateDocs();
|
||||
//void sigRecalculateDocs();
|
||||
void sigSendDocs(QString docsPath);
|
||||
|
||||
void signal_updateDocsXML();
|
||||
|
||||
private:
|
||||
UpdateController *updateController;
|
||||
SendSystem *sendSystem;
|
||||
DataParser *dataParser;
|
||||
ServerLMSWidget *server;
|
||||
QString command;
|
||||
PacketType packetType;
|
||||
QString filePath;
|
||||
|
||||
@@ -7,12 +7,13 @@ SendSystem::SendSystem(QObject *parent) : QObject(parent)
|
||||
|
||||
void SendSystem::initialize(DataParser *dataParser,QMutex *globalMutex)
|
||||
{
|
||||
this->dataParser = dataParser;
|
||||
connect(this,&SendSystem::sigSendXMLmessage,dataParser->ClientAnswer(),&ClientAnswerParser::message,Qt::AutoConnection);
|
||||
connect(this,&SendSystem::sigSendNotify,dataParser->ClientAnswer(),&ClientAnswerParser::notify,Qt::DirectConnection); //потому что возвращает значение
|
||||
connect(this,&SendSystem::sigSendVersion,dataParser->ClientAnswer(),&ClientAnswerParser::currentVersion,Qt::AutoConnection);
|
||||
qDebug() << "SendSystem::initialize thread ID " << QThread::currentThreadId();
|
||||
|
||||
this->dataParser = dataParser;
|
||||
//connect(this,&SendSystem::sigSendXMLmessage,dataParser->ClientAnswer(),&ClientAnswerParser::message,Qt::AutoConnection); //сигнал не используется
|
||||
connect(this,&SendSystem::sigSendNotify,dataParser->ClientAnswer(),&ClientAnswerParser::notify,Qt::DirectConnection); //потому что возвращает значение
|
||||
//connect(this,&SendSystem::sigSendVersion,dataParser->ClientAnswer(),&ClientAnswerParser::currentVersion,Qt::AutoConnection); //сигнал не используется
|
||||
|
||||
qDebug() << "SendSystem thread: " << QThread::currentThreadId();
|
||||
mutex = globalMutex;
|
||||
}
|
||||
|
||||
@@ -26,7 +27,8 @@ void SendSystem::setClient(Client *client,QTcpSocket *socket)
|
||||
|
||||
void SendSystem::sendNotify(QString notify)
|
||||
{
|
||||
qDebug() << "SendNotify thread: " << QThread::currentThreadId();
|
||||
qDebug() << "SendSystem::sendNotify thread ID " << QThread::currentThreadId();
|
||||
|
||||
auto answer = emit sigSendNotify(notify);
|
||||
sendXmlAnswer(answer);
|
||||
}
|
||||
@@ -85,7 +87,7 @@ void SendSystem::sendFileBlockByteArray(QByteArray array, PacketType packetType)
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
|
||||
quint64 size = array.size();
|
||||
qint64 size = array.size();
|
||||
qint64 bytesSended = 0;
|
||||
|
||||
if (size == 0)
|
||||
@@ -97,19 +99,18 @@ void SendSystem::sendFileBlockByteArray(QByteArray array, PacketType packetType)
|
||||
stream << packetType; //Отправляем тип блока
|
||||
stream << size;
|
||||
|
||||
while (size > 0)
|
||||
while (bytesSended < size)
|
||||
{
|
||||
QByteArray chunk = array.mid(bytesSended,sendFileBlockSize);
|
||||
stream << chunk;
|
||||
|
||||
bytesSended += chunk.length();
|
||||
size -= bytesSended;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sendPacketType(packetType);
|
||||
quint64 size = array.size();
|
||||
qint64 size = array.size();
|
||||
qint64 bytesSended = 0;
|
||||
|
||||
if (size == 0)
|
||||
@@ -141,7 +142,7 @@ void SendSystem::sendVersion()
|
||||
|
||||
void SendSystem::sendFileBlockWithRename(QString path, QString newName)
|
||||
{
|
||||
qDebug() << "sendFileBlockWithRename thread: " << QThread::currentThreadId();
|
||||
qDebug() << "SendSystem::sendFileBlockWithRename thread ID " << QThread::currentThreadId();
|
||||
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
@@ -233,7 +234,8 @@ void SendSystem::sendPacketType(PacketType packetType)
|
||||
|
||||
void SendSystem::sendXmlAnswer(QByteArray array, PacketType packetType)
|
||||
{
|
||||
qDebug() << "SendSystemThread: " << QThread::currentThreadId();
|
||||
qDebug() << "SendSystem::sendXmlAnswer thread ID " << QThread::currentThreadId();
|
||||
|
||||
Logger::instance().log("SEND TO: "+ client->getLogin() + " " + enumToString(packetType) + "\n Text: " +
|
||||
QString(array),LogLevel::DEBUG);
|
||||
|
||||
@@ -316,11 +318,6 @@ void SendSystem::socketClose()
|
||||
socket->close();
|
||||
}
|
||||
|
||||
bool SendSystem::socketFlush() //TODO: проверить использование
|
||||
{
|
||||
return socket->flush();
|
||||
}
|
||||
|
||||
void SendSystem::sendStop()
|
||||
{
|
||||
isSendStopped = true;
|
||||
|
||||
@@ -35,7 +35,6 @@ public:
|
||||
void sendXmlAnswer(QByteArray array, PacketType packetType = PacketType::TYPE_XMLANSWER);
|
||||
void sendNeedUpdate(bool flag,quint64 size,quint64 fileCount,quint64 deleteCount);
|
||||
void updateFiles(QList<FileData> fileSendList, QList<FileData> deleteList);
|
||||
bool socketFlush();
|
||||
|
||||
bool getIsSendStopped() const;
|
||||
|
||||
@@ -49,9 +48,9 @@ public slots:
|
||||
|
||||
signals:
|
||||
void sigLoadHash();
|
||||
QByteArray sigSendXMLmessage(QString loginFrom, QString loginTo, QString text, QString userType);
|
||||
//QByteArray sigSendXMLmessage(QString loginFrom, QString loginTo, QString text, QString userType); //сигнал не используется
|
||||
QByteArray sigSendNotify(QString message);
|
||||
QByteArray sigSendVersion();
|
||||
//QByteArray sigSendVersion(); //сигнал не используется
|
||||
|
||||
private:
|
||||
Client *client;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
#include <QThread>
|
||||
#include "updatecontroller.h"
|
||||
|
||||
|
||||
@@ -5,16 +6,19 @@ UpdateController::UpdateController(QObject *parent) :
|
||||
QObject(parent),
|
||||
commonClientHandler(nullptr)
|
||||
{
|
||||
qDebug() << "UpdateController init thread ID " << QThread::currentThreadId();
|
||||
|
||||
buildPath = QDir::currentPath() + "/" + applicationFolderName;
|
||||
sharedDataPath = QDir::currentPath() + "/" + sharedDataFolderName;
|
||||
Logger::instance().log(buildPath);
|
||||
qDebug() << hashFileName;
|
||||
}
|
||||
|
||||
void UpdateController::initialize(CommonClientHandler *commonClientHandler,DataParser *dataParser,AssetsManager *assetManager)
|
||||
void UpdateController::initialize(CommonClientHandler *commonClientHandler,AssetsManager *assetManager)
|
||||
{
|
||||
qDebug() << "UpdateController::initialize thread ID " << QThread::currentThreadId();
|
||||
|
||||
this->commonClientHandler = commonClientHandler;
|
||||
this->dataParser = dataParser;
|
||||
this->assetManager = assetManager;
|
||||
hashCalculator = new FastHashCalculator;
|
||||
|
||||
@@ -24,7 +28,7 @@ void UpdateController::initialize(CommonClientHandler *commonClientHandler,DataP
|
||||
}
|
||||
|
||||
sizeToSend = 0;
|
||||
assetManager->initialize(this,dataParser);
|
||||
assetManager->initialize(this);
|
||||
|
||||
if (!checkRequiredFolder())
|
||||
{
|
||||
@@ -37,19 +41,20 @@ void UpdateController::initialize(CommonClientHandler *commonClientHandler,DataP
|
||||
setUpCurrentServerHash();
|
||||
|
||||
mutex = new QMutex;
|
||||
qDebug() << "UpdateController init thread ID " << QThread::currentThreadId();
|
||||
|
||||
emit sigInitializeFinished();
|
||||
}
|
||||
|
||||
void UpdateController::changeAssetVersion(QString versionName)
|
||||
{
|
||||
qDebug() << "UpdateController::changeAssetVersion thread ID " << QThread::currentThreadId();
|
||||
|
||||
//commonClientHandler->slot_sendPacketToAllClients(PacketType::BUSY);
|
||||
bool res = emit signal_BlockAutorization(true, "SERVER", "ChangeAssetVersion");
|
||||
qDebug() << "UpdateController thread ID " << QThread::currentThreadId();
|
||||
|
||||
currentStreamingPath = assetManager->setVersion(versionName);
|
||||
setUpCurrentServerHash();
|
||||
emit sigUpdateDocs();
|
||||
emit sigUpdateDocsXML();
|
||||
commonClientHandler->slot_sendPacketToAllClients(PacketType::HASH_READY, false);
|
||||
commonClientHandler->sendCurrentVersionToAllClient();
|
||||
|
||||
|
||||
@@ -10,14 +10,14 @@
|
||||
#include <QMutex>
|
||||
#include <QApplication>
|
||||
#include <QMessageBox>
|
||||
#include <Systems/Parsers/dataparser.h>
|
||||
#include <Data/typesDataServerClient.h>
|
||||
#include <Data/StreamingVersionData.h>
|
||||
#include "fasthashcalculator.h"
|
||||
#include "assetsmanager.h"
|
||||
#include "commonclienthandler.h"
|
||||
|
||||
class TCPServer;
|
||||
class SendSystem;
|
||||
class DataParser;
|
||||
class ClientHandler;
|
||||
class AssetsManager;
|
||||
class ServerLMSWidget;
|
||||
@@ -30,7 +30,7 @@ class UpdateController : public QObject
|
||||
public:
|
||||
|
||||
explicit UpdateController(QObject *parent = 0);
|
||||
void initialize(CommonClientHandler* commonClientHandler,DataParser *dataParser,AssetsManager *assetManager);
|
||||
void initialize(CommonClientHandler* commonClientHandler,AssetsManager *assetManager);
|
||||
void compareFiles(ClientHandler* handler, QByteArray array);
|
||||
void showHash();
|
||||
void calculateFullHash();
|
||||
@@ -67,7 +67,7 @@ public slots:
|
||||
|
||||
signals:
|
||||
void sigErrorRequired(int code);
|
||||
void sigUpdateDocs();
|
||||
void sigUpdateDocsXML();
|
||||
|
||||
void sigInitializeFinished();
|
||||
|
||||
@@ -85,7 +85,6 @@ private:
|
||||
QString sharedDataPath;
|
||||
CommonClientHandler *commonClientHandler;
|
||||
FastHashCalculator *hashCalculator;
|
||||
DataParser *dataParser;
|
||||
AssetsManager *assetManager;
|
||||
quint64 sizeToSend;
|
||||
QMutex *mutex;
|
||||
|
||||
Reference in New Issue
Block a user