package org.security.trans.dataStatistics.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.security.trans.dataStatistics.dto.DeviceDataDTO;
import org.security.trans.dataStatistics.service.DeviceDataService;
import org.security.trans.dataStatistics.vo.PieChartDataVO;
import org.security.trans.dataStatistics.vo.RisingSunChartDeviceVo;
import org.security.trans.dataStatistics.vo.RisingSunChartVO;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author ：wzf
 * @apiNote ：设备统计
 * @since ：Created in 2022/11/28 14:56
 */
@RestController
@AllArgsConstructor
@RequestMapping("/statistics/device")
public class DeviceDataController {


	private final DeviceDataService deviceDataService;

	/**
	 * 统计旭日图
	 */
	@PostMapping("/ris-sun-chart")
	@ApiOperationSupport(order = 1)
	@ApiOperation(value = "旭日图", notes = "")
	public R<RisingSunChartDeviceVo> getRisSunChartData(@RequestBody DeviceDataDTO deviceDataDTO) {
		return R.data(deviceDataService.getRisSunChartData(deviceDataDTO));
	}
	/**
	 * 设备按机构分布饼图
	 */
	@PostMapping("/pie-dept")
	@ApiOperationSupport(order = 2)
	@ApiOperation(value = "机构饼图", notes = "")
	public R<List<PieChartDataVO>> getPieDeptData(@RequestBody DeviceDataDTO deviceDataDTO) {
		return R.data(deviceDataService.getPieDeptData(deviceDataDTO));
	}
}
