渤海易贷修改
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
package com.fangjia.dal.mongo.dao;
|
||||
|
||||
import com.fangjia.dal.MongoDao;
|
||||
import com.fangjia.dal.mongo.model.PriceBorder;
|
||||
import com.fangjia.dal.mongo.model.PriceJiucuo;
|
||||
|
||||
public interface PriceBorderDao extends MongoDao<PriceBorder> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.fangjia.dal.mongo.dao;
|
||||
|
||||
import com.fangjia.dal.MongoDaoImpl;
|
||||
import com.fangjia.dal.mongo.model.PriceBorder;
|
||||
|
||||
public class PriceBorderDaoImpl extends MongoDaoImpl<PriceBorder> implements PriceBorderDao{
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package com.fangjia.dal.mongo.model;
|
||||
|
||||
import com.fangjia.dal.MongoEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
|
||||
@Entity
|
||||
@Table(name = "fangjia_crawl.price_border")
|
||||
public class PriceBorder implements MongoEntity {
|
||||
|
||||
private String id;
|
||||
private String city;
|
||||
private String region;
|
||||
private String name;
|
||||
private Double latitude;
|
||||
private Double longitude;
|
||||
private String border;
|
||||
private Integer level;
|
||||
|
||||
@Id
|
||||
@GeneratedValue
|
||||
@Column(name = "_id", unique = true, nullable = false)
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@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 = "name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
@Column(name = "latitude")
|
||||
public Double getLatitude() {
|
||||
return latitude;
|
||||
}
|
||||
|
||||
public void setLatitude(Double latitude) {
|
||||
this.latitude = latitude;
|
||||
}
|
||||
|
||||
@Column(name = "longitude")
|
||||
public Double getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public void setLongitude(Double longitude) {
|
||||
this.longitude = longitude;
|
||||
}
|
||||
|
||||
@Column(name = "border")
|
||||
public String getBorder() {
|
||||
return border;
|
||||
}
|
||||
|
||||
public void setBorder(String border) {
|
||||
this.border = border;
|
||||
}
|
||||
|
||||
@Column(name = "level")
|
||||
public Integer getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(Integer level) {
|
||||
this.level = level;
|
||||
}
|
||||
}
|
||||
+75
-12
@@ -2,14 +2,13 @@ package com.fangjia.open.controllers.weixin;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.fangjia.service.mongo.fangjia.PriceBorderService;
|
||||
import net.sf.json.JSONArray;
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
@@ -25,6 +24,7 @@ import com.fangjia.dal.common.DistrictKey;
|
||||
import com.fangjia.dal.mongo.model.AverageStatistics;
|
||||
import com.fangjia.dal.mongo.model.Evaluation;
|
||||
import com.fangjia.dal.mongo.model.LatlngPolygon;
|
||||
import com.fangjia.dal.mongo.model.PriceBorder;
|
||||
import com.fangjia.dal.mongo.model.bkoff.DistrictHouseStat;
|
||||
import com.fangjia.dal.seaweed.model.District;
|
||||
import com.fangjia.dal.sql.model.EvaluationAudit;
|
||||
@@ -105,6 +105,7 @@ public class WeiXinEvaluationController {
|
||||
private EvaluationRateService evaluationRateService;
|
||||
private EvaluationService evaluationService;
|
||||
private GoldLogsService goldLogsService;
|
||||
private PriceBorderService priceBorderService;
|
||||
|
||||
private final static String DD_ID = "5938c43984aec20a36f474c5";
|
||||
|
||||
@@ -369,15 +370,20 @@ public class WeiXinEvaluationController {
|
||||
|
||||
|
||||
FjtUsers fjtUser = fjtUsersService.findById(evaluation.getUserId());
|
||||
model.setRole(fjtUser.getRole());
|
||||
|
||||
model.setRole(fjtUser.getRole());
|
||||
|
||||
District district = districtService.findDistrict(new DistrictKey(evaluation.getCity(), evaluation.getRegion(), evaluation.getDistrictName()), "district");
|
||||
model.setId(district.getId());
|
||||
//参考价
|
||||
EvaluationAudit evaluationAudit = evaluationAuditService.findByEvalutionId(evaluationId);
|
||||
model.setEvaluationAudit(evaluationAudit);
|
||||
|
||||
model.setRole(fjtUser.getRole());
|
||||
|
||||
if(fjtUser!=null && fjtUser.getRole()==17 && district.getCity().equals("上海")){
|
||||
Map<String, Object> retMap = getLoanInfo(district, evaluation.getHouseArea());
|
||||
if(retMap!=null && retMap.size()>0){
|
||||
model.setLoanInfoMap(retMap);
|
||||
}
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
@@ -790,7 +796,62 @@ public class WeiXinEvaluationController {
|
||||
}
|
||||
return loopLine;
|
||||
}
|
||||
|
||||
|
||||
private Map<String, Object> getLoanInfo(District district, Double area){
|
||||
List<PriceBorder> ranges = priceBorderService.getALLBlockRange();
|
||||
PriceBorder pbObj = null;
|
||||
for(PriceBorder pb : ranges){
|
||||
String[] pointArrs = pb.getBorder().split(";");
|
||||
List<Point> points = new ArrayList<Point>();
|
||||
for(String pointStr : pointArrs){
|
||||
String[] ll = pointStr.split(",");
|
||||
Point point = new Point(Double.valueOf(ll[0]), Double.valueOf(ll[1]));
|
||||
points.add(point);
|
||||
}
|
||||
Point point = new Point(district.getLng2()/10000000000.0, district.getLat2()/10000000000.0);
|
||||
boolean flag = InsidePolygon.aboutZone(point, points);
|
||||
if(flag){
|
||||
pbObj = pb;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Integer yearAge = getBuildYear(district.getFinishBuildingDate());
|
||||
Map<String, Object> retsMap = new HashMap<String, Object>();
|
||||
if(pbObj!=null && pbObj.getLevel()!=null && pbObj.getLevel()==1 && yearAge!=null && yearAge<=25 && area>=60){
|
||||
retsMap.put("type", "A");
|
||||
retsMap.put("loan_ratio", 7);
|
||||
}else if(pbObj!=null && pbObj.getLevel()!=null && pbObj.getLevel()==2 && yearAge!=null && yearAge<=25 && area>=70){
|
||||
retsMap.put("type", "B");
|
||||
retsMap.put("loan_ratio", 6.5);
|
||||
}else if(yearAge!=null && yearAge<=25 && yearAge>20 && pbObj!=null && pbObj.getLevel()!=null && (pbObj.getLevel()==1 || pbObj.getLevel()==2)){
|
||||
retsMap.put("type", "C");
|
||||
retsMap.put("loan_ratio", 6);
|
||||
}else if(yearAge!=null && yearAge<=20 ){
|
||||
retsMap.put("type", "C");
|
||||
retsMap.put("loan_ratio", 6);
|
||||
}else if(yearAge!=null && yearAge>25){
|
||||
retsMap.put("type", "D");
|
||||
retsMap.put("loan_ratio", 5);
|
||||
}
|
||||
return retsMap;
|
||||
}
|
||||
|
||||
public Integer getBuildYear(String finishBuildingDate){
|
||||
if(StringUtils.isNotBlank(finishBuildingDate)){
|
||||
Pattern pat3 = Pattern.compile("\\d{4}");
|
||||
Matcher matcher3 = pat3.matcher(finishBuildingDate);
|
||||
if (matcher3.find()) {
|
||||
String year = matcher3.group();
|
||||
if(StringUtils.isNotBlank(year)){
|
||||
int curYear = Calendar.getInstance().get(Calendar.YEAR);
|
||||
return curYear - Integer.valueOf(year);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setFjtEvaluationService(FjtEvaluationService fjtEvaluationService) {
|
||||
this.fjtEvaluationService = fjtEvaluationService;
|
||||
@@ -868,6 +929,8 @@ public class WeiXinEvaluationController {
|
||||
public void setEmailService(EmailService emailService) {
|
||||
this.emailService = emailService;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void setPriceBorderService(PriceBorderService priceBorderService) {
|
||||
this.priceBorderService = priceBorderService;
|
||||
}
|
||||
}
|
||||
|
||||
+10
-2
@@ -2,6 +2,7 @@ package com.fangjia.open.model.weixin;
|
||||
|
||||
import com.fangjia.dal.mongo.model.Evaluation;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fangjia.dal.seaweed.model.District;
|
||||
import com.fangjia.dal.sql.model.EvaluationAudit;
|
||||
@@ -38,6 +39,7 @@ public class EvaluationModel extends BaseModel{
|
||||
private String userType;
|
||||
private Integer role;
|
||||
private String cardId;
|
||||
private Map<String, Object> loanInfoMap;
|
||||
|
||||
|
||||
public void setId(String id) {
|
||||
@@ -186,6 +188,12 @@ public class EvaluationModel extends BaseModel{
|
||||
public void setCardId(String cardId) {
|
||||
this.cardId = cardId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public Map<String, Object> getLoanInfoMap() {
|
||||
return loanInfoMap;
|
||||
}
|
||||
|
||||
public void setLoanInfoMap(Map<String, Object> loanInfoMap) {
|
||||
this.loanInfoMap = loanInfoMap;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -31,23 +31,11 @@
|
||||
<span></span>
|
||||
<p style="margin-top:14px;">评估总价:<#if fjtEvaluation??><strong class="<#if evaluationAudit?? && evaluationAudit.auditPrice??><#else>price_final</#if>">${(fjtEvaluation.totalPrice/10000)?string('0.##')}</strong> 万元</#if></p>
|
||||
<p>评估单价:${fjtEvaluation.averagePrice!} 元/平米</p>
|
||||
<#if role?? && role==17>
|
||||
<#if fjtEvaluation.districtName=="锦绣花木公寓">
|
||||
<p style="margin-top:-12px;">所属分类:A类</p>
|
||||
<p style="margin-top:-10px;">可贷成数:7成</p>
|
||||
<p style="margin-top:-22px;">可贷金额:<strong class="price_final">${(fjtEvaluation.totalPrice*0.7/10000)?string('0.##')}</strong>万元</p>
|
||||
<#if role?? && role==17 && loanInfoMap??>
|
||||
<p style="margin-top:-12px;">所属分类:${loanInfoMap.type!}类</p>
|
||||
<p style="margin-top:-10px;">可贷成数:${loanInfoMap.loan_ratio!}成</p>
|
||||
<p style="margin-top:-22px;">可贷金额:<strong class="price_final">${(fjtEvaluation.totalPrice*loanInfoMap.loan_ratio*0.1/10000)?string('0.##')}</strong>万元</p>
|
||||
<p style="margin-top:-4px;">贷款利率:4.5%</p>
|
||||
<#elseif fjtEvaluation.districtName=="南山雨果">
|
||||
<p style="margin-top:-12px;">所属分类:C类</p>
|
||||
<p style="margin-top:-10px;">可贷成数:6成</p>
|
||||
<p style="margin-top:-22px;">可贷金额:<strong class="price_final">${(fjtEvaluation.totalPrice*0.6/10000)?string('0.##')}</strong>万元</p>
|
||||
<p style="margin-top:-4px;">贷款利率:4.5%</p>
|
||||
<#elseif fjtEvaluation.districtName=="新泾三村">
|
||||
<p style="margin-top:-12px;">所属分类:D类</p>
|
||||
<p style="margin-top:-10px;">可贷成数:5成</p>
|
||||
<p style="margin-top:-22px;">可贷金额:<strong class="price_final">${(fjtEvaluation.totalPrice*0.5/10000)?string('0.##')}</strong>万元</p>
|
||||
<p style="margin-top:-4px;">贷款利率:4.5%</p>
|
||||
</#if>
|
||||
</#if>
|
||||
</div>
|
||||
<div class="topicContent topicBottom" style="padding:0 20px;padding-bottom:5px;">
|
||||
@@ -56,7 +44,7 @@
|
||||
</div>
|
||||
|
||||
|
||||
<#if role?? && (role==12 || role==16)>
|
||||
<#if role?? && (role==12 || role==16 || role==17)>
|
||||
<#if evaluationAudit?? && evaluationAudit.auditPrice??>
|
||||
<div class="topic inputTopic01" id="inputTopic01c">
|
||||
<div class="topicTitle topicTitle01">
|
||||
@@ -93,7 +81,7 @@
|
||||
</#if>
|
||||
</#if>
|
||||
|
||||
<#if role?? && (role==12 || role==16)>
|
||||
<#if role?? && (role==12 || role==16 || role==17)>
|
||||
|
||||
<div class="topic inputTopic02" id="inputTopic02b" style="border-bottom:none;margin-bottom:0;">
|
||||
<div class="topicTitle topicTitle01">
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.fangjia.service.mongo.fangjia
|
||||
|
||||
import com.fangjia.dal.mongo.model.PriceBorder
|
||||
|
||||
interface PriceBorderService {
|
||||
|
||||
public List<PriceBorder> getALLBlockRange();
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.fangjia.service.mongo.fangjia;
|
||||
|
||||
import com.fangjia.dal.mongo.dao.PriceBorderDao;
|
||||
import com.fangjia.dal.mongo.model.PriceBorder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PriceBorderServiceImpl implements PriceBorderService{
|
||||
|
||||
private PriceBorderDao priceBorderDao;
|
||||
|
||||
public void setPriceBorderDao(PriceBorderDao priceBorderDao) {
|
||||
this.priceBorderDao = priceBorderDao;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PriceBorder> getALLBlockRange() {
|
||||
return priceBorderDao.findAll();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user