Commit fc09c6ab by 吕明尚

修改数据统计的数据量

parent 5afe235b
......@@ -15,6 +15,7 @@ import share.common.utils.JsonConvertUtil;
import share.system.domain.SOrder;
import share.system.domain.vo.OrderVo;
import share.system.domain.vo.SOrderVo;
import share.system.mapper.SStoreConsumerMapper;
import share.system.request.CreateOrderRequest;
import share.system.request.OrderComputedPriceRequest;
import share.system.request.OrderRefundRequest;
......@@ -43,6 +44,8 @@ public class SOrderController extends BaseController
private ISOrderService sOrderService;
@Autowired
private RedisUtil redisUtil;
@Autowired
private SStoreConsumerMapper storeConsumerMapper;
/**
* 查询订单列表
......@@ -148,8 +151,9 @@ public class SOrderController extends BaseController
return R.ok(sOrderService.statistics(request));
}
@PostMapping("/statistics/orderList")
public R<List<OrderVo>> statisticsOrderList(@RequestBody OrderStatisticsRequest request) {
// @PostMapping("/statistics/orderList")
@RequestMapping(value = "/statistics/orderList", method = RequestMethod.GET)
public R<List<OrderVo>> statisticsOrderList(OrderStatisticsRequest request) {
startPage();
return R.ok(sOrderService.statisticsOrderList(request));
}
......
package share.system.request;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
@Data
public class OrderStatisticsRequest {
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "OrderStatisticsRequest对象", description = "门店数据查询请求对象")
public class OrderStatisticsRequest implements Serializable {
private static final long serialVersionUID = 1L;
//门店id
private Long storeId;
//开始时间
......
......@@ -3080,18 +3080,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Override
public List<OrderVo> statisticsOrderList(OrderStatisticsRequest request) {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
List<OrderVo> orderVoList = new ArrayList<>();
if (!user.getRoleType().equals(RoleTypeEnum.CLEANER.getCode())) {
throw new RuntimeException("当前用户不是店员");
}
List<Long> longs = storeConsumerMapper.selectByConsumerId(user.getId(), PositionEnum.MANAGE.getCode());
if (CollectionUtils.isEmpty(longs)) {
throw new RuntimeException("当前用户不是门店管理人员");
}
//判断longs是否包含request.getStoreId()
if (!longs.contains(request.getStoreId())) {
throw new RuntimeException("当前用户不是该门店管理人员");
}
List<SOrder> orderList = baseMapper.selectList(new LambdaQueryWrapper<SOrder>()
.eq(SOrder::getStoreId, request.getStoreId())
.eq(SOrder::getIsDelete, YesNoEnum.no.getIndex())
......@@ -3100,9 +3091,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
.le(SOrder::getCreateTime, request.getEndTime())
.orderByDesc(SOrder::getCreateTime)
);
List<OrderVo> orderVoList = new ArrayList<>();
if (CollectionUtil.isEmpty(orderList)) {
return new ArrayList<>();
}
List<Long> longs = storeConsumerMapper.selectByConsumerId(user.getId(), PositionEnum.MANAGE.getCode());
if (CollectionUtils.isEmpty(longs)) {
throw new RuntimeException("当前用户不是门店管理人员");
}
//判断longs是否包含request.getStoreId()
if (!longs.contains(request.getStoreId())) {
throw new RuntimeException("当前用户不是该门店管理人员");
}
Map<Long, SCoupon> sCouponMap = sCouponService.list().stream().collect(Collectors.toMap(SCoupon::getId, Function.identity()));
Map<Long, SStore> sStoreMap = storeService.list().stream().collect(Collectors.toMap(SStore::getId, Function.identity()));
Map<Long, SRoom> sRoomMap = roomService.list().stream().collect(Collectors.toMap(SRoom::getId, Function.identity()));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment