Merge branch 'master' of http://gitlab.fangjia.com/dev0/main into script_gj

# Conflicts:
#	projects/fangjia-script/src/main/groovy/com/fangjia/script/gj/xiamen/SuggestionDataSynch.groovy
This commit is contained in:
2024-01-08 18:31:41 +08:00
47 changed files with 5703 additions and 424 deletions
+1 -1
View File
@@ -18,6 +18,6 @@
<finalName>goojia-auto</finalName>
</build>
<modules>
<module>../../projects/goojia-auto</module>
<!-- <module>../../projects/goojia-auto</module>-->
</modules>
</project>
@@ -1920,6 +1920,7 @@ public class DistrictController {
district.setMappingAlias(null);
}
}
district.setModificationDate(new Date());
districtService.save(district);
}
@@ -1981,6 +1982,7 @@ public class DistrictController {
district.setLandProperty(model.getLandProperty());
}
district.setModificationDate(new Date());
districtService.save(district);
}
return model;
@@ -459,6 +459,11 @@ public class BaseAvgImportServlet extends HttpServlet {
price.setCat("district");
price.setModifyDate(new Date());
guidingPriceService.save(price);
Map<String, Object> udata = new HashMap<String, Object>();
udata.put("modificationDate", new Date());
districtService.updateById(udata, dis.getId());
HttpRequest request = new HttpRequest();
HashMap<String, String> params = new HashMap<String, String>();
params.put("category", "sell");
@@ -835,7 +835,20 @@ function add(){
alert('小区名不能为空!');
return false;
}
var estateType = $("#estateType2").val()
if(name.indexOf("商住")>-1){
if(estateType!="商住"){
alert('物业类型有误!');
return false;
}
}else{
if(name.indexOf("别墅")>-1){
if(estateType!="别墅"){
alert('物业类型有误!');
return false;
}
}
}
var alias=$("#alias").val();
if(alias){
var aliasArr=alias.toString().split("\n");
@@ -1148,6 +1148,20 @@ $(document).ready(function(){
alert('小区名不能为空!');
return false;
}
if(name.indexOf("商住")>-1){
if(estateTypeStr!="商住"){
alert('物业类型有误!');
return false;
}
}else{
if(name.indexOf("别墅")>-1){
if(estateTypeStr!="别墅"){
alert('物业类型有误!');
return false;
}
}
}
var alias=$("#alias").val();
@@ -69,6 +69,7 @@ public class DataUtil {
private static final String hanziReg = "[\\u4e00-\\u9fa5]";
private static final String englishReg = "[A-Za-z]";
public static String[] TAGS =new String[]{"独栋", "联排", "叠加", "双拼", "花园面积", "泳池", "别墅", "带花园", "洋房", "叠拼", "独院", "联体", "微墅", "大平墅"};
public static String replaceAll(String original, String with, Pattern... pattern) {
if (StringUtils.isNotBlank(original)) {
@@ -1463,6 +1464,13 @@ public class DataUtil {
return false;
}
public static boolean isNumber(String s) {
if (s != null && !"".equals(s.trim()))
return s.matches("^[0-9]*$");
else
return false;
}
public static double roundDouble(double d, int scale) {
try {
double ret = new BigDecimal(String.valueOf(d)).setScale(scale, BigDecimal.ROUND_HALF_UP).doubleValue();
@@ -1834,6 +1842,44 @@ public class DataUtil {
return false;
}
/**
* 是否是别墅
* @return
*/
public static boolean isVilla(Double area, String name, Integer height, Integer room) {
if (area == null) {
return false;
}
if (area >= 150 && StringUtils.indexOfAny(name, TAGS) > -1) {
return true;
}
boolean ret = false;
if (height != null && room != null) {
if (height <= 3) {
if (area > 200 && room >= 5) {
ret = true;
}
}
}else if(height != null){
if (height <= 3) {
if (area > 200){
ret = true;
}
}
} else if (height == null && room != null) {
if (area > 360 && room >= 6) {
ret = true;
}
} else if (height == null && room == null) {
if (area > 500) {
ret = true;
}
}
return ret;
}
@@ -165,6 +165,7 @@ public class SaleLeadsController {
}
saleLeads = converValue(saleLeads);
String body =
"业务需求:" + saleLeads.getBusiness() + " " + saleLeads.getOtherBusiness() + "\n\n"
@@ -363,11 +364,14 @@ public class SaleLeadsController {
if (saleLeads.getId()!=null) {
saleLeads.setId(null);
}
String ip = AnalyticsUtil.getIpAddress(req);
saleLeads = converValue(saleLeads);
String body =
"业务需求:" + saleLeads.getBusiness() + "\n\n"
+ "姓名:" + saleLeads.getUname() + "\n\n"
+ "手机:" + saleLeads.getMobile() + "\n\n"
+ "IP:"+ip + "\n\n"
+ "咨询内容:" + saleLeads.getRemarks()+ "\n\n" ;
body = body.replaceAll("null", "").replaceAll("其他,请填写", "");
if (StringUtils.isNotBlank(refUrl) && refUrl.contains("bd_vid")) {
@@ -99,6 +99,27 @@
@media(max-device-width:320px){
.searchBoxIndex{top:13.5rem;}
}
.advert {
position: fixed;
top: 30%;
left: 40%;
right: 0;
height: 320px;
width: 580px;
z-index: 10000;
}
.left-ad {
position: absolute;
bottom: 0;
left: 0;
width: 580px;
height: 300px;
background: url("${staticUrl}/images/fangjia/v5/adv.png");
background-size: 100% 100%;
}
.advert a{ float: right;margin-right: 10px;cursor: pointer;font-weight: bold;}
</style>
</head>
@@ -108,6 +129,10 @@
<#include "/header/v5/_header.ftl"/>
<#--<div class="advert mobile01">-->
<#-- <a id="close">关闭</a>-->
<#-- <div class="left-ad"></div>-->
<#--</div>-->
<div class="bannerIndex">
<div class="imgBoxIndex">
@@ -556,7 +581,18 @@ $.config = {router: false}
<script type="text/javascript" src="//developer.baidu.com/map/jsdemo/demo/convertor.js"></script>
<script src="${staticUrl}/js/fangjia/v5/city.js?v=${version}"></script>
<script>
// function closeWin(){
// $(".advert").addClass("dn")
// }
//
// $("#close").click(function(){
// closeWin();
// })
// window.setInterval(closeWin, 10000)
//
// $(".left-ad").click(function(){
// window.open('https://jinshuju.net/f/hBkMVo','_blank');
// })
/* banner轮播 */
$(".imgBoxIndex > div").hide();
$(".imgBoxIndex > div").eq(0).show();
@@ -184,7 +184,7 @@ public class DistrictFacilitys implements MongoEntity {
this.bus = bus;
}
@Column(name = "metro")
@Column(name = "subway")
public List<String> getMetro() {
return metro;
}
@@ -1,6 +1,8 @@
package com.fangjia.open.controllers;
import com.fangjia.core.util.HttpRequest;
import com.fangjia.dal.common.DistrictKey;
import com.fangjia.dal.seaweed.model.District;
import com.fangjia.open.dto.addressGovernance.*;
import com.fangjia.open.interceptors.Authority;
import com.fangjia.open.interceptors.Role;
@@ -9,6 +11,9 @@ import com.fangjia.open.model.AddressModel;
import com.fangjia.open.model.BasicModel;
import com.fangjia.open.model.RestfulModelAndView;
import com.fangjia.open.util.CommonDtoUtils;
import com.fangjia.service.bo.DistrictStatBo;
import com.fangjia.service.datastore.DistrictService;
import com.fangjia.service.district.DistrictStatService;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
@@ -24,6 +29,9 @@ import java.util.Map;
@Authority(role = Role.USER)
public class AddrSvcController {
private DistrictStatService districtStatService;
private DistrictService districtService;
/**
* 華硊賦凳趙
*
@@ -179,7 +187,7 @@ public class AddrSvcController {
/**
* 華硊⑤饜
*/
public Object matchAction(AddesssMatchModel model) {
public Object matchAction(AddesssMatchModel model) throws Exception {
RestfulModelAndView mav = new RestfulModelAndView();
if (StringUtils.isBlank(model.getAddress())) {
@@ -195,18 +203,13 @@ public class AddrSvcController {
params.put("category", model.getCategory());
params.put("district", model.getSuggestDistrict());
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/match", params, "UTF-8");
if (json != null) {
int code = json.getInt("status");
String msg = json.getString("msg");
BasicModel basicModel = new BasicModel(code, msg);
if (json.containsKey("result")) {
basicModel.setResult(CommonDtoUtils.transformV(MatchedBuildingDto.class, json.get("result")));
}
mav.setModel(basicModel);
} else {
mav.setModel(BasicModel.buildServerErrorModel().setMsg("·þÎñÉý¼¶ÖÐ..."));
//新匹配接口
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaNlpService/match", params, "UTF-8");
BasicModel basicModel = new BasicModel(200, "ok");
if (json != null && json.size()>0) {
basicModel.setResult(CommonDtoUtils.transformV(MatchedBuildingDto.class, json));
}
mav.setModel(basicModel);
} catch (Exception e) {
e.printStackTrace();
mav.setModel(BasicModel.buildServerErrorModel().setMsg("督昢汔撰笢..."));
@@ -261,4 +264,57 @@ public class AddrSvcController {
}
return mav;
}
public Object avgPriceAction(AddressModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
if (StringUtils.isBlank(model.getAddress())) {
mav.setModel(BasicModel.buildBadRequestModel("地址不能为空"));
return mav;
}
HttpRequest request = new HttpRequest();
JSONObject json = null;
Map<String, String> params = new HashMap<String, String>();
params.put("city", model.getCity());
params.put("address", model.getAddress());
params.put("category", model.getCategory());
params.put("useMap", String.valueOf(model.isUseMap()));
// params.put("district", model.getSuggestDistrict());//接口没有此参数
try {
//新匹配接口
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaNlpService/match", params, "UTF-8");
BasicModel basicModel = new BasicModel(200, "ok");
if (json != null && json.size()>0) {
MatchedBuildingDto dto = CommonDtoUtils.transformV(MatchedBuildingDto.class, json);
District district = districtService.findByNameAndAlias(dto.getCity(), dto.getDistrict(), dto.getName(),"district");
if (null != district) {
DistrictStatBo statBo = districtStatService.findCurrentDistrictStat(new DistrictKey(dto.getCity(), dto.getDistrict(), dto.getName()));
if(null != statBo){
if(statBo.getDistrictStat()!=null){
dto.setAvgPrice(statBo.getDistrictStat().getAvgPrice());
}else if(statBo.getVillaDistrictStat()!=null){
dto.setAvgPrice(statBo.getVillaDistrictStat().getAvgPrice());
}
}
}
basicModel.setResult(dto);
}
mav.setModel(basicModel);
} catch (Exception e) {
e.printStackTrace();
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
return mav;
}
public void setDistrictStatService(DistrictStatService districtStatService) {
this.districtStatService = districtStatService;
}
public void setDistrictService(DistrictService districtService) {
this.districtService = districtService;
}
}
@@ -7,9 +7,12 @@ import javax.servlet.http.HttpServletRequest;
import com.fangjia.core.RegionData;
import com.fangjia.core.util.DateUtil;
import com.fangjia.core.util.HttpRequest;
import com.fangjia.dal.mongo.model.*;
import com.fangjia.open.dto.addressGovernance.MatchedBuildingDto;
import com.fangjia.open.model.AvgPriceQueryModel;
import com.fangjia.open.model.BasicModel;
import com.fangjia.open.util.CommonDtoUtils;
import com.fangjia.service.datastore.RegionStatService;
import com.fangjia.service.district.DistrictFacilitysService;
import com.fangjia.service.district.DistrictStatRentService;
@@ -1164,7 +1167,41 @@ public class DistrictController {
}
return mav;
}
public Object addrFacilitysAction(DistrictSearchModel model, @Param(name = "city") String city, @Param(name = "address") String address) throws Exception{
RestfulModelAndView mav = new RestfulModelAndView();
mav.setViewType("rest");
if (StringUtils.isBlank(address)) {
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "地址必须输入"));
return mav;
} else {
String cat = "district";
HttpRequest request = new HttpRequest();
JSONObject json = null;
Map<String, String> params = new HashMap<String, String>();
params.put("city", city);
params.put("address", address);
params.put("category", "property");
//新匹配接口
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaNlpService/match", params, "UTF-8");
District property = null;
if (json != null && json.size() > 0) {
MatchedBuildingDto dto = CommonDtoUtils.transformV(MatchedBuildingDto.class, json);
property = districtService.findByNameAndAlias(dto.getCity(), dto.getDistrict(), dto.getName(), cat);
if (null == property) {
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "小区数据不存在"));
return mav;
}
DistrictFacilitys facilitys = districtFacilitysService.findByDistrict(property);
mav.setModel(BasicModel.buildOKModel().setResult(facilitys));
}else{
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "小区数据不存在"));
}
}
return mav;
}
/**
@@ -20,14 +20,18 @@ import com.fangjia.open.FangjiaApiUtil;
import com.fangjia.open.HttpCode;
import com.fangjia.open.OpenHttpCodeEnum;
import com.fangjia.open.dto.HouseDto;
import com.fangjia.open.dto.UniversalDto;
import com.fangjia.open.dto.addressGovernance.MatchedBuildingDto;
import com.fangjia.open.interceptors.Authority;
import com.fangjia.open.interceptors.Role;
import com.fangjia.open.model.BasicModel;
import com.fangjia.open.model.HousePublishModel;
import com.fangjia.open.model.HouseSearchModel;
import com.fangjia.open.model.RestfulModelAndView;
import com.fangjia.open.util.CommonDtoUtils;
import com.fangjia.open.util.FileDao;
import com.fangjia.open.ws.query.CollateralSampleQuery;
import com.fangjia.open.ws.query.SampleQuery;
import com.fangjia.open.ws.query.ShopCollateralSampleQuery;
import com.fangjia.service.address.AddressParser;
import com.fangjia.service.bo.Collateral;
@@ -55,6 +59,7 @@ import com.fangjia.service.open.HousePojo;
import com.fangjia.service.sql.ApiUserService;
import com.fangjia.service.sql.UserService;
import com.fangjia.service.web.MenuService;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.bson.types.ObjectId;
import org.sothis.core.util.Closure;
@@ -65,7 +70,6 @@ import java.io.IOException;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@Authority(role = Role.USER)
public class HouseController {
@@ -322,6 +326,117 @@ public class HouseController {
return queryBeans;
}
private List<CollateralSampleQueryBean> convertSampileQueryToBean(SampleQuery... queries) throws Exception{
List<CollateralSampleQueryBean> queryBeans = new ArrayList<CollateralSampleQueryBean>(queries.length);
for(SampleQuery q : queries){
CollateralSampleQueryBean queryBean = new CollateralSampleQueryBean();
BeanUtils.copyProperties(q, queryBean);
// String propertyTypeCode = queryBean.getPropertyTypeCode();
// if(!Arrays.asList("01", "02", "03").contains(propertyTypeCode)){
// throw new Exception("propertyTypeCode取值非法");
// }
String cat = "district";
if(StringUtils.isNotBlank(queryBean.getCity()) && StringUtils.isNotBlank(queryBean.getDistrict()) && StringUtils.isNotBlank(queryBean.getBuildingName())){
District property = districtService.findByNameAndAlias(queryBean.getCity(), queryBean.getDistrict(), queryBean.getBuildingName(), cat);
if(property == null){
throw new Exception("未找到该小区");
}
queryBean.setProperty(property);
}else if(StringUtils.isNotBlank(queryBean.getAddress())){
HttpRequest request = new HttpRequest();
JSONObject json = null;
String address = queryBean.getAddress().replace(" ","").replace("%","");
Map<String, String> params = new HashMap<String, String>();
params.put("city", queryBean.getCity());
params.put("address", address);
params.put("category", "property");
//新匹配接口
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaNlpService/match", params, "UTF-8");
if (json != null && json.size()>0) {
MatchedBuildingDto dto = CommonDtoUtils.transformV(MatchedBuildingDto.class, json);
District property = districtService.findByNameAndAlias(dto.getCity(), dto.getDistrict(), dto.getName(), cat);
if(property == null){
throw new Exception("未找到该小区");
}
queryBean.setProperty(property);
}else{
throw new Exception("未找到该小区");
}
}
String estateType = queryBean.getProperty().getEstateType2();
queryBean.setPropertyTypeCode("01");
if(StringUtils.isNotBlank(estateType)){
if(estateType.equals("普通住宅")){
queryBean.setPropertyTypeCode("01");
}else if(estateType.equals("别墅")){
queryBean.setPropertyTypeCode("02");
}else if(estateType.equals("商住")){
queryBean.setPropertyTypeCode("03");
}
}
Integer decrCondCode = queryBean.getDecrCondCode();
if(decrCondCode == null){
decrCondCode = 2;
}
if(decrCondCode > 5 || decrCondCode < 1){
throw new Exception("decrCondCode取值非法");
}
Integer towardDirectCode = queryBean.getTowardDirectCode();
if(towardDirectCode == null){
towardDirectCode = 3;
}
if(towardDirectCode > 10 || towardDirectCode < 1){
throw new Exception("towardDirectCode取值非法");
}
queryBeans.add(queryBean);
}
return queryBeans;
}
// private List<CollateralSampleQueryBean> convertSampileQueryToBean(SampleQuery... queries) throws Exception{
//
// List<CollateralSampleQueryBean> queryBeans = new ArrayList<CollateralSampleQueryBean>(queries.length);
// for(SampleQuery q : queries){
//
// CollateralSampleQueryBean queryBean = new CollateralSampleQueryBean();
// BeanUtils.copyProperties(q, queryBean);
//
//
// String propertyTypeCode = queryBean.getPropertyTypeCode();
// if(!Arrays.asList("01", "02", "03").contains(propertyTypeCode)){
// throw new Exception("propertyTypeCode取值非法");
// }
// String cat = "district";
// District property = districtService.findByNameAndAlias(queryBean.getCity(), queryBean.getDistrict(), queryBean.getBuildingName(), cat);
// if(property == null){
// throw new Exception("未找到该小区");
// }
// queryBean.setProperty(property);
// Integer decrCondCode = queryBean.getDecrCondCode();
// if(decrCondCode == null){
// decrCondCode = 2;
// }
// if(decrCondCode > 5 || decrCondCode < 1){
// throw new Exception("decrCondCode取值非法");
// }
// Integer towardDirectCode = queryBean.getTowardDirectCode();
// if(towardDirectCode == null){
// towardDirectCode = 3;
// }
// if(towardDirectCode > 10 || towardDirectCode < 1){
// throw new Exception("towardDirectCode取值非法");
// }
// queryBeans.add(queryBean);
// }
// return queryBeans;
// }
public Object detailAction(HousePublishModel model){
RestfulModelAndView mav = new RestfulModelAndView();
mav.setViewType("rest");
@@ -774,6 +889,54 @@ public class HouseController {
return mav;
}
public Object caseAction(@Valid SampleQuery sampleQuery){
RestfulModelAndView mav = new RestfulModelAndView();
List<CollateralSampleQueryBean> querys = null;
try{
querys = convertSampileQueryToBean(sampleQuery);
}catch (Exception e){
mav.setModel(BasicModel.buildBadRequestModel(e.getMessage()));
return mav;
}
if(null == sampleQuery.getMax()){
sampleQuery.setMax(10);
}
long start = System.currentTimeMillis();
List<Collateral> collaterals = czbankSampleService.findSample2(querys, sampleQuery.getMax());
long end = System.currentTimeMillis();
System.out.println("用时:"+(end-start));
Collateral collateral = collaterals.get(0);
List<Sample> samples = collateral.getSample();
UniversalDto dto = UniversalDto.newDto();
if(null != collateral.getMaxPrice()){
dto.append("maxUnitPrice", collateral.getMaxPrice());
}
if(null != collateral.getMinPrice()){
dto.append("minUnitPrice", collateral.getMinPrice());
}
dto.append("datas", samples);
// if(samples!= null && samples.size()>=2){
// Sample minSample = samples.get(samples.size()-2);
// Sample maxSample = samples.get(samples.size()-1);
// dto.append("minUnitPrice", minSample.getUnitPrice());
// dto.append("maxUnitPrice", maxSample.getUnitPrice());
// }
// if(samples.size()>2){
// dto.append("datas", samples.subList(0, samples.size()-2));
// }else{
// dto.append("datas", samples);
// }
mav.setModel(BasicModel.buildOKModel().setResult(dto));
return mav;
}
private List<HousePojo> fillDistrictInfoForHouse(FacetQueryResult<com.fangjia.service.bo.HouseBo> houseList, Date endDate,
District district, boolean showDetail, boolean matchModel) {
FacetQueryResult<HousePojo> list = new FacetQueryResult<HousePojo>();
@@ -37,6 +37,8 @@ import com.fangjia.dal.mongo.open.model.EvaluateRatio;
import com.fangjia.dal.seawater.dao.SeawaterDao;
import com.fangjia.dal.seawater.model.Seawater;
import com.fangjia.open.dto.*;
import com.fangjia.open.dto.addressGovernance.StructureDto;
import com.fangjia.open.util.CommonDtoUtils;
import com.fangjia.service.district.*;
import com.fangjia.service.mongo.fangjia.*;
import com.fangjia.service.open.*;
@@ -1085,6 +1087,21 @@ public class PropertyController {
return mav;
}
if(model.getFloor() == null){
JSONObject structureOb = addressMatchProxyService.addressStructure(district.getCity(), model.getAddress());
if(structureOb != null){
if(structureOb.containsKey("buildingNumber")){
model.setBuildingNumber(structureOb.getString("buildingNumber"));
}
if(structureOb.containsKey("roomNumber")){
String roomNumber = structureOb.getString("roomNumber");
model.setFloor(getFloor(roomNumber));
}
}
}
if(model.getMaxFloor() == null && model.getFloor() != null &&StringUtils.isNotBlank(model.getBuildingNumber())){
Loudong loudong = loudongService.findForEvaluate(district.getId(), model.getBuildingNumber(), model.getUnitNumber());
if(loudong != null && loudong.getFloors() >= model.getFloor()){
@@ -1108,6 +1125,8 @@ public class PropertyController {
} else {
model.setCalDate(DateUtil.getFirstDayOfWeek(new Date()));
}
Evaluation evaluation = evaluationService.evaluate(district, buildEvaluation(model, request),
model.getCalDate());
Double cityPriceCredit = null;
@@ -1549,6 +1568,9 @@ public class PropertyController {
model.setDistrict(fangjiaOfficialAreaMap.getFangjiaDistrict());
}
}
boolean villaFlag = DataUtil.isVilla(model.getSize(), model.getName(), model.getHeight(), model.getRoom());
District district = null;
Map<String, Object> params = new HashMap<String, Object>();
params.put("city", model.getCity());
@@ -1566,7 +1588,14 @@ public class PropertyController {
if(json.getInt("code")==200){
Map<String, Object> map = (Map<String, Object>) json.get("result");
if((Integer)map.get("precise")>=0){
district = districtService.findByNameAndAlias((String) map.get("city"), (String) map.get("district"), (String) map.get("name"), "district");
String propertyType = (String) map.get("propertyType");
if(villaFlag && StringUtils.isNotBlank(propertyType) && !propertyType.equals("±ðÊû")){
district = districtService.findByNameAndAlias((String) map.get("city"), (String) map.get("district"), (String) map.get("name")+"±ðÊû", "district");
}
if(null == district){
district = districtService.findByNameAndAlias((String) map.get("city"), (String) map.get("district"), (String) map.get("name"), "district");
}
}
}
}
@@ -2773,7 +2802,7 @@ public class PropertyController {
evaluation.setOtherFactor(model.getOtherFactor());
}
evaluation.setRegion(model.getDistrict());
if (0 != model.getRoom()) {
if (null != model.getRoom()) {
evaluation.setRoom(model.getRoom());
}
if (StringUtils.isNotBlank(model.getRoomNumber())) {
@@ -4057,6 +4086,19 @@ public class PropertyController {
return "fangjia.com";
}
private Integer getFloor(String roomNumber){
if(StringUtils.isNotBlank(roomNumber) && DataUtil.isNumber(roomNumber)){
if(roomNumber.length() == 3){
return Integer.valueOf(roomNumber.substring(0,1));
}else if(roomNumber.length() == 4){
return Integer.valueOf(roomNumber.substring(0,2));
}else{
return null;
}
}
return null;
}
private boolean checkExists(FacetQueryResult<NewHousePojo> houseBoList, NewHousePojo house) {
for (NewHousePojo bo : houseBoList) {
boolean sameName = bo.getName().equals(house.getName());
@@ -5517,7 +5559,7 @@ public class PropertyController {
//ÖܱßÏàËÆÐ¡Çø×â½ð
Integer room = null;
if(model.getRoom()!=0){
if(model.getRoom()!=null && model.getRoom()>0){
room = model.getRoom();
}else{
room = houseService.getDistrictRoomType((float)model.getSize());
@@ -7,7 +7,8 @@ import com.fangjia.dal.mongo.model.CityNewPrice;
import com.fangjia.dal.mongo.model.RegionSellStat;
@SuppressWarnings("serial")
public class CityNewPriceDto implements Serializable{
public class
CityNewPriceDto implements Serializable{
/**
*
@@ -0,0 +1,57 @@
package com.fangjia.open.dto;
import com.fangjia.dal.mongo.model.DistrictFacilitys;
import com.fangjia.open.dto.addressGovernance.MatchedBuildingDto;
import com.fangjia.open.model.RestfulModelAndView;
import java.util.Map;
/**
* @author 13607
* @since 2023/12/12 10:47
*/
public class HouseValueInformationDto {
// 原小区均价返回值
private MatchedBuildingDto communityAvgPrice;
// 原房屋价值评估返回值
private Map<String, Object> addressValue;
//原房源样本返回值
private UniversalDto houseCase;
//原周边POI返回值
private DistrictFacilitys surroundingPoi;
public MatchedBuildingDto getCommunityAvgPrice() {
return communityAvgPrice;
}
public void setCommunityAvgPrice(MatchedBuildingDto communityAvgPrice) {
this.communityAvgPrice = communityAvgPrice;
}
public Map<String, Object> getAddressValue() {
return addressValue;
}
public void setAddressValue(Map<String, Object> addressValue) {
this.addressValue = addressValue;
}
public UniversalDto getHouseCase() {
return houseCase;
}
public void setHouseCase(UniversalDto houseCase) {
this.houseCase = houseCase;
}
public DistrictFacilitys getSurroundingPoi() {
return surroundingPoi;
}
public void setSurroundingPoi(DistrictFacilitys surroundingPoi) {
this.surroundingPoi = surroundingPoi;
}
}
@@ -46,6 +46,11 @@ public class MatchedBuildingDto {
*/
private String propertyType;
/**
* ¾ù¼Û
*/
private Integer avgPrice;
public String getId() {
return id;
}
@@ -125,4 +130,12 @@ public class MatchedBuildingDto {
public void setPropertyType(String propertyType) {
this.propertyType = propertyType;
}
public Integer getAvgPrice() {
return avgPrice;
}
public void setAvgPrice(Integer avgPrice) {
this.avgPrice = avgPrice;
}
}
@@ -39,6 +39,8 @@ public class AddressModel extends FangjiaApiModel {
private String dataLevel;
private String keyword;
//是否使用地图poi数据
private boolean useMap;
public boolean isContainsLocation() {
return containsLocation;
@@ -248,4 +250,12 @@ public class AddressModel extends FangjiaApiModel {
public void setRegion(String region) {
this.region = region;
}
public boolean isUseMap() {
return useMap;
}
public void setUseMap(boolean useMap) {
this.useMap = useMap;
}
}
@@ -0,0 +1,941 @@
package com.fangjia.open.model;
import java.util.Date;
/**
* @author 13607
* @since 2023/12/12 14:27
*/
public class HouseInfomationModel extends FangjiaApiModel {
private String city;
private String address;
private String category;
private boolean useMap;
/**
* 判断是不是有房估价
*/
private boolean isYouFang;
/**
* 判断是不是友达
*/
private boolean isYouDa;
/**
* 区域
*/
private String region;
/**
* 区域(新版本估价)
**/
private String district;
/**
* 小区名
*/
private String districtName;
/**
* 小区名(新版本)
*/
private String name;
/**
* 楼号
*/
private String unitNumber;
/**
* 新楼号
*/
private String houseNumber;
private String id;
/**
* 室号
*/
private String roomNumber;
/**
* 面积
*/
private double size;
/**
* 所在楼层
*/
private Integer floor;
/**
* 总楼层
*/
private Integer height;
/**
* 室数
*/
private Integer room;
/**
* 厅数
*/
private int hall;
/**
* 卫数
*/
private int toilet;
/**
* 估价时间
*/
private Date calDate;
private String propertyType;
/**
* 建筑类型
*/
private String buildType;
/**
* 朝向
*/
private String direction;
/**
* 装修情况
*/
private String fitment;
/**
* 装修价格
*/
private int fitmentCharge;
/**
* 景观情况
*/
private String view;
/**
* 噪音情况
*/
private String noise;
/**
* 花园面积
*/
private Double gardenArea;
/**
* 地下室面积
*/
private Double basementArea;
/**
* 厌恶因素
*/
private String[] worryFactor;
/**
* 房龄
*/
private int age;
/**
* 自有车位
*/
private String carport;
/**
* 小区配套
*/
private String facilities;
/**
* 小区位置
*/
private String insidepos;
/**
* 装修年限
*/
private int fitmentAge;
/**
* 采光通风
*/
private String lightingVentilation;
/**
* 边套装置
*/
private String sideset;
/**
* 建筑质量
*/
private String[] buildQuality;
/**
* 厌恶设施
*/
private String worryFacility;
/**
* 产权属性
*/
private String houseProperty;
/**
* 其他因素
*/
private String otherFactor;
/**
* 门面开间
*/
private String facade;
/**
* 公共交通
*/
private String traffice;
/**
* 形状
*/
private String shape;
/**
* 障碍物
*/
private String obstacle;
/**
* 经营性质
*/
private String industry;
/**
* 配套设备
*/
private String supportDevice;
/**
* 距离扶梯位置
*/
private String leftPosition;
/**
* 商铺类型
*/
private String shopType;
/**
* 商铺唯一性
*/
private String shopUnique;
/**
* 商铺位置
*/
private String location;
private String kind;
private boolean isNewDistrict;
private Integer carportPrice;
private String keyword;
private String buildingNumber;
private Integer maxFloor;
private String decoration;
private Integer decorationCost;
private Double gardenSize;
private Double basementSize;
private Double outerSize;
private Double atticSize;
private String negativeFactor;
private String insidePosition;
private int decorationAge;
private boolean convert;
private String estateType;
private String periodType;
private Integer periodCount;
private Integer houseType;
private String clientNo;
private int scope;
private Integer maxPrice;
private Integer minPrice;
private Integer radius;
private Integer limit;
private String app;
private String user;
private Integer avgPrice;
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public boolean isUseMap() {
return useMap;
}
public void setUseMap(boolean useMap) {
this.useMap = useMap;
}
public boolean isYouFang() {
return isYouFang;
}
public void setYouFang(boolean youFang) {
isYouFang = youFang;
}
public boolean isYouDa() {
return isYouDa;
}
public void setYouDa(boolean youDa) {
isYouDa = youDa;
}
public String getRegion() {
return region;
}
public void setRegion(String region) {
this.region = region;
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district;
}
public String getDistrictName() {
return districtName;
}
public void setDistrictName(String districtName) {
this.districtName = districtName;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUnitNumber() {
return unitNumber;
}
public void setUnitNumber(String unitNumber) {
this.unitNumber = unitNumber;
}
public String getHouseNumber() {
return houseNumber;
}
public void setHouseNumber(String houseNumber) {
this.houseNumber = houseNumber;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getRoomNumber() {
return roomNumber;
}
public void setRoomNumber(String roomNumber) {
this.roomNumber = roomNumber;
}
public double getSize() {
return size;
}
public void setSize(double size) {
this.size = size;
}
public Integer getFloor() {
return floor;
}
public void setFloor(Integer floor) {
this.floor = floor;
}
public Integer getHeight() {
return height;
}
public void setHeight(Integer height) {
this.height = height;
}
public Integer getRoom() {
return room;
}
public void setRoom(Integer room) {
this.room = room;
}
public int getHall() {
return hall;
}
public void setHall(int hall) {
this.hall = hall;
}
public int getToilet() {
return toilet;
}
public void setToilet(int toilet) {
this.toilet = toilet;
}
public Date getCalDate() {
return calDate;
}
public void setCalDate(Date calDate) {
this.calDate = calDate;
}
public String getPropertyType() {
return propertyType;
}
public void setPropertyType(String propertyType) {
this.propertyType = propertyType;
}
public String getBuildType() {
return buildType;
}
public void setBuildType(String buildType) {
this.buildType = buildType;
}
public String getDirection() {
return direction;
}
public void setDirection(String direction) {
this.direction = direction;
}
public String getFitment() {
return fitment;
}
public void setFitment(String fitment) {
this.fitment = fitment;
}
public int getFitmentCharge() {
return fitmentCharge;
}
public void setFitmentCharge(int fitmentCharge) {
this.fitmentCharge = fitmentCharge;
}
public String getView() {
return view;
}
public void setView(String view) {
this.view = view;
}
public String getNoise() {
return noise;
}
public void setNoise(String noise) {
this.noise = noise;
}
public Double getGardenArea() {
return gardenArea;
}
public void setGardenArea(Double gardenArea) {
this.gardenArea = gardenArea;
}
public Double getBasementArea() {
return basementArea;
}
public void setBasementArea(Double basementArea) {
this.basementArea = basementArea;
}
public String[] getWorryFactor() {
return worryFactor;
}
public void setWorryFactor(String[] worryFactor) {
this.worryFactor = worryFactor;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getCarport() {
return carport;
}
public void setCarport(String carport) {
this.carport = carport;
}
public String getFacilities() {
return facilities;
}
public void setFacilities(String facilities) {
this.facilities = facilities;
}
public String getInsidepos() {
return insidepos;
}
public void setInsidepos(String insidepos) {
this.insidepos = insidepos;
}
public int getFitmentAge() {
return fitmentAge;
}
public void setFitmentAge(int fitmentAge) {
this.fitmentAge = fitmentAge;
}
public String getLightingVentilation() {
return lightingVentilation;
}
public void setLightingVentilation(String lightingVentilation) {
this.lightingVentilation = lightingVentilation;
}
public String getSideset() {
return sideset;
}
public void setSideset(String sideset) {
this.sideset = sideset;
}
public String[] getBuildQuality() {
return buildQuality;
}
public void setBuildQuality(String[] buildQuality) {
this.buildQuality = buildQuality;
}
public String getWorryFacility() {
return worryFacility;
}
public void setWorryFacility(String worryFacility) {
this.worryFacility = worryFacility;
}
public String getHouseProperty() {
return houseProperty;
}
public void setHouseProperty(String houseProperty) {
this.houseProperty = houseProperty;
}
public String getOtherFactor() {
return otherFactor;
}
public void setOtherFactor(String otherFactor) {
this.otherFactor = otherFactor;
}
public String getFacade() {
return facade;
}
public void setFacade(String facade) {
this.facade = facade;
}
public String getTraffice() {
return traffice;
}
public void setTraffice(String traffice) {
this.traffice = traffice;
}
public String getShape() {
return shape;
}
public void setShape(String shape) {
this.shape = shape;
}
public String getObstacle() {
return obstacle;
}
public void setObstacle(String obstacle) {
this.obstacle = obstacle;
}
public String getIndustry() {
return industry;
}
public void setIndustry(String industry) {
this.industry = industry;
}
public String getSupportDevice() {
return supportDevice;
}
public void setSupportDevice(String supportDevice) {
this.supportDevice = supportDevice;
}
public String getLeftPosition() {
return leftPosition;
}
public void setLeftPosition(String leftPosition) {
this.leftPosition = leftPosition;
}
public String getShopType() {
return shopType;
}
public void setShopType(String shopType) {
this.shopType = shopType;
}
public String getShopUnique() {
return shopUnique;
}
public void setShopUnique(String shopUnique) {
this.shopUnique = shopUnique;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public String getKind() {
return kind;
}
public void setKind(String kind) {
this.kind = kind;
}
public boolean isNewDistrict() {
return isNewDistrict;
}
public void setNewDistrict(boolean newDistrict) {
isNewDistrict = newDistrict;
}
public Integer getCarportPrice() {
return carportPrice;
}
public void setCarportPrice(Integer carportPrice) {
this.carportPrice = carportPrice;
}
public String getKeyword() {
return keyword;
}
public void setKeyword(String keyword) {
this.keyword = keyword;
}
public String getBuildingNumber() {
return buildingNumber;
}
public void setBuildingNumber(String buildingNumber) {
this.buildingNumber = buildingNumber;
}
public Integer getMaxFloor() {
return maxFloor;
}
public void setMaxFloor(Integer maxFloor) {
this.maxFloor = maxFloor;
}
public String getDecoration() {
return decoration;
}
public void setDecoration(String decoration) {
this.decoration = decoration;
}
public Integer getDecorationCost() {
return decorationCost;
}
public void setDecorationCost(Integer decorationCost) {
this.decorationCost = decorationCost;
}
public Double getGardenSize() {
return gardenSize;
}
public void setGardenSize(Double gardenSize) {
this.gardenSize = gardenSize;
}
public Double getBasementSize() {
return basementSize;
}
public void setBasementSize(Double basementSize) {
this.basementSize = basementSize;
}
public Double getOuterSize() {
return outerSize;
}
public void setOuterSize(Double outerSize) {
this.outerSize = outerSize;
}
public Double getAtticSize() {
return atticSize;
}
public void setAtticSize(Double atticSize) {
this.atticSize = atticSize;
}
public String getNegativeFactor() {
return negativeFactor;
}
public void setNegativeFactor(String negativeFactor) {
this.negativeFactor = negativeFactor;
}
public String getInsidePosition() {
return insidePosition;
}
public void setInsidePosition(String insidePosition) {
this.insidePosition = insidePosition;
}
public int getDecorationAge() {
return decorationAge;
}
public void setDecorationAge(int decorationAge) {
this.decorationAge = decorationAge;
}
public boolean isConvert() {
return convert;
}
public void setConvert(boolean convert) {
this.convert = convert;
}
public String getEstateType() {
return estateType;
}
public void setEstateType(String estateType) {
this.estateType = estateType;
}
public String getPeriodType() {
return periodType;
}
public void setPeriodType(String periodType) {
this.periodType = periodType;
}
public Integer getPeriodCount() {
return periodCount;
}
public void setPeriodCount(Integer periodCount) {
this.periodCount = periodCount;
}
public Integer getHouseType() {
return houseType;
}
public void setHouseType(Integer houseType) {
this.houseType = houseType;
}
public String getClientNo() {
return clientNo;
}
public void setClientNo(String clientNo) {
this.clientNo = clientNo;
}
public int getScope() {
return scope;
}
public void setScope(int scope) {
this.scope = scope;
}
public Integer getMaxPrice() {
return maxPrice;
}
public void setMaxPrice(Integer maxPrice) {
this.maxPrice = maxPrice;
}
public Integer getMinPrice() {
return minPrice;
}
public void setMinPrice(Integer minPrice) {
this.minPrice = minPrice;
}
public Integer getRadius() {
return radius;
}
public void setRadius(Integer radius) {
this.radius = radius;
}
public Integer getLimit() {
return limit;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public String getApp() {
return app;
}
public void setApp(String app) {
this.app = app;
}
public String getUser() {
return user;
}
public void setUser(String user) {
this.user = user;
}
public Integer getAvgPrice() {
return avgPrice;
}
public void setAvgPrice(Integer avgPrice) {
this.avgPrice = avgPrice;
}
}
@@ -70,12 +70,12 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
/**
* 总楼层
*/
private int height;
private Integer height;
/**
* 室数
*/
private int room;
private Integer room;
/**
* 厅数
@@ -345,19 +345,19 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
this.floor = floor;
}
public int getHeight() {
public Integer getHeight() {
return height;
}
public void setHeight(int height) {
public void setHeight(Integer height) {
this.height = height;
}
public int getRoom() {
public Integer getRoom() {
return room;
}
public void setRoom(int room) {
public void setRoom(Integer room) {
this.room = room;
}
@@ -0,0 +1,181 @@
package com.fangjia.open.ws.query;
import org.hibernate.validator.constraints.NotBlank;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.Date;
public class SampleQuery {
/**城市*/
// @NotBlank
private String city;
/**区域*/
// @NotBlank
private String district;
// @NotBlank
/**小区名*/
private String buildingName;
/**楼栋名称*/
private String buildingNoName;
/**物业类型编码*/
private String propertyTypeCode;
/**是否有电梯 0:无 1:有*/
private Integer isElevator;
/**总楼层*/
private Integer aboveFloorAmount;
/**所在楼层*/
private Integer floorNumber;
/**
* 装修情况编码
* 1:毛坯
* 2:简装(默认)
* 3:精装
* 4:豪装
* */
private Integer decrCondCode;
/**面积**/
private Double strctureArea;
/**
* 朝向情况编码
* 1:西南
* 2:东南
* 3:南(默认)
* 4:西北
* 5:东北
* 6:东
* 7:西
* 8:北
* 9:东西
* 10:南北
* */
private Integer towardDirectCode;
private Date updateDate;
@NotBlank
private String address;
@Min(1)
@Max(10)
private Integer max;
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district;
}
public String getBuildingName() {
return buildingName;
}
public void setBuildingName(String buildingName) {
this.buildingName = buildingName;
}
public String getBuildingNoName() {
return buildingNoName;
}
public void setBuildingNoName(String buildingNoName) {
this.buildingNoName = buildingNoName;
}
public String getPropertyTypeCode() {
return propertyTypeCode;
}
public void setPropertyTypeCode(String propertyTypeCode) {
this.propertyTypeCode = propertyTypeCode;
}
public Integer getIsElevator() {
return isElevator;
}
public void setIsElevator(Integer isElevator) {
this.isElevator = isElevator;
}
public Integer getAboveFloorAmount() {
return aboveFloorAmount;
}
public void setAboveFloorAmount(Integer aboveFloorAmount) {
this.aboveFloorAmount = aboveFloorAmount;
}
public Integer getFloorNumber() {
return floorNumber;
}
public void setFloorNumber(Integer floorNumber) {
this.floorNumber = floorNumber;
}
public Double getStrctureArea() {
return strctureArea;
}
public void setStrctureArea(Double strctureArea) {
this.strctureArea = strctureArea;
}
public Integer getDecrCondCode() {
return decrCondCode;
}
public void setDecrCondCode(Integer decrCondCode) {
this.decrCondCode = decrCondCode;
}
public Integer getTowardDirectCode() {
return towardDirectCode;
}
public void setTowardDirectCode(Integer towardDirectCode) {
this.towardDirectCode = towardDirectCode;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public Integer getMax() {
return max;
}
public void setMax(Integer max) {
this.max = max;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
@@ -1,5 +1,6 @@
package com.fangjia.script.gj
import com.fangjia.script.util.ElasticUtils
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
import java.sql.ResultSet
@@ -18,25 +19,24 @@ class EsSearchUtils {
static def findPois(def city, def region, def name){
final StringBuffer sqlBuffer = new StringBuffer()
sqlBuffer.append("SELECT cityname,adname,name,address,type,location.lon,location.lat,m_date,typecode FROM amap_poi WHERE 1=1")
sqlBuffer.append(" and cityname = '" + city + "'")
sqlBuffer.append(" and adname = '" + region + "'")
sqlBuffer.append(" and name = '" + name + "'")
ResultSet rs = dataSource.connection.createStatement().executeQuery(sqlBuffer.toString())
def sql = "select * from amap_poi where cityname='${city}' and adname='${region}' and MATCH(name, '${name}') "
ResultSet rs = dataSource.connection.createStatement().executeQuery(sql.toString())
def rets = []
while (rs.next()) {
def m = [:]
m.city = rs.getString("cityname")
m.region = rs.getString("adname")
m.name = rs.getString("name")
m.address = rs.getString("address")
m.type = rs.getString("type")
m.code = rs.getString("typecode")
m.lng = rs.getString("location.lon")
m.lat = rs.getString("location.lat")
rets << m
}
ElasticUtils.executeSqlQuery(sql,{ data->
def m = [:]
m.city = data.cityname
m.region = data.adname
m.name = data.name
m.address = data.address
m.type = data.type
m.code = data.typecode
def location = data.location
m.lng = location.lon
m.lat = location.lat
rets << m
})
return rets;
}
@@ -0,0 +1,110 @@
package com.fangjia.script.gj.village
import com.fangjia.script.gj.EsSearchUtils
import com.fangjia.script.looplineinfo.InsidePolygon
import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.MongoUtils
import com.fangjia.script.yinjihaun.amap.GaoDeApiUtils
import com.mongodb.BasicDBObject
import com.mongodb.DBCollection
DBCollection TOWN_POLYLINECOLL = MongoUtils.getCollectionByAuth20190102("fangjia_crawl", "town_polyline")
def MONGO100_URL = "mongodb://admin:G00MONGOADMIN@192.168.0.100:30009";
DBCollection COMMUNITY_CONN = MongoUtils.getCollectionByName2("fangjia", "community", MONGO100_URL)
def filePath = "D:\\数据\\涉农\\县.xlsx"
ExcelUtils.multiThreadingModify(filePath, { row ->
// if(!row['D']){
// def rets = EsSearchUtils.findPois(row['B'], row['C'], row['C']+"人民政府")
// if(rets){
// def obj = findOneByName(rets, row['C']+"人民政府")
// if(obj){
// row['D'] = obj.lng
// row['E'] = obj.lat
// println row['C'] + " "+obj
// }
// }
// }
// if(row['D'] && !row['F']){
// def townMap = findTownRange(row['B'], TOWN_POLYLINECOLL)
// def map = ["lon":row['D'], "lat":row['E']]
// def township = InsidePolygon.isInArea2(map.lon, map.lat, townMap)
// row['F'] = township
// }
if(row['F'] && !row['K']){
def q = new BasicDBObject()
q.put("city_name", row['B'])
q.put("area_name", row['C'])
def streetName = row['I']
q.put("street_name", streetName)
def count = COMMUNITY_CONN.count(q);
row['K'] = count
// row['H'] = streetName
}
// def gaodeMap = getTownshipInfo(row['D']+","+row['E'])
// if(gaodeMap && gaodeMap.township){
// row['I'] = gaodeMap.township
// }
})
def getTownshipInfo(def glocation){
def township = null
def district = null
def jsonObject = null
def stop = false
def count = 0
while(!stop){
if(glocation){
jsonObject = GaoDeApiUtils.geocode(glocation)
if(jsonObject && jsonObject.regeocode) {
def addressComponent = jsonObject.regeocode.addressComponent
if(addressComponent){
township = addressComponent.township
district = addressComponent.district
}
}
}
if(district || count>10){
stop = true
}else{
count ++
Thread.sleep(3000)
print "."
}
}
def map = [:]
map.district = district
map.township = township
return map;
}
def findOneByName(def rets, name){
def obj = null
for(def r : rets){
if(r.name == name){
obj = r
break;
}
}
return obj
}
def findTownRange(city, TOWN_POLYLINECOLL){
def q = new BasicDBObject()
q.put("city",city)
def dbcursor = TOWN_POLYLINECOLL.find(q)
def townMap = [:]
for(def d : dbcursor){
def pointList = InsidePolygon.createPoint3(d.polyline);
townMap.put(d.fjw_region +"##"+ d.town, pointList)
}
return townMap
}
@@ -0,0 +1,71 @@
package com.fangjia.script.majintao
import com.fangjia.core.util.HttpRequest
import com.fangjia.script.util.ExcelUtils
import net.sf.json.JSONObject
ExcelUtils.removeEmptyRow("F:\\估家\\文件\\北交所\\testcopy.xlsx")
ExcelUtils.singleThreadingModify("F:\\估家\\文件\\北交所\\testcopy.xlsx", { List items ->
String excelFilePath = "F:\\估家\\文件\\北交所\\testcopy.xlsx";
String comprehensiveUrl = "http://192.168.10.15:9180/comprehensiveQuery/houseValueInformation";
String communityUrl = "http://192.168.10.15:9180/addrSvc/avgPrice";
String valueUrl = "http://192.168.10.15:9180/property/addressEvaluate";
String caseUrl = "http://192.168.10.15:9180/house/case";
String poiUrl = "http://192.168.10.15:9180/district/addrFacilitys";
HttpRequest httpRequest = new HttpRequest();
map = new HashMap<String, String>()
String city = items['A']
String address = items['B']
double size = items['C']
System.out.println(city + "---" + address + "----" + size);
map.put("city", city)
map.put("address", address)
map.put("size", size.toString())
map.put("strctureArea", size.toString())
map.put("token", "F54F52381C49BB9EB4A33EB1B65604AE4B71A28AEE53518A94A2F360408B9056D57553931D15CE6DDE765562DAD286BA38E05A4CDAFC51C3D527A4959BF8E75A3B95DB7108FCEA340DDE61925616DB55118E1851E67D83EAD800460D100D6B667A4ED8EE67C8F7FB")
if (!address.contains("%")) {
// 发送HTTP请求
long start
long end
// start = System.currentTimeMillis();
// httpRequest.getJsonContent(communityUrl, map, "UTF-8")
//
//
// end = System.currentTimeMillis();
// items['D'] = String.valueOf(end - start);
//
// start = System.currentTimeMillis();
// httpRequest.getJsonContent(valueUrl, map, "UTF-8")
// end = System.currentTimeMillis();
// items['E'] = String.valueOf(end - start);
//
// start = System.currentTimeMillis();
// httpRequest.getJsonContent(caseUrl, map, "UTF-8")
// end = System.currentTimeMillis();
// items['F'] = String.valueOf(end - start);
//
// start = System.currentTimeMillis();
// httpRequest.getJsonContent(poiUrl, map, "UTF-8")
// end = System.currentTimeMillis();
// items['G'] = String.valueOf(end - start);
start = System.currentTimeMillis();
def content = httpRequest.getJsonContent(comprehensiveUrl, map, "UTF-8")
end = System.currentTimeMillis();
items['H'] = String.valueOf(end - start);
println content.get("msg")
if(content.get("msg").contains("该地址不支持估价!")) {
items['I'] = "该地址不支持估价!"
}
}
})
@@ -443,6 +443,45 @@ public class ExcelUtils{
}
public static singleThreadingModify(String fileName, Closure closure, Integer srcSheetIndex = 0, String destSheetName = null){
if(!destSheetName){
def inp = new FileInputStream(fileName);
Workbook workbook = WorkbookFactory.create(inp)
workbook.setForceFormulaRecalculation(true)
Sheet sheet = workbook.getSheetAt(srcSheetIndex);
destSheetName = sheet.getSheetName();
}
def data = ExcelUtils.read(fileName, srcSheetIndex, 0)
def body = data.subList(1, data.size())
def nThread = Runtime.getRuntime().availableProcessors() * 3
println nThread
ExecutorService executorService = Executors.newFixedThreadPool(3)
final AtomicInteger counter = new AtomicInteger(0)
final double total = body.size()
for(int i = 0 ; i < body.size(); i++){
final row = body[i]
executorService.submit(new Runnable() {
@Override
void run() {
try{
closure.call(row)
int count = counter.incrementAndGet()
if(count % 1000 == 0){
println(DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd HH:mm:ss")+"Ö´Ðнø¶È:${com.fangjia.core.util.DataUtil.roundDouble((count * 100)/total, 2)}%")
}
}catch (Exception e){
println(row)
e.printStackTrace()
}
}
})
}
executorService.shutdown()
executorService.awaitTermination(30, TimeUnit.DAYS)
ExcelUtils.write(fileName, data, destSheetName)
}
public static Object getCellValue(Cell cell){
@@ -84,5 +84,9 @@ public interface AddressMatchProxyService {
* @return
*/
MatchDistrictResult checkMatchDistrictCorrect(CheckMatchDistrictCorrectParam param);
JSONObject addressStructure(String city, String address);
}
@@ -271,7 +271,27 @@ public class AddressMatchProxyServiceImpl extends AbstractHttpApiService impleme
}
return matchResult;
}
@Override
public JSONObject addressStructure(String city, String address) {
HttpRequest request = new HttpRequest();
JSONObject json = null;
Map<String, String> params = new HashMap<String, String>();
params.put("city", city);
params.put("address", address);
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/v2/structure", params, "UTF-8");
if (json != null && json.containsKey("msgCode") && json.getInt("msgCode") == 200) {
if (json.containsKey("result")) {
return (JSONObject) json.get("result");
}
}
}catch(Exception e){
LOGGER.error("華硊梓袧趙囮啖", e);
}
return null;
}
/**
* 获取高德中分数最高的信息
* @param city
@@ -353,7 +373,12 @@ public class AddressMatchProxyServiceImpl extends AbstractHttpApiService impleme
if (mapResult == null) {
matchResult.addDebugLog("格式化地址调百度重试开始");
mapResult = this.searchByBaiDu(city, formatAddress);
matchResult.addDebugLog("格式化地址调百度结果:" + mapResult != null ? mapResult.toString() : "");
if(null != mapResult){
matchResult.addDebugLog("跡宒趙華硊覃啃僅賦彆ㄩ" + mapResult.toString());
}else{
matchResult.addDebugLog("跡宒趙華硊覃啃僅賦彆ㄩ");
}
} else {
break;
}
@@ -18,6 +18,9 @@ public class Collateral {
@XStreamAlias("samples")
private List<Sample> sample;
private Integer maxPrice;
private Integer minPrice;
public String getCltNo() {
return cltNo;
}
@@ -33,4 +36,20 @@ public class Collateral {
public void setSample(List<Sample> sample) {
this.sample = sample;
}
public Integer getMaxPrice() {
return maxPrice;
}
public void setMaxPrice(Integer maxPrice) {
this.maxPrice = maxPrice;
}
public Integer getMinPrice() {
return minPrice;
}
public void setMinPrice(Integer minPrice) {
this.minPrice = minPrice;
}
}
@@ -31,4 +31,11 @@ public interface CzbankSampleService {
List<ShopSample> findShopSample(ShopCollateralSampleQueryBean queryBean, int max);
}
/**
* 北交所小区房源样本查询
* @param queryBeans
* @param max
* @return
*/
List<Collateral> findSample2(List<CollateralSampleQueryBean> queryBeans, int max);
}
@@ -523,6 +523,10 @@ public interface DistrictService extends ModeService<DistrictKey, DistrictBo> {
List<District> findNearestDistrict(District district, int radiusMeters, int limit);
List<District> doFindNearestHasHouseDistrict(District district, int radiusMeters, int limit) ;
District findDistrictHasHouseFlag(District district);
List<District> findNearestDistrict(District district, int radiusMeters, String[] fields, int limit);
List<District> findNearestDistrict(String city, Double lng, Double lat, int radiusMeters, int limit);
@@ -2297,6 +2297,22 @@ public class DistrictServiceImpl implements DistrictService {
return list;
}
@SuppressWarnings("unchecked")
public List<District> findNearestHasHouseDistrict(District district, int radiusMeters, int limit) {
String cacheKey = district.getCity() + "#" + district.getRegion() + "#" + district.getName() + "#" + radiusMeters + "#_if_sell_1" + limit;
Object obj = CacheUtils.getValue(this.getClass(), cacheKey);
if (obj != null) {
return (List<District>) obj;
}
ArrayList<District> list = new ArrayList<District>();
List<District> nlist = doFindNearestHasHouseDistrict(district, radiusMeters, limit);
if (nlist.size() > 0) {
list = (ArrayList<District>) nlist;
}
CacheUtils.putValue(CachePolicyEnum.LONG, this.getClass(), cacheKey, list);
return list;
}
public List<District> findNearestDistrict(District district, int radiusMeters, String[] fields, int limit) {
String cacheKey = district.getCity() + "#" + district.getRegion() + "#" + district.getName() + "#" + radiusMeters + "#" + limit;
@@ -2437,6 +2453,68 @@ public class DistrictServiceImpl implements DistrictService {
return new ArrayList<District>(ret);
}
public List<District> doFindNearestHasHouseDistrict(District district, int radiusMeters, int limit) {
if (district == null || district.getLat() == null || district.getLng() == null || district.getLat() <= 0
|| district.getLng() <= 0) {
return Collections.EMPTY_LIST;
}
List<QueryParam> params = new ArrayList<QueryParam>();
params.add(new QueryParam("category", "district"));
params.add(new QueryParam("city", district.getCity()));
params.add(new QueryParam("visible", 0));
params.add(new QueryParam("ifSell", 1));
SdQuery sdQuery = new SdQuery();
sdQuery.setPoint((double) district.getLat() / 10000000000.0 + "," + (double) district.getLng() / 10000000000.0);
sdQuery.setField("lat_lng");
sdQuery.setDistance(String.valueOf((double) radiusMeters / 1000.0));
params.add(new QueryParam(QueryParam.SD_PARAM_NAME, sdQuery));
List<District> list = districtDao.findAllByParams(params, null, 0, limit * 2,
new String[] { "city", "region", "name", "estateType2", "id" });
if (list.isEmpty()) {
return list;
}
List<District> ret = new ArrayList<District>();
for (District d : list) {
if (district.getName().equals(d.getName()) && district.getRegion().equals(d.getRegion())
&& district.getCity().equals(d.getCity())) {
continue;
}
if (d.getEstateType2() != null) {
if (d.getEstateType2().indexOf(district.getEstateType2()) > -1) {
ret.add(d);
}
}
}
if (ret.size() > limit) {
ret = ret.subList(0, limit);
}
return new ArrayList<District>(ret);
}
@Override
public District findDistrictHasHouseFlag(District district) {
List<QueryParam> params = new ArrayList<QueryParam>();
params.add(new QueryParam("category", "district"));
params.add(new QueryParam("city", district.getCity()));
params.add(new QueryParam("region", district.getRegion()));
params.add(new QueryParam("name", district.getName()));
params.add(new QueryParam("visible", 0));
params.add(new QueryParam("ifSell", 1));
List<District> list = districtDao.findAllByParams(params, null, 0, 1, DISTRICT_MINI);
if (CollectionUtils.isEmpty(list)) {
return null;
}
if (list.size() == 1) {
return list.get(0);
}
return null;
}
public List<District> doFindNearestDistrict(District district, int radiusMeters, String[] fields, int limit) {
if (district == null || district.getLat() == null || district.getLng() == null || district.getLat() <= 0
@@ -225,7 +225,8 @@ public class DistrictTriggerServiceImpl implements TriggerService {
}
// 是否有二手房
if (districtHouseMap.get(districtKey) != null && districtHouseMap.get(districtKey).getSellCount() != null) {
if (districtHouseMap.get(districtKey) != null && districtHouseMap.get(districtKey).getSellCount() != null && districtHouseMap.get(districtKey).getSellCount().intValue()>0) {
LOGGER.warn("house count:"+districtHouseMap.get(districtKey).getSellCount());
newObj.put("if_sell", 1);
} else {
newObj.put("if_sell", 0);
@@ -70,9 +70,9 @@ public class SellTriggerServiceImpl implements TriggerService {
for (BSONObject object : bSONDocList) {
try {
ServerArea city = ServerAreaData.getServerAreaByDisplayDefaultNull(String.valueOf(object.get("city")));
// DistrictKey districtKey = new DistrictKey((String) object.get("city"), (String) object.get("region"),
// (String) object.get("district_name"));
// District district = districtMap.get(districtKey);
DistrictKey districtKey = new DistrictKey((String) object.get("city"), (String) object.get("region"),
(String) object.get("district_name"));
District district = districtMap.get(districtKey);
// if (district != null && district.getName() != null) {
// districtKey = new DistrictKey(district.getCity(), district.getRegion(),district.getName());
// }
@@ -156,16 +156,16 @@ public class SellTriggerServiceImpl implements TriggerService {
newObj.put("fitment", object.get("fitment"));
newObj.put("contact_people", object.get("contact_people"));
ScoreCalculatorInputData inputDate = new ScoreCalculatorInputData();
// if (district != null) {
// newObj.put("region", district.getRegion());
// if (StringUtils.isNotBlank(district.getBlock())) {
// newObj.put("block", district.getBlock());
// }
// if (district.getName() != null) {
// newObj.put("districtname_key", district.getName() + "_" + newObj.get("region") + "_" + object.get("city"));
// newObj.put("district_name", district.getName());
// }
// }
if (district != null) {
newObj.put("region", district.getRegion());
if (StringUtils.isNotBlank(district.getBlock())) {
newObj.put("block", district.getBlock());
}
if (district.getName() != null) {
newObj.put("districtname_key", district.getName() + "_" + newObj.get("region") + "_" + object.get("city"));
newObj.put("district_name", district.getName());
}
}
// newObj.put("if_school", 0);
// if (districtSchoolMap != null && districtSchoolMap.containsKey(districtKey)) {
Binary file not shown.

After

Width:  |  Height:  |  Size: 350 KiB