充值代理-周统计-后台
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
|
||||
package com.accompany.admin.vo.recharge;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@ApiModel
|
||||
@Data
|
||||
public class WeekRechargeAgentPartitionStatAdminVo {
|
||||
|
||||
@ApiModelProperty("周期")
|
||||
private String date;
|
||||
@ApiModelProperty("周期结束")
|
||||
private String endDate;
|
||||
|
||||
@ApiModelProperty("分区id")
|
||||
private Integer partitionId;
|
||||
@ApiModelProperty("分区描述")
|
||||
private String partitionDesc;
|
||||
|
||||
@ApiModelProperty("充值代理数")
|
||||
private Integer rechargeUserCount;
|
||||
@ApiModelProperty("充值代理活跃数")
|
||||
private Integer activeRechargeUserCount;
|
||||
@ApiModelProperty("公会usd总转入数")
|
||||
private BigDecimal receiveTotalGuildUsd;
|
||||
@ApiModelProperty("金币转赠总转出数")
|
||||
private BigDecimal transformTotalDiamond;
|
||||
@ApiModelProperty("金币转赠换算usd总转入数")
|
||||
private BigDecimal transformTotalUsd;
|
||||
@ApiModelProperty("剩余usd数")
|
||||
private BigDecimal remainUsd;
|
||||
|
||||
}
|
@@ -0,0 +1,57 @@
|
||||
package com.accompany.admin.service.recharge;
|
||||
|
||||
import com.accompany.admin.vo.recharge.WeekRechargeAgentPartitionStatAdminVo;
|
||||
import com.accompany.business.dto.WeekRechargeAgentPartitionStat;
|
||||
import com.accompany.business.mybatismapper.WeekRechargeAgentPartitionStatMapper;
|
||||
import com.accompany.business.param.BasePageParams;
|
||||
import com.accompany.core.enumeration.PartitionEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class WeekRechargeAgentStatAdminService {
|
||||
|
||||
@Autowired
|
||||
private WeekRechargeAgentPartitionStatMapper mapper;
|
||||
|
||||
public Page<WeekRechargeAgentPartitionStatAdminVo> page(Integer partitionId, String date,
|
||||
BasePageParams pageParam) {
|
||||
Page<WeekRechargeAgentPartitionStatAdminVo> voPage = new Page<>(pageParam.getPageNo(), pageParam.getPageSize());
|
||||
Page<WeekRechargeAgentPartitionStat> poPage = new Page<>(pageParam.getPageNo(), pageParam.getPageSize());
|
||||
LambdaQueryWrapper<WeekRechargeAgentPartitionStat> queryWrapper = Wrappers.<WeekRechargeAgentPartitionStat>lambdaQuery()
|
||||
.eq(StringUtils.isNotBlank(date), WeekRechargeAgentPartitionStat::getDate, date)
|
||||
.eq(null != partitionId, WeekRechargeAgentPartitionStat::getPartitionId, partitionId)
|
||||
.orderByDesc(WeekRechargeAgentPartitionStat::getDate);
|
||||
mapper.selectPage(poPage, queryWrapper);
|
||||
if (CollectionUtils.isEmpty(poPage.getRecords())){
|
||||
return voPage;
|
||||
}
|
||||
|
||||
List<WeekRechargeAgentPartitionStatAdminVo> voList = poPage.getRecords().stream()
|
||||
.map(po -> {
|
||||
WeekRechargeAgentPartitionStatAdminVo vo = new WeekRechargeAgentPartitionStatAdminVo();
|
||||
vo.setDate(po.getDate());
|
||||
vo.setEndDate(po.getEndDate());
|
||||
vo.setPartitionId(po.getPartitionId());
|
||||
vo.setPartitionDesc(PartitionEnum.getByPartitionId(po.getPartitionId()).getDesc());
|
||||
|
||||
BeanUtils.copyProperties(po, vo);
|
||||
|
||||
return vo;
|
||||
|
||||
})
|
||||
.toList();
|
||||
voPage.setRecords(voList);
|
||||
voPage.setTotal(poPage.getTotal());
|
||||
return voPage;
|
||||
}
|
||||
|
||||
}
|
@@ -0,0 +1,77 @@
|
||||
package com.accompany.admin.controller.recharge;
|
||||
|
||||
import com.accompany.admin.controller.BaseController;
|
||||
import com.accompany.admin.service.guild.WeekGuildPartitionStatAdminService;
|
||||
import com.accompany.admin.service.recharge.WeekRechargeAgentStatAdminService;
|
||||
import com.accompany.admin.vo.guild.WeekGuildPartitionStatAdminVo;
|
||||
import com.accompany.admin.vo.recharge.WeekRechargeAgentPartitionStatAdminVo;
|
||||
import com.accompany.business.param.BasePageParams;
|
||||
import com.accompany.common.result.BusiResult;
|
||||
import com.accompany.common.status.BusiStatus;
|
||||
import com.accompany.core.exception.AdminServiceException;
|
||||
import com.accompany.core.util.StringUtils;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.support.ExcelTypeEnum;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.SneakyThrows;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
@Api(tags = "充值代理代发/售卖分析周统计")
|
||||
@RequestMapping("/admin/rechargeAgentStat")
|
||||
@RestController
|
||||
public class RechargeAgentPartitionAdminController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private WeekRechargeAgentStatAdminService statService;
|
||||
|
||||
@ApiOperation("分页查询周统计")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "partitionId", value = "分区id"),
|
||||
@ApiImplicitParam(name = "date", value = "周期开始日期"),
|
||||
@ApiImplicitParam(name = "pageNo", value = "页码", required = true),
|
||||
@ApiImplicitParam(name = "pageSize", value = "页长", required = true),
|
||||
})
|
||||
@GetMapping("/page")
|
||||
public BusiResult<Page<WeekRechargeAgentPartitionStatAdminVo>> page(Integer partitionId,
|
||||
String date,
|
||||
BasePageParams pageParam) {
|
||||
Page<WeekRechargeAgentPartitionStatAdminVo> page = statService.page(partitionId, date, pageParam);
|
||||
return BusiResult.success(page);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@ApiOperation("导出周统计")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "partitionId", value = "分区id"),
|
||||
@ApiImplicitParam(name = "date", value = "周期开始日期"),
|
||||
})
|
||||
@GetMapping("/export")
|
||||
public void export(HttpServletResponse response,
|
||||
Integer partitionId,
|
||||
String date){
|
||||
response.setContentType("application/vnd.ms-excel");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
// 这里URLEncoder.encode可以防止中文乱码
|
||||
String excelName = URLEncoder.encode("充值代理代发/售卖分析", StandardCharsets.UTF_8);
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + excelName + ExcelTypeEnum.XLSX.getValue());
|
||||
|
||||
BasePageParams pageParam = new BasePageParams();
|
||||
pageParam.setPageNo(1);
|
||||
pageParam.setPageSize(-1);
|
||||
Page<WeekRechargeAgentPartitionStatAdminVo> page = statService.page(partitionId, date, pageParam);
|
||||
EasyExcel.write(response.getOutputStream(), WeekRechargeAgentPartitionStatAdminVo.class).sheet("充值代理代发/售卖分析").doWrite(page.getRecords());
|
||||
}
|
||||
|
||||
}
|
@@ -13,7 +13,6 @@ public class WeekRechargeAgentPartitionStat {
|
||||
|
||||
private Integer partitionId;
|
||||
|
||||
|
||||
private Integer rechargeUserCount;
|
||||
private Integer activeRechargeUserCount;
|
||||
private BigDecimal receiveTotalGuildUsd;
|
||||
|
Reference in New Issue
Block a user