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

This commit is contained in:
2024-02-06 11:06:25 +08:00
56 changed files with 6702 additions and 5053 deletions
File diff suppressed because it is too large Load Diff
@@ -1,18 +1,16 @@
package com.fangjia.open.controllers;
import com.fangjia.core.util.*;
import com.fangjia.dal.mongo.model.AdministrativeDivision;
import com.fangjia.dal.common.DistrictKey;
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
import com.fangjia.dal.mongo.model.ApiUserCfg;
import com.fangjia.dal.mongo.model.DistrictFacilitys;
import com.fangjia.dal.mongo.model.Evaluation;
import com.fangjia.dal.mongo.model.FangjiaOfficialAreaMap;
import com.fangjia.dal.mongo.model.bkoff.Loudong;
import com.fangjia.dal.mongo.open.model.ApiUserAuthority;
import com.fangjia.dal.mongo.open.model.EvaluateRatio;
import com.fangjia.dal.seaweed.model.District;
import com.fangjia.open.HttpCode;
import com.fangjia.open.OpenHttpCodeEnum;
import com.fangjia.open.dto.HouseValueInformationDto;
import com.fangjia.open.dto.UniversalDto;
import com.fangjia.open.dto.addressGovernance.MatchedBuildingDto;
@@ -35,7 +33,6 @@ import com.fangjia.service.mongo.bkoff.HouseLoudongService;
import com.fangjia.service.mongo.bkoff.LoudongService;
import com.fangjia.service.mongo.fangjia.*;
import com.fangjia.service.open.*;
import com.fangjia.service.tool.OpenLogService;
import com.fangjia.service.web.AddressService;
import net.sf.json.JSONObject;
import org.apache.commons.lang.ArrayUtils;
@@ -84,6 +81,7 @@ public class ComprehensiveQueryController {
static final int BAI_DU_GEO = 1;// 百度系坐标
static final int GAO_DE_GEO = 2;// 高德系坐标
private AdministrativeDivisionService administrativeDivisionService;
private EvaluateRatioService evaluateRatioService;
@@ -213,11 +211,22 @@ public class ComprehensiveQueryController {
HouseValueInformationDto houseValueInformation = new HouseValueInformationDto();
RestfulModelAndView mav = new RestfulModelAndView();
if (StringUtils.isBlank(model.getAddress()) || StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(String.valueOf(model.getSize()))) {
mav.setModel(BasicModel.buildBadRequestModel("城市(city),地址(address),面积(size)为必填字段"));
if (StringUtils.isBlank(model.getAddress()) || StringUtils.isBlank(String.valueOf(model.getSize()))) {
mav.setModel(BasicModel.buildBadRequestModel("地址(address),面积(size)为必填字段"));
return mav;
}
String cityStr = model.getCity();
if (StringUtils.isNotBlank(cityStr) && cityStr.matches("\\d+")) {
AdministrativeDivision administrativeDivision = administrativeDivisionService.findcityByCode(cityStr);
String city = administrativeDivision.getCityShort();
if (StringUtils.isBlank(city)) {
mav.setModel(BasicModel.buildBadRequestModel("城市代码错误"));
return mav;
}
model.setCity(city);
}
HttpRequest httpRequest = new HttpRequest();
JSONObject json = null;
Map<String, String> communityAvgPriceParams = new HashMap<String, String>();
@@ -228,10 +237,11 @@ public class ComprehensiveQueryController {
JSONObject matchResponse = null;
try {
matchResponse = httpRequest.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/v2/match", communityAvgPriceParams, "UTF-8");
// matchResponse = httpRequest.getJsonContent("http://192.168.0.19:31080/FangJiaAddressService/v2/match", communityAvgPriceParams, "UTF-8");
} catch (HttpRequestException e) {
}
if(matchResponse == null || !matchResponse.containsKey("result") || !matchResponse.getJSONObject("result").containsKey("id")) {
if (matchResponse == null || !matchResponse.containsKey("result") || !matchResponse.getJSONObject("result").containsKey("id")) {
mav.setModel(BasicModel.buildBadRequestModel("该地址不支持估价!"));
return mav;
}
@@ -266,6 +276,8 @@ public class ComprehensiveQueryController {
district = bieShuDistrict;
}
}
//添加城市
propertyEvaluationModel.setCity(district.getCity());
propertyEvaluationModel.setDistrict(district.getRegion());
propertyEvaluationModel.setName(district.getName());
try {
@@ -286,7 +298,7 @@ public class ComprehensiveQueryController {
// RestfulModelAndView houseCaseMav = new RestfulModelAndView();
List<CollateralSampleQueryBean> querys = null;
try {
querys = convertSampileQueryToBean(district,sampleQuery);
querys = convertSampileQueryToBean(district, sampleQuery);
} catch (Exception e) {
mav.setModel(BasicModel.buildBadRequestModel(e.getMessage()));
return mav;
@@ -298,7 +310,7 @@ public class ComprehensiveQueryController {
long start = System.currentTimeMillis();
List<Collateral> collaterals = czbankSampleService.findSample2(querys, sampleQuery.getMax());
long end = System.currentTimeMillis();
System.out.println("用时:"+(end-start));
System.out.println("用时:" + (end - start));
Collateral collateral = collaterals.get(0);
List<Sample> samples = collateral.getSample();
UniversalDto houseCaseDto = UniversalDto.newDto();
@@ -425,7 +437,7 @@ public class ComprehensiveQueryController {
return propertyModel;
}
private List<CollateralSampleQueryBean> convertSampileQueryToBean(District district,SampleQuery... queries) throws Exception {
private List<CollateralSampleQueryBean> convertSampileQueryToBean(District district, SampleQuery... queries) throws Exception {
List<CollateralSampleQueryBean> queryBeans = new ArrayList<CollateralSampleQueryBean>(queries.length);
for (SampleQuery q : queries) {
@@ -497,10 +509,10 @@ public class ComprehensiveQueryController {
throws NumberFormatException, IllegalAccessException {
// RestfulModelAndView mav = new RestfulModelAndView();
// mav.setViewType("rest");
if (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getName())
if (StringUtils.isBlank(model.getName())
|| StringUtils.isBlank(model.getDistrict()) || model.getSize() <= 0) {
mav.setModel(BasicModel.buildBadRequestModel("参数非法:城市,区域,小区名,面积(size)为必填项"));
return mav;
mav.setModel(BasicModel.buildBadRequestModel("参数非法:区域,小区名,面积(size)为必填项"));
// return mav;
}
if (model.getCity().endsWith("市")) {
model.setCity(model.getCity().replaceAll("市$", ""));
@@ -1229,8 +1241,6 @@ public class ComprehensiveQueryController {
}
public void setEvaluationService(EvaluationService evaluationService) {
this.evaluationService = evaluationService;
}
@@ -1253,7 +1263,6 @@ public class ComprehensiveQueryController {
}
public BatchEvaluateService getBatchEvaluateService() {
return batchEvaluateService;
}
@@ -1312,5 +1321,8 @@ public class ComprehensiveQueryController {
this.districtFacilitysService = districtFacilitysService;
}
public void setAdministrativeDivisionService(AdministrativeDivisionService administrativeDivisionService) {
this.administrativeDivisionService = administrativeDivisionService;
}
}
@@ -880,8 +880,13 @@ public class PropertyController {
districtInfoDto.setAddressAlias(district.getAddrAlias());
if (district.getLat2() != null && district.getLat2() != 0 && district.getLng2() != null
&& district.getLng2() != 0) {
districtInfoDto.setLat(district.getLat2() / 10000000000D);
districtInfoDto.setLng(district.getLng2() / 10000000000D);
districtInfoDto.setLat2(district.getLat2() / 10000000000D);
districtInfoDto.setLng2(district.getLng2() / 10000000000D);
}
if (district.getLat() != null && district.getLat() != 0 && district.getLng() != null
&& district.getLng() != 0) {
districtInfoDto.setLat(district.getLat() / 10000000000D);
districtInfoDto.setLng(district.getLng() / 10000000000D);
}
districtInfoDto.setPropertyType(district.getEstateType2());
if (HouseValidator.validateBuildingType(district.getBuildType())) {
@@ -3508,7 +3513,8 @@ public class PropertyController {
if (model.getHall() != null) {
params.add(new QueryParam("hall", model.getHall()));
}
params.add(new QueryParam("score", QueryParam.GREATER_THAN_OPERATOR, 200000000000l));
// 18年之后抓住的数据没有score字段
// params.add(new QueryParam("score", QueryParam.GREATER_THAN_OPERATOR, 200000000000l));
List<DealPrice> dealPrices = dealPriceService.findDealPrices(params, max);
List<DealPrice> distinctDealPrices = new ArrayList<DealPrice>();
for (DealPrice dealPrice : dealPrices) {
@@ -26,8 +26,14 @@ public class DistrictInfoDto {
private List<String> alias;
private List<String> addressAlias;
private String videoUrl;
//高德坐标
//维度
private Double lat;
//经度
private Double lng;
// 百度坐标
private Double lat2;
private Double lng2;
private String developer;
private String buildType;
private String estateCompany;
@@ -102,7 +108,22 @@ public class DistrictInfoDto {
private String township;
private String landProperty;
public Double getLat2() {
return lat2;
}
public void setLat2(Double lat2) {
this.lat2 = lat2;
}
public Double getLng2() {
return lng2;
}
public void setLng2(Double lng2) {
this.lng2 = lng2;
}
public String getDistrict() {
return district;
}
@@ -0,0 +1,10 @@
package com.fangjia.open;
public class test {
public static void main(String[] args) {
String a = "123545";
String b ="i980";
System.out.println(a.matches("\\d+"));
System.out.println(b.matches("\\d+"));
}
}
@@ -0,0 +1,18 @@
package com.fangjia;
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.codec.binary.Hex;
import java.util.Scanner;
public class test {
public static void main(String[] args) {
while (true){
Scanner scanner = new Scanner(System.in);
String password = scanner.nextLine();
String p =DigestUtils.md5Hex(password);
System.out.println(p);
}
}
}