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> importTotal(ChannelReportDto reportDto) { List result = channelLogService.importTotal(reportDto); return ResultJson.ok(result); } @GetMapping(value = "/importDetail") @ApiOperation(value = "入口流量明细") @PreAuthorize("hasAuthority('channelLog.importDetail')") public ResultJson> importDetail(ChannelReportDetailDto reportDto, PageRequest pageRequest) { if (reportDto.getChannelCode() == null) { throw new CommonException("渠道编码不能为空"); } IPage result = channelLogService.importDetail(reportDto, pageRequest); return ResultJson.ok(result); } @GetMapping(value = "/exportTotal") @ApiOperation(value = "出口流量总览") @PreAuthorize("hasAuthority('channelLog.exportTotal')") public ResultJson> exportTotal(ChannelReportDto reportDto) { List result = channelLogService.exportTotal(reportDto); return ResultJson.ok(result); } @GetMapping(value = "/exportDetail") @ApiOperation(value = "出口流量明细") @PreAuthorize("hasAuthority('channelLog.exportDetail')") public ResultJson> exportDetail(ChannelReportDetailDto reportDto, PageRequest pageRequest) { if (reportDto.getChannelCode() == null) { throw new CommonException("渠道编码不能为空"); } IPage result = channelLogService.exportDetail(reportDto, pageRequest); return ResultJson.ok(result); } @GetMapping(value = "/channelList") @ApiOperation(value = "获取渠道列表") @PreAuthorize("hasAuthority('channelLog.channelList')") public ResultJson> channelList(Integer type) { List result = channelLogService.channelList(type); return ResultJson.ok(result); } @GetMapping(value = "/addVipCardOrderLog") @ApiOperation(value = "新增渠道会员订单购买日志") public ResultJson addVipCardOrderLog(@AuthenticationPrincipal UserDetail userDetail, VipCardOrderLogDto logDto) { vipCardOrderLogService.addVipCardOrderLog(userDetail, logDto); return ResultJson.success(); } @GetMapping(value = "/getVipStatisticsList") @ApiOperation(value = "查看会员转化率") @PreAuthorize("hasAuthority('conversionRate.getVipStatisticsList')") public ResultJson> getVipStatisticsList(PageRequest pageRequest, ChannelVisitDto visitDto) { visitDto.setVipType(VipCardTypeEnum.MEMBER_SERVICE.getCode()); IPage result = vipCardOrderLogService.getVipStatisticsList(pageRequest, visitDto); return ResultJson.ok(result); } @GetMapping(value = "/getVipStatisticsDetail") @ApiOperation(value = "查看会员转化率明细") @PreAuthorize("hasAuthority('conversionRate.getVipStatisticsDetail')") public ResultJson> getVipStatisticsDetail(PageRequest pageRequest, VipStatisticsDetailDto detailDto) { detailDto.setVipType(VipCardTypeEnum.MEMBER_SERVICE.getCode()); IPage result = vipCardOrderLogService.getVipStatisticsDetail(pageRequest, detailDto); return ResultJson.ok(result); } @GetMapping(value = "/getQueueVipStatistics") @ApiOperation(value = "查看审批加速会员转化率") @PreAuthorize("hasAuthority('conversionRate.getQueueVipStatisticsList')") public ResultJson> getQueueVipStatistics(PageRequest pageRequest, ChannelVisitDto visitDto) { visitDto.setVipType(VipCardTypeEnum.AUDIT_QUEUE.getCode()); IPage result = vipCardOrderLogService.getVipStatisticsList(pageRequest, visitDto); return ResultJson.ok(result); } @GetMapping(value = "/getQueueVipStatisticsDetail") @ApiOperation(value = "查看审批加速会员转化率明细") @PreAuthorize("hasAuthority('conversionRate.getQueueVipStatisticsDetail')") public ResultJson> getQueueVipStatisticsDetail(PageRequest pageRequest, VipStatisticsDetailDto detailDto) { detailDto.setVipType(VipCardTypeEnum.AUDIT_QUEUE.getCode()); IPage result = vipCardOrderLogService.getVipStatisticsDetail(pageRequest, detailDto); return ResultJson.ok(result); } @PostMapping(value = "/getChannelProportion") @ApiOperation(value = "查看渠道占比") @PreAuthorize("hasAuthority('channelProportion.getChannelProportion')") public ResultJson> getChannelProportion(@RequestBody ChannelProportionDto channelProportionDto) { List channelProportion = channelLogService.getChannelProportion(channelProportionDto); return ResultJson.ok(channelProportion); } @PostMapping(value = "/getLoanSupermarketStatistics") @ApiOperation(value = "查看贷超统计报表") @PreAuthorize("hasAuthority('loanSupermarketStatistics.getLoanSupermarketStatistics')") public ResultJson getLoanSupermarketStatistics(@RequestBody LoanSupermarketStatisticsDto supermarketStatisticsDto) { List loanSupermarketStatistics = channelLogService.getLoanSupermarketStatistics(supermarketStatisticsDto); return ResultJson.ok(loanSupermarketStatistics); } @PostMapping(value = "/getAutoStatistics") @ApiOperation(value = "查看联登渠道统计报表") @PreAuthorize("hasAuthority('autoStatistics.getAutoStatistics')") public ResultJson> getAutoStatistics(@RequestBody AutoStatisticsDto autoStatisticsDto) { List autoStatistics = channelLogService.getAutoStatistics(autoStatisticsDto); return ResultJson.ok(autoStatistics); } @PostMapping(value = "/getWholeProcessStatistics") @ApiOperation(value = "查看全流程报表") @PreAuthorize("hasAuthority('wholeProcessStatistics.getWholeProcessStatistics')") public ResultJson> getWholeProcessStatistics(@RequestBody WholeProcessStatisticsDto wholeProcessStatisticsDto) { List 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> channelStatistics(@RequestBody ChannelStatisticsDto channelStatisticsDto) { List channelStatisticsVos = channelLogService.channelStatistics(channelStatisticsDto); return ResultJson.ok(channelStatisticsVos); } @PostMapping(value = "/profitAnalysisReport") @ApiOperation(value = "盈利分析报表") @PreAuthorize("hasAuthority('profitAnalysis.profitAnalysisReport')") public ResultJson> profitAnalysisReport(@RequestBody ProfitAnalysisReportDto profitAnalysisReportDto) { List profitAnalysisReportVos = channelLogService.profitAnalysisReport(profitAnalysisReportDto); return ResultJson.ok(profitAnalysisReportVos); } }