| | |
| | | */ |
| | | class CamDevController : public VssBaseController { |
| | | private: |
| | | /** 摄像头设备构造函数 */ |
| | | CamDevController() {} |
| | | /** 摄像头设备构造函数 */ |
| | | CamDevController() {} |
| | | public: |
| | | /** 摄像头设备单例模式 */ |
| | | /** 摄像头设备单例模式 */ |
| | | static CamDevController* instance() { |
| | | static CamDevController instance; |
| | | return &instance; |
| | | } |
| | | public: |
| | | /** 注册{label}http服务 */ |
| | | /** 注册{label}http服务 */ |
| | | void registerHttpServices(HttpSrvRetRecieve& _HttpSrvRetRecieve) { |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/addCamDev$", "POST", |
| | | std::bind(&CamDevController::addCamDev, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/delCamDev$", "POST", |
| | | std::bind(&CamDevController::delCamDev, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/updateCamDev$", "POST", |
| | | std::bind(&CamDevController::updateCamDev, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/findCamDev$", "POST", |
| | | std::bind(&CamDevController::findCamDev, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/findCamDevList$", "POST", |
| | | std::bind(&CamDevController::findCamDevList, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | _HttpSrvRetRecieve.setInfo("^/addCamDev$", "POST", |
| | | std::bind(&CamDevController::addCamDev, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/delCamDev$", "POST", |
| | | std::bind(&CamDevController::delCamDev, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/updateCamDev$", "POST", |
| | | std::bind(&CamDevController::updateCamDev, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/findCamDev$", "POST", |
| | | std::bind(&CamDevController::findCamDev, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | _HttpSrvRetRecieve.setInfo("^/findCamDevList$", "POST", |
| | | std::bind(&CamDevController::findCamDevList, this, |
| | | std::placeholders::_1, std::placeholders::_2, |
| | | std::placeholders::_3, std::placeholders::_4)); |
| | | |
| | | } |
| | | public: |
| | | /** 添加摄像头设备 */ |
| | | /** 添加摄像头设备 */ |
| | | std::string addCamDev(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | Json::Reader requestJsonReader; |
| | | Json::Value requestJsonValue; |
| | |
| | | responseJsonValue["success"] = "false"; |
| | | if (requestJsonReader.parse(content, requestJsonValue)) { |
| | | CamDevBuilder camDevBuilder; |
| | | |
| | | Json::Value idJsonValue = requestJsonValue[CamDev_id]; |
| | | |
| | | Json::Value idJsonValue = requestJsonValue[CamDev_id]; |
| | | if (idJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addid(std::stoi((idJsonValue.asString()))); |
| | | } |
| | | |
| | | Json::Value cam_dev_idJsonValue = requestJsonValue[CamDev_cam_dev_id]; |
| | | |
| | | Json::Value cam_dev_idJsonValue = requestJsonValue[CamDev_cam_dev_id]; |
| | | if (cam_dev_idJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addcam_dev_id((cam_dev_idJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value nameJsonValue = requestJsonValue[CamDev_name]; |
| | | |
| | | Json::Value nameJsonValue = requestJsonValue[CamDev_name]; |
| | | if (nameJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addname((nameJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value addrJsonValue = requestJsonValue[CamDev_addr]; |
| | | |
| | | Json::Value addrJsonValue = requestJsonValue[CamDev_addr]; |
| | | if (addrJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addaddr((addrJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value longitudeJsonValue = requestJsonValue[CamDev_longitude]; |
| | | |
| | | Json::Value longitudeJsonValue = requestJsonValue[CamDev_longitude]; |
| | | if (longitudeJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addlongitude((longitudeJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value latitudeJsonValue = requestJsonValue[CamDev_latitude]; |
| | | |
| | | Json::Value latitudeJsonValue = requestJsonValue[CamDev_latitude]; |
| | | if (latitudeJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addlatitude((latitudeJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value ipJsonValue = requestJsonValue[CamDev_ip]; |
| | | |
| | | Json::Value ipJsonValue = requestJsonValue[CamDev_ip]; |
| | | if (ipJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addip((ipJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value portJsonValue = requestJsonValue[CamDev_port]; |
| | | |
| | | Json::Value portJsonValue = requestJsonValue[CamDev_port]; |
| | | if (portJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addport(std::stoi((portJsonValue.asString()))); |
| | | } |
| | | |
| | | Json::Value usernameJsonValue = requestJsonValue[CamDev_username]; |
| | | |
| | | Json::Value usernameJsonValue = requestJsonValue[CamDev_username]; |
| | | if (usernameJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addusername((usernameJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value passwordJsonValue = requestJsonValue[CamDev_password]; |
| | | |
| | | Json::Value passwordJsonValue = requestJsonValue[CamDev_password]; |
| | | if (passwordJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addpassword((passwordJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value brandJsonValue = requestJsonValue[CamDev_brand]; |
| | | |
| | | Json::Value brandJsonValue = requestJsonValue[CamDev_brand]; |
| | | if (brandJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addbrand((brandJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value reservedJsonValue = requestJsonValue[CamDev_reserved]; |
| | | |
| | | Json::Value reservedJsonValue = requestJsonValue[CamDev_reserved]; |
| | | if (reservedJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addreserved((reservedJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value typeJsonValue = requestJsonValue[CamDev_type]; |
| | | |
| | | Json::Value typeJsonValue = requestJsonValue[CamDev_type]; |
| | | if (typeJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addtype((typeJsonValue.asString())); |
| | | } |
| | | auto keyValuesToAdd = camDevBuilder.buildCamDevMap(); |
| | | if (keyValuesToAdd.size() > 0) { |
| | | mysqlpp::SimpleResult addCamDevResult = CamDevSqliteDao::instance()->addCamDev(keyValuesToAdd); |
| | | if (addCamDevResult.rows() > 0) { |
| | | responseJsonValue["success"] = "true"; |
| | | responseJsonValue["message"] = "添加成功!"; |
| | | } |
| | | auto keyValuesToAdd = camDevBuilder.buildCamDevMap(); |
| | | if (keyValuesToAdd.size() > 0) { |
| | | responseJsonValue = CamDevSqliteDao::instance()->addCamDev(keyValuesToAdd); |
| | | } |
| | | } |
| | | return responseJsonValue.toStyledString(); |
| | | } |
| | | |
| | | |
| | | /** 删除摄像头设备 */ |
| | | std::string delCamDev(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | Json::Reader requestJsonReader; |
| | |
| | | responseJsonValue["message"] = "删除失败!"; |
| | | responseJsonValue["success"] = "false"; |
| | | if (requestJsonReader.parse(content, requestJsonValue)) { |
| | | Json::Value iDJsonValue = requestJsonValue[CamDev_ID]; |
| | | if (iDJsonValue.type() != Json::ValueType::nullValue) { |
| | | string iDValue = iDJsonValue.asString(); |
| | | if (iDValue.size() > 0 && CamDevSqliteDao::instance()->deleteByColumn("ID", iDValue)) { |
| | | responseJsonValue["success"] = "true"; |
| | | responseJsonValue["message"] = "删除成功!"; |
| | | } |
| | | Json::Value iDJsonValue = requestJsonValue["id"]; |
| | | if (iDJsonValue.type() != Json::ValueType::nullValue) { |
| | | string iDValue = iDJsonValue.asString(); |
| | | responseJsonValue = CamDevSqliteDao::instance()->deleteByColumn("id", iDValue); |
| | | } |
| | | |
| | | |
| | | } |
| | | return responseJsonValue.toStyledString(); |
| | | } |
| | | |
| | | |
| | | /** 更新摄像头设备 */ |
| | | std::string updateCamDev(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | Json::Reader requestJsonReader; |
| | |
| | | responseJsonValue["success"] = "false"; |
| | | if (requestJsonReader.parse(content, requestJsonValue)) { |
| | | CamDevBuilder camDevBuilder; |
| | | |
| | | Json::Value idJsonValue = requestJsonValue[CamDev_id]; |
| | | |
| | | Json::Value idJsonValue = requestJsonValue[CamDev_id]; |
| | | if (idJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addid(std::stoi((idJsonValue.asString()))); |
| | | } |
| | | |
| | | Json::Value cam_dev_idJsonValue = requestJsonValue[CamDev_cam_dev_id]; |
| | | |
| | | Json::Value cam_dev_idJsonValue = requestJsonValue[CamDev_cam_dev_id]; |
| | | if (cam_dev_idJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addcam_dev_id((cam_dev_idJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value nameJsonValue = requestJsonValue[CamDev_name]; |
| | | |
| | | Json::Value nameJsonValue = requestJsonValue[CamDev_name]; |
| | | if (nameJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addname((nameJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value addrJsonValue = requestJsonValue[CamDev_addr]; |
| | | |
| | | Json::Value addrJsonValue = requestJsonValue[CamDev_addr]; |
| | | if (addrJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addaddr((addrJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value longitudeJsonValue = requestJsonValue[CamDev_longitude]; |
| | | |
| | | Json::Value longitudeJsonValue = requestJsonValue[CamDev_longitude]; |
| | | if (longitudeJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addlongitude((longitudeJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value latitudeJsonValue = requestJsonValue[CamDev_latitude]; |
| | | |
| | | Json::Value latitudeJsonValue = requestJsonValue[CamDev_latitude]; |
| | | if (latitudeJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addlatitude((latitudeJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value ipJsonValue = requestJsonValue[CamDev_ip]; |
| | | |
| | | Json::Value ipJsonValue = requestJsonValue[CamDev_ip]; |
| | | if (ipJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addip((ipJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value portJsonValue = requestJsonValue[CamDev_port]; |
| | | |
| | | Json::Value portJsonValue = requestJsonValue[CamDev_port]; |
| | | if (portJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addport(std::stoi((portJsonValue.asString()))); |
| | | } |
| | | |
| | | Json::Value usernameJsonValue = requestJsonValue[CamDev_username]; |
| | | |
| | | Json::Value usernameJsonValue = requestJsonValue[CamDev_username]; |
| | | if (usernameJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addusername((usernameJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value passwordJsonValue = requestJsonValue[CamDev_password]; |
| | | |
| | | Json::Value passwordJsonValue = requestJsonValue[CamDev_password]; |
| | | if (passwordJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addpassword((passwordJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value brandJsonValue = requestJsonValue[CamDev_brand]; |
| | | |
| | | Json::Value brandJsonValue = requestJsonValue[CamDev_brand]; |
| | | if (brandJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addbrand((brandJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value reservedJsonValue = requestJsonValue[CamDev_reserved]; |
| | | |
| | | Json::Value reservedJsonValue = requestJsonValue[CamDev_reserved]; |
| | | if (reservedJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addreserved((reservedJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value typeJsonValue = requestJsonValue[CamDev_type]; |
| | | |
| | | Json::Value typeJsonValue = requestJsonValue[CamDev_type]; |
| | | if (typeJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addtype((typeJsonValue.asString())); |
| | | } |
| | | if (iDJsonValue.type() != Json::ValueType::nullValue) { |
| | | string iDValue = iDJsonValue.asString(); |
| | | if (iDValue.size() > 0 && CamDevSqliteDao::instance()->updateCamDev(camDevBuilder.buildCamDevMap(), "ID", iDValue)) { |
| | | responseJsonValue["success"] = "true"; |
| | | responseJsonValue["message"] = "更新成功!"; |
| | | } |
| | | if (idJsonValue.type() != Json::ValueType::nullValue) { |
| | | responseJsonValue = CamDevSqliteDao::instance()->updateCamDev(camDevBuilder.buildCamDevMap(), "id", idJsonValue.asString()); |
| | | } |
| | | } |
| | | return responseJsonValue.toStyledString(); |
| | | } |
| | | |
| | | |
| | | /** 查找单个摄像头设备 */ |
| | | std::string findCamDev(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | Json::Reader requestJsonReader; |
| | |
| | | responseJsonValue["success"] = "false"; |
| | | if (requestJsonReader.parse(content, requestJsonValue)) { |
| | | CamDevBuilder camDevBuilder; |
| | | |
| | | Json::Value idJsonValue = requestJsonValue[CamDev_id]; |
| | | |
| | | Json::Value idJsonValue = requestJsonValue[CamDev_id]; |
| | | if (idJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addid(std::stoi((idJsonValue.asString()))); |
| | | } |
| | | |
| | | Json::Value cam_dev_idJsonValue = requestJsonValue[CamDev_cam_dev_id]; |
| | | |
| | | Json::Value cam_dev_idJsonValue = requestJsonValue[CamDev_cam_dev_id]; |
| | | if (cam_dev_idJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addcam_dev_id((cam_dev_idJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value nameJsonValue = requestJsonValue[CamDev_name]; |
| | | |
| | | Json::Value nameJsonValue = requestJsonValue[CamDev_name]; |
| | | if (nameJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addname((nameJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value addrJsonValue = requestJsonValue[CamDev_addr]; |
| | | |
| | | Json::Value addrJsonValue = requestJsonValue[CamDev_addr]; |
| | | if (addrJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addaddr((addrJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value longitudeJsonValue = requestJsonValue[CamDev_longitude]; |
| | | |
| | | Json::Value longitudeJsonValue = requestJsonValue[CamDev_longitude]; |
| | | if (longitudeJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addlongitude((longitudeJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value latitudeJsonValue = requestJsonValue[CamDev_latitude]; |
| | | |
| | | Json::Value latitudeJsonValue = requestJsonValue[CamDev_latitude]; |
| | | if (latitudeJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addlatitude((latitudeJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value ipJsonValue = requestJsonValue[CamDev_ip]; |
| | | |
| | | Json::Value ipJsonValue = requestJsonValue[CamDev_ip]; |
| | | if (ipJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addip((ipJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value portJsonValue = requestJsonValue[CamDev_port]; |
| | | |
| | | Json::Value portJsonValue = requestJsonValue[CamDev_port]; |
| | | if (portJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addport(std::stoi((portJsonValue.asString()))); |
| | | } |
| | | |
| | | Json::Value usernameJsonValue = requestJsonValue[CamDev_username]; |
| | | |
| | | Json::Value usernameJsonValue = requestJsonValue[CamDev_username]; |
| | | if (usernameJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addusername((usernameJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value passwordJsonValue = requestJsonValue[CamDev_password]; |
| | | |
| | | Json::Value passwordJsonValue = requestJsonValue[CamDev_password]; |
| | | if (passwordJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addpassword((passwordJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value brandJsonValue = requestJsonValue[CamDev_brand]; |
| | | |
| | | Json::Value brandJsonValue = requestJsonValue[CamDev_brand]; |
| | | if (brandJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addbrand((brandJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value reservedJsonValue = requestJsonValue[CamDev_reserved]; |
| | | |
| | | Json::Value reservedJsonValue = requestJsonValue[CamDev_reserved]; |
| | | if (reservedJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addreserved((reservedJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value typeJsonValue = requestJsonValue[CamDev_type]; |
| | | |
| | | Json::Value typeJsonValue = requestJsonValue[CamDev_type]; |
| | | if (typeJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addtype((typeJsonValue.asString())); |
| | | } |
| | | responseJsonValue["message"] = "查询成功!"; |
| | | responseJsonValue["success"] = "true"; |
| | | responseJsonValue["data"] = CamDevSqliteDao::instance()->findJsonArray(string("select * from ") + CamDev_TABLE_NAME + " where 1 = 1 limit 1"); |
| | | responseJsonValue["message"] = "查询成功!"; |
| | | responseJsonValue["success"] = "true"; |
| | | responseJsonValue = CamDevSqliteDao::instance()->findCamDevList(camDevBuilder.buildCamDevMap()); |
| | | } |
| | | return responseJsonValue.toStyledString(); |
| | | } |
| | | |
| | | |
| | | /** 查找摄像头设备列表 */ |
| | | std::string findCamDevList(std::string ip, unsigned int port, std::string content, PResponse &response) { |
| | | Json::Reader requestJsonReader; |
| | |
| | | responseJsonValue["success"] = "false"; |
| | | if (content == "" || requestJsonReader.parse(content, requestJsonValue)) { |
| | | CamDevBuilder camDevBuilder; |
| | | |
| | | Json::Value idJsonValue = requestJsonValue[CamDev_id]; |
| | | |
| | | Json::Value idJsonValue = requestJsonValue[CamDev_id]; |
| | | if (idJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addid(std::stoi((idJsonValue.asString()))); |
| | | } |
| | | |
| | | Json::Value cam_dev_idJsonValue = requestJsonValue[CamDev_cam_dev_id]; |
| | | |
| | | Json::Value cam_dev_idJsonValue = requestJsonValue[CamDev_cam_dev_id]; |
| | | if (cam_dev_idJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addcam_dev_id((cam_dev_idJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value nameJsonValue = requestJsonValue[CamDev_name]; |
| | | |
| | | Json::Value nameJsonValue = requestJsonValue[CamDev_name]; |
| | | if (nameJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addname((nameJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value addrJsonValue = requestJsonValue[CamDev_addr]; |
| | | |
| | | Json::Value addrJsonValue = requestJsonValue[CamDev_addr]; |
| | | if (addrJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addaddr((addrJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value longitudeJsonValue = requestJsonValue[CamDev_longitude]; |
| | | |
| | | Json::Value longitudeJsonValue = requestJsonValue[CamDev_longitude]; |
| | | if (longitudeJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addlongitude((longitudeJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value latitudeJsonValue = requestJsonValue[CamDev_latitude]; |
| | | |
| | | Json::Value latitudeJsonValue = requestJsonValue[CamDev_latitude]; |
| | | if (latitudeJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addlatitude((latitudeJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value ipJsonValue = requestJsonValue[CamDev_ip]; |
| | | |
| | | Json::Value ipJsonValue = requestJsonValue[CamDev_ip]; |
| | | if (ipJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addip((ipJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value portJsonValue = requestJsonValue[CamDev_port]; |
| | | |
| | | Json::Value portJsonValue = requestJsonValue[CamDev_port]; |
| | | if (portJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addport(std::stoi((portJsonValue.asString()))); |
| | | } |
| | | |
| | | Json::Value usernameJsonValue = requestJsonValue[CamDev_username]; |
| | | |
| | | Json::Value usernameJsonValue = requestJsonValue[CamDev_username]; |
| | | if (usernameJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addusername((usernameJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value passwordJsonValue = requestJsonValue[CamDev_password]; |
| | | |
| | | Json::Value passwordJsonValue = requestJsonValue[CamDev_password]; |
| | | if (passwordJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addpassword((passwordJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value brandJsonValue = requestJsonValue[CamDev_brand]; |
| | | |
| | | Json::Value brandJsonValue = requestJsonValue[CamDev_brand]; |
| | | if (brandJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addbrand((brandJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value reservedJsonValue = requestJsonValue[CamDev_reserved]; |
| | | |
| | | Json::Value reservedJsonValue = requestJsonValue[CamDev_reserved]; |
| | | if (reservedJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addreserved((reservedJsonValue.asString())); |
| | | } |
| | | |
| | | Json::Value typeJsonValue = requestJsonValue[CamDev_type]; |
| | | |
| | | Json::Value typeJsonValue = requestJsonValue[CamDev_type]; |
| | | if (typeJsonValue.type() != Json::ValueType::nullValue) { |
| | | camDevBuilder.addtype((typeJsonValue.asString())); |
| | | } |
| | | responseJsonValue["message"] = "查询成功!"; |
| | | responseJsonValue["success"] = "true"; |
| | | responseJsonValue["data"] = CamDevSqliteDao::instance()->findJsonArray(string("select * from ") + CamDev_TABLE_NAME + " where 1 = 1"); |
| | | responseJsonValue["message"] = "查询成功!"; |
| | | responseJsonValue["success"] = "true"; |
| | | responseJsonValue = CamDevSqliteDao::instance()->findCamDevList(camDevBuilder.buildCamDevMap()); |
| | | |
| | | } |
| | | return responseJsonValue.toStyledString(); |
| | |
| | | |
| | | |
| | | #endif //CAMDEV_CONTROLLER_H |
| | | |
| | | |
| | | |
| | | |