diff --git a/nxhs-service/src/main/java/cc/yunxi/controller/RecycleOrderController.java b/nxhs-service/src/main/java/cc/yunxi/controller/RecycleOrderController.java index 1df5c96..d16e9d1 100644 --- a/nxhs-service/src/main/java/cc/yunxi/controller/RecycleOrderController.java +++ b/nxhs-service/src/main/java/cc/yunxi/controller/RecycleOrderController.java @@ -174,12 +174,12 @@ public class RecycleOrderController { detailResponseVOList.stream().collect(Collectors.groupingBy(RecycleOrderDetailResponseVO::getRecycleOrderId)); // 地址关联信息 Map orderAddressMap = orderRespVOList.stream().collect(Collectors.toMap( - RecycleOrderRespVO::getId, RecycleOrderRespVO::getClientAddressId)); + RecycleOrderRespVO::getId, v -> Optional.ofNullable(v.getClientAddressId()).orElse(""), (k1, k2) -> k1)); Set addressIds = new HashSet<>(orderAddressMap.values()); List clientAddresses = clientAddressService.queryAddressList(addressIds); List addressSimpleVOList = BeanUtils.copyList(clientAddresses, ClientAddressSimpleVO.class); Map clientAddressMap = addressSimpleVOList.stream().collect(Collectors.toMap( - ClientAddressSimpleVO::getId, cas -> cas)); + ClientAddressSimpleVO::getId, v -> v, (k1, k2) -> k1)); for (RecycleOrderRespVO orderRespVO : orderRespVOList) { this.computeOrderDistance(orderRespVO, locationDTO); List orderDetails = orderProductsMap.get(orderRespVO.getId()); diff --git a/nxhs-service/src/main/java/cc/yunxi/controller/RecycleStationController.java b/nxhs-service/src/main/java/cc/yunxi/controller/RecycleStationController.java index 633a801..107b4ed 100644 --- a/nxhs-service/src/main/java/cc/yunxi/controller/RecycleStationController.java +++ b/nxhs-service/src/main/java/cc/yunxi/controller/RecycleStationController.java @@ -69,4 +69,18 @@ public class RecycleStationController { return CommonResult.success(stationProduct); } + + @ApiOperation("附近的回收站") + @GetMapping("/nearby") + public CommonResult stationNearby(LocationDTO locationDTO) { + RecycleStation nearbyStation = recycleStationService.getNearbyStation(locationDTO); + RecycleStationRespVO stationRespVO = null; + if (ObjectUtil.isNotEmpty(nearbyStation)) { + stationRespVO = BeanUtils.copyBean(nearbyStation, RecycleStationRespVO.class); + List produceList = recycleStationService.getStationProduct(nearbyStation.getId()); + stationRespVO.setStationProducts(produceList); + } + return CommonResult.success(stationRespVO); + } + } diff --git a/nxhs-service/src/main/java/cc/yunxi/domain/vo/recyclestation/RecycleStationRespVO.java b/nxhs-service/src/main/java/cc/yunxi/domain/vo/recyclestation/RecycleStationRespVO.java index b19d204..205fb67 100644 --- a/nxhs-service/src/main/java/cc/yunxi/domain/vo/recyclestation/RecycleStationRespVO.java +++ b/nxhs-service/src/main/java/cc/yunxi/domain/vo/recyclestation/RecycleStationRespVO.java @@ -1,10 +1,12 @@ package cc.yunxi.domain.vo.recyclestation; +import cc.yunxi.domain.vo.priceproduct.ProductRespVO; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.time.LocalDateTime; +import java.util.List; /** *

@@ -89,12 +91,15 @@ public class RecycleStationRespVO { @ApiModelProperty("范围限制(单位:m)") private Integer acceptRange; - @ApiModelProperty("服务范围内小区") - private String acceptHousingEstate; +// @ApiModelProperty("服务范围内小区") +// private String acceptHousingEstate; @ApiModelProperty("创建时间") private LocalDateTime creatorTime; @ApiModelProperty("站点距离(m)") private String distance; + + @ApiModelProperty("站点类目信息") + private List stationProducts; } diff --git a/nxhs-service/src/main/java/cc/yunxi/mapper/RecycleStationMapper.java b/nxhs-service/src/main/java/cc/yunxi/mapper/RecycleStationMapper.java index 929f3ad..a18ceac 100644 --- a/nxhs-service/src/main/java/cc/yunxi/mapper/RecycleStationMapper.java +++ b/nxhs-service/src/main/java/cc/yunxi/mapper/RecycleStationMapper.java @@ -29,10 +29,18 @@ public interface RecycleStationMapper extends BaseMapper { * 复杂sql xml分页查询回收站 * @param page * @param queryWrapper - * @return + * @return Page */ Page queryStationByPage( @Param("location") LocationDTO locationDTO, Page page, @Param(Constants.WRAPPER) LambdaQueryWrapper queryWrapper); + + /** + * 获取最近的站点 + * @param locationDTO + * @return RecycleStation + */ + RecycleStation getNearbyStation(@Param("location") LocationDTO locationDTO); + } diff --git a/nxhs-service/src/main/java/cc/yunxi/service/IClientService.java b/nxhs-service/src/main/java/cc/yunxi/service/IClientService.java index a248eae..b03cac0 100644 --- a/nxhs-service/src/main/java/cc/yunxi/service/IClientService.java +++ b/nxhs-service/src/main/java/cc/yunxi/service/IClientService.java @@ -77,7 +77,7 @@ public interface IClientService extends IService { * @param amount * @param orderNo */ - void addBalance(String clientId, BigDecimal amount, String orderNo); + void addBalance(String clientId, BigDecimal amount, String orderNo, String stationId); /** diff --git a/nxhs-service/src/main/java/cc/yunxi/service/IRecycleStationService.java b/nxhs-service/src/main/java/cc/yunxi/service/IRecycleStationService.java index 9cf5f95..7610730 100644 --- a/nxhs-service/src/main/java/cc/yunxi/service/IRecycleStationService.java +++ b/nxhs-service/src/main/java/cc/yunxi/service/IRecycleStationService.java @@ -1,8 +1,10 @@ package cc.yunxi.service; +import cc.yunxi.domain.dto.LocationDTO; import cc.yunxi.domain.po.RecycleStation; import cc.yunxi.domain.query.RecycleStationQuery; import cc.yunxi.domain.vo.priceproduct.ProductRespVO; +import cc.yunxi.domain.vo.recyclestation.RecycleStationRespVO; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; @@ -26,6 +28,13 @@ public interface IRecycleStationService extends IService { */ Page queryStationByPage(RecycleStationQuery recycleStationQuery); + /** + * 获取最近的站点 + * + * @param locationDTO + * @return + */ + RecycleStation getNearbyStation(LocationDTO locationDTO); /** * 站点详情 diff --git a/nxhs-service/src/main/java/cc/yunxi/service/impl/RecycleStationServiceImpl.java b/nxhs-service/src/main/java/cc/yunxi/service/impl/RecycleStationServiceImpl.java index a332d89..5742870 100644 --- a/nxhs-service/src/main/java/cc/yunxi/service/impl/RecycleStationServiceImpl.java +++ b/nxhs-service/src/main/java/cc/yunxi/service/impl/RecycleStationServiceImpl.java @@ -3,9 +3,11 @@ package cc.yunxi.service.impl; import cc.yunxi.common.domain.LambdaQueryWrapperX; import cc.yunxi.common.exception.BizIllegalException; import cc.yunxi.common.utils.BeanUtils; +import cc.yunxi.domain.dto.LocationDTO; import cc.yunxi.domain.po.*; import cc.yunxi.domain.query.RecycleStationQuery; import cc.yunxi.domain.vo.priceproduct.ProductRespVO; +import cc.yunxi.domain.vo.recyclestation.RecycleStationRespVO; import cc.yunxi.enums.GlobalStatusEnum; import cc.yunxi.mapper.*; import cc.yunxi.service.IRecycleStationService; @@ -73,6 +75,12 @@ public class RecycleStationServiceImpl extends ServiceImpl + + + +