| | |
| | | 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 |
| | |
| | | private FileParamService paramService; |
| | | |
| | | |
| | | @ApiOperation(value = "获取文件信息xml属性") |
| | | @GetMapping("getXmlFileParam") |
| | | public Response getXmlFileParam(){ |
| | | return paramService.getXmlFileParam(); |
| | | @ApiOperation(value = "解析xml文件(传参一个文件)") |
| | | @GetMapping("getXmlValue") |
| | | public Response getXmlValue(@RequestParam String filePath){ |
| | | return paramService.getXmlValue(filePath); |
| | | } |
| | | |
| | | @ApiOperation(value = "解析xml文件(传参一个文件夹)") |
| | | @GetMapping("getXmlValueByPath") |
| | | public Response getXmlValueByPath(@RequestParam String filePath){ |
| | | return paramService.getXmlValueByPath(filePath); |
| | | } |
| | | |
| | | @ApiOperation("通过修改属性窗口值来修改文件值(传参对象)") |
| | | @PostMapping("updateXmlByFileParam") |
| | | public Response updateXmlByFileParam(@RequestBody FileParam fileParam,@RequestParam String filePath){ |
| | | return paramService.updateXmlByFileParam(fileParam,filePath); |
| | | } |
| | | |
| | | @ApiOperation("通过修改属性窗口值来修改文件值(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("对比时下拉选择站点下挂在的文件信息") |
| | | @GetMapping("selectFileInStation") |
| | | public Response selectFileInStation(){ |
| | | return service.selectFileInStation(); |
| | | } |
| | | |
| | | } |