diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/PromoterAnalysisExcelVo.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/PromoterAnalysisExcelVo.java new file mode 100644 index 000000000..2f2d6ba6d --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/PromoterAnalysisExcelVo.java @@ -0,0 +1,35 @@ +package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @Title:PromoterAnalysisExcelVo + * @Description: TODO + * @author: tangqian + * @date: 2023/6/25 10:04 + * @version: V1.0.0 + */ +@Data +public class PromoterAnalysisExcelVo { + + @ExcelProperty("租户名称") + private String tenantName; + @ExcelProperty("推广员名称") + private String promoterName; + @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/recharge/vo/RefundAnalysisReqVo.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RefundAnalysisReqVo.java new file mode 100644 index 000000000..b31ee6e26 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RefundAnalysisReqVo.java @@ -0,0 +1,24 @@ +package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Title:RefundAnalysisReqVo + * @Description: TODO + * @author: tangqian + * @date: 2023/6/25 11:08 + * @version: V1.0.0 + */ +@Data +public class RefundAnalysisReqVo implements Serializable { + private static final long serialVersionUID = -7750537307362666158L; + @Schema(description = "退款类型") + private String refundType; + @Schema(description = "退款类型中文解释") + private String refundName; + @Schema(description = "数量") + private Integer totalNum; +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RefundOrderAnalysisReqVO.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RefundOrderAnalysisReqVO.java new file mode 100644 index 000000000..253ab5cd0 --- /dev/null +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/recharge/vo/RefundOrderAnalysisReqVO.java @@ -0,0 +1,21 @@ +package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.io.Serializable; + +/** + * @Title:RefundOrderAnalysisReqVO + * @Description: TODO + * @author: tangqian + * @date: 2023/6/25 11:58 + * @version: V1.0.0 + */ +@Data +public class RefundOrderAnalysisReqVO implements Serializable { + @Schema(description = "已退款数量") + private Integer alreadyTotalNum; + @Schema(description = "未退款数量") + private Integer notTotalNum; +} diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/statement/DataAnalysisController.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/statement/DataAnalysisController.java index de83e799b..97129b319 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/statement/DataAnalysisController.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/controller/admin/statement/DataAnalysisController.java @@ -120,6 +120,39 @@ public class DataAnalysisController { } // 销售(推广员维度) 导出 - + @Operation(summary = "销售(商铺维度)-导出") + @RequestMapping(value = "/promoterAnalysis-excel", method = RequestMethod.GET) + @PreAuthenticated + @TenantIgnore + @OperateLog(type = EXPORT) + public void promoterAnalysisExcel(@Validated DataAnalysisRequest request + , HttpServletResponse response) throws IOException { + PageResult promoterAnalysisReqVOPageResult = storeOrderService.promoterAnalysis(request); + List list = new ArrayList<>(); + if (null != promoterAnalysisReqVOPageResult && !CollectionUtils.isEmpty(promoterAnalysisReqVOPageResult.getList())) { + promoterAnalysisReqVOPageResult.getList().forEach(e -> { + PromoterAnalysisExcelVo vo = new PromoterAnalysisExcelVo(); + BeanUtils.copyProperties(e, vo); + list.add(vo); + }); + } + ExcelUtils.write(response, "销售(推广员维度).xls", "数据", PromoterAnalysisExcelVo.class, list); + } // 退款原因分析 + + @Operation(summary = "退款分析(退款类型)") + @RequestMapping(value = "/refundAnalysis", method = RequestMethod.GET) + @PreAuthenticated + @TenantIgnore + public CommonResult> refundAnalysis(@Validated DataAnalysisRequest request) { + return CommonResult.success(storeOrderService.refundAnalysis(request)); + } + + @Operation(summary = "退款分析(订单量)") + @RequestMapping(value = "/refundOrderAnalysis", method = RequestMethod.GET) + @PreAuthenticated + @TenantIgnore + public CommonResult refundOrderAnalysis(@Validated DataAnalysisRequest request) { + return CommonResult.success(storeOrderService.refundOrderAnalysis(request)); + } } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/mysql/order/StoreOrderMapper.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/mysql/order/StoreOrderMapper.java index 4334bc0f1..8bd3a7141 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/mysql/order/StoreOrderMapper.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/dal/mysql/order/StoreOrderMapper.java @@ -1,8 +1,7 @@ package cn.iocoder.yudao.module.shop.dal.mysql.order; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatementAllReqDataVo; -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.dal.dataobject.order.StoreOrder; import cn.iocoder.yudao.module.shop.request.order.DataAnalysisRequest; import cn.iocoder.yudao.module.shop.request.order.StoreOrderStaticsticsRequest; @@ -11,6 +10,7 @@ import cn.iocoder.yudao.module.shop.response.order.StoreOrderStatisticsChartItem import cn.iocoder.yudao.module.shop.vo.order.StoreDateRangeSqlPram; import cn.iocoder.yudao.module.shop.vo.order.StoreStaffDetail; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -85,4 +85,10 @@ public interface StoreOrderMapper extends BaseMapperX { List statisticsAll(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, @Param("tenantId") Long tenantId); IPage statisticsAnalysis(IPage page, @Param("data")DataAnalysisRequest request); + + IPage promoterAnalysis(Page page, @Param("data")DataAnalysisRequest request); + + List refundAnalysis(@Param("data")DataAnalysisRequest request); + + RefundOrderAnalysisReqVO refundOrderAnalysis(@Param("data")DataAnalysisRequest request); } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/StoreOrderService.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/StoreOrderService.java index cfce476ed..6e6b55ec7 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/StoreOrderService.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/StoreOrderService.java @@ -421,4 +421,8 @@ public interface StoreOrderService extends IService { PageResult statisticsAnalysis(DataAnalysisRequest request); PageResult promoterAnalysis(DataAnalysisRequest request); + + List refundAnalysis(DataAnalysisRequest request); + + RefundOrderAnalysisReqVO refundOrderAnalysis(DataAnalysisRequest request); } diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java index 8a791e80f..15ba950f1 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/java/cn/iocoder/yudao/module/shop/service/order/impl/StoreOrderServiceImpl.java @@ -1532,11 +1532,17 @@ public class StoreOrderServiceImpl extends ServiceImpl affiliation(DataAnalysisRequest request) { + if (!Objects.nonNull(request.getTenantId())) { + request.setTenantId(TenantContextHolder.getTenantId()); + } return null; } @@ -1544,14 +1550,38 @@ public class StoreOrderServiceImpl extends ServiceImpl statisticsAnalysis(DataAnalysisRequest request) { com.baomidou.mybatisplus.extension.plugins.pagination.Page page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(request.getPageNo(), request.getPageSize()); + if (!Objects.nonNull(request.getTenantId())) { + request.setTenantId(TenantContextHolder.getTenantId()); + } mapper.statisticsAnalysis(page, request); return new PageResult<>(page.getRecords(), page.getTotal()); } @Override public PageResult promoterAnalysis(DataAnalysisRequest request) { + com.baomidou.mybatisplus.extension.plugins.pagination.Page page = + new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(request.getPageNo(), request.getPageSize()); + if (!Objects.nonNull(request.getTenantId())) { + request.setTenantId(TenantContextHolder.getTenantId()); + } + mapper.promoterAnalysis(page, request); + return new PageResult<>(page.getRecords(), page.getTotal()); + } - return null; + @Override + public List refundAnalysis(DataAnalysisRequest request) { + if (!Objects.nonNull(request.getTenantId())) { + request.setTenantId(TenantContextHolder.getTenantId()); + } + return mapper.refundAnalysis(request); + } + + @Override + public RefundOrderAnalysisReqVO refundOrderAnalysis(DataAnalysisRequest request) { + if (!Objects.nonNull(request.getTenantId())) { + request.setTenantId(TenantContextHolder.getTenantId()); + } + return mapper.refundOrderAnalysis(request); } private RechargeOrderDO initializeOrder(OrderContentRequest request, String code, MemberUserRespDTO user, PromoterDTO promoterDTO) { diff --git a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/order/StoreOrderMapper.xml b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/order/StoreOrderMapper.xml index 1c3ca5dd1..d166753a7 100644 --- a/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/order/StoreOrderMapper.xml +++ b/yudao-module-mall/yudao-module-shop-biz/src/main/resources/mapper/order/StoreOrderMapper.xml @@ -131,6 +131,9 @@ and t1.create_time < #{endTime} + + and t1.tenant_id =#{data.tenantId} + GROUP BY t1.tenant_id @@ -142,4 +145,92 @@ + + + +