|
@@ -11,6 +11,7 @@ import com.chelvc.cloud.vehicle.api.param.NearbyQueryParam;
|
|
import com.chelvc.cloud.vehicle.api.service.MerchantService;
|
|
import com.chelvc.cloud.vehicle.api.service.MerchantService;
|
|
import com.chelvc.framework.base.annotation.UnifiedResponseBody;
|
|
import com.chelvc.framework.base.annotation.UnifiedResponseBody;
|
|
import com.chelvc.framework.base.context.ApplicationContextHolder;
|
|
import com.chelvc.framework.base.context.ApplicationContextHolder;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.validation.annotation.Validated;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -23,6 +24,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
* @author Woody
|
|
* @author Woody
|
|
* @date 2023/5/4
|
|
* @date 2023/5/4
|
|
*/
|
|
*/
|
|
|
|
+@Slf4j
|
|
@Validated
|
|
@Validated
|
|
@RestController
|
|
@RestController
|
|
@UnifiedResponseBody
|
|
@UnifiedResponseBody
|
|
@@ -39,7 +41,7 @@ public class IndexController {
|
|
* @return 距离(米)
|
|
* @return 距离(米)
|
|
*/
|
|
*/
|
|
private int getNearbyDistance() {
|
|
private int getNearbyDistance() {
|
|
- return ApplicationContextHolder.getProperty("platform.nearby.distance", int.class, 20000);
|
|
|
|
|
|
+ return ApplicationContextHolder.getSafeProperty("platform.nearby.distance", int.class, 20000);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -70,13 +72,20 @@ public class IndexController {
|
|
NearbyQueryParam query = NearbyQueryParam.builder().longitude(param.getLongitude())
|
|
NearbyQueryParam query = NearbyQueryParam.builder().longitude(param.getLongitude())
|
|
.latitude(param.getLatitude()).distance(this.getNearbyDistance()).build();
|
|
.latitude(param.getLatitude()).distance(this.getNearbyDistance()).build();
|
|
CustomerIndexVO index = CustomerIndexVO.builder().build();
|
|
CustomerIndexVO index = CustomerIndexVO.builder().build();
|
|
- index.setConfiguration(this.getConfiguration());
|
|
|
|
- index.setRecommendMerchants(
|
|
|
|
- MerchantCopier.INSTANCE.copying(this.merchantService.listRecommendMerchants(query, 4))
|
|
|
|
- );
|
|
|
|
- index.setNearbyMerchants(
|
|
|
|
- MerchantCopier.INSTANCE.copying(this.merchantService.listNearbyMerchants(query, 4))
|
|
|
|
- );
|
|
|
|
|
|
+
|
|
|
|
+ // 加载附近商家列表
|
|
|
|
+ try {
|
|
|
|
+ index.setNears(MerchantCopier.INSTANCE.copying(this.merchantService.listNearbyMerchants(query, 4)));
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("Nearby merchants load failed", e);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 加载推荐商家列表
|
|
|
|
+ try {
|
|
|
|
+ index.setRecommends(MerchantCopier.INSTANCE.copying(this.merchantService.listRecommendMerchants(query, 4)));
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ log.error("Recommend merchants load failed", e);
|
|
|
|
+ }
|
|
return index;
|
|
return index;
|
|
}
|
|
}
|
|
}
|
|
}
|