zbb378@sohu.com
2024-11-04 b2bad51be3c8d3e78d7f81a19415faeac2d0297c
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
package com.nova.sankuai.controller.v1;
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.nova.sankuai.domain.dto.*;
import com.nova.sankuai.domain.entity.ChannelInfo;
import com.nova.sankuai.domain.enums.vipservice.VipCardTypeEnum;
import com.nova.sankuai.domain.vo.*;
import com.nova.sankuai.domain.vo.channel.ChannelExportReportVo;
import com.nova.sankuai.domain.vo.channel.ChannelImportReportVo;
import com.nova.sankuai.domain.vo.channel.ChannelReportTotalVo;
import com.nova.sankuai.infra.config.CommonException;
import com.nova.sankuai.infra.utils.PageRequest;
import com.nova.sankuai.infra.utils.ResultJson;
import com.nova.sankuai.security.UserDetail;
import com.nova.sankuai.service.IChannelLogService;
import com.nova.sankuai.service.IVipCardOrderLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletResponse;
import java.util.List;
 
/**
 * @author weikangdi
 * @create 2021/11/25
 */
@Api(tags = "统计报表")
@RestController
@RequestMapping(value = "/api/v1/channelLog")
@AllArgsConstructor
public class ChannelLogController {
 
    private final IChannelLogService channelLogService;
 
 
    private final IVipCardOrderLogService vipCardOrderLogService;
 
    @GetMapping(value = "/importTotal")
    @ApiOperation(value = "入口流量总览")
    @PreAuthorize("hasAuthority('channelLog.importTotal')")
    public ResultJson<List<ChannelReportTotalVo>> importTotal(ChannelReportDto reportDto) {
        List<ChannelReportTotalVo> result = channelLogService.importTotal(reportDto);
        return ResultJson.ok(result);
    }
 
    @GetMapping(value = "/importDetail")
    @ApiOperation(value = "入口流量明细")
    @PreAuthorize("hasAuthority('channelLog.importDetail')")
    public ResultJson<IPage<ChannelImportReportVo>> importDetail(ChannelReportDetailDto reportDto, PageRequest pageRequest) {
        if (reportDto.getChannelCode() == null) {
            throw new CommonException("渠道编码不能为空");
        }
        IPage<ChannelImportReportVo> result = channelLogService.importDetail(reportDto, pageRequest);
        return ResultJson.ok(result);
    }
 
 
    @GetMapping(value = "/exportTotal")
    @ApiOperation(value = "出口流量总览")
    @PreAuthorize("hasAuthority('channelLog.exportTotal')")
    public ResultJson<List<ChannelReportTotalVo>> exportTotal(ChannelReportDto reportDto) {
        List<ChannelReportTotalVo> result = channelLogService.exportTotal(reportDto);
        return ResultJson.ok(result);
    }
 
    @GetMapping(value = "/exportDetail")
    @ApiOperation(value = "出口流量明细")
    @PreAuthorize("hasAuthority('channelLog.exportDetail')")
    public ResultJson<IPage<ChannelExportReportVo>> exportDetail(ChannelReportDetailDto reportDto, PageRequest pageRequest) {
        if (reportDto.getChannelCode() == null) {
            throw new CommonException("渠道编码不能为空");
        }
        IPage<ChannelExportReportVo> result = channelLogService.exportDetail(reportDto, pageRequest);
        return ResultJson.ok(result);
    }
 
    @GetMapping(value = "/channelList")
    @ApiOperation(value = "获取渠道列表")
    @PreAuthorize("hasAuthority('channelLog.channelList')")
    public ResultJson<List<ChannelInfo>> channelList(Integer type) {
        List<ChannelInfo> result = channelLogService.channelList(type);
        return ResultJson.ok(result);
    }
 
    @GetMapping(value = "/addVipCardOrderLog")
    @ApiOperation(value = "新增渠道会员订单购买日志")
    public ResultJson<Void> addVipCardOrderLog(@AuthenticationPrincipal UserDetail userDetail, VipCardOrderLogDto logDto) {
        vipCardOrderLogService.addVipCardOrderLog(userDetail, logDto);
        return ResultJson.success();
    }
 
    @GetMapping(value = "/getVipStatisticsList")
    @ApiOperation(value = "查看会员转化率")
    @PreAuthorize("hasAuthority('conversionRate.getVipStatisticsList')")
    public ResultJson<IPage<VipStatisticsVo>> getVipStatisticsList(PageRequest pageRequest, ChannelVisitDto visitDto) {
        visitDto.setVipType(VipCardTypeEnum.MEMBER_SERVICE.getCode());
        IPage<VipStatisticsVo> result = vipCardOrderLogService.getVipStatisticsList(pageRequest, visitDto);
        return ResultJson.ok(result);
    }
 
    @GetMapping(value = "/getVipStatisticsDetail")
    @ApiOperation(value = "查看会员转化率明细")
    @PreAuthorize("hasAuthority('conversionRate.getVipStatisticsDetail')")
    public ResultJson<IPage<VipStatisticsDetailVo>> getVipStatisticsDetail(PageRequest pageRequest, VipStatisticsDetailDto detailDto) {
        detailDto.setVipType(VipCardTypeEnum.MEMBER_SERVICE.getCode());
        IPage<VipStatisticsDetailVo> result = vipCardOrderLogService.getVipStatisticsDetail(pageRequest, detailDto);
        return ResultJson.ok(result);
    }
 
    @GetMapping(value = "/getQueueVipStatistics")
    @ApiOperation(value = "查看审批加速会员转化率")
    @PreAuthorize("hasAuthority('conversionRate.getQueueVipStatisticsList')")
    public ResultJson<IPage<VipStatisticsVo>> getQueueVipStatistics(PageRequest pageRequest, ChannelVisitDto visitDto) {
        visitDto.setVipType(VipCardTypeEnum.AUDIT_QUEUE.getCode());
        IPage<VipStatisticsVo> result = vipCardOrderLogService.getVipStatisticsList(pageRequest, visitDto);
        return ResultJson.ok(result);
    }
 
    @GetMapping(value = "/getQueueVipStatisticsDetail")
    @ApiOperation(value = "查看审批加速会员转化率明细")
    @PreAuthorize("hasAuthority('conversionRate.getQueueVipStatisticsDetail')")
    public ResultJson<IPage<VipStatisticsDetailVo>> getQueueVipStatisticsDetail(PageRequest pageRequest, VipStatisticsDetailDto detailDto) {
        detailDto.setVipType(VipCardTypeEnum.AUDIT_QUEUE.getCode());
        IPage<VipStatisticsDetailVo> result = vipCardOrderLogService.getVipStatisticsDetail(pageRequest, detailDto);
        return ResultJson.ok(result);
    }
 
    @PostMapping(value = "/getChannelProportion")
    @ApiOperation(value = "查看渠道占比")
    @PreAuthorize("hasAuthority('channelProportion.getChannelProportion')")
    public ResultJson<List<ChannelProportionListVo>> getChannelProportion(@RequestBody ChannelProportionDto channelProportionDto) {
        List<ChannelProportionListVo> channelProportion = channelLogService.getChannelProportion(channelProportionDto);
        return ResultJson.ok(channelProportion);
    }
 
    @PostMapping(value = "/getLoanSupermarketStatistics")
    @ApiOperation(value = "查看贷超统计报表")
    @PreAuthorize("hasAuthority('loanSupermarketStatistics.getLoanSupermarketStatistics')")
    public ResultJson getLoanSupermarketStatistics(@RequestBody LoanSupermarketStatisticsDto supermarketStatisticsDto) {
        List<LoanSupermarketStatisticsVo> loanSupermarketStatistics = channelLogService.getLoanSupermarketStatistics(supermarketStatisticsDto);
        return ResultJson.ok(loanSupermarketStatistics);
    }
 
    @PostMapping(value = "/getAutoStatistics")
    @ApiOperation(value = "查看联登渠道统计报表")
    @PreAuthorize("hasAuthority('autoStatistics.getAutoStatistics')")
    public ResultJson<List<AutoStatisticsVo>> getAutoStatistics(@RequestBody AutoStatisticsDto autoStatisticsDto) {
        List<AutoStatisticsVo> autoStatistics = channelLogService.getAutoStatistics(autoStatisticsDto);
        return ResultJson.ok(autoStatistics);
    }
 
    @PostMapping(value = "/getWholeProcessStatistics")
    @ApiOperation(value = "查看全流程报表")
    @PreAuthorize("hasAuthority('wholeProcessStatistics.getWholeProcessStatistics')")
    public ResultJson<List<WholeProcessStatisticsListVo>> getWholeProcessStatistics(@RequestBody WholeProcessStatisticsDto wholeProcessStatisticsDto) {
        List<WholeProcessStatisticsListVo> wholeProcessStatistics = channelLogService.getWholeProcessStatistics(wholeProcessStatisticsDto);
        return ResultJson.ok(wholeProcessStatistics);
    }
 
    @PostMapping(value = "/inletFlowProportionExport")
    @ApiOperation(value = "入口流量会员购买率Excel导出")
    @PreAuthorize("hasAuthority('inletFlowProportion.getInletFlowProportionExport')")
    public void inletFlowProportionExport(HttpServletResponse response, @RequestBody InletFlowProportionDto inletFlowProportionDto) {
        channelLogService.inletFlowProportionExport(response, inletFlowProportionDto);
    }
 
    @PostMapping(value = "/getChannelProportionExport")
    @ApiOperation(value = "渠道占比导出excel")
    @PreAuthorize("hasAuthority('channelProportion.getChannelProportionExport')")
    public void getChannelProportionExport(HttpServletResponse response, @RequestBody ChannelProportionDto channelProportionDto) {
        channelLogService.getChannelProportionExport(response, channelProportionDto);
    }
 
    @PostMapping(value = "/getLoanSupermarketStatisticsExport")
    @ApiOperation(value = "贷超统计报表导出excel")
    @PreAuthorize("hasAuthority('loanSupermarketStatistics.loanSupermarketStatisticsExport')")
    public void getLoanSupermarketStatisticsExport(HttpServletResponse response, @RequestBody LoanSupermarketStatisticsDto supermarketStatisticsDto) {
        channelLogService.getLoanSupermarketStatisticsExport(response, supermarketStatisticsDto);
    }
 
    @PostMapping(value = "/autoStatisticsExport")
    @ApiOperation(value = "联登统计报表导出excel")
    @PreAuthorize("hasAuthority('autoStatistics.autoStatisticsExport')")
    public void autoStatisticsExport(HttpServletResponse response, @RequestBody AutoStatisticsDto autoStatisticsDto) {
        channelLogService.autoStatisticsExport(response, autoStatisticsDto);
    }
 
    @PostMapping(value = "/channelStatistics")
    @ApiOperation(value = "多渠道统计报表")
    @PreAuthorize("hasAuthority('inletFlowProportion.getChannelStatistics')")
    public ResultJson<List<ChannelStatisticsVo>> channelStatistics(@RequestBody ChannelStatisticsDto channelStatisticsDto) {
        List<ChannelStatisticsVo> channelStatisticsVos = channelLogService.channelStatistics(channelStatisticsDto);
        return ResultJson.ok(channelStatisticsVos);
    }
 
    @PostMapping(value = "/profitAnalysisReport")
    @ApiOperation(value = "盈利分析报表")
    @PreAuthorize("hasAuthority('profitAnalysis.profitAnalysisReport')")
    public ResultJson<List<ProfitAnalysisReportVo>> profitAnalysisReport(@RequestBody ProfitAnalysisReportDto profitAnalysisReportDto) {
        List<ProfitAnalysisReportVo> profitAnalysisReportVos = channelLogService.profitAnalysisReport(profitAnalysisReportDto);
        return ResultJson.ok(profitAnalysisReportVos);
    }
}