123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- package com.gyee.power.fitting.controller.fj;
- import com.alibaba.fastjson.JSONObject;
- import com.gyee.power.fitting.common.result.JsonResult;
- import com.gyee.power.fitting.common.result.ResultCode;
- import com.gyee.power.fitting.common.util.FileUtil;
- import com.gyee.power.fitting.model.ProEconPowerFittingAnalySis;
- import com.gyee.power.fitting.service.ProEconPowerFittingAnalySisService;
- import com.gyee.power.fitting.service.custom.curve.DataPrepareService;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.util.*;
- /**
- * 功率曲线拟合 数据准备
- */
- @RestController
- @CrossOrigin
- @RequestMapping("/power/prepare")
- public class DataPrepareController {
- @Autowired
- private DataPrepareService prepareService;
- @Autowired
- private ProEconPowerFittingAnalySisService powerService;
- @Autowired
- private HttpServletRequest request;
- /**
- * 数据准备 golden-file
- * @param station
- * @param wtIds
- * @param st
- * @param et
- * @param interval
- * @return
- */
- @GetMapping("data")
- public JSONObject dataPrepare(String station, String wtIds, Long st,
- Long et, Integer interval){
- if (station.isEmpty() || wtIds.isEmpty())
- return JsonResult.error(ResultCode.PARAM_NOT_COMPLETE);
- String[] points = wtIds.split(",");
- prepareService.dataPrepare(station, Arrays.asList(points), st, et, interval);
- return JsonResult.error(ResultCode.SUCCESS_DATA_PREPARE);
- }
- /** 文件 tree
- * @return
- */
- @GetMapping("tree")
- public JSONObject dataPrepareTree(){
- List<Object> result = prepareService.dataPrepareTree(request);
- return JsonResult.successData(ResultCode.SUCCESS, result);
- }
- /**
- * file 文件数据展示前500行
- * @param id
- * @return
- */
- @GetMapping("show")
- public JSONObject dataPrepareShow(String id){
- Map<String, Object> result = prepareService.dataPrepareShow(id);
- return JsonResult.successData(ResultCode.SUCCESS, result);
- }
- /**
- * file 下载
- * @return
- */
- @GetMapping("download")
- public void dataPrepareDownload(HttpServletResponse response, @RequestParam(value = "id", required = false) String id){
- ProEconPowerFittingAnalySis obj = powerService.selectItemById(id);
- FileUtil.download(obj.getPath(), response);
- }
- }
|