新增小区第三方均价接口(ApiCode:3004)及测试脚本
- AverageStatistics 新增 xingfuliEsfPrice、maitianEsfPrice 字段 - AverageStatisticsService 新增 findRecentMonths 方法(查询最近N个月数据) - PropertyController 新增 thirdPartyPriceAction(/property/thirdPartyPrice) - 返回幸福里、安居客、房天下、链家、城市房产、吉屋、淘房365、麦田均价 - 仅取二手房价格,最多回溯3个月补全空值 - 新增 opentest 测试脚本:数据提取 + 多线程接口测试 - 更新 claude 技能文档:修正本地端口、seaweed集合字段说明、Groovy static 限制 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+102
@@ -6859,6 +6859,108 @@ public class PropertyController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 小区第三方均价接口
|
||||
* ApiCode: 3004
|
||||
* 根据小区id获取最新月份的第三方均价
|
||||
*/
|
||||
public Object thirdPartyPriceAction(@Param(name = "id") String id) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
|
||||
if (StringUtils.isBlank(id)) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("参数缺失:id(小区ID)是必须参数"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
District district = districtService.findById(id);
|
||||
if (district == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("该小区不存在"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
List<AverageStatistics> statsList = averageStatisticsService.findRecentMonths(
|
||||
district.getCity(), district.getRegion(), district.getName(), district.getCategory(), 3);
|
||||
|
||||
UniversalDto result = UniversalDto.newDto();
|
||||
result.append("id", id);
|
||||
result.append("city", district.getCity());
|
||||
result.append("district", district.getRegion());
|
||||
result.append("name", district.getName());
|
||||
|
||||
if (statsList != null && !statsList.isEmpty()) {
|
||||
result.append("date", statsList.get(0).getShortDate());
|
||||
|
||||
Integer xinfuliAvgPrice = null;
|
||||
Integer anjukeAvgPrice = null;
|
||||
Integer fangAvgPrice = null;
|
||||
Integer lianjiaAvgPrice = null;
|
||||
Integer cityhouseAvgPrice = null;
|
||||
Integer jiwuAvgPrice = null;
|
||||
Integer taofangAvgPrice = null;
|
||||
Integer maitianAvgPrice = null;
|
||||
|
||||
for (AverageStatistics stats : statsList) {
|
||||
if (xinfuliAvgPrice == null && stats.getXingfuliEsfPrice() != null && stats.getXingfuliEsfPrice() > 0) {
|
||||
xinfuliAvgPrice = stats.getXingfuliEsfPrice();
|
||||
}
|
||||
if (anjukeAvgPrice == null) {
|
||||
anjukeAvgPrice = getFirstValidThirdPrice(stats.getAnjukePrice(), stats.getAnjukeEsfPrice());
|
||||
}
|
||||
if (fangAvgPrice == null && stats.getSoufangEsfPrice() != null && stats.getSoufangEsfPrice() > 0) {
|
||||
fangAvgPrice = stats.getSoufangEsfPrice();
|
||||
}
|
||||
if (lianjiaAvgPrice == null && stats.getLianjiaEsfPrice() != null && stats.getLianjiaEsfPrice() > 0) {
|
||||
lianjiaAvgPrice = stats.getLianjiaEsfPrice();
|
||||
}
|
||||
if (cityhouseAvgPrice == null && stats.getCityhouseEsfPrice() != null && stats.getCityhouseEsfPrice() > 0) {
|
||||
cityhouseAvgPrice = stats.getCityhouseEsfPrice();
|
||||
}
|
||||
if (jiwuAvgPrice == null && stats.getJiwuEsfPrice() != null && stats.getJiwuEsfPrice() > 0) {
|
||||
jiwuAvgPrice = stats.getJiwuEsfPrice();
|
||||
}
|
||||
if (taofangAvgPrice == null && stats.getTsfhouseEsfPrice() != null && stats.getTsfhouseEsfPrice() > 0) {
|
||||
taofangAvgPrice = stats.getTsfhouseEsfPrice();
|
||||
}
|
||||
if (maitianAvgPrice == null && stats.getMaitianEsfPrice() != null && stats.getMaitianEsfPrice() > 0) {
|
||||
maitianAvgPrice = stats.getMaitianEsfPrice();
|
||||
}
|
||||
}
|
||||
|
||||
result.append("xinfuliAvgPrice", xinfuliAvgPrice);
|
||||
result.append("anjukeAvgPrice", anjukeAvgPrice);
|
||||
result.append("fangAvgPrice", fangAvgPrice);
|
||||
result.append("lianjiaAvgPrice", lianjiaAvgPrice);
|
||||
result.append("cityhouseAvgPrice", cityhouseAvgPrice);
|
||||
result.append("jiwuAvgPrice", jiwuAvgPrice);
|
||||
result.append("taofangAvgPrice", taofangAvgPrice);
|
||||
result.append("maitianAvgPrice", maitianAvgPrice);
|
||||
} else {
|
||||
result.append("date", null);
|
||||
result.append("xinfuliAvgPrice", null);
|
||||
result.append("anjukeAvgPrice", null);
|
||||
result.append("fangAvgPrice", null);
|
||||
result.append("lianjiaAvgPrice", null);
|
||||
result.append("cityhouseAvgPrice", null);
|
||||
result.append("jiwuAvgPrice", null);
|
||||
result.append("taofangAvgPrice", null);
|
||||
result.append("maitianAvgPrice", null);
|
||||
}
|
||||
|
||||
List<UniversalDto> resultList = new ArrayList<UniversalDto>();
|
||||
resultList.add(result);
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(resultList));
|
||||
return mav;
|
||||
}
|
||||
|
||||
private Integer getFirstValidThirdPrice(Integer... prices) {
|
||||
for (Integer p : prices) {
|
||||
if (p != null && p > 0) {
|
||||
return p;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private List<HouseCaseDto> createDealHouseCase(List<HouseCaseDto> caseDtos, List<DealPrice> dealPrices,int distance, Integer showSource){
|
||||
|
||||
Reference in New Issue
Block a user