|
@@ -85,72 +85,72 @@ public class WeAppOrderClothController {
|
|
|
@ApiOperation("获取预约洗送列表")
|
|
|
@PostMapping(value = "findAppointmentPage")
|
|
|
public R<List<WeAppOrderClothAppointmentVO>> findAppointmentPage(@RequestBody @Valid WeAppOrderClothAppointmentQueryDTO weAppOrderClothAppointmentQueryDTO)
|
|
|
- throws Exception{
|
|
|
- Page<OrderCloth> page = new Page<>(weAppOrderClothAppointmentQueryDTO.getPageNum(),weAppOrderClothAppointmentQueryDTO.getPageSize());
|
|
|
+ throws Exception {
|
|
|
+ Page<OrderCloth> page = new Page<>(weAppOrderClothAppointmentQueryDTO.getPageNum(), weAppOrderClothAppointmentQueryDTO.getPageSize());
|
|
|
page.setSearchCount(false);
|
|
|
|
|
|
LambdaQueryWrapper<OrderCloth> queryWrapper = new QueryWrapper<OrderCloth>().lambda()
|
|
|
- .eq(OrderCloth::getAppUserId,AuthHolder.userId())
|
|
|
- .eq(OrderCloth::getRefundStatus,OrderRefundStatus.OK.getCode())
|
|
|
+ .eq(OrderCloth::getAppUserId, AuthHolder.userId())
|
|
|
+ .eq(OrderCloth::getRefundStatus, OrderRefundStatus.OK.getCode())
|
|
|
.and(orderClothLambdaQueryWrapper -> orderClothLambdaQueryWrapper
|
|
|
- .eq(OrderCloth::getTakeClothWay,TakeOrSendClothWay.DELIVERY.getCode())
|
|
|
- .or()
|
|
|
- .eq(OrderCloth::getSendClothWay,TakeOrSendClothWay.DELIVERY.getCode())
|
|
|
+ .eq(OrderCloth::getTakeClothWay, TakeOrSendClothWay.DELIVERY.getCode())
|
|
|
+ .or()
|
|
|
+ .eq(OrderCloth::getSendClothWay, TakeOrSendClothWay.DELIVERY.getCode())
|
|
|
// .or()
|
|
|
// .eq(OrderCloth::getOrderStatus,ClothOrderStatusType.HAS_WASH.getCode())
|
|
|
)
|
|
|
.and(orderClothLambdaQueryWrapper -> orderClothLambdaQueryWrapper
|
|
|
- .eq(OrderCloth::getOrderStatus,ClothOrderStatusType.APPOINTMENT.getCode())
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.APPOINTMENT.getCode())
|
|
|
.or()
|
|
|
- .eq(OrderCloth::getOrderStatus,ClothOrderStatusType.WAITING_TO_DOOR.getCode())
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_TO_DOOR.getCode())
|
|
|
.or()
|
|
|
- .eq(OrderCloth::getOrderStatus,ClothOrderStatusType.HAS_TO_DOOR.getCode())
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.HAS_TO_DOOR.getCode())
|
|
|
.or()
|
|
|
- .eq(OrderCloth::getOrderStatus,ClothOrderStatusType.WAITING_TO_SEND.getCode())
|
|
|
+ .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()));
|
|
|
+ if (StringUtils.isNotEmpty(weAppOrderClothAppointmentQueryDTO.getOrderStatus())) {
|
|
|
+ queryWrapper.eq(OrderCloth::getOrderStatus, weAppOrderClothAppointmentQueryDTO.getOrderStatus());
|
|
|
}
|
|
|
queryWrapper.orderByDesc(BaseEntity::getCreateTime);
|
|
|
List<OrderCloth> orderCloths = orderClothService.page(page
|
|
|
- ,queryWrapper).getRecords();
|
|
|
- if(orderCloths.size() == 0){
|
|
|
+ , queryWrapper).getRecords();
|
|
|
+ if (orderCloths.size() == 0) {
|
|
|
return R.ok(new ArrayList<>());
|
|
|
}
|
|
|
|
|
|
List<OrderDelivery> list = orderDeliveryService.list(new QueryWrapper<OrderDelivery>().lambda()
|
|
|
.in(OrderDelivery::getOrderSn
|
|
|
- ,orderCloths.stream().map(OrderCloth::getOrderNo).collect(Collectors.toSet())));
|
|
|
- Map<String,OrderDelivery> collectAddressMap = list.stream().filter(orderDelivery -> ClothOrderDeliveryType.collectCloth.getCode()
|
|
|
- .equals(orderDelivery.getClothOrderType()))
|
|
|
- .collect(Collectors.toMap(OrderDelivery::getOrderSn,OrderDelivery -> OrderDelivery));
|
|
|
- Map<String,OrderDelivery> takeAddressMap = list.stream().filter(orderDelivery -> ClothOrderDeliveryType.takeCloth.getCode()
|
|
|
- .equals(orderDelivery.getClothOrderType()))
|
|
|
- .collect(Collectors.toMap(OrderDelivery::getOrderSn,OrderDelivery -> OrderDelivery));
|
|
|
- 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){
|
|
|
+ , orderCloths.stream().map(OrderCloth::getOrderNo).collect(Collectors.toSet())));
|
|
|
+ Map<String, OrderDelivery> collectAddressMap = list.stream().filter(orderDelivery -> ClothOrderDeliveryType.collectCloth.getCode()
|
|
|
+ .equals(orderDelivery.getClothOrderType()))
|
|
|
+ .collect(Collectors.toMap(OrderDelivery::getOrderSn, OrderDelivery -> OrderDelivery));
|
|
|
+ Map<String, OrderDelivery> takeAddressMap = list.stream().filter(orderDelivery -> ClothOrderDeliveryType.takeCloth.getCode()
|
|
|
+ .equals(orderDelivery.getClothOrderType()))
|
|
|
+ .collect(Collectors.toMap(OrderDelivery::getOrderSn, OrderDelivery -> OrderDelivery));
|
|
|
+ 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().in(SysOrg::getId
|
|
|
- ,orderCloths.stream().filter(orderCloth -> SourceType.STORE.getCode().equals(orderCloth.getSourceType())).map(OrderCloth::getOrgId).collect(Collectors.toSet()))
|
|
|
- .eq(SysOrg::getSourceType,SourceType.STORE.getCode())).stream().collect(Collectors.toMap(SysOrg::getId,SysOrg -> SysOrg));
|
|
|
+ , orderCloths.stream().filter(orderCloth -> SourceType.STORE.getCode().equals(orderCloth.getSourceType())).map(OrderCloth::getOrgId).collect(Collectors.toSet()))
|
|
|
+ .eq(SysOrg::getSourceType, SourceType.STORE.getCode())).stream().collect(Collectors.toMap(SysOrg::getId, SysOrg -> SysOrg));
|
|
|
}
|
|
|
- if(orderCloths.stream().filter(orderCloth -> SourceType.FACTORY.getCode().equals(orderCloth.getSourceType())).collect(Collectors.toList()).size() > 0){
|
|
|
+ if (orderCloths.stream().filter(orderCloth -> SourceType.FACTORY.getCode().equals(orderCloth.getSourceType())).collect(Collectors.toList()).size() > 0) {
|
|
|
factoryOrgMap = sysOrgService.list(new QueryWrapper<SysOrg>().lambda().in(SysOrg::getId
|
|
|
- ,orderCloths.stream().filter(orderCloth -> SourceType.FACTORY.getCode().equals(orderCloth.getSourceType())).map(OrderCloth::getOrgId).collect(Collectors.toSet()))
|
|
|
- .eq(SysOrg::getSourceType,SourceType.FACTORY.getCode())).stream().collect(Collectors.toMap(SysOrg::getId,SysOrg -> SysOrg));
|
|
|
+ , orderCloths.stream().filter(orderCloth -> SourceType.FACTORY.getCode().equals(orderCloth.getSourceType())).map(OrderCloth::getOrgId).collect(Collectors.toSet()))
|
|
|
+ .eq(SysOrg::getSourceType, SourceType.FACTORY.getCode())).stream().collect(Collectors.toMap(SysOrg::getId, SysOrg -> SysOrg));
|
|
|
}
|
|
|
List<WeAppOrderClothAppointmentVO> weAppOrderClothAppointmentVOS = new ArrayList<>();
|
|
|
for (OrderCloth orderCloth : orderCloths) {
|
|
|
WeAppOrderClothAppointmentVO weAppOrderClothAppointmentVO = new WeAppOrderClothAppointmentVO();
|
|
|
- BeanUtils.copyProperties(orderCloth,weAppOrderClothAppointmentVO);
|
|
|
+ BeanUtils.copyProperties(orderCloth, weAppOrderClothAppointmentVO);
|
|
|
weAppOrderClothAppointmentVO.setCollectClothDeliverInfo(collectAddressMap.get(orderCloth.getId()));
|
|
|
weAppOrderClothAppointmentVO.setTakeClothDeliverInfo(takeAddressMap.get(orderCloth.getId()));
|
|
|
- if(SourceType.FACTORY.getCode().equals(orderCloth.getSourceType())){
|
|
|
+ if (SourceType.FACTORY.getCode().equals(orderCloth.getSourceType())) {
|
|
|
weAppOrderClothAppointmentVO.setSysOrg(factoryOrgMap.get(orderCloth.getOrgId()));
|
|
|
- }else if(SourceType.STORE.getCode().equals(orderCloth.getSourceType())){
|
|
|
+ } else if (SourceType.STORE.getCode().equals(orderCloth.getSourceType())) {
|
|
|
weAppOrderClothAppointmentVO.setSysOrg(storeOrgMap.get(orderCloth.getOrgId()));
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
weAppOrderClothAppointmentVO.setSysOrg(SysOrg.buildManagerOrg());
|
|
|
}
|
|
|
weAppOrderClothAppointmentVOS.add(weAppOrderClothAppointmentVO);
|
|
@@ -160,15 +160,15 @@ public class WeAppOrderClothController {
|
|
|
|
|
|
@ApiOperation("预约洗衣")
|
|
|
@PostMapping(value = "appointment")
|
|
|
- public R appointment(@RequestBody @Valid OrderClothAppointmentDTO orderClothAppointmentDTO) throws Exception{
|
|
|
+ public R appointment(@RequestBody @Valid OrderClothAppointmentDTO orderClothAppointmentDTO) throws Exception {
|
|
|
AppUserAddress appUserAddress = appUserAddressService.getOne(new QueryWrapper<AppUserAddress>().lambda()
|
|
|
- .eq(AppUserAddress::getId,orderClothAppointmentDTO.getAddressId())
|
|
|
- .eq(AppUserAddress::getAppUserId,AuthHolder.userId()));
|
|
|
- if(appUserAddress == null){
|
|
|
+ .eq(AppUserAddress::getId, orderClothAppointmentDTO.getAddressId())
|
|
|
+ .eq(AppUserAddress::getAppUserId, AuthHolder.userId()));
|
|
|
+ if (appUserAddress == null) {
|
|
|
throw new ServiceException("未查询到地址");
|
|
|
}
|
|
|
OrderCloth orderCloth = new OrderCloth();
|
|
|
- BeanUtils.copyProperties(orderClothAppointmentDTO,orderCloth);
|
|
|
+ BeanUtils.copyProperties(orderClothAppointmentDTO, orderCloth);
|
|
|
orderCloth.setCreateTime(DateUtils.getNowDate());
|
|
|
orderCloth.setTakeClothWay(TakeOrSendClothWay.DELIVERY.getCode());
|
|
|
orderCloth.setAppUserId(AuthHolder.userId());
|
|
@@ -177,14 +177,14 @@ public class WeAppOrderClothController {
|
|
|
// 预约单
|
|
|
orderCloth.setIsAppointment(SysBoolType.YES.getCode());
|
|
|
orderCloth.setOrderNo(orderNoUtils.getClothOrderNo());
|
|
|
- if(ClothOrderType.normal.equals(orderCloth.getOrderType())){
|
|
|
+ if (ClothOrderType.normal.equals(orderCloth.getOrderType())) {
|
|
|
SysStore sysStore = storeService.selectSysStoreById(orderClothAppointmentDTO.getOrgId());
|
|
|
orderCloth.setFactoryId(sysStore.getFactoryId());
|
|
|
}
|
|
|
|
|
|
//云洗订单或者第三方订单
|
|
|
- if(ClothOrderType.online.getCode().equals(orderCloth.getOrderType())
|
|
|
- || ClothOrderType.thirdPart.getCode().equals(orderCloth.getOrderType())){
|
|
|
+ if (ClothOrderType.online.getCode().equals(orderCloth.getOrderType())
|
|
|
+ || ClothOrderType.thirdPart.getCode().equals(orderCloth.getOrderType())) {
|
|
|
}
|
|
|
orderClothService.save(orderCloth);
|
|
|
// 预创建配送单
|
|
@@ -193,7 +193,7 @@ public class WeAppOrderClothController {
|
|
|
orderDelivery.setOrderSn(orderCloth.getOrderNo());
|
|
|
orderDelivery.setClothOrderType(ClothOrderDeliveryType.collectCloth.getCode());
|
|
|
orderDelivery.setCreateTime(DateUtils.getNowDate());
|
|
|
- orderDelivery.setDeliveryStatus(OrderDeliveryStatusEnum.ORIGIN_STATUS.getCode());
|
|
|
+ orderDelivery.setDeliveryStatus(OrderDeliveryStatusEnum.WAIT_DELIVERY.getCode());
|
|
|
orderDelivery.setDeliveryWay(ClothOrderDeliveryWay.delivery.getCode());
|
|
|
orderDeliveryService.save(orderDelivery);
|
|
|
return R.ok();
|
|
@@ -201,113 +201,113 @@ public class WeAppOrderClothController {
|
|
|
|
|
|
@ApiOperation("查询洗衣订单列表")
|
|
|
@PostMapping(value = "findPage")
|
|
|
- public R<List<OrderClothVO>> findPage(@RequestBody @Valid OrderClothAppQueryDTO orderClothAppQueryDTO) throws Exception{
|
|
|
+ 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());
|
|
|
+ .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());
|
|
|
}
|
|
|
- if(orderClothAppQueryDTO.getEndDate() != null){
|
|
|
- queryWrapper.lt(BaseEntity::getCreateTime,DateUtils.addDays(orderClothAppQueryDTO.getEndDate(),1));
|
|
|
+ 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());
|
|
|
+ if ("0".equals(orderClothAppQueryDTO.getOrderStatus())
|
|
|
+ || "1".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
+ queryWrapper.eq(OrderCloth::getOrderStatus, ClothOrderStatusType.APPOINTMENT.getCode());
|
|
|
}
|
|
|
- if("2".equals(orderClothAppQueryDTO.getOrderStatus())){
|
|
|
+ if ("2".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
queryWrapper.and(orderClothLambdaQueryWrapper -> orderClothLambdaQueryWrapper
|
|
|
- .eq(OrderCloth::getOrderStatus,ClothOrderStatusType.HAS_TO_DOOR.getCode())
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.HAS_TO_DOOR.getCode())
|
|
|
.or()
|
|
|
- .eq(OrderCloth::getOrderStatus,ClothOrderStatusType.HAS_TAKING.getCode()));
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.HAS_TAKING.getCode()));
|
|
|
}
|
|
|
- if("3".equals(orderClothAppQueryDTO.getOrderStatus())){
|
|
|
+ if ("3".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
queryWrapper.and(orderClothLambdaQueryWrapper -> orderClothLambdaQueryWrapper
|
|
|
- .eq(OrderCloth::getOrderStatus,ClothOrderStatusType.WAITING_FOR_PAY.getCode())
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_FOR_PAY.getCode())
|
|
|
.or()
|
|
|
- .eq(OrderCloth::getOrderStatus,ClothOrderStatusType.WAIT_FACTORY.getCode())
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAIT_FACTORY.getCode())
|
|
|
.or()
|
|
|
- .eq(OrderCloth::getOrderStatus,ClothOrderStatusType.WASHING.getCode()));
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WASHING.getCode()));
|
|
|
}
|
|
|
- if("4".equals(orderClothAppQueryDTO.getOrderStatus())){
|
|
|
+ if ("4".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
queryWrapper.and(orderClothLambdaQueryWrapper -> orderClothLambdaQueryWrapper
|
|
|
- .eq(OrderCloth::getOrderStatus,ClothOrderStatusType.HAS_WASH.getCode())
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.HAS_WASH.getCode())
|
|
|
.or()
|
|
|
- .eq(OrderCloth::getOrderStatus,ClothOrderStatusType.WAITING_TO_DOOR.getCode()));
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_TO_DOOR.getCode()));
|
|
|
}
|
|
|
- if("5".equals(orderClothAppQueryDTO.getOrderStatus())){
|
|
|
- queryWrapper.eq(OrderCloth::getOrderStatus,ClothOrderStatusType.WAITING_TO_SEND.getCode());
|
|
|
+ if ("5".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
+ queryWrapper.eq(OrderCloth::getOrderStatus, ClothOrderStatusType.WAITING_TO_SEND.getCode());
|
|
|
}
|
|
|
- if("6".equals(orderClothAppQueryDTO.getOrderStatus())){
|
|
|
- queryWrapper.eq(OrderCloth::getOrderStatus,ClothOrderStatusType.HAS_WASH.getCode());
|
|
|
+ if ("6".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
+ queryWrapper.eq(OrderCloth::getOrderStatus, ClothOrderStatusType.HAS_WASH.getCode());
|
|
|
}
|
|
|
- if("7".equals(orderClothAppQueryDTO.getOrderStatus())){
|
|
|
- queryWrapper.eq(OrderCloth::getOrderStatus,ClothOrderStatusType.SENDING.getCode());
|
|
|
+ if ("7".equals(orderClothAppQueryDTO.getOrderStatus())) {
|
|
|
+ queryWrapper.eq(OrderCloth::getOrderStatus, ClothOrderStatusType.SENDING.getCode());
|
|
|
}
|
|
|
- if("8".equals(orderClothAppQueryDTO.getOrderStatus())){
|
|
|
+ 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_COMMENT.getCode()).or()
|
|
|
+ .eq(OrderCloth::getOrderStatus, ClothOrderStatusType.FINISH.getCode()));
|
|
|
}
|
|
|
|
|
|
queryWrapper.orderByDesc(BaseEntity::getCreateTime);
|
|
|
List<OrderCloth> orderCloths = orderClothService.page(new Page<>(orderClothAppQueryDTO.getPageNum()
|
|
|
- ,orderClothAppQueryDTO.getPageSize(),false),queryWrapper).getRecords();
|
|
|
+ , orderClothAppQueryDTO.getPageSize(), false), queryWrapper).getRecords();
|
|
|
List<OrderClothVO> orderClothVOS = new ArrayList<>();
|
|
|
- if(orderCloths.size() == 0){
|
|
|
+ if (orderCloths.size() == 0) {
|
|
|
return R.ok(orderClothVOS);
|
|
|
}
|
|
|
|
|
|
- Map<Long,AppUser> takeClothUserMap = new HashMap<>();
|
|
|
- if(orderCloths.stream().filter(orderCloth -> orderCloth.getTakeClothAppUserId() != null)
|
|
|
- .map(OrderCloth::getAppUserId).collect(Collectors.toSet()).size() > 0){
|
|
|
+ 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));
|
|
|
+ .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){
|
|
|
+ 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));
|
|
|
+ .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){
|
|
|
+ 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));
|
|
|
+ , 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){
|
|
|
+ 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));
|
|
|
+ , 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())){
|
|
|
+ BeanUtils.copyProperties(record, orderClothVO);
|
|
|
+ if (record.getTakeClothAppUserId() != null && takeClothUserMap.containsKey(record.getTakeClothAppUserId())) {
|
|
|
AppUserVO appUserVO = new AppUserVO();
|
|
|
- BeanUtils.copyProperties(takeClothUserMap.get(record.getTakeClothAppUserId()),appUserVO);
|
|
|
+ BeanUtils.copyProperties(takeClothUserMap.get(record.getTakeClothAppUserId()), appUserVO);
|
|
|
orderClothVO.setTakeClothUserVO(appUserVO);
|
|
|
}
|
|
|
- if(record.getSendClothAppUserId() != null && sendClothUserMap.containsKey(record.getSendClothAppUserId())){
|
|
|
+ if (record.getSendClothAppUserId() != null && sendClothUserMap.containsKey(record.getSendClothAppUserId())) {
|
|
|
AppUserVO appUserVO = new AppUserVO();
|
|
|
- BeanUtils.copyProperties(sendClothUserMap.get(record.getSendClothAppUserId()),appUserVO);
|
|
|
+ BeanUtils.copyProperties(sendClothUserMap.get(record.getSendClothAppUserId()), appUserVO);
|
|
|
orderClothVO.setSendClothUserVO(appUserVO);
|
|
|
}
|
|
|
- if(SourceType.STORE.getCode().equals(orderClothVO.getSourceType())){
|
|
|
+ if (SourceType.STORE.getCode().equals(orderClothVO.getSourceType())) {
|
|
|
orderClothVO.setSysOrg(storeOrgMap.get(orderClothVO.getOrgId()));
|
|
|
- }else if(SourceType.FACTORY.getCode().equals(orderClothVO.getSourceType())){
|
|
|
+ } else if (SourceType.FACTORY.getCode().equals(orderClothVO.getSourceType())) {
|
|
|
orderClothVO.setSysOrg(factoryOrgMap.get(orderClothVO.getOrgId()));
|
|
|
}
|
|
|
orderClothVOS.add(orderClothVO);
|
|
@@ -317,34 +317,34 @@ public class WeAppOrderClothController {
|
|
|
|
|
|
@ApiOperation("查询洗衣订单明细")
|
|
|
@GetMapping(value = "getInfoById")
|
|
|
- public R<OrderClothVO> getInfoById(@RequestParam @ApiParam("订单ID") Long orderId) throws Exception{
|
|
|
+ public R<OrderClothVO> getInfoById(@RequestParam @ApiParam("订单ID") Long orderId) throws Exception {
|
|
|
OrderCloth orderCloth = orderClothService.getOne(new QueryWrapper<OrderCloth>().lambda()
|
|
|
- .eq(OrderCloth::getId,orderId).eq(OrderCloth::getAppUserId,AuthHolder.userId()));
|
|
|
- if(orderCloth == null){
|
|
|
+ .eq(OrderCloth::getId, orderId).eq(OrderCloth::getAppUserId, AuthHolder.userId()));
|
|
|
+ if (orderCloth == null) {
|
|
|
throw new ServiceException("未查询到订单信息");
|
|
|
}
|
|
|
|
|
|
OrderClothVO orderClothVO = new OrderClothVO();
|
|
|
- BeanUtils.copyProperties(orderCloth,orderClothVO);
|
|
|
- orderClothVO.setSysOrg(sysOrgService.getOne(new QueryWrapper<SysOrg>().lambda().eq(SysOrg::getId,orderCloth.getOrgId())
|
|
|
- .eq(SysOrg::getSourceType,orderCloth.getSourceType())));
|
|
|
+ BeanUtils.copyProperties(orderCloth, orderClothVO);
|
|
|
+ orderClothVO.setSysOrg(sysOrgService.getOne(new QueryWrapper<SysOrg>().lambda().eq(SysOrg::getId, orderCloth.getOrgId())
|
|
|
+ .eq(SysOrg::getSourceType, orderCloth.getSourceType())));
|
|
|
|
|
|
orderClothVO.setOrderClothItemVOS(
|
|
|
orderClothItemService.buildWeAppOrderClothItemDetail(
|
|
|
- orderClothItemService.list(new QueryWrapper<OrderClothItem>().lambda()
|
|
|
- .eq(OrderClothItem::getOrderId,orderCloth.getId()))));
|
|
|
+ orderClothItemService.list(new QueryWrapper<OrderClothItem>().lambda()
|
|
|
+ .eq(OrderClothItem::getOrderId, orderCloth.getId()))));
|
|
|
|
|
|
- if(TakeOrSendClothWay.DELIVERY.getCode().equals(orderCloth.getTakeClothWay())
|
|
|
- || TakeOrSendClothWay.DELIVERY.getCode().equals(orderCloth.getSendClothWay())){
|
|
|
- Map<String,OrderDelivery> orderDeliveryMap = orderDeliveryService.list(
|
|
|
- new QueryWrapper<OrderDelivery>().lambda()
|
|
|
- .eq(OrderDelivery::getOrderSn,orderCloth.getOrderNo()))
|
|
|
+ if (TakeOrSendClothWay.DELIVERY.getCode().equals(orderCloth.getTakeClothWay())
|
|
|
+ || TakeOrSendClothWay.DELIVERY.getCode().equals(orderCloth.getSendClothWay())) {
|
|
|
+ Map<String, OrderDelivery> orderDeliveryMap = orderDeliveryService.list(
|
|
|
+ new QueryWrapper<OrderDelivery>().lambda()
|
|
|
+ .eq(OrderDelivery::getOrderSn, orderCloth.getOrderNo()))
|
|
|
.stream().collect(Collectors.toMap(OrderDelivery::getClothOrderType
|
|
|
- ,OrderDelivery -> OrderDelivery));
|
|
|
- if(TakeOrSendClothWay.DELIVERY.getCode().equals(orderCloth.getTakeClothWay())){
|
|
|
+ , OrderDelivery -> OrderDelivery));
|
|
|
+ if (TakeOrSendClothWay.DELIVERY.getCode().equals(orderCloth.getTakeClothWay())) {
|
|
|
orderClothVO.setCollectClothDeliverInfo(orderDeliveryMap.get(ClothOrderDeliveryType.collectCloth.getCode()));
|
|
|
}
|
|
|
- if(TakeOrSendClothWay.DELIVERY.getCode().equals(orderCloth.getSendClothWay())){
|
|
|
+ if (TakeOrSendClothWay.DELIVERY.getCode().equals(orderCloth.getSendClothWay())) {
|
|
|
orderClothVO.setTakeClothDeliverInfo(orderDeliveryMap.get(ClothOrderDeliveryType.takeCloth.getCode()));
|
|
|
}
|
|
|
}
|
|
@@ -354,7 +354,7 @@ public class WeAppOrderClothController {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@ApiOperation("洗衣订单配送订单下单")
|
|
|
@PostMapping(value = "addSendClothDeliveryOrder")
|
|
|
- public R addSendClothDeliveryOrder(@RequestBody @Valid UpdateOrderClothTakeClothWayDTO updateOrderClothTakeClothWayDTO) throws Exception{
|
|
|
+ public R addSendClothDeliveryOrder(@RequestBody @Valid UpdateOrderClothTakeClothWayDTO updateOrderClothTakeClothWayDTO) throws Exception {
|
|
|
// if(updateOrderClothTakeClothWayDTO.getAddressId() == null){
|
|
|
// throw new ServiceException("请先选择地址");
|
|
|
// }
|
|
@@ -467,76 +467,76 @@ public class WeAppOrderClothController {
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
@ApiOperation("衣服确认送达")
|
|
|
@GetMapping(value = "confirmSend")
|
|
|
- public R confirmSend(@RequestParam Long orderId) throws Exception{
|
|
|
+ public R confirmSend(@RequestParam Long orderId) throws Exception {
|
|
|
OrderCloth orderCloth = orderClothService.getOne(new QueryWrapper<OrderCloth>().lambda()
|
|
|
- .eq(OrderCloth::getId,orderId)
|
|
|
- .eq(OrderCloth::getAppUserId,AuthHolder.userId()));
|
|
|
- if(orderCloth == null){
|
|
|
+ .eq(OrderCloth::getId, orderId)
|
|
|
+ .eq(OrderCloth::getAppUserId, AuthHolder.userId()));
|
|
|
+ if (orderCloth == null) {
|
|
|
throw new ServiceException("未查询到订单信息");
|
|
|
}
|
|
|
- if(!ClothOrderStatusType.SENDING.getCode().equals(orderCloth.getOrderStatus())){
|
|
|
+ if (!ClothOrderStatusType.SENDING.getCode().equals(orderCloth.getOrderStatus())) {
|
|
|
throw new ServiceException("当前订单状态为"
|
|
|
- + EnumUtils.getEnumByType(orderCloth.getOrderStatus(),ClothOrderStatusType.class)
|
|
|
+ + EnumUtils.getEnumByType(orderCloth.getOrderStatus(), ClothOrderStatusType.class)
|
|
|
+ ",无法进行确认送达操作");
|
|
|
}
|
|
|
orderCloth.setOrderStatus(ClothOrderStatusType.FINISH.getCode());
|
|
|
orderClothService.updateById(orderCloth);
|
|
|
orderClothItemService.update(new UpdateWrapper<OrderClothItem>().lambda()
|
|
|
- .set(OrderClothItem::getFlowStatus,ClothOrderFlowStatus.hasTake.getCode())
|
|
|
- .eq(OrderClothItem::getOrderId,orderId));
|
|
|
+ .set(OrderClothItem::getFlowStatus, ClothOrderFlowStatus.hasTake.getCode())
|
|
|
+ .eq(OrderClothItem::getOrderId, orderId));
|
|
|
List<OrderClothItem> orderClothItems = orderClothItemService.list(new QueryWrapper<OrderClothItem>()
|
|
|
- .lambda().eq(OrderClothItem::getOrderId,orderId));
|
|
|
- orderClothItemFlowRecordService.addRecordBatch(orderClothItems,ClothOrderFlowStatus.hasTake.getCode());
|
|
|
+ .lambda().eq(OrderClothItem::getOrderId, orderId));
|
|
|
+ orderClothItemFlowRecordService.addRecordBatch(orderClothItems, ClothOrderFlowStatus.hasTake.getCode());
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
@ApiOperation("取消订单")
|
|
|
@GetMapping(value = "cancel")
|
|
|
- public R cancel(@RequestParam @ApiParam("订单ID") Long orderId) throws Exception{
|
|
|
+ public R cancel(@RequestParam @ApiParam("订单ID") Long orderId) throws Exception {
|
|
|
OrderCloth orderCloth = orderClothService.getOne(new QueryWrapper<OrderCloth>().lambda()
|
|
|
- .eq(OrderCloth::getId,orderId).eq(OrderCloth::getAppUserId,AuthHolder.userId()));
|
|
|
- if(orderCloth == null){
|
|
|
+ .eq(OrderCloth::getId, orderId).eq(OrderCloth::getAppUserId, AuthHolder.userId()));
|
|
|
+ if (orderCloth == null) {
|
|
|
throw new ServiceException("未查询到订单");
|
|
|
}
|
|
|
|
|
|
- if(!(ClothOrderStatusType.APPOINTMENT.getCode().equals(orderCloth.getOrderStatus())
|
|
|
- ||ClothOrderStatusType.WAITING_TO_DOOR.getCode().equals(orderCloth.getOrderStatus())
|
|
|
- ||ClothOrderStatusType.HAS_TO_DOOR.getCode().equals(orderCloth.getOrderStatus())
|
|
|
- ||ClothOrderStatusType.HAS_TAKING.getCode().equals(orderCloth.getOrderStatus())
|
|
|
- ||ClothOrderStatusType.WAITING_FOR_PAY.getCode().equals(orderCloth.getOrderStatus()))){
|
|
|
+ if (!(ClothOrderStatusType.APPOINTMENT.getCode().equals(orderCloth.getOrderStatus())
|
|
|
+ || ClothOrderStatusType.WAITING_TO_DOOR.getCode().equals(orderCloth.getOrderStatus())
|
|
|
+ || ClothOrderStatusType.HAS_TO_DOOR.getCode().equals(orderCloth.getOrderStatus())
|
|
|
+ || ClothOrderStatusType.HAS_TAKING.getCode().equals(orderCloth.getOrderStatus())
|
|
|
+ || ClothOrderStatusType.WAITING_FOR_PAY.getCode().equals(orderCloth.getOrderStatus()))) {
|
|
|
throw new ServiceException("订单状态不正确,无法取消");
|
|
|
}
|
|
|
|
|
|
orderClothService.update(new UpdateWrapper<OrderCloth>().lambda()
|
|
|
- .set(OrderCloth::getOrderStatus,ClothOrderStatusType.CANCEL.getCode())
|
|
|
- .set(BaseEntity::getUpdateTime,DateUtils.getNowDate()).eq(OrderCloth::getId,orderId));
|
|
|
+ .set(OrderCloth::getOrderStatus, ClothOrderStatusType.CANCEL.getCode())
|
|
|
+ .set(BaseEntity::getUpdateTime, DateUtils.getNowDate()).eq(OrderCloth::getId, orderId));
|
|
|
|
|
|
orderClothItemService.update(new UpdateWrapper<OrderClothItem>().lambda()
|
|
|
- .set(OrderClothItem::getFlowStatus,ClothOrderFlowStatus.refund.getCode())
|
|
|
- .eq(OrderClothItem::getOrderId,orderId));
|
|
|
+ .set(OrderClothItem::getFlowStatus, ClothOrderFlowStatus.refund.getCode())
|
|
|
+ .eq(OrderClothItem::getOrderId, orderId));
|
|
|
List<OrderClothItem> orderClothItems = orderClothItemService.list(new QueryWrapper<OrderClothItem>()
|
|
|
- .lambda().eq(OrderClothItem::getOrderId,orderId));
|
|
|
- orderClothItemFlowRecordService.addRecordBatch(orderClothItems,ClothOrderFlowStatus.refund.getCode());
|
|
|
+ .lambda().eq(OrderClothItem::getOrderId, orderId));
|
|
|
+ orderClothItemFlowRecordService.addRecordBatch(orderClothItems, ClothOrderFlowStatus.refund.getCode());
|
|
|
return R.ok();
|
|
|
}
|
|
|
|
|
|
@ApiOperation("计算配送费金额")
|
|
|
@GetMapping(value = "calculateDeliveryPirce")
|
|
|
- public R<BigDecimal> calculateDeliveryPirce(@RequestParam Long orderId) throws Exception{
|
|
|
+ public R<BigDecimal> calculateDeliveryPirce(@RequestParam Long orderId) throws Exception {
|
|
|
OrderCloth orderCloth = orderClothService.getOne(new QueryWrapper<OrderCloth>().lambda()
|
|
|
- .eq(OrderCloth::getId,orderId)
|
|
|
- .eq(OrderCloth::getAppUserId,AuthHolder.userId()));
|
|
|
+ .eq(OrderCloth::getId, orderId)
|
|
|
+ .eq(OrderCloth::getAppUserId, AuthHolder.userId()));
|
|
|
int freeDeliveryNum = 0;
|
|
|
- if(orderCloth.getOrderClothPrice().doubleValue() >= 100){
|
|
|
+ if (orderCloth.getOrderClothPrice().doubleValue() >= 100) {
|
|
|
freeDeliveryNum++;
|
|
|
}
|
|
|
- if(orderCloth.getOrderClothPrice().doubleValue() >= 200){
|
|
|
+ if (orderCloth.getOrderClothPrice().doubleValue() >= 200) {
|
|
|
freeDeliveryNum++;
|
|
|
}
|
|
|
- if(ClothTakeWay.DELIVERY.getCode().equals(orderCloth.getTakeClothWay())){
|
|
|
+ if (ClothTakeWay.DELIVERY.getCode().equals(orderCloth.getTakeClothWay())) {
|
|
|
freeDeliveryNum--;
|
|
|
}
|
|
|
- if(freeDeliveryNum > 0){
|
|
|
+ if (freeDeliveryNum > 0) {
|
|
|
return R.ok(BigDecimal.ZERO);
|
|
|
}
|
|
|
return R.ok(new BigDecimal(sysConfigService.selectConfigByKey(SysConfigKey.OrderClothDeliveryPrice.getCode())));
|