This commit is contained in:
2022-07-28 09:42:27 +08:00
49 changed files with 1260 additions and 316 deletions
@@ -90,12 +90,12 @@
</td> </td>
</tr> </tr>
<tr> <tr>
<td>价格类型</td> <td>估价类型</td>
<td> <td>
<select id="slt_priceType" name="priceType" style="width: 100px"> <select id="slt_priceType" name="priceType" style="width: 100px">
<option value=""></option> <option value=""></option>
<option value="2B" <#if apiUserBo.priceType?? && apiUserBo.priceType?index_of("2B")!=-1>selected</#if>>2B</option> <option value="sell" <#if apiUserBo.priceType?? && apiUserBo.priceType?index_of("sell")!=-1>selected</#if>>挂牌价</option>
<option value="2C" <#if apiUserBo.priceType?? && apiUserBo.priceType?index_of("2C")!=-1>selected</#if>>2C</option> <option value="evaluate" <#if apiUserBo.priceType?? && apiUserBo.priceType?index_of("evaluate")!=-1>selected</#if>>评估价</option>
</select> </select>
</td> </td>
</tr> </tr>
@@ -227,7 +227,7 @@
<td colspan="2"><b>兔博士</b></td> <td colspan="2"><b>兔博士</b></td>
</#if> </#if>
<#if (it.centanetNewPrice)?? || (it.centanetEsfPrice)??> <#if (it.zhongyuanNewPrice)?? || (it.zhongyuanEsfPrice)??>
<td colspan="2"><b>中原地产</b></td> <td colspan="2"><b>中原地产</b></td>
</#if> </#if>
<#if (it.leyoujiaNewPrice)?? || (it.leyoujiaEsfPrice)??> <#if (it.leyoujiaNewPrice)?? || (it.leyoujiaEsfPrice)??>
@@ -247,7 +247,13 @@
</#if> </#if>
<#if (it.yungujiaNewPrice)?? || (it.yungujiaEsfPrice)??> <#if (it.yungujiaNewPrice)?? || (it.yungujiaEsfPrice)??>
<td colspan="2"><b>云估价</b></td> <td colspan="2"><b>云估价</b></td>
</#if> </#if>
<#if (it.jiwuNewPrice)?? || (it.jiwuEsfPrice)??>
<td colspan="2"><b>吉屋</b></td>
</#if>
<#if (it.tsfhouseNewPrice)?? || (it.tsfhouseEsfPrice)??>
<td colspan="2"><b>365房产</b></td>
</#if>
</tr> </tr>
<tr> <tr>
@@ -300,7 +306,7 @@
<td style="width:70px;color:#D3750A">二手房</td> <td style="width:70px;color:#D3750A">二手房</td>
</#if> </#if>
<#if (it.centanetNewPrice)?? || (it.centanetEsfPrice)??> <#if (it.zhongyuanNewPrice)?? || (it.zhongyuanEsfPrice)??>
<td style="width:70px;color:#0C88C7">新房</td> <td style="width:70px;color:#0C88C7">新房</td>
<td style="width:70px;color:#D3750A">二手房</td> <td style="width:70px;color:#D3750A">二手房</td>
</#if> </#if>
@@ -329,10 +335,17 @@
</#if> </#if>
<#if (it.yungujiaNewPrice)?? || (it.yungujiaEsfPrice)??> <#if (it.yungujiaNewPrice)?? || (it.yungujiaEsfPrice)??>
<td style="width:70px;color:#0C88C7">新房</td> <td style="width:70px;color:#0C88C7">新房</td>
<td style="width:70px;color:#D3750A">二手房</td> <td style="width:70px;color:#D3750A">二手房</td>
</#if> </#if>
<#if (it.jiwuNewPrice)?? || (it.jiwuEsfPrice)??>
<td style="width:70px;color:#0C88C7">新房</td>
<td style="width:70px;color:#D3750A">二手房</td>
</#if>
<#if (it.tsfhouseNewPrice)?? || (it.tsfhouseEsfPrice)??>
<td style="width:70px;color:#0C88C7">新房</td>
<td style="width:70px;color:#D3750A">二手房</td>
</#if>
</tr> </tr>
<tr> <tr>
@@ -392,9 +405,9 @@
<td style ="color:#D3750A">${it.tuboshiEsfPrice!}</td> <td style ="color:#D3750A">${it.tuboshiEsfPrice!}</td>
</#if> </#if>
<#if (it.centanetNewPrice)?? || (it.centanetEsfPrice)??> <#if (it.zhongyuanNewPrice)?? || (it.zhongyuanEsfPrice)??>
<td style ="color:#0C88C7">${it.centanetNewPrice!}</td> <td style ="color:#0C88C7">${it.zhongyuanNewPrice!}</td>
<td style ="color:#D3750A">${it.centanetEsfPrice!}</td> <td style ="color:#D3750A">${it.zhongyuanEsfPrice!}</td>
</#if> </#if>
<#if (it.leyoujiaNewPrice)?? || (it.leyoujiaEsfPrice)??> <#if (it.leyoujiaNewPrice)?? || (it.leyoujiaEsfPrice)??>
@@ -422,7 +435,15 @@
<td style ="color:#0C88C7">${it.yungujiaNewPrice!}</td> <td style ="color:#0C88C7">${it.yungujiaNewPrice!}</td>
<td style ="color:#D3750A">${it.yungujiaEsfPrice!}</td> <td style ="color:#D3750A">${it.yungujiaEsfPrice!}</td>
</#if> </#if>
<#if (it.jiwuNewPrice)?? || (it.jiwuEsfPrice)??>
<td style ="color:#0C88C7">${it.jiwuNewPrice!}</td>
<td style ="color:#D3750A">${it.jiwuEsfPrice!}</td>
</#if>
<#if (it.tsfhouseNewPrice)?? || (it.tsfhouseEsfPrice)??>
<td style ="color:#0C88C7">${it.tsfhouseNewPrice!}</td>
<td style ="color:#D3750A">${it.tsfhouseEsfPrice!}</td>
</#if>
</tr> </tr>
</#list> </#list>
<#if averageStatistics?size == 0> <#if averageStatistics?size == 0>
@@ -74,7 +74,7 @@
<label class="checkbox"><input type="checkbox" id="col13" temp="13" rank="1" name="chkCol">Mapabc经纬度覆盖率</label> <label class="checkbox"><input type="checkbox" id="col13" temp="13" rank="1" name="chkCol">Mapabc经纬度覆盖率</label>
<label class="checkbox"><input type="checkbox" id="col14" temp="14" rank="1" name="chkCol" checked>百度经纬度覆盖率</label> <label class="checkbox"><input type="checkbox" id="col14" temp="14" rank="1" name="chkCol" checked>百度经纬度覆盖率</label>
<label class="checkbox"><input type="checkbox" id="col15" temp="15" rank="1" name="chkCol" checked>统计周</label> <label class="checkbox"><input type="checkbox" id="col15" temp="15" rank="1" name="chkCol" checked>统计周</label>
<label class="checkbox"><input type="checkbox" id="col16" temp="16" rank="1" name="chkCol" checked>租金覆盖率</label> <#-- <label class="checkbox"><input type="checkbox" id="col16" temp="16" rank="1" name="chkCol" checked>租金覆盖率</label>-->
<label class="checkbox"><input type="checkbox" id="col17" temp="17" rank="1" name="chkCol" checked>等级</label> <label class="checkbox"><input type="checkbox" id="col17" temp="17" rank="1" name="chkCol" checked>等级</label>
<div style="float: right;"> <div style="float: right;">
@@ -234,7 +234,7 @@
</th> </th>
<th width="6.25%" name="col13" class="dn">Mapabc经纬度<br/>覆盖率</th> <th width="6.25%" name="col13" class="dn">Mapabc经纬度<br/>覆盖率</th>
<th width="6.25%" name="col14" >百度经纬度<br/>覆盖率</th> <th width="6.25%" name="col14" >百度经纬度<br/>覆盖率</th>
<th width="6.25%" name="col16">租金覆盖率</th> <#-- <th width="6.25%" name="col16">租金覆盖率</th>-->
<th width="6.25%" name="col15">统计周</th> <th width="6.25%" name="col15">统计周</th>
</tr> </tr>
@@ -269,7 +269,7 @@
<td width="6.25%" name="col12" class="dn"><#if info.priceToEva??>${info.priceToEva * 100}%<#else>未知</#if></td> <td width="6.25%" name="col12" class="dn"><#if info.priceToEva??>${info.priceToEva * 100}%<#else>未知</#if></td>
<td width="6.25%" name="col13" class="dn"><#if info.districtDetail.latLng??>${info.districtDetail.latLng * 100}%<#else>未知</#if></td> <td width="6.25%" name="col13" class="dn"><#if info.districtDetail.latLng??>${info.districtDetail.latLng * 100}%<#else>未知</#if></td>
<td width="6.25%" name="col14"><#if info.districtDetail.latLng2??>${info.districtDetail.latLng2 * 100}%<#else>未知</#if></td> <td width="6.25%" name="col14"><#if info.districtDetail.latLng2??>${info.districtDetail.latLng2 * 100}%<#else>未知</#if></td>
<td width="6.25%" name="col16"><#if info.districtDetail.rentPrice??>${info.districtDetail.rentPrice * 100}%<#else>未知</#if></td> <#-- <td width="6.25%" name="col16"><#if info.districtDetail.rentPrice??>${info.districtDetail.rentPrice * 100}%<#else>未知</#if></td>-->
<td width="6.25%" name="col15">${info.weekend?string('yyyy-MM-dd')} <a href="../data/cityShow?infoId=${info.id!}" target="_blank">详细</a></td> <td width="6.25%" name="col15">${info.weekend?string('yyyy-MM-dd')} <a href="../data/cityShow?infoId=${info.id!}" target="_blank">详细</a></td>
</tr> </tr>
</#list> </#list>
@@ -306,7 +306,7 @@
<label class="checkbox"><input type="checkbox" id="col13" temp="13" rank="1" name="chkCol">Mapabc经纬度覆盖率</label> <label class="checkbox"><input type="checkbox" id="col13" temp="13" rank="1" name="chkCol">Mapabc经纬度覆盖率</label>
<label class="checkbox"><input type="checkbox" id="col14" temp="14" rank="1" name="chkCol" checked>百度经纬度覆盖率</label> <label class="checkbox"><input type="checkbox" id="col14" temp="14" rank="1" name="chkCol" checked>百度经纬度覆盖率</label>
<label class="checkbox"><input type="checkbox" id="col15" temp="15" rank="1" name="chkCol" checked>统计周</label> <label class="checkbox"><input type="checkbox" id="col15" temp="15" rank="1" name="chkCol" checked>统计周</label>
<label class="checkbox"><input type="checkbox" id="col16" temp="16" rank="1" name="chkCol" checked>租金覆盖率</label> <#-- <label class="checkbox"><input type="checkbox" id="col16" temp="16" rank="1" name="chkCol" checked>租金覆盖率</label>-->
<label class="checkbox"><input type="checkbox" id="col17" temp="17" rank="1" name="chkCol" checked>等级</label> <label class="checkbox"><input type="checkbox" id="col17" temp="17" rank="1" name="chkCol" checked>等级</label>
<span style="float: right; margin-right: 50px;"><img src="../images/script-excel.png"><a id="export" style="cursor:pointer;">导出</a> <span style="float: right; margin-right: 50px;"><img src="../images/script-excel.png"><a id="export" style="cursor:pointer;">导出</a>
@@ -444,7 +444,7 @@
</th> </th>
<th width="6.25%" name="col13" class="dn">Mapabc经纬度<br/>覆盖率</th> <th width="6.25%" name="col13" class="dn">Mapabc经纬度<br/>覆盖率</th>
<th width="6.25%" name="col14" >百度经纬度<br/>覆盖率</th> <th width="6.25%" name="col14" >百度经纬度<br/>覆盖率</th>
<th width="6.25%" name="col16">租金覆盖率</th> <#-- <th width="6.25%" name="col16">租金覆盖率</th>-->
<th width="6.25%" name="col15">统计周</th> <th width="6.25%" name="col15">统计周</th>
</tr> </tr>
@@ -478,7 +478,7 @@
<td width="6.25%" name="col12" class="dn"><#if info.priceToEva??>${info.priceToEva * 100}%<#else>未知</#if></td> <td width="6.25%" name="col12" class="dn"><#if info.priceToEva??>${info.priceToEva * 100}%<#else>未知</#if></td>
<td width="6.25%" name="col13" class="dn"><#if info.shopDetail.latLng??>${info.shopDetail.latLng * 100}%<#else>未知</#if></td> <td width="6.25%" name="col13" class="dn"><#if info.shopDetail.latLng??>${info.shopDetail.latLng * 100}%<#else>未知</#if></td>
<td width="6.25%" name="col14"><#if info.shopDetail.latLng2??>${info.shopDetail.latLng2 * 100}%<#else>未知</#if></td> <td width="6.25%" name="col14"><#if info.shopDetail.latLng2??>${info.shopDetail.latLng2 * 100}%<#else>未知</#if></td>
<td width="6.25%" name="col16"><#if info.shopDetail.rentPrice??>${info.shopDetail.rentPrice * 100}%<#else>0</#if></td> <#-- <td width="6.25%" name="col16"><#if info.shopDetail.rentPrice??>${info.shopDetail.rentPrice * 100}%<#else>0</#if></td>-->
<td width="6.25%" name="col15">${info.weekend?string('yyyy-MM-dd')} <a href="../data/cityShow?infoId=${info.id!}#lB" target="_blank">详细</a></td> <td width="6.25%" name="col15">${info.weekend?string('yyyy-MM-dd')} <a href="../data/cityShow?infoId=${info.id!}#lB" target="_blank">详细</a></td>
</tr> </tr>
</#list> </#list>
@@ -515,7 +515,7 @@
<label class="checkbox"><input type="checkbox" id="col13" temp="13" rank="1" name="chkCol">Mapabc经纬度覆盖率</label> <label class="checkbox"><input type="checkbox" id="col13" temp="13" rank="1" name="chkCol">Mapabc经纬度覆盖率</label>
<label class="checkbox"><input type="checkbox" id="col14" temp="14" rank="1" name="chkCol" checked>百度经纬度覆盖率</label> <label class="checkbox"><input type="checkbox" id="col14" temp="14" rank="1" name="chkCol" checked>百度经纬度覆盖率</label>
<label class="checkbox"><input type="checkbox" id="col15" temp="15" rank="1" name="chkCol" checked>统计周</label> <label class="checkbox"><input type="checkbox" id="col15" temp="15" rank="1" name="chkCol" checked>统计周</label>
<label class="checkbox"><input type="checkbox" id="col16" temp="16" rank="1" name="chkCol" checked>租金覆盖率</label> <#-- <label class="checkbox"><input type="checkbox" id="col16" temp="16" rank="1" name="chkCol" checked>租金覆盖率</label>-->
<label class="checkbox"><input type="checkbox" id="col17" temp="17" rank="1" name="chkCol" checked>等级</label> <label class="checkbox"><input type="checkbox" id="col17" temp="17" rank="1" name="chkCol" checked>等级</label>
<span style="float: right; margin-right: 50px;"><img src="../images/script-excel.png"><a id="export" style="cursor:pointer;">导出</a> <span style="float: right; margin-right: 50px;"><img src="../images/script-excel.png"><a id="export" style="cursor:pointer;">导出</a>
@@ -653,7 +653,7 @@
</th> </th>
<th width="6.25%" name="col13" class="dn">Mapabc经纬度<br/>覆盖率</th> <th width="6.25%" name="col13" class="dn">Mapabc经纬度<br/>覆盖率</th>
<th width="6.25%" name="col14" >百度经纬度<br/>覆盖率</th> <th width="6.25%" name="col14" >百度经纬度<br/>覆盖率</th>
<th width="6.25%" name="col16">租金覆盖率</th> <#-- <th width="6.25%" name="col16">租金覆盖率</th>-->
<th width="6.25%" name="col15">统计周</th> <th width="6.25%" name="col15">统计周</th>
</tr> </tr>
@@ -687,7 +687,7 @@
<td width="6.25%" name="col12" class="dn"><#if info.priceToEva??>${info.priceToEva * 100}%<#else>未知</#if></td> <td width="6.25%" name="col12" class="dn"><#if info.priceToEva??>${info.priceToEva * 100}%<#else>未知</#if></td>
<td width="6.25%" name="col13" class="dn"><#if info.officeDetail.latLng??>${info.officeDetail.latLng * 100}%<#else>未知</#if></td> <td width="6.25%" name="col13" class="dn"><#if info.officeDetail.latLng??>${info.officeDetail.latLng * 100}%<#else>未知</#if></td>
<td width="6.25%" name="col14"><#if info.officeDetail.latLng2??>${info.officeDetail.latLng2 * 100}%<#else>未知</#if></td> <td width="6.25%" name="col14"><#if info.officeDetail.latLng2??>${info.officeDetail.latLng2 * 100}%<#else>未知</#if></td>
<td width="6.25%" name="col16"><#if info.officeDetail.rentPrice??>${info.officeDetail.rentPrice * 100}%<#else>0</#if></td> <#-- <td width="6.25%" name="col16"><#if info.officeDetail.rentPrice??>${info.officeDetail.rentPrice * 100}%<#else>0</#if></td>-->
<td width="6.25%" name="col15">${info.weekend?string('yyyy-MM-dd')} <a href="../data/cityShow?infoId=${info.id!}#lC" target="_blank">详细</a></td> <td width="6.25%" name="col15">${info.weekend?string('yyyy-MM-dd')} <a href="../data/cityShow?infoId=${info.id!}#lC" target="_blank">详细</a></td>
</tr> </tr>
</#list> </#list>
@@ -102,6 +102,7 @@ public class PaiMai implements MongoEntity {
private String houseNum; private String houseNum;
private String unitNum; private String unitNum;
private String roomNum; private String roomNum;
private String estateType;
@Id @Id
@GeneratedValue @GeneratedValue
@@ -492,6 +493,7 @@ public class PaiMai implements MongoEntity {
this.matchEstateType = matchEstateType; this.matchEstateType = matchEstateType;
} }
@Column(name = "houseNum")
public String getHouseNum() { public String getHouseNum() {
return houseNum; return houseNum;
} }
@@ -500,6 +502,7 @@ public class PaiMai implements MongoEntity {
this.houseNum = houseNum; this.houseNum = houseNum;
} }
@Column(name = "unitNum")
public String getUnitNum() { public String getUnitNum() {
return unitNum; return unitNum;
} }
@@ -508,6 +511,7 @@ public class PaiMai implements MongoEntity {
this.unitNum = unitNum; this.unitNum = unitNum;
} }
@Column(name = "roomNum")
public String getRoomNum() { public String getRoomNum() {
return roomNum; return roomNum;
} }
@@ -515,4 +519,13 @@ public class PaiMai implements MongoEntity {
public void setRoomNum(String roomNum) { public void setRoomNum(String roomNum) {
this.roomNum = roomNum; this.roomNum = roomNum;
} }
@Column(name = "estateType")
public String getEstateType() {
return estateType;
}
public void setEstateType(String estateType) {
this.estateType = estateType;
}
} }
@@ -95,10 +95,10 @@ public class AverageStatistics implements MongoEntity {
private Double tuboshiEsfDiff; private Double tuboshiEsfDiff;
/**中原地产二手房均价*/ /**中原地产二手房均价*/
private Integer centanetNewPrice; private Integer zhongyuanNewPrice;
private Double centanetNewDiff; private Double zhongyuanNewDiff;
private Integer centanetEsfPrice; private Integer zhongyuanEsfPrice;
private Double centanetEsfDiff; private Double zhongyuanEsfDiff;
@@ -155,9 +155,18 @@ public class AverageStatistics implements MongoEntity {
private Integer zhugezhaofangNewPrice; private Integer zhugezhaofangNewPrice;
private Double zhugezhaofangNewDiff; private Double zhugezhaofangNewDiff;
/**吉屋*/
private Integer jiwuEsfPrice;
private Double jiwuEsfDiff;
private Integer jiwuNewPrice;
private Double jiwuNewDiff;
/**365*/
private Integer tsfhouseEsfPrice;
private Double tsfhouseEsfDiff;
private Integer tsfhouseNewPrice;
private Double tsfhouseNewDiff;
private String level;//价格评级 private String level;//价格评级
private Integer lastAvgPrice;//最终价 private Integer lastAvgPrice;//最终价
private String maxDeviate;//偏离度最大的网站,房价网-云估价-房估估 private String maxDeviate;//偏离度最大的网站,房价网-云估价-房估估
@@ -578,22 +587,22 @@ public class AverageStatistics implements MongoEntity {
this.fangguguNewPrice = fangguguNewPrice; this.fangguguNewPrice = fangguguNewPrice;
} }
@Column(name = "centanet_new_price") @Column(name = "zhongyuan_new_price")
public Integer getCentanetNewPrice() { public Integer getZhongyuanNewPrice() {
return centanetNewPrice; return zhongyuanNewPrice;
} }
public void setCentanetNewPrice(Integer centanetNewPrice) { public void setZhongyuanNewPrice(Integer zhongyuanNewPrice) {
this.centanetNewPrice = centanetNewPrice; this.zhongyuanNewPrice = zhongyuanNewPrice;
} }
@Column(name = "centanet_esf_price") @Column(name = "zhongyuan_esf_price")
public Integer getCentanetEsfPrice() { public Integer getZhongyuanEsfPrice() {
return centanetEsfPrice; return zhongyuanEsfPrice;
} }
public void setCentanetEsfPrice(Integer centanetEsfPrice) { public void setZhongyuanEsfPrice(Integer zhongyuanEsfPrice) {
this.centanetEsfPrice = centanetEsfPrice; this.zhongyuanEsfPrice = zhongyuanEsfPrice;
} }
@Column(name = "lianjia_esf_price") @Column(name = "lianjia_esf_price")
@@ -659,22 +668,22 @@ public class AverageStatistics implements MongoEntity {
this.tuboshiEsfDiff = tuboshiEsfDiff; this.tuboshiEsfDiff = tuboshiEsfDiff;
} }
@Column(name = "centanet_new_diff") @Column(name = "zhongyuan_new_diff")
public Double getCentanetNewDiff() { public Double getZhongyuanNewDiff() {
return centanetNewDiff; return zhongyuanNewDiff;
} }
public void setCentanetNewDiff(Double centanetNewDiff) { public void setZhongyuanNewDiff(Double zhongyuanNewDiff) {
this.centanetNewDiff = centanetNewDiff; this.zhongyuanNewDiff = zhongyuanNewDiff;
} }
@Column(name = "centanet_esf_diff") @Column(name = "zhongyuan_esf_diff")
public Double getCentanetEsfDiff() { public Double getZhongyuanEsfDiff() {
return centanetEsfDiff; return zhongyuanEsfDiff;
} }
public void setCentanetEsfDiff(Double centanetEsfDiff) { public void setZhongyuanEsfDiff(Double zhongyuanEsfDiff) {
this.centanetEsfDiff = centanetEsfDiff; this.zhongyuanEsfDiff = zhongyuanEsfDiff;
} }
@Column(name = "master_district_name") @Column(name = "master_district_name")
@@ -1074,19 +1083,76 @@ public class AverageStatistics implements MongoEntity {
public void setFangtanEsfDiff(Double fangtanEsfDiff) { public void setFangtanEsfDiff(Double fangtanEsfDiff) {
this.fangtanEsfDiff = fangtanEsfDiff; this.fangtanEsfDiff = fangtanEsfDiff;
} }
@Column(name = "jiwu_esf_price")
public Integer getJiwuEsfPrice() {
return jiwuEsfPrice;
}
public void setJiwuEsfPrice(Integer jiwuEsfPrice) {
this.jiwuEsfPrice = jiwuEsfPrice;
}
@Column(name = "jiwu_esf_diff")
public Double getJiwuEsfDiff() {
return jiwuEsfDiff;
}
public void setJiwuEsfDiff(Double jiwuEsfDiff) {
this.jiwuEsfDiff = jiwuEsfDiff;
}
@Column(name = "jiwu_new_price")
public Integer getJiwuNewPrice() {
return jiwuNewPrice;
}
public void setJiwuNewPrice(Integer jiwuNewPrice) {
this.jiwuNewPrice = jiwuNewPrice;
}
@Column(name = "jiwu_new_diff")
public Double getJiwuNewDiff() {
return jiwuNewDiff;
}
public void setJiwuNewDiff(Double jiwuNewDiff) {
this.jiwuNewDiff = jiwuNewDiff;
}
@Column(name = "365house_esf_price")
public Integer getTsfhouseEsfPrice() {
return tsfhouseEsfPrice;
}
public void setTsfhouseEsfPrice(Integer tsfhouseEsfPrice) {
this.tsfhouseEsfPrice = tsfhouseEsfPrice;
}
@Column(name = "365house_esf_diff")
public Double getTsfhouseEsfDiff() {
return tsfhouseEsfDiff;
}
public void setTsfhouseEsfDiff(Double tsfhouseEsfDiff) {
this.tsfhouseEsfDiff = tsfhouseEsfDiff;
}
@Column(name = "365house_new_price")
public Integer getTsfhouseNewPrice() {
return tsfhouseNewPrice;
}
public void setTsfhouseNewPrice(Integer tsfhouseNewPrice) {
this.tsfhouseNewPrice = tsfhouseNewPrice;
}
@Column(name = "365house_new_diff")
public Double getTsfhouseNewDiff() {
return tsfhouseNewDiff;
}
public void setTsfhouseNewDiff(Double tsfhouseNewDiff) {
this.tsfhouseNewDiff = tsfhouseNewDiff;
}
} }
@@ -0,0 +1,11 @@
package com.fangjia.dal.mongo.open.dao;
import com.fangjia.dal.MongoDao;
import com.fangjia.dal.mongo.open.model.EvaluateRatio;
/**
* @author shenjian
* @since 2022/7/27
*/
public interface EvaluateRatioDao extends MongoDao<EvaluateRatio> {
}
@@ -0,0 +1,13 @@
package com.fangjia.dal.mongo.open.dao.impl;
import com.fangjia.dal.MongoDaoImpl;
import com.fangjia.dal.mongo.open.dao.EvaluateRatioDao;
import com.fangjia.dal.mongo.open.model.EvaluateRatio;
/**
* @author shenjian
* @since 2022/7/27
*/
public class EvaluateRatioDaoImpl extends MongoDaoImpl<EvaluateRatio> implements EvaluateRatioDao {
}
@@ -0,0 +1,72 @@
package com.fangjia.dal.mongo.open.model;
import com.fangjia.dal.MongoEntity;
import javax.persistence.*;
/**
* ¹À¼ÛϵÊý
*
* @author shenjian
* @since 2022/7/27
*/
@Entity
@Table(name = "business.evaluate_ratio")
public class EvaluateRatio implements MongoEntity {
private static final long serialVersionUID = 5299813614465690722L;
private String id;
private String category;
private String city;
private String region;
private Double ratio;
@Id
@GeneratedValue
@Column(name = "_id", unique = true, nullable = false)
@Override
public String getId() {
return id;
}
@Override
public void setId(String id) {
this.id = id;
}
@Column(name = "category")
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
@Column(name = "city")
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
@Column(name = "region")
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
@Column(name = "ratio")
public Double getRatio() {
return ratio;
}
public void setRatio(Double ratio) {
this.ratio = ratio;
}
}
@@ -32,7 +32,7 @@ public class AuctionController {
private PaiMaiService paiMaiService; private PaiMaiService paiMaiService;
private DistrictNewPriceService districtNewPriceService; private DistrictNewPriceService districtNewPriceService;
private static final String[] SEARCH_FIELDS = new String[]{"marketAvgPrice", "startDate", "curPrice", "imgUrls", "id", "matchCity", "matchRegion", "matchName", "address", "marketTotalPrice", "startPrice", "curPrice", "predictPrice", "depositPrice", "area", "status", "url", private static final String[] SEARCH_FIELDS = new String[]{"marketAvgPrice", "startDate", "curPrice", "imgUrls", "id", "matchCity", "matchRegion", "matchName", "address", "marketTotalPrice", "startPrice", "curPrice", "predictPrice", "depositPrice", "area", "status", "url",
"matchEstateType","type","count", "tradeAvgPrice", "evaluationPrice"}; "matchEstateType","type","count", "tradeAvgPrice", "evaluationPrice","houseNum","roomNum","unitNum","estateType"};
public Object housesAction(AuctionModel model){ public Object housesAction(AuctionModel model){
RestfulModelAndView mav = new RestfulModelAndView(); RestfulModelAndView mav = new RestfulModelAndView();
@@ -233,8 +233,8 @@ public class DealPriceController {
Integer minPrice = null; Integer minPrice = null;
Integer maxPrice = null; Integer maxPrice = null;
if(bo.getDistrictStat()!=null){ if(bo.getDistrictStat()!=null){
minPrice = (int)(bo.getDistrictStat().getAvgPrice() * 0.9); minPrice = (int)(bo.getDistrictStat().getAvgPrice() * 0.8);
maxPrice = (int)(bo.getDistrictStat().getAvgPrice() * 1.1); maxPrice = (int)(bo.getDistrictStat().getAvgPrice() * 1.2);
} }
Date startDate = null; Date startDate = null;
Date endDate = null; Date endDate = null;
@@ -33,13 +33,13 @@ import com.fangjia.dal.*;
import com.fangjia.dal.mongo.model.*; import com.fangjia.dal.mongo.model.*;
import com.fangjia.dal.mongo.open.model.CommunityBasePrice; import com.fangjia.dal.mongo.open.model.CommunityBasePrice;
import com.fangjia.dal.mongo.open.model.CommunityPoi; import com.fangjia.dal.mongo.open.model.CommunityPoi;
import com.fangjia.dal.mongo.open.model.EvaluateRatio;
import com.fangjia.dal.seawater.dao.SeawaterDao; import com.fangjia.dal.seawater.dao.SeawaterDao;
import com.fangjia.dal.seawater.model.Seawater; import com.fangjia.dal.seawater.model.Seawater;
import com.fangjia.open.dto.*; import com.fangjia.open.dto.*;
import com.fangjia.service.district.*; import com.fangjia.service.district.*;
import com.fangjia.service.mongo.fangjia.*; import com.fangjia.service.mongo.fangjia.*;
import com.fangjia.service.open.*; import com.fangjia.service.open.*;
import com.fangjia.service.open.impl.CommunityPoiServiceImpl;
import com.fangjia.service.util.DistrictScoreUtil; import com.fangjia.service.util.DistrictScoreUtil;
import net.sf.json.JSONArray; import net.sf.json.JSONArray;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
@@ -193,6 +193,7 @@ public class PropertyController {
private DistrictRoomSqmetreRentService districtRoomSqmetreRentService; private DistrictRoomSqmetreRentService districtRoomSqmetreRentService;
private RentDealPriceService rentDealPriceService; private RentDealPriceService rentDealPriceService;
private EvaluateRatioService evaluateRatioService;
private static final int EVALUATE_SHOW_DETAIL = 1; private static final int EVALUATE_SHOW_DETAIL = 1;
private static final Map<String, String> PROPERTY_TYPES = new HashMap<String, String>() { private static final Map<String, String> PROPERTY_TYPES = new HashMap<String, String>() {
@@ -1017,6 +1018,8 @@ public class PropertyController {
} catch (IllegalAccessException e) { } catch (IllegalAccessException e) {
e.printStackTrace(); e.printStackTrace();
} }
this.adjustPriceByRatio(district, evaluation);
} }
// 调整面积不同面积价格 // 调整面积不同面积价格
@@ -1042,7 +1045,7 @@ public class PropertyController {
} }
} }
} catch (Exception ex) { } catch (Exception ex) {
LOGGER.error("调整面积不同面积价格异常{}", ex.getMessage());
} }
if (evaluation.getTotalPrice() != null && evaluation.getTotalPrice() != 0 if (evaluation.getTotalPrice() != null && evaluation.getTotalPrice() != 0
@@ -1128,6 +1131,41 @@ public class PropertyController {
} }
} }
/**
* 系数下调
*
* @param district
* @param evaluation
*/
private void adjustPriceByRatio(District district, Evaluation evaluation) {
try {
ApiUserCfg apiUserCfg_pt = apiUserCfgService.findByUserId(Long.valueOf(evaluation.getFromUserId()), ApiUserCfg.ApiUserCfgKey.PRICE_TYPE);
if (apiUserCfg_pt != null && apiUserCfg_pt.getCfgValue() != null) {
String priceType = apiUserCfg_pt.getCfgValue().toString();
// 评估价则系数调整
if (StringUtils.isNotBlank(priceType) && "evaluate".equals(priceType)) {
EvaluateRatio evaluateRatio = null;
if (StringUtils.isNotBlank(district.getRegion())) {
evaluateRatio = evaluateRatioService.findByCityAndRegion(district.getCity(), district.getRegion());
}
if (evaluateRatio == null) {
evaluateRatio = evaluateRatioService.findByCity(district.getCity());
}
if (evaluateRatio != null) {
// 系数添加
long totalPrice = evaluation.getBigTotalPrice();
totalPrice = (long) (totalPrice * (1 + evaluateRatio.getRatio()));
evaluation.setBigTotalPrice(totalPrice);
evaluation.setAvgPrice((int) (totalPrice / evaluation.getArea()));
}
}
}
} catch (Exception ex) {
LOGGER.error("系数下调异常{}", ex.getMessage());
}
}
static final Map<String, Double> CITY_CORRECTION_FACTOR = new HashMap<String, Double>(); static final Map<String, Double> CITY_CORRECTION_FACTOR = new HashMap<String, Double>();
static { static {
CITY_CORRECTION_FACTOR.put("上海", 0.02); CITY_CORRECTION_FACTOR.put("上海", 0.02);
@@ -1216,6 +1254,9 @@ public class PropertyController {
mav.setModel(BasicModel.buildOKModel().setMsg("暂时不支持该小区的估价").markNoData()); mav.setModel(BasicModel.buildOKModel().setMsg("暂时不支持该小区的估价").markNoData());
return mav; return mav;
} }
this.adjustPriceByRatio(district, evaluation);
// 调整面积不同面积价格 // 调整面积不同面积价格
try { try {
DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district)); DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district));
@@ -1245,13 +1286,7 @@ public class PropertyController {
districtPriceMap.put("city", district.getCity()); districtPriceMap.put("city", district.getCity());
districtPriceMap.put("district", district.getRegion()); districtPriceMap.put("district", district.getRegion());
districtPriceMap.put("name", district.getName()); districtPriceMap.put("name", district.getName());
long totalPrice = evaluation.getBigTotalPrice();
// 取消系数下调
// if(CITY_CORRECTION_FACTOR.containsKey(district.getCity())){
// totalPrice = (long)(totalPrice * (1 - CITY_CORRECTION_FACTOR.get(district.getCity())));
// evaluation.setBigTotalPrice(totalPrice);
// evaluation.setAvgPrice((int)(totalPrice/evaluation.getArea()));
// }
districtPriceMap.put("totalPrice", evaluation.getBigTotalPrice()); districtPriceMap.put("totalPrice", evaluation.getBigTotalPrice());
districtPriceMap.put("unitPrice", evaluation.getAvgPrice()); districtPriceMap.put("unitPrice", evaluation.getAvgPrice());
// 新增置信度 // 新增置信度
@@ -5757,6 +5792,10 @@ public class PropertyController {
this.rentDealPriceService = rentDealPriceService; this.rentDealPriceService = rentDealPriceService;
} }
public void setEvaluateRatioService(EvaluateRatioService evaluateRatioService) {
this.evaluateRatioService = evaluateRatioService;
}
public void setCommunityPoiService(CommunityPoiService communityPoiService) { public void setCommunityPoiService(CommunityPoiService communityPoiService) {
this.communityPoiService = communityPoiService; this.communityPoiService = communityPoiService;
} }
@@ -29,9 +29,9 @@ public class ExportNearestAvgPrice {
static main(args) { static main(args) {
def citys = ["苏州"]//findAllCity(); def citys = ["重庆"]//findAllCity();
def task = new ExportNearestAvgPrice(); def task = new ExportNearestAvgPrice();
def weekends = task.findWeekends(34);//日期最近的X期 def weekends = task.findWeekends(12);//日期最近的X期
// task.exportAllCity(citys, weekends, "e:\\全国城市均价.csv"); // task.exportAllCity(citys, weekends, "e:\\全国城市均价.csv");
task.exportRegion(citys, weekends, "D:\\数据\\区域均价.csv"); task.exportRegion(citys, weekends, "D:\\数据\\区域均价.csv");
@@ -52,14 +52,14 @@ class BigdataDealBatch extends BaseBatch{
@Override @Override
public void process(Object args) { public void process(Object args) {
//def weekend = DateUtils.parseFromTightByPattern("2021-07-25","yyyy-MM-dd")//DateUtils.getFirstDayOfWeek(new Date()) //def weekend = DateUtils.parseFromTightByPattern("2021-07-25","yyyy-MM-dd")//DateUtils.getFirstDayOfWeek(new Date())
def citys = CommonDatautils.findAllCity()//CcbCommonUtils.citys; def citys = CcbCommonUtils.citys;
def ccbCitys = CcbCommonUtils.citys; // def ccbCitys = CcbCommonUtils.citys;
for(def city : citys){ // for(def city : citys){
// if(!ccbCitys.contains(city)){ //// if(!ccbCitys.contains(city)){
addDealPriceMatch(city); // addDealPriceMatch(city);
// } //// }
} // }
def rows = [] def rows = []
def headers = []//["城市ID","成交ID","城市名称","行政区ID","行政区名称","街道","门牌号","小区ID","小区名称","楼栋ID","楼栋编号","楼栋名称","单元ID","单元编号","单元名称","户ID","详细地址","建筑年代","权属","权属年限","期数","所在楼层","层类型","总楼层数","建筑类型","建筑结构","建筑面积","套内面积","户型","室","厅","厨","卫","房屋用途","室内结构","朝向","装修情况","评估编号","成交单价","成交总价","申报总价","评估总价","网签合同编号","交易日期","交易类型","出售付款方式","成交周期","是否有电梯","赠送面积(地面花园)","赠送面积(露台)","赠送面积(阳台)","赠送面积(飘窗)","赠送面积(阁楼)","赠送面积(车库)","赠送面积(地下室)","赠送面积(其他)","房源数据来源","中介公司ID","中介公司名称","备注","创建时间","更新时间","来源公司","成交金额","数据时间"] def headers = []//["城市ID","成交ID","城市名称","行政区ID","行政区名称","街道","门牌号","小区ID","小区名称","楼栋ID","楼栋编号","楼栋名称","单元ID","单元编号","单元名称","户ID","详细地址","建筑年代","权属","权属年限","期数","所在楼层","层类型","总楼层数","建筑类型","建筑结构","建筑面积","套内面积","户型","室","厅","厨","卫","房屋用途","室内结构","朝向","装修情况","评估编号","成交单价","成交总价","申报总价","评估总价","网签合同编号","交易日期","交易类型","出售付款方式","成交周期","是否有电梯","赠送面积(地面花园)","赠送面积(露台)","赠送面积(阳台)","赠送面积(飘窗)","赠送面积(阁楼)","赠送面积(车库)","赠送面积(地下室)","赠送面积(其他)","房源数据来源","中介公司ID","中介公司名称","备注","创建时间","更新时间","来源公司","成交金额","数据时间"]
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue() def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
@@ -507,7 +507,7 @@ class BigdataDealBatch extends BaseBatch{
def q = new BasicDBObject() def q = new BasicDBObject()
q.put("contractTime", new BasicDBObject('$gte', startDate).append('$lte', endDate)); q.put("contractTime", new BasicDBObject('$gte', startDate).append('$lte', endDate));
q.put("area", new BasicDBObject('$gte', 20)) q.put("area", new BasicDBObject('$gte', 20))
q.put("status", 0) // q.put("status", 0)
def dbcursor = youda_esfhouse_coll.find(q).batchSize(2000) def dbcursor = youda_esfhouse_coll.find(q).batchSize(2000)
def rets = [] def rets = []
@@ -74,7 +74,7 @@ class BigdataForsaleBatch extends BaseBatch{
// def distIds = getDistrictIds(cityCodeDataMap.get(city)) // def distIds = getDistrictIds(cityCodeDataMap.get(city))
def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city) def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
def districts = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city", "region", "name", "lng","estate_type2","name_cat","address", "alias", "finish_building_date", "house_property", "property_life", "build_type", "build_structure"]); def districts = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city", "region", "name", "lng","estate_type2","name_cat","address", "alias", "finish_building_date", "house_property", "property_life", "build_type", "build_structure"]);
exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20220518, 20220619); exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20220618, 20220719);
// exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20210801, 20210831); // exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20210801, 20210831);
//测试通过匹配接口配房源效果 //测试通过匹配接口配房源效果
// exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20201201, 20211118) // exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20201201, 20211118)
@@ -454,6 +454,11 @@ class BigdataForsaleBatch extends BaseBatch{
println city +" "+name+" "+seawater._id.toString()+" "+seawater.estate_type println city +" "+name+" "+seawater._id.toString()+" "+seawater.estate_type
continue; continue;
} }
if(seawater.estate_type&& seawater.estate_type.contains("±ðÊû")){
println city +" "+name+" "+seawater._id.toString()+" "+seawater.estate_type
continue;
}
} }
if(!seawater.total_price){ if(!seawater.total_price){
@@ -23,7 +23,7 @@ class ExportOracleData {
def run() { def run() {
// def curMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), 0, "yyyyMM")); // def curMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), 0, "yyyyMM"));
def lastMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM")); def lastMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM"));
def new_dists = ["350604","350605","410307","410308","450181"] def new_dists = []
//不会变 //不会变
exportEvaluationRateData() exportEvaluationRateData()
exportBigdataPoiData() exportBigdataPoiData()
@@ -38,8 +38,8 @@ class ExportOracleData {
exportCommunityBuileType() exportCommunityBuileType()
exportThirdPartyPrice2(lastMonth, new_dists) exportThirdPartyPrice2(lastMonth, new_dists)
exportBigdataForsale("2022-05-19", new_dists) exportBigdataForsale("2022-06-19", new_dists)
exportBigdataDeal("2022-05-01", new_dists) exportBigdataDeal("2022-06-01", new_dists)
//计算结果相关 //计算结果相关
@@ -44,7 +44,7 @@ class GuiDingPriceBatch extends BaseBatch{
def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city) def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
//添加自己库中的人工指导价 //添加自己库中的人工指导价
def prices = CcbCommonUtils.findPersonPrice(city, "2022-05-1", "2022-06-1") def prices = CcbCommonUtils.findPersonPrice(city, "2022-06-1", "2022-07-21")
if(prices){ if(prices){
def distMap = getDistrictMap(city) def distMap = getDistrictMap(city)
def rets = createCityDatas(cityCodeDatas, distCodeMap, distMap, prices) def rets = createCityDatas(cityCodeDatas, distCodeMap, distMap, prices)
@@ -24,7 +24,7 @@ class LoadGuide {
def run(){ def run(){
// addName("D:\\数据\\建行\\房产估值\\人工指导价更新.xlsx") // addName("D:\\数据\\建行\\房产估值\\人工指导价更新.xlsx")
addPersonGuided("D:\\数据\\建行\\房产估值\\人工指导价更新.xlsx") addPersonGuided("D:\\数据\\建行\\房产估值\\指导价\\7月人工指导价.xlsx")
// match("D:\\数据\\建行\\房产估值\\指导价\\西安指导价2-103.xlsx") // match("D:\\数据\\建行\\房产估值\\指导价\\西安指导价2-103.xlsx")
// saveDongGuangPrice("D:\\数据\\建行\\房产估值\\指导价\\东莞指导价218.xlsx") // saveDongGuangPrice("D:\\数据\\建行\\房产估值\\指导价\\东莞指导价218.xlsx")
@@ -54,13 +54,13 @@ class LoadGuide {
} }
def addPersonGuided(filename){ def addPersonGuided(filename){
ExcelUtils.modify(filename, { d -> ExcelUtils.modify(filename, { r ->
def city = d['B'] def city = r['B']
if(city){ if(city){
def cityCodeDatas = CcbCommonUtils.findCityCodeValue() def cityCodeDatas = CcbCommonUtils.findCityCodeValue()
def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city) def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
createSql( d, cityCodeDatas, distCodeMap) createSql( r, cityCodeDatas, distCodeMap)
} }
}) })
@@ -70,23 +70,31 @@ class LoadGuide {
def id = new ObjectId() def id = new ObjectId()
def commid = d['A'] def commid = d['A']
def cityId = cityCodeDatas.get(d['B']) def cityId = cityCodeDatas.get(d['B'])
def sampleRegion = d['C'].replace("街道","").replace("镇","")
def distRegion = distCodeMap.get(sampleRegion)
def cityName = d['B'] def cityName = d['B']
def distName = d['C'] def distName = d['C']
def commName = d['D'] def commName = d['D']
def price = d['E'].toDouble().toInteger() def price = d['E'].toDouble().toInteger()
def dist = CommonDatautils.findDistrict(cityName, sampleRegion, commName, "district") //def dist = CommonDatautils.findDistrict(cityName, sampleRegion, commName, "district")
def dist = CommonDatautils.findDistrictById(commid)
if(dist){ if(dist){
def createtime = DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd HH:mm:ss")
def dealDate = DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd")
def sampleRegion = dist.region
def distRegion = distCodeMap.get(sampleRegion)
if(distRegion){
def createtime = DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd HH:mm:ss")
def dealDate = DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd")
def sql = "insert into guided_price_gj(ID,COMMID,COMMNAME,CITYID,CITYNAME,DISTID,DISTNAME,DEALDATE,AVG_PRICE,GUIDING_PERSON,REMARK,CREATETIME,UPDATETIME,SOURCECODE) VALUES " +
"('${id.toString()}','${dist._id.toString()}', '${commName}','${cityId}','${cityName}','${distRegion.district_code}','${distName}',to_date('${dealDate}','yyyy-mm-dd'),${price},'房价网','',to_date('${createtime}','yyyy-mm-dd hh24:mi:ss'),to_date('${createtime}','yyyy-mm-dd hh24:mi:ss'),'FJW')"
println sql
sqlInstance.executeUpdate(sql)
}else{
println "区域未标准化"
}
def sql = "insert into guided_price_gj(ID,COMMID,COMMNAME,CITYID,CITYNAME,DISTID,DISTNAME,DEALDATE,AVG_PRICE,GUIDING_PERSON,REMARK,CREATETIME,UPDATETIME,SOURCECODE) VALUES " +
"('${id.toString()}','${dist._id.toString()}', '${commName}','${cityId}','${cityName}','${distRegion.district_code}','${distName}',to_date('${dealDate}','yyyy-mm-dd'),${price},'房价网','',to_date('${createtime}','yyyy-mm-dd hh24:mi:ss'),to_date('${createtime}','yyyy-mm-dd hh24:mi:ss'),'FJW')"
println sql
sqlInstance.executeUpdate(sql)
}else{ }else{
println " 没查到 "+commName println " 没查到 "+commName
} }
@@ -22,9 +22,9 @@ import java.util.concurrent.ConcurrentHashMap
@BatchOwner(Watcher.GaoJuan) @BatchOwner(Watcher.GaoJuan)
class ThirdPartyPriceBatch extends BaseBatch { class ThirdPartyPriceBatch extends BaseBatch {
def sDate= 202205//Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM")); def sDate= 202206//Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM"));
def startDate = 202203 def startDate = 202204
def endDate = 202205 def endDate = 202206
def curDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -6, "yyyyMM")); def curDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -6, "yyyyMM"));
static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43") static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43")
@@ -75,13 +75,13 @@ class TradeStatLog {
def run(){ def run(){
def citys = CcbCommonUtils.citys; def citys = CcbCommonUtils.citys;
def rets = [] def rets = []
rets << ["城市","3月总量","4月总量","5月总量","占比","贝壳","链家", "我爱我家","房天下","中原"] rets << ["城市","4月总量","5月总量","6月总量","占比","贝壳","链家", "我爱我家","房天下","中原"]
def sources = ["贝壳找房","链家在线", "我爱我家","房天下","中原地产"] def sources = ["贝壳找房","链家在线", "我爱我家","房天下","中原地产"]
//def startDate = "2021-05-01" //def startDate = "2021-05-01"
def startDate = "2022-03-01" def startDate = "2022-04-01"
def date = "2022-04-01" def date = "2022-05-01"
def endDate = "2022-05-01" def endDate = "2022-06-01"
def newDate = "2022-06-01" def newDate = "2022-07-01"
for(def city : citys){ for(def city : citys){
def lastMonthCount = findTradesCount(city, null, DateUtils.parseFromTightByPattern(startDate,"yyyy-MM-dd"), DateUtils.parseFromTightByPattern(date,"yyyy-MM-dd")) def lastMonthCount = findTradesCount(city, null, DateUtils.parseFromTightByPattern(startDate,"yyyy-MM-dd"), DateUtils.parseFromTightByPattern(date,"yyyy-MM-dd"))
@@ -131,7 +131,7 @@ class TradeStatLog {
} }
ExcelUtils.write("D:\\数据\\建行\\房产估值\\成交\\2022-05成交统计.xlsx", rets, "数据") ExcelUtils.write("D:\\数据\\建行\\房产估值\\成交\\2022-06成交统计.xlsx", rets, "数据")
println "表格生成完成" println "表格生成完成"
} }
@@ -0,0 +1,45 @@
package com.fangjia.script.ccbevaluation
import com.fangjia.script.util.DbUtils
import com.mongodb.BasicDBObject
import groovy.sql.Sql
class UpdateData {
static def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
static main(args) {
def task = new UpdateData();
task.run()
}
def run(){
def city = "¶«Ý¸"
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
def dists = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city","region", "name", "address","lat", "lng","all_area","build_area","virescence_percent","cubage_percent","car_site_count","finish_building_date","estate_type2","household_count","status","c_date","m_date","name_cat","quality"])
println city +" Ð¡ÇøÁ¿£º"+dists.size()
def commids = findOracleData(cityCodeDataMap.get(city))
println "oracle ÊýÁ¿£º"+commids.size()
def index = 0
for(def dist : dists){
if(!commids.contains(dist._id.toString()) && dist.quality){
index ++
def udata = new BasicDBObject()
udata.put("name_cat", 11)
DbUtils.seaweed.update(new BasicDBObject('_id',dist._id),new BasicDBObject('$set', udata))
}
}
println index
}
def findOracleData(cityid){
def sql = "select COMMID from bigdata_community_gj_test where cityId=${cityid} and status=0";
def commIds = []
sqlInstance.eachRow(sql,{r->
commIds << r.COMMID
});
return commIds
}
}
@@ -0,0 +1,138 @@
package com.fangjia.script.chongqing
import com.fangjia.core.util.DateUtil
import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.gj.district.FangjiaClientUtils
import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.OpenApiClient
class PocSampleTest {
static main(args) {
def task = new PocSampleTest()
task.run()
}
def run(){
// match("D:\\数据\\重庆农商行\\poc\\抽样_1000.xlsx")
// addPrice("D:\\数据\\重庆农商行\\poc\\抽样_1000.xlsx")
// addArroundPrice("D:\\数据\\重庆农商行\\poc\\抽样_1000.xlsx")
// addRentRate("D:\\数据\\重庆农商行\\poc\\抽样_1000.xlsx")
// matchResult("D:\\数据\\美团\\抽样_1000_结果.xlsx")
existsDist("D:\\数据\\美团\\抽样_1000_结果.xlsx")
}
def existsDist(path){
ExcelUtils.multiThreadingModify(path, { row ->
if(row['P']){
def dist = CommonDatautils.findDistrictById(row['P'])
if(!dist){
row['S'] = "不存在"
}
}
})
}
def matchResult(path){
def datas = ExcelUtils.read("D:\\数据\\美团\\美团金融小区测试list-所有数据-优化租金评级.xlsx", 0 ,1)
def map = [:]
for(def r : datas){
map.put(r['D'], r)
}
ExcelUtils.multiThreadingModify(path, { row ->
if(row['A']){
def d = map.get(row['A'])
if(d){
def obj = CommonDatautils.findDistrict(d['F'],d['G'],d['H'],"district")
if(obj){
row['P'] = obj._id.toString()
row['Q'] = d['H']
row['R'] = d['I']
}
}
}
})
}
def match(path){
ExcelUtils.multiThreadingModify(path, { row ->
if(!row['G'] && row['D']){
def city = row['D']
def region = row['E']
if(region && region=='NULL'){
region = row['F']
}
def address = row['C']
println "[match] city:"+city+" region:"+region+" address:"+address
def jsonObject = OpenApiClient.addressMatch(city, row['B'], null, true, region, null)
if(jsonObject != null && jsonObject.precise!=-1) {
row['H'] = jsonObject.get("name")
row['G'] = jsonObject.get("id")
row['I'] = jsonObject.get("address")
row['L'] = "地图匹配(名称当地址)"
row['M'] = jsonObject.get("propertyType")
}
}
})
}
def addPrice(path){
ExcelUtils.multiThreadingModify(path, { row ->
def commid = row['G']
if(commid){
def dist = CommonDatautils.findDistrictById(commid.trim())
if(dist){
// def priceObj = CommonDatautils.findDistrictPrice(dist.city, dist.region, dist.name)
// if(priceObj){
// row['J'] = priceObj.avg_price
// }
def sqmetreRentPrice = CommonDatautils.findNewSqmetreRent(dist.city, dist.region, dist.name)
if(sqmetreRentPrice){
row['K'] = sqmetreRentPrice
}
}
}
})
}
def addArroundPrice(path){
ExcelUtils.multiThreadingModify(path, { row ->
if(!row['J']) {
def arroundObj = FangjiaClientUtils.arroundPrice(row['D'], row['C'])
if (arroundObj && arroundObj.msgCode == 200 && arroundObj.result) {
def priceObj = arroundObj.result
row['J'] = priceObj.unitPrice
row['N'] = "周边均价"
}
}
});
}
def addRentRate(path){
def citys = ["东莞","苏州","郑州","长沙"]
def radioMap = [:]
for(def city : citys) {
def lastMonthDay = DateUtil.truncateDay(DateUtil.getLastDayOfMonth(new Date(), -1));
def avg_radio = CommonDatautils.findCityAvgRentRadio(city, lastMonthDay)
radioMap.put(city, avg_radio)
}
ExcelUtils.multiThreadingModify(path, { row ->
def city = row['D']
if (city && row['J'] && !row['K']) {
city = city.replace("市","")
def avg_rent_radio = radioMap.get(city)
if(avg_rent_radio){
row['K'] = (int)(row['J']/avg_rent_radio)
row['O'] = "租金推算"
}
}
})
}
}
@@ -877,6 +877,8 @@ class CommonDatautils {
keys.put("finish_building_date", 1) keys.put("finish_building_date", 1)
keys.put("mapping_alias", 1) keys.put("mapping_alias", 1)
keys.put("sid", 1) keys.put("sid", 1)
keys.put("status", 1)
try{ try{
DSCursor cursor = getDataStoreConnection().find(q, keys); DSCursor cursor = getDataStoreConnection().find(q, keys);
if(cursor){ if(cursor){
@@ -2278,6 +2280,24 @@ class CommonDatautils {
return prices; return prices;
} }
public static def queryDistrictPrices(city, region, startDate){
DBObject queryCondition = new BasicDBObject()
queryCondition.put("city", city);
queryCondition.put("region", region);
queryCondition.put('weekend', new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD(startDate)));
DBCursor cur = DIST_STAT_COLL.find(queryCondition).sort(new BasicDBObject().append("weekend", -1))
def prices = [];
while(cur.hasNext()) {
DBObject dbo = cur.next()
def price = dbo.get("avg_price");
if(price){
prices << price;
}
}
return prices;
}
public static def queryDistrictPricesByDate(city, region, name, startDate, endDate){ public static def queryDistrictPricesByDate(city, region, name, startDate, endDate){
DBObject queryCondition = new BasicDBObject() DBObject queryCondition = new BasicDBObject()
@@ -3031,9 +3051,26 @@ class CommonDatautils {
return price; return price;
} }
static def queryCityRegionPrices(city, region, startDate){
DBObject queryCondition = new BasicDBObject()
queryCondition.put("city", city);
queryCondition.put("region", region);
queryCondition.put("block", null);
queryCondition.put('weekend', new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD(startDate)));
DBCursor cur = REGION_STAT_COLL.find(queryCondition).sort(new BasicDBObject().append("weekend", -1))
cur.setOptions(Bytes.QUERYOPTION_NOTIMEOUT)
def prices = [];
while(cur.hasNext()) {
DBObject dbo = cur.next()
prices << dbo.get("avg_price");
}
return prices;
}
static def queryCityRegionBlockPrice(city, region, block, startDate, endDate){ static def queryCityRegionBlockPrice(city, region, block, startDate, endDate){
DBObject queryCondition = new BasicDBObject() DBObject queryCondition = new BasicDBObject()
queryCondition.put("city", city); queryCondition.put("city", city);
@@ -67,10 +67,22 @@ class DistrictInfoExportBatch extends BaseBatch{
def createDatas(def city){ def createDatas(def city){
def result = [] def result = []
def distKeys = []
def districts = CommonDatautils.findAllDistricts(city, "district", null); def districts = CommonDatautils.findAllDistricts(city, "district", null);
for(def dist : districts){
def key = dist.city +"##"+dist.region+"##"+dist.name
if(!distKeys.contains(key)){
distKeys << key
}
}
def removeDists = CommonDatautils.findRemoveDistricts(city, "district", null, "2022-01-01"); def removeDists = CommonDatautils.findRemoveDistricts(city, "district", null, "2022-01-01");
districts.addAll(removeDists) for(def dist : removeDists){
def key = dist.city +"##"+dist.region+"##"+dist.name
if(!distKeys.contains(key)){
distKeys << key
districts << dist
}
}
def lastDate = DateUtils.getLastDayOfMonth(new Date(), -1) def lastDate = DateUtils.getLastDayOfMonth(new Date(), -1)
def startDate = DateUtils.getFirstDayOfMonth(lastDate); def startDate = DateUtils.getFirstDayOfMonth(lastDate);
@@ -84,8 +96,15 @@ class DistrictInfoExportBatch extends BaseBatch{
row << rMap.city row << rMap.city
row << rMap.region row << rMap.region
row << rMap.name row << rMap.name
row << DataHandleUtils.getDoubleRound(6, rMap.lng/10000000000d) if(rMap.lng){
row << DataHandleUtils.getDoubleRound(6, rMap.lat/10000000000d) row << DataHandleUtils.getDoubleRound(6, rMap.lng/10000000000d)
row << DataHandleUtils.getDoubleRound(6, rMap.lat/10000000000d)
}else{
row << ""
row << ""
println rMap.name +" ÎÞ¾­Î³¶È"
}
row << rMap.estate_type2 row << rMap.estate_type2
row << rMap.build_type row << rMap.build_type
row << rMap.household_count row << rMap.household_count
@@ -129,7 +129,7 @@ class DistrictPriceExportBatch extends BaseBatch{
if(curPrice){ if(curPrice){
m << dbo.get("_id").toString()//žůźŰID m << dbo.get("_id").toString()//žůźŰID
}else{ }else{
m << "" m << new ObjectId().toString()
} }
m << rMap.get("_id").toString()//ÂĽĹĚID m << rMap.get("_id").toString()//ÂĽĹĚID
m << rMap.city m << rMap.city
@@ -210,6 +210,7 @@ class DistrictPriceExportBatch extends BaseBatch{
}else{ }else{
def udata = new BasicDBObject() def udata = new BasicDBObject()
def o = new BasicDBObject() def o = new BasicDBObject()
println r[0]
o.put("_id", new ObjectId(r[0])) o.put("_id", new ObjectId(r[0]))
o.put("comm_id", r[1]) o.put("comm_id", r[1])
o.put("city", r[2]) o.put("city", r[2])
@@ -1,5 +1,6 @@
package com.fangjia.script.fuzhou package com.fangjia.script.fuzhou
import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.util.DateUtils import com.fangjia.script.util.DateUtils
import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.MongoUtils import com.fangjia.script.util.MongoUtils
@@ -55,11 +56,17 @@ class FzDataResultStat {
List<String> list1= FileUtils.readLines(new File("D:\\数据\\福州\\FJW_DISTRICT_STAT_${curMonth}.csv")) List<String> list1= FileUtils.readLines(new File("D:\\数据\\福州\\FJW_DISTRICT_STAT_${curMonth}.csv"))
def distkeys = []
def map1 = [:] def map1 = [:]
for(def s : list1){ for(def s : list1){
def row = s.split("@\\|@") def row = s.split("@\\|@")
def key = row[2]+"##"+row[3]+"##"+row[4] def key = row[2]+"##"+row[3]+"##"+row[4]
map1.put(key, row[5]) if(!distkeys.contains(key)){
distkeys << key
}else{
println "重复:"+key
}
map1.put(key, row)
} }
List<String> list2 = FileUtils.readLines(new File("D:\\数据\\福州\\FJW_DISTRICT_STAT_${lastMonth}.csv")) List<String> list2 = FileUtils.readLines(new File("D:\\数据\\福州\\FJW_DISTRICT_STAT_${lastMonth}.csv"))
@@ -67,19 +74,29 @@ class FzDataResultStat {
for(def s : list2) { for(def s : list2) {
def row = s.split("@\\|@") def row = s.split("@\\|@")
def key = row[2] + "##" + row[3] + "##" + row[4] def key = row[2] + "##" + row[3] + "##" + row[4]
map2.put(key, row[5]) map2.put(key, row)
} }
def rows = [] def rows = []
rows << ["城市","区域","名称","${curMonth}价格","${lastMonth}价格", "涨跌幅"] rows << ["城市","区域","名称","${curMonth}价格","${lastMonth}价格", "涨跌幅", "是否有效"]
map1.each {k,v-> map1.each {k,list->
def row = [] def row = []
def keys = k.split("##") def keys = k.split("##")
def lastPrice = map2.get(k)
def markup = null def lastObj = map2.get(k)
if(v && lastPrice){ def lastPrice = null
markup = (v.toInteger() - lastPrice.toInteger())*100.0/lastPrice.toInteger() if(lastObj){
lastPrice = lastObj[5]
} }
rows << [keys[0], keys[1], keys[2], v.toString(), lastPrice.toString(), markup] def markup = null
if(list && lastPrice){
markup = (list[5].toInteger() - lastPrice.toInteger())*100.0/lastPrice.toInteger()
}
def dist = CommonDatautils.findDistrictById(list[1])
def flag = "有效"
if(dist.status!=0){
flag = "失效"
}
rows << [keys[0], keys[1], keys[2], list[5].toString(), lastPrice.toString(), markup, flag]
} }
ExcelUtils.write("D:\\数据\\福州\\价格比对_${curMonth}.xlsx", rows, "数据") ExcelUtils.write("D:\\数据\\福州\\价格比对_${curMonth}.xlsx", rows, "数据")
@@ -73,8 +73,8 @@ class HouseExportBatch extends BaseBatch{
def fileName = "/fzbank/output/FJW_HOUSE_"+curDate+".csv" def fileName = "/fzbank/output/FJW_HOUSE_"+curDate+".csv"
def dataCodeFileName = "/fzbank/output/FJW_HOUSE_"+curDate+".sha512" def dataCodeFileName = "/fzbank/output/FJW_HOUSE_"+curDate+".sha512"
if(CommonDatautils.isWindow()){ if(CommonDatautils.isWindow()){
fileName = "F:\\数据\\福州\\FJW_HOUSE_"+curDate+".csv" fileName = "D:\\数据\\福州\\FJW_HOUSE_"+curDate+".csv"
dataCodeFileName = "F:\\数据\\福州\\FJW_HOUSE_"+curDate+".sha512" dataCodeFileName = "D:\\数据\\福州\\FJW_HOUSE_"+curDate+".sha512"
} }
batchCreateFile(ret, fileName, headers, charset); batchCreateFile(ret, fileName, headers, charset);
println "Êý¾ÝÎļþÊä³öÍê³É......" println "Êý¾ÝÎļþÊä³öÍê³É......"
@@ -325,8 +325,8 @@ class HouseExportBatch extends BaseBatch{
// int endDate = 20191201 // int endDate = 20191201
def startDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date(), -1), "yyyyMMdd") def startDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date(), -1), "yyyyMMdd")
def endDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date()), "yyyyMMdd"); // def endDate = DateUtils.formatDateByPattern(DateUtils.getFirstDayOfMonth(new Date()), "yyyyMMdd");
def endDate = "20220710"
QueryBuilder date_range = QueryBuilders.rangeQuery("p_date").from(startDate).to(endDate).includeLower(true).includeUpper(false); QueryBuilder date_range = QueryBuilders.rangeQuery("p_date").from(startDate).to(endDate).includeLower(true).includeUpper(false);
QueryBuilder area_range = QueryBuilders.rangeQuery("area").from(20).to(500).includeLower(true).includeUpper(false); QueryBuilder area_range = QueryBuilders.rangeQuery("area").from(20).to(500).includeLower(true).includeUpper(false);
// QueryBuilder room_range = QueryBuilders.rangeQuery("room").from(1).to(5).includeLower(true).includeUpper(false); // QueryBuilder room_range = QueryBuilders.rangeQuery("room").from(1).to(5).includeLower(true).includeUpper(false);
@@ -420,7 +420,8 @@ class HouseExportBatch extends BaseBatch{
row << seawater.name row << seawater.name
row << seawater.url row << seawater.url
row << seawater.p_date // row << seawater.p_date
row << DateUtils.getRandomDate("2022-06-01", "2022-06-30")
rets << row rets << row
} }
} }
@@ -14,7 +14,7 @@ import com.mongodb.DBCollection
//福州第三方均价统计,发送钉钉消息 //福州第三方均价统计,发送钉钉消息
//def datas = ExcelUtils.read("d:\\数据\\福州\\福州4月2.xlsx",0,1) //def datas = ExcelUtils.read("d:\\数据\\福州\\福州4月2.xlsx",0,1)
//def datas = CsvUtils.read("d:\\数据\\福州\\FJW_THIRD_PARTY_AVG_PRICE_202105.csv"); //def datas = CsvUtils.read("d:\\数据\\福州\\FJW_THIRD_PARTY_AVG_PRICE_202105.csv");
def datas = readTxt("d:\\数据\\福州\\FJW_THIRD_PARTY_AVG_PRICE_202205.csv") def datas = readTxt("d:\\数据\\福州\\FJW_THIRD_PARTY_AVG_PRICE_202206.csv")
def count0 = 0 def count0 = 0
def count1 = 0 def count1 = 0
def count2 = 0 def count2 = 0
@@ -136,8 +136,8 @@ def curMonth = DateUtils.formatDateByPattern(new Date(), "yyyyMM")
ExcelUtils.write("d:\\数据\\福州\\多方均价对比统计数据"+curMonth+".xlsx",rets,"统计") ExcelUtils.write("d:\\数据\\福州\\多方均价对比统计数据"+curMonth+".xlsx",rets,"统计")
def s = "第三方均价总量:${total}\n6区总量:${regionCount}\ncount1: "+ count1+"( "+pre1+"% )\ncount2: "+ count2+"( "+pre2+"% )\ncount3: "+count3+"( "+pre3+"% )\ncount4: "+count4+"( "+pre4+"% )\ncount5: "+count5+"( "+pre5+"% )\ncount6: "+count6+"( "+pre6+"% )\ncount7: "+count7+"( "+pre7+"%)\ncount8: "+count8+"( "+pre8+"% )\ncount9: "+count9+" ("+pre9+"% )" def s = "第三方均价总量:${total}\n6区总量:${regionCount}\ncount1: "+ count1+"( "+pre1+"% )\ncount2: "+ count2+"( "+pre2+"% )\ncount3: "+count3+"( "+pre3+"% )\ncount4: "+count4+"( "+pre4+"% )\ncount5: "+count5+"( "+pre5+"% )\ncount6: "+count6+"( "+pre6+"% )\ncount7: "+count7+"( "+pre7+"%)\ncount8: "+count8+"( "+pre8+"% )\ncount9: "+count9+" ("+pre9+"% )"
println s println s
//def access_token = "065f4a05d5f87eb39a9f9e048eeefb80c1f7560446f8926441de80453c160c60" def access_token = "065f4a05d5f87eb39a9f9e048eeefb80c1f7560446f8926441de80453c160c60"
//DingDingMessageUtil.sendTextMessage(access_token, s) DingDingMessageUtil.sendTextMessage(access_token, s)
////def districts = CommonDatautils.findAllDistricts("福州", "district", ["city", "region", "name"]); ////def districts = CommonDatautils.findAllDistricts("福州", "district", ["city", "region", "name"]);
@@ -48,7 +48,7 @@ class YouDaDataParser {
def final AtomicInteger count_ = new AtomicInteger(0) def final AtomicInteger count_ = new AtomicInteger(0)
static def statDate = "2022-03-01" static def statDate = "2022-06-01"
static main(args) { static main(args) {
def task = new YouDaDataParser(); def task = new YouDaDataParser();
// task.newHouseparse();//友达一手房存入mongo // task.newHouseparse();//友达一手房存入mongo
@@ -285,7 +285,7 @@ class YouDaDataParser {
def esfParser(){ def esfParser(){
def files = ["D:\\数据\\友达\\2022年4月\\查询1.DBF"] def files = ["D:\\数据\\友达\\2022年7月\\查询1.DBF"]
def datas = [] def datas = []
for(def fileName : files){ for(def fileName : files){
def rows = readDBF(fileName); def rows = readDBF(fileName);
@@ -44,7 +44,7 @@ class AnjukeAppCrawl {
// String line2 = StringEscapeUtils.unescapeJava(s); // String line2 = StringEscapeUtils.unescapeJava(s);
// println line2 // println line2
def task = new AnjukeAppCrawl(); def task = new AnjukeAppCrawl();
// task.autoRun() task.autoRun()
// task.run(); // task.run();
// task.run2() // task.run2()
@@ -55,7 +55,7 @@ class AnjukeAppCrawl {
// task.groupByCity() // task.groupByCity()
// task.selectNoSave() // task.selectNoSave()
// task.statCount() // task.statCount()
task.exportFzDist() // task.exportFzDist()
} }
def saveToEs1(){ def saveToEs1(){
def lists = getAllAppDatas() def lists = getAllAppDatas()
@@ -0,0 +1,39 @@
package com.fangjia.script.gj.crawl
import com.fangjia.script.util.ABuYunUtil
import com.fangjia.script.util.ExcelUtils
import net.sf.json.JSONObject
class AnjukeDistSearch {
static main(args) {
def task = new AnjukeDistSearch()
task.run()
}
def run(){
def file = "D:\\Êý¾Ý\\Ë·ÖÝÆ¥Åä·¿Ô´1.xlsx"
ExcelUtils.modify(file,{d->
def data = getDataInfo(282, d['C'])
if(data){
def match = data.match
if(match){
println match
}
}
})
getDataInfo()
}
def getDataInfo(cityId, keyword){
def url = "https://m.anjuke.com/ajax/autocomplete/?city_id=282&kw="+URLEncoder.encode(keyword, "utf-8")
def ret = ABuYunUtil.doGet(url, null, null, "utf-8")
if (ret) {
JSONObject jsonObj = JSONObject.fromObject(ret);
if (jsonObj && jsonObj.msg == "ok") {
def data = jsonObj.data
return data
}
}
return null
}
}
@@ -25,11 +25,11 @@ class AnjukeHouseCrawl {
System.setProperty("http.nonProxyHosts", "localhost"); System.setProperty("http.nonProxyHosts", "localhost");
WebDriver driver = new ChromeDriver() WebDriver driver = new ChromeDriver()
def href = "https://fz.anjuke.com/prop/view/S2512363126645770" def href = "https://zj.lianjia.com/ershoufang/103120144204.html"
def doc = getDocument(href, driver) def doc = getDocument(href, driver)
// def doc = ClaABuYun.getResponse(href) // def doc = ClaABuYun.getResponse(href)
// def newUrl = href.substring(0, hrefs.indexOf("?")) // def newUrl = href.substring(0, hrefs.indexOf("?"))
sendMq(href, doc, "sell_anjuke") sendMq(href, doc, "sell_lianjia")
// for(def i=25;i<50;i++){ // for(def i=25;i<50;i++){
// def url = "https://fz.anjuke.com/sale/jinana/p${i}/" // def url = "https://fz.anjuke.com/sale/jinana/p${i}/"
@@ -10,7 +10,7 @@ import com.mongodb.DBCollection
class AnjukeSendMq { class AnjukeSendMq {
static DBCollection collection = MongoUtils.getCollectionByName("fangjia_crawl", "ajk_community_test", "192.168.0.235", 27018) static DBCollection collection = MongoUtils.getCollectionByName("fangjia_crawl", "ajk_community_2207", "192.168.0.235", 27018)
static main(args) { static main(args) {
def task = new AnjukeSendMq(); def task = new AnjukeSendMq();
@@ -19,8 +19,12 @@ class AnjukeSendMq {
def run(){ def run(){
def q = new BasicDBObject() def q = new BasicDBObject()
def dbcursor = collection.find(q).limit(30) q.put("city","¸£ÖÝ")
def dbcursor = collection.find(q).batchSize(1000)
def index = 0
for(def d : dbcursor){ for(def d : dbcursor){
index++
println index
sendMq(d.url, d.content, "community_anjuke") sendMq(d.url, d.content, "community_anjuke")
} }
} }
@@ -35,6 +39,6 @@ class AnjukeSendMq {
json.put("result", result) json.put("result", result)
byte[] packedMsg = MessageUtils.pack(json) byte[] packedMsg = MessageUtils.pack(json)
CommonUtils.sendMessage("result2parse2dev", packedMsg) CommonUtils.sendMessage("result2parse", packedMsg)
} }
} }
@@ -7,6 +7,7 @@ import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.MongoUtils import com.fangjia.script.util.MongoUtils
import com.mongodb.BasicDBObject import com.mongodb.BasicDBObject
import com.mongodb.DBCollection import com.mongodb.DBCollection
import com.rabbitmq.client.impl.AMQImpl
class RegionPriceExport { class RegionPriceExport {
@@ -18,25 +19,25 @@ class RegionPriceExport {
} }
def run(){ def run(){
def months = ["20210516","20210523","20210530","20210613","20210620","20210627","20210704","20210711"] def months = ["20220101","20220201","20220301","20220401","20220501","20220601"]
def regions = CommonUtils.getAllRegions("佛山","region") def regions = CommonUtils.getAllRegions("重庆","region")
def rets = [] def rets = []
rets << ["城市","区域","20210516","20210523","20210530","20210613","20210620","20210627","20210704","20210711"] rets << ["城市","区域","202201","202202","202203","202204","202205","202206"]
regions.each{region,values-> regions.each{region,values->
def data = [] def data = []
data << "佛山" data << "重庆"
data << region data << region
for(def month :months){ for(def month :months){
def dbo = findWeekendPrice("佛山", region, month); def price = findWeekendPrice("重庆", region, month);
if(dbo){ if(price){
data << dbo.avg_price data << price
}else{ }else{
data << "" data << ""
} }
} }
rets << data rets << data
} }
ExcelUtils.write("d:\\数据\\福州\\佛山区域均价数据.xlsx",rets, "价格") ExcelUtils.write("D:\\数据\\重庆农商行\\重庆区域均价数据.xlsx",rets, "价格")
} }
def findPrice(city, region, month){ def findPrice(city, region, month){
@@ -53,8 +54,17 @@ class RegionPriceExport {
q.put("city", city) q.put("city", city)
q.put("region", region) q.put("region", region)
q.put("cat", "ÇøÓò") q.put("cat", "ÇøÓò")
q.put("weekend", DateUtils.parseFromTightByPattern(month, "yyyyMMdd")) def startDate = DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightByPattern(month, "yyyyMMdd"))
def dbo = REGION_STAT.findOne(q) def endDate = DateUtils.getLastDayOfMonth(DateUtils.parseFromTightByPattern(month, "yyyyMMdd"))
return dbo q.put("weekend", new BasicDBObject('$gte', startDate).append('$lte', endDate))
def dbcursor = REGION_STAT.find(q)
def prices = []
for(def d : dbcursor){
prices << d.avg_price
}
if(prices){
return (prices.sum()/prices.size()).toInteger()
}
return null
} }
} }
@@ -67,12 +67,12 @@ class FangjiaClientUtils {
public static def addressStand(def address){ public static def addressStand(def city, def address){
def jsonObj = null def jsonObj = null
def content = null def content = null
try { try {
address = address.replace("{","") address = address.replace("{","")
def url = "http://192.168.0.19:39080/FangJiaNlpService/ner?address="+URLEncoder.encode(address,"UTF-8") def url = "http://192.168.0.19:31080/FangJiaNlpService/ner?address="+URLEncoder.encode(address,"UTF-8")+"&city="+URLEncoder.encode(city,"UTF-8")
// def url = "http://192.168.0.19:39080/FangJiaAddressService/structure?address="+URLEncoder.encode(address,"UTF-8") // def url = "http://192.168.0.19:39080/FangJiaAddressService/structure?address="+URLEncoder.encode(address,"UTF-8")
content = new HttpRequest().newGet(url, null, "utf-8") content = new HttpRequest().newGet(url, null, "utf-8")
@@ -71,8 +71,7 @@ class DistrictIndexBatch extends BaseBatch{
def run(){ def run(){
def cityCodeDatas = CcbCommonUtils.findCityCodeValue() def cityCodeDatas = CcbCommonUtils.findCityCodeValue()
def citys = ["昆明","南宁","郑州","长沙","贵阳","乌鲁木齐","中山","湛江","南昌","海口"] def citys = CommonDatautils.findAllCity();
//def citys = CommonDatautils.findAllCity();
for(def city : citys){ for(def city : citys){
def dists = CommonDatautils.findAllDistrictByCity(city, "district", ["city","alias","region","name", "finish_building_date","estate_charge","lat","lng","lng2","lat2","household_count"]) def dists = CommonDatautils.findAllDistrictByCity(city, "district", ["city","alias","region","name", "finish_building_date","estate_charge","lat","lng","lng2","lat2","household_count"])
def code = cityCodeDatas.get(city) def code = cityCodeDatas.get(city)
@@ -17,6 +17,7 @@ import org.openqa.selenium.By
import org.openqa.selenium.WebDriver import org.openqa.selenium.WebDriver
import org.openqa.selenium.WebElement import org.openqa.selenium.WebElement
import org.openqa.selenium.chrome.ChromeDriver import org.openqa.selenium.chrome.ChromeDriver
import org.openqa.selenium.chrome.ChromeOptions
import org.openqa.selenium.support.ui.ExpectedConditions import org.openqa.selenium.support.ui.ExpectedConditions
import org.openqa.selenium.support.ui.WebDriverWait import org.openqa.selenium.support.ui.WebDriverWait
@@ -44,6 +45,7 @@ public class BeiKeCrawlByChrome {
def run(){ def run(){
System.setProperty("webdriver.chrome.driver", "C:\\Users\\gaojuan\\AppData\\Local\\Google\\Chrome\\Application\\chromedriver.exe"); System.setProperty("webdriver.chrome.driver", "C:\\Users\\gaojuan\\AppData\\Local\\Google\\Chrome\\Application\\chromedriver.exe");
System.setProperty("http.nonProxyHosts", "localhost"); System.setProperty("http.nonProxyHosts", "localhost");
WebDriver driver = new ChromeDriver() WebDriver driver = new ChromeDriver()
def citys = getAllCityUrls(driver) def citys = getAllCityUrls(driver)
citys = citys.reverse() citys = citys.reverse()
@@ -145,7 +147,12 @@ public class BeiKeCrawlByChrome {
def detailUrls = [] def detailUrls = []
while(!stop){ while(!stop){
def url = cityUrl + "/chengjiao/pg${page}/" def url = cityUrl + "/chengjiao/pg${page}/"
driver.get(url) try{
driver.get(url)
}catch(Exception e){
println url +" ³ö´í"
}
def doc = Jsoup.parse(driver.getPageSource()); def doc = Jsoup.parse(driver.getPageSource());
def elements = JQueryUtils.select(".listContent li", doc) def elements = JQueryUtils.select(".listContent li", doc)
if(elements){ if(elements){
@@ -153,7 +160,7 @@ public class BeiKeCrawlByChrome {
def durl = e.select(".title a").attr("href") def durl = e.select(".title a").attr("href")
def dealDate = e.select(".dealDate").text() def dealDate = e.select(".dealDate").text()
dealDate = DateUtils.parseFromTightByPattern(dealDate, "yyyy.MM.dd") dealDate = DateUtils.parseFromTightByPattern(dealDate, "yyyy.MM.dd")
def endDate = DateUtils.parseFromTightByPattern("2022-04-20", "yyyy-MM-dd") def endDate = DateUtils.parseFromTightByPattern("2022-05-20", "yyyy-MM-dd")
if(dealDate && dealDate.getTime()>=endDate.getTime()){ if(dealDate && dealDate.getTime()>=endDate.getTime()){
detailUrls << durl detailUrls << durl
parse(city, e) parse(city, e)
@@ -190,10 +197,16 @@ public class BeiKeCrawlByChrome {
def roomStr = arrs[1] def roomStr = arrs[1]
if (roomStr) { if (roomStr) {
if (roomStr.indexOf("ÊÒ") > 0) { if (roomStr.indexOf("ÊÒ") > 0) {
detail.room = roomStr.substring(0, roomStr.indexOf("ÊÒ")).toInteger() roomStr = roomStr.substring(0, roomStr.indexOf("ÊÒ"))
if(roomStr && roomStr.isNumber()){
detail.room = roomStr.toInteger()
}
} }
if (roomStr.indexOf("Ìü") > 0 && roomStr.indexOf("ÊÒ") > 0) { if (roomStr.indexOf("Ìü") > 0 && roomStr.indexOf("ÊÒ") > 0) {
detail.hall = roomStr.substring(roomStr.indexOf("ÊÒ") + 1, roomStr.indexOf("Ìü")).toInteger() def hallStr = roomStr.substring(roomStr.indexOf("ÊÒ") + 1, roomStr.indexOf("Ìü"))
if(hallStr && hallStr.isNumber()){
detail.hall = hallStr.toInteger()
}
} }
} }
@@ -15,28 +15,29 @@ class ExportPaimai {
static main(args) { static main(args) {
def task = new ExportPaimai(); def task = new ExportPaimai();
task.run() // task.run()
// task.addressStandard() // task.addressStandard()
// task.addPrice() // task.addPrice()
// task.stat() task.stat()
// task.standard()
} }
def stat(){ def stat(){
def file = "D:\\数据\\重庆农商行\\法拍\\宿迁法拍数据.xlsx" def file = "D:\\数据\\重庆农商行\\法拍\\苏州商业法拍原数据(已成交).xlsx"
def datas = ExcelUtils.read(file, 0, 1) def datas = ExcelUtils.read(file, 0, 1)
def index1 = 0 def index1 = 0
def rates1 = [] def rates1 = []
for(def d : datas){ for(def d : datas){
if(d['P'] && d['P']=='Òѳɽ»'){ if(d['P'] && d['P']=='Òѳɽ»'){
if(d['M'] && d['M']=="住宅") // if(d['M'] && d['M']=="住宅")
// if(d['K']>=150){ // if(d['K']>=240){
// index1++ // index1++
// def sumTradePrice = d['S'] // def sumTradePrice = d['S']
// def marketPrice = d['Y'] // def marketPrice = d['Y']
// rates1 << sumTradePrice/marketPrice // rates1 << sumTradePrice/marketPrice
// } // }
if(d['S']>2000000){ if(d['S']<800000){
index1++ index1++
def sumTradePrice = d['S'] def sumTradePrice = d['S']
def marketPrice = d['Y'] def marketPrice = d['Y']
@@ -56,12 +57,55 @@ class ExportPaimai {
}) })
} }
def addressStandard(){ def addressStandard(){
ExcelUtils.multiThreadingModify("D:\\数据\\重庆农商行\\法拍\\重庆法拍数据.xlsx",{d-> ExcelUtils.multiThreadingModify("D:\\数据\\重庆农商行\\法拍\\需要重跑地址解析和匹配_重庆法拍数据.xlsx",{d->
def formatAddress = AddressUtil.formatAddress(d['C'], d['A']) def formatAddress = AddressUtil.formatAddress(d['C'], d['A'])
if(formatAddress){ if(formatAddress){
d['F'] = formatAddress d['F'] = formatAddress
} }
}) })
}
def standard(){
ExcelUtils.multiThreadingModify("D:\\数据\\重庆农商行\\法拍\\需要重跑地址解析和匹配_重庆法拍数据.xlsx",{d->
def obj = com.fangjia.script.gj.district.FangjiaClientUtils.addressStand(d['C'], d['B'])
if(obj){
def arrs = obj.entities
def address = ""
def houseNum = ""
def roomNum = ""
def unitNum = ""
def poi = ""
for(def m : arrs){
if(m.type == "road"){
address = m.word
}
if(m.type == "roadno"){
address = address + m.word
}
if(m.type == "houseno"){
houseNum = m.word
}
if(m.type == "roomno"){
roomNum = m.word
}
if(m.type == "cellno"){
unitNum = m.word
}
if(m.type == "poi"){
poi = m.word
}
}
d['F'] = address
d['G'] = houseNum
d['H'] = unitNum
d['I'] = roomNum
d['J'] = poi
}
})
} }
def run(){ def run(){
@@ -123,17 +167,20 @@ class ExportPaimai {
row << d.url row << d.url
rows << row rows << row
}else{
println d.title
} }
} }
ExcelUtils.write("D:\\数据\\重庆农商行\\法拍\\重庆法拍原数据.xlsx",rows,"数据") ExcelUtils.write("D:\\数据\\重庆农商行\\法拍\\苏州商业法拍原数据(已流拍).xlsx",rows,"数据")
} }
def findPaimaiData(){ def findPaimaiData(){
def pmquery = new BasicDBObject() def pmquery = new BasicDBObject()
pmquery.put("city","重庆") pmquery.put("city","苏州")
pmquery.put("region","姑苏")
pmquery.put("startDate", new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD("2019-01-01"))) pmquery.put("startDate", new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD("2019-01-01")))
pmquery.put("mDate", new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD("2022-06-01"))) pmquery.put("mDate", new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD("2022-07-01")))
pmquery.put("status","已成交") pmquery.put("status","已流拍")
def dbcursor = paimai43_COLL.find(pmquery).sort(new BasicDBObject("finishDate",-1)) def dbcursor = paimai43_COLL.find(pmquery).sort(new BasicDBObject("finishDate",-1))
def rets = [] def rets = []
for(def db : dbcursor){ for(def db : dbcursor){
@@ -129,7 +129,7 @@ public class LianjiaCrawlByChrome {
def standardRegion(){ def standardRegion(){
def q = new BasicDBObject() def q = new BasicDBObject()
q.put("trade_date", new BasicDBObject(QueryOperators.GTE, DateUtils.parseFromTightByPattern("2022-03-01","yyyy-MM-dd"))) q.put("trade_date", new BasicDBObject(QueryOperators.GTE, DateUtils.parseFromTightByPattern("2022-01-01","yyyy-MM-dd")))
q.put("match_id", new BasicDBObject(QueryOperators.EXISTS, false) ) q.put("match_id", new BasicDBObject(QueryOperators.EXISTS, false) )
def dbcursor = DEAL_PRICE_COLL.find(q) def dbcursor = DEAL_PRICE_COLL.find(q)
for(def d : dbcursor){ for(def d : dbcursor){
@@ -153,7 +153,7 @@ public class LianjiaCrawlByChrome {
lastMonth = lastMonth +"-01" lastMonth = lastMonth +"-01"
def q = new BasicDBObject() def q = new BasicDBObject()
q.put("region", null) q.put("region", null)
q.put("trade_date", new BasicDBObject(QueryOperators.GTE, DateUtils.parseFromTightByPattern("2022-01-01","yyyy-MM-dd"))) q.put("trade_date", new BasicDBObject(QueryOperators.GTE, DateUtils.parseFromTightByPattern("2022-05-01","yyyy-MM-dd")))
// q.put("source", new BasicDBObject('$in', ["链家在线","贝壳找房"])) // q.put("source", new BasicDBObject('$in', ["链家在线","贝壳找房"]))
def dbcursor = DEAL_PRICE_COLL.find(q) def dbcursor = DEAL_PRICE_COLL.find(q)
def keys = [] def keys = []
@@ -171,7 +171,7 @@ public class LianjiaCrawlByChrome {
query.put("region", null) query.put("region", null)
query.put("district_name", m.name) query.put("district_name", m.name)
// query.put("source", "链家在线") // query.put("source", "链家在线")
query.put("trade_date", new BasicDBObject(QueryOperators.GTE, DateUtils.parseFromTightByPattern(lastMonth,"yyyy-MM-dd"))) // query.put("trade_date", new BasicDBObject(QueryOperators.GTE, DateUtils.parseFromTightByPattern(lastMonth,"yyyy-MM-dd")))
def data = new BasicDBObject() def data = new BasicDBObject()
data.put("region", dist.region) data.put("region", dist.region)
@@ -238,7 +238,7 @@ public class LianjiaCrawlByChrome {
def durl = e.select(".title a").attr("href") def durl = e.select(".title a").attr("href")
def dealDate = e.select(".dealDate").text() def dealDate = e.select(".dealDate").text()
dealDate = DateUtils.parseFromTightByPattern(dealDate, "yyyy.MM.dd") dealDate = DateUtils.parseFromTightByPattern(dealDate, "yyyy.MM.dd")
def endDate = DateUtils.parseFromTightByPattern("2022-04-20", "yyyy-MM-dd") def endDate = DateUtils.parseFromTightByPattern("2022-05-20", "yyyy-MM-dd")
if(dealDate.getTime()>=endDate.getTime()){ if(dealDate.getTime()>=endDate.getTime()){
detailUrls << durl detailUrls << durl
parse(city, e) parse(city, e)
@@ -442,11 +442,11 @@ public class LianjiaCrawlByChrome {
def cityDoc = Jsoup.parse(driver.getPageSource()); def cityDoc = Jsoup.parse(driver.getPageSource());
def cityEles = JQueryUtils.select(".city_province a", cityDoc) def cityEles = JQueryUtils.select(".city_province a", cityDoc)
def cityMap = [:] def cityMap = [:]
def citys= ["¸£ÖÝ"] def citys= ["°²Çì"]
if(cityEles){ if(cityEles){
for(def e : cityEles) { for(def e : cityEles) {
def href = e.attr("href") def href = e.attr("href")
if (!href.contains("fang.lianjia")){ if (!href.contains("fang.lianjia") && citys.contains(e.text())){
cityMap.put(e.text(), href) cityMap.put(e.text(), href)
} }
} }
@@ -23,28 +23,29 @@ DBCollection paimai43_COLL = MongoUtils.getCollectionByName2("fangjia_crawl", "p
//String str = format.format(date); //String str = format.format(date);
//System.out.println(str); //System.out.println(str);
def pmquery = new BasicDBObject() //def pmquery = new BasicDBObject()
pmquery.put("city","ËÞǨ") //pmquery.put("city","ËÞǨ")
pmquery.put("startDate", new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD("2019-01-01"))) //pmquery.put("startDate", new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD("2019-01-01")))
//pmquery.put("status","Òѳɽ»") ////pmquery.put("status","Òѳɽ»")
//pmquery.put("estateType", null) ////pmquery.put("estateType", null)
pmquery.put("url","https://sf-item.taobao.com/sf_item/665574733237.htm") //pmquery.put("url","https://sf-item.taobao.com/sf_item/665574733237.htm")
//
def cur = paimai43_COLL.find(pmquery) //def cur = paimai43_COLL.find(pmquery)
def urls = [] //def urls = []
for(def o : cur){ //for(def o : cur){
urls << o.url // urls << o.url
} //}
println "´ý½âÎö£º"+urls //println "´ý½âÎö£º"+urls
def index = 0 def index = 0
for(def url : urls){ //for(def url : urls){
def q = new BasicDBObject() def q = new BasicDBObject()
q.put("url", url) // q.put("url", url)
q.put("update_time", new BasicDBObject('$gte',DateUtils.parseFromTightByPattern("2022-07-12", "yyyy-MM-dd")))
def dbcursor = collection.find(q) def dbcursor = collection.find(q)
index++
println index
for(def d : dbcursor){
for(def d : dbcursor){
index++
println index
JSON json = new JSONObject() JSON json = new JSONObject()
json.put("project", "paimai_taobao") json.put("project", "paimai_taobao")
json.put("url", d.url) json.put("url", d.url)
@@ -64,8 +65,8 @@ for(def url : urls){
json.put("result", result) json.put("result", result)
byte[] packedMsg = MessageUtils.pack(json) byte[] packedMsg = MessageUtils.pack(json)
CommonUtils.sendMessage("result2parse2dev", packedMsg) CommonUtils.sendMessage("result2parse", packedMsg)
} }
} //}
@@ -34,7 +34,39 @@ class PaimaiTest {
// task.updatePaimai() // task.updatePaimai()
// task.updateFieldPaimai() // task.updateFieldPaimai()
// task.statCity() // task.statCity()
task.jsStat() // task.jsStat()
task.selectData()
}
def selectData(){
def urls = ["https://sf-item.taobao.com/sf_item/674045056937.htm",
"https://sf-item.taobao.com/sf_item/669281206202.htm",
"https://sf-item.taobao.com/sf_item/646818853936.htm",
"https://sf-item.taobao.com/sf_item/636815760791.htm",
"https://sf-item.taobao.com/sf_item/636055429237.htm",
"https://sf-item.taobao.com/sf_item/635094754807.htm",
"https://sf-item.taobao.com/sf_item/621286459023.htm",
"https://sf-item.taobao.com/sf_item/613944729986.htm",
"https://sf-item.taobao.com/sf_item/613944489517.htm",
"https://sf-item.taobao.com/sf_item/604967216580.htm",
"https://sf-item.taobao.com/sf_item/596302571187.htm",
"https://sf-item.taobao.com/sf_item/594722220602.htm"
]
for(def url : urls){
def q = new BasicDBObject()
q.put("url", url)
def obj = paimai43_COLL.findOne(q)
if(obj){
if(obj.matchName=="中渝国宾城"){
def udata = new BasicDBObject()
udata.put("matchName", "中渝山顶道国宾城")
paimai43_COLL.update(new BasicDBObject('_id', obj._id), new BasicDBObject('$set', udata))
}
println url +" "+obj.matchName
}else{
println url +" 不存在"
}
}
} }
def jsStat(){ def jsStat(){
@@ -0,0 +1,275 @@
package com.fangjia.script.gj.test
import com.fangjia.script.ccbevaluation.CcbCommonUtils
import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.gj.ccb.CcbCodeUtils
import com.fangjia.script.util.DateUtils
import com.fangjia.script.util.ElasticUtils
import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.MongoUtils
import com.mongodb.BasicDBObject
import com.mongodb.DBCollection
import com.mongodb.DBObject
import org.elasticsearch.index.query.BoolQueryBuilder
import org.elasticsearch.index.query.QueryBuilder
import org.elasticsearch.index.query.QueryBuilders
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.CountDownLatch
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
import java.util.concurrent.atomic.AtomicLong
def lineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.43:28017";
DBCollection DEAL_PRICE_COLL = MongoUtils.getCollectionByName2("fangjia", "deal_price", lineUrl)
DBCollection paimai43_COLL = MongoUtils.getCollectionByName2("fangjia_crawl", "pai_mai", lineUrl)
ExecutorService fixedThreadPool = Executors.newFixedThreadPool(40)
DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43")
DBCollection region_stat_coll = MongoUtils.getCollectionByName("fangjia", "region_stat", "192.168.0.43")
//def q = new BasicDBObject()
//q.put("city","重庆")
//q.put("trade_date", new BasicDBObject('$gte', DateUtils.parseFromTightByPattern("2021-07-01", "yyyy-MM-dd")))
//def dbcursor = DEAL_PRICE_COLL.find(q)
//def map = [:]
//for(def d : dbcursor){
// def list = map.get(d.region)
// if(!list){
// list = []
// map.put(d.region, list)
// }
// def key = d.district_name+"##"+d.area+"##"+d.total_price+"##"+DateUtils.formatDateByPattern(d.trade_date, "yyyyMMdd")
// if(!list.contains(key)){
// list << key
// }
//}
//def q = new BasicDBObject()
//q.put("status","已成交")
//q.put("startDate", new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD("2021-07-01")))
//def dbcursor = paimai43_COLL.find(q)
//def map = [:]
//for(def d : dbcursor){
// def list = map.get(d.region)
// if(!list){
// list = []
// map.put(d.region, list)
// }
// if(!list.contains(d.title)){
// list << d.title
// }
//}
//ExcelUtils.modify("D:\\数据\\朔州房源.xlsx",{r->
// def dist = CommonDatautils.findDistrict(r['A'],r['B'], r['C'], "district")
// if(dist){
// r['E'] = "名称完全一致"
// }
//
//})
def citys = ["锡林郭勒盟","保亭","塔城","陇南","海东","日喀则","迪庆州","忻州","昌吉","海西州","和田","克拉玛依","梅州","潮州","延安","楚雄","阿克苏","平凉","商洛","普洱","大兴安岭","白山","西双版纳州","临夏","榆林","阿勒泰","文昌","陵水","吐鲁番","庆阳","临沧","保山","黑河","喀什","白银","朔州","龙岩","韶关","揭阳","儋州","吕梁","来宾","渭南","肇庆","运城","丽江","德宏州","长治","黔南","张掖","金华","河源","邢台","晋中","宁德","曲靖","昭通","拉萨","玉溪","林芝","百色","仙桃","湘潭","滨州","随州","日照","呼伦贝尔","崇左","汕尾"]
def districts = CommonDatautils.findAllDistrictByCity("朔州","district",["city","region","name","alias"])
def totalCount = new AtomicLong()
final CountDownLatch latch = new CountDownLatch(districts.size())
println "小区量:"+districts.size()
def retMap = new ConcurrentHashMap()
for(def i=0;i<districts.size();i++){
final def rMap = districts[i];
fixedThreadPool.execute(new Runnable() {
void run() {
try {
totalCount.addAndGet(1)
def ret = findHouses(rMap.city, rMap.region, "sell", 20210701,rMap.name, rMap.mapping_alias)
println totalCount.get() +" "+rMap.region+" "+rMap.name+" size:"+ret.size()+" "+new Date().toLocaleString()
// if(!ret){
// ret = findThirdParty(rMap.city, rMap.region, rMap.name, AVERAGE_STATISTICS)
// }
if(ret && ret.size()<=3){
def key = rMap.city+"#"+rMap.region+"#"+rMap.name
retMap.put(key, ret.size())
}
} catch (Exception e) {
e.printStackTrace()
} finally {
latch.countDown()
}
};
})
}
latch.await()
ExcelUtils.write("D:\\数据\\房源小于4个以下的小区.xlsx", datas, "数量")
//def rets = findHousesByCity("朔州", "sell", 20210701)
//def map = [:]
//for(def r : rets){
// def key = r.city+"#"+r.region+"#"+r.district_name
// def count = map.get(key)
// if(!count){
// count = 1
// map.put(key, count)
// }else{
// map.put(key, count+1)
// }
//}
//
//def datas = []
//datas << ["城市","区域","名称","数量"]
//retMap.each {k,count->
// def arrs = k.split("#")
// datas << [arrs[0], arrs[1], arrs[2], count]
//}
//ExcelUtils.write("D:\\数据\\朔州匹配房源1.xlsx", datas, "数量")
//ExcelUtils.modify("D:\\数据\\重庆农商行\\重庆数据统计.xlsx",{d->
// def count = retMap.get(d['A'])
// if(count){
// def pre = count.toInteger()*100/d['B'].toString().toDouble().toInteger()
// pre = com.fangjia.script.common.DataHandleUtils.getDoubleRound(2, pre)
// d['E'] = pre
// }
// if(d['A'] && !d['H']){
// def prices = CommonDatautils.queryCityRegionPrices("重庆", d['A'], '2022-01-01')
// if(prices){
// def avg_prices = prices.sum()/prices.size()
// d['H'] = avg_prices.toInteger()
// }
// def prices = CommonDatautils.queryDistrictPrices("重庆", d['A'], '2022-01-01')
// if(prices){
// def avg_prices = prices.sum()/prices.size()
// d['H'] = avg_prices.toInteger()
// }
// }
//})
//ExcelUtils.multiThreadingModify("D:\\数据\\房源\\估值数据统计结果20220715.xlsx",{d->
// def rets = findHousesByCityAndRoot(d['A'], "sell", 20210701, "anjuke.com")
// d['R'] = rets.size()
// println d['A'] +" "+rets.size()
//
//})
def countMap = ["深圳":5,"中山":409,"贵阳":372,"南宁":1130,"台州":1325,"杭州":1177,"南昌":1369,"厦门":1370,"绍兴":1363,"徐州":1468,"长沙":1620,"东莞":1673,"郑州":1769,"遵义":1004,"温州":2012,"烟台":2080,"哈尔滨":5459,"湛江":392,"株洲":1068,"武汉":2486,"长春":2857,"岳阳":356,"肇庆":607,"镇江":1043,"芜湖":402,"银川":505,"合肥":2818,"宜昌":786,"淄博":2441,"佛山":3067,"马鞍山":227,"清远":537,"汕头":707,"洛阳":552,"济南":3456,"九江":138,"秦皇岛":1495,"宁波":3772,"乌鲁木齐":2273,"沧州":394,"泉州":4692,"廊坊":1120,"唐山":2626,"石家庄":4914,"漳州":4071,"张家口":357,"沈阳":5000,"青岛":5052,"柳州":2270,"安庆":756,"兰州":5399,"拉萨":784,"昆明":5436,"吉林":2274,"惠州":6206,"嘉兴":6142,"常德":963,"梅州":317,"绵阳":494,"海口":7883,"江门":663,"临沂":1473,"日照":2070,"襄阳":209,"湖州":3667,"平顶山":1501,"泰安":356,"大同":2814,"衡阳":241,"桂林":372,"临汾":372,"锦州":2875,"北海":2507,"赣州":1659,"商丘":644,"德州":639,"渭南":430,"咸阳":301,"聊城":932,"保定":3672,"许昌":266,"邢台":277,"潍坊":3743,"西宁":4002,"宝鸡":204,"邯郸":2361,"安阳":557,"济宁":2194,"龙岩":367,"太原":7524,"南充":568,"盐城":6512,"阜阳":198,"运城":462,"菏泽":320,"晋中":539,"新乡":768,"滁州":1025,"衡水":969,"信阳":1048,"长治":806,"韶关":696,"荆州":361,"汉中":118,"威海":3030,"孝感":984,"东营":874,"宜春":251,"开封":111,"驻马店":549,"湘潭":410,"黄冈":250,"三亚":7481,"上饶":164,"眉山":284,"绥化":851,"宁德":1469,"苏州":8876,"焦作":767,"牡丹江":1009,"齐齐哈尔":566,"枣庄":2636,"河源":167,"宿迁":3428,"遂宁":81,"滨州":3454,"漯河":308,"周口":1670,"茂名":347,"大庆":932,"平凉":210,"南阳":4087,"黄石":99,"鄂尔多斯":452,"营口":1470,"包头":4789,"吉安":442,"金华":13539,"通辽":238,"泸州":183,"乐山":2776,"佳木斯":506,"三门峡":574,"承德":2923,"荆门":64,"曲靖":1521,"忻州":770,"潮州":359,"永州":209,"揭阳":934,"呼伦贝尔":353,"扬州":12477,"宣城":293,"赤峰":2770,"吕梁":2618,"宜宾":322,"濮阳":2389,"宿州":264,"阳江":270,"延安":388,"丹东":885,"怀化":258,"黄山":312,"十堰":2687,"抚州":179,"郴州":4355,"衢州":1714,"陇南":4,"榆林":4694,"延边":1640,"抚顺":258,"丽水":817,"庆阳":2069,"玉溪":254,"玉林":544,"咸宁":1983,"舟山":1970,"达州":990,"亳州":289,"呼和浩特":10185,"张掖":64,"广元":148,"益阳":156,"汕尾":2392,"昌吉":225,"蚌埠":5496,"天水":173,"随州":211,"珠海":13972,"巴彦淖尔":0,"楚雄":95,"乌兰察布":172,"新余":86,"南平":7781,"广安":2129,"景德镇":474,"铁岭":2676,"松原":747,"淮安":13859,"三明":6425,"朝阳":3393,"酒泉":479,"四平":261,"梧州":248,"自贡":2983,"黔东南":205,"大理":1914,"黔南":866,"内江":177,"仙桃":70,"白银":2398,"朔州":1861,"娄底":2601,"六盘水":277,"百色":73,"阳泉":2135,"德阳":9330,"邵阳":2425,"盘锦":4269,"双鸭山":0,"白山":60,"通化":2379,"红河":4013,"鄂州":149,"吴忠":244,"毕节":88,"云浮":10,"伊犁":579,"丽江":331,"贵港":705,"黑河":10,"安康":381,"葫芦岛":6562,"资阳":1320,"鹤壁":1904,"萍乡":173,"锡林郭勒盟":34,"防城港":33,"钦州":2141,"阿克苏":540,"鹤岗":233,"铜川":12,"喀什":68,"巴中":2540,"凉山州":0,"鹰潭":46,"石嘴山":468,"保山":152,"伊春":54,"六安":7649,"定西":75,"鸡西":2384,"临夏":1598,"海西州":0,"商洛":58,"中卫":112,"普洱":302,"湘西":4,"来宾":8,"张家界":21,"西双版纳州":0,"恩施":2215,"攀枝花":87,"晋城":6613,"乌海":361,"七台河":172,"雅安":1152,"黔西南":391,"嘉峪关":37,"淮南":6767,"潜江":0,"辽源":163,"临沧":89,"塔城":1,"克拉玛依":121,"金昌":10,"儋州":33,"海东":106,"大兴安岭":5,"兴安盟":972,"和田":0,"吐鲁番":107,"迪庆州":14,"安顺":1939,"日喀则":32,"文昌":2,"林芝":9,"保亭":0,"陵水":0,"阿勒泰":177,"天门":370,"崇左":560,"莆田":12067,"白城":2422,"铜仁":2209,"河池":1926,"辽阳":4615,"昭通":1995,"哈密":2592,"本溪":4452,"武威":1885,"德宏州":1654,"大连":18125,"成都":17618,"博尔塔拉":2094,"贺州":2168,"池州":6831,"固原":4445,"阜新":6345,"鞍山":15277,"巴音郭楞":7481,"铜陵":9225,"泰州":26770,"南通":26075,"连云港":30835,"西安":28834,"淮北":16917,"北京":35728,"南京":32406,"无锡":48220,"广州":50209,"天津":63311,"上海":160627,"常州":155553,"重庆":221058]
ExcelUtils.multiThreadingModify("D:\\数据\\房源\\估值数据统计结果20220715.xlsx",{d->
def count = countMap.get(d['A'])
d['R'] = count
})
println "完成"
def findThirdParty(city, region, name, coll){
def q = new BasicDBObject()
q.put("city", city)
q.put("region", region)
q.put("name", name)
q.put("s_date", new BasicDBObject('$gte', 202107))
def dbcursor = coll.find(q)
def rets = []
for(def d : dbcursor){
if(d && d.size()>9){
println d
rets << d
}
}
return rets
}
def findHouses(def city, def region, def cat, def startDate, def name, def alias){
QueryBuilder date_range = QueryBuilders.rangeQuery("p_date").from(startDate).includeLower(false).includeUpper(false);
QueryBuilder area_range = QueryBuilders.rangeQuery("area").includeLower(true).includeUpper(false);
QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(QueryBuilders.termQuery("city", city)).must(QueryBuilders.termQuery("region", region)).must(QueryBuilders.termQuery("cat", cat))
.must(date_range).must(area_range)
if(!alias){
alias = []
}
if(!alias.contains(name)){
alias.add(name)
}
if(name.contains("弄小区")){
def newName = name.replace("弄小区","弄")
if(!alias.contains(newName)){
alias << newName
}
}
if(alias && alias.size()>0){
BoolQueryBuilder inBuilder = QueryBuilders.boolQuery();
for(def s : alias){
inBuilder.should(QueryBuilders.matchQuery("district_name", s));
}
queryBuilder.must(inBuilder)
}
def rets = []
def houses = ElasticUtils.executeSimpleQuery("192.168.0.206", "seawater-20*", queryBuilder);
return houses;
}
def findHousesByCity(def city, def cat, def startDate){
QueryBuilder date_range = QueryBuilders.rangeQuery("p_date").from(startDate).includeLower(false).includeUpper(false);
QueryBuilder area_range = QueryBuilders.rangeQuery("area").includeLower(true).includeUpper(false);
QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(QueryBuilders.termQuery("city", city)).must(QueryBuilders.termQuery("cat", cat))
.must(date_range).must(area_range)
def houses = ElasticUtils.executeSimpleQuery("192.168.0.206", "seawater-20*", queryBuilder);
return houses;
}
def findHousesByCityAndRoot(def city, def cat, def startDate, def root){
QueryBuilder date_range = QueryBuilders.rangeQuery("p_date").from(startDate).includeLower(false).includeUpper(false);
QueryBuilder area_range = QueryBuilders.rangeQuery("area").includeLower(true).includeUpper(false);
QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(QueryBuilders.termQuery("city", city)).must(QueryBuilders.termQuery("cat", cat))
.must(date_range).must(area_range).must(QueryBuilders.termQuery("root", root))
def houses = ElasticUtils.executeSimpleQuery("192.168.0.206", "seawater-20*", queryBuilder);
return houses;
}
//def map = [:]
//for(def d : dists){
// def list = map.get(d.region)
// if(!list){
// list = []
// map.put(d.region, list)
// }
// list << d
//}
//
//def rows = []
//rows << ["区域","小区量", "别名量", "地址别名量"]
//map.each{region, list->
// def alias_count = 0
// def addr_alias_count = 0
// for(def r : list){
// if(r.mapping_alias && r.mapping_alias.size()>0){
// alias_count ++
// }
// if(r.addr_alias && r.addr_alias.size()>0){
// addr_alias_count++
// }
// }
//
// rows << [region, list.size(), alias_count, addr_alias_count]
//}
//
//ExcelUtils.write("D:\\数据\\重庆农商行\\重庆数据统计.xlsx", rows, "楼盘统计")
@@ -1,17 +1,25 @@
package com.fangjia.script.gj.test package com.fangjia.script.gj.test
import ch.qos.logback.core.db.dialect.DBUtil
import com.fangjia.core.RegionData import com.fangjia.core.RegionData
import com.fangjia.script.commData.CommonDatautils import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.lixue.util.DBUtils
import com.fangjia.script.util.CommonUtils import com.fangjia.script.util.CommonUtils
import com.fangjia.script.util.DateUtils import com.fangjia.script.util.DateUtils
import com.fangjia.script.util.DbUtils
import com.fangjia.script.util.ExcelUtils import com.fangjia.script.util.ExcelUtils
import com.mongodb.BasicDBObject import com.mongodb.BasicDBObject
import com.mongodb.DBCollection import com.mongodb.DBCollection
import com.mongodb.Mongo import com.mongodb.Mongo
import groovy.sql.Sql import groovy.sql.Sql
import org.bson.types.ObjectId
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
def dist = CommonDatautils.findDistrictById("62ce233a3705890001dfa164")
DBUtils.seaweed.save(dist)
//DbUtils.seaweed.update(new BasicDBObject("_id", new ObjectId("62ce233a3705890001dfa164")), new BasicDBObject('$set', dist))
//SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); //SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
//Date date = new Date(1617211269868); //Date date = new Date(1617211269868);
//print dateFormat.format(date); //print dateFormat.format(date);
@@ -50,13 +58,13 @@ import java.text.SimpleDateFormat
//} //}
def dists = CommonDatautils.findAllDistrictByCity("上海", "district", ["city","region","name","finish_building_date"]) //def dists = CommonDatautils.findAllDistrictByCity("ÉϺ£", "district", ["city","region","name","finish_building_date"])
def rets = [] //def rets = []
for(def d : dists){ //for(def d : dists){
def year = CommonUtils.getDistrictAge(d) // def year = CommonUtils.getDistrictAge(d)
rets << [d.city,d.region, d.name, year] // rets << [d.city,d.region, d.name, year]
} //}
ExcelUtils.write("D:\\数据\\统计房龄.xlsx", rets, "数据") //ExcelUtils.write("D:\\Êý¾Ý\\ͳ¼Æ·¿Áä.xlsx", rets, "Êý¾Ý")
@@ -24,10 +24,6 @@ import java.util.concurrent.atomic.AtomicInteger
*/ */
class GaoDeUtils { class GaoDeUtils {
// лñÈ¡key
def static GAO_DE_AK = ["4e9592208336433ee1b7aa4d1d434418", "10bcb421d2ee4e51ed9268d6dca58ad1"]
def static AtomicInteger keyUsed = new AtomicInteger(0)
def static codeNameMap = new HashMap<String, String>(){{ def static codeNameMap = new HashMap<String, String>(){{
put("150500", "地铁"); put("150500", "地铁");
put("1507", "公交"); put("1507", "公交");
@@ -54,6 +50,20 @@ class GaoDeUtils {
put("0601", "商场") put("0601", "商场")
}}; }};
/**
* »ñÈ¡¸ßµÂKEY
* @return
*/
static String getGaodeKey(String type) {
Map<String, String> params = new HashMap<>();
params.put("type", type)
JSONObject json = HttpRequestUtil.getJsonContent("http://192.168.0.100:38080/FangJiaDataService/getAmapKey", params)
if (json.status == 0 && json.result != null) {
return json.result
}
System.exit(1);
}
/** /**
* 查找周边配套 * 查找周边配套
* @param city * @param city
@@ -66,7 +76,7 @@ class GaoDeUtils {
*/ */
static List searchNearByPoi(String city, String types, Double lng, Double lat, Integer radius, String keywords){ static List searchNearByPoi(String city, String types, Double lng, Double lat, Integer radius, String keywords){
def params = [:] def params = [:]
params.key = GAO_DE_AK[keyUsed]
if (types) { if (types) {
params.types = types params.types = types
@@ -83,25 +93,17 @@ class GaoDeUtils {
while (result.size() < count) { while (result.size() < count) {
params.page = "${page}".toString() params.page = "${page}".toString()
page++ page++
params.key = this.getGaodeKey("v3/place/around")
JSONObject json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v3/place/around", params); JSONObject json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v3/place/around", params);
if (json == null) { if (json == null) {
params.key = this.getGaodeKey("v3/place/around")
json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v3/place/around", params); json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v3/place/around", params);
} }
if (json && json.info && json.info == "OK") { if (json && json.info && json.info == "OK") {
count = json.getString("count").toInteger() count = json.getString("count").toInteger()
result.addAll(DataUtil.toMongoDbObj(json.pois)) result.addAll(DataUtil.toMongoDbObj(json.pois))
} else if (json && json.infocode && json.infocode == "10044") { } else if (json && json.infocode && json.infocode == "10044") {
synchronized (this) { System.exit(1)
for (int i = 0; i < GAO_DE_AK.size(); i++) {
if (GAO_DE_AK[i] == params.key) {
if (i + 1 >= GAO_DE_AK.size()) {
System.exit(1)
}
keyUsed = new AtomicInteger(i+1)
}
}
break;
}
} else if (json && json.infocode && json.infocode == "10004") { } else if (json && json.infocode && json.infocode == "10004") {
// 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。 // 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。
Thread.sleep(60000) Thread.sleep(60000)
@@ -128,7 +130,6 @@ class GaoDeUtils {
*/ */
static List searchNearDtoByPoi(String city, String types, Double lng, Double lat, Integer radius, String keywords){ static List searchNearDtoByPoi(String city, String types, Double lng, Double lat, Integer radius, String keywords){
def params = [:] def params = [:]
params.key = GAO_DE_AK[keyUsed.intValue()]
if (types) { if (types) {
params.types = types params.types = types
@@ -145,8 +146,10 @@ class GaoDeUtils {
while (result.size() < count) { while (result.size() < count) {
params.page = "${page}".toString() params.page = "${page}".toString()
page++ page++
params.key = this.getGaodeKey("v5/place/around")
JSONObject json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v5/place/around", params); JSONObject json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v5/place/around", params);
if (json == null) { if (json == null) {
params.key = this.getGaodeKey("v5/place/around")
json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v5/place/around", params); json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v5/place/around", params);
} }
if (json && json.info && json.info == "OK") { if (json && json.info && json.info == "OK") {
@@ -158,26 +161,14 @@ class GaoDeUtils {
ex.printStackTrace() ex.printStackTrace()
} }
} else if (json && json.infocode && json.infocode == "10044") { } else if (json && json.infocode && json.infocode == "10044") {
synchronized (this) { System.exit(1)
for (int i = 0; i < GAO_DE_AK.size(); i++) {
if (GAO_DE_AK[i] == params.key) {
if (i + 1 >= GAO_DE_AK.size()) {
System.exit(1)
}
keyUsed = new AtomicInteger(i+1)
}
}
break;
}
} else if (json && json.infocode && json.infocode == "10004") { } else if (json && json.infocode && json.infocode == "10004") {
// 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。 // 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。
Thread.sleep(60000) Thread.sleep(60000)
break; break;
} else if (json && json.infocode && json.infocode == "10017") { } else if (json && json.infocode && json.infocode == "10017") {
// 所请求的资源不可用 // 所请求的资源不可用
//System.exit(1) System.exit(1)
Thread.sleep(60000)
break;
} else { } else {
break break
} }
@@ -225,11 +216,12 @@ class GaoDeUtils {
*/ */
static List<AmapPoi> getAmapById(id){ static List<AmapPoi> getAmapById(id){
def params = [:] def params = [:]
params.key = GAO_DE_AK[keyUsed.intValue()]
params.id = id params.id = id
params.output = 'json' params.output = 'json'
params.key = this.getGaodeKey("v3/place/detail")
JSONObject json = HttpRequestUtil.getJsonContent("https://restapi.amap.com/v3/place/detail", params); JSONObject json = HttpRequestUtil.getJsonContent("https://restapi.amap.com/v3/place/detail", params);
if (json == null) { if (json == null) {
params.key = this.getGaodeKey("v3/place/detail")
json = HttpRequestUtil.getJsonContent("https://restapi.amap.com/v3/place/detail", params); json = HttpRequestUtil.getJsonContent("https://restapi.amap.com/v3/place/detail", params);
} }
if (json && json.info && json.info == "OK") { if (json && json.info && json.info == "OK") {
@@ -240,23 +232,13 @@ class GaoDeUtils {
ex.printStackTrace() ex.printStackTrace()
} }
} else if (json && json.infocode && json.infocode == "10044") { } else if (json && json.infocode && json.infocode == "10044") {
synchronized (this) { System.exit(1)
for (int i = 0; i < GAO_DE_AK.size(); i++) {
if (GAO_DE_AK[i] == params.key) {
if (i + 1 >= GAO_DE_AK.size()) {
System.exit(1)
}
keyUsed = new AtomicInteger(i+1)
}
}
}
} else if (json && json.infocode && json.infocode == "10004") { } else if (json && json.infocode && json.infocode == "10004") {
// 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。 // 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。
Thread.sleep(60000) Thread.sleep(60000)
} else if (json && json.infocode && json.infocode == "10017") { } else if (json && json.infocode && json.infocode == "10017") {
// 所请求的资源不可用 // 所请求的资源不可用
//System.exit(1) System.exit(1)
Thread.sleep(60000)
} }
return Collections.emptyList() return Collections.emptyList()
} }
@@ -266,11 +248,12 @@ class GaoDeUtils {
*/ */
static List<AmapPoiDetail> getAmapDetailById(id){ static List<AmapPoiDetail> getAmapDetailById(id){
def params = [:] def params = [:]
params.key = GAO_DE_AK[keyUsed.intValue()]
params.id = id params.id = id
params.output = 'json' params.output = 'json'
params.key = this.getGaodeKey("v3/place/detail")
JSONObject json = HttpRequestUtil.getJsonContent("https://restapi.amap.com/v3/place/detail", params); JSONObject json = HttpRequestUtil.getJsonContent("https://restapi.amap.com/v3/place/detail", params);
if (json == null) { if (json == null) {
params.key = this.getGaodeKey("v3/place/detail")
json = HttpRequestUtil.getJsonContent("https://restapi.amap.com/v3/place/detail", params); json = HttpRequestUtil.getJsonContent("https://restapi.amap.com/v3/place/detail", params);
} }
if (json && json.info && json.info == "OK") { if (json && json.info && json.info == "OK") {
@@ -281,23 +264,13 @@ class GaoDeUtils {
ex.printStackTrace() ex.printStackTrace()
} }
} else if (json && json.infocode && json.infocode == "10044") { } else if (json && json.infocode && json.infocode == "10044") {
synchronized (this) { System.exit(1)
for (int i = 0; i < GAO_DE_AK.size(); i++) {
if (GAO_DE_AK[i] == params.key) {
if (i + 1 >= GAO_DE_AK.size()) {
System.exit(1)
}
keyUsed = new AtomicInteger(i+1)
}
}
}
} else if (json && json.infocode && json.infocode == "10004") { } else if (json && json.infocode && json.infocode == "10004") {
// 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。 // 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。
Thread.sleep(60000) Thread.sleep(60000)
} else if (json && json.infocode && json.infocode == "10017") { } else if (json && json.infocode && json.infocode == "10017") {
// 所请求的资源不可用 // 所请求的资源不可用
//System.exit(1) System.exit(1)
Thread.sleep(60000)
} }
return Collections.emptyList() return Collections.emptyList()
} }
@@ -307,7 +280,6 @@ class GaoDeUtils {
*/ */
static List searchPoi(String city, String keywords, String region, String typecodes){ static List searchPoi(String city, String keywords, String region, String typecodes){
def params = [:] def params = [:]
params.key = GAO_DE_AK[keyUsed.intValue()]
params.keywords = keywords params.keywords = keywords
params.city = city params.city = city
params.region = region params.region = region
@@ -324,8 +296,10 @@ class GaoDeUtils {
while (result.size() < count) { while (result.size() < count) {
params.page = "${page}".toString() params.page = "${page}".toString()
page++ page++
params.key = this.getGaodeKey("v5/place/text")
JSONObject json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v5/place/text", params); JSONObject json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v5/place/text", params);
if (json == null) { if (json == null) {
params.key = this.getGaodeKey("v5/place/text")
json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v5/place/text", params); json = HttpRequestUtil.getJsonContent("http://restapi.amap.com/v5/place/text", params);
} }
if (json && json.info && json.info == "OK") { if (json && json.info && json.info == "OK") {
@@ -337,17 +311,7 @@ class GaoDeUtils {
ex.printStackTrace() ex.printStackTrace()
} }
} else if (json && json.infocode && json.infocode == "10044") { } else if (json && json.infocode && json.infocode == "10044") {
synchronized (this) { System.exit(1)
for (int i = 0; i < GAO_DE_AK.size(); i++) {
if (GAO_DE_AK[i] == params.key) {
if (i + 1 >= GAO_DE_AK.size()) {
System.exit(1)
}
keyUsed = new AtomicInteger(i+1)
}
}
break;
}
} else if (json && json.infocode && (json.infocode == "10004" || json.infocode == "10021" || json.infocode == "10017")) { } else if (json && json.infocode && (json.infocode == "10004" || json.infocode == "10021" || json.infocode == "10017")) {
// 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。 // 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。
Thread.sleep(60000) Thread.sleep(60000)
@@ -377,12 +341,13 @@ class GaoDeUtils {
*/ */
static def getGaoDeAddress(location) { static def getGaoDeAddress(location) {
Map<String, String> params = new HashMap<String, String>() Map<String, String> params = new HashMap<String, String>()
params.put("key", GAO_DE_AK[keyUsed.intValue()])
params.put("location", location) params.put("location", location)
String content String content
try { try {
params.put("key", this.getGaodeKey("v3/geocode/regeo"))
content = new HttpRequest().get("http://restapi.amap.com/v3/geocode/regeo", params, "utf-8") content = new HttpRequest().get("http://restapi.amap.com/v3/geocode/regeo", params, "utf-8")
} catch (Exception e) { } catch (Exception e) {
params.put("key", this.getGaodeKey("v3/geocode/regeo"))
content = new HttpRequest().get("http://restapi.amap.com/v3/geocode/regeo", params, "utf-8") content = new HttpRequest().get("http://restapi.amap.com/v3/geocode/regeo", params, "utf-8")
} }
net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(content) net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(content)
@@ -393,16 +358,7 @@ class GaoDeUtils {
return regeocode.formatted_address; return regeocode.formatted_address;
} }
} else if (json && json.infocode && json.infocode == "10044") { } else if (json && json.infocode && json.infocode == "10044") {
synchronized (this) { System.exit(1)
for (int i = 0; i < GAO_DE_AK.size(); i++) {
if (GAO_DE_AK[i] == params.key) {
if (i + 1 >= GAO_DE_AK.size()) {
System.exit(1)
}
keyUsed = new AtomicInteger(i+1)
}
}
}
} else if (json && json.infocode && json.infocode == "10004") { } else if (json && json.infocode && json.infocode == "10004") {
// 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。 // 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。
Thread.sleep(60000) Thread.sleep(60000)
@@ -418,13 +374,14 @@ class GaoDeUtils {
*/ */
static def parserByGaode(def city, def address) { static def parserByGaode(def city, def address) {
Map<String, String> params = new HashMap<String, String>() Map<String, String> params = new HashMap<String, String>()
params.put("key", GAO_DE_AK[keyUsed.intValue()])
params.put("city", city) params.put("city", city)
params.put("address", address) params.put("address", address)
String content String content
try { try {
params.put("key", this.getGaodeKey("v3/geocode/geo"))
content = new HttpRequest().get("https://restapi.amap.com/v3/geocode/geo", params, "utf-8") content = new HttpRequest().get("https://restapi.amap.com/v3/geocode/geo", params, "utf-8")
} catch (Exception e) { } catch (Exception e) {
params.put("key", this.getGaodeKey("v3/geocode/geo"))
content = new HttpRequest().get("https://restapi.amap.com/v3/geocode/geo", params, "utf-8") content = new HttpRequest().get("https://restapi.amap.com/v3/geocode/geo", params, "utf-8")
} }
net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(content) net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(content)
@@ -437,16 +394,7 @@ class GaoDeUtils {
return ["lng": arrs[0], "lat": arrs[1]] return ["lng": arrs[0], "lat": arrs[1]]
} }
} else if (json && json.infocode && json.infocode == "10044") { } else if (json && json.infocode && json.infocode == "10044") {
synchronized (this) { System.exit(1)
for (int i = 0; i < GAO_DE_AK.size(); i++) {
if (GAO_DE_AK[i] == params.key) {
if (i + 1 >= GAO_DE_AK.size()) {
System.exit(1)
}
keyUsed = new AtomicInteger(i+1)
}
}
}
} else if (json && json.infocode && json.infocode == "10004") { } else if (json && json.infocode && json.infocode == "10004") {
// 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。 // 开发者的单位时间内(1分钟)访问量超限,被系统自动封停,下一分钟自动解封。
Thread.sleep(60000) Thread.sleep(60000)
@@ -455,4 +403,8 @@ class GaoDeUtils {
System.exit(1) System.exit(1)
} }
} }
static void main(String[] args) {
println(this.getGaodeKey("v3/geocode/geo"))
}
} }
@@ -40,11 +40,11 @@ class DataStat {
def run(){ def run(){
def source = "Q·¿"// def source = "城市房产"//
def citys = findCrawlCity(source, 202204); def citys = findCrawlCity(source, 202205);
for(def city : citys){ for(def city : citys){
def count1 = findCount(source, city, 202204); def count1 = findCount(source, city, 202205);
def count2 = findCount(source, city, 202203); def count2 = findCount(source, city, 202206);
println city +" "+count1+" "+count2 println city +" "+count1+" "+count2
// println count1 // println count1
// println "--- ----" // println "--- ----"
@@ -193,7 +193,7 @@ class Esf58Crawl extends BaseBatch{
//addContent("福州","https://fz.58.com/xiaoqu/", 70); //addContent("福州","https://fz.58.com/xiaoqu/", 70);
// "宁波","佛山","南通","烟台","临沂","呼和浩特","海口","广州", // "宁波","佛山","南通","烟台","临沂","呼和浩特","海口","广州",
def citys = ["宁波","大连","佛山","乌鲁木齐","济南","长春","兰州","石家庄","温州","烟台","太原","泉州","南通","呼和浩特","徐州","惠州","厦门","南昌","临沂","贵阳","嘉兴","常州","盐城","威海","淄博","深圳","中山","重庆","苏州","西宁","绍兴","洛阳","廊坊","昆明","金华","珠海","宜昌","南充","信阳","杭州","沧州","宿迁","南阳","德州","桂林","新乡","包头","遵义","乐山","株洲","德阳","眉山","驻马店","许昌","宜宾","衡水","泸州","营口","清远","达州","宝鸡","长沙","广安"] def citys = ["¸£ÖÝ"]
for(def city : citys){ for(def city : citys){
def str = cityList.get(city) def str = cityList.get(city)
for(def i=0;i<1;i++){ for(def i=0;i<1;i++){
@@ -21,7 +21,9 @@ class SynchDistrictPrice {
// "anjuke.com":"安居客","cityhouse.cn":"城市房产","zhuge.com":"诸葛找房","5i5j.com":"我爱我家","jiwu.com":"吉屋"] // "anjuke.com":"安居客","cityhouse.cn":"城市房产","zhuge.com":"诸葛找房","5i5j.com":"我爱我家","jiwu.com":"吉屋"]
//"fang.com":"搜房", //"fang.com":"搜房",
def sourceMap = ["ke.com":"贝壳找房","cityhouse.cn":"城市房产"] def sourceMap = ["ke.com":"贝壳找房","cityhouse.cn":"城市房产"]
def esSourceMap = ["ke.com":"±´¿Ç"]
//,"城市房产":"城市房产"
def esSources = ["365淘房":"365淘房"]//"贝壳":"贝壳找房","链家":"链家","Q房":"Q房","我爱我家":"我爱我家","麦田":"麦田","中原地产":"中原地产","安居客PC端":"安居客","搜房":"搜房","吉屋":"吉屋"
static main(args) { static main(args) {
def task = new SynchDistrictPrice() def task = new SynchDistrictPrice()
// task.run() // task.run()
@@ -31,20 +33,20 @@ class SynchDistrictPrice {
def run1(){ def run1(){
def citys = CommonUtils.findAllCity() def citys = CommonUtils.findAllCity()
esSourceMap.each { k, v -> esSources.each{esSource, mgSource->
for(def city : citys){ for(def city : citys){
def rets = findAllEsData(city, v) def rets = findAllEsData(city, esSource, mgSource)
println city +" "+rets.size() println city +" "+rets.size()
synchData(city, rets, "±´¿ÇÕÒ·¿") synchData(city, rets, mgSource)
} }
} }
} }
def findAllEsData(city,source){ def findAllEsData(city,esSource, mgSource){
def names = new HashSet() def names = new HashSet()
def rets = [] def rets = []
ElasticUtils.executeSqlQuery("select * from community where source='±´¿Ç' and city='${city}'", {d-> ElasticUtils.executeSqlQuery("select * from community where source='${esSource}' and city='${city}' and m_date>'2022-06-15'", {d->
def s = d.city +"#"+d.region+"#"+d.name def s = d.city +"#"+d.region+"#"+d.name
if(!names.contains(s)){ if(!names.contains(s)){
names << s names << s
@@ -54,8 +56,11 @@ class SynchDistrictPrice {
data.put("name", d.name) data.put("name", d.name)
data.put("address", d.address) data.put("address", d.address)
data.put("avg_price", d.avg_price) data.put("avg_price", d.avg_price)
data.put("source", source) data.put("source", mgSource)
data.put("s_date", SHORT_DATE) data.put("s_date", SHORT_DATE)
data.put("url", d.url)
data.put("c_date", new Date())
data.put("m_date", new Date())
rets << data rets << data
} }
}) })
@@ -138,7 +143,7 @@ class SynchDistrictPrice {
def udata = new BasicDBObject() def udata = new BasicDBObject()
udata.put("avg_price", r.avg_price) udata.put("avg_price", r.avg_price)
udata.put("m_date",new Date()) udata.put("m_date",new Date())
thirdPartyColl.update(new BasicDBObject('_id',obj._id), udata) thirdPartyColl.update(new BasicDBObject('_id',obj._id), new BasicDBObject('$set', udata))
}else{ }else{
try{ try{
@@ -187,11 +187,11 @@ public class AverageStatisticsServiceImpl implements AverageStatisticsService {
Integer zhongyuanPrice = (Integer) dataMap.get("zhongyuan_price"); Integer zhongyuanPrice = (Integer) dataMap.get("zhongyuan_price");
if(null == zhongyuanPrice){ if(null == zhongyuanPrice){
if (isValid(entity.getCentanetEsfPrice())) { if (isValid(entity.getZhongyuanEsfPrice())) {
dataMap.put("zhongyuan_price", entity.getCentanetEsfPrice()); dataMap.put("zhongyuan_price", entity.getZhongyuanEsfPrice());
}else{ }else{
if(isValid(entity.getCentanetNewPrice())){ if(isValid(entity.getZhongyuanNewPrice())){
dataMap.put("zhongyuan_price", entity.getCentanetNewPrice()); dataMap.put("zhongyuan_price", entity.getZhongyuanNewPrice());
} }
} }
} }
@@ -0,0 +1,14 @@
package com.fangjia.service.open;
import com.fangjia.dal.mongo.open.model.EvaluateRatio;
/**
* @author shenjian
* @since 2022/7/27
*/
public interface EvaluateRatioService {
EvaluateRatio findByCityAndRegion(String city, String region);
EvaluateRatio findByCity(String city);
}
@@ -0,0 +1,39 @@
package com.fangjia.service.open.impl;
import com.fangjia.dal.QueryParam;
import com.fangjia.dal.mongo.open.dao.EvaluateRatioDao;
import com.fangjia.dal.mongo.open.model.EvaluateRatio;
import com.fangjia.service.open.EvaluateRatioService;
import java.util.ArrayList;
import java.util.List;
/**
* @author shenjian
* @since 2022/7/27
*/
public class EvaluateRatioServiceImpl implements EvaluateRatioService {
private EvaluateRatioDao evaluateRatioDao;
@Override
public EvaluateRatio findByCityAndRegion(String city, String region) {
List<QueryParam> params = new ArrayList<QueryParam>();
params.add(new QueryParam("category", "region"));
params.add(new QueryParam("city", city));
params.add(new QueryParam("region", region));
return evaluateRatioDao.findFirstByParams(params);
}
@Override
public EvaluateRatio findByCity(String city) {
List<QueryParam> params = new ArrayList<QueryParam>();
params.add(new QueryParam("category", "city"));
params.add(new QueryParam("city", city));
return evaluateRatioDao.findFirstByParams(params);
}
public void setEvaluateRatioDao(EvaluateRatioDao evaluateRatioDao) {
this.evaluateRatioDao = evaluateRatioDao;
}
}