合并问题
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
package com.czg.service.order.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.czg.exception.CzgException;
|
||||
import com.czg.order.entity.ShopOrderStatistic;
|
||||
import com.czg.order.service.ShopOrderStatisticService;
|
||||
@@ -100,25 +103,29 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
||||
ShopOrderStatistic result = new ShopOrderStatistic();
|
||||
|
||||
ShopOrderStatistic onlineStat = mapper.getOnlineStatSingleDate(shopId, day);
|
||||
log.info("onlineStat:{}", onlineStat);
|
||||
log.info("onlineStat:{}", JSONObject.toJSONString(onlineStat));
|
||||
ShopOrderStatistic orderStat = mapper.getOrderStatSingleDate(shopId, day);
|
||||
log.info("orderStat:{}", orderStat);
|
||||
log.info("orderStat:{}", JSONObject.toJSONString(orderStat));
|
||||
ShopOrderStatistic userFlowStat = mapper.getShopUserFlowStatSingleDate(shopId, day);
|
||||
log.info("userFlowStat:{}", userFlowStat);
|
||||
log.info("userFlowStat:{}", JSONObject.toJSONString(userFlowStat));
|
||||
Long discountCount = mapper.countDiscountOrder(shopId, day);
|
||||
BigDecimal discountAmount = mapper.countDiscountAmount(shopId, day);
|
||||
Long tableCount = mapper.countShopTable(shopId);
|
||||
Long newMemberCount = mapper.countNewMember(shopId, day);
|
||||
BigDecimal productCostAmount = mapper.countProductCostAmount(shopId, day);
|
||||
// 合并结果
|
||||
CopyOptions copyOptions = CopyOptions.create().setIgnoreNullValue(true);
|
||||
if (onlineStat != null) {
|
||||
BeanUtils.copyProperties(onlineStat, result);
|
||||
BeanUtil.copyProperties(onlineStat, result, copyOptions);
|
||||
log.info("合并onlineStat后 result:{}", JSONObject.toJSONString(result));
|
||||
}
|
||||
if (orderStat != null) {
|
||||
BeanUtils.copyProperties(orderStat, result);
|
||||
BeanUtil.copyProperties(orderStat, result, copyOptions);
|
||||
log.info("合并orderStat后 result:{}", JSONObject.toJSONString(result));
|
||||
}
|
||||
if (userFlowStat != null) {
|
||||
BeanUtils.copyProperties(userFlowStat, result);
|
||||
BeanUtil.copyProperties(userFlowStat, result, copyOptions);
|
||||
log.info("合并userFlowStat后 result:{}", JSONObject.toJSONString(result));
|
||||
}
|
||||
|
||||
result.setShopId(shopId);
|
||||
|
||||
Reference in New Issue
Block a user