From e16302f9d475c7cc4dd18c5abf1a23cb5502e362 Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq.com> Date: 星期三, 28 五月 2025 14:57:56 +0800 Subject: [PATCH] 密码验证加- --- src/main/java/com/whyc/controller/FGCDFileDownloadController.java | 27 +++++++++++++++++++-------- 1 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/whyc/controller/FGCDFileDownloadController.java b/src/main/java/com/whyc/controller/FGCDFileDownloadController.java index 30f4460..259ad44 100644 --- a/src/main/java/com/whyc/controller/FGCDFileDownloadController.java +++ b/src/main/java/com/whyc/controller/FGCDFileDownloadController.java @@ -3,10 +3,12 @@ import com.whyc.dto.Response; import com.whyc.pojo.FGCDFileDownload; import com.whyc.service.FGCDFileDownloadService; +import com.whyc.util.ActionUtil; import io.swagger.annotations.Api; 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; @@ -17,10 +19,12 @@ @RestController @RequestMapping("FGCDFileDownload") @Api(tags = "鍦ㄧ嚎鐩戞祴-涓�浣撴満瀵煎叆璁板綍") -public class FGCDFileDownloadController { +public class FGCDFileDownloadController extends BaseController{ @Autowired private FGCDFileDownloadService service; + @Autowired + private Environment environment; @GetMapping("listByDeviceId") @ApiOperation(value = "鏁版嵁瀵煎叆") @@ -39,7 +43,7 @@ return new Response().setII(1, false,null,"璇诲彇鏂囦欢澶辫触"); } - @PutMapping("sendCmdToA059_readFile") + @PostMapping("sendCmdToA059_readFile") @ApiOperation(value = "璇诲彇璁惧鏂囦欢鐨刢md鍜宎ck鏍¢獙 file_index椤电爜鏁�") public Response sendCmdToA059ReadFile(@RequestParam Integer deviceId,@RequestParam Integer fileIndex){ List cmdCheck = service.sendCmdToA059ReadFile(deviceId, fileIndex); @@ -49,7 +53,7 @@ return new Response().setII(1, false,null,"璇诲彇鏂囦欢瓒呮椂"); } - @PutMapping("sendCmdToA059_downloadFile") + @PostMapping("sendCmdToA059_downloadFile") @ApiOperation(value = "瀵煎叆璁惧鏂囦欢鐨刢md鍜宎ck鏍¢獙 BattGroupId 鐢垫睜缁刬d锛宖ile_index鏂囦欢瀵瑰簲鐨勭储寮曞彿") public Response sendCmdToA059DownloadFile(@RequestBody FGCDFileDownload download){ boolean cmdCheck = service.sendCmdToA059DownloadFile(download); @@ -62,17 +66,24 @@ @GetMapping("readA059Pictrue") @ApiOperation(tags = "鍦ㄧ嚎鐩戞祴-瀹炴椂鐩戞帶",value = "璇诲彇A059鍐呯闀滃浘鐗�") public Response readA059Pictrue(HttpServletRequest request,@RequestParam String devId){ + //杩囨护鐗规畩瀛楃,閬垮厤璺緞閬嶅巻鏀诲嚮 + devId = ActionUtil.filterFileName(devId); /*=========鍥剧墖淇濆瓨===========*/ ApplicationHome applicationHome = new ApplicationHome(getClass()); 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); //鍥剧墖鐨刄rl File file = new File(fileDirName); if(file.exists()){ -- Gitblit v1.9.1