|
@@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUtil;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.ruoyi.common.core.domain.BaseIdPo;
|
|
|
import com.ruoyi.common.utils.wrapper.IWrapper;
|
|
|
+import com.sd.business.entity.board.dto.BzSkuSpecSalesSelectDto;
|
|
|
import com.sd.business.entity.board.dto.DailyBoardSelectDto;
|
|
|
import com.sd.business.entity.board.dto.SalesBoardSelectDto;
|
|
|
import com.sd.business.entity.board.vo.*;
|
|
@@ -307,4 +308,37 @@ public class SalesBoardServiceImpl implements SalesBoardService {
|
|
|
|
|
|
return salesBoardVoList;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<BzSkuSpecSalesVo> getBzSkuSpecSalesPage(BzSkuSpecSalesSelectDto dto) {
|
|
|
+ IWrapper<SkuSalesRankingVo> wrapper = IWrapper.getWrapper();
|
|
|
+ wrapper.eq("bc", BomClassify::getParentId, 1);
|
|
|
+ wrapper.eq("oi", OrderInfo::getDepartmentId, DepartmentConstant.BZ);
|
|
|
+ wrapper.eq("oi", OrderInfo::getStatus, OrderStatusEnum.COMPLETION_PRODUCTION.getKey());
|
|
|
+ wrapper.ge("oi", OrderInfo::getShippingTime, DateUtil.beginOfDay(DateUtil.offsetDay(new Date(), -30)));
|
|
|
+ wrapper.groupBy("ss.id");
|
|
|
+ wrapper.orderByDesc("salesQuantity");
|
|
|
+ Page<SkuSalesRankingVo> page = salesBoardMapper.getSkuSalesRankingPage(dto.getPage(), wrapper);
|
|
|
+ List<SkuSalesRankingVo> records = page.getRecords();
|
|
|
+
|
|
|
+ Page<BzSkuSpecSalesVo> result = new Page<>();
|
|
|
+ if (records.isEmpty()) {
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ List<BzSkuSpecSalesVo> salesBoardVoList = records.stream().map(item -> {
|
|
|
+ BzSkuSpecSalesVo vo = new BzSkuSpecSalesVo();
|
|
|
+ vo.setSkuSpecCode(item.getSkuSpecCode());
|
|
|
+ vo.setSkuSpecName(item.getSkuSpecName());
|
|
|
+ vo.setSalesQuantity(item.getSalesQuantity());
|
|
|
+ vo.setDailySales(vo.getSalesQuantity().divide(BigDecimal.valueOf(30), 0, RoundingMode.HALF_UP));
|
|
|
+ return vo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+
|
|
|
+ result.setTotal(page.getTotal());
|
|
|
+ result.setRecords(salesBoardVoList);
|
|
|
+ result.setPages(page.getPages());
|
|
|
+ result.setSize(page.getSize());
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|