peng
2026-03-20 aeb465194251550c9d3748c34910e435d7f760cb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
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);
    }
}