|
|
|
@ -244,7 +244,7 @@ public class RecycleOrderController {
|
|
|
|
|
LocationDTO location = (LocationDTO) CommonUtil.obtainField(orderRespVO, "location");
|
|
|
|
|
if (location != null) {
|
|
|
|
|
BigDecimal distance = CommonUtil.getDistance(longitude, latitude, location.getLongitude(), location.getLatitude());
|
|
|
|
|
CommonUtil.assignField(orderRespVO, "distance2", distance);
|
|
|
|
|
CommonUtil.assignField(orderRespVO, "distance2", distance.doubleValue());
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
@ -262,17 +262,19 @@ public class RecycleOrderController {
|
|
|
|
|
List<RecycleOrderDetailResponseVO> detailResponseVOList = BeanUtils.copyList(orderProducts, RecycleOrderDetailResponseVO.class);
|
|
|
|
|
// 查询废品信息
|
|
|
|
|
Set<String> productIds = detailResponseVOList.stream().map(RecycleOrderDetailResponseVO::getProductId).collect(Collectors.toSet());
|
|
|
|
|
List<Product> productList = priceProductService.queryProductList(productIds);
|
|
|
|
|
Map<String, Product> productMap = productList.stream().collect(Collectors.toMap(Product::getId, p -> p, (k1, k2) -> k1));
|
|
|
|
|
for (RecycleOrderDetailResponseVO detailVO : detailResponseVOList) {
|
|
|
|
|
Product product = productMap.get(detailVO.getProductId());
|
|
|
|
|
detailVO.setProduct(BeanUtils.copyBean(product, ProductSimpleVO.class));
|
|
|
|
|
List<Product> productList = priceProductService.getProductListByIds(productIds);
|
|
|
|
|
if (CollUtils.isNotEmpty(productList)) {
|
|
|
|
|
Map<String, Product> productMap = productList.stream().collect(Collectors.toMap(Product::getId, p -> p, (k1, k2) -> k1));
|
|
|
|
|
for (RecycleOrderDetailResponseVO detailVO : detailResponseVOList) {
|
|
|
|
|
Product product = productMap.get(detailVO.getProductId());
|
|
|
|
|
detailVO.setProduct(BeanUtils.copyBean(product, ProductSimpleVO.class));
|
|
|
|
|
}
|
|
|
|
|
Map<String, List<RecycleOrderDetailResponseVO>> orderProductsMap =
|
|
|
|
|
detailResponseVOList.stream().collect(Collectors.groupingBy(RecycleOrderDetailResponseVO::getRecycleOrderId));
|
|
|
|
|
orderRespVOList.forEach(v -> {
|
|
|
|
|
CommonUtil.assignField(v, "orderDetails", orderProductsMap.get(v.getId()));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
Map<String, List<RecycleOrderDetailResponseVO>> orderProductsMap =
|
|
|
|
|
detailResponseVOList.stream().collect(Collectors.groupingBy(RecycleOrderDetailResponseVO::getRecycleOrderId));
|
|
|
|
|
orderRespVOList.forEach(v -> {
|
|
|
|
|
CommonUtil.assignField(v, "orderDetails", orderProductsMap.get(v.getId()));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -288,14 +290,16 @@ public class RecycleOrderController {
|
|
|
|
|
return Optional.ofNullable(clientAddressId).orElse("");
|
|
|
|
|
}, (k1, k2) -> k1));
|
|
|
|
|
Set<String> addressIds = new HashSet<>(CollUtils.removeEmpty(orderAddressMap.values()));
|
|
|
|
|
List<ClientAddress> clientAddresses = clientAddressService.queryAddressList(addressIds);
|
|
|
|
|
List<ClientAddressSimpleVO> addressSimpleVOList = BeanUtils.copyList(clientAddresses, ClientAddressSimpleVO.class);
|
|
|
|
|
Map<String, ClientAddressSimpleVO> clientAddressMap = addressSimpleVOList.stream().collect(
|
|
|
|
|
Collectors.toMap(ClientAddressSimpleVO::getId, v -> v, (k1, k2) -> k1));
|
|
|
|
|
orderRespVOList.forEach(v -> {
|
|
|
|
|
String clientAddressId = (String) CommonUtil.obtainField(v, "clientAddressId");
|
|
|
|
|
CommonUtil.assignField(v, "clientAddressId", clientAddressId);
|
|
|
|
|
});
|
|
|
|
|
List<ClientAddress> clientAddresses = clientAddressService.getAddressListByIds(addressIds);
|
|
|
|
|
if (CollUtils.isNotEmpty(clientAddresses)) {
|
|
|
|
|
List<ClientAddressSimpleVO> addressSimpleVOList = BeanUtils.copyList(clientAddresses, ClientAddressSimpleVO.class);
|
|
|
|
|
Map<String, ClientAddressSimpleVO> clientAddressMap = addressSimpleVOList.stream().collect(
|
|
|
|
|
Collectors.toMap(ClientAddressSimpleVO::getId, v -> v, (k1, k2) -> k1));
|
|
|
|
|
orderRespVOList.forEach(v -> {
|
|
|
|
|
String clientAddressId = (String) CommonUtil.obtainField(v, "clientAddressId");
|
|
|
|
|
CommonUtil.assignField(v, "clientAddressId", clientAddressId);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -309,16 +313,18 @@ public class RecycleOrderController {
|
|
|
|
|
RecycleOrderRespVO::getId, v -> Optional.ofNullable(v.getStaffsId()).orElse(""), (k1, k2) -> k1));
|
|
|
|
|
Set<String> recyclerIds = new HashSet<>(CollUtils.removeEmpty(orderRecyclerMap.values()));
|
|
|
|
|
List<Recycler> recyclerList = recyclerService.getRecyclerByIds(recyclerIds);
|
|
|
|
|
List<RecyclerSimpleVO> recyclerSimpleVOList = BeanUtils.copyList(recyclerList, RecyclerSimpleVO.class);
|
|
|
|
|
Map<String, RecyclerSimpleVO> recyclerMap = recyclerSimpleVOList.stream().collect(
|
|
|
|
|
Collectors.toMap(RecyclerSimpleVO::getId, v -> v, (k1, k2) -> k1));
|
|
|
|
|
orderRespVOList.forEach(v -> {
|
|
|
|
|
CommonUtil.assignField(v, "recyclerInfo", recyclerMap.get(v.getStaffsId()));
|
|
|
|
|
LocalDateTime appointmentTimeStart = (LocalDateTime) CommonUtil.obtainField(v, "appointmentTimeStart");
|
|
|
|
|
if (ObjectUtil.isNotEmpty(appointmentTimeStart)) {
|
|
|
|
|
CommonUtil.assignField(v, "estimateArrivalTime", appointmentTimeStart.plusHours(1));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
if (ObjectUtil.isNotEmpty(recyclerList)) {
|
|
|
|
|
List<RecyclerSimpleVO> recyclerSimpleVOList = BeanUtils.copyList(recyclerList, RecyclerSimpleVO.class);
|
|
|
|
|
Map<String, RecyclerSimpleVO> recyclerMap = recyclerSimpleVOList.stream().collect(
|
|
|
|
|
Collectors.toMap(RecyclerSimpleVO::getId, v -> v, (k1, k2) -> k1));
|
|
|
|
|
orderRespVOList.forEach(v -> {
|
|
|
|
|
CommonUtil.assignField(v, "recyclerInfo", recyclerMap.get(v.getStaffsId()));
|
|
|
|
|
LocalDateTime appointmentTimeStart = (LocalDateTime) CommonUtil.obtainField(v, "appointmentTimeStart");
|
|
|
|
|
if (ObjectUtil.isNotEmpty(appointmentTimeStart)) {
|
|
|
|
|
CommonUtil.assignField(v, "estimateArrivalTime", appointmentTimeStart.plusHours(1));
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -335,13 +341,15 @@ public class RecycleOrderController {
|
|
|
|
|
}, (k1, k2) -> k1));
|
|
|
|
|
Set<String> housingEstateIds = new HashSet<>(CollUtils.removeEmpty(orderHousingEstateMap.values()));
|
|
|
|
|
List<HousingEstate> housingEstateList = housingEstateService.getHousingListByIds(housingEstateIds);
|
|
|
|
|
List<HousingEstateSimpleVO> housingSimpleVOList = BeanUtils.copyList(housingEstateList, HousingEstateSimpleVO.class);
|
|
|
|
|
Map<String, HousingEstateSimpleVO> housingEstateMap = housingSimpleVOList.stream().collect(
|
|
|
|
|
Collectors.toMap(HousingEstateSimpleVO::getId, v -> v, (k1, k2) -> k1));
|
|
|
|
|
orderRespVOList.forEach(v -> {
|
|
|
|
|
String housingEstateId = (String) CommonUtil.obtainField(v, "housingEstateId");
|
|
|
|
|
CommonUtil.assignField(v, "housingEstateInfo", housingEstateMap.get(housingEstateId));
|
|
|
|
|
});
|
|
|
|
|
if (CollUtils.isNotEmpty(housingEstateList)) {
|
|
|
|
|
List<HousingEstateSimpleVO> housingSimpleVOList = BeanUtils.copyList(housingEstateList, HousingEstateSimpleVO.class);
|
|
|
|
|
Map<String, HousingEstateSimpleVO> housingEstateMap = housingSimpleVOList.stream().collect(
|
|
|
|
|
Collectors.toMap(HousingEstateSimpleVO::getId, v -> v, (k1, k2) -> k1));
|
|
|
|
|
orderRespVOList.forEach(v -> {
|
|
|
|
|
String housingEstateId = (String) CommonUtil.obtainField(v, "housingEstateId");
|
|
|
|
|
CommonUtil.assignField(v, "housingEstateInfo", housingEstateMap.get(housingEstateId));
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|