dengsixing пре 5 месеци
родитељ
комит
b1a90b6f11

+ 1 - 31
src/main/java/com/fdkankan/Application.java

@@ -1,56 +1,26 @@
 package com.fdkankan;
 
-import cn.hutool.core.date.DatePattern;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.date.format.DateParser;
-import cn.hutool.core.util.StrUtil;
 import com.dtflys.forest.springboot.annotation.ForestScan;
-import com.fdkankan.project.tieta.constant.Constant;
-import com.fdkankan.project.tieta.service.IConvertService;
-import com.fdkankan.redis.util.RedisClient;
 import lombok.extern.slf4j.Slf4j;
 import org.mybatis.spring.annotation.MapperScan;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.CommandLineRunner;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.context.annotation.ComponentScan;
-import org.springframework.core.convert.ConversionService;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
-import javax.annotation.Resource;
-import java.util.Date;
-
 @Slf4j
 @SpringBootApplication
 @EnableScheduling
 @EnableAsync
 @MapperScan("com.fdkankan.project.tieta.mapper")
 @ForestScan("com.fdkankan.project.tieta.httpclient")
-public class Application implements CommandLineRunner {
+public class Application {
 
-    @Autowired
-    private IConvertService convertService;
-    @Resource
-    private RedisClient redisClient;
 
     public static void main(String[] args) {
         SpringApplication.run(Application.class, args);
     }
 
-    @Override
-    public void run(String... args) throws Exception {
-
-//        Date date = new Date();
-//        if(date.after(DateUtil.parse("2025-02-20", DatePattern.NORM_DATE_PATTERN))){
-//            return;
-//        }
-
-//        log.info("推送历史数据开始");
-//        convertService.pushOldHistory();
-//        log.info("推送历史数据结束");
-    }
 }
 
 

+ 0 - 10
src/main/java/com/fdkankan/project/tieta/controller/ConvertController.java

@@ -67,16 +67,6 @@ public class ConvertController {
 
     @GetMapping("/pushHistory2")
     public ResultData pushHistory2(){
-//        List<FullphotoFileindex> fullphotoFileindices = null;
-//        long current = 1;
-//        int size = 1;
-//        Page<FullphotoFileindex> fullphotoFileindexPage = null;
-//        do {
-//            fullphotoFileindexPage = fullphotoFileindexService.pageStationCodeAndEntityId(current, size);
-//            fullphotoFileindices = fullphotoFileindexPage.getRecords();
-//        }while (fullphotoFileindexPage.hasNext());
-//
-//        return ResultData.ok();
         IPage<FullphotoFileindex> page = fullphotoFileindexService.page(new Page<>(1, 100));
         return ResultData.ok();
 

+ 0 - 5
src/main/java/com/fdkankan/project/tieta/controller/SceneController.java

@@ -3,7 +3,6 @@ package com.fdkankan.project.tieta.controller;
 
 import com.fdkankan.project.tieta.bean.ResultData;
 import com.fdkankan.project.tieta.entity.Scene;
-import com.fdkankan.project.tieta.service.FullphotoFileindexService;
 import com.fdkankan.project.tieta.service.SceneService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -38,10 +37,6 @@ public class SceneController {
         return  ResultData.ok();
     }
 
-    @Autowired
-    private FullphotoFileindexService fullphotoFileindexService;
-
-
     @GetMapping(value = "/ping")
     public ResultData ping(){
         return ResultData.ok();

+ 0 - 18
src/main/java/com/fdkankan/project/tieta/generator/AutoGenerate.java

@@ -22,24 +22,6 @@ public class AutoGenerate {
         generate(path,"project.tieta.generator", getTables(new String[]{
                 "T_FULLPHOTO_UPRECORD"
         }));
-
-//        generate(path,"goods", getTables(new String[]{
-//                        "t_camera","t_camera_detail","t_camera_out","t_camera_space","t_camera_version",
-//                        "t_company","t_goods","t_goods_sku","t_cart","t_goods_spec",
-//                        "t_goods_spec_value","t_goods_spu_spec","t_sn_code"
-//        }));
-//
-//        generate(path,"order", getTables(new String[]{
-//                        "t_increment_order","t_invoice","t_order","t_order_item",
-//                        "t_pre_sale","t_space_sdk","t_trade_log","t_commerce_order","t_download_order","t_expansion_order"
-//        }));
-//        generate(path,"order", getTables(new String[]{
-//                        "t_virtual_order"
-//        }));
-//
-//        generate(path,"user", getTables(new String[]{
-//                        "t_user","t_user_increment","t_manager","t_province","t_increment_type","t_intercom_message","t_receiver_info"
-//        }));
     }
 
     public static List<String> getTables(String [] tableNames){

+ 0 - 189
src/main/java/com/fdkankan/project/tieta/generator/MappingGeneratorOracle.java

@@ -1,189 +0,0 @@
-//package com.fdkankan.project.tieta.generator;
-//
-//import com.baomidou.mybatisplus.annotation.DbType;
-//import com.baomidou.mybatisplus.annotation.IdType;
-//import com.baomidou.mybatisplus.generator.AutoGenerator;
-//import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
-//import com.baomidou.mybatisplus.generator.config.GlobalConfig;
-//import com.baomidou.mybatisplus.generator.config.PackageConfig;
-//import com.baomidou.mybatisplus.generator.config.StrategyConfig;
-//import com.baomidou.mybatisplus.generator.config.converts.MySqlTypeConvert;
-//import com.baomidou.mybatisplus.generator.config.rules.DateType;
-//import com.baomidou.mybatisplus.generator.config.rules.NamingStrategy;
-//import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
-//
-///**
-// * 代码生成器
-// *
-// * <p>
-// * 根据数据库中的表生成:数据库表映射对象、Mapper 接口、Mapper XML 文件(含基础的 ResultMap 和字段代码片段)、 Service
-// * 接口、Service 接口实现累、基础的 Controller 类。
-// * </p>
-// * <p>
-// * 如果数据库设计符合规范,并且代码没有特殊要求。设置好表名前缀(无则忽略)、表字段前缀(无则忽略)后, 直接修改输出的路径、JDBC
-// * Url、数据库的账户和密码即可直接生成代码。
-// * </p>
-// * <p>
-// * 生成后将 Mapper 中的 xml 包中的 XML 文件移动到 resource 下即可,XML 存放文件夹名为 Mapper
-// * 接口包名(全包名)的同名文件夹<br/>
-// * 如 Mapper 接口包名为:com.example.mapper,那么在 resource 下新建同名文件夹:com.example.mapper,将
-// * xml 文件移动到该文件夹下即可。
-// * </p>
-// *
-// * @author wayne
-// * @since 2020-01-08 23:00
-// */
-//public class MappingGeneratorOracle {
-//
-//	/**
-//	 * 生成代码输出路径,<strong>路径必须是绝对路径,不需要包含包名</strong>
-//	 */
-//	private static final String OUTPUT_DIR = ".\\src\\main\\java\\com\\fdkankan\\project\\tieta\\generator";
-//	/**
-//	 * 生成代码输出的包名
-//	 * <p>
-//	 * 总包名,后续生成的 Mapper,Service 等将在该包下生成子包
-//	 * </p>
-//	 */
-//	private static final String PACKAGE = "com.fdkankan.project.tieta";
-//	/**
-//	 * JDBC URL 说明: url地址前需要加上@,否则会报错
-//	 */
-//
-//	private static final String JDBC_URL = "jdbc:oracle:thin:@//10.180.41.37:1521/resdb";
-//	/**
-//	 * 数据库账户
-//	 */
-//	private static final String DB_USERNAME = "RES_FILE";
-//	/**
-//	 * 数据库账户密码
-//	 */
-//	private static final String DB_PASSWORD = "qNQVkH3YbA";
-//
-//	/**
-//	 * 执行即可生成代码 需要添加 freemarker 依赖 <dependency> <groupId>org.freemarker</groupId>
-//	 * <artifactId>freemarker</artifactId> <version>2.3.29</version> </dependency>
-//	 */
-//	// 不要在src/main/java里面使用main方法,否则springboot项目某人为main方法的类就是启动类
-////	public static void main(String[] args) {
-////		autoGenerator().execute();
-////	}
-//
-//	public static AutoGenerator autoGenerator() {
-//		AutoGenerator autoGenerator = new AutoGenerator();
-//		autoGenerator.setGlobalConfig(globalConfig());
-//		autoGenerator.setDataSource(oracleDataSourceConfig());
-//		autoGenerator.setStrategy(strategyConfig());
-//		autoGenerator.setPackageInfo(packageConfig());
-//		autoGenerator.setTemplateEngine(new FreemarkerTemplateEngine());
-//		return autoGenerator;
-//	}
-//
-//	public static void main(String[] args) {
-//		autoGenerator().execute();
-//	}
-//
-//	/**
-//	 * 全局配置
-//	 *
-//	 * @return {@link GlobalConfig}
-//	 */
-//	private static GlobalConfig globalConfig() {
-//		GlobalConfig globalConfig = new GlobalConfig();
-//		globalConfig.setAuthor("dsx");
-//		// 设置代码输出位置,需要绝对路径
-//		globalConfig.setOutputDir(OUTPUT_DIR);
-//		// 覆盖已有的代码
-//		globalConfig.setFileOverride(false);
-//		// 基本表的 ResultMap
-//		globalConfig.setBaseResultMap(true);
-//		// 基本表字段片段
-//		globalConfig.setBaseColumnList(true);
-//		// 开启基于 Model 操作数据库
-//		globalConfig.setActiveRecord(true);
-//		//
-//		globalConfig.setDateType(DateType.ONLY_DATE);
-//		// 设置 ID 类型
-//		globalConfig.setIdType(IdType.AUTO);
-////		// 生成基本 Swagger2 文档
-////		globalConfig.setSwagger2(true);
-//		// 开启二级缓存
-////		globalConfig.setEnableCache(true);
-//		// 设置生成的对象名称规则,%s 表示当前的 Entity
-//		// 数据库表映射对象名称规则
-//		globalConfig.setEntityName("%s");
-//		// 也可以使用下面这种就是末尾会以DO结尾
-////		globalConfig.setEntityName("%sDO");
-//		// Mapper 接口名称规则
-//		globalConfig.setMapperName("%sMapper");
-//		// Mapper XML 文件名称规则
-//		globalConfig.setXmlName("%sMapper");
-//		// Controller 生成规则
-//		globalConfig.setControllerName("%sController");
-//		// Service 接口生成名称规则
-//		globalConfig.setServiceName("%sService");
-//		// Service 实现类生成名称规则
-//		globalConfig.setServiceImplName("%sServiceImpl");
-//		return globalConfig;
-//	}
-//
-//	/**
-//	 * 生成策略配置
-//	 *
-//	 * @return StrategyConfig
-//	 */
-//	private static StrategyConfig strategyConfig() {
-//		StrategyConfig strategyConfig = new StrategyConfig();
-//		strategyConfig.setCapitalMode(false);
-//		strategyConfig.setEntityLombokModel(true);
-//		strategyConfig.setRestControllerStyle(true);
-//		strategyConfig.setNaming(NamingStrategy.underline_to_camel);
-//		strategyConfig.setColumnNaming(NamingStrategy.underline_to_camel);
-//		// TODO 填写表前缀、表字段前缀,生成代码时去除字段前缀
-//		strategyConfig.setTablePrefix("t_");
-//		strategyConfig.setFieldPrefix("a_", "c_", "e_", "f_", "p_", "r_", "t_", "tf_");
-//		strategyConfig.setInclude("T_FULLPHOTO_FILEINDEX");
-//		return strategyConfig;
-//	}
-//
-//	/**
-//	 * MySQL 数据源配置
-//	 *
-//	 * @return DataSourceConfig
-//	 */
-//	private static DataSourceConfig oracleDataSourceConfig() {
-//		DataSourceConfig dataSourceConfig = new DataSourceConfig();
-//		dataSourceConfig.setDbType(DbType.ORACLE);
-//		dataSourceConfig.setTypeConvert(new MySqlTypeConvert());
-//		dataSourceConfig.setDriverName("oracle.jdbc.driver.OracleDriver");
-//		dataSourceConfig.setUrl(JDBC_URL);
-//		dataSourceConfig.setUsername(DB_USERNAME);
-//		dataSourceConfig.setPassword(DB_PASSWORD);
-//		return dataSourceConfig;
-//	}
-//
-//	/**
-//	 * 包相关配置信息
-//	 * <p>
-//	 * 配置生成代码的包信息,如生成的 Mapper 包,Service 包等
-//	 * </p>
-//	 */
-//	private static PackageConfig packageConfig() {
-//		PackageConfig packageConfig = new PackageConfig();
-//		// 设置父包
-//		packageConfig.setParent(PACKAGE);
-//		// TODO 设置生成代码的包
-//		// Controller 包
-//		packageConfig.setController("controller");
-//		// 数据库表映射对象包
-//		packageConfig.setEntity("entity");
-//		// Mapper 接口包,含 XML 文件
-//		packageConfig.setMapper("mapper");
-//		// Service 接口包
-//		packageConfig.setService("service");
-//		// Service 接口实现类包
-//		packageConfig.setServiceImpl("service.impl");
-//		return packageConfig;
-//	}
-//}
-//

+ 3 - 0
src/main/java/com/fdkankan/project/tieta/schedule/Job.java

@@ -37,6 +37,9 @@ public class Job {
     @Autowired
     private FullphotoFileindexService fullphotoFileindexService;
 
+    /**
+     * 定时推送vr渲染,10分钟执行一次,项目启动延迟2分钟开始第一次执行
+     */
     @Scheduled(initialDelay = 2*10*1000, fixedDelay = 10*60*1000)
     public void push(){
             String startTimeStr = redisClient.get(Constant.REDIS_SCENE_CONVERT_STARTTIME);

+ 12 - 0
src/main/java/com/fdkankan/project/tieta/service/impl/ConvertServiceImpl.java

@@ -54,6 +54,12 @@ public class ConvertServiceImpl implements IConvertService {
         mqProducer.sendByWorkQueue(Constant.QUEUE_SCENE_CONVERT, playload);
     }
 
+    /**
+     * 推送场景
+     * @param dto
+     * @param convertType
+     * @return
+     */
     @Override
     public ResultData scenePush(ScenePushDTO dto, String convertType) {
         JSONObject playload = new JSONObject();
@@ -71,6 +77,7 @@ public class ConvertServiceImpl implements IConvertService {
         if(CollUtil.isEmpty(fullphotoFileindices)){
             return ResultData.error(ServerCode.RESOURCE_NOT_EXIST);
         }
+        //组装推送载荷
         List<JSONObject> fileList = fullphotoFileindices.stream().filter(v->StrUtil.isNotEmpty(v.getFileUrl())).map(v -> {
             JSONObject item = new JSONObject();
             item.put("fileName", v.getFileName());
@@ -110,6 +117,11 @@ public class ConvertServiceImpl implements IConvertService {
         }while (fullphotoFileindexPage.hasNext());
     }
 
+    /**
+     * 推送历史场景记录
+     * @param stationCode
+     * @param entityId
+     */
     @Override
     public void pushOldHistory(String stationCode, String entityId) {
 

+ 11 - 0
src/main/java/com/fdkankan/project/tieta/service/impl/FullphotoFileindexServiceImpl.java

@@ -30,6 +30,12 @@ public class FullphotoFileindexServiceImpl extends ServiceImpl<FullphotoFileinde
                 .orderByAsc(FullphotoFileindex::getUpTime));
     }
 
+    /**
+     * 根据站址编码和机房id分页查询
+     * @param current
+     * @param size
+     * @return
+     */
     @Override
     public Page<FullphotoFileindex> pageStationCodeAndEntityId(long current, int size) {
         Page<FullphotoFileindex> fullphotoFileindexPage = new Page<>(current, size);
@@ -37,6 +43,11 @@ public class FullphotoFileindexServiceImpl extends ServiceImpl<FullphotoFileinde
         return fullphotoFileindexPage1;
     }
 
+    /**
+     * 根据上传id查询列表
+     * @param uploadId
+     * @return
+     */
     @Override
     public List<FullphotoFileindex> listByUploadId(String uploadId) {
         return this.list(new LambdaQueryWrapper<FullphotoFileindex>()

+ 0 - 161
src/main/java/com/fdkankan/project/tieta/utils/ConvertUtil.java

@@ -1,161 +0,0 @@
-//package com.fdkankan.project.tieta.utils;
-//
-//import cn.hutool.core.io.FileUtil;
-//import com.alibaba.fastjson.JSON;
-//import com.alibaba.fastjson.JSONArray;
-//import com.alibaba.fastjson.JSONObject;
-//
-//import java.io.File;
-//import java.util.Objects;
-//
-//public class ConvertUtil {
-//
-//    private static String result_dir = "results";
-//
-//    private static String floorplanJson_Name = "floorplan.json";
-//
-//    /**
-//     *
-//     * @param sourcePath 原始资源目录
-//     * @param targetPath 目标资源目录
-//     * @return boolean true-转换成功  false-转换失败
-//     */
-//    public static void convert(String sourcePath, String targetPath) throws Exception {
-//
-//        String obj2TxtPath = null;
-//
-//        try {
-//            if(!sourcePath.endsWith(File.separator)){
-//                sourcePath = sourcePath + File.separator;
-//            }
-//            if(!targetPath.endsWith(File.separator)){
-//                targetPath = targetPath + File.separator;
-//            }
-//            String targetDataPath = targetPath + "data";
-//            FileUtil.mkdir(new File(targetDataPath));
-//            String targetImagePath = targetPath + "images";
-//            FileUtil.mkdir(new File(targetImagePath));
-//
-//            obj2TxtPath = sourcePath.substring(0, sourcePath.length() - 1) + "_obj2txt";
-//            FileUtil.mkdir(obj2TxtPath);
-//            //调用算法生成modeldata.txt
-//            String extrasPath = obj2TxtPath + File.separator + "extras";
-//            FileUtil.mkdir(extrasPath);
-//            FileUtil.copyContent(new File(sourcePath + "data" + File.separator + "mesh"), new File(extrasPath), true);
-//
-//            //写data.json
-//            writeDataJson(obj2TxtPath);
-//
-//            //调用算法建模
-//            build3dModel(obj2TxtPath);
-//
-//            //校验算法是否正常结束
-//            String uploadJsonPath = obj2TxtPath + File.separator + result_dir +File.separator+"upload.json";
-//            boolean success = checkComputeCompleted(uploadJsonPath, 5, 300);
-//            if(!success){
-//                throw new RuntimeException("计算失败,obj2TxtPath:" + obj2TxtPath);
-//            }
-//
-//            //压缩成dam
-//            String damPath = targetImagePath + File.separator + "tieta.dam";
-//            CreateObjUtil.convertTxtToDam( obj2TxtPath + File.separator + result_dir +File.separator+"modeldata.txt", damPath);
-//
-//            //复制贴图
-//            String uploadData = FileUtil.readUtf8String(uploadJsonPath);
-//            JSONObject uploadJson = null;
-//            JSONArray array = null;
-//            if(uploadData!=null) {
-//                uploadJson = JSONObject.parseObject(uploadData);
-//                array = uploadJson.getJSONArray("upload");
-//            }
-//            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(obj2TxtPath + File.separator + result_dir + File.separator + fileName).exists()) {
-//                    throw new Exception(obj2TxtPath + File.separator + result_dir + File.separator + fileName + "文件不存在");
-//                }
-//
-//                //tex文件夹
-//                if (fileJson.getIntValue("clazz") == 15) {
-//                    FileUtil.copy(obj2TxtPath + File.separator + result_dir + File.separator + fileName,
-//                            targetImagePath + File.separator + "tieta_texture/" + fileName.replace("tex/", ""),true);
-//                }
-//            }
-//
-//            //复制文件
-//            FileUtil.copyContent(new File(sourcePath + "data"), new File(targetDataPath), true);
-//            if(FileUtil.exist(targetDataPath + "/" + floorplanJson_Name)){
-//                String floorplanJson = FileUtil.readUtf8String(targetDataPath + "/" + floorplanJson_Name);
-//                JSONObject jsonObject = JSON.parseObject(floorplanJson);
-//                Integer currentId = jsonObject.getInteger("currentId");
-//                if(Objects.nonNull(currentId) && currentId == 0){
-//                    FileUtil.del(targetDataPath + "/" + floorplanJson_Name);
-//                }
-//            }
-//
-//
-//            String finalSourcePath = sourcePath;
-//            if(FileUtil.exist(finalSourcePath + "images/4k/")){
-//                FileUtil.listFileNames(sourcePath + "images/4k/").stream().forEach(v->{
-//                    FileUtil.copy(finalSourcePath + "images/4k/" + v, targetImagePath + "/pan/high/" + v.replaceAll("-", ""), true);
-//                });
-//            }
-//
-//            if(FileUtil.exist(finalSourcePath + "images/512/")){
-//                FileUtil.listFileNames(finalSourcePath + "images/512/").stream().forEach(v->{
-//                    FileUtil.copy(finalSourcePath + "images/512/" + v, targetImagePath + "/pan/low/" + v.replaceAll("-", ""), true);
-//                });
-//            }
-//
-//            if(FileUtil.exist(finalSourcePath + "images/8k/")) {
-//                FileUtil.listFileNames(finalSourcePath + "images/8k/").stream().forEach(v -> {
-//                    FileUtil.copy(finalSourcePath + "images/8k/" + v, targetImagePath + "/pan/8k/" + v.replaceAll("-", ""), true);
-//                });
-//
-//            }
-//            FileUtil.copy(sourcePath + "images/vision.txt", targetImagePath + "/vision.txt", true);
-//
-//            //生成vison.modeldata
-//            CreateObjUtil.convertTxtToVisionmodeldata(targetImagePath + "/vision.txt", targetImagePath + "/vision.modeldata");
-//        }finally {
-////            FileUtil.del(obj2TxtPath);
-//        }
-//    }
-//
-//    public static void writeDataJson(String path){
-//        JSONObject dataJson = new JSONObject();
-//        dataJson.put("obj2txt", true);
-//        dataJson.put("split_type", "SPLIT_V6");
-//        dataJson.put("data_describe", "double spherical");
-//        dataJson.put("skybox_type", "SKYBOX_V5");
-//        FileUtil.writeUtf8String(dataJson.toString(), path + File.separator + "data.json");
-//    }
-//
-//    public static void build3dModel(String folderName) throws Exception {
-//        System.out.println("开始建模");
-//        String command = "sudo bash /home/ubuntu/bin/Launcher.sh " + folderName;
-//        CmdUtils.callLineSh(command);
-//        System.out.println("计算完毕:" + command);
-//    }
-//
-//    public static boolean checkComputeCompleted(String uploadJsonPath, int maxCheckTimes, long waitTime) throws Exception {
-//        int checkTimes = 1;
-//        boolean exist = false;
-//
-//        do {
-//            if ((new File(uploadJsonPath)).exists()) {
-//                exist = true;
-//                break;
-//            }
-//
-//            Thread.sleep(waitTime);
-//            ++checkTimes;
-//        } while(checkTimes <= maxCheckTimes);
-//
-//        return exist;
-//    }
-//
-//}

+ 0 - 171
src/main/java/com/fdkankan/project/tieta/utils/CreateObjUtil.java

@@ -1,171 +0,0 @@
-//package com.fdkankan.project.tieta.utils;
-//
-//import com.alibaba.fastjson.JSON;
-//import com.alibaba.fastjson.JSONArray;
-//import com.alibaba.fastjson.JSONObject;
-//import com.fdkankan.project.tieta.proto.BigSceneProto;
-//import com.fdkankan.project.tieta.proto.Visionmodeldata;
-//import com.fdkankan.project.tieta.proto.format.JsonFormat;
-//import com.google.protobuf.TextFormat;
-//import lombok.extern.slf4j.Slf4j;
-//
-//import java.io.*;
-//import java.util.HashMap;
-//import java.util.Map;
-//
-//@Slf4j
-//public class CreateObjUtil {
-//
-//
-//	public static void main(String[] args) throws Exception {
-////		Scanner scanner = new Scanner(System.in);
-////		System.out.println("输入需要调用的转换方法:");
-////		System.out.println("convertTxtToVisionmodeldata:输入1");
-////		System.out.println("convertTxtToDam:输入2");
-////		int type = scanner.nextInt();
-////		scanner.reset();
-////		System.out.println("输入源文件路径:");
-////		String srcPath = scanner.next();
-////		System.out.println("输入目标文件路径:");
-////		String targetPath = scanner.next();
-//
-//		String type = args[0];//类型(1-vision.txt转为vision.modeldata, 2-modeldata.txt转为tieta.dam)
-//		String srcPath = args[1];//源文件目录(需要提前源文件放到此目录中再调用方法)
-//		String targetPath = args[2];//目标文件路径(目录,转换后文件会放到此目录中,文件名固定为vision.modeldata或tieta.dam)
-//
-//		if(type.equals("1")){
-//			String srcFileName = "vision.txt";
-//			String targetFileName = "vision.modeldata";
-//			CreateObjUtil.convertTxtToVisionmodeldata(srcPath.concat(File.separator).concat(srcFileName),targetPath.concat(File.separator).concat(targetFileName));
-//		}
-//		if(type.equals("2")){
-//			String srcFileName = "modeldata.txt";
-//			String targetFileName = "tieta.dam";
-//			CreateObjUtil.convertTxtToDam(srcPath.concat(File.separator).concat(srcFileName),targetPath.concat(File.separator).concat(targetFileName));
-//		}
-//
-////		scanner.close();
-//	}
-//
-//	/**
-//	 * modeldata.txt 转 dam
-//	 * @param srcpath 源文件全路径,如D:\test\modeldata.txt
-//	 * @param despath 目标文件全路径,如D:\test\tieta.dam
-//	 * @throws Exception
-//	 */
-//	public static void convertTxtToDam(String srcpath,String despath)throws Exception{
-//		InputStream inputStream = null;
-//		InputStreamReader reader = null;
-//		ByteArrayInputStream stream = null;
-//		BufferedOutputStream bos = null;
-//		BufferedInputStream bis = null;
-//		try{
-//			BigSceneProto.binary_mesh.Builder builder = BigSceneProto.binary_mesh.newBuilder();
-//			inputStream = new FileInputStream(srcpath);
-//			reader = new InputStreamReader(inputStream, "ASCII");
-//			TextFormat.merge(reader, builder);
-//			byte[] buf = builder.build().toByteArray();
-//
-//			//把序列化后的数据写入本地磁盘
-//			stream = new ByteArrayInputStream(buf);
-//			bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
-//			bis = new BufferedInputStream(stream);
-//			int b = -1;
-//			while ((b = bis.read()) != -1) {
-//				bos.write(b);
-//			}
-//		}catch (Exception e){
-//			log.error("txt转dam出错,srcpath:{}, despath:{}",srcpath, despath);
-//			throw e;
-//		}finally {
-//			if(inputStream != null){
-//				inputStream.close();
-//			}
-//			if(reader != null){
-//				reader.close();
-//			}
-//			if(stream != null){
-//				stream.close();
-//			}
-//			if(bos != null){
-//				bos.close();
-//			}
-//			if(bis != null){
-//				bis.close();
-//			}
-//		}
-//
-//	}
-//
-//	/**
-//	 * vision.txt 转 vision.modeldata
-//	 * @param srcpath 源文件全路径,如D:\test\vision.txt
-//	 * @param despath 目标文件全路径,如D:\test\vision.modeldata
-//	 * @throws Exception
-//	 */
-//	public static void convertTxtToVisionmodeldata(String srcpath,String despath)throws Exception {
-//
-//		Visionmodeldata.NavigationInfo.Builder builder = Visionmodeldata.NavigationInfo.newBuilder();
-//		String jsonFormat = transferVisionUuidToIndex(srcpath);
-//		JsonFormat.merge(jsonFormat, builder);
-//		byte[] buf= builder.build().toByteArray();
-//
-//		//把序列化后的数据写入本地磁盘
-//		try(ByteArrayInputStream stream = new ByteArrayInputStream(buf);
-//			BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(despath));//设置输出路径
-//			BufferedInputStream bis = new BufferedInputStream(stream)){
-//			int b = -1;
-//			while ((b = bis.read()) != -1) {
-//				bos.write(b);
-//			}
-//		}
-//	}
-//
-//	public static String readTxtFileToJson(String filePath){
-//		try {
-//			String encoding="UTF-8";
-//			File file=new File(filePath);
-//			if(file.isFile() && file.exists()){
-//				InputStreamReader read = new InputStreamReader(
-//						new FileInputStream(file),encoding);
-//				BufferedReader bufferedReader = new BufferedReader(read);
-//				String lineTxt = null;
-//				String result="";
-//				while((lineTxt = bufferedReader.readLine()) != null){
-//					result+=lineTxt;
-//					//log.info(lineTxt);
-//				}
-//				read.close();
-//				return result;
-//			}else{
-//				return null;
-//			}
-//		} catch (Exception e) {
-//			e.printStackTrace();
-//			return null;
-//		}
-//
-//	}
-//
-//	public static String transferVisionUuidToIndex(String srcPath){
-//		String visionJsonStr = readTxtFileToJson(srcPath);
-//		JSONObject visionJson = JSON.parseObject(visionJsonStr);
-//		JSONArray sweepLocationArr = visionJson.getJSONArray("sweepLocations");
-//		Map<String, Integer> uuidIndexMap = new HashMap<>();
-//		for (int i = 0; i < sweepLocationArr.size(); i++) {
-//			JSONObject sweepLocationObj = (JSONObject)sweepLocationArr.get(i);
-//			uuidIndexMap.put(sweepLocationObj.getString("uuid"), i);
-//		}
-//		for (Object o : sweepLocationArr) {
-//			JSONObject sweepLocationObj = (JSONObject)o;
-//			JSONArray visibles =  sweepLocationObj.getJSONArray("visibles");
-//			int[] visiblesArr = new int[visibles.size()];
-//			for(int i = 0; i < visibles.size(); i++){
-//				visiblesArr[i] = uuidIndexMap.get(visibles.get(i));
-//			}
-//			sweepLocationObj.put("visibles", visiblesArr);
-//		}
-//		return JSON.toJSONString(visionJson);
-//	}
-//
-//}

+ 19 - 0
src/main/java/com/fdkankan/project/tieta/utils/FdfsUtil.java

@@ -38,6 +38,12 @@ public class FdfsUtil {
     @Value("${fdfs.sysCode}")
     private String sysCode;
 
+    /**
+     * 获取签名
+     * @param nonce
+     * @param timestamp
+     * @return
+     */
     public String getSignature(String nonce, String timestamp){
         Map<String, String> headers = new HashMap<>();
         headers.put(timestamp_key, timestamp);
@@ -55,6 +61,14 @@ public class FdfsUtil {
         return tietaResBean.getData();
     }
 
+    /**
+     * 上传文件
+     * @param nonce
+     * @param timestamp
+     * @param signature
+     * @param filePath
+     * @return
+     */
     public Map<String, String> uploadFile(String nonce, String timestamp, String signature, String filePath){
 
         Map<String, String> headers = new HashMap<>();
@@ -80,6 +94,11 @@ public class FdfsUtil {
         return tietaResBean.getData();
     }
 
+    /**
+     * 上传文件工具方法
+     * @param filePath
+     * @return
+     */
     public Map<String, String> uploadFile(String filePath){
         String nonce = UUID.fastUUID().toString();
         String timestamp = String.valueOf(new Date().getTime());