DFS_Shuo_Chen 1 тиждень тому
батько
коміт
c7f46fdee9

+ 2 - 2
ChatRoomClient-VR/Release/conn.ini

@@ -1,12 +1,12 @@
 [Config]
 fip=1
-noz=1
+noz=7
 YLS=10.00
 QLS=10.00
 YL=15.00
 QL=15.00
 VL=1.00
-TTC=1
+TTC=7
 ERROR=0
 PRESS=10
 PWM=10

BIN
VaporRecoveryMonitor/VaporRecoveryMonitor/Bin/VaporRecoveryMonitor.exe


BIN
VaporRecoveryMonitor/VaporRecoveryMonitor/VaporRecoveryMonitor.v12.suo


BIN
VaporRecoveryMonitor/VaporRecoveryMonitor/VaporRecoveryMonitor/Release/VaporRec.A31C344F.tlog/link.read.1.tlog


+ 42 - 69
VaporRecoveryMonitor/VaporRecoveryMonitor/VaporRecoveryMonitor/WebLink_BJ.cpp

@@ -12,6 +12,8 @@
 #include "vr_db.h"
 #include "vr_devices.h"
 #include "md5.h"
+#include "vr_ext.h"
+#include "tool.h"
 
 
 using namespace VR::notify;
@@ -21,7 +23,17 @@ extern devices_tree g_devices_tree;
 
 CWebLink_BJ::CWebLink_BJ()
 {
-	m_bGetToken = TRUE;
+	m_bGetToken = FALSE;
+
+	char chpw[100];
+	GetPrivateProfileStringA("UserID", "pw", "", chpw, 100, ".//conn.ini");
+	m_pw = chpw;
+
+	if (!m_pw.empty())
+	{
+		m_pw = DecryptionAES(m_pw, "111VTG9991sit2c5");
+	}
+
 }
 
 
@@ -121,9 +133,9 @@ void CWebLink_BJ::PackWebData_Config(VR::WebData& webdata, int nozzlenum)
 	sprintf_s(chType, "%02d", webdata.type);
 
 
-	strdata += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-	strdata += "<root>";
-	strdata += "<VERSION>V1.1</VERSION>";
+	//strdata += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
+	//strdata += "<root>";
+	strdata += "<VERSION>V2.0.1</VERSION>";
 	strdata += "<DATAID>" + string(chDataID) + "</DATAID>";
 	strdata += "<USERID>" + *m_pUserId + "</USERID>";
 	strdata += "<TIME>" + string(chTime) + "</TIME>";
@@ -131,7 +143,7 @@ void CWebLink_BJ::PackWebData_Config(VR::WebData& webdata, int nozzlenum)
 	strdata += "<SEC>1</SEC>";
 	strdata += "<BUSINESSCONTENT>" + base64 + "</BUSINESSCONTENT>";
 	strdata += "<HMAC></HMAC>";
-	strdata += "</root>";
+	//strdata += "</root>";
 
 
 	webdata.data = strdata;
@@ -279,9 +291,8 @@ void CWebLink_BJ::PackWebData_Warning(VR::WebData& webdata, int type, int warnin
 	sprintf_s(chType, "%02d", webdata.type);
 
 
-	strdata += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-	strdata += "<root>";
-	strdata += "<VERSION>V1.1</VERSION>";
+
+	strdata += "<VERSION>V2.0.1</VERSION>";
 	strdata += "<DATAID>" + string(chDataID) + "</DATAID>";
 	strdata += "<USERID>" + *m_pUserId + "</USERID>";
 	strdata += "<TIME>" + string(chTime) + "</TIME>";
@@ -289,7 +300,6 @@ void CWebLink_BJ::PackWebData_Warning(VR::WebData& webdata, int type, int warnin
 	strdata += "<SEC>1</SEC>";
 	strdata += "<BUSINESSCONTENT>" + base64 + "</BUSINESSCONTENT>";
 	strdata += "<HMAC></HMAC>";
-	strdata += "</root>";
 
 
 	webdata.data = strdata;
@@ -415,6 +425,18 @@ void CWebLink_BJ::PackWebData_Record(VR::WebData& webdata, const VR::notify::fil
 	{
 		data += "<YZ>NULL</YZ>";
 	}
+
+	string begtime = string(record.tmBegin);
+	if (begtime == "")
+	{
+		begtime = string(record.tmEnd);
+	}
+
+
+	data += "<KSDATE>" + begtime + "</KSDATE>";
+	data += "<JSDATE>" + string(record.tmEnd) + "</JSDATE>";
+	data += "<JYGCZT>" + string("0") + "</JYGCZT>";
+
 	data += "</row>";
 	data += "</rows>";
 
@@ -426,9 +448,8 @@ void CWebLink_BJ::PackWebData_Record(VR::WebData& webdata, const VR::notify::fil
 	char chTime[15];
 	get_current_time(chTime);
 
-	strdata += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-	strdata += "<root>";
-	strdata += "<VERSION>V1.1</VERSION>";
+
+	strdata += "<VERSION>V2.0.1</VERSION>";
 	strdata += "<DATAID>" + string(chDataID) + "</DATAID>";
 	strdata += "<USERID>" + *m_pUserId + "</USERID>";
 	strdata += "<TIME>" + string(chTime) + "</TIME>";
@@ -436,7 +457,7 @@ void CWebLink_BJ::PackWebData_Record(VR::WebData& webdata, const VR::notify::fil
 	strdata += "<SEC>1</SEC>";
 	strdata += "<BUSINESSCONTENT>" + base64 + "</BUSINESSCONTENT>";
 	strdata += "<HMAC></HMAC>";
-	strdata += "</root>";
+
 
 	webdata.data = strdata;
 }
@@ -524,9 +545,8 @@ void CWebLink_BJ::PackWebData_Environment(VR::WebData& webdata)
 	char chTime[15];
 	get_current_time(chTime);
 
-	strdata += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-	strdata += "<root>";
-	strdata += "<VERSION>V1.1</VERSION>";
+
+	strdata += "<VERSION>V2.0.1</VERSION>";
 	strdata += "<DATAID>" + string(chDataID) + "</DATAID>";
 	strdata += "<USERID>" + *m_pUserId + "</USERID>";
 	strdata += "<TIME>" + string(chTime) + "</TIME>";
@@ -534,7 +554,6 @@ void CWebLink_BJ::PackWebData_Environment(VR::WebData& webdata)
 	strdata += "<SEC>1</SEC>";
 	strdata += "<BUSINESSCONTENT>" + base64 + "</BUSINESSCONTENT>";
 	strdata += "<HMAC></HMAC>";
-	strdata += "</root>";
 
 	webdata.data = strdata;
 }
@@ -570,9 +589,8 @@ void CWebLink_BJ::PackWebData_Error(VR::WebData& webdata, string code, string st
 	sprintf_s(chType, "%02d", webdata.type);
 
 
-	strdata += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-	strdata += "<root>";
-	strdata += "<VERSION>V1.1</VERSION>";
+
+	strdata += "<VERSION>V2.0.1</VERSION>";
 	strdata += "<DATAID>" + string(chDataID) + "</DATAID>";
 	strdata += "<USERID>" + *m_pUserId + "</USERID>";
 	strdata += "<TIME>" + string(chTime) + "</TIME>";
@@ -580,7 +598,6 @@ void CWebLink_BJ::PackWebData_Error(VR::WebData& webdata, string code, string st
 	strdata += "<SEC>1</SEC>";
 	strdata += "<BUSINESSCONTENT>" + base64 + "</BUSINESSCONTENT>";
 	strdata += "<HMAC></HMAC>";
-	strdata += "</root>";
 
 
 	webdata.data = strdata;
@@ -620,9 +637,8 @@ void CWebLink_BJ::PackWebData_NozControl(VR::WebData& webdata, int fip, int noz,
 	sprintf_s(chType, "%02d", webdata.type);
 
 
-	strdata += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-	strdata += "<root>";
-	strdata += "<VERSION>V1.1</VERSION>";
+
+	strdata += "<VERSION>V2.0.1</VERSION>";
 	strdata += "<DATAID>" + string(chDataID) + "</DATAID>";
 	strdata += "<USERID>" + *m_pUserId + "</USERID>";
 	strdata += "<TIME>" + string(chTime) + "</TIME>";
@@ -630,7 +646,6 @@ void CWebLink_BJ::PackWebData_NozControl(VR::WebData& webdata, int fip, int noz,
 	strdata += "<SEC>1</SEC>";
 	strdata += "<BUSINESSCONTENT>" + base64 + "</BUSINESSCONTENT>";
 	strdata += "<HMAC></HMAC>";
-	strdata += "</root>";
 
 
 	webdata.data = strdata;
@@ -695,9 +710,8 @@ void CWebLink_BJ::PackWebData_NozState(VR::WebData& webdata, string strDate)
 	sprintf_s(chType, "%02d", webdata.type);
 
 
-	strdata += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-	strdata += "<root>";
-	strdata += "<VERSION>V1.1</VERSION>";
+
+	strdata += "<VERSION>V2.0.1</VERSION>";
 	strdata += "<DATAID>" + string(chDataID) + "</DATAID>";
 	strdata += "<USERID>" + *m_pUserId + "</USERID>";
 	strdata += "<TIME>" + string(chTime) + "</TIME>";
@@ -705,51 +719,10 @@ void CWebLink_BJ::PackWebData_NozState(VR::WebData& webdata, string strDate)
 	strdata += "<SEC>1</SEC>";
 	strdata += "<BUSINESSCONTENT>" + base64 + "</BUSINESSCONTENT>";
 	strdata += "<HMAC></HMAC>";
-	strdata += "</root>";
 
 
 	webdata.data = strdata;
 }
 
 
-/*
-//自定义心跳
-void CWebLink_BJ::PackWebData_HeartBeat(VR::WebData& webdata)
-{
-	string strdata = "";
-
-	char chDataID[7];
-	sprintf_s(chDataID, "%06d", webdata.ID);
-
-	string data = "";
-
-	//用空环境数据包来做心跳检测
-	data += "<rows>";
-	data += "</rows>";
-
-
-	string base64 = base64_encode((BYTE*)data.data(), data.length());
-	char chType[3];
-	sprintf_s(chType, "%02d", webdata.type);
-
-	char chTime[15];
-	get_current_time(chTime);
-
-	strdata += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
-	strdata += "<root>";
-	strdata += "<VERSION>V1.1</VERSION>";
-	strdata += "<DATAID>" + string(chDataID) + "</DATAID>";
-	strdata += "<USERID>" + *m_pUserId + "</USERID>";
-	strdata += "<TIME>" + string(chTime) + "</TIME>";
-	strdata += "<TYPE>" + string(chType) + "</TYPE>";
-	strdata += "<SEC>1</SEC>";
-	strdata += "<BUSINESSCONTENT>" + base64 + "</BUSINESSCONTENT>";
-	strdata += "<HMAC></HMAC>";
-	strdata += "</root>";
-
-	webdata.data = strdata;
-
-
-}
-*/
 

+ 2 - 0
VaporRecoveryMonitor/VaporRecoveryMonitor/VaporRecoveryMonitor/WebLink_BJ.h

@@ -27,5 +27,7 @@ public:
 	string getAllString(string dataid, string time, string type, string base64str);
 
 	int m_bGetToken;
+	string m_token;
+	string m_pw;
 };
 

+ 8 - 6
VaporRecoveryMonitor/VaporRecoveryMonitor/VaporRecoveryMonitor/conn.ini

@@ -1,7 +1,7 @@
 ;上传平台选择
 [City]
 ;上传平台1;  0-北京;1-;2-;3-浙江杭州环保局;4-;5-山东省环保;6-广州;7-湖南中石化;8-山东烟台;9-重庆;10-;11-浙江金华环保局;12-南京环保局;13-福建厦门环保局;14-东莞市环保局;15-深圳环保局;16-江门环保局;17-沈阳环保局;18-广东惠州环保局;19=汕头环保局;20-云浮环保局;21-揭阳环保局;22-浙江宁波环保局;23-佛山市环保2;24-阳江环保局;25-安徽合肥环保局;26-浙江温州环保局;27-珠海环保局; 28-河北张家口环保局;29-浙江台州环保;30-湛江环保局;31-清远环保局;32-河北唐山环保局;33-内蒙古呼和浩特环保局;34-武汉环保局;35-宁夏环保局;36-成都环保局;37-茂名环保局;38-河源环保局;999-测试1;1000-不设置
-CityNo=38
+CityNo=0
 ;上传平台2;  0-不设置;1-浙江浙石油;2-浙江中石化;3-山东青岛;4-湖南长沙环保局;5-佛山顺德(佛山市);6-广东中石化;7-重庆环保2;8-山东烟台;9-中化道达尔;999-测试2
 CityNo2=999
 ;上传平台3;0-不设置;1-浙江高速;2-中山智慧平台;3-北京中石化;4-山东烟台(新地址)
@@ -13,7 +13,7 @@ MainCity=1
 ;远程服务器
 [WebService]
 ;是否开启平台1远程传输。0-关闭;1-开启
-Enable=1
+Enable=0
 ;是否开启平台2远程传输。0-关闭;1-开启
 Enable2=0
 ;是否开启平台3远程传输。0-关闭;1-开启
@@ -42,7 +42,9 @@ port2=6005
 ;加油站标识
 [UserID]
 ;区域代码标识(6位)+ 加油站标识(4位) 环科院给每个油站分配唯一的加油站标识,例如1101080059是北沙滩加油站的标识
-id=0
+id=1101080059
+;用加密工具(位置:C:\VR\加密工具)加密环保局提供的获取token的密码,填入加密后的字段
+pw=zkW5k0GvUR9cTfAsm8Jb1XPRGkopvw3N34IIC07PhAE=
 ;IP地址
 IP=bjzfzd.huazx.cn
 ;端口
@@ -946,7 +948,7 @@ Port=10000
 [DataID]
 Record=67169
 Environment=105878
-Config=3333
+Config=3344
 Warning=14006
 Error=1641
 NozState=1680
@@ -981,8 +983,8 @@ configupdatetime=20251107114832
 
 [RunningState]
 UnLockFlag=000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-Date=20251225
-TradeFlag=100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
+Date=20251231
+TradeFlag=000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
 
 
 

+ 2 - 0
VaporRecoveryMonitor/VaporRecoveryMonitor/VaporRecoveryMonitor/tool.cpp

@@ -582,6 +582,8 @@ string EncryptionAES(const string& strSrc, string key) //AES
 
 
 
+
+
 unsigned char ascii2value(unsigned char c)
 {
 	if ('0' <= c && c <= '9')

+ 17 - 0
VaporRecoveryMonitor/VaporRecoveryMonitor/VaporRecoveryMonitor/vr_ext.cpp

@@ -5177,6 +5177,20 @@ string wstring2string(wstring wstr)
 
 
 
+//把用ascii码表示的字符串转成实际字符串,如把4849转成01
+std::string asciiToString(const std::string& asciiStr)
+{
+	std::string result = "";
+	if (asciiStr.length() % 2 == 1)
+	{
+		return result;
+	}
+	for (size_t i = 0; i < asciiStr.length(); i += 2)
+	{
+		result += static_cast<char>(std::stoi(asciiStr.substr(i, 2)));
+	}
+	return result;
+}
 
 //100%LEL = 1.9%VOL = 19000PPM = 19000*2.59毫克每立方 = 49.21克每立方
 
@@ -5693,6 +5707,9 @@ void dailyUpload()
 		}
 
 		//getDataFiles();
+
+
+		web_bj.m_bGetToken = FALSE;
 	}
 }
 

+ 4 - 0
VaporRecoveryMonitor/VaporRecoveryMonitor/VaporRecoveryMonitor/vr_ext.h

@@ -24,6 +24,7 @@ using namespace VR::ui;
 #define DataTYPE_HeartBeat	20
 
 
+
 #define DataTYPE_Config_SH	1
 #define DataTYPE_Envir_SH	2
 #define DataTYPE_Record_SH	3
@@ -167,6 +168,9 @@ wstring string2wstring(string str);
 string wstring2string(wstring wstr);
 
 
+std::string asciiToString(const std::string& asciiStr);
+
+
 double LEL2GM3(double lel);
 
 double GM32LEL(double gm3);

+ 110 - 9
VaporRecoveryMonitor/VaporRecoveryMonitor/VaporRecoveryMonitor/vr_webservice.cpp

@@ -238,16 +238,111 @@ void vr_webservice::CreateRequestThread()
 							if (g_strUserID != "")
 							{
 
-								//if (!web_bj.m_bGetToken)
-								//{
-								//}
-								//else
+								if (!web_bj.m_bGetToken)
 								{
 
+									std::string  xml = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"http://webservice.orvr.data.ebp.huazx.cn/\">"
+										+ string("<soapenv:Header/>")
+										+ "<soapenv:Body>"
+										+ "<web:getToken>"
+										+ "<userId>"
+										+ *web_bj.m_pUserId
+										+ "</userId>"
+										+ "<pwd>"
+										+ web_bj.m_pw
+										+"</pwd>"
+										+"</web:getToken>"
+										+"</soapenv:Body>"
+										+"</soapenv:Envelope>";
+
+
+										std::string strpath = path_gen;
+										rtnstr = http_post_xml_bj(ip_gen.c_str(), port_gen, strpath.c_str(), xml.c_str());
+										rtnstr = UTF8_To_GBKA(rtnstr);
+
+
+										int index = rtnstr.find_first_of("<");
+										if (index == -1)
+										{
+											char recvlogs[100] = { 0 };
+											sprintf_s(recvlogs, "类型:%s;   接收:", webdata.strtype.c_str());
+											string strlog = recvlogs + rtnstr;
+											log(strlog.c_str());
+
+											Sleep(10 * 1000);
+										}
+										else
+										{
+
+											rtnstr = rtnstr.substr(index, rtnstr.length());
+
+
+											char recvlogs[100] = { 0 };
+											sprintf_s(recvlogs, "类型:%s;   接收:", webdata.strtype.c_str());
+											string strlog = recvlogs + rtnstr;
+											log(strlog.c_str());
+
+
+											std::string rtnstr2 = "";
+
+											//rapidxml::xml_document<> doc;
+											doc.parse<0>(const_cast<char*>(rtnstr.c_str()));
+
+											//! 获取根节点
+											rapidxml::xml_node<>* root = doc.first_node();
+
+											//! 获取根节点第一个节点
+											rapidxml::xml_node<>* node1 = root->first_node();
+
+											rapidxml::xml_node<>* node11 = node1->first_node();
+
+
+											for (rapidxml::xml_node<char> * node = node11->first_node("return");
+												node != NULL;
+												node = node->next_sibling())
+											{
+												rtnstr2 += node->value();
+											}
 
-									char *pdata = new char[2 * webdata.data.size()];
-									memset(pdata, 0, 2 * webdata.data.size());
-									memcpy(pdata, webdata.data.data(), webdata.data.size());
+											webtick = GetTickCount();
+
+
+
+
+
+											if (rtnstr2 == "5748") //90 
+											{
+												errmsg = "token密码错误";
+											}
+											else if (rtnstr2.length()>4 && rtnstr2.substr(0,4) == "5749")
+											{
+												web_bj.m_token = rtnstr2.substr(4);
+												web_bj.m_bGetToken = TRUE;
+											}
+											else
+											{
+												errmsg = rtnstr2;
+											}
+										}
+
+								}
+								else
+								{
+									string senddata = "";
+
+									senddata += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
+									senddata += "<root>";
+									senddata += webdata.data;
+									senddata += "<TOKEN>";
+									senddata += web_bj.m_token;
+									senddata += "</TOKEN>";
+									senddata += "</root>";
+
+
+
+									char *pdata = new char[2 * senddata.size()];
+									memset(pdata, 0, 2 * senddata.size());
+									memcpy(pdata, senddata.data(), senddata.size());
 									strrpc(pdata, "<", "&lt;");
 									strrpc(pdata, ">", "&gt;");
 
@@ -316,15 +411,21 @@ void vr_webservice::CreateRequestThread()
 											rtnstr2 += node->value();
 										}
 
+										webtick = GetTickCount();
 
+										 
 
-										webtick = GetTickCount();
+										rtnstr2 = asciiToString(rtnstr2);
 
 
-										if (rtnstr2 == "4849" || webdata.strtype == "HeartBeat") //成功 //心跳数据是自己发的空环境数据,只要能收到回复就算成功
+										if (rtnstr2 == "01" ) //成功 
 										{
 											bSuccess = TRUE;
 										}
+										else if (rtnstr2 == "92") 
+										{
+											errmsg = "token校验失败";
+										}
 										else
 										{
 											errmsg = rtnstr2;