package com.gyee.runeconomy.controller;


import com.alibaba.fastjson.JSONObject;
import com.gyee.runeconomy.dto.result.JsonResult;
import com.gyee.runeconomy.dto.result.PowerPointData;
import com.gyee.runeconomy.dto.result.ResultCode;
import com.gyee.runeconomy.model.auto.ProEconPowerFittingAnalySis;
import com.gyee.runeconomy.model.vo.NewDataFittingVo;
import com.gyee.runeconomy.service.auto.impl.NewDataFittingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping("/new/power/fitting")
public class NewDataFittingController {



    @Autowired
    private NewDataFittingService newDataFittingService;

    /**
     * 功率曲线拟合
     * @param newDataFittingVo
     * @return
     */
    @PostMapping("/data")
    public JSONObject dataFitting(@RequestBody NewDataFittingVo newDataFittingVo ) {

        ProEconPowerFittingAnalySis obj = newDataFittingService.newDataFitting(newDataFittingVo);
        return JsonResult.successData(ResultCode.SUCCESS, obj);

    }

    /**
     * 读取曲线，散点等数据
     * @param id  拟合好的数据ID
     * @return
     */
//    @GetMapping("curve")
//    public JSONObject dataFittingCurve(String id){
//        Map<String, Object> result = newDataFittingService.dataFittingCurve(id);
//        return JsonResult.successData(ResultCode.SUCCESS, result);
//    }



    /**
     * 通过key获取原始数据
     * 对应前端的圈选功能
     * @param yk  有用点的key
     * @param wk  无用点的key
     * @return
     */
//    @GetMapping("filter")
//    public JSONObject dataFittingFilter(String yk, String wk){
//        List<PowerPointData> list = newDataFittingService.dataOrigin(yk, wk);
//        return JsonResult.successData(ResultCode.SUCCESS, list);
//    }


    /**
     * file 文件数据展示
     * @param id
     * @return
     */
//    @GetMapping("show")
//    public JSONObject dataFittingShow(String id){
//        Map<String, Object> result = newDataFittingService.dataFittingShow(id);
//        return JsonResult.successData(ResultCode.SUCCESS, result);
//    }

}
