From b46f7fa6d77852ae9e28a062da234a2ddf9405fb Mon Sep 17 00:00:00 2001 From: whyclxw <810412026@qq.com> Date: 星期一, 31 三月 2025 16:09:51 +0800 Subject: [PATCH] 2025-3-22定制修改导出去掉容量和连接条 --- src/main/java/com/whyc/controller/FileInfoController.java | 67 ++++++++++++++++++++++++++++++--- 1 files changed, 60 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/whyc/controller/FileInfoController.java b/src/main/java/com/whyc/controller/FileInfoController.java index b825dbd..892e8cb 100644 --- a/src/main/java/com/whyc/controller/FileInfoController.java +++ b/src/main/java/com/whyc/controller/FileInfoController.java @@ -1,14 +1,18 @@ package com.whyc.controller; +import com.whyc.dto.FileParamToXml; import com.whyc.dto.Response; +import com.whyc.pojo.FileParam; import com.whyc.service.FileInfoService; import com.whyc.service.FileParamService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import net.sf.json.JSONObject; 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 org.springframework.web.bind.annotation.*; + +import java.util.*; +import java.util.Map.Entry; @Api(tags = "鏂囦欢") @RestController @@ -21,9 +25,58 @@ private FileParamService paramService; - @ApiOperation(value = "鑾峰彇鏂囦欢淇℃伅xml灞炴��") - @GetMapping("getXmlFileParam") - public Response getXmlFileParam(){ - return paramService.getXmlFileParam(); + @ApiOperation(value = "瑙f瀽xml鏂囦欢(浼犲弬涓�涓枃浠�)") + @GetMapping("getXmlValue") + public Response getXmlValue(@RequestParam String filePath){ + return paramService.getXmlValue(filePath); } + + @ApiOperation(value = "瑙f瀽xml鏂囦欢(浼犲弬涓�涓枃浠跺す)") + @GetMapping("getXmlValueByPath") + public Response getXmlValueByPath(@RequestParam String filePath){ + return paramService.getXmlValueByPath(filePath); + } + + @ApiOperation("閫氳繃淇敼灞炴�х獥鍙e�兼潵淇敼鏂囦欢鍊�(浼犲弬瀵硅薄)") + @PostMapping("updateXmlByFileParam") + public Response updateXmlByFileParam(@RequestBody FileParam fileParam,@RequestParam String filePath){ + return paramService.updateXmlByFileParam(fileParam,filePath); + } + + + @ApiOperation("閫氳繃淇敼灞炴�х獥鍙e�兼潵淇敼鏂囦欢鍊�(json)") + @PostMapping("updateXmlByParamMap") + public Response updateXmlByParamMap(@RequestBody JSONObject paramJson, @RequestParam String filePath){ + Map<String,String> map=new HashMap<>(); + Set paramSet=paramJson.entrySet(); + for (Iterator iter = paramSet.iterator(); iter.hasNext(); ) { + Entry entry = (Entry) iter.next(); + String key = (String) entry.getKey(); + String value = (String) entry.getValue(); + String xmlName = FileParamToXml.getNameByType(key); + if (xmlName != null && !xmlName.isEmpty()) { + map.put(xmlName, value); + } + } + return paramService.updateXmlByParamMap(map,filePath); + } + + @ApiOperation("鏍规嵁fileId閫氳繃淇敼灞炴�х獥鍙e�兼潵淇敼鏁版嵁搴撳睘鎬�") + @PostMapping("updateFileParamByFileId") + public Response updateFileParamByFileId(@RequestBody FileParam fileParam,@RequestParam String fileId){ + return paramService.updateFileParamByFileId(fileParam,fileId); + } + + @ApiOperation("鏇存敼鍙扮珯涓嬪叕鐢ㄥ弬鏁�") + @PostMapping("updateFileParamByStationId") + public Response updateFileParamByStationId(@RequestBody FileParam fileParam,@RequestParam int stationId){ + return paramService.updateFileParamByStationId(fileParam,stationId); + } + + @ApiOperation("瀵规瘮鏃朵笅鎷夐�夋嫨绔欑偣涓嬫寕鍦ㄧ殑鏂囦欢淇℃伅") + @GetMapping("selectFileInStation") + public Response selectFileInStation(){ + return service.selectFileInStation(); + } + } -- Gitblit v1.9.1