Merge remote-tracking branch 'origin/prod' into prod
This commit is contained in:
@@ -3,6 +3,8 @@ package com.czg.service.order.service.impl;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.czg.account.entity.ShopInfo;
|
||||
import com.czg.account.service.ShopInfoService;
|
||||
import com.czg.order.entity.ShopOrderStatistic;
|
||||
import com.czg.order.param.DataSummaryTradeParam;
|
||||
import com.czg.order.service.DataSummaryService;
|
||||
@@ -11,6 +13,7 @@ import com.czg.service.order.mapper.ShopOrderStatisticMapper;
|
||||
import com.mybatisflex.spring.service.impl.ServiceImpl;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.annotation.DubboReference;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -28,6 +31,10 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
||||
@Resource
|
||||
private DataSummaryService dataSummaryService;
|
||||
|
||||
@DubboReference
|
||||
private ShopInfoService shopInfoService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void statistic(DateTime dateTime) {
|
||||
@@ -42,8 +49,10 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
||||
List<List<Long>> split = CollUtil.split(shopIdList, 5);
|
||||
for (List<Long> splitIdList : split) {
|
||||
splitIdList.parallelStream().forEach(shopId -> {
|
||||
Long mainShopId = shopInfoService.getMainIdByShopId(shopId);
|
||||
DataSummaryTradeParam param = new DataSummaryTradeParam();
|
||||
param.setShopId(shopId);
|
||||
param.setMainShopId(mainShopId);
|
||||
param.setBeginDate(startOfDay.toStringDefaultTimeZone());
|
||||
param.setEndDate(endOfDay.toStringDefaultTimeZone());
|
||||
ShopOrderStatistic statistic = dataSummaryService.getRealTimeTradeData(param);
|
||||
@@ -61,7 +70,10 @@ public class ShopOrderStatisticServiceImpl extends ServiceImpl<ShopOrderStatisti
|
||||
) {
|
||||
log.info("店铺:{},{},没有要存档的订单统计数据", shopId, dateTime.toDateStr());
|
||||
} else {
|
||||
ShopOrderStatistic entity = getMapper().selectOneByQuery(query().eq(ShopOrderStatistic::getShopId, shopId).eq(ShopOrderStatistic::getCreateDay, dateTime.toDateStr()));
|
||||
ShopOrderStatistic entity =
|
||||
getMapper()
|
||||
.selectOneByQuery(query().eq("shop_id", shopId)
|
||||
.eq("create_day", dateTime.toDateStr()));
|
||||
if (entity != null) {
|
||||
statistic.setId(entity.getId());
|
||||
updateById(statistic);
|
||||
|
||||
@@ -60,7 +60,10 @@ public class ShopProdStatisticServiceImpl extends ServiceImpl<ShopProdStatisticM
|
||||
param.setBeginDate(startOfDay.toStringDefaultTimeZone());
|
||||
param.setEndDate(endOfDay.toStringDefaultTimeZone());
|
||||
// 删除之前统计数据
|
||||
getMapper().deleteByQuery(QueryWrapper.create().eq(ShopProdStatistic::getShopId, shopId).eq(ShopProdStatistic::getCreateDay, dateTime.toDateStr()));
|
||||
getMapper().deleteByQuery(
|
||||
QueryWrapper.create()
|
||||
.eq("shop_id", shopId)
|
||||
.eq("create_day", dateTime.toDateStr()));
|
||||
// 重新统计数据
|
||||
List<DataSummaryProductSaleRankingVo> list = shopProdStatisticMapper.findProdRandingSummaryPage2(param);
|
||||
for (DataSummaryProductSaleRankingVo dto : list) {
|
||||
|
||||
@@ -86,7 +86,11 @@ public class ShopTableOrderStatisticServiceImpl extends ServiceImpl<ShopTableOrd
|
||||
param.setBeginDate(startOfDay.toStringDefaultTimeZone());
|
||||
param.setEndDate(endOfDay.toStringDefaultTimeZone());
|
||||
// 删除之前统计数据
|
||||
getMapper().deleteByQuery(new QueryWrapper().eq(ShopTableOrderStatistic::getShopId, shopId).eq(ShopTableOrderStatistic::getCreateDay, dateTime.toDateStr()));
|
||||
getMapper()
|
||||
.deleteByQuery(
|
||||
new QueryWrapper()
|
||||
.eq("shop_id", shopId)
|
||||
.eq("create_day", dateTime.toDateStr()));
|
||||
// 重新统计数据
|
||||
List<TableSummaryInfoVo> list = shopTableOrderStatisticMapper.findSummaryList2(param);
|
||||
for (TableSummaryInfoVo dto : list) {
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
group by shop_id
|
||||
</select>
|
||||
<select id="getNewMemberCount" resultType="java.lang.Long">
|
||||
select count(1) from tb_shop_user where shop_id = #{shopId} and is_vip = 1
|
||||
select count(1) from tb_shop_user where main_shop_id = #{mainShopId} and is_vip = 1
|
||||
<if test="beginDate != null and beginDate != ''">
|
||||
and join_time >= str_to_date(#{beginDate}, '%Y-%m-%d %H:%i:%s')
|
||||
</if>
|
||||
|
||||
Reference in New Issue
Block a user