时间修改
This commit is contained in:
+6
-6
@@ -23,7 +23,7 @@ public class DealSample implements MongoEntity {
|
||||
private Integer maxFloor;
|
||||
private Integer room;
|
||||
private Integer hall;
|
||||
private Integer yearMonth;
|
||||
private Integer yearmonth;
|
||||
private String cat;
|
||||
private Object location;
|
||||
|
||||
@@ -153,13 +153,13 @@ public class DealSample implements MongoEntity {
|
||||
this.hall = hall;
|
||||
}
|
||||
|
||||
@Column(name = "yearMonth")
|
||||
public Integer getYearMonth() {
|
||||
return yearMonth;
|
||||
@Column(name = "yearmonth")
|
||||
public Integer getYearmonth() {
|
||||
return yearmonth;
|
||||
}
|
||||
|
||||
public void setYearMonth(Integer yearMonth) {
|
||||
this.yearMonth = yearMonth;
|
||||
public void setYearmonth(Integer yearmonth) {
|
||||
this.yearmonth = yearmonth;
|
||||
}
|
||||
|
||||
@Column(name = "cat")
|
||||
|
||||
+150
-4
@@ -3,6 +3,7 @@ package com.fangjia.open.controllers;
|
||||
import com.fangjia.core.util.*;
|
||||
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
|
||||
import com.fangjia.dal.mongo.model.ApiUserCfg;
|
||||
import com.fangjia.dal.mongo.model.bkoff.DealSample;
|
||||
import com.fangjia.open.dto.BusinessCaseDto;
|
||||
import com.fangjia.open.interceptors.AuthenticationBean;
|
||||
import com.fangjia.open.interceptors.Authority;
|
||||
@@ -12,6 +13,7 @@ import com.fangjia.open.model.BasicModel;
|
||||
import com.fangjia.open.model.CommercialModel;
|
||||
import com.fangjia.open.model.RestfulModelAndView;
|
||||
import com.fangjia.service.api.ApiUserCfgService;
|
||||
import com.fangjia.service.mongo.fangjia.DealSampleService;
|
||||
import com.fangjia.service.mongo.fangjia.ServerAreaService;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
@@ -26,12 +28,13 @@ import java.util.*;
|
||||
*
|
||||
* @since 2025/9/16
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
//@Authority(role = Role.USER)
|
||||
public class CommercialController {
|
||||
|
||||
private static final List<String> GAODE_LEVEL = Arrays.asList("兴趣点", "门牌号", "单元号", "楼层", "房间", "门址", "住宅区","村庄");
|
||||
|
||||
private ApiUserCfgService apiUserCfgService;
|
||||
private DealSampleService dealSampleService;
|
||||
|
||||
public Object shopSellEvaluateAction(CommercialModel model, HttpServletRequest request) {
|
||||
|
||||
@@ -82,7 +85,6 @@ public class CommercialController {
|
||||
if (json != null) {
|
||||
|
||||
if (json.containsKey("msg") && "成功".equals(json.getString("msg"))) {
|
||||
List<HashMap<String, Object>> list = new ArrayList<HashMap<String, Object>>();
|
||||
if (json.containsKey("case")) {
|
||||
List<BusinessCaseDto> dtos = createBusiness((JSONArray) json.get("case"), "sell", ratio);
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(dtos));
|
||||
@@ -100,6 +102,60 @@ public class CommercialController {
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 湖北征信定制接口
|
||||
* @param model
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public Object shopSellCaseAction(CommercialModel model, HttpServletRequest request) {
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
mav = checkParmas(model, mav);
|
||||
if(mav.model()!=null){
|
||||
return mav;
|
||||
}
|
||||
Double ratio = getUserPriceRatio(request);
|
||||
JSONObject json = locationEvaluateApi(model, AvmUrls.SHOPSELL_EVALUATE);
|
||||
if (json != null) {
|
||||
|
||||
if (json.containsKey("msg") && "成功".equals(json.getString("msg"))) {
|
||||
if (json.containsKey("unitPrice") && json.containsKey("lng")) {
|
||||
|
||||
if(json.get("unitPrice") != null){
|
||||
int unitPrice = (Integer) json.get("unitPrice");
|
||||
int minPrice = (int) (unitPrice - unitPrice * 0.1);
|
||||
model.setMinPrice(minPrice);
|
||||
|
||||
int maxPrice = (int) (unitPrice + unitPrice * 0.1);
|
||||
model.setMaxPrice(maxPrice);
|
||||
}else{
|
||||
if(model.getMinPrice() != null && model.getMinPrice()>0){
|
||||
model.setMinPrice(model.getMinPrice());
|
||||
}
|
||||
if(model.getMaxPrice() != null && model.getMaxPrice()>0){
|
||||
model.setMaxPrice(model.getMaxPrice());
|
||||
}
|
||||
}
|
||||
Double lng = json.getDouble("lng");
|
||||
Double lat = json.getDouble("lat");
|
||||
List<DealSample> houseSelf = dealSampleService.querySampleByLocation(lng, lat, model.getMinPrice(), model.getMaxPrice(), "shop_sell", 5);
|
||||
List<BusinessCaseDto> dtos = createSample(houseSelf, "sell", ratio, lng, lat);
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(dtos));
|
||||
if(dtos!=null && dtos.size()<5){
|
||||
BasicModel.markNoDataRequest();
|
||||
}
|
||||
}
|
||||
}else{
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg(json.getString("msg")));
|
||||
}
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商铺出租
|
||||
@@ -211,6 +267,57 @@ public class CommercialController {
|
||||
}
|
||||
|
||||
|
||||
private List<BusinessCaseDto> createSample(List<DealSample> cases, String cat, Double ratio, Double lng, Double lat){
|
||||
if(cases != null && cases.size()>0){
|
||||
List<BusinessCaseDto> dtos = new ArrayList<BusinessCaseDto>();
|
||||
for(DealSample sample : cases){
|
||||
BusinessCaseDto dto = new BusinessCaseDto();
|
||||
dto.setCity(sample.getCity());
|
||||
dto.setDistrict(sample.getDistrict());
|
||||
dto.setName(sample.getName());
|
||||
// dto.setLocation(sample.getString("location"));
|
||||
|
||||
if(ratio != null){
|
||||
Integer totalPrice = (int)(sample.getTotalPrice().intValue() * ratio);
|
||||
if(cat.equals("rent")){
|
||||
Double dayPrice = totalPrice/sample.getSize()*30;
|
||||
dto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
|
||||
}else{
|
||||
Integer avgPrie = (int)(totalPrice/sample.getSize());
|
||||
dto.setUnitPrice(avgPrie);
|
||||
}
|
||||
dto.setTotalPrice(totalPrice);
|
||||
}else{
|
||||
if(cat.equals("rent")){
|
||||
Double dayPrice = sample.getTotalPrice()/(sample.getSize()*30);
|
||||
dto.setUnitPrice(DataUtil.getDoubleRound(2, dayPrice));
|
||||
}else{
|
||||
dto.setUnitPrice(sample.getUnitPrice());
|
||||
}
|
||||
dto.setTotalPrice(sample.getTotalPrice());
|
||||
}
|
||||
dto.setSize(sample.getSize());
|
||||
if(StringUtils.isNotBlank(sample.getType())){
|
||||
dto.setType(sample.getType());
|
||||
}
|
||||
if(sample.getFloor()!=null){
|
||||
dto.setFloor(sample.getFloor());
|
||||
}
|
||||
|
||||
dto.setCaseDate(DateUtil.formatByPattern(sample.getCaseDate(),"yyyy-MM-dd"));
|
||||
|
||||
Map<String, Double> locationMap = (Map) sample.getLocation();
|
||||
double distance = GeoUtils.calculateDistance(locationMap.get("lon"), locationMap.get("lat"), lng, lat);
|
||||
dto.setDistance((int)distance);
|
||||
|
||||
dtos.add(dto);
|
||||
}
|
||||
return dtos;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public Object shopRentSampleAction(CommercialModel model, HttpServletRequest request) {
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
@@ -223,7 +330,6 @@ public class CommercialController {
|
||||
JSONObject json = locationEvaluateApi(model, AvmUrls.SHOPRENT_EVALUATE);
|
||||
if (json != null) {
|
||||
if (json.containsKey("msg") && "成功".equals(json.getString("msg"))) {
|
||||
List<HashMap<String, Object>> list = new ArrayList<HashMap<String, Object>>();
|
||||
if (json.containsKey("case")) {
|
||||
List<BusinessCaseDto> dtos = createBusiness((JSONArray) json.get("case"), "rent", ratio);
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(dtos));
|
||||
@@ -242,6 +348,44 @@ public class CommercialController {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 湖北征信定制出租案例接口
|
||||
* @param model
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public Object shopRentCaseAction(CommercialModel model, HttpServletRequest request) {
|
||||
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
mav = checkParmas(model, mav);
|
||||
if(mav.model()!=null){
|
||||
return mav;
|
||||
}
|
||||
Double ratio = getUserPriceRatio(request);
|
||||
JSONObject json = locationEvaluateApi(model, AvmUrls.SHOPRENT_EVALUATE);
|
||||
if (json != null) {
|
||||
if (json.containsKey("msg") && "成功".equals(json.getString("msg"))) {
|
||||
if (json.containsKey("case")) {
|
||||
List<BusinessCaseDto> dtos = createBusiness((JSONArray) json.get("case"), "rent", ratio);
|
||||
|
||||
|
||||
mav.setModel(BasicModel.buildOKModel().setResult(dtos));
|
||||
if(dtos!=null && dtos.size()<5){
|
||||
BasicModel.markNoDataRequest();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg(json.getString("msg")));
|
||||
}
|
||||
} else {
|
||||
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
|
||||
}
|
||||
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private RestfulModelAndView checkParmas(CommercialModel model, RestfulModelAndView mav){
|
||||
if (StringUtils.isBlank(model.getAddress()) && StringUtils.isBlank(model.getLocation())) {
|
||||
@@ -374,5 +518,7 @@ public class CommercialController {
|
||||
this.apiUserCfgService = apiUserCfgService;
|
||||
}
|
||||
|
||||
|
||||
public void setDealSampleService(DealSampleService dealSampleService) {
|
||||
this.dealSampleService = dealSampleService;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-9
@@ -1206,15 +1206,8 @@ public class OfficeController {
|
||||
dto.setDistance((int)distance);
|
||||
|
||||
dto.setSize(house.getSize());
|
||||
if (house.getYearMonth() != null && house.getYearMonth() > 10000000) {
|
||||
String numberStr = String.valueOf(house.getYearMonth());
|
||||
// 拆分字符串并格式化
|
||||
String year = numberStr.substring(0, 4); // 前四位是年份
|
||||
String month = numberStr.substring(4, 6); // 中间两位是月份
|
||||
String day = numberStr.substring(6, 8); // 最后两位是日期
|
||||
String formattedDate = year + "-" + month + "-" + day;
|
||||
dto.setCaseDate(formattedDate);
|
||||
}
|
||||
dto.setCaseDate(DateUtil.formatByPattern(house.getCaseDate(),"yyyy-MM-dd"));
|
||||
|
||||
dtos.add(dto);
|
||||
}
|
||||
return dtos;
|
||||
|
||||
+2
-13
@@ -1,10 +1,7 @@
|
||||
package com.fangjia.open.controllers;
|
||||
|
||||
import com.fangjia.core.RegionData;
|
||||
import com.fangjia.core.util.AnalyticsUtil;
|
||||
import com.fangjia.core.util.DataUtil;
|
||||
import com.fangjia.core.util.GeoUtils;
|
||||
import com.fangjia.core.util.LoggerFactory;
|
||||
import com.fangjia.core.util.*;
|
||||
import com.fangjia.dal.common.ServerAreaData;
|
||||
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
|
||||
import com.fangjia.dal.mongo.model.ApiUserCfg;
|
||||
@@ -921,15 +918,7 @@ public class OfficeSellController {
|
||||
dto.setDistance((int)distance);
|
||||
|
||||
dto.setSize(house.getSize());
|
||||
if (house.getYearMonth() != null && house.getYearMonth() > 10000000) {
|
||||
String numberStr = String.valueOf(house.getYearMonth());
|
||||
// 拆分字符串并格式化
|
||||
String year = numberStr.substring(0, 4); // 前四位是年份
|
||||
String month = numberStr.substring(4, 6); // 中间两位是月份
|
||||
String day = numberStr.substring(6, 8); // 最后两位是日期
|
||||
String formattedDate = year + "-" + month + "-" + day;
|
||||
dto.setCaseDate(formattedDate);
|
||||
}
|
||||
dto.setCaseDate(DateUtil.formatByPattern(house.getCaseDate(),"yyyy-MM-dd"));
|
||||
dtos.add(dto);
|
||||
}
|
||||
return dtos;
|
||||
|
||||
+1
-9
@@ -6786,15 +6786,7 @@ public class PropertyController {
|
||||
caseDto.setRoom(house.getRoom() == null || house.getRoom() == 0 ? null : house.getRoom().toString());
|
||||
caseDto.setHall(house.getHall() == null || house.getHall() == 0 ? null : house.getHall().toString());
|
||||
|
||||
if (house.getYearMonth() != null && house.getYearMonth() > 10000000) {
|
||||
String numberStr = String.valueOf(house.getYearMonth());
|
||||
// 拆分字符串并格式化
|
||||
String year = numberStr.substring(0, 4); // 前四位是年份
|
||||
String month = numberStr.substring(4, 6); // 中间两位是月份
|
||||
String day = numberStr.substring(6, 8); // 最后两位是日期
|
||||
String formattedDate = year + "-" + month + "-" + day;
|
||||
caseDto.setCaseDate(formattedDate);
|
||||
}
|
||||
caseDto.setCaseDate(DateUtil.formatByPattern(house.getCaseDate(),"yyyy-MM-dd"));
|
||||
|
||||
Map<String, Double> locationMap = (Map) house.getLocation();
|
||||
double distance = GeoUtils.calculateDistance(locationMap.get("lon"), locationMap.get("lat"), lng, lat);
|
||||
|
||||
@@ -23,6 +23,10 @@ public class CommercialModel extends FangjiaApiModel{
|
||||
|
||||
private Integer showSample;//是否显示样本 1:显示
|
||||
|
||||
|
||||
private Integer maxPrice;
|
||||
private Integer minPrice;
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
@@ -118,4 +122,20 @@ public class CommercialModel extends FangjiaApiModel{
|
||||
public void setShowSample(Integer showSample) {
|
||||
this.showSample = showSample;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,6 +61,12 @@
|
||||
</ladders>
|
||||
</rule>
|
||||
|
||||
<rule controller="officeSell" action="sellSample" channel="office">
|
||||
<ladders>
|
||||
<ladder>/sellSample</ladder>
|
||||
</ladders>
|
||||
</rule>
|
||||
|
||||
|
||||
<rule controller="commercial" action="shopSellEvaluate" channel="shop">
|
||||
<ladders>
|
||||
@@ -75,6 +81,13 @@
|
||||
</rule>
|
||||
|
||||
|
||||
<rule controller="commercial" action="shopSellCase" channel="shop">
|
||||
<ladders>
|
||||
<ladder>/sellSample</ladder>
|
||||
</ladders>
|
||||
</rule>
|
||||
|
||||
|
||||
<rule controller="commercial" action="shopRentEvaluate" channel="shop">
|
||||
<ladders>
|
||||
<ladder>/rentEvaluate</ladder>
|
||||
@@ -87,5 +100,12 @@
|
||||
</ladders>
|
||||
</rule>
|
||||
|
||||
|
||||
<rule controller="commercial" action="shopRentCase" channel="shop">
|
||||
<ladders>
|
||||
<ladder>/rentSample</ladder>
|
||||
</ladders>
|
||||
</rule>
|
||||
|
||||
</rules>
|
||||
</urlrewrite>
|
||||
Reference in New Issue
Block a user