From c34317cbc825321e152964478e5438f78af47fcd Mon Sep 17 00:00:00 2001 From: krivoshein Date: Mon, 12 May 2025 17:20:18 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A1=D1=82=D0=B0=D1=82=D1=83=D1=81=D1=8B=20?= =?UTF-8?q?=D0=B7=D0=B0=D0=B4=D0=B0=D1=87=20=D0=BE=D0=B1=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=BB=D1=8F=D1=8E=D1=82=D1=81=D1=8F=20=D0=B0=D0=B2=D1=82=D0=BE?= =?UTF-8?q?=D0=BC=D0=B0=D1=82=D0=B8=D1=87=D0=B5=D1=81=D0=BA=D0=B8=20=D0=B2?= =?UTF-8?q?=20=D0=93=D0=A3=D0=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ServerLMS/Systems/Parsers/processparser.cpp | 6 ++- ServerLMS/Systems/Parsers/processparser.h | 3 ++ ServerLMS/Systems/commonclienthandler.cpp | 44 +++++++++++++++++++++ ServerLMS/Systems/commonclienthandler.h | 2 + ServerLMS/Systems/processingsystem.cpp | 24 ++--------- ServerLMS/Systems/processingsystem.h | 2 + 6 files changed, 59 insertions(+), 22 deletions(-) diff --git a/ServerLMS/Systems/Parsers/processparser.cpp b/ServerLMS/Systems/Parsers/processparser.cpp index 72a2a78..50fc127 100644 --- a/ServerLMS/Systems/Parsers/processparser.cpp +++ b/ServerLMS/Systems/Parsers/processparser.cpp @@ -65,7 +65,6 @@ void ProcessParser::read(ClientHandler *client, QByteArray array) } else if(xmlReader.name() == "ListTasksAMM") { - //TODO if(client->getClient()->getIsUnity()) {//Отчет по задаче АММ от Юнити-клиента clientUnityTaskAMMreport(xmlReader,client, array); @@ -73,7 +72,6 @@ void ProcessParser::read(ClientHandler *client, QByteArray array) } else if(xmlReader.name() == "ListTasksFIM") { - //TODO if(client->getClient()->getIsUnity()) {//Отчет по задаче FIM от Юнити-клиента clientUnityTaskFIMreport(xmlReader,client, array); @@ -140,6 +138,8 @@ void ProcessParser::clientUnityTaskAMMreport(QXmlStreamReader &xmlReader, Client processingSystem->processingClientQueryToDB(client, queryToDB, trainee_id, data); } } + + emit processingSystem->sigStatusTasksAMMofTraineeChanged(trainee_id); } void ProcessParser::clientUnityTaskFIMreport(QXmlStreamReader &xmlReader, ClientHandler *client, QByteArray array) @@ -186,6 +186,8 @@ void ProcessParser::clientUnityTaskFIMreport(QXmlStreamReader &xmlReader, Client processingSystem->processingClientQueryToDB(client, queryToDB, trainee_id, data); } } + + emit processingSystem->sigStatusTasksFIMofTraineeChanged(trainee_id); } TaskAmmFim ProcessParser::xmlParserQueryToDB_ASSIGN_TASK_FIM_TO_TRAINEE(QByteArray array) diff --git a/ServerLMS/Systems/Parsers/processparser.h b/ServerLMS/Systems/Parsers/processparser.h index 3cfb2ef..63fb1ab 100644 --- a/ServerLMS/Systems/Parsers/processparser.h +++ b/ServerLMS/Systems/Parsers/processparser.h @@ -17,6 +17,9 @@ public: signals: void sigLogMessage(QString text); + + //void sigStatusTasksAMMofTraineeChanged(int trainee_id); + //void sigStatusTasksFIMofTraineeChanged(int trainee_id); private: ProcessingSystem *processingSystem; void clientAuth(QXmlStreamReader &xmlReader,ClientHandler *client); diff --git a/ServerLMS/Systems/commonclienthandler.cpp b/ServerLMS/Systems/commonclienthandler.cpp index 2a84c6f..966d9dd 100644 --- a/ServerLMS/Systems/commonclienthandler.cpp +++ b/ServerLMS/Systems/commonclienthandler.cpp @@ -55,6 +55,50 @@ void CommonClientHandler::slot_ListsInstructorsTraineesChanged() } } +void CommonClientHandler::slot_StatusTasksAMMofTraineeChanged(int trainee_id) +{ + //Проходим все открытые сокеты + foreach(int idSocket, clientsMap->keys()) + { + ClientHandler *handler = clientsMap->value(idSocket); + //Проверяем, есть ли клиенты TYPE_GUI + if(handler->getClient()->getTypeClient() == TypeClientAutorization::TYPE_GUI) + {//Отправляем этому клиенту задачи AMM для Обучаемого (с измененным статусом) + ClientQueryToDB queryToDB; + queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_TASKS_AMM_FOR_TRAINEE; + processingSystem->processingClientQueryToDB(handler, queryToDB, trainee_id); + } + } + + //Отправка списка задач AMM клиенту Юнити + if(ClientHandler* clientUnity = processingSystem->getUnityClientById(trainee_id)) + {//Есть такой + //processingSystem->sendListTasksAMMofTraineetoClient(clientUnity, trainee_id); + } +} + +void CommonClientHandler::slot_StatusTasksFIMofTraineeChanged(int trainee_id) +{ + //Проходим все открытые сокеты + foreach(int idSocket, clientsMap->keys()) + { + ClientHandler *handler = clientsMap->value(idSocket); + //Проверяем, есть ли клиенты TYPE_GUI + if(handler->getClient()->getTypeClient() == TypeClientAutorization::TYPE_GUI) + {//Отправляем этому клиенту задачи FIM для Обучаемого (с измененным статусом) + ClientQueryToDB queryToDB; + queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_TASKS_FIM_FOR_TRAINEE; + processingSystem->processingClientQueryToDB(handler, queryToDB, trainee_id); + } + } + + //Отправка списка задач FIM клиенту Юнити + if(ClientHandler* clientUnity = processingSystem->getUnityClientById(trainee_id)) + {//Есть такой + //processingSystem->sendListTasksFIMofTraineetoClient(clientUnity, trainee_id); + } +} + void CommonClientHandler::slot_sendPacketToAllClients(PacketType packetType) { foreach(int idSocket, clientsMap->keys()) diff --git a/ServerLMS/Systems/commonclienthandler.h b/ServerLMS/Systems/commonclienthandler.h index 0348e05..9d8709a 100644 --- a/ServerLMS/Systems/commonclienthandler.h +++ b/ServerLMS/Systems/commonclienthandler.h @@ -21,6 +21,8 @@ public: void sendNewVersionListToAllClient(); void sendCurrentVersionToAllClient(); void slot_ListsInstructorsTraineesChanged(); + void slot_StatusTasksAMMofTraineeChanged(int trainee_id); + void slot_StatusTasksFIMofTraineeChanged(int trainee_id); void slot_sendPacketToAllClients(PacketType packetType); //слот обработки сигнала о готовности нового сообщения на отправку клиенту от мессенджера void slot_msgToClientFromGUI(QString login, QString text); diff --git a/ServerLMS/Systems/processingsystem.cpp b/ServerLMS/Systems/processingsystem.cpp index 4c19afc..6d87adf 100644 --- a/ServerLMS/Systems/processingsystem.cpp +++ b/ServerLMS/Systems/processingsystem.cpp @@ -23,6 +23,10 @@ void ProcessingSystem::initialize(ServerLMSWidget *server, this->updateController = updateController; connect(this,&ProcessingSystem::sigListsInstructorsTraineesChanged,commonClientHandler, &CommonClientHandler::slot_ListsInstructorsTraineesChanged,Qt::AutoConnection); + + connect(this,&ProcessingSystem::sigStatusTasksAMMofTraineeChanged,commonClientHandler, &CommonClientHandler::slot_StatusTasksAMMofTraineeChanged,Qt::AutoConnection); + connect(this,&ProcessingSystem::sigStatusTasksFIMofTraineeChanged,commonClientHandler, &CommonClientHandler::slot_StatusTasksFIMofTraineeChanged,Qt::AutoConnection); + connect(this,&ProcessingSystem::sigUpdateListClients,server, &ServerLMSWidget::slotUpdateListClients,Qt::AutoConnection); connect(this,&ProcessingSystem::sigSetData,updateController,&UpdateController::setDataInfo,Qt::AutoConnection); connect(this,&ProcessingSystem::signal_msgToClientReady,commonClientHandler, &CommonClientHandler::slot_msgToClientFromGUI); @@ -333,17 +337,7 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu { if(int id_trainee = providerDBLMS->editTaskAMM(*(TaskAmmFim*)data)) { - //Отправка списка задач AMM клиенту GUI - //sendListTasksAMMofTraineetoClient(client, id_trainee); - //Извещаем об изменениях в авторизации - //emit sigListTasksAMMofTraineetoClientChanged(); - //TODO - //Отправка списка задач AMM клиенту Юнити - if(ClientHandler* clientUnity = getUnityClientById(id_trainee)) - {//Есть такой - sendListTasksAMMofTraineetoClient(clientUnity, id_trainee); - } } break; } @@ -351,17 +345,7 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu { if(int id_trainee = providerDBLMS->editTaskFIM(*(TaskAmmFim*)data)) { - //Отправка списка задач FIM клиенту GUI - //sendListTasksFIMofTraineetoClient(client, id_trainee); - //Извещаем об изменениях в авторизации - //emit sigListTasksFIMofTraineetoClientChanged(); - //TODO - //Отправка списка задач FIM клиенту Юнити - if(ClientHandler* clientUnity = getUnityClientById(id_trainee)) - {//Есть такой - sendListTasksFIMofTraineetoClient(clientUnity, id_trainee); - } } break; } diff --git a/ServerLMS/Systems/processingsystem.h b/ServerLMS/Systems/processingsystem.h index cb73318..d59620c 100644 --- a/ServerLMS/Systems/processingsystem.h +++ b/ServerLMS/Systems/processingsystem.h @@ -46,6 +46,8 @@ public: signals: void sigUpdateListClients(); void sigListsInstructorsTraineesChanged(); + void sigStatusTasksAMMofTraineeChanged(int trainee_id); + void sigStatusTasksFIMofTraineeChanged(int trainee_id); void sigLogMessage(QString log); void sigAddToMessanger(QString login,QString text); void signal_msgToClientReady(QString login, QString text);