mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
feat: send contact list
This commit is contained in:
@@ -26,7 +26,9 @@ enum TypeQueryToDB{
|
|||||||
TYPE_QUERY_SET_REPORT_TASK_FIM_TO_TRAINEE,
|
TYPE_QUERY_SET_REPORT_TASK_FIM_TO_TRAINEE,
|
||||||
|
|
||||||
TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_AMM_TO_TRAINEE,
|
TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_AMM_TO_TRAINEE,
|
||||||
TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE
|
TYPE_QUERY_CHANGE_STATUS_REPORT_TASK_FIM_TO_TRAINEE,
|
||||||
|
|
||||||
|
TYPE_QUERY_GET_CONTACT_LIST
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // TYPEQUERYTODB_H
|
#endif // TYPEQUERYTODB_H
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ enum PacketType
|
|||||||
TYPE_FILESIZE = 20,
|
TYPE_FILESIZE = 20,
|
||||||
TYPE_BIGXML = 21,
|
TYPE_BIGXML = 21,
|
||||||
|
|
||||||
TYPE_XMLANSWER_MESSAGE_FOR_GUI = 90,
|
TYPE_XMLANSWER_MESSAGE_FOR_GUI = 90,
|
||||||
|
|
||||||
//xml-ответы на запросы к БД
|
//xml-ответы на запросы к БД
|
||||||
TYPE_XMLANSWER_QUERY_DB__LIST_INSTRUCTORS = 100,
|
TYPE_XMLANSWER_QUERY_DB__LIST_INSTRUCTORS = 100,
|
||||||
@@ -42,7 +42,8 @@ enum PacketType
|
|||||||
DELETE_DATA_VERSION = 153,
|
DELETE_DATA_VERSION = 153,
|
||||||
BUSY = 154,
|
BUSY = 154,
|
||||||
FREE = 155,
|
FREE = 155,
|
||||||
HASH_CALCULATE_START = 156
|
HASH_CALCULATE_START = 156,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -102,6 +102,31 @@ QByteArray DBAnswerParser::listClassrooms(bool result, QList<Classroom> *listCla
|
|||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QByteArray DBAnswerParser::listContacts(bool result, QList<User> *listContacts)
|
||||||
|
{
|
||||||
|
QDomDocument doc;
|
||||||
|
QDomProcessingInstruction xmlDecl = doc.createProcessingInstruction("xml", "version='1.0' encoding='utf-8'");
|
||||||
|
doc.insertBefore(xmlDecl,doc.firstChild());
|
||||||
|
QDomElement root = doc.createElement("ContactArray");
|
||||||
|
|
||||||
|
for(User entity : *listContacts)
|
||||||
|
{
|
||||||
|
QDomElement contact = doc.createElement("ContactData");
|
||||||
|
contact.toElement().setAttribute("name",entity.getName());
|
||||||
|
contact.toElement().setAttribute("id",entity.getID());
|
||||||
|
QString isLogged = entity.getLoggedIn() ? "1" : "0";
|
||||||
|
contact.toElement().setAttribute("isOnline",isLogged);
|
||||||
|
|
||||||
|
root.appendChild(contact);
|
||||||
|
}
|
||||||
|
|
||||||
|
doc.appendChild(root);
|
||||||
|
|
||||||
|
qDebug() << doc.toString();
|
||||||
|
return doc.toByteArray();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
QByteArray DBAnswerParser::listTasksAMMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list)
|
QByteArray DBAnswerParser::listTasksAMMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list)
|
||||||
{
|
{
|
||||||
QDomDocument commonDOM;
|
QDomDocument commonDOM;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public:
|
|||||||
QByteArray listTrainees(bool result, QList<Trainee> *listTrainees);
|
QByteArray listTrainees(bool result, QList<Trainee> *listTrainees);
|
||||||
QByteArray listComputers(bool result, QList<Computer> *listComputers);
|
QByteArray listComputers(bool result, QList<Computer> *listComputers);
|
||||||
QByteArray listClassrooms(bool result, QList<Classroom> *listClassrooms);
|
QByteArray listClassrooms(bool result, QList<Classroom> *listClassrooms);
|
||||||
|
QByteArray listContacts(bool result, QList<User> *listContacts);
|
||||||
|
|
||||||
QByteArray listTasksAMMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list);
|
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 listTasksFIMofTrainee(bool result, QList<TaskAmmFim> *listTasks, int trainee_id, bool full_list);
|
||||||
|
|||||||
@@ -52,6 +52,13 @@ void CommonClientHandler::slot_ListsInstructorsTraineesChanged()
|
|||||||
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_ALL_LISTS;
|
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_ALL_LISTS;
|
||||||
processingSystem->processingClientQueryToDB(handler, queryToDB);
|
processingSystem->processingClientQueryToDB(handler, queryToDB);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(handler->getClient()->getIsUnity())
|
||||||
|
{
|
||||||
|
ClientQueryToDB queryToDB;
|
||||||
|
queryToDB.typeQuery = TypeQueryToDB::TYPE_QUERY_GET_CONTACT_LIST;
|
||||||
|
processingSystem->processingClientQueryToDB(handler, queryToDB);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -425,6 +425,30 @@ void ProcessingSystem::processingClientQueryToDB(ClientHandler *client, ClientQu
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case TypeQueryToDB::TYPE_QUERY_GET_CONTACT_LIST:
|
||||||
|
{
|
||||||
|
QList<User> entitylist;
|
||||||
|
QList<Instructor> listInstructor = providerDBLMS->GetListAllInstructors();
|
||||||
|
QList<Trainee> listTrainees = providerDBLMS->GetListAllTrainees();
|
||||||
|
|
||||||
|
for (Instructor instructor : listInstructor)
|
||||||
|
{
|
||||||
|
entitylist.append(static_cast<User>(instructor));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Trainee trainee : listTrainees)
|
||||||
|
{
|
||||||
|
entitylist.append(static_cast<User>(trainee));
|
||||||
|
}
|
||||||
|
|
||||||
|
QByteArray arrayAnswer;
|
||||||
|
|
||||||
|
arrayAnswer = dataParser->DbAnswer()->listContacts(true, &entitylist);
|
||||||
|
|
||||||
|
client->sendFileBlockByteArray(arrayAnswer,PacketType::TYPE_BIGXML);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user