From 4c77f5e959ad7bd29ef52386fbda0393977ae43c Mon Sep 17 00:00:00 2001 From: xuxiuxi <554325746@qq.com> Date: 星期四, 28 二月 2019 13:28:43 +0800 Subject: [PATCH] update models, daos and controllers for tables. --- QiaoJiaSystem/DataManagerServer/vss/controller/VssLocalSettingTblController.h | 62 QiaoJiaSystem/DataManagerServer/vss/dao/VssLocalSettingTblSqliteDao.h | 54 - QiaoJiaSystem/DataManagerServer/vss/controller/VssChannelTblController.h | 668 ++++++++++---------- QiaoJiaSystem/DataManagerServer/vss/controller/VssDevTblController.h | 380 +++++----- QiaoJiaSystem/DataManagerServer/vss/controller/VssDomainUnitTblController.h | 308 ++++---- QiaoJiaSystem/build/config.db | 0 QiaoJiaSystem/DataManagerServer/vss/controller/VssUpperSvrTblController.h | 500 +++++++------- 7 files changed, 977 insertions(+), 995 deletions(-) diff --git a/QiaoJiaSystem/DataManagerServer/vss/controller/VssChannelTblController.h b/QiaoJiaSystem/DataManagerServer/vss/controller/VssChannelTblController.h index 654b001..57c0021 100755 --- a/QiaoJiaSystem/DataManagerServer/vss/controller/VssChannelTblController.h +++ b/QiaoJiaSystem/DataManagerServer/vss/controller/VssChannelTblController.h @@ -16,46 +16,46 @@ */ class VssChannelTblController : public VssBaseController { private: - /** 鍒涘缓浜岀骇璁惧琛ㄦ瀯閫犲嚱鏁� */ - VssChannelTblController() {} + /** 鍒涘缓浜岀骇璁惧琛ㄦ瀯閫犲嚱鏁� */ + VssChannelTblController() {} public: - /** 鍒涘缓浜岀骇璁惧琛ㄥ崟渚嬫ā寮� */ + /** 鍒涘缓浜岀骇璁惧琛ㄥ崟渚嬫ā寮� */ static VssChannelTblController* instance() { static VssChannelTblController instance; return &instance; } public: - /** 娉ㄥ唽{label}http鏈嶅姟 */ + /** 娉ㄥ唽{label}http鏈嶅姟 */ void registerHttpServices(HttpSrvRetRecieve& _HttpSrvRetRecieve) { - _HttpSrvRetRecieve.setInfo("^/addVssChannelTbl$", "POST", - std::bind(&VssChannelTblController::addVssChannelTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/delVssChannelTbl$", "POST", - std::bind(&VssChannelTblController::delVssChannelTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/updateVssChannelTbl$", "POST", - std::bind(&VssChannelTblController::updateVssChannelTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/findVssChannelTbl$", "POST", - std::bind(&VssChannelTblController::findVssChannelTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/findVssChannelTblList$", "POST", - std::bind(&VssChannelTblController::findVssChannelTblList, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); + _HttpSrvRetRecieve.setInfo("^/addVssChannelTbl$", "POST", + std::bind(&VssChannelTblController::addVssChannelTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/delVssChannelTbl$", "POST", + std::bind(&VssChannelTblController::delVssChannelTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/updateVssChannelTbl$", "POST", + std::bind(&VssChannelTblController::updateVssChannelTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/findVssChannelTbl$", "POST", + std::bind(&VssChannelTblController::findVssChannelTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/findVssChannelTblList$", "POST", + std::bind(&VssChannelTblController::findVssChannelTblList, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); } public: - /** 娣诲姞鍒涘缓浜岀骇璁惧琛� */ + /** 娣诲姞鍒涘缓浜岀骇璁惧琛� */ std::string addVssChannelTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; Json::Value requestJsonValue; @@ -64,133 +64,133 @@ responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { VssChannelTblBuilder vssChannelTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssChannelTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssChannelTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addID(iDJsonValue.asInt()); + vssChannelTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value devPubIDJsonValue = requestJsonValue[VssChannelTbl_DevPubID]; + + Json::Value devPubIDJsonValue = requestJsonValue[VssChannelTbl_DevPubID]; if (devPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addDevPubID(devPubIDJsonValue.asString()); + vssChannelTblBuilder.addDevPubID((devPubIDJsonValue.asString())); } - - Json::Value nicknameJsonValue = requestJsonValue[VssChannelTbl_Nickname]; + + Json::Value nicknameJsonValue = requestJsonValue[VssChannelTbl_Nickname]; if (nicknameJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addNickname(nicknameJsonValue.asString()); + vssChannelTblBuilder.addNickname((nicknameJsonValue.asString())); } - - Json::Value chanPubIDJsonValue = requestJsonValue[VssChannelTbl_ChanPubID]; + + Json::Value chanPubIDJsonValue = requestJsonValue[VssChannelTbl_ChanPubID]; if (chanPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addChanPubID(chanPubIDJsonValue.asString()); + vssChannelTblBuilder.addChanPubID((chanPubIDJsonValue.asString())); } - - Json::Value aliveJsonValue = requestJsonValue[VssChannelTbl_Alive]; + + Json::Value aliveJsonValue = requestJsonValue[VssChannelTbl_Alive]; if (aliveJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addAlive(aliveJsonValue.asInt()); + vssChannelTblBuilder.addAlive(std::stoi((aliveJsonValue.asString()))); } - - Json::Value corpIDJsonValue = requestJsonValue[VssChannelTbl_CorpID]; + + Json::Value corpIDJsonValue = requestJsonValue[VssChannelTbl_CorpID]; if (corpIDJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addCorpID(corpIDJsonValue.asString()); + vssChannelTblBuilder.addCorpID((corpIDJsonValue.asString())); } - - Json::Value modelJsonValue = requestJsonValue[VssChannelTbl_Model]; + + Json::Value modelJsonValue = requestJsonValue[VssChannelTbl_Model]; if (modelJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addModel(modelJsonValue.asString()); + vssChannelTblBuilder.addModel((modelJsonValue.asString())); } - - Json::Value ownerJsonValue = requestJsonValue[VssChannelTbl_Owner]; + + Json::Value ownerJsonValue = requestJsonValue[VssChannelTbl_Owner]; if (ownerJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addOwner(ownerJsonValue.asString()); + vssChannelTblBuilder.addOwner((ownerJsonValue.asString())); } - - Json::Value civilCodeJsonValue = requestJsonValue[VssChannelTbl_CivilCode]; + + Json::Value civilCodeJsonValue = requestJsonValue[VssChannelTbl_CivilCode]; if (civilCodeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addCivilCode(civilCodeJsonValue.asString()); + vssChannelTblBuilder.addCivilCode((civilCodeJsonValue.asString())); } - - Json::Value addressJsonValue = requestJsonValue[VssChannelTbl_Address]; + + Json::Value addressJsonValue = requestJsonValue[VssChannelTbl_Address]; if (addressJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addAddress(addressJsonValue.asString()); + vssChannelTblBuilder.addAddress((addressJsonValue.asString())); } - - Json::Value parentalJsonValue = requestJsonValue[VssChannelTbl_Parental]; + + Json::Value parentalJsonValue = requestJsonValue[VssChannelTbl_Parental]; if (parentalJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addParental(parentalJsonValue.asInt()); + vssChannelTblBuilder.addParental(std::stoi((parentalJsonValue.asString()))); } - - Json::Value parentIdJsonValue = requestJsonValue[VssChannelTbl_ParentId]; + + Json::Value parentIdJsonValue = requestJsonValue[VssChannelTbl_ParentId]; if (parentIdJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addParentId(parentIdJsonValue.asString()); + vssChannelTblBuilder.addParentId((parentIdJsonValue.asString())); } - - Json::Value iPJsonValue = requestJsonValue[VssChannelTbl_IP]; + + Json::Value iPJsonValue = requestJsonValue[VssChannelTbl_IP]; if (iPJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addIP(iPJsonValue.asString()); + vssChannelTblBuilder.addIP((iPJsonValue.asString())); } - - Json::Value portJsonValue = requestJsonValue[VssChannelTbl_Port]; + + Json::Value portJsonValue = requestJsonValue[VssChannelTbl_Port]; if (portJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addPort(portJsonValue.asInt()); + vssChannelTblBuilder.addPort(std::stoi((portJsonValue.asString()))); } - - Json::Value longitudeJsonValue = requestJsonValue[VssChannelTbl_Longitude]; + + Json::Value longitudeJsonValue = requestJsonValue[VssChannelTbl_Longitude]; if (longitudeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addLongitude(longitudeJsonValue.asDouble()); + vssChannelTblBuilder.addLongitude(std::stod((longitudeJsonValue.asString()))); } - - Json::Value latitudeJsonValue = requestJsonValue[VssChannelTbl_Latitude]; + + Json::Value latitudeJsonValue = requestJsonValue[VssChannelTbl_Latitude]; if (latitudeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addLatitude(latitudeJsonValue.asDouble()); + vssChannelTblBuilder.addLatitude(std::stod((latitudeJsonValue.asString()))); } - - Json::Value altitudeJsonValue = requestJsonValue[VssChannelTbl_Altitude]; + + Json::Value altitudeJsonValue = requestJsonValue[VssChannelTbl_Altitude]; if (altitudeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addAltitude(altitudeJsonValue.asDouble()); + vssChannelTblBuilder.addAltitude(std::stod((altitudeJsonValue.asString()))); } - - Json::Value pTZTypeJsonValue = requestJsonValue[VssChannelTbl_PTZType]; + + Json::Value pTZTypeJsonValue = requestJsonValue[VssChannelTbl_PTZType]; if (pTZTypeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addPTZType(pTZTypeJsonValue.asInt()); + vssChannelTblBuilder.addPTZType(std::stoi((pTZTypeJsonValue.asString()))); } - - Json::Value roomTypeJsonValue = requestJsonValue[VssChannelTbl_RoomType]; + + Json::Value roomTypeJsonValue = requestJsonValue[VssChannelTbl_RoomType]; if (roomTypeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addRoomType(roomTypeJsonValue.asInt()); + vssChannelTblBuilder.addRoomType(std::stoi((roomTypeJsonValue.asString()))); } - - Json::Value directionTypeJsonValue = requestJsonValue[VssChannelTbl_DirectionType]; + + Json::Value directionTypeJsonValue = requestJsonValue[VssChannelTbl_DirectionType]; if (directionTypeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addDirectionType(directionTypeJsonValue.asInt()); + vssChannelTblBuilder.addDirectionType(std::stoi((directionTypeJsonValue.asString()))); } - - Json::Value streamTypeJsonValue = requestJsonValue[VssChannelTbl_StreamType]; + + Json::Value streamTypeJsonValue = requestJsonValue[VssChannelTbl_StreamType]; if (streamTypeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addStreamType(streamTypeJsonValue.asInt()); + vssChannelTblBuilder.addStreamType(std::stoi((streamTypeJsonValue.asString()))); } - - Json::Value dMarkerJsonValue = requestJsonValue[VssChannelTbl_DMarker]; + + Json::Value dMarkerJsonValue = requestJsonValue[VssChannelTbl_DMarker]; if (dMarkerJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addDMarker(dMarkerJsonValue.asInt()); + vssChannelTblBuilder.addDMarker(std::stoi((dMarkerJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssChannelTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssChannelTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssChannelTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - auto keyValuesToAdd = vssChannelTblBuilder.buildVssChannelTblMap(); - if (keyValuesToAdd.size() > 0) { - mysqlpp::SimpleResult addVssChannelTblResult = VssChannelTblDao::instance()->addVssChannelTbl(keyValuesToAdd); - if (addVssChannelTblResult.rows() > 0) { - responseJsonValue["success"] = "true"; - responseJsonValue["message"] = "娣诲姞鎴愬姛锛�"; - } + auto keyValuesToAdd = vssChannelTblBuilder.buildVssChannelTblMap(); + if (keyValuesToAdd.size() > 0) { + mysqlpp::SimpleResult addVssChannelTblResult = VssChannelTblDao::instance()->addVssChannelTbl(keyValuesToAdd); + if (addVssChannelTblResult.rows() > 0) { + responseJsonValue["success"] = "true"; + responseJsonValue["message"] = "娣诲姞鎴愬姛锛�"; + } } } return responseJsonValue.toStyledString(); } - + /** 鍒犻櫎鍒涘缓浜岀骇璁惧琛� */ std::string delVssChannelTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -199,19 +199,19 @@ responseJsonValue["message"] = "鍒犻櫎澶辫触锛�"; responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { - Json::Value iDJsonValue = requestJsonValue[VssChannelTbl_ID]; - if (iDJsonValue.type() != Json::ValueType::nullValue) { - string iDValue = iDJsonValue.asString(); + Json::Value iDJsonValue = requestJsonValue[VssChannelTbl_ID]; + if (iDJsonValue.type() != Json::ValueType::nullValue) { + string iDValue = iDJsonValue.asString(); if (iDValue.size() > 0 && VssChannelTblDao::instance()->deleteByColumn("ID", iDValue)) { - responseJsonValue["success"] = "true"; - responseJsonValue["message"] = "鍒犻櫎鎴愬姛!"; - } + responseJsonValue["success"] = "true"; + responseJsonValue["message"] = "鍒犻櫎鎴愬姛!"; + } } - + } return responseJsonValue.toStyledString(); } - + /** 鏇存柊鍒涘缓浜岀骇璁惧琛� */ std::string updateVssChannelTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -221,132 +221,132 @@ responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { VssChannelTblBuilder vssChannelTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssChannelTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssChannelTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addID(iDJsonValue.asInt()); + vssChannelTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value devPubIDJsonValue = requestJsonValue[VssChannelTbl_DevPubID]; + + Json::Value devPubIDJsonValue = requestJsonValue[VssChannelTbl_DevPubID]; if (devPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addDevPubID(devPubIDJsonValue.asString()); + vssChannelTblBuilder.addDevPubID((devPubIDJsonValue.asString())); } - - Json::Value nicknameJsonValue = requestJsonValue[VssChannelTbl_Nickname]; + + Json::Value nicknameJsonValue = requestJsonValue[VssChannelTbl_Nickname]; if (nicknameJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addNickname(nicknameJsonValue.asString()); + vssChannelTblBuilder.addNickname((nicknameJsonValue.asString())); } - - Json::Value chanPubIDJsonValue = requestJsonValue[VssChannelTbl_ChanPubID]; + + Json::Value chanPubIDJsonValue = requestJsonValue[VssChannelTbl_ChanPubID]; if (chanPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addChanPubID(chanPubIDJsonValue.asString()); + vssChannelTblBuilder.addChanPubID((chanPubIDJsonValue.asString())); } - - Json::Value aliveJsonValue = requestJsonValue[VssChannelTbl_Alive]; + + Json::Value aliveJsonValue = requestJsonValue[VssChannelTbl_Alive]; if (aliveJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addAlive(aliveJsonValue.asInt()); + vssChannelTblBuilder.addAlive(std::stoi((aliveJsonValue.asString()))); } - - Json::Value corpIDJsonValue = requestJsonValue[VssChannelTbl_CorpID]; + + Json::Value corpIDJsonValue = requestJsonValue[VssChannelTbl_CorpID]; if (corpIDJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addCorpID(corpIDJsonValue.asString()); + vssChannelTblBuilder.addCorpID((corpIDJsonValue.asString())); } - - Json::Value modelJsonValue = requestJsonValue[VssChannelTbl_Model]; + + Json::Value modelJsonValue = requestJsonValue[VssChannelTbl_Model]; if (modelJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addModel(modelJsonValue.asString()); + vssChannelTblBuilder.addModel((modelJsonValue.asString())); } - - Json::Value ownerJsonValue = requestJsonValue[VssChannelTbl_Owner]; + + Json::Value ownerJsonValue = requestJsonValue[VssChannelTbl_Owner]; if (ownerJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addOwner(ownerJsonValue.asString()); + vssChannelTblBuilder.addOwner((ownerJsonValue.asString())); } - - Json::Value civilCodeJsonValue = requestJsonValue[VssChannelTbl_CivilCode]; + + Json::Value civilCodeJsonValue = requestJsonValue[VssChannelTbl_CivilCode]; if (civilCodeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addCivilCode(civilCodeJsonValue.asString()); + vssChannelTblBuilder.addCivilCode((civilCodeJsonValue.asString())); } - - Json::Value addressJsonValue = requestJsonValue[VssChannelTbl_Address]; + + Json::Value addressJsonValue = requestJsonValue[VssChannelTbl_Address]; if (addressJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addAddress(addressJsonValue.asString()); + vssChannelTblBuilder.addAddress((addressJsonValue.asString())); } - - Json::Value parentalJsonValue = requestJsonValue[VssChannelTbl_Parental]; + + Json::Value parentalJsonValue = requestJsonValue[VssChannelTbl_Parental]; if (parentalJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addParental(parentalJsonValue.asInt()); + vssChannelTblBuilder.addParental(std::stoi((parentalJsonValue.asString()))); } - - Json::Value parentIdJsonValue = requestJsonValue[VssChannelTbl_ParentId]; + + Json::Value parentIdJsonValue = requestJsonValue[VssChannelTbl_ParentId]; if (parentIdJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addParentId(parentIdJsonValue.asString()); + vssChannelTblBuilder.addParentId((parentIdJsonValue.asString())); } - - Json::Value iPJsonValue = requestJsonValue[VssChannelTbl_IP]; + + Json::Value iPJsonValue = requestJsonValue[VssChannelTbl_IP]; if (iPJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addIP(iPJsonValue.asString()); + vssChannelTblBuilder.addIP((iPJsonValue.asString())); } - - Json::Value portJsonValue = requestJsonValue[VssChannelTbl_Port]; + + Json::Value portJsonValue = requestJsonValue[VssChannelTbl_Port]; if (portJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addPort(portJsonValue.asInt()); + vssChannelTblBuilder.addPort(std::stoi((portJsonValue.asString()))); } - - Json::Value longitudeJsonValue = requestJsonValue[VssChannelTbl_Longitude]; + + Json::Value longitudeJsonValue = requestJsonValue[VssChannelTbl_Longitude]; if (longitudeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addLongitude(longitudeJsonValue.asDouble()); + vssChannelTblBuilder.addLongitude(std::stod((longitudeJsonValue.asString()))); } - - Json::Value latitudeJsonValue = requestJsonValue[VssChannelTbl_Latitude]; + + Json::Value latitudeJsonValue = requestJsonValue[VssChannelTbl_Latitude]; if (latitudeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addLatitude(latitudeJsonValue.asDouble()); + vssChannelTblBuilder.addLatitude(std::stod((latitudeJsonValue.asString()))); } - - Json::Value altitudeJsonValue = requestJsonValue[VssChannelTbl_Altitude]; + + Json::Value altitudeJsonValue = requestJsonValue[VssChannelTbl_Altitude]; if (altitudeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addAltitude(altitudeJsonValue.asDouble()); + vssChannelTblBuilder.addAltitude(std::stod((altitudeJsonValue.asString()))); } - - Json::Value pTZTypeJsonValue = requestJsonValue[VssChannelTbl_PTZType]; + + Json::Value pTZTypeJsonValue = requestJsonValue[VssChannelTbl_PTZType]; if (pTZTypeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addPTZType(pTZTypeJsonValue.asInt()); + vssChannelTblBuilder.addPTZType(std::stoi((pTZTypeJsonValue.asString()))); } - - Json::Value roomTypeJsonValue = requestJsonValue[VssChannelTbl_RoomType]; + + Json::Value roomTypeJsonValue = requestJsonValue[VssChannelTbl_RoomType]; if (roomTypeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addRoomType(roomTypeJsonValue.asInt()); + vssChannelTblBuilder.addRoomType(std::stoi((roomTypeJsonValue.asString()))); } - - Json::Value directionTypeJsonValue = requestJsonValue[VssChannelTbl_DirectionType]; + + Json::Value directionTypeJsonValue = requestJsonValue[VssChannelTbl_DirectionType]; if (directionTypeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addDirectionType(directionTypeJsonValue.asInt()); + vssChannelTblBuilder.addDirectionType(std::stoi((directionTypeJsonValue.asString()))); } - - Json::Value streamTypeJsonValue = requestJsonValue[VssChannelTbl_StreamType]; + + Json::Value streamTypeJsonValue = requestJsonValue[VssChannelTbl_StreamType]; if (streamTypeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addStreamType(streamTypeJsonValue.asInt()); + vssChannelTblBuilder.addStreamType(std::stoi((streamTypeJsonValue.asString()))); } - - Json::Value dMarkerJsonValue = requestJsonValue[VssChannelTbl_DMarker]; + + Json::Value dMarkerJsonValue = requestJsonValue[VssChannelTbl_DMarker]; if (dMarkerJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addDMarker(dMarkerJsonValue.asInt()); + vssChannelTblBuilder.addDMarker(std::stoi((dMarkerJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssChannelTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssChannelTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssChannelTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - if (iDJsonValue.type() != Json::ValueType::nullValue) { - string iDValue = iDJsonValue.asString(); + if (iDJsonValue.type() != Json::ValueType::nullValue) { + string iDValue = iDJsonValue.asString(); if (iDValue.size() > 0 && VssChannelTblDao::instance()->updateVssChannelTbl(vssChannelTblBuilder.buildVssChannelTblMap(), "ID", iDValue)) { - responseJsonValue["success"] = "true"; - responseJsonValue["message"] = "鏇存柊鎴愬姛锛�"; - } + responseJsonValue["success"] = "true"; + responseJsonValue["message"] = "鏇存柊鎴愬姛锛�"; + } } } return responseJsonValue.toStyledString(); } - + /** 鏌ユ壘鍗曚釜鍒涘缓浜岀骇璁惧琛� */ std::string findVssChannelTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -356,128 +356,128 @@ responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { VssChannelTblBuilder vssChannelTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssChannelTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssChannelTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addID(iDJsonValue.asInt()); + vssChannelTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value devPubIDJsonValue = requestJsonValue[VssChannelTbl_DevPubID]; + + Json::Value devPubIDJsonValue = requestJsonValue[VssChannelTbl_DevPubID]; if (devPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addDevPubID(devPubIDJsonValue.asString()); + vssChannelTblBuilder.addDevPubID((devPubIDJsonValue.asString())); } - - Json::Value nicknameJsonValue = requestJsonValue[VssChannelTbl_Nickname]; + + Json::Value nicknameJsonValue = requestJsonValue[VssChannelTbl_Nickname]; if (nicknameJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addNickname(nicknameJsonValue.asString()); + vssChannelTblBuilder.addNickname((nicknameJsonValue.asString())); } - - Json::Value chanPubIDJsonValue = requestJsonValue[VssChannelTbl_ChanPubID]; + + Json::Value chanPubIDJsonValue = requestJsonValue[VssChannelTbl_ChanPubID]; if (chanPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addChanPubID(chanPubIDJsonValue.asString()); + vssChannelTblBuilder.addChanPubID((chanPubIDJsonValue.asString())); } - - Json::Value aliveJsonValue = requestJsonValue[VssChannelTbl_Alive]; + + Json::Value aliveJsonValue = requestJsonValue[VssChannelTbl_Alive]; if (aliveJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addAlive(aliveJsonValue.asInt()); + vssChannelTblBuilder.addAlive(std::stoi((aliveJsonValue.asString()))); } - - Json::Value corpIDJsonValue = requestJsonValue[VssChannelTbl_CorpID]; + + Json::Value corpIDJsonValue = requestJsonValue[VssChannelTbl_CorpID]; if (corpIDJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addCorpID(corpIDJsonValue.asString()); + vssChannelTblBuilder.addCorpID((corpIDJsonValue.asString())); } - - Json::Value modelJsonValue = requestJsonValue[VssChannelTbl_Model]; + + Json::Value modelJsonValue = requestJsonValue[VssChannelTbl_Model]; if (modelJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addModel(modelJsonValue.asString()); + vssChannelTblBuilder.addModel((modelJsonValue.asString())); } - - Json::Value ownerJsonValue = requestJsonValue[VssChannelTbl_Owner]; + + Json::Value ownerJsonValue = requestJsonValue[VssChannelTbl_Owner]; if (ownerJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addOwner(ownerJsonValue.asString()); + vssChannelTblBuilder.addOwner((ownerJsonValue.asString())); } - - Json::Value civilCodeJsonValue = requestJsonValue[VssChannelTbl_CivilCode]; + + Json::Value civilCodeJsonValue = requestJsonValue[VssChannelTbl_CivilCode]; if (civilCodeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addCivilCode(civilCodeJsonValue.asString()); + vssChannelTblBuilder.addCivilCode((civilCodeJsonValue.asString())); } - - Json::Value addressJsonValue = requestJsonValue[VssChannelTbl_Address]; + + Json::Value addressJsonValue = requestJsonValue[VssChannelTbl_Address]; if (addressJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addAddress(addressJsonValue.asString()); + vssChannelTblBuilder.addAddress((addressJsonValue.asString())); } - - Json::Value parentalJsonValue = requestJsonValue[VssChannelTbl_Parental]; + + Json::Value parentalJsonValue = requestJsonValue[VssChannelTbl_Parental]; if (parentalJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addParental(parentalJsonValue.asInt()); + vssChannelTblBuilder.addParental(std::stoi((parentalJsonValue.asString()))); } - - Json::Value parentIdJsonValue = requestJsonValue[VssChannelTbl_ParentId]; + + Json::Value parentIdJsonValue = requestJsonValue[VssChannelTbl_ParentId]; if (parentIdJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addParentId(parentIdJsonValue.asString()); + vssChannelTblBuilder.addParentId((parentIdJsonValue.asString())); } - - Json::Value iPJsonValue = requestJsonValue[VssChannelTbl_IP]; + + Json::Value iPJsonValue = requestJsonValue[VssChannelTbl_IP]; if (iPJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addIP(iPJsonValue.asString()); + vssChannelTblBuilder.addIP((iPJsonValue.asString())); } - - Json::Value portJsonValue = requestJsonValue[VssChannelTbl_Port]; + + Json::Value portJsonValue = requestJsonValue[VssChannelTbl_Port]; if (portJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addPort(portJsonValue.asInt()); + vssChannelTblBuilder.addPort(std::stoi((portJsonValue.asString()))); } - - Json::Value longitudeJsonValue = requestJsonValue[VssChannelTbl_Longitude]; + + Json::Value longitudeJsonValue = requestJsonValue[VssChannelTbl_Longitude]; if (longitudeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addLongitude(longitudeJsonValue.asDouble()); + vssChannelTblBuilder.addLongitude(std::stod((longitudeJsonValue.asString()))); } - - Json::Value latitudeJsonValue = requestJsonValue[VssChannelTbl_Latitude]; + + Json::Value latitudeJsonValue = requestJsonValue[VssChannelTbl_Latitude]; if (latitudeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addLatitude(latitudeJsonValue.asDouble()); + vssChannelTblBuilder.addLatitude(std::stod((latitudeJsonValue.asString()))); } - - Json::Value altitudeJsonValue = requestJsonValue[VssChannelTbl_Altitude]; + + Json::Value altitudeJsonValue = requestJsonValue[VssChannelTbl_Altitude]; if (altitudeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addAltitude(altitudeJsonValue.asDouble()); + vssChannelTblBuilder.addAltitude(std::stod((altitudeJsonValue.asString()))); } - - Json::Value pTZTypeJsonValue = requestJsonValue[VssChannelTbl_PTZType]; + + Json::Value pTZTypeJsonValue = requestJsonValue[VssChannelTbl_PTZType]; if (pTZTypeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addPTZType(pTZTypeJsonValue.asInt()); + vssChannelTblBuilder.addPTZType(std::stoi((pTZTypeJsonValue.asString()))); } - - Json::Value roomTypeJsonValue = requestJsonValue[VssChannelTbl_RoomType]; + + Json::Value roomTypeJsonValue = requestJsonValue[VssChannelTbl_RoomType]; if (roomTypeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addRoomType(roomTypeJsonValue.asInt()); + vssChannelTblBuilder.addRoomType(std::stoi((roomTypeJsonValue.asString()))); } - - Json::Value directionTypeJsonValue = requestJsonValue[VssChannelTbl_DirectionType]; + + Json::Value directionTypeJsonValue = requestJsonValue[VssChannelTbl_DirectionType]; if (directionTypeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addDirectionType(directionTypeJsonValue.asInt()); + vssChannelTblBuilder.addDirectionType(std::stoi((directionTypeJsonValue.asString()))); } - - Json::Value streamTypeJsonValue = requestJsonValue[VssChannelTbl_StreamType]; + + Json::Value streamTypeJsonValue = requestJsonValue[VssChannelTbl_StreamType]; if (streamTypeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addStreamType(streamTypeJsonValue.asInt()); + vssChannelTblBuilder.addStreamType(std::stoi((streamTypeJsonValue.asString()))); } - - Json::Value dMarkerJsonValue = requestJsonValue[VssChannelTbl_DMarker]; + + Json::Value dMarkerJsonValue = requestJsonValue[VssChannelTbl_DMarker]; if (dMarkerJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addDMarker(dMarkerJsonValue.asInt()); + vssChannelTblBuilder.addDMarker(std::stoi((dMarkerJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssChannelTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssChannelTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssChannelTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; - responseJsonValue["success"] = "true"; - responseJsonValue["data"] = VssChannelTblDao::instance()->findJsonArray(string("select * from ") + VSSChannelTbl_TABLE_NAME + " where 1 = 1 limit 1"); + responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; + responseJsonValue["success"] = "true"; + responseJsonValue["data"] = VssChannelTblDao::instance()->findJsonArray(string("select * from ") + VSSChannelTbl_TABLE_NAME + " where 1 = 1 limit 1"); } return responseJsonValue.toStyledString(); } - + /** 鏌ユ壘鍒涘缓浜岀骇璁惧琛ㄥ垪琛� */ std::string findVssChannelTblList(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -487,124 +487,124 @@ responseJsonValue["success"] = "false"; if (content == "" || requestJsonReader.parse(content, requestJsonValue)) { VssChannelTblBuilder vssChannelTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssChannelTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssChannelTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addID(iDJsonValue.asInt()); + vssChannelTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value devPubIDJsonValue = requestJsonValue[VssChannelTbl_DevPubID]; + + Json::Value devPubIDJsonValue = requestJsonValue[VssChannelTbl_DevPubID]; if (devPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addDevPubID(devPubIDJsonValue.asString()); + vssChannelTblBuilder.addDevPubID((devPubIDJsonValue.asString())); } - - Json::Value nicknameJsonValue = requestJsonValue[VssChannelTbl_Nickname]; + + Json::Value nicknameJsonValue = requestJsonValue[VssChannelTbl_Nickname]; if (nicknameJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addNickname(nicknameJsonValue.asString()); + vssChannelTblBuilder.addNickname((nicknameJsonValue.asString())); } - - Json::Value chanPubIDJsonValue = requestJsonValue[VssChannelTbl_ChanPubID]; + + Json::Value chanPubIDJsonValue = requestJsonValue[VssChannelTbl_ChanPubID]; if (chanPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addChanPubID(chanPubIDJsonValue.asString()); + vssChannelTblBuilder.addChanPubID((chanPubIDJsonValue.asString())); } - - Json::Value aliveJsonValue = requestJsonValue[VssChannelTbl_Alive]; + + Json::Value aliveJsonValue = requestJsonValue[VssChannelTbl_Alive]; if (aliveJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addAlive(aliveJsonValue.asInt()); + vssChannelTblBuilder.addAlive(std::stoi((aliveJsonValue.asString()))); } - - Json::Value corpIDJsonValue = requestJsonValue[VssChannelTbl_CorpID]; + + Json::Value corpIDJsonValue = requestJsonValue[VssChannelTbl_CorpID]; if (corpIDJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addCorpID(corpIDJsonValue.asString()); + vssChannelTblBuilder.addCorpID((corpIDJsonValue.asString())); } - - Json::Value modelJsonValue = requestJsonValue[VssChannelTbl_Model]; + + Json::Value modelJsonValue = requestJsonValue[VssChannelTbl_Model]; if (modelJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addModel(modelJsonValue.asString()); + vssChannelTblBuilder.addModel((modelJsonValue.asString())); } - - Json::Value ownerJsonValue = requestJsonValue[VssChannelTbl_Owner]; + + Json::Value ownerJsonValue = requestJsonValue[VssChannelTbl_Owner]; if (ownerJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addOwner(ownerJsonValue.asString()); + vssChannelTblBuilder.addOwner((ownerJsonValue.asString())); } - - Json::Value civilCodeJsonValue = requestJsonValue[VssChannelTbl_CivilCode]; + + Json::Value civilCodeJsonValue = requestJsonValue[VssChannelTbl_CivilCode]; if (civilCodeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addCivilCode(civilCodeJsonValue.asString()); + vssChannelTblBuilder.addCivilCode((civilCodeJsonValue.asString())); } - - Json::Value addressJsonValue = requestJsonValue[VssChannelTbl_Address]; + + Json::Value addressJsonValue = requestJsonValue[VssChannelTbl_Address]; if (addressJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addAddress(addressJsonValue.asString()); + vssChannelTblBuilder.addAddress((addressJsonValue.asString())); } - - Json::Value parentalJsonValue = requestJsonValue[VssChannelTbl_Parental]; + + Json::Value parentalJsonValue = requestJsonValue[VssChannelTbl_Parental]; if (parentalJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addParental(parentalJsonValue.asInt()); + vssChannelTblBuilder.addParental(std::stoi((parentalJsonValue.asString()))); } - - Json::Value parentIdJsonValue = requestJsonValue[VssChannelTbl_ParentId]; + + Json::Value parentIdJsonValue = requestJsonValue[VssChannelTbl_ParentId]; if (parentIdJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addParentId(parentIdJsonValue.asString()); + vssChannelTblBuilder.addParentId((parentIdJsonValue.asString())); } - - Json::Value iPJsonValue = requestJsonValue[VssChannelTbl_IP]; + + Json::Value iPJsonValue = requestJsonValue[VssChannelTbl_IP]; if (iPJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addIP(iPJsonValue.asString()); + vssChannelTblBuilder.addIP((iPJsonValue.asString())); } - - Json::Value portJsonValue = requestJsonValue[VssChannelTbl_Port]; + + Json::Value portJsonValue = requestJsonValue[VssChannelTbl_Port]; if (portJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addPort(portJsonValue.asInt()); + vssChannelTblBuilder.addPort(std::stoi((portJsonValue.asString()))); } - - Json::Value longitudeJsonValue = requestJsonValue[VssChannelTbl_Longitude]; + + Json::Value longitudeJsonValue = requestJsonValue[VssChannelTbl_Longitude]; if (longitudeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addLongitude(longitudeJsonValue.asDouble()); + vssChannelTblBuilder.addLongitude(std::stod((longitudeJsonValue.asString()))); } - - Json::Value latitudeJsonValue = requestJsonValue[VssChannelTbl_Latitude]; + + Json::Value latitudeJsonValue = requestJsonValue[VssChannelTbl_Latitude]; if (latitudeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addLatitude(latitudeJsonValue.asDouble()); + vssChannelTblBuilder.addLatitude(std::stod((latitudeJsonValue.asString()))); } - - Json::Value altitudeJsonValue = requestJsonValue[VssChannelTbl_Altitude]; + + Json::Value altitudeJsonValue = requestJsonValue[VssChannelTbl_Altitude]; if (altitudeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addAltitude(altitudeJsonValue.asDouble()); + vssChannelTblBuilder.addAltitude(std::stod((altitudeJsonValue.asString()))); } - - Json::Value pTZTypeJsonValue = requestJsonValue[VssChannelTbl_PTZType]; + + Json::Value pTZTypeJsonValue = requestJsonValue[VssChannelTbl_PTZType]; if (pTZTypeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addPTZType(pTZTypeJsonValue.asInt()); + vssChannelTblBuilder.addPTZType(std::stoi((pTZTypeJsonValue.asString()))); } - - Json::Value roomTypeJsonValue = requestJsonValue[VssChannelTbl_RoomType]; + + Json::Value roomTypeJsonValue = requestJsonValue[VssChannelTbl_RoomType]; if (roomTypeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addRoomType(roomTypeJsonValue.asInt()); + vssChannelTblBuilder.addRoomType(std::stoi((roomTypeJsonValue.asString()))); } - - Json::Value directionTypeJsonValue = requestJsonValue[VssChannelTbl_DirectionType]; + + Json::Value directionTypeJsonValue = requestJsonValue[VssChannelTbl_DirectionType]; if (directionTypeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addDirectionType(directionTypeJsonValue.asInt()); + vssChannelTblBuilder.addDirectionType(std::stoi((directionTypeJsonValue.asString()))); } - - Json::Value streamTypeJsonValue = requestJsonValue[VssChannelTbl_StreamType]; + + Json::Value streamTypeJsonValue = requestJsonValue[VssChannelTbl_StreamType]; if (streamTypeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addStreamType(streamTypeJsonValue.asInt()); + vssChannelTblBuilder.addStreamType(std::stoi((streamTypeJsonValue.asString()))); } - - Json::Value dMarkerJsonValue = requestJsonValue[VssChannelTbl_DMarker]; + + Json::Value dMarkerJsonValue = requestJsonValue[VssChannelTbl_DMarker]; if (dMarkerJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addDMarker(dMarkerJsonValue.asInt()); + vssChannelTblBuilder.addDMarker(std::stoi((dMarkerJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssChannelTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssChannelTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssChannelTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssChannelTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; - responseJsonValue["success"] = "true"; - responseJsonValue["data"] = VssChannelTblDao::instance()->findJsonArray(string("select * from ") + VSSChannelTbl_TABLE_NAME + " where 1 = 1"); + responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; + responseJsonValue["success"] = "true"; + responseJsonValue["data"] = VssChannelTblDao::instance()->findJsonArray(string("select * from ") + VSSChannelTbl_TABLE_NAME + " where 1 = 1"); } return responseJsonValue.toStyledString(); diff --git a/QiaoJiaSystem/DataManagerServer/vss/controller/VssDevTblController.h b/QiaoJiaSystem/DataManagerServer/vss/controller/VssDevTblController.h index 94a3377..c8d7c94 100755 --- a/QiaoJiaSystem/DataManagerServer/vss/controller/VssDevTblController.h +++ b/QiaoJiaSystem/DataManagerServer/vss/controller/VssDevTblController.h @@ -16,46 +16,46 @@ */ class VssDevTblController : public VssBaseController { private: - /** 鍒涘缓涓�绾ц澶囪〃鏋勯�犲嚱鏁� */ - VssDevTblController() {} + /** 鍒涘缓涓�绾ц澶囪〃鏋勯�犲嚱鏁� */ + VssDevTblController() {} public: - /** 鍒涘缓涓�绾ц澶囪〃鍗曚緥妯″紡 */ + /** 鍒涘缓涓�绾ц澶囪〃鍗曚緥妯″紡 */ static VssDevTblController* instance() { static VssDevTblController instance; return &instance; } public: - /** 娉ㄥ唽{label}http鏈嶅姟 */ + /** 娉ㄥ唽{label}http鏈嶅姟 */ void registerHttpServices(HttpSrvRetRecieve& _HttpSrvRetRecieve) { - _HttpSrvRetRecieve.setInfo("^/addVssDevTbl$", "POST", - std::bind(&VssDevTblController::addVssDevTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/delVssDevTbl$", "POST", - std::bind(&VssDevTblController::delVssDevTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/updateVssDevTbl$", "POST", - std::bind(&VssDevTblController::updateVssDevTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/findVssDevTbl$", "POST", - std::bind(&VssDevTblController::findVssDevTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/findVssDevTblList$", "POST", - std::bind(&VssDevTblController::findVssDevTblList, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); + _HttpSrvRetRecieve.setInfo("^/addVssDevTbl$", "POST", + std::bind(&VssDevTblController::addVssDevTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/delVssDevTbl$", "POST", + std::bind(&VssDevTblController::delVssDevTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/updateVssDevTbl$", "POST", + std::bind(&VssDevTblController::updateVssDevTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/findVssDevTbl$", "POST", + std::bind(&VssDevTblController::findVssDevTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/findVssDevTblList$", "POST", + std::bind(&VssDevTblController::findVssDevTblList, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); } public: - /** 娣诲姞鍒涘缓涓�绾ц澶囪〃 */ + /** 娣诲姞鍒涘缓涓�绾ц澶囪〃 */ std::string addVssDevTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; Json::Value requestJsonValue; @@ -64,73 +64,73 @@ responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { VssDevTblBuilder vssDevTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssDevTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssDevTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addID(iDJsonValue.asInt()); + vssDevTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value devPubIDJsonValue = requestJsonValue[VssDevTbl_DevPubID]; + + Json::Value devPubIDJsonValue = requestJsonValue[VssDevTbl_DevPubID]; if (devPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addDevPubID(devPubIDJsonValue.asString()); + vssDevTblBuilder.addDevPubID((devPubIDJsonValue.asString())); } - - Json::Value devNicknameJsonValue = requestJsonValue[VssDevTbl_DevNickname]; + + Json::Value devNicknameJsonValue = requestJsonValue[VssDevTbl_DevNickname]; if (devNicknameJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addDevNickname(devNicknameJsonValue.asString()); + vssDevTblBuilder.addDevNickname((devNicknameJsonValue.asString())); } - - Json::Value userNameJsonValue = requestJsonValue[VssDevTbl_UserName]; + + Json::Value userNameJsonValue = requestJsonValue[VssDevTbl_UserName]; if (userNameJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addUserName(userNameJsonValue.asString()); + vssDevTblBuilder.addUserName((userNameJsonValue.asString())); } - - Json::Value passwdJsonValue = requestJsonValue[VssDevTbl_Passwd]; + + Json::Value passwdJsonValue = requestJsonValue[VssDevTbl_Passwd]; if (passwdJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addPasswd(passwdJsonValue.asString()); + vssDevTblBuilder.addPasswd((passwdJsonValue.asString())); } - - Json::Value corpIDJsonValue = requestJsonValue[VssDevTbl_CorpID]; + + Json::Value corpIDJsonValue = requestJsonValue[VssDevTbl_CorpID]; if (corpIDJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addCorpID(corpIDJsonValue.asString()); + vssDevTblBuilder.addCorpID((corpIDJsonValue.asString())); } - - Json::Value iPJsonValue = requestJsonValue[VssDevTbl_IP]; + + Json::Value iPJsonValue = requestJsonValue[VssDevTbl_IP]; if (iPJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addIP(iPJsonValue.asString()); + vssDevTblBuilder.addIP((iPJsonValue.asString())); } - - Json::Value portJsonValue = requestJsonValue[VssDevTbl_Port]; + + Json::Value portJsonValue = requestJsonValue[VssDevTbl_Port]; if (portJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addPort(portJsonValue.asInt()); + vssDevTblBuilder.addPort(std::stoi((portJsonValue.asString()))); } - - Json::Value aliveJsonValue = requestJsonValue[VssDevTbl_Alive]; + + Json::Value aliveJsonValue = requestJsonValue[VssDevTbl_Alive]; if (aliveJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addAlive(aliveJsonValue.asInt()); + vssDevTblBuilder.addAlive(std::stoi((aliveJsonValue.asString()))); } - - Json::Value dMarkerJsonValue = requestJsonValue[VssDevTbl_DMarker]; + + Json::Value dMarkerJsonValue = requestJsonValue[VssDevTbl_DMarker]; if (dMarkerJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addDMarker(dMarkerJsonValue.asInt()); + vssDevTblBuilder.addDMarker(std::stoi((dMarkerJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssDevTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssDevTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssDevTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - auto keyValuesToAdd = vssDevTblBuilder.buildVssDevTblMap(); - if (keyValuesToAdd.size() > 0) { - mysqlpp::SimpleResult addVssDevTblResult = VssDevTblDao::instance()->addVssDevTbl(keyValuesToAdd); - if (addVssDevTblResult.rows() > 0) { - responseJsonValue["success"] = "true"; - responseJsonValue["message"] = "娣诲姞鎴愬姛锛�"; - } + auto keyValuesToAdd = vssDevTblBuilder.buildVssDevTblMap(); + if (keyValuesToAdd.size() > 0) { + mysqlpp::SimpleResult addVssDevTblResult = VssDevTblDao::instance()->addVssDevTbl(keyValuesToAdd); + if (addVssDevTblResult.rows() > 0) { + responseJsonValue["success"] = "true"; + responseJsonValue["message"] = "娣诲姞鎴愬姛锛�"; + } } } return responseJsonValue.toStyledString(); } - + /** 鍒犻櫎鍒涘缓涓�绾ц澶囪〃 */ std::string delVssDevTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -139,19 +139,19 @@ responseJsonValue["message"] = "鍒犻櫎澶辫触锛�"; responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { - Json::Value iDJsonValue = requestJsonValue[VssDevTbl_ID]; - if (iDJsonValue.type() != Json::ValueType::nullValue) { - string iDValue = iDJsonValue.asString(); + Json::Value iDJsonValue = requestJsonValue[VssDevTbl_ID]; + if (iDJsonValue.type() != Json::ValueType::nullValue) { + string iDValue = iDJsonValue.asString(); if (iDValue.size() > 0 && VssDevTblDao::instance()->deleteByColumn("ID", iDValue)) { - responseJsonValue["success"] = "true"; - responseJsonValue["message"] = "鍒犻櫎鎴愬姛!"; - } + responseJsonValue["success"] = "true"; + responseJsonValue["message"] = "鍒犻櫎鎴愬姛!"; + } } - + } return responseJsonValue.toStyledString(); } - + /** 鏇存柊鍒涘缓涓�绾ц澶囪〃 */ std::string updateVssDevTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -161,72 +161,72 @@ responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { VssDevTblBuilder vssDevTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssDevTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssDevTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addID(iDJsonValue.asInt()); + vssDevTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value devPubIDJsonValue = requestJsonValue[VssDevTbl_DevPubID]; + + Json::Value devPubIDJsonValue = requestJsonValue[VssDevTbl_DevPubID]; if (devPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addDevPubID(devPubIDJsonValue.asString()); + vssDevTblBuilder.addDevPubID((devPubIDJsonValue.asString())); } - - Json::Value devNicknameJsonValue = requestJsonValue[VssDevTbl_DevNickname]; + + Json::Value devNicknameJsonValue = requestJsonValue[VssDevTbl_DevNickname]; if (devNicknameJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addDevNickname(devNicknameJsonValue.asString()); + vssDevTblBuilder.addDevNickname((devNicknameJsonValue.asString())); } - - Json::Value userNameJsonValue = requestJsonValue[VssDevTbl_UserName]; + + Json::Value userNameJsonValue = requestJsonValue[VssDevTbl_UserName]; if (userNameJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addUserName(userNameJsonValue.asString()); + vssDevTblBuilder.addUserName((userNameJsonValue.asString())); } - - Json::Value passwdJsonValue = requestJsonValue[VssDevTbl_Passwd]; + + Json::Value passwdJsonValue = requestJsonValue[VssDevTbl_Passwd]; if (passwdJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addPasswd(passwdJsonValue.asString()); + vssDevTblBuilder.addPasswd((passwdJsonValue.asString())); } - - Json::Value corpIDJsonValue = requestJsonValue[VssDevTbl_CorpID]; + + Json::Value corpIDJsonValue = requestJsonValue[VssDevTbl_CorpID]; if (corpIDJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addCorpID(corpIDJsonValue.asString()); + vssDevTblBuilder.addCorpID((corpIDJsonValue.asString())); } - - Json::Value iPJsonValue = requestJsonValue[VssDevTbl_IP]; + + Json::Value iPJsonValue = requestJsonValue[VssDevTbl_IP]; if (iPJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addIP(iPJsonValue.asString()); + vssDevTblBuilder.addIP((iPJsonValue.asString())); } - - Json::Value portJsonValue = requestJsonValue[VssDevTbl_Port]; + + Json::Value portJsonValue = requestJsonValue[VssDevTbl_Port]; if (portJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addPort(portJsonValue.asInt()); + vssDevTblBuilder.addPort(std::stoi((portJsonValue.asString()))); } - - Json::Value aliveJsonValue = requestJsonValue[VssDevTbl_Alive]; + + Json::Value aliveJsonValue = requestJsonValue[VssDevTbl_Alive]; if (aliveJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addAlive(aliveJsonValue.asInt()); + vssDevTblBuilder.addAlive(std::stoi((aliveJsonValue.asString()))); } - - Json::Value dMarkerJsonValue = requestJsonValue[VssDevTbl_DMarker]; + + Json::Value dMarkerJsonValue = requestJsonValue[VssDevTbl_DMarker]; if (dMarkerJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addDMarker(dMarkerJsonValue.asInt()); + vssDevTblBuilder.addDMarker(std::stoi((dMarkerJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssDevTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssDevTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssDevTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - if (iDJsonValue.type() != Json::ValueType::nullValue) { - string iDValue = iDJsonValue.asString(); + if (iDJsonValue.type() != Json::ValueType::nullValue) { + string iDValue = iDJsonValue.asString(); if (iDValue.size() > 0 && VssDevTblDao::instance()->updateVssDevTbl(vssDevTblBuilder.buildVssDevTblMap(), "ID", iDValue)) { - responseJsonValue["success"] = "true"; - responseJsonValue["message"] = "鏇存柊鎴愬姛锛�"; - } + responseJsonValue["success"] = "true"; + responseJsonValue["message"] = "鏇存柊鎴愬姛锛�"; + } } } return responseJsonValue.toStyledString(); } - + /** 鏌ユ壘鍗曚釜鍒涘缓涓�绾ц澶囪〃 */ std::string findVssDevTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -236,68 +236,68 @@ responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { VssDevTblBuilder vssDevTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssDevTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssDevTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addID(iDJsonValue.asInt()); + vssDevTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value devPubIDJsonValue = requestJsonValue[VssDevTbl_DevPubID]; + + Json::Value devPubIDJsonValue = requestJsonValue[VssDevTbl_DevPubID]; if (devPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addDevPubID(devPubIDJsonValue.asString()); + vssDevTblBuilder.addDevPubID((devPubIDJsonValue.asString())); } - - Json::Value devNicknameJsonValue = requestJsonValue[VssDevTbl_DevNickname]; + + Json::Value devNicknameJsonValue = requestJsonValue[VssDevTbl_DevNickname]; if (devNicknameJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addDevNickname(devNicknameJsonValue.asString()); + vssDevTblBuilder.addDevNickname((devNicknameJsonValue.asString())); } - - Json::Value userNameJsonValue = requestJsonValue[VssDevTbl_UserName]; + + Json::Value userNameJsonValue = requestJsonValue[VssDevTbl_UserName]; if (userNameJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addUserName(userNameJsonValue.asString()); + vssDevTblBuilder.addUserName((userNameJsonValue.asString())); } - - Json::Value passwdJsonValue = requestJsonValue[VssDevTbl_Passwd]; + + Json::Value passwdJsonValue = requestJsonValue[VssDevTbl_Passwd]; if (passwdJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addPasswd(passwdJsonValue.asString()); + vssDevTblBuilder.addPasswd((passwdJsonValue.asString())); } - - Json::Value corpIDJsonValue = requestJsonValue[VssDevTbl_CorpID]; + + Json::Value corpIDJsonValue = requestJsonValue[VssDevTbl_CorpID]; if (corpIDJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addCorpID(corpIDJsonValue.asString()); + vssDevTblBuilder.addCorpID((corpIDJsonValue.asString())); } - - Json::Value iPJsonValue = requestJsonValue[VssDevTbl_IP]; + + Json::Value iPJsonValue = requestJsonValue[VssDevTbl_IP]; if (iPJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addIP(iPJsonValue.asString()); + vssDevTblBuilder.addIP((iPJsonValue.asString())); } - - Json::Value portJsonValue = requestJsonValue[VssDevTbl_Port]; + + Json::Value portJsonValue = requestJsonValue[VssDevTbl_Port]; if (portJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addPort(portJsonValue.asInt()); + vssDevTblBuilder.addPort(std::stoi((portJsonValue.asString()))); } - - Json::Value aliveJsonValue = requestJsonValue[VssDevTbl_Alive]; + + Json::Value aliveJsonValue = requestJsonValue[VssDevTbl_Alive]; if (aliveJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addAlive(aliveJsonValue.asInt()); + vssDevTblBuilder.addAlive(std::stoi((aliveJsonValue.asString()))); } - - Json::Value dMarkerJsonValue = requestJsonValue[VssDevTbl_DMarker]; + + Json::Value dMarkerJsonValue = requestJsonValue[VssDevTbl_DMarker]; if (dMarkerJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addDMarker(dMarkerJsonValue.asInt()); + vssDevTblBuilder.addDMarker(std::stoi((dMarkerJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssDevTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssDevTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssDevTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; - responseJsonValue["success"] = "true"; - responseJsonValue["data"] = VssDevTblDao::instance()->findJsonArray(string("select * from ") + VSSDevTbl_TABLE_NAME + " where 1 = 1 limit 1"); + responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; + responseJsonValue["success"] = "true"; + responseJsonValue["data"] = VssDevTblDao::instance()->findJsonArray(string("select * from ") + VSSDevTbl_TABLE_NAME + " where 1 = 1 limit 1"); } return responseJsonValue.toStyledString(); } - + /** 鏌ユ壘鍒涘缓涓�绾ц澶囪〃鍒楄〃 */ std::string findVssDevTblList(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -307,64 +307,64 @@ responseJsonValue["success"] = "false"; if (content == "" || requestJsonReader.parse(content, requestJsonValue)) { VssDevTblBuilder vssDevTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssDevTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssDevTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addID(iDJsonValue.asInt()); + vssDevTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value devPubIDJsonValue = requestJsonValue[VssDevTbl_DevPubID]; + + Json::Value devPubIDJsonValue = requestJsonValue[VssDevTbl_DevPubID]; if (devPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addDevPubID(devPubIDJsonValue.asString()); + vssDevTblBuilder.addDevPubID((devPubIDJsonValue.asString())); } - - Json::Value devNicknameJsonValue = requestJsonValue[VssDevTbl_DevNickname]; + + Json::Value devNicknameJsonValue = requestJsonValue[VssDevTbl_DevNickname]; if (devNicknameJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addDevNickname(devNicknameJsonValue.asString()); + vssDevTblBuilder.addDevNickname((devNicknameJsonValue.asString())); } - - Json::Value userNameJsonValue = requestJsonValue[VssDevTbl_UserName]; + + Json::Value userNameJsonValue = requestJsonValue[VssDevTbl_UserName]; if (userNameJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addUserName(userNameJsonValue.asString()); + vssDevTblBuilder.addUserName((userNameJsonValue.asString())); } - - Json::Value passwdJsonValue = requestJsonValue[VssDevTbl_Passwd]; + + Json::Value passwdJsonValue = requestJsonValue[VssDevTbl_Passwd]; if (passwdJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addPasswd(passwdJsonValue.asString()); + vssDevTblBuilder.addPasswd((passwdJsonValue.asString())); } - - Json::Value corpIDJsonValue = requestJsonValue[VssDevTbl_CorpID]; + + Json::Value corpIDJsonValue = requestJsonValue[VssDevTbl_CorpID]; if (corpIDJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addCorpID(corpIDJsonValue.asString()); + vssDevTblBuilder.addCorpID((corpIDJsonValue.asString())); } - - Json::Value iPJsonValue = requestJsonValue[VssDevTbl_IP]; + + Json::Value iPJsonValue = requestJsonValue[VssDevTbl_IP]; if (iPJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addIP(iPJsonValue.asString()); + vssDevTblBuilder.addIP((iPJsonValue.asString())); } - - Json::Value portJsonValue = requestJsonValue[VssDevTbl_Port]; + + Json::Value portJsonValue = requestJsonValue[VssDevTbl_Port]; if (portJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addPort(portJsonValue.asInt()); + vssDevTblBuilder.addPort(std::stoi((portJsonValue.asString()))); } - - Json::Value aliveJsonValue = requestJsonValue[VssDevTbl_Alive]; + + Json::Value aliveJsonValue = requestJsonValue[VssDevTbl_Alive]; if (aliveJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addAlive(aliveJsonValue.asInt()); + vssDevTblBuilder.addAlive(std::stoi((aliveJsonValue.asString()))); } - - Json::Value dMarkerJsonValue = requestJsonValue[VssDevTbl_DMarker]; + + Json::Value dMarkerJsonValue = requestJsonValue[VssDevTbl_DMarker]; if (dMarkerJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addDMarker(dMarkerJsonValue.asInt()); + vssDevTblBuilder.addDMarker(std::stoi((dMarkerJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssDevTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssDevTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssDevTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssDevTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; - responseJsonValue["success"] = "true"; - responseJsonValue["data"] = VssDevTblDao::instance()->findJsonArray(string("select * from ") + VSSDevTbl_TABLE_NAME + " where 1 = 1"); + responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; + responseJsonValue["success"] = "true"; + responseJsonValue["data"] = VssDevTblDao::instance()->findJsonArray(string("select * from ") + VSSDevTbl_TABLE_NAME + " where 1 = 1"); } return responseJsonValue.toStyledString(); diff --git a/QiaoJiaSystem/DataManagerServer/vss/controller/VssDomainUnitTblController.h b/QiaoJiaSystem/DataManagerServer/vss/controller/VssDomainUnitTblController.h index 60f05f2..c9674ab 100755 --- a/QiaoJiaSystem/DataManagerServer/vss/controller/VssDomainUnitTblController.h +++ b/QiaoJiaSystem/DataManagerServer/vss/controller/VssDomainUnitTblController.h @@ -16,46 +16,46 @@ */ class VssDomainUnitTblController : public VssBaseController { private: - /** 鍒涘缓涓�绾ц澶囪〃鏋勯�犲嚱鏁� */ - VssDomainUnitTblController() {} + /** 鍒涘缓涓�绾ц澶囪〃鏋勯�犲嚱鏁� */ + VssDomainUnitTblController() {} public: - /** 鍒涘缓涓�绾ц澶囪〃鍗曚緥妯″紡 */ + /** 鍒涘缓涓�绾ц澶囪〃鍗曚緥妯″紡 */ static VssDomainUnitTblController* instance() { static VssDomainUnitTblController instance; return &instance; } public: - /** 娉ㄥ唽{label}http鏈嶅姟 */ + /** 娉ㄥ唽{label}http鏈嶅姟 */ void registerHttpServices(HttpSrvRetRecieve& _HttpSrvRetRecieve) { - _HttpSrvRetRecieve.setInfo("^/addVssDomainUnitTbl$", "POST", - std::bind(&VssDomainUnitTblController::addVssDomainUnitTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/delVssDomainUnitTbl$", "POST", - std::bind(&VssDomainUnitTblController::delVssDomainUnitTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/updateVssDomainUnitTbl$", "POST", - std::bind(&VssDomainUnitTblController::updateVssDomainUnitTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/findVssDomainUnitTbl$", "POST", - std::bind(&VssDomainUnitTblController::findVssDomainUnitTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/findVssDomainUnitTblList$", "POST", - std::bind(&VssDomainUnitTblController::findVssDomainUnitTblList, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); + _HttpSrvRetRecieve.setInfo("^/addVssDomainUnitTbl$", "POST", + std::bind(&VssDomainUnitTblController::addVssDomainUnitTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/delVssDomainUnitTbl$", "POST", + std::bind(&VssDomainUnitTblController::delVssDomainUnitTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/updateVssDomainUnitTbl$", "POST", + std::bind(&VssDomainUnitTblController::updateVssDomainUnitTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/findVssDomainUnitTbl$", "POST", + std::bind(&VssDomainUnitTblController::findVssDomainUnitTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/findVssDomainUnitTblList$", "POST", + std::bind(&VssDomainUnitTblController::findVssDomainUnitTblList, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); } public: - /** 娣诲姞鍒涘缓涓�绾ц澶囪〃 */ + /** 娣诲姞鍒涘缓涓�绾ц澶囪〃 */ std::string addVssDomainUnitTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; Json::Value requestJsonValue; @@ -64,58 +64,58 @@ responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { VssDomainUnitTblBuilder vssDomainUnitTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssDomainUnitTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssDomainUnitTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addID(iDJsonValue.asInt()); + vssDomainUnitTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value devPubIDJsonValue = requestJsonValue[VssDomainUnitTbl_DevPubID]; + + Json::Value devPubIDJsonValue = requestJsonValue[VssDomainUnitTbl_DevPubID]; if (devPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addDevPubID(devPubIDJsonValue.asString()); + vssDomainUnitTblBuilder.addDevPubID((devPubIDJsonValue.asString())); } - - Json::Value domainPubIDJsonValue = requestJsonValue[VssDomainUnitTbl_DomainPubID]; + + Json::Value domainPubIDJsonValue = requestJsonValue[VssDomainUnitTbl_DomainPubID]; if (domainPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addDomainPubID(domainPubIDJsonValue.asString()); + vssDomainUnitTblBuilder.addDomainPubID((domainPubIDJsonValue.asString())); } - - Json::Value nameJsonValue = requestJsonValue[VssDomainUnitTbl_Name]; + + Json::Value nameJsonValue = requestJsonValue[VssDomainUnitTbl_Name]; if (nameJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addName(nameJsonValue.asString()); + vssDomainUnitTblBuilder.addName((nameJsonValue.asString())); } - - Json::Value businessGroupIDJsonValue = requestJsonValue[VssDomainUnitTbl_BusinessGroupID]; + + Json::Value businessGroupIDJsonValue = requestJsonValue[VssDomainUnitTbl_BusinessGroupID]; if (businessGroupIDJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addBusinessGroupID(businessGroupIDJsonValue.asString()); + vssDomainUnitTblBuilder.addBusinessGroupID((businessGroupIDJsonValue.asString())); } - - Json::Value parentIdJsonValue = requestJsonValue[VssDomainUnitTbl_ParentId]; + + Json::Value parentIdJsonValue = requestJsonValue[VssDomainUnitTbl_ParentId]; if (parentIdJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addParentId(parentIdJsonValue.asString()); + vssDomainUnitTblBuilder.addParentId((parentIdJsonValue.asString())); } - - Json::Value domainTypeJsonValue = requestJsonValue[VssDomainUnitTbl_DomainType]; + + Json::Value domainTypeJsonValue = requestJsonValue[VssDomainUnitTbl_DomainType]; if (domainTypeJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addDomainType(domainTypeJsonValue.asInt()); + vssDomainUnitTblBuilder.addDomainType(std::stoi((domainTypeJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssDomainUnitTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssDomainUnitTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssDomainUnitTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - auto keyValuesToAdd = vssDomainUnitTblBuilder.buildVssDomainUnitTblMap(); - if (keyValuesToAdd.size() > 0) { - mysqlpp::SimpleResult addVssDomainUnitTblResult = VssDomainUnitTblDao::instance()->addVssDomainUnitTbl(keyValuesToAdd); - if (addVssDomainUnitTblResult.rows() > 0) { - responseJsonValue["success"] = "true"; - responseJsonValue["message"] = "娣诲姞鎴愬姛锛�"; - } + auto keyValuesToAdd = vssDomainUnitTblBuilder.buildVssDomainUnitTblMap(); + if (keyValuesToAdd.size() > 0) { + mysqlpp::SimpleResult addVssDomainUnitTblResult = VssDomainUnitTblDao::instance()->addVssDomainUnitTbl(keyValuesToAdd); + if (addVssDomainUnitTblResult.rows() > 0) { + responseJsonValue["success"] = "true"; + responseJsonValue["message"] = "娣诲姞鎴愬姛锛�"; + } } } return responseJsonValue.toStyledString(); } - + /** 鍒犻櫎鍒涘缓涓�绾ц澶囪〃 */ std::string delVssDomainUnitTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -124,19 +124,19 @@ responseJsonValue["message"] = "鍒犻櫎澶辫触锛�"; responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { - Json::Value iDJsonValue = requestJsonValue[VssDomainUnitTbl_ID]; - if (iDJsonValue.type() != Json::ValueType::nullValue) { - string iDValue = iDJsonValue.asString(); + Json::Value iDJsonValue = requestJsonValue[VssDomainUnitTbl_ID]; + if (iDJsonValue.type() != Json::ValueType::nullValue) { + string iDValue = iDJsonValue.asString(); if (iDValue.size() > 0 && VssDomainUnitTblDao::instance()->deleteByColumn("ID", iDValue)) { - responseJsonValue["success"] = "true"; - responseJsonValue["message"] = "鍒犻櫎鎴愬姛!"; - } + responseJsonValue["success"] = "true"; + responseJsonValue["message"] = "鍒犻櫎鎴愬姛!"; + } } - + } return responseJsonValue.toStyledString(); } - + /** 鏇存柊鍒涘缓涓�绾ц澶囪〃 */ std::string updateVssDomainUnitTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -146,57 +146,57 @@ responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { VssDomainUnitTblBuilder vssDomainUnitTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssDomainUnitTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssDomainUnitTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addID(iDJsonValue.asInt()); + vssDomainUnitTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value devPubIDJsonValue = requestJsonValue[VssDomainUnitTbl_DevPubID]; + + Json::Value devPubIDJsonValue = requestJsonValue[VssDomainUnitTbl_DevPubID]; if (devPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addDevPubID(devPubIDJsonValue.asString()); + vssDomainUnitTblBuilder.addDevPubID((devPubIDJsonValue.asString())); } - - Json::Value domainPubIDJsonValue = requestJsonValue[VssDomainUnitTbl_DomainPubID]; + + Json::Value domainPubIDJsonValue = requestJsonValue[VssDomainUnitTbl_DomainPubID]; if (domainPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addDomainPubID(domainPubIDJsonValue.asString()); + vssDomainUnitTblBuilder.addDomainPubID((domainPubIDJsonValue.asString())); } - - Json::Value nameJsonValue = requestJsonValue[VssDomainUnitTbl_Name]; + + Json::Value nameJsonValue = requestJsonValue[VssDomainUnitTbl_Name]; if (nameJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addName(nameJsonValue.asString()); + vssDomainUnitTblBuilder.addName((nameJsonValue.asString())); } - - Json::Value businessGroupIDJsonValue = requestJsonValue[VssDomainUnitTbl_BusinessGroupID]; + + Json::Value businessGroupIDJsonValue = requestJsonValue[VssDomainUnitTbl_BusinessGroupID]; if (businessGroupIDJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addBusinessGroupID(businessGroupIDJsonValue.asString()); + vssDomainUnitTblBuilder.addBusinessGroupID((businessGroupIDJsonValue.asString())); } - - Json::Value parentIdJsonValue = requestJsonValue[VssDomainUnitTbl_ParentId]; + + Json::Value parentIdJsonValue = requestJsonValue[VssDomainUnitTbl_ParentId]; if (parentIdJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addParentId(parentIdJsonValue.asString()); + vssDomainUnitTblBuilder.addParentId((parentIdJsonValue.asString())); } - - Json::Value domainTypeJsonValue = requestJsonValue[VssDomainUnitTbl_DomainType]; + + Json::Value domainTypeJsonValue = requestJsonValue[VssDomainUnitTbl_DomainType]; if (domainTypeJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addDomainType(domainTypeJsonValue.asInt()); + vssDomainUnitTblBuilder.addDomainType(std::stoi((domainTypeJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssDomainUnitTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssDomainUnitTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssDomainUnitTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - if (iDJsonValue.type() != Json::ValueType::nullValue) { - string iDValue = iDJsonValue.asString(); + if (iDJsonValue.type() != Json::ValueType::nullValue) { + string iDValue = iDJsonValue.asString(); if (iDValue.size() > 0 && VssDomainUnitTblDao::instance()->updateVssDomainUnitTbl(vssDomainUnitTblBuilder.buildVssDomainUnitTblMap(), "ID", iDValue)) { - responseJsonValue["success"] = "true"; - responseJsonValue["message"] = "鏇存柊鎴愬姛锛�"; - } + responseJsonValue["success"] = "true"; + responseJsonValue["message"] = "鏇存柊鎴愬姛锛�"; + } } } return responseJsonValue.toStyledString(); } - + /** 鏌ユ壘鍗曚釜鍒涘缓涓�绾ц澶囪〃 */ std::string findVssDomainUnitTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -206,53 +206,53 @@ responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { VssDomainUnitTblBuilder vssDomainUnitTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssDomainUnitTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssDomainUnitTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addID(iDJsonValue.asInt()); + vssDomainUnitTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value devPubIDJsonValue = requestJsonValue[VssDomainUnitTbl_DevPubID]; + + Json::Value devPubIDJsonValue = requestJsonValue[VssDomainUnitTbl_DevPubID]; if (devPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addDevPubID(devPubIDJsonValue.asString()); + vssDomainUnitTblBuilder.addDevPubID((devPubIDJsonValue.asString())); } - - Json::Value domainPubIDJsonValue = requestJsonValue[VssDomainUnitTbl_DomainPubID]; + + Json::Value domainPubIDJsonValue = requestJsonValue[VssDomainUnitTbl_DomainPubID]; if (domainPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addDomainPubID(domainPubIDJsonValue.asString()); + vssDomainUnitTblBuilder.addDomainPubID((domainPubIDJsonValue.asString())); } - - Json::Value nameJsonValue = requestJsonValue[VssDomainUnitTbl_Name]; + + Json::Value nameJsonValue = requestJsonValue[VssDomainUnitTbl_Name]; if (nameJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addName(nameJsonValue.asString()); + vssDomainUnitTblBuilder.addName((nameJsonValue.asString())); } - - Json::Value businessGroupIDJsonValue = requestJsonValue[VssDomainUnitTbl_BusinessGroupID]; + + Json::Value businessGroupIDJsonValue = requestJsonValue[VssDomainUnitTbl_BusinessGroupID]; if (businessGroupIDJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addBusinessGroupID(businessGroupIDJsonValue.asString()); + vssDomainUnitTblBuilder.addBusinessGroupID((businessGroupIDJsonValue.asString())); } - - Json::Value parentIdJsonValue = requestJsonValue[VssDomainUnitTbl_ParentId]; + + Json::Value parentIdJsonValue = requestJsonValue[VssDomainUnitTbl_ParentId]; if (parentIdJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addParentId(parentIdJsonValue.asString()); + vssDomainUnitTblBuilder.addParentId((parentIdJsonValue.asString())); } - - Json::Value domainTypeJsonValue = requestJsonValue[VssDomainUnitTbl_DomainType]; + + Json::Value domainTypeJsonValue = requestJsonValue[VssDomainUnitTbl_DomainType]; if (domainTypeJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addDomainType(domainTypeJsonValue.asInt()); + vssDomainUnitTblBuilder.addDomainType(std::stoi((domainTypeJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssDomainUnitTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssDomainUnitTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssDomainUnitTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; - responseJsonValue["success"] = "true"; - responseJsonValue["data"] = VssDomainUnitTblDao::instance()->findJsonArray(string("select * from ") + VSSDomainUnitTbl_TABLE_NAME + " where 1 = 1 limit 1"); + responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; + responseJsonValue["success"] = "true"; + responseJsonValue["data"] = VssDomainUnitTblDao::instance()->findJsonArray(string("select * from ") + VSSDomainUnitTbl_TABLE_NAME + " where 1 = 1 limit 1"); } return responseJsonValue.toStyledString(); } - + /** 鏌ユ壘鍒涘缓涓�绾ц澶囪〃鍒楄〃 */ std::string findVssDomainUnitTblList(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -262,49 +262,49 @@ responseJsonValue["success"] = "false"; if (content == "" || requestJsonReader.parse(content, requestJsonValue)) { VssDomainUnitTblBuilder vssDomainUnitTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssDomainUnitTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssDomainUnitTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addID(iDJsonValue.asInt()); + vssDomainUnitTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value devPubIDJsonValue = requestJsonValue[VssDomainUnitTbl_DevPubID]; + + Json::Value devPubIDJsonValue = requestJsonValue[VssDomainUnitTbl_DevPubID]; if (devPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addDevPubID(devPubIDJsonValue.asString()); + vssDomainUnitTblBuilder.addDevPubID((devPubIDJsonValue.asString())); } - - Json::Value domainPubIDJsonValue = requestJsonValue[VssDomainUnitTbl_DomainPubID]; + + Json::Value domainPubIDJsonValue = requestJsonValue[VssDomainUnitTbl_DomainPubID]; if (domainPubIDJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addDomainPubID(domainPubIDJsonValue.asString()); + vssDomainUnitTblBuilder.addDomainPubID((domainPubIDJsonValue.asString())); } - - Json::Value nameJsonValue = requestJsonValue[VssDomainUnitTbl_Name]; + + Json::Value nameJsonValue = requestJsonValue[VssDomainUnitTbl_Name]; if (nameJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addName(nameJsonValue.asString()); + vssDomainUnitTblBuilder.addName((nameJsonValue.asString())); } - - Json::Value businessGroupIDJsonValue = requestJsonValue[VssDomainUnitTbl_BusinessGroupID]; + + Json::Value businessGroupIDJsonValue = requestJsonValue[VssDomainUnitTbl_BusinessGroupID]; if (businessGroupIDJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addBusinessGroupID(businessGroupIDJsonValue.asString()); + vssDomainUnitTblBuilder.addBusinessGroupID((businessGroupIDJsonValue.asString())); } - - Json::Value parentIdJsonValue = requestJsonValue[VssDomainUnitTbl_ParentId]; + + Json::Value parentIdJsonValue = requestJsonValue[VssDomainUnitTbl_ParentId]; if (parentIdJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addParentId(parentIdJsonValue.asString()); + vssDomainUnitTblBuilder.addParentId((parentIdJsonValue.asString())); } - - Json::Value domainTypeJsonValue = requestJsonValue[VssDomainUnitTbl_DomainType]; + + Json::Value domainTypeJsonValue = requestJsonValue[VssDomainUnitTbl_DomainType]; if (domainTypeJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addDomainType(domainTypeJsonValue.asInt()); + vssDomainUnitTblBuilder.addDomainType(std::stoi((domainTypeJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssDomainUnitTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssDomainUnitTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssDomainUnitTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssDomainUnitTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; - responseJsonValue["success"] = "true"; - responseJsonValue["data"] = VssDomainUnitTblDao::instance()->findJsonArray(string("select * from ") + VSSDomainUnitTbl_TABLE_NAME + " where 1 = 1"); + responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; + responseJsonValue["success"] = "true"; + responseJsonValue["data"] = VssDomainUnitTblDao::instance()->findJsonArray(string("select * from ") + VSSDomainUnitTbl_TABLE_NAME + " where 1 = 1"); } return responseJsonValue.toStyledString(); diff --git a/QiaoJiaSystem/DataManagerServer/vss/controller/VssLocalSettingTblController.h b/QiaoJiaSystem/DataManagerServer/vss/controller/VssLocalSettingTblController.h index 01259ad..589e536 100755 --- a/QiaoJiaSystem/DataManagerServer/vss/controller/VssLocalSettingTblController.h +++ b/QiaoJiaSystem/DataManagerServer/vss/controller/VssLocalSettingTblController.h @@ -68,34 +68,34 @@ Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssLocalSettingTblBuilder.addID(iDJsonValue.asInt()); + vssLocalSettingTblBuilder.addID(std::stoi(iDJsonValue.asString())); } - + Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp]; if (serverIpJsonValue.type() != Json::ValueType::nullValue) { vssLocalSettingTblBuilder.addServerIp(serverIpJsonValue.asString()); } - + Json::Value serverPortJsonValue = requestJsonValue[VssLocalSettingTbl_ServerPort]; if (serverPortJsonValue.type() != Json::ValueType::nullValue) { vssLocalSettingTblBuilder.addServerPort(serverPortJsonValue.asString()); } - + Json::Value serverIdJsonValue = requestJsonValue[VssLocalSettingTbl_ServerId]; if (serverIdJsonValue.type() != Json::ValueType::nullValue) { vssLocalSettingTblBuilder.addServerId(serverIdJsonValue.asString()); } - + Json::Value userAuthIdJsonValue = requestJsonValue[VssLocalSettingTbl_UserAuthId]; if (userAuthIdJsonValue.type() != Json::ValueType::nullValue) { vssLocalSettingTblBuilder.addUserAuthId(userAuthIdJsonValue.asString()); } - + Json::Value passwordJsonValue = requestJsonValue[VssLocalSettingTbl_Password]; if (passwordJsonValue.type() != Json::ValueType::nullValue) { vssLocalSettingTblBuilder.addPassword(passwordJsonValue.asString()); } - + Json::Value updateTimeJsonValue = requestJsonValue[VssLocalSettingTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { vssLocalSettingTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); @@ -107,7 +107,7 @@ } return responseJsonValue.toStyledString(); } - + /** 鍒犻櫎鏈湴鍥芥爣閰嶇疆 */ std::string delVssLocalSettingTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -121,11 +121,11 @@ string iDValue = iDJsonValue.asString(); responseJsonValue = VssLocalSettingTblSqliteDao::instance()->deleteByColumn("ID", iDValue); } - + } return responseJsonValue.toStyledString(); } - + /** 鏇存柊鏈湴鍥芥爣閰嶇疆 */ std::string updateVssLocalSettingTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -135,37 +135,37 @@ responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { VssLocalSettingTblBuilder vssLocalSettingTblBuilder; - + Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssLocalSettingTblBuilder.addID(iDJsonValue.asInt()); + vssLocalSettingTblBuilder.addID(std::stoi(iDJsonValue.asString())); } - + Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp]; if (serverIpJsonValue.type() != Json::ValueType::nullValue) { vssLocalSettingTblBuilder.addServerIp(serverIpJsonValue.asString()); } - + Json::Value serverPortJsonValue = requestJsonValue[VssLocalSettingTbl_ServerPort]; if (serverPortJsonValue.type() != Json::ValueType::nullValue) { vssLocalSettingTblBuilder.addServerPort(serverPortJsonValue.asString()); } - + Json::Value serverIdJsonValue = requestJsonValue[VssLocalSettingTbl_ServerId]; if (serverIdJsonValue.type() != Json::ValueType::nullValue) { vssLocalSettingTblBuilder.addServerId(serverIdJsonValue.asString()); } - + Json::Value userAuthIdJsonValue = requestJsonValue[VssLocalSettingTbl_UserAuthId]; if (userAuthIdJsonValue.type() != Json::ValueType::nullValue) { vssLocalSettingTblBuilder.addUserAuthId(userAuthIdJsonValue.asString()); } - + Json::Value passwordJsonValue = requestJsonValue[VssLocalSettingTbl_Password]; if (passwordJsonValue.type() != Json::ValueType::nullValue) { vssLocalSettingTblBuilder.addPassword(passwordJsonValue.asString()); } - + Json::Value updateTimeJsonValue = requestJsonValue[VssLocalSettingTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { vssLocalSettingTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); @@ -180,7 +180,7 @@ } return responseJsonValue.toStyledString(); } - + /** 鏌ユ壘鍗曚釜鏈湴鍥芥爣閰嶇疆 */ std::string findVssLocalSettingTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -190,37 +190,37 @@ responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { VssLocalSettingTblBuilder vssLocalSettingTblBuilder; - + Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssLocalSettingTblBuilder.addID(iDJsonValue.asInt()); + vssLocalSettingTblBuilder.addID(std::stoi(iDJsonValue.asString())); } - + Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp]; if (serverIpJsonValue.type() != Json::ValueType::nullValue) { vssLocalSettingTblBuilder.addServerIp(serverIpJsonValue.asString()); } - + Json::Value serverPortJsonValue = requestJsonValue[VssLocalSettingTbl_ServerPort]; if (serverPortJsonValue.type() != Json::ValueType::nullValue) { vssLocalSettingTblBuilder.addServerPort(serverPortJsonValue.asString()); } - + Json::Value serverIdJsonValue = requestJsonValue[VssLocalSettingTbl_ServerId]; if (serverIdJsonValue.type() != Json::ValueType::nullValue) { vssLocalSettingTblBuilder.addServerId(serverIdJsonValue.asString()); } - + Json::Value userAuthIdJsonValue = requestJsonValue[VssLocalSettingTbl_UserAuthId]; if (userAuthIdJsonValue.type() != Json::ValueType::nullValue) { vssLocalSettingTblBuilder.addUserAuthId(userAuthIdJsonValue.asString()); } - + Json::Value passwordJsonValue = requestJsonValue[VssLocalSettingTbl_Password]; if (passwordJsonValue.type() != Json::ValueType::nullValue) { vssLocalSettingTblBuilder.addPassword(passwordJsonValue.asString()); } - + Json::Value updateTimeJsonValue = requestJsonValue[VssLocalSettingTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { vssLocalSettingTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); @@ -231,7 +231,7 @@ } return responseJsonValue.toStyledString(); } - + /** 鏌ユ壘鏈湴鍥芥爣閰嶇疆鍒楄〃 */ std::string findVssLocalSettingTblList(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -241,10 +241,10 @@ responseJsonValue["success"] = "false"; if (content == "" || requestJsonReader.parse(content, requestJsonValue)) { VssLocalSettingTblBuilder vssLocalSettingTblBuilder; - + Json::Value iDJsonValue = requestJsonValue[VssLocalSettingTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssLocalSettingTblBuilder.addID(iDJsonValue.asInt()); + vssLocalSettingTblBuilder.addID(std::stoi(iDJsonValue.asString())); } Json::Value serverIpJsonValue = requestJsonValue[VssLocalSettingTbl_ServerIp]; @@ -278,7 +278,7 @@ } responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; responseJsonValue["success"] = "true"; - responseJsonValue["data"] = VssLocalSettingTblSqliteDao::instance()->findJsonArray(string("select * from ") + VSSLocalSettingTbl_TABLE_NAME + " where 1 = 1"); + responseJsonValue = VssLocalSettingTblSqliteDao::instance()->findVssLocalSettingTblList(vssLocalSettingTblBuilder.buildVssLocalSettingTblMap()); } return responseJsonValue.toStyledString(); diff --git a/QiaoJiaSystem/DataManagerServer/vss/controller/VssUpperSvrTblController.h b/QiaoJiaSystem/DataManagerServer/vss/controller/VssUpperSvrTblController.h index 300d89c..156c4e7 100755 --- a/QiaoJiaSystem/DataManagerServer/vss/controller/VssUpperSvrTblController.h +++ b/QiaoJiaSystem/DataManagerServer/vss/controller/VssUpperSvrTblController.h @@ -16,46 +16,46 @@ */ class VssUpperSvrTblController : public VssBaseController { private: - /** 鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃鏋勯�犲嚱鏁� */ - VssUpperSvrTblController() {} + /** 鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃鏋勯�犲嚱鏁� */ + VssUpperSvrTblController() {} public: - /** 鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃鍗曚緥妯″紡 */ + /** 鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃鍗曚緥妯″紡 */ static VssUpperSvrTblController* instance() { static VssUpperSvrTblController instance; return &instance; } public: - /** 娉ㄥ唽{label}http鏈嶅姟 */ + /** 娉ㄥ唽{label}http鏈嶅姟 */ void registerHttpServices(HttpSrvRetRecieve& _HttpSrvRetRecieve) { - _HttpSrvRetRecieve.setInfo("^/addVssUpperSvrTbl$", "POST", - std::bind(&VssUpperSvrTblController::addVssUpperSvrTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/delVssUpperSvrTbl$", "POST", - std::bind(&VssUpperSvrTblController::delVssUpperSvrTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/updateVssUpperSvrTbl$", "POST", - std::bind(&VssUpperSvrTblController::updateVssUpperSvrTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/findVssUpperSvrTbl$", "POST", - std::bind(&VssUpperSvrTblController::findVssUpperSvrTbl, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); - - _HttpSrvRetRecieve.setInfo("^/findVssUpperSvrTblList$", "POST", - std::bind(&VssUpperSvrTblController::findVssUpperSvrTblList, this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4)); + _HttpSrvRetRecieve.setInfo("^/addVssUpperSvrTbl$", "POST", + std::bind(&VssUpperSvrTblController::addVssUpperSvrTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/delVssUpperSvrTbl$", "POST", + std::bind(&VssUpperSvrTblController::delVssUpperSvrTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/updateVssUpperSvrTbl$", "POST", + std::bind(&VssUpperSvrTblController::updateVssUpperSvrTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/findVssUpperSvrTbl$", "POST", + std::bind(&VssUpperSvrTblController::findVssUpperSvrTbl, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); + + _HttpSrvRetRecieve.setInfo("^/findVssUpperSvrTblList$", "POST", + std::bind(&VssUpperSvrTblController::findVssUpperSvrTblList, this, + std::placeholders::_1, std::placeholders::_2, + std::placeholders::_3, std::placeholders::_4)); } public: - /** 娣诲姞鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃 */ + /** 娣诲姞鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃 */ std::string addVssUpperSvrTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; Json::Value requestJsonValue; @@ -64,98 +64,98 @@ responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { VssUpperSvrTblBuilder vssUpperSvrTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addID(iDJsonValue.asInt()); + vssUpperSvrTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name]; + + Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name]; if (nameJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addName(nameJsonValue.asString()); + vssUpperSvrTblBuilder.addName((nameJsonValue.asString())); } - - Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID]; + + Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID]; if (publicIDJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPublicID(publicIDJsonValue.asString()); + vssUpperSvrTblBuilder.addPublicID((publicIDJsonValue.asString())); } - - Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername]; + + Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername]; if (authUsernameJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAuthUsername(authUsernameJsonValue.asString()); + vssUpperSvrTblBuilder.addAuthUsername((authUsernameJsonValue.asString())); } - - Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd]; + + Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd]; if (authPasswdJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAuthPasswd(authPasswdJsonValue.asString()); + vssUpperSvrTblBuilder.addAuthPasswd((authPasswdJsonValue.asString())); } - - Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain]; + + Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain]; if (domainJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addDomain(domainJsonValue.asString()); + vssUpperSvrTblBuilder.addDomain((domainJsonValue.asString())); } - - Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP]; + + Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP]; if (iPJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIP(iPJsonValue.asString()); + vssUpperSvrTblBuilder.addIP((iPJsonValue.asString())); } - - Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port]; + + Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port]; if (portJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPort(portJsonValue.asInt()); + vssUpperSvrTblBuilder.addPort(std::stoi((portJsonValue.asString()))); } - - Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime]; + + Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime]; if (registerTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addRegisterTime(registerTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addRegisterTime(std::stoi((registerTimeJsonValue.asString()))); } - - Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime]; + + Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime]; if (keepAliveTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addKeepAliveTime(keepAliveTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addKeepAliveTime(std::stoi((keepAliveTimeJsonValue.asString()))); } - - Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive]; + + Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive]; if (aliveJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAlive(aliveJsonValue.asInt()); + vssUpperSvrTblBuilder.addAlive(std::stoi((aliveJsonValue.asString()))); } - - Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime]; + + Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime]; if (isSyncTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIsSyncTime(isSyncTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addIsSyncTime(std::stoi((isSyncTimeJsonValue.asString()))); } - - Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol]; + + Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol]; if (pushProtocolJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPushProtocol(pushProtocolJsonValue.asInt()); + vssUpperSvrTblBuilder.addPushProtocol(std::stoi((pushProtocolJsonValue.asString()))); } - - Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo]; + + Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo]; if (platformInfoJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPlatformInfo(platformInfoJsonValue.asInt()); + vssUpperSvrTblBuilder.addPlatformInfo(std::stoi((platformInfoJsonValue.asString()))); } - - Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable]; + + Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable]; if (isEnableJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIsEnable(isEnableJsonValue.asInt()); + vssUpperSvrTblBuilder.addIsEnable(std::stoi((isEnableJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssUpperSvrTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - auto keyValuesToAdd = vssUpperSvrTblBuilder.buildVssUpperSvrTblMap(); - if (keyValuesToAdd.size() > 0) { - mysqlpp::SimpleResult addVssUpperSvrTblResult = VssUpperSvrTblDao::instance()->addVssUpperSvrTbl(keyValuesToAdd); - if (addVssUpperSvrTblResult.rows() > 0) { - responseJsonValue["success"] = "true"; - responseJsonValue["message"] = "娣诲姞鎴愬姛锛�"; - } + auto keyValuesToAdd = vssUpperSvrTblBuilder.buildVssUpperSvrTblMap(); + if (keyValuesToAdd.size() > 0) { + mysqlpp::SimpleResult addVssUpperSvrTblResult = VssUpperSvrTblDao::instance()->addVssUpperSvrTbl(keyValuesToAdd); + if (addVssUpperSvrTblResult.rows() > 0) { + responseJsonValue["success"] = "true"; + responseJsonValue["message"] = "娣诲姞鎴愬姛锛�"; + } } } return responseJsonValue.toStyledString(); } - + /** 鍒犻櫎鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃 */ std::string delVssUpperSvrTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -164,19 +164,19 @@ responseJsonValue["message"] = "鍒犻櫎澶辫触锛�"; responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { - Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; - if (iDJsonValue.type() != Json::ValueType::nullValue) { - string iDValue = iDJsonValue.asString(); + Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; + if (iDJsonValue.type() != Json::ValueType::nullValue) { + string iDValue = iDJsonValue.asString(); if (iDValue.size() > 0 && VssUpperSvrTblDao::instance()->deleteByColumn("ID", iDValue)) { - responseJsonValue["success"] = "true"; - responseJsonValue["message"] = "鍒犻櫎鎴愬姛!"; - } + responseJsonValue["success"] = "true"; + responseJsonValue["message"] = "鍒犻櫎鎴愬姛!"; + } } - + } return responseJsonValue.toStyledString(); } - + /** 鏇存柊鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃 */ std::string updateVssUpperSvrTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -186,97 +186,97 @@ responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { VssUpperSvrTblBuilder vssUpperSvrTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addID(iDJsonValue.asInt()); + vssUpperSvrTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name]; + + Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name]; if (nameJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addName(nameJsonValue.asString()); + vssUpperSvrTblBuilder.addName((nameJsonValue.asString())); } - - Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID]; + + Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID]; if (publicIDJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPublicID(publicIDJsonValue.asString()); + vssUpperSvrTblBuilder.addPublicID((publicIDJsonValue.asString())); } - - Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername]; + + Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername]; if (authUsernameJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAuthUsername(authUsernameJsonValue.asString()); + vssUpperSvrTblBuilder.addAuthUsername((authUsernameJsonValue.asString())); } - - Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd]; + + Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd]; if (authPasswdJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAuthPasswd(authPasswdJsonValue.asString()); + vssUpperSvrTblBuilder.addAuthPasswd((authPasswdJsonValue.asString())); } - - Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain]; + + Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain]; if (domainJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addDomain(domainJsonValue.asString()); + vssUpperSvrTblBuilder.addDomain((domainJsonValue.asString())); } - - Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP]; + + Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP]; if (iPJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIP(iPJsonValue.asString()); + vssUpperSvrTblBuilder.addIP((iPJsonValue.asString())); } - - Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port]; + + Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port]; if (portJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPort(portJsonValue.asInt()); + vssUpperSvrTblBuilder.addPort(std::stoi((portJsonValue.asString()))); } - - Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime]; + + Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime]; if (registerTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addRegisterTime(registerTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addRegisterTime(std::stoi((registerTimeJsonValue.asString()))); } - - Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime]; + + Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime]; if (keepAliveTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addKeepAliveTime(keepAliveTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addKeepAliveTime(std::stoi((keepAliveTimeJsonValue.asString()))); } - - Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive]; + + Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive]; if (aliveJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAlive(aliveJsonValue.asInt()); + vssUpperSvrTblBuilder.addAlive(std::stoi((aliveJsonValue.asString()))); } - - Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime]; + + Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime]; if (isSyncTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIsSyncTime(isSyncTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addIsSyncTime(std::stoi((isSyncTimeJsonValue.asString()))); } - - Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol]; + + Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol]; if (pushProtocolJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPushProtocol(pushProtocolJsonValue.asInt()); + vssUpperSvrTblBuilder.addPushProtocol(std::stoi((pushProtocolJsonValue.asString()))); } - - Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo]; + + Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo]; if (platformInfoJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPlatformInfo(platformInfoJsonValue.asInt()); + vssUpperSvrTblBuilder.addPlatformInfo(std::stoi((platformInfoJsonValue.asString()))); } - - Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable]; + + Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable]; if (isEnableJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIsEnable(isEnableJsonValue.asInt()); + vssUpperSvrTblBuilder.addIsEnable(std::stoi((isEnableJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssUpperSvrTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - if (iDJsonValue.type() != Json::ValueType::nullValue) { - string iDValue = iDJsonValue.asString(); + if (iDJsonValue.type() != Json::ValueType::nullValue) { + string iDValue = iDJsonValue.asString(); if (iDValue.size() > 0 && VssUpperSvrTblDao::instance()->updateVssUpperSvrTbl(vssUpperSvrTblBuilder.buildVssUpperSvrTblMap(), "ID", iDValue)) { - responseJsonValue["success"] = "true"; - responseJsonValue["message"] = "鏇存柊鎴愬姛锛�"; - } + responseJsonValue["success"] = "true"; + responseJsonValue["message"] = "鏇存柊鎴愬姛锛�"; + } } } return responseJsonValue.toStyledString(); } - + /** 鏌ユ壘鍗曚釜鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃 */ std::string findVssUpperSvrTbl(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -286,93 +286,93 @@ responseJsonValue["success"] = "false"; if (requestJsonReader.parse(content, requestJsonValue)) { VssUpperSvrTblBuilder vssUpperSvrTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addID(iDJsonValue.asInt()); + vssUpperSvrTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name]; + + Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name]; if (nameJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addName(nameJsonValue.asString()); + vssUpperSvrTblBuilder.addName((nameJsonValue.asString())); } - - Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID]; + + Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID]; if (publicIDJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPublicID(publicIDJsonValue.asString()); + vssUpperSvrTblBuilder.addPublicID((publicIDJsonValue.asString())); } - - Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername]; + + Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername]; if (authUsernameJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAuthUsername(authUsernameJsonValue.asString()); + vssUpperSvrTblBuilder.addAuthUsername((authUsernameJsonValue.asString())); } - - Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd]; + + Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd]; if (authPasswdJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAuthPasswd(authPasswdJsonValue.asString()); + vssUpperSvrTblBuilder.addAuthPasswd((authPasswdJsonValue.asString())); } - - Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain]; + + Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain]; if (domainJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addDomain(domainJsonValue.asString()); + vssUpperSvrTblBuilder.addDomain((domainJsonValue.asString())); } - - Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP]; + + Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP]; if (iPJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIP(iPJsonValue.asString()); + vssUpperSvrTblBuilder.addIP((iPJsonValue.asString())); } - - Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port]; + + Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port]; if (portJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPort(portJsonValue.asInt()); + vssUpperSvrTblBuilder.addPort(std::stoi((portJsonValue.asString()))); } - - Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime]; + + Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime]; if (registerTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addRegisterTime(registerTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addRegisterTime(std::stoi((registerTimeJsonValue.asString()))); } - - Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime]; + + Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime]; if (keepAliveTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addKeepAliveTime(keepAliveTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addKeepAliveTime(std::stoi((keepAliveTimeJsonValue.asString()))); } - - Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive]; + + Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive]; if (aliveJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAlive(aliveJsonValue.asInt()); + vssUpperSvrTblBuilder.addAlive(std::stoi((aliveJsonValue.asString()))); } - - Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime]; + + Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime]; if (isSyncTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIsSyncTime(isSyncTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addIsSyncTime(std::stoi((isSyncTimeJsonValue.asString()))); } - - Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol]; + + Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol]; if (pushProtocolJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPushProtocol(pushProtocolJsonValue.asInt()); + vssUpperSvrTblBuilder.addPushProtocol(std::stoi((pushProtocolJsonValue.asString()))); } - - Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo]; + + Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo]; if (platformInfoJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPlatformInfo(platformInfoJsonValue.asInt()); + vssUpperSvrTblBuilder.addPlatformInfo(std::stoi((platformInfoJsonValue.asString()))); } - - Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable]; + + Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable]; if (isEnableJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIsEnable(isEnableJsonValue.asInt()); + vssUpperSvrTblBuilder.addIsEnable(std::stoi((isEnableJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssUpperSvrTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; - responseJsonValue["success"] = "true"; - responseJsonValue["data"] = VssUpperSvrTblDao::instance()->findJsonArray(string("select * from ") + VSSUpperSvrTbl_TABLE_NAME + " where 1 = 1 limit 1"); + responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; + responseJsonValue["success"] = "true"; + responseJsonValue["data"] = VssUpperSvrTblDao::instance()->findJsonArray(string("select * from ") + VSSUpperSvrTbl_TABLE_NAME + " where 1 = 1 limit 1"); } return responseJsonValue.toStyledString(); } - + /** 鏌ユ壘鍒涘缓涓婄骇骞冲彴鏈嶅姟鍣ㄨ〃鍒楄〃 */ std::string findVssUpperSvrTblList(std::string ip, unsigned int port, std::string content, PResponse &response) { Json::Reader requestJsonReader; @@ -382,89 +382,89 @@ responseJsonValue["success"] = "false"; if (content == "" || requestJsonReader.parse(content, requestJsonValue)) { VssUpperSvrTblBuilder vssUpperSvrTblBuilder; - - Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; + + Json::Value iDJsonValue = requestJsonValue[VssUpperSvrTbl_ID]; if (iDJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addID(iDJsonValue.asInt()); + vssUpperSvrTblBuilder.addID(std::stoi((iDJsonValue.asString()))); } - - Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name]; + + Json::Value nameJsonValue = requestJsonValue[VssUpperSvrTbl_Name]; if (nameJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addName(nameJsonValue.asString()); + vssUpperSvrTblBuilder.addName((nameJsonValue.asString())); } - - Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID]; + + Json::Value publicIDJsonValue = requestJsonValue[VssUpperSvrTbl_PublicID]; if (publicIDJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPublicID(publicIDJsonValue.asString()); + vssUpperSvrTblBuilder.addPublicID((publicIDJsonValue.asString())); } - - Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername]; + + Json::Value authUsernameJsonValue = requestJsonValue[VssUpperSvrTbl_AuthUsername]; if (authUsernameJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAuthUsername(authUsernameJsonValue.asString()); + vssUpperSvrTblBuilder.addAuthUsername((authUsernameJsonValue.asString())); } - - Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd]; + + Json::Value authPasswdJsonValue = requestJsonValue[VssUpperSvrTbl_AuthPasswd]; if (authPasswdJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAuthPasswd(authPasswdJsonValue.asString()); + vssUpperSvrTblBuilder.addAuthPasswd((authPasswdJsonValue.asString())); } - - Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain]; + + Json::Value domainJsonValue = requestJsonValue[VssUpperSvrTbl_Domain]; if (domainJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addDomain(domainJsonValue.asString()); + vssUpperSvrTblBuilder.addDomain((domainJsonValue.asString())); } - - Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP]; + + Json::Value iPJsonValue = requestJsonValue[VssUpperSvrTbl_IP]; if (iPJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIP(iPJsonValue.asString()); + vssUpperSvrTblBuilder.addIP((iPJsonValue.asString())); } - - Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port]; + + Json::Value portJsonValue = requestJsonValue[VssUpperSvrTbl_Port]; if (portJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPort(portJsonValue.asInt()); + vssUpperSvrTblBuilder.addPort(std::stoi((portJsonValue.asString()))); } - - Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime]; + + Json::Value registerTimeJsonValue = requestJsonValue[VssUpperSvrTbl_RegisterTime]; if (registerTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addRegisterTime(registerTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addRegisterTime(std::stoi((registerTimeJsonValue.asString()))); } - - Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime]; + + Json::Value keepAliveTimeJsonValue = requestJsonValue[VssUpperSvrTbl_KeepAliveTime]; if (keepAliveTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addKeepAliveTime(keepAliveTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addKeepAliveTime(std::stoi((keepAliveTimeJsonValue.asString()))); } - - Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive]; + + Json::Value aliveJsonValue = requestJsonValue[VssUpperSvrTbl_Alive]; if (aliveJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addAlive(aliveJsonValue.asInt()); + vssUpperSvrTblBuilder.addAlive(std::stoi((aliveJsonValue.asString()))); } - - Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime]; + + Json::Value isSyncTimeJsonValue = requestJsonValue[VssUpperSvrTbl_IsSyncTime]; if (isSyncTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIsSyncTime(isSyncTimeJsonValue.asInt()); + vssUpperSvrTblBuilder.addIsSyncTime(std::stoi((isSyncTimeJsonValue.asString()))); } - - Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol]; + + Json::Value pushProtocolJsonValue = requestJsonValue[VssUpperSvrTbl_PushProtocol]; if (pushProtocolJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPushProtocol(pushProtocolJsonValue.asInt()); + vssUpperSvrTblBuilder.addPushProtocol(std::stoi((pushProtocolJsonValue.asString()))); } - - Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo]; + + Json::Value platformInfoJsonValue = requestJsonValue[VssUpperSvrTbl_PlatformInfo]; if (platformInfoJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addPlatformInfo(platformInfoJsonValue.asInt()); + vssUpperSvrTblBuilder.addPlatformInfo(std::stoi((platformInfoJsonValue.asString()))); } - - Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable]; + + Json::Value isEnableJsonValue = requestJsonValue[VssUpperSvrTbl_IsEnable]; if (isEnableJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addIsEnable(isEnableJsonValue.asInt()); + vssUpperSvrTblBuilder.addIsEnable(std::stoi((isEnableJsonValue.asString()))); } - - Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime]; + + Json::Value updateTimeJsonValue = requestJsonValue[VssUpperSvrTbl_UpdateTime]; if (updateTimeJsonValue.type() != Json::ValueType::nullValue) { - vssUpperSvrTblBuilder.addUpdateTime(updateTimeJsonValue.asString()); + vssUpperSvrTblBuilder.addUpdateTime((updateTimeJsonValue.asString())); } - responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; - responseJsonValue["success"] = "true"; - responseJsonValue["data"] = VssUpperSvrTblDao::instance()->findJsonArray(string("select * from ") + VSSUpperSvrTbl_TABLE_NAME + " where 1 = 1"); + responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; + responseJsonValue["success"] = "true"; + responseJsonValue["data"] = VssUpperSvrTblDao::instance()->findJsonArray(string("select * from ") + VSSUpperSvrTbl_TABLE_NAME + " where 1 = 1"); } return responseJsonValue.toStyledString(); diff --git a/QiaoJiaSystem/DataManagerServer/vss/dao/VssLocalSettingTblSqliteDao.h b/QiaoJiaSystem/DataManagerServer/vss/dao/VssLocalSettingTblSqliteDao.h index dd74143..7592a5a 100755 --- a/QiaoJiaSystem/DataManagerServer/vss/dao/VssLocalSettingTblSqliteDao.h +++ b/QiaoJiaSystem/DataManagerServer/vss/dao/VssLocalSettingTblSqliteDao.h @@ -7,6 +7,7 @@ #define VSSLocalSettingTbl_Sqlite_TABLE_NAME "VSSLocalSettingTbl" +#include <qsqlfield.h> /** * 鏈湴鍥芥爣閰嶇疆绠$悊绫� */ @@ -174,67 +175,48 @@ } /** 鏌ヨ鏈湴鍥芥爣閰嶇疆鍒楄〃 querySql 瑕佹煡璇㈢殑sql璇彞 */ - Json::Value findVssLocalSettingTblList(string querySql) { + Json::Value findVssLocalSettingTblList(std::map<std::string, std::string>& whereKeyValues) { Json::Value responseJsonValue; - responseJsonValue["message"] = "鍒犻櫎澶辫触锛�"; + responseJsonValue["message"] = "鏌ヨ澶辫触锛�"; responseJsonValue["success"] = "false"; - responseJsonValue["data"] = "[]"; + responseJsonValue["data"] = Json::arrayValue; QMutexLocker mutexLocker(m_mutexVisit);//TODO std::list<Record_Cut_Video_info> lst; QSqlTableModel pModel(NULL, *m_db); - pModel.setTable(VSSLocalSettingTbl_Sqlite_TABLE_NAME); + pModel.setTable(VSSLocalSettingTbl_Sqlite_TABLE_NAME);; + for (auto whereKeyValue : whereKeyValues ) { + pModel.setFilter(QObject::tr((string(whereKeyValue.first)+" = '%1'").c_str()).arg(QString::fromUtf8(whereKeyValue.second.c_str()))); + } pModel.setEditStrategy(QSqlTableModel::OnManualSubmit);//OnManualSubmit OnFieldChange pModel.select(); int rowCount = pModel.rowCount(); if (rowCount > 0) { - Json::Value rowDataList; + Json::Value rowDataList = Json::arrayValue; for (int i = 0; i < rowCount; ++i) { - Json::Value rowData; + Json::Value rowData = Json::objectValue; Record_Cut_Video_info lRec; QSqlRecord rec = pModel.record(i); -// if (!rec.value("finish_flag").toBool()) { -// lRec.n_id = rec.value("id").toInt(); -// lRec.str_storage_dev_id = rec.value("storage_dev_id").toString(); -// lRec.n_chn = rec.value("chn").toInt(); -// lRec.str_src_path = rec.value("src_path").toString(); -// lRec.str_dst_path = rec.value("dst_path").toString(); -// lRec.n_total = rec.value("total").toInt(); -// lRec.b_finish_flag = rec.value("finish_flag").toBool(); -// lRec.tim_update_time = QDateTime::fromString(rec.value("update_time").toString(), -// "yyyy-MM-dd hh:mm:ss"); -// lRec.str_reserved = rec.value("reserved").toString(); -// lst.push_back(lRec); -// } + for (int i = 0; i < rec.count(); i++) { + QSqlField field = rec.field(i); + rowData[field.name().toStdString()] = field.value().toString().toStdString(); + } rowDataList.append(rowData); } responseJsonValue["data"] = rowDataList; } + responseJsonValue["message"] = "鏌ヨ鎴愬姛锛�"; + responseJsonValue["success"] = "true"; return responseJsonValue; - - - - -// vector<VssLocalSettingTbl> vssLocalSettingTblVec; -// vector<map<string, string>> rowDatList = findList(querySql); -// vssLocalSettingTblVec.reserve(rowDatList.size()); -// for (auto rowData : rowDatList) { -// vssLocalSettingTblVec.emplace_back(mapToModel(rowData)); -// } -// return vssLocalSettingTblVec; } - - /**鏌ヨ鏈湴鍥芥爣閰嶇疆鍒楄〃 whereKeyValues 鍒楀悕鍜屽垪鍊煎鏉′欢 */ - Json::Value findVssLocalSettingTblList(std::map<std::string, std::string>& whereKeyValues) { - return findVssLocalSettingTblList(string("select * from ") + VSSLocalSettingTbl_TABLE_NAME + " where 1=1 " + getWhereColumnNameValuePair(whereKeyValues)); - } /**鏌ヨ鎵�鏈夋湰鍦板浗鏍囬厤缃垪琛� */ Json::Value findAllVssLocalSettingTblList() { - return findVssLocalSettingTblList(string("select * from ") + VSSLocalSettingTbl_TABLE_NAME + " where 1=1 "); + std::map<std::string, std::string> whereKeyValues; + return findVssLocalSettingTblList(whereKeyValues); } /** 鏌ヨmap鍒楄〃 querySql 瑕佹煡璇㈢殑sql璇彞 */ diff --git a/QiaoJiaSystem/build/config.db b/QiaoJiaSystem/build/config.db index bb0bacb..2366125 100755 --- a/QiaoJiaSystem/build/config.db +++ b/QiaoJiaSystem/build/config.db Binary files differ -- Gitblit v1.8.0