| | |
| | | import com.whyc.util.AnalysisUtil; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.openxml4j.exceptions.InvalidFormatException; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.IOException; |
| | | import java.text.ParseException; |
| | | |
| | | |
| | | @RequestMapping("anaysis") |
| | |
| | | @ApiOperation("生成预估数据") |
| | | @GetMapping("createAnaysisXls") |
| | | public Response createAnaysisXls(@RequestParam int battGroupId, @RequestParam int testRecordCount){ |
| | | service.createAnaysisXls(battGroupId,testRecordCount); |
| | | return new Response().set(1,true); |
| | | String voltagePredictExePath=service.createAnaysisXls(battGroupId,testRecordCount); |
| | | return new Response().setII(1,true,voltagePredictExePath,"生成预估数据"); |
| | | } |
| | | |
| | | @ApiOperation("查询预估数据") |
| | |
| | | public Response getAnaysisXls(@RequestParam int battGroupId, @RequestParam int testRecordCount){ |
| | | return service.getAnaysisXls(battGroupId,testRecordCount); |
| | | } |
| | | |
| | | @ApiOperation("解析xls文件到放电数据中") |
| | | @PostMapping("anaysisXlsToTdata") |
| | | public Response anaysisXlsToTdata(@RequestParam int battGroupId,@RequestParam MultipartFile multipartFile) throws IOException, InvalidFormatException, ParseException { |
| | | Response<Object> response = new Response<>(); |
| | | String name=multipartFile.getOriginalFilename(); |
| | | assert name != null; |
| | | if(!name.substring(name.length()-4).equals(".xls") && !name.substring(name.length()-5).equals(".xlsx")){ |
| | | response.set(1,false,"文件解析错误:上传格式非excel格式"); |
| | | }else{ |
| | | response = service.anaysisXlsToTdata(battGroupId,multipartFile.getInputStream()); |
| | | } |
| | | return response; |
| | | } |
| | | |
| | | @ApiOperation("预估一个2小时后面的数据") |
| | | @GetMapping("get2To10Data") |
| | | public Response get2To10Data(@RequestParam int battGroupId, @RequestParam int testRecordCount1, @RequestParam int testRecordCount2){ |
| | | return service.get2To10Data(battGroupId,testRecordCount1,testRecordCount2); |
| | | } |
| | | } |