123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- package com.fdkankan.project.tieta.controller;
- import cn.hutool.core.img.ImgUtil;
- import cn.hutool.core.io.FileUtil;
- import cn.hutool.http.HttpUtil;
- import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
- import com.fdkankan.project.tieta.bean.ResultData;
- import com.fdkankan.project.tieta.entity.FullphotoFileindex;
- import com.fdkankan.project.tieta.entity.Scene;
- import com.fdkankan.project.tieta.service.FullphotoFileindexService;
- import com.fdkankan.project.tieta.service.SceneService;
- import com.fdkankan.project.tieta.utils.CreateObjUtil;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RestController;
- import java.io.File;
- import java.util.List;
- /**
- * <p>
- * 前端控制器
- * </p>
- *
- * @author dsx
- * @since 2024-06-25
- */
- @RestController
- @RequestMapping("/scene")
- public class SceneController {
- @Autowired
- private SceneService sceneService;
- @GetMapping("/test")
- public ResultData test(){
- return ResultData.ok(sceneService.list());
- }
- @GetMapping("/add")
- public ResultData add(){
- Scene scene = new Scene();
- scene.setNum("sdfsdfdhfgjghjrr胜多负少的");
- sceneService.save(scene);
- return ResultData.ok();
- }
- @Autowired
- private FullphotoFileindexService fullphotoFileindexService;
- @GetMapping("/test2")
- public ResultData test2(String stationCode, String roomEntityID) throws Exception {
- String path = "D:\\test\\tieta\\" + stationCode + "_" + roomEntityID + "\\";
- List<FullphotoFileindex> list = fullphotoFileindexService.list(new LambdaQueryWrapper<FullphotoFileindex>().eq(FullphotoFileindex::getStationCode, stationCode).eq(FullphotoFileindex::getEntityId, roomEntityID));
- list.stream().forEach(v->{
- String localPath = path + v.getFileName();
- HttpUtil.downloadFile(v.getFileUrl(), localPath);
- if(v.getFileName().endsWith("jpg")){
- String highPath = path + "pan\\high\\" + v.getFileName();
- FileUtil.mkParentDirs(highPath);
- String lowPath = path + "pan\\low\\" + v.getFileName();
- FileUtil.mkParentDirs(lowPath);
- ImgUtil.scale(new File(localPath),new File(highPath), 0.5f);
- ImgUtil.scale(new File(localPath),new File(lowPath), 0.0625f);
- }
- });
- CreateObjUtil.convertTxtToVisionmodeldata(path + "vision.txt", path + "vision.modeldata");
- return ResultData.ok();
- }
- }
|