package com.huimv.environ.eco.controller;

import java.text.ParseException;
import com.huimv.common.utils.Result;
import com.huimv.environ.eco.service.EcoDeviceFlowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author zn
 * @since 2022-11-09
 */
@RestController
@RequestMapping("/ecoDeviceFlow")
public class EcoDeviceFlowController {

    @Autowired
    private EcoDeviceFlowService ecoDeviceFlowService;

    @PostMapping("/getLastFlow")
    public Result getLastFlow(@RequestBody Map<String, String> paramsMap){
        return ecoDeviceFlowService.getLastFlow(paramsMap);
    }

    @PostMapping("/getUnitLastFlow")
    public Result getUnitLastFlow(@RequestBody Map<String, String> paramsMap){
        return ecoDeviceFlowService.getUnitLastFlow(paramsMap);
    }

    @PostMapping("/getLastFlowByUnitId")
    public Result getLastFlowByUnitId(@RequestBody Map<String, String> paramsMap){
        return ecoDeviceFlowService.getLastFlowByUnitId(paramsMap);
    }

    @PostMapping("/listByRoom")
    public Result listByRoom( HttpServletRequest request,@RequestBody Map<String, String> paramsMap) throws ParseException {
        return ecoDeviceFlowService.listByRoom(request, paramsMap);
    }

    @PostMapping("/listDayDetails")
    public Result listDayDetails( HttpServletRequest request,@RequestBody Map<String, String> paramsMap) throws ParseException {
        return ecoDeviceFlowService.listDayDetails(request, paramsMap);
    }

//    @PostMapping("/getFlowList")
//    public Result getFlowList(@RequestBody Map<String, String> paramsMap){
//        return ecoDeviceFlowService.getFlowList(paramsMap);
//    }
}

