/house/around 完善

This commit is contained in:
majintao
2024-12-06 13:16:47 +08:00
parent 657fa827c6
commit 0bec20be41
3 changed files with 103 additions and 33 deletions
@@ -376,6 +376,12 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
if(source.containsKey("elevator")){
seawater.setElevator(source.getString("elevator"));
}
if(source.containsKey("level")){
seawater.setLevel(source.getString("level"));
}
if(source.containsKey("business_range")){
seawater.setBusinessRange(source.getString("business_range"));
}
try {
seawater.setDistance((int)jsonList.get(i).getJSONArray("sort").getDouble(0));
}catch (Exception e){
@@ -84,6 +84,20 @@ public class Seawater implements SeawaterEntity {
private String location;
private String title;
// 商铺经营范围
private String businessScope;
private String businessRange;
//商铺类型
private String shopType;
// 写字楼等级
private String level;
@Id
@Column(name = "_id")
public String getId() {
@@ -473,4 +487,46 @@ public class Seawater implements SeawaterEntity {
public void setLocation(String location) {
this.location = location;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getBusinessScope() {
return businessScope;
}
public void setBusinessScope(String businessScope) {
this.businessScope = businessScope;
}
public String getShopType() {
return shopType;
}
public void setShopType(String shopType) {
this.shopType = shopType;
}
@Column(name = "level")
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
@Column(name = "business_range")
public String getBusinessRange() {
return businessRange;
}
public void setBusinessRange(String businessRange) {
this.businessRange = businessRange;
}
}
@@ -1014,11 +1014,21 @@ public class HouseController {
seawater.setCity(house.getCity());
seawater.setDistrict(house.getRegion());
seawater.setAddress(house.getAddress());
String districtName = house.getDistrictName();
if (!"暂无数据".equals(districtName) && StringUtils.isNotBlank(districtName)) {
seawater.setName(districtName);
}else {
seawater.setName(house.getName());
seawater.setName(house.getDistrictName());
String name = house.getName();
if (!"暂无数据".equals(name) && StringUtils.isNotBlank(name)) {
seawater.setTitle(name);
}
if (cat.contains("office")){
seawater.setLevel(house.getLevel());
}
if (cat.contains("shop")){
if (StringUtils.isNotBlank(house.getEstateType()) && !"其他".equals(house.getEstateType())){
seawater.setShopType(house.getEstateType());
}
if (StringUtils.isNotBlank(house.getBusinessRange())){
seawater.setBusinessScope(house.getBusinessRange());
}
}
seawater.setSize(house.getArea() == null || house.getArea() == 0 ? null : house.getArea());
seawater.setUnitPrice(house.getAvgPrice() == null || house.getAvgPrice() == 0 ? null : house.getAvgPrice());
@@ -1029,37 +1039,36 @@ public class HouseController {
seawater.setRoom(house.getRoom() == null || house.getRoom() == 0 ? null : house.getRoom());
seawater.setHall(house.getHall() == null || house.getHall() == 0 ? null : house.getHall());
seawater.setToilet(house.getToilet() == null || house.getToilet() == 0 ? null : house.getToilet());
if (house.getAvgPrice() != null && house.getAvgPrice() != 0) {
seawater.setDecoration(house.getFitment());
if (house.getpDate() != null && house.getpDate() > 10000000) {
String numberStr = String.valueOf(house.getpDate());
// 拆分字符串并格式化
String year = numberStr.substring(0, 4); // 前四位是年份
String month = numberStr.substring(4, 6); // 中间两位是月份
String day = numberStr.substring(6, 8); // 最后两位是日期
String formattedDate = year + "-" + month + "-" + day;
seawater.setPublishDate(formattedDate);
}
seawater.setDistance(house.getDistance());
if (StringUtils.isNotBlank(house.getLocation())) {
if ("2".equals(model.getLocationType())) {
String[] split = house.getLocation().split(",");
Double lon = Double.valueOf(split[0]);
Double latt = Double.valueOf(split[1]);
Map<String, Double> toBd09 = GeoUtils.gcj02ToBd09(latt, lon);
seawater.setLocation(sub6(toBd09.get("lng")) + "," + sub6(toBd09.get("lat")));
} else {
String location = house.getLocation();
String[] split = location.split(",");
if (split.length == 2) {
String location1 = sub6(Double.valueOf(split[0])) + "," + sub6(Double.valueOf(split[1]));
seawater.setLocation(location1);
}
seawater.setDecoration(house.getFitment());
if (house.getpDate() != null && house.getpDate() > 10000000) {
String numberStr = String.valueOf(house.getpDate());
// 拆分字符串并格式化
String year = numberStr.substring(0, 4); // 前四位是年份
String month = numberStr.substring(4, 6); // 中间两位是月份
String day = numberStr.substring(6, 8); // 最后两位是日期
String formattedDate = year + "-" + month + "-" + day;
seawater.setPublishDate(formattedDate);
}
seawater.setDistance(house.getDistance());
if (StringUtils.isNotBlank(house.getLocation())) {
if ("2".equals(model.getLocationType())) {
String[] split = house.getLocation().split(",");
Double lon = Double.valueOf(split[0]);
Double latt = Double.valueOf(split[1]);
Map<String, Double> toBd09 = GeoUtils.gcj02ToBd09(latt, lon);
seawater.setLocation(sub6(toBd09.get("lng")) + "," + sub6(toBd09.get("lat")));
} else {
String location = house.getLocation();
String[] split = location.split(",");
if (split.length == 2) {
String location1 = sub6(Double.valueOf(split[0])) + "," + sub6(Double.valueOf(split[1]));
seawater.setLocation(location1);
}
}
houseList.add(seawater);
}
houseList.add(seawater);
}
}
// } else {
// if ("sell".equals(cat)) {
// List<House> houseByLocation = houseService.findNearestHasHouseByLocation(model.getCity(), lat, lng, cat, model.getRadius(), 5);
@@ -1129,7 +1138,6 @@ public class HouseController {
// }
// }
// }
}
BasicModel basicModel = new BasicModel(200, "ok");