/house/around 完善

This commit is contained in:
majintao
2024-12-05 14:01:13 +08:00
parent b5071ce01a
commit 657fa827c6
@@ -68,6 +68,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.validation.Valid; import javax.validation.Valid;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@@ -1013,7 +1014,12 @@ public class HouseController {
seawater.setCity(house.getCity()); seawater.setCity(house.getCity());
seawater.setDistrict(house.getRegion()); seawater.setDistrict(house.getRegion());
seawater.setAddress(house.getAddress()); seawater.setAddress(house.getAddress());
seawater.setName(house.getDistrictName()); String districtName = house.getDistrictName();
if (!"暂无数据".equals(districtName) && StringUtils.isNotBlank(districtName)) {
seawater.setName(districtName);
}else {
seawater.setName(house.getName());
}
seawater.setSize(house.getArea() == null || house.getArea() == 0 ? null : house.getArea()); seawater.setSize(house.getArea() == null || house.getArea() == 0 ? null : house.getArea());
seawater.setUnitPrice(house.getAvgPrice() == null || house.getAvgPrice() == 0 ? null : house.getAvgPrice()); seawater.setUnitPrice(house.getAvgPrice() == null || house.getAvgPrice() == 0 ? null : house.getAvgPrice());
seawater.setTotalPrice(house.getTotalPrice() == null || house.getTotalPrice() == 0 ? null : house.getTotalPrice()); seawater.setTotalPrice(house.getTotalPrice() == null || house.getTotalPrice() == 0 ? null : house.getTotalPrice());
@@ -1041,9 +1047,14 @@ public class HouseController {
Double lon = Double.valueOf(split[0]); Double lon = Double.valueOf(split[0]);
Double latt = Double.valueOf(split[1]); Double latt = Double.valueOf(split[1]);
Map<String, Double> toBd09 = GeoUtils.gcj02ToBd09(latt, lon); Map<String, Double> toBd09 = GeoUtils.gcj02ToBd09(latt, lon);
seawater.setLocation(toBd09.get("lng") + "," + toBd09.get("lat")); seawater.setLocation(sub6(toBd09.get("lng")) + "," + sub6(toBd09.get("lat")));
} else { } else {
seawater.setLocation(house.getLocation()); 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);
@@ -1129,6 +1140,12 @@ public class HouseController {
return mav; return mav;
} }
Double sub6(Double a) {
BigDecimal bd = new BigDecimal(a);
BigDecimal bigDecimal = bd.setScale(6, BigDecimal.ROUND_DOWN);
return bigDecimal.doubleValue();
}
// 格式化日期为 yyyyMMdd // 格式化日期为 yyyyMMdd
private static int formatDate(Calendar calendar) { private static int formatDate(Calendar calendar) {
int year = calendar.get(Calendar.YEAR); int year = calendar.get(Calendar.YEAR);