diff --git a/deliverables/k8s/fangjia-static.yaml b/deliverables/k8s/fangjia-static.yaml index da58e88a9..fa7f9b842 100644 --- a/deliverables/k8s/fangjia-static.yaml +++ b/deliverables/k8s/fangjia-static.yaml @@ -98,4 +98,4 @@ spec: ports: - port: 8080 targetPort: 8080 - nodePort: 30005 \ No newline at end of file + nodePort: 30013 \ No newline at end of file diff --git a/deliverables/k8s/fangjia-youda-manager.yaml b/deliverables/k8s/fangjia-youda-manager.yaml new file mode 100644 index 000000000..2fa388c75 --- /dev/null +++ b/deliverables/k8s/fangjia-youda-manager.yaml @@ -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 \ No newline at end of file diff --git a/deliverables/k8s/fangjia-youda-web-business.yaml b/deliverables/k8s/fangjia-youda-web-business.yaml new file mode 100644 index 000000000..ee19e4c63 --- /dev/null +++ b/deliverables/k8s/fangjia-youda-web-business.yaml @@ -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 \ No newline at end of file diff --git a/deliverables/k8s/fangjia-youda-web-customer.yaml b/deliverables/k8s/fangjia-youda-web-customer.yaml new file mode 100644 index 000000000..d8374216b --- /dev/null +++ b/deliverables/k8s/fangjia-youda-web-customer.yaml @@ -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 \ No newline at end of file diff --git a/projects/fangjia-coresite/src/main/java/com/fangjia/coresite/controllers/TrendController.java b/projects/fangjia-coresite/src/main/java/com/fangjia/coresite/controllers/TrendController.java index c3a3756a9..cccf755b8 100644 --- a/projects/fangjia-coresite/src/main/java/com/fangjia/coresite/controllers/TrendController.java +++ b/projects/fangjia-coresite/src/main/java/com/fangjia/coresite/controllers/TrendController.java @@ -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; diff --git a/projects/fangjia-coresite/src/main/java/com/fangjia/coresite/model/TrendModel.java b/projects/fangjia-coresite/src/main/java/com/fangjia/coresite/model/TrendModel.java index 6e7cfda75..a06cb6a31 100644 --- a/projects/fangjia-coresite/src/main/java/com/fangjia/coresite/model/TrendModel.java +++ b/projects/fangjia-coresite/src/main/java/com/fangjia/coresite/model/TrendModel.java @@ -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; + } } diff --git a/projects/fangjia-coresite/src/main/webapp/trend/trend.ftl b/projects/fangjia-coresite/src/main/webapp/trend/trend.ftl index c4fb35940..ea155f653 100644 --- a/projects/fangjia-coresite/src/main/webapp/trend/trend.ftl +++ b/projects/fangjia-coresite/src/main/webapp/trend/trend.ftl @@ -125,6 +125,7 @@
<#if districtStatBo?? || regionStatBo??> + <#if count??>
${count!}
<#if districtStatBo??>
<#if districtStatBo.lastTimeDistrictStat??>${districtStatBo.lastTimeDistrictStat.avgPrice}<#else>鏆傛棤
<#if districtStatBo.districtStat??>${districtStatBo.districtStat.avgPrice}<#else>鏆傛棤
diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/sql/fangjia/dao/FormalReportDao.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/sql/fangjia/dao/FormalReportDao.java new file mode 100644 index 000000000..a06caa12a --- /dev/null +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/sql/fangjia/dao/FormalReportDao.java @@ -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 { +} diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/sql/fangjia/dao/FormalReportDaoImpl.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/sql/fangjia/dao/FormalReportDaoImpl.java new file mode 100644 index 000000000..72ea5ebbd --- /dev/null +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/sql/fangjia/dao/FormalReportDaoImpl.java @@ -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 implements FormalReportDao { +} diff --git a/projects/fangjia-dal/src/main/java/com/fangjia/dal/sql/model/FormalReport.java b/projects/fangjia-dal/src/main/java/com/fangjia/dal/sql/model/FormalReport.java new file mode 100644 index 000000000..93f5d11fc --- /dev/null +++ b/projects/fangjia-dal/src/main/java/com/fangjia/dal/sql/model/FormalReport.java @@ -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; + } +} diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/DistrictController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/DistrictController.java index 4cc728b6a..826c55070 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/DistrictController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/DistrictController.java @@ -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")); diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/UserController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/UserController.java index 81419d5e4..e97bc10ae 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/UserController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/UserController.java @@ -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 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 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()); } } 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); diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/WeiXinEvaluationController.java b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/WeiXinEvaluationController.java index 20817129d..64764ab41 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/WeiXinEvaluationController.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/controllers/weixin/WeiXinEvaluationController.java @@ -1,38 +1,5 @@ package com.fangjia.open.controllers.weixin; -import java.io.*; -import java.net.URLDecoder; -import java.net.URLEncoder; -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.core.util.HttpRequest; -import com.fangjia.dal.sql.model.*; -import com.fangjia.open.OpenConfig; -import com.fangjia.open.dto.UniversalDto; -import com.fangjia.open.model.BasicModel; -import com.fangjia.open.model.FilesModel; -import com.fangjia.open.util.*; -import com.fangjia.service.mongo.fangjia.*; -import com.fangjia.service.sql.*; -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 com.fangjia.core.util.DataUtil; import com.fangjia.core.util.DateUtil; import com.fangjia.dal.common.DistrictKey; @@ -42,9 +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.*; import com.fangjia.service.bo.DistrictStatBo; import com.fangjia.service.bo.HouseBo; import com.fangjia.service.datastore.DistrictService; @@ -57,13 +27,35 @@ 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.*; 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. */ @@ -105,6 +97,7 @@ public class WeiXinEvaluationController { private GoldLogsService goldLogsService; private PriceBorderService priceBorderService; private BohaiEvaluationAuditService bohaiEvaluationAuditService; + private FormalReportService formalReportService; private FileService fileService; private ReportFileAttachService reportFileAttachService; @@ -272,6 +265,10 @@ 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){ @@ -295,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", "-"); } @@ -451,12 +453,27 @@ public class WeiXinEvaluationController { if(fjtUser!=null && fjtUser.getRole()==17) { System.out.println("渤海地址搜索 "+evaluation.getAddress()); List bhDists = BHBankUtils.getDistrictByBhbank(evaluation.getAddress()); - if(bhDists.size()<1){ + JSONObject o = null; + if(bhDists.size()==0){ bhDists = BHBankUtils.getDistrictByBhbank(district.getName()); } - Map bhMatchMap = new HashMap(); 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){ + double price = Double.valueOf((String)jo.get("price")); + int bhprice = (int)price; + int bhmod = Math.abs(bhprice - avgPrice); + if(bhmod bhMatchMap = new HashMap(); + if(o != null){ + String bhDistName = (String)o.get("name"); String regionCode = String.valueOf((Long)o.get("country")); String bhRegion = BHBankUtils.regionCodeMap.get(regionCode); @@ -643,6 +660,8 @@ public class WeiXinEvaluationController { } } + UserTrades userTrade = userTradesService.findUserTradesByEvaluationId(model.getEvaluationId()); + model.setUserTrades(userTrade); if(fjtUser!=null && fjtUser.getRole()==17 && district.getCity().equals("上海")){ Map retMap = getLoanInfo(district, evaluation.getHouseArea()); @@ -979,13 +998,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()); @@ -1010,18 +1030,84 @@ public class WeiXinEvaluationController { 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 uploadfiles = new ArrayList(); + 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 data = new HashMap(); + data.put("code", code); + jsonModel.setJsonModel(data); + } + } + return jsonModel; + } + + public Object checkImageAction(EvaluationModel model){ + JsonModel jsonModel = new JsonModel(); + if (StringUtils.isNotBlank(model.getEvaluationId())){ + List datas = reportFileAttachService.findHouseImage(Integer.valueOf(model.getEvaluationId()), 3); + Map data = new HashMap(); + data.put("count", datas.size()); + jsonModel.setJsonModel(data); + } + return jsonModel; + } + + private void sendToEmail(String fjtUrl, String evaluationId, String email){ try { @@ -1261,8 +1347,45 @@ public class WeiXinEvaluationController { } } + 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) { + private static void inputStreamToFile(InputStream ins, File file) { //将输出流转化为文件即可 FileOutputStream os = null; try { @@ -1451,4 +1574,8 @@ public class WeiXinEvaluationController { public void setReportFileAttachService(ReportFileAttachService reportFileAttachService) { this.reportFileAttachService = reportFileAttachService; } + + public void setFormalReportService(FormalReportService formalReportService) { + this.formalReportService = formalReportService; + } } diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/model/weixin/EvaluationModel.java b/projects/fangjia-open/src/main/java/com/fangjia/open/model/weixin/EvaluationModel.java index ce6cc6080..8de0977f8 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/model/weixin/EvaluationModel.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/model/weixin/EvaluationModel.java @@ -7,10 +7,7 @@ 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.ReportFileAttach; +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; @@ -57,6 +54,8 @@ public class EvaluationModel extends BaseModel{ private String queryId; private Integer fileClass; private Map> reportFileMap; + private UserTrades userTrades; + private String address; public void setId(String id) { @@ -302,4 +301,20 @@ public class EvaluationModel extends BaseModel{ public void setReportFileMap(Map> 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; + } } diff --git a/projects/fangjia-open/src/main/java/com/fangjia/open/util/BHBankUtils.java b/projects/fangjia-open/src/main/java/com/fangjia/open/util/BHBankUtils.java index d638fe36d..1e18831b4 100644 --- a/projects/fangjia-open/src/main/java/com/fangjia/open/util/BHBankUtils.java +++ b/projects/fangjia-open/src/main/java/com/fangjia/open/util/BHBankUtils.java @@ -2,27 +2,15 @@ package com.fangjia.open.util; import com.fangjia.core.util.HttpRequest; import com.fangjia.core.util.MD5Util; -import com.fangjia.core.util.MultipartUtility; import com.fangjia.dal.sql.model.FjtEvaluation; import com.fangjia.dal.sql.model.UsersDetail; import com.fangjia.open.model.weixin.EvaluationModel; -import com.mashape.unirest.http.HttpResponse; -import com.mashape.unirest.http.Unirest; -import com.mashape.unirest.request.HttpRequestWithBody; -import com.yeepay.shade.org.apache.http.entity.mime.MultipartEntityBuilder; import net.sf.json.JSONArray; import net.sf.json.JSONObject; import okhttp3.*; -import org.apache.commons.collections.map.MultiValueMap; import org.apache.commons.lang.StringUtils; -import org.apache.http.HttpHeaders; -import org.apache.http.client.methods.HttpPost; -import org.apache.http.impl.client.CloseableHttpClient; -import org.apache.http.impl.client.HttpClients; -import org.springframework.http.ResponseEntity; import java.io.File; -import java.io.FileInputStream; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.*; @@ -58,8 +46,11 @@ public class BHBankUtils { }}; public static List getDistrictByBhbank(String address){ - List list = new ArrayList(); + try { + +// Thread.sleep(20*1000); + Map params = new HashMap(); params.put("keyword",address); @@ -73,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"); @@ -116,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())); @@ -129,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; @@ -197,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"); @@ -282,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"); @@ -406,11 +410,6 @@ public class BHBankUtils { .addFormDataPart("userName",name); for(File file : uploadfiles){ - System.out.println(file.getAbsoluteFile()); - System.out.println(file.getName()); - System.out.println(file.getPath()); - System.out.println(file.getCanonicalPath()); - System.out.println(file.getParentFile()); builder.addFormDataPart("file",file.getPath(), RequestBody.create(MediaType.parse("application/octet-stream"), file)); } RequestBody body = builder.build(); @@ -434,4 +433,60 @@ public class BHBankUtils { return null; } + + + public static Integer inquireToReport(String queryId, String reportMsg){ + String feedbackId = null; + List list = new ArrayList(); + Map params = new HashMap(); + params.put("queryId",queryId); + if(StringUtils.isNotBlank(reportMsg)){ + params.put("reportMsg",reportMsg); + } + + + List 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; + } + } diff --git a/projects/fangjia-open/src/main/resources/persistence-goojia-fangjia.xml b/projects/fangjia-open/src/main/resources/persistence-goojia-fangjia.xml index 9004315d0..69ec4700c 100644 --- a/projects/fangjia-open/src/main/resources/persistence-goojia-fangjia.xml +++ b/projects/fangjia-open/src/main/resources/persistence-goojia-fangjia.xml @@ -17,6 +17,7 @@ com.fangjia.dal.sql.model.GoldLogs com.fangjia.dal.sql.model.BohaiEvaluationAudit com.fangjia.dal.sql.model.ReportFileAttach + com.fangjia.dal.sql.model.FormalReport true \ No newline at end of file diff --git a/projects/fangjia-open/src/main/webapp/district/weXinList.ftl b/projects/fangjia-open/src/main/webapp/district/weXinList.ftl index 3e07b5ef4..46ef7c552 100644 --- a/projects/fangjia-open/src/main/webapp/district/weXinList.ftl +++ b/projects/fangjia-open/src/main/webapp/district/weXinList.ftl @@ -26,7 +26,7 @@
- + <#if !(cityName??) || cityName == ""> <#else> @@ -48,7 +48,7 @@
    - <#if type?? && type == 'b'> + <#if type?? && (type == 'b' || type == 'gb')>
    - <#if type?? && type == 'b' && (citys??&&citys?size>0)> + <#if type?? && (type == 'b' || type == 'gb') && (citys??&&citys?size>0)>
    <#list citys as bo>

    ${bo}

    @@ -54,7 +54,7 @@
    - <#if type?? && type == 'c' || type == 'b' && (citys??&&citys?size=0)> + <#if type?? && type == 'c' || (type == 'b' || type == 'gb') && (citys??&&citys?size=0)>
    褰撳墠瀹氫綅鍩庡競
    diff --git a/projects/fangjia-open/src/main/webapp/user/reqLoginPage.ftl b/projects/fangjia-open/src/main/webapp/user/reqLoginPage.ftl index 621633126..f9d2c03e3 100644 --- a/projects/fangjia-open/src/main/webapp/user/reqLoginPage.ftl +++ b/projects/fangjia-open/src/main/webapp/user/reqLoginPage.ftl @@ -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("鍙戦�佸け璐ワ紝璇烽噸璇�"); diff --git a/projects/fangjia-open/src/main/webapp/user/setup.ftl b/projects/fangjia-open/src/main/webapp/user/setup.ftl index a173193de..797f87a6c 100644 --- a/projects/fangjia-open/src/main/webapp/user/setup.ftl +++ b/projects/fangjia-open/src/main/webapp/user/setup.ftl @@ -67,7 +67,7 @@