PowerController.java 1.33 KB
package com.qgutech.controller;

import com.qgutech.common.JsonResult;
import com.qgutech.model.PowerModel;
import com.qgutech.service.PowerService;
import lombok.extern.slf4j.Slf4j;
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;

/**
 * @author xxx
 * @date 2024/12/15 12:08
 * @description
 */

/**
 * 徽辰智电公司相关接口
 */
@Slf4j
@RestController
@RequestMapping(value = "/hczd")
public class PowerController {

    @Resource
    private PowerService powerService;

    /**
     * 设备统计
     */
    @PostMapping("/index")
    public JsonResult<?> index(@RequestBody PowerModel powerModel) {
        JsonResult<Object> result = new JsonResult<>(true, "操作成功");
        result.setData(powerService.getIndex(powerModel));
        return result;
    }

    /**
     * BMS日期滚动数据
     */
    @PostMapping("/getDate")
    public JsonResult<?> getDate(@RequestBody PowerModel powerModel) {
        JsonResult<Object> result = new JsonResult<>(true, "操作成功");
        String type = powerModel.getType();
        result.setData(powerService.getDateMap(type));
        return result;
    }

}