Commit 8b40cf68 authored by jiaorz's avatar jiaorz

Merge remote-tracking branch 'origin/dev' into dev

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