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.vo.HistogramDataVO;
import org.security.trans.dataStatistics.vo.PieChartDataVO;
import org.security.trans.basic.dto.EmployeeDTO;
import org.security.trans.dataStatistics.service.IEmployeeDataService;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Create by wzf
 * @date 2022/5/23 11:37
 * 基础信息模块-数据统计
 */
@RestController
@AllArgsConstructor
@RequestMapping("/data-count")
public class EmployeeDataController {

	private final IEmployeeDataService iEmployeeDataService;

	/**
	 * 性别构成饼图
	 */
	@GetMapping("/pie-sex")
	@ApiOperationSupport(order = 1)
	@ApiOperation(value = "性别构成饼图", notes = "employeeDTO")
	public R<List<PieChartDataVO>> getSexData(EmployeeDTO employeeDTO, Query query) {
		return R.data(iEmployeeDataService.getSexData(employeeDTO,query));
	}


	/**
	 * 年龄结构柱状图
	 */
	@GetMapping("/histogram-age")
	@ApiOperationSupport(order = 2)
	@ApiOperation(value = "年龄结构柱状图", notes = "employeeDTO")
	public R<List<HistogramDataVO>> getAgeData(EmployeeDTO employeeDTO, Query query) {
		return R.data(iEmployeeDataService.getAgeData(employeeDTO,query));
	}

	/**
	 * 学历构成饼图
	 */
	@GetMapping("/pie-educate")
	@ApiOperationSupport(order = 3)
	@ApiOperation(value = "学历构成饼图", notes = "employeeDTO")
	public R<List<PieChartDataVO>> getEducateData(EmployeeDTO employeeDTO, Query query) {
		return R.data(iEmployeeDataService.getEducateData(employeeDTO,query));
	}

	/**
	 * 企业工龄柱状图
	 */
	@GetMapping("/histogram-seniority-in-enterprise")
	@ApiOperationSupport(order = 4)
	@ApiOperation(value = "企业工龄柱状图", notes = "employeeDTO")
	public R<List<HistogramDataVO>> getSeniorityInEnterpriseData(EmployeeDTO employeeDTO, Query query) {
		return R.data(iEmployeeDataService.getSeniorityInEnterpriseData(employeeDTO,query));
	}

	/**
	 * 行内工龄柱状图
	 */
	@GetMapping("/histogram-professional-length-of-service")
	@ApiOperationSupport(order = 5)
	@ApiOperation(value = "行内工龄柱状图", notes = "employeeDTO")
	public R<List<HistogramDataVO>> getProfessionalLengthOfServiceData(EmployeeDTO employeeDTO, Query query) {
		return R.data(iEmployeeDataService.getProfessionalLengthOfServiceData(employeeDTO,query));
	}

	/**
	 * 人防类型构成饼图
	 */
	@GetMapping("/pie-civil-air-defense-type")
	@ApiOperationSupport(order = 6)
	@ApiOperation(value = "人防类型构成饼图", notes = "employeeDTO")
	public R<List<PieChartDataVO>> getCivilAirDefenseTypeData(EmployeeDTO employeeDTO, Query query) {
		return R.data(iEmployeeDataService.getCivilAirDefenseTypeData(employeeDTO,query));
	}

	/**
	 * 民族构成饼图
	 */
	@GetMapping("/pie-nation-type")
	@ApiOperationSupport(order = 7)
	@ApiOperation(value = "民族构成饼图", notes = "employeeDTO")
	public R<List<PieChartDataVO>> getNationTypeData(EmployeeDTO employeeDTO, Query query) {
		return R.data(iEmployeeDataService.getNationTypeData(employeeDTO));
	}

	/**
	 * 政治面貌构成饼图
	 */
	@GetMapping("/pie-political-outlook-type")
	@ApiOperationSupport(order = 8)
	@ApiOperation(value = "政治面貌构成饼图", notes = "employeeDTO")
	public R<List<PieChartDataVO>> getPoliticalOutlookTypeData(EmployeeDTO employeeDTO, Query query) {
		return R.data(iEmployeeDataService.getPoliticalOutlookTypeData(employeeDTO));
	}
}
