Commit 712a9911 by 吕明尚

修改数据统计的数据量

parent 5a723c63
...@@ -15,6 +15,7 @@ import share.common.utils.JsonConvertUtil; ...@@ -15,6 +15,7 @@ import share.common.utils.JsonConvertUtil;
import share.system.domain.SOrder; import share.system.domain.SOrder;
import share.system.domain.vo.OrderVo; import share.system.domain.vo.OrderVo;
import share.system.domain.vo.SOrderVo; import share.system.domain.vo.SOrderVo;
import share.system.mapper.SStoreConsumerMapper;
import share.system.request.CreateOrderRequest; import share.system.request.CreateOrderRequest;
import share.system.request.OrderComputedPriceRequest; import share.system.request.OrderComputedPriceRequest;
import share.system.request.OrderRefundRequest; import share.system.request.OrderRefundRequest;
...@@ -43,6 +44,8 @@ public class SOrderController extends BaseController ...@@ -43,6 +44,8 @@ public class SOrderController extends BaseController
private ISOrderService sOrderService; private ISOrderService sOrderService;
@Autowired @Autowired
private RedisUtil redisUtil; private RedisUtil redisUtil;
@Autowired
private SStoreConsumerMapper storeConsumerMapper;
/** /**
* 查询订单列表 * 查询订单列表
...@@ -148,8 +151,10 @@ public class SOrderController extends BaseController ...@@ -148,8 +151,10 @@ public class SOrderController extends BaseController
return R.ok(sOrderService.statistics(request)); return R.ok(sOrderService.statistics(request));
} }
@PostMapping("/statistics/orderList") // @PostMapping("/statistics/orderList")
public R<List<OrderVo>> statisticsOrderList(@RequestBody OrderStatisticsRequest request) { @RequestMapping(value = "/statistics/orderList", method = RequestMethod.GET)
public R<List<OrderVo>> statisticsOrderList(OrderStatisticsRequest request) {
startPage();
return R.ok(sOrderService.statisticsOrderList(request)); return R.ok(sOrderService.statisticsOrderList(request));
} }
......
package share.system.request; package share.system.request;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
@Data @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 //门店id
private Long storeId; private Long storeId;
//开始时间 //开始时间
......
...@@ -3080,18 +3080,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -3080,18 +3080,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Override @Override
public List<OrderVo> statisticsOrderList(OrderStatisticsRequest request) { public List<OrderVo> statisticsOrderList(OrderStatisticsRequest request) {
SConsumer user = FrontTokenComponent.getWxSConsumerEntry(); SConsumer user = FrontTokenComponent.getWxSConsumerEntry();
List<OrderVo> orderVoList = new ArrayList<>();
if (!user.getRoleType().equals(RoleTypeEnum.CLEANER.getCode())) { if (!user.getRoleType().equals(RoleTypeEnum.CLEANER.getCode())) {
throw new RuntimeException("当前用户不是店员"); 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>() List<SOrder> orderList = baseMapper.selectList(new LambdaQueryWrapper<SOrder>()
.eq(SOrder::getStoreId, request.getStoreId()) .eq(SOrder::getStoreId, request.getStoreId())
.eq(SOrder::getIsDelete, YesNoEnum.no.getIndex()) .eq(SOrder::getIsDelete, YesNoEnum.no.getIndex())
...@@ -3100,9 +3091,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme ...@@ -3100,9 +3091,18 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
.le(SOrder::getCreateTime, request.getEndTime()) .le(SOrder::getCreateTime, request.getEndTime())
.orderByDesc(SOrder::getCreateTime) .orderByDesc(SOrder::getCreateTime)
); );
List<OrderVo> orderVoList = new ArrayList<>();
if (CollectionUtil.isEmpty(orderList)) { if (CollectionUtil.isEmpty(orderList)) {
return new ArrayList<>(); 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, 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, 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())); 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