DATE 카운트 추가
git-svn-id: svn://192.168.0.12/source@49 8346c931-da38-4b9b-9d4c-e48b93cbd075
This commit is contained in:
@@ -256,6 +256,7 @@ void Widget::on_insert()
|
||||
foreach (QListWidgetItem *item,m_plw[E_LIST_CATALOG].selectedItems())
|
||||
{
|
||||
InsertLog("Data Make Run Start : " + item->text());
|
||||
MakeBuzzy(item->data(Qt::UserRole).toInt());
|
||||
DataMake(item->data(Qt::UserRole).toInt());
|
||||
InsertLog("Data Make Run End ");
|
||||
}
|
||||
@@ -549,7 +550,6 @@ void Widget::DataFilter(QString _strFilterGroupID)
|
||||
db.close();
|
||||
}
|
||||
|
||||
|
||||
void Widget::on_refresh()
|
||||
{
|
||||
Refresh();
|
||||
@@ -710,6 +710,7 @@ void Widget::DataItemClicked(QListWidgetItem* item)
|
||||
SBody stBody;
|
||||
stBody.m_nNum = nCount++;
|
||||
stBody.m_dtLast = QDateTime::fromString(strList[m_anData[E_DATA_article_date]].trimmed(),"yyyy-MM-dd HH:mm:ss");
|
||||
stBody.m_date = QDateTime::fromString(strList[m_anData[E_DATA_article_date]].trimmed(),"yyyy-MM-dd HH:mm:ss").date();
|
||||
stBody.m_bSelect = false;
|
||||
stBody.m_bReplySelect = false;
|
||||
stBody.m_strlist = strList;
|
||||
@@ -726,6 +727,7 @@ void Widget::DataItemClicked(QListWidgetItem* item)
|
||||
stReply.m_bSelect = false;
|
||||
stReply.m_nOrder = strList[m_nOrderColumn].toInt();
|
||||
stReply.m_strlist = strList;
|
||||
stReply.m_date = QDateTime::fromString(strList[m_anData[E_DATA_article_date]].trimmed(),"yyyy-MM-dd HH:mm:ss").date();
|
||||
QDateTime dtComp = QDateTime::fromString(strList[m_anData[E_DATA_article_date]].trimmed(),"yyyy-MM-dd HH:mm:ss");
|
||||
if (m_mapData[strURL].m_dtLast < dtComp)
|
||||
m_mapData[strURL].m_dtLast = dtComp;
|
||||
@@ -735,11 +737,77 @@ void Widget::DataItemClicked(QListWidgetItem* item)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
InsertLog("End Loading");
|
||||
}
|
||||
MakeBuzzyAll();
|
||||
InsertLog("End Loading");
|
||||
db.close();
|
||||
}
|
||||
|
||||
void Widget::MakeBuzzyAll()
|
||||
{
|
||||
m_vecBuzzy.clear();
|
||||
SBuzzy stBuzzy;
|
||||
stBuzzy.m_nCategory = 0;
|
||||
foreach(SBody stBody, m_mapData.values())
|
||||
{
|
||||
if (stBuzzy.m_astArticle[E_ARTICLE_BODY].m_mapCount.contains(stBody.m_date))
|
||||
stBuzzy.m_astArticle[E_ARTICLE_BODY].m_mapCount[stBody.m_date]++;
|
||||
else
|
||||
stBuzzy.m_astArticle[E_ARTICLE_BODY].m_mapCount.insert(stBody.m_date,1);
|
||||
foreach(SReply stReply , stBody.m_vecReply.values())
|
||||
{
|
||||
if (stBuzzy.m_astArticle[E_ARTICLE_REPLY].m_mapCount.contains(stReply.m_date))
|
||||
stBuzzy.m_astArticle[E_ARTICLE_REPLY].m_mapCount[stReply.m_date]++;
|
||||
else
|
||||
stBuzzy.m_astArticle[E_ARTICLE_REPLY].m_mapCount.insert(stReply.m_date,1);
|
||||
}
|
||||
}
|
||||
m_vecBuzzy.push_back(stBuzzy);
|
||||
}
|
||||
|
||||
void Widget::MakeBuzzy(int _nCategory)
|
||||
{
|
||||
SBuzzy stBuzzy;
|
||||
stBuzzy.m_nCategory = _nCategory;
|
||||
QMap <QString,bool> map;
|
||||
if (m_bDataFlag[E_ARTICLE_BODY] == true)
|
||||
{
|
||||
foreach(QStringList strList,m_data[E_ARTICLE_BODY])
|
||||
{
|
||||
QString strURL = strList[m_nUrlColumn].trimmed();
|
||||
if(map.contains(strURL) == false)
|
||||
{
|
||||
QDate date = QDateTime::fromString(strList[m_anData[E_DATA_article_date]].trimmed(),"yyyy-MM-dd HH:mm:ss").date();
|
||||
if (stBuzzy.m_astArticle[E_ARTICLE_BODY].m_mapCount.contains(date))
|
||||
stBuzzy.m_astArticle[E_ARTICLE_BODY].m_mapCount[date]++;
|
||||
else
|
||||
stBuzzy.m_astArticle[E_ARTICLE_BODY].m_mapCount.insert(date,1);
|
||||
map.insert(strURL,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
map.clear();
|
||||
if (m_bDataFlag[E_ARTICLE_REPLY] == true)
|
||||
{
|
||||
foreach(QStringList strList,m_data[E_ARTICLE_REPLY])
|
||||
{
|
||||
QString strURL = strList[m_nUrlColumn].trimmed();
|
||||
strURL += "\\";
|
||||
strURL += strList[m_nOrderColumn].trimmed();
|
||||
if(map.contains(strURL) == false)
|
||||
{
|
||||
QDate date = QDateTime::fromString(strList[m_anData[E_DATA_article_date]].trimmed(),"yyyy-MM-dd HH:mm:ss").date();
|
||||
if (stBuzzy.m_astArticle[E_ARTICLE_REPLY].m_mapCount.contains(date))
|
||||
stBuzzy.m_astArticle[E_ARTICLE_REPLY].m_mapCount[date]++;
|
||||
else
|
||||
stBuzzy.m_astArticle[E_ARTICLE_REPLY].m_mapCount.insert(date,1);
|
||||
map.insert(strURL,true);
|
||||
}
|
||||
}
|
||||
}
|
||||
m_vecBuzzy.push_back(stBuzzy);
|
||||
}
|
||||
|
||||
void Widget::DataMake(int _nCategory)
|
||||
{
|
||||
QMap <QString,int> mapData;
|
||||
@@ -987,17 +1055,17 @@ void Widget::on_count()
|
||||
QList<SInfluenceCount> list = mapCount.values();
|
||||
qSort(list.begin(),list.end(),QSortInfulrence);
|
||||
|
||||
strQuery = "insert into influencer (cost,company_num,id,nickname,title,profileurl,bodycount,replycount,influencevalue) VALUES (0," +
|
||||
strCompanyNum + ",:ID,:NICKNAME,:TITLE,:PROFILE_URL,:BODY_COUNT,:REPLY_COUNT,:INPL)";
|
||||
strQuery = "insert into influencer (cost,company_num,id,nickname,title,profileurl,bodycount,replycount,influencevalue)"
|
||||
" VALUES (0," + strCompanyNum + ",:ID,:NICKNAME,:TITLE,:PROFILE_URL,:BODY_COUNT,:REPLY_COUNT,:INPL)";
|
||||
|
||||
query.prepare(strQuery.toUtf8());
|
||||
foreach(SInfluenceCount stIn,list)
|
||||
{
|
||||
if (stIn.m_strID.length() > 42) continue;
|
||||
query.bindValue(":ID",stIn.m_strID.toUtf8());
|
||||
query.bindValue(":NICKNAME",stIn.m_strNick.toUtf8());
|
||||
query.bindValue(":TITLE",stIn.m_strTitle.toUtf8());
|
||||
query.bindValue(":PROFILE_URL",stIn.m_strProfileUrl.toUtf8());
|
||||
query.bindValue(":ID",stIn.m_strID.trimmed().toUtf8());
|
||||
query.bindValue(":NICKNAME",stIn.m_strNick.trimmed().toUtf8());
|
||||
query.bindValue(":TITLE",stIn.m_strTitle.trimmed().toUtf8());
|
||||
query.bindValue(":PROFILE_URL",stIn.m_strProfileUrl.trimmed().toUtf8());
|
||||
query.bindValue(":BODY_COUNT",stIn.m_ncBody);
|
||||
query.bindValue(":REPLY_COUNT",stIn.m_ncReply);
|
||||
query.bindValue(":INPL",QString::number(stIn.m_dinfulrence,'g',3));
|
||||
@@ -1038,8 +1106,8 @@ QString Widget::MakeInfluencerrankQuery(SInfluenceCount &_stIn,QString _strOrder
|
||||
{
|
||||
QString strOut;
|
||||
strOut = "insert into stats_influencerrank(id,nickname,bodycount,replycount,influencevalue,orderby,company_num) VALUES (";
|
||||
strOut += "'" + _stIn.m_strID + "',";
|
||||
strOut += "'" + _stIn.m_strNick + "',";
|
||||
strOut += "'" + _stIn.m_strID.trimmed() + "',";
|
||||
strOut += "'" + _stIn.m_strNick.trimmed() + "',";
|
||||
strOut += QString::number(_stIn.m_ncBody) + ",";
|
||||
strOut += QString::number(_stIn.m_ncReply) + ",";
|
||||
strOut += QString::number(_stIn.m_dinfulrence,'g',3)+ ",";
|
||||
@@ -1048,8 +1116,6 @@ QString Widget::MakeInfluencerrankQuery(SInfluenceCount &_stIn,QString _strOrder
|
||||
return strOut;
|
||||
}
|
||||
|
||||
|
||||
|
||||
QString Widget::SeqDelString(QString _strData,QChar _chChar,int _nMax)
|
||||
{
|
||||
static const int C_SEQ_FIND = 0;
|
||||
|
||||
@@ -14,7 +14,8 @@
|
||||
//#include "SPutThread.h"
|
||||
struct SReply
|
||||
{
|
||||
QStringList m_strlist;
|
||||
QStringList m_strlist;
|
||||
QDate m_date;
|
||||
bool m_bSelect;
|
||||
int m_nOrder;
|
||||
QVector <int> m_vecCategory;
|
||||
@@ -27,6 +28,7 @@ struct SBody
|
||||
bool m_bSelect;
|
||||
bool m_bReplySelect;
|
||||
QDateTime m_dtLast;
|
||||
QDate m_date;
|
||||
QMap <int,SReply> m_vecReply;
|
||||
QVector <int> m_vecCategory;
|
||||
};
|
||||
@@ -51,6 +53,11 @@ struct SInfluenceCount
|
||||
QString m_strTitle;
|
||||
};
|
||||
|
||||
struct SBuzzyArticle
|
||||
{
|
||||
QMap <QDate,int> m_mapCount;
|
||||
};
|
||||
|
||||
class Widget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -102,6 +109,13 @@ public:
|
||||
E_DATA_MAX,
|
||||
};
|
||||
|
||||
struct SBuzzy
|
||||
{
|
||||
SBuzzyArticle m_astArticle[E_ARTICLE_MAX];
|
||||
int m_nArticle;
|
||||
int m_nCategory;
|
||||
};
|
||||
|
||||
const int C_MAP_REAL_BODY;
|
||||
const int C_MAP_REAL_REPLY;
|
||||
|
||||
@@ -126,6 +140,7 @@ private:
|
||||
QStringList m_strlistOrder;
|
||||
QSqlDatabase db;
|
||||
QVector <SInfluenceCount> m_vecInfluence;
|
||||
QVector <SBuzzy> m_vecBuzzy;
|
||||
//SGetThread *m_pThread;
|
||||
//SPutThread *m_pPutThread;
|
||||
//QVector <QStringList> m_mainData;
|
||||
@@ -146,6 +161,8 @@ private:
|
||||
void ReloadData();
|
||||
QString SeqDelString(QString _strData,QChar _chChar,int _nMax);
|
||||
QString MakeInfluencerrankQuery(SInfluenceCount &_stIn,QString _strOrder,QString _strCompanyNum);
|
||||
void MakeBuzzyAll();
|
||||
void MakeBuzzy(int _nCategory);
|
||||
|
||||
private slots:
|
||||
void CompanyItemChanged(QListWidgetItem*,QListWidgetItem* _prev = 0);
|
||||
|
||||
Reference in New Issue
Block a user