Complete Qt6/rtiddsgen migration of residual Lts service sources
This commit is contained in:
86 files changed
+1235
-1128
No files matched your search
+7
-7
@@ -26,12 +26,12 @@ bool HandlerReportData::generateChargeAdminResult(const CreateModifyReportReques
|
||||
q.prepare(QLatin1String("INSERT INTO rep_charge_administration (report_id, effect_source_id, charge_type_id ) VALUES (:reportId, :effectSourceId, :chargeTypeId )"));
|
||||
q.bindValue(QLatin1String(":reportId"), reportId);
|
||||
|
||||
for (auto it1 = request.effectSources().begin(); it1 != request.effectSources().end(); ++it1)
|
||||
for (auto it1 = request.effectSources.begin(); it1 != request.effectSources.end(); ++it1)
|
||||
{
|
||||
ProjectDataManagement::EffectSource effectSourceId = *it1;
|
||||
q.bindValue(QLatin1String(":effectSourceId"), effectSourceId.underlying());
|
||||
q.bindValue(QLatin1String(":effectSourceId"), static_cast<int>(effectSourceId));
|
||||
|
||||
for (auto it2 = request.chargeTypeIds().begin(); it2 != request.chargeTypeIds().end(); ++it2)
|
||||
for (auto it2 = request.chargeTypeIds.begin(); it2 != request.chargeTypeIds.end(); ++it2)
|
||||
{
|
||||
int chargeTypeId = *it2;
|
||||
if (chargeTypeId == 0)
|
||||
@@ -45,7 +45,7 @@ bool HandlerReportData::generateChargeAdminResult(const CreateModifyReportReques
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!calculateStock(chargeTypeId, effectSourceId, request.startTime(), request.endTime(), request.partyId(), reportId))
|
||||
if (!calculateStock(chargeTypeId, effectSourceId, request.startTime, request.endTime, request.partyId, reportId))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -69,7 +69,7 @@ bool HandlerReportData::calculateStock(int chargeTypeId, const ProjectDataManage
|
||||
QString stmt = QLatin1String("SELECT amount, planned, used, sample_time, charge_type_id "
|
||||
" FROM rec_charge_administration "
|
||||
" WHERE effect_source_id = ")
|
||||
+ QString::number(es.underlying()) + QLatin1String(" AND sample_time > 0 AND sample_time < ") + QString::number(startTime)
|
||||
+ QString::number(static_cast<int>(es)) + QLatin1String(" AND sample_time > 0 AND sample_time < ") + QString::number(startTime)
|
||||
+ QLatin1String(" AND party_id = ") + QString::number(partyId) + QLatin1String(" AND charge_type_id = ") + QString::number(chargeTypeId)
|
||||
+ QLatin1String(" ORDER BY sample_time DESC LIMIT 1");
|
||||
|
||||
@@ -112,7 +112,7 @@ bool HandlerReportData::calculateStock(int chargeTypeId, const ProjectDataManage
|
||||
" FROM rec_charge_administration "
|
||||
" WHERE sample_time >= ")
|
||||
+ QString::number(startTime) + QLatin1String(" AND sample_time <= ") + QString::number(endTime) + QLatin1String(" AND party_id = ") + QString::number(partyId)
|
||||
+ QLatin1String(" AND charge_type_id = ") + QString::number(chargeTypeId) + QLatin1String(" AND effect_source_id = ") + QString::number(es.underlying())
|
||||
+ QLatin1String(" AND charge_type_id = ") + QString::number(chargeTypeId) + QLatin1String(" AND effect_source_id = ") + QString::number(static_cast<int>(es))
|
||||
+ QLatin1String(" ORDER BY sample_time ");
|
||||
|
||||
if (!qSelect.exec(stmt))
|
||||
@@ -151,7 +151,7 @@ bool HandlerReportData::calculateStock(int chargeTypeId, const ProjectDataManage
|
||||
+ QString::number(chargeData.chargePlanned) + QLatin1String(", ") + QLatin1String(" charge_available = ")
|
||||
+ QString::number(chargeData.chargeQuantity - chargeData.chargePlanned) + QLatin1String(" WHERE report_id = ") + QString::number(reportId)
|
||||
+ QLatin1String(" AND charge_type_id = ") + QString::number(chargeData.chargeTypeId) + QLatin1String(" AND effect_source_id = ")
|
||||
+ QString::number(es.underlying());
|
||||
+ QString::number(static_cast<int>(es));
|
||||
|
||||
DEBUG_LOG(m_logger) << "Update statement: " << stmt;
|
||||
|
||||
|
||||
+9
-9
@@ -21,8 +21,8 @@ bool HandlerReportData::generateMedevacNineLinerResult(const CreateModifyReportR
|
||||
{
|
||||
INFO_LOG(m_logger) << "Start generateMedevacNineLinerResult ";
|
||||
|
||||
LtsCoordTrans::UtmCoordinate coord(LtsCoordTrans::UtmCoordinate::fromGeographic(request.cornerBottomLeft().lon(),
|
||||
request.cornerBottomLeft().lat()));
|
||||
LtsCoordTrans::UtmCoordinate coord(LtsCoordTrans::UtmCoordinate::fromGeographic(request.cornerBottomLeft.lon,
|
||||
request.cornerBottomLeft.lat));
|
||||
|
||||
DBTransaction trans(m_db->database());
|
||||
|
||||
@@ -38,16 +38,16 @@ bool HandlerReportData::generateMedevacNineLinerResult(const CreateModifyReportR
|
||||
NSqlQuery q(m_db->database());
|
||||
q.setForwardOnly(false);
|
||||
|
||||
QString stmt = QLatin1String("SELECT id FROM san_nine_liner WHERE last_modified >= ") + QString::number(request.startTime()) +
|
||||
QLatin1String(" AND last_modified <= ") + QString::number(request.endTime());
|
||||
QString stmt = QLatin1String("SELECT id FROM san_nine_liner WHERE last_modified >= ") + QString::number(request.startTime) +
|
||||
QLatin1String(" AND last_modified <= ") + QString::number(request.endTime);
|
||||
|
||||
|
||||
if (request.width() > 0 && request.height() > 0)
|
||||
if (request.width > 0 && request.height > 0)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "#### Filtering data on geographic position";
|
||||
|
||||
double x1 = coord.x + request.height();
|
||||
double y1 = coord.y + request.width();
|
||||
double x1 = coord.x + request.height;
|
||||
double y1 = coord.y + request.width;
|
||||
DEBUG_LOG(m_logger) << "#### (x,x1,y,y1) = (" << coord.x << "," << x1 << "," << coord.y << "," << y1 << ")";
|
||||
|
||||
stmt += QLatin1String(" AND position_x_m >= ") + QString::number(coord.x);
|
||||
@@ -65,8 +65,8 @@ bool HandlerReportData::generateMedevacNineLinerResult(const CreateModifyReportR
|
||||
|
||||
if (!q.exec(stmt))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error while selecting sanNineLiners for area (x) " << request.cornerBottomLeft().lon() << ", (y)" << request.cornerBottomLeft().lat()
|
||||
<< " width: " << request.width() << ", height: " << request.height();
|
||||
ERROR_LOG(m_logger) << "Error while selecting sanNineLiners for area (x) " << request.cornerBottomLeft.lon << ", (y)" << request.cornerBottomLeft.lat
|
||||
<< " width: " << request.width << ", height: " << request.height;
|
||||
ERROR_LOG(m_logger) << "stmt: " << stmt;
|
||||
return false;
|
||||
}
|
||||
|
||||
+38
-38
@@ -17,11 +17,11 @@ bool HandlerReportData::generateAirSupportResult(const CreateModifyReportRequest
|
||||
{
|
||||
INFO_LOG(m_logger) << "Start generateAirSupportResult - reportId: " << reportId;
|
||||
|
||||
if (request.chargeTypeIds().size() <= 0 || request.participantTypes().size() <= 0)
|
||||
if (request.chargeTypeIds.size() <= 0 || request.participantTypes.size() <= 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "No elements selected to generate the report";
|
||||
DEBUG_LOG(m_logger) << "request.chargeTypeIds().size()" << request.chargeTypeIds().size();
|
||||
DEBUG_LOG(m_logger) << "request.participantTypes().size()" << request.participantTypes().size();
|
||||
DEBUG_LOG(m_logger) << "request.chargeTypeIds().size()" << request.chargeTypeIds.size();
|
||||
DEBUG_LOG(m_logger) << "request.participantTypes().size()" << request.participantTypes.size();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -49,9 +49,9 @@ bool HandlerReportData::generateAirSupportResult(const CreateModifyReportRequest
|
||||
" (event_time BETWEEN :startTime AND :endTime) AND "
|
||||
" charge_type_id = :chargeId AND ");
|
||||
|
||||
if (request.participantTypes().size() > 0)
|
||||
if (request.participantTypes.size() > 0)
|
||||
{
|
||||
const QString pTypeIdsStr = intVecToString(request.participantTypes());
|
||||
const QString pTypeIdsStr = intVecToString(request.participantTypes);
|
||||
stmtSelect2 += QStringLiteral(" participant_type_id IN (%1) ").arg(pTypeIdsStr);
|
||||
}
|
||||
|
||||
@@ -75,9 +75,9 @@ bool HandlerReportData::generateAirSupportResult(const CreateModifyReportRequest
|
||||
|
||||
qInsert.bindValue(QStringLiteral(":reportId"), reportId);
|
||||
|
||||
qSelect1.bindValue(QStringLiteral(":partyId"), request.partyId());
|
||||
qSelect1.bindValue(QStringLiteral(":startTime"), request.startTime());
|
||||
qSelect1.bindValue(QStringLiteral(":endTime"), request.endTime());
|
||||
qSelect1.bindValue(QStringLiteral(":partyId"), request.partyId);
|
||||
qSelect1.bindValue(QStringLiteral(":startTime"), static_cast<qint64>(request.startTime));
|
||||
qSelect1.bindValue(QStringLiteral(":endTime"), static_cast<qint64>(request.endTime));
|
||||
|
||||
if (!qSelect1.exec())
|
||||
{
|
||||
@@ -86,9 +86,9 @@ bool HandlerReportData::generateAirSupportResult(const CreateModifyReportRequest
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "stmtSelect1: " << stmtSelect1;
|
||||
DEBUG_LOG(m_logger) << "partyId: " << request.partyId();
|
||||
DEBUG_LOG(m_logger) << "startTime: " << request.startTime();
|
||||
DEBUG_LOG(m_logger) << "endTime: " << request.endTime();
|
||||
DEBUG_LOG(m_logger) << "partyId: " << request.partyId;
|
||||
DEBUG_LOG(m_logger) << "startTime: " << request.startTime;
|
||||
DEBUG_LOG(m_logger) << "endTime: " << request.endTime;
|
||||
|
||||
// QMap<chargeTypeId, impacts>
|
||||
QMap<int,int> impactDataMap;
|
||||
@@ -114,9 +114,9 @@ bool HandlerReportData::generateAirSupportResult(const CreateModifyReportRequest
|
||||
return false;
|
||||
}
|
||||
|
||||
qSelect1.bindValue(QStringLiteral(":partyId"), request.partyId());
|
||||
qSelect1.bindValue(QStringLiteral(":startTime"), request.startTime());
|
||||
qSelect1.bindValue(QStringLiteral(":endTime"), request.endTime());
|
||||
qSelect1.bindValue(QStringLiteral(":partyId"), request.partyId);
|
||||
qSelect1.bindValue(QStringLiteral(":startTime"), static_cast<qint64>(request.startTime));
|
||||
qSelect1.bindValue(QStringLiteral(":endTime"), static_cast<qint64>(request.endTime));
|
||||
|
||||
if (!qSelect1.exec())
|
||||
{
|
||||
@@ -125,9 +125,9 @@ bool HandlerReportData::generateAirSupportResult(const CreateModifyReportRequest
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "stmtSelect1: " << stmtSelect1;
|
||||
DEBUG_LOG(m_logger) << "partyId: " << request.partyId();
|
||||
DEBUG_LOG(m_logger) << "startTime: " << request.startTime();
|
||||
DEBUG_LOG(m_logger) << "endTime: " << request.endTime();
|
||||
DEBUG_LOG(m_logger) << "partyId: " << request.partyId;
|
||||
DEBUG_LOG(m_logger) << "startTime: " << request.startTime;
|
||||
DEBUG_LOG(m_logger) << "endTime: " << request.endTime;
|
||||
|
||||
// QMap<chargeTypeId, eventTime>
|
||||
QMap<int,qint64> minEventTimeMap;
|
||||
@@ -152,9 +152,9 @@ bool HandlerReportData::generateAirSupportResult(const CreateModifyReportRequest
|
||||
return false;
|
||||
}
|
||||
|
||||
qSelect1.bindValue(QStringLiteral(":partyId"), request.partyId());
|
||||
qSelect1.bindValue(QStringLiteral(":startTime"), request.startTime());
|
||||
qSelect1.bindValue(QStringLiteral(":endTime"), request.endTime());
|
||||
qSelect1.bindValue(QStringLiteral(":partyId"), request.partyId);
|
||||
qSelect1.bindValue(QStringLiteral(":startTime"), static_cast<qint64>(request.startTime));
|
||||
qSelect1.bindValue(QStringLiteral(":endTime"), static_cast<qint64>(request.endTime));
|
||||
|
||||
if (!qSelect1.exec())
|
||||
{
|
||||
@@ -163,9 +163,9 @@ bool HandlerReportData::generateAirSupportResult(const CreateModifyReportRequest
|
||||
}
|
||||
|
||||
DEBUG_LOG(m_logger) << "stmtSelect1: " << stmtSelect1;
|
||||
DEBUG_LOG(m_logger) << "partyId: " << request.partyId();
|
||||
DEBUG_LOG(m_logger) << "startTime: " << request.startTime();
|
||||
DEBUG_LOG(m_logger) << "endTime: " << request.endTime();
|
||||
DEBUG_LOG(m_logger) << "partyId: " << request.partyId;
|
||||
DEBUG_LOG(m_logger) << "startTime: " << request.startTime;
|
||||
DEBUG_LOG(m_logger) << "endTime: " << request.endTime;
|
||||
|
||||
// QMap<chargeTypeId, eventTime>
|
||||
QMap<int,qint64> maxEventTimeMap;
|
||||
@@ -187,7 +187,7 @@ bool HandlerReportData::generateAirSupportResult(const CreateModifyReportRequest
|
||||
DEBUG_LOG(m_logger) << "Impacts = " << impacts;
|
||||
|
||||
// use only requested chargeTypeIds
|
||||
if (std::find(request.chargeTypeIds().begin(), request.chargeTypeIds().end(), chargeTypeId) == request.chargeTypeIds().end() || chargeTypeId == 0)
|
||||
if (std::find(request.chargeTypeIds.begin(), request.chargeTypeIds.end(), chargeTypeId) == request.chargeTypeIds.end() || chargeTypeId == 0)
|
||||
{
|
||||
WARNING_LOG(m_logger) << "ChargeTypeId " << chargeTypeId << " not found in list";
|
||||
continue;
|
||||
@@ -197,22 +197,22 @@ bool HandlerReportData::generateAirSupportResult(const CreateModifyReportRequest
|
||||
timeoutTimer.start();
|
||||
|
||||
qint64 t1;
|
||||
t1 = request.startTime();
|
||||
while (t1 <= request.endTime())
|
||||
t1 = request.startTime;
|
||||
while (t1 <= request.endTime)
|
||||
{
|
||||
checkElapsedTimer(timeoutTimer);
|
||||
qint64 t2 = qMin(qMax(t1, t1 + request.intervalTime() - 1), request.endTime());
|
||||
if (request.intervalTime() == 0) // || request.visualisationType() == VisualisationType::Table)
|
||||
t2 = request.endTime();
|
||||
qint64 t2 = qMin(qMax(t1, t1 + request.intervalTime - 1), request.endTime);
|
||||
if (request.intervalTime == 0) // || request.visualisationType == VisualisationType::Table)
|
||||
t2 = request.endTime;
|
||||
|
||||
qInsert.bindValue(QStringLiteral(":start"), t1);
|
||||
qInsert.bindValue(QStringLiteral(":end"), t2);
|
||||
qInsert.bindValue(QStringLiteral(":chargeTypeId"), chargeTypeId);
|
||||
|
||||
DEBUG_LOG(m_logger) << " Inserting: reportId, start, end, interval, name = " << reportId << " , " << t1 << " , " << t2 << " , "
|
||||
<< request.intervalTime();
|
||||
<< request.intervalTime;
|
||||
|
||||
qSelect2.bindValue(QStringLiteral(":aesPartyId"), request.partyId());
|
||||
qSelect2.bindValue(QStringLiteral(":aesPartyId"), request.partyId);
|
||||
qSelect2.bindValue(QStringLiteral(":chargeId"), chargeTypeId);
|
||||
qSelect2.bindValue(QStringLiteral(":startTime"), t1);
|
||||
qSelect2.bindValue(QStringLiteral(":endTime"), t2);
|
||||
@@ -220,7 +220,7 @@ bool HandlerReportData::generateAirSupportResult(const CreateModifyReportRequest
|
||||
DEBUG_LOG(m_logger) << "stmtSelect2: " << stmtSelect2;
|
||||
DEBUG_LOG(m_logger) << "startTime: " << t1;
|
||||
DEBUG_LOG(m_logger) << "endTime: " << t2;
|
||||
DEBUG_LOG(m_logger) << "aesPartyId: " << request.partyId();
|
||||
DEBUG_LOG(m_logger) << "aesPartyId: " << request.partyId;
|
||||
DEBUG_LOG(m_logger) << "chargeTypeId: " << chargeTypeId;
|
||||
|
||||
QMap<int, QVector<int>> vbgMap;
|
||||
@@ -238,9 +238,9 @@ bool HandlerReportData::generateAirSupportResult(const CreateModifyReportRequest
|
||||
|
||||
if (!vbgMap.contains(vbg))
|
||||
vbgMap.insert(vbg, {0, 0, 0});
|
||||
if (vbg == ProjectDataManagement::VulnerabilityState::CombatReady ||
|
||||
vbg == ProjectDataManagement::VulnerabilityState::NearMiss ||
|
||||
vbg == ProjectDataManagement::VulnerabilityState::HitWithNoEffect)
|
||||
if (vbg == static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady) ||
|
||||
vbg == static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_NearMiss) ||
|
||||
vbg == static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_HitWithNoEffect))
|
||||
continue;
|
||||
|
||||
vbgMap[vbg][0] += qSelect2.value(1).toInt(); // hits
|
||||
@@ -274,7 +274,7 @@ bool HandlerReportData::generateAirSupportResult(const CreateModifyReportRequest
|
||||
|
||||
if (vbgMap.isEmpty())
|
||||
{
|
||||
qInsert.bindValue(QStringLiteral(":vbg"),ProjectDataManagement::VulnerabilityState::NearMiss);
|
||||
qInsert.bindValue(QStringLiteral(":vbg"),static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_NearMiss));
|
||||
qInsert.bindValue(QStringLiteral(":impacts"), impacts);
|
||||
qInsert.bindValue(QStringLiteral(":hit"), 0);
|
||||
qInsert.bindValue(QStringLiteral(":hit_ff"), 0);
|
||||
@@ -289,8 +289,8 @@ bool HandlerReportData::generateAirSupportResult(const CreateModifyReportRequest
|
||||
}
|
||||
}
|
||||
|
||||
t1 += request.intervalTime();
|
||||
if (request.intervalTime() == 0) // || request.visualisationType() == VisualisationType::Table)
|
||||
t1 += request.intervalTime;
|
||||
if (request.intervalTime == 0) // || request.visualisationType == VisualisationType::Table)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -40,7 +40,7 @@ bool HandlerReportData::generateBuildingDamageResult(const CreateModifyReportReq
|
||||
m_buildingDamageData.clear();
|
||||
|
||||
// in chargeTypeIds are saved buildingIds
|
||||
for (auto it = request.chargeTypeIds().begin(); it != request.chargeTypeIds().end(); ++it)
|
||||
for (auto it = request.chargeTypeIds.begin(); it != request.chargeTypeIds.end(); ++it)
|
||||
{
|
||||
BuildingDamageData bdDataStart, bdDataEnd;
|
||||
int buildingId = *it;
|
||||
@@ -50,10 +50,10 @@ bool HandlerReportData::generateBuildingDamageResult(const CreateModifyReportReq
|
||||
continue;
|
||||
|
||||
bdDataStart.buildingId = buildingId;
|
||||
bdDataStart.timePoint = request.startTime();
|
||||
bdDataStart.timePoint = request.startTime;
|
||||
|
||||
bdDataEnd.buildingId = buildingId;
|
||||
bdDataEnd.timePoint = request.endTime();
|
||||
bdDataEnd.timePoint = request.endTime;
|
||||
|
||||
qSelect.bindValue(QStringLiteral(":buildingId"), bdDataStart.buildingId);
|
||||
|
||||
|
||||
+14
-14
@@ -33,19 +33,19 @@ bool HandlerReportData::generateChargeResupplyResult(const CreateModifyReportReq
|
||||
QSet<int> usedGears;
|
||||
{
|
||||
QString stmt = QLatin1String("SELECT DISTINCT gear_id FROM rep_charge_resupply_data "
|
||||
" WHERE (event_time BETWEEN ") + QString::number(request.startTime()) + QLatin1String(" AND ") + QString::number(request.endTime()) + QLatin1String(") ");
|
||||
" WHERE (event_time BETWEEN ") + QString::number(request.startTime) + QLatin1String(" AND ") + QString::number(request.endTime) + QLatin1String(") ");
|
||||
|
||||
stmt += QLatin1String(" AND charge_type_id != 0");
|
||||
|
||||
if (request.chargeTypeIds().size() > 0)
|
||||
if (request.chargeTypeIds.size() > 0)
|
||||
{
|
||||
const QString chargeTypeIds = intVecToString(request.chargeTypeIds());
|
||||
const QString chargeTypeIds = intVecToString(request.chargeTypeIds);
|
||||
stmt += QLatin1String(" AND (charge_type_id IN (") + chargeTypeIds + QLatin1String(") OR charge_type_id < 0) ");
|
||||
}
|
||||
|
||||
if (request.participantIds().size() > 0)
|
||||
if (request.participantIds.size() > 0)
|
||||
{
|
||||
const QString participants = intVecToString(request.participantIds());
|
||||
const QString participants = intVecToString(request.participantIds);
|
||||
stmt += QStringLiteral(" AND participant_id IN (%1)").arg(participants);
|
||||
}
|
||||
|
||||
@@ -70,14 +70,14 @@ bool HandlerReportData::generateChargeResupplyResult(const CreateModifyReportReq
|
||||
{
|
||||
QString stmt = QLatin1String("SELECT party_id, event_time, participant_id, participant_type_id, charge_type_id, gear_type_id, "
|
||||
"gear_id, charge_fired, charge_remain FROM rep_charge_resupply_data "
|
||||
" WHERE (event_time BETWEEN ") + QString::number(request.startTime()) + QLatin1String(" AND ") + QString::number(request.endTime()) + QLatin1String(") ");
|
||||
" WHERE (event_time BETWEEN ") + QString::number(request.startTime) + QLatin1String(" AND ") + QString::number(request.endTime) + QLatin1String(") ");
|
||||
|
||||
stmt += QLatin1String(" AND charge_type_id != 0 ");
|
||||
|
||||
// for gears with more than one possible charge
|
||||
if (request.chargeTypeIds().size() > 0)
|
||||
if (request.chargeTypeIds.size() > 0)
|
||||
{
|
||||
const QString chargeTypeIds = intVecToString(request.chargeTypeIds());
|
||||
const QString chargeTypeIds = intVecToString(request.chargeTypeIds);
|
||||
stmt += QLatin1String(" AND (charge_type_id IN (") + chargeTypeIds + QLatin1String(") OR charge_type_id < 0) ");
|
||||
}
|
||||
|
||||
@@ -91,9 +91,9 @@ bool HandlerReportData::generateChargeResupplyResult(const CreateModifyReportReq
|
||||
stmt += QLatin1String(" AND gear_id IN (") + gears + QLatin1String(")");
|
||||
}
|
||||
|
||||
if (request.participantIds().size() > 0)
|
||||
if (request.participantIds.size() > 0)
|
||||
{
|
||||
const QString participants = intVecToString(request.participantIds());
|
||||
const QString participants = intVecToString(request.participantIds);
|
||||
stmt += QStringLiteral(" AND participant_id IN (%1)").arg(participants);
|
||||
}
|
||||
|
||||
@@ -170,13 +170,13 @@ bool HandlerReportData::generateChargeResupplyResult(const CreateModifyReportReq
|
||||
|
||||
// Alle Teilnehmer, die in der angegebenen Zeit kein Telegramm erzeugt haben, hier
|
||||
// hinzufügen
|
||||
for (const int participantId : request.participantIds())
|
||||
for (const int participantId : request.participantIds)
|
||||
{
|
||||
if (!m_crPartMap.contains(participantId))
|
||||
{
|
||||
checkElapsedTimer(timeoutTimer);
|
||||
// letzte Waffenzuordnung & Munitionsvorat holen und in m_crPartMap / m_crGear eintragen
|
||||
getLastGearSetting(participantId, request.chargeTypeIds(), request.startTime());
|
||||
getLastGearSetting(participantId, request.chargeTypeIds, request.startTime);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ bool HandlerReportData::generateChargeResupplyResult(const CreateModifyReportReq
|
||||
}
|
||||
else
|
||||
{
|
||||
start = getStart(x.participantId, x.gearId, x.chargeTypeId, request.startTime(), 0);
|
||||
start = getStart(x.participantId, x.gearId, x.chargeTypeId, request.startTime, 0);
|
||||
DEBUG_LOG(m_logger) << "### ChargeType changed - 1st: MunV, therefore, START = " << start;
|
||||
}
|
||||
}
|
||||
@@ -435,7 +435,7 @@ bool HandlerReportData::generateChargeResupplyResult(const CreateModifyReportReq
|
||||
{
|
||||
for (const ChargeResupplyResult &res : qAsConst(ctmap)) // Per ChargeType
|
||||
{
|
||||
if (request.participantIds().size() > 0 && !contains(request.participantIds(), res.participantId))
|
||||
if (request.participantIds.size() > 0 && !contains(request.participantIds, res.participantId))
|
||||
continue;
|
||||
|
||||
finalMap[res.participantTypeId][res.chargeTypeId].chargeTypeId = res.chargeTypeId;
|
||||
|
||||
+52
-52
@@ -102,21 +102,21 @@ void HandlerReportData::onCreateModifyReportRequest(const rti::core::SampleIdent
|
||||
|
||||
m_updateReportCookie = cookie;
|
||||
|
||||
m_reply.errorString(std::string());
|
||||
m_reply.replyState(Core::FtReplyState::InProgress);
|
||||
m_reply.currentTime(QDateTime::currentMSecsSinceEpoch());
|
||||
m_reply.errorString = std::string();
|
||||
m_reply.replyState = Core::FtReplyState::InProgress;
|
||||
m_reply.currentTime = QDateTime::currentMSecsSinceEpoch();
|
||||
|
||||
m_ddsHandler->fts()->createModifyReportReply(m_updateReportCookie, m_reply);
|
||||
|
||||
qint32 reportId;
|
||||
bool ok = true;
|
||||
|
||||
if (request.id() == 0) // add
|
||||
if (request.id == 0) // add
|
||||
reportId = 0;
|
||||
else // modify
|
||||
{
|
||||
reportId = request.id();
|
||||
ReportType repType = request.reportType(); // assuming this cannot be changed by this request
|
||||
reportId = request.id;
|
||||
ReportType repType = request.reportType; // assuming this cannot be changed by this request
|
||||
ok = removeReportData(reportId, repType); // remove old data
|
||||
if (!ok)
|
||||
WARNING_LOG(m_logger) << "Cannot remove old data for report id = " << reportId;
|
||||
@@ -125,17 +125,17 @@ void HandlerReportData::onCreateModifyReportRequest(const rti::core::SampleIdent
|
||||
if (!insertReportData(request, reportId))
|
||||
{
|
||||
ERROR_LOG(m_logger) << "Error while creating report!";
|
||||
m_reply.errorString(tr_lts("dds","Error while creating report"));
|
||||
m_reply.replyState(Core::FtReplyState::Error);
|
||||
m_reply.currentTime(QDateTime::currentMSecsSinceEpoch());
|
||||
m_reply.errorString = tr_lts("dds","Error while creating report");
|
||||
m_reply.replyState = Core::FtReplyState::Error;
|
||||
m_reply.currentTime = QDateTime::currentMSecsSinceEpoch();
|
||||
m_ddsHandler->fts()->createModifyReportReply(m_updateReportCookie, m_reply);
|
||||
return;
|
||||
}
|
||||
|
||||
m_reply.id(reportId);
|
||||
m_reply.id = reportId;
|
||||
|
||||
// Generate data per reportType
|
||||
switch (request.reportType().underlying())
|
||||
switch (request.reportType)
|
||||
{
|
||||
case ReportManagement::ReportType::UnitPower:
|
||||
{
|
||||
@@ -226,16 +226,16 @@ void HandlerReportData::onCreateModifyReportRequest(const rti::core::SampleIdent
|
||||
objRep->removeObject();
|
||||
m_objReportMap.remove(reportId);
|
||||
|
||||
ERROR_LOG(m_logger) << "Error generating report with type " << request.reportType();
|
||||
m_reply.errorString(tr_lts("dds", "Error generating report"));
|
||||
m_reply.replyState(Core::FtReplyState::Error);
|
||||
m_reply.currentTime(QDateTime::currentMSecsSinceEpoch());
|
||||
ERROR_LOG(m_logger) << "Error generating report with type " << request.reportType;
|
||||
m_reply.errorString = tr_lts("dds", "Error generating report");
|
||||
m_reply.replyState = Core::FtReplyState::Error;
|
||||
m_reply.currentTime = QDateTime::currentMSecsSinceEpoch();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_reply.errorString(std::string());
|
||||
m_reply.replyState(Core::FtReplyState::Completed);
|
||||
m_reply.currentTime(QDateTime::currentMSecsSinceEpoch());
|
||||
m_reply.errorString = std::string();
|
||||
m_reply.replyState = Core::FtReplyState::Completed;
|
||||
m_reply.currentTime = QDateTime::currentMSecsSinceEpoch();
|
||||
}
|
||||
|
||||
m_ddsHandler->fts()->createModifyReportReply(m_updateReportCookie, m_reply);
|
||||
@@ -247,13 +247,13 @@ void HandlerReportData::onRemoveReportRequest(const rti::core::SampleIdentity &c
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onRemoveReportRequest " << request;
|
||||
|
||||
int reportId = request.id();
|
||||
int reportId = request.id;
|
||||
|
||||
Core::FunctionReplyObject ret;
|
||||
ObjectReportInfo *ifs = m_objReportMap.value(reportId);
|
||||
if (ifs == nullptr)
|
||||
{
|
||||
ret = Core::FunctionReplyObject(request.id(), tr_lts("dds", "Report with id %1 not found")).arg(reportId);
|
||||
ret = Core::FunctionReplyObject(request.id, tr_lts("dds", "Report with id %1 not found")).arg(reportId);
|
||||
m_ddsHandler->fts()->removeReportReply(cookie, ret);
|
||||
return;
|
||||
}
|
||||
@@ -286,7 +286,7 @@ bool HandlerReportData::removeReportData(int reportId, ReportType repType)
|
||||
|
||||
bool ok = true;
|
||||
|
||||
switch (repType.underlying())
|
||||
switch (repType)
|
||||
{
|
||||
case ReportManagement::ReportType::UnitPower:
|
||||
{
|
||||
@@ -380,10 +380,10 @@ void HandlerReportData::onReportChangeStatusRequest(const rti::core::SampleIdent
|
||||
const ReportChangeStatusRequest &request)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "onReportChangeStatusRequest " << request;
|
||||
ObjectReportInfo *ifs = m_objReportMap.value(request.id());
|
||||
ObjectReportInfo *ifs = m_objReportMap.value(request.id);
|
||||
if (ifs == nullptr)
|
||||
{
|
||||
Core::FunctionReplyObject ret = Core::FunctionReplyObject(request.id(), tr_lts("dds", "Report with id %1 not found")).arg(request.id());
|
||||
Core::FunctionReplyObject ret = Core::FunctionReplyObject(request.id, tr_lts("dds", "Report with id %1 not found")).arg(request.id);
|
||||
m_ddsHandler->fts()->reportChangeStatusReply(cookie, ret);
|
||||
return;
|
||||
}
|
||||
@@ -399,26 +399,26 @@ bool HandlerReportData::insertReportData(const CreateModifyReportRequest &reques
|
||||
{
|
||||
Database::RepReport data;
|
||||
|
||||
data.name = QString::fromStdString(request.name());
|
||||
data.description = QString::fromStdString(request.description());
|
||||
data.partyId = request.partyId();
|
||||
data.startTime = request.startTime();
|
||||
data.endTime = request.endTime();
|
||||
data.reportTypeId = request.reportType();
|
||||
data.visualisationType = request.visualisationType();
|
||||
data.intervalTime = request.intervalTime();
|
||||
data.lastModified = request.lastModified();
|
||||
data.operatorId = request.operatorId();
|
||||
data.fileStatusId = request.fileStatus();
|
||||
data.name = QString::fromStdString(request.name);
|
||||
data.description = QString::fromStdString(request.description);
|
||||
data.partyId = request.partyId;
|
||||
data.startTime = request.startTime;
|
||||
data.endTime = request.endTime;
|
||||
data.reportTypeId = request.reportType;
|
||||
data.visualisationType = request.visualisationType;
|
||||
data.intervalTime = request.intervalTime;
|
||||
data.lastModified = request.lastModified;
|
||||
data.operatorId = request.operatorId;
|
||||
data.fileStatusId = request.fileStatus;
|
||||
// area
|
||||
data.width = request.width();
|
||||
data.height = request.height();
|
||||
data.position = QPointF(request.cornerBottomLeft().lon(), request.cornerBottomLeft().lat());
|
||||
data.width = request.width;
|
||||
data.height = request.height;
|
||||
data.position = QPointF(request.cornerBottomLeft.lon, request.cornerBottomLeft.lat);
|
||||
|
||||
const auto participants = m_ppmDtc->participants();
|
||||
QJsonArray participantIdArray;
|
||||
QJsonArray participantNamesArray;
|
||||
for (int id : request.participantIds())
|
||||
for (int id : request.participantIds)
|
||||
{
|
||||
participantIdArray.append(QJsonValue(id));
|
||||
QJsonValue name = QJsonValue(m_ppmDtc->hierarchyFromParticipant(id, participants));
|
||||
@@ -426,17 +426,17 @@ bool HandlerReportData::insertReportData(const CreateModifyReportRequest &reques
|
||||
}
|
||||
|
||||
QJsonArray superiorIdsArray;
|
||||
for (Superior sup : request.superiorIds())
|
||||
for (Superior sup : request.superiorIds)
|
||||
{
|
||||
QJsonObject jsonData;
|
||||
jsonData[QStringLiteral("participantId")] = sup.participantId();
|
||||
jsonData[QStringLiteral("superiorId")] = sup.superiorId();
|
||||
jsonData[QStringLiteral("participantId")] = sup.participantId;
|
||||
jsonData[QStringLiteral("superiorId")] = sup.superiorId;
|
||||
superiorIdsArray.append(jsonData);
|
||||
}
|
||||
|
||||
QJsonArray unitIdArray;
|
||||
QJsonArray unitNamesArray;
|
||||
for (int id : request.unitIds())
|
||||
for (int id : request.unitIds)
|
||||
{
|
||||
unitIdArray.append(QJsonValue(id));
|
||||
QJsonValue name = QJsonValue(m_ppmDtc->hierarchyFromParticipant(id, participants));
|
||||
@@ -444,34 +444,34 @@ bool HandlerReportData::insertReportData(const CreateModifyReportRequest &reques
|
||||
}
|
||||
|
||||
QJsonArray partTypeArray;
|
||||
for (int id : request.participantTypes())
|
||||
for (int id : request.participantTypes)
|
||||
partTypeArray.append(QJsonValue(id));
|
||||
|
||||
QJsonArray chargeTypeIdsArray;
|
||||
for (int id : request.chargeTypeIds())
|
||||
for (int id : request.chargeTypeIds)
|
||||
chargeTypeIdsArray.append(QJsonValue(id));
|
||||
|
||||
QJsonArray mineAreaIdsArray;
|
||||
QJsonArray mineAreaNamesArray;
|
||||
for (int id : request.mineAreaIds())
|
||||
for (int id : request.mineAreaIds)
|
||||
{
|
||||
mineAreaIdsArray.append(QJsonValue(id));
|
||||
QJsonValue name = QJsonValue(QString::fromStdString(m_aesDtc->mineArea(id).name()));
|
||||
QJsonValue name = QJsonValue(QString::fromStdString(m_aesDtc->mineArea(id).name));
|
||||
mineAreaNamesArray.append(name);
|
||||
}
|
||||
|
||||
QJsonArray nbcIdsArray;
|
||||
QJsonArray nbcNamesArray;
|
||||
for (int id : request.nbcIds())
|
||||
for (int id : request.nbcIds)
|
||||
{
|
||||
nbcIdsArray.append(QJsonValue(id));
|
||||
QJsonValue name = QJsonValue(QString::fromStdString(m_aesDtc->bCContamination(id).name()));
|
||||
QJsonValue name = QJsonValue(QString::fromStdString(m_aesDtc->bCContamination(id).name));
|
||||
nbcNamesArray.append(name);
|
||||
}
|
||||
|
||||
QJsonArray effectSourceArray;
|
||||
for (const ProjectDataManagement::EffectSource &es : request.effectSources())
|
||||
effectSourceArray.append(QJsonValue(es.underlying()));
|
||||
for (const ProjectDataManagement::EffectSource &es : request.effectSources)
|
||||
effectSourceArray.append(QJsonValue(static_cast<int>(es)));
|
||||
|
||||
QJsonObject obj;
|
||||
obj[QStringLiteral("participantIds")] = participantIdArray;
|
||||
@@ -480,7 +480,7 @@ bool HandlerReportData::insertReportData(const CreateModifyReportRequest &reques
|
||||
obj[QStringLiteral("superiorIds")] = superiorIdsArray;
|
||||
obj[QStringLiteral("unitNames")] = unitNamesArray;
|
||||
obj[QStringLiteral("participantTypes")] = partTypeArray;
|
||||
obj[QStringLiteral("groupByParty")] = request.groupByParty();
|
||||
obj[QStringLiteral("groupByParty")] = request.groupByParty;
|
||||
obj[QStringLiteral("chargeTypeIds")] = chargeTypeIdsArray;
|
||||
obj[QStringLiteral("mineAreaIds")] = mineAreaIdsArray;
|
||||
obj[QStringLiteral("mineAreaNames")] = mineAreaNamesArray;
|
||||
@@ -567,7 +567,7 @@ void HandlerReportData::checkElapsedTimer(QElapsedTimer &t)
|
||||
void HandlerReportData::updateReportReply()
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "updateReportReply: " << m_reply;
|
||||
m_reply.currentTime(QDateTime::currentMSecsSinceEpoch());
|
||||
m_reply.currentTime = QDateTime::currentMSecsSinceEpoch();
|
||||
m_ddsHandler->fts()->createModifyReportReply(m_updateReportCookie, m_reply);
|
||||
m_ddsHandler->pacemaker()->publishState();
|
||||
}
|
||||
|
||||
+1
-1
@@ -88,7 +88,7 @@ struct AirSupportImpactData
|
||||
struct ChargeTypeData
|
||||
{
|
||||
int chargeTypeId = 0;
|
||||
ProjectDataManagement::EffectSource effectSourceId = ProjectDataManagement::EffectSource::get_default();
|
||||
ProjectDataManagement::EffectSource effectSourceId = ProjectDataManagement::EffectSource::ES_Unknown;
|
||||
int chargeQuantity = 0;
|
||||
int usedCharge = 0;
|
||||
int chargeAddition = 0;
|
||||
|
||||
+19
-19
@@ -17,12 +17,12 @@ bool HandlerReportData::generateFiringsResult(const CreateModifyReportRequest &r
|
||||
{
|
||||
INFO_LOG(m_logger) << "Start generateFiringsResult - reportId: " << reportId;
|
||||
|
||||
if (request.chargeTypeIds().size() <= 0 || request.participantIds().size() <= 0 || request.participantTypes().size() <= 0)
|
||||
if (request.chargeTypeIds.size() <= 0 || request.participantIds.size() <= 0 || request.participantTypes.size() <= 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "No elements selected to generate the report";
|
||||
DEBUG_LOG(m_logger) << "request.chargeTypeIds().size()" << request.chargeTypeIds().size();
|
||||
DEBUG_LOG(m_logger) << "request.participantIds().size()" << request.participantIds().size();
|
||||
DEBUG_LOG(m_logger) << "request.participantTypes().size()" << request.participantTypes().size();
|
||||
DEBUG_LOG(m_logger) << "request.chargeTypeIds().size()" << request.chargeTypeIds.size();
|
||||
DEBUG_LOG(m_logger) << "request.participantIds().size()" << request.participantIds.size();
|
||||
DEBUG_LOG(m_logger) << "request.participantTypes().size()" << request.participantTypes.size();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -37,9 +37,9 @@ bool HandlerReportData::generateFiringsResult(const CreateModifyReportRequest &r
|
||||
"(event_time BETWEEN :startTime AND :endTime) AND "
|
||||
" charge_type_id = :chargeId AND ");
|
||||
|
||||
if (request.participantTypes().size() > 0)
|
||||
if (request.participantTypes.size() > 0)
|
||||
{
|
||||
const QString pTypeIdsStr = intVecToString(request.participantTypes());
|
||||
const QString pTypeIdsStr = intVecToString(request.participantTypes);
|
||||
stmtSelect += QStringLiteral(" participant_type_id IN (%1) ").arg(pTypeIdsStr);
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ bool HandlerReportData::generateFiringsResult(const CreateModifyReportRequest &r
|
||||
|
||||
QElapsedTimer timeoutTimer;
|
||||
timeoutTimer.start();
|
||||
for (const int &chargeId : qAsConst(request.chargeTypeIds()))
|
||||
for (const int &chargeId : qAsConst(request.chargeTypeIds))
|
||||
{
|
||||
if (chargeId == 0) continue; // skip 0
|
||||
|
||||
@@ -73,21 +73,21 @@ bool HandlerReportData::generateFiringsResult(const CreateModifyReportRequest &r
|
||||
DEBUG_LOG(m_logger) << "Charge id = " << chargeId;
|
||||
|
||||
qint64 t1;
|
||||
t1 = request.startTime();
|
||||
while (t1 <= request.endTime())
|
||||
t1 = request.startTime;
|
||||
while (t1 <= request.endTime)
|
||||
{
|
||||
checkElapsedTimer(timeoutTimer);
|
||||
qint64 t2 = qMin(qMax(t1, t1 + request.intervalTime() - 1), request.endTime());
|
||||
if (request.intervalTime() == 0) // || request.visualisationType() == VisualisationType::Table)
|
||||
t2 = request.endTime();
|
||||
qint64 t2 = qMin(qMax(t1, t1 + request.intervalTime - 1), request.endTime);
|
||||
if (request.intervalTime == 0) // || request.visualisationType == VisualisationType::Table)
|
||||
t2 = request.endTime;
|
||||
|
||||
qInsert.bindValue(QStringLiteral(":start"), t1);
|
||||
qInsert.bindValue(QStringLiteral(":end"), t2);
|
||||
|
||||
DEBUG_LOG(m_logger) << " Inserting: reportId, start, end, interval = " << reportId << " , " << t1 << " , " << t2 << " , "
|
||||
<< request.intervalTime();
|
||||
<< request.intervalTime;
|
||||
|
||||
qSelect.bindValue(QStringLiteral(":partyId"), request.partyId());
|
||||
qSelect.bindValue(QStringLiteral(":partyId"), request.partyId);
|
||||
qSelect.bindValue(QStringLiteral(":chargeId"), chargeId);
|
||||
qSelect.bindValue(QStringLiteral(":startTime"), t1);
|
||||
qSelect.bindValue(QStringLiteral(":endTime"), t2);
|
||||
@@ -105,9 +105,9 @@ bool HandlerReportData::generateFiringsResult(const CreateModifyReportRequest &r
|
||||
int vbg = qSelect.value(0).toInt();
|
||||
if (!vbgMap.contains(vbg))
|
||||
vbgMap.insert(vbg, {0, 0, 0});
|
||||
if (vbg == ProjectDataManagement::VulnerabilityState::CombatReady ||
|
||||
vbg == ProjectDataManagement::VulnerabilityState::NearMiss ||
|
||||
vbg == ProjectDataManagement::VulnerabilityState::HitWithNoEffect)
|
||||
if (vbg == static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_CombatReady) ||
|
||||
vbg == static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_NearMiss) ||
|
||||
vbg == static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_HitWithNoEffect))
|
||||
vbgMap[vbg][0] ++; // firings
|
||||
|
||||
vbgMap[vbg][1] += qSelect.value(1).toInt(); // hits
|
||||
@@ -131,8 +131,8 @@ bool HandlerReportData::generateFiringsResult(const CreateModifyReportRequest &r
|
||||
}
|
||||
}
|
||||
|
||||
t1 += request.intervalTime();
|
||||
if (request.intervalTime() == 0) // || request.visualisationType() == VisualisationType::Table)
|
||||
t1 += request.intervalTime;
|
||||
if (request.intervalTime == 0) // || request.visualisationType == VisualisationType::Table)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+24
-24
@@ -40,9 +40,9 @@ bool HandlerReportGetData::init() { return true; }
|
||||
void HandlerReportGetData::onGetReportDataRequest(const rti::core::SampleIdentity &cookie, const GetReportDataRequest &request)
|
||||
{
|
||||
GetReportDataReply ret = getReportDataRequest(request);
|
||||
if (ret.errorString().size() != 0)
|
||||
if (ret.errorString.size() != 0)
|
||||
{
|
||||
Core::FunctionReplyObject fro(ret.id(), ret.errorString(), ret.errorParams());
|
||||
Core::FunctionReplyObject fro(ret.id, ret.errorString, ret.errorParams);
|
||||
WARNING_LOG(m_logger) << "error: " << fro();
|
||||
}
|
||||
m_ddsHandler->fts()->getReportDataReply(cookie, ret);
|
||||
@@ -55,54 +55,54 @@ GetReportDataReply HandlerReportGetData::getReportDataRequest(const GetReportDat
|
||||
|
||||
// Get data per reportType
|
||||
QByteArray reportData;
|
||||
switch (request.reportType().underlying())
|
||||
switch (request.reportType)
|
||||
{
|
||||
case ReportManagement::ReportType::UnitPower:
|
||||
reportData = getUnitPowerResult(request.reportId());
|
||||
reportData = getUnitPowerResult(request.reportId);
|
||||
break;
|
||||
case ReportManagement::ReportType::ParticipantDistance:
|
||||
reportData = getParticipantDistanceResult(request.reportId());
|
||||
reportData = getParticipantDistanceResult(request.reportId);
|
||||
break;
|
||||
case ReportManagement::ReportType::MineArea:
|
||||
reportData = getMineAreaResult(request.reportId());
|
||||
reportData = getMineAreaResult(request.reportId);
|
||||
break;
|
||||
case ReportManagement::ReportType::Nbc:
|
||||
reportData = getNbcResult(request.reportId());
|
||||
reportData = getNbcResult(request.reportId);
|
||||
break;
|
||||
case ReportManagement::ReportType::Firings:
|
||||
case ReportManagement::ReportType::ExplosiveDevice:
|
||||
reportData = getFiringsResult(request.reportId());
|
||||
reportData = getFiringsResult(request.reportId);
|
||||
break;
|
||||
case ReportManagement::ReportType::AirSupport:
|
||||
reportData = getAirSupportResult(request.reportId());
|
||||
reportData = getAirSupportResult(request.reportId);
|
||||
break;
|
||||
|
||||
case ReportManagement::ReportType::ChargeResupply:
|
||||
reportData = getChargeResupplyResult(request.reportId());
|
||||
reportData = getChargeResupplyResult(request.reportId);
|
||||
break;
|
||||
case ReportManagement::ReportType::ChargeAdministration:
|
||||
reportData = getChargeAdminResult(request.reportId());
|
||||
reportData = getChargeAdminResult(request.reportId);
|
||||
break;
|
||||
case ReportManagement::ReportType::VehicleRepair:
|
||||
case ReportManagement::ReportType::Decontamination:
|
||||
reportData = getMaintenanceResult(request.reportId());
|
||||
reportData = getMaintenanceResult(request.reportId);
|
||||
break;
|
||||
case ReportManagement::ReportType::BuildingDamage:
|
||||
reportData = getBuildingDamageResult(request.reportId());
|
||||
reportData = getBuildingDamageResult(request.reportId);
|
||||
break;
|
||||
case ReportManagement::ReportType::SanitationMaterial:
|
||||
reportData = getSanitationMaterialResult(request.reportId());
|
||||
reportData = getSanitationMaterialResult(request.reportId);
|
||||
break;
|
||||
case ReportManagement::ReportType::MedevacNineLiner:
|
||||
reportData = getSanNineLinerResult(request.reportId());
|
||||
reportData = getSanNineLinerResult(request.reportId);
|
||||
break;
|
||||
case ReportManagement::ReportType::Treatment:
|
||||
case ReportManagement::ReportType::TreatmentPriority:
|
||||
case ReportManagement::ReportType::TreatmentChain:
|
||||
reportData = getTreatmentResult(request.reportId());
|
||||
reportData = getTreatmentResult(request.reportId);
|
||||
break;
|
||||
case ReportManagement::ReportType::TreatmentTimeline:
|
||||
reportData = getTreatmentTimelineResult(request.reportId());
|
||||
reportData = getTreatmentTimelineResult(request.reportId);
|
||||
break;
|
||||
default:
|
||||
WARNING_LOG(m_logger) << "Report Type unknown, no generating.";
|
||||
@@ -110,16 +110,16 @@ GetReportDataReply HandlerReportGetData::getReportDataRequest(const GetReportDat
|
||||
}
|
||||
|
||||
GetReportDataReply ret;
|
||||
ret.id(request.reportId());
|
||||
ret.id = request.reportId;
|
||||
|
||||
if (reportData.isEmpty())
|
||||
{
|
||||
Core::FunctionReplyObject fro = Core::FunctionReplyObject(tr_lts("dds", "No data for this report (report type: %1)")).arg(request.reportType().underlying());
|
||||
ret.errorString(fro.str());
|
||||
ret.errorParams(fro.args());
|
||||
Core::FunctionReplyObject fro = Core::FunctionReplyObject(tr_lts("dds", "No data for this report (report type: %1)")).arg(static_cast<int>(request.reportType));
|
||||
ret.errorString = fro.str();
|
||||
ret.errorParams = fro.args();
|
||||
}
|
||||
else
|
||||
ret.reportData(LtsUtils::convert<std::vector<uint8_t>>(reportData));
|
||||
ret.reportData = LtsUtils::convert<std::vector<uint8_t>>(reportData);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ QByteArray HandlerReportGetData::getChargeAdminResult(int reportId) const
|
||||
|
||||
object.insert(QLatin1String("id"), data.id);
|
||||
object.insert(QLatin1String("charge_type_id"), data.chargeTypeId);
|
||||
object.insert(QLatin1String("effect_source_id"), data.effectSourceId.underlying());
|
||||
object.insert(QLatin1String("effect_source_id"), static_cast<int>(data.effectSourceId));
|
||||
object.insert(QLatin1String("charge_start"), data.chargeStart);
|
||||
object.insert(QLatin1String("charge_resupplied"), data.chargeResupplied);
|
||||
object.insert(QLatin1String("charge_end"), data.chargeEnd);
|
||||
@@ -536,7 +536,7 @@ QByteArray HandlerReportGetData::getTreatmentTimelineResult(int reportId) const
|
||||
object.insert(QLatin1String("vulnerability"), data.vulnerability);
|
||||
object.insert(QLatin1String("vulnerability_state"), data.vulnerabilityState);
|
||||
object.insert(QLatin1String("vitality"), data.vitality);
|
||||
object.insert(QLatin1String("event_type_id"), data.eventTypeId.underlying());
|
||||
object.insert(QLatin1String("event_type_id"), static_cast<int>(data.eventTypeId));
|
||||
object.insert(QLatin1String("event_time"), data.eventTime);
|
||||
object.insert(QLatin1String("properties"), data.properties);
|
||||
|
||||
|
||||
+10
-10
@@ -28,27 +28,27 @@ bool HandlerReportData::generateMaintenanceResult(const CreateModifyReportReques
|
||||
QString stmtSelect = QStringLiteral("SELECT participant_type_id, participant_id, time_event, time_position_changed, time_vulnerability "
|
||||
"FROM rep_maintenance_data "
|
||||
"WHERE party_id = :partyId AND (time_event between :startTime and :endTime) ");
|
||||
if (request.participantTypes().size() > 0)
|
||||
if (request.participantTypes.size() > 0)
|
||||
{
|
||||
const QString pTypeIdsStr = intVecToString(request.participantTypes());
|
||||
const QString pTypeIdsStr = intVecToString(request.participantTypes);
|
||||
stmtSelect += QStringLiteral(" AND participant_type_id IN (%1) ").arg(pTypeIdsStr);
|
||||
}
|
||||
if (request.participantIds().size() > 0)
|
||||
if (request.participantIds.size() > 0)
|
||||
{
|
||||
const QString pIdsStr = intVecToString(request.participantIds());
|
||||
const QString pIdsStr = intVecToString(request.participantIds);
|
||||
stmtSelect += QStringLiteral(" AND participant_id IN (%1) ").arg(pIdsStr);
|
||||
}
|
||||
stmtSelect += QStringLiteral(" ORDER by participant_type_id, participant_id, time_event");
|
||||
|
||||
DEBUG_LOG(m_logger) << "Statement: " << stmtSelect;
|
||||
DEBUG_LOG(m_logger) << "Party Id = " << request.partyId();
|
||||
DEBUG_LOG(m_logger) << "Start Time = " << request.startTime();
|
||||
DEBUG_LOG(m_logger) << "End Time = " << request.endTime();
|
||||
DEBUG_LOG(m_logger) << "Party Id = " << request.partyId;
|
||||
DEBUG_LOG(m_logger) << "Start Time = " << request.startTime;
|
||||
DEBUG_LOG(m_logger) << "End Time = " << request.endTime;
|
||||
|
||||
qSelect.prepare(stmtSelect);
|
||||
qSelect.bindValue(QStringLiteral(":startTime"), request.startTime());
|
||||
qSelect.bindValue(QStringLiteral(":endTime"), request.endTime());
|
||||
qSelect.bindValue(QStringLiteral(":partyId"), request.partyId());
|
||||
qSelect.bindValue(QStringLiteral(":startTime"), static_cast<qint64>(request.startTime));
|
||||
qSelect.bindValue(QStringLiteral(":endTime"), static_cast<qint64>(request.endTime));
|
||||
qSelect.bindValue(QStringLiteral(":partyId"), request.partyId);
|
||||
|
||||
if (!qSelect.exec())
|
||||
{
|
||||
|
||||
+6
-6
@@ -27,12 +27,12 @@ bool HandlerReportData::generateMineAreaResult(const CreateModifyReportRequest &
|
||||
NSqlQuery qSelect(m_db->database());
|
||||
NSqlQuery qInsert(m_db->database());
|
||||
|
||||
const QString mineAreaIdsStr = intVecToString(request.mineAreaIds());
|
||||
const QString mineAreaIdsStr = intVecToString(request.mineAreaIds);
|
||||
|
||||
QString stmtSelect = QStringLiteral("SELECT mine_area_id, participant_type_id, SUM(hit) as hit, SUM(hit_friendly_fire) as hit_friendly_fire "
|
||||
" FROM rep_mine_area_data "
|
||||
" WHERE party_id = :partyId AND (event_time between :startTime and :endTime ) ");
|
||||
if (request.mineAreaIds().size() > 0)
|
||||
if (request.mineAreaIds.size() > 0)
|
||||
stmtSelect += QStringLiteral(" AND mine_area_id IN (%1)").arg(mineAreaIdsStr);
|
||||
stmtSelect += QStringLiteral(" GROUP BY mine_area_id, participant_type_id ");
|
||||
stmtSelect += QStringLiteral(" ORDER by mine_area_id, participant_type_id ");
|
||||
@@ -45,9 +45,9 @@ bool HandlerReportData::generateMineAreaResult(const CreateModifyReportRequest &
|
||||
return false;
|
||||
}
|
||||
|
||||
qSelect.bindValue(QStringLiteral(":startTime"), request.startTime());
|
||||
qSelect.bindValue(QStringLiteral(":endTime"), request.endTime());
|
||||
qSelect.bindValue(QStringLiteral(":partyId"), request.partyId());
|
||||
qSelect.bindValue(QStringLiteral(":startTime"), static_cast<qint64>(request.startTime));
|
||||
qSelect.bindValue(QStringLiteral(":endTime"), static_cast<qint64>(request.endTime));
|
||||
qSelect.bindValue(QStringLiteral(":partyId"), request.partyId);
|
||||
|
||||
if (!qSelect.exec())
|
||||
{
|
||||
@@ -79,7 +79,7 @@ bool HandlerReportData::generateMineAreaResult(const CreateModifyReportRequest &
|
||||
INFO_LOG(m_logger) << "hit_ff: " << hitFriendlyFire;
|
||||
|
||||
qInsert.bindValue(QStringLiteral(":mineAreaId") , mineAreaId);
|
||||
QString mineAreaName = QString::fromStdString(aesDtc->mineArea(mineAreaId).name());
|
||||
QString mineAreaName = QString::fromStdString(aesDtc->mineArea(mineAreaId).name);
|
||||
qInsert.bindValue(QStringLiteral(":mineAreaName") , mineAreaName);
|
||||
qInsert.bindValue(QStringLiteral(":pTypeId") , participantTypeId);
|
||||
qInsert.bindValue(QStringLiteral(":hit") , hit);
|
||||
|
||||
+6
-6
@@ -21,14 +21,14 @@ bool HandlerReportData::generateNbcResult(const CreateModifyReportRequest &reque
|
||||
{
|
||||
INFO_LOG(m_logger) << "Start generateNbcResult - reportId: " << reportId;
|
||||
|
||||
if (request.nbcIds().size() <= 0)
|
||||
if (request.nbcIds.size() <= 0)
|
||||
{
|
||||
ERROR_LOG(m_logger) << "No elements selected to generate the report";
|
||||
DEBUG_LOG(m_logger) << "request.nbcIds().size()" << request.nbcIds().size();
|
||||
DEBUG_LOG(m_logger) << "request.nbcIds().size()" << request.nbcIds.size();
|
||||
return false;
|
||||
}
|
||||
|
||||
const QString nbcIdsStr = intVecToString(request.nbcIds());
|
||||
const QString nbcIdsStr = intVecToString(request.nbcIds);
|
||||
|
||||
DBTransaction trans(m_db->database());
|
||||
NSqlQuery qSelect(m_db->database());
|
||||
@@ -48,8 +48,8 @@ bool HandlerReportData::generateNbcResult(const CreateModifyReportRequest &reque
|
||||
ERROR_LOG(m_logger) << "Error preparing select statement: " << stmtSelect;
|
||||
return false;
|
||||
}
|
||||
qSelect.bindValue(QStringLiteral(":startTime"), request.startTime());
|
||||
qSelect.bindValue(QStringLiteral(":endTime"), request.endTime());
|
||||
qSelect.bindValue(QStringLiteral(":startTime"), static_cast<qint64>(request.startTime));
|
||||
qSelect.bindValue(QStringLiteral(":endTime"), static_cast<qint64>(request.endTime));
|
||||
|
||||
if (!qSelect.exec())
|
||||
{
|
||||
@@ -86,7 +86,7 @@ bool HandlerReportData::generateNbcResult(const CreateModifyReportRequest &reque
|
||||
|
||||
qInsert.bindValue(QStringLiteral(":reportId"), reportId);
|
||||
qInsert.bindValue(QStringLiteral(":nbcId"), nbcId);
|
||||
QString nbcName = QString::fromStdString(aesDtc->bCContamination(nbcId).name());
|
||||
QString nbcName = QString::fromStdString(aesDtc->bCContamination(nbcId).name);
|
||||
qInsert.bindValue(QStringLiteral(":nbcName"), nbcName);
|
||||
qInsert.bindValue(QStringLiteral(":aesType"), aesType);
|
||||
qInsert.bindValue(QStringLiteral(":chargeId"), chargeTypeId);
|
||||
|
||||
+11
-11
@@ -32,15 +32,15 @@ bool HandlerReportData::generateParticipantDistanceResult(const CreateModifyRepo
|
||||
"WHERE party_id = :partyId AND (sample_time between :startTime and :endTime) "
|
||||
"AND (pos_lon > 0 OR pos_lat > 0)"); // ignore (0,0)
|
||||
|
||||
if (request.participantTypes().size() > 0)
|
||||
if (request.participantTypes.size() > 0)
|
||||
{
|
||||
const QString pTypeIdsStr = intVecToString(request.participantTypes());
|
||||
const QString pTypeIdsStr = intVecToString(request.participantTypes);
|
||||
stmtSelect += QStringLiteral(" AND participant_type_id IN (%1) ").arg(pTypeIdsStr);
|
||||
}
|
||||
|
||||
if (request.participantIds().size() > 0)
|
||||
if (request.participantIds.size() > 0)
|
||||
{
|
||||
const QString participants = intVecToString(request.participantIds());
|
||||
const QString participants = intVecToString(request.participantIds);
|
||||
stmtSelect += QStringLiteral(" AND participant_id IN (%1)").arg(participants);
|
||||
}
|
||||
|
||||
@@ -48,14 +48,14 @@ bool HandlerReportData::generateParticipantDistanceResult(const CreateModifyRepo
|
||||
|
||||
qSelect.prepare(stmtSelect);
|
||||
|
||||
qSelect.bindValue(QStringLiteral(":startTime"), request.startTime());
|
||||
qSelect.bindValue(QStringLiteral(":endTime"), request.endTime());
|
||||
qSelect.bindValue(QStringLiteral(":partyId"), request.partyId());
|
||||
qSelect.bindValue(QStringLiteral(":startTime"), static_cast<qint64>(request.startTime));
|
||||
qSelect.bindValue(QStringLiteral(":endTime"), static_cast<qint64>(request.endTime));
|
||||
qSelect.bindValue(QStringLiteral(":partyId"), request.partyId);
|
||||
|
||||
DEBUG_LOG(m_logger) << "Select statement: " << stmtSelect;
|
||||
DEBUG_LOG(m_logger) << "Party id = " << request.partyId();
|
||||
DEBUG_LOG(m_logger) << "StartTime = " << request.startTime();
|
||||
DEBUG_LOG(m_logger) << "EndTime = " << request.endTime();
|
||||
DEBUG_LOG(m_logger) << "Party id = " << request.partyId;
|
||||
DEBUG_LOG(m_logger) << "StartTime = " << request.startTime;
|
||||
DEBUG_LOG(m_logger) << "EndTime = " << request.endTime;
|
||||
|
||||
if (!qSelect.exec())
|
||||
{
|
||||
@@ -137,7 +137,7 @@ bool HandlerReportData::generateParticipantDistanceResult(const CreateModifyRepo
|
||||
}
|
||||
|
||||
qInsert.bindValue(QStringLiteral(":reportId"), reportId);
|
||||
qInsert.bindValue(QStringLiteral(":partyId"), request.partyId());
|
||||
qInsert.bindValue(QStringLiteral(":partyId"), request.partyId);
|
||||
|
||||
for (auto it = m_distanceMapType.cbegin(); it != m_distanceMapType.cend(); ++it)
|
||||
{
|
||||
|
||||
+21
-21
@@ -32,25 +32,25 @@ bool HandlerReportData::generateTreatmentResult(const CreateModifyReportRequest
|
||||
"FROM rep_treatment_data "
|
||||
// "WHERE party_id = :partyId AND (time_treatment between :startTime and :endTime) ");
|
||||
"WHERE party_id = :partyId AND (time_vulnerability between :startTime and :endTime) ");
|
||||
if (request.participantTypes().size() > 0)
|
||||
if (request.participantTypes.size() > 0)
|
||||
{
|
||||
const QString pTypeIdsStr = intVecToString(request.participantTypes());
|
||||
const QString pTypeIdsStr = intVecToString(request.participantTypes);
|
||||
stmtSelect += QStringLiteral(" AND participant_type_id IN (%1) ").arg(pTypeIdsStr);
|
||||
}
|
||||
if (request.participantIds().size() > 0)
|
||||
if (request.participantIds.size() > 0)
|
||||
{
|
||||
const QString pIdsStr = intVecToString(request.participantIds());
|
||||
const QString pIdsStr = intVecToString(request.participantIds);
|
||||
stmtSelect += QStringLiteral(" AND participant_id IN (%1) ").arg(pIdsStr);
|
||||
}
|
||||
|
||||
if (request.width() > 0 && request.height() > 0)
|
||||
if (request.width > 0 && request.height > 0)
|
||||
{
|
||||
DEBUG_LOG(m_logger) << "#### Filtering data on geographic position";
|
||||
LtsCoordTrans::UtmCoordinate coord(LtsCoordTrans::UtmCoordinate::fromGeographic(request.cornerBottomLeft().lon(),
|
||||
request.cornerBottomLeft().lat()));
|
||||
LtsCoordTrans::UtmCoordinate coord(LtsCoordTrans::UtmCoordinate::fromGeographic(request.cornerBottomLeft.lon,
|
||||
request.cornerBottomLeft.lat));
|
||||
|
||||
double x1 = coord.x + request.height();
|
||||
double y1 = coord.y + request.width();
|
||||
double x1 = coord.x + request.height;
|
||||
double y1 = coord.y + request.width;
|
||||
DEBUG_LOG(m_logger) << "#### (x,x1,y,y1) = (" << coord.x << "," << x1 << "," << coord.y << "," << y1 << ")";
|
||||
|
||||
stmtSelect += QLatin1String(" AND position_x_m >= ") + QString::number(coord.x);
|
||||
@@ -63,14 +63,14 @@ bool HandlerReportData::generateTreatmentResult(const CreateModifyReportRequest
|
||||
stmtSelect += QStringLiteral(" ORDER by time_vulnerability");
|
||||
|
||||
DEBUG_LOG(m_logger) << "Statement: " << stmtSelect;
|
||||
DEBUG_LOG(m_logger) << "Party Id = " << request.partyId();
|
||||
DEBUG_LOG(m_logger) << "Start Time = " << request.startTime();
|
||||
DEBUG_LOG(m_logger) << "End Time = " << request.endTime();
|
||||
DEBUG_LOG(m_logger) << "Party Id = " << request.partyId;
|
||||
DEBUG_LOG(m_logger) << "Start Time = " << request.startTime;
|
||||
DEBUG_LOG(m_logger) << "End Time = " << request.endTime;
|
||||
|
||||
qSelect.prepare(stmtSelect);
|
||||
qSelect.bindValue(QStringLiteral(":startTime"), request.startTime());
|
||||
qSelect.bindValue(QStringLiteral(":endTime"), request.endTime());
|
||||
qSelect.bindValue(QStringLiteral(":partyId"), request.partyId());
|
||||
qSelect.bindValue(QStringLiteral(":startTime"), static_cast<qint64>(request.startTime));
|
||||
qSelect.bindValue(QStringLiteral(":endTime"), static_cast<qint64>(request.endTime));
|
||||
qSelect.bindValue(QStringLiteral(":partyId"), request.partyId);
|
||||
|
||||
if (!qSelect.exec())
|
||||
{
|
||||
@@ -105,7 +105,7 @@ bool HandlerReportData::generateTreatmentResult(const CreateModifyReportRequest
|
||||
tData.pos_y_m = qSelect.value(19).toDouble();
|
||||
|
||||
tData.area_id = qSelect.value(20).toInt();
|
||||
tData.area_name = qSelect.value(21).toInt();
|
||||
tData.area_name = qSelect.value(21).toString();
|
||||
|
||||
m_treatmentData.append(tData);
|
||||
}
|
||||
@@ -147,7 +147,7 @@ bool HandlerReportData::generateTreatmentResult(const CreateModifyReportRequest
|
||||
|
||||
bool kiaAfterWia = false;
|
||||
// Check if KIA is also KIA after WIA
|
||||
if (tData.vulnerabilityState == ProjectDataManagement::VulnerabilityState::CatastrophicKill)
|
||||
if (tData.vulnerabilityState == static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill))
|
||||
kiaAfterWia = checkVulnerabilityStateWIA(tData.participantId, tData.time_vulnerability);
|
||||
|
||||
qInsert.bindValue(QStringLiteral(":kia_after_wia"), kiaAfterWia);
|
||||
@@ -197,7 +197,7 @@ bool HandlerReportData::generateTreatmentResult(const CreateModifyReportRequest
|
||||
QString area_name;
|
||||
if (area_id > 0)
|
||||
{
|
||||
area_name = QString::fromStdString(m_aesDtc->functionalArea(area_id).name());
|
||||
area_name = QString::fromStdString(m_aesDtc->functionalArea(area_id).name);
|
||||
qInsert.bindValue(QStringLiteral(":area_id"), area_id);
|
||||
qInsert.bindValue(QStringLiteral(":area_name"), area_name);
|
||||
}
|
||||
@@ -231,7 +231,7 @@ bool HandlerReportData::generateTreatmentResult(const CreateModifyReportRequest
|
||||
if (tData.time_treatment > 0)
|
||||
{
|
||||
bool pCorrect = false;
|
||||
pCorrect = getPriorityCorrect(participant.id(), tData.time_treatment, tData.priority);
|
||||
pCorrect = getPriorityCorrect(participant.id, tData.time_treatment, tData.priority);
|
||||
qInsert.bindValue(QStringLiteral(":pCorrect"), pCorrect);
|
||||
}
|
||||
|
||||
@@ -549,8 +549,8 @@ bool HandlerReportData::checkVulnerabilityStateWIA(int participantId, qint64 cur
|
||||
|
||||
qSelect.prepare(stmtSelect);
|
||||
qSelect.bindValue(QStringLiteral(":currTime"), currTime);
|
||||
qSelect.bindValue(QStringLiteral(":eventTypeId"), ReportManagement::EventType::VBGSet);
|
||||
qSelect.bindValue(QStringLiteral(":vulnerabilityState"), ProjectDataManagement::VulnerabilityState::CatastrophicKill);
|
||||
qSelect.bindValue(QStringLiteral(":eventTypeId"), static_cast<int>(ReportManagement::EventType::VBGSet));
|
||||
qSelect.bindValue(QStringLiteral(":vulnerabilityState"), static_cast<int>(ProjectDataManagement::VulnerabilityState::VulnerabilityState_CatastrophicKill));
|
||||
qSelect.bindValue(QStringLiteral(":participantId"), participantId);
|
||||
|
||||
if (!qSelect.exec())
|
||||
|
||||
+12
-12
@@ -30,28 +30,28 @@ bool HandlerReportData::generateTreatmentTimelineResult(const CreateModifyReport
|
||||
QString stmtSelect = QStringLiteral("SELECT participant_type_id, participant_id, vitality, vulnerability, vulnerability_state, event_time, event_type_id, properties "
|
||||
"FROM rep_treatment_timeline_data "
|
||||
"WHERE party_id = :partyId AND (event_time between :startTime and :endTime) ");
|
||||
if (request.participantTypes().size() > 0)
|
||||
if (request.participantTypes.size() > 0)
|
||||
{
|
||||
const QString pTypeIdsStr = intVecToString(request.participantTypes());
|
||||
const QString pTypeIdsStr = intVecToString(request.participantTypes);
|
||||
stmtSelect += QStringLiteral(" AND participant_type_id IN (%1) ").arg(pTypeIdsStr);
|
||||
}
|
||||
if (request.participantIds().size() > 0)
|
||||
if (request.participantIds.size() > 0)
|
||||
{
|
||||
const QString pIdsStr = intVecToString(request.participantIds());
|
||||
const QString pIdsStr = intVecToString(request.participantIds);
|
||||
stmtSelect += QStringLiteral(" AND participant_id IN (%1) ").arg(pIdsStr);
|
||||
}
|
||||
|
||||
stmtSelect += QStringLiteral(" ORDER by participant_type_id, participant_id, event_time, event_type_id");
|
||||
|
||||
DEBUG_LOG(m_logger) << "Statement: " << stmtSelect;
|
||||
DEBUG_LOG(m_logger) << "Party Id = " << request.partyId();
|
||||
DEBUG_LOG(m_logger) << "Start Time = " << request.startTime();
|
||||
DEBUG_LOG(m_logger) << "End Time = " << request.endTime();
|
||||
DEBUG_LOG(m_logger) << "Party Id = " << request.partyId;
|
||||
DEBUG_LOG(m_logger) << "Start Time = " << request.startTime;
|
||||
DEBUG_LOG(m_logger) << "End Time = " << request.endTime;
|
||||
|
||||
qSelect.prepare(stmtSelect);
|
||||
qSelect.bindValue(QStringLiteral(":startTime"), request.startTime());
|
||||
qSelect.bindValue(QStringLiteral(":endTime"), request.endTime());
|
||||
qSelect.bindValue(QStringLiteral(":partyId"), request.partyId());
|
||||
qSelect.bindValue(QStringLiteral(":startTime"), static_cast<qint64>(request.startTime));
|
||||
qSelect.bindValue(QStringLiteral(":endTime"), static_cast<qint64>(request.endTime));
|
||||
qSelect.bindValue(QStringLiteral(":partyId"), request.partyId);
|
||||
|
||||
if (!qSelect.exec())
|
||||
{
|
||||
@@ -80,8 +80,8 @@ bool HandlerReportData::generateTreatmentTimelineResult(const CreateModifyReport
|
||||
tData.properties = qSelect.value(7).toString();
|
||||
|
||||
// 2 events TransportInitiated one after another, we save only first one
|
||||
if (oldData.eventTypeId == ReportManagement::EventType::TransportInitiated &&
|
||||
tData.eventTypeId == ReportManagement::EventType::TransportInitiated)
|
||||
if (oldData.eventTypeId == static_cast<int>(ReportManagement::EventType::TransportInitiated) &&
|
||||
tData.eventTypeId == static_cast<int>(ReportManagement::EventType::TransportInitiated))
|
||||
continue;
|
||||
|
||||
m_treatmentTimelineData.append(tData);
|
||||
|
||||
+14
-14
@@ -142,7 +142,7 @@ bool HandlerReportData::generateUnitPowerResult(const CreateModifyReportRequest
|
||||
// request.participantIds() == auszuwertende Participants (wird im MMI ausgefüllt)
|
||||
|
||||
|
||||
QString keyStr = request.groupByParty() ? QStringLiteral("party_id") : QStringLiteral("participant_type_id");
|
||||
QString keyStr = request.groupByParty ? QStringLiteral("party_id") : QStringLiteral("participant_type_id");
|
||||
// 1. ParticipantVec - only participantIds
|
||||
// QSet<int> participantIds;
|
||||
// for (auto it = request.participantIds().begin(); it != request.participantIds().end(); ++it)
|
||||
@@ -151,9 +151,9 @@ bool HandlerReportData::generateUnitPowerResult(const CreateModifyReportRequest
|
||||
// participantId -> ParticipantKeyData
|
||||
QMap<int, ParticipantKeyData> resultMapPrevious;
|
||||
|
||||
if (!getParticipantInitial(LtsUtils::convert<QVector<int>>(request.participantIds()),
|
||||
request.startTime(),
|
||||
request.endTime(),
|
||||
if (!getParticipantInitial(LtsUtils::convert<QVector<int>>(request.participantIds),
|
||||
request.startTime,
|
||||
request.endTime,
|
||||
keyStr,
|
||||
resultMapPrevious))
|
||||
return false;
|
||||
@@ -165,9 +165,9 @@ bool HandlerReportData::generateUnitPowerResult(const CreateModifyReportRequest
|
||||
QString stmt = QStringLiteral("SELECT participant_id, ready, vulnerability_state, event_time "
|
||||
" FROM rep_unit_power_data WHERE event_time > :intervalStart"
|
||||
" AND event_time <= :intervalEnd ");
|
||||
if (request.participantIds().size() > 0)
|
||||
if (request.participantIds.size() > 0)
|
||||
{
|
||||
const QString participantIdStr = intVecToString(request.participantIds());
|
||||
const QString participantIdStr = intVecToString(request.participantIds);
|
||||
stmt += QStringLiteral(" AND participant_id IN (%1)").arg(participantIdStr);
|
||||
}
|
||||
stmt += QStringLiteral(" ORDER by event_time");
|
||||
@@ -178,8 +178,8 @@ bool HandlerReportData::generateUnitPowerResult(const CreateModifyReportRequest
|
||||
if (!q.prepare(stmt))
|
||||
return false; // ...
|
||||
|
||||
q.bindValue(QStringLiteral(":intervalStart"), request.startTime());
|
||||
q.bindValue(QStringLiteral(":intervalEnd"), request.endTime());
|
||||
q.bindValue(QStringLiteral(":intervalStart"), static_cast<qint64>(request.startTime));
|
||||
q.bindValue(QStringLiteral(":intervalEnd"), static_cast<qint64>(request.endTime));
|
||||
|
||||
if (!q.exec())
|
||||
{
|
||||
@@ -200,15 +200,15 @@ bool HandlerReportData::generateUnitPowerResult(const CreateModifyReportRequest
|
||||
|
||||
DEBUG_LOG(m_logger) << "dataVec size: " << dataVec.size();
|
||||
|
||||
qint64 t1 = request.startTime();
|
||||
qint64 t1 = request.startTime;
|
||||
int startIndex = 0;
|
||||
QElapsedTimer timeoutTimer;
|
||||
timeoutTimer.start();
|
||||
while (t1 <= request.endTime())
|
||||
while (t1 <= request.endTime)
|
||||
{
|
||||
checkElapsedTimer(timeoutTimer);
|
||||
qint64 t2 = qMin(qMax(t1, t1 + request.intervalTime() - 1), request.endTime());
|
||||
if (request.intervalTime() == 0) t2 = request.endTime();
|
||||
qint64 t2 = qMin(qMax(t1, t1 + request.intervalTime - 1), request.endTime);
|
||||
if (request.intervalTime == 0) t2 = request.endTime;
|
||||
|
||||
INFO_LOG(m_logger) << "Generating report data for interval t1: " << t1 << ", t2: " << t2;
|
||||
|
||||
@@ -229,8 +229,8 @@ bool HandlerReportData::generateUnitPowerResult(const CreateModifyReportRequest
|
||||
return false;
|
||||
trans.commit();
|
||||
|
||||
t1 += request.intervalTime();
|
||||
if (request.intervalTime() == 0) break;
|
||||
t1 += request.intervalTime;
|
||||
if (request.intervalTime == 0) break;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
+7
-7
@@ -28,19 +28,19 @@ bool HandlerReportData::generateSanitationMaterialResult(const CreateModifyRepor
|
||||
// find all sanitation unique ids
|
||||
QSet<qint64> sanitationIds;
|
||||
QString stmt = QLatin1String("SELECT DISTINCT sanitation_unique_id FROM rep_sanitation_material_data "
|
||||
" WHERE (event_time BETWEEN ") + QString::number(request.startTime()) + QLatin1String(" AND ") + QString::number(request.endTime()) + QLatin1String(") ");
|
||||
" WHERE (event_time BETWEEN ") + QString::number(request.startTime) + QLatin1String(" AND ") + QString::number(request.endTime) + QLatin1String(") ");
|
||||
|
||||
stmt += QLatin1String(" AND material_id != 0 ");
|
||||
|
||||
if (request.chargeTypeIds().size() > 0)
|
||||
if (request.chargeTypeIds.size() > 0)
|
||||
{
|
||||
const QString chargeTypeIds = intVecToString(request.chargeTypeIds());
|
||||
const QString chargeTypeIds = intVecToString(request.chargeTypeIds);
|
||||
stmt += QLatin1String(" AND (material_id IN (") + chargeTypeIds + QLatin1String("))");
|
||||
}
|
||||
|
||||
if (request.participantIds().size() > 0)
|
||||
if (request.participantIds.size() > 0)
|
||||
{
|
||||
const QString participants = intVecToString(request.participantIds());
|
||||
const QString participants = intVecToString(request.participantIds);
|
||||
stmt += QStringLiteral(" AND participant_id IN (%1)").arg(participants);
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ bool HandlerReportData::generateSanitationMaterialResult(const CreateModifyRepor
|
||||
for (int qualif : qualifications)
|
||||
{
|
||||
qInsert.bindValue(QLatin1String(":qualif"), qualif);
|
||||
for (auto it = request.chargeTypeIds().begin(); it != request.chargeTypeIds().end(); ++it)
|
||||
for (auto it = request.chargeTypeIds.begin(); it != request.chargeTypeIds.end(); ++it)
|
||||
{
|
||||
int materialId = *it;
|
||||
if (materialId == 0) continue; // skip 0
|
||||
@@ -87,7 +87,7 @@ bool HandlerReportData::generateSanitationMaterialResult(const CreateModifyRepor
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!calculateSanitationMaterialStock(sanitationId, materialId, request.startTime(), request.endTime(), request.partyId(), reportId, qualif))
|
||||
if (!calculateSanitationMaterialStock(sanitationId, materialId, request.startTime, request.endTime, request.partyId, reportId, qualif))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+33
-33
@@ -98,9 +98,9 @@ Core::FunctionReplyObject ObjectReportInfo::changeStatus(const ReportChangeStatu
|
||||
if (!isValid())
|
||||
return Core::FunctionReplyObject(m_data.id, tr_lts("dds", "Trying to update an already removed Report object with id = %1")).arg(m_data.id);
|
||||
|
||||
m_data.fileStatusId = request.fileStatus();
|
||||
m_data.operatorId = request.operatorId();
|
||||
m_data.lastModified = request.lastModified();
|
||||
m_data.fileStatusId = request.fileStatus;
|
||||
m_data.operatorId = request.operatorId;
|
||||
m_data.lastModified = request.lastModified;
|
||||
|
||||
// Publish Data via DTS
|
||||
onPublishData();
|
||||
@@ -149,11 +149,11 @@ static inline std::vector<Superior> fromJsonArrayToSuperior(const QJsonArray &ar
|
||||
{
|
||||
Superior sup;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
|
||||
sup.participantId(obj[QStringLiteral("participantId")].toInt());
|
||||
sup.superiorId(obj[QStringLiteral("superiorId")].toInt());
|
||||
sup.participantId = obj[QStringLiteral("participantId")].toInt();
|
||||
sup.superiorId = obj[QStringLiteral("superiorId")].toInt();
|
||||
#else
|
||||
sup.participantId(obj.toObject().value(QStringLiteral("participantId")).toInt());
|
||||
sup.superiorId(obj.toObject().value(QStringLiteral("superiorId")).toInt());
|
||||
sup.participantId = obj.toObject().value(QStringLiteral("participantId")).toInt();
|
||||
sup.superiorId = obj.toObject().value(QStringLiteral("superiorId")).toInt();
|
||||
|
||||
#endif
|
||||
ret.push_back(sup);
|
||||
@@ -171,38 +171,38 @@ ReportInfo ObjectReportInfo::toDdsData(const Database::RepReport &dbData)
|
||||
{
|
||||
ReportInfo ddsData;
|
||||
|
||||
ddsData.id(dbData.id);
|
||||
ddsData.name(dbData.name.toStdString());
|
||||
ddsData.description(dbData.description.toStdString());
|
||||
ddsData.reportType(dbData.reportTypeId);
|
||||
ddsData.partyId(dbData.partyId);
|
||||
ddsData.startTime(dbData.startTime);
|
||||
ddsData.endTime(dbData.endTime);
|
||||
ddsData.visualisationType(dbData.visualisationType);
|
||||
ddsData.intervalTime(dbData.intervalTime);
|
||||
ddsData.lastModified(dbData.lastModified);
|
||||
ddsData.operatorId(dbData.operatorId);
|
||||
ddsData.fileStatus(dbData.fileStatusId);
|
||||
ddsData.id = dbData.id;
|
||||
ddsData.name = dbData.name.toStdString();
|
||||
ddsData.description = dbData.description.toStdString();
|
||||
ddsData.reportType = dbData.reportTypeId;
|
||||
ddsData.partyId = dbData.partyId;
|
||||
ddsData.startTime = dbData.startTime;
|
||||
ddsData.endTime = dbData.endTime;
|
||||
ddsData.visualisationType = dbData.visualisationType;
|
||||
ddsData.intervalTime = dbData.intervalTime;
|
||||
ddsData.lastModified = dbData.lastModified;
|
||||
ddsData.operatorId = dbData.operatorId;
|
||||
ddsData.fileStatus = dbData.fileStatusId;
|
||||
|
||||
// area
|
||||
ddsData.cornerBottomLeft(Core::GeoPosition2D(dbData.position.x(), dbData.position.y()));
|
||||
ddsData.width(dbData.width);
|
||||
ddsData.height(dbData.height);
|
||||
ddsData.cornerBottomLeft = Core::GeoPosition2D(dbData.position.x(), dbData.position.y());
|
||||
ddsData.width = dbData.width;
|
||||
ddsData.height = dbData.height;
|
||||
|
||||
QJsonObject obj = QJsonDocument::fromJson(dbData.parameter.toUtf8()).object();
|
||||
ddsData.groupByParty(obj[QStringLiteral("groupByParty")].toBool());
|
||||
ddsData.groupByParty = obj[QStringLiteral("groupByParty")].toBool();
|
||||
|
||||
// convert QJSonArray to std::vector
|
||||
ddsData.chargeTypeIds(fromJsonArray(obj[QStringLiteral("chargeTypeIds")].toArray()));
|
||||
ddsData.mineAreaIds(fromJsonArray(obj[QStringLiteral("mineAreaIds")].toArray()));
|
||||
ddsData.nbcIds(fromJsonArray(obj[QStringLiteral("nbcIds")].toArray()));
|
||||
ddsData.participantIds(fromJsonArray(obj[QStringLiteral("participantIds")].toArray()));
|
||||
ddsData.participantTypes(fromJsonArray(obj[QStringLiteral("participantTypes")].toArray()));
|
||||
ddsData.unitIds(fromJsonArray(obj[QStringLiteral("unitIds")].toArray()));
|
||||
ddsData.participantNames(fromJsonArrayToString(obj[QStringLiteral("participantNames")].toArray()));
|
||||
ddsData.unitNames(fromJsonArrayToString(obj[QStringLiteral("unitNames")].toArray()));
|
||||
ddsData.superiorIds(fromJsonArrayToSuperior(obj[QStringLiteral("superiorIds")].toArray()));
|
||||
ddsData.effectSources(fromJsonArray(obj[QStringLiteral("effectSources")].toArray()));
|
||||
ddsData.chargeTypeIds = fromJsonArray(obj[QStringLiteral("chargeTypeIds")].toArray());
|
||||
ddsData.mineAreaIds = fromJsonArray(obj[QStringLiteral("mineAreaIds")].toArray());
|
||||
ddsData.nbcIds = fromJsonArray(obj[QStringLiteral("nbcIds")].toArray());
|
||||
ddsData.participantIds = fromJsonArray(obj[QStringLiteral("participantIds")].toArray());
|
||||
ddsData.participantTypes = fromJsonArray(obj[QStringLiteral("participantTypes")].toArray());
|
||||
ddsData.unitIds = fromJsonArray(obj[QStringLiteral("unitIds")].toArray());
|
||||
ddsData.participantNames = fromJsonArrayToString(obj[QStringLiteral("participantNames")].toArray());
|
||||
ddsData.unitNames = fromJsonArrayToString(obj[QStringLiteral("unitNames")].toArray());
|
||||
ddsData.superiorIds = fromJsonArrayToSuperior(obj[QStringLiteral("superiorIds")].toArray());
|
||||
ddsData.effectSources = fromJsonArray(obj[QStringLiteral("effectSources")].toArray());
|
||||
|
||||
return ddsData;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user