From 0ec4f3ed2e2584bebb1fb0cc92a039f59fcfa529 Mon Sep 17 00:00:00 2001
From: wumu <mayi@mayi.com>
Date: 星期一, 01 九月 2025 23:52:26 +0800
Subject: [PATCH] 250901

---
 analysisbyrediscache.cpp |   57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 54 insertions(+), 3 deletions(-)

diff --git a/analysisbyrediscache.cpp b/analysisbyrediscache.cpp
index a917c7d..b74eed5 100644
--- a/analysisbyrediscache.cpp
+++ b/analysisbyrediscache.cpp
@@ -31,7 +31,7 @@
     ui->tableView_2->setModel(m_modelResult);
 
     QStringList labels;
-    labels<<"鑲$エ鍚嶅瓧"<<"甯傚��"<<"鏀剁洏浠�"<<"娑ㄨ穼骞�"<<"鎺掑悕"<<"浜ゆ槗鏃堕棿"<<"鎺掑悕鍙樺寲";
+    labels<<"鑲$エ鍚嶅瓧"<<"甯傚��"<<"鏀剁洏浠�"<<"娑ㄨ穼骞�"<<"鎺掑悕"<<"浜ゆ槗鏃堕棿"<<"鎺掑悕鍙樺寲"<<"搴曢儴鍙嶈浆鏃堕棿"<<"涓�闃崇┛鍥涚嚎鏃堕棿";
     m_model->setHorizontalHeaderLabels(labels);
     m_modelResult->setHorizontalHeaderLabels(labels);
 }
@@ -43,6 +43,7 @@
 
 void AnalysisByRedisCache::on_pushButton_loadDataSQLRedis_clicked()
 {
+    ui->label_load->setText("缂撳瓨鍔犺浇涓�...");
     QString begin_date = ui->dateEdit->text();
     QString limit_str = ui->comboBox->currentText();
     QString sql = QString("select * from stock_day_info where time_trade > '%1' limit %2;").arg(begin_date).arg(limit_str);
@@ -58,8 +59,11 @@
     // 绗簩娆℃煡璇㈠簲璇ヤ粠缂撳瓨鑾峰彇
     timer.restart();
     result = m_dbCache.query(sql);
-    qDebug() << "Cached query executed in" << timer.elapsed() << "ms";
+    qint64 resTime = timer.elapsed();
+    qDebug() << "Cached query executed in" << resTime << "ms";
     m_result = result;
+    ui->label_load->setText(QString("缂撳瓨鍔犺浇%2鏉�,鑰楁椂%1ms").arg(QString::number(resTime)).arg(QString::number(result.size())));
+
 }
 
 // 婊戝姩绐楀彛璁$畻鎺掑悕鍙樺寲
@@ -104,6 +108,9 @@
     int rank_val = 0;
     int cnt = 0;
     int bigFlag = false;
+    int bigRankUp = false; // 绐佺劧浠庡緢浣庣殑鎺掑悕涓婂崌鍒板ぇ鎺掑悕
+    bool big_3000 = false;
+    bool big_2000 = false;
     for(auto it:m_result){
         if(it["name"].toString() == name){
 //            qDebug()<<it["name"].toString()<<it["close"].toString()<<it["amount_rank"].toString()<<it["time_trade"].toString();
@@ -133,13 +140,40 @@
             if(rank_val != 0){
                 double rank_rate = 1 - (amount_rank.toDouble()/rank_val);
                 //items.append(new QStandardItem(QString::number(rank_rate)));
-                rank_val = amount_rank.toInt();
+
                 QStandardItem * amount_rank_item = new QStandardItem(QString::number(rank_rate));
                 if(rank_rate > 0.9){
                     amount_rank_item->setData(QColor("red"),Qt::BackgroundColorRole);
                     bigFlag = true;
                 }
+                if(rank_rate > 0.7 && rank_val >= 1000 && amount_rank.toInt() < 1000){
+                    bigRankUp = true;
+                    bigFlag = true;
+                    if(rank_rate > 0.9){
+                        // 绱壊
+                        amount_rank_item->setData(QColor(170, 85, 255),Qt::BackgroundColorRole);
+                    }else{
+                        // 绮夎壊
+                        amount_rank_item->setData(QColor("pink"),Qt::BackgroundColorRole);
+                    }
+
+
+
+                    if(rank_val >= 3000){
+                        amount_rank_item->setData(QColor(85,170,255),Qt::BackgroundColorRole);
+                        big_3000 = true;
+                    }
+                    else if(rank_val >= 2000){
+                        amount_rank_item->setData(QColor(85,255,255),Qt::BackgroundColorRole);
+                        big_2000 = true;
+                    }
+
+
+
+
+                }
                 items.append(amount_rank_item);
+                rank_val = amount_rank.toInt(); // 鍒板悗闈㈠啀璧嬪��
 
             }
             if(rank_val == 0 && amount_rank.toInt() != 0){
@@ -153,10 +187,27 @@
                     items_2.append(new QStandardItem(items.at(i)->text()));
                     if(i==6 && items.at(i)->text().toDouble() > 0.95){
                         items_2.back()->setData(QColor("red"),Qt::BackgroundColorRole);
+                    }else if(i==6 && bigRankUp){
+                        if(items.at(i)->text().toDouble() > 0.9){
+                            items_2.back()->setData(QColor(170, 85, 255),Qt::BackgroundColorRole);
+                        }else{
+                            items_2.back()->setData(QColor("pink"),Qt::BackgroundColorRole);
+                        }
+
+                        if(big_3000){
+                            items_2.back()->setData(QColor(85,170,255),Qt::BackgroundColorRole);
+                        }
+                        if(big_2000){
+                            items_2.back()->setData(QColor(85,255,255),Qt::BackgroundColorRole);
+                        }
+
                     }
                 }
                 m_modelResult->appendRow(items_2);
                 bigFlag = false;
+                bigRankUp = false;
+                big_3000 = false;
+                big_2000 = false;
             }
         }
 

--
Gitblit v1.8.0