feat(shop): 添加统计功能以获取商店、商品、订单等数据
新增统计功能,用于获取商店数量、商品数量、订单数量、柜子数量、格口数量、已关联格口数量、未管理格口数量、网关数量等数据,并支持获取热门商品和今日最新订单商品信息。
This commit is contained in:
parent
97bf45987f
commit
ca858ba62b
|
@ -5,12 +5,19 @@ import com.agileboot.common.core.base.BaseController;
|
||||||
import com.agileboot.common.core.dto.ResponseDTO;
|
import com.agileboot.common.core.dto.ResponseDTO;
|
||||||
import com.agileboot.common.core.page.PageDTO;
|
import com.agileboot.common.core.page.PageDTO;
|
||||||
import com.agileboot.common.enums.common.BusinessTypeEnum;
|
import com.agileboot.common.enums.common.BusinessTypeEnum;
|
||||||
|
import com.agileboot.domain.cabinet.cell.CabinetCellApplicationService;
|
||||||
|
import com.agileboot.domain.cabinet.smartCabinet.SmartCabinetApplicationService;
|
||||||
import com.agileboot.domain.common.command.BulkOperationCommand;
|
import com.agileboot.domain.common.command.BulkOperationCommand;
|
||||||
|
import com.agileboot.domain.mqtt.MqttService;
|
||||||
|
import com.agileboot.domain.shop.goods.GoodsApplicationService;
|
||||||
|
import com.agileboot.domain.shop.order.OrderApplicationService;
|
||||||
|
import com.agileboot.domain.shop.order.db.TodayLatestOrderGoodsDTO;
|
||||||
import com.agileboot.domain.shop.shop.ShopApplicationService;
|
import com.agileboot.domain.shop.shop.ShopApplicationService;
|
||||||
import com.agileboot.domain.shop.shop.command.AddShopCommand;
|
import com.agileboot.domain.shop.shop.command.AddShopCommand;
|
||||||
import com.agileboot.domain.shop.shop.command.UpdateShopCommand;
|
import com.agileboot.domain.shop.shop.command.UpdateShopCommand;
|
||||||
import com.agileboot.domain.shop.shop.db.ShopEntity;
|
import com.agileboot.domain.shop.shop.db.ShopEntity;
|
||||||
import com.agileboot.domain.shop.shop.dto.ShopDTO;
|
import com.agileboot.domain.shop.shop.dto.ShopDTO;
|
||||||
|
import com.agileboot.domain.shop.shop.dto.StatsDTO;
|
||||||
import com.agileboot.domain.shop.shop.query.SearchShopQuery;
|
import com.agileboot.domain.shop.shop.query.SearchShopQuery;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -33,6 +40,34 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
public class ShopController extends BaseController {
|
public class ShopController extends BaseController {
|
||||||
|
|
||||||
private final ShopApplicationService shopApplicationService;
|
private final ShopApplicationService shopApplicationService;
|
||||||
|
private final GoodsApplicationService goodsApplicationService;
|
||||||
|
private final OrderApplicationService orderApplicationService;
|
||||||
|
private final SmartCabinetApplicationService smartCabinetApplicationService;
|
||||||
|
private final CabinetCellApplicationService cabinetCellApplicationService;
|
||||||
|
private final MqttService mqttService;
|
||||||
|
|
||||||
|
@Operation(summary = "首页数据")
|
||||||
|
@GetMapping("/Stats")
|
||||||
|
public ResponseDTO<StatsDTO> stats() {
|
||||||
|
StatsDTO statsDTO = new StatsDTO();
|
||||||
|
statsDTO.setShopCount(shopApplicationService.countAllRecord());
|
||||||
|
statsDTO.setGoodsCount(goodsApplicationService.countAllRecord());
|
||||||
|
statsDTO.setOrderCount(orderApplicationService.countAllRecord());
|
||||||
|
statsDTO.setCabinetCount(smartCabinetApplicationService.countAllRecord());
|
||||||
|
statsDTO.setCellCount(cabinetCellApplicationService.countAllRecord());
|
||||||
|
statsDTO.setLinkedCellCount(cabinetCellApplicationService.countLinkedRecord());
|
||||||
|
statsDTO.setUnmanagedCellCount(statsDTO.getCellCount() - statsDTO.getLinkedCellCount());
|
||||||
|
statsDTO.setGatewayCount(mqttService.getGatewayCount());
|
||||||
|
statsDTO.setTopGoods(orderApplicationService.selectTopGoodsByOccurrence());
|
||||||
|
List<TodayLatestOrderGoodsDTO> todayLatestOrderGoodsDTOS = orderApplicationService.selectTodayLatestOrderGoods();
|
||||||
|
todayLatestOrderGoodsDTOS.forEach(dto -> {
|
||||||
|
if (dto.getCreateTime() != null) {
|
||||||
|
dto.setCreateTimeStr(cn.hutool.core.date.DateUtil.format(dto.getCreateTime(), "HH:mm:ss"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
statsDTO.setTodayLatestOrderGoods(todayLatestOrderGoodsDTOS);
|
||||||
|
return ResponseDTO.ok(statsDTO);
|
||||||
|
}
|
||||||
|
|
||||||
@Operation(summary = "商店列表")
|
@Operation(summary = "商店列表")
|
||||||
@GetMapping
|
@GetMapping
|
||||||
|
|
|
@ -104,4 +104,12 @@ public class CabinetCellApplicationService {
|
||||||
public void clearGoodsCells(Long cellId) {
|
public void clearGoodsCells(Long cellId) {
|
||||||
cabinetCellService.clearGoodsIdAndFreeCell(cellId);
|
cabinetCellService.clearGoodsIdAndFreeCell(cellId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long countAllRecord() {
|
||||||
|
return cabinetCellService.countAllRecord();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long countLinkedRecord() {
|
||||||
|
return cabinetCellService.countLinkedRecord();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -61,4 +61,9 @@ public interface CabinetCellMapper extends BaseMapper<CabinetCellEntity> {
|
||||||
@Param(Constants.WRAPPER) Wrapper<CabinetCellEntity> queryWrapper
|
@Param(Constants.WRAPPER) Wrapper<CabinetCellEntity> queryWrapper
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@Select("SELECT COUNT(1) FROM cabinet_cell WHERE deleted = 0")
|
||||||
|
Long countAllRecord();
|
||||||
|
|
||||||
|
@Select("SELECT COUNT(1) FROM cabinet_cell WHERE deleted = 0 AND goods_id IS NOT NULL")
|
||||||
|
Long countLinkedRecord();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -30,4 +31,8 @@ public interface CabinetCellService extends IService<CabinetCellEntity> {
|
||||||
void clearGoodsIdAndFreeCell(Long cellId);
|
void clearGoodsIdAndFreeCell(Long cellId);
|
||||||
|
|
||||||
Page<CabinetCellWithOrderCountDTO> getCellListWithOrders(AbstractPageQuery<CabinetCellEntity> query);
|
Page<CabinetCellWithOrderCountDTO> getCellListWithOrders(AbstractPageQuery<CabinetCellEntity> query);
|
||||||
|
|
||||||
|
Long countAllRecord();
|
||||||
|
|
||||||
|
Long countLinkedRecord();
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,4 +46,14 @@ public class CabinetCellServiceImpl extends ServiceImpl<CabinetCellMapper, Cabin
|
||||||
public Page<CabinetCellWithOrderCountDTO> getCellListWithOrders(AbstractPageQuery<CabinetCellEntity> query) {
|
public Page<CabinetCellWithOrderCountDTO> getCellListWithOrders(AbstractPageQuery<CabinetCellEntity> query) {
|
||||||
return baseMapper.getCellListWithOrders(query.toPage(), query.toQueryWrapper());
|
return baseMapper.getCellListWithOrders(query.toPage(), query.toQueryWrapper());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long countAllRecord() {
|
||||||
|
return baseMapper.countAllRecord();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long countLinkedRecord() {
|
||||||
|
return baseMapper.countLinkedRecord();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -218,4 +218,8 @@ public class SmartCabinetApplicationService {
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long countAllRecord() {
|
||||||
|
return smartCabinetService.countAllRecord();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,4 +48,7 @@ public interface SmartCabinetMapper extends BaseMapper<SmartCabinetEntity> {
|
||||||
// 新增根据柜体ID查询的方法
|
// 新增根据柜体ID查询的方法
|
||||||
@Select("SELECT * FROM smart_cabinet WHERE cabinet_id = #{cabinetId} LIMIT 1")
|
@Select("SELECT * FROM smart_cabinet WHERE cabinet_id = #{cabinetId} LIMIT 1")
|
||||||
SmartCabinetEntity selectByCabinetId(Long cabinetId);
|
SmartCabinetEntity selectByCabinetId(Long cabinetId);
|
||||||
|
|
||||||
|
@Select("SELECT COUNT(1) FROM smart_cabinet WHERE deleted = 0")
|
||||||
|
Long countAllRecord();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,4 +23,5 @@ public interface SmartCabinetService extends IService<SmartCabinetEntity> {
|
||||||
|
|
||||||
SmartCabinetEntity getByCabinetId(Long cabinetId);
|
SmartCabinetEntity getByCabinetId(Long cabinetId);
|
||||||
|
|
||||||
|
Long countAllRecord();
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,4 +40,9 @@ public class SmartCabinetServiceImpl extends ServiceImpl<SmartCabinetMapper, Sma
|
||||||
return baseMapper.selectByCabinetId(cabinetId);
|
return baseMapper.selectByCabinetId(cabinetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long countAllRecord() {
|
||||||
|
return baseMapper.countAllRecord();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,6 +135,10 @@ public class MqttService implements MqttCallback {
|
||||||
@Override
|
@Override
|
||||||
public void deliveryComplete(IMqttDeliveryToken token) {}
|
public void deliveryComplete(IMqttDeliveryToken token) {}
|
||||||
|
|
||||||
|
public Long getGatewayCount() {
|
||||||
|
return (long) clientConfigs.size();
|
||||||
|
}
|
||||||
|
|
||||||
/******************************************************
|
/******************************************************
|
||||||
*函数名称: lockCmd
|
*函数名称: lockCmd
|
||||||
*输 入: 指令,地址码,通道号,指令参数
|
*输 入: 指令,地址码,通道号,指令参数
|
||||||
|
|
|
@ -69,4 +69,8 @@ public class GoodsApplicationService {
|
||||||
public ShopGoodsDTO getGoodsInfo(Long goodsId) {
|
public ShopGoodsDTO getGoodsInfo(Long goodsId) {
|
||||||
return new ShopGoodsDTO(shopGoodsService.getGoodsInfo(goodsId));
|
return new ShopGoodsDTO(shopGoodsService.getGoodsInfo(goodsId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long countAllRecord() {
|
||||||
|
return shopGoodsService.countAllRecord();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,4 +91,7 @@ public interface ShopGoodsMapper extends BaseMapper<ShopGoodsEntity> {
|
||||||
"LEFT JOIN smart_cabinet sc ON cc.cabinet_id = sc.cabinet_id AND sc.deleted = 0 " +
|
"LEFT JOIN smart_cabinet sc ON cc.cabinet_id = sc.cabinet_id AND sc.deleted = 0 " +
|
||||||
"WHERE g.goods_id = #{goodsId} ")
|
"WHERE g.goods_id = #{goodsId} ")
|
||||||
SearchGoodsDO getGoodsInfo(@Param("goodsId") Long goodsId);
|
SearchGoodsDO getGoodsInfo(@Param("goodsId") Long goodsId);
|
||||||
|
|
||||||
|
@Select("SELECT COUNT(1) FROM shop_goods WHERE deleted = 0")
|
||||||
|
Long countAllRecord();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,4 +22,6 @@ public interface ShopGoodsService extends IService<ShopGoodsEntity> {
|
||||||
List<SearchGoodsWithCabinetDO> getGoodsWithCabinetList(Long shopId);
|
List<SearchGoodsWithCabinetDO> getGoodsWithCabinetList(Long shopId);
|
||||||
|
|
||||||
SearchGoodsDO getGoodsInfo(Long goodsId);
|
SearchGoodsDO getGoodsInfo(Long goodsId);
|
||||||
|
|
||||||
|
Long countAllRecord();
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,4 +45,9 @@ public class ShopGoodsServiceImpl extends ServiceImpl<ShopGoodsMapper, ShopGoods
|
||||||
public SearchGoodsDO getGoodsInfo(Long goodsId) {
|
public SearchGoodsDO getGoodsInfo(Long goodsId) {
|
||||||
return baseMapper.getGoodsInfo(goodsId);
|
return baseMapper.getGoodsInfo(goodsId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long countAllRecord() {
|
||||||
|
return baseMapper.countAllRecord();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,14 +25,12 @@ import com.agileboot.domain.qywx.user.model.QyUserModelFactory;
|
||||||
import com.agileboot.domain.shop.goods.db.ShopGoodsEntity;
|
import com.agileboot.domain.shop.goods.db.ShopGoodsEntity;
|
||||||
import com.agileboot.domain.shop.goods.db.ShopGoodsService;
|
import com.agileboot.domain.shop.goods.db.ShopGoodsService;
|
||||||
import com.agileboot.domain.shop.order.command.SubmitOrderCommand;
|
import com.agileboot.domain.shop.order.command.SubmitOrderCommand;
|
||||||
import com.agileboot.domain.shop.order.db.ShopOrderEntity;
|
import com.agileboot.domain.shop.order.db.*;
|
||||||
import com.agileboot.domain.shop.order.db.ShopOrderService;
|
|
||||||
import com.agileboot.domain.shop.order.db.ShopOrderGoodsEntity;
|
|
||||||
import com.agileboot.domain.shop.order.db.ShopOrderGoodsService;
|
|
||||||
import com.agileboot.domain.shop.order.db.dto.OrderWithGoodsDTO;
|
import com.agileboot.domain.shop.order.db.dto.OrderWithGoodsDTO;
|
||||||
import com.agileboot.domain.shop.order.dto.CreateOrderResult;
|
import com.agileboot.domain.shop.order.dto.CreateOrderResult;
|
||||||
import com.agileboot.domain.shop.order.dto.GetOrdersByOpenIdDTO;
|
import com.agileboot.domain.shop.order.dto.GetOrdersByOpenIdDTO;
|
||||||
import com.agileboot.domain.shop.order.dto.ShopOrderDTO;
|
import com.agileboot.domain.shop.order.dto.ShopOrderDTO;
|
||||||
|
import com.agileboot.domain.shop.order.dto.TopGoodsDTO;
|
||||||
import com.agileboot.domain.shop.order.model.OrderModel;
|
import com.agileboot.domain.shop.order.model.OrderModel;
|
||||||
import com.agileboot.domain.shop.order.model.OrderModelFactory;
|
import com.agileboot.domain.shop.order.model.OrderModelFactory;
|
||||||
import com.agileboot.domain.shop.order.model.OrderGoodsModel;
|
import com.agileboot.domain.shop.order.model.OrderGoodsModel;
|
||||||
|
@ -339,4 +337,16 @@ public class OrderApplicationService {
|
||||||
public OrderModel loadById(Long orderId) {
|
public OrderModel loadById(Long orderId) {
|
||||||
return orderModelFactory.loadById(orderId);
|
return orderModelFactory.loadById(orderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long countAllRecord() {
|
||||||
|
return orderService.countAllRecord();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TopGoodsDTO> selectTopGoodsByOccurrence(){
|
||||||
|
return orderGoodsService.selectTopGoodsByOccurrence();
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<TodayLatestOrderGoodsDTO> selectTodayLatestOrderGoods(){
|
||||||
|
return orderGoodsService.selectTodayLatestOrderGoods();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,6 @@
|
||||||
package com.agileboot.domain.shop.order.db;
|
package com.agileboot.domain.shop.order.db;
|
||||||
|
|
||||||
|
import com.agileboot.domain.shop.order.dto.TopGoodsDTO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import org.apache.ibatis.annotations.Select;
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
@ -22,4 +23,22 @@ public interface ShopOrderGoodsMapper extends BaseMapper<ShopOrderGoodsEntity> {
|
||||||
|
|
||||||
@Select("SELECT * FROM shop_order_goods WHERE order_id = #{orderId} AND deleted = 0")
|
@Select("SELECT * FROM shop_order_goods WHERE order_id = #{orderId} AND deleted = 0")
|
||||||
List<ShopOrderGoodsEntity> selectByOrderId(@Param("orderId") Long orderId);
|
List<ShopOrderGoodsEntity> selectByOrderId(@Param("orderId") Long orderId);
|
||||||
|
|
||||||
|
@Select("SELECT sog.goods_id, sg.goods_name, sg.cover_img, COUNT(*) AS occurrence_count " +
|
||||||
|
"FROM shop_order_goods sog " +
|
||||||
|
"JOIN shop_goods sg ON sog.goods_id = sg.goods_id " +
|
||||||
|
"WHERE sog.deleted = 0 AND sg.deleted = 0 AND sog.goods_id != 6 " +
|
||||||
|
"GROUP BY sog.goods_id, sg.goods_name, sg.cover_img " +
|
||||||
|
"ORDER BY occurrence_count DESC " +
|
||||||
|
"LIMIT 10")
|
||||||
|
List<TopGoodsDTO> selectTopGoodsByOccurrence();
|
||||||
|
|
||||||
|
@Select("SELECT sog.*, so.name AS buyer_name " +
|
||||||
|
"FROM shop_order_goods sog " +
|
||||||
|
"JOIN shop_order so ON sog.order_id = so.order_id " +
|
||||||
|
"WHERE sog.deleted = 0 AND so.deleted = 0 " +
|
||||||
|
"AND DATE(sog.create_time) = CURRENT_DATE " +
|
||||||
|
"ORDER BY sog.create_time DESC " +
|
||||||
|
"LIMIT 10")
|
||||||
|
List<TodayLatestOrderGoodsDTO> selectTodayLatestOrderGoods();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.agileboot.domain.shop.order.db;
|
package com.agileboot.domain.shop.order.db;
|
||||||
|
|
||||||
|
import com.agileboot.domain.shop.order.dto.TopGoodsDTO;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -16,4 +18,8 @@ public interface ShopOrderGoodsService extends IService<ShopOrderGoodsEntity> {
|
||||||
ShopOrderGoodsEntity getByOrderIdAndGoodsId(Long orderId, Long goodsId);
|
ShopOrderGoodsEntity getByOrderIdAndGoodsId(Long orderId, Long goodsId);
|
||||||
|
|
||||||
List<ShopOrderGoodsEntity> selectByOrderId(Long orderId);
|
List<ShopOrderGoodsEntity> selectByOrderId(Long orderId);
|
||||||
|
|
||||||
|
List<TopGoodsDTO> selectTopGoodsByOccurrence();
|
||||||
|
|
||||||
|
List<TodayLatestOrderGoodsDTO> selectTodayLatestOrderGoods();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.agileboot.domain.shop.order.db;
|
package com.agileboot.domain.shop.order.db;
|
||||||
|
|
||||||
|
import com.agileboot.domain.shop.order.dto.TopGoodsDTO;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -26,4 +27,14 @@ public class ShopOrderGoodsServiceImpl extends ServiceImpl<ShopOrderGoodsMapper,
|
||||||
return baseMapper.selectByOrderId(orderId);
|
return baseMapper.selectByOrderId(orderId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TopGoodsDTO> selectTopGoodsByOccurrence() {
|
||||||
|
return baseMapper.selectTopGoodsByOccurrence();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<TodayLatestOrderGoodsDTO> selectTodayLatestOrderGoods() {
|
||||||
|
return baseMapper.selectTodayLatestOrderGoods();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,4 +29,7 @@ public interface ShopOrderMapper extends BaseMapper<ShopOrderEntity> {
|
||||||
Page<OrderWithGoodsDTO> page,
|
Page<OrderWithGoodsDTO> page,
|
||||||
@Param(Constants.WRAPPER) Wrapper<OrderWithGoodsDTO> queryWrapper
|
@Param(Constants.WRAPPER) Wrapper<OrderWithGoodsDTO> queryWrapper
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@Select("SELECT COUNT(1) FROM shop_order WHERE deleted = 0")
|
||||||
|
Long countAllRecord();
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,4 +16,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
*/
|
*/
|
||||||
public interface ShopOrderService extends IService<ShopOrderEntity> {
|
public interface ShopOrderService extends IService<ShopOrderEntity> {
|
||||||
Page<OrderWithGoodsDTO> getOrderList(SearchShopOrderQuery<OrderWithGoodsDTO> query);
|
Page<OrderWithGoodsDTO> getOrderList(SearchShopOrderQuery<OrderWithGoodsDTO> query);
|
||||||
|
Long countAllRecord();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,4 +23,9 @@ public class ShopOrderServiceImpl extends ServiceImpl<ShopOrderMapper, ShopOrder
|
||||||
public Page<OrderWithGoodsDTO> getOrderList(SearchShopOrderQuery<OrderWithGoodsDTO> query) {
|
public Page<OrderWithGoodsDTO> getOrderList(SearchShopOrderQuery<OrderWithGoodsDTO> query) {
|
||||||
return baseMapper.getOrderList(query.toPage(), query.toQueryWrapper());
|
return baseMapper.getOrderList(query.toPage(), query.toQueryWrapper());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long countAllRecord() {
|
||||||
|
return baseMapper.countAllRecord();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
package com.agileboot.domain.shop.order.db;
|
||||||
|
|
||||||
|
import com.agileboot.common.core.base.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 今日最新订单商品DTO
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author valarchie
|
||||||
|
* @since 2025-03-10
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@ApiModel(value = "TodayLatestOrderGoodsDTO对象", description = "今日最新订单商品DTO")
|
||||||
|
public class TodayLatestOrderGoodsDTO extends BaseEntity<TodayLatestOrderGoodsDTO> {
|
||||||
|
|
||||||
|
@ApiModelProperty("订单商品唯一ID")
|
||||||
|
private Long orderGoodsId;
|
||||||
|
|
||||||
|
@ApiModelProperty("关联订单ID")
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
@ApiModelProperty("关联商品ID")
|
||||||
|
private Long goodsId;
|
||||||
|
|
||||||
|
@ApiModelProperty("关联格口ID")
|
||||||
|
private Long cellId;
|
||||||
|
|
||||||
|
@ApiModelProperty("购买数量")
|
||||||
|
private Integer quantity;
|
||||||
|
|
||||||
|
@ApiModelProperty("购买时单价")
|
||||||
|
private BigDecimal price;
|
||||||
|
|
||||||
|
@ApiModelProperty("商品总金额")
|
||||||
|
private BigDecimal totalAmount;
|
||||||
|
|
||||||
|
@ApiModelProperty("商品名称")
|
||||||
|
private String goodsName;
|
||||||
|
|
||||||
|
@ApiModelProperty("封面图URL")
|
||||||
|
private String coverImg;
|
||||||
|
|
||||||
|
@ApiModelProperty("商品状态(1正常 2已退货 3已换货 4已完成 5审核中 6退货未通过)")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty("买家姓名")
|
||||||
|
private String buyerName;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("创建时间")
|
||||||
|
private String createTimeStr;
|
||||||
|
}
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.agileboot.domain.shop.order.dto;
|
||||||
|
|
||||||
|
import com.agileboot.common.annotation.ExcelColumn;
|
||||||
|
import com.agileboot.common.annotation.ExcelSheet;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@ExcelSheet(name = "热门商品统计")
|
||||||
|
@Data
|
||||||
|
public class TopGoodsDTO {
|
||||||
|
|
||||||
|
@ExcelColumn(name = "商品ID")
|
||||||
|
private Long goodsId;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "商品名称")
|
||||||
|
private String goodsName;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "封面图片")
|
||||||
|
private String coverImg;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "出现次数")
|
||||||
|
private Integer occurrenceCount;
|
||||||
|
}
|
|
@ -50,4 +50,8 @@ public class ShopApplicationService {
|
||||||
model.deleteById();
|
model.deleteById();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long countAllRecord() {
|
||||||
|
return shopService.countAllRecord();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -40,4 +40,7 @@ public interface ShopMapper extends BaseMapper<ShopEntity> {
|
||||||
|
|
||||||
@Select("SELECT * FROM shop WHERE shop_name = #{shopName} LIMIT 1")
|
@Select("SELECT * FROM shop WHERE shop_name = #{shopName} LIMIT 1")
|
||||||
ShopEntity selectByShopName(String shopName);
|
ShopEntity selectByShopName(String shopName);
|
||||||
|
|
||||||
|
@Select("SELECT COUNT(1) FROM shop WHERE deleted = 0")
|
||||||
|
Long countAllRecord();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,4 +25,6 @@ public interface ShopService extends IService<ShopEntity> {
|
||||||
ShopEntity selectByShopId(Long shopId);
|
ShopEntity selectByShopId(Long shopId);
|
||||||
|
|
||||||
ShopEntity selectByShopName(String shopName);
|
ShopEntity selectByShopName(String shopName);
|
||||||
|
|
||||||
|
Long countAllRecord();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,4 +42,9 @@ public class ShopServiceImpl extends ServiceImpl<ShopMapper, ShopEntity> impleme
|
||||||
public ShopEntity selectByShopName(String shopName) {
|
public ShopEntity selectByShopName(String shopName) {
|
||||||
return baseMapper.selectByShopName(shopName);
|
return baseMapper.selectByShopName(shopName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long countAllRecord() {
|
||||||
|
return baseMapper.countAllRecord();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,42 @@
|
||||||
|
package com.agileboot.domain.shop.shop.dto;
|
||||||
|
|
||||||
|
import com.agileboot.common.annotation.ExcelColumn;
|
||||||
|
import com.agileboot.common.annotation.ExcelSheet;
|
||||||
|
import com.agileboot.domain.shop.order.db.TodayLatestOrderGoodsDTO;
|
||||||
|
import com.agileboot.domain.shop.order.dto.TopGoodsDTO;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@ExcelSheet(name = "统计数据")
|
||||||
|
@Data
|
||||||
|
public class StatsDTO {
|
||||||
|
|
||||||
|
@ExcelColumn(name = "商店数量")
|
||||||
|
private Long shopCount;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "商品数量")
|
||||||
|
private Long goodsCount;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "订单数量")
|
||||||
|
private Long orderCount;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "总柜子数量")
|
||||||
|
private Long cabinetCount;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "总格口数量")
|
||||||
|
private Long cellCount;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "已关联格口数量")
|
||||||
|
private Long linkedCellCount;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "未管理格口数量")
|
||||||
|
private Long unmanagedCellCount;
|
||||||
|
|
||||||
|
@ExcelColumn(name = "网关数量")
|
||||||
|
private Long gatewayCount;
|
||||||
|
|
||||||
|
private List<TopGoodsDTO> topGoods;
|
||||||
|
|
||||||
|
private List<TodayLatestOrderGoodsDTO> todayLatestOrderGoods;
|
||||||
|
}
|
Loading…
Reference in New Issue