派生自 development/c++

miyanhui
2019-02-12 348205b66cce214c625b98511adda811bf27ca52
修改imgKey和DevId参数顺序导致截图失败的问题
2个文件已修改
29 ■■■■ 已修改文件
QiaoJiaSystem/DataManagerServer/http_configserver.cpp 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/UnitTest/BasicStruct_test.cpp 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
QiaoJiaSystem/DataManagerServer/http_configserver.cpp
@@ -2554,7 +2554,7 @@
std::string devHttpServer_c::getAlarmImageByImageKeyAndDevId(const std::string& devId,const std::string& imgKey,
std::string devHttpServer_c::getAlarmImageByImageKeyAndDevId(const std::string& imgKey,const std::string& devId,
                                                        PResponse &response)  {
    try {
        if (!devId.empty() && !imgKey.empty()) {
@@ -2825,7 +2825,7 @@
        auto videoParseResult = VideoName_s_t::fromString(item);
        if (videoParseResult.Valid()) {
            if (videoParseResult.m_startFrameId <= imgSt.m_frameId &&
                imgSt.m_frameId < videoParseResult.m_endFrameId) {
                imgSt.m_frameId <= videoParseResult.m_endFrameId) {
                auto imgTm = AppUtil::ParseFromHypenTimeStr(imgSt.m_timeStamp);
                auto videoTm = AppUtil::ParseFromHypenTimeStr(videoParseResult.m_timeStamp);
                if (AppUtil::IsRightAfterLeft(imgTm, videoTm)) {
@@ -2858,10 +2858,10 @@
}
//新的根据图片名称获取路径的方法
std::string devHttpServer_c::getVideoPathByImgKey(const std::string &strImageName, const std::string &camId)
std::string devHttpServer_c::getVideoPathByImgKey(const std::string &imgKey, const std::string &camId)
{
    INFO("GetVideoFor: "<<strImageName<<" CamID:"<<camId);
    ImageName_s_t imgSt= ImageName_s_t::fromString(strImageName);
    INFO("GetVideoFor: "<<imgKey<<" CamID:"<<camId);
    ImageName_s_t imgSt= ImageName_s_t::fromString(imgKey);
    struct tm imgTime = AppUtil::ParseFromHypenTimeStr(imgSt.m_timeStamp);
    char curFolder[128]={0};
@@ -2871,7 +2871,7 @@
                                  imgTime.tm_year+1900,imgTime.tm_mon+1,imgTime.tm_mday,imgTime.tm_hour);
    std::string t_FilePath = appConfig.getStringProperty("cutPath");
    std::string videoPath = t_FilePath+"/"+camId+"/"+std::string(curFolder);
    return GetVideoNameByImgKey(strImageName,videoPath);
    return GetVideoNameByImgKey(imgKey,videoPath);
}
QiaoJiaSystem/UnitTest/BasicStruct_test.cpp
@@ -80,4 +80,21 @@
    CHECK(AppUtil::IsRightAfterLeft(firstTime,secondTime));
    CHECK_FALSE(AppUtil::IsRightAfterLeft(secondTime,firstTime));
}
TEST_CASE("BetweenLimit"){
    std::string strImageKey ="DS-2CD5026EFWD20180202AACH181129936$2019-02-01-09-49-35_1588152";
    std::string strVideoName = "DS-2CD5026EFWD20180202AACH181129936$2019-02-01-09-49-35_1587925_1588424.mp4";
    ImageName_s_t imgSt = ImageName_s_t::fromString(strImageKey);
    VideoName_s_t videoSt = VideoName_s_t::fromString(strVideoName);
    CHECK(imgSt.Valid());
    CHECK(videoSt.Valid());
    CHECK((imgSt.m_frameId < videoSt.m_endFrameId));
    CHECK(imgSt.m_frameId > videoSt.m_startFrameId);
    auto firstTime = AppUtil::ParseFromHypenTimeStr(imgSt.m_timeStamp);
    auto secondTime = AppUtil::ParseFromHypenTimeStr(videoSt.m_timeStamp);
    CHECK(AppUtil::IsRightAfterLeft(firstTime,secondTime));
    //CHECK_FALSE(AppUtil::IsRightAfterLeft(secondTime,firstTime));
}