package com.fdkankan.common.util;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
//import com.fdkankan.base.mq.ModelingMsgProducer;
import com.fdkankan.common.constant.ConstantFileName;
import com.fdkankan.common.constant.ConstantFilePath;
import com.fdkankan.common.constant.ConstantUrl;
import com.fdkankan.mq.message.BuildSceneMqMessage;
import lombok.extern.slf4j.Slf4j;
import org.joda.time.DateTime;
import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;

import java.io.File;
import java.util.*;

/**
 * 生成场景和计算场景
 * Created by Hb_zzZ on 2019/5/8.
 */
@Slf4j
@Component
public class ComputerUtil {


    public static Map<String,String> computer(String projectNum, String path, String buildType) throws Exception{
        Map<String,String> map = new HashMap<String,String>();
        path = path.replace("//", "/");

        log.info("开始建模："+projectNum);
        //构建算法isModel去掉，因此改成空字符串
        if("V2".equals(buildType)){
            CreateObjUtil.build3dModelOld(path, "");
        }
        if("V3".equals(buildType)){
            CreateObjUtil.build3dModel(path, "");
//        CreateObjUtil.build3dModel(unicode, "");
        }
        log.info("建模完成转换数据："+projectNum);

        boolean vision2 = false;
        //读取upload文件，检验需要上传的文件是否存在
        String uploadData = FileUtils.readFile(path + File.separator + "results" +File.separator+"upload.json");
        JSONObject uploadJson = null;
        JSONArray array = null;
        if(uploadData!=null) {
            uploadJson = JSONObject.parseObject(uploadData);
            array = uploadJson.getJSONArray("upload");
        }
        if(array == null){
            String instanceId = FileUtils.readFile("/opt/hosts/hosts.txt");
            FileUtils.writeFile(path + File.separator + "javaErrorNow.log", instanceId + ":计算错误！");

            Thread.sleep(10000L);
            FileUtils.writeFile(path + File.separator + "javaError.log", instanceId + ":计算错误！");
            throw new Exception("upload.json数据出错");
        }
        JSONObject fileJson = null;
        String fileName = "";
        String meshfix = "";  //双模型时候会有改文件路径
        for(int i = 0, len = array.size(); i < len; i++){
            fileJson = array.getJSONObject(i);
            fileName = fileJson.getString("file");
            //文件不存在抛出异常
            if(!new File(path + File.separator + "results" +File.separator + fileName).exists()){
                throw new Exception(path + File.separator + "results" +File.separator + fileName+"文件不存在");
            }

            //判断是否有vision2.txt
            if("vision2.txt".equals(fileName)){
                vision2 = true;
            }

            //tex文件夹
            if(fileJson.getIntValue("clazz") == 2 && !fileJson.containsKey("pack-file")){
                if(fileName.contains("meshfix.txt")){
                    meshfix = fileName;
                }else {
                    map.put(path + File.separator + "results" +File.separator+ fileName,"images/images"+
                            projectNum+"/"+ ConstantFileName.modelUUID+"_50k_texture_jpg_high1/"+fileName.replace("tex/", ""));
                }
                continue;
            }

            //high文件夹
            if(fileJson.getIntValue("clazz") == 3){
                map.put(path + File.separator + "results" +File.separator+ fileName,"images/images"+
                        projectNum+"/pan/high/"+ fileName.replace("high/", ""));
                continue;
            }
            //low文件夹
            if(fileJson.getIntValue("clazz") == 4){
                map.put(path + File.separator + "results" +File.separator+ fileName,"images/images"+
                        projectNum+"/pan/low/"+ fileName.replace("low/", ""));
                continue;
            }

            //tiles文件夹,亚马逊没有裁剪图片api，不需要上传4k图
//            if(fileJson.getIntValue("clazz") == 5 && !"s3".equals(ossType)){
//                map.put(path + File.separator + "results" + File.separator+ fileName,"images/images"+
//                        projectNum+ File.separator + fileName);
//                continue;
//            }
            if(fileJson.getIntValue("clazz") == 5 ){
                map.put(path + File.separator + "results" + File.separator+ fileName,"images/images"+
                        projectNum+ File.separator + fileName);
                continue;
            }

            //tiles文件夹,亚马逊瓦片图
            if(fileJson.getIntValue("clazz") == 7 ){
                if(fileName.contains("/4k_")){
                    continue;
                }
                map.put(path + File.separator + "results" + File.separator+ fileName,"images/images"+
                        projectNum+ File.separator + fileName);
                continue;
            }

            //updown文件复制一份到ecs中并去掉换行符
            if(fileJson.getIntValue("clazz") == 10){
                String updown = FileUtils.readFile(path + File.separator + "results" +File.separator+ fileName);
                JSONObject updownJson = JSONObject.parseObject(updown);
                FileUtils.writeFile(ConstantFilePath.SCENE_PATH + "data" + File.separator + "data" + projectNum +
                        File.separator + fileName.replace("updown", "mapping"), updownJson.toString());
                continue;
            }

            //video视频文件或封面图
            if(fileJson.getIntValue("clazz") == 11 || fileJson.getIntValue("cl" +
                    "azz") == 12){
                map.put(path + File.separator + "results" + File.separator+ fileName,"video/video"+
                        projectNum+ File.separator + fileName.replace("videos/", ""));

                if(fileName.contains(".mp4")){
//                    CreateObjUtil.mp4ToFlv(path + File.separator + "results" + File.separator+ fileName,
//                            path + File.separator + "results" + File.separator+ fileName.replace("mp4", "flv"));

                    map.put(path + File.separator + "results" + File.separator+ fileName.replace("mp4", "flv"),"video/video"+
                            projectNum+ File.separator + fileName.replace("videos/", "").replace("mp4", "flv"));
                }
            }

            //2048的模型和贴图
            if(fileJson.getIntValue("clazz") == 16){
                map.put(path + File.separator + "results" + File.separator+ fileName,"data/data"+
                        projectNum+ File.separator + fileName);
            }

            if(fileJson.getIntValue("clazz") == 18){
                map.put(path + File.separator + "results" + File.separator+ fileName,"images/images"+
                        projectNum+ File.separator + fileName);
            }
        }

        CreateObjUtil.convertTxtToDam( path + File.separator + "results" + File.separator+"tex"+File.separator+"modeldata.txt", path + File.separator + "results" +File.separator+ ConstantFileName.modelUUID+"_50k.dam");
        CreateObjUtil.convertDamToLzma(path + File.separator + "results");
        CreateObjUtil.convertTxtToDam( path + File.separator + "results" +File.separator+"tex"+File.separator+"modeldata.txt", path + File.separator + "results" + File.separator+ConstantFileName.modelUUID+"_50k.dam");
        //有meshfix，表示双模型
        if(!"".equals(meshfix)){
            CreateObjUtil.convertTxtToDam( path + File.separator + "results" + File.separator+meshfix, path + File.separator + "results" +File.separator+ ConstantFileName.modelUUID+"_50k2.dam");
            CreateObjUtil.convertDamToLzma2(path + File.separator + "results");
            CreateObjUtil.convertTxtToDam( path + File.separator + "results" +File.separator+meshfix, path + File.separator + "results" + File.separator+ConstantFileName.modelUUID+"_50k2.dam");
            map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k2.dam.lzma", "images/images"+projectNum+"/"+ConstantFileName.modelUUID+"_50k2.dam.lzma");
            map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k2.dam", "images/images"+projectNum+"/"+ConstantFileName.modelUUID+"_50k2.dam");
        }
        //8目相机有两个vision.txt因此第二个叫vision2.txt
        CreateObjUtil.convertTxtToVisionmodeldata(path + File.separator + "results" +File.separator+"vision.txt",path + File.separator + "results" +File.separator+"vision.modeldata");
        if(vision2){
            CreateObjUtil.convertTxtToVisionmodeldata(path + File.separator + "results" +File.separator+"vision2.txt",path + File.separator + "results" +File.separator+"vision2.modeldata");
            map.put(path + File.separator + "results" +File.separator+"vision2.modeldata", "images/images"+projectNum+"/"+"vision2.modeldata");
        }else {
            CreateObjUtil.convertTxtToVisionmodeldataCommon(path + File.separator + "results" +File.separator+"vision.txt",path + File.separator + "results" +File.separator+"vision.modeldata");
        }
        log.info("数据转换完成："+projectNum);

        File file = new File(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k.dam.lzma");
        while(!file.exists())
        {
            Thread.sleep(60000);
        }

        map.put(path + File.separator + "results" +File.separator+"vision.modeldata", "images/images"+projectNum+"/"+"vision.modeldata");
        map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k.dam.lzma", "images/images"+projectNum+"/"+ConstantFileName.modelUUID+"_50k.dam.lzma");
        map.put(path + File.separator + "results" +File.separator+ConstantFileName.modelUUID+"_50k.dam", "images/images"+projectNum+"/"+ConstantFileName.modelUUID+"_50k.dam");

        file = new File(ConstantFilePath.SCENE_PATH+"data"+File.separator+"data"+projectNum);
        if(!file.exists())
        {
            file.mkdir();
        }
        FileUtils.copyFile(path + File.separator + "results" +File.separator+"floor.json", ConstantFilePath.SCENE_PATH+"data"+File.separator+"data"+projectNum+File.separator+"floor.json", true);
        FileUtils.copyFile(path + File.separator + "results" +File.separator+"floorplan.json", ConstantFilePath.SCENE_PATH+"data"+File.separator+"data"+projectNum+File.separator+"floor.json", true);
        FileUtils.copyFile(path + File.separator + "results" +File.separator+"floorplan.json", ConstantFilePath.SCENE_PATH+"data"+File.separator+"data"+projectNum+File.separator+"floorplan.json", true);
        log.info("floor.json路径："+ path + File.separator + "results" +File.separator+"floor.json");
        map.put(path + File.separator + "results" +File.separator+"floor.json","data/data"+projectNum+"/floor.json");
        map.put(path + File.separator + "results" +File.separator+"floorplan.json","data/data"+projectNum+"/floor.json");
//        map.put(path + File.separator + "results" +File.separator+"floorplan_cad.json","data/data"+projectNum+"/house_floor.json");
        map.put(path + File.separator + "results" +File.separator+"floorplan_cad.json","data/data"+projectNum+"/floorplan_cad.json");
        log.info("准备上传文件到oss："+projectNum);
        return map;
    }


    public static Map<String,String> computerRebuildVideo(String projectNum, String path) throws Exception{
        Map<String,String> map = new HashMap<String,String>();
        path = path.replace("//", "/");

        log.info("开始建模："+projectNum);
        //构建算法isModel去掉，因此改成空字符串
        CreateObjUtil.build3dModel(path, "");
        log.info("建模完成转换数据："+projectNum);

        boolean vision2 = false;
        //读取upload文件，检验需要上传的文件是否存在
        String uploadData = FileUtils.readFile(path + File.separator + "results" +File.separator+"upload.json");
        JSONObject uploadJson = null;
        JSONArray array = null;
        if(uploadData!=null) {
            uploadJson = JSONObject.parseObject(uploadData);
            array = uploadJson.getJSONArray("upload");
        }

        if(array == null){
            String instanceId = FileUtils.readFile("/opt/hosts/hosts.txt");
            FileUtils.writeFile(path + File.separator + "javaErrorNow.log", instanceId + ":计算错误！");

            Thread.sleep(10000L);
            FileUtils.writeFile(path + File.separator + "javaError.log", instanceId + ":计算错误！");
            throw new Exception("upload.json数据出错");
        }

        JSONObject fileJson = null;
        String fileName = "";
        for(int i = 0, len = array.size(); i < len; i++) {
            fileJson = array.getJSONObject(i);
            fileName = fileJson.getString("file");
            //文件不存在抛出异常
            if (!new File(path + File.separator + "results" + File.separator + fileName).exists()) {
                throw new Exception(path + File.separator + "results" + File.separator + fileName + "文件不存在");
            }

            //video视频文件或封面图
            if (fileJson.getIntValue("clazz") == 20) {
                if (fileName.contains(".flv")) {
                    map.put(path + File.separator + "results" + File.separator + fileName, "video/video" +
                            projectNum + File.separator + fileName.replace("videos/", ""));
                }

                if (fileName.contains(".mp4")) {
                    map.put(path + File.separator + "results" + File.separator + fileName, "video/video" +
                            projectNum + File.separator + fileName.replace("videos/", ""));
                }
            }
        }

        log.info("准备上传文件到oss："+projectNum);
        return map;
    }

    /**
     *  标定算法
     * @param path
     * @throws Exception
     */
    public static Map<String,String> computerCalibration(String path) throws Exception{

        Map<String,String> map = new HashMap<String,String>();

        log.info("开始标定：" );
        //构建算法isModel去掉，因此改成空字符串
        CreateObjUtil.build3dModel(path, "");
//        CreateObjUtil.build3dModel(unicode, "");
        log.info("标定完成转换数据：" );

        boolean vision2 = false;
        //读取upload文件，检验需要上传的文件是否存在
        String uploadData = FileUtils.readFile(path + File.separator + "results" +File.separator+"upload.json");
        JSONObject uploadJson = null;
        JSONArray array = null;
        if(uploadData!=null) {
            uploadJson = JSONObject.parseObject(uploadData);
            array = uploadJson.getJSONArray("upload");
        }
        if(array == null){
            throw new Exception("upload.json数据出错");
        }
        JSONObject fileJson = null;
        String fileName = "";
        for(int i = 0, len = array.size(); i < len; i++) {
            fileJson = array.getJSONObject(i);
            fileName = fileJson.getString("file");
            //文件不存在抛出异常
            if (!new File(path + File.separator + "results" + File.separator + fileName).exists()) {
                throw new Exception(path + File.separator + "results" + File.separator + fileName + "文件不存在");
            }

            if(fileJson.getIntValue("clazz") == 13 || fileJson.getIntValue("clazz") == 14){
                map.put(path + File.separator + "results" +File.separator+ fileName,
                        ConstantFilePath.OSS_PREFIX + path.replace(ConstantFilePath.BUILD_MODEL_PATH, "") +
                                File.separator + fileName);
            }
        }
        return map;
    }
//
    public static void createJson(String path, String splitType, String skyboxType, String dataDescribe,
                                  String sceneNum, String dataSource) throws Exception{
        JSONObject projectJson = new JSONObject();
        projectJson.put("version", "201909231830");
        projectJson.put("protocol", "file api 1.4");
        projectJson.put("uuid", UUID.randomUUID().toString());
        projectJson.put("description", "");
        projectJson.put("time", System.currentTimeMillis());
        projectJson.put("category", "default");
        projectJson.put("tag", null);
        projectJson.put("status", null);
        projectJson.put("sceneNum", sceneNum);
        projectJson.put("dataSource", dataSource);
        FileUtils.writeFile(path + File.separator + "project.json", projectJson.toString());

        JSONObject dataJson = new JSONObject();
        dataJson.put("split_type", splitType);
        dataJson.put("skybox_type", skyboxType);
        dataJson.put("extras", null);
        FileUtils.writeFile(path + File.separator + "data.json", dataJson.toString());
    }

    public static void createExtras(String rebuildParam, String hdrParam, String path) throws Exception {

        FileUtils.writeFile( path + File.separator + "extras" + File.separator + "videos_hdr_param.json", hdrParam);

        FileUtils.writeFile( path + File.separator + "extras" + File.separator + "required_videos.json", rebuildParam);

    }

    public static void createExtras(String rebuildParam,String path) throws Exception {
        FileUtils.writeFile( path + File.separator + "extras" + File.separator + "image-ROI.json", rebuildParam);
    }

    /**
     * 生成标定数据
     * @param calPath
     * @param prefix
     * @throws Exception
     */
    public static void createCalibrationData(String calPath, String prefix) throws Exception{
        File calFile = new File(calPath);
        if(calFile.exists()){
            calFile.mkdirs();
        }
        //删除results和capture文件夹
        FileUtils.deleteDirectory(calPath + "/capture");
        FileUtils.deleteDirectory(calPath + "/results");

//        CreateObjUtil.ossUtilCp(ConstantFilePath.OSS_PREFIX + prefix, calPath + "/capture");
        for(File oldFile : new File(prefix).listFiles()){
            FileUtils.copyFile(oldFile.getAbsolutePath(), calPath + "/capture/" + oldFile.getName(), true);
        }
        JSONObject dataJson = new JSONObject();
        dataJson.put("split_type", "SPLIT_V7");
        dataJson.put("skybox_type", "SKYBOX_V5");
        FileUtils.writeFile(calPath + "/data.json", dataJson.toString());
    }

    public static Map<String, String> getTypeString(String cameraType, String algorithm, String resolution){
        Map<String, String> map = new HashMap<>();
        String splitType = "";
        String skyboxType = "";
        String dataDescribe = "";
        if(Integer.parseInt(cameraType) >= 4){
            if("0".equals(resolution)){
//            skyboxType = "SKYBOX_V4";  //tiles
//            skyboxType = "SKYBOX_V6";    //high,low,4k
                skyboxType = "SKYBOX_V7";    //high,low,2k
            }else {
                skyboxType = "SKYBOX_V1";
            }
            splitType = "SPLIT_V1";
//            skyboxType = "SKYBOX_V4";  //tiles
            dataDescribe = "double spherical";

            if(Integer.parseInt(cameraType) == 5 ){
                //新双目相机
//              skyboxType = "SKYBOX_V9";
                splitType = "SPLIT_V9";
                skyboxType = "SKYBOX_V1";
            }
            if(Integer.parseInt(cameraType) == 6){
                //小红屋新双目相机
//                    skyboxType = "SKYBOX_V9";
                splitType = "SPLIT_V3";
                skyboxType = "SKYBOX_V7";
            }

            if(Integer.parseInt(cameraType) == 13){
                //转台相机
                skyboxType = "SKYBOX_V6";
                splitType = "SPLIT_V12";
            }

            if(Integer.parseInt(cameraType) == 14){
                //转台相机
                log.info("激光转台相机调用算法");
                skyboxType = "SKYBOX_V11";
                splitType = "SPLIT_V14";
            }

        }else {
            if("sfm".equals(algorithm)){
                splitType = "SPLIT_V2";
                skyboxType = "SKYBOX_V1";
                dataDescribe = "old sfm";
            }else {
                splitType = "SPLIT_V3";
                skyboxType = "SKYBOX_V1";
                dataDescribe = "old slam";
            }
        }
        map.put("splitType", splitType);
        map.put("skyboxType", skyboxType);
        map.put("dataDescribe", dataDescribe);
        return map;
    }

//    public static SceneEntity createScene(String projectNum, Long cameraId, String cameraName, String phoneId, String scenepsd,
//                                          String unicode, Long cameraType, String fileId, String prefix,
//                                          String imgsName, String pic, String isModel, Long userId, String userName,
//                                          String algorithm, Integer sceneShootCount, String sceneName,
//                                          String sceneDec, Integer sceneType, String gps, ISceneService sceneService,
//                                          Integer type, ModelingMsgProducer producer, String url, String ecsType,
//                                          RubberSheetingUtil rubberSheetingUtil)throws Exception{
//        //先返回链接地址
//        SceneEntity scene = new SceneEntity();
//        scene.setWebSite(url+projectNum);
//        scene.setCameraId(cameraId);
//        scene.setPhoneId(phoneId);
//        scene.setNum(String.valueOf(projectNum));
//        if(scenepsd == null)
//        {
//            scenepsd = "";
//        }
//        if(!scenepsd.equals(""))
//        {
//            scene.setSceneKey(scenepsd);
//        }
//
//        if(!StringUtils.isEmpty(ecsType)){
//            scene.setEcs(ecsType);
//        }
//
//        String path =  ConstantFilePath.BUILD_MODEL_PATH + unicode;
//
//        if(cameraType.longValue() >= 4){
//            scene.setDataSource(ConstantFilePath.BUILD_MODEL_PATH +
//                    cameraName.replace("4DKKPRO_", "").replace("-fdage", "").toLowerCase() + File.separator + fileId + File.separator + unicode);
//        }else {
//            scene.setDataSource(prefix+imgsName);
//        }
//
//        if(cameraType.longValue() == 14){
//
//            scene.setDataSource(ConstantFilePath.BUILD_MODEL_LASER_PATH +
//                    cameraName.replace("4DKKPRO_", "").replace("-fdage", "").toLowerCase() + File.separator +
//                    fileId + File.separator + unicode);
//
//            log.info("激光相机 dataSource ：" + scene.getDataSource());
//
//        }
//
//
//        if(pic!=null&&pic.length()>5)
//        {
//            scene.setThumb(pic);
//        }
//        else
//        {
//            scene.setThumb(ConstantUrl.DEFAULT_SCENE_PIC);
//        }
//
//        String parametr = "";
//        parametr+=unicode+":;"+path+":;"+prefix+":;"+imgsName+":;"+projectNum+":;"+isModel;
//        if(userName!=null&&!userName.trim().equals(""))
//        {
//            parametr+=":;"+userName;
//            scene.setUserId(userId);
//        }
//        else
//        {
//            parametr+=":;noMan";
//        }
//        parametr+=":;"+cameraType;
//        parametr+=":;"+algorithm;
//        parametr += ":;" + fileId;
//        parametr += ":;" + cameraName;
//        parametr += ":;1";
//        log.info("大场景添加到队列："+parametr);
//        producer.sendMsg(parametr);
//
//        if(sceneShootCount == null)
//        {
//            scene.setShootCount(0);
//        }
//        else
//        {
//            scene.setShootCount(sceneShootCount);
//        }
//        if(sceneName!=null)
//        {
//            scene.setSceneName(sceneName);
//        }
//        if(sceneDec!=null)
//        {
//            scene.setSceneDec("<p>"+sceneDec+"</p>");
//        }
//
//        if(sceneType!=null)
//        {
//            scene.setSceneType(sceneType);
//        }
//
//        if(gps!=null&&!gps.trim().equals(""))
//        {
//            scene.setGps(gps);
//        }
//
//        scene.setSceneScheme(cameraType.intValue());
//        scene.setAlgorithm(algorithm);
//        log.info("场景记录添加到数据库："+projectNum);
//        if(type == 0){
//            sceneService.save(scene);
//        }
//
//        JSONObject scenejson = JSONObject.parseObject(JSONObject.toJSONString(scene));
//        scenejson.put("thumbImg", 0);
//        scenejson.put("version", 0);
//        scenejson.put("floorLogo", 0);
//        if(!scenepsd.equals("")){
//            scenejson.put("scenePsd", scenepsd);
//            scenejson.put("public", 1);
//        }else{
//            scenejson.put("scenePsd", "");
//            scenejson.put("public", 0);
//        }
//        if(cameraType < 4){
//            scenejson.put("visions", 1);
//        }else {
//            scenejson.put("visions", 2);
//        }
//        scenejson.put("createTime", new DateTime(new Date()).toString("yyyy-MM-dd HH:mm"));
//
//        File file = new File(ConstantFilePath.SCENE_PATH+"data/data"+projectNum);
//        if(!file.exists()||!file.isDirectory())
//        {
//            file.mkdirs();
//        }
//        FileUtils.writeFile(ConstantFilePath.SCENE_PATH+"data/data"+projectNum+File.separator+"scene.json", scenejson.toString());
//
//        //生成二维码
//        MatrixToImageWriterUtil.createQRCode(url + projectNum, ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+projectNum+".png", null);
//        MatrixToImageWriterUtil.createQRCode(url + projectNum + "&lang=en", ConstantFilePath.BASE_PATH + File.separator + "sceneQRcode/"+projectNum+"_en.png", null);
//        log.info("二维码生成完成");
//
//        return scene;
//    }


    public static BuildSceneMqMessage getBuildSceneMqMessage(String projectNum, String cameraName, String unicode, Long cameraType, String fileId,
                                               String prefix, String imgsName, String isModel, String userName,
                                               String algorithm, Integer resolution, String buildType, String path) {
        BuildSceneMqMessage mqMsg = new BuildSceneMqMessage();
        mqMsg.setSceneNum(projectNum);
        mqMsg.setCameraName(cameraName);
        mqMsg.setUnicode(unicode);
        mqMsg.setCameraType(String.valueOf(cameraType));
        mqMsg.setFileId(fileId);
        mqMsg.setPrefix(prefix);
        mqMsg.setImgsName(imgsName);
        mqMsg.setIsModel(isModel);
        mqMsg.setUserName(userName);
        mqMsg.setAlgorithm(algorithm);
        mqMsg.setResolution(String.valueOf(resolution));
        mqMsg.setBuildType(buildType);
        mqMsg.setPath(path);
        return mqMsg;
    }

    public static String getMQMsg(String projectNum, String cameraName, String unicode, Long cameraType, String fileId,
                                  String prefix, String imgsName, String isModel,String userName,
                                  String algorithm, Integer resolution, String buildType, String path) {
        String parametr = "";
        parametr+= unicode +":;"+ path +":;"+ prefix +":;"+ imgsName +":;"+ projectNum +":;"+ isModel;
        if(userName !=null&&!userName.trim().equals("")){
            parametr+=":;"+ userName;
        }else{
            parametr+=":;noMan";
        }
        parametr+=":;"+ cameraType;
        parametr+=":;"+ algorithm;
        parametr += ":;" + fileId;
        parametr += ":;" + cameraName;
        if(resolution == null){
            parametr += ":;0";
        }else {
            parametr += ":;" + resolution.intValue();
        }

        if(buildType != null){
            parametr += ":;" + buildType;
        }

        log.info("pro大场景添加到队列："+parametr);
        return parametr;
    }
}
