| | |
| | | package com.whyc.config; |
| | | |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.whyc.constant.YamlProperties; |
| | | import org.springframework.boot.system.ApplicationHome; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | |
| | | |
| | | //这个是可行的,解析的时候path为*.html,校验路径admin下是否存在 |
| | | registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/"); |
| | | //录像视频mp4文件路径转为http url |
| | | registry.addResourceHandler("/video/**").addResourceLocations("file:/battery_system/video_system/ZLMediaKit/www/record/rtp/"); |
| | | //巡检记录文件和视频 |
| | | registry.addResourceHandler("/inspectRecord/video/**").addResourceLocations("file:/mnt/disk2/YunNan3/video/"); |
| | | registry.addResourceHandler("/inspectRecord/recordAnalysis/**").addResourceLocations("file:/mnt/disk2/YunNan3/reportAnalysis/"); |
| | | //registry.addResourceHandler("/inspectRecord/video/**").addResourceLocations("file:\\C:\\Users\\29550\\Desktop\\当前项目\\2023\\0智能机器人运维系统\\巡检记录\\video\\"); |
| | | //registry.addResourceHandler("/inspectRecord/recordAnalysis/**").addResourceLocations("file:\\C:\\Users\\29550\\Desktop\\当前项目\\2023\\0智能机器人运维系统\\巡检记录\\recordAnalysis\\"); |
| | | |
| | | //项目jar同级目录下,图片能通过http方式访问到,很重要! |
| | | ApplicationHome applicationHome = new ApplicationHome(getClass()); |
| | | File jarFile = applicationHome.getDir(); |
| | | //在jar包所在目录下生成一个upload文件夹用来存储上传的图片 |
| | | |
| | | /**文档存储路径*/ |
| | | String baseDirPath; |
| | | |
| | | |
| | | if(YamlProperties.runModel == 1) { |
| | | //开发路径 |
| | | baseDirPath = jarFile.getParentFile().toString()+File.separator+"battery_gwm_file"+File.separator; |
| | | }else { |
| | | //打包路径 |
| | | baseDirPath = jarFile.toString()+File.separator+"battery_gwm_file"+File.separator; |
| | | } |
| | | registry.addResourceHandler("/battery_gwm_file/**").addResourceLocations("file:/"+baseDirPath); |
| | | |
| | | super.addResourceHandlers(registry); |
| | | |
| | | } |