修改统计接口
This commit is contained in:
@ -15,25 +15,37 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
||||
public class OrderSpaceCapsuleStatisticsVo {
|
||||
@Schema(description = "每日总金额")
|
||||
private BigDecimal totalMoney;
|
||||
@Schema(description = "昨日金额")
|
||||
private BigDecimal compMoney;
|
||||
@Schema(description = "总订单")
|
||||
private Integer totalOrder;
|
||||
@Schema(description = "昨日总订单")
|
||||
private Integer compOrder;
|
||||
@Schema(description = "总分钟/分")
|
||||
private BigDecimal totalMinute;
|
||||
@Schema(description = "昨日")
|
||||
private BigDecimal compMoney;
|
||||
@Schema(description = "比较值")
|
||||
private String type;
|
||||
@Schema(description = "昨日分钟")
|
||||
private BigDecimal compMinute;
|
||||
@Schema(description = "门店id", example = "22393")
|
||||
private Long carteenId;
|
||||
@Schema(description = "总退款金额")
|
||||
private BigDecimal refundMoney;
|
||||
@Schema(description = "总退款金额")
|
||||
private BigDecimal compRefundMoneyy;
|
||||
@Schema(description = "总套餐数量")
|
||||
private Integer totalPackageSum;
|
||||
@Schema(description = "昨日套餐数量")
|
||||
private Integer compPackageSum;
|
||||
@Schema(description = "门店名称", example = "李四")
|
||||
private String carteenName;
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
@Schema(description = "总顾客")
|
||||
private Integer totalCustomer;
|
||||
@Schema(description = "总顾客")
|
||||
private Integer compCustomer;
|
||||
@Schema(description = "均单价")
|
||||
private BigDecimal avgOrderMoney;
|
||||
@Schema(description = "均单价")
|
||||
private BigDecimal compAvgOrderMoney;
|
||||
List<OrderSpaceCapsuleStatisticsComVo> lists;
|
||||
}
|
||||
|
@ -114,8 +114,7 @@ public class StatisticsSpaceCapsuleOrderServiceImpl implements StatisticsSpaceCa
|
||||
DateTime dateTime = DateUtil.offsetDay(start, -1);
|
||||
DateTime start2 = DateUtil.beginOfDay(dateTime);
|
||||
DateTime end2 = DateUtil.endOfDay(dateTime);
|
||||
BigDecimal compMoney = orderSpaceCapsuleService.getTotalMoney(carteenId, start2, end2);
|
||||
orvo.setCompMoney(compMoney);
|
||||
comp(carteenId, orvo, start2, end2);
|
||||
DateTime dateTime1 = DateUtil.beginOfMonth(end2);
|
||||
DateTime dateTime2 = DateUtil.endOfMonth(dateTime1);
|
||||
DateRange range = DateUtil.range(dateTime1, dateTime2, DateField.DAY_OF_MONTH);
|
||||
@ -130,12 +129,11 @@ public class StatisticsSpaceCapsuleOrderServiceImpl implements StatisticsSpaceCa
|
||||
vo=vo1;
|
||||
}
|
||||
if(DateUtil.isSameDay(end, var2)){
|
||||
vo.setDate(orvo.getTotalMoney()+"");
|
||||
vo.setTotalMoney(orvo.getTotalMoney());
|
||||
}
|
||||
vo.setDate(DateUtil.format(var2,"d"));
|
||||
list.add(vo) ;
|
||||
}
|
||||
|
||||
orvo.setLists(list);
|
||||
return orvo;
|
||||
}
|
||||
@ -151,8 +149,7 @@ public class StatisticsSpaceCapsuleOrderServiceImpl implements StatisticsSpaceCa
|
||||
DateTime dateTime = DateUtil.offsetMonth(start, -1);
|
||||
DateTime start2 = DateUtil.beginOfMonth(dateTime);
|
||||
DateTime end2 = DateUtil.endOfMonth(dateTime);
|
||||
BigDecimal compMoney = orderSpaceCapsuleService.getTotalMoney(carteenId, start2, end2);
|
||||
orvo.setCompMoney(compMoney);
|
||||
comp(carteenId, orvo, start2, end2);
|
||||
DateTime var1 = DateUtil.beginOfYear(start2);
|
||||
DateTime var2 = DateUtil.endOfYear(start2);
|
||||
DateRange range = DateUtil.range(var1, var2, DateField.MONTH);
|
||||
@ -167,7 +164,7 @@ public class StatisticsSpaceCapsuleOrderServiceImpl implements StatisticsSpaceCa
|
||||
vo=vo1;
|
||||
}
|
||||
if(DateUtil.isSameMonth(end, var3)){
|
||||
vo.setDate(orvo.getTotalMoney()+"");
|
||||
vo.setTotalMoney(orvo.getTotalMoney());
|
||||
}
|
||||
vo.setDate(DateUtil.format(var3,"M月"));
|
||||
list.add(vo) ;
|
||||
@ -175,4 +172,17 @@ public class StatisticsSpaceCapsuleOrderServiceImpl implements StatisticsSpaceCa
|
||||
orvo.setLists(list);
|
||||
return orvo;
|
||||
}
|
||||
|
||||
private void comp(Long carteenId, OrderSpaceCapsuleStatisticsVo orvo, DateTime start2, DateTime end2) {
|
||||
OrderSpaceCapsuleStatisticsVo vo1 = orderSpaceCapsuleMapper.compDay(SpaceCapsuleOrderEnum.SPACE_CAPSULE_ORDER_ENUM_DONE.getCode(), start2, end2, carteenId);
|
||||
if(vo1!=null){
|
||||
orvo.setCompMoney(vo1.getTotalMoney());
|
||||
orvo.setCompOrder(vo1.getTotalOrder());
|
||||
orvo.setCompCustomer(vo1.getTotalCustomer());
|
||||
orvo.setCompMinute(vo1.getTotalMinute());
|
||||
orvo.setCompAvgOrderMoney(vo1.getAvgOrderMoney());
|
||||
orvo.setCompPackageSum(vo1.getTotalPackageSum());
|
||||
orvo.setCompRefundMoneyy(vo1.getRefundMoney());
|
||||
}
|
||||
}
|
||||
}
|
@ -20,7 +20,8 @@
|
||||
SUM(combo_num) AS totalPackageSum,
|
||||
carteen_id AS carteenId,
|
||||
carteen_name AS carteenName,
|
||||
COUNT(DISTINCT user_id) AS totalCustomer
|
||||
COUNT(DISTINCT user_id) AS totalCustomer,
|
||||
ROUND(SUM(money) / COUNT(id)) AS avgOrderMoney
|
||||
FROM
|
||||
t_order_space_capsule
|
||||
WHERE
|
||||
|
Reference in New Issue
Block a user