pansen
2019-01-28 0a1992c1189eb162c6597289877cf060d4ea24cc
布控上传修改
5个文件已修改
181 ■■■■ 已修改文件
QiaoJiaSystem/DataManagerServer/http_configserver.cpp 136 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/DataManagerServer/http_configserver.h 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/DataManagerServer/uploadDataInterface.md 27 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/build/DataWebServer 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/build/config.json 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/DataManagerServer/http_configserver.cpp
@@ -1875,6 +1875,22 @@
        std::string createBy = value["createBy"].asString();
        string str_uuid;
        uuid_t t_uuid;
        char str[36];
        uuid_generate(t_uuid);
        uuid_unparse(t_uuid, str);
        str_uuid = str;
        if (createBy == "analyDev") {
            Uuid = Uuid.empty() ? str_uuid : Uuid;
        } else if (createBy == "conCemter") {
            if (Uuid.empty()) {
                response->write(SimpleWeb::StatusCode::client_error_bad_request, "{\"error\":\"参数错误! \"}");
                return "";
            }
        }
        bool ret = false;
        FieldValues fieldValues;
        fieldValues.insert(std::make_pair("uuid", Uuid));
@@ -1910,10 +1926,17 @@
            return "";
        }
        {
//            #todo 上传。仅黑名单。
//            #TODO 根据createBy判断是否需要上传
        if (createBy == "analyDev" && BwType == "1") {
//            string &Uuid, string &TableName, string &SyncType, string &StartTime,string &EndTime,
//            string &UploadFlag, string &CmpThreshold, string &Enabled
            string str_SyncType(to_string(SyncType));
            UploadTaskToMonitorCenter(Uuid, TableName, str_SyncType, StartTime, EndTime, UploadFlag, CmpThreshold,
                                      Enabled);
        }
        erlangDbTool->sendMessage();
        std::string str_result = std::string("{\"result\":").append("\"" + std::to_string(ret) + "\"}");
@@ -2244,6 +2267,19 @@
        std::string BwType = value["BwType"].asString();
        std::string CreateBy = value["createBy"].asString();
//        std::string BwType = value["BwType"].asString();
        std::string UploadFlag = "-1";
        if (SyncType == "1") {
            UploadFlag = erlangDbTool->findAllDatabase()[TableId].uploadFlag;
        } else {
            auto its = m_SqliteFaceEncap.getTableInfos();
            for (auto &item : its) {
                if (item.uuid == TableId) {
                    UploadFlag = item.uploadFlag;
                    break;
                }
            }
        }
        DBG("content: " << TableName << "," << img_url << "," << idcard << "," << strUUID << ","
                        << Enabled << "," << TableType << "," << SyncType << "," << TableId);
@@ -2342,21 +2378,17 @@
//            usleep(100);
            erlangDbTool->sendMessage();
//           #todo  CreateBy == ""???
//            #TODO黑名单更新需要上传
//            if (UploadFlag == "1") {
////                #todo db queue upload to server
//                if (BwType == "0") {
            if (CreateBy == "analyDev" && UploadFlag == "1") {
//                #todo db queue upload to server
                if (BwType == "0") {
//                    UploadPersonToUserCenter(img_url, idcard, strUUID, feature_base64);
//                } else {
//                    //todo send person to backServer
////#TODO 黑名单上传
            {
//            #todo 上传。仅黑名单。
//            #TODO 根据createBy判断是否需要上传
                } else if (BwType == "1") {
                    UpdatePersonToMonitorCenter(img_url, idcard, strUUID, TableId, Enabled);
                }
            } else {
//                不上传
            }
//                }
//            }
            return str_result;
        } else {
            std::string str_result = std::string("{\"error\":\"addPerson error\"}");
@@ -2392,7 +2424,7 @@
void devHttpServer_c::addPersonMToDB(const string &TableName, const string &img_url, const string &SyncType,
                                     const string &feature_base64, const Features &faceResults, string &idcard,
                                     string &strUUID, bool &ret_addPerson) const {
                                     string &strUUID, bool &ret_addPerson) {
    if (SyncType == "0") {
        FieldValues fieldValues;
        AddFaceData addFaceData;
@@ -2488,6 +2520,73 @@
    perInfos.append(perInfo);
    thread sendPerson(uploadServer, this, sendUrl, perInfos.toStyledString());
    sendPerson.detach();
}
void
devHttpServer_c::UpdatePersonToMonitorCenter(string &img_url, string &idcard, string &strUUID,
                                             string &strTableId, string &strControl) {
//  string sendUrl = "ip:3699/data/api-c/taskUser/updateFromC";
    string sendUrl = GET_STR_CONFIG("updateFromAnalyUrl");
    if (sendUrl.empty()) {
        ERR("");
        return;
    }
    Json::Value perInfos;
    Json::Value perInfo;
//                #todo get string from config.json file
    perInfo["id"] = strUUID;
    perInfo["distributionIds"] = m_cluster_id;
    perInfo["distributionNames"] = m_cluster_name;
    auto rec = db_c.searchConfigTableWithinServerInfo();
    perInfo["deviceId"] = rec.dev_id.toStdString();
    perInfo["photos"] = img_url;
    perInfo["cardId"] = idcard; // 图片描述
    perInfo["taskId"] = strTableId; // 底库id
    perInfo["isControl"] = strControl; // 布控状态(0为未布控,1为已布控)
    perInfos.append(perInfo);
    thread sendPerson(uploadServer, this, sendUrl, perInfos.toStyledString());
    sendPerson.detach();
}
void
devHttpServer_c::UploadTaskToMonitorCenter(string &Uuid, string &TableName, string &SyncType, string &StartTime,
                                           string &EndTime, string &UploadFlag, string &CmpThreshold, string &Enabled) {
//  string sendUrl = "192.168.1.184:3699/addTaskByNode";
    string sendUrl = GET_STR_CONFIG("addTaskAnalyUrl");
    if (sendUrl.empty()) {
        ERR("");
        return;
    }
//    Json::Value perInfos;
    Json::Value perInfo;
    perInfo["uuid"] = Uuid;
    perInfo["TableName"] = TableName;
    perInfo["SyncType"] = SyncType;
    perInfo["StartTime"] = StartTime;
    perInfo["EndTime"] = EndTime;
    perInfo["IsSync"] = UploadFlag;
    perInfo["threshold"] = CmpThreshold;
    perInfo["enabled"] = Enabled;
    perInfo["distributionIds"] = m_cluster_id;
    perInfo["distributionNames"] = m_cluster_name;
    auto rec = db_c.searchConfigTableWithinServerInfo();
    perInfo["deviceId"] = rec.dev_id.toStdString();
//    perInfos.append(perInfo);
    thread sendPerson(uploadServer, this, sendUrl, perInfo.toStyledString());
    sendPerson.detach();
}
@@ -2635,11 +2734,16 @@
            return "";
        }
        {
//            #todo 上传。仅黑名单。
//            #TODO 根据createBy判断是否需要上传
        if (createBy == "analyDev" && BwType == "1") {
//            UploadTaskToMonitorCenter(Uuid, TableName, SyncType, StartTime, EndTime, SyncType, Enabled);
            string str_SyncType(to_string(SyncType));
            UploadTaskToMonitorCenter(Uuid, TableName, str_SyncType, StartTime, EndTime, UploadFlag, CmpThreshold,
                                      Enabled);
        }
        erlangDbTool->sendMessage();
        std::string str_result = std::string("{\"result\":").append("\"" + std::to_string(ret) + "\"}");
        return str_result;
QiaoJiaSystem/DataManagerServer/http_configserver.h
@@ -189,15 +189,21 @@
    static void uploadServer(devHttpServer_c *t_ptrThis, std::string sendUrl, std::string param);
    void devHttpServer_c::UploadPersonToUserCenter(string &img_url, string &idcard, string &strUUID,
                                                   string &feature_base64);
    void UploadPersonToUserCenter(string &img_url, string &idcard, string &strUUID, string &feature_base64);
    void devHttpServer_c::UploadPersonToMonitorCenter(string &img_url, string &idcard, string &strUUID,
                                                      string &feature_base64, string &strTableId, string &strControl);
    void UploadPersonToMonitorCenter(string &img_url, string &idcard, string &strUUID, string &feature_base64,
                                     string &strTableId, string &strControl);
    void UpdatePersonToMonitorCenter(string &img_url, string &idcard, string &strUUID, string &strTableId,
                                     string &strControl);
    void
    UploadTaskToMonitorCenter(string &Uuid, string &TableName, string &SyncType, string &StartTime, string &EndTime,
                              string &UploadFlag, string &CmpThreshold, string &Enabled);
    void
    addPersonMToDB(const string &TableName, const string &img_url, const string &SyncType, const string &feature_base64,
                   const Features &faceResults, string &idcard, string &strUUID, bool &ret_addPerson) const;
                   const Features &faceResults, string &idcard, string &strUUID, bool &ret_addPerson);
    void getMat(string &img_url, const string &img_base64, cv::Mat &image) const;
};
QiaoJiaSystem/DataManagerServer/uploadDataInterface.md
@@ -2,7 +2,7 @@
----
#1.调用创建布控报警底库任务
# 1. 调用创建布控报警底库任务
192.168.1.184:3699/addTaskByNode
@@ -26,7 +26,7 @@
//黑白名单  1黑名单 "BwType": "1",   布控只要黑名单      
----
#2.调用上传布控人员接口
# 2. 调用上传布控人员接口
   分析设备上传布控人员
   
    path:ip:3699/data/api-c/taskUser/addFromAnaly
@@ -44,7 +44,7 @@
    
----
#3.人员管理上传人员接口
# 3. 人员管理上传人员接口
    人员ID(必需): id   例如:PSSVR010120181208175534014
    姓名(可空)  name  
    身份证号(可以不准)cardId  
@@ -58,7 +58,7 @@
    数据类型,没标注的都是字符串
    注意传输时的驼峰式命名
---
传参举例:
        [
@@ -84,13 +84,30 @@
                "featureBase64  ":"kQZbUt48zxqUQfwv/r2mYfCz//+=="
            }
        ]
---
请求方法为post,以json格式传输,支持批量上传
目前的ip为203
接口路径:IP:3697/addPerson/uploadToTemporary
---
# 4. 15 分析更新人员接口:
路径:
> ip:3699/data/api-c/taskUser/updateFromC
参数:
    id         人员ID
    idCard       身份证号(描述?)
    imgUrl       图片路径
    isControl  布控状态(0为未布控,1为已布控)
---
请求类型:httpMethod = "POST"(json)
---
---
QiaoJiaSystem/build/DataWebServer
Binary files differ
QiaoJiaSystem/build/config.json
@@ -20,6 +20,8 @@
  "mainServerPort": "3697",
  "mainServerrUrl": "/addPerson/uploadToTemporary",
  "addFromAnalyUrl":"192.168.1.182:3699/data/api-c/taskUser/addFromAnaly",
  "updateFromAnalyUrl":"192.168.1.182::3699/data/api-c/taskUser/updateFromC",
  "addTaskAnalyUrl":"192.168.1.182:3699/addTaskByNode",
  "netIfName": "enp3s0",
  "redis_buf_len": 750,
  "redis_ip": "127.0.0.1",