mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
Переработан порядок передачи списков 0
This commit is contained in:
@@ -36,7 +36,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 +71,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,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);
|
||||
|
||||
|
||||
@@ -27,7 +27,10 @@ void ProcessingSystem::initialize(MultiThreadServer *server, DataParser *dataPar
|
||||
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 +101,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 +125,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 +190,7 @@ void ProcessingSystem::processingClientDeAutorization(ClientHandler *client, Cli
|
||||
client->sendXmlAnswer(arrayAnswer);
|
||||
|
||||
//Извещаем об изменениях в авторизации
|
||||
emit sigListsInstructorsTraineesChanged();
|
||||
emit sigListTraineesChanged();
|
||||
}
|
||||
else if(providerDBLMS->deAuthorizationInstructor(clientDeAutorization.Login))
|
||||
{//ДеАвторизуется инструктор
|
||||
@@ -187,7 +208,7 @@ void ProcessingSystem::processingClientDeAutorization(ClientHandler *client, Cli
|
||||
providerDBLMS->signal_BlockAutorization(false, fullName, "DeAuthorizationInstructor");
|
||||
|
||||
//Извещаем об изменениях в авторизации
|
||||
emit sigListsInstructorsTraineesChanged();
|
||||
emit sigListInstructorsChanged();
|
||||
}
|
||||
else
|
||||
{//Никто не ДеАвторизовался
|
||||
@@ -311,6 +332,43 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu
|
||||
|
||||
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 +378,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 +403,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 +428,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,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);
|
||||
|
||||
Reference in New Issue
Block a user