补充客户信息
This commit is contained in:
21
src/main/java/com/rj/dto/NearbyMerchantItem.java
Normal file
21
src/main/java/com/rj/dto/NearbyMerchantItem.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.rj.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* 高德周边 POI 中的一条商家记录(与 {@code AllShopCollectorV5} 解析字段一致)。
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class NearbyMerchantItem {
|
||||
|
||||
private String name;
|
||||
private String address;
|
||||
private String tel;
|
||||
private String type;
|
||||
/** 经纬度,格式 "lng,lat" */
|
||||
private String location;
|
||||
}
|
||||
43
src/main/java/com/rj/dto/NearbyMerchantSearchResult.java
Normal file
43
src/main/java/com/rj/dto/NearbyMerchantSearchResult.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.rj.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 根据城市+地址做地理编码后,按半径周边搜索商家的结果。
|
||||
*/
|
||||
@Getter
|
||||
public class NearbyMerchantSearchResult {
|
||||
|
||||
private final int httpStatus;
|
||||
private final boolean success;
|
||||
private final String message;
|
||||
private final String centerLocation;
|
||||
private final List<NearbyMerchantItem> merchants;
|
||||
/** 高德返回的本次检索总条数(字符串),可能大于已拉取页数之和 */
|
||||
private final String totalCount;
|
||||
|
||||
private NearbyMerchantSearchResult(int httpStatus, boolean success, String message,
|
||||
String centerLocation, List<NearbyMerchantItem> merchants, String totalCount) {
|
||||
this.httpStatus = httpStatus;
|
||||
this.success = success;
|
||||
this.message = message;
|
||||
this.centerLocation = centerLocation;
|
||||
this.merchants = merchants == null ? Collections.emptyList() : merchants;
|
||||
this.totalCount = totalCount;
|
||||
}
|
||||
|
||||
public static NearbyMerchantSearchResult ok(String centerLocation, List<NearbyMerchantItem> merchants, String totalCount) {
|
||||
return new NearbyMerchantSearchResult(200, true, "查询成功", centerLocation, merchants, totalCount);
|
||||
}
|
||||
|
||||
public static NearbyMerchantSearchResult badRequest(String message) {
|
||||
return new NearbyMerchantSearchResult(400, false, message, null, Collections.emptyList(), null);
|
||||
}
|
||||
|
||||
public static NearbyMerchantSearchResult serverError(String message) {
|
||||
return new NearbyMerchantSearchResult(500, false, message, null, Collections.emptyList(), null);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user