lxw
2023-05-25 f3c27fb78447449a950ba73c5e72ceda64ad8a12
src/main/java/com/whyc/controller/FGCDFileDownloadController.java
@@ -7,6 +7,7 @@
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.system.ApplicationHome;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@@ -21,6 +22,8 @@
    @Autowired
    private FGCDFileDownloadService service;
    @Autowired
    private Environment environment;
    @GetMapping("listByDeviceId")
    @ApiOperation(value = "数据导入")
@@ -67,12 +70,17 @@
        File jarFile = applicationHome.getDir();
        //存储A059图片的文件夹
        //调试版
        String fileDirName = jarFile.getParentFile().toString()+File.separator+"A059"+File.separator+"images"+File.separator+devId;
        //打包版
        //String fileDirName = jarFile.toString()+File.separator+"A059"+File.separator+"images"+File.separator+devId;
        //D:\GitWorkSpace\fg_v2.0\target\classes
        int configType = Integer.parseInt(environment.getProperty("configFile.type"));
        String fileDirName = "";
        //测试版
        if(configType==1){
            fileDirName = jarFile.getParentFile().toString()+File.separator+"A059"+File.separator+"images"+File.separator+devId;
        }else{
            //打包版
            fileDirName = jarFile.toString()+File.separator+"A059"+File.separator+"images"+File.separator+devId;
        }
        //System.out.println("jarFile:"+jarFile+"      parentfile:"+jarFile.getParentFile().toString());
        //System.out.println("############:"+fileDirName);
        //图片的Url
        File file = new File(fileDirName);
        if(file.exists()){