package com.tievd.jyz.controller;
|
|
import cn.hutool.core.date.DateUtil;
|
import com.tievd.cube.commons.annotations.DictApi;
|
import com.tievd.cube.commons.base.Result;
|
import com.tievd.cube.commons.utils.SystemContextUtil;
|
import com.tievd.cube.modules.system.model.LoginUser;
|
import com.tievd.jyz.entity.vo.*;
|
import com.tievd.jyz.service.IOperationDataService;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.List;
|
import java.util.Map;
|
|
|
/**
|
* 运营数据大屏
|
* @author yang'zhi'shui
|
*/
|
@Slf4j
|
@DictApi
|
@RestController
|
@RequestMapping("/jyz/operationData")
|
public class OperationDataController {
|
|
@Autowired
|
private IOperationDataService operationDataService;
|
|
|
|
/**
|
* 当日运营概况查询
|
*/
|
@GetMapping("/overview")
|
public Result<?> overview() {
|
LoginUser currentLoginUser = SystemContextUtil.currentLoginUser();
|
OperationOverviewVO overviewVO = operationDataService.overview(DateUtil.today(), currentLoginUser.getOrgCode());
|
return Result.ok(overviewVO);
|
}
|
|
/**
|
* 近一周车流量统计-加油站
|
*/
|
@GetMapping("/trafficFlowStat")
|
public Result<?> trafficFlowStat() {
|
LoginUser currentLoginUser = SystemContextUtil.currentLoginUser();
|
Map<String, List> result = operationDataService.trafficFlowStat(7, DateUtil.today(), currentLoginUser.getOrgCode());
|
return Result.ok(result);
|
}
|
|
/**
|
* 车流量统计-片区
|
*/
|
@GetMapping("/regionTrafficFlowStat")
|
public Result<?> regionTrafficFlowStat(@RequestParam(defaultValue = "10") Integer limit) {
|
LoginUser currentLoginUser = SystemContextUtil.currentLoginUser();
|
List<RegionTrafficFlowStatVO> result = operationDataService.regionTrafficFlowStat(DateUtil.today(), currentLoginUser.getOrgCode(), limit);
|
return Result.ok(result);
|
}
|
|
/**
|
* 客户类型统计
|
*/
|
@GetMapping("/customerStat")
|
public Result<?> customerStat() {
|
LoginUser currentLoginUser = SystemContextUtil.currentLoginUser();
|
CustomerStatVO vo = operationDataService.customerStat(currentLoginUser.getOrgCode());
|
return Result.ok(vo);
|
}
|
|
/**
|
* 加油率统计,加油次数/(加油次数+停靠次数)-加油站
|
*/
|
@GetMapping("/oilRecordTimeStat")
|
public Result<?> oilRecordTimeStat() {
|
LoginUser currentLoginUser = SystemContextUtil.currentLoginUser();
|
Map<String, List> result = operationDataService.oilRecordTimeStat(DateUtil.today(), currentLoginUser.getOrgCode());
|
return Result.ok(result);
|
}
|
|
/**
|
* 加油率统计,加油次数/(加油次数+停靠次数)-片区
|
* @param limit 返回数据条数
|
* @param freq 统计频率,0表示当天,1表示当月
|
*/
|
@GetMapping("/regionOilRecordStat")
|
public Result<?> regionOilRecordStat(@RequestParam(defaultValue = "10") Integer limit,
|
@RequestParam(defaultValue = "0") Integer freq) {
|
LoginUser currentLoginUser = SystemContextUtil.currentLoginUser();
|
List<OilRecordStatVO> result = operationDataService.regionOilRecordStat(currentLoginUser.getOrgCode(), freq, limit);
|
return Result.ok(result);
|
}
|
|
/**
|
* 加油位热度查询
|
*/
|
@GetMapping("/oilPositionHeatMap")
|
public Result<?> oilPositionHeatMap() {
|
LoginUser currentLoginUser = SystemContextUtil.currentLoginUser();
|
List<OilPositionHeatMapVO> result = operationDataService.oilPositionHeatMap(DateUtil.today(), currentLoginUser.getOrgCode());
|
return Result.ok(result);
|
}
|
|
/**
|
* 车型统计
|
*/
|
@GetMapping("/carModelStat")
|
public Result<?> carModelStat() {
|
LoginUser currentLoginUser = SystemContextUtil.currentLoginUser();
|
Map<String, List> result = operationDataService.carModelStat(DateUtil.today(), currentLoginUser.getOrgCode());
|
return Result.ok(result);
|
}
|
|
/**
|
* 销量统计
|
*/
|
@GetMapping("/salesStat")
|
public Result<?> salesStat() {
|
LoginUser currentLoginUser = SystemContextUtil.currentLoginUser();
|
Map<String, List> result = operationDataService.salesStat(12, DateUtil.today(), currentLoginUser.getOrgCode());
|
return Result.ok(result);
|
}
|
|
/**
|
* 销量排行-片区
|
* @param limit 返回数据条数
|
* @param freq 统计频率,0表示当天,1表示当月
|
*/
|
@GetMapping("/salesRanking")
|
public Result<?> salesRanking(@RequestParam(defaultValue = "3") Integer limit,
|
@RequestParam(defaultValue = "0") Integer freq) {
|
LoginUser currentLoginUser = SystemContextUtil.currentLoginUser();
|
List<SalesStatVO> result = operationDataService.salesRanking(currentLoginUser.getOrgCode(), freq, limit);
|
return Result.ok(result);
|
}
|
}
|