优化管理端首页数据统计
This commit is contained in:
parent
393c246018
commit
83c86ab1da
@ -1,5 +1,7 @@
|
||||
package cn.lili.modules.statistics.service;
|
||||
|
||||
import cn.lili.modules.statistics.model.dto.GoodsStatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.model.dto.StatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.model.vo.*;
|
||||
|
||||
import java.util.List;
|
||||
@ -38,14 +40,14 @@ public interface IndexStatisticsService {
|
||||
*
|
||||
* @return 热卖商品TOP10
|
||||
*/
|
||||
List<GoodsStatisticsDataVO> goodsStatisticsOfMonth();
|
||||
List<GoodsStatisticsDataVO> goodsStatistics(GoodsStatisticsQueryParam statisticsQueryParam);
|
||||
|
||||
/**
|
||||
* 查询热卖店铺TOP10
|
||||
*
|
||||
* @return 当月的热卖店铺TOP10
|
||||
*/
|
||||
List<StoreStatisticsDataVO> storeStatisticsOfMonth();
|
||||
List<StoreStatisticsDataVO> storeStatistics(StatisticsQueryParam statisticsQueryParam);
|
||||
|
||||
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -45,7 +44,7 @@ public class GoodsStatisticsDataServiceImpl extends ServiceImpl<GoodsStatisticsD
|
||||
queryWrapper.groupBy("goods_name");
|
||||
|
||||
queryWrapper.eq(!StringUtils.isEmpty(goodsStatisticsQueryParam.getStoreId()), "store_id", goodsStatisticsQueryParam.getStoreId());
|
||||
//查询前一百条记录
|
||||
//查询前X记录
|
||||
Page page = new Page<GoodsStatisticsDataVO>(1, num);
|
||||
return goodsStatisticsDataMapper.getGoodsStatisticsData(page, queryWrapper);
|
||||
}
|
||||
|
@ -19,9 +19,9 @@ import cn.lili.modules.statistics.mapper.StoreStatisticsDataMapper;
|
||||
import cn.lili.modules.statistics.model.dto.GoodsStatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.model.dto.StatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.model.enums.SearchTypeEnum;
|
||||
import cn.lili.modules.statistics.model.enums.StatisticsQuery;
|
||||
import cn.lili.modules.statistics.model.vo.*;
|
||||
import cn.lili.modules.statistics.service.*;
|
||||
import cn.lili.modules.statistics.util.StatisticsDateUtil;
|
||||
import cn.lili.modules.store.entity.enums.BillStatusEnum;
|
||||
import cn.lili.modules.store.service.BillService;
|
||||
import cn.lili.modules.store.service.StoreService;
|
||||
@ -31,6 +31,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -146,7 +147,7 @@ public class IndexStatisticsServiceImpl implements IndexStatisticsService {
|
||||
//下单统计
|
||||
Map<String, Object> map = orderStatisticsDataService.getOrderStatisticsPrice();
|
||||
//今日下单数
|
||||
indexStatisticsVO.setTodayOrderNum(map.get("num") == null ? 0L : (Long)map.get("num"));
|
||||
indexStatisticsVO.setTodayOrderNum(map.get("num") == null ? 0L : (Long) map.get("num"));
|
||||
//今日下单金额
|
||||
indexStatisticsVO.setTodayOrderPrice(map.get("price") == null ? 0D : (Double) map.get("price"));
|
||||
|
||||
@ -234,20 +235,19 @@ public class IndexStatisticsServiceImpl implements IndexStatisticsService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GoodsStatisticsDataVO> goodsStatisticsOfMonth() {
|
||||
//获取查询参数
|
||||
GoodsStatisticsQueryParam goodsStatisticsQueryParam = getGoodsStatisticsQueryParam();
|
||||
public List<GoodsStatisticsDataVO> goodsStatistics(GoodsStatisticsQueryParam statisticsQueryParam) {
|
||||
//查询商品
|
||||
return goodsStatisticsDataService.getGoodsStatisticsData(goodsStatisticsQueryParam, 10);
|
||||
return goodsStatisticsDataService.getGoodsStatisticsData(statisticsQueryParam, 10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<StoreStatisticsDataVO> storeStatisticsOfMonth() {
|
||||
public List<StoreStatisticsDataVO> storeStatistics(StatisticsQueryParam statisticsQueryParam) {
|
||||
|
||||
QueryWrapper queryWrapper = Wrappers.query();
|
||||
|
||||
queryWrapper.between("create_time", cn.hutool.core.date.DateUtil.beginOfYear(new DateTime()),
|
||||
cn.hutool.core.date.DateUtil.endOfYear(new DateTime()));
|
||||
Date[] dates = StatisticsDateUtil.getDateArray(statisticsQueryParam);
|
||||
Date startTime = dates[0], endTime = dates[1];
|
||||
queryWrapper.between("create_time", startTime, endTime);
|
||||
|
||||
queryWrapper.orderByDesc("price");
|
||||
|
||||
@ -288,7 +288,6 @@ public class IndexStatisticsServiceImpl implements IndexStatisticsService {
|
||||
if (UserContext.getCurrentUser().getRole().equals(UserEnums.STORE)) {
|
||||
goodsStatisticsQueryParam.setStoreId(UserContext.getCurrentUser().getStoreId());
|
||||
}
|
||||
goodsStatisticsQueryParam.setType(StatisticsQuery.PRICE.name());
|
||||
DateTime dateTime = new DateTime();
|
||||
goodsStatisticsQueryParam.setYear(dateTime.year());
|
||||
goodsStatisticsQueryParam.setMonth(dateTime.monthBaseOne());
|
||||
|
@ -2,6 +2,9 @@ package cn.lili.controller.statistics;
|
||||
|
||||
import cn.lili.common.enums.ResultUtil;
|
||||
import cn.lili.common.vo.ResultMessage;
|
||||
import cn.lili.modules.statistics.model.dto.GoodsStatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.model.dto.StatisticsQueryParam;
|
||||
import cn.lili.modules.statistics.model.enums.StatisticsQuery;
|
||||
import cn.lili.modules.statistics.model.vo.GoodsStatisticsDataVO;
|
||||
import cn.lili.modules.statistics.model.vo.IndexNoticeVO;
|
||||
import cn.lili.modules.statistics.model.vo.IndexStatisticsVO;
|
||||
@ -46,14 +49,17 @@ public class IndexStatisticsManagerController {
|
||||
|
||||
@ApiOperation(value = "获取首页查询热卖商品TOP10")
|
||||
@GetMapping("/goodsStatistics")
|
||||
public ResultMessage<List<GoodsStatisticsDataVO>> goodsStatistics() {
|
||||
return ResultUtil.data(indexStatisticsService.goodsStatisticsOfMonth());
|
||||
public ResultMessage<List<GoodsStatisticsDataVO>> goodsStatistics(GoodsStatisticsQueryParam goodsStatisticsQueryParam) {
|
||||
|
||||
//按照金额查询
|
||||
goodsStatisticsQueryParam.setType(StatisticsQuery.PRICE.name());
|
||||
return ResultUtil.data(indexStatisticsService.goodsStatistics(goodsStatisticsQueryParam));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取首页查询热卖店铺TOP10")
|
||||
@GetMapping("/storeStatistics")
|
||||
public ResultMessage<List<StoreStatisticsDataVO>> storeStatistics() {
|
||||
return ResultUtil.data(indexStatisticsService.storeStatisticsOfMonth());
|
||||
public ResultMessage<List<StoreStatisticsDataVO>> storeStatistics(StatisticsQueryParam statisticsQueryParam) {
|
||||
return ResultUtil.data(indexStatisticsService.storeStatistics(statisticsQueryParam));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通知提示信息")
|
||||
|
Loading…
x
Reference in New Issue
Block a user