package com.nova.sankuai.controller.v1;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.nova.sankuai.domain.dto.ChannelVisitDto;
|
import com.nova.sankuai.domain.vo.channel.ChannelVisitVo;
|
import com.nova.sankuai.domain.vo.channel.H5LoanMarketViewVo;
|
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.IChannelDownloadLogService;
|
import com.nova.sankuai.service.IChannelViewLogService;
|
import com.nova.sankuai.service.IH5LoanMarketViewLogService;
|
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.GetMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.List;
|
|
/**
|
* @author weikangdi
|
* @create 2021/12/30
|
*/
|
@Api(tags = "渠道UV统计")
|
@RestController
|
@RequestMapping(value = "/api/v1/channelVisit")
|
@AllArgsConstructor
|
public class ChannelViewLogController {
|
|
private final IChannelViewLogService channelViewLogService;
|
|
private final IChannelDownloadLogService channelDownloadLogService;
|
|
private final IH5LoanMarketViewLogService h5LoanMarketViewLogService;
|
|
@GetMapping(value = "/addVisitLog")
|
@ApiOperation(value = "增加渠道UV统计记录")
|
public ResultJson addVisitLog(String appId, Integer type) {
|
channelViewLogService.addVisitLog(appId, type);
|
return ResultJson.success();
|
}
|
|
@GetMapping(value = "/getChannelVisitList")
|
@ApiOperation(value = "获取渠道UV统计")
|
@PreAuthorize("hasAuthority('channelVisit.getVisitList')")
|
public ResultJson<List<ChannelVisitVo>> getChannelVisitList(PageRequest pageRequest, ChannelVisitDto visitDto) {
|
List<ChannelVisitVo> result = channelViewLogService.getChannelVisitList(pageRequest, visitDto);
|
return ResultJson.ok(result);
|
}
|
|
@GetMapping(value = "/addDownloadLog")
|
@ApiOperation(value = "新增渠道下载统计记录")
|
public ResultJson<Void> addDownloadLog(@AuthenticationPrincipal UserDetail userDetail, String downloadUrl) {
|
channelDownloadLogService.addDownloadLog(downloadUrl, userDetail);
|
return ResultJson.success();
|
}
|
|
@GetMapping(value = "/getH5LoanMarketViewLogs")
|
@ApiOperation(value = "获取H5渠道贷超UV统计")
|
@PreAuthorize("hasAuthority('channelVisit.getH5LoanMarketViewLogs')")
|
public ResultJson<IPage<H5LoanMarketViewVo>> getH5LoanMarketViewLogs(PageRequest pageRequest, ChannelVisitDto visitDto) {
|
IPage<H5LoanMarketViewVo> result = h5LoanMarketViewLogService.getH5LoanMarketViewLogs(pageRequest, visitDto);
|
return ResultJson.ok(result);
|
}
|
}
|