Parcourir la source

【bug修复】(黄根)解决绑定学校时无法绑定前50个学校之外的学校的问题 & 优化打分框红笔判分和上传json乱码的问题
【工作量】8h
【评审人】

huanggen il y a 2 ans
Parent
commit
588f4cc4cf

+ 1 - 1
EvaluationUtil/HttpClient.cpp

@@ -100,7 +100,7 @@ int CHttpClient::ExecuteRequest(LPCTSTR strMethod, LPCTSTR strUrl, LPCTSTR strPo
 			data_len = end_boundary_char.length();
 		}
        // m_pHttpFile->SendRequest(NULL, 0, (LPVOID)(LPCTSTR)strPostData, strPostData == NULL ? 0 : _tcslen(strPostData));
-		m_pHttpFile->SendRequest(NULL, 0, strPostData == NULL ? NULL:(char*)end_boundary_char.c_str(),strPostData == NULL ? 0:data_len-1);
+		m_pHttpFile->SendRequest(NULL, 0, strPostData == NULL ? NULL:(char*)end_boundary_char.c_str(),strPostData == NULL ? 0:data_len);
         char szChars[BUFFER_SIZE + 1] = {0};
         string strRawResponse = "";
         UINT nReaded = 0;

+ 25 - 2
HJUnHandle/bindschoolinfo.cpp

@@ -23,6 +23,26 @@ CBindSchoolInfo::CBindSchoolInfo(QWidget *parent)
 	connect(ui.pushButton_ok, SIGNAL(clicked()), this, SLOT(slot_clickButton()));
 	connect(ui.pushButton_canncel, SIGNAL(clicked()), this, SLOT(slot_clickButton()));
 	connect(ui.comboBox_school, SIGNAL(currentIndexChanged(int)), this, SLOT(slot_comboxIndexChange(int)));
+	connect(ui.comboBox_school, &QComboBox::editTextChanged, this, [=](QString strContext){
+		QCompleter * pCompleter = ui.comboBox_school->completer();
+		int nRow = pCompleter->completionCount();
+		//无法从前50个学校中获取时,调用后端接口获取
+		if (nRow == 0)
+		{
+			m_vctschool.clear();
+			RequestSchoolInfo(strContext);
+			for (auto& iter : m_vctschool)
+			{
+				QString strName(QString::number(iter.schoolId));
+				strName.append("-");
+				strName.append(iter.schoolName);
+				strName.append("-");
+				strName.append(iter.schoolArea);
+				ui.comboBox_school->addItem(strName, iter.schoolId);
+			}
+			pCompleter->popup();
+		}
+	});
 
 	RequestSchoolInfo();
 	CheckBindSchool();
@@ -33,13 +53,16 @@ CBindSchoolInfo::~CBindSchoolInfo()
 
 }
 
-void CBindSchoolInfo::RequestSchoolInfo()
+void CBindSchoolInfo::RequestSchoolInfo(QString strSchoolName)
 {
 	WCHAR server_url[MAX_PATH] = { 0 };
 	GetPrivateProfileString(L"USER", L"server_url", L"", server_url, MAX_PATH, g_strConfigPath.c_str());
 
 	QString url(QString::fromStdWString(server_url));
-	url.append("/teacher/third/school?schoolName=""");
+	if (strSchoolName.isEmpty())
+		strSchoolName = "";
+	QString strUrl = QString("/teacher/third/school?schoolName=%1").arg(strSchoolName);
+	url.append(strUrl.toStdString().c_str());
 
 	QNetworkRequest request;
 	request.setUrl(url);

+ 3 - 3
HJUnHandle/bindschoolinfo.h

@@ -4,7 +4,7 @@
 #include <QDialog>
 #include "ui_bindschoolinfo.h"
 #include <string>
-#include <vector>
+#include <QList>
 #include "basedialog.h"
 using namespace std;
 
@@ -21,7 +21,7 @@ private slots:
 	void slot_comboxIndexChange(int index);
 
 private:
-	void RequestSchoolInfo();
+	void RequestSchoolInfo(QString strSchoolName = "");
 	void CheckBindSchool();
 
 	Ui::CBindSchoolInfo ui;
@@ -33,7 +33,7 @@ private:
 		QString schoolArea;
 		QStringList manager;
 	};
-	vector<school_info> m_vctschool;
+	QList<school_info> m_vctschool;
 };
 
 #endif // BINDSCHOOLINFO_H

+ 6 - 4
Identifier/PageIdentify.cpp

@@ -2944,6 +2944,7 @@ namespace OnLineCard{
 			rx = data[0] * qs.rt.x + data[1] * qs.rt.y + data[2];
 			ly = data[3] * qs.lt.x + data[4] * qs.lt.y + data[5];
 			ry = data[3] * qs.rt.x + data[4] * qs.rt.y + data[5];
+			//打分框识别从右往左读
 			if (qs.type == QUESTION_SCORE_TYPE::MUTIL_SCORE){
 				if (lx >= 0 && rx >= 0){
 					float h = (point[2]->y - point[0]->y)*pscale;
@@ -3003,13 +3004,14 @@ namespace OnLineCard{
 							//十位数
 							int red_area = 0;
 							int red_area_index = -1;
-							int begin_index = (qs.scoreBox.bPoint ? 11 : 10);
-							for (int i = begin_index; i < begin_index + (int)(qs.scoreBox.limit / 10) + 1; ++i)
+							//跳过打分框中的中文字符格子(“十”“个”)从11索引开始
+							int begin_index = (qs.scoreBox.bPoint ? 12 : 11);
+							for (int i = begin_index; i < begin_index + (int)(qs.scoreBox.limit / 10); ++i)
 							{
 								if (red_in_count[i] > red_area){ red_area = red_in_count[i]; red_area_index = i; }
 							}
-							if (red_area_index >= begin_index){
-								score = score + 10 * ((int)(qs.scoreBox.limit / 10) - (red_area_index - begin_index) + 1);
+							if (red_area_index >= begin_index && red_area > 25){
+								score = score + 10 * ((int)(qs.scoreBox.limit / 10) - (red_area_index - begin_index));
 							}
 						}
 					}

+ 14 - 3
SmartEvaluationLogic/BatchInfo.cpp

@@ -3233,7 +3233,7 @@ int CBatch_Server::UploadResult(Paper_Page* paper)
 	fclose(pf);
 
 	vector<string> jpgs = splitEx(jpgbuf, ",");
-	FILE* pf2 = fopen(json_file.c_str(), "rb");
+	/*FILE* pf2 = fopen(json_file.c_str(), "rb");
 	if (!pf2)
 	{
 		g_log.PutMsg(LogLvlFailed, "´ò¿ªÉÏ´«Îļþʧ°Ü %s", json_file.c_str());
@@ -3241,7 +3241,18 @@ int CBatch_Server::UploadResult(Paper_Page* paper)
 		return 0;
 	}
 	fread(json_buf, 1, 20480, pf2);
-	fclose(pf2);
+	fclose(pf2);*/
+
+	string strContent;
+	string strTemp;
+	ifstream in;
+	ofstream out;
+	in.open(json_file);
+	while (getline(in, strTemp))
+	{
+		strContent += strTemp;
+	}
+	in.close();
 
 	//Json::Features features;
 	//Json::Reader re(features);
@@ -3294,7 +3305,7 @@ int CBatch_Server::UploadResult(Paper_Page* paper)
 		string response;
 		CString url;
 		url.Format(_T("%s/teacher/third/student/upload"), strA2W(g_ServerUrl).c_str());
-		string strJsonContent = UtfToGbk(json_buf);
+		string strJsonContent = UtfToGbk(strContent);
 		CString strJson = CString(_T("json=")) + strA2W(strJsonContent).c_str();
 		httpClient.HttpPost(url, strJson, response);
 		if (response.find("\"code\":200") != string::npos)