From 445ff39c79373519d452e44bc8d96c1e0b01e66a Mon Sep 17 00:00:00 2001
From: wumu <mayi@mayi.com>
Date: 星期四, 25 九月 2025 22:33:40 +0800
Subject: [PATCH] 0925

---
 separateanalysis.cpp |   67 ++++++++++++++++++++++++++++++++-
 1 files changed, 65 insertions(+), 2 deletions(-)

diff --git a/separateanalysis.cpp b/separateanalysis.cpp
index c1f749a..0f0cd14 100644
--- a/separateanalysis.cpp
+++ b/separateanalysis.cpp
@@ -33,6 +33,40 @@
 
 }
 
+void SeparateAnalysis::calcWindowRank()
+{
+    // 婊戝姩绐楀彛鎺掑悕锛�6涓2+鐨勫墠100
+    QVector<int> ranks;
+    for(int i=0;i<m_model->rowCount();++i){
+        ranks.append(m_model->item(i,9)->text().toInt());
+        if(i >= 6){
+            // 鍏堢粺璁℃帓鍚嶈鏁�
+            int cntBig=0, cntSmall=0;
+            for(int j=0;j<ranks.size();++j){
+                if(ranks.at(j) > 100){
+                    cntBig++;
+                }else{
+                    cntSmall++;
+                }
+            }
+            // 缁熻瀵规瘮
+            if(cntSmall == 2 && ranks.back() <= 100){
+                // 灏嗗綋鍓�6涓厓绱犲畾涓虹鍚堢殑绐楀彛锛岃儗鏅壊璁剧疆涓虹传鑹�
+                for(int k=0;k<6;++k){
+                    m_model->item(i-k,9)->setData(QColor("red"),Qt::BackgroundColorRole);
+                }
+            }
+
+            // 娓呴櫎绐楀彛绗竴涓厓绱�
+            ranks.pop_front();
+
+
+        }
+
+    }
+
+}
+
 void SeparateAnalysis::initMySQL()
 {
     //娣诲姞涓�涓暟鎹簱
@@ -66,6 +100,8 @@
         m_model->setRowCount(0); // 閲嶇疆妯″瀷琛屾暟
         //int rows = 0;
         int rank_val = 0;
+        double amount_old = 0;
+
         while (que.next()) {
             QString name = que.value(0).toString();
             QString code = que.value(1).toString();
@@ -99,7 +135,19 @@
             items.append(percentItem);
 
             items.append(new QStandardItem(close));
-            items.append(new QStandardItem(amount));
+
+            double amount_val = amount.toDouble(); // 浜ゆ槗棰�
+            QStandardItem *amountItem = new QStandardItem(amount);
+            if(amount_old > 0){
+                if(amount_val / amount_old >= 3){
+                    amountItem->setData(QColor("red"),Qt::BackgroundColorRole);
+                    amountItem->setData(QString::number(amount_val / amount_old),Qt::ToolTipRole);
+                }
+            }
+            items.append(amountItem);
+            amount_old = amount_val;
+
+//            items.append(new QStandardItem(amount));
             items.append(new QStandardItem(volume));
             items.append(new QStandardItem(turnover_rate));
             items.append(new QStandardItem(pe_ttm));
@@ -108,12 +156,25 @@
             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);
                 }
+
+                if(rank_rate > 0.7 && rank_val >= 1000 && amount_rank.toInt() < 1000){
+                    if(rank_rate > 0.9){
+                        // 绱壊
+                        amount_rank_item->setData(QColor(170, 85, 255),Qt::BackgroundColorRole);
+                    }else{
+                        // 绮夎壊
+                        amount_rank_item->setData(QColor("pink"),Qt::BackgroundColorRole);
+                    }
+
+                }
+
                 items.append(amount_rank_item);
+                rank_val = amount_rank.toInt(); // 鍒锋柊鎺掑悕
 
             }
             if(rank_val == 0 && amount_rank.toInt() != 0){
@@ -131,6 +192,8 @@
     qint64 need = QDateTime::currentMSecsSinceEpoch()-tt;
     ui->label_status->setText(QString("鑰楁椂:%1 姣,鏌ヨ瀹屾垚.鏉℃暟: %2").arg(QString::number(need)).arg(QString::number(rows)));
     ui->tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
+    // 婊戝姩绐楀彛缁熻
+    calcWindowRank();
 
 }
 

--
Gitblit v1.8.0