/house/around 完善
This commit is contained in:
+20
-3
@@ -68,6 +68,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -1013,7 +1014,12 @@ public class HouseController {
|
||||
seawater.setCity(house.getCity());
|
||||
seawater.setDistrict(house.getRegion());
|
||||
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.setUnitPrice(house.getAvgPrice() == null || house.getAvgPrice() == 0 ? null : house.getAvgPrice());
|
||||
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 latt = Double.valueOf(split[1]);
|
||||
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 {
|
||||
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);
|
||||
@@ -1129,6 +1140,12 @@ public class HouseController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
Double sub6(Double a) {
|
||||
BigDecimal bd = new BigDecimal(a);
|
||||
BigDecimal bigDecimal = bd.setScale(6, BigDecimal.ROUND_DOWN);
|
||||
return bigDecimal.doubleValue();
|
||||
}
|
||||
|
||||
// 格式化日期为 yyyyMMdd
|
||||
private static int formatDate(Calendar calendar) {
|
||||
int year = calendar.get(Calendar.YEAR);
|
||||
|
||||
Reference in New Issue
Block a user