Commit 3c0c5137 by 陶光胜

门店经纬度

parent 88d10453
......@@ -30,6 +30,8 @@ public enum StoreESFieldsEnum {
OWNTYPE("ownType", "门店是否共享"),
PHOTOLIST("photoList", "门店图片"),
BUSSINESSTIME("businessTimeList", "门店营业时间"),
ADDRESS("address", "门店详细地址"),
LOCATION("location", "经纬度"),
C1("c1", "自定义字段1"),
C2("c2", "自定义字段2"),
C3("c3", "自定义字段3"),
......
......@@ -30,6 +30,8 @@ public class StoreEsDTO implements Serializable {
private Integer ownType;
private List<StorePhotoDTO> photoList;
private List<StoreBusinessTimeDTO> businessTimeList;
private String location;
private String address;
public Integer getStoreId() {
return storeId;
......@@ -238,4 +240,20 @@ public class StoreEsDTO implements Serializable {
public void setBusinessTimeList(List<StoreBusinessTimeDTO> businessTimeList) {
this.businessTimeList = businessTimeList;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
......@@ -17,6 +17,8 @@ public class StoreSearchDTO implements Serializable {
private Integer storeBrandId;
private String searchJson;
private String authSearchJson;
private String latitude;
private String longitude;
private Integer currentPage=1;
private Integer pageSize=20;
......@@ -147,4 +149,20 @@ public class StoreSearchDTO implements Serializable {
public void setAuthSearchJson(String authSearchJson) {
this.authSearchJson = authSearchJson;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
}
......@@ -369,7 +369,13 @@ public class StoreApiServiceImpl implements StoreApiService {
return EnterpriseServiceResponse.failure(ErrorCode.ENTERPRISE_EMPTY);
}
JSONObject enterpriseJson = this.buildSearchJSON(storeSearchDTO);
JSONObject sortJson = QueryConditionAssemblyUtil.createSortNode(StoreESFieldsEnum.STORECODE.getField(), QueryConditionAssemblyUtil.SORT_RULE_ASC);
JSONObject sortJson = null;
if(StringUtils.isNotBlank(storeSearchDTO.getLatitude()) && StringUtils.isNotBlank(storeSearchDTO.getLatitude())){
sortJson = QueryConditionAssemblyUtil.createSortNodeByLocation(StoreESFieldsEnum.LOCATION.getField(), QueryConditionAssemblyUtil.SORT_RULE_ASC,
Double.valueOf(storeSearchDTO.getLatitude()), Double.valueOf(storeSearchDTO.getLongitude()));
}else {
sortJson = QueryConditionAssemblyUtil.createSortNode(StoreESFieldsEnum.STORECODE.getField(), QueryConditionAssemblyUtil.SORT_RULE_ASC);
}
ServiceResponse<ESResponseQueryBatchDTO> response = this.queryStoreFromES(enterpriseJson, pageNum, pageSize, sortJson, returnFileds);
if (response.isSuccess()) {
Page<StoreDTO> page = new Page(pageNum, pageSize);
......@@ -824,6 +830,8 @@ public class StoreApiServiceImpl implements StoreApiService {
esDTO.setOwnType(dto.getOwnType());
esDTO.setBusinessTimeList(dto.getBusinessTimeList());
esDTO.setPhotoList(dto.getPhotoList());
esDTO.setAddress(dto.getAddress());
esDTO.setLocation(dto.getLatitude()+","+dto.getLongitude());
JSONObject jsonObject = JSON.parseObject(JSON.toJSONString(esDTO));
List<StoreExtendDTO> storeExtendDTOList = dto.getStoreExtendList();
for (StoreExtendDTO extendDTO : storeExtendDTOList) {
......@@ -934,6 +942,10 @@ public class StoreApiServiceImpl implements StoreApiService {
jsonObjectList.add(json);
}
}
if(StringUtils.isNotBlank(storeSearchDTO.getLatitude()) && StringUtils.isNotBlank(storeSearchDTO.getLongitude())){
json = QueryConditionAssemblyUtil.createSimpleQueryNode(StoreESFieldsEnum.LOCATION.getField(), OperateEnum.OPERATE_LOCATION, storeSearchDTO.getLatitude()+","+storeSearchDTO.getLongitude());
jsonObjectList.add(json);
}
enterpriseJson = QueryConditionAssemblyUtil.createListQueryNode(jsonObjectList, OperateEnum.OPERATE_AND);
return enterpriseJson;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment