Commit 3631f299 authored by wwka's avatar wwka

解析用户相关信息功能模块优化、根据业务查询更新教材模块组(根据业务查询,渲染书籍,更新书籍)功能模块优化、根据业务监听查询更新教材模块组(根据业务查询,渲染...

解析用户相关信息功能模块优化、根据业务查询更新教材模块组(根据业务查询,渲染书籍,更新书籍)功能模块优化、根据业务监听查询更新教材模块组(根据业务查询,渲染书籍,更新书籍)功能模块优化、驻后台线程封面下载模块优化
parent 897152af
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "NoteDao.h" #include "NoteDao.h"
#include "XZip\XUnzip.h" #include "XZip\XUnzip.h"
#include "tinyxml.h" #include "tinyxml.h"
// //
// CString?CStringW // CString?CStringW
// //
...@@ -288,6 +287,11 @@ void CBookDal::TargetSaveParentTarget( TARGET_BOOK info ) ...@@ -288,6 +287,11 @@ void CBookDal::TargetSaveParentTarget( TARGET_BOOK info )
} }
} }
void CBookDal::TargetSaveParentTargetAll(CString sSQL)
{
pHelper->ExecuteNonQuery(sSQL);
}
void CBookDal::TargetInsertInfo( CString name,LONGLONG id,LONGLONG parent_id,CString type,CString bookid ) void CBookDal::TargetInsertInfo( CString name,LONGLONG id,LONGLONG parent_id,CString type,CString bookid )
{ {
CString sql; CString sql;
...@@ -1565,6 +1569,94 @@ std::vector<Book_Manager> CBookDal::GetUserBookLocal(CString userId,int nType) ...@@ -1565,6 +1569,94 @@ std::vector<Book_Manager> CBookDal::GetUserBookLocal(CString userId,int nType)
return LocalbookInfos; return LocalbookInfos;
} }
// Add By Vincent 2024-01-22
std::vector<Book_ManagerInfo> CBookDal::GetUserBookLocalManagerInfo(CString userId,int nType)
{
CFunction fun;
CDataTable dt;
std::vector<Book_ManagerInfo> LocalbookInfos;
CString sql;
if(nType==0)
{
//sql.Format(_T("select book_id,IsMoved,lastpage,order_index,update_time,isHistory,active_name,owner from BookManager where user_id=%s order by order_index"),userId);
sql.Format(_T("select A.book_id,A.IsMoved,A.lastpage,A.order_index,A.update_time,A.isHistory,A.active_name,A.owner \
,B.id,B.bookId,B.bookName,B.catalogId,B.bookCoverPath,B.bookTextPath,B.bookType,B.bookState,B.recentNo,B.exist,B.coursecode,B.downloadurl,B.downloadsize,B.filesize,B.orderNo,B.courseCode,B.coverDigest,B.fileDigest,B.applicableTerm ,B.startPage ,B.updatetime,B.year,B.diandu_URL,B.exercise_URL,B.grade,B.securityKey,B.shortName,B.checkstatus,B.activtype,B.owner,B.author,B.fromuser \
from BookManager A LEFT JOIN BookInfo B ON A.book_id=B.bookId where A.user_id=%s order by A.order_index"),userId);
}else
{
//sql.Format(_T("select book_id,IsMoved,lastpage,order_index,update_time,isHistory,active_name,owner from BookManager where user_id=%s and isMoved=1 order by order_index"),userId);
sql.Format(_T("select A.book_id,A.IsMoved,A.lastpage,A.order_index,A.update_time,A.isHistory,A.active_name,A.owner \
,B.id,B.bookId,B.bookName,B.catalogId,B.bookCoverPath,B.bookTextPath,B.bookType,B.bookState,B.recentNo,B.exist,B.coursecode,B.downloadurl,B.downloadsize,B.filesize,B.orderNo,B.courseCode,B.coverDigest,B.fileDigest,B.applicableTerm ,B.startPage ,B.updatetime,B.year,B.diandu_URL,B.exercise_URL,B.grade,B.securityKey,B.shortName,B.checkstatus,B.activtype,B.owner,B.author,B.fromuser \
from BookManager A LEFT JOIN BookInfo B ON A.book_id=B.bookId where user_id=%s and isMoved=1 order by A.order_index"),userId);
}
pHelper->ExecuteQueryTable(sql, dt);
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
Book_ManagerInfo bookmanager;
bookmanager.strBookID =dt.Rows[i][0];
/*bookmanager.nIsHistory =_ttoi(dt.Rows[i][1]);//Comment By Ray 2018-06-14历史书籍判断 */
bookmanager.nIsMoved =_ttoi(dt.Rows[i][1]);//Comment By Ray 2018-06-14书籍移动判断
bookmanager.nLastPage =_ttoi(dt.Rows[i][2]);
bookmanager.nBookPos =_ttoi(dt.Rows[i][3]);
bookmanager.strUpdatetime =dt.Rows[i][4];
bookmanager.nIsHistory =_ttoi(dt.Rows[i][5]);
bookmanager.activeName = dt.Rows[i][6];
bookmanager.m_NIsOwner =_ttoi(dt.Rows[i][7]);
CBookInfo bookInfo;
int idx = 8;
CRow bookInfoRow = dt.Rows[i];
bookInfo.id=_ttoi(bookInfoRow[idx++]);
bookInfo.bookId=bookInfoRow[idx++];
bookInfo.bookName=bookInfoRow[idx++];
bookInfo.catalogId=_ttoi(bookInfoRow[idx++]);
bookInfo.bookCoverPath=bookInfoRow[idx++];
bookInfo.bookTextPath=bookInfoRow[idx++];
bookInfo.bookType = (Book_Type)_ttoi(bookInfoRow[idx++]);
bookInfo.bookState=(Book_State)_ttoi(bookInfoRow[idx++]);
bookInfo.recentNo=_ttol(bookInfoRow[idx++]);
bookInfo.exist = _ttoi(bookInfoRow[idx++]);
bookInfo.strSubjectId = bookInfoRow[idx++];
//if(isCount)
//{
// bookInfo.notesCount=_ttoi(bookInfoRow[idx++]);
// bookInfo.resCount=_ttoi(bookInfoRow[idx++]);
//}
bookInfo.strDownloadUrl = bookInfoRow[idx++];
bookInfo.strDownloadSize = bookInfoRow[idx++];
bookInfo.strFileSize = bookInfoRow[idx++];
bookInfo.orderNo=_ttoi(bookInfoRow[idx++]);
bookInfo.strSubjectId=bookInfoRow[idx++];
bookInfo.strCoverDigest=bookInfoRow[idx++];
bookInfo.strFileDigest=bookInfoRow[idx++];
bookInfo.applicableTerm=bookInfoRow[idx++];
bookInfo.startPage= _ttoi(bookInfoRow[idx++]);
bookInfo.updatetime =bookInfoRow[idx++];
bookInfo.strYear =bookInfoRow[idx++];
bookInfo.strDiandu_URL =bookInfoRow[idx++];
bookInfo.strExercise_URL =bookInfoRow[idx++];
bookInfo.strGrade =bookInfoRow[idx++];
bookInfo.strSecurityKey=fun.UnicodeToAscii(bookInfoRow[idx++]);
bookInfo.strShortName = bookInfoRow[idx++];
bookInfo.m_NBookCheckStatus = _ttoi(bookInfoRow[idx++]);
bookInfo.m_IBookActive = _ttoi(bookInfoRow[idx++]);
bookInfo.m_NIsOwner = _ttoi(bookInfoRow[idx++]);
bookInfo.m_strAuthor = bookInfoRow[idx++];
bookInfo.m_strFromUserName = bookInfoRow[idx++];
bookmanager.bookInfo = bookInfo;
LocalbookInfos.push_back(bookmanager);
}
}
return LocalbookInfos;
}
//Add By Ray 2020-05-20 //Add By Ray 2020-05-20
int CBookDal::GetUserBookOrder(CString userId,CString BookId) int CBookDal::GetUserBookOrder(CString userId,CString BookId)
...@@ -1718,17 +1810,21 @@ std::vector<CBookInfo> CBookDal::GetUserBookData(CString userId,int nTypeFlag,CS ...@@ -1718,17 +1810,21 @@ std::vector<CBookInfo> CBookDal::GetUserBookData(CString userId,int nTypeFlag,CS
m_nNoteBookCount = m_nDownloadBookCount=0; m_nNoteBookCount = m_nDownloadBookCount=0;
std::vector<CBookInfo> AllbookInfo; std::vector<CBookInfo> AllbookInfo;
//PUBLIC库中BOOKMANAGER用UserId找出对应所有bookid //PUBLIC库中BOOKMANAGER用UserId找出对应所有bookid
vector<Book_Manager> Localbook=GetUserBookLocal(userId,nTypeFlag); //vector<Book_Manager> Localbook=GetUserBookLocal(userId,nTypeFlag);
vector<Book_ManagerInfo> Localbook=GetUserBookLocalManagerInfo(userId,nTypeFlag);
for(int Num=0;Num<Localbook.size();Num++) for(int Num=0;Num<Localbook.size();Num++)
{ {
Book_Manager bookmanager = Localbook.at(Num); //Book_Manager bookmanager = Localbook.at(Num);
Book_ManagerInfo bookmanager = Localbook.at(Num);
//去PUBLIC库中以bookid去bookinfo取出boolist //去PUBLIC库中以bookid去bookinfo取出boolist
// if(nTypeFlag==bookmanager.nIsHistory)//0=Current ,1=History // if(nTypeFlag==bookmanager.nIsHistory)//0=Current ,1=History
// { // {
CBookInfo bookInfo = GetBookInfoByBookIdAnyState(bookmanager.strBookID, 0); //CBookInfo bookInfo = GetBookInfoByBookIdAnyState(bookmanager.strBookID, 0);
CBookInfo bookInfo = bookmanager.bookInfo;
if(keyword.GetLength()>0) if(keyword.GetLength()>0)
{ {
...@@ -1811,7 +1907,6 @@ std::vector<CBookInfo> CBookDal::GetUserBookData(CString userId,int nTypeFlag,CS ...@@ -1811,7 +1907,6 @@ std::vector<CBookInfo> CBookDal::GetUserBookData(CString userId,int nTypeFlag,CS
// } // }
} }
return AllbookInfo; return AllbookInfo;
} }
......
...@@ -47,6 +47,19 @@ struct Book_Manager ...@@ -47,6 +47,19 @@ struct Book_Manager
CString activeName; CString activeName;
int m_NIsOwner; int m_NIsOwner;
}; };
struct Book_ManagerInfo
{
CString strBookID;
int nIsMoved;
int nLastPage;
int nBookPos;
int nIsHistory;
int m_IBookActive;
CString strUpdatetime;
CString activeName;
int m_NIsOwner;
CBookInfo bookInfo;
};
struct SubjectInfo struct SubjectInfo
{ {
CString name; CString name;
...@@ -134,6 +147,7 @@ public: ...@@ -134,6 +147,7 @@ public:
void DeleteBookFromManager(CString bookId,CString uId); void DeleteBookFromManager(CString bookId,CString uId);
void UpdateBookManagerData(CString userId,CString bookId,int nTypeFlag); void UpdateBookManagerData(CString userId,CString bookId,int nTypeFlag);
std::vector<Book_Manager> GetUserBookLocal(CString userId,int nType);//0=书架 1=书桌 std::vector<Book_Manager> GetUserBookLocal(CString userId,int nType);//0=书架 1=书桌
std::vector<Book_ManagerInfo> GetUserBookLocalManagerInfo(CString userId,int nType);//0=书架 1=书桌
bool IsBookManagerExit(CString userId,CString bookId); bool IsBookManagerExit(CString userId,CString bookId);
//Add By Ray 2020-05-20 //Add By Ray 2020-05-20
int GetUserBookOrder(CString userId,CString BookId); int GetUserBookOrder(CString userId,CString BookId);
...@@ -224,6 +238,7 @@ private: ...@@ -224,6 +238,7 @@ private:
public: public:
void TargetDeleteAllTarget(); void TargetDeleteAllTarget();
void TargetSaveParentTarget(TARGET_BOOK info); void TargetSaveParentTarget(TARGET_BOOK info);
void TargetSaveParentTargetAll(CString sSQL);
void TargetGetAllTargetByBookID(CString bookid,TARGET_INFO_PARENT_LIST& list,int userType); void TargetGetAllTargetByBookID(CString bookid,TARGET_INFO_PARENT_LIST& list,int userType);
//Add By Ray 2020-07-13 //Add By Ray 2020-07-13
void CheckCompoundResourceTable(); void CheckCompoundResourceTable();
......
...@@ -435,6 +435,12 @@ int CUserInfo::ParseUserSchoolInfo(std::string strRsult) ...@@ -435,6 +435,12 @@ int CUserInfo::ParseUserSchoolInfo(std::string strRsult)
rapidjson::StringStream inputStream(func.StringToChar(strRsult)); //创建一个输入流 rapidjson::StringStream inputStream(func.StringToChar(strRsult)); //创建一个输入流
doc.ParseStream<0>(inputStream); doc.ParseStream<0>(inputStream);
rapidjson::Value value; rapidjson::Value value;
int sql_loop = 0;
int sql_loop_all = 0;
CString sql;
CString sql_values;
if(doc.HasMember("code")) if(doc.HasMember("code"))
{ {
CBookDal dao; CBookDal dao;
...@@ -500,7 +506,66 @@ int CUserInfo::ParseUserSchoolInfo(std::string strRsult) ...@@ -500,7 +506,66 @@ int CUserInfo::ParseUserSchoolInfo(std::string strRsult)
} }
} }
} }
dao.TargetSaveParentTarget(targetBookInfo);//保存数据 //dao.TargetSaveParentTarget(targetBookInfo);//保存数据
int targetBookInfoListLength = 0;
targetBookInfoListLength = targetBookInfo.list.size();
for (int j=0; j < targetBookInfoListLength; j++) {
TARGET_INFO_PARENT& parent_info = targetBookInfo.list.at(j);
CString name = parent_info.name;
LONGLONG id = parent_info.id;
LONGLONG parent_id = 0;
CString type = parent_info.type_name;
CString bookid = targetBookInfo.bookid;
CString sql_parent;
sql_parent.Format(_T("(%lld,'%s','%s',%lld,'%s')"),id,name,type,parent_id,bookid);
if (sql_loop > 0) {
sql_values += _T(",");
}
sql_values += sql_parent;
sql_loop++;
sql_loop_all++;
for (int k=0;k<parent_info.target_list.size();k++) {
TARGET_INFO_SON& son_info = parent_info.target_list.at(k);
CString name = son_info.name;
LONGLONG id = son_info.id;
LONGLONG parent_id = parent_info.id;
CString type = son_info.type_name;
CString bookid = targetBookInfo.bookid;
CString sql_son;
sql_son.Format(_T("(%lld,'%s','%s',%lld,'%s')"),id,name,type,parent_id,bookid);
if (sql_loop > 0) {
sql_values += _T(",");
}
sql_values += sql_son;
sql_loop++;
sql_loop_all++;
}
}
//dao.TargetSaveParentTarget(targetBookInfo);//保存数据
if ((i > 0) && (i % 100 == 0) && (sql_loop > 0)) {
sql.Format(_T("insert into BookTarget(tid, tname, ttype, parentid, bookid) values %s"), sql_values);
dao.TargetSaveParentTargetAll(sql);
sql_loop = 0;
sql = _T("");
sql_values = _T("");
}
}
if (sql_loop > 0) {
sql.Format(_T("insert into BookTarget(tid, tname, ttype, parentid, bookid) values %s"), sql_values);
dao.TargetSaveParentTargetAll(sql);
sql_loop = 0;
sql = _T("");
sql_values = _T("");
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment