Commit 51d86f6c authored by libin's avatar libin

大屏数据调试

parent c5544e9e
......@@ -26,6 +26,14 @@ public class LargeScreenDisplayConstantDataBo implements Serializable {
* 订单基础单量
*/
private int baseOrderNum;
/**
* 当日基础订单量
*/
private long baseTodayOrderNum;
/**
* 当日基础金额
*/
private BigDecimal baseTodayOrderAmount = BigDecimal.ZERO;
/**
* 微信支付占比率
*/
......
......@@ -80,6 +80,10 @@ public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, O
Dictionary largeScreenConstantDictionary = thirdFeign.findDictionaryByTypeAndCode(largeScreenType, largeScreenCode);
if (Objects.nonNull(largeScreenConstantDictionary) && StringUtils.hasText(largeScreenConstantDictionary.getDetail())) {
largeScreenDisplayConstantDataBo = JSON.parseObject(largeScreenConstantDictionary.getDetail(), LargeScreenDisplayConstantDataBo.class);
orderProfileDispayVo.setTodayOrderNum(largeScreenDisplayConstantDataBo.getBaseTodayOrderNum());
orderProfileDispayVo.setTodayOrderAmount(largeScreenDisplayConstantDataBo.getBaseTodayOrderAmount());
orderProfileDispayVo.setOrderAmount(largeScreenDisplayConstantDataBo.getBaseOrderAmount());
orderProfileDispayVo.setOrderNum(largeScreenDisplayConstantDataBo.getBaseOrderNum());
}
//2.1查询订单数据
......@@ -125,12 +129,6 @@ public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, O
log.error("统计出错:【{}】", e);
}
//1.基础金额 + 真实金额 基础订单量+真实订单量
long totalOrderNum = orderProfileDispayVo.getOrderNum() + largeScreenDisplayConstantDataBo.getBaseOrderNum();
BigDecimal totalOrderAmount = orderProfileDispayVo.getOrderAmount().add(largeScreenDisplayConstantDataBo.getBaseOrderAmount());
orderProfileDispayVo.setOrderAmount(totalOrderAmount);
orderProfileDispayVo.setOrderNum(totalOrderNum);
largeScreenDisplayDataVo.setOrderProfileDispayData(orderProfileDispayVo);
return largeScreenDisplayDataVo;
}
......@@ -150,11 +148,15 @@ public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, O
OrderPayProfileDispalyVo orderPayProfileDispalyVo = new OrderPayProfileDispalyVo();
BigDecimal orderAmountConstant = CollectionUtils.isEmpty(orderProfileDisplays) ? BigDecimal.ZERO :
orderProfileDisplays.stream().map(OrderProfileDisplay::getOrderAmount).reduce(BigDecimal.ZERO, BigDecimal::add);
//订单总金额
orderAmountConstant = orderAmountConstant.add(largeScreenDisplayConstantDataBo.getBaseTodayOrderAmount()).add(largeScreenDisplayConstantDataBo.getBaseOrderAmount());
//1.支付方式统计
wrapToPayProfileWithPayWay(baseOrders, orderAmountConstant, largeScreenDisplayConstantDataBo, orderPayProfileDispalyVo);
//2.支付终端统计
wrapToPayProfileWithPayTerminal(baseOrders, orderAmountConstant, largeScreenDisplayConstantDataBo, orderPayProfileDispalyVo);
//累计订单金额
orderProfileDispayVo.setOrderAmount(orderAmountConstant);
orderProfileDispayVo.setOrderPayProfileDisplay(orderPayProfileDispalyVo);
return orderProfileDispayVo;
}
......@@ -245,12 +247,15 @@ public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, O
Map<Date, BigDecimal> orderAmountMap = baseOrderDTOS.stream().collect(Collectors.groupingBy(BaseOrderDTO::getPayDate, CollectorsUtil.summingBigDecimal(BaseOrderDTO::getRealAmount)));
//2.某个时间段的订单统计
//2.1 订单金额
List<OrderProfileVo> orderProfileVos = createOrderProfiles(orderAmountMap);
List<OrderProfileVo> orderProfileVos = createOrderProfiles(orderAmountMap,orderProfileDispayVo.getTodayOrderAmount());
//2.2 订单量
wrapBaseDateToOrderProfileDispay(baseOrders, orderProfileDispayVo);
//3.今日金额
Date date = DateUtil.beginOfDay(new Date()).toJdkDate();
BigDecimal todayOrderAmount = orderAmountMap == null ? BigDecimal.ZERO : orderAmountMap.get(date) == null ? BigDecimal.ZERO : orderAmountMap.get(date);
//3.1真实金额+基础金额
todayOrderAmount = todayOrderAmount.add(orderProfileDispayVo.getTodayOrderAmount());
orderProfileDispayVo.setTodayOrderAmount(todayOrderAmount);
orderProfileDispayVo.setOrderProfiles(orderProfileVos);
return orderProfileDispayVo;
......@@ -271,7 +276,12 @@ public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, O
Date date = DateUtil.beginOfDay(new Date()).toJdkDate();
//今日订单量
long todayOrderNum = orderNumMap.get(date) == null ? 0 : orderNumMap.get(date);
//真实订单量 + 基础订单量
todayOrderNum = todayOrderNum + orderProfileDispayVo.getTodayOrderNum();
//总订单量
long totalOrderNum = orderProfileDispayVo.getOrderNum()+baseOrderDTOS.size()+orderProfileDispayVo.getTodayOrderNum();
orderProfileDispayVo.setTodayOrderNum(todayOrderNum);
orderProfileDispayVo.setOrderNum(totalOrderNum);
return orderProfileDispayVo;
}
......@@ -281,7 +291,7 @@ public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, O
* @param orderAmountMap
* @return
*/
private List<OrderProfileVo> createOrderProfiles(Map<Date, BigDecimal> orderAmountMap) {
private List<OrderProfileVo> createOrderProfiles(Map<Date, BigDecimal> orderAmountMap,BigDecimal baseTodayOrderAmount) {
List<OrderProfileVo> orderProfileVos = new ArrayList<>();
if (orderAmountMap == null || orderAmountMap.isEmpty()) {
return orderProfileVos;
......@@ -289,14 +299,27 @@ public class OrderProfileDisplayBiz extends BaseBiz<OrderProfileDisplayMapper, O
Set<Map.Entry<Date, BigDecimal>> orderAmountEntrySet = orderAmountMap.entrySet();
Iterator<Map.Entry<Date, BigDecimal>> orderAmountIterator = orderAmountEntrySet.iterator();
OrderProfileVo orderProfileVo;
Date date = DateUtil.beginOfDay(new Date()).toJdkDate();
boolean isToday = (orderAmountMap==null||orderAmountMap.isEmpty())?false:Objects.nonNull(orderAmountMap.get(date));
while (orderAmountIterator.hasNext()) {
Map.Entry<Date, BigDecimal> orderAmountMapEntry = orderAmountIterator.next();
orderProfileVo = new OrderProfileVo();
orderProfileVo.setOrderDate(orderAmountMapEntry.getKey());
orderProfileVo.setOrderAmount(orderAmountMapEntry.getValue());
BigDecimal orderAmount = orderAmountMapEntry.getValue();
if (isToday){
orderAmount =orderAmount.add(baseTodayOrderAmount);
}
orderProfileVo.setOrderAmount(orderAmount);
orderProfileVo.setDate(DateUtil.format(orderProfileVo.getOrderDate(),"MM.dd"));
orderProfileVos.add(orderProfileVo);
}
if (!isToday){
OrderProfileVo todayOrderProfileVo = new OrderProfileVo();
todayOrderProfileVo.setOrderDate(date);
todayOrderProfileVo.setOrderAmount(baseTodayOrderAmount);
orderProfileVos.add(todayOrderProfileVo);
}
orderProfileVos.sort(Comparator.comparing(OrderProfileVo::getOrderDate));
return orderProfileVos;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment