|
@@ -4,11 +4,13 @@ import javax.validation.Valid;
|
|
|
|
|
|
import com.chelvc.cloud.maintain.copier.MerchantCopier;
|
|
|
import com.chelvc.cloud.maintain.param.CustomerIndexParam;
|
|
|
+import com.chelvc.cloud.maintain.vo.ConfigurationVO;
|
|
|
import com.chelvc.cloud.maintain.vo.CustomerIndexVO;
|
|
|
import com.chelvc.cloud.uc.api.service.UsageService;
|
|
|
import com.chelvc.cloud.vehicle.api.param.NearbyQueryParam;
|
|
|
import com.chelvc.cloud.vehicle.api.service.MerchantService;
|
|
|
import com.chelvc.framework.base.annotation.UnifiedResponseBody;
|
|
|
+import com.chelvc.framework.base.context.ApplicationContextHolder;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
@@ -31,11 +33,29 @@ public class IndexController {
|
|
|
@DubboReference
|
|
|
private MerchantService merchantService;
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取附近距离配置
|
|
|
+ *
|
|
|
+ * @return 距离(米)
|
|
|
+ */
|
|
|
+ private int getNearbyDistance() {
|
|
|
+ return ApplicationContextHolder.getProperty("platform.nearby.distance", int.class, 20000);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取系统配置
|
|
|
+ *
|
|
|
+ * @return 配置信息
|
|
|
+ */
|
|
|
+ private ConfigurationVO getConfiguration() {
|
|
|
+ return ConfigurationVO.builder().build();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 刷新用户使用记录
|
|
|
*/
|
|
|
@PostMapping("/usage")
|
|
|
- public void refreshUsage() {
|
|
|
+ public void using() {
|
|
|
this.usageService.refresh();
|
|
|
}
|
|
|
|
|
@@ -48,8 +68,9 @@ public class IndexController {
|
|
|
@GetMapping("/customer/index")
|
|
|
public CustomerIndexVO getCustomerIndex(@Valid CustomerIndexParam param) {
|
|
|
NearbyQueryParam query = NearbyQueryParam.builder().longitude(param.getLongitude())
|
|
|
- .latitude(param.getLatitude()).distance(10000).build();
|
|
|
+ .latitude(param.getLatitude()).distance(this.getNearbyDistance()).build();
|
|
|
CustomerIndexVO index = CustomerIndexVO.builder().build();
|
|
|
+ index.setConfiguration(this.getConfiguration());
|
|
|
index.setRecommendMerchants(
|
|
|
MerchantCopier.INSTANCE.copying(this.merchantService.listRecommendMerchants(query, 4))
|
|
|
);
|