|
@@ -100,21 +100,38 @@ public class WeAppOrderClothController {
|
|
|
.eq(OrderCloth::getTakeClothWay, TakeOrSendClothWay.DELIVERY.getCode())
|
|
|
.or()
|
|
|
.eq(OrderCloth::getSendClothWay, TakeOrSendClothWay.DELIVERY.getCode())
|
|
|
-// .or()
|
|
|
-// .eq(OrderCloth::getOrderStatus,ClothOrderStatusType.HAS_WASH.getCode())
|
|
|
- )
|
|
|
- .and(orderClothLambdaQueryWrapper -> orderClothLambdaQueryWrapper
|
|
|
+ );
|
|
|
+ if (StringUtils.isNotEmpty(weAppOrderClothAppointmentQueryDTO.getOrderStatus())) {
|
|
|
+ //带上门
|
|
|
+ if ("1".equals(weAppOrderClothAppointmentQueryDTO.getOrderStatus())) {
|
|
|
+ queryWrapper.and(orderClothLambdaQueryWrapper -> orderClothLambdaQueryWrapper
|
|
|
.eq(OrderCloth::getOrderStatus, ClothOrderStatusType.APPOINTMENT.getCode())
|
|
|
.or()
|
|
|
.eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_TO_DOOR.getCode())
|
|
|
- .or()
|
|
|
+ );
|
|
|
+ }
|
|
|
+ //已上门
|
|
|
+ if ("2".equals(weAppOrderClothAppointmentQueryDTO.getOrderStatus())) {
|
|
|
+ queryWrapper.and(orderClothLambdaQueryWrapper -> orderClothLambdaQueryWrapper
|
|
|
.eq(OrderCloth::getOrderStatus, ClothOrderStatusType.HAS_TO_DOOR.getCode())
|
|
|
.or()
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.HAS_TAKING.getCode())
|
|
|
+ );
|
|
|
+ }
|
|
|
+ //已上门
|
|
|
+ if ("8".equals(weAppOrderClothAppointmentQueryDTO.getOrderStatus())) {
|
|
|
+ queryWrapper.and(orderClothLambdaQueryWrapper -> orderClothLambdaQueryWrapper
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_FOR_HANG.getCode())
|
|
|
+ );
|
|
|
+ }
|
|
|
+ //已上门
|
|
|
+ if ("9".equals(weAppOrderClothAppointmentQueryDTO.getOrderStatus())) {
|
|
|
+ queryWrapper.and(orderClothLambdaQueryWrapper -> orderClothLambdaQueryWrapper
|
|
|
.eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_TO_SEND.getCode())
|
|
|
.or()
|
|
|
- .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.SENDING.getCode()));
|
|
|
- if (StringUtils.isNotEmpty(weAppOrderClothAppointmentQueryDTO.getOrderStatus())) {
|
|
|
- queryWrapper.eq(OrderCloth::getOrderStatus, weAppOrderClothAppointmentQueryDTO.getOrderStatus());
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.SENDING.getCode())
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|
|
|
queryWrapper.orderByDesc(BaseEntity::getCreateTime);
|
|
|
List<OrderCloth> orderCloths = orderClothService.page(page
|
|
@@ -206,12 +223,17 @@ public class WeAppOrderClothController {
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @param orderClothAppQueryDTO
|
|
|
+ * @return orderStatus 代付款 2、服务中-3、带取衣 6、待送达 8、 已完成 12
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
@ApiOperation("查询洗衣订单列表")
|
|
|
@PostMapping(value = "findPage")
|
|
|
public R<List<OrderClothVO>> findPage(@RequestBody @Valid OrderClothAppQueryDTO orderClothAppQueryDTO) throws Exception {
|
|
|
LambdaQueryWrapper<OrderCloth> queryWrapper = new QueryWrapper<OrderCloth>().lambda()
|
|
|
.eq(OrderCloth::getAppUserId, AuthHolder.userId())
|
|
|
- .ne(OrderCloth::getRefundStatus, OrderRefundStatus.REFUND_SUCCESS.getCode())
|
|
|
.eq(OrderCloth::getDelFlag, DeleteStatus.OK.getCode());
|
|
|
if (orderClothAppQueryDTO.getStartDate() != null) {
|
|
|
queryWrapper.ge(BaseEntity::getCreateTime, orderClothAppQueryDTO.getStartDate());
|
|
@@ -219,43 +241,139 @@ public class WeAppOrderClothController {
|
|
|
if (orderClothAppQueryDTO.getEndDate() != null) {
|
|
|
queryWrapper.lt(BaseEntity::getCreateTime, DateUtils.addDays(orderClothAppQueryDTO.getEndDate(), 1));
|
|
|
}
|
|
|
- if ("0".equals(orderClothAppQueryDTO.getOrderStatus())
|
|
|
- || "1".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
- queryWrapper.eq(OrderCloth::getOrderStatus, ClothOrderStatusType.APPOINTMENT.getCode());
|
|
|
- }
|
|
|
+ //2=待付款,3=服务中,4=待配送,5=配送中,6=待取衣(到店自取),7=待评价,8=已完成,100=已取消
|
|
|
if ("2".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
queryWrapper.and(orderClothLambdaQueryWrapper -> orderClothLambdaQueryWrapper
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.APPOINTMENT.getCode())
|
|
|
+ .or()
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_TO_DOOR.getCode())
|
|
|
+ .or()
|
|
|
.eq(OrderCloth::getOrderStatus, ClothOrderStatusType.HAS_TO_DOOR.getCode())
|
|
|
.or()
|
|
|
- .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.HAS_TAKING.getCode()));
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.HAS_TAKING.getCode())
|
|
|
+ .or()
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_FOR_PAY.getCode())
|
|
|
+ );
|
|
|
}
|
|
|
if ("3".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
queryWrapper.and(orderClothLambdaQueryWrapper -> orderClothLambdaQueryWrapper
|
|
|
- .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_FOR_PAY.getCode())
|
|
|
- .or()
|
|
|
.eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAIT_FACTORY.getCode())
|
|
|
.or()
|
|
|
- .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WASHING.getCode()));
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WASHING.getCode())
|
|
|
+ .or()
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.HAS_WASH.getCode())
|
|
|
+ );
|
|
|
+
|
|
|
}
|
|
|
- if ("4".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
+ if ("6".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
queryWrapper.and(orderClothLambdaQueryWrapper -> orderClothLambdaQueryWrapper
|
|
|
- .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.HAS_WASH.getCode())
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_FOR_HANG.getCode()));
|
|
|
+ }
|
|
|
+ if ("8".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
+ queryWrapper.and(orderClothLambdaQueryWrapper -> orderClothLambdaQueryWrapper
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_TO_SEND.getCode())
|
|
|
.or()
|
|
|
- .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_TO_DOOR.getCode()));
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.SENDING.getCode()));
|
|
|
}
|
|
|
- if ("5".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
- queryWrapper.eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_TO_SEND.getCode());
|
|
|
+ if ("12".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
+ queryWrapper.and(orderClothLambdaQueryWrapper -> orderClothLambdaQueryWrapper
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_FOR_COMMENT.getCode())
|
|
|
+ .or()
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.FINISH.getCode()));
|
|
|
}
|
|
|
- if ("6".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
- queryWrapper.eq(OrderCloth::getOrderStatus, ClothOrderStatusType.HAS_WASH.getCode());
|
|
|
+
|
|
|
+ queryWrapper.orderByDesc(BaseEntity::getCreateTime);
|
|
|
+ List<OrderCloth> orderCloths = orderClothService.page(new Page<>(orderClothAppQueryDTO.getPageNum()
|
|
|
+ , orderClothAppQueryDTO.getPageSize(), false), queryWrapper).getRecords();
|
|
|
+ List<OrderClothVO> orderClothVOS = new ArrayList<>();
|
|
|
+ if (orderCloths.size() == 0) {
|
|
|
+ return R.ok(orderClothVOS);
|
|
|
}
|
|
|
- if ("7".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
- queryWrapper.eq(OrderCloth::getOrderStatus, ClothOrderStatusType.SENDING.getCode());
|
|
|
+
|
|
|
+ Map<Long, AppUser> takeClothUserMap = new HashMap<>();
|
|
|
+ if (orderCloths.stream().filter(orderCloth -> orderCloth.getTakeClothAppUserId() != null)
|
|
|
+ .map(OrderCloth::getAppUserId).collect(Collectors.toSet()).size() > 0) {
|
|
|
+ takeClothUserMap = appUserService.list(new QueryWrapper<AppUser>().lambda()
|
|
|
+ .in(AppUser::getId, orderCloths.stream().filter(orderCloth -> orderCloth.getTakeClothAppUserId() != null)
|
|
|
+ .map(OrderCloth::getAppUserId).collect(Collectors.toSet())))
|
|
|
+ .stream().collect(Collectors.toMap(AppUser::getId, AppUser -> AppUser));
|
|
|
}
|
|
|
+
|
|
|
+ Map<Long, AppUser> sendClothUserMap = new HashMap<>();
|
|
|
+ if (orderCloths.stream().filter(orderCloth -> orderCloth.getSendClothAppUserId() != null)
|
|
|
+ .map(OrderCloth::getAppUserId).collect(Collectors.toSet()).size() > 0) {
|
|
|
+ sendClothUserMap = appUserService.list(new QueryWrapper<AppUser>().lambda()
|
|
|
+ .in(AppUser::getId, orderCloths.stream().filter(orderCloth -> orderCloth.getSendClothAppUserId() != null)
|
|
|
+ .map(OrderCloth::getAppUserId).collect(Collectors.toSet())))
|
|
|
+ .stream().collect(Collectors.toMap(AppUser::getId, AppUser -> AppUser));
|
|
|
+ }
|
|
|
+ Map<Long, SysOrg> storeOrgMap = new HashMap<>();
|
|
|
+ Map<Long, SysOrg> factoryOrgMap = new HashMap<>();
|
|
|
+ if (orderCloths.stream().filter(orderCloth -> SourceType.STORE.getCode()
|
|
|
+ .equals(orderCloth.getSourceType())).collect(Collectors.toList()).size() > 0) {
|
|
|
+ storeOrgMap = sysOrgService.list(new QueryWrapper<SysOrg>().lambda().eq(SysOrg::getSourceType
|
|
|
+ , SourceType.STORE.getCode()).in(SysOrg::getId, orderCloths.stream()
|
|
|
+ .map(OrderCloth::getOrgId).collect(Collectors.toSet()))).stream()
|
|
|
+ .collect(Collectors.toMap(SysOrg::getId, SysOrg -> SysOrg));
|
|
|
+ }
|
|
|
+ if (orderCloths.stream().filter(orderCloth -> SourceType.FACTORY.getCode()
|
|
|
+ .equals(orderCloth.getSourceType())).collect(Collectors.toList()).size() > 0) {
|
|
|
+ factoryOrgMap = sysOrgService.list(new QueryWrapper<SysOrg>().lambda().eq(SysOrg::getSourceType
|
|
|
+ , SourceType.FACTORY.getCode()).in(SysOrg::getId, orderCloths.stream()
|
|
|
+ .map(OrderCloth::getOrgId).collect(Collectors.toSet()))).stream()
|
|
|
+ .collect(Collectors.toMap(SysOrg::getId, SysOrg -> SysOrg));
|
|
|
+ }
|
|
|
+ for (OrderCloth record : orderCloths) {
|
|
|
+ OrderClothVO orderClothVO = new OrderClothVO();
|
|
|
+ BeanUtils.copyProperties(record, orderClothVO);
|
|
|
+ if (record.getTakeClothAppUserId() != null && takeClothUserMap.containsKey(record.getTakeClothAppUserId())) {
|
|
|
+ AppUserVO appUserVO = new AppUserVO();
|
|
|
+ BeanUtils.copyProperties(takeClothUserMap.get(record.getTakeClothAppUserId()), appUserVO);
|
|
|
+ orderClothVO.setTakeClothUserVO(appUserVO);
|
|
|
+ }
|
|
|
+ if (record.getSendClothAppUserId() != null && sendClothUserMap.containsKey(record.getSendClothAppUserId())) {
|
|
|
+ AppUserVO appUserVO = new AppUserVO();
|
|
|
+ BeanUtils.copyProperties(sendClothUserMap.get(record.getSendClothAppUserId()), appUserVO);
|
|
|
+ orderClothVO.setSendClothUserVO(appUserVO);
|
|
|
+ }
|
|
|
+ if (SourceType.STORE.getCode().equals(orderClothVO.getSourceType())) {
|
|
|
+ orderClothVO.setSysOrg(storeOrgMap.get(orderClothVO.getOrgId()));
|
|
|
+ } else if (SourceType.FACTORY.getCode().equals(orderClothVO.getSourceType())) {
|
|
|
+ orderClothVO.setSysOrg(factoryOrgMap.get(orderClothVO.getOrgId()));
|
|
|
+ }
|
|
|
+ orderClothVOS.add(orderClothVO);
|
|
|
+ }
|
|
|
+ return R.ok(orderClothVOS);
|
|
|
+ }
|
|
|
+
|
|
|
+/**
|
|
|
+ * 查询洗好送回订单列表
|
|
|
+ * orderStatus : 8 : 已到店带取衣 9:待送衣 10:送衣中
|
|
|
+ */
|
|
|
+ @ApiOperation("查询洗好送回订单列表")
|
|
|
+ @PostMapping(value = "findSendPage")
|
|
|
+ public R<List<OrderClothVO>> findSendPage(@RequestBody @Valid OrderClothAppQueryDTO orderClothAppQueryDTO) throws Exception {
|
|
|
+ LambdaQueryWrapper<OrderCloth> queryWrapper = new QueryWrapper<OrderCloth>().lambda()
|
|
|
+ .eq(OrderCloth::getAppUserId, AuthHolder.userId())
|
|
|
+ .eq(OrderCloth::getDelFlag, DeleteStatus.OK.getCode());
|
|
|
+ if (orderClothAppQueryDTO.getStartDate() != null) {
|
|
|
+ queryWrapper.ge(BaseEntity::getCreateTime, orderClothAppQueryDTO.getStartDate());
|
|
|
+ }
|
|
|
+ if (orderClothAppQueryDTO.getEndDate() != null) {
|
|
|
+ queryWrapper.lt(BaseEntity::getCreateTime, DateUtils.addDays(orderClothAppQueryDTO.getEndDate(), 1));
|
|
|
+ }
|
|
|
+ //0=待上门,1=已上门、带门店定价,2=待付款,3=服务中,4=待配送,5=配送中,6=待取衣(到店自取),7=待评价,8=已完成,100=已取消
|
|
|
if ("8".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
queryWrapper.and(orderClothLambdaQueryWrapper -> orderClothLambdaQueryWrapper
|
|
|
- .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_FOR_COMMENT.getCode()).or()
|
|
|
- .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.FINISH.getCode()));
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_FOR_HANG.getCode()));
|
|
|
+ }
|
|
|
+ if ("9".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
+ queryWrapper.and(orderClothLambdaQueryWrapper -> orderClothLambdaQueryWrapper
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_TO_SEND.getCode()));
|
|
|
+ }
|
|
|
+ if ("10".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
+ queryWrapper.and(orderClothLambdaQueryWrapper -> orderClothLambdaQueryWrapper
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.SENDING.getCode()));
|
|
|
}
|
|
|
|
|
|
queryWrapper.orderByDesc(BaseEntity::getCreateTime);
|
|
@@ -322,6 +440,7 @@ public class WeAppOrderClothController {
|
|
|
return R.ok(orderClothVOS);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@ApiOperation("查询洗衣订单明细")
|
|
|
@GetMapping(value = "getInfoById")
|
|
|
public R<OrderClothVO> getInfoById(@RequestParam @ApiParam("订单ID") Long orderId) throws Exception {
|