|
@@ -15,6 +15,7 @@
|
|
|
#include <dbService/GradeIndexInfoService.h>
|
|
|
#include <dbService/EffectIndexInfoService.h>
|
|
|
#include <dbService/EffectResultService.h>
|
|
|
+#include <dbService/MindScoreService.h>
|
|
|
|
|
|
#include <QWord/QWord.h>
|
|
|
#include <QWord/QWordDemo.h>
|
|
@@ -66,7 +67,13 @@ bool ExportReportManager::exportReport()
|
|
|
|
|
|
insertProjectInfo();
|
|
|
|
|
|
- if (m_evalType == ProjectManager::DemandEval) { }
|
|
|
+ if (m_evalType == ProjectManager::DemandEval) {
|
|
|
+ insertDemandAlg();
|
|
|
+ insertDemandIndex();
|
|
|
+ insertDemandTechIndex();
|
|
|
+ insertDemandWeight();
|
|
|
+ insertDemandEval();
|
|
|
+ }
|
|
|
|
|
|
if (m_evalType == ProjectManager::OptimalEval) {
|
|
|
insertSchemeDesignInfo();
|
|
@@ -138,6 +145,357 @@ void ExportReportManager::insertProjectInfo()
|
|
|
insertText("bmEvalPurpose", m_proj->estimateObjective);
|
|
|
}
|
|
|
|
|
|
+void ExportReportManager::insertDemandAlg()
|
|
|
+{
|
|
|
+ // bmWeightAlg bmEvalAlg
|
|
|
+ QList<SchemePlanManager::SchemeProcessInfo> processList;
|
|
|
+ bool processRet = SchemeProcessService().QueryAllByProjectIdAndIndexType(processList, m_proj->id, 1);
|
|
|
+ if (processRet == false) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < processList.size(); ++i) {
|
|
|
+ if (processList[i].type == SchemePlanManager::CalculateWeight) {
|
|
|
+ SchemePlanManager::Algorithm alg = processList[i].algorithm;
|
|
|
+ QString algStr = SchemePlanManager::stringFromAlgorithm(alg);
|
|
|
+ insertText("bmWeightAlg", algStr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ processRet = SchemeProcessService().QueryAllByProjectIdAndIndexType(processList, m_proj->id, 2);
|
|
|
+ if (processRet == false) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < processList.size(); ++i) {
|
|
|
+ if (processList[i].type == SchemePlanManager::RunEvaluate) {
|
|
|
+ SchemePlanManager::Algorithm alg = processList[i].algorithm;
|
|
|
+ QString algStr = SchemePlanManager::stringFromAlgorithm(alg);
|
|
|
+ insertText("bmEvalAlg", algStr);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void ExportReportManager::insertDemandIndex()
|
|
|
+{
|
|
|
+ insertText("bmProjName21", m_proj->projectName);
|
|
|
+ insertText("bmProjName22", m_proj->projectName);
|
|
|
+
|
|
|
+ QList<CNodeData> nodeList;
|
|
|
+ bool ret = CNodeDataService().QueryAllValid(nodeList, m_proj->id, 1);
|
|
|
+ if (ret == false) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CMind *mind = new CMind();
|
|
|
+ mind->setNodeList(nodeList);
|
|
|
+
|
|
|
+ QList<CNodeData> leaveNodes = mind->leaves();
|
|
|
+ int rowCount = leaveNodes.size() + 1;
|
|
|
+ int columnCount = mind->levels();
|
|
|
+
|
|
|
+ // bmIndexTable
|
|
|
+ QAxObject *table = insertTable("bmIndexTable", rowCount, columnCount);
|
|
|
+ if (table == nullptr) {
|
|
|
+ delete mind;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 2; i <= mind->levels(); ++i) {
|
|
|
+ if (i < mind->levels()) {
|
|
|
+ setCellString(table, 1, i - 1, QString("%1级指标").arg(i - 1));
|
|
|
+ } else {
|
|
|
+ setCellString(table, 1, i - 1, QString("指标"));
|
|
|
+ setCellString(table, 1, i, QString("量纲"));
|
|
|
+ }
|
|
|
+
|
|
|
+ QList<CNodeData> nodes = mind->nodesInLevel(i);
|
|
|
+ int rowPos = 2;
|
|
|
+ for (int j = 0; j < nodes.size(); ++j) {
|
|
|
+ CNodeData node = nodes[j];
|
|
|
+ int leaves = mind->leavesCountOfNode(node);
|
|
|
+ int textPos = (rowPos + leaves / 2);
|
|
|
+ setCellString(table, textPos, i - 1, node.name);
|
|
|
+
|
|
|
+ if (leaves > 1) {
|
|
|
+ mergeCells(table, rowPos, i - 1, leaves, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ rowPos += leaves;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < leaveNodes.size(); ++i) {
|
|
|
+ CNodeData node = leaveNodes[i];
|
|
|
+ setCellString(table, i + 2, columnCount, node.dimension);
|
|
|
+ }
|
|
|
+
|
|
|
+ delete mind;
|
|
|
+}
|
|
|
+
|
|
|
+void ExportReportManager::insertDemandTechIndex()
|
|
|
+{
|
|
|
+ insertText("bmProjName31", m_proj->projectName);
|
|
|
+ insertText("bmProjName32", m_proj->projectName);
|
|
|
+
|
|
|
+ QList<CNodeData> nodeList;
|
|
|
+ bool ret = CNodeDataService().QueryAllValid(nodeList, m_proj->id, 2);
|
|
|
+ if (ret == false) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CMind *mind = new CMind();
|
|
|
+ mind->setNodeList(nodeList);
|
|
|
+
|
|
|
+ QList<CNodeData> leaveNodes = mind->leaves();
|
|
|
+ int rowCount = leaveNodes.size() + 1;
|
|
|
+ int columnCount = mind->levels() - 1;
|
|
|
+
|
|
|
+ // bmIndexTable
|
|
|
+ QAxObject *table = insertTable("bmTechTable", rowCount, columnCount);
|
|
|
+ if (table == nullptr) {
|
|
|
+ delete mind;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 2; i <= mind->levels(); ++i) {
|
|
|
+ if (i < mind->levels()) {
|
|
|
+ setCellString(table, 1, i - 1, QString("%1级指标").arg(i - 1));
|
|
|
+ } else {
|
|
|
+ setCellString(table, 1, i - 1, QString("指标"));
|
|
|
+ }
|
|
|
+
|
|
|
+ QList<CNodeData> nodes = mind->nodesInLevel(i);
|
|
|
+ int rowPos = 2;
|
|
|
+ for (int j = 0; j < nodes.size(); ++j) {
|
|
|
+ CNodeData node = nodes[j];
|
|
|
+ int leaves = mind->leavesCountOfNode(node);
|
|
|
+ int textPos = (rowPos + leaves / 2);
|
|
|
+ setCellString(table, textPos, i - 1, node.name);
|
|
|
+
|
|
|
+ if (leaves > 1) {
|
|
|
+ mergeCells(table, rowPos, i - 1, leaves, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ rowPos += leaves;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ delete mind;
|
|
|
+}
|
|
|
+
|
|
|
+void ExportReportManager::insertDemandWeight()
|
|
|
+{
|
|
|
+ // 指标权重表:bmWeightTable,指标权重图:bmWeightPic
|
|
|
+
|
|
|
+ QList<CNodeData> nodeList;
|
|
|
+ bool ret = CNodeDataService().QueryAllValid(nodeList, m_proj->id, 1);
|
|
|
+ if (ret == false) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CMind *mind = new CMind();
|
|
|
+ mind->setNodeList(nodeList);
|
|
|
+
|
|
|
+ QList<CNodeData> leaveNodes = mind->leaves();
|
|
|
+ int rowCount = leaveNodes.size() + 1;
|
|
|
+ int columnCount = mind->levels();
|
|
|
+
|
|
|
+ // bmIndexTable
|
|
|
+ QAxObject *table = insertTable("bmWeightTable", rowCount, columnCount);
|
|
|
+ if (table == nullptr) {
|
|
|
+ delete mind;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 2; i <= mind->levels(); ++i) {
|
|
|
+ if (i < mind->levels()) {
|
|
|
+ setCellString(table, 1, i - 1, QString("%1级指标").arg(i - 1));
|
|
|
+ } else {
|
|
|
+ setCellString(table, 1, i - 1, QString("指标"));
|
|
|
+ setCellString(table, 1, i, QString("权重值"));
|
|
|
+ }
|
|
|
+
|
|
|
+ QList<CNodeData> nodes = mind->nodesInLevel(i);
|
|
|
+ int rowPos = 2;
|
|
|
+ for (int j = 0; j < nodes.size(); ++j) {
|
|
|
+ CNodeData node = nodes[j];
|
|
|
+ int leaves = mind->leavesCountOfNode(node);
|
|
|
+ int textPos = (rowPos + leaves / 2);
|
|
|
+ setCellString(table, textPos, i - 1, node.name);
|
|
|
+
|
|
|
+ if (leaves > 1) {
|
|
|
+ mergeCells(table, rowPos, i - 1, leaves, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ rowPos += leaves;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ delete mind;
|
|
|
+
|
|
|
+ MindWeightInfo info;
|
|
|
+ ret = MindWeightService().queryWeightData(&info, m_proj->id, 1);
|
|
|
+ if (ret == false) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (info.id < 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ QMap<QString, double> weightData;
|
|
|
+ QStringList weightList = info.weight.split(";");
|
|
|
+ for (QString keyValueStr : weightList) {
|
|
|
+ QStringList keyValue = keyValueStr.split(":");
|
|
|
+ if (keyValue.size() == 2) {
|
|
|
+ weightData[keyValue.first()] = keyValue.last().toDouble();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ QVector<PlotView::Data> values;
|
|
|
+ for (int i = 0; i < leaveNodes.size(); ++i) {
|
|
|
+ CNodeData node = leaveNodes[i];
|
|
|
+ QString value = QString("%1").arg(weightData[node.name]);
|
|
|
+ setCellString(table, i + 2, columnCount, value);
|
|
|
+
|
|
|
+ PlotView::Data data { node.name, weightData[node.name] };
|
|
|
+ values.append(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ PlotView *plot = new PlotView(PlotView::HistogramHorizontal, values, "");
|
|
|
+ plot->setFixedSize(QSize(600, 600));
|
|
|
+ plot->plot();
|
|
|
+ QPixmap pixmap = plot->grab();
|
|
|
+ plot->deleteLater();
|
|
|
+ if (pixmap.isNull()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ QString imgName = QString("%1_%2_weight").arg(m_proj->id).arg(1);
|
|
|
+ QString path = saveImage(imgName, pixmap);
|
|
|
+
|
|
|
+ QAxObject *bmWeightPic = m_word->getDocument()->querySubObject("Bookmarks(QVariant)", "bmWeightPic");
|
|
|
+ if (bmWeightPic != nullptr) {
|
|
|
+ bmWeightPic->dynamicCall("Select(void)");
|
|
|
+ QAxObject *range = bmWeightPic->querySubObject("Range");
|
|
|
+ QAxObject *inlineShapes = range->querySubObject("InlineShapes");
|
|
|
+ QAxObject *shape = inlineShapes->querySubObject("AddPicture(const QString&)", path);
|
|
|
+ if (shape != nullptr) {
|
|
|
+ shape->setProperty("Width", 400);
|
|
|
+ shape->setProperty("Height", 400);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void ExportReportManager::insertDemandEval()
|
|
|
+{
|
|
|
+ MindScoreInfo info;
|
|
|
+ bool ret = MindScoreService().queryScoreData(&info, m_proj->id);
|
|
|
+ if (ret == false || info.id < 0) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ QMap<QString, QString> scoreData;
|
|
|
+ QStringList keyValueStringList = info.score.split(";");
|
|
|
+ for (QString keyValueString : keyValueStringList) {
|
|
|
+ QStringList keyValue = keyValueString.split(":");
|
|
|
+ if (keyValue.size() == 2) {
|
|
|
+ scoreData[keyValue.first()] = keyValue.last();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ QList<CNodeData> nodeList;
|
|
|
+ ret = CNodeDataService().QueryAllValid(nodeList, m_proj->id, 2);
|
|
|
+ if (ret == false) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ CMind *mind = new CMind();
|
|
|
+ mind->setNodeList(nodeList);
|
|
|
+
|
|
|
+ QList<CNodeData> leaveNodes = mind->leaves();
|
|
|
+ int rowCount = leaveNodes.size() + 1;
|
|
|
+ int columnCount = mind->levels();
|
|
|
+
|
|
|
+ // bmEvalTable
|
|
|
+ QAxObject *table = insertTable("bmEvalTable", rowCount, columnCount);
|
|
|
+ if (table == nullptr) {
|
|
|
+ delete mind;
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 2; i <= mind->levels(); ++i) {
|
|
|
+ if (i < mind->levels()) {
|
|
|
+ setCellString(table, 1, i - 1, QString("%1级指标").arg(i - 1));
|
|
|
+ } else {
|
|
|
+ setCellString(table, 1, i - 1, QString("指标"));
|
|
|
+ setCellString(table, 1, i, QString("重要度"));
|
|
|
+ }
|
|
|
+
|
|
|
+ QList<CNodeData> nodes = mind->nodesInLevel(i);
|
|
|
+ int rowPos = 2;
|
|
|
+ for (int j = 0; j < nodes.size(); ++j) {
|
|
|
+ CNodeData node = nodes[j];
|
|
|
+ int leaves = mind->leavesCountOfNode(node);
|
|
|
+ int textPos = (rowPos + leaves / 2);
|
|
|
+ setCellString(table, textPos, i - 1, node.name);
|
|
|
+
|
|
|
+ if (leaves > 1) {
|
|
|
+ mergeCells(table, rowPos, i - 1, leaves, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ rowPos += leaves;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ delete mind;
|
|
|
+
|
|
|
+ QVector<PlotView::Data> values;
|
|
|
+ for (int i = 0; i < leaveNodes.size(); ++i) {
|
|
|
+ CNodeData node = leaveNodes[i];
|
|
|
+ QString value = scoreData[node.name];
|
|
|
+ setCellString(table, i + 2, columnCount, value);
|
|
|
+
|
|
|
+ PlotView::Data data { node.name, value.toDouble() };
|
|
|
+ values.append(data);
|
|
|
+ }
|
|
|
+
|
|
|
+ PlotView *plot = new PlotView(PlotView::HistogramHorizontal, values, "");
|
|
|
+ plot->setFixedSize(QSize(600, 600));
|
|
|
+ plot->plot();
|
|
|
+ QPixmap pixmap = plot->grab();
|
|
|
+ plot->deleteLater();
|
|
|
+ if (pixmap.isNull()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ QString imgName = QString("%1_%2_tech").arg(m_proj->id).arg(1);
|
|
|
+ QString path = saveImage(imgName, pixmap);
|
|
|
+
|
|
|
+ QAxObject *bmWeightPic = m_word->getDocument()->querySubObject("Bookmarks(QVariant)", "bmEvalPic");
|
|
|
+ if (bmWeightPic != nullptr) {
|
|
|
+ bmWeightPic->dynamicCall("Select(void)");
|
|
|
+ QAxObject *range = bmWeightPic->querySubObject("Range");
|
|
|
+ QAxObject *inlineShapes = range->querySubObject("InlineShapes");
|
|
|
+ QAxObject *shape = inlineShapes->querySubObject("AddPicture(const QString&)", path);
|
|
|
+ if (shape != nullptr) {
|
|
|
+ shape->setProperty("Width", 400);
|
|
|
+ shape->setProperty("Height", 400);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ QString viTech;
|
|
|
+ double score = 0;
|
|
|
+ for (QString key : scoreData.keys()) {
|
|
|
+ if (scoreData[key].toDouble() > score) {
|
|
|
+ score = scoreData[key].toDouble();
|
|
|
+ viTech = key;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ insertText("bmVITech1", viTech);
|
|
|
+ insertText("bmVITech2", viTech);
|
|
|
+}
|
|
|
+
|
|
|
void ExportReportManager::insertSchemeDesignInfo()
|
|
|
{
|
|
|
QList<SchemaEval *> schemeList;
|