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

This commit is contained in:
2021-12-10 10:42:20 +08:00
32 changed files with 810 additions and 99 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
@@ -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;
}
}
@@ -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.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,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;
}
}
@@ -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,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<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){
double price = Double.valueOf((String)jo.get("price"));
int 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);
@@ -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<String, Object> 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<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 {
@@ -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;
}
}
@@ -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<String, List<ReportFileAttach>> 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<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;
}
}
@@ -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<JSONObject> getDistrictByBhbank(String address){
List<JSONObject> list = new ArrayList<JSONObject>();
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<JSONObject> list = new ArrayList<JSONObject>();
Map params = new HashMap();
params.put("queryId",queryId);
if(StringUtils.isNotBlank(reportMsg)){
params.put("reportMsg",reportMsg);
}
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;
}
}
@@ -17,6 +17,7 @@
<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>
@@ -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>
@@ -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",
@@ -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{
@@ -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>
@@ -385,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>
@@ -429,7 +429,13 @@
<#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>
@@ -521,7 +527,7 @@
onClick: function () {
$("a.create-actions08").empty().text(this.text).addClass("selected")
$("#fileClass").val("1")
$("input[name=reportFiles]").attr("accept","application/pdf")
$("input[name=reportFiles]").attr("accept","image/*")
}
},
{
@@ -563,11 +569,11 @@ function changeFile(d){
var val = $(d).attr("accept")
if(val==""){
var fileClass = $("#fileClass").val()
if(fileClass == "1"){
$(d).attr("accept","application/pdf")
}else{
// if(fileClass == "1"){
// $(d).attr("accept","application/pdf")
// }else{
$(d).attr("accept","image/*")
}
// }
}
}
</script>
@@ -387,6 +387,7 @@
<script type="text/javascript">
var eId = '${fjtEvaluation.id!}';
showOtherSource(eId);
var role = ${role}
//showTradeReference(eId);
showHouseReference(eId);
$("#evalRows").click(function(){
@@ -2014,7 +2014,13 @@ public class DistrictServiceImpl implements DistrictService {
params.add(new QueryParam("city", ClientUtils.escapeQueryChars(city)));
}
if (StringUtils.isNotBlank(region)) {
params.add(new QueryParam("region", ClientUtils.escapeQueryChars(RegionData.formatRegion(city, region))));
city = ClientUtils.escapeQueryChars(city);
String newRegion = RegionData.formatRegion(city, region);
if(StringUtils.isNotBlank(newRegion)){
params.add(new QueryParam("region", ClientUtils.escapeQueryChars(newRegion)));
}else{
params.add(new QueryParam("region", region));
}
}
if (StringUtils.isNotBlank(target)) {
params.add(new QueryParam("category", target));
@@ -0,0 +1,12 @@
package com.fangjia.service.sql;
import com.fangjia.dal.sql.model.FormalReport;
public interface FormalReportService {
FormalReport findFormalReportById(long evaluationId);
void save(FormalReport formalReport);
void update(FormalReport formalReport);
}
@@ -0,0 +1,37 @@
package com.fangjia.service.sql;
import com.fangjia.dal.QueryParam;
import com.fangjia.dal.sql.fangjia.dao.FormalReportDao;
import com.fangjia.dal.sql.model.FormalReport;
import java.util.ArrayList;
import java.util.List;
public class FormalReportServiceImpl implements FormalReportService {
private FormalReportDao formalReportDao;
public FormalReportDao getFormalReportDao() {
return formalReportDao;
}
public void setFormalReportDao(FormalReportDao formalReportDao) {
this.formalReportDao = formalReportDao;
}
@Override
public FormalReport findFormalReportById(long evaluationId) {
List<QueryParam> params = new ArrayList<QueryParam>(1);
params.add(new QueryParam("evaluationId", evaluationId));
return formalReportDao.findFirstByParams(params);
}
@Override
public void save(FormalReport formalReport) {
formalReportDao.save(formalReport);
}
@Override
public void update(FormalReport formalReport) {
formalReportDao.update(formalReport);
}
}
@@ -10,4 +10,6 @@ public interface ReportFileAttachService {
ReportFileAttach findFirstByParams(Integer evaluationId, String queryId, Integer userId, Integer fileClass, String fileName);
List<ReportFileAttach> findAllByParams(Integer evaluationId, String queryId, Integer userId);
List<ReportFileAttach> findHouseImage(Integer evaluationId, Integer fileClass);
}
@@ -42,4 +42,12 @@ public class ReportFileAttachServiceImpl implements ReportFileAttachService{
params.add(new QueryParam("queryId", queryId));
return reportFileAttachDao.findAllByParams(params);
}
@Override
public List<ReportFileAttach> findHouseImage(Integer evaluationId, Integer fileClass) {
List<QueryParam> params = new ArrayList<QueryParam>();
params.add(new QueryParam("evaluationId", evaluationId));
params.add(new QueryParam("fileClass", fileClass));
return reportFileAttachDao.findAllByParams(params);
}
}
@@ -1,5 +1,7 @@
package com.fangjia.service.util;
import org.apache.commons.lang.StringUtils;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -29,6 +31,29 @@ public class CookieUtils {
}
public static boolean removeCookie(HttpServletRequest request, HttpServletResponse response, String name) {
if(request.getCookies() == null){
return false;
}
if (StringUtils.isBlank(name)) {
return false;
}
Cookie[] cookies = request.getCookies();
if (null != cookies) {
for (Cookie cookie : cookies) {
if (name.equals(cookie.getName())) {
cookie.setValue(null);
cookie.setMaxAge(0);
cookie.setPath("/");
response.addCookie(cookie);
return true;
}
}
}
return false;
}
public static void setCookie(String name, String value, String path,int maxAge, HttpServletResponse response){
Cookie cookie = new Cookie(name, value);
if(path != null){
@@ -80,6 +80,8 @@ public class GetFileServlet2 extends HttpServlet {
String reqUrl = req.getRequestURI();
String i = reqUrl.substring(reqUrl.indexOf("/fs/") + 4, reqUrl.length());
System.out.println(i);
if (StringUtils.isBlank(i)) {
resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
return;
@@ -424,7 +424,7 @@
.trend01a p small{display:block;text-align:center;font-size:12px;color:#999;margin-bottom:10px;}
.trend01b{overflow:hidden;}
.trend01b div{width:350px;height:110px;background:url(../../../images/fangjia/v5/evaluation_line.png);border:solid 1px #e7ecf1;padding-top:30px;float:left;margin-right:72px;}
.trend01b div{width:20%;height:110px;background:url(../../../images/fangjia/v5/evaluation_line.png);border:solid 1px #e7ecf1;padding-top:30px;float:left;margin-right:72px;}
.trend01b div label{display:block;text-align:center;color:#666;line-height:40px;}
.trend01b div em{display:block;text-align:center;font-size:36px;}