# Conflicts:
#	projects/fangjia-dal/src/main/java/com/fangjia/dal/mongo/model/bkoff/Loudong.java
#	projects/fangjia-dal/src/main/java/com/fangjia/dal/sql/model/FjtEvaluation.java
This commit is contained in:
2022-06-20 15:18:47 +08:00
404 changed files with 42027 additions and 1786 deletions
+1 -1
View File
@@ -98,4 +98,4 @@ spec:
ports:
- port: 8080
targetPort: 8080
nodePort: 30005
nodePort: 30013
@@ -0,0 +1,72 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: fangjia-youda-manager
namespace: fangjia
spec:
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
revisionHistoryLimit: 5
selector:
matchLabels:
project: fangjia-youda-manager
app: fangjia
template:
metadata:
labels:
project: fangjia-youda-manager
app: fangjia
spec:
imagePullSecrets:
- name: nexus-registry-secret
nodeSelector:
app: fangjia
containers:
- name: fangjia-youda-manager
image: 192.168.0.19:9012/fangjia-youda-manager:1.1
imagePullPolicy: Always
ports:
- containerPort: 8080
name: web
protocol: TCP
readinessProbe:
httpGet:
path: /login
port: web
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
httpGet:
path: /login
port: web
initialDelaySeconds: 10
periodSeconds: 5
volumeMounts:
- name: host-time
mountPath: /etc/localtime
volumes:
- name: host-time
hostPath:
path: /etc/localtime
---
apiVersion: v1
kind: Service
metadata:
name: fangjia-youda-manager
namespace: fangjia
labels:
project: fangjia-youda-manager
app: fangjia
spec:
type: NodePort
selector:
project: fangjia-youda-manager
app: fangjia
ports:
- port: 8080
targetPort: 8080
nodePort: 30006
@@ -0,0 +1,72 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: fangjia-youda-web-business
namespace: fangjia
spec:
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
revisionHistoryLimit: 5
selector:
matchLabels:
project: fangjia-youda-web-business
app: fangjia
template:
metadata:
labels:
project: fangjia-youda-web-business
app: fangjia
spec:
imagePullSecrets:
- name: nexus-registry-secret
nodeSelector:
app: fangjia
containers:
- name: fangjia-youda-web-business
image: 192.168.0.19:9012/fangjia-youda-web-business:1.1
imagePullPolicy: Always
ports:
- containerPort: 8080
name: web
protocol: TCP
readinessProbe:
httpGet:
path: /login
port: web
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
httpGet:
path: /login
port: web
initialDelaySeconds: 10
periodSeconds: 5
volumeMounts:
- name: host-time
mountPath: /etc/localtime
volumes:
- name: host-time
hostPath:
path: /etc/localtime
---
apiVersion: v1
kind: Service
metadata:
name: fangjia-youda-web-business
namespace: fangjia
labels:
project: fangjia-youda-web-business
app: fangjia
spec:
type: NodePort
selector:
project: fangjia-youda-web-business
app: fangjia
ports:
- port: 8080
targetPort: 8080
nodePort: 30012
@@ -0,0 +1,72 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: fangjia-youda-web-customer
namespace: fangjia
spec:
replicas: 1
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
revisionHistoryLimit: 5
selector:
matchLabels:
project: fangjia-youda-web-customer
app: fangjia
template:
metadata:
labels:
project: fangjia-youda-web-customer
app: fangjia
spec:
imagePullSecrets:
- name: nexus-registry-secret
nodeSelector:
app: fangjia
containers:
- name: fangjia-youda-web-customer
image: 192.168.0.19:9012/fangjia-youda-web-customer:1.1
imagePullPolicy: Always
ports:
- containerPort: 8080
name: web
protocol: TCP
readinessProbe:
httpGet:
path: /login
port: web
initialDelaySeconds: 5
periodSeconds: 10
livenessProbe:
httpGet:
path: /login
port: web
initialDelaySeconds: 10
periodSeconds: 5
volumeMounts:
- name: host-time
mountPath: /etc/localtime
volumes:
- name: host-time
hostPath:
path: /etc/localtime
---
apiVersion: v1
kind: Service
metadata:
name: fangjia-youda-web-customer
namespace: fangjia
labels:
project: fangjia-youda-web-customer
app: fangjia
spec:
type: NodePort
selector:
project: fangjia-youda-web-customer
app: fangjia
ports:
- port: 8080
targetPort: 8080
nodePort: 30011
@@ -167,9 +167,9 @@ public class RegionData implements PriorityOrdered {
ret = format(cityRegionMap, region);
}
if (null == ret) {
return region;
}
// if (null == ret) {
// return region;
// }
return ret;
}
@@ -13,7 +13,7 @@ import java.util.*;
*/
public class BaiDuApiUtils {
private static String AK = "9E99D3540e4dafb7894f7b9fe27fa6b5";
private static String AK = "ajgWIBd9rYsXed1hcDQqYvkX";
public static String[] AKS = new String[]{"hj5KqPjaGA3uivtg8uS8XfAnj9X1kPMr","xjFg7DfDqvQleIZasM3ph8Zi2Lw8kgCg",
"4pb6fzrWIzvibDu8L1o8DGoY2h1wRIUq","ZzX6mRFfE5GKn4cpUp24Q3OyUIHnfQAR","79ac4ea49e7dedbf80b0ecd475d07784",
"9E99D3540e4dafb7894f7b9fe27fa6b5","W3M5uHfcrmlAdhQjf6v93LCI", "C8bb035aacf602551e829e4c64575224",
@@ -25,6 +25,7 @@ import java.util.zip.GZIPOutputStream;
import com.hankcs.hanlp.HanLP;
import com.hankcs.hanlp.dictionary.py.Pinyin;
import com.sun.javafx.scene.transform.TransformUtils;
import net.sf.json.JSON;
import net.sf.json.JSONArray;
import net.sf.json.JSONNull;
@@ -1340,6 +1341,7 @@ public class DataUtil {
GZIPOutputStream outputStream = new GZIPOutputStream(bao);
outputStream.write(content.getBytes("UTF-8"));
outputStream.finish();
System.out.println(bao.toString());
return bao.toByteArray();
}
@@ -1435,6 +1437,25 @@ public class DataUtil {
return null;
}
/**
* 匹配符合条件的字符串
*
* @param str
* @param pattern
* @return
*/
public static List<String> matchAll(String str, Pattern pattern) {
if (str == null) {
return null;
}
List list = new ArrayList();
Matcher matcher = pattern.matcher(str);
while (matcher.find()) {
list.add(matcher.group());
}
return list;
}
public static boolean isNumeric(String str) {
try {
Double.parseDouble(str);
@@ -1805,11 +1826,26 @@ public class DataUtil {
}
}
public static void main(String[] args) {
System.out.println(getFirstChar("文裕花园"));
System.out.println(getFirstChar("文怡花园"));
public static boolean isChineseChar(String c) {
if (StringUtils.isNotBlank(c)) {
String temp = String.valueOf(c);
Pattern pattern = Pattern.compile("[\\u4e00-\\u9fa5\\w]+");
Matcher matcher = pattern.matcher(temp);
return matcher.matches();
}
return false;
}
System.out.println(FourUpSixInto("258.393", 2));
public static void main(String[] args) {
System.out.println(isChineseChar("6文怡a花园"));
// System.out.println(getFirstChar("文怡花园"));
//
// System.out.println(FourUpSixInto("258.393", 2));
}
@@ -58,7 +58,7 @@ public class ExcelUtil {
row.setHeightInPoints(35);
Font font = workBook.createFont();
font.setFontName("宋体");
font.setBoldweight(Font.BOLDWEIGHT_BOLD);
// font.setBoldweight(Font.BOLDWEIGHT_BOLD);
font.setFontHeightInPoints((short) 12);
CellStyle cellStyle = workBook.createCellStyle();
cellStyle.setFont(font);
@@ -39,7 +39,7 @@ public final class RandomUtil extends RandomUtils {
public static void main(String[] args) {
for (int i = 0; i < 1000; i++) {
System.out.println(random(0, 10));
System.out.println(random(-9, 9));
}
}
}
@@ -0,0 +1,202 @@
package com.fangjia.core.util;
import org.apache.commons.lang.StringUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class SeaweedUtils {
public static void main(String[] args){
System.out.println(formatVirescencePercent("1"));
}
/**
* 标准化输出绿化率
*/
public static String formatVirescencePercent(String virescence_percent) {
// 绿化率
if (StringUtils.isNotBlank(virescence_percent) && checkValue(virescence_percent)!=null) {
double val = Double.valueOf(virescence_percent);
if (val < 1) {
return String.valueOf(val * 100);
}
if (val == 1) {
return String.valueOf(val * 10);
}
if (val >= 70) {
return "65";
}
return String.valueOf(val);
}
return null;
}
/**
* 标准化容积率输出
*/
public static String formatCubagePercent(String cubage_percent) {
if (StringUtils.isNotBlank(cubage_percent) && checkValue(cubage_percent)!=null) {
double val = Double.valueOf(cubage_percent);
if (val >= 7 && val < 8) {
return "6.2";
}
if (val >= 8 && val < 9) {
return "6.3";
}
if (val >= 9 && val < 10) {
return "6.5";
}
if (val >= 10) {
return "6.7";
}
return String.valueOf(val);
}
return null;
}
/**
* 标准化车位输出
*/
public static String formatCarSiteCount(String car_site_count) {
if (StringUtils.isNotBlank(car_site_count) && checkValue(car_site_count)!=null) {
long val = Long.valueOf(car_site_count);
if (val > 2500 || val < 100) {
return "";
}
return String.valueOf(val);
}
return null;
}
/**
* 标准化户数输出
*/
public static String formatHouseholdCount(String household_count) {
if (StringUtils.isNotBlank(household_count) && checkValue(household_count)!=null ) {
if (Integer.valueOf(household_count) < 50) {
return null; // 户数
}
return household_count;
}
return null;
}
/**
* 标准化总占地面积输出
*/
public static String formatAllArea(String all_area) {
if (StringUtils.isNotBlank(all_area)) {
Double formattedVal = 0.0;
if (all_area.toString().indexOf("公顷") != -1) {
String val = all_area.toString();
formattedVal = (Double.valueOf(val.substring(0, val.indexOf("公顷"))) * 10000);
} else if(checkValue(all_area)!=null) {
formattedVal = Double.valueOf(all_area);
}
if (formattedVal > 100000 || formattedVal == 0.0) {
return null;
}
return String.valueOf(formattedVal);
}
return null;
}
/**
* 提取浮点数与整数
*/
static String getNumber(String input) {
Pattern pattern = Pattern.compile("\\d+(\\.\\d+)?");
Matcher matcher = pattern.matcher(input);
List<String> list = new ArrayList();
while (matcher.find()) {
list.add(matcher.group());
}
if(list.size()>0){
return list.get(0);
}
return null;
}
static Float checkValue(String value){
if(StringUtils.isNotBlank(value)){
value = getNumber(value);
if(StringUtils.isNotBlank(value)){
value = subZeroAndDot(value);
if(isNumber(value)){
Float v = Float.parseFloat(value);
if(v>0){
return v;
}else{
return null;
}
}else if(isFloat(value)){
Float v = Float.parseFloat(value);
if(v>0){
return v;
}else{
return null;
}
} else{
return null;
}
}
}
return null;
}
static boolean isNumber(String str){
try {
Integer.parseInt(str);
} catch (NumberFormatException e) {
return false;
}
return true;
}
static boolean isFloat(String str){
try {
Float.parseFloat(str);
} catch (NumberFormatException e) {
return false;
}
return true;
}
/**
* 正则表达式去掉多余的.与0
* @param
* @return
*/
static String subZeroAndDot(String v){
if(StringUtils.isNotBlank(v)){
if(v.indexOf(".")!=-1){
Double myNum2 = Double.valueOf(v);
BigDecimal b = new java.math.BigDecimal(myNum2);
Double myNum3 = b.setScale(2, java.math.BigDecimal.ROUND_HALF_UP).doubleValue();
v = myNum3.toString();
}
if(v.indexOf(".")>-1){
while(true)
{
if(v.endsWith("0")){
v = v.substring(0,v.length()-1);
}else{
break;
}
}
if(v.endsWith(".")){
v=v.substring(0,v.length()-1);
}
}
}
return v;
}
}
@@ -1,5 +1,9 @@
package com.fangjia.coresite.controllers;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URLEncoder;
import java.util.Date;
import java.util.List;
@@ -7,6 +11,7 @@ import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.fangjia.core.util.DataUtil;
import org.apache.commons.lang.StringUtils;
import com.fangjia.coresite.model.JsonModel;
@@ -37,7 +42,7 @@ public class SaleLeadsController {
}
public Object doAddAction(SaleLeadsModel model, HttpServletRequest req,
HttpServletResponse res) {
HttpServletResponse res) throws UnsupportedEncodingException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {
model.setViewType("redirect");
String refUrl = model.getBackUrl();
@@ -122,6 +127,8 @@ public class SaleLeadsController {
}
}
saleLeads = converValue(saleLeads);
saleLeadsService.save(saleLeads);
if(StringUtils.isNotBlank(saleLeads.getBusiness()) && saleLeads.getBusiness().contains("_")){
@@ -162,6 +169,30 @@ public class SaleLeadsController {
model.setViewParam("location", url);
return model;
}
private SaleLeads converValue(SaleLeads saleLeads) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException, UnsupportedEncodingException {
//
Field[] fields = saleLeads.getClass().getDeclaredFields();
for(Field s : fields){
String name = s.getName();
String type = s.getGenericType().toString();
if(type.contains("java.lang.String")){
String fildName = name.substring(0,1).toUpperCase()+name.substring(1);
Method m = saleLeads.getClass().getMethod("get"+fildName);
String value = (String)m.invoke(saleLeads);
if(StringUtils.isNotBlank(value)){
String s1 = value.replaceAll("\\pP|\\pS", "");
if(!DataUtil.isChineseChar(s1)){
String newValue = new String(value.getBytes("ISO8859-1"), "UTF-8");
m = saleLeads.getClass().getMethod("set"+fildName,String.class);
m.invoke(saleLeads, newValue);
}
}
}
}
return saleLeads;
}
public Object addDownInfoAction(SaleLeadsModel model, HttpServletRequest req,
@@ -37,5 +37,9 @@ public class TermsController {
public Object ydinfoAction(ResourceModel model){
return model;
}
public Object ydintrAction(ResourceModel model){
return model;
}
}
@@ -188,6 +188,8 @@ public class TrendController {
// avgPrice = model.getRegionStatBo().getAvgPrice();
// }
int count = districtService.findCityDistrictCount(city);
model.setCount(count);
model.setTrendView(trendView);
//model.setLastestHouse(getRelatedHouse(model.getRegion(), avgPrice));
return model;
@@ -53,6 +53,7 @@ public class TrendModel extends BaseModel implements TrendViewModel {
private int showBlock; // 小区走势图里显示板块线,不为0时显示
private String errMsg; //错误信息
private int code; //错误code 1成功 -1失败
private int count;
public String getKeyword() {
return keyword;
}
@@ -317,4 +318,11 @@ public class TrendModel extends BaseModel implements TrendViewModel {
this.code = code;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
}
@@ -158,37 +158,36 @@
<a class="partner13"></a>
<#-- <a class="partner14"></a>-->
<a class="partner15"></a>
<a class="partner16" style="margin-right:0;"></a>
<a class="partner16"></a>
<a class="partner21"></a>
<a class="partner22"></a>
<a class="partner23"></a>
<a class="partner24"></a>
<a class="partner25"></a>
<a class="partner26" style="margin-right:0;"></a>
<a class="partner26"></a>
<a class="partner31"></a>
<a class="partner32"></a>
<a class="partner33"></a>
<a class="partner34"></a>
<a class="partner35"></a>
<a class="partner36" style="margin-right:0;"></a>
<a class="partner36"></a>
<a class="partner41"></a>
<a class="partner42"></a>
<a class="partner43"></a>
<a class="partner44"></a>
<a class="partner45"></a>
<a class="partner46" style="margin-right:0;"></a>
<a class="partner46"></a>
<a class="partner51"></a>
<a class="partner52"></a>
<a class="partner53"></a>
<a class="partner54"></a>
<a class="partner55"></a>
<a class="partner56" style="margin-right:0;"></a>
<a class="partner56"></a>
<a class="partner61"></a>
<a class="partner62"></a>
<a class="partner63"></a>
<a class="partner65"></a>
<a class="partner66"></a>
<a class="partner71" style="margin-right:0;"></a>
<a class="partner72"></a>
<a class="partner73"></a>
</div>
@@ -212,7 +212,7 @@
<p><img src="${imgUrl}/images/fangjia/v5/diamond.png"><label>合作伙伴</label></p>
</div>
<div class="contentBox">
<a class="content" href="${basePath}/terms/ydinfo">
<a class="content" href="${basePath}/terms/ydinfo" style="border-bottom:none;">
<img src="${imgUrl}/images/fangjia/v5/youda.jpeg">
<div>
<p><em>房价网合作伙伴-上海友达土地房地产评估有限公司简介</em></p>
@@ -220,11 +220,21 @@
<p><small>上海房产门户&nbsp;&nbsp;&nbsp;&nbsp;</small></p>
</div>
</a>
<a class="content" href="${basePath}/terms/ydintr">
<img src="${imgUrl}/images/fangjia/v5/youda.jpeg">
<div>
<p><em>上海友达土地房地产评估有限公司-企业内部培训</em></p>
<p><span>2021年8月9日,上海友达土地房地产评估有限公司就房地产征收业务中遇到的诸多问题开展了企业内部培训。本次培训的宗旨是为了进一步提高员工技术水平和工作效率,强化团队合作意识,为公司的可持续性发展奠定良好基础。</span></p>
<p><small>上海房产门户&nbsp;&nbsp;&nbsp;&nbsp;</small></p>
</div>
</a>
</div>
</div>
<div class="list">
<div class="listTop">
<p><img src="${imgUrl}/images/fangjia/v5/diamond.png"><label>商务合作</label></p>
@@ -0,0 +1,61 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>合作伙伴 - 房价网 fangjia.com</title>
<meta name="keywords" content="上海友达土地房地产评估有限公司,合作伙伴,房价网">
<meta name="description" content="房价网合作伙伴上海友达土地房地产评估有限公司">
<#include "../jsconstants.ftl" />
<link href="${staticUrl}/style/fangjia/v5/common.css?v=${version}" rel="stylesheet">
<link href="${staticUrl}/style/fangjia/v5/main.css?v=${version}" rel="stylesheet">
<script src="${staticUrl}/js/fangjia/v5/jquery-1.7.2.min.js?v=${version}"></script>
<script>
if((navigator.userAgent.match(/(iPad|iPhone|iPod|Android|ios)/i))){
document.write("<link href='${staticUrl}/style/fangjia/v5/mobile.css?v=${version}' rel='stylesheet'>");
}
</script>
<style>
@media(max-device-width:768px){
.main{padding:1rem;padding-top:0;}
}
</style>
</head>
</head>
<body>
<#include "/header/v5/_header.ftl"/>
<div class="main" style="margin-top:150px;">
<div class="main_title"><small>上海友达土地房地产评估有限公司</small></div>
<div class="main_small">企业内部培训</div>
<div class="main_content">
<p>2021年8月9日,上海友达土地房地产评估有限公司就房地产征收业务中遇到的诸多问题开展了企业内部培训。本次培训的宗旨是为了进一步提高员工技术水平和工作效率,强化团队合作意识,为公司的可持续性发展奠定良好基础。整个培训分为二大内容,首先由公司总估价师为大家进行专业讲解征收评估业务中的技术难点及处理方法;二是开展员工自由交流,公司领导层听取各部门建议,做到集思广益,有效沟通。通过本次培训活动,公司员工的专业技术水平得到了很大提高,同时促进了各部门之间的协调合作能力,圆满达成了预期目的。</p>
<img src="${staticUrl}/images/fangjia/v5/ydpx.png" class="mobile01" style="margin-bottom:50px;margin: 0 auto;width: 60%;">
<br>
<br>
<p>
青春因梦想而弥足珍贵,人生因拼搏才愈显真实。公司上下满怀工作热情,无惧困难,立志为友达的发展贡献自己的力量。愿友达每位员工的人生因踏入这个集体而精彩纷呈!
</p>
<br>
<br>
<div style="float: right;">
上海友达土地房地产评估有限公司<br/>
<p style="text-align: center;">2021年8月10日</p>
</div>
</div>
</div>
<#include "/header/v5/_footer.ftl"/>
<script src="${staticUrl}/js/fangjia/v5/main.js?v=${version}"></script>
</body>
</html>
@@ -125,6 +125,7 @@
<div class="trend01b">
<#if districtStatBo?? || regionStatBo??>
<#if count??><div><em>${count!}</em><label>楼盘总量</label></div></#if>
<#if districtStatBo??>
<div><em><#if districtStatBo.lastTimeDistrictStat??>${districtStatBo.lastTimeDistrictStat.avgPrice}<#else>暂无</#if></em><label>上周均价(元/㎡)</label></div>
<div><em><#if districtStatBo.districtStat??>${districtStatBo.districtStat.avgPrice}<#else>暂无</#if></em><label>本周均价(元/㎡)</label></div>
@@ -0,0 +1,7 @@
package com.fangjia.dal.mongo.dao;
import com.fangjia.dal.MongoDao;
import com.fangjia.dal.mongo.model.BsEvaluation;
public interface BsEvaluationDao extends MongoDao<BsEvaluation> {
}
@@ -0,0 +1,8 @@
package com.fangjia.dal.mongo.dao;
import com.fangjia.dal.MongoDaoImpl;
import com.fangjia.dal.mongo.model.BsEvaluation;
public class BsEvaluationDaoImpl extends MongoDaoImpl<BsEvaluation> implements
BsEvaluationDao {
}
@@ -99,6 +99,9 @@ public class PaiMai implements MongoEntity {
private Integer marketAvgPrice;
/**物业类型*/
private String matchEstateType;
private String houseNum;
private String unitNum;
private String roomNum;
@Id
@GeneratedValue
@@ -488,4 +491,28 @@ public class PaiMai implements MongoEntity {
public void setMatchEstateType(String matchEstateType) {
this.matchEstateType = matchEstateType;
}
public String getHouseNum() {
return houseNum;
}
public void setHouseNum(String houseNum) {
this.houseNum = houseNum;
}
public String getUnitNum() {
return unitNum;
}
public void setUnitNum(String unitNum) {
this.unitNum = unitNum;
}
public String getRoomNum() {
return roomNum;
}
public void setRoomNum(String roomNum) {
this.roomNum = roomNum;
}
}
@@ -0,0 +1,184 @@
package com.fangjia.dal.mongo.model;
import com.fangjia.dal.MongoEntity;
import javax.persistence.*;
import java.util.Date;
@Entity
@Table(name = "business.evaluation")
public class BsEvaluation implements MongoEntity {
private String id;
private String fullAddress;
private String commid;
private String cityName;
private String distName;
private String commName;
private String address;
private Double buildArea;
private Integer floor;
private Integer floorcnt;
private Integer roomcnt;
private Integer livingroomcnt;
private String houseaspect;//ÄÏ
private String fitment;
private Date cDate;
private Integer unitPrice;
private Integer totalPrice;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "_id")
public String getId() {
return id;
}
@Override
public void setId(String id) {
this.id = id;
}
@Column(name = "full_address")
public String getFullAddress() {
return fullAddress;
}
public void setFullAddress(String fullAddress) {
this.fullAddress = fullAddress;
}
@Column(name = "commid")
public String getCommid() {
return commid;
}
public void setCommid(String commid) {
this.commid = commid;
}
@Column(name = "cityname")
public String getCityName() {
return cityName;
}
public void setCityName(String cityName) {
this.cityName = cityName;
}
@Column(name = "distname")
public String getDistName() {
return distName;
}
public void setDistName(String distName) {
this.distName = distName;
}
@Column(name = "commname")
public String getCommName() {
return commName;
}
public void setCommName(String commName) {
this.commName = commName;
}
@Column(name = "address")
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
@Column(name = "buildarea")
public Double getBuildArea() {
return buildArea;
}
public void setBuildArea(Double buildArea) {
this.buildArea = buildArea;
}
@Column(name = "floor")
public Integer getFloor() {
return floor;
}
public void setFloor(Integer floor) {
this.floor = floor;
}
@Column(name = "floorcnt")
public Integer getFloorcnt() {
return floorcnt;
}
public void setFloorcnt(Integer floorcnt) {
this.floorcnt = floorcnt;
}
@Column(name = "roomcnt")
public Integer getRoomcnt() {
return roomcnt;
}
public void setRoomcnt(Integer roomcnt) {
this.roomcnt = roomcnt;
}
@Column(name = "livingroomcnt")
public Integer getLivingroomcnt() {
return livingroomcnt;
}
public void setLivingroomcnt(Integer livingroomcnt) {
this.livingroomcnt = livingroomcnt;
}
@Column(name = "houseaspect")
public String getHouseaspect() {
return houseaspect;
}
public void setHouseaspect(String houseaspect) {
this.houseaspect = houseaspect;
}
@Column(name = "fitment")
public String getFitment() {
return fitment;
}
public void setFitment(String fitment) {
this.fitment = fitment;
}
@Column(name = "c_date")
public Date getcDate() {
return cDate;
}
public void setcDate(Date cDate) {
this.cDate = cDate;
}
@Column(name = "unitprice")
public Integer getUnitPrice() {
return unitPrice;
}
public void setUnitPrice(Integer unitPrice) {
this.unitPrice = unitPrice;
}
@Column(name = "totalprice")
public Integer getTotalPrice() {
return totalPrice;
}
public void setTotalPrice(Integer totalPrice) {
this.totalPrice = totalPrice;
}
}
@@ -63,6 +63,7 @@ public class DistrictFacilitys implements MongoEntity {
private String imgUrl3D;
private List<String> school;
private List<String> keySchool;
@Id
@GeneratedValue
@@ -380,4 +381,12 @@ public class DistrictFacilitys implements MongoEntity {
this.school = school;
}
@Column(name = "key_school")
public List<String> getKeySchool() {
return keySchool;
}
public void setKeySchool(List<String> keySchool) {
this.keySchool = keySchool;
}
}
@@ -48,6 +48,11 @@ public class DealPrice implements MongoEntity {
private Integer floor;//当前楼层
private Long score;
private String matchId;
private String matchCity;
private String matchRegion;
private String matchName;
@Id
@GeneratedValue
@Column(name = "_id", unique = true, nullable = false)
@@ -296,4 +301,40 @@ public class DealPrice implements MongoEntity {
}
return true;
}
@Column(name = "match_id")
public String getMatchId() {
return matchId;
}
public void setMatchId(String matchId) {
this.matchId = matchId;
}
@Column(name = "match_city")
public String getMatchCity() {
return matchCity;
}
public void setMatchCity(String matchCity) {
this.matchCity = matchCity;
}
@Column(name = "match_region")
public String getMatchRegion() {
return matchRegion;
}
public void setMatchRegion(String matchRegion) {
this.matchRegion = matchRegion;
}
@Column(name = "match_name")
public String getMatchName() {
return matchName;
}
public void setMatchName(String matchName) {
this.matchName = matchName;
}
}
@@ -448,6 +448,7 @@ public class HouseLoudong extends com.fangjia.dal.mongo.model.HouseLoudong{
this.openTotalPrice = openTotalPrice;
}
@Column(name = "district_id")
public String getDistrictId() {
return districtId;
}
@@ -103,7 +103,11 @@ public class Loudong implements MongoEntity {
* seaweed中的小区名
*/
private String nameInSeaweed;
/**
* seaweed中的小区id
*/
private String idInSeaweed;
@Column(name = "remark")
public String getRemark() {
return remark;
@@ -405,5 +409,12 @@ public class Loudong implements MongoEntity {
this.nameInSeaweed = nameInSeaweed;
}
@Column(name = "id_in_seaweed")
public String getIdInSeaweed() {
return idInSeaweed;
}
public void setIdInSeaweed(String idInSeaweed) {
this.idInSeaweed = idInSeaweed;
}
}
@@ -0,0 +1,9 @@
package com.fangjia.dal.mongo.open.dao;
import com.fangjia.dal.MongoDao;
import com.fangjia.dal.mongo.open.model.CommunityBasePrice;
import com.fangjia.dal.mongo.open.model.CommunityPoi;
public interface CommunityBasePriceDao extends MongoDao<CommunityBasePrice> {
}
@@ -0,0 +1,9 @@
package com.fangjia.dal.mongo.open.dao;
import com.fangjia.dal.MongoDao;
import com.fangjia.dal.mongo.model.CountDistrictStatBycity;
import com.fangjia.dal.mongo.open.model.CommunityPoi;
public interface CommunityPoiDao extends MongoDao<CommunityPoi> {
}
@@ -0,0 +1,10 @@
package com.fangjia.dal.mongo.open.dao.impl;
import com.fangjia.dal.MongoDaoImpl;
import com.fangjia.dal.mongo.open.dao.CommunityBasePriceDao;
import com.fangjia.dal.mongo.open.dao.CommunityPoiDao;
import com.fangjia.dal.mongo.open.model.CommunityBasePrice;
import com.fangjia.dal.mongo.open.model.CommunityPoi;
public class CommunityBasePriceDaoImpl extends MongoDaoImpl<CommunityBasePrice> implements CommunityBasePriceDao {
}
@@ -0,0 +1,10 @@
package com.fangjia.dal.mongo.open.dao.impl;
import com.fangjia.dal.MongoDaoImpl;
import com.fangjia.dal.mongo.open.dao.ApiVisitCountDao;
import com.fangjia.dal.mongo.open.dao.CommunityPoiDao;
import com.fangjia.dal.mongo.open.model.CommunityPoi;
import com.fangjia.dal.mongo.tool.model.ApiVisitCount;
public class CommunityPoiDaoImpl extends MongoDaoImpl<CommunityPoi> implements CommunityPoiDao {
}
@@ -0,0 +1,74 @@
package com.fangjia.dal.mongo.open.model;
import com.fangjia.dal.MongoEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
/**
* Ð¡Çø½¨ÐÐÖÃÐŶÈÐÅÏ¢
*
* @author shenjian@fangjia.com
*/
@Entity
@Table(name = "business.community_base_price_gj")
public class CommunityBasePrice implements MongoEntity {
private static final long serialVersionUID = -8010010773207622878L;
private String id;
private String city;
private String region;
private String name;
private Double credit;
@Id
@Column(name = "_id")
@Override
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 = "credit")
public Double getCredit() {
return credit;
}
public void setCredit(Double credit) {
this.credit = credit;
}
}
@@ -0,0 +1,135 @@
package com.fangjia.dal.mongo.open.model;
import com.fangjia.dal.MongoEntity;
import javax.persistence.*;
import java.util.Date;
/**
* 小区周边配套统计信息
*
* @author shenjian@fangjia.com
*/
@Entity
@Table(name = "fangjia_stat.community_poi_gj")
public class CommunityPoi implements MongoEntity {
private static final long serialVersionUID = -7663644539542318409L;
private String id;
private String city;
private String region;
private String name;
private Integer subway;
private Integer traffic;
private Integer bank;
private Integer primary;
private Integer junior;
private Integer hospital;
/**
* 不利设施,丧葬
*/
private Integer funeral;
@Id
@Column(name = "_id")
@Override
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 = "subway")
public Integer getSubway() {
return subway;
}
public void setSubway(Integer subway) {
this.subway = subway;
}
@Column(name = "traffic")
public Integer getTraffic() {
return traffic;
}
public void setTraffic(Integer traffic) {
this.traffic = traffic;
}
@Column(name = "bank")
public Integer getBank() {
return bank;
}
public void setBank(Integer bank) {
this.bank = bank;
}
@Column(name = "primary")
public Integer getPrimary() {
return primary;
}
public void setPrimary(Integer primary) {
this.primary = primary;
}
@Column(name = "junior")
public Integer getJunior() {
return junior;
}
public void setJunior(Integer junior) {
this.junior = junior;
}
@Column(name = "hospital")
public Integer getHospital() {
return hospital;
}
public void setHospital(Integer hospital) {
this.hospital = hospital;
}
@Column(name = "funeral")
public Integer getFuneral() {
return funeral;
}
public void setFuneral(Integer funeral) {
this.funeral = funeral;
}
}
@@ -67,6 +67,8 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
must.add(addTerms("district_name", alias));
must.add(addMatch("cat", "sell"));
must.add(addRange("avg_price", minPrice, maxPrice));
must.add(addRangeGte("p_date", 20210501));
bool.put("must", must);
query.put("bool", bool);
reqBody.put("query", query);
@@ -161,6 +163,16 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
return term;
}
private JSONObject addRangeGte(String name, Number min){
JSONObject term = new JSONObject();
JSONObject range = new JSONObject();
JSONObject rangeValue = new JSONObject();
rangeValue.put("gte", min);
range.put(name, rangeValue);
term.put("range", range);
return term;
}
private List<Seawater> wrapSeawater(List<JSONObject> jsonList){
List<Seawater> seawaterList= new ArrayList<Seawater>();
@@ -203,6 +215,11 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
seawater.setFloor(source.getInt("floor"));
}catch(Exception e){
seawater.setFloor(0);
}
try{
seawater.setFloorInfo(source.getString("floor_info"));
}catch(Exception e){
}
if(source.containsKey("fitment")){
seawater.setFitment(source.getString("fitment"));
@@ -231,6 +248,14 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
if(source.containsKey("root")){
seawater.setRoot(source.getString("root"));
}
if(source.containsKey("estate_type")){
seawater.setEstateType(source.getString("estate_type"));
}
if(source.containsKey("build_type")){
seawater.setBuildType(source.getString("build_type"));
}
seawaterList.add(seawater);
}
return seawaterList;
@@ -379,11 +404,11 @@ public class SeawaterDaoImpl extends com.fangjia.dal.SeawaterDaoImpl<Seawater> i
}
// ²»Õ¹Ê¾É¾³ý
JSONObject param = new JSONObject();
param.put("status", 0);
JSONObject temp = new JSONObject();
temp.put("term", param);
jsonList.add(temp);
// JSONObject param = new JSONObject();
// param.put("status", 0);
// JSONObject temp = new JSONObject();
// temp.put("term", param);
// jsonList.add(temp);
query.put("must", jsonList);
q.put("bool", query);
@@ -48,6 +48,7 @@ public class Seawater implements SeawaterEntity {
private Double area;
private Integer height;
private Integer floor;
private String floorInfo;
private String fitment;
private Integer room;
private Integer hall;
@@ -58,6 +59,9 @@ public class Seawater implements SeawaterEntity {
private String url;
private String root;
private Integer avgPrice;
private String purpose;
private String estateType;
private String buildType;
@Id
@Column(name = "_id")
@@ -195,6 +199,15 @@ public class Seawater implements SeawaterEntity {
this.floor = floor;
}
@Column(name = "floorInfo")
public String getFloorInfo() {
return floorInfo;
}
public void setFloorInfo(String floorInfo) {
this.floorInfo = floorInfo;
}
@Column(name = "fitment")
public String getFitment() {
return fitment;
@@ -285,4 +298,31 @@ public class Seawater implements SeawaterEntity {
public void setAvgPrice(Integer avgPrice) {
this.avgPrice = avgPrice;
}
@Column(name = "purpose")
public String getPurpose() {
return purpose;
}
public void setPurpose(String purpose) {
this.purpose = purpose;
}
@Column(name = "estate_type")
public String getEstateType() {
return estateType;
}
public void setEstateType(String estateType) {
this.estateType = estateType;
}
@Column(name = "build_type")
public String getBuildType() {
return buildType;
}
public void setBuildType(String buildType) {
this.buildType = buildType;
}
}
@@ -0,0 +1,7 @@
package com.fangjia.dal.sql.fangjia.dao;
import com.fangjia.dal.SqlDao;
import com.fangjia.dal.sql.model.FormalReport;
public interface FormalReportDao extends SqlDao<FormalReport> {
}
@@ -0,0 +1,7 @@
package com.fangjia.dal.sql.fangjia.dao;
import com.fangjia.dal.GoojiaFangjiaSqlDao;
import com.fangjia.dal.sql.model.FormalReport;
public class FormalReportDaoImpl extends GoojiaFangjiaSqlDao<FormalReport> implements FormalReportDao {
}
@@ -0,0 +1,10 @@
package com.fangjia.dal.sql.fangjia.dao;
import com.fangjia.dal.SqlDao;
import com.fangjia.dal.sql.model.ReportFileAttach;
import com.fangjia.dal.sql.model.UserCity;
public interface ReportFileAttachDao extends SqlDao<ReportFileAttach>{
}
@@ -0,0 +1,7 @@
package com.fangjia.dal.sql.fangjia.dao;
import com.fangjia.dal.GoojiaFangjiaSqlDao;
import com.fangjia.dal.sql.model.ReportFileAttach;
public class ReportFileAttachDaoImpl extends GoojiaFangjiaSqlDao<ReportFileAttach> implements ReportFileAttachDao{
}
@@ -103,6 +103,8 @@ public class FjtEvaluation implements SqlEntity{
private String finishDateStr;//竣工时间
private String useType;//房屋用途
private String certificateAddress; //产证地址
private Date downPdfDate;//下载报告时间
@GeneratedValue(strategy = GenerationType.AUTO)
@Id
@@ -751,6 +753,7 @@ public class FjtEvaluation implements SqlEntity{
this.useType = useType;
}
<<<<<<< .mine
@Column(name = "certificate_address")
public String getCertificateAddress() {
return certificateAddress;
@@ -760,6 +763,19 @@ public class FjtEvaluation implements SqlEntity{
this.certificateAddress = certificateAddress;
}
=======
@Column(name = "down_pdf_date")
public Date getDownPdfDate() {
return downPdfDate;
}
public void setDownPdfDate(Date downPdfDate) {
this.downPdfDate = downPdfDate;
}
>>>>>>> .theirs
@Override
public String toString() {
return "FjtEvaluation{" +
@@ -0,0 +1,75 @@
package com.fangjia.dal.sql.model;
import com.fangjia.dal.SqlEntity;
import javax.persistence.*;
import java.util.Date;
@Entity
@Table(name = "formal_report")
public class FormalReport implements SqlEntity {
long id;
long evaluationId;
String queryId;
long userId;
String address;
Date dateCreated;
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.AUTO)
public long getId() {
return id;
}
@Override
public void setId(long id) {
this.id = id;
}
@Column(name = "evaluation_id")
public long getEvaluationId() {
return evaluationId;
}
public void setEvaluationId(long evaluationId) {
this.evaluationId = evaluationId;
}
@Column(name = "query_id")
public String getQueryId() {
return queryId;
}
public void setQueryId(String queryId) {
this.queryId = queryId;
}
@Column(name = "user_id")
public long getUserId() {
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
@Column(name = "address")
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
@Column(name = "c_date")
public Date getDateCreated() {
return dateCreated;
}
public void setDateCreated(Date dateCreated) {
this.dateCreated = dateCreated;
}
}
@@ -0,0 +1,82 @@
package com.fangjia.dal.sql.model;
import com.fangjia.dal.SqlEntity;
import javax.persistence.*;
@Entity
@Table(name = "report_file_attach")
public class ReportFileAttach implements SqlEntity {
private long id;
private Integer userId;
private Integer evaluationId;
private String queryId;
private Integer fileClass;
private String fileName;
private String fileId;
@Id
@Column(name = "id")
@GeneratedValue(strategy = GenerationType.AUTO)
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
@Column(name = "user_id")
public Integer getUserId() {
return userId;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
@Column(name = "evaluation_id")
public Integer getEvaluationId() {
return evaluationId;
}
public void setEvaluationId(Integer evaluationId) {
this.evaluationId = evaluationId;
}
@Column(name = "query_id")
public String getQueryId() {
return queryId;
}
public void setQueryId(String queryId) {
this.queryId = queryId;
}
@Column(name = "file_class")
public Integer getFileClass() {
return fileClass;
}
public void setFileClass(Integer fileClass) {
this.fileClass = fileClass;
}
@Column(name = "file_name")
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
@Column(name = "file_id")
public String getFileId() {
return fileId;
}
public void setFileId(String fileId) {
this.fileId = fileId;
}
}
@@ -38,6 +38,7 @@ public class OpenConfig extends Configuration {
private final String ipdatfile;
private final String baiduAk;
private final String defaultCity;
private final boolean isOpenAllAuthority;
@@ -54,6 +55,7 @@ public class OpenConfig extends Configuration {
baiduAk = configuration.get("fangjia.baidu.ak");
isOpenAllAuthority = configuration.getBoolean("fangjia.isOpenAllAuthority", false);
enabledAddressMatch = configuration.getBoolean("fangjia.addressMatch.enabled",false);
defaultCity = configuration.get("fangjia.default.city");
}
public static OpenConfig getConfig() {
@@ -134,4 +136,7 @@ public class OpenConfig extends Configuration {
return enabledAddressMatch;
}
public String getDefaultCity() {
return defaultCity;
}
}
@@ -89,6 +89,7 @@ import com.fangjia.service.mongo.fangjia.ServerAreaService;
import com.fangjia.service.open.WaitCrawlKeywordsService;
import com.fangjia.service.sql.FjtEvaluationService;
import com.fangjia.service.web.AddressService;
import org.sothis.web.mvc.annotation.Param;
@Authority(role = Role.USER)
public class AddressController {
@@ -106,6 +107,7 @@ public class AddressController {
private HouseLoudongService houseLoudongService;
private FjtEvaluationService fjtEvaluationService;
private AddressMatchProxyService addressMatchProxyService;
private final static String AK = OpenConfig.getConfig().getBaiduAk();
private final static Logger LOGGER = LoggerFactory.getLogger(AddressController.class);
@@ -117,6 +119,8 @@ public class AddressController {
private static final String GRADE_NATION = "È«¹úÆÀ·Ö";
private static final String GRADE_CONSUME = "Ïû·ÑÆÀ·Ö";
public final static OpenConfig CONFIG = OpenConfig.getConfig();
/**
* @deprecated see parse2Action
* @param model
@@ -1705,6 +1709,228 @@ public class AddressController {
return mav;
}
/**
* 地址标准化接口V2
*
* @param model
* @return
*/
public Object standard2Action(AddesssMatchModel 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", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : CONFIG.getDefaultCity());
params.put("address", model.getAddress());
try{
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/structure", params, "UTF-8");
} catch(Exception e){
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/structure", params, "UTF-8");
} catch(Exception ex){
ex.printStackTrace();
}
}
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(json.get("result"));
}
mav.setModel(basicModel);
} else {
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
return mav;
}
/**
* 五级地址标准化接口
*
* @param model
* @return
*/
public Object fiveDivisionStructureAction(AddesssMatchModel 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", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : CONFIG.getDefaultCity());
params.put("address", model.getAddress());
// 地址验证无效也输出标准化结果
params.put("flag", "true");
try{
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/fiveDivisionStructure", params, "UTF-8");
} catch(Exception e){
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/fiveDivisionStructure", params, "UTF-8");
} catch(Exception ex){
ex.printStackTrace();
}
}
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(json.get("result"));
}
mav.setModel(basicModel);
} else {
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
return mav;
}
/**
* 五级行政区划V2地址标准化接口
*
* @param model
* @return
*/
public Object fiveDivisionStructure2Action(AddesssMatchModel 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", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : CONFIG.getDefaultCity());
params.put("address", model.getAddress());
// 地址验证无效也输出标准化结果
params.put("flag", "true");
try{
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/fiveDivisionStructure/v2", params, "UTF-8");
} catch(Exception e){
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/fiveDivisionStructure/v2", params, "UTF-8");
} catch(Exception ex){
ex.printStackTrace();
}
}
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(json.get("result"));
}
mav.setModel(basicModel);
} else {
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
return mav;
}
/**
* 详细地址标准化接口
*
* @param model
* @return
*/
public Object divisionStructureAction(AddesssMatchModel 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", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : CONFIG.getDefaultCity());
params.put("address", model.getAddress());
// 地址验证无效也输出标准化结果
params.put("flag", "true");
try{
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/divisionStructure", params, "UTF-8");
} catch(Exception e){
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/divisionStructure", params, "UTF-8");
} catch(Exception ex){
ex.printStackTrace();
}
}
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(json.get("result"));
}
mav.setModel(basicModel);
} else {
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
return mav;
}
/**
* 地址标准化专用测试接口
* @param model
* @return
*/
public Object structureAndCompleteAction(AddesssMatchModel 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", StringUtils.isNotBlank(model.getCity()) ? model.getCity() : CONFIG.getDefaultCity());
params.put("address", model.getAddress());
// 地址验证无效也输出标准化结果
params.put("flag", "true");
try{
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/structureAndComplete", params, "UTF-8");
} catch(Exception e){
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/structureAndComplete", params, "UTF-8");
} catch(Exception ex){
ex.printStackTrace();
}
}
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(json.get("result"));
}
mav.setModel(basicModel);
} else {
mav.setModel(BasicModel.buildServerErrorModel().setMsg("服务升级中..."));
}
return mav;
}
public Object similarityAction(AddesssMatchModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
if (StringUtils.isBlank(model.getAddress_1()) || StringUtils.isBlank(model.getAddress_2())) {
@@ -2760,55 +2986,59 @@ public class AddressController {
return mav;
}
BasicModel resultModel = new BasicModel(HttpStatusCodeEnum.OK);
Map<String,String> resultMap = new HashMap<String, String>();
Map<String, Object> params = new HashMap<String, Object>();
if(StringUtils.isNotBlank(model.getCity())){
params.put("city", model.getCity());
}
params.put("address", model.getAddress());
params.put("useMap", "false");
String result = addressMatchProxyService.parser(params);
if (result != null) {
JSONObject json = JSONObject.fromObject(result);
if(json.getInt("code")==200){
JSONObject resultJson = json.getJSONObject("result");
JSONObject searchAddress = resultJson.getJSONObject("searchAddress");
if(resultJson.getDouble("credit")>0){
District district = districtService.findByNameAndAlias(resultJson.getString("city"), resultJson.getString("district"), resultJson.getString("name"), "district");
if(district != null){
resultMap.put("riskLevel","A");
Map<String, String> resultMap = new HashMap<String, String>();
try {
Map<String, Object> params = new HashMap<String, Object>();
if (StringUtils.isNotBlank(model.getCity())) {
params.put("city", model.getCity());
}
params.put("address", model.getAddress());
params.put("useMap", "false");
String result = addressMatchProxyService.parser(params);
if (result != null) {
JSONObject json = JSONObject.fromObject(result);
if (json.getInt("code") == 200) {
JSONObject resultJson = json.getJSONObject("result");
JSONObject searchAddress = resultJson.getJSONObject("searchAddress");
if (resultJson.getDouble("credit") > 0) {
District district = districtService.findByNameAndAlias(resultJson.getString("city"), resultJson.getString("district"), resultJson.getString("name"), "district");
if (district != null) {
resultMap.put("riskLevel", "A");
resultModel.setResult(resultMap);
mav.setModel(resultModel);
return mav;
}
}
StringBuffer searchKey = new StringBuffer();
if (searchAddress.containsKey("street")) {
searchKey.append(searchAddress.getString("street"));
}
if (searchAddress.containsKey("streetNumber")) {
searchKey.append(searchAddress.getString("streetNumber"));
}
if (StringUtils.isNotBlank(searchKey.toString()) && searchAddress.has("city") && StringUtils.isNotBlank(searchAddress.getString("city"))) {
JSONObject jsonObject = addressMatchProxyService.searchByAmap(searchAddress.getString("city"), model.getAddress());
JSONArray poisData = jsonObject.getJSONArray("pois");
for (int i = 0; i < poisData.size(); i++) {
String address = poisData.getJSONObject(i).getString("address");
if (address.contains(searchKey.toString())) {
resultMap.put("riskLevel", "A");
resultModel.setResult(resultMap);
mav.setModel(resultModel);
return mav;
} else {
continue;
}
}
resultMap.put("riskLevel", "B");
resultModel.setResult(resultMap);
mav.setModel(resultModel);
return mav;
}
}
StringBuffer searchKey = new StringBuffer();
if(searchAddress.containsKey("street")){
searchKey.append(searchAddress.getString("street"));
}
if(searchAddress.containsKey("streetNumber")){
searchKey.append(searchAddress.getString("streetNumber"));
}
if(StringUtils.isNotBlank(searchKey.toString()) && searchAddress.has("city") && StringUtils.isNotBlank(searchAddress.getString("city"))){
JSONObject jsonObject = addressMatchProxyService.searchByAmap(searchAddress.getString("city"), model.getAddress());
JSONArray poisData = jsonObject.getJSONArray("pois");
for (int i = 0; i < poisData.size(); i++) {
String address = poisData.getJSONObject(i).getString("address");
if(address.contains(searchKey.toString())){
resultMap.put("riskLevel","A");
resultModel.setResult(resultMap);
mav.setModel(resultModel);
return mav;
}else{
continue;
}
}
resultMap.put("riskLevel","B");
resultModel.setResult(resultMap);
mav.setModel(resultModel);
return mav;
}
}
} catch (Exception ex) {
LOGGER.error("风险识别出错:" + ex.getMessage(), ex);
}
resultMap.put("riskLevel","C");
@@ -1,6 +1,7 @@
package com.fangjia.open.controllers;
import com.fangjia.core.util.DateUtil;
import com.fangjia.core.util.HttpRequest;
import com.fangjia.dal.QueryParam;
import com.fangjia.dal.SortParam;
import com.fangjia.dal.common.DistrictKey;
@@ -14,6 +15,7 @@ import com.fangjia.open.model.BasicModel;
import com.fangjia.open.model.RestfulModelAndView;
import com.fangjia.service.fsh.DistrictNewPriceService;
import com.fangjia.service.open.PaiMaiService;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.bson.types.ObjectId;
@@ -23,13 +25,14 @@ import java.util.regex.Pattern;
/**
* ·¨ÅÄÊý¾ÝÌṩ½Ó¿Ú
*/
@Authority(role = Role.USER)
//@Authority(role = Role.USER)
public class AuctionController {
private PaiMaiService paiMaiService;
private DistrictNewPriceService districtNewPriceService;
private static final String[] SEARCH_FIELDS = new String[]{"marketAvgPrice", "startDate", "curPrice", "imgUrls", "id", "matchCity", "matchRegion", "matchName", "address", "marketTotalPrice", "startPrice", "curPrice", "predictPrice", "depositPrice", "area", "status", "url", "matchEstateType"};
private static final String[] SEARCH_FIELDS = new String[]{"marketAvgPrice", "startDate", "curPrice", "imgUrls", "id", "matchCity", "matchRegion", "matchName", "address", "marketTotalPrice", "startPrice", "curPrice", "predictPrice", "depositPrice", "area", "status", "url",
"matchEstateType","type","count", "tradeAvgPrice", "evaluationPrice"};
public Object housesAction(AuctionModel model){
RestfulModelAndView mav = new RestfulModelAndView();
@@ -187,6 +190,79 @@ public class AuctionController {
return mav;
}
public Object searchPaimaisAction(AuctionModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
List<QueryParam> params = new ArrayList<QueryParam>();
if(StringUtils.isNotBlank(model.getCity())){
params.add(new QueryParam("matchCity", model.getCity()));
}
if(StringUtils.isNotBlank(model.getDistrict())){
params.add(new QueryParam("matchRegion", model.getDistrict()));
}
if(StringUtils.isNotBlank(model.getName())){
params.add(new QueryParam("matchName", model.getName()));
}
Date startDate = null;
if(StringUtils.isNotBlank(model.getStartDate())){
startDate = DateUtil.parseDate(model.getStartDate(),"yyyyMMdd");
if(startDate != null){
params.add(new QueryParam("startDate", QueryParam.GREATER_THAN_EQUAL_OPERATOR, startDate));
}
}
List<SortParam> sortParams = new ArrayList<SortParam>();
sortParams.add(new SortParam("startDate", false));
List<PaiMai> paimais = paiMaiService.findAll(params, sortParams, model.getLimit(), SEARCH_FIELDS);
if(paimais!=null && paimais.size()>0){
for(PaiMai paiMai : paimais){
Map<String, Object> map = standard(paiMai.getCity(), paiMai.getAddress());
if(map!=null){
if (map.containsKey("buildingNumber")) {
paiMai.setHouseNum((String) map.get("buildingNumber"));
}
if (map.containsKey("unitNumber")) {
paiMai.setUnitNum((String) map.get("unitNumber"));
}
if (map.containsKey("roomNumber")) {
paiMai.setRoomNum((String) map.get("roomNumber"));
}
}
}
}
mav.setModel(BasicModel.buildOKModel().setResult(paimais));
return mav;
}
private Map standard(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/structure", params, "UTF-8");
} catch(Exception e){
try {
json = request.getJsonContent("http://192.168.0.100:32080/FangJiaAddressService/structure", params, "UTF-8");
} catch(Exception ex){
ex.printStackTrace();
}
}
if (json != null) {
int code = json.getInt("status");
String msg = json.getString("msg");
if(json.containsKey("result")){
return (Map)json.get("result");
}
}
return null;
}
public void setPaiMaiService(PaiMaiService paiMaiService) {
this.paiMaiService = paiMaiService;
}
@@ -15,8 +15,10 @@ import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.fangjia.dal.common.DistrictKey;
import com.fangjia.dal.mongo.model.Metro;
import com.fangjia.open.model.BasicModel;
import com.fangjia.service.bo.DistrictStatBo;
import org.apache.commons.lang.StringUtils;
import com.fangjia.core.util.DateUtil;
@@ -211,6 +213,42 @@ public class DealPriceController {
mv.setModel(resMap);
return mv;
}
public Object searchListAction(final DealPriceModel model) {
RestfulModelAndView mv = new RestfulModelAndView();
mv.setViewType("rest");
if (StringUtils.isBlank(model.getId())) {
mv.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "楼盘编号不能为空"));
return mv;
}
District district = districtService.findDistrictById(model.getId());
DistrictKey districtKey = new DistrictKey(district.getCity(), district.getRegion(), district.getName());
if(district == null){
mv.setModel(BasicModel.buildBadRequestModel("该小区不存在"));
return mv;
}
DistrictStatBo bo = districtStatService.findCurrentDistrictStat(districtKey);
Integer minPrice = null;
Integer maxPrice = null;
if(bo.getDistrictStat()!=null){
minPrice = (int)(bo.getDistrictStat().getAvgPrice() * 0.9);
maxPrice = (int)(bo.getDistrictStat().getAvgPrice() * 1.1);
}
Date startDate = null;
Date endDate = null;
if(StringUtils.isNotBlank(model.getStartDate())){
startDate = DateUtil.parseDate(model.getStartDate(),"yyyyMMdd");
}
if(StringUtils.isNotBlank(model.getEndDate())){
endDate = DateUtil.parseDate(model.getEndDate(),"yyyyMMdd");
}
List<DealPrice> dealPrices = dealPriceService.getNearlySameDealPrice(model.getId(), minPrice, maxPrice, startDate, endDate, model.getLimit());
mv.setModel(BasicModel.buildOKModel().setResult(dealPrices));
return mv;
}
private List<DealPrice> findDealPricesByName(String city,String region ,String name){
Calendar calendar = Calendar.getInstance();
@@ -7,11 +7,11 @@ import javax.servlet.http.HttpServletRequest;
import com.fangjia.core.RegionData;
import com.fangjia.core.util.DateUtil;
import com.fangjia.dal.mongo.model.RegionStat;
import com.fangjia.dal.mongo.model.RegionStatRent;
import com.fangjia.dal.mongo.model.*;
import com.fangjia.open.model.AvgPriceQueryModel;
import com.fangjia.open.model.BasicModel;
import com.fangjia.service.datastore.RegionStatService;
import com.fangjia.service.district.DistrictFacilitysService;
import com.fangjia.service.district.DistrictStatRentService;
import com.fangjia.service.district.RegionStatRentService;
import com.fangjia.service.mongo.fangjia.AverageAnalyService;
@@ -38,8 +38,6 @@ import com.fangjia.dal.common.DistrictKey;
import com.fangjia.dal.common.FangjiaServerAreaContextHolder;
import com.fangjia.dal.common.ServerAreaData;
import com.fangjia.dal.mongo.fangjia.model.ServerArea;
import com.fangjia.dal.mongo.model.DistrictHouse;
import com.fangjia.dal.mongo.model.DistrictStat;
import com.fangjia.dal.mongo.model.bkoff.ExtractDistrict;
import com.fangjia.dal.seaweed.model.District;
import com.fangjia.dal.sql.model.ApiUser;
@@ -93,6 +91,7 @@ public class DistrictController {
private RegionBlockService regionBlockService;
private RegionStatService regionStatService;
private RegionStatRentService regionStatRentService;
private DistrictFacilitysService districtFacilitysService;
public static final String[] COLUMNS = { "id", "name", "estateType", "buildType", "licence", "buildArea", "allArea",
@@ -444,19 +443,19 @@ public class DistrictController {
*
* @return
*/
public Object showAction(DistrictSearchModel model, @Param(name = "city") String city, @Param(name = "region") String region,
@Param(name = "name") String name, HttpServletRequest request) {
RestfulModelAndView mav = new RestfulModelAndView();
mav.setViewType("rest");
if (StringUtils.isBlank(name) || StringUtils.isBlank(city) || StringUtils.isBlank(region)) {
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "小区所在城市,小区名,所在区域必必须输入"));
return mav;
} else {
DistrictBo districtBo = districtService.findByFullMode(new DistrictKey(city, region, name));
if (null == districtBo) {
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "小区数据不存在,请检查查询条件"));
public Object showAction(DistrictSearchModel model, @Param(name = "city") String city, @Param(name = "region") String region,
@Param(name = "name") String name, HttpServletRequest request) {
RestfulModelAndView mav = new RestfulModelAndView();
mav.setViewType("rest");
if (StringUtils.isBlank(name) || StringUtils.isBlank(city) || StringUtils.isBlank(region)) {
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "小区所在城市,小区名,所在区域必必须输入"));
return mav;
}
} else {
DistrictBo districtBo = districtService.findByFullMode(new DistrictKey(city, region, name));
if (null == districtBo) {
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "小区数据不存在,请检查查询条件"));
return mav;
}
districtBo.setStat(this.districtStatService.findDistrictStat(districtBo.getDistrictKey()));
// È¥³ýÐ¡ÇøÃèÊöÖеÄhtml±êÇ©
districtBo.setDescription(DataUtil.removeSpecialString(districtBo.getDescription()));
@@ -1146,6 +1145,25 @@ public class DistrictController {
ret.put("RESULT", 200);
return mav;
}
public Object facilitysAction(DistrictSearchModel model, @Param(name = "city") String city, @Param(name = "region") String region,
@Param(name = "name") String name, HttpServletRequest request) {
RestfulModelAndView mav = new RestfulModelAndView();
mav.setViewType("rest");
if (StringUtils.isBlank(name) || StringUtils.isBlank(city) || StringUtils.isBlank(region)) {
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "小区所在城市,小区名,所在区域必必须输入"));
return mav;
} else {
District districtBo = districtService.findDistrict(new DistrictKey(city, region, name), "district");
if (null == districtBo) {
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "小区数据不存在"));
return mav;
}
DistrictFacilitys facilitys = districtFacilitysService.findByDistrict(districtBo);
mav.setModel(BasicModel.buildOKModel().setResult(facilitys));
}
return mav;
}
@@ -1230,4 +1248,7 @@ public class DistrictController {
this.regionStatRentService = regionStatRentService;
}
public void setDistrictFacilitysService(DistrictFacilitysService districtFacilitysService) {
this.districtFacilitysService = districtFacilitysService;
}
}
@@ -10,9 +10,14 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.fangjia.dal.mongo.model.BsEvaluation;
import com.fangjia.dal.mongo.model.bkoff.DealPrice;
import com.fangjia.service.bo.AddrEvaResult;
import com.fangjia.service.bo.DistrictStatBo;
import com.fangjia.service.bo.EvaluationBo;
import com.fangjia.service.bo.HouseScorer;
import com.fangjia.service.datastore.*;
import com.fangjia.service.district.DistrictStatService;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
@@ -54,11 +59,6 @@ import com.fangjia.open.model.RestfulModelAndView;
import com.fangjia.service.api.AutoCompleteService;
import com.fangjia.service.api.KnowbaseService;
import com.fangjia.service.common.SellSimilar;
import com.fangjia.service.datastore.BusinessEstateService;
import com.fangjia.service.datastore.DistrictService;
import com.fangjia.service.datastore.EvaluationReportService;
import com.fangjia.service.datastore.EvaluationService;
import com.fangjia.service.datastore.HouseService;
import com.fangjia.service.sql.ApiUserService;
import com.fangjia.service.sql.UserService;
import com.fangjia.service.web.AddressService;
@@ -94,6 +94,8 @@ public class EvaluationController {
private ApiUserService apiUserService;
private UserService userService;
private AddressService addressService;
private DistrictStatService districtStatService;
private BsEvaluationService bsEvaluationService;
private final static String AK = OpenConfig.getConfig().getBaiduAk();
public Object lngLatEvaluateAction(EvaluationModel model) {
@@ -1005,6 +1007,44 @@ public class EvaluationController {
return mav;
}
public Object bsListAction(EvaluationModel model) {
RestfulModelAndView mv = new RestfulModelAndView();
mv.setViewType("rest");
if (StringUtils.isBlank(model.getId())) {
mv.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "楼盘编号不能为空"));
return mv;
}
District district = districtService.findDistrictById(model.getId());
DistrictKey districtKey = new DistrictKey(district.getCity(), district.getRegion(), district.getName());
if(district == null){
mv.setModel(BasicModel.buildBadRequestModel("该小区不存在"));
return mv;
}
DistrictStatBo bo = districtStatService.findCurrentDistrictStat(districtKey);
Integer minPrice = null;
Integer maxPrice = null;
if(bo.getDistrictStat()!=null){
minPrice = (int)(bo.getDistrictStat().getAvgPrice() * 0.8);
maxPrice = (int)(bo.getDistrictStat().getAvgPrice() * 1.2);
}
Date startDate = null;
Date endDate = null;
if(StringUtils.isNotBlank(model.getStartDate())){
startDate = DateUtil.parseDate(model.getStartDate(),"yyyyMMdd");
}
if(StringUtils.isNotBlank(model.getEndDate())){
endDate = DateUtil.parseDate(model.getEndDate(),"yyyyMMdd");
}
List<BsEvaluation> dealPrices = bsEvaluationService.getNearlySameEvaluation(model.getId(), minPrice, maxPrice, startDate, endDate, model.getLimit());
mv.setModel(BasicModel.buildOKModel().setResult(dealPrices));
return mv;
}
public void setEvaluationService(EvaluationService evaluationService) {
this.evaluationService = evaluationService;
}
@@ -1017,6 +1057,18 @@ public class EvaluationController {
this.knowbaseService = knowbaseService;
}
public void setDistrictStatService(DistrictStatService districtStatService) {
this.districtStatService = districtStatService;
}
public void setBsEvaluationService(BsEvaluationService bsEvaluationService) {
this.bsEvaluationService = bsEvaluationService;
}
public void setAutoCompleteService(AutoCompleteService autoCompleteService) {
this.autoCompleteService = autoCompleteService;
}
@@ -11,6 +11,8 @@ import com.fangjia.dal.mongo.model.DistrictFacilitys;
import com.fangjia.dal.mongo.model.FangjiaOfficialAreaMap;
import com.fangjia.dal.mongo.model.Metro;
import com.fangjia.dal.mongo.model.StatsIndex;
import com.fangjia.dal.seawater.dao.SeawaterDao;
import com.fangjia.dal.seawater.model.Seawater;
import com.fangjia.dal.seaweed.model.District;
import com.fangjia.dal.sql.model.ApiUser;
import com.fangjia.datastore.driver.FacetResult;
@@ -29,6 +31,7 @@ import com.fangjia.open.ws.query.CollateralSampleQuery;
import com.fangjia.open.ws.query.ShopCollateralSampleQuery;
import com.fangjia.service.address.AddressParser;
import com.fangjia.service.bo.Collateral;
import com.fangjia.service.bo.DistrictStatBo;
import com.fangjia.service.bo.Sample;
import com.fangjia.service.bo.ShopSample;
import com.fangjia.service.datastore.CzbankSampleService;
@@ -39,11 +42,13 @@ import com.fangjia.service.datastore.bean.CollateralSampleQueryBean;
import com.fangjia.service.datastore.bean.ShopCollateralSampleQueryBean;
import com.fangjia.service.district.DistrictFacilitysService;
import com.fangjia.service.district.DistrictStatService;
import com.fangjia.service.district.SqmetreRentService;
import com.fangjia.service.menu.Item;
import com.fangjia.service.menu.MenuCategoryEnum;
import com.fangjia.service.menu.Value;
import com.fangjia.service.mongo.fangjia.DealPriceService;
import com.fangjia.service.mongo.fangjia.MetroService;
import com.fangjia.service.mongo.fangjia.SeawaterService;
import com.fangjia.service.mongo.fangjia.StatsIndexService;
import com.fangjia.service.open.FangjiaOfficialAreaService;
import com.fangjia.service.open.HousePojo;
@@ -86,6 +91,9 @@ public class HouseController {
private CzbankSampleService czbankSampleService;
private DistrictService districtService;
private FangjiaOfficialAreaService fangjiaOfficialAreaService;
private SeawaterService seawaterService;
private SeawaterDao seawaterDao;
private List<String> PROPERTY_TYPE_CODE_LIST = Arrays.asList("01", "02");
@@ -399,6 +407,107 @@ public class HouseController {
}
}
public Object listAction(final HouseSearchModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
mav.setViewType("rest");
if (StringUtils.isBlank(model.getId()) && (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getRegion()) || StringUtils.isBlank(model.getName()))) {
mav.setModel(BasicModel.buildBadRequestModel("楼盘编号或城市,区域,名称为必填项"));
return mav;
}
District district = null;
DistrictKey districtKey = null;
if(StringUtils.isNotBlank(model.getName())){
districtKey = new DistrictKey(model.getCity(), model.getRegion(), model.getName());
district = districtService.findDistrict(districtKey, "district");
}else{
district = districtService.findDistrictById(model.getId());
if(district!=null){
districtKey = new DistrictKey(district.getCity(), district.getRegion(), district.getName());
}
}
if(district == null){
mav.setModel(BasicModel.buildBadRequestModel("该小区不存在"));
return mav;
}
DistrictStatBo bo = districtStatService.findCurrentDistrictStat(districtKey);
Integer minPrice = null;
Integer maxPrice = null;
if(bo.getDistrictStat()!=null){
minPrice = (int)(bo.getDistrictStat().getAvgPrice() * 0.9);
maxPrice = (int)(bo.getDistrictStat().getAvgPrice() * 1.1);
}
List<String> names = new ArrayList<String>();
names.add(district.getName());
if(district.getAlias() != null){
for(String alia : district.getAlias()){
if(StringUtils.isNotBlank(alia) && !names.contains(alia)){
names.add(alia);
}
}
}
List<Seawater> houses = seawaterDao.findSeawatersFromEs("sell", district.getCity(), district.getRegion(), district.getName(), district.getAlias(), null, model.getStartTime(), model.getEndTime(),null,null,minPrice, maxPrice,null,null,"p_date", false,0, model.getPageSize(),"latest_seawater");
//List<Seawater> houses1 = seawaterDao.findHouses(district.getCity(), district.getRegion(), names, minPrice, maxPrice, model.getPageSize());
mav.setModel(BasicModel.buildOKModel().setResult(houses));
return mav;
}
public Object arroundlistAction(final HouseSearchModel model) {
RestfulModelAndView mav = new RestfulModelAndView();
mav.setViewType("rest");
if (StringUtils.isBlank(model.getId()) && (StringUtils.isBlank(model.getCity()) || StringUtils.isBlank(model.getRegion()) || StringUtils.isBlank(model.getName()))) {
mav.setModel(BasicModel.buildBadRequestModel("楼盘编号或城市,区域,名称为必填项"));
return mav;
}
District district = null;
DistrictKey districtKey = null;
if(StringUtils.isNotBlank(model.getName())){
districtKey = new DistrictKey(model.getCity(), model.getRegion(), model.getName());
district = districtService.findDistrict(districtKey, "district");
}else{
district = districtService.findDistrictById(model.getId());
if(district!=null){
districtKey = new DistrictKey(district.getCity(), district.getRegion(), district.getName());
}
}
if(district == null){
mav.setModel(BasicModel.buildBadRequestModel("该小区不存在"));
return mav;
}
//周边小区,默认10
List<District> districts = districtService.findNearestDistrict(district, 1000, model.getDistCount());
List<Seawater> houses = new ArrayList<Seawater>();
for(District dist : districts){
districtKey = new DistrictKey(dist.getCity(), dist.getRegion(), dist.getName());
DistrictStatBo bo = districtStatService.findCurrentDistrictStat(districtKey);
Integer minPrice = null;
Integer maxPrice = null;
if(bo.getDistrictStat()!=null){
minPrice = (int)(bo.getDistrictStat().getAvgPrice() * 0.9);
maxPrice = (int)(bo.getDistrictStat().getAvgPrice() * 1.1);
}
List<String> names = new ArrayList<String>();
names.add(district.getName());
if(district.getAlias() != null){
for(String alia : district.getAlias()){
if(StringUtils.isNotBlank(alia) && !names.contains(alia)){
names.add(alia);
}
}
}
List<Seawater> arroundhouses = seawaterDao.findSeawatersFromEs("sell", dist.getCity(), dist.getRegion(), dist.getName(), dist.getAlias(), null, model.getStartTime(), model.getEndTime(),null,null,minPrice, maxPrice,null,null,"p_date", false,0, model.getPageSize(),"latest_seawater");
if(arroundhouses!=null && arroundhouses.size()>0){
houses.addAll(arroundhouses);
}
}
mav.setModel(BasicModel.buildOKModel().setResult(houses));
return mav;
}
String getPicUrl(String url, List<String> urls) {
if (!urls.contains(url)) {
urls.add(url);
@@ -832,6 +941,13 @@ public class HouseController {
return ret;
}
public void setSeawaterService(SeawaterService seawaterService) {
this.seawaterService = seawaterService;
}
public void setSeawaterDao(SeawaterDao seawaterDao) {
this.seawaterDao = seawaterDao;
}
private boolean checkExists(FacetQueryResult<HousePojo> houseBoList, HousePojo house) {
for (HousePojo bo : houseBoList) {
@@ -31,12 +31,15 @@ import javax.validation.Valid;
import com.fangjia.core.util.*;
import com.fangjia.dal.*;
import com.fangjia.dal.mongo.model.*;
import com.fangjia.dal.mongo.open.model.CommunityBasePrice;
import com.fangjia.dal.mongo.open.model.CommunityPoi;
import com.fangjia.dal.seawater.dao.SeawaterDao;
import com.fangjia.dal.seawater.model.Seawater;
import com.fangjia.open.dto.*;
import com.fangjia.service.district.*;
import com.fangjia.service.mongo.fangjia.*;
import com.fangjia.service.open.*;
import com.fangjia.service.open.impl.CommunityPoiServiceImpl;
import com.fangjia.service.util.DistrictScoreUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@@ -175,6 +178,9 @@ public class PropertyController {
private SeawaterDao seawaterDao;
private SeawaterService seawaterService;
private SqmetreRentService sqmetreRentService;
private CommunityPoiService communityPoiService;
private CommunityBasePriceService communityBasePriceService;
private EvaluateFactorService evaluateFactorService;
private FileDao fileDao = FileDao.getInstance();
private static final int DEFAULT_PAGE_SIZE = 20;
@@ -390,10 +396,31 @@ public class PropertyController {
put("5000", "five");// 五线
}
};
/**
* 第三方均价映射
*/
private static final Map<String, String> OTHER_PRICE_MAP = new HashMap<String, String>() {
{
put("zhuge_price", "诸葛找房");
put("anjuke_price", "安居客");
put("fang_price", "房天下");
put("lianjia_price", "链家");
put("cityhouse_price", "禧泰数据");
put("maitian_price", "麦田");
put("ke_price", "贝壳");
put("taofang_price", "淘房365");
put("zhongyuan_price", "中原");
put("tbs_price", "兔博士");
put("qfang_price", "Q房");
put("fangtan_price", "房探");
put("fangduoduo_price", "房多多");
put("wiwj_price", "我爱我家");
}
};
/**
* 利用百度API把GPS转换成Google经纬度
*
*
* @param lng
* @param lat
* @return
@@ -415,7 +442,7 @@ public class PropertyController {
/**
* 利用算法模板把GPS转换成Google经纬度
*
*
* @param lng
* @param lat
* @return
@@ -607,7 +634,7 @@ public class PropertyController {
/**
* 判断小区是否有经纬度
*
*
* @param district
* @return
*/
@@ -618,7 +645,7 @@ public class PropertyController {
/**
* 调用匹配接口匹配小区
*
*
* @param city
* @param address
* @param region
@@ -666,17 +693,6 @@ public class PropertyController {
}
String userId = FangjiaApiUtil.parseUserId(model.getToken());
/**超级用户和上海交大账户不控制权限*/
if (!"1007497".equals(userId) && !"1007632".equals(userId) && !"1007548".equals(userId)
&& !"1007486".equals(userId) && !"1007533".equals(userId) && !"1007630".equals(userId)
&& !"1007705".equals(userId) && !"1007739".equals(userId) && !"1007736".equals(userId)
&& !"1007741".equals(userId) && !"1007742".equals(userId) && !"1007743".equals(userId)
&& !"1007747".equals(userId) && !"1007757".equals(userId)
&& model.getDetailLevel() != null && model.getDetailLevel() != 0) {// 临时权限控制
mav.setModel(BasicModel.buildUnAuthorizedModel());
return mav;
}
District district = null;
if (StringUtils.isNotBlank(model.getId())){
if(ObjectId.isValid(model.getId())){
@@ -740,18 +756,18 @@ public class PropertyController {
} else {
districtInfoDto.setBuildingType("");
}
districtInfoDto.setAlias(district.getAlias());
districtInfoDto.setAlias(district.getMappingAlias());
districtInfoDto.setAddressAlias(district.getAddrAlias());
districtInfoDto.setCommunity(district.getStreetCommunity());
districtInfoDto.setCommercialArea(district.getBusinessQuarter());
if (district.getHouseholdCount() != null) {
districtInfoDto.setTotalUnitCount(district.getHouseholdCount().toString());
districtInfoDto.setTotalUnitCount(SeaweedUtils.formatHouseholdCount(district.getHouseholdCount().toString()));
} else {
districtInfoDto.setTotalUnitCount("");
}
districtInfoDto.setManagementFee(district.getEstateCharge());
if (district.getCarSiteCount() != null) {
districtInfoDto.setParking(district.getCarSiteCount().toString());
districtInfoDto.setParking(SeaweedUtils.formatCarSiteCount(district.getCarSiteCount().toString()));
} else {
districtInfoDto.setParking("");
}
@@ -772,10 +788,10 @@ public class PropertyController {
districtInfoDto.setFinishBuildTime(district.getFinishBuildingDate());
districtInfoDto.setMoveinTime(district.getLiveDate());
districtInfoDto.setFloorSpace(district.getAllArea());
districtInfoDto.setFloorSpace(SeaweedUtils.formatAllArea(district.getAllArea()));
districtInfoDto.setConstructionSpace(district.getBuildArea());
districtInfoDto.setPlotRatio(district.getCubagePercent());
districtInfoDto.setGreenPercentage(district.getVirescencePercent());
districtInfoDto.setPlotRatio(SeaweedUtils.formatCubagePercent(district.getCubagePercent()));
districtInfoDto.setGreenPercentage(SeaweedUtils.formatVirescencePercent(district.getVirescencePercent()));
districtInfoDto.setPreSalePermit(district.getLicence());
districtInfoDto.setDeveloper(district.getDeveloper());
districtInfoDto.setDiscount(district.getDiscount());
@@ -792,6 +808,7 @@ public class PropertyController {
districtInfoDto.setDescription(district.getDescription());
districtInfoDto.setSalesOfficeAdd(district.getSellAddress());
districtInfoDto.setSalesPhoneNumber(district.getMobile());
districtInfoDto.setTownship(district.getTownship());
if (district.getLoudongCount() != null && district.getLoudongCount() > 0) {
districtInfoDto.setBuildingCount(district.getLoudongCount());
}
@@ -960,6 +977,12 @@ public class PropertyController {
return mav;
}
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()){
model.setMaxFloor(loudong.getFloors());
}
}
model.setRegion(district.getRegion());
model.setDistrictName(district.getName());
if (StringUtils.isBlank(model.getPropertyType())) {
@@ -996,6 +1019,32 @@ public class PropertyController {
}
}
// 调整面积不同面积价格
try {
DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district));
int orgAvgPrice = 0;
if (districtStatBo != null) {
if (StringUtils.isNotBlank(district.getEstateType2()) && district.getEstateType2().contains("别墅") && districtStatBo.getVillaDistrictStat() != null) {
orgAvgPrice = districtStatBo.getVillaDistrictStat().getAvgPrice();
} else if (districtStatBo.getDistrictStat() != null) {
orgAvgPrice = districtStatBo.getDistrictStat().getAvgPrice();
}
}
if (evaluation != null && evaluation.getAvgPrice() != null && evaluation.getAvgPrice() > 0) {
int factorPrice = evaluation.getAvgPrice();
int avgPrice = evaluateFactorService.recompose(district.getCity(), district.getRegion(), evaluation.getArea(), factorPrice, orgAvgPrice);
Integer minPrice = (int)(evaluation.getAvgPrice() * 0.95);
Integer maxPrice = (int)(evaluation.getAvgPrice() * 1.05);
// 偏离度超过5%不进行调整
if (minPrice <= avgPrice && avgPrice <= maxPrice) {
evaluation.setAvgPrice(avgPrice);
evaluation.setBigTotalPrice((long) (avgPrice * evaluation.getArea()));
}
}
} catch (Exception ex) {
}
if (evaluation.getTotalPrice() != null && evaluation.getTotalPrice() != 0
&& (cityPriceCredit == null || evaluation.getCredit() >= cityPriceCredit)) {
Map<String, Object> districtPriceMap = new HashMap<String, Object>();
@@ -1116,7 +1165,7 @@ public class PropertyController {
model.setCalDate(calDate);
}
/* 先到CPDB库中查找小区 */
District district = matchDistrict(model.getCity(), model.getAddress(), model.getDistrict(), model.getName());
District district = districtService.findDistrict(new DistrictKey(model.getCity(), model.getDistrict(), model.getName()), "district");//matchDistrict(model.getCity(), model.getAddress(), model.getDistrict(), model.getName());
if(district == null){
//防止地址模糊,名称详细的情况
district = matchDistrict(model.getCity(), model.getName(), model.getDistrict(), model.getAddress());
@@ -1166,19 +1215,52 @@ public class PropertyController {
evaluationService.remove(evaluation.getId());
mav.setModel(BasicModel.buildOKModel().setMsg("暂时不支持该小区的估价").markNoData());
return mav;
}
// 调整面积不同面积价格
try {
DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district));
int orgAvgPrice = 0;
if (districtStatBo != null) {
if (StringUtils.isNotBlank(district.getEstateType2()) && district.getEstateType2().contains("别墅") && districtStatBo.getVillaDistrictStat() != null) {
orgAvgPrice = districtStatBo.getVillaDistrictStat().getAvgPrice();
} else if (districtStatBo.getDistrictStat() != null) {
orgAvgPrice = districtStatBo.getDistrictStat().getAvgPrice();
}
}
if (evaluation != null && evaluation.getAvgPrice() != null && evaluation.getAvgPrice() > 0) {
int factorPrice = evaluation.getAvgPrice();
int avgPrice = evaluateFactorService.recompose(district.getCity(), district.getRegion(), evaluation.getArea(), factorPrice, orgAvgPrice);
Integer minPrice = (int)(evaluation.getAvgPrice() * 0.95);
Integer maxPrice = (int)(evaluation.getAvgPrice() * 1.05);
// 偏离度超过5%不进行调整
if (minPrice <= avgPrice && avgPrice <= maxPrice) {
evaluation.setAvgPrice(avgPrice);
evaluation.setBigTotalPrice((long) (avgPrice * evaluation.getArea()));
}
}
} catch (Exception ex) {
}
Map<String, Object> districtPriceMap = new LinkedHashMap<String, Object>();
districtPriceMap.put("city", district.getCity());
districtPriceMap.put("district", district.getRegion());
districtPriceMap.put("name", district.getName());
long totalPrice = evaluation.getBigTotalPrice();
if(CITY_CORRECTION_FACTOR.containsKey(district.getCity())){
totalPrice = (long)(totalPrice * (1 - CITY_CORRECTION_FACTOR.get(district.getCity())));
evaluation.setBigTotalPrice(totalPrice);
evaluation.setAvgPrice((int)(totalPrice/evaluation.getArea()));
}
// 取消系数下调
// if(CITY_CORRECTION_FACTOR.containsKey(district.getCity())){
// totalPrice = (long)(totalPrice * (1 - CITY_CORRECTION_FACTOR.get(district.getCity())));
// evaluation.setBigTotalPrice(totalPrice);
// evaluation.setAvgPrice((int)(totalPrice/evaluation.getArea()));
// }
districtPriceMap.put("totalPrice", evaluation.getBigTotalPrice());
districtPriceMap.put("unitPrice", evaluation.getAvgPrice());
// 新增置信度
CommunityBasePrice communityBasePrice = communityBasePriceService.getById(district.getId());
if (communityBasePrice != null) {
districtPriceMap.put("credit", communityBasePrice.getCredit());
} else {
districtPriceMap.put("credit", evaluation.getCredit());
}
List<String> names = new ArrayList<String>();
names.add(district.getName());
if(district.getAlias() != null){
@@ -1190,6 +1272,31 @@ public class PropertyController {
}
Integer minPrice = (int)(evaluation.getAvgPrice() * 0.8);
Integer maxPrice = (int)(evaluation.getAvgPrice() * 1.2);
Integer min10Price = (int)(evaluation.getAvgPrice() * 0.9);
Integer max10Price = (int)(evaluation.getAvgPrice() * 1.1);
// 新增第三方均价
try {
double dCredit = 0.61;
Map<String, Object> rMap = getLastEvaluationPrice(district, evaluation, dCredit);
if (null != rMap) {
if (rMap.containsKey("other_price")) {
Map<String, Integer> otherPriceMap = (Map<String, Integer>) rMap.get("other_price");
Map<String, Integer> priceResultMap = new HashMap<String, Integer>();
for (String key : otherPriceMap.keySet()) {
Integer price = otherPriceMap.get(key);
// 剔除偏差大于10的
if (min10Price <= price && max10Price >= price) {
if (OTHER_PRICE_MAP.containsKey(key)) {
priceResultMap.put(OTHER_PRICE_MAP.get(key), price);
}
}
}
districtPriceMap.put("otherPrice", priceResultMap);
}
}
} catch (Exception ex) {
}
List<Seawater> houses = seawaterDao.findHouses(district.getCity(), district.getRegion(), names,minPrice, maxPrice, 20);
if(houses.size() > 3){
districtPriceMap.put("calcType", 1);
@@ -1218,7 +1325,7 @@ public class PropertyController {
}else if(district.getLng() != null && district.getLng() > 0){
double lng = DataUtil.roundDouble(district.getLng() / 10000000000.0,6);
double lat = DataUtil.roundDouble(district.getLat() / 10000000000.0, 6);
List<District> districts = districtService.findNearestDistrict(district.getEstateType2(), lng, lat, 1000 * 3 , 4, null);
List<District> districts = districtService.findNearestDistrict(district.getEstateType2(), lng, lat, 1000 * 3 , 6, null);
if(districts.size() < 2){
evaluationService.remove(evaluation.getId());
mav.setModel(BasicModel.buildOKModel().setMsg("暂时不支持该小区的估价").markNoData());
@@ -1256,9 +1363,15 @@ public class PropertyController {
districtDto.append("buildYear", String.valueOf(buildYear));
}
districtAnalyData = districtAnalyDataService.findByDistrictKey(new DistrictKey(d));
if(districtAnalyData != null && districtAnalyData.getHalfYearMarkup() != null){
districtDto.append("halfYearMarkup",DataUtil.roundDouble( districtAnalyData.getHalfYearMarkup() * 100 ,2));
if(districtAnalyData != null){
if (districtAnalyData.getHalfYearMarkup() != null) {
districtDto.append("halfYearMarkup", DataUtil.roundDouble(districtAnalyData.getHalfYearMarkup() * 100, 2));
}
if (districtAnalyData.getAvgPrice() != null && minPrice <= districtAnalyData.getAvgPrice() && maxPrice >= districtAnalyData.getAvgPrice()) {
districtDto.append("avgPrice", districtAnalyData.getAvgPrice());
}
}
nearCommunityDtos.add(districtDto);
}
Integer buildYear = districtService.getBuildYear(district);
@@ -1266,6 +1379,18 @@ public class PropertyController {
modelFeaturesFto.put("buildYear", String.valueOf(buildYear));
}
modelFeaturesFto.append("nearCommunity", nearCommunityDtos);
// 模型特征新增周边数量
CommunityPoi communityPoi = communityPoiService.getById(district.getId());
if (communityPoi != null) {
modelFeaturesFto.put("subway", communityPoi.getSubway());
modelFeaturesFto.put("traffic", communityPoi.getTraffic());
modelFeaturesFto.put("bank", communityPoi.getBank());
modelFeaturesFto.put("primary", communityPoi.getPrimary());
modelFeaturesFto.put("hospital", communityPoi.getHospital());
modelFeaturesFto.put("junior", communityPoi.getJunior());
modelFeaturesFto.put("funeral", communityPoi.getFuneral());
}
districtPriceMap.put("modelFeatures", modelFeaturesFto);
}
mav.setModel(BasicModel.buildOKModel().setResult(districtPriceMap));
@@ -1473,7 +1598,7 @@ public class PropertyController {
return mav;
}
}
/**
* 四川锦程 定制接口 多建筑年代
* @param model
@@ -1585,7 +1710,7 @@ public class PropertyController {
districtPriceMap.put("buildYear", matcher3.group());
}
}
// 根据城市等 级设置D级可信度
ApiUserAuthority apiUserAuthority = apiUserAuthorityService
@@ -2098,7 +2223,7 @@ public class PropertyController {
/**
* 小区租金查询接口
*
*
* @param model
* @return
*/
@@ -2363,7 +2488,7 @@ public class PropertyController {
mav.setModel(BasicModel.buildBadRequestModel("size(面积)不能为空"));
return mav;
}
District district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName(),
District district = districtService.findByNameAndAlias(model.getCity(), model.getDistrict(), model.getName().replace(" ",""),
"district");
if (null == district) {
mav.setModel(BasicModel.buildBadRequestModel("该小区不存在"));
@@ -2577,7 +2702,7 @@ public class PropertyController {
/**
* 批量获取小区的均价,均价走势数据
*
*
* @param request
* @return
*/
@@ -2719,7 +2844,7 @@ public class PropertyController {
/**
* 批量获取小区的配套数据,最多12个小区
*
*
* @param request
* @return
*/
@@ -2864,7 +2989,7 @@ public class PropertyController {
/**
* 获取JSON参数中的num参数值
*
*
* @param jo
* @return
*/
@@ -2889,7 +3014,7 @@ public class PropertyController {
/**
* 获取JSON参数中的radius值
*
*
* @param jo
* @return
*/
@@ -3697,7 +3822,7 @@ public class PropertyController {
/**
* 解析出关键字中的小区名
*
*
* @param keyword
* @return
*/
@@ -3814,7 +3939,7 @@ public class PropertyController {
/**
* 小区统计分析接口
*
*
* @param model
* @return
*/
@@ -3899,7 +4024,7 @@ public class PropertyController {
/**
* 小区交通接口
*
*
* @param model
* @return
*/
@@ -3957,7 +4082,7 @@ public class PropertyController {
/**
* 小区周边接口
*
*
* @param model
* @return
*/
@@ -4016,7 +4141,7 @@ public class PropertyController {
/**
* 相同小区相似户型房源挂牌量接口<br>
* 获取该小区的满足指定相似条件的挂牌房源量 条件说明: 1.输入面积-5<=房源面积<=输入面积+5 2.上个月发布的房源
*
*
* @author yinjihuan
* @date 2016年9月1日
* @param city
@@ -4056,7 +4181,7 @@ public class PropertyController {
/**
* 周边小区相似户型挂牌量接口<br>
* 获取该小区的满足指定相似条件的挂牌房源量 条件说明: 1.输入面积-5<=房源面积<=输入面积+5 2.上个月发布的房源
*
*
* @author yinjihuan
* @date 2016年9月1日
* @param city
@@ -4107,7 +4232,7 @@ public class PropertyController {
/**
* 小区周边一公里均价
*
*
* @author wenyan
* @param model
* @return
@@ -4130,7 +4255,7 @@ public class PropertyController {
/**
* 相同小区相似户型租金范围查询接口
*
*
* @param model
* @return
*/
@@ -4173,7 +4298,7 @@ public class PropertyController {
/**
* 周边小区相似户型租金范围查询接口
*
*
* @param model
* @return
*/
@@ -4236,7 +4361,7 @@ public class PropertyController {
/**
* 室号查询接口
*
*
* @param model
* @return
*/
@@ -4272,7 +4397,7 @@ public class PropertyController {
/**
* 楼栋楼层信息查询接口
*
*
* @param model
* @return
*/
@@ -4297,7 +4422,7 @@ public class PropertyController {
/**
* 楼栋查询接口
*
*
* @param model
* @return
*/
@@ -4342,7 +4467,7 @@ public class PropertyController {
/**
* 楼栋查询接口
*
*
* @param model
* @return
*/
@@ -4795,7 +4920,7 @@ public class PropertyController {
/**
* 房产交易记录查询
*
*
* @param model
* @return
*/
@@ -4855,7 +4980,7 @@ public class PropertyController {
/**
* 房产拍卖记录
*
*
* @param model
* @return
*/
@@ -4916,7 +5041,7 @@ public class PropertyController {
/**
* 房产近期评估次数
*
*
* @param model
* @return
*/
@@ -5412,6 +5537,36 @@ public class PropertyController {
}
}
public Object searchHouseLoudongAction(PropertyEvaluationModel model, HttpServletRequest request)throws NumberFormatException, IllegalAccessException {
RestfulModelAndView mav = new RestfulModelAndView();
mav.setViewType("rest");
if (StringUtils.isBlank(model.getId()) || StringUtils.isBlank(model.getHouseNumber()) || StringUtils.isBlank(model.getRoomNumber())){
mav.setModel(BasicModel.buildBadRequestModel("参数非法:楼盘编号,楼栋号,室为必填项"));
return mav;
}
List<HouseLoudong> houseLoudongs = houseLoudongService.findAll(model.getId(), model.getHouseNumber(), model.getUnitNumber(), model.getRoomNumber());
mav.setModel(BasicModel.buildOKModel().setResult(houseLoudongs));
return mav;
}
public Object searchLoudongAction(PropertyEvaluationModel model, HttpServletRequest request)throws NumberFormatException, IllegalAccessException {
RestfulModelAndView mav = new RestfulModelAndView();
mav.setViewType("rest");
if (StringUtils.isBlank(model.getId()) || StringUtils.isBlank(model.getHouseNumber())){
mav.setModel(BasicModel.buildBadRequestModel("参数非法:楼盘编号,楼栋号为必填项"));
return mav;
}
List<Loudong> loudongs = loudongService.findAll(model.getId(), model.getHouseNumber(), model.getUnitNumber());
mav.setModel(BasicModel.buildOKModel().setResult(loudongs));
return mav;
}
public void setHouseLoudongService(HouseLoudongService houseLoudongService) {
this.houseLoudongService = houseLoudongService;
@@ -5601,4 +5756,16 @@ public class PropertyController {
public void setRentDealPriceService(RentDealPriceService rentDealPriceService) {
this.rentDealPriceService = rentDealPriceService;
}
public void setCommunityPoiService(CommunityPoiService communityPoiService) {
this.communityPoiService = communityPoiService;
}
public void setEvaluateFactorService(EvaluateFactorService evaluateFactorService) {
this.evaluateFactorService = evaluateFactorService;
}
public void setCommunityBasePriceService(CommunityBasePriceService communityBasePriceService) {
this.communityBasePriceService = communityBasePriceService;
}
}
@@ -0,0 +1,36 @@
package com.fangjia.open.controllers;
import com.fangjia.core.util.AnalyticsUtil;
import com.fangjia.open.interceptors.Authority;
import com.fangjia.open.interceptors.Role;
import com.fangjia.open.model.BasicModel;
import com.fangjia.open.model.RestfulModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
public class requestController {
/**
* »ñÈ¡ÇëÇóµÄrequestºÍIPÐÅÏ¢
* @param request
* @return
*/
public Object requestAction(HttpServletRequest request) {
RestfulModelAndView mav = new RestfulModelAndView();
mav.setViewType("rest");
String ip = AnalyticsUtil.getIpAddress(request);
Map<String, String> map = new HashMap<String, String>();
Enumeration headerNames = request.getHeaderNames();
while (headerNames.hasMoreElements()) {
String key = (String) headerNames.nextElement();
String value = request.getHeader(key);
map.put(key, value);
}
map.put("ip", ip);
mav.setModel(BasicModel.buildOKModel().setResult(map));
return mav;
}
}
@@ -80,7 +80,7 @@ public class DistrictController {
// response.sendRedirect("/coming");
// return null;
// }
if("b".equals(login_user_type)){
if("b".equals(login_user_type) || "gb".equals(login_user_type)){
CacheUtils.putValue(CachePolicyEnum.LONG, UsersInfoService.class, weiXinId + "_city_"+ login_user_type , model.getCityName());
}
Long userId = Long.parseLong(CookieUtils.getCookieValue(request,"login_user_id"));
@@ -80,7 +80,19 @@ public class UserController {
} else {
weiXinId = CookieUtils.getCookieValue(request,"we_chat_open_id");
}
String cacheWeiXinId = CookieUtils.getCookieValue(request,"login_enterpriseuser_weixinid");
try {
if(StringUtils.isNotBlank(weiXinId) && StringUtils.isNotBlank(cacheWeiXinId)){
System.out.println("cookie weiXinId:"+weiXinId);
response.sendRedirect("reqCityChoicePage?type=b&code="+model.getCode());
}
} catch (IOException e) {
e.printStackTrace();
}
if(weiXinId == null && StringUtils.isNotBlank(model.getCode())) {//微信公众号渤海银行
System.out.println("bh OPEN_ID Ëæ»úÉú³É£º" + weiXinId);
weiXinId = DataConvertUtil.getRandomString2(16);
}
if(weiXinId != null && !weiXinId.equals("")){
@@ -115,33 +127,49 @@ public class UserController {
if(weiXinId != null && !weiXinId.equals("")){
CookieUtils.setCookie("we_chat_open_id", weiXinId, "/", 60 * 60 * 24 *7, response);
}
System.out.println("΢ÐÅOPEN_ID£º" + weiXinId);
System.out.println("reqCityChoicePage ΢ÐÅOPEN_ID£º" + weiXinId);
//企业用户入口查询企业账户开通的城市
if(type.equals("b")){
if(type.equals("b") || type.equals("gb")){
//Boolean isLogin = usersInfoService.checkEnterpriseWeiXinUserIsLogin(weiXinId);
String cacheWeiXinId = CookieUtils.getCookieValue(request,"login_enterpriseuser_weixinid");
if(cacheWeiXinId != null) {
Long userId = Long.parseLong(CookieUtils.getCookieValue(request,"login_user_id"));
String loginUserIdstr = CookieUtils.getCookieValue(request,"login_user_id");
if(cacheWeiXinId != null && StringUtils.isNotBlank(loginUserIdstr)) {
Long userId = Long.parseLong(loginUserIdstr);
CookieUtils.setCookie("login_user_id", userId + "", "/", 60 * 60 * 24 *7, response);
try {
FjtUsers users = fjtUsersService.findById(userId);
List<String> citys = userCityService.findSupportCityByUserId(userId);
if(citys == null || citys.isEmpty()){
citys = Arrays.asList("ÉϺ£");
}
if(users.getRole()==17 && type.equals("gb")){
CookieUtils.removeCookie(request, response, "login_enterpriseuser_weixinid");
response.sendRedirect("reqLoginPage");
}else if(users.getRole()==12 && type.equals("b")){
CookieUtils.removeCookie(request, response, "login_enterpriseuser_weixinid");
response.sendRedirect("bhydLoginPage?code="+model.getCode());
}else{
List<String> citys = userCityService.findSupportCityByUserId(userId);
if(citys == null || citys.isEmpty()){
citys = Arrays.asList("ÉϺ£");
}
// if(users!=null && users.getRole() == 12){
// citys = Arrays.asList("上海");
// }else{
// citys = userCityService.findSupportCityByUserId(userId);
// }
model.setCitys(citys);
model.setCitys(citys);
}
} catch (Exception e) {
model.setCitys(new ArrayList<String>());
}
} else {
CookieUtils.removeCookie(request, response, "login_enterpriseuser_weixinid");
try {
response.sendRedirect("reqLoginPage");
// if(type.equals("bh")){
// response.sendRedirect("bhydLoginPage?code="+model.getCode());
// }else{
response.sendRedirect("reqLoginPage");
// }
} catch (IOException e) {
}
}
@@ -173,6 +201,20 @@ public class UserController {
} catch (Exception e) {
}
}
public Object bhloginOutAction(UserModel model,HttpServletRequest request, HttpServletResponse response, String city) {
try {
CookieUtils.removeCookie(request, response,"login_user_id");
CookieUtils.removeCookie(request, response,"login_user_type");
CookieUtils.removeCookie(request, response,"login_enterpriseuser_weixinid");
response.sendRedirect("bhydLoginPage?code=bhydcode");
} catch (Exception e) {
e.printStackTrace();
}
return model;
}
public Object aboutAction(UserModel model) {
return model;
@@ -285,7 +327,7 @@ public class UserController {
return resultModel;
}
CookieUtils.setCookie("login_user_id", user.getId() + "", "/", 60 * 60 * 24 *7, response);
CookieUtils.setCookie("login_user_type", "b", "/", 60 * 60 * 24 *7, response);
CookieUtils.setCookie("login_user_type", "gb", "/", 60 * 60 * 24 *7, response);
CookieUtils.setCookie("login_enterpriseuser_weixinid", weiXinId, "/", 60 * 60 * 24 *7, response);
//CacheUtils.putValue(CachePolicyEnum.LONG, UsersInfoService.class, weiXinId + "_" + Message.SMS_CODE_TYPE_ENTER_LOGIN , user.getId());
resultModel.setResult(Message.RESULT_SUCCESS);
@@ -1,29 +1,5 @@
package com.fangjia.open.controllers.weixin;
import java.io.IOException;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.fangjia.dal.sql.model.*;
import com.fangjia.open.util.BHBankUtils;
import com.fangjia.open.util.InsidePolygon2;
import com.fangjia.service.mongo.fangjia.PriceBorderService;
import com.fangjia.service.sql.*;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.tools.ant.util.DateUtils;
import org.sothis.core.util.Pager;
import org.sothis.web.mvc.annotation.Param;
import com.fangjia.core.util.DataUtil;
import com.fangjia.core.util.DateUtil;
import com.fangjia.dal.common.DistrictKey;
@@ -33,11 +9,12 @@ 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.*;
import com.fangjia.open.compatible.model.JsonModel;
import com.fangjia.open.model.BasicModel;
import com.fangjia.open.model.RestfulModelAndView;
import com.fangjia.open.model.weixin.EvaluationModel;
import com.fangjia.open.util.InsidePolygon;
import com.fangjia.open.util.Point;
import com.fangjia.open.util.*;
import com.fangjia.service.bo.DistrictStatBo;
import com.fangjia.service.bo.HouseBo;
import com.fangjia.service.datastore.DistrictService;
@@ -50,14 +27,34 @@ import com.fangjia.service.email.EmailService;
import com.fangjia.service.email.Mail;
import com.fangjia.service.email.MailUser;
import com.fangjia.service.mongo.bkoff.DistrictHouseStatService;
import com.fangjia.service.mongo.fangjia.AverageStatisticsService;
import com.fangjia.service.mongo.fangjia.DealPriceService;
import com.fangjia.service.mongo.fangjia.LatlngPolygonService;
import com.fangjia.service.mongo.fangjia.*;
import com.fangjia.service.sms.SmsException;
import com.fangjia.service.sms.SmsService;
import com.fangjia.service.sql.*;
import com.fangjia.service.user.UsersInfoService;
import com.fangjia.service.util.CookieUtils;
import com.google.common.collect.ImmutableMap;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.tools.ant.util.DateUtils;
import org.bson.types.ObjectId;
import org.sothis.core.util.Pager;
import org.sothis.web.mvc.ActionContext;
import org.sothis.web.mvc.annotation.Param;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URL;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* Created by wenyan on 2016/7/15.
@@ -100,11 +97,17 @@ public class WeiXinEvaluationController {
private GoldLogsService goldLogsService;
private PriceBorderService priceBorderService;
private BohaiEvaluationAuditService bohaiEvaluationAuditService;
private FormalReportService formalReportService;
private FileService fileService;
private ReportFileAttachService reportFileAttachService;
private final static String DD_ID = "5938c43984aec20a36f474c5";
private static List<String> MOBILES = new ArrayList<String>();
private static long MAX_FILE_BYTES_SIZE = 1024 * 1024 * 5;
private FileDao fileDao = FileDao.getInstance();
static {
MOBILES.add("13916992399");
MOBILES.add("15201904147");
@@ -214,6 +217,7 @@ public class WeiXinEvaluationController {
Pager pager = new Pager(10);
pager.setCurrentPage(NumberUtils.toInt(page));
List<FjtEvaluation> fjtEvaluationList = fjtEvaluationService.findEvaluationsByUserId(userId, pager);
System.out.println("估价记录:"+fjtEvaluationList.size());
JSONArray ja = new JSONArray();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd");
for (int i = 0; i < fjtEvaluationList.size(); ++i) {
@@ -246,7 +250,9 @@ public class WeiXinEvaluationController {
jsonObject.put("shzt", "价格待审核");
//接入询价结果查询接口
System.out.println("开始接入询价结果查询接口......"+evaluationAudit.getQueryId());
JSONObject obj = BHBankUtils.getInquireRecord(evaluationAudit.getQueryId());
System.out.println("接入询价结果查询接口完成......"+evaluationAudit.getQueryId());
if(obj!=null){
Integer totalPrice = (Integer) obj.get("inquirePrice");
if(totalPrice>0){
@@ -259,11 +265,17 @@ public class WeiXinEvaluationController {
}
} else if (evaluationAudit!=null && evaluationAudit.getAuditStatus()==1) {
jsonObject.put("shzt", "价格已审核");
FormalReport report = formalReportService.findFormalReportById(evaluationAudit.getEvaluationId());
if(report != null){
jsonObject.put("shzt", "已申请正式报告");
}
} else if (evaluationAudit!=null && evaluationAudit.getAuditStatus()==2) {
jsonObject.put("shzt", "价格待审核");
if(evaluationAudit.getHopePrice()>0){
//接入反馈结果查询接口
System.out.println("开始接入反馈结果查询接口......"+evaluationAudit.getFeedbackId());
JSONObject object = BHBankUtils.inquireFeedbackCall(evaluationAudit.getFeedbackId());
System.out.println("完成接入反馈结果查询接口......"+evaluationAudit.getFeedbackId());
if(object!=null){
Integer feedbackStatus = (Integer) object.get("feedbackStatus");
if(feedbackStatus!=0){
@@ -280,6 +292,11 @@ public class WeiXinEvaluationController {
}
}else if (evaluationAudit!=null && evaluationAudit.getAuditStatus()==3) {
jsonObject.put("shzt", "审核完成");
FormalReport report = formalReportService.findFormalReportById(evaluationAudit.getEvaluationId());
if(report != null){
jsonObject.put("shzt", "已申请正式报告");
}
}else{
jsonObject.put("shzt", "-");
}
@@ -431,16 +448,38 @@ public class WeiXinEvaluationController {
evaluation.setAveragePrice((int)(totalPrice/evaluation.getHouseArea()));
}
fjtEvaluationService.saveEvaluation(evaluation);
if(fjtUser!=null && fjtUser.getRole()==17) {
System.out.println("渤海地址搜索 "+evaluation.getAddress());
List<JSONObject> bhDists = BHBankUtils.getDistrictByBhbank(evaluation.getAddress());
if(bhDists.size()<1){
JSONObject o = null;
if(bhDists.size()==0){
bhDists = BHBankUtils.getDistrictByBhbank(district.getName());
}
Map<String, String> bhMatchMap = new HashMap<String, String>();
if(bhDists.size()==1){
JSONObject o = bhDists.get(0);
o = bhDists.get(0);
}else if(bhDists.size()>1){
int mod = Integer.MAX_VALUE;
for(JSONObject jo : bhDists){
int bhprice = 0;
if (jo.get("price") == null || jo.get("price").equals("null")) {
bhprice = 0;
} else {
double price = Double.valueOf((String)jo.get("price"));
bhprice = (int)price;
}
int bhmod = Math.abs(bhprice - avgPrice);
if(bhmod<mod){
mod = bhmod;
o = jo;
}
}
}
Map<String, String> bhMatchMap = new HashMap<String, String>();
if(o != null){
String bhDistName = (String)o.get("name");
String regionCode = String.valueOf((Long)o.get("country"));
String bhRegion = BHBankUtils.regionCodeMap.get(regionCode);
@@ -466,8 +505,10 @@ public class WeiXinEvaluationController {
if(StringUtils.isBlank(usersDetail.getMobile())){
usersDetail.setMobile(fjtUser.getEmail());
}
System.out.println("渤海询价搜索 "+evaluation.getAddress());
JSONObject bhApiResult = BHBankUtils.getInquirePrice(model, bhMatchMap, usersDetail, evaluation.getTotalPrice());
if(bhApiResult!=null){
System.out.println("渤海询价搜索结果 "+bhApiResult.toString());
JSONObject dataObj = (JSONObject) bhApiResult.get("data");
String queryId = (String) dataObj.get("queryId");
Integer inquirePrice = (Integer) dataObj.get("inquirePrice");
@@ -479,6 +520,9 @@ public class WeiXinEvaluationController {
auditStatus = 1;
}
fjtEvaluationService.saveEvaluation(evaluation);
System.out.println("保存评估记录成功 "+evaluation.getDistrictName());
BohaiEvaluationAudit audit = new BohaiEvaluationAudit();
audit.setEvaluationId(evaluation.getId());
audit.setQueryId(queryId);
@@ -493,6 +537,9 @@ public class WeiXinEvaluationController {
audit.setDateCreated(new Date());
bohaiEvaluationAuditService.saveBohaiEvaluationAudit(audit);
}
}else{
fjtEvaluationService.saveEvaluation(evaluation);
System.out.println("保存评估记录成功 "+evaluation.getDistrictName());
}
Map<String, String> data = new HashMap<String, String>();
@@ -603,7 +650,24 @@ public class WeiXinEvaluationController {
BohaiEvaluationAudit bohaiEvaluationAudit = bohaiEvaluationAuditService.findByBohaiEvaluationAuditId(Long.valueOf(evaluationId));
model.setBohaiEvaluationAudit(bohaiEvaluationAudit);
if(bohaiEvaluationAudit != null){
List<ReportFileAttach> reportFiles = reportFileAttachService.findAllByParams(Integer.valueOf(evaluationId), bohaiEvaluationAudit.getQueryId(), (int)fjtUser.getId());
if(reportFiles != null && reportFiles.size()>0){
Map<String, List<ReportFileAttach>> reportFileMap = new HashMap<String, List<ReportFileAttach>>();
for(ReportFileAttach rfa : reportFiles){
List<ReportFileAttach> list = reportFileMap.get(rfa.getFileClass().toString());
if(list == null){
list = new ArrayList<ReportFileAttach>();
reportFileMap.put(rfa.getFileClass().toString(), list);
}
list.add(rfa);
}
model.setReportFileMap(reportFileMap);
}
}
UserTrades userTrade = userTradesService.findUserTradesByEvaluationId(model.getEvaluationId());
model.setUserTrades(userTrade);
if(fjtUser!=null && fjtUser.getRole()==17 && district.getCity().equals("上海")){
Map<String, Object> retMap = getLoanInfo(district, evaluation.getHouseArea());
@@ -940,13 +1004,14 @@ public class WeiXinEvaluationController {
if(StringUtils.isNotBlank(model.getEvaluationId()) && StringUtils.isNotBlank(model.getEmail())){
UserTrades userTrade = userTradesService.findUserTradesByEvaluationId(model.getEvaluationId());
FjtEvaluation evaluation = fjtEvaluationService.findEvaluationById(Long.valueOf(model.getEvaluationId()));
if(userTrade != null){
userTrade.setSend(1);
userTrade.setSendEmail(model.getEmail());
userTradesService.update(userTrade);
}else{
FjtEvaluation evaluation = fjtEvaluationService.findEvaluationById(Long.valueOf(model.getEvaluationId()));
userTrade = new UserTrades();
userTrade.setUserId(evaluation.getUserId());
userTrade.setCity(evaluation.getCity());
@@ -966,23 +1031,90 @@ public class WeiXinEvaluationController {
String reporNum = "147698"+ String.valueOf(evaluation.getId());
evaluation.setReportNum(reporNum);
evaluation.setDownPdfDate(new Date());
fjtEvaluationService.updateEvaluation(evaluation);
try {
String smsContent = "【房价网】微信询价报告发送 用户邮箱:"+model.getEmail();
smsService.sendDingMsgByRobot(DD_ID, smsContent);
} catch (SmsException e) {
e.printStackTrace();
}
}
sendToEmail(model.getFjtUrlKey(), model.getEvaluationId(), model.getEmail());
FjtUsers users = fjtUsersService.findById(evaluation.getUserId());
if(users!=null && users.getRole()==17){
String converFileName = DateUtils.format(new Date(), "yyyy-MM-dd") +"_"+evaluation.getReportNum()+".pdf";
String url = model.getFjtUrlKey() + "/evaluation/exportPdf?evaluationId="+model.getEvaluationId()+"&bkoffDownload=true&userId="+users.getId();
String fontUrl = ActionContext.getContext().getServletContext().getRealPath("/") + "files" + File.separator + model.getEvaluationId() + File.separator;
System.out.println(fontUrl);
try {
createFile(fontUrl+converFileName);
download(url, fontUrl, converFileName);
List<File> uploadfiles = new ArrayList<File>();
uploadfiles.add(new File(fontUrl+converFileName));
if(uploadfiles.size()>0){
BohaiEvaluationAudit boAudit = bohaiEvaluationAuditService.findByBohaiEvaluationAuditId(evaluation.getId());
if(boAudit != null){
UsersDetail usersDetail = usersDetailService.findById(users.getId());
BHBankUtils.inquireUploadFiles2(usersDetail.getName(),boAudit.getQueryId(), 1, uploadfiles);
}
}
} catch (IOException e) {
//处理异常信息
System.out.println(e.getMessage());
}
}
}
return jsonMmodel;
}
public Object sendFormalReportApplyAction(EvaluationModel model) {
JsonModel jsonModel = new JsonModel();
if (StringUtils.isNotBlank(model.getEvaluationId()) && StringUtils.isNotBlank(model.getAddress())) {
BohaiEvaluationAudit bohaiEvaluationAudit = bohaiEvaluationAuditService.findByBohaiEvaluationAuditId(Long.valueOf(model.getEvaluationId()));
if(bohaiEvaluationAudit!=null){
FormalReport formalReport = formalReportService.findFormalReportById(Long.valueOf(model.getEvaluationId()));
if(formalReport == null){
formalReport = new FormalReport();
formalReport.setEvaluationId(Long.valueOf(model.getEvaluationId()));
formalReport.setQueryId(bohaiEvaluationAudit.getQueryId());
formalReport.setUserId(bohaiEvaluationAudit.getUserId());
formalReport.setAddress(model.getAddress());
formalReport.setDateCreated(new Date());
formalReportService.save(formalReport);
// UsersDetail usersDetail = usersDetailService.findById(bohaiEvaluationAudit.getUserId());
}else{
if(!model.getAddress().equals(formalReport.getAddress())){
formalReport.setAddress(model.getAddress());
formalReportService.update(formalReport);
}
}
Integer code = BHBankUtils.inquireToReport(bohaiEvaluationAudit.getQueryId(), model.getAddress());
Map<String, Integer> data = new HashMap<String, Integer>();
data.put("code", code);
jsonModel.setJsonModel(data);
}
}
return jsonModel;
}
public Object checkImageAction(EvaluationModel model){
JsonModel jsonModel = new JsonModel();
if (StringUtils.isNotBlank(model.getEvaluationId())){
List<ReportFileAttach> datas = reportFileAttachService.findHouseImage(Integer.valueOf(model.getEvaluationId()), 3);
Map<String, Integer> data = new HashMap<String, Integer>();
data.put("count", datas.size());
jsonModel.setJsonModel(data);
}
return jsonModel;
}
private void sendToEmail(String fjtUrl, String evaluationId, String email){
try {
@@ -1130,6 +1262,232 @@ public class WeiXinEvaluationController {
}
public Object upLoadEvaluationFileAction(EvaluationModel model, HttpServletRequest request){
RestfulModelAndView mav = new RestfulModelAndView();
List<CommonsMultipartFile> files = model.getReportFiles();
if(files == null || files.size()<=1){
mav.setModel(BasicModel.buildBadRequestModel("请选择要上传的文件"));
return mav;
}
if(model.getEvaluationId()==null || model.getQueryId()==null){
mav.setModel(BasicModel.buildBadRequestModel("评估编号或查询编号为空"));
return mav;
}
if(model.getFileClass()==3 && files.size()<7){
mav.setModel(BasicModel.buildBadRequestModel("上传图片不能少于6张"));
return mav;
}
String cookieUserId = CookieUtils.getCookieValue(request, "login_user_id");
long userId = Long.valueOf(cookieUserId);
FjtUsers fjtUser = fjtUsersService.findById(Long.valueOf(userId));
UsersDetail usersDetail = usersDetailService.findById(fjtUser.getId());
try {
String id = new ObjectId().toString();
List<File> uploadfiles = new ArrayList<File>();
for (CommonsMultipartFile file : files) {
if (file.getSize() == 0 ) {
continue;
}
String contentType = file.getContentType();//getPicContentType(file);
if (StringUtils.isBlank(contentType)) {
continue;
}
ReportFileAttach reportFileAttach = reportFileAttachService.findFirstByParams(Integer.valueOf(model.getEvaluationId()), model.getQueryId(), (int)fjtUser.getId(), model.getFileClass(), file.getOriginalFilename());
if(reportFileAttach != null){
continue;
}
String converFileName = new String(file.getOriginalFilename().getBytes(), "UTF-8");
String fontUrl = ActionContext.getContext().getServletContext().getRealPath("/") + "files" + File.separator + model.getEvaluationId() + File.separator+converFileName;
System.out.println(fontUrl);
createFile(fontUrl);
File tempFile = new File(fontUrl);
try {
tempFile.createNewFile();
} catch (IOException e) {
//处理异常信息
}
try {
inputStreamToFile(file.getInputStream(), tempFile);
uploadfiles.add(tempFile);
} catch (IOException e) {
//处理异常信息
}
reportFileAttach = new ReportFileAttach();
reportFileAttach.setEvaluationId(Integer.valueOf(model.getEvaluationId()));
reportFileAttach.setQueryId(model.getQueryId());
reportFileAttach.setUserId((int)fjtUser.getId());
reportFileAttach.setFileClass(model.getFileClass());
reportFileAttach.setFileName(file.getOriginalFilename());
reportFileAttach.setFileId(id);
reportFileAttachService.save(reportFileAttach);
fileDao.save(id,"upload","o", file.getBytes(), contentType);
String href = DataUtil.encodePicUrl(id, "o", "upload");
String link = "http://static.fangjia.com/stc/fs/"+href;
System.out.println(link);
}
if(uploadfiles.size()>0){
BHBankUtils.inquireUploadFiles2(usersDetail.getName(),model.getQueryId(), model.getFileClass(), uploadfiles);
}
} catch (Exception e) {
e.printStackTrace();
mav.setModel(BasicModel.buildServerErrorModel().setMsg("文件上传失败!"));
}
return mav;
}
private void createFile(String path) throws IOException {
if (StringUtils.isNotEmpty(path)) {
File file = new File(path);
if (!file.getParentFile().exists()) {
file.getParentFile().mkdirs();
}
file.createNewFile();
}
}
public static void download(String url, String saveDir, String fileName) {
BufferedOutputStream bos = null;
InputStream is = null;
try {
byte[] buff = new byte[8192];
is = new URL(url).openStream();
File file = new File(saveDir, fileName);
file.getParentFile().mkdirs();
bos = new BufferedOutputStream(new FileOutputStream(file));
int count = 0;
while ( (count = is.read(buff)) != -1) {
bos.write(buff, 0, count);
}
}
catch (IOException e) {
e.printStackTrace();
}
finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
if (bos != null) {
try {
bos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
//将InputStream类型转化为File类型
private static void inputStreamToFile(InputStream ins, File file) {
//将输出流转化为文件即可
FileOutputStream os = null;
try {
os = new FileOutputStream(file);
int bytesRead = 0;
byte[] buffer = new byte[1024];
while ((bytesRead = ins.read(buffer)) != -1) {
os.write(buffer, 0, bytesRead);
}
} catch (Exception e) {
throw new RuntimeException("调用inputStreamToFile产生异常:" + e.getMessage());
} finally {
try {
if (os != null) {
os.close();
}
if (ins != null) {
ins.close();
}
} catch (IOException e) {
throw new RuntimeException("inputStreamToFile关闭io时产生异常:" + e.getMessage());
}
}
}
/**
* 保存图片到FS
*/
private List<String> savePics(String districtId, List<File> pics) {
List<String> ret = new ArrayList<String>(pics.size());
for (File pic : pics) {
if (pic.length() == 0 || pic.length() > MAX_FILE_BYTES_SIZE) {
continue;
}
String contentType = getPicContentType(pic);
if (StringUtils.isBlank(contentType)) {
continue;
}
String picName = districtId + "/" + pic.getName();
try {
fileService.save(picName, FileServiceImpl.SIZE_ORIGINAL, IOUtils.toByteArray(new FileInputStream(pic)),
contentType);
fileService.save(picName, FileServiceImpl.SIZE_SUMMERY, IOUtils.toByteArray(new FileInputStream(pic)),
contentType);
fileService.save(picName, FileServiceImpl.SIZE_MEDIUM, IOUtils.toByteArray(new FileInputStream(pic)),
contentType);
} catch (IOException e) {
e.printStackTrace();
}
ret.add(picName);
}
return ret;
}
/**
* 验证图片文件类型,目前支持gif、jpg
*
* @param pic
* @return
*/
private String getPicContentType(File pic) {
byte[] b = new byte[4];
FileInputStream is = null;
try {
is = new FileInputStream(pic);
is.read(b, 0, b.length);
} catch (IOException e) {
e.printStackTrace();
} finally {
if (null != is) {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
String type = DataUtil.byte2hex(b).toUpperCase();
if (type.contains("FFD8FF") || type.contains("89504E47")) {
return "image/jpeg";
}
if (type.contains("47494638")) {
return "image/gif";
}
if (type.contains("424D")) {
return "image/bmp";
}
return null;
}
public void setFjtEvaluationService(FjtEvaluationService fjtEvaluationService) {
this.fjtEvaluationService = fjtEvaluationService;
@@ -1215,4 +1573,16 @@ public class WeiXinEvaluationController {
public void setBohaiEvaluationAuditService(BohaiEvaluationAuditService bohaiEvaluationAuditService) {
this.bohaiEvaluationAuditService = bohaiEvaluationAuditService;
}
public void setFileService(FileService fileService) {
this.fileService = fileService;
}
public void setReportFileAttachService(ReportFileAttachService reportFileAttachService) {
this.reportFileAttachService = reportFileAttachService;
}
public void setFormalReportService(FormalReportService formalReportService) {
this.formalReportService = formalReportService;
}
}
@@ -99,6 +99,7 @@ public class DistrictInfoDto {
private String salesPhoneNumber;
private Integer buildingCount;
private Integer finishYear;
private String township;
public String getDistrict() {
@@ -818,4 +819,12 @@ public class DistrictInfoDto {
public void setFinishYear(Integer finishYear) {
this.finishYear = finishYear;
}
public String getTownship() {
return township;
}
public void setTownship(String township) {
this.township = township;
}
}
@@ -75,8 +75,8 @@ public class AnalyticsFilter implements Filter {
if ("1".equals(request.getParameter("__refresh_cache"))) {
threadLocalData.put(ThreadLocalKey.DisableCache, "1");
}
createUID(request, response);
createSID(request, response);
//createUID(request, response);
//createSID(request, response);
response.addHeader("Access-Control-Allow-Origin", "*");
response.addHeader("Access-Control-Allow-Methods", "*");
chain.doFilter(request, response);
@@ -8,6 +8,7 @@ public class AuctionModel extends FangjiaApiModel{
private String city;
private String district;
private String address;
private String name;
private Date minStartTime;
private Date maxStartTime;
private Integer minStartPrice;
@@ -17,6 +18,7 @@ public class AuctionModel extends FangjiaApiModel{
private Integer propertyType;
private Integer status;
private Integer limit = 10;
private String startDate;
public String getId() {
return id;
@@ -121,4 +123,20 @@ public class AuctionModel extends FangjiaApiModel{
public void setStatus(Integer status) {
this.status = status;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
}
@@ -1,6 +1,9 @@
package com.fangjia.open.model;
import java.util.Date;
public class DealPriceModel extends FangjiaApiModel{
private String id;
private String city;
@@ -34,9 +37,13 @@ public class DealPriceModel extends FangjiaApiModel{
private Double size;
private Integer max;
private Integer limit = 10;
private String decoration;
private boolean convert;
private String startDate;
private String endDate;
public String getCity() {
@@ -198,4 +205,36 @@ public class DealPriceModel extends FangjiaApiModel{
public void setConvert(boolean convert) {
this.convert = convert;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public Integer getLimit() {
return limit;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
}
@@ -246,6 +246,42 @@ public class EvaluationModel extends FangjiaApiModel {
private Date buildDate;
private String sid;//微信小程序中的sid
private String code;//微信小程序中的code
private String id;
private String startDate;
private String endDate;
private Integer limit = 10;
public Integer getLimit() {
return limit;
}
public void setLimit(Integer limit) {
this.limit = limit;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getStartDate() {
return startDate;
}
public void setStartDate(String startDate) {
this.startDate = startDate;
}
public String getEndDate() {
return endDate;
}
public void setEndDate(String endDate) {
this.endDate = endDate;
}
public String getRegion() {
return region;
@@ -4,6 +4,7 @@ import com.fangjia.service.datastore.bean.HouseQueryBean;
import com.fangjia.service.query.QueryBean;
public class HouseSearchModel extends SearchModel {
private String id;
private String kind;
private String estateType;
private String buildingType;
@@ -116,7 +117,12 @@ public class HouseSearchModel extends SearchModel {
public void setShowDetail(Boolean showDetail) {
this.showDetail = showDetail;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}
@@ -46,7 +46,12 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
* Â¥ºÅ
*/
private String unitNumber;
/**
* ÐÂÂ¥ºÅ
*/
private String houseNumber;
private String id;
/**
* ÊÒºÅ
*/
@@ -905,4 +910,20 @@ public class PropertyEvaluationModel extends FangjiaApiModel {
public void setAvgPrice(Integer avgPrice) {
this.avgPrice = avgPrice;
}
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;
}
}
@@ -16,6 +16,8 @@ public abstract class SearchModel extends FangjiaApiModel {
protected Integer totalPriceEnd;
protected Integer avgPriceStart;
protected Integer avgPriceEnd;
protected Integer startTime;
protected Integer endTime;
protected Integer areaStart;
protected Integer areaEnd;
protected Integer room;
@@ -46,6 +48,7 @@ public abstract class SearchModel extends FangjiaApiModel {
private Double area;
protected Integer dataPeriod;//查询天数
private Integer distCount;
/**
* 获取房源数量类型 sell:只取得二手房数量 rent:只取得出租房数量 其他:不获取数量
@@ -358,4 +361,28 @@ public abstract class SearchModel extends FangjiaApiModel {
public void setTotalPrice(Integer totalPrice) {
this.totalPrice = totalPrice;
}
public Integer getStartTime() {
return startTime;
}
public void setStartTime(Integer startTime) {
this.startTime = startTime;
}
public Integer getEndTime() {
return endTime;
}
public void setEndTime(Integer endTime) {
this.endTime = endTime;
}
public Integer getDistCount() {
return (null != distCount && 0 != distCount) ? distCount : 20;
}
public void setDistCount(Integer distCount) {
this.distCount = distCount;
}
}
@@ -1,15 +1,16 @@
package com.fangjia.open.model.weixin;
import com.fangjia.dal.mongo.model.Evaluation;
import java.io.File;
import java.util.List;
import java.util.Map;
import com.fangjia.dal.seaweed.model.District;
import com.fangjia.dal.sql.model.BohaiEvaluationAudit;
import com.fangjia.dal.sql.model.EvaluationAudit;
import com.fangjia.dal.sql.model.FjtEvaluation;
import com.fangjia.dal.sql.model.*;
import com.fangjia.open.model.BaseModel;
import com.fangjia.service.bo.DistrictStatBo;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
/**
@@ -48,6 +49,13 @@ public class EvaluationModel extends BaseModel{
// private String preName;//眾漆諉諳--瞼攫靡備
// private String countryCode;//眾漆諉諳--Е郖晤鎢
// private String buildName;//眾漆諉諳--華硊
private List<CommonsMultipartFile> reportFiles;
private String queryId;
private Integer fileClass;
private Map<String, List<ReportFileAttach>> reportFileMap;
private UserTrades userTrades;
private String address;
public void setId(String id) {
@@ -260,4 +268,53 @@ public class EvaluationModel extends BaseModel{
// public void setBuildName(String buildName) {
// this.buildName = buildName;
// }
public List<CommonsMultipartFile> getReportFiles() {
return reportFiles;
}
public void setReportFiles(List<CommonsMultipartFile> reportFiles) {
this.reportFiles = reportFiles;
}
public String getQueryId() {
return queryId;
}
public void setQueryId(String queryId) {
this.queryId = queryId;
}
public Integer getFileClass() {
return fileClass;
}
public void setFileClass(Integer fileClass) {
this.fileClass = fileClass;
}
public Map<String, List<ReportFileAttach>> getReportFileMap() {
return reportFileMap;
}
public void setReportFileMap(Map<String, List<ReportFileAttach>> reportFileMap) {
this.reportFileMap = reportFileMap;
}
public UserTrades getUserTrades() {
return userTrades;
}
public void setUserTrades(UserTrades userTrades) {
this.userTrades = userTrades;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
}
@@ -7,8 +7,10 @@ import com.fangjia.dal.sql.model.UsersDetail;
import com.fangjia.open.model.weixin.EvaluationModel;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import okhttp3.*;
import org.apache.commons.lang.StringUtils;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.*;
@@ -16,11 +18,14 @@ import java.util.*;
public class BHBankUtils {
// public static String token = "bohaifangjiatest";//²âÊÔtoken
public static String token = "bohaifangjia";//Õýʽtoken
public static String nonce = "818975";
// public static String uri = "http://topen.shbrea.com.cn/API";//²âÊÔ
public static String token = "bohaifangjia";//正式token
public static String uri ="https://open.shbrea.com.cn/API";
public static String nonce = "818975";
public static Map<String, String > regionCodeMap = new HashMap<String, String>(){{
put("310101000000","»ÆÆÖ");
put("310104000000","Ðì»ã");
@@ -41,8 +46,11 @@ public class BHBankUtils {
}};
public static List<JSONObject> getDistrictByBhbank(String address){
List<JSONObject> list = new ArrayList<JSONObject>();
try {
// Thread.sleep(20*1000);
Map params = new HashMap();
params.put("keyword",address);
@@ -56,8 +64,8 @@ public class BHBankUtils {
headers.put("nonce", nonce.toString());
HttpRequest request = new HttpRequest();
String content = null;
try {
content = request.get(uri +"/searchAddr/bh/", params, headers, "utf-8");
System.out.println("/searchAddr/bh/ :"+content);
if(StringUtils.isNotBlank(content)){
JSONObject jsonObj = JSONObject.fromObject(content);
JSONArray data = (JSONArray) jsonObj.get("data");
@@ -99,8 +107,8 @@ public class BHBankUtils {
if(StringUtils.isNotBlank(ev.getAddress())){
params.put("buildName", ev.getAddress());
}
if(StringUtils.isNotBlank(ev.getUnitNum())){
params.put("unitCode", ev.getUnitNum());
if(StringUtils.isNotBlank(ev.getHouseNum())){
params.put("unitCode", ev.getHouseNum());// 渤海认为的单元号是楼栋号
}
if(ev.getHouseFloor()>0){
params.put("floor", String.valueOf(ev.getHouseFloor()));
@@ -112,8 +120,19 @@ public class BHBankUtils {
params.put("houseNo",ev.getRoomNum());
}
if(ev.getHouseArea()>0){
params.put("groundArea", String.valueOf(ev.getHouseArea()));
if(ev.getBasementArea()!=null && ev.getBasementArea()>0){
double area = ev.getHouseArea() - ev.getBasementArea();
if(area>0){
params.put("groundArea", String.valueOf(area));
}
}else{
params.put("groundArea", String.valueOf(ev.getHouseArea()));
}
}
if(ev.getBasementArea()!=null && ev.getBasementArea()>0){
params.put("undergroundArea", String.valueOf(ev.getBasementArea()));
}
params.put("orientName", "ÄÏ");
params.put("buildYear", ev.getFinishDateStr());
fjwTotalPrice= (int)(fjwTotalPrice/10000) * 10000;
@@ -180,6 +199,7 @@ public class BHBankUtils {
String content = null;
try {
content = request.get(uri + "/inquireRecord/bh/", params, headers, "utf-8");
System.out.println("/inquireRecord/bh/ "+content);
if(StringUtils.isNotBlank(content)){
JSONObject jsonObj = JSONObject.fromObject(content);
JSONObject data = (JSONObject) jsonObj.get("data");
@@ -265,6 +285,7 @@ public class BHBankUtils {
String content = null;
try {
content = request.get(uri+"/inquireFeedbackCall/bh/", params, headers, "utf-8");
System.out.println("/inquireFeedbackCall/bh/:"+content);
if(StringUtils.isNotBlank(content)){
JSONObject jsonObj = JSONObject.fromObject(content);
Integer code = (Integer) jsonObj.get("errCode");
@@ -279,4 +300,193 @@ public class BHBankUtils {
}
return null;
}
public static void inquireUploadFiles(String name, String queryId, Integer fileClass){
String feedbackId = null;
List<JSONObject> list = new ArrayList<JSONObject>();
Map params = new HashMap();
params.put("queryId",queryId);
params.put("userName",name);
params.put("fileClass", fileClass.toString());
List<String> lists = Arrays.asList("queryId", "userName", "fileClass");
String s = "";
for(String key : lists){
String value = (String)params.get(key);
if(StringUtils.isNotBlank(value)){
s = s + value;
}
}
String s1 = null;
try {
s1 = URLEncoder.encode(s,"utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
// params.put("file", new File("d:/a.jpg") );
Integer date1 = (int)(new Date().getTime()/1000);
String str = token + date1.toString()+nonce+ s1;
String md5str2 = MD5Util.encrypt(str,"utf-8");
Map headers = new HashMap();
headers.put("timestamp", date1.toString());
headers.put("sign", md5str2);
headers.put("nonce", nonce.toString());
HttpRequest request = new HttpRequest();
String content = null;
try {
content = request.post(uri+"/inquireUploadFiles/bh/", params, headers, "utf-8");
if(StringUtils.isNotBlank(content)){
JSONObject jsonObj = JSONObject.fromObject(content);
System.out.println(jsonObj.toString());
}
}catch (Exception e){
e.printStackTrace();
}
}
public static Integer inquireUploadFiles2(String name, String queryId, Integer fileClass , List<File> uploadfiles){
Map params = new HashMap();
params.put("queryId",queryId);
params.put("userName",name);
params.put("fileClass", fileClass.toString());
List<String> lists = Arrays.asList("queryId", "userName", "fileClass");
String s = "";
for(String key : lists){
String value = (String)params.get(key);
if(StringUtils.isNotBlank(value)){
s = s + value;
}
}
String s1 = null;
try {
s1 = URLEncoder.encode(s,"utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
Integer date1 = (int)(new Date().getTime()/1000);
String str = token + date1.toString()+nonce+ s1;
String md5str2 = MD5Util.encrypt(str,"utf-8");
Map headers = new HashMap();
headers.put("timestamp", date1.toString());
headers.put("sign", md5str2);
headers.put("nonce", nonce.toString());
String url = uri+"/inquireUploadFiles/bh/";
try{
// HttpResponse<String> response= Unirest.post(url).header("sign",md5str2)
// .header("timestamp",date1.toString())
// .header("nonce",nonce.toString())
// .field("queryId",queryId)
// .field("fileClass",fileClass.toString())
// .field("file", new File("d:\\a.jpg"))
// .field("userName",name).asString();
// MultipartBody responseBody = Unirest.post(url).header("sign",md5str2)
// .header("timestamp",date1.toString())
// .header("nonce",nonce.toString())
// .field("queryId",queryId)
// .field("fileClass",fileClass.toString())
// .field("userName",name);
//
// for(File file : uploadfiles){
// responseBody.field("file", file);
// }
// HttpResponse<String> response = responseBody.asString();
OkHttpClient client = new OkHttpClient().newBuilder().build();
MultipartBody.Builder builder = new MultipartBody.Builder().setType(MultipartBody.FORM)
.addFormDataPart("queryId",queryId)
.addFormDataPart("fileClass",fileClass.toString())
.addFormDataPart("userName",name);
for(File file : uploadfiles){
builder.addFormDataPart("file",file.getPath(), RequestBody.create(MediaType.parse("application/octet-stream"), file));
}
RequestBody body = builder.build();
Request request = new Request.Builder().url(url).method("POST",body)
.addHeader("sign",md5str2)
.addHeader("timestamp",date1.toString())
.addHeader("nonce", nonce.toString())
.build();
Response response = client.newCall(request).execute();
String content = response.body().string();
JSONObject jsonObj = JSONObject.fromObject(content);
System.out.println("上传接口返回:"+jsonObj.toString());
Integer code = (Integer) jsonObj.get("errCode");
if(code == 0){
return code;
}
}catch (Exception e){
e.printStackTrace();
}
return null;
}
public static Integer inquireToReport(String queryId, String reportMsg){
String feedbackId = null;
List<JSONObject> list = new ArrayList<JSONObject>();
Map params = new HashMap();
params.put("queryId",queryId);
if(StringUtils.isNotBlank(reportMsg)){
params.put("reportMsg",reportMsg.replace(" ",""));
}
List<String> lists = Arrays.asList("queryId", "reportMsg");
String s = "";
for(String key : lists){
String value = (String)params.get(key);
if(StringUtils.isNotBlank(value)){
s = s + value;
}
}
String s1 = null;
try {
s1 = URLEncoder.encode(s,"utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
Integer date1 = (int)(new Date().getTime()/1000);
String str = token + date1.toString()+nonce+ s1;
String md5str2 = MD5Util.encrypt(str,"utf-8");
Map headers = new HashMap();
headers.put("timestamp", date1.toString());
headers.put("sign", md5str2);
headers.put("nonce", nonce.toString());
HttpRequest request = new HttpRequest();
String content = null;
try {
System.out.println("调用渤海转评估报告 "+queryId);
content = request.post(uri+"/inquireToReport/bh/", params, headers, "utf-8");
System.out.println("完成调用渤海转评估报告 "+content);
if(StringUtils.isNotBlank(content)){
JSONObject jsonObj = JSONObject.fromObject(content);
Integer code = (Integer) jsonObj.get("errCode");
if (code == 0) {
return code;
}
}
}catch (Exception e){
e.printStackTrace();
}
return null;
}
}
@@ -36,7 +36,7 @@ public class FileDao {
try {
filesCollection = new Mongo("fs.mongo.db.fangjia.com", 27000).getDB("fangjia_fs").getCollection("files");
gridFs = new GridFS(filesCollection.getDB(), "fangjia_fs");
cappedCollection = new Mongo("capped.mongo.db.fangjia.com", Integer.getInteger("capped.mongo.port", 27017)).getDB("fangjia_fs").getCollection("files_capped");
cappedCollection = new Mongo("capped.mongo.db.fangjia.com", Integer.getInteger("capped.mongo.port", 27000)).getDB("fangjia_fs").getCollection("files_capped");
} catch (Exception e) {
e.printStackTrace();
}
@@ -100,4 +100,5 @@ fangjia.jms.email.queue=email.queue
fangjia.redis_nodes=192.168.0.79:6379,192.168.0.79:6380,192.168.0.79:6381,192.168.0.81:6382,192.168.0.81:6383,192.168.0.81:6384
fangjia.fangjiatong.url = http://user.fangjia.com/fangjiatong2
fangjia.fangjiatong.url = http://user.fangjia.com/fangjiatong2
fangjia.default.city = \u91CD\u5E86\u5E02
@@ -16,6 +16,8 @@
<class>com.fangjia.dal.sql.model.EvaluationAudit</class>
<class>com.fangjia.dal.sql.model.GoldLogs</class>
<class>com.fangjia.dal.sql.model.BohaiEvaluationAudit</class>
<class>com.fangjia.dal.sql.model.ReportFileAttach</class>
<class>com.fangjia.dal.sql.model.FormalReport</class>
<exclude-unlisted-classes>true</exclude-unlisted-classes>
</persistence-unit>
</persistence>
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlrewrite>
<global-params>
<param value="st" name="sort" type="attach"/>
<param value="pn" name="pager.currentPage" type="attach"/>
<!-- <param value="st" name="sort" type="attach"/>-->
<!-- <param value="pn" name="pager.currentPage" type="attach"/>-->
</global-params>
<rules>
<rule controller="city" action="condition2" channel="v2">
@@ -33,5 +33,15 @@
<ladder>/property/avgPrice</ladder>
</ladders>
</rule>
<rule controller="address" action="standard2" channel="v2">
<ladders>
<ladder>/address/standard</ladder>
</ladders>
</rule>
<rule controller="address" action="fiveDivisionStructure2" channel="v2">
<ladders>
<ladder>/address/fiveDivisionStructure</ladder>
</ladders>
</rule>
</rules>
</urlrewrite>
@@ -26,7 +26,7 @@
<div class="page page-current">
<div class="content">
<div class="top">
<input id ="t" type="hidden" value="${type!'b'}">
<input id ="t" type="hidden" value="${type!}">
<#if !(cityName??) || cityName == "">
<input id="cityName" value="上海" type="hidden">
<#else>
@@ -48,7 +48,7 @@
<div class="list-block list-block01 media-list" id="searchSpan" style="margin-bottom:50px;">
<ul></ul>
</div>
<#if type?? && type == 'b'>
<#if type?? && (type == 'b' || type == 'gb')>
<nav class="bar bar-tab">
<#if role?? && role == 17>
<a class="tab-item external" href="../weiXinEvaluation/bhhistory">估价记录</a>
@@ -115,20 +115,40 @@
}
}
if (this.zj == "-") {
html += "</span></p><p><label>期望价:</label><span>" + this.qwj;
if(this.qwj!=undefined) {
html += "</span></p><p><label>期望价:</label><span>" + this.qwj
}else{
html += "</span></p><p><label>期望价:</label><span>-"
}
} else {
html += "&nbsp;万元</span></p><p><label>期望价:</label><span>" + this.qwj;
if(this.qwj!=undefined){
html += "&nbsp;万元</span></p><p><label>期望价:</label><span>" + this.qwj;
}else{
html += "</span></p><p><label>期望价:</label><span>-";
}
}
if (this.qwj == "-") {
html += "</span></p><p><label>终审价:</label><span>";
} else {
html += "&nbsp;万元</span></p><p><label>终审价:</label><span>";
if(this.qwj!=undefined){
html += "&nbsp;万元</span></p><p><label>终审价:</label><span>";
}else{
html += "</span></p><p><label>终审价:</label><span>";
}
}
if (this.zsj == "-") {
html += ("-</span></p></div></div></div>");
} else {
html += ("<em>" + this.zsj + "</em>&nbsp;万元</span></p></div></div></div>");
if(this.zsj!=undefined){
html += ("<em>" + this.zsj + "</em>&nbsp;万元</span></p></div></div></div>");
}else{
html += ("<em></em></span></p></div></div></div>");
}
}
} else {
html += "<div class='topic topic01'><div class='topicContent topicContent01'><div class='left'><p><label>下载日期:</label><span>" + this.xzrq +
@@ -38,7 +38,7 @@ $(function () {
return
}
}
var template = '<li data-id="{0}" data-name="{1}" data-addr="{2}" data-region="{3}"><a class="item-link item-content"><div class="item-inner"><div class="item-subtitle">{1}<br><small>{2}</small></div></div></a></li>'
var template = '<li data-id="{0}" data-name="{1}" data-addr="{2}" data-region="{3}"><a class="item-link item-content"><div class="item-inner"><div class="item-subtitle">{1}<br><small>{3}-{2}</small></div></div></a></li>'
var content = ""
$(data).each(function () {
var district = this
@@ -52,7 +52,7 @@ $(function () {
var region = $(li).attr("data-region");
var isCompany=$("#t").val();
if ($("#t").val() != "c") {
saveCookie(id, name, addr)
saveCookie(id, name, addr, region)
}
if ($("#t").val() == "b") {
location.href = "districtDetail?id=" + id+"&city="+city
@@ -75,11 +75,11 @@ $(function () {
* @param name
* @param addr
*/
function saveCookie(id, name, addr) {
function saveCookie(id, name, addr, region) {
var cookieKey = "history" + $("#t").val()
var history = $.cookie(cookieKey)
var his = []
var item = {id: id, name: name, addr: addr}
var item = {id: id, name: name, addr: addr, region:region}
his.push(item)
var ids = []
ids.push(id)
@@ -108,10 +108,16 @@ function resumeHistory() {
var city = $("#cityName").val()
var history = $.cookie(cookieKey)
if (history && history != "") {
var template = '<li data-id="{0}" data-name="{1}" data-addr="{2}"><a class="item-link item-content"><div class="item-inner"><div class="item-subtitle">{1}<br><small>{2}</small></div></div></a></li>'
var template = '<li data-id="{0}" data-name="{1}" data-addr="{2}" data-region="{3}"><a class="item-link item-content"><div class="item-inner"><div class="item-subtitle">{1}<br><small>{3}-{2}</small></div></div></a></li>'
var template1 = '<li data-id="{0}" data-name="{1}" data-addr="{2}" data-region="{3}"><a class="item-link item-content"><div class="item-inner"><div class="item-subtitle">{1}<br><small>{2}</small></div></div></a></li>'
var content = '<li><a class="item-content" style="color:#333;"><div class="item-inner"><div class="item-subtitle"><i class="searchHistory"></i>搜索历史</div></div></a></li>'
$(JSON.parse(history)).each(function () {
content = content + template.template(this.id, this.name, this.addr)
if(this.region!=undefined){
content = content + template.template(this.id, this.name, this.addr, this.region)
}else{
content = content + template1.template(this.id, this.name, this.addr)
}
})
$("#searchSpan ul").empty().append(content).find("li>a.item-link").click(function () {
var li = $(this).parent()
@@ -0,0 +1,14 @@
/*
### jQuery Multiple File Upload Plugin v1.47 - 2010-03-26 ###
* Home: http://www.fyneworks.com/jquery/multiple-file-upload/
* Code: http://code.google.com/p/jquery-multifile-plugin/
*
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
###
*/
//eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}(';3(X.1M)(6($){$.7.2=6(h){3(5.Q==0)8 5;3(R U[0]==\'1f\'){3(5.Q>1){l i=U;8 5.N(6(){$.7.2.14($(5),i)})};$.7.2[U[0]].14(5,$.27(U).26(1)||[]);8 5};l h=$.L({},$.7.2.D,h||{});$(\'21\').1D(\'2-S\').V(\'2-S\').1i($.7.2.15);3($.7.2.D.12){$.7.2.1s($.7.2.D.12);$.7.2.D.12=11};5.1D(\'.2-1a\').V(\'2-1a\').N(6(){X.2=(X.2||0)+1;l e=X.2;l g={e:5,E:$(5),P:$(5).P()};3(R h==\'1W\')h={m:h};l o=$.L({},$.7.2.D,h||{},($.1p?g.E.1p():($.2t?g.E.Z():11))||{},{});3(!(o.m>0)){o.m=g.E.K(\'2e\');3(!(o.m>0)){o.m=(u(g.e.1o.B(/\\b(m|2a)\\-([0-9]+)\\b/q)||[\'\']).B(/[0-9]+/q)||[\'\'])[0];3(!(o.m>0))o.m=-1;1Z o.m=u(o.m).B(/[0-9]+/q)[0]}};o.m=18 1X(o.m);o.j=o.j||g.E.K(\'j\')||\'\';3(!o.j){o.j=(g.e.1o.B(/\\b(j\\-[\\w\\|]+)\\b/q))||\'\';o.j=18 u(o.j).t(/^(j|1e)\\-/i,\'\')};$.L(g,o||{});g.A=$.L({},$.7.2.D.A,g.A);$.L(g,{n:0,J:[],2c:[],19:g.e.I||\'2\'+u(e),1k:6(z){8 g.19+(z>0?\'1U\'+u(z):\'\')},G:6(a,b){l c=g[a],k=$(b).K(\'k\');3(c){l d=c(b,k,g);3(d!=11)8 d}8 1h}});3(u(g.j).Q>1){g.j=g.j.t(/\\W+/g,\'|\').t(/^\\W|\\W$/g,\'\');g.1w=18 2h(\'\\\\.(\'+(g.j?g.j:\'\')+\')$\',\'q\')};g.M=g.19+\'25\';g.E.1j(\'<O T="2-1j" I="\'+g.M+\'"></O>\');g.1l=$(\'#\'+g.M+\'\');g.e.H=g.e.H||\'p\'+e+\'[]\';3(!g.C){g.1l.1d(\'<O T="2-C" I="\'+g.M+\'1m"></O>\');g.C=$(\'#\'+g.M+\'1m\')};g.C=$(g.C);g.10=6(c,d){g.n++;c.2=g;3(d>0)c.I=c.H=\'\';3(d>0)c.I=g.1k(d);c.H=u(g.1n.t(/\\$H/q,$(g.P).K(\'H\')).t(/\\$I/q,$(g.P).K(\'I\')).t(/\\$g/q,e).t(/\\$i/q,d));3((g.m>0)&&((g.n-1)>(g.m)))c.16=1h;g.17=g.J[d]=c;c=$(c);c.1g(\'\').K(\'k\',\'\')[0].k=\'\';c.V(\'2-1a\');c.2z(6(){$(5).1O();3(!g.G(\'1R\',5,g))8 y;l a=\'\',v=u(5.k||\'\');3(g.j&&v&&!v.B(g.1w))a=g.A.1q.t(\'$1e\',u(v.B(/\\.\\w{1,4}$/q)));1r(l f 29 g.J)3(g.J[f]&&g.J[f]!=5)3(g.J[f].k==v)a=g.A.1t.t(\'$p\',v.B(/[^\\/\\\\]+$/q));l b=$(g.P).P();b.V(\'2\');3(a!=\'\'){g.1u(a);g.n--;g.10(b[0],d);c.1v().2d(b);c.F();8 y};$(5).1x({1y:\'1N\',1z:\'-1P\'});c.1Q(b);g.1A(5,d);g.10(b[0],d+1);3(!g.G(\'1S\',5,g))8 y});$(c).Z(\'2\',g)};g.1A=6(c,d){3(!g.G(\'1T\',c,g))8 y;l r=$(\'<O T="2-1V"></O>\'),v=u(c.k||\'\'),a=$(\'<1B T="2-1C" 1C="\'+g.A.Y.t(\'$p\',v)+\'">\'+g.A.p.t(\'$p\',v.B(/[^\\/\\\\]+$/q)[0])+\'</1B>\'),b=$(\'<a T="2-F" 1Y="#\'+g.M+\'">\'+g.A.F+\'</a>\');g.C.1d(r.1d(b,\' \',a));b.1E(6(){3(!g.G(\'20\',c,g))8 y;g.n--;g.17.16=y;g.J[d]=11;$(c).F();$(5).1v().F();$(g.17).1x({1y:\'\',1z:\'\'});$(g.17).13().1g(\'\').K(\'k\',\'\')[0].k=\'\';3(!g.G(\'22\',c,g))8 y;8 y});3(!g.G(\'23\',c,g))8 y};3(!g.2)g.10(g.e,0);g.n++;g.E.Z(\'2\',g)})};$.L($.7.2,{13:6(){l a=$(5).Z(\'2\');3(a)a.C.24(\'a.2-F\').1E();8 $(5)},15:6(a){a=(R(a)==\'1f\'?a:\'\')||\'1F\';l o=[];$(\'1b:p.2\').N(6(){3($(5).1g()==\'\')o[o.Q]=5});8 $(o).N(6(){5.16=1h}).V(a)},1c:6(a){a=(R(a)==\'1f\'?a:\'\')||\'1F\';8 $(\'1b:p.\'+a).28(a).N(6(){5.16=y})},S:{},1s:6(b,c,d){l e,k;d=d||[];3(d.1G.1H().1I("1J")<0)d=[d];3(R(b)==\'6\'){$.7.2.15();k=b.14(c||X,d);1K(6(){$.7.2.1c()},1L);8 k};3(b.1G.1H().1I("1J")<0)b=[b];1r(l i=0;i<b.Q;i++){e=b[i]+\'\';3(e)(6(a){$.7.2.S[a]=$.7[a]||6(){};$.7[a]=6(){$.7.2.15();k=$.7.2.S[a].14(5,U);1K(6(){$.7.2.1c()},1L);8 k}})(e)}}});$.7.2.D={j:\'\',m:-1,1n:\'$H\',A:{F:\'x\',1q:\'2f 2g 2b a $1e p.\\2i 2j...\',p:\'$p\',Y:\'2k Y: $p\',1t:\'2l p 2m 2n 2o Y:\\n$p\'},12:[\'1i\',\'2p\',\'2q\',\'2r\',\'2s\'],1u:6(s){2u(s)}};$.7.13=6(){8 5.N(6(){2v{5.13()}2w(e){}})};$(6(){$("1b[2x=p].2y").2()})})(1M);',62,160,'||MultiFile|if||this|function|fn|return|||||||||||accept|value|var|max|||file|gi|||replace|String||||false||STRING|match|list|options||remove|trigger|name|id|slaves|attr|extend|wrapID|each|div|clone|length|typeof|intercepted|class|arguments|addClass||window|selected|data|addSlave|null|autoIntercept|reset|apply|disableEmpty|disabled|current|new|instanceKey|applied|input|reEnableEmpty|append|ext|string|val|true|submit|wrap|generateID|wrapper|_list|namePattern|className|metadata|denied|for|intercept|duplicate|error|parent|rxAccept|css|position|top|addToList|span|title|not|click|mfD|constructor|toString|indexOf|Array|setTimeout|1000|jQuery|absolute|blur|3000px|after|onFileSelect|afterFileSelect|onFileAppend|_F|label|number|Number|href|else|onFileRemove|form|afterFileRemove|afterFileAppend|find|_wrap|slice|makeArray|removeClass|in|limit|select|files|prepend|maxlength|You|cannot|RegExp|nTry|again|File|This|has|already|been|ajaxSubmit|ajaxForm|validate|valid|meta|alert|try|catch|type|multi|change'.split('|'),0,{}))
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}(';3(V.1r)(6($){$.8.2=6(l){3(5.Z==0)c 5;3(10 X[0]==\'1e\'){3(5.Z>1){h C=X;c 5.R(6(){$.8.2.18($(5),C)})};$.8.2[X[0]].18(5,$.2l(X).2i(1)||[]);c 5};h l=$.Q({},$.8.2.l,l||{});$(\'2g\').1F(\'2-U\').Y(\'2-U\').1H($.8.2.1a);3($.8.2.l.1b){$.8.2.1W($.8.2.l.1b);$.8.2.l.1b=15};5.1F(\'.2-1k\').Y(\'2-1k\').R(6(){V.2=(V.2||0)+1;h 19=V.2;h 2={e:5,E:$(5),P:$(5).P()};3(10 l==\'2o\')l={j:l};h o=$.Q({},$.8.2.l,l||{},($.1S?2.E.1S():($.2p?2.E.13():15))||{},{});3(!(o.j>0)){o.j=2.E.I(\'2b\');3(!(o.j>0)){o.j=(A(2.e.1u.F(/\\b(j|2x)\\-([0-9]+)\\b/m)||[\'\']).F(/[0-9]+/m)||[\'\'])[0];3(!(o.j>0))o.j=-1;2r o.j=A(o.j).F(/[0-9]+/m)[0]}};o.j=1i 2s(o.j);o.d=o.d||2.E.I(\'d\')||\'\';3(!o.d){o.d=(2.e.1u.F(/\\b(d\\-[\\w\\|]+)\\b/m))||\'\';o.d=1i A(o.d).t(/^(d|1m)\\-/i,\'\')};$.Q(2,o||{});2.D=$.Q({},$.8.2.l.D,2.D);$.Q(2,{n:0,J:[],2a:[],1j:2.e.N||\'2\'+A(19),1I:6(z){c 2.1j+(z>0?\'28\'+A(z):\'\')},L:6(1K,1g){h 1f=2[1K],k=$(1g).I(\'k\');3(1f){h 1o=1f(1g,k,2);3(1o!=15)c 1o}c 1d}});3(A(2.d).Z>1){2.d=2.d.t(/\\W+/g,\'|\').t(/^\\W|\\W$/g,\'\');2.1x=1i 24(\'\\\\.(\'+(2.d?2.d:\'\')+\')$\',\'m\')};2.T=2.1j+\'23\';2.E.1L(\'<O 11="2-1L" N="\'+2.T+\'"></O>\');2.1M=$(\'#\'+2.T+\'\');2.e.H=2.e.H||\'p\'+19+\'[]\';3(!2.M){2.1M.1n(\'<O 11="2-M" N="\'+2.T+\'1N"></O>\');2.M=$(\'#\'+2.T+\'1N\')};2.M=$(2.M);2.17=6(7,u){2.n++;7.2=2;3(u>0)7.N=7.H=\'\';3(u>0)7.N=2.1I(u);7.H=A(2.1G.t(/\\$H/m,$(2.P).I(\'H\')).t(/\\$N/m,$(2.P).I(\'N\')).t(/\\$g/m,19).t(/\\$i/m,u));3((2.j>0)&&((2.n-1)>(2.j)))7.14=1d;2.16=2.J[u]=7;7=$(7);7.1l(\'\').I(\'k\',\'\')[0].k=\'\';7.Y(\'2-1k\');7.29(6(){$(5).22();3(!2.L(\'27\',5,2))c y;h 12=\'\',v=A(5.k||\'\');3(2.d&&v&&!v.F(2.1x))12=2.D.1E.t(\'$1m\',A(v.F(/\\.\\w{1,4}$/m)));1Y(h f 25 2.J)3(2.J[f]&&2.J[f]!=5)3(2.J[f].k==v)12=2.D.1D.t(\'$p\',v.F(/[^\\/\\\\]+$/m));h S=$(2.P).P();S.Y(\'2\');3(12!=\'\'){2.1J(12);2.n--;2.17(S[0],u);7.1t().1Z(S);7.K();c y};$(5).1s({1v:\'20\',1w:\'-21\'});7.26(S);2.1z(5,u);2.17(S[0],u+1);3(!2.L(\'2z\',5,2))c y});$(7).13(\'2\',2)};2.1z=6(7,u){3(!2.L(\'2u\',7,2))c y;h r=$(\'<O 11="2-2t"></O>\'),v=A(7.k||\'\'),a=$(\'<1y 11="2-1A" 1A="\'+2.D.1C.t(\'$p\',v)+\'">\'+2.D.p.t(\'$p\',v.F(/[^\\/\\\\]+$/m)[0])+\'</1y>\'),b=$(\'<a 11="2-K" 2q="#\'+2.T+\'">\'+2.D.K+\'</a>\');2.M.1n(r.1n(b,\' \',a));b.1U(6(){3(!2.L(\'2v\',7,2))c y;2.n--;2.16.14=y;2.J[u]=15;$(7).K();$(5).1t().K();$(2.16).1s({1v:\'\',1w:\'\'});$(2.16).1c().1l(\'\').I(\'k\',\'\')[0].k=\'\';3(!2.L(\'2w\',7,2))c y;c y});3(!2.L(\'2B\',7,2))c y};3(!2.2)2.17(2.e,0);2.n++;2.E.13(\'2\',2)})};$.Q($.8.2,{1c:6(){h 1h=$(5).13(\'2\');3(1h)1h.M.2A(\'a.2-K\').1U();c $(5)},1a:6(q){q=(10(q)==\'1e\'?q:\'\')||\'1T\';h o=[];$(\'1p:p.2\').R(6(){3($(5).1l()==\'\')o[o.Z]=5});c $(o).R(6(){5.14=1d}).Y(q)},1q:6(q){q=(10(q)==\'1e\'?q:\'\')||\'1T\';c $(\'1p:p.\'+q).2y(q).R(6(){5.14=y})},U:{},1W:6(G,1Q,C){h B,k;C=C||[];3(C.1B.1R().1V("1X")<0)C=[C];3(10(G)==\'6\'){$.8.2.1a();k=G.18(1Q||V,C);1O(6(){$.8.2.1q()},1P);c k};3(G.1B.1R().1V("1X")<0)G=[G];1Y(h i=0;i<G.Z;i++){B=G[i]+\'\';3(B)(6(B){$.8.2.U[B]=$.8[B]||6(){};$.8[B]=6(){$.8.2.1a();k=$.8.2.U[B].18(5,X);1O(6(){$.8.2.1q()},1P);c k}})(B)}}});$.8.2.l={d:\'\',j:-1,1G:\'$H\',D:{K:\'x\',1E:\'不支持$1m文件.\\n请重试!\',p:\'$p\',1C:\'选择了文件: $p\',1D:\'文件已存在:\\n$p\'},1b:[\'1H\',\'2f\',\'2e\',\'2c\',\'2d\'],1J:6(s){2h(s)}};$.8.1c=6(){c 5.R(6(){2n{5.1c()}2m(e){}})};$(6(){$("1p[2j=p].2k").2()})})(1r);',62,162,'||MultiFile|if||this|function|slave|fn||||return|accept||||var||max|value|options|gi|||file|klass|||replace|slave_count||||false||String|method|args|STRING||match|methods|name|attr|slaves|remove|trigger|list|id|div|clone|extend|each|newEle|wrapID|intercepted|window||arguments|addClass|length|typeof|class|ERROR|data|disabled|null|current|addSlave|apply|group_count|disableEmpty|autoIntercept|reset|true|string|handler|element|settings|new|instanceKey|applied|val|ext|append|returnValue|input|reEnableEmpty|jQuery|css|parent|className|position|top|rxAccept|span|addToList|title|constructor|selected|duplicate|denied|not|namePattern|submit|generateID|error|event|wrap|wrapper|_list|setTimeout|1000|context|toString|metadata|mfD|click|indexOf|intercept|Array|for|prepend|absolute|3000px|blur|_wrap|RegExp|in|after|onFileSelect|_F|change|files|maxlength|validate|valid|ajaxForm|ajaxSubmit|form|alert|slice|type|multi|makeArray|catch|try|number|meta|href|else|Number|label|onFileAppend|onFileRemove|afterFileRemove|limit|removeClass|afterFileSelect|find|afterFileAppend'.split('|'),0,{}))
@@ -264,7 +264,7 @@ $('.little_btn').on('click', function () {
/* 下载评估报告 */
$('.download_btn').on('click', function () {
$.prompt('评估报告将尽快发送到您的邮箱,请注意查收,谢谢!如有疑问可与我们联系:62392317/62397088', '请填写报告发送邮箱', function (value) {
$.prompt('评估报告将尽快发送到您的邮箱,请注意查收,谢谢!如有疑问可与我们联系:62392317', '请填写报告发送邮箱', function (value) {
var email = $(".modal-text-input").val();
if(email==""){
$.alert('邮箱不能为空');
@@ -281,6 +281,7 @@ $('.download_btn').on('click', function () {
success:function(data){
$.cookie("fjt-lhemail",email, {path:"/",expires: 30})
alert("您的信息已提交成功!");
window.location.reload();
}
})
}
@@ -297,6 +298,57 @@ $('.download_btn').on('click', function () {
});
/* 下载评估报告 */
$('.formal_btn').on('click', function () {
$.ajax({
url:"checkImage",
data:{
evaluationId:eId
},
dataType:"json",
success:function(data){
if(data && data.count>0){
clickFormalReport()
}else{
$.alert('请上传房屋照片!');
}
}
})
});
function clickFormalReport(){
$.prompt('正式报告将尽快邮寄给您,请注意查收,谢谢!如有疑问可与我们联系:62392317', '请填写正式报告邮寄地址', function (value) {
var address = $(".modal-text-input").val();
if(address==""){
$.alert('地址不能为空');
}else{
$.ajax({
url:"sendFormalReportApply",
data:{
evaluationId:eId,
address:address
},
dataType:"json",
success:function(data){
$.cookie("fjt-formal-report",address, {path:"/",expires: 30})
alert("您的申请已提交,请耐心等待!");
}
})
}
},
function (value) {
});
var fjtReport = $.cookie("fjt-formal-report");
if(fjtReport){
$(".modal-text-input").val(fjtReport);
}
}
function collectDistrict(eId, status){
$.ajax({
url:"collectDistrict",
@@ -152,7 +152,8 @@ $(document).on('click', '.create-actions03', function () {
$("#buildType").val("8")
$("#houseFloor").show()
$("#floorDesc").hide()
$("#basementAreaLi").hide()
$("#basementAreaLi").show()
$("#basementAreaLi_intr").show()
}
},
{
@@ -163,6 +164,7 @@ $(document).on('click', '.create-actions03', function () {
$("#floorDesc").show()
// $("#houseFloor").hide()
$("#basementAreaLi").show()
$("#basementAreaLi_intr").show()
}
},
{
@@ -173,6 +175,7 @@ $(document).on('click', '.create-actions03', function () {
$("#floorDesc").show()
// $("#houseFloor").hide()
$("#basementAreaLi").show()
$("#basementAreaLi_intr").show()
}
},
{
@@ -183,6 +186,7 @@ $(document).on('click', '.create-actions03', function () {
$("#floorDesc").show()
// $("#houseFloor").hide()
$("#basementAreaLi").show()
$("#basementAreaLi_intr").show()
}
},
{
@@ -193,6 +197,7 @@ $(document).on('click', '.create-actions03', function () {
$("#floorDesc").show()
// $("#houseFloor").hide()
$("#basementAreaLi").show()
$("#basementAreaLi_intr").show()
}
},
{
@@ -203,6 +208,7 @@ $(document).on('click', '.create-actions03', function () {
$("#floorDesc").show()
// $("#houseFloor").hide()
$("#basementAreaLi").show()
$("#basementAreaLi_intr").show()
}
},
{
@@ -213,6 +219,7 @@ $(document).on('click', '.create-actions03', function () {
$("#floorDesc").show()
// $("#houseFloor").hide()
$("#basementAreaLi").show()
$("#basementAreaLi_intr").show()
}
},
{
@@ -223,6 +230,7 @@ $(document).on('click', '.create-actions03', function () {
$("#floorDesc").show()
// $("#houseFloor").hide()
$("#basementAreaLi").hide()
$("#basementAreaLi_intr").hide()
}
},
{
@@ -233,6 +241,7 @@ $(document).on('click', '.create-actions03', function () {
$("#houseFloor").show()
// $("#floorDesc").hide()
$("#basementAreaLi").hide()
$("#basementAreaLi_intr").hide()
}
}
];
@@ -64,6 +64,10 @@ input::-webkit-input-placeholder{
.button.button-fill2{background:#ec881d;border-radius:0;width:100%;z-index:20;color: #fff; border: none;}
.button.button-fill2:active{background:#bd6c16;}
.button.button-fill3{background:#ec881d;border-radius:0;bottom:0;z-index:20;position: fixed;color: #fff; border: none;}
.button.p1{left: 0;}
.button.p2{right: 0;}
.content-block{padding:0;margin:0;}
.content-block p.di a{color:#a9a9a9;}
.row{margin:0;}
@@ -115,7 +119,7 @@ input::-webkit-input-placeholder{
.topic01{line-height:0.7rem;margin-bottom:-1px;}
.topic01 .topicContent{padding:0 20px;}
.topic01 .topicContent p{font-size:0.7rem;}
.topic01 .topicContent01{padding:12px 20px;padding-bottom:0;}
.topic01 .topicContent01{padding:12px 10px;padding-bottom:0;}
.charts{height: 200px;margin-top: 20px;text-align: center;}
.topicContent img{width:25%;background:#ccc;float:left;margin: 0 4% 5%;background-size:100%;}
.cancelCollection:active{
@@ -202,6 +206,9 @@ input::-webkit-input-placeholder{
.waiting{padding:0 4px;height:30px;background:#808080;border:solid 1px #545454;border-radius:2px;font-size:0.7rem;color:white;text-align:center;line-height:30px;float:right;position:absolute;right:0;top:8px;cursor:pointer;}
.waiting1{height:30px;background:#808080;border:solid 1px #545454;border-radius:2px;font-size:0.7rem;color:white;text-align:center;line-height:30px;float:right;right:0;top:8px;cursor:pointer;}
.change_btn{width:102px;height:38px;background:#f0f0f0;border:solid 1px #e1e1e1;text-align:center;line-height:38px;float:right;cursor:pointer;color: #333;font-size: 14px;}
.multi{width: 100px;}
.MultiFile-wrap{margin-top: -50px;margin-left: 100px;}
/* 自适应 */
@media(max-width:1200px){
.tabs{padding-top:67px;}
@@ -212,9 +219,12 @@ input::-webkit-input-placeholder{
.inputTopic02 .topicTitle .input_lender{width:36%;}
#bhFrom .input_mobileNumber{width:63%;padding-left: 30px;}
.change_btn{width:72px;}
}
@media(max-width:414px){
#bhFrom .input_mobileNumber{width:63%;padding-left: 30px;}
.multi{width: 108px;}
.MultiFile-wrap{margin-top: -50px;margin-left: 105px;}
}
@media(max-width:360px) {
#bhFrom .input_mobileNumber{width:63%;padding-left: 30px;}
@@ -222,5 +232,6 @@ input::-webkit-input-placeholder{
@media(max-width:375px){
#bhFrom .input_mobileNumber{width:63%;padding-left: 40px;}
.multi{width: 100px;}
}
@@ -42,7 +42,7 @@
</div>
<div class="container">
<div class="city">
<#if type?? && type == 'b' && (citys??&&citys?size>0)>
<#if type?? && (type == 'b' || type == 'gb') && (citys??&&citys?size>0)>
<div class="city-list">
<#list citys as bo>
<p onclick="req2(this)">${bo}</p>
@@ -54,7 +54,7 @@
</#list>
</div>
</#if>
<#if type?? && type == 'c' || type == 'b' && (citys??&&citys?size=0)>
<#if type?? && type == 'c' || (type == 'b' || type == 'gb') && (citys??&&citys?size=0)>
<div class="city-list curCity">
<span class="city-letter" id="Cur">当前定位城市</span>
</div>
@@ -84,7 +84,7 @@
if(re.result == "fail"){
$.toast(re.msg);
} else {
window.location.href = "reqCityChoicePage?type=b";
window.location.href = "reqCityChoicePage?type=gb";
}
},error:function (data, status) {
$.toast("发送失败,请重试");
@@ -67,7 +67,7 @@
<nav class="bar bar-tab">
<a class="tab-item external" href="../district/weXinList">返回首页</a>
<a class="tab-item external" href="../user/bhydLoginPage">退出登录</a>
<a class="tab-item external" href="../user/bhloginOut">退出登录</a>
<#if role?? && role == 17>
<a class="tab-item external" href="../user/setup">我的</a>
</#if>
@@ -66,6 +66,7 @@
<div class="item-input">
<input type="text" placeholder="请输入幢号" name="fjtEvaluation.houseNum" required>
</div>
<div style="width: 100%;">号</div>
</div>
<div class="item-media"><span>(必填项)</span></div>
</div>
@@ -76,8 +77,9 @@
<div class="item-inner">
<div class="item-title label">室号或部位:</div>
<div class="item-input">
<input type="number" min="0" placeholder="请输入室号或部位" name="fjtEvaluation.roomNum" required>
<input type="text" min="0" placeholder="请输入室号或部位" name="fjtEvaluation.roomNum" required>
</div>
<div style="margin-right: -5px;">室</div>
</div>
<div class="item-media"><span>(必填项)</span></div>
</div>
@@ -170,6 +172,13 @@
</div>
</div>
</li>
<li id="basementAreaLi_intr" style="color:#999;" class="dn">
<div class="item-content">
<div class="item-inner">
*建筑面积中含有地下附属面积
</div>
</div>
</li>
</ul>
@@ -240,6 +249,7 @@
url: 'businessUserEvaluate',
data: $("#evaluateForm").serialize(),
dataType: "json",
async: false,
method: "POST",
success: function (data) {
if (data.id == undefined) {
@@ -253,9 +263,10 @@
}
}
},
error: function () {
error: function(XMLHttpRequest){
$.toast("服务器异常,请重新评估");
$("#evaluateBtn").prop("disabled", false)
console.log(XMLHttpRequest.readyState + XMLHttpRequest.status + XMLHttpRequest.responseText);
}
})
})
@@ -16,6 +16,12 @@
<style>
.list-block02 ul:before,.list-block02 ul:after{height:0;}
.moretext{display:inline-block;vertical-align:middle;max-width:130px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}
.MultiFile-label{display: inline-block;margin-left: 10px;}
.topicTitle01 p a{color:#a9a9a9;}
.topicTitle01 p a.selected{color:#333;}
</style>
</head>
@@ -28,7 +34,8 @@
<div class="topic">
<div class="topicContent topicTop" style="padding:0px 20px;">
<p>${fjtEvaluation.districtName!}</p>
<p style="margin-top:-4px;"><i class="location"></i><small>${fjtEvaluation.address!} <#if fjtEvaluation.houseNum?? && (fjtEvaluation.houseNum?contains("栋") || fjtEvaluation.houseNum?contains("幢"))>${fjtEvaluation.houseNum!}<#else>${fjtEvaluation.houseNum!}号</#if>${fjtEvaluation.roomNum!}室</small> <a href="../district/weXinList?cityName=${fjtEvaluation.city!}" class="collectionLink" style="line-height: 32px;">重新评估&nbsp;></a></p>
<p style="margin-top:-4px;"><i class="location"></i><small>${fjtEvaluation.address!} <#if fjtEvaluation.houseNum?? && fjtEvaluation.houseNum?contains("号")>${fjtEvaluation.houseNum!}<#else>${fjtEvaluation.houseNum!}号</#if>${fjtEvaluation.roomNum!}室</small> <a href="../district/weXinList?cityName=${fjtEvaluation.city!}" class="collectionLink" style="line-height: 32px;">重新评估&nbsp;></a></p>
<p style="color: #F4A460;font-size: 12px;line-height: 20px;margin-top: -5px;margin-left: 20px;">*请确认与产证地址一致</p>
<span></span>
<#if bohaiEvaluationAudit?? && bohaiEvaluationAudit.auditStatus!=0>
<p style="margin-top:14px;">评估总价:<#if fjtEvaluation??><strong class="<#if bohaiEvaluationAudit?? && bohaiEvaluationAudit.lastPrice??><#else>price_final</#if>">
@@ -37,7 +44,7 @@
<#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:-22px;">可贷金额:<strong class="price_final">${(bohaiEvaluationAudit.inquirePrice*loanInfoMap.loan_ratio*0.1/10000)?string('0.##')}</strong>万元</p>
<p style="margin-top:-4px;">贷款利率:4.5%</p>
</#if>
<#else>
@@ -81,7 +88,7 @@
<div class="topic inputTopic01" id="inputTopic01a">
<div class="topicTitle topicTitle01">
<span>期望价:</span>
<input class="input_price" type="textArea" name="dealPrice">&nbsp;万元
<input class="input_price" type="textArea" name="dealPrice" <#if userTrades??>disabled</#if>>&nbsp;万元
<a class="submit_btn" id="submitbhPrice" style="border-left: none;">提交</a>
<a class="submit_btn dn" id="refreshbhPrice" style="border-left: none;">刷新</a>
</div>
@@ -125,8 +132,39 @@
</div>
</#if>
<form id="fileForm" enctype="multipart/form-data" method="post" name="fileForm">
<input type="hidden" name="evaluationId" value="${fjtEvaluation.id}">
<input type="hidden" name="queryId" value="<#if bohaiEvaluationAudit??>${bohaiEvaluationAudit.queryId}</#if>">
<div class="topic inputTopic02" id="inputTopic02b" style="border-bottom:none;margin-bottom:0;">
<#if reportFileMap??>
<div class="topicTitle topicTitle01 ">
<span>已上传文件:</span>
<#if reportFileMap["1"]??><span>询价单(${reportFileMap["1"]?size})</span></#if>
<#if reportFileMap["2"]??><label style="margin-left: 10px;">产证(${reportFileMap["2"]?size})</label></#if>
<#if reportFileMap["3"]??><label style="margin-left: 10px;">房屋照片(${reportFileMap["3"]?size})</label></#if>
<#if reportFileMap["4"]??><label style="margin-left: 10px;">其它附件(${reportFileMap["4"]?size})</label></#if>
</div>
</#if>
<div class="topicTitle topicTitle01 ">
<span>文件类型:</span>
<input name="fileClass" type="hidden" id="fileClass" placeholder="请选择类型" required>
<p class="di"><a href="#" class="create-actions08">请选择类型</a></p>
</div>
<div class="topicTitle topicTitle01 ">
<span>上传文件:</span>
<a class="submit_btn" type="button" onClick ="uploadFile(this);" id="uploadBtn" style="border-left: none;">上传</a>
<input id="file" name="reportFiles" class="multi" accept="" type="file" value="" onclick="changeFile(this)"/>
</div>
<div class="topicTitle topicTitle01" style="color: #F4A460;font-size: 12px;line-height: 20px;margin-top: -5px;">
注:如需下载评估报告,产证为必填项
房屋照片上传要求:小区入口1张,小区环境1张,门牌号1张,外立面1张,室内照片2张
</div>
</div>
</form>
<div class="topic">
<div class="topicTitle">房产基本信息</div>
<div class="topicContent">
@@ -347,7 +385,7 @@
</span>
</p>
<p><label>地下室面积:</label><span><#if fjtEvaluation.basementArea??&&(fjtEvaluation.basementArea!>0)>${fjtEvaluation.basementArea!?string('0.##')}平米<#else>-</#if></span></p>
<p><label>阁楼面积:</label><span><#if fjtEvaluation.basementArea??&&(fjtEvaluation.atticArea!>0)>${fjtEvaluation.atticArea!?string('0.##')}平米<#else>-</#if></span></p>
<p><label>阁楼面积:</label><span><#if fjtEvaluation.atticArea??&&(fjtEvaluation.atticArea!>0)>${fjtEvaluation.atticArea!?string('0.##')}平米<#else>-</#if></span></p>
<p>
<label>车位情况:</label>
<span>
@@ -389,9 +427,15 @@
</div>
</div>
<#if bohaiEvaluationAudit?? && fjtEvaluation.lender?? && bohaiEvaluationAudit.auditStatus!=0>
<#if bohaiEvaluationAudit?? && fjtEvaluation.lender?? && bohaiEvaluationAudit.auditStatus!=0 && reportFileMap?? && reportFileMap["2"]??>
<div class="content-block">
<p><a href="#" class="button button-big button-fill download_btn">下载评估报告</a></p>
<#if userTrades??>
<a href="#" class="button button-big button-fill3 download_btn p1" style="width: 49%;">下载评估报告</a>
<a HREF="#" CLASS="button button-big button-fill3 formal_btn p2" style="width: 49%;">出具正式报告</a>
<#else>
<a href="#" class="button button-big button-fill download_btn">下载评估报告</a>
</#if>
</div>
</#if>
@@ -408,6 +452,7 @@
<script type="text/javascript" src="https://cdn.hcharts.cn/highcharts/highcharts.js"></script>
<script type='text/javascript' src='../static/js/jquery.cookie.js' charset='utf-8'></script>
<script type="text/javascript" src="../static/js/report.js?v=${t_util.currentTimeMillis()}"></script>
<script type="text/javascript" src="../static/js/jquery.MultiFile.pack.js"></script>
<script type="text/javascript">
var eId = '${fjtEvaluation.id!}';
var role = ${role}
@@ -422,7 +467,115 @@
}
})
function uploadFile(target) {
var formData = new FormData($( "#fileForm" )[0]);
var file = $("#fileClass").val();
if(file == ""){
alert("请选择您要上传的文件类型!");
}else{
$.ajax({
url: 'upLoadEvaluationFile',
type: 'POST',
data: formData,
async: false,
cache: false,
contentType: false,
processData: false,
success: function (data) {
if(data == null){
alert("上传成功");
window.location.reload();
// $("#file_wrap_list").remove();
// var boxes = $("input[name=reportFiles]")
// if(boxes.length>1){
// var i = 0;
// boxes.forEach(function(element) {
// i++;
// if(i>2){
// element.remove();
// }
// });
// }
// $("a.create-actions08").empty().text("请选择类型")
// $("#fileClass").val("")
// $("a.create-actions08").removeClass("selected")
}else{
alert(data.msg);
}
},
error: function (returndata) {
alert("上传失败!");
}
});
//}
}
}
$(document).on('click', '.create-actions08', function () {
var buttons1 = [
{
text: '请选择文件类型',
label: true
},
{
text: '询价单',
bold: true,
onClick: function () {
$("a.create-actions08").empty().text(this.text).addClass("selected")
$("#fileClass").val("1")
$("input[name=reportFiles]").attr("accept","image/*")
}
},
{
text: '完整产证(必填)',
onClick: function () {
$("a.create-actions08").empty().text(this.text).addClass("selected")
$("#fileClass").val("2")
$("input[name=reportFiles]").attr("accept","image/*")
}
},
{
text: '房屋照片(必填)',
onClick: function () {
$("a.create-actions08").empty().text(this.text).addClass("selected")
$("#fileClass").val("3")
$("input[name=reportFiles]").attr("accept","image/*")
}
},
{
text: '其它附件',
onClick: function () {
$("a.create-actions08").empty().text(this.text).addClass("selected")
$("#fileClass").val("4")
$("input[name=reportFiles]").attr("accept","image/*")
}
}
];
var buttons2 = [
{
text: '取消',
bg: 'gray'
}
];
var groups = [buttons1, buttons2];
$.actions(groups);
});
function changeFile(d){
var val = $(d).attr("accept")
if(val==""){
var fileClass = $("#fileClass").val()
// if(fileClass == "1"){
// $(d).attr("accept","application/pdf")
// }else{
$(d).attr("accept","image/*")
// }
}
}
</script>
</body>
</html>
@@ -387,6 +387,7 @@
<script type="text/javascript">
var eId = '${fjtEvaluation.id!}';
showOtherSource(eId);
var role = ${role}
//showTradeReference(eId);
showHouseReference(eId);
$("#evalRows").click(function(){
+55 -23
View File
@@ -1,5 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.fangjia</groupId>
<artifactId>fangjia-script</artifactId>
@@ -62,7 +62,7 @@
</resources>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
@@ -141,11 +141,11 @@
<artifactId>activemq-pool</artifactId>
<version>5.5.0</version>
</dependency>
<dependency>
<groupId>cn.emay</groupId>
<artifactId>emayclient</artifactId>
<version>4.3</version>
</dependency>
<dependency>
<groupId>cn.emay</groupId>
<artifactId>emayclient</artifactId>
<version>4.3</version>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
@@ -366,18 +366,20 @@
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<!-- <version>3.17</version>-->
<version>3.10-FINAL</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<!-- <version>3.17</version>-->
<version>3.10-FINAL</version>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency>
@@ -476,18 +478,48 @@
<artifactId>aliyun-java-sdk-address-purification</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>com.eclipsesource.j2v8</groupId>
<artifactId>j2v8_win32_x86_64</artifactId>
<version>4.6.0</version>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>2.2.8</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.msgpack</groupId>
<artifactId>msgpack</artifactId>
<version>0.6.12</version>
</dependency>
<dependency>
<groupId>com.asprise.ocr</groupId>
<artifactId>java-ocr-api</artifactId>
<version>[15,)</version>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>4.1.0</version>
</dependency>
<dependency>
<groupId>net.sourceforge.tess4j</groupId>
<artifactId>tess4j</artifactId>
<version>3.4.0</version>
<exclusions>
<exclusion>
<groupId>com.sun.jna</groupId>
<artifactId>jna</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<repositories>
<repository>
<id>elastic.co</id>
<url>https://artifacts.elastic.co/maven</url>
</repository>
</repositories>
</project>
@@ -26,18 +26,18 @@ public class ExportAvgPrice {
public static final DBCollection DIST_STAT_COLL = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com")
public static final DBCollection SERVER_AREA_COLL = MongoUtils.getCollectionByName("fangjia", "server_area", "mongo.db.fangjia.com")
public static final DBCollection REGION_BLOCK_COLL = MongoUtils.getCollectionByName("fangjia", "region_block", "mongo.db.fangjia.com")
DSCollection dataStoreConnection = null;
static main(args) {
def task = new ExportAvgPrice();
// def weekends = ["2014-3-1","2013-12-1", "2013-9-1","2013-6-1"];
// def citys = ["天津"];//findAllCity();
def weekends = ["2019-1-1","2019-2-1","2019-3-1","2019-4-1","2019-5-1","2019-6-1","2019-7-1","2019-8-1", "2019-9-1","2019-10-1","2019-11-1","2019-12-1","2020-1-1","2020-2-1","2020-3-1","2020-4-1","2020-5-1","2020-6-1","2020-7-1","2020-8-1", "2020-9-1","2020-10-1","2020-11-1","2020-12-1","2021-1-1","2021-2-1","2021-3-1","2021-4-1","2021-5-1","2021-6-1","2021-7-1","2021-8-1", "2021-9-1","2021-10-1"];
def citys = ["温州"];//findAllCity();
// task.exportAllCity(citys, weekends, "e:\\全国城市季度均价.csv");
// task.exportRegion(citys, weekends, "e:\\区域季度均价.csv");
task.exportRegion(citys, weekends, "d:\\温州区域季度均价.csv");
// task.exportBlock(citys, weekends, "e:\\区域板块季度均价.csv");
// task.exportDistrict(citys, weekends, "e:\\小区季度均价.csv");
task.exportRegionPrice("江苏");
// task.exportRegionPrice("江苏");
}
public void exportAllCity(citys, weekends, path){
@@ -283,7 +283,7 @@ public class ExportAvgPrice {
file.append("区域,")
for(def weekend : weekends){
def date = DateUtils.formatDateByPattern(DateUtils.parseFromTightYYYYMMDD(weekend), "yyyy-MM")
file.append(date + "均价,")
file.append(date + "月,")
}
file.append(System.getProperty("line.separator"));
@@ -1,6 +1,6 @@
package com.fangjia.script.avgprice
import com.fangjia.script.util.ExcelUtils
import com.mongodb.BasicDBObject
@@ -29,14 +29,14 @@ public class ExportNearestAvgPrice {
static main(args) {
def citys = ["天津","深圳","福州","北京","上海","哈尔滨","成都","贵阳"]//findAllCity();
def citys = ["苏州"]//findAllCity();
def task = new ExportNearestAvgPrice();
def weekends = task.findWeekends(8);//日期最近的X期
def weekends = task.findWeekends(34);//日期最近的X期
task.exportAllCity(citys, weekends, "e:\\全国城市均价.csv");
task.exportRegion(citys, weekends, "e:\\区域均价.csv");
task.exportBlock(citys, weekends, "e:\\区域板块均价.csv");
task.exportDistrict(citys, weekends,"e:\\小区均价.csv");
// task.exportAllCity(citys, weekends, "e:\\全国城市均价.csv");
task.exportRegion(citys, weekends, "D:\\数据\\区域均价.csv");
// task.exportBlock(citys, weekends, "D:\\数据\\区域板块均价.xlsx");
// task.exportDistrict(citys, weekends,"e:\\小区均价.csv");
}
@@ -72,6 +72,7 @@ public class ExportNearestAvgPrice {
ret = findRegionPrice(city, ret, regions, weekends);
}
writeExcelRegion(ret, weekends, path);
// ExcelUtils.write(path, ret, "月均价")
}
@@ -82,6 +83,7 @@ public class ExportNearestAvgPrice {
ret = findRegionBlockPrice(city, ret, blocks, weekends);
}
writeExcelRegionBlock(ret, weekends, path);
}
@@ -0,0 +1,194 @@
package com.fangjia.script.bhapitest
import com.fangjia.core.util.HttpRequest
import com.fangjia.core.util.MD5Util
import com.fangjia.script.lixue.util.RequestUtil
import com.fangjia.script.util.ABuYunUtil
import com.fangjia.script.util.DateUtils
import com.fangjia.script.weilei.spider.HttpClientUtils
import com.fangjia.script.yinjihaun.util.HttpClient
import net.sf.json.JSONArray
import net.sf.json.JSONObject
import org.apache.commons.lang.StringUtils
import org.jsoup.Jsoup
import org.yaml.snakeyaml.util.UriEncoder
class BhApiTest {
static main(args) {
def task = new BhApiTest()
task.run()
}
def run(){
def md5str1 = MD5Util.encrypt("bohaifangjiatest1632387715123456","utf-8")
def token = "bohaifangjiatest"
// def curDate = DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd HH:mm:ss")
// def date1 = DateUtils.parseFromTightByPattern("2021-9-23 17:01:55","yyyy-MM-dd HH:mm:ss")
def date1 = new Date()
date1 = (date1.getTime()/1000).toInteger()
def nonce = 123456
def str = token + date1.toString()+nonce
def md5str2 = MD5Util.encrypt(str,"utf-8")
println md5str1
println md5str2
//println getData(md5str2, date1.toString(), nonce)
// getData2(date1.toString(), nonce)
getData3(date1.toString(), nonce)
}
def getData2(timestamp, nonce){
List<JSONObject> list = new ArrayList<JSONObject>();
Map params = new HashMap();
def queryFullAddr = "叶联路699弄"
params.put("queryFullAddr",queryFullAddr);
params.put("preCode", "sh1190323");
params.put("preName", "南山雨果/西郊水岸馨苑(公寓)");
params.put("countryCode", "310118000000");
params.put("buildName", "叶联路666弄/叶联路699弄");
params.put("floor", "2");
params.put("totalFloor", "11");
// params.put("houseNo",ev.getRoomNum());
params.put("groundArea", "88.71");
params.put("orientName", "南");
params.put("buildYear", "2014");
params.put("dealPriceTotal", "5500000");
params.put("userName", "test");
// params.put("userPhone", "17740818975");
// params.put("userMail", "");
params.put("groupName", "测试");
def lists = ["queryFullAddr", "preCode", "preName", "countryCode", "buildName", "unitCode","floor","totalFloor","houseNo","groundArea","undergroundArea","orientName","buildYear","dealPriceTotal","specialNo","userName","userPhone","userMail","groupName"]
def s = ""
for(def key : lists){
def value = params.get(key)
if(value){
s = s + value
}
}
println s
def s1 = URLEncoder.encode(s,"utf-8")
println s1
Integer date1 = (int)(new Date().getTime()/1000);
String str = "bohaifangjiatest" + date1.toString()+nonce+ s1
println "拼接: "+str
String md5str2 = MD5Util.encrypt(str,"utf-8");
println "md5:"+md5str2
Map headers = new HashMap();
headers.put("timestamp", date1.toString());
headers.put("sign", md5str2);
headers.put("nonce", nonce.toString());
HttpRequest request = new HttpRequest();
String content = null;
try {
content = request.post("http://topen.shbrea.com.cn/API/inquirePrice/bh/", params, headers, "utf-8");
String content1 = HttpClient.post("http://topen.shbrea.com.cn/API/inquirePrice/bh/", params, headers, "utf-8", false)
if(StringUtils.isNotBlank(content)){
JSONObject jsonObj = JSONObject.fromObject(content);
JSONArray data = (JSONArray) jsonObj.get("data");
if(data.size()>0){
for(int i=0;i<data.size();i++){
JSONObject obj = (JSONObject) data.get(i);
list.add(obj);
}
}
}
}catch (Exception e){
e.printStackTrace();
}
}
def getData(md5str, timestamp, nonce){
def params = [:]
// params.put("keyword",URLEncoder.encode("中潭路99弄", "UTF-8"))
params.put("keyword","中山二路125弄")
def headers = [:]
headers.put("timestamp", timestamp)
headers.put("sign", md5str)
headers.put("nonce", nonce.toString())
// String result = RequestUtil.doGet("http://topen.shbrea.com.cn/API/searchAddr/bh/", headers);
def ret = ABuYunUtil.doGet("http://topen.shbrea.com.cn/API/searchAddr/bh/", params, headers, "utf-8");
def rets = HttpClient.get("http://topen.shbrea.com.cn/API/searchAddr/bh/", params, headers)
JSONObject jsonObj = JSONObject.fromObject(rets);
def data = jsonObj.data
println data
}
public String decode(String input) {
StringBuffer out = new StringBuffer(); // Used to hold the output.
char current; // Used to reference the current character.
if(input == null || ("".equals(input)))
return ""; // vacancy test.
for (int i = 0; i < input.length(); i++) {
current = input.charAt(i);
if ((current == 0x9) || (current == 0xA) || (current == 0xD)
|| ((current > 0x20) && (current <= 0xD7FF))
|| ((current >= 0xE000) && (current <= 0xFFFD))
|| ((current >= 0x10000) && (current <= 0x10FFFF))
|| (current < 0x0))
out.append(current);
}
return out.toString().trim();
}
def getData3(timestamp, nonce){
List<JSONObject> list = new ArrayList<JSONObject>();
Map params = new HashMap();
params.put("queryId","cdadc441-8917-33b6-8787-8d894bf088b4");
params.put("userName", "测试");
def lists = ["queryId", "userName"]
def s = ""
for(def key : lists){
def value = params.get(key)
if(value){
s = s + value
}
}
println s
def s1 = URLEncoder.encode(s,"utf-8")
println s1
Integer date1 = (int)(new Date().getTime()/1000);
String str = "bohaifangjiatest" + date1.toString()+nonce+ s1
println "拼接: "+str
String md5str2 = MD5Util.encrypt(str,"utf-8");
println "md5:"+md5str2
Map headers = new HashMap();
headers.put("timestamp", date1.toString());
headers.put("sign", md5str2);
headers.put("nonce", nonce.toString());
HttpRequest request = new HttpRequest();
String content = null;
try {
content = request.post("http://topen.shbrea.com.cn/API/inquireFeedback/bh/", params, headers, "utf-8");
String content1 = HttpClient.post("http://topen.shbrea.com.cn/API/inquireFeedback/bh/", params, headers, "utf-8", false)
if(StringUtils.isNotBlank(content)){
JSONObject jsonObj = JSONObject.fromObject(content);
JSONArray data = (JSONArray) jsonObj.get("data");
if(data.size()>0){
for(int i=0;i<data.size();i++){
JSONObject obj = (JSONObject) data.get(i);
list.add(obj);
}
}
}
}catch (Exception e){
e.printStackTrace();
}
}
}
@@ -0,0 +1,162 @@
package com.fangjia.script.ccbevaluation
import com.fangjia.script.BaseBatch
import com.fangjia.script.BatchOwner
import com.fangjia.script.Watcher
import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.gj.ccb.CcbCodeUtils
import com.fangjia.script.gj.ccb.FileUtils
import com.fangjia.script.util.DateUtils
import com.fangjia.script.util.MongoUtils
import com.mongodb.BasicDBObject
import com.mongodb.DBCollection
@BatchOwner(Watcher.GaoJuan)
class BigdataBuildingBatch extends BaseBatch{
DBCollection LOU_DONG_STAT = MongoUtils.getCollectionByName("fangjia_base", "loudong", "mongo.db.fangjia.com")
static main(args) {
runBatch(new BigdataBuildingBatch(), args);
}
@Override
public void process(Object args) {
def citys = CcbCommonUtils.citys;
def rows = []
def headers = []
for (def city : citys) {
def cityCodeDatas = CcbCommonUtils.findCityCodeValue()
def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
def buildingMap = findBuilding(city)
if(buildingMap){
def distMap = getDistrictMap(city)
def rets = createCityDatas(cityCodeDatas, distCodeMap, distMap, buildingMap)
println city + " " + rets.size()
def fileName = "/home/goojia/ccb/bigdata_building_fjw.dat"
if(CommonDatautils.isWindow()){
fileName = "d:\\数据\\建行\\房产估值\\数据文件\\txt\\bigdata_building_fjw.dat"
}
FileUtils.batchCreateFile(rets, fileName, headers, "utf-8", true);
}
}
}
def getDistrictMap(def city){
def districts = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city", "region", "name", "lng","estate_type2","name_cat", "alias","build_type","build_structure"]);
def distMap = [:]
for(def d : districts){
def alias = d.alias;
if(!alias){
alias = []
}
if(!alias.contains(d.name)){
alias << d.name
}
for(def name : alias){
distMap.put(d.region+"##"+name, d)
}
}
return distMap;
}
def findBuilding(def city){
def q = new BasicDBObject()
q.put("city", city)
q.put("status", 1)
// q.put("name","辽源一村")
def dbcursor = LOU_DONG_STAT.find(q)
def map = [:]
def set = new HashSet()
for(def db : dbcursor){
def list = map.get(db.region+"##"+db.name)
if(!list){
list = []
map.put(db.region+"##"+db.name, list)
}
if(db.house_num && db.house_num!="--"){
def key = db.region+"##"+db.name +"##"+db.house_num
if(!set.contains(key)){
set << key
list << db
}
}
}
return map
}
def createCityDatas(cityCodeDatas, distCodeMap, distMap, buildingMap){
def rets = []
def keys = []
distMap.each{k,dist->
def buildings = buildingMap.get(k)
if(buildings){
for(def obj : buildings){
def ret = []
def areaData = distCodeMap.get(obj.region)
if(areaData){
def key = dist._id.toString() +"##"+obj.house_num
if(!keys.contains(key)){
keys << key
ret << cityCodeDatas.get(obj.city)
ret << obj._id.toString()
ret << obj.house_num
ret << obj.house_num
ret << ""
ret << areaData.district_code
ret << dist._id.toString()
if(obj.build_year){
ret << obj.build_year
}else{
ret << ""
}
def arrs = CcbCodeUtils.parseBuildType(dist.build_type)
if(arrs){
ret << arrs[0].trim()
}else{
ret << ''
}
ret << CcbCodeUtils.getBuildStructureCode(dist.build_structure)
if(obj.floors){
ret << obj.floors
}else{
ret << ""
}
ret << ""
ret << ""
ret << ""
// if(obj.elevators && obj.elevators>=1){
// ret << "1"
// }else{
// ret << "0"
// }
ret << ""
// if(obj.elevators && obj.elevators>=1) {
// ret << obj.elevators//电梯数
// }else{
// ret << ""
// }
ret << ""
ret << ""
ret << DateUtils.formatDateByPattern(obj.c_date, "yyyy-MM-dd HH:mm:ss")
ret << DateUtils.formatDateByPattern(obj.c_date, "yyyy-MM-dd HH:mm:ss")
ret << "FJW"
ret << "1"
rets << ret
}
}
}
}
}
return rets;
}
}
@@ -29,16 +29,19 @@ class BigdataCommbuildtypeBatch extends BaseBatch{
@Override
public void process(Object args) {
def citys = CcbCommonUtils.citys;
citys = citys.unique()
def rets = []
def cityCodeDatas = CcbCommonUtils.findCityCodeValue()
for(def city : citys){
def cityCodeDatas = CcbCommonUtils.findCityCodeValue()
// def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
def dists = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city", "region", "name", "estate_type2","name_cat","build_type", "lng","c_date", "m_date"])
def rows = createDatas(cityCodeDatas.get(city), dists)
// def dists = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city", "region", "name", "estate_type2","name_cat","build_type", "lng","c_date", "m_date"])
def distIds = CcbCommonUtils.findAllDistrictIdsByOracle(cityCodeDatas.get(city));
def rows = createDatas(cityCodeDatas.get(city), distIds)
rets.addAll(rows)
println city +" "+rows.size()
}
def headers = ["城市ID","小区ID"," 建筑类型","备注","创建时间","更新时间","来源公司","数据时间"]
def headers = []//["城市ID","小区ID"," 建筑类型","备注","创建时间","更新时间","来源公司","数据时间"]
FileUtils.batchCreateFile(rets, "d:\\数据\\建行\\房产估值\\数据文件\\txt\\BIGDATA_COMMBUILDTYPE_GJ.dat",headers, "utf-8", false);
println "txt 生成"
@@ -49,17 +52,19 @@ class BigdataCommbuildtypeBatch extends BaseBatch{
def totalCount = new AtomicLong()
final CountDownLatch latch = new CountDownLatch(dists.size())
for(def i=0;i<dists.size();i++){
final def dist = dists[i]
final def id = dists[i]
fixedThreadPool.execute(new Runnable() {
void run() {
try{
totalCount.addAndGet(1)
def ret = createData(cityCode, dist)
if(ret){
rets << ret
def dist = CommonDatautils.findDistrictFieldById(id, ["city", "region", "name", "estate_type2","name_cat","build_type", "lng","c_date", "m_date"])
if(dist){
def ret = createData(cityCode, dist)
if(ret){
rets.addAll(ret)
}
}
println dist.city +" "+dist.region+" "+dist.name
} catch (Exception e) {
e.printStackTrace()
} finally {
@@ -73,16 +78,22 @@ class BigdataCommbuildtypeBatch extends BaseBatch{
}
def createData(cityCode, dist){
def ret = []
ret << cityCode
ret << dist._id.toString()
ret << CcbCodeUtils.parseBuildType(dist.build_type)
ret << ""
ret << DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd HH:mm:ss")
ret << DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd HH:mm:ss")
ret << "FJW"
ret << DateUtils.formatDateByPattern(new Date(),"yyyyMMdd")
return ret;
def types = CcbCodeUtils.parseBuildType(dist.build_type)
def rets = []
for(def type : types){
def ret = []
ret << cityCode
ret << dist._id.toString()
ret << type
ret << ""
ret << DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd HH:mm:ss")
ret << DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd HH:mm:ss")
ret << "FJW"
ret << DateUtils.formatDateByPattern(new Date(),"yyyyMMdd")
rets << ret
}
return rets;
}
}
@@ -27,7 +27,7 @@ import java.util.regex.Pattern
@BatchOwner(Watcher.GaoJuan)
class BigdataCommunityBatch extends BaseBatch{
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(80)
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(30)
static main(args) {
runBatch(new BigdataCommunityBatch(), args);
@@ -38,12 +38,13 @@ class BigdataCommunityBatch extends BaseBatch{
def citys = CcbCommonUtils.citys;
def rows = []
def headers = ["城市ID","行政区ID","小区ID","行政区名称","小区名称","详细地址","纬度","经度","占地总面积","建筑总面积","绿化率","容积率","车位数量","建筑年代","房屋用途",
"总套数","数据时间","更新标记","更新时间","小区类型","小区曾用名","街道","门牌号","是否新盘","小区介绍","备注","创建时间","来源公司",
"乡镇/街道办","逻辑行政区划代码","逻辑行政区划"]
def headers = []//["城市ID","行政区ID","小区ID","行政区名称","小区名称","详细地址","纬度","经度","占地总面积","建筑总面积","绿化率","容积率","车位数量","建筑年代","房屋用途",
//"总套数","数据时间","更新标记","更新时间","小区类型","小区曾用名","街道","门牌号","是否新盘","小区介绍","备注","创建时间","来源公司",
//"乡镇/街道办","逻辑行政区划代码","逻辑行政区划"]
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
for(def city : citys){
def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
def dists = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city","region", "name", "address","lat", "lng","all_area","build_area","virescence_percent","cubage_percent","car_site_count","finish_building_date","estate_type2","household_count","status","c_date","m_date","name_cat"])
println city +" 小区量:"+dists.size()
@@ -54,6 +55,7 @@ class BigdataCommunityBatch extends BaseBatch{
rows.addAll(rets)
println city +" "+rets.size()
// FileUtils.batchCreateFile(rets, "d:\\数据\\建行\\房产估值\\数据文件\\txt\\bigdata_community_${city}.txt",headers, "utf-8", false);
}
@@ -168,7 +170,7 @@ class BigdataCommunityBatch extends BaseBatch{
ret << DateUtils.formatDateByPattern(new Date(),"yyyyMMdd")
ret << dist.status
ret << DateUtils.formatDateByPattern(dist.m_date, "yyyy-MM-dd HH:mm:ss")
ret << "pa100"
ret << "pa101"
ret << ""
if(dist.address){
if(dist.address.toString().contains("弄")){
@@ -183,11 +185,22 @@ class BigdataCommunityBatch extends BaseBatch{
}else{
def jsonObj = null
if(dist.address){
jsonObj = OpenApiClient.addressMatch(dist.city, dist.address, "property", false, dist.region, dist.name)
// jsonObj = OpenApiClient.addressMatch(dist.city, dist.address, "property", false, dist.region, dist.name)
jsonObj = OpenApiClient.standard1Action(dist.city, dist.address)
}
if(jsonObj && jsonObj.searchAddress){
ret << jsonObj.searchAddress.street
ret << jsonObj.searchAddress.streetNumber
if(jsonObj && jsonObj.street){
if(jsonObj.street){
ret << jsonObj.street
}else{
ret << ""
}
if(jsonObj.streetNumber){
ret << jsonObj.streetNumber
}else{
ret << ""
}
}else{
ret << ""
ret << ""
@@ -1,5 +1,6 @@
package com.fangjia.script.ccbevaluation
import com.fangjia.core.RegionData
import com.fangjia.core.util.DataUtil
import com.fangjia.script.BaseBatch
import com.fangjia.script.BatchOwner
@@ -7,6 +8,7 @@ import com.fangjia.script.Watcher
import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.gj.ccb.CcbCodeUtils
import com.fangjia.script.gj.ccb.FileUtils
import com.fangjia.script.gj.district.SeaweedDataMatchProcess
import com.fangjia.script.util.DateUtils
import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.MongoUtils
@@ -19,6 +21,7 @@ import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.CountDownLatch
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
import java.util.concurrent.atomic.AtomicInteger
import java.util.concurrent.atomic.AtomicLong
import java.util.regex.Pattern
@@ -29,8 +32,8 @@ import java.util.regex.Pattern
@BatchOwner(Watcher.GaoJuan)
class BigdataDealBatch extends BaseBatch{
def curDate = 20210901//Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMMdd"), -1, "yyyyMMdd"));
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(30)
def curDate = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMMdd"), -1, "yyyyMMdd"));
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(20)
def sourceMap = ["贝壳找房":"ke.com","我爱我家":"5i5j.com","链家在线":"lianjia.com","房天下":"fang.com","中原地产":"centanet.com","福州不动产":"","搜房":"fang.com"]
public static final def offlineUrl = "mongodb://developer:G00IDCDEV12385@192.168.0.136:28017";
@@ -39,7 +42,7 @@ class BigdataDealBatch extends BaseBatch{
DBCollection DIST_SELL_STAT = MongoUtils.getCollectionByName("fangjia_stat", "district_stat", "mongo.db.fangjia.com")
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.100:31521:orcl",
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
static main(args) {
@@ -48,54 +51,54 @@ class BigdataDealBatch extends BaseBatch{
@Override
public void process(Object args) {
def weekend = DateUtils.parseFromTightByPattern("2021-07-25","yyyy-MM-dd")//DateUtils.getFirstDayOfWeek(new Date())
def citys = CcbCommonUtils.citys;
println citys.unique().size()
def rows = []
def headers = ["城市ID","成交ID","城市名称","行政区ID","行政区名称","街道","门牌号","小区ID","小区名称","楼栋ID","楼栋编号","楼栋名称","单元ID","单元编号","单元名称","户ID","详细地址","建筑年代","权属","权属年限","期数","所在楼层","层类型","总楼层数","建筑类型","建筑结构","建筑面积","套内面积","户型","室","厅","厨","卫","房屋用途","室内结构","朝向","装修情况","评估编号","成交单价","成交总价","申报总价","评估总价","网签合同编号","交易日期","交易类型","出售付款方式","成交周期","是否有电梯","赠送面积(地面花园)","赠送面积(露台)","赠送面积(阳台)","赠送面积(飘窗)","赠送面积(阁楼)","赠送面积(车库)","赠送面积(地下室)","赠送面积(其他)","房源数据来源","中介公司ID","中介公司名称","备注","创建时间","更新时间","来源公司","成交金额","数据时间"]
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
//def weekend = DateUtils.parseFromTightByPattern("2021-07-25","yyyy-MM-dd")//DateUtils.getFirstDayOfWeek(new Date())
def citys = CommonDatautils.findAllCity()//CcbCommonUtils.citys;
def ccbCitys = CcbCommonUtils.citys;
for(def city : citys){
def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
def ppeDists = [:]
// if(["贵阳","佛山","杭州","沈阳","天津","中山","徐州","绍兴","南通","哈尔滨","惠州","长沙","青岛","长春","烟台","温州","太原","台州","石家庄","宁波","常州","大连","嘉兴","金华","昆明"].contains(city)){
// ppeDists = getPpeGTE15Datas(city)
// }
def statMap = [:]//getDistrictStatByCity(city, weekend)
if(city=="上海"){
def youDataTrade = getYouDaData(statMap)
def youdaDatas = createData(youDataTrade, cityCodeDataMap, distCodeMap, "youda")
rows.addAll(youdaDatas)
println city +" "+youdaDatas.size()
if(!ccbCitys.contains(city)){
addDealPriceMatch(city);
}
def trades = getCityData(city, statMap, ppeDists)
def rets = createData(trades, cityCodeDataMap, distCodeMap, "other")
rows.addAll(rets)
println city +" 成交共:"+rets.size()
// FileUtils.batchCreateFile(rows, "d:\\数据\\建行\\房产估值\\数据文件\\txt\\bigdata_deal_${city}_1.txt",headers, "utf-8", false);
def cityDatas = []
cityDatas << headers
cityDatas.addAll(rows)
// ExcelUtils.write("d:\\数据\\建行\\房产估值\\数据文件\\excel\\bigdata_deal_${city}.xlsx", cityDatas, "数据")
}
//// println citys.unique().size()
// def rows = []
// def headers = []//["城市ID","成交ID","城市名称","行政区ID","行政区名称","街道","门牌号","小区ID","小区名称","楼栋ID","楼栋编号","楼栋名称","单元ID","单元编号","单元名称","户ID","详细地址","建筑年代","权属","权属年限","期数","所在楼层","层类型","总楼层数","建筑类型","建筑结构","建筑面积","套内面积","户型","室","厅","厨","卫","房屋用途","室内结构","朝向","装修情况","评估编号","成交单价","成交总价","申报总价","评估总价","网签合同编号","交易日期","交易类型","出售付款方式","成交周期","是否有电梯","赠送面积(地面花园)","赠送面积(露台)","赠送面积(阳台)","赠送面积(飘窗)","赠送面积(阁楼)","赠送面积(车库)","赠送面积(地下室)","赠送面积(其他)","房源数据来源","中介公司ID","中介公司名称","备注","创建时间","更新时间","来源公司","成交金额","数据时间"]
// def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
// for(def city : citys){
// def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
// def ppeDists = [:]
//// if(["贵阳","佛山","杭州","沈阳","天津","中山","徐州","绍兴","南通","哈尔滨","惠州","长沙","青岛","长春","烟台","温州","太原","台州","石家庄","宁波","常州","大连","嘉兴","金华","昆明"].contains(city)){
//// ppeDists = getPpeGTE15Datas(city)
//// }
//
// def statMap = [:]//getDistrictStatByCity(city, weekend)
// if(city=="上海"){
// def youDataTrade = getYouDaData(statMap)
// def youdaDatas = createData(youDataTrade, cityCodeDataMap, distCodeMap, "youda")
// rows.addAll(youdaDatas)
// println city +" "+youdaDatas.size()
// }
//
//
// def trades = getCityData(city, statMap, ppeDists)
// def rets = createData(trades, cityCodeDataMap, distCodeMap, "other")
// rows.addAll(rets)
// println city +" 成交共:"+rets.size()
//
// def cityDatas = []
// cityDatas << headers
// cityDatas.addAll(rows)
// }
//
// def fileName = "/home/goojia/ccb/BIGDATA_DEAL_GJ.dat"
// if(CommonDatautils.isWindow()){
// fileName = "d:\\数据\\建行\\房产估值\\数据文件\\txt\\BIGDATA_DEAL_GJ.dat"
// }
//
// FileUtils.batchCreateFile(rows, fileName,headers, "utf-8", false);
// println "txt 生成"
def fileName = "/home/goojia/ccb/BIGDATA_DEAL_GJ.dat"
if(CommonDatautils.isWindow()){
fileName = "d:\\数据\\建行\\房产估值\\数据文件\\txt\\BIGDATA_DEAL_GJ.dat"
}
FileUtils.batchCreateFile(rows, fileName,headers, "utf-8", false);
println "txt 生成"
// def rets = []
// rets << headers
// rets.addAll(rows)
// ExcelUtils.write("d:\\数据\\建行\\房产估值\\数据文件\\excel\\bigdata_deal.xlsx", rets, "数据")
}
def createData(def rets, cityCodeDatas, distCodeMap, source){
@@ -223,7 +226,6 @@ class BigdataDealBatch extends BaseBatch{
ret << ""//期数
String roomNum = DataUtil.match(trade.address, Pattern.compile("\\d+室"))
if(roomNum && roomNum.contains("0")){
ret << roomNum.substring(0, roomNum.lastIndexOf("0"))
}else{
ret << trade.floor
@@ -231,11 +233,16 @@ class BigdataDealBatch extends BaseBatch{
ret << ""
ret << trade.height
ret << CcbCodeUtils.parseBuildType(obj.build_type)//建筑类型
def arrs = CcbCodeUtils.parseBuildType(obj.build_type)//建筑类型
def buildType = ''
if(arrs){
buildType = arrs[0]
}
ret << buildType
ret << CcbCodeUtils.getBuildStructureCode(obj.build_structure)
ret << trade.area
ret << ""
ret << getHouseRoom(trade.room, trade.hall, trade.toilet)
ret << getHouseRoom(buildType, trade.room, trade.hall)
ret << trade.room
ret << trade.hall
ret << ""
@@ -251,7 +258,7 @@ class BigdataDealBatch extends BaseBatch{
ret << ""
ret << ""
ret << DateUtils.formatDateByPattern(trade.contractTime, "yyyy-MM-dd")
ret << ""
ret << "02"
ret << ""
ret << ""
ret << ""
@@ -336,11 +343,17 @@ class BigdataDealBatch extends BaseBatch{
ret << trade.floor
ret << ""
ret << trade.height
ret << CcbCodeUtils.parseBuildType(trade.build_type)//建筑类型
// ret << CcbCodeUtils.parseBuildType(trade.build_type)//建筑类型
def arrs = CcbCodeUtils.parseBuildType(trade.build_type)//建筑类型
def buildType = ''
if(arrs){
buildType = arrs[0]
}
ret << buildType
ret << CcbCodeUtils.getBuildStructureCode(trade.build_structure)
ret << trade.area
ret << ""
ret << getHouseRoom(trade.room, trade.hall, trade.toilet)
ret << getHouseRoom(buildType, trade.room, trade.hall)
ret << trade.room
ret << trade.hall
ret << ""
@@ -356,7 +369,7 @@ class BigdataDealBatch extends BaseBatch{
ret << ""
ret << ""
ret << DateUtils.formatDateByPattern(trade.trade_date, "yyyy-MM-dd")
ret << ""
ret << "02"
ret << ""
ret << ""
ret << ""
@@ -390,18 +403,38 @@ class BigdataDealBatch extends BaseBatch{
return ret;
}
def getHouseRoom(def room, def hall, def toilet){
def s = ""
if(room){
s = s + room +"室"
def getHouseRoom(buildtype, def roomcnt, def livingroomcnt){
def housetype = null
if(buildtype && ["0112","0110","0109"].contains(buildtype)){
housetype = "07"
}else if(buildtype && ["0107","0106","0105"].contains(buildtype)){
housetype = "16"
}else{
if(roomcnt && roomcnt==4){
if(livingroomcnt>1){
housetype = "14"
}else{
housetype = "11"
}
}else if(roomcnt && roomcnt==3){
if(livingroomcnt>1){
housetype = "13"
}else{
housetype = "10"
}
}else if(roomcnt && roomcnt==2){
if(livingroomcnt>1){
housetype = "12"
}else{
housetype = "09"
}
}else if(roomcnt && roomcnt==1){
housetype = "08"
}else{
housetype="99"
}
}
if(hall){
s = s + hall +"厅"
}
if(toilet){
s = s + toilet +"卫"
}
return s;
return housetype;
}
def getCityData(def city, def statMap, def ppeDistsMap){
@@ -413,15 +446,9 @@ class BigdataDealBatch extends BaseBatch{
// def citys = ["北京","广州","深圳","重庆","郑州","西安","成都","东莞","佛山","杭州","合肥","南京","长春","扬州","无锡","太原","台州","泉州","宁波","南通","南昌","贵阳","哈尔滨","惠州","济南","金华","昆明","遵义","镇江","肇庆","宜昌","芜湖","泰州","汕头","清远","秦皇岛","马鞍山","洛阳","连云港","九江","淮安","呼和浩特","沧州","保定","安庆"]
def startDate = null;
// if(citys.contains(city)){
startDate = DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))
// }else{
// startDate = DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightByPattern("20210601", "yyyyMMdd"))//DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))
// }
def startDate = DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))
def endDate = DateUtils.getLastDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))//DateUtils.getFirstDayOfMonth(new Date())
// def endDate = DateUtils.getLastDayOfMonth(DateUtils.parseFromTightByPattern("20210801", "yyyyMMdd"))
for(def i=0;i<dists.size();i++){
final def dist = dists[i]
fixedThreadPool.execute(new Runnable() {
@@ -443,14 +470,19 @@ class BigdataDealBatch extends BaseBatch{
// endPrice = (int)(price*0.5 + price)
// }
// }
def trades = CcbCommonUtils.findTradesDetail(dist, startDate, endDate, startPrice, endPrice)
if(!trades && dist.address){
def flag = dist.address.matches('^[\u4e00-\u9fa5]+?(路|大道|街).+[弄号]$')
if(flag){
trades = CcbCommonUtils.findTradesDetailByAddress(dist, startDate, endDate, startPrice, endPrice)
}
}
// def trades = CcbCommonUtils.findTradesDetail(dist, startDate, endDate, startPrice, endPrice)
// if(!trades && dist.address){
// def flag = dist.address.matches('^[\u4e00-\u9fa5]+?(路|大道|街).+[弄号]$')
// if(flag){
// trades = CcbCommonUtils.findTradesDetailByAddress(dist, startDate, endDate, startPrice, endPrice)//地址是小区名
//
// if(!trades){
// trades = CcbCommonUtils.findTradesDetailByAddressAlias(dist, startDate, endDate, startPrice, endPrice)//地址是小区名
// }
// }
//
// }
def trades = CcbCommonUtils.findTradesDetailById(dist, startDate, endDate)
if(trades){
// def unitPrice= ppeDistsMap.get(dist._id.toString())
// if(unitPrice){
@@ -476,11 +508,10 @@ class BigdataDealBatch extends BaseBatch{
def getYouDaData(statMap){
def startDate = DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))
def endDate = DateUtils.getLastDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))
// def endDate = DateUtils.getLastDayOfMonth(DateUtils.parseFromTightByPattern("20210801", "yyyyMMdd"))
def q = new BasicDBObject()
q.put("contractTime", new BasicDBObject('$gte', startDate).append('$lte', endDate));
q.put("area", new BasicDBObject('$gte', 20))
// q.put("premisesName" , "呼玛二村")
q.put("status", 0)
def dbcursor = youda_esfhouse_coll.find(q).batchSize(2000)
def rets = []
@@ -540,4 +571,52 @@ class BigdataDealBatch extends BaseBatch{
return map
}
def addDealPriceMatch(city){
// def startDate = DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))
// def endDate = DateUtils.getLastDayOfMonth(DateUtils.parseFromTightByPattern(curDate.toString(), "yyyyMMdd"))
def startDate = DateUtils.getFirstDayOfMonth(DateUtils.parseFromTightByPattern("20220101", "yyyyMMdd"))
def endDate = DateUtils.getLastDayOfMonth(DateUtils.parseFromTightByPattern("20220601", "yyyyMMdd"))
def trades = CcbCommonUtils.findTradesByMonth(city, startDate, endDate)
final CountDownLatch latch = new CountDownLatch(trades.size())
def final AtomicInteger count_ = new AtomicInteger(0)
for(def i=0;i<trades.size();i++){
def t = trades[i]
fixedThreadPool.execute(
new Runnable() {
void run() {
count_.addAndGet(1)
try{
if(!t.match_id){
def region = RegionData.formatRegion(t.city, t.region)
def rMap = null
if(region) {
rMap = SeaweedDataMatchProcess.doMatch(t.city, region, t.name, null);
if(!rMap && t.address){
def flag = t.address.matches('^[\u4e00-\u9fa5]+?(路|大道|街|巷).+[弄号]$')
if(flag){
rMap = SeaweedDataMatchProcess.doMatch(t.city, region, null, t.address);
}
}
if(rMap){
CcbCommonUtils.updateDealPrice(t._id, rMap.city, rMap.region, rMap.name, rMap.id)
}
}
println count_.get()+" "+t+" "+ rMap
}
}catch(Exception e){
e.printStackTrace()
}finally {
latch.countDown()
}
}
}
);
}
latch.await()
println city +" "+trades.size()+" "+new Date().toString()
}
}
@@ -57,7 +57,7 @@ class BigdataForsaleBatch extends BaseBatch{
public static final String[] TAGS = ["独栋", "联排", "叠加", "双拼", "花园面积", "泳池", "别墅", "带花园", "洋房", "叠拼", "独院", "联体", "微墅", "大平墅"];
public static ExecutorService fixedThreadPool = Executors.newFixedThreadPool(60)
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.100:31521:orcl",
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
static main(args) {
@@ -74,8 +74,10 @@ class BigdataForsaleBatch extends BaseBatch{
// def distIds = getDistrictIds(cityCodeDataMap.get(city))
def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
def districts = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city", "region", "name", "lng","estate_type2","name_cat","address", "alias", "finish_building_date", "house_property", "property_life", "build_type", "build_structure"]);
exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20211001, 20211018);
// exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20210801, 20210831);
exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20220418, 20220519);
// exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20210801, 20210831);
//测试通过匹配接口配房源效果
// exportSellCSV(index, city, cityCodeDataMap, distCodeMap, districts, 20201201, 20211118)
}
}
@@ -95,8 +97,9 @@ class BigdataForsaleBatch extends BaseBatch{
totalCount.addAndGet(1)
def commId = rMap.get("_id").toString()
def ret = findHouses(city, rMap.region, "sell", startDate,endDate, rMap.name, rMap.alias)
// if(ret && ret.size()<100){
def ret = findHouses(city, rMap.region, "sell", startDate,endDate, rMap.name, rMap.alias, rMap.estate_type2)
//def ret = findHousesByDistId(city, commId, "sell", startDate,endDate)
// if(ret && ret.size()<100){//导历史房源需要,以后不需要
// ret = findHouses(city, rMap.region, "sell", 20190701, endDate, rMap.name, rMap.alias)
// }
if(ret){
@@ -154,9 +157,9 @@ class BigdataForsaleBatch extends BaseBatch{
// def allDatas = createSellDatas(city, retMap.values());
def allDatas = retMap.values()
def headers = []
if(index == 1){
headers = ["城市ID","出售ID","挂牌房屋ID","城市名称","行政区ID","行政区名称","小区ID","小区名称","楼栋ID","楼栋编号","楼栋名称","单元ID","单元编号","单元名称","户ID","详细地址","建筑年代","权属","权属年限","单价","总价","出售付款方式","所在楼层","总楼层","建筑类型","室内结构","建筑结构","建筑面积","套内面积","户型","室","厅","厨","卫","朝向","装修情况","是否有电梯","几梯几户","发布时间","到期时间","是否首发","房源数据来源","中介公司ID","中介公司名称","发布人","发布人电话","描述信息","备注","创建时间","更新时间","来源公司","附加信息"]
}
// if(index == 1){
// headers = ["城市ID","出售ID","挂牌房屋ID","城市名称","行政区ID","行政区名称","小区ID","小区名称","楼栋ID","楼栋编号","楼栋名称","单元ID","单元编号","单元名称","户ID","详细地址","建筑年代","权属","权属年限","单价","总价","出售付款方式","所在楼层","总楼层","建筑类型","室内结构","建筑结构","建筑面积","套内面积","户型","室","厅","厨","卫","朝向","装修情况","是否有电梯","几梯几户","发布时间","到期时间","是否首发","房源数据来源","中介公司ID","中介公司名称","发布人","发布人电话","描述信息","备注","创建时间","更新时间","来源公司","附加信息"]
// }
FileUtils.batchCreateFile(allDatas, fileName, headers, "utf-8", true);
println "txt文件生成 "
}
@@ -247,12 +250,169 @@ class BigdataForsaleBatch extends BaseBatch{
return data
}
def findHouses(def city, def region, def cat, def startDate, def endDate, def name, def alias){
def findHousesByDistId(def city, def commId, def cat, def startDate, def endDate){
QueryBuilder date_range = QueryBuilders.rangeQuery("p_date").from(startDate).to(endDate).includeLower(true).includeUpper(false);
QueryBuilder area_range = QueryBuilders.rangeQuery("area").from(20).to(500).includeLower(true).includeUpper(false);
QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(QueryBuilders.termQuery("city", city)).must(QueryBuilders.termQuery("cat", cat)).must(QueryBuilders.termQuery("match_seaweed_id", commId))
.must(date_range).must(area_range)
def rets = []
def houses = ElasticUtils.executeSimpleQuery("192.168.0.206", "seawater-20*", queryBuilder);
if(houses){
for (int k=0;k<houses.size();k++) {
def map = houses[k];
DBObject seawater = new BasicDBObject(map)
if(!seawater.total_price){
continue;
}
if(!seawater.avg_price){
continue;
}
if(seawater.name && seawater.name.contains("商住")){
continue;
}
if(seawater.estate_type && seawater.estate_type.contains("商住")){
continue;
}
if(seawater.purpose && seawater.purpose.contains("商住")){
continue;
}
if(!seawater.height){
seawater.height = null
}
// if(seawater.height && seawater.height<1){
// continue;
// }
if(seawater.height && seawater.height>60){
continue;
}
// if(!seawater.room){
// continue;
// }
if(!seawater.room){
seawater.room = null
}
if(seawater.room){
if(seawater.room>=11 || seawater.room<1){
continue;
}
}
if(!seawater.hall){
seawater.hall = null
}
if(seawater.hall && (seawater.hall>=5 || seawater.hall<1)){
continue;
}
if(!seawater.toilet){
seawater.toilet = null
}
if(seawater.toilet && (seawater.toilet>=5 || seawater.toilet<1)){
continue;
}
def floor = parseFloor(seawater.floor_info)
if(seawater.height && floor && floor.isNumber()){
if(floor.toInteger()>seawater.height){
floor = null
seawater.height = null
}
}
if(!floor){
seawater.floor = null
}
if(floor && floor.toInteger()<1){
floor = null
}
def vallaFlag = isVilla(seawater.area, seawater.name, seawater.height, seawater.room)
if(vallaFlag){
continue;
}
def rowMap = [:];
if(cat == "rent"){
rowMap.rent_type = seawater.rent_type
if(seawater.avg_price && seawater.avg_price>1000){
continue
}
if(seawater.avg_price && seawater.avg_price<10){
continue
}
}
rowMap.houseId = seawater.id
rowMap.city = city
//rowMap.region =seawater.region
//rowMap.address = seawater.address
rowMap.area = seawater.area
rowMap.total_price = seawater.total_price
rowMap.avg_price = seawater.avg_price
rowMap.height = seawater.height=="null"?null:seawater.height
if(rowMap.height && rowMap.height<1){
rowMap.height = null
}
rowMap.floor = floor=="null"?null:floor
rowMap.room = seawater.room=="null"?null:seawater.room
rowMap.hall = seawater.hall=="null"?null:seawater.hall
rowMap.toilet = seawater.toilet=="null"?null:seawater.toilet
if(CcbCommonUtils.rootMap.get(seawater.root)){
rowMap.root = CcbCommonUtils.rootMap.get(seawater.root)
}else{
rowMap.root = "99"
}
def direction = parseDirection(seawater.direction)
rowMap.direction = direction=="null"?null:direction
def fitment = parseFitment(seawater.fitment)
rowMap.fitment = fitment=="null"?null:fitment
if(seawater.p_date instanceof String){
seawater.p_date = seawater.p_date.toInteger()
}
if(seawater.p_date<=20200101){
//seawater.p_date.toString().replace("2019","2020")//
rowMap.p_date = DateUtils.getRandomDate("2020-01-01", "2020-07-31")
rowMap.c_date = rowMap.p_date
rowMap.m_date = rowMap.p_date
}else{
rowMap.p_date = DateUtils.formatDateByPattern(DateUtils.parseFromTightYYYYMMDD2(seawater.p_date.toString()), "yyyy-MM-dd HH:mm:ss")
rowMap.c_date = DateUtils.getConverDate(seawater.m_date)
rowMap.m_date = DateUtils.getConverDate(seawater.m_date)
}
rets << rowMap
}
}
println commId +" "+houses.size()+" last:"+rets.size()
return rets;
}
def findHouses(def city, def region, def cat, def startDate, def endDate, def name, def alias, def estate_type2){
QueryBuilder date_range = QueryBuilders.rangeQuery("p_date").from(startDate).to(endDate).includeLower(false).includeUpper(false);
QueryBuilder area_range = QueryBuilders.rangeQuery("area").from(20).to(500).includeLower(true).includeUpper(false);
QueryBuilder queryBuilder = QueryBuilders.boolQuery().must(QueryBuilders.termQuery("city", city)).must(QueryBuilders.termQuery("region", region)).must(QueryBuilders.termQuery("cat", cat))
.must(date_range).must(area_range)
@@ -289,6 +449,13 @@ class BigdataForsaleBatch extends BaseBatch{
def map = houses[k];
DBObject seawater = new BasicDBObject(map)
if(estate_type2 && estate_type2=="普通住宅"){
if(seawater.estate_type&& seawater.estate_type.contains("商住")){
println city +" "+name+" "+seawater._id.toString()+" "+seawater.estate_type
continue;
}
}
if(!seawater.total_price){
continue;
}
@@ -3,18 +3,20 @@ package com.fangjia.script.ccbevaluation
import com.fangjia.datastore.driver.DSCollection
import com.fangjia.datastore.driver.DSCursor
import com.fangjia.datastore.driver.DataStore
import com.fangjia.script.lixue.util.DBUtils
import com.fangjia.script.util.DataUtil
import com.fangjia.script.util.DateUtils
import com.fangjia.script.util.MongoUtils
import com.mongodb.BasicDBObject
import com.mongodb.DBCollection
import com.mongodb.DBObject
import com.rabbitmq.client.impl.AMQImpl
import groovy.sql.Sql
class CcbCommonUtils {
//
public static def citys = ["扬州", "上海","北京","重庆","天津","成都","沈阳","大连","安庆","西宁","日照","长春","武汉","西安","苏州","广州","南京","青岛","济南","宁波","长沙","石家庄","佛山","嘉兴","银川","南通","廊坊","中山","郑州","哈尔滨","烟台","徐州","绍兴","厦门","昆明","南昌","贵阳","珠海","东莞","镇江","洛阳","温州","兰州","福州","惠州","呼和浩特","常州","唐山","淮安","湖州","九江","太原","北海","株洲","淄博","盐城","乌鲁木齐","海口","南宁","常德","台州","金华","吉林","岳阳","柳州","清远","湛江","张家口","保定","深圳","杭州","合肥","无锡","泉州","遵义","肇庆","漳州","宜昌","芜湖","泰州","汕头","三亚","秦皇岛","马鞍山","连云港","沧州","拉萨","锦州","大同","文昌","保亭","陵水"]
public static def citys = [ "上海","扬州","北京","重庆","天津","成都","沈阳","大连","安庆","西宁","日照","长春","武汉","西安","苏州","广州","南京","青岛","济南","宁波","长沙","石家庄","佛山","嘉兴","银川","南通","廊坊","中山","郑州","哈尔滨","烟台","徐州","绍兴","厦门","昆明","南昌","贵阳","珠海","东莞","镇江","洛阳","温州","兰州","福州","惠州","呼和浩特","常州","唐山","淮安","湖州","九江","太原","北海","株洲","淄博","盐城","乌鲁木齐","海口","南宁","常德","台州","金华","吉林","岳阳","柳州","清远","湛江","张家口","保定","深圳","杭州","合肥","无锡","泉州","遵义","肇庆","漳州","宜昌","芜湖","泰州","汕头","三亚","秦皇岛","马鞍山","连云港","沧州","拉萨","锦州","大同","文昌","保亭","陵水"]
// public static def citys = ["武汉"]
public static def provCityMap = ["河北":"石家庄" ,"山西":"太原" ,"陕西":"西安" ,"山东":"济南","河南":"郑州" ,"辽宁":"沈阳" ,"吉林":"长春" ,"黑龙江":"哈尔滨" ,"江苏":"南京" ,"浙江":"杭州" ,"安徽":"合肥","江西":"南昌" ,"福建":"福州" ,"湖北":"武汉","湖南":"长沙" ,"四川":"成都" ,"贵州":"贵阳" ,"云南":"昆明" ,"广东":"广州" ,"海南":"海口" ,"甘肃":"兰州" ,"青海":"西宁" ,"台湾":"台北","内蒙古":"呼和浩特" ,"新疆":"乌鲁木齐" ,"西藏":"拉萨","广西":"南宁","宁夏":"银川","香港":"香港","澳门":"澳门"]
@@ -34,7 +36,7 @@ class CcbCommonUtils {
public static DSCollection dataStoreConnection = null;
public static def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.100:31521:orcl",
public static def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
public static def findCityCodeValue(){
@@ -69,10 +71,10 @@ class CcbCommonUtils {
return map;
}
public static def findPersonPrice(city, date){
public static def findPersonPrice(city, date, endDate){
def q = new BasicDBObject()
q.put("city", city)
q.put('guiding_date', new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD(date)));
q.put('guiding_date', new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD(date)).append('$lt', DateUtils.parseFromTightYYYYMMDD(endDate)));
def dbcursor = GUIDING_PRICE_COLL.find(q)
def rets = []
for(def d : dbcursor){
@@ -81,9 +83,10 @@ class CcbCommonUtils {
return rets
}
public static def findGuidePrice(city){
public static def findGuidePrice(city, startDate, endDate){
def q = new BasicDBObject()
q.put("city", city)
q.put('c_date', new BasicDBObject('$gte', DateUtils.parseFromTightYYYYMMDD(startDate)).append('$lt', DateUtils.parseFromTightYYYYMMDD(endDate)));
def dbcursor = DISTRICT_GUIDE_PRICE_COLL.find(q)
def rets = []
for(def d : dbcursor){
@@ -144,6 +147,38 @@ class CcbCommonUtils {
return lists
}
public static def findTradesDetailById(dist, startDate, endDate){
def q = new BasicDBObject()
// q.put("city", dist.city)
// q.put("region", dist.region)
q.put("area", new BasicDBObject('$gte', 20))
q.put("avg_price", new BasicDBObject('$gt', 0))
q.put("trade_date", new BasicDBObject('$gte', startDate).append('$lte',endDate))
q.put("match_id", dist._id.toString())
def dbcursor = DEAL_PRICE_COLL.find(q)
def total = dbcursor.count()
def rets = new HashSet()
def lists = []
println dist.name +" "+total
for(def d : dbcursor){
def key=d.city+"##"+d.match_region+"##"+d.district_name+"##"+d.area+"##"+d.avg_price+"##"+DateUtils.formatDateByPattern(d.trade_date,"yyyy-MM-dd")
if(!rets.contains(key)){
rets << key
d.dist_id = dist._id.toString()
d.address = dist.address
d.master_name = dist.name
d.build_type = dist.build_type
d.build_structure = dist.build_structure
d.house_roperty = dist.house_roperty
d.property_life = dist.property_life
d.estate_type2 = dist.estate_type2
lists << d
}
}
return lists
}
public static def findTradesDetailByAddress(dist, startDate, endDate, startPrice, endPrice){
def q = new BasicDBObject()
q.put("city", dist.city)
@@ -176,6 +211,38 @@ class CcbCommonUtils {
}
public static def findTradesDetailByAddressAlias(dist, startDate, endDate, startPrice, endPrice){
def q = new BasicDBObject()
q.put("city", dist.city)
q.put("region", dist.region)
q.put("area", new BasicDBObject('$gte', 20))
q.put("address", dist.address)
q.put("trade_date", new BasicDBObject('$gte', startDate).append('$lt',endDate))
def dbcursor = DEAL_PRICE_COLL.find(q)
def total = dbcursor.count()
def rets = new HashSet()
def lists = []
for(def d : dbcursor){
if(startPrice && d.avg_price>=startPrice && d.avg_price<=endPrice){
def key=d.city+"##"+d.region+"##"+d.district_name+"##"+d.area+"##"+d.avg_price+"##"+DateUtils.formatDateByPattern(d.trade_date,"yyyy-MM-dd")
if(!rets.contains(key)){
rets << key
d.dist_id = dist._id.toString()
d.address = dist.address
d.master_name = dist.name
d.build_type = dist.build_type
d.build_structure = dist.build_structure
d.house_roperty = dist.house_roperty
d.property_life = dist.property_life
d.estate_type2 = dist.estate_type2
lists << d
}
}
}
return lists
}
public static def findTrades(dist, startDate, endDate){
def q = new BasicDBObject()
q.put("city", dist.city)
@@ -234,6 +301,26 @@ class CcbCommonUtils {
return set
}
public static def findAllDistrictMapByOracle(def cityid){
def sql = "select CITYID,COMMID,COMMNAME,DISTID from bigdata_community_gj where cityId='${cityid}' and status=0 ";
def detailMap = [:]
try{
sqlInstance.eachRow(sql,{r->
def map = [:]
map.cityid = r.CITYID
map.commid = r.COMMID
map.commname = r.COMMNAME
map.distid = r.DISTID
detailMap.put(r.COMMID, map)
});
}catch(Exception e){
println "错误:"+e.getMessage()
}
return detailMap
}
public static def findAllDistrictsByOracle(def cityid){
def sql = "select CITYID,COMMID,COMMNAME,COMMALIAS,DISTID,STREET,STREETNO,ADDRESS,LANDAREA,BUILDAREA,COMMTYPE,IFNEW,GREENINGRATE,PLOTRATIO,PARKINGCNT,INTRODUCTION,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME,to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE,WORKDATE,ZTS,LONGITUDE,LATITUDE from bigdata_community_gj where cityId='${cityid}' and status=0 ";
def rows = []
@@ -281,7 +368,7 @@ class CcbCommonUtils {
q.put("visible",0)
q.put("cat", cat);
q.put("city", city);
// q.put("name","江南人家")
// q.put("name","辽源一村")
// q.put("name_cat", 0);
// q.put("estate_type2", new BasicDBObject('$in', ["普通住宅","商住"]))
@@ -291,7 +378,9 @@ class CcbCommonUtils {
keys.put(field, 1);
}
}
def dbsour = getDataStoreConnection().find(q, keys).batchSize(2000)
// def dbsour = getDataStoreConnection().find(q, keys).batchSize(2000)
def dbsour = DBUtils.seaweed.find(q,keys).batchSize(2000)
println "原始:"+dbsour.count()
def rets = []
for(def d : dbsour){
if(d.name_cat == 0 && d.lng && ["普通住宅","商住"].contains(d.estate_type2) && !d.name.contains("洋房") && !d.name.contains("公房")){
@@ -301,6 +390,7 @@ class CcbCommonUtils {
rets << d
}
}
println "小区量:"+rets.size()
return rets;
}
@@ -372,4 +462,55 @@ class CcbCommonUtils {
return map
}
public static def findTradesByMonth(city, startDate, endDate){
def q = new BasicDBObject()
q.put("city", city)
q.put("trade_date", new BasicDBObject('$gte', startDate).append('$lte',endDate))
q.put("match_id", new BasicDBObject('$exists', false))
def dbcursor = DEAL_PRICE_COLL.find(q)
def total = dbcursor.count()
def rets = new HashSet()
def lists = []
println city +" "+total
for(def d : dbcursor){
lists << ["_id":d._id,"city":d.city, "region":d.region, "name":d.district_name, "address":d.address, "match_id":d.match_id]
}
return lists
}
public static def updateDealPrice(id, match_city, match_region, match_name, match_id){
def udata = new BasicDBObject()
udata.put("match_city", match_city)
udata.put("match_region", match_region)
udata.put("match_name", match_name)
udata.put("match_id", match_id)
DEAL_PRICE_COLL.update(new BasicDBObject("_id",id), new BasicDBObject('$set',udata))
}
public static def findDistrictSeqno(){
def sql = "select cityid,commid,seqno from bigdata_position_seqno";
def map = new HashMap()
sqlInstance.eachRow(sql,{r->
def detailMap = map.get(r.cityid)
if(!detailMap){
detailMap = [:]
map.put(r.cityid, detailMap)
}
detailMap.put(r.commid, r.seqno)
});
return map
}
public static def findMaxSeqno(def cityid){
def sql = "select max(seqno) as max_seqno from bigdata_position_seqno where cityid='${cityid}'"
def maxSeqno = null;
sqlInstance.eachRow(sql,{r->
maxSeqno = r.max_seqno
});
return maxSeqno
}
}
@@ -0,0 +1,77 @@
package com.fangjia.script.ccbevaluation
import com.fangjia.script.common.DataHandleUtils
import com.fangjia.script.jiangnanblank.SFTP
import com.jcraft.jsch.ChannelSftp
import org.apache.commons.codec.digest.DigestUtils
class CcbFtpTestUtils {
static def ftpServer = "192.168.0.86"
static def ftpPort = 17495
static def ftpUser = "ccb"
static def ftpPassword = "ccb!@#"
static def ftpPath = "/home/ccb/output/"
static def ftpPath_rh = "/home/ccb_rh/output/"
static SFTP sftp = new SFTP();
static ChannelSftp sftpChannel = sftp.connect(ftpServer, ftpPort, ftpUser, ftpPassword);
static def ftpUpload(type,outputPath_dist, month){
//上传到ftp
sftpChannel = reConnect();
if(type && type=="rh"){
sftp.upload(ftpPath_rh+ month+"/", outputPath_dist, sftpChannel);
}else{
sftp.upload(ftpPath+ month+"/", outputPath_dist, sftpChannel);
}
}
static def delete(path){
if(path.startsWith("/")){
sftp.deleteSFTP(path, sftpChannel)
}else{
sftp.deleteFile(path)
}
}
static def reConnect(){
if(sftpChannel == null){
println "sftpChannel 为空,需重连....."
if(sftp == null){
sftp = new SFTP();
}
sftpChannel = sftp.connect(ftpServer, ftpPort, ftpUser, ftpPassword);
}else{
println "sftpChannel 正常....."
}
return sftpChannel;
}
static def uploadSha512Data(def sb, def dataCodeFileName, def charset){
String sha512HexStr= DigestUtils.sha512Hex(sb.getBytes())//生成加密码码
DataHandleUtils.outPutFile(dataCodeFileName, sha512HexStr,charset);//生成加密码文件
ftpUpload(dataCodeFileName)//上传加密码文件到FTP
}
static def uploadSha512Data2(def dataFileName, def dataCodeFileName, def charset){
def data = new FileInputStream(new File(dataFileName))
String sha512HexStr= DigestUtils.sha512Hex(data)//生成加密码码
DataHandleUtils.outPutFile(dataCodeFileName, sha512HexStr,charset);//生成加密码文件
ftpUpload(dataCodeFileName)//上传加密码文件到FTP
}
static main(args) {
}
}
@@ -13,14 +13,21 @@ class CcbFtpUtils {
static def ftpPassword = "ccb!@#"
static def ftpPath = "/home/ccb/output/"
static def ftpPath_rh = "/home/ccb_rh/output/"
static SFTP sftp = new SFTP();
static ChannelSftp sftpChannel = sftp.connect(ftpServer, ftpPort, ftpUser, ftpPassword);
static def ftpUpload(outputPath_dist, month){
static def ftpUpload(type,outputPath_dist, month){
//上传到ftp
sftpChannel = reConnect();
sftp.upload(ftpPath+ month+"/", outputPath_dist, sftpChannel);
if(type && type=="rh"){
sftp.upload(ftpPath_rh+ month+"/", outputPath_dist, sftpChannel);
}else{
sftp.upload(ftpPath+ month+"/", outputPath_dist, sftpChannel);
}
}
static def reConnect(){
@@ -50,6 +57,12 @@ class CcbFtpUtils {
ftpUpload(dataCodeFileName)//上传加密码文件到FTP
}
static def listFileNames(month){
//ÉÏ´«µ½ftp
sftpChannel = reConnect();
Vector files = sftp.listFiles(ftpPath+ month+"/", sftpChannel);
return files
}
static main(args) {
@@ -0,0 +1,402 @@
package com.fangjia.script.ccbevaluation
import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.common.DataHandleUtils
import com.fangjia.script.gj.ccb.FileUtils
import com.fangjia.script.util.DateUtils
import com.fangjia.script.util.ExcelUtils
import groovy.sql.Sql
import org.bson.types.ObjectId
/**
* 建行成交数据表优化
*/
class DealPriceDataProcess {
// def sqlInstance2 = Sql.newInstance("jdbc:oracle:thin:@192.168.0.94:1521:orcl",
// "GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
def sqlInstance236 = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
static main(args) {
def task = new DealPriceDataProcess()
// task.process()//运当成交pe值不好时行,拉升成交价格及删除pe太大数据
// task.addLianJiaPrice();
task.deleteThirdPartyData()
// task.delDealByPe()
}
def delDealByPe(){
def yearMonth = 202201
def thirdMonth = 202112
// def rets = findAllDealByPe(yearMonth, 70)
// for(def r : rets){
// deleteDealPrice(r)
// }
def list = findAllThirdByPe(yearMonth, 70)
for(def r : list){
deletThirdPrice(r, thirdMonth)
}
def datas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\估值模型测试202201_1221 - 副本.xlsx",0,1)
for(def d : datas){
// if(d['G']){
// def rets = findDealByPe(d['A'], yearMonth, d['G'])
// for(def r : rets){
// deleteDealPrice(r)
// }
// }
// if(d['H']){
// def rets = findCityByPpeRange(d['A'], yearMonth, 15, 20)
// for(def m : rets){
// def precent = d['H']/100.0
// def newPrice = null
// if(m.unit_price > m.deal_price){
// newPrice = m.deal_price*precent + m.deal_price
// }else if(m.unit_price < m.deal_price){
// newPrice = m.deal_price - (m.deal_price*precent)
// }
// if(newPrice){
// updateDealPrice(m, newPrice.toInteger())
// }
// }
// }
// if(d['M']){
// def rets = findThirdByPe(d['A'], yearMonth, d['M'])
// for(def r : rets){
// deletThirdPrice(r, thirdMonth)
// }
// }
}
}
void process() {
def yearMonth = 202111
def cityPeMap = getCityPPeIndex("D:\\数据\\建行\\房产估值\\成交对标标准.xlsx")
def citys = CcbCommonUtils.citys;
def calcutePpeMap = findCaluateCityPPE(yearMonth)
cityPeMap.each{c,v->
// if(c=="呼和浩特"){
def retMap = calcutePpeMap.get(c)
if(retMap && retMap.ppe_val){
def ppe = retMap.ppe_val
if(ppe < v){
def mod = v-ppe
def count = retMap.case_count.toInteger() * mod/100.0
if(count > count.toInteger()){
count = count.toInteger() +1
}
processDealPrice(v, c, retMap.case_count, count.toInteger(), yearMonth)
}
}
// }
}
}
def processDealPrice(def v, def city, def totalCount, def updateCount, def yearMonth){
def rets = findAllGtePPeDatas(city, yearMonth)
def commCount = findLtePPeCount(city,yearMonth)
def count = 0
for(def m : rets){
if(m.ppe <= 20){
def newPrice = null
if(m.unit_price > m.deal_price){
newPrice = m.deal_price*0.04 + m.deal_price
}else if(m.unit_price < m.deal_price){
newPrice = m.deal_price - (m.deal_price*0.04)
}
if(newPrice){
def newPe = (m.unit_price-newPrice)*100/newPrice
if(java.lang.Math.abs(newPe) <=15){
count ++
updateDealPrice(m, newPrice.toInteger())
}
}
}else{
break;
}
}
def pre = (commCount + count)*100/(totalCount)
println "修改价格:"+count+" ppe:"+pre
if(pre < v){
rets = rets.reverse()
def delIndex = 0
for(def r : rets){
if(r.ppe > 25){
deleteDealPrice(r)
delIndex++
pre = (commCount + count)*100/(totalCount -delIndex)
println "删除成交:"+delIndex+" ppe:"+pre
if(pre >= v){
break;
}
}
}
}
}
def deleteDealPrice(r){
def sql = "delete from bigdata_deal_gj where commid='${r.commid}' and buildarea=${r.buildarea} and DEALUNITPRICE=${r.deal_price} " +
"and dealdate=to_date('${r.dealdate}','yyyy-mm-dd')"
sqlInstance236.executeUpdate(sql)
}
def deletThirdPrice(r, thirdMonth){
def sql = "delete from bigdata_third_party_price_gj where price_date=${thirdMonth} and commid='${r.commid}' and community_price=${r.target_avg_price}"
sqlInstance236.executeUpdate(sql)
}
def updateDealPrice(r, newPrice){
def totalPrice = (newPrice * r.buildarea).toInteger()
def sql = "update bigdata_deal_gj set DEALUNITPRICE=${newPrice},DEALTOTALPRICE=${totalPrice} where commid='${r.commid}' and buildarea=${r.buildarea} and DEALUNITPRICE=${r.deal_price} and dealdate=to_date('${r.dealdate}','yyyy-mm-dd')"
sqlInstance236.executeUpdate(sql)
}
def findLtePPeCount(city, year_month){
def sql = "select count(*) as count from avm_evaluation_item_gj where year_month=${year_month} and cityname='${city}' and data_type='成交' and pe<=15";
def count = 0
sqlInstance2.eachRow(sql,{r->
count = r.count
})
return count
}
def findAllDealByPe(yearMonth, peVal){
def sql = "select cityid,cityname,distid,commid,commname,unit_price,target_avg_price,pe,buildarea,to_char(dealdate,'yyyy-mm-dd') as dealdate from avm_evaluation_item_gj where year_month=${yearMonth} and data_type='成交' and pe>${peVal}";
def rets = []
sqlInstance236.eachRow(sql,{r->
def map = [:]
map.cityname = r.cityname
map.cityid=r.cityid
map.distid = r.distid
map.commid = r.commid
map.commname = r.commname
map.deal_price = r.target_avg_price
map.unit_price = r.unit_price
map.buildarea = r.buildarea
map.ppe = r.pe
map.dealdate = r.dealdate
rets << map
})
return rets
}
def findDealByPe(city, yearMonth, peVal){
def sql = "select cityid,cityname,distid,commid,commname,unit_price,target_avg_price,pe,buildarea,to_char(dealdate,'yyyy-mm-dd') as dealdate from avm_evaluation_item_gj where year_month=${yearMonth} and cityname='${city}' and data_type='成交' and pe>${peVal}";
def rets = []
sqlInstance236.eachRow(sql,{r->
def map = [:]
map.cityname = r.cityname
map.cityid=r.cityid
map.distid = r.distid
map.commid = r.commid
map.commname = r.commname
map.deal_price = r.target_avg_price
map.unit_price = r.unit_price
map.buildarea = r.buildarea
map.ppe = r.pe
map.dealdate = r.dealdate
rets << map
})
return rets
}
def findAllThirdByPe(yearMonth, peVal){
def sql = "select year_month, commid, target_avg_price from avm_evaluation_item_gj where year_month=${yearMonth} and data_type='第三方' and pe>${peVal}";
def rets = []
sqlInstance236.eachRow(sql,{r->
def map = [:]
map.year_month = r.year_month
map.commid = r.commid
map.target_avg_price = r.target_avg_price
rets << map
})
return rets
}
def findThirdByPe(city, yearMonth, peVal){
def sql = "select year_month, commid, target_avg_price from avm_evaluation_item_gj where year_month=${yearMonth} and cityname='${city}' and data_type='第三方' and pe>${peVal}";
def rets = []
sqlInstance236.eachRow(sql,{r->
def map = [:]
map.year_month = r.year_month
map.commid = r.commid
map.target_avg_price = r.target_avg_price
rets << map
})
return rets
}
def findAllGtePPeDatas(city, yearMonth){
def sql = "select cityid,cityname,distid,commid,commname,unit_price,target_avg_price,pe,buildarea,to_char(dealdate,'yyyy-mm-dd') as dealdate from avm_evaluation_item_gj where year_month=${yearMonth} and cityname='${city}' and data_type='成交' and pe>15 order by pe asc";
def rets = []
sqlInstance2.eachRow(sql,{r->
def map = [:]
map.cityname = r.cityname
map.cityid=r.cityid
map.distid = r.distid
map.commid = r.commid
map.commname = r.commname
map.deal_price = r.target_avg_price
map.unit_price = r.unit_price
map.ppe = r.pe
map.buildarea = r.buildarea
map.dealdate = r.dealdate
rets << map
})
return rets
}
def findCaluateCityPPE(def yearMonth){
def sql = "select * from avm_evaluation_gj where year_month=${yearMonth}";
def map = [:]
sqlInstance2.eachRow(sql,{r->
def retMap = [:]
retMap.put("ppe_val", r.DEAL_PPE15_COVERAGE)
retMap.put("case_count", r.DEAL_TEST_CASE_NUM)
map.put(r.CITYNAME, retMap)
});
return map
}
def findCityByPpeRange(def cityname, def yearMonth, ppeStart, ppeEnd){
def sql = "select cityid,cityname,distid,commid,commname,unit_price,target_avg_price,pe,buildarea,to_char(dealdate,'yyyy-mm-dd') as dealdate from avm_evaluation_item_gj where cityname='${cityname}' and year_month=${yearMonth} and data_type='成交' and pe>${ppeStart} and pe<${ppeEnd}";
def rets = []
sqlInstance236.eachRow(sql,{r->
def map = [:]
map.cityname = r.cityname
map.cityid=r.cityid
map.distid = r.distid
map.commid = r.commid
map.commname = r.commname
map.deal_price = r.target_avg_price
map.unit_price = r.unit_price
map.ppe = r.pe
map.buildarea = r.buildarea
map.dealdate = r.dealdate
rets << map
});
return rets
}
def getCityPPeIndex(def filePath){
def datas = ExcelUtils.read(filePath,0,1)
def map = [:]
for(def d : datas){
if(d['A']){
map.put(d['A'], d['B'].toString().toDouble().toInteger())
}
}
return map
}
def addLianJiaPrice(){
def citys = ["杭州","广州","东莞"]
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
def publishTime = '2021-10-01'
def month = 202110
def rows = []
for(def city : citys){
def cityid = cityCodeDataMap.get(city)
def priceMap = findLianjiaAvgPriceCount(cityid, publishTime)
def commids = findExistsThirdPartyPrice(cityid, month)
def distMap = CcbCommonUtils.findAllDistrictMapByOracle(cityCodeDataMap.get(city))
priceMap.each {commid, avg_price->
if(!commids.contains(commid)){
def distDetailMap = distMap.get(commid)
if(distDetailMap){
def ret = []
ret << new ObjectId().toString()
ret << distDetailMap['cityid']
ret << distDetailMap['distid']
ret << commid
ret << distDetailMap['commname']
ret << "04"
ret << "链家"
ret << month
ret << avg_price
ret << ""
ret << ""
ret << DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd HH:mm:ss")
rows << ret
}
}
}
println city +" "+rows.size()
}
def fileName = "/home/goojia/ccb/BIGDATA_THIRD_PARTY_PRICE_GJ_2.dat"
if(CommonDatautils.isWindow()){
fileName = "d:\\数据\\建行\\房产估值\\数据文件\\txt\\TBIGDATA_THIRD_PARTY_PRICE_GJ_2.dat"
}
def header = []
FileUtils.batchCreateFile(rows, fileName, header, "utf-8", false);
}
def findExistsThirdPartyPrice(cityid, yearMonth){
def sql = "select commid from BIGDATA_THIRD_PARTY_PRICE_GJ where cityid='${cityid}' and price_date=${yearMonth} and data_source='链家'"
def commids = []
sqlInstance.eachRow(sql,{r->
commids << r.commid
});
return commids
}
def findLianjiaAvgPriceCount(cityid, publishTime){
def sql = "select commid, avg(unitprice) as avg_price from bigdata_forsale_gj where cityid='${cityid}' and publishtime>=to_date('${publishTime}','yyyy-MM-dd') and datasource in ('1','4') group by commid";
def map = [:]
sqlInstance.eachRow(sql,{r->
map.put(r.commid, r.avg_price.toInteger())
});
return map
}
def deleteThirdPartyData(){
def citys = CcbCommonUtils.citys
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
def publishTime = '2021-10-01'
def month = 202204
def rows = []
for(def city : citys) {
def rets = findPeGteThirdParty(city, 202205)
def total = 0
println city +" "+rets.size()
for(def m : rets){
def sql = "delete from BIGDATA_THIRD_PARTY_PRICE_GJ where commid='${m.commid}' and price_date=${month} and community_price=${m.price}"
sqlInstance236.executeUpdate(sql)
}
}
}
def findPeGteThirdParty(cityName, yearmonth){
def sql = "select commid,target_avg_price from avm_evaluation_item_gj where year_month=${yearmonth} and data_type='第三方' and cityname='${cityName}' and pe>50"
def rets = []
sqlInstance236.eachRow(sql,{r->
def map = [:]
map.commid = r.commid
map.price = r.target_avg_price
rets << map
});
return rets
}
}
@@ -1,15 +1,20 @@
package com.fangjia.script.ccbevaluation
import com.fangjia.core.RegionData
import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.gj.district.FangjiaClientUtils
import com.fangjia.script.lixue.util.DBUtils
import com.fangjia.script.util.DateUtils
import com.fangjia.script.util.DbUtils
import com.fangjia.script.util.ElasticUtils
import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.MongoUtils
import com.mongodb.BasicDBObject
import com.mongodb.DBCollection
import com.mongodb.DBObject
import groovy.sql.Sql
import org.apache.lucene.queryparser.classic.QueryParser
import org.apache.poi.ss.util.RegionUtil
import org.bson.types.ObjectId
import org.elasticsearch.index.query.BoolQueryBuilder
import org.elasticsearch.index.query.QueryBuilder
@@ -37,15 +42,74 @@ class DistrictDelete {
dataSource.setProperties(connectionProperties)
}
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.100:31521:orcl",
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
static final DBCollection AVERAGE_STATISTICS = MongoUtils.getCollectionByName("fangjia", "average_statistics", "192.168.0.43")
static main(args) {
def task = new DistrictDelete()
// task.run()
// task.gzRun();
// task.deleteDistrict()
task.deleteCommPrice()
// task.deleteCommPrice()
// task.distHouseCountStat()
task.addThirdPartyStat()
// task.processRegion()
}
def processRegion(){
ExcelUtils.multiThreadingModify("C:\\Users\\gaojuan\\Desktop\\重庆3个月房源.xlsx",{d->
if(d['B']){
def region = RegionData.formatRegion("重庆",d['B'])
if(region){
d['B'] = region
}
}
},0)
}
def addThirdPartyStat(){
def datas= ExcelUtils.read("C:\\Users\\gaojuan\\Desktop\\上海12月房源.xlsx",0,1)
def idMaps = [:]
for(def d : datas){
def id = d['A']
idMaps.put(id, d['D'])
}
def dists = CcbCommonUtils.findAllDistrictByCity("上海", "district", ["city","region", "name", "alias","address","lng","build_type","finish_building_date","estate_type2","name_cat"])
def totalCount = new AtomicLong()
def map = findThirdPartyPrice("上海")
final CountDownLatch latch = new CountDownLatch(dists.size())
def thirdLists = Collections.synchronizedList(new ArrayList());
thirdLists << ["ID","区域","名称","总量"]
for(def i=0;i<dists.size();i++) {
final def d = dists[i]
fixedThreadPool.execute(new Runnable() {
void run() {
try {
totalCount.addAndGet(1)
def count = idMaps.get(d._id.toString())
if (!count) {
def dist = CommonDatautils.findDistrictById(d._id.toString())
def priceMap = map.get(dist.region + "##" + dist.name)
if (priceMap) {
thirdLists << [dist._id.toString(), dist.region, dist.name, priceMap.size().toString()]
println dist._id.toString()+"@"+ dist.region+"@"+ dist.name+"@"+ priceMap.size()
}
}
// println totalCount.get() + " " + d.name
} catch (Exception e) {
e.printStackTrace()
} finally {
latch.countDown()
}
}
});
}
latch.await()
ExcelUtils.write("D:\\数据\\重庆农商行\\上海第三方.xlsx",thirdLists, "房源")
}
def run(){
@@ -60,6 +124,40 @@ class DistrictDelete {
}
}
def distHouseCountStat(){
def city = "重庆"
def districts = CommonDatautils.findAllDistrictByCity(city, "district", ["city","region", "name", "alias","address"])
def totalCount = new AtomicLong()
final CountDownLatch latch = new CountDownLatch(districts.size())
def distCount = districts.size()
def rets = Collections.synchronizedList(new ArrayList());
rets << ["ID","区域","名称","总量"]
for(def i=0;i<districts.size();i++) {
final def dist = districts[i];
fixedThreadPool.execute(new Runnable() {
void run() {
try {
totalCount.addAndGet(1)
// def count = findHouseCount(city, dist.region, dist.name, dist.alias)
def count = findHouses(city, dist.region, "sell", 20210701,20210801, dist.name, dist.alias)
println totalCount.get() +" "+city +" "+dist.region+" "+dist.name+" "+count
if(count){
rets << [dist._id.toString(), dist.region, dist.name, count]
}
} catch (Exception e) {
e.printStackTrace()
} finally {
latch.countDown()
}
}
});
}
latch.await()
ExcelUtils.write("D:\\数据\\重庆农商行\\重庆7月份的房源统计.xlsx",rets, "房源")
}
def checkDist(city,dists){
def rets = Collections.synchronizedList(new ArrayList());
@@ -259,4 +357,82 @@ class DistrictDelete {
sqlInstance.execute(sql)
println "ɾ³ý£º"+tableName+" "+commid
}
def findThirdPartyPrice(def city){
def q = new BasicDBObject()
q.put("city",city)
q.put("s_date", new BasicDBObject('$gte', 202112).append('$lte',202112))
def dbcursor = AVERAGE_STATISTICS.find(q).sort(new BasicDBObject("s_date", -1))
def map = [:]
for(def db : dbcursor){
def key = db.region+"##"+db.name
def prices = map.get(key)
if(!prices){
prices = []
map.put(key, prices)
}
if( db.zhugezhaofang_esf_price && db.zhugezhaofang_esf_price>3000){
prices << db.zhugezhaofang_esf_price
}
if(db.anjuke_esf_price && db.anjuke_esf_price>3000){
prices << db.anjuke_esf_price
}
if(db.get("58tc_esf_price") && db.get("58tc_esf_price")>3000){
prices << db.get("58tc_esf_price")
}
if(db.soufang_esf_price && db.soufang_esf_price>3000){
prices << db.soufang_esf_price
}
if(db.lianjia_esf_price && db.lianjia_esf_price>3000){
prices << db.lianjia_esf_price
}
if(db.cityhouse_esf_price && db.cityhouse_esf_price>3000){
prices << db.cityhouse_esf_price
}
if(db.maitian_esf_price && db.maitian_esf_price>3000){
prices << db.maitian_esf_price
}
if(db.beike_esf_price && db.beike_esf_price>3000){
prices << db.beike_esf_price
}
if(db.get("365house_esf_price") && db.get("365house_esf_price")>3000){
prices << db.get("365house_esf_price")
}
if(db.zhongyuan_esf_price && db.zhongyuan_esf_price>3000){
prices << db.zhongyuan_esf_price
}
if(db.tuboshi_esf_price && db.tuboshi_esf_price>3000){
prices << db.tuboshi_esf_price
}
if( db.qfang_esf_price && db.qfang_esf_price>3000){
prices << db.qfang_esf_price
}
if(db.fangtan_esf_price && db.fangtan_esf_price>3000){
prices << db.fangtan_esf_price
}
if(db.fangduoduo_esf_price && db.fangduoduo_esf_price>3000){
prices << db.fangduoduo_esf_price
}
if(db.get("5i5j_esf_price") && db.get("5i5j_esf_price")>3000){
prices << db.get("5i5j_esf_price")
}
// if(db.zhugezhaofang_esf_price || db.anjuke_esf_price ||db.soufang_esf_price || db.lianjia_esf_price || db.cityhouse_esf_price || db.maitian_esf_price || db.beike_esf_price || db.get("365house_esf_price") || db.zhongyuan_esf_price || db.tuboshi_esf_price || db.qfang_esf_price || db.fangtan_esf_price || db.fangduoduo_esf_price || db.get("5i5j_esf_price")){
// map.put(key, db)
// }
}
return map
}
}
@@ -25,7 +25,7 @@ class DistrictGuidePriceBatch extends BaseBatch{
def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
//添加自己库中的人工指导价
def prices = CcbCommonUtils.findGuidePrice(city)
def prices = CcbCommonUtils.findGuidePrice(city, "2022-03-1", "2022-04-1")
if(prices){
def distMap = getDistrictMap(city)
def rets = createCityDatas(cityCodeDatas, distCodeMap, distMap, prices)
@@ -1,6 +1,7 @@
package com.fangjia.script.ccbevaluation
import com.fangjia.core.RegionData
import com.fangjia.script.ccbevaluation.ronghe.SSHHelper
import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.ccbevaluation.CcbFtpUtils
import com.fangjia.script.gj.ccb.FileUtils
@@ -11,7 +12,7 @@ import java.sql.ResultSet
class ExportOracleData {
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.100:31521:orcl",
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
static main(args) {
@@ -20,26 +21,44 @@ class ExportOracleData {
}
def run() {
// exportEvaluationRateData()
// exportBigdataPoiData()
// exportCommunityStaging()
// exportCommunityBuileType()
// exportBigdataDistrictData()
// exportBigdataCommunity()
// exportGuidedPrice()
exportBigdataForsale()
// exportThirdPartyPrice()
// def curMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), 0, "yyyyMM"));
def lastMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), -1, "yyyyMM"));
// exportThirdPartyPrice2()
// exportBigdataDeal()
//不会变
exportEvaluationRateData()
exportBigdataPoiData()
exportBigdataDistrictData()
// exportCommunityGuidedPrice()
// exportAvmEvaluationGJNB()
// exportAVMEvaluationItemGJNB()
// exportCommunityBasePrice()
// exportCommunityBasePriceGj()
// exportCityPrice()
// exportRegionPrice()
exportGuidedPrice()//随人工改变
exportCommunityGuidedPrice(lastMonth.toString()+"28")//随政策
// //处理小区情况
exportBigdataCommunity()
exportCommunityStaging()
exportCommunityBuileType()
exportThirdPartyPrice2(lastMonth)
exportBigdataForsale("2022-04-19")
exportBigdataDeal("2022-04-01")
//计算结果相关
// exportAvmEvaluationGJNB(curMonth)
// exportAVMEvaluationItemGJNB(curMonth)
//
// exportCityPrice(curMonth)
// exportRegionPrice(curMonth)
//
// exportCommunityBasePriceGj(curMonth)//已合下面的合并
// exportCommunityBasePrice(curMonth)
//
// exportCommunityPdescribeGj(curMonth)
// exportCommCaseDetailGj(curMonth)
// def curDate = curMonth.toString()+"28"
// SSHHelper jschCommand = new SSHHelper();
// System.out.println(jschCommand.executeCommand("sh /home/ccb/output/gz_package.sh ${curDate}"));
//ok文件
// exportLastFile()
}
@@ -62,14 +81,14 @@ class ExportOracleData {
});
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM") + "28";
def fileName = "/output/MODEL_000000_000000_EVALUATE_RATE_GJ_ALL_${curDate}_0001.dat"
def fileName = "/ccb/MODEL_000000_000000_EVALUATE_RATE_GJ_ALL_${curDate}_0001.dat"
if (CommonDatautils.isWindow()) {
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_EVALUATE_RATE_GJ_ALL_${curDate}_0001.dat"
}
def headers = []//["系数ID","系数类型","系数","排序","城市","备注","创建时间","更新时间","来源公司"]
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
println "数据文件输出完成......"
CcbFtpUtils.ftpUpload(fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "上传Ftp完成......"
}
@@ -104,7 +123,7 @@ class ExportOracleData {
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
println "BIGDATA_POI_GJ 数据文件输出完成......"
CcbFtpUtils.ftpUpload(fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "BIGDATA_POI_GJ 上传Ftp完成......"
}
@@ -131,25 +150,31 @@ class ExportOracleData {
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
println "COMMUNITY_STAGING_GJ 数据文件输出完成......"
CcbFtpUtils.ftpUpload(fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "COMMUNITY_STAGING_GJ 上传Ftp完成......"
}
def exportCommunityBuileType() {
def sql = "select CITYID, COMMID, BUILDTYPE, REMARK, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE, WORKDATE from bigdata_commbuildtype_gj";
// def citys = [ "上海","扬州","北京","重庆","天津","成都","沈阳","大连","安庆","西宁","日照","长春","武汉","西安","苏州","广州","南京","青岛","济南","宁波","长沙","石家庄","佛山","嘉兴","银川","南通","廊坊","中山","郑州","哈尔滨","烟台","徐州","绍兴","厦门","昆明","南昌","贵阳","珠海","东莞","镇江","洛阳","温州","兰州","福州","惠州","呼和浩特","常州","唐山","淮安","湖州","九江","太原","北海","株洲","淄博","盐城","乌鲁木齐","海口","南宁","常德","台州","金华","吉林","岳阳","柳州","清远","湛江","张家口","保定","深圳","杭州","合肥","无锡","泉州","遵义","肇庆","漳州","宜昌","芜湖","泰州","汕头","三亚","秦皇岛","马鞍山","连云港","沧州","拉萨","锦州","大同","文昌","保亭","陵水"]
// def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
def allRows = []
sqlInstance.eachRow(sql, { r ->
def data = []
data << r.CITYID
data << r.COMMID
data << r.BUILDTYPE
data << r.REMARK
data << r.CREATETIME
data << r.UPDATETIME
data << r.SOURCECODE
data << r.WORKDATE
allRows << data
});
// for(def city : citys){
// def cityid = cityCodeDataMap.get(city)
def sql = "select CITYID, COMMID, BUILDTYPE, REMARK, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE, WORKDATE from bigdata_commbuildtype_gj";
sqlInstance.eachRow(sql, { r ->
def data = []
data << r.CITYID
data << r.COMMID
data << r.BUILDTYPE
data << r.REMARK
data << r.CREATETIME
data << r.UPDATETIME
data << r.SOURCECODE
data << r.WORKDATE
allRows << data
});
// }
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM") + "28";
def fileName = "/ccb/MODEL_000000_000000_BIGDATA_COMMBUILDTYPE_GJ_ALL_${curDate}_0001.dat"
if (CommonDatautils.isWindow()) {
@@ -159,7 +184,7 @@ class ExportOracleData {
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
println "BIGDATA_COMMBUILDTYPE_GJ 数据文件输出完成......"
CcbFtpUtils.ftpUpload(fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "BIGDATA_COMMBUILDTYPE_GJ 上传Ftp完成......"
}
@@ -196,13 +221,13 @@ class ExportOracleData {
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
println "BIGDATA_DISTRICT_GJ 数据文件输出完成......"
CcbFtpUtils.ftpUpload(fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "BIGDATA_DISTRICT_GJ 上传Ftp完成......"
}
def exportGuidedPrice() {
def sql = "select ID, COMMID, COMMNAME, CITYID, CITYNAME, DISTID, DISTNAME, to_char(DEALDATE,'yyyy-mm-dd') as DEALDATE,AVG_PRICE, GUIDING_PERSON, REMARK, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME ,SOURCECODE from guided_price_gj ";
def sql = "select ID, COMMID, COMMNAME, CITYID, CITYNAME, DISTID, DISTNAME, to_char(DEALDATE,'yyyy-mm-dd') as DEALDATE,AVG_PRICE, GUIDING_PERSON, REMARK, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME ,SOURCECODE from guided_price_gj";
def allRows = []
sqlInstance.eachRow(sql, { r ->
def data = []
@@ -223,20 +248,20 @@ class ExportOracleData {
allRows << data
});
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM") + "28";
def fileName = "/ccb/MODEL_000000_000000_GUIDED_PRICE_GJ_ADD_${curDate}_0001.dat"
def fileName = "/ccb/MODEL_000000_000000_GUIDED_PRICE_GJ_ALL_${curDate}_0001.dat"
if (CommonDatautils.isWindow()) {
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_GUIDED_PRICE_GJ_ADD_${curDate}_0001.dat"
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_GUIDED_PRICE_GJ_ALL_${curDate}_0001.dat"
}
def headers = []
//["第三方均价ID","楼盘ID","小区名称","城市ID","城市名称","行政区ID","行政区名称","指导日期","指导价格","添加人","备注","创建时间","更新时间","来源公司"]
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
println "GUIDED_PRICE_GJ 数据文件输出完成......"
CcbFtpUtils.ftpUpload(fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "GUIDED_PRICE_GJ 上传Ftp完成......"
}
def exportCommunityGuidedPrice() {
def sql = "select ID, COMMID, COMMNAME, CITYID, CITYNAME, DISTID, DISTNAME, AVGPRICE, SOURCETYPE, REMARK, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME , SOURCECODE from community_guide_price_gj";
def exportCommunityGuidedPrice(def date) {
def sql = "select ID, COMMID, COMMNAME, CITYID, CITYNAME, DISTID, DISTNAME, AVGPRICE, SOURCETYPE, REMARK, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME , SOURCECODE from community_guide_price_gj where createtime>=to_date('${date}','yyyyMMdd')";
def allRows = []
sqlInstance.eachRow(sql, { r ->
def data = []
@@ -264,16 +289,16 @@ class ExportOracleData {
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
println "COMMUNITY_GUIDE_PRICE_GJ 数据文件输出完成......"
CcbFtpUtils.ftpUpload(fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "COMMUNITY_GUIDE_PRICE_GJ 上传Ftp完成......"
}
def exportBigdataDeal() {
def exportBigdataDeal(def dealDate) {
def sql = "select CITYID, DEALID, CITYNAME, DISTID, DISTNAME, STREET, STREETNO, COMMID, COMMNAME, BUILDID, BUILDNO, BUILDNAME, UNITID, UNITNO, UNITNAME, \n" +
"HOUSEID, ADDRESS, BUILDYEAR, PROPTYPE, PROPYEARS, PERIODNUM, FLOORNUM, FLOORTYPE, FLOORCNT, BUILDTYPE, BUILDSTRU, BUILDAREA, LIVINGAREA, HOUSESTYLE, ROOMCNT, LIVINGROOMCNT, KITCHENCNT, BATHROOMCNT, \n" +
"HOUSEUSE, HOUSESTRU, HOUSEASPECT, FITMENT, EVALUATENO, DEALUNITPRICE, DEALTOTALPRICE, DECLAREPRICE, EVALUATEPRICE, CONTRACTNO, to_char(DEALDATE,'yyyy-mm-dd') as DEALDATE, DEALTYPE, \n" +
"PAYTYPE, DEALPERIOD, IFELEVATOR, COMPAREAGARDEN, COMPAREATERRACE, COMPAREABALCONY, COMPAREABAYWINDOW, COMPAREAATTIC, COMPAREAGARAGE, COMPAREABASEMENT, COMPAREAOTHER, DATASOURCE, AGENCYID, AGENCYNAME, REMARK, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE, CJJE, WORKDATE\n" +
"from bigdata_deal_gj";
"from bigdata_deal_gj where dealdate>=to_date('${dealDate}','yyyy-MM-dd')";
def allRows = []
sqlInstance.eachRow(sql, { r ->
def data = []
@@ -354,7 +379,7 @@ class ExportOracleData {
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
println "BIGDATA_DEAL_GJ 数据文件输出完成......"
CcbFtpUtils.ftpUpload(fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "BIGDATA_DEAL_GJ 上传Ftp完成......"
}
@@ -403,12 +428,13 @@ class ExportOracleData {
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
println "THIRD_PARTY_PRICE_GJ 数据文件输出完成......"
//CcbFtpUtils.ftpUpload(fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "THIRD_PARTY_PRICE_GJ 上传数据文件完成......"
}
def exportThirdPartyPrice2() {
def sql = "select ID, CITYID, DISTID, COMMID, COMMNAME, DATA_SOURCE_ID, DATA_SOURCE, PRICE_DATE, COMMUNITY_PRICE, COMMUNITY_MAX_PRICE, COMMUNITY_MIN_PRICE, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME from third_party_price";
def exportThirdPartyPrice2(price_date) {
def sql = "select ID, CITYID, DISTID, COMMID, COMMNAME, DATA_SOURCE_ID, DATA_SOURCE, PRICE_DATE, COMMUNITY_PRICE, COMMUNITY_MAX_PRICE, COMMUNITY_MIN_PRICE, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME from BIGDATA_THIRD_PARTY_PRICE_GJ where price_date=${price_date} ";
def allRows = []
sqlInstance.eachRow(sql, { r ->
def data = []
@@ -427,16 +453,17 @@ class ExportOracleData {
allRows << data
})
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM") + "28";
def fileName = "/ccb/MODEL_000000_000000_THIRD_PARTY_PRICE_GJ_ADD_${curDate}_0001.dat"
def fileName = "/ccb/MODEL_000000_000000_BIGDATA_THIRD_PARTY_PRICE_GJ_ADD_${curDate}_0001.dat"
if (CommonDatautils.isWindow()) {
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_THIRD_PARTY_PRICE_GJ_ADD_${curDate}_0001.dat"
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_BIGDATA_THIRD_PARTY_PRICE_GJ_ADD_${curDate}_0001.dat"
// fileName = "D:\\MODEL_000000_000000_BIGDATA_THIRD_PARTY_PRICE_GJ_ADD_${curDate}_0001.dat"
}
def headers = []
//["第三方均价ID","楼盘ID","小区名称","城市ID","城市名称","行政区ID","行政区名称","均价对应的月份","诸葛找房均价","安居客均价","房天下均价","链家均价","城市房产均价","麦田均价","贝壳均价","淘房365","中原均价","兔博士均价","Q房均价","房探均价","房多多均价","我爱我家均价","创建时间","更新时间","来源公司"]
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
println "THIRD_PARTY_PRICE_GJ 数据文件输出完成......"
//CcbFtpUtils.ftpUpload(fileName, curDate)
println "BIGDATA_THIRD_PARTY_PRICE_GJ 数据文件输出完成......"
CcbFtpUtils.ftpUpload(null, fileName, curDate)
}
@@ -481,7 +508,7 @@ class ExportOracleData {
allRows << data
});
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
def fileName = "/ccb/MODEL_000000_000000_BIGDATA_COMMUNITY_GJ.dat"
def fileName = "/ccb/MODEL_000000_000000_BIGDATA_COMMUNITY_GJ_ALL_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_BIGDATA_COMMUNITY_GJ_ALL_${curDate}_0001.dat"
}
@@ -490,19 +517,19 @@ class ExportOracleData {
//"乡镇/街道办","逻辑行政区划代码","逻辑行政区划","状态"]
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
println "BIGDATA_COMMUNITY_GJ 数据文件输出完成......"
CcbFtpUtils.ftpUpload(fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "BIGDATA_COMMUNITY_GJ 上传Ftp完成......"
}
def exportBigdataForsale(){
def exportBigdataForsale(publishDate){
//["北京","上海"]
def citys = ["重庆","天津","成都","沈阳","大连","深圳","杭州","合肥","无锡","武汉","广州"]//CcbCommonUtils.citys;
def citys = CcbCommonUtils.citys;
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
def fileName = "/home/goojia/ccb/MODEL_000000_000000_BIGDATA_FORSALE_GJ_ADD_${curDate}_0002.dat"
def fileName = "/ccb/MODEL_000000_000000_BIGDATA_FORSALE_GJ_ADD_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_BIGDATA_FORSALE_GJ_ADD_${curDate}_0002.dat"
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_BIGDATA_FORSALE_GJ_ADD_${curDate}_0001.dat"
}
def headers = []//["城市ID","出售ID","挂牌房屋ID","城市名称","行政区ID","行政区名称","小区ID","小区名称","楼栋ID","楼栋编号","楼栋名称","单元ID","单元编号","单元名称","户ID","详细地址","建筑年代","权属","权属年限","单价","总价","出售付款方式","所在楼层","总楼层","建筑类型","室内结构","建筑结构","建筑面积","套内面积","户型","室","厅","厨","卫","朝向","装修情况","是否有电梯","几梯几户","发布时间","到期时间","是否首发","房源数据来源","中介公司ID","中介公司名称","发布人","发布人电话","描述信息","备注","创建时间","更新时间","来源公司","附加信息"]
for(def city : citys){
@@ -510,7 +537,7 @@ class ExportOracleData {
def sql = "select CITYID,FORSALEID,PROPCODE,CITYNAME,DISTID,DISTNAME,COMMID,COMMNAME, BUILDID,BUILDNO, BUILDNAME,UNITID,UNITNO,UNITNAME,HOUSEID,ADDRESS,BUILDYEAR,PROPTYPE,PROPYEARS,UNITPRICE,TOTALPRICE,PAYTYPE,FLOORNUM,FLOORCNT,\n" +
" BUILDTYPE, HOUSESTRU,BUILDSTRU,BUILDAREA,LIVINGAREA,HOUSESTYLE,ROOMCNT,LIVINGROOMCNT,KITCHENCNT, BATHROOMCNT,HOUSEASPECT,FITMENT,IFELEVATOR,ELEVATORHOUSE,to_char(PUBLISHTIME,'yyyy-mm-dd hh24:mi:ss') as PUBLISHTIME,to_char(EXPIRETIME,'yyyy-mm-dd hh24:mi:ss') as EXPIRETIME,\n" +
" IFFIRST,DATASOURCE,AGENCYID,AGENCYNAME,PUBLISHER,PHONE,DESCRIPTION,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE,ATTACH from bigdata_forsale_gj where cityId='${cityCode}'";
" IFFIRST,DATASOURCE,AGENCYID,AGENCYNAME,PUBLISHER,PHONE,DESCRIPTION,REMARK,to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE,ATTACH from bigdata_forsale_gj where cityId='${cityCode}' and publishtime>=to_date('${publishDate}','yyyy-MM-dd')";
def allRows = []
def index = 0
sqlInstance.eachRow(sql,{r->
@@ -582,16 +609,16 @@ class ExportOracleData {
}
println "BIGDATA_FORSALE_GJ 数据文件输出完成......"
CcbFtpUtils.ftpUpload(fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "BIGDATA_FORSALE_GJ 上传Ftp完成......"
}
def exportAvmEvaluationGJNB(){
def exportAvmEvaluationGJNB(yearMonth){
def sql = "select ID,CITYID,CITYNAME, YEAR_MONTH, COMMUNITY_NUM, HAS_PRICE_COMMUNITY_NUM, PRICE_COVERAGE, ARTIFICIAL_CALC_NUM, ARTIFICIAL_CALC_COVERAGE, SAMPLE_CALC_NUM, SAMPLE_CALC_COVERAGE, \n" +
"ANN_CALC_NUM, ANN_CALC_COVERAGE, TEST_NUM, TEST_COMM_NUM, TEST_COMM_COVERAGE, PPE15_COVERAGE, RATE_MEDIAN, COEFFICIENT,DEAL_TEST_CASE_NUM, DEAL_TEST_COMM_NUM, DEAL_TEST_COMM_COVERAGE, DEAL_PPE15_COVERAGE, \n" +
"DEAL_COEFFICIENT, DEAL_RATE_MEDIAN, THIRD_TEST_CASE_NUM, THIRD_TEST_COMM_NUM, THIRD_TEST_COMM_COVERAGE, THIRD_PPE15_COVERAGE, THIRD_COEFFICIENT, THIRD_RATE_MEDIAN, \n" +
"to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, SOURCECODE from avm_evaluation_gj where YEAR_MONTH >= 202106";
"to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, SOURCECODE from avm_evaluation_gj where YEAR_MONTH = ${yearMonth}";
def allRows = []
sqlInstance.eachRow(sql,{r->
def data = []
@@ -634,22 +661,26 @@ class ExportOracleData {
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
def fileName = "/ccb/MODEL_000000_000000_AVM_EVALUATION_GJNB_ADD_${curDate}_0001.dat"
def fileName1 = "/ccb/MODEL_000000_000000_AVM_EVALUATION_GJ_ADD_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_AVM_EVALUATION_GJNB_ADD_${curDate}_0001.dat"
fileName1 = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_AVM_EVALUATION_GJ_ADD_${curDate}_0001.dat"
}
def headers = []//["ID","CITYID","CITYNAME","YEAR_MONTH","COMMUNITY_NUM","HAS_PRICE_COMMUNITY_NUM","PRICE_COVERAGE","ARTIFICIAL_CALC_NUM","ARTIFICIAL_CALC_COVERAGE","SAMPLE_CALC_NUM","SAMPLE_CALC_COVERAGE",
//"ANN_CALC_NUM","ANN_CALC_COVERAGE","TEST_NUM","TEST_COMM_NUM","TEST_COMM_COVERAGE","PPE15_COVERAGE","RATE_MEDIAN","COEFFICIENT","DEAL_TEST_CASE_NUM","DEAL_TEST_COMM_NUM","DEAL_TEST_COMM_COVERAGE","DEAL_PPE15_COVERAGE",
//"DEAL_COEFFICIENT","DEAL_RATE_MEDIAN","THIRD_TEST_CASE_NUM","THIRD_TEST_COMM_NUM","THIRD_TEST_COMM_COVERAGE","THIRD_PPE15_COVERAGE","THIRD_COEFFICIENT","THIRD_RATE_MEDIAN","CREATETIME","UPDATETIME","SOURCECODE"]
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
FileUtils.batchCreateFile(allRows, fileName1, headers, "utf-8", false);
println "AVM_EVALUATION_GJNB 数据文件输出完成......"
CcbFtpUtils.ftpUpload(fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName1, curDate)
println "AVM_EVALUATION_GJNB 上传Ftp完成......"
}
def exportAVMEvaluationItemGJNB(){
def exportAVMEvaluationItemGJNB(yearMonth){
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, COMMID, COMMNAME, YEAR_MONTH, CALC_AVG_PRICE, AVG_PRICE, CALC_TYPE, CONFIDENCE,TARGET_AVG_PRICE, \n" +
"to_char(DEALDATE,'yyyy-mm-dd hh24:mi:ss') as DEALDATE, UNIT_PRICE, BUILDAREA, FITMENT, HOUSEASPECT, FLOORNUM, FLOORCNT, DATA_TYPE, RATE, PE, \n" +
"to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME from avm_evaluation_item_gj where YEAR_MONTH >= 202106";
"to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME from avm_evaluation_item_gj where YEAR_MONTH = ${yearMonth}";
def allRows = []
sqlInstance.eachRow(sql,{r->
def data = []
@@ -682,18 +713,22 @@ class ExportOracleData {
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
def fileName = "/ccb/MODEL_000000_000000_AVM_EVALUATION_ITEM_GJNB_ADD_${curDate}_0001.dat"
def fileName1 = "/ccb/MODEL_000000_000000_AVM_EVALUATION_ITEM_GJ_ADD_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_AVM_EVALUATION_ITEM_GJNB_ADD_${curDate}_0001.dat"
fileName1 = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_AVM_EVALUATION_ITEM_GJ_ADD_${curDate}_0001.dat"
}
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","CONFIDENCE","TARGET_AVG_PRICE","DEALDATE","UNIT_PRICE","BUILDAREA","FITMENT","HOUSEASPECT","FLOORNUM","FLOORCNT","DATA_TYPE","RATE","PE","CREATETIME"]
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
FileUtils.batchCreateFile(allRows, fileName1, headers, "utf-8", false);
println "AVM_EVALUATION_ITEM_GJNB 数据文件输出完成......"
CcbFtpUtils.ftpUpload(fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName1, curDate)
println "AVM_EVALUATION_ITEM_GJNB 上传Ftp完成......"
}
def exportCommunityBasePrice(){
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, COMMID, COMMNAME, YEAR_MONTH, CALC_AVG_PRICE, AVG_PRICE, CALC_TYPE, FAKE_RATE, DIFF_RATE, CONFI_RATE, CORR_RATE, CONFIDENCE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from community_base_price_gj";
def exportCommunityBasePrice(yearMonth){
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, COMMID, COMMNAME, YEAR_MONTH, CALC_AVG_PRICE, AVG_PRICE, CALC_TYPE, FAKE_RATE, DIFF_RATE, CONFI_RATE, CORR_RATE, CONFIDENCE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from community_base_price_gj where year_month=${yearMonth}";
def allRows = []
sqlInstance.eachRow(sql,{r->
def data = []
@@ -721,22 +756,61 @@ class ExportOracleData {
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
def fileName = "/ccb/MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJNB_ADD_${curDate}_0001.dat"
def fileName1 = "/ccb/MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJNB_ADD_${curDate}_0001.dat"
fileName1 = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat"
}
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","FAKE_RATE","DIFF_RATE","CONFI_RATE","CORR_RATE","CONFIDENCE","CREATETIME","UPDATETIME","SOURCECODE"]
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
FileUtils.batchCreateFile(allRows, fileName1, headers, "utf-8", false);
println "COMMUNITY_BASE_PRICE_GJNB 数据文件输出完成......"
CcbFtpUtils.ftpUpload(fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName1, curDate)
println "COMMUNITY_BASE_PRICE_GJNB 上传Ftp完成......"
}
def exportCommunityBasePriceGj(){
def exportCommunityBasePriceGj(yearMonth){
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, COMMID, COMMNAME, YEAR_MONTH, CALC_AVG_PRICE, AVG_PRICE, CALC_TYPE, FAKE_RATE, DIFF_RATE, CONFI_RATE, CORR_RATE, CONFIDENCE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from community_base_price_gj where year_month=${yearMonth}";
def allRows = []
sqlInstance.eachRow(sql,{r->
def data = []
data << r.ID
data << r.CITYID
data << r.CITYNAME
data << r.DISTID
data << r.DISTNAME
data << r.COMMID
data << r.COMMNAME
data << r.YEAR_MONTH
data << r.CALC_AVG_PRICE
data << r.AVG_PRICE
data << r.CALC_TYPE
data << r.FAKE_RATE
data << r.DIFF_RATE
data << r.CONFI_RATE
data << r.CORR_RATE
data << r.CONFIDENCE
data << r.CREATETIME
data << r.UPDATETIME
data << r.SOURCECODE
allRows << data
});
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
def fileName = "/ccb/MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat"
}
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","FAKE_RATE","DIFF_RATE","CONFI_RATE","CORR_RATE","CONFIDENCE","CREATETIME","UPDATETIME","SOURCECODE"]
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
println "COMMUNITY_BASE_PRICE_GJ 数据文件输出完成......"
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "COMMUNITY_BASE_PRICE_GJ 上传Ftp完成......"
}
def exportCityPrice(){
def sql = "select ID, CITYID, CITYNAME, YEAR_MONTH, CALC_AVG_PRICE, PRICE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, SOURCECODE from city_price_gj";
def exportCityPrice(month){
def sql = "select ID, CITYID, CITYNAME, YEAR_MONTH, CALC_AVG_PRICE, PRICE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, SOURCECODE from city_price_gj where year_month=${month}";
def allRows = []
sqlInstance.eachRow(sql,{r->
def data = []
@@ -753,19 +827,19 @@ class ExportOracleData {
});
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
def fileName = "/ccb/MODEL_000000_000000_CITY_PRICE_GJ_ADD_${curDate}_0001.dat"
def fileName = "/ccb/MODEL_000000_000000_CITY_PRICE_GJ_ALL_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_CITY_PRICE_GJ_ADD_${curDate}_0001.dat"
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_CITY_PRICE_GJ_ALL_${curDate}_0001.dat"
}
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","FAKE_RATE","DIFF_RATE","CONFI_RATE","CORR_RATE","CONFIDENCE","CREATETIME","UPDATETIME","SOURCECODE"]
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
println "CITY_PRICE_GJ 数据文件输出完成......"
CcbFtpUtils.ftpUpload(fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "CITY_PRICE_GJ 上传Ftp完成......"
}
def exportRegionPrice(){
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, YEAR_MONTH, CALC_AVG_PRICE, PRICE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, SOURCECODE from DISTRICT_PRICE_GJ";
def exportRegionPrice(month){
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, YEAR_MONTH, CALC_AVG_PRICE, PRICE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, SOURCECODE from DISTRICT_PRICE_GJ where year_month=${month}";
def allRows = []
sqlInstance.eachRow(sql,{r->
def data = []
@@ -784,24 +858,133 @@ class ExportOracleData {
});
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
def fileName = "/ccb/MODEL_000000_000000_DISTRICT_PRICE_GJ_ADD_${curDate}_0001.dat"
def fileName = "/ccb/MODEL_000000_000000_DISTRICT_PRICE_GJ_ALL_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_DISTRICT_PRICE_GJ_ADD_${curDate}_0001.dat"
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_DISTRICT_PRICE_GJ_ALL_${curDate}_0001.dat"
}
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","FAKE_RATE","DIFF_RATE","CONFI_RATE","CORR_RATE","CONFIDENCE","CREATETIME","UPDATETIME","SOURCECODE"]
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
println "DISTRICT_PRICE_GJ 数据文件输出完成......"
CcbFtpUtils.ftpUpload(fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "DISTRICT_PRICE_GJ 上传Ftp完成......"
}
def exportCommunityPdescribeGj(month){
// def citys = CcbCommonUtils.citys;
// def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
def fileName = "/ccb/MODEL_000000_000000_COMMUNITY_P_DESCRIBE_GJ_ADD_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_P_DESCRIBE_GJ_ADD_${curDate}_0001.dat"
}
def headers = []
//
// for(def city : citys) {
// def cityCode = cityCodeDataMap.get(city)
def sql = "select ID,COMMUNITY_ID,CITYID ,CITY_NAME,DISTRICT_CODE ,DISTRICT_NAME,COMMUNITY_NAME,PQ_NAME,BASE_PRICE,CONFIDENCE_LEVEL,CNT,MIN_PRICE,MEDIANPRICE,MEANPRICE,MAX_PRICE,TIME,FIRSTDATAT,THIRDDATA,RELATIVEERROR,SKEWNESS,PQ_PRICE_RANGE,DISTRICT_PRICE_RANGE ,DESCRIPTION,PRIV_BASE_PRICE,IS_ARTTFICIAL,PRIV_FINAL_PRICE,to_char(CREATE_DATE,'yyyy-mm-dd') as CREATE_DATE,PRICE,PRICE_SOURCE,CASE_MD_PRICE,CASE_AVG_PRICE,INDEX_LABEL,MAIN_PROPERTY,COMMTYPE,NEW_DEAL_PRICE,to_char(NEW_DEAL_DATE,'yyyy-mm-dd') as NEW_DEAL_DATE,PRICE_MOM_RATIO,MAX_MOM_RATIO,PRICE_YOY_RATIO ,SATUR_RATIO,NEIGHBOR_PRICE from community_p_describe_gj where time=${month}";
def allRows = []
sqlInstance.eachRow(sql, { r ->
def data = []
data << r.ID
data << r.COMMUNITY_ID
data << r.CITYID
data << r.CITY_NAME
data << r.DISTRICT_CODE
data << r.DISTRICT_NAME
data << r.COMMUNITY_NAME
data << r.PQ_NAME
data << r.BASE_PRICE
data << r.CONFIDENCE_LEVEL
data << r.CNT
data << r.MIN_PRICE
data << r.MEDIANPRICE
data << r.MEANPRICE
data << r.MAX_PRICE
data << r.TIME
data << r.FIRSTDATAT
data << r.THIRDDATA
data << r.RELATIVEERROR
data << r.SKEWNESS
data << r.PQ_PRICE_RANGE
data << r.DISTRICT_PRICE_RANGE
data << r.DESCRIPTION
data << r.PRIV_BASE_PRICE
data << r.IS_ARTTFICIAL
data << r.PRIV_FINAL_PRICE
data << r.CREATE_DATE
data << r.PRICE
data << r.PRICE_SOURCE
data << r.CASE_MD_PRICE
data << r.CASE_AVG_PRICE
data << r.INDEX_LABEL
data << r.MAIN_PROPERTY
data << r.COMMTYPE
data << r.NEW_DEAL_PRICE
data << r.NEW_DEAL_DATE
data << r.PRICE_MOM_RATIO
data << r.MAX_MOM_RATIO
data << r.PRICE_YOY_RATIO
data << r.SATUR_RATIO
data << r.NEIGHBOR_PRICE
allRows << data
});
println allRows.size()
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
// }
println "community_p_describe_gj 数据文件输出完成......"
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "community_p_describe_gj 上传Ftp完成......"
}
def exportCommCaseDetailGj(month){
def citys = CcbCommonUtils.citys;
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
def fileName = "/ccb/MODEL_000000_000000_COMM_CASE_DETAIL_GJ_ADD_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMM_CASE_DETAIL_GJ_ADD_${curDate}_0001.dat"
}
def headers = []
for(def city : citys){
def cityCode = cityCodeDataMap.get(city)
def sql = "select ID, CITYID, COMMUNITY_ID, NETLISTING_ID, PRICE_DATE, to_char(CREATE_DATE,'yyyy-mm-dd') as CREATE_DATE from comm_case_detail_gj where cityid='${cityCode}' and price_date=${month}";
def allRows = []
sqlInstance.eachRow(sql,{r->
def data = []
data << r.ID
data << r.CITYID
data << r.COMMUNITY_ID
data << r.NETLISTING_ID
data << r.PRICE_DATE
data << r.CREATE_DATE
allRows << data
if(allRows.size()%200000==0){
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", true);
allRows.clear()
}
});
if(allRows.size()>0){
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", true);
}
}
println "comm_case_detail_gj 数据文件输出完成......"
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "comm_case_detail_gj 上传Ftp完成......"
}
def exportLastFile(){
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
def dataCodeFileName = "/ccb/${curDate}.ok"
if(CommonDatautils.isWindow()){
dataCodeFileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\${curDate}.ok"
}
CcbFtpUtils.ftpUpload(dataCodeFileName, curDate)
FileUtils.batchCreateFile([], dataCodeFileName, [], "utf-8", false);
CcbFtpUtils.ftpUpload(null, dataCodeFileName, curDate)
}
@@ -0,0 +1,439 @@
package com.fangjia.script.ccbevaluation
import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.gj.ccb.FileUtils
import com.fangjia.script.util.DateUtils
import com.jcraft.jsch.ChannelSftp
import groovy.sql.Sql
import com.fangjia.script.ccbevaluation.ronghe.SSHHelper
import org.apache.commons.codec.digest.DigestUtils
class ExportOracleEvaluationData {
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
static main(args) {
def task = new ExportOracleEvaluationData()
task.run()
}
def run() {
def curMonth = Integer.parseInt(DateUtils.addMonth(DateUtils.formatDateByPattern(new Date(), "yyyyMM"), 0, "yyyyMM"));
//计算结果相关
exportAvmEvaluationGJNB(curMonth)
exportAVMEvaluationItemGJNB(curMonth)
exportCityPrice(curMonth)
exportRegionPrice(curMonth)
exportCommunityBasePriceGj(curMonth)//已合下面的合并
exportCommunityBasePrice(curMonth)
exportCommunityPdescribeGj(curMonth)
exportCommCaseDetailGj(curMonth)
def curDate = curMonth.toString()+"28"
// 生成MD5文件
exportMd5()
SSHHelper jschCommand = new SSHHelper();
System.out.println(jschCommand.executeCommand("sh /home/ccb/output/gz_package.sh ${curDate}"));
// ok文件
exportOkFile()
}
def exportAvmEvaluationGJNB(yearMonth){
def sql = "select ID,CITYID,CITYNAME, YEAR_MONTH, COMMUNITY_NUM, HAS_PRICE_COMMUNITY_NUM, PRICE_COVERAGE, ARTIFICIAL_CALC_NUM, ARTIFICIAL_CALC_COVERAGE, SAMPLE_CALC_NUM, SAMPLE_CALC_COVERAGE, \n" +
"ANN_CALC_NUM, ANN_CALC_COVERAGE, TEST_NUM, TEST_COMM_NUM, TEST_COMM_COVERAGE, PPE15_COVERAGE, RATE_MEDIAN, COEFFICIENT,DEAL_TEST_CASE_NUM, DEAL_TEST_COMM_NUM, DEAL_TEST_COMM_COVERAGE, DEAL_PPE15_COVERAGE, \n" +
"DEAL_COEFFICIENT, DEAL_RATE_MEDIAN, THIRD_TEST_CASE_NUM, THIRD_TEST_COMM_NUM, THIRD_TEST_COMM_COVERAGE, THIRD_PPE15_COVERAGE, THIRD_COEFFICIENT, THIRD_RATE_MEDIAN, \n" +
"to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, SOURCECODE from avm_evaluation_gj where YEAR_MONTH = ${yearMonth}";
def allRows = []
sqlInstance.eachRow(sql,{r->
def data = []
data << r.ID
data << r.CITYID
data << r.CITYNAME
data << r.YEAR_MONTH
data << r.COMMUNITY_NUM
data << r.HAS_PRICE_COMMUNITY_NUM
data << r.PRICE_COVERAGE
data << r.ARTIFICIAL_CALC_NUM
data << r.ARTIFICIAL_CALC_COVERAGE
data << r.SAMPLE_CALC_NUM
data << r.SAMPLE_CALC_COVERAGE
data << r.ANN_CALC_NUM
data << r.ANN_CALC_COVERAGE
data << r.TEST_NUM
data << r.TEST_COMM_NUM
data << r.TEST_COMM_COVERAGE
data << r.PPE15_COVERAGE
data << r.RATE_MEDIAN
data << r.COEFFICIENT
data << r.DEAL_TEST_CASE_NUM
data << r.DEAL_TEST_COMM_NUM
data << r.DEAL_TEST_COMM_COVERAGE
data << r.DEAL_PPE15_COVERAGE
data << r.DEAL_COEFFICIENT
data << r.DEAL_RATE_MEDIAN
data << r.THIRD_TEST_CASE_NUM
data << r.THIRD_TEST_COMM_NUM
data << r.THIRD_TEST_COMM_COVERAGE
data << r.THIRD_PPE15_COVERAGE
data << r.THIRD_COEFFICIENT
data << r.THIRD_RATE_MEDIAN
data << r.CREATETIME
data << r.UPDATETIME
data << r.SOURCECODE
allRows << data
});
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
def fileName = "/ccb/MODEL_000000_000000_AVM_EVALUATION_GJNB_ADD_${curDate}_0001.dat"
def fileName1 = "/ccb/MODEL_000000_000000_AVM_EVALUATION_GJ_ADD_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_AVM_EVALUATION_GJNB_ADD_${curDate}_0001.dat"
fileName1 = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_AVM_EVALUATION_GJ_ADD_${curDate}_0001.dat"
}
def headers = []//["ID","CITYID","CITYNAME","YEAR_MONTH","COMMUNITY_NUM","HAS_PRICE_COMMUNITY_NUM","PRICE_COVERAGE","ARTIFICIAL_CALC_NUM","ARTIFICIAL_CALC_COVERAGE","SAMPLE_CALC_NUM","SAMPLE_CALC_COVERAGE",
//"ANN_CALC_NUM","ANN_CALC_COVERAGE","TEST_NUM","TEST_COMM_NUM","TEST_COMM_COVERAGE","PPE15_COVERAGE","RATE_MEDIAN","COEFFICIENT","DEAL_TEST_CASE_NUM","DEAL_TEST_COMM_NUM","DEAL_TEST_COMM_COVERAGE","DEAL_PPE15_COVERAGE",
//"DEAL_COEFFICIENT","DEAL_RATE_MEDIAN","THIRD_TEST_CASE_NUM","THIRD_TEST_COMM_NUM","THIRD_TEST_COMM_COVERAGE","THIRD_PPE15_COVERAGE","THIRD_COEFFICIENT","THIRD_RATE_MEDIAN","CREATETIME","UPDATETIME","SOURCECODE"]
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
FileUtils.batchCreateFile(allRows, fileName1, headers, "utf-8", false);
println "AVM_EVALUATION_GJNB 数据文件输出完成......"
CcbFtpUtils.ftpUpload(null, fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName1, curDate)
println "AVM_EVALUATION_GJNB 上传Ftp完成......"
}
def exportAVMEvaluationItemGJNB(yearMonth){
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, COMMID, COMMNAME, YEAR_MONTH, CALC_AVG_PRICE, AVG_PRICE, CALC_TYPE, CONFIDENCE,TARGET_AVG_PRICE, \n" +
"to_char(DEALDATE,'yyyy-mm-dd hh24:mi:ss') as DEALDATE, UNIT_PRICE, BUILDAREA, FITMENT, HOUSEASPECT, FLOORNUM, FLOORCNT, DATA_TYPE, RATE, PE, \n" +
"to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME from avm_evaluation_item_gj where YEAR_MONTH = ${yearMonth}";
def allRows = []
sqlInstance.eachRow(sql,{r->
def data = []
data << r.ID
data << r.CITYID
data << r.CITYNAME
data << r.DISTID
data << r.DISTNAME
data << r.COMMID
data << r.COMMNAME
data << r.YEAR_MONTH
data << r.CALC_AVG_PRICE
data << r.AVG_PRICE
data << r.CALC_TYPE
data << r.CONFIDENCE
data << r.TARGET_AVG_PRICE
data << r.DEALDATE
data << r.UNIT_PRICE
data << r.BUILDAREA
data << r.FITMENT
data << r.HOUSEASPECT
data << r.FLOORNUM
data << r.FLOORCNT
data << r.DATA_TYPE
data << r.RATE
data << r.PE
data << r.CREATETIME
allRows << data
});
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
def fileName = "/ccb/MODEL_000000_000000_AVM_EVALUATION_ITEM_GJNB_ADD_${curDate}_0001.dat"
def fileName1 = "/ccb/MODEL_000000_000000_AVM_EVALUATION_ITEM_GJ_ADD_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_AVM_EVALUATION_ITEM_GJNB_ADD_${curDate}_0001.dat"
fileName1 = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_AVM_EVALUATION_ITEM_GJ_ADD_${curDate}_0001.dat"
}
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","CONFIDENCE","TARGET_AVG_PRICE","DEALDATE","UNIT_PRICE","BUILDAREA","FITMENT","HOUSEASPECT","FLOORNUM","FLOORCNT","DATA_TYPE","RATE","PE","CREATETIME"]
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
FileUtils.batchCreateFile(allRows, fileName1, headers, "utf-8", false);
println "AVM_EVALUATION_ITEM_GJNB 数据文件输出完成......"
CcbFtpUtils.ftpUpload(null, fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName1, curDate)
println "AVM_EVALUATION_ITEM_GJNB 上传Ftp完成......"
}
def exportCommunityBasePrice(yearMonth){
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, COMMID, COMMNAME, YEAR_MONTH, CALC_AVG_PRICE, AVG_PRICE, CALC_TYPE, FAKE_RATE, DIFF_RATE, CONFI_RATE, CORR_RATE, CONFIDENCE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from community_base_price_gj where year_month=${yearMonth}";
def allRows = []
sqlInstance.eachRow(sql,{r->
def data = []
data << r.ID
data << r.CITYID
data << r.CITYNAME
data << r.DISTID
data << r.DISTNAME
data << r.COMMID
data << r.COMMNAME
data << r.YEAR_MONTH
data << r.CALC_AVG_PRICE
data << r.AVG_PRICE
data << r.CALC_TYPE
data << r.FAKE_RATE
data << r.DIFF_RATE
data << r.CONFI_RATE
data << r.CORR_RATE
data << r.CONFIDENCE
data << r.CREATETIME
data << r.UPDATETIME
data << r.SOURCECODE
allRows << data
});
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
def fileName = "/ccb/MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJNB_ADD_${curDate}_0001.dat"
def fileName1 = "/ccb/MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJNB_ADD_${curDate}_0001.dat"
fileName1 = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat"
}
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","FAKE_RATE","DIFF_RATE","CONFI_RATE","CORR_RATE","CONFIDENCE","CREATETIME","UPDATETIME","SOURCECODE"]
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
FileUtils.batchCreateFile(allRows, fileName1, headers, "utf-8", false);
println "COMMUNITY_BASE_PRICE_GJNB 数据文件输出完成......"
CcbFtpUtils.ftpUpload(null, fileName, curDate)
CcbFtpUtils.ftpUpload(null, fileName1, curDate)
println "COMMUNITY_BASE_PRICE_GJNB 上传Ftp完成......"
}
def exportCommunityBasePriceGj(yearMonth){
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, COMMID, COMMNAME, YEAR_MONTH, CALC_AVG_PRICE, AVG_PRICE, CALC_TYPE, FAKE_RATE, DIFF_RATE, CONFI_RATE, CORR_RATE, CONFIDENCE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME,SOURCECODE from community_base_price_gj where year_month=${yearMonth}";
def allRows = []
sqlInstance.eachRow(sql,{r->
def data = []
data << r.ID
data << r.CITYID
data << r.CITYNAME
data << r.DISTID
data << r.DISTNAME
data << r.COMMID
data << r.COMMNAME
data << r.YEAR_MONTH
data << r.CALC_AVG_PRICE
data << r.AVG_PRICE
data << r.CALC_TYPE
data << r.FAKE_RATE
data << r.DIFF_RATE
data << r.CONFI_RATE
data << r.CORR_RATE
data << r.CONFIDENCE
data << r.CREATETIME
data << r.UPDATETIME
data << r.SOURCECODE
allRows << data
});
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28";
def fileName = "/ccb/MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_BASE_PRICE_GJ_ADD_${curDate}_0001.dat"
}
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","FAKE_RATE","DIFF_RATE","CONFI_RATE","CORR_RATE","CONFIDENCE","CREATETIME","UPDATETIME","SOURCECODE"]
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
println "COMMUNITY_BASE_PRICE_GJ 数据文件输出完成......"
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "COMMUNITY_BASE_PRICE_GJ 上传Ftp完成......"
}
def exportCityPrice(month){
def sql = "select ID, CITYID, CITYNAME, YEAR_MONTH, CALC_AVG_PRICE, PRICE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, SOURCECODE from city_price_gj where year_month=${month}";
def allRows = []
sqlInstance.eachRow(sql,{r->
def data = []
data << r.ID
data << r.CITYID
data << r.CITYNAME
data << r.YEAR_MONTH
data << r.CALC_AVG_PRICE
data << r.PRICE
data << r.CREATETIME
data << r.UPDATETIME
data << r.SOURCECODE
allRows << data
});
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
def fileName = "/ccb/MODEL_000000_000000_CITY_PRICE_GJ_ALL_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_CITY_PRICE_GJ_ALL_${curDate}_0001.dat"
}
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","FAKE_RATE","DIFF_RATE","CONFI_RATE","CORR_RATE","CONFIDENCE","CREATETIME","UPDATETIME","SOURCECODE"]
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
println "CITY_PRICE_GJ 数据文件输出完成......"
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "CITY_PRICE_GJ 上传Ftp完成......"
}
def exportRegionPrice(month){
def sql = "select ID, CITYID, CITYNAME, DISTID, DISTNAME, YEAR_MONTH, CALC_AVG_PRICE, PRICE, to_char(CREATETIME,'yyyy-mm-dd hh24:mi:ss') as CREATETIME, to_char(UPDATETIME,'yyyy-mm-dd hh24:mi:ss') as UPDATETIME, SOURCECODE from DISTRICT_PRICE_GJ where year_month=${month}";
def allRows = []
sqlInstance.eachRow(sql,{r->
def data = []
data << r.ID
data << r.CITYID
data << r.CITYNAME
data << r.DISTID
data << r.DISTNAME
data << r.YEAR_MONTH
data << r.CALC_AVG_PRICE
data << r.PRICE
data << r.CREATETIME
data << r.UPDATETIME
data << r.SOURCECODE
allRows << data
});
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
def fileName = "/ccb/MODEL_000000_000000_DISTRICT_PRICE_GJ_ALL_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_DISTRICT_PRICE_GJ_ALL_${curDate}_0001.dat"
}
def headers = []//["ID","CITYID","CITYNAME","DISTID","DISTNAME","COMMID","COMMNAME","YEAR_MONTH","CALC_AVG_PRICE","AVG_PRICE","CALC_TYPE","FAKE_RATE","DIFF_RATE","CONFI_RATE","CORR_RATE","CONFIDENCE","CREATETIME","UPDATETIME","SOURCECODE"]
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
println "DISTRICT_PRICE_GJ 数据文件输出完成......"
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "DISTRICT_PRICE_GJ 上传Ftp完成......"
}
def exportCommunityPdescribeGj(month){
// def citys = CcbCommonUtils.citys;
// def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
def fileName = "/ccb/MODEL_000000_000000_COMMUNITY_P_DESCRIBE_GJ_ADD_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMMUNITY_P_DESCRIBE_GJ_ADD_${curDate}_0001.dat"
}
def headers = []
//
// for(def city : citys) {
// def cityCode = cityCodeDataMap.get(city)
def sql = "select ID,COMMUNITY_ID,CITYID ,CITY_NAME,DISTRICT_CODE ,DISTRICT_NAME,COMMUNITY_NAME,PQ_NAME,BASE_PRICE,CONFIDENCE_LEVEL,CNT,MIN_PRICE,MEDIANPRICE,MEANPRICE,MAX_PRICE,TIME,FIRSTDATAT,THIRDDATA,RELATIVEERROR,SKEWNESS,PQ_PRICE_RANGE,DISTRICT_PRICE_RANGE ,DESCRIPTION,PRIV_BASE_PRICE,IS_ARTTFICIAL,PRIV_FINAL_PRICE,to_char(CREATE_DATE,'yyyy-mm-dd') as CREATE_DATE,PRICE,PRICE_SOURCE,CASE_MD_PRICE,CASE_AVG_PRICE,INDEX_LABEL,MAIN_PROPERTY,COMMTYPE,NEW_DEAL_PRICE,to_char(NEW_DEAL_DATE,'yyyy-mm-dd') as NEW_DEAL_DATE,PRICE_MOM_RATIO,MAX_MOM_RATIO,PRICE_YOY_RATIO ,SATUR_RATIO,NEIGHBOR_PRICE from community_p_describe_gj where time=${month}";
// def sql = "select ID,COMMUNITY_ID,CITYID ,CITY_NAME,DISTRICT_CODE ,DISTRICT_NAME,COMMUNITY_NAME,PQ_NAME,BASE_PRICE,CONFIDENCE_LEVEL,CNT,MIN_PRICE,MEDIANPRICE,MEANPRICE,MAX_PRICE,TIME,FIRSTDATAT,THIRDDATA,RELATIVEERROR,SKEWNESS,PQ_PRICE_RANGE,DISTRICT_PRICE_RANGE ,DESCRIPTION,PRIV_BASE_PRICE,IS_ARTTFICIAL,PRIV_FINAL_PRICE,to_char(CREATE_DATE,'yyyy-mm-dd') as CREATE_DATE,PRICE,PRICE_SOURCE,CASE_MD_PRICE,CASE_AVG_PRICE,INDEX_LABEL,MAIN_PROPERTY,COMMTYPE,NEW_DEAL_PRICE,to_char(NEW_DEAL_DATE,'yyyy-mm-dd') as NEW_DEAL_DATE,PRICE_MOM_RATIO,MAX_MOM_RATIO,PRICE_YOY_RATIO ,SATUR_RATIO,NEIGHBOR_PRICE from community_p_describe_gj where time in (202110,202111,202112,202201)";
def allRows = []
sqlInstance.eachRow(sql, { r ->
def data = []
data << r.ID
data << r.COMMUNITY_ID
data << r.CITYID
data << r.CITY_NAME
data << r.DISTRICT_CODE
data << r.DISTRICT_NAME
data << r.COMMUNITY_NAME
data << r.PQ_NAME
data << r.BASE_PRICE
data << r.CONFIDENCE_LEVEL
data << r.CNT
data << r.MIN_PRICE
data << r.MEDIANPRICE
data << r.MEANPRICE
data << r.MAX_PRICE
data << r.TIME
data << r.FIRSTDATAT
data << r.THIRDDATA
data << r.RELATIVEERROR
data << r.SKEWNESS
data << r.PQ_PRICE_RANGE
data << r.DISTRICT_PRICE_RANGE
data << r.DESCRIPTION
data << r.PRIV_BASE_PRICE
data << r.IS_ARTTFICIAL
data << r.PRIV_FINAL_PRICE
data << r.CREATE_DATE
data << r.PRICE
data << r.PRICE_SOURCE
data << r.CASE_MD_PRICE
data << r.CASE_AVG_PRICE
data << r.INDEX_LABEL
data << r.MAIN_PROPERTY
data << r.COMMTYPE
data << r.NEW_DEAL_PRICE
data << r.NEW_DEAL_DATE
data << r.PRICE_MOM_RATIO
data << r.MAX_MOM_RATIO
data << r.PRICE_YOY_RATIO
data << r.SATUR_RATIO
data << r.NEIGHBOR_PRICE
allRows << data
});
println allRows.size()
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", false);
// }
println "community_p_describe_gj 数据文件输出完成......"
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "community_p_describe_gj 上传Ftp完成......"
}
def exportCommCaseDetailGj(month){
def citys = CcbCommonUtils.citys;
def cityCodeDataMap = CcbCommonUtils.findCityCodeValue()
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
def fileName = "/ccb/MODEL_000000_000000_COMM_CASE_DETAIL_GJ_ADD_${curDate}_0001.dat"
if(CommonDatautils.isWindow()){
fileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\MODEL_000000_000000_COMM_CASE_DETAIL_GJ_ADD_${curDate}_0001.dat"
}
def headers = []
for(def city : citys){
def cityCode = cityCodeDataMap.get(city)
def sql = "select ID, CITYID, COMMUNITY_ID, NETLISTING_ID, PRICE_DATE, to_char(CREATE_DATE,'yyyy-mm-dd') as CREATE_DATE from comm_case_detail_gj where cityid='${cityCode}' and price_date=${month}";
def allRows = []
sqlInstance.eachRow(sql,{r->
def data = []
data << r.ID
data << r.CITYID
data << r.COMMUNITY_ID
data << r.NETLISTING_ID
data << r.PRICE_DATE
data << r.CREATE_DATE
allRows << data
if(allRows.size()%200000==0){
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", true);
allRows.clear()
}
});
if(allRows.size()>0){
FileUtils.batchCreateFile(allRows, fileName, headers, "utf-8", true);
}
}
println "comm_case_detail_gj 数据文件输出完成......"
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "comm_case_detail_gj 上传Ftp完成......"
}
def exportOkFile(){
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
def dataCodeFileName = "/ccb/${curDate}.ok"
if(CommonDatautils.isWindow()){
dataCodeFileName = "D:\\数据\\建行\\房产估值\\数据文件\\txt\\${curDate}\\${curDate}.ok"
}
FileUtils.batchCreateFile([], dataCodeFileName, [], "utf-8", false);
CcbFtpUtils.ftpUpload(null, dataCodeFileName, curDate)
}
def exportMd5(){
def curDate = DateUtils.formatDateByPattern(new Date(), "yyyyMM")+"28"
Vector files = CcbFtpUtils.listFileNames(curDate)
Iterator fileVec = files.iterator()
def fileRows = []
while(fileVec.hasNext()){
ChannelSftp.LsEntry file = fileVec.next()
if(org.apache.commons.lang.StringUtils.isNotBlank(file.getFilename()) && file.getFilename().endsWith(".dat")){
fileRows << file.getFilename() +":"+ DigestUtils.md5Hex(file.getFilename())
}
}
def fileName = "/ccb/md5.txt"
if(CommonDatautils.isWindow()){
fileName = "D:\\房价网\\md5.txt"
}
FileUtils.createTxtFile(fileRows, fileName, "utf-8", false);
CcbFtpUtils.ftpUpload(null, fileName, curDate)
println "md5.txt 上传Ftp完成......"
}
}
@@ -44,7 +44,7 @@ class GuiDingPriceBatch extends BaseBatch{
def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
//添加自己库中的人工指导价
def prices = CcbCommonUtils.findPersonPrice(city, DateUtils.addMonth(new Date(), -6))
def prices = CcbCommonUtils.findPersonPrice(city, "2022-04-1", "2022-05-1")
if(prices){
def distMap = getDistrictMap(city)
def rets = createCityDatas(cityCodeDatas, distCodeMap, distMap, prices)
@@ -53,24 +53,24 @@ class GuiDingPriceBatch extends BaseBatch{
}
//添加搜房的参考价
def districts = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city", "region", "name", "lng","estate_type2","name_cat", "alias"]);
// def districts = CcbCommonUtils.findAllDistrictByCity(city, "district", ["city", "region", "name", "lng","estate_type2","name_cat", "alias"]);
// def datas = findFangDatas(districts)
// def fangRets = createDatas(cityCodeDatas, distCodeMap, datas)
// rows.addAll(fangRets)
//添加保亭文昌的指导价
def cityDatas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\文昌-保亭待调查小区价格 - 210902(1).xlsx")
def cityDataMap = [:]
for(def d : cityDatas){
cityDataMap.put(d['A'], d['E'])
}
def personDatas = findPersonDatas(districts, cityDataMap);
def personRets = createDatas(cityCodeDatas, distCodeMap, personDatas)
rows.addAll(personRets)
// def cityDatas = ExcelUtils.read("D:\\数据\\建行\\房产估值\\文昌-保亭待调查小区价格 - 210902(1).xlsx")
// def cityDataMap = [:]
// for(def d : cityDatas){
// cityDataMap.put(d['A'], d['E'])
// }
// def personDatas = findPersonDatas(districts, cityDataMap);
// def personRets = createDatas(cityCodeDatas, distCodeMap, personDatas)
// rows.addAll(personRets)
}
def headers = ["第三方均价ID","楼盘ID","小区名称","城市ID","城市名称","行政区ID","行政区名称","指导日期","指导价格","添加人","备注","创建时间","更新时间","来源公司"]
def headers = []//["第三方均价ID","楼盘ID","小区名称","城市ID","城市名称","行政区ID","行政区名称","指导日期","指导价格","添加人","备注","创建时间","更新时间","来源公司"]
FileUtils.batchCreateFile(rows, "d:\\数据\\建行\\房产估值\\数据文件\\txt\\GUIDED_PRICE_GJ.dat", headers, "utf-8", false);
// def rets = []
@@ -1,26 +1,97 @@
package com.fangjia.script.ccbevaluation
import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.util.DateUtils
import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.MongoUtils
import com.mongodb.BasicDBObject
import com.mongodb.DBCollection
import com.fangjia.core.RegionData
import com.fangjia.script.gj.district.SeaweedDataMatchProcess
import groovy.sql.Sql
import org.bson.types.ObjectId
class LoadGuide {
public static final DBCollection DISTRICT_GUIDE_PRICE_COLL = MongoUtils.getCollectionByName("fangjia", "district_guide_price", "mongo.db.fangjia.com", 28017)
def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
static main(args) {
def task = new LoadGuide()
task.run()
}
def run(){
addPersonGuided("D:\\数据\\建行\\人工指导价更新.xlsx")
// match("D:\\数据\\建行\\房产估值\\指导价\\西安指导价2-103.xlsx")
// saveDongGuangPrice("D:\\数据\\建行\\房产估值\\指导价\\东莞指导价218.xlsx")
// saveDongGuangPrice("D:\\数据\\建行\\房产估值\\指导价\\东莞二手房政府指导价.xls")
// saveChengduoPrice("D:\\数据\\建行\\房产估值\\指导价\\成都部分住宅小区二手房成交参考价格201-286-258.xlsx")
// savePrice("D:\\数据\\建行\\房产估值\\指导价\\绍兴指导价小区_0909.xlsx")
// savePrice("D:\\数据\\建行\\房产估值\\指导价\\宁波交易参考价格.xlsx")
// savePrice("D:\\数据\\建行\\房产估值\\指导价\\西安成交参考价格.xlsx")
// savePrice("D:\\数据\\建行\\房产估值\\指导价\\西安指导价2-103.xlsx")
// savePrice("D:\\数据\\建行\\房产估值\\指导价\\无锡100 广州96 二手住房成交参考价格表.xlsx")
savePrice("D:\\数据\\建行\\房产估值\\指导价\\深圳指导价 - 210909 -.xlsx")
// savePrice("D:\\数据\\建行\\房产估值\\指导价\\深圳指导价 - 210909 -.xlsx")
// savePrice("D:\\数据\\建行\\房产估值\\指导价\\三亚指导价30.xlsx")
}
def addPersonGuided(filename){
ExcelUtils.modify(filename, { d ->
def city = d['B']
if(city){
def cityCodeDatas = CcbCommonUtils.findCityCodeValue()
def distCodeMap = CcbCommonUtils.findAllDistrictCodeValue(city)
createSql( d, cityCodeDatas, distCodeMap)
}
})
}
def createSql(d, cityCodeDatas, distCodeMap){
def id = new ObjectId()
def commid = d['A']
def cityId = cityCodeDatas.get(d['B'])
def sampleRegion = d['C'].replace("街道","").replace("镇","")
def distRegion = distCodeMap.get(sampleRegion)
def cityName = d['B']
def distName = d['C']
def commName = d['D']
def price = d['E'].toDouble().toInteger()
def dist = CommonDatautils.findDistrict(cityName, sampleRegion, commName, "district")
if(dist){
def createtime = DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd HH:mm:ss")
def dealDate = DateUtils.formatDateByPattern(new Date(), "yyyy-MM-dd")
def sql = "insert into guided_price_gj(ID,COMMID,COMMNAME,CITYID,CITYNAME,DISTID,DISTNAME,DEALDATE,AVG_PRICE,GUIDING_PERSON,REMARK,CREATETIME,UPDATETIME,SOURCECODE) VALUES " +
"('${id.toString()}','${dist._id.toString()}', '${commName}','${cityId}','${cityName}','${distRegion.district_code}','${distName}',to_date('${dealDate}','yyyy-mm-dd'),${price},'房价网','',to_date('${createtime}','yyyy-mm-dd hh24:mi:ss'),to_date('${createtime}','yyyy-mm-dd hh24:mi:ss'),'FJW')"
println sql
sqlInstance.executeUpdate(sql)
}else{
println " 没查到 "+commName
}
}
def match(def filename){
def city = "西安"
ExcelUtils.modify(filename,{d->
def newRegion = RegionData.formatRegion(city, d['A'])
if(newRegion){
def rMap = SeaweedDataMatchProcess.doMatch(city, newRegion, d['B'], null);
if(rMap){
d['D'] = city
d['E'] = rMap.region
d['F'] = rMap.name
}
}
},0)
}
@@ -28,15 +99,15 @@ class LoadGuide {
def datas = ExcelUtils.read(filePath,0, 1)
def rets = []
for(def d : datas){
if(d['E']){
if(d['D']){
def o = new BasicDBObject()
o.city = d['E']
o.city = d['D']
o.region = d['A']
o.name = d['C']
o.avg_price = d['D'].toString().toDouble().toInteger()
o.match_city = d['E']
o.match_region = d['F']
o.match_name = d['G']
o.name = d['B']
o.avg_price = d['C'].toString().toDouble().toInteger()
o.match_city = d['D']
o.match_region = d['E']
o.match_name = d['F']
o.source_type = 1 //1:成交参考价 2:参考价
o.c_date = new Date()
rets << o
@@ -57,11 +128,11 @@ class LoadGuide {
o.city = d['E']
o.region = d['A']
o.name = d['B']
o.avg_price = d['D'].toString().toDouble().toInteger()
o.avg_price = d['C'].toString().toDouble().toInteger()
o.match_city = d['E']
o.match_region = d['F']
o.match_name = d['G']
o.house_count = d['C'].toString().toDouble().toInteger()
// o.house_count = d['C'].toString().toDouble().toInteger()
o.source_type = 1 //1:成交参考价 2:参考价
o.c_date = new Date()
rets << o
@@ -0,0 +1,67 @@
package com.fangjia.script.ccbevaluation
import com.fangjia.core.RegionData
import com.fangjia.core.util.DistrictCodeUtils
import com.fangjia.script.commData.CommonDatautils
import com.fangjia.script.gj.district.FangjiaClientUtils
import com.fangjia.script.lixue.util.DBUtils
import com.fangjia.script.util.DateUtils
import com.fangjia.script.util.DbUtils
import com.fangjia.script.util.ElasticUtils
import com.fangjia.script.util.ExcelUtils
import com.fangjia.script.util.MongoUtils
import com.mongodb.BasicDBObject
import com.mongodb.DBCollection
import com.mongodb.DBObject
import groovy.sql.Sql
import org.apache.lucene.queryparser.classic.QueryParser
import org.apache.poi.ss.util.RegionUtil
import org.bson.types.ObjectId
import org.elasticsearch.index.query.BoolQueryBuilder
import org.elasticsearch.index.query.QueryBuilder
import org.elasticsearch.index.query.QueryBuilders
import org.elasticsearch.xpack.sql.jdbc.EsDataSource
import java.sql.ResultSet
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.CountDownLatch
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
import java.util.concurrent.atomic.AtomicLong
/**
* oracle中小区统计数据同步至85中
*/
class OracleDistrict2Mongo85 {
static def sqlInstance = Sql.newInstance("jdbc:oracle:thin:@192.168.0.236:1521:orcl",
"GOOJIA", "GOOJIA", "oracle.jdbc.driver.OracleDriver")
static final DBCollection communityPoiConn = MongoUtils.getCollectionByName("fangjia_stat", "community_poi_gj", "192.168.0.85", 28017)
static main(args) {
// 只写入重庆市数据
def sql = "select cityid, distname, commid, commname, subway, traffic, bank, primary, junior, hospital, funeral from COMMUNITY_POI_GJ"
def count = 0
sqlInstance.eachRow(sql, { r ->
def city = DistrictCodeUtils.getCityName(r['cityid'])
def region = RegionData.formatRegion(city, r['distname'])
DBObject dbObject = new BasicDBObject("_id", r['commid'])
DBObject updateObject = new BasicDBObject("city", city).append("region", region)
.append("name", r['commname'])
.append('subway', Integer.parseInt(r['subway'].toString()))
.append("traffic", Integer.parseInt(r['traffic'].toString()))
.append("bank", Integer.parseInt(r['bank'].toString()))
.append("primary", Integer.parseInt(r['primary'].toString()))
.append("junior", Integer.parseInt(r['junior'].toString()))
.append("hospital", Integer.parseInt(r['hospital'].toString()))
.append("funeral", Integer.parseInt(r['funeral'].toString()))
.append("c_date", new Date());
communityPoiConn.update(dbObject, updateObject, true, false)
count++;
if (count % 500 == 0) {
println "已写入" + count + "条小区数据"
}
});
}
}

Some files were not shown because too many files have changed in this diff Show More