diff --git a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/PageParam.java b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/PageParam.java index 9c553055a..aedf1af0a 100644 --- a/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/PageParam.java +++ b/yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/PageParam.java @@ -20,10 +20,10 @@ public class PageParam implements Serializable { @Min(value = 1, message = "页码最小值为 1") private Integer pageNo = PAGE_NO; - @Schema(description = "每页条数,最大值为 100", required = true, example = "10") + @Schema(description = "每页条数,最大值为 1000", required = true, example = "10") @NotNull(message = "每页条数不能为空") @Min(value = 1, message = "每页条数最小值为 1") - @Max(value = 100, message = "每页条数最大值为 100") + @Max(value = 100, message = "每页条数最大值为 1000") private Integer pageSize = PAGE_SIZE; } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/StatisticsExcelVO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/StatisticsExcelVO.java new file mode 100644 index 000000000..d9caf1de4 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/StatisticsExcelVO.java @@ -0,0 +1,32 @@ +package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * 充值档位 Excel VO + * + * @author 创盈云 + */ +@Data +public class StatisticsExcelVO { + @ExcelProperty("租户id") + private Long tenantId; + @ExcelProperty("租户名称") + private String tenantName; + @ExcelProperty("总销售金额") + private BigDecimal totalMoney; + @ExcelProperty("总订单数量") + private Integer totalNum; + @ExcelProperty("总退款金额") + private BigDecimal totalWithdrawMoney; + @ExcelProperty("240档订单数量") + private Integer threeTotalNum; + @ExcelProperty("400档订单数量") + private Integer twoTotalNum; + @ExcelProperty("640档订单数量") + private Integer oneTotalNum; + +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/statement/StatementController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/statement/StatementController.java index c7d13fc24..933e7939d 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/statement/StatementController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/statement/StatementController.java @@ -2,26 +2,38 @@ package cn.iocoder.yudao.module.shop.controller.admin.statement; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; +import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore; -import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RechargeGearRespVO; -import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatementAllReqVo; -import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatisticsPageVo; +import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*; +import cn.iocoder.yudao.module.shop.convert.recharge.RechargeGearConvert; import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrderStatus; +import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeGearDO; import cn.iocoder.yudao.module.shop.request.order.StatementAllRequest; import cn.iocoder.yudao.module.shop.request.order.StatementPageRequest; import cn.iocoder.yudao.module.shop.service.order.StoreOrderService; import com.github.pagehelper.PageInfo; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; +import javax.servlet.http.HttpServletResponse; +import javax.validation.Valid; +import java.io.IOException; +import java.util.ArrayList; import java.util.List; +import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; + /** * @Title:StatementController * @Description: 报表 @@ -54,4 +66,23 @@ public class StatementController { } + @GetMapping("/statement-excel") + @Operation(summary = "导出数据统计(根据租户统计) Excel") + @OperateLog(type = EXPORT) + @TenantIgnore + public void exportRechargeGearExcel(@Valid StatementPageRequest request, + HttpServletResponse response) throws IOException { + PageInfo statistics = storeOrderService.statistics(request); + List list = new ArrayList<>(); + if (!CollectionUtils.isEmpty(statistics.getList())) { + statistics.getList().forEach(e -> { + StatisticsExcelVO vo = new StatisticsExcelVO(); + BeanUtils.copyProperties(e,vo); + list.add(vo); + }); + } + // 导出 Excel + ExcelUtils.write(response, "导出数据统计(根据租户统计).xls", "数据", StatisticsExcelVO.class, list); + } + } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/recharge/RechargeOrderMapper.xml b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/recharge/RechargeOrderMapper.xml index ac084accb..899877869 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/recharge/RechargeOrderMapper.xml +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/recharge/RechargeOrderMapper.xml @@ -106,8 +106,8 @@ e.name as tenantName, a.out_trade_no, a.pay_time, - a.real_name as nickname, - a.real_name, + b.nickname, + b.nickname as realName, a.uid, a.user_phone, a.confirm_phone, @@ -249,9 +249,9 @@ and b.nickname like CONCAT('%',#{data.nickname},'%') - + and a.user_phone like CONCAT('%',#{data.userPhone},'%')