Merge branch 'feature/mall_product' into test

pull/17/head
tangqian 2023-06-25 14:37:32 +08:00
commit 877e40d7a0
17 changed files with 667 additions and 42 deletions

View File

@ -0,0 +1,53 @@
package cn.iocoder.yudao.module.shop.request.order;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* @Title:DataAnalysisRequest
* @Description:
* @author: tangqian
* @date: 2023/6/21 11:08
* @version: V1.0.0
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Schema( description="销售数据分析")
public class DataAnalysisRequest implements Serializable {
@Schema(description = "开始执行时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime startTime;
@Schema(description = "结束执行时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime endTime;
@Schema(description = "租户id")
private Long tenantId;
@Schema(description = "租户名称")
private Long tenantName;
@Schema(description = "销售金额排序1(降序desc);2(升序asc)")
private Integer sortMoney;
@Schema(description = "订单数量排序1(降序desc);2(升序asc)")
private Integer sortNum;
@Schema(description = "页码,从 1 开始")
private Integer pageNo=1;
@Schema(description = "每页条数,最大值为 10000")
private Integer pageSize=20;
}

View File

@ -1,50 +1,43 @@
package cn.iocoder.yudao.module.shop.controller.admin.recharge;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
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.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.shop.controller.admin.recharge.method.Excel;
import cn.iocoder.yudao.module.shop.convert.recharge.RechargeOrderInfoConvert;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderInfoDO;
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
import cn.iocoder.yudao.module.shop.convert.recharge.RechargeOrderConvert;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
import cn.iocoder.yudao.module.shop.request.member.RefundRequest;
import cn.iocoder.yudao.module.shop.request.member.RemarkRequest;
import cn.iocoder.yudao.module.shop.service.order.StoreOrderService;
import cn.iocoder.yudao.module.shop.service.recharge.RechargeOrderInfoService;
import cn.iocoder.yudao.module.shop.service.recharge.RechargeOrderService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.time.LocalDateTime;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
import cn.iocoder.yudao.module.shop.dal.dataobject.recharge.RechargeOrderDO;
import cn.iocoder.yudao.module.shop.convert.recharge.RechargeOrderConvert;
import cn.iocoder.yudao.module.shop.service.recharge.RechargeOrderService;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
@Tag(name = "管理后台 - 订单")
@RestController

View File

@ -0,0 +1,22 @@
package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Title:AffiliationAnalysisExcelReqVO
* @Description: TODO
* @author: tangqian
* @date: 2023/6/21 14:36
* @version: V1.0.0
*/
@Data
public class AffiliationAnalysisExcelReqVO implements Serializable {
@ExcelProperty( "地区")
private String name;
@ExcelProperty( "金额")
private BigDecimal money;
}

View File

@ -0,0 +1,25 @@
package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Title:AffiliationAnalysisReqVO
* @Description: TODO
* @author: tangqian
* @date: 2023/6/21 14:13
* @version: V1.0.0
*/
@Data
@ToString(callSuper = true)
public class AffiliationAnalysisReqVO implements Serializable {
private static final long serialVersionUID = -1691739114336421986L;
@Schema(description = "地区")
private String name;
@Schema(description = "金额")
private BigDecimal money;
}

View File

@ -0,0 +1,55 @@
package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Title:DimensionalityAnalysisReqVO
* @Description: TODO
* @author: tangqian
* @date: 2023/6/21 11:10
* @version: V1.0.0
*/
@Data
@ToString(callSuper = true)
public class DimensionalityAnalysisReqVO implements Serializable {
private static final long serialVersionUID = 9195908075161191001L;
@Schema(description = "总销售金额")
private BigDecimal totalMoney;
@Schema(description = "总订单数量")
private Integer totalNum;
@Schema(description = "订单均价(总金额/订单数量)")
private BigDecimal orderTotalMoney;
@Schema(description = "客单价(总金额/客户数量)")
private BigDecimal guestMoney;
@Schema(description = "本金待返汇总")
private BigDecimal toBeReturnedTotalMoney;
@Schema(description = "销售已返金额")
private BigDecimal haveReturnedMoney;
@Schema(description = "销售待返金额")
private BigDecimal toBeReturnedMoney;
@Schema(description = "投诉单数")
private Integer complaintTotalNum;
@Schema(description = "投诉率")
private BigDecimal complaintProportion;
@Schema(description = "退款单数")
private Integer refundTotalNum;
@Schema(description = "退款率")
private BigDecimal refundProportion;
@Schema(description = "240档单数")
private Integer threeTotalNum;
@Schema(description = "240 占比")
private BigDecimal threeProportion;
@Schema(description = "400档单数")
private Integer twoTotalNum;
@Schema(description = "400 占比")
private BigDecimal twoProportion;
@Schema(description = "640档单数")
private Integer oneTotalNum;
@Schema(description = "640 占比")
private BigDecimal oneProportion;
}

View File

@ -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;
}

View File

@ -0,0 +1,37 @@
package cn.iocoder.yudao.module.shop.controller.admin.recharge.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
import java.math.BigDecimal;
/**
* @Title:PromoterAnalysisReqVO
* @Description: TODO
* @author: tangqian
* @date: 2023/6/21 14:51
* @version: V1.0.0
*/
@Data
@ToString(callSuper = true)
public class PromoterAnalysisReqVO implements Serializable {
private static final long serialVersionUID = -7630125949607067142L;
@Schema(description = "租户名称")
private String tenantName;
@Schema(description = "推广员名称")
private String promoterName;
@Schema(description = "总销售金额")
private BigDecimal totalMoney;
@Schema(description = "总订单数量")
private Integer totalNum;
@Schema(description = "总退款金额")
private BigDecimal totalWithdrawMoney;
@Schema(description = "240档订单数量")
private Integer threeTotalNum;
@Schema(description = "400档订单数量")
private Integer twoTotalNum;
@Schema(description = "640档订单数量")
private Integer oneTotalNum;
}

View File

@ -135,7 +135,9 @@ public class RechargeOrderExportReqVO {
*/
private Integer refundType;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime startApplyTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime endApplyTime;
}

View File

@ -142,6 +142,8 @@ public class RechargeOrderPageReqVO extends PageParam {
/**
* 退
*/
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime startApplyTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime endApplyTime;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -0,0 +1,158 @@
package cn.iocoder.yudao.module.shop.controller.admin.statement;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
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.*;
import cn.iocoder.yudao.module.shop.request.order.DataAnalysisRequest;
import cn.iocoder.yudao.module.shop.service.order.StoreOrderService;
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.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
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 java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
/**
* @Title:DataAnalysisController
* @Description:
* @author: tangqian
* @date: 2023/6/21 11:01
* @version: V1.0.0
*/
@Tag(name = "管理后台 - 数据分析")
@RestController
@RequestMapping("/system/analysis")
@Validated
public class DataAnalysisController {
@Autowired
private StoreOrderService storeOrderService;
// 维度数据统计
@Operation(summary = "维度数据统计")
@RequestMapping(value = "/dimensionalityAnalysis", method = RequestMethod.GET)
@PreAuthenticated
@TenantIgnore
public CommonResult<DimensionalityAnalysisReqVO> dimensionalityAnalysis(@Validated DataAnalysisRequest request) {
return CommonResult.success(storeOrderService.dimensionalityAnalysis(request));
}
// 号码归属地分析
@Operation(summary = "号码归属地分析")
@RequestMapping(value = "/affiliationAnalysis", method = RequestMethod.GET)
@PreAuthenticated
@TenantIgnore
public CommonResult<List<AffiliationAnalysisReqVO>> affiliation(@Validated DataAnalysisRequest request) {
return CommonResult.success(storeOrderService.affiliation(request));
}
@Operation(summary = "号码归属地分析-导出")
@RequestMapping(value = "/affiliationAnalysis-excel", method = RequestMethod.GET)
@PreAuthenticated
@TenantIgnore
@OperateLog(type = EXPORT)
public void affiliationExcel(@Validated DataAnalysisRequest request
, HttpServletResponse response) throws IOException {
List<AffiliationAnalysisReqVO> affiliation = storeOrderService.affiliation(request);
List<AffiliationAnalysisExcelReqVO> list = new ArrayList<>();
if (!CollectionUtils.isEmpty(affiliation)) {
affiliation.forEach(e -> {
AffiliationAnalysisExcelReqVO vo = new AffiliationAnalysisExcelReqVO();
BeanUtils.copyProperties(e, vo);
list.add(vo);
});
}
ExcelUtils.write(response, "号码归属地分析.xls", "数据", AffiliationAnalysisExcelReqVO.class, list);
}
// 销售(商铺维度)
@Operation(summary = "销售(商铺维度)")
@RequestMapping(value = "/statisticsAnalysisPage", method = RequestMethod.GET)
@PreAuthenticated
@TenantIgnore
public CommonResult<PageResult<StatisticsPageVo>> statisticsAnalysis(@Validated DataAnalysisRequest request) {
return CommonResult.success(storeOrderService.statisticsAnalysis(request));
}
@Operation(summary = "销售(商铺维度)-导出")
@RequestMapping(value = "/statisticsAnalysis-excel", method = RequestMethod.GET)
@PreAuthenticated
@TenantIgnore
@OperateLog(type = EXPORT)
public void statisticsAnalysisExcel(@Validated DataAnalysisRequest request
, HttpServletResponse response) throws IOException {
PageResult<StatisticsPageVo> statisticsPageVoPageResult = storeOrderService.statisticsAnalysis(request);
List<StatisticsExcelVO> list = new ArrayList<>();
if (null != statisticsPageVoPageResult && !CollectionUtils.isEmpty(statisticsPageVoPageResult.getList())) {
statisticsPageVoPageResult.getList().forEach(e -> {
StatisticsExcelVO vo = new StatisticsExcelVO();
BeanUtils.copyProperties(e, vo);
list.add(vo);
});
}
ExcelUtils.write(response, "销售(商铺维度).xls", "数据", StatisticsExcelVO.class, list);
}
// 销售(推广员维度)
@Operation(summary = "销售(推广员维度)")
@RequestMapping(value = "/promoterAnalysis", method = RequestMethod.GET)
@PreAuthenticated
@TenantIgnore
public CommonResult<PageResult<PromoterAnalysisReqVO>> promoterAnalysis(@Validated DataAnalysisRequest request) {
return CommonResult.success(storeOrderService.promoterAnalysis(request));
}
// 销售(推广员维度) 导出
@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<PromoterAnalysisReqVO> promoterAnalysisReqVOPageResult = storeOrderService.promoterAnalysis(request);
List<PromoterAnalysisExcelVo> 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<List<RefundAnalysisReqVo>> refundAnalysis(@Validated DataAnalysisRequest request) {
return CommonResult.success(storeOrderService.refundAnalysis(request));
}
@Operation(summary = "退款分析(订单量)")
@RequestMapping(value = "/refundOrderAnalysis", method = RequestMethod.GET)
@PreAuthenticated
@TenantIgnore
public CommonResult<RefundOrderAnalysisReqVO> refundOrderAnalysis(@Validated DataAnalysisRequest request) {
return CommonResult.success(storeOrderService.refundOrderAnalysis(request));
}
}

View File

@ -1,14 +1,16 @@
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.*;
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;
import cn.iocoder.yudao.module.shop.response.order.OrderBrokerageData;
import cn.iocoder.yudao.module.shop.response.order.StoreOrderStatisticsChartItemResponse;
import cn.iocoder.yudao.module.shop.vo.order.StoreDateRangeSqlPram;
import cn.iocoder.yudao.module.shop.vo.order.StoreStaffDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
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;
@ -81,4 +83,12 @@ public interface StoreOrderMapper extends BaseMapperX<StoreOrder> {
BigDecimal shoppingOrderCount(@Param("startDate") LocalDateTime startDate, @Param("endDate") LocalDateTime endDate, @Param("promoterId") Long promoterId);
List<StatementAllReqDataVo> statisticsAll(@Param("startTime") LocalDateTime startTime, @Param("endTime") LocalDateTime endTime, @Param("tenantId") Long tenantId);
IPage<StatisticsPageVo> statisticsAnalysis(IPage<StatisticsPageVo> page, @Param("data")DataAnalysisRequest request);
IPage<PromoterAnalysisReqVO> promoterAnalysis(Page<PromoterAnalysisReqVO> page, @Param("data")DataAnalysisRequest request);
List<RefundAnalysisReqVo> refundAnalysis(@Param("data")DataAnalysisRequest request);
RefundOrderAnalysisReqVO refundOrderAnalysis(@Param("data")DataAnalysisRequest request);
}

View File

@ -1,9 +1,8 @@
package cn.iocoder.yudao.module.shop.service.order;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
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.TenantListVo;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
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.dal.dataobject.recharge.RechargeOrderDO;
import cn.iocoder.yudao.module.shop.request.member.OrderContentRequest;
@ -414,4 +413,16 @@ public interface StoreOrderService extends IService<StoreOrder> {
List<TenantListVo> getTenantList();
void addPhone(RechargeOrderDO orderDO, String outTradeNo);
DimensionalityAnalysisReqVO dimensionalityAnalysis(DataAnalysisRequest request);
List<AffiliationAnalysisReqVO> affiliation(DataAnalysisRequest request);
PageResult<StatisticsPageVo> statisticsAnalysis(DataAnalysisRequest request);
PageResult<PromoterAnalysisReqVO> promoterAnalysis(DataAnalysisRequest request);
List<RefundAnalysisReqVo> refundAnalysis(DataAnalysisRequest request);
RefundOrderAnalysisReqVO refundOrderAnalysis(DataAnalysisRequest request);
}

View File

@ -21,10 +21,7 @@ import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder;
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
import cn.iocoder.yudao.module.member.api.user.dto.PromoterDTO;
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatementAllReqDataVo;
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.TenantListVo;
import cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.*;
import cn.iocoder.yudao.module.shop.controller.app.recharge.vo.PhoneRecordAdd;
import cn.iocoder.yudao.module.shop.dal.dataobject.express.ExpressDO;
import cn.iocoder.yudao.module.shop.dal.dataobject.order.StoreOrder;
@ -88,18 +85,14 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.DayOfWeek;
import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_TENANT_ID;
/**
* StoreOrderServiceImpl
* +----------------------------------------------------------------------
@ -1537,6 +1530,59 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderMapper, StoreOr
addPhoneRecord(orderDO, outTradeNo);
}
@Override
public DimensionalityAnalysisReqVO dimensionalityAnalysis(DataAnalysisRequest request) {
if (!Objects.nonNull(request.getTenantId())) {
request.setTenantId(TenantContextHolder.getTenantId());
}
return null;
}
@Override
public List<AffiliationAnalysisReqVO> affiliation(DataAnalysisRequest request) {
if (!Objects.nonNull(request.getTenantId())) {
request.setTenantId(TenantContextHolder.getTenantId());
}
return null;
}
@Override
public PageResult<StatisticsPageVo> statisticsAnalysis(DataAnalysisRequest request) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<StatisticsPageVo> 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<PromoterAnalysisReqVO> promoterAnalysis(DataAnalysisRequest request) {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<PromoterAnalysisReqVO> 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());
}
@Override
public List<RefundAnalysisReqVo> 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) {
Long tenantId = TenantContextHolder.getTenantId();

View File

@ -10,6 +10,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@ -45,8 +46,9 @@ public class ReplenishmentTask {
/**
* 83
*/
@Scheduled(cron = "0 0 9,15 * * ?")
@TenantIgnore
@Transactional
@Scheduled(cron = "0 0 8,15 * * ?")
public void replenishmentTask() {
/**
* 1.
@ -99,6 +101,10 @@ public class ReplenishmentTask {
rechargeOrderMapper.updateById(orderDO);
// 写入 充值档位记录表
storeOrderService.addPhone(orderDO, outTradeNo);
} else {
orderDO.setIsReplenishment(1);
orderDO.setReplenishmentName(map.toString());
rechargeOrderMapper.updateById(orderDO);
}
}

View File

@ -108,4 +108,129 @@
and info.tenant_id =#{tenantId}
</if>
</select>
<select id="statisticsAnalysis"
resultType="cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.StatisticsPageVo">
SELECT
t1.tenant_id AS tenantId,
t3.`name` AS tenantName,
SUM(t1.price) AS totalMoney,
count(t1.id) AS totalNum,
SUM(IF(t2.refund_status=2,t1.price,0)) AS totalWithdrawMoney,
sum(t1.price = 240) AS threeTotalNum,
sum(t1.price = 400) AS twoTotalNum,
sum(t1.price = 640) AS oneTotalNum
FROM
cy_recharge_order_info t1
JOIN cy_recharge_order t2 ON t1.recharge_order_id = t2.id
LEFT JOIN system_tenant t3 ON t1.tenant_id = t3.id
WHERE
t2.paid != 0
<if test="null != data.startTime">
and t1.create_time &gt;= #{startTime}
</if>
<if test="null != data.endTime">
and t1.create_time &lt; #{endTime}
</if>
<if test="data.tenantId !=null and data.tenantId!=1">
and t1.tenant_id =#{data.tenantId}
</if>
GROUP BY
t1.tenant_id
<choose>
<when test="data.sortMoney !=null and data.sortMoney=1">
ORDER BY totalMoney DESC,totalNum DESC
</when>
<otherwise>
ORDER BY totalMoney ASC,totalNum ASC
</otherwise>
</choose>
</select>
<select id="promoterAnalysis"
resultType="cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.PromoterAnalysisReqVO">
SELECT
t4.`name` AS tenantName,
t2.nickname AS promoterName,
SUM(t6.price) AS totalMoney,
count(t6.id) AS totalNum,
SUM(IF(t5.refund_status=2,t6.price,0)) AS totalWithdrawMoney,
sum(t6.price = 240) AS threeTotalNum,
sum(t6.price = 400) AS twoTotalNum,
sum(t6.price = 640) AS oneTotalNum
FROM
member_promoter t1
JOIN member_user t2 ON t1.user_id = t2.id
LEFT JOIN system_dept t3 ON t1.dept_id = t3.id
LEFT JOIN system_tenant t4 ON t1.tenant_id = t4.id
LEFT JOIN cy_recharge_order t5 ON t1.user_id = t5.promoter_id
LEFT JOIN cy_recharge_order_info t6 ON t5.id = t6.recharge_order_id
WHERE t5.paid != 0
<if test="null != data.startTime">
and t1.create_time &gt;= #{startTime}
</if>
<if test="null != data.endTime">
and t1.create_time &lt; #{endTime}
</if>
<if test="data.tenantId !=null and data.tenantId!=1">
and t1.tenant_id =#{data.tenantId}
</if>
GROUP BY
t1.user_id, t4.`name`
<choose>
<when test="data.sortMoney !=null and data.sortMoney=1">
ORDER BY totalMoney DESC,totalNum DESC
</when>
<otherwise>
ORDER BY totalMoney ASC,totalNum ASC
</otherwise>
</choose>
</select>
<select id="refundAnalysis"
resultType="cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RefundAnalysisReqVo">
SELECT
refund_type,
refund_name,
count( refund_type ) AS totalNum
FROM
cy_recharge_order
WHERE
paid = 2
AND refund_status = 2
AND refund_type IS NOT NULL
<if test="null != data.startTime">
and t1.create_time &gt;= #{startTime}
</if>
<if test="null != data.endTime">
and t1.create_time &lt; #{endTime}
</if>
<if test="data.tenantId !=null and data.tenantId!=1">
and t1.tenant_id =#{data.tenantId}
</if>
GROUP BY
refund_type,refund_name
</select>
<select id="refundOrderAnalysis"
resultType="cn.iocoder.yudao.module.shop.controller.admin.recharge.vo.RefundOrderAnalysisReqVO">
SELECT
COUNT(CASE WHEN refund_status = 2 THEN 1 END) AS alreadyTotalNum,
COUNT(CASE WHEN refund_status != 2 THEN 1 END) AS notTotalNum
FROM
cy_recharge_order
WHERE
paid = 1
<if test="null != data.startTime">
and t1.create_time &gt;= #{startTime}
</if>
<if test="null != data.endTime">
and t1.create_time &lt; #{endTime}
</if>
<if test="data.tenantId !=null and data.tenantId!=1">
and t1.tenant_id =#{data.tenantId}
</if>
</select>
</mapper>