修改代码字符编码

This commit is contained in:
2026-02-24 17:53:50 +08:00
parent 2495fe5f6d
commit c8418c7d4b
5195 changed files with 121754 additions and 121754 deletions
+2 -2
View File
@@ -7,7 +7,7 @@
<version>0.0.1-SNAPSHOT</version>
<name>fangjia-coresite</name>
<properties>
<project.build.sourceEncoding>GBK</project.build.sourceEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<finalName>fangjia-coresite</finalName>
@@ -19,7 +19,7 @@
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>GBK</encoding>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
</plugins>
@@ -38,19 +38,19 @@ public class CheckLoginInterceptor implements Interceptor {
return ret;
}
// 验证时间戳
// 验证时间戳
Calendar ca = Calendar.getInstance();
ca.setTimeInMillis(Long.parseLong(userInfo[2]));
Date cookieDate = ca.getTime();
// cookie超过2天默认失效
// cookie超过2天默认失效
ca.setTime(new Date());
ca.add(Calendar.DAY_OF_MONTH, -2);
if (cookieDate.before(ca.getTime())) {
return ret;
}
// 数据库验证用户是否有记录
// 数据库验证用户是否有记录
int userId = Integer.parseInt(userInfo[0]);
if (!userService.checkMediaUser(userId, userInfo[1])) {
return ret;
@@ -36,7 +36,7 @@ public class CoresiteContextLoaderListener extends ContextLoaderListener {
}
super.contextInitialized(event);
// // Ô¤ÈÈ
// // 预热
// if (LOGGER.isInfoEnabled()) {
// LOGGER.info("warm up keyword links...");
// }
@@ -57,8 +57,8 @@ public class CoresiteContextLoaderListener extends ContextLoaderListener {
}
LOGGER.info("warm up city,region");
ServerAreaData.getServerAreaByDisplay("ÉϺ£");
RegionData.formatRegion("ÖØÇì", "½­±±");
ServerAreaData.getServerAreaByDisplay("上海");
RegionData.formatRegion("重庆", "江北");
if (LOGGER.isInfoEnabled()) {
LOGGER.info("warm up ip seeker...");
@@ -130,7 +130,7 @@ public class FangjiaConfig extends Configuration {
}
/**
* 是否启用页面静态缓存,默认为false
* 是否启用页面静态缓存,默认为false
*
* @return
*/
@@ -139,7 +139,7 @@ public class FangjiaConfig extends Configuration {
}
/**
* 得到页面静态缓存的存放路径
* 得到页面静态缓存的存放路径
*
* @return
*/
@@ -148,7 +148,7 @@ public class FangjiaConfig extends Configuration {
}
/**
* 得到fangjia网spider的user agent,默认为goojiaSpider
* 得到fangjia网spider的user agent,默认为goojiaSpider
*
* @return
*/
@@ -157,7 +157,7 @@ public class FangjiaConfig extends Configuration {
}
/**
* 得到网站根域名
* 得到网站根域名
*
* @return
*/
@@ -240,7 +240,7 @@ public class FangjiaConfig extends Configuration {
}
/**
* 是否开启google 统计
* 是否开启google 统计
*
* @return
*/
@@ -249,7 +249,7 @@ public class FangjiaConfig extends Configuration {
}
/**
* 全站检索列表分页最大页码
* 全站检索列表分页最大页码
*
* @return
*/
@@ -258,7 +258,7 @@ public class FangjiaConfig extends Configuration {
}
/**
* 内部链接关键字
* 内部链接关键字
*
* @return
*/
@@ -267,7 +267,7 @@ public class FangjiaConfig extends Configuration {
}
/**
* 上海的推荐学校
* 上海的推荐学校
*
* @return
*/
@@ -24,7 +24,7 @@ import com.fangjia.service.cnAnalyzer.Token;
public class FangjiaRudder {
/**
* 全部首页跳转控制
* 全部首页跳转控制
*
* @param keyword
* @return
@@ -40,12 +40,12 @@ public class FangjiaRudder {
}
if (tokens.get(0).containsType(KeywordEnum.city)) {
ServerArea sa = ServerAreaData.getServerAreaByDisplayDefaultNull(tokens.get(0).getName().replace("市", ""));
ServerArea sa = ServerAreaData.getServerAreaByDisplayDefaultNull(tokens.get(0).getName().replace("市", ""));
if (sa == null) {
return null;
}
if (!isCurrentCity(tokens.get(0).getName())) {
sa = ServerAreaData.getServerAreaByDisplay(tokens.get(0).getName().replace("市", ""));
sa = ServerAreaData.getServerAreaByDisplay(tokens.get(0).getName().replace("市", ""));
return switchCity(sa.getName(), keyword);
}
}
@@ -82,7 +82,7 @@ public class FangjiaRudder {
}
/**
* 列表页跳转控制
* 列表页跳转控制
*
* @param keyword
* @return
@@ -98,13 +98,13 @@ public class FangjiaRudder {
}
if (tokens.get(0).containsType(KeywordEnum.city)) {
ServerArea sa = ServerAreaData.getServerAreaByDisplayDefaultNull(tokens.get(0).getName().replace("市", ""));
ServerArea sa = ServerAreaData.getServerAreaByDisplayDefaultNull(tokens.get(0).getName().replace("市", ""));
if (sa == null) {
return null;
}
if (!isCurrentCity(tokens.get(0).getName())) {
sa = ServerAreaData.getServerAreaByDisplay(tokens.get(0).getName().replace("市", ""));
sa = ServerAreaData.getServerAreaByDisplay(tokens.get(0).getName().replace("市", ""));
return switchCity(sa.getName(), keyword);
}
}
@@ -234,16 +234,16 @@ public class FangjiaRudder {
private static Map<String, String> WORD_CAT_MAP = new HashMap<String, String>();
static {
WORD_CAT_MAP.put("二手房", "ershoufang");
WORD_CAT_MAP.put("房子", "ershoufang");
WORD_CAT_MAP.put("租房", "zufang");
WORD_CAT_MAP.put("出租房", "zufang");
WORD_CAT_MAP.put("小区", "xiaoqu");
WORD_CAT_MAP.put("新房", "xinfang");
WORD_CAT_MAP.put("新盘", "xinfang");
WORD_CAT_MAP.put("地图", "map/list");
WORD_CAT_MAP.put("新闻", "zixun");
WORD_CAT_MAP.put("估价", "evaluation/report");
WORD_CAT_MAP.put("评估", "evaluation/report");
WORD_CAT_MAP.put("二手房", "ershoufang");
WORD_CAT_MAP.put("房子", "ershoufang");
WORD_CAT_MAP.put("租房", "zufang");
WORD_CAT_MAP.put("出租房", "zufang");
WORD_CAT_MAP.put("小区", "xiaoqu");
WORD_CAT_MAP.put("新房", "xinfang");
WORD_CAT_MAP.put("新盘", "xinfang");
WORD_CAT_MAP.put("地图", "map/list");
WORD_CAT_MAP.put("新闻", "zixun");
WORD_CAT_MAP.put("估价", "evaluation/report");
WORD_CAT_MAP.put("评估", "evaluation/report");
}
}
@@ -45,7 +45,7 @@ import com.fangjia.service.mongo.fangjia.RegionBlockService;
import com.fangjia.service.web.IdMapService;
/**
* fangjia-coresite的URL映射
* fangjia-coresite的URL映射
*
* @author dxy
*
@@ -83,7 +83,7 @@ public class FangjiaUrlMapper extends org.sothis.web.mvc.urlrewrite.AbstractUrlR
}
}
// 老网站的url跳转
// 老网站的url跳转
try {
return processGoojiaUrl(uri, request, response);
} catch (IOException e) {
@@ -136,7 +136,7 @@ public class FangjiaUrlMapper extends org.sothis.web.mvc.urlrewrite.AbstractUrlR
Pattern seopagePattern = Pattern.compile(".*--z-(\\d+)$");
/**
* 处理老网站的URL
* 处理老网站的URL
*
* @param uri
* @param request
@@ -150,7 +150,7 @@ public class FangjiaUrlMapper extends org.sothis.web.mvc.urlrewrite.AbstractUrlR
return uri;
}
//2015-08-11注释了,已经过了好几年了
//2015-08-11注释了,已经过了好几年了
List<UrlPair> pairList = null;//GoojiaUrlParser.getInstance().getUrlPairs();
if (CollectionUtils.isEmpty(pairList)) {
return uri;
@@ -219,10 +219,10 @@ public class FangjiaUrlMapper extends org.sothis.web.mvc.urlrewrite.AbstractUrlR
newUrl = StringUtils.substringBeforeLast(newUrl, "/");
// 没有找到对应小区,把小区名替换为空
// 没有找到对应小区,把小区名替换为空
newUrl = newUrl.replace("${districtName}", "");
if (newUrl.indexOf("$") > 0) {
// 如还有别的变量,返回到小区列表
// 如还有别的变量,返回到小区列表
newUrl = "xiaoqu/" + getKeyword(request);
}
@@ -249,7 +249,7 @@ public class FangjiaUrlMapper extends org.sothis.web.mvc.urlrewrite.AbstractUrlR
newUrl = newUrl.replace("${id}", newId);
} else {
if (newUrl.indexOf("$") < 0) {
// newUrl不变
// newUrl不变
} else if (CategoryEnum.sell.name().equals(pair.getCat())) {
newUrl = "ershoufang/" + getKeyword(request);
} else if (CategoryEnum.rent.name().equals(pair.getCat())) {
@@ -346,7 +346,7 @@ public class FangjiaUrlMapper extends org.sothis.web.mvc.urlrewrite.AbstractUrlR
String tmpCity = StringUtils.substringBefore(url, ".");
if ("www".equalsIgnoreCase(tmpCity)) {
// 用IP判断用户城市,无结果则用默认城市
// 用IP判断用户城市,无结果则用默认城市
// IpAddress ipAddress =
// ipAddressService.findByIp(AnalyticsUtil.getIpAddress(request));
// ServerArea ipCity = null;
@@ -3,7 +3,7 @@ package com.fangjia.coresite.controllers;
import com.fangjia.coresite.model.FangjiaModel;
/**
* ÁªÏµÎÒÃÇ
* 联系我们
* Created by wenyan on 2016/5/9.
*/
public class AboutController {
@@ -65,13 +65,13 @@ public class AdController {
private CustomerConsultService customerConsultService;
private static List<String> NOTICE_MOBILES = new ArrayList<String>();
static {
NOTICE_MOBILES.add("13916992399"); // 蒋
NOTICE_MOBILES.add("13681915777"); // 钟
NOTICE_MOBILES.add("15201904147");//姚嘉毅
NOTICE_MOBILES.add("13916992399"); // 蒋
NOTICE_MOBILES.add("13681915777"); // 钟
NOTICE_MOBILES.add("15201904147");//姚嘉毅
}
/**
* 显示一个具体的广告
* 显示一个具体的广告
*
* @param id
* @return
@@ -85,7 +85,7 @@ public class AdController {
}
/**
* 显示一个默认广告
* 显示一个默认广告
*
* @param model
* @return
@@ -123,7 +123,7 @@ public class AdController {
}
public Object sendCodeAction(AdModel model) {
// 验证一下是否从页面发起的请求,防止攻击
// 验证一下是否从页面发起的请求,防止攻击
String refererUrl = model.getRefererUrl();
if (!"fangjia.com".equals(DataUtil.urlToSiteName(refererUrl))) {
return Models.NOT_FOUNT;
@@ -132,43 +132,43 @@ public class AdController {
AdJsonModel ret = new AdJsonModel();
String mobile = model.getMobile();
if (StringUtils.isBlank(mobile)) {
ret.setMsg("请输入联系手机号码");
ret.setMsg("请输入联系手机号码");
return ret;
}
Pattern pattern = Pattern.compile("^1[3|4|5|8][0-9]\\d{4,8}$");
Matcher matcher = pattern.matcher(mobile);
if (!matcher.matches()) {
ret.setMsg("手机号码不正确");
ret.setMsg("手机号码不正确");
return ret;
}
if ("taste".equals(model.getType())) {
ReportTaste sendedTaste = reportTasteService.findSendedByMobile(mobile);
if (null != sendedTaste) {
ret.setMsg("该手机用户已获得了免费体验,<br/>请付费购买《房调报告》,谢谢!");
ret.setMsg("该手机用户已获得了免费体验,<br/>请付费购买《房调报告》,谢谢!");
return ret;
}
int todayCount = smsCodeService.findMobileCodesToday(mobile, "taste");
if (todayCount > 1) {
ret.setMsg("该手机号今日已申请过免费体验,<br/>每个手机号每天只能申请1次,谢谢参与!");
ret.setMsg("该手机号今日已申请过免费体验,<br/>每个手机号每天只能申请1次,谢谢参与!");
return ret;
}
}
try {
smsCodeService.sendCode(mobile, model.getType());
ret.setMsg("验证码已发送,请注意查收");
ret.setMsg("验证码已发送,请注意查收");
} catch (SmsException e) {
LOGGER.error("fangjiatong2 send sms cod error:", e);
ret.setMsg("发送失败,请稍后重试");
ret.setMsg("发送失败,请稍后重试");
}
return ret;
}
public Object saveFjtAppAction(AdModel model, HttpServletRequest request, HttpServletResponse response) {
// 验证一下是否从页面发起的请求,防止攻击
// 验证一下是否从页面发起的请求,防止攻击
String refererUrl = model.getRefererUrl();
if (!"fangjia.com".equals(DataUtil.urlToSiteName(refererUrl))) {
return Models.NOT_FOUNT;
@@ -184,18 +184,18 @@ public class AdController {
String password = getPass(8);
if (StringUtils.isBlank(name) || StringUtils.isBlank(company) || StringUtils.isBlank(email)
|| StringUtils.isBlank(mobile) || StringUtils.isBlank(code)|| StringUtils.isBlank(cityName)) {
ret.setMsg("请将信息输入完整");
ret.setMsg("请将信息输入完整");
return ret;
}
String dbCode = smsCodeService.findCodeByMobile(mobile, "fjt");
if (null == dbCode) {
// ret.setMsg("验证码已过期,请重新发送");
// ret.setMsg("验证码已过期,请重新发送");
ret.setMsg("error");
return ret;
}
if (!dbCode.equals(code)) {
// ret.setMsg("手机验证码不正确");
// ret.setMsg("手机验证码不正确");
ret.setMsg("error");
return ret;
}
@@ -206,14 +206,14 @@ public class AdController {
return ret;
}
// ret.setMsg("申请成功,请等待客服处理");
// ret.setMsg("申请成功,请等待客服处理");
CookieContext cookieContext = CoresiteCookieContext.getInstance();
String rgTimes = cookieContext.getCookieValue(request, "rg_times");
String limitTime = cookieContext.getCookieValue(request, "limit_time");
JSONObject login_ret = fjtLoginService.regist(email, password, rgTimes, limitTime, "3", 2);
if (null == login_ret || login_ret.isNullObject()) {
ret.setMsg("服务器异常,请稍后注册");
ret.setMsg("服务器异常,请稍后注册");
} else if (login_ret.getInt("code") == 0) {
CpdbApplication entity = new CpdbApplication();
entity.setName(DataUtil.removeHtml(name));
@@ -250,7 +250,7 @@ public class AdController {
ret.setMsg("OK");
try {
StringBuffer text = new StringBuffer();
text.append("您申请的房价通试用账号用户名:").append(email).append(",密码:").append(password).append(",两天内有效。客服:021-6239 2522");
text.append("您申请的房价通试用账号用户名:").append(email).append(",密码:").append(password).append(",两天内有效。客服:021-6239 2522");
smsService.send(mobile, text.toString());
} catch (Exception e) {
LOGGER.error("fangjiatong2 send sms cod error:", e);
@@ -263,11 +263,11 @@ public class AdController {
}
/**
* 生成随机密码
* 生成随机密码
*
* @param passLenth
* 生成的密码长度
* @return 随机密码
* 生成的密码长度
* @return 随机密码
*/
public static String getPass(int passLenth) {
StringBuffer buffer = new StringBuffer("0123456789abcdefghijklmnopqrstuvwxyz");
@@ -275,7 +275,7 @@ public class AdController {
Random r = new Random();
int range = buffer.length();
for (int i = 0; i < passLenth; i++) {
// 生成指定范围类的随机数0—字符串长度(包括0、不包括字符串长度)
// 生成指定范围类的随机数0—字符串长度(包括0、不包括字符串长度)
sb.append(buffer.charAt(r.nextInt(range)));
}
return sb.toString();
@@ -301,7 +301,7 @@ public class AdController {
}
public Object saveCustomerConsultAction(AdModel model, HttpServletRequest request, HttpServletResponse response){
// 验证一下是否从页面发起的请求,防止攻击
// 验证一下是否从页面发起的请求,防止攻击
String refererUrl = model.getRefererUrl();
if (!"fangjia.com".equals(DataUtil.urlToSiteName(refererUrl))) {
return Models.NOT_FOUNT;
@@ -317,21 +317,21 @@ public class AdController {
if (StringUtils.isBlank(name) || StringUtils.isBlank(company) || StringUtils.isBlank(mobile)
|| StringUtils.isBlank(email)) {
ret.setMsg("请将信息输入完整");
ret.setMsg("请将信息输入完整");
return ret;
}
Pattern p = Pattern.compile("^1[3|4|5|8][0-9]\\d{4,8}$");
Matcher m = p.matcher(mobile);
if (!m.matches()) {
ret.setMsg("手机号码不正确");
ret.setMsg("手机号码不正确");
return ret;
}
p = Pattern.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
m = p.matcher(email);
if (!m.matches()) {
ret.setMsg("电子邮箱不正确");
ret.setMsg("电子邮箱不正确");
return ret;
}
CustomerConsult consult = new CustomerConsult();
@@ -343,7 +343,7 @@ public class AdController {
consult.setIp(AnalyticsUtil.getIpAddress(request));
consult.setSource("CPDB");
customerConsultService.save(consult);
String smsContent ="FangJia China(来自CPDB) 收到留言:\n " + "联系人:" + consult.getName() + " \n邮箱:" + consult.getEmail() + " \n联系电话:" +consult.getPhone()+"\n";
String smsContent ="FangJia China(来自CPDB) 收到留言:\n " + "联系人:" + consult.getName() + " \n邮箱:" + consult.getEmail() + " \n联系电话:" +consult.getPhone()+"\n";
try {
for(String mob:NOTICE_MOBILES){
smsService.send(mob, smsContent);
@@ -356,7 +356,7 @@ public class AdController {
}
public Object saveCpdbAppAction(AdModel model, HttpServletRequest request, HttpServletResponse response) {
// 验证一下是否从页面发起的请求,防止攻击
// 验证一下是否从页面发起的请求,防止攻击
String refererUrl = model.getRefererUrl();
if (!"fangjia.com".equals(DataUtil.urlToSiteName(refererUrl))) {
return Models.NOT_FOUNT;
@@ -372,21 +372,21 @@ public class AdController {
if (StringUtils.isBlank(name) || StringUtils.isBlank(company) || StringUtils.isBlank(mobile)
|| StringUtils.isBlank(email)) {
ret.setMsg("请将信息输入完整");
ret.setMsg("请将信息输入完整");
return ret;
}
Pattern p = Pattern.compile("^1[3|4|5|8][0-9]\\d{4,8}$");
Matcher m = p.matcher(mobile);
if (!m.matches()) {
ret.setMsg("手机号码不正确");
ret.setMsg("手机号码不正确");
return ret;
}
p = Pattern.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
m = p.matcher(email);
if (!m.matches()) {
ret.setMsg("电子邮箱不正确");
ret.setMsg("电子邮箱不正确");
return ret;
}
@@ -411,7 +411,7 @@ public class AdController {
String limitTime = cookieContext.getCookieValue(request, "limit_time");
JSONObject login_ret = fjtLoginService.regist(email, password, rgTimes, limitTime, "3", 2);
if (null == login_ret || login_ret.isNullObject()) {
ret.setMsg("服务器异常,请稍后注册");
ret.setMsg("服务器异常,请稍后注册");
} else if (login_ret.getInt("code") == 0) {
CpdbApplication entity = new CpdbApplication();
entity.setName(DataUtil.removeHtml(name));
@@ -439,47 +439,47 @@ public class AdController {
response.addCookie(cookie);
try {
// 发邮件给用户
// 发邮件给用户
Mail mail = new Mail();
mail.setReceiver(new MailUser(email));
mail.setSubject("房价网—中国不动产大数据库CPDB演示");
mail.setSubject("房价网—中国不动产大数据库CPDB演示");
StringBuffer emailMsg = new StringBuffer();
emailMsg.append("尊敬的用户:<br/><br/>")
.append("&emsp;&emsp;感谢您申请房价网的<b>房价数据测试平台</b>免费试用账号!<br/><br/>")
.append("&emsp;&emsp;您现在可以在48小时内免费体验<b>房价数据测试平台</b>的所有功能了!<br/><br/>")
.append("&emsp;&emsp;登陆链接:<a href=\"http://user.fangjia.com/fangjiatong2/users/userCenterLogin?__from=cpdbemail\">房价数据测试平台</a><br/>")
.append("&emsp;&emsp;用户名:")
emailMsg.append("尊敬的用户:<br/><br/>")
.append("&emsp;&emsp;感谢您申请房价网的<b>房价数据测试平台</b>免费试用账号!<br/><br/>")
.append("&emsp;&emsp;您现在可以在48小时内免费体验<b>房价数据测试平台</b>的所有功能了!<br/><br/>")
.append("&emsp;&emsp;登陆链接:<a href=\"http://user.fangjia.com/fangjiatong2/users/userCenterLogin?__from=cpdbemail\">房价数据测试平台</a><br/>")
.append("&emsp;&emsp;用户名:")
.append(email)
.append("<br/>")
.append("&emsp;&emsp;密码:")
.append("&emsp;&emsp;密码:")
.append(password)
.append("<br/><br/>")
.append("&emsp;&emsp;由于该账号为<b>限时使用</b>,所以请尽快开始使用。<br/><br/>")
.append("&emsp;&emsp;<b>房价数据测试平台</b>是凭借<b>中国不动产大数据库CPDB</b>的基础上,整合优势力量,推出的测试平台。<br/><br/>")
.append("&emsp;&emsp;CPDB大数据库包括")
.append("&emsp;&emsp;<ul><li>住宅物业的实时挂牌价格、成交参考、房源、楼盘详情、照片、地图</li>")
.append("&emsp;&emsp;<li>商业地产的均价、详情、消费分析、竞争对手情报</li>")
.append("&emsp;&emsp;<li>城市行情、历史数据等</li></ul><br/>")
.append("&emsp;&emsp;CPDB(China Property Data Base)是由房价网通过<b>10年积累</b>和国际领先的<b>专利技术</b>(OLKD),打造的精确到每一户房产微观数据的“中国不动产大数据库”。<br/>")
.append("&emsp;&emsp;CPDB的数据覆盖全国<b>100个</b>城市、<b>15万</b>楼盘,拥有<b>5000万套</b>房产的个性化微观数据,革命性的实现了“<b>一户一信息</b>”,是目前中国最大、最专业、最实时的不动产微观数据库。<br/><br/>")
.append("&emsp;&emsp;关于<b>中国不动产大数据库CPDB</b>的更多相关内容,您可以通过附件中的PPT演示文稿更全面的了解。<br/><br/>")
.append("&emsp;&emsp;您可以将此封邮件转发给其他用到不动产大数据库的伙伴,比如银行、电商平台、贷款公司、评估机构、房地产营销机构、软件公司、金融类网站等等,相信给会他们带来极大帮助。<br/><br/>")
.append("&emsp;&emsp;如有任何疑问,欢迎您致电客服电话:021-6239 2522。<br/><br/>").append("&emsp;&emsp;谢谢您。<br/><br/>")
.append("&emsp;&emsp;祝您生活愉快,工作顺利。");
.append("&emsp;&emsp;由于该账号为<b>限时使用</b>,所以请尽快开始使用。<br/><br/>")
.append("&emsp;&emsp;<b>房价数据测试平台</b>是凭借<b>中国不动产大数据库CPDB</b>的基础上,整合优势力量,推出的测试平台。<br/><br/>")
.append("&emsp;&emsp;CPDB大数据库包括")
.append("&emsp;&emsp;<ul><li>住宅物业的实时挂牌价格、成交参考、房源、楼盘详情、照片、地图</li>")
.append("&emsp;&emsp;<li>商业地产的均价、详情、消费分析、竞争对手情报</li>")
.append("&emsp;&emsp;<li>城市行情、历史数据等</li></ul><br/>")
.append("&emsp;&emsp;CPDB(China Property Data Base)是由房价网通过<b>10年积累</b>和国际领先的<b>专利技术</b>(OLKD),打造的精确到每一户房产微观数据的“中国不动产大数据库”。<br/>")
.append("&emsp;&emsp;CPDB的数据覆盖全国<b>100个</b>城市、<b>15万</b>楼盘,拥有<b>5000万套</b>房产的个性化微观数据,革命性的实现了“<b>一户一信息</b>”,是目前中国最大、最专业、最实时的不动产微观数据库。<br/><br/>")
.append("&emsp;&emsp;关于<b>中国不动产大数据库CPDB</b>的更多相关内容,您可以通过附件中的PPT演示文稿更全面的了解。<br/><br/>")
.append("&emsp;&emsp;您可以将此封邮件转发给其他用到不动产大数据库的伙伴,比如银行、电商平台、贷款公司、评估机构、房地产营销机构、软件公司、金融类网站等等,相信给会他们带来极大帮助。<br/><br/>")
.append("&emsp;&emsp;如有任何疑问,欢迎您致电客服电话:021-6239 2522。<br/><br/>").append("&emsp;&emsp;谢谢您。<br/><br/>")
.append("&emsp;&emsp;祝您生活愉快,工作顺利。");
mail.setContent(emailMsg.toString());
mail.setImportant(true);
mail.setAttachment(true);
mail.setAttachmentDes("CPDB大数据库示例");
mail.setAttachmentName("CPDB大数据库示例.pptx");
mail.setAttachmentDes("CPDB大数据库示例");
mail.setAttachmentName("CPDB大数据库示例.pptx");
mail.setAttachmentUrl("http://static.fangjia.com/res/static_logo/CPDB.pptx");
emailService.sendHtmlMailWithFile(mail);
// smsCodeService.sendNotices("13391219237", email, mobile);
} catch (Exception e) {
LOGGER.error("fangjiatong2 send sms cod error:", e);
// ret.setMsg("发送失败,请稍后重试");
// ret.setMsg("发送失败,请稍后重试");
}
// ret.setMsg("申请成功,请等待客服处理");
// ret.setMsg("申请成功,请等待客服处理");
ret.setMsg("OK");
} else {
ret.setMsg(login_ret.getString("msg"));
@@ -54,7 +54,7 @@ import com.fangjia.service.address.analy.AddressRegionCountService;
import com.fangjia.service.address.analy.AnalyticsOverviewService;
/**
* 批量地址分析
* 批量地址分析
*/
public class AddressAnalyController {
@@ -101,7 +101,7 @@ public class AddressAnalyController {
}
public Object fjindexAction(AddressAnalyModel model, HttpServletRequest request) {
model.setTitle("风控");
model.setTitle("风控");
model.setExistsOverTask(isExistsOverTask(LoginUtil.getUserId(request), model.getTitle()));
String userId = LoginUtil.getUserId(request);
List<AddressTask> finishAddressTasks = addressTaskService.findTasksByUserId(userId, 3, 0, model.getTitle(), 5);
@@ -158,7 +158,7 @@ public class AddressAnalyController {
task.setStatus(1);
addressTaskService.update(task);
if(task.getType().equals("营销")){
if(task.getType().equals("营销")){
model.setViewParam("location", "/addressAnaly/yxindex");
}else{
model.setViewParam("location", "/addressAnaly/fjindex");
@@ -178,7 +178,7 @@ public class AddressAnalyController {
String userId = LoginUtil.getUserId(request);
if(StringUtils.isNotBlank(userId)){
String type = model.getType().equals("fk")?"风控":"营销";
String type = model.getType().equals("fk")?"风控":"营销";
List<AddressTask> addressTasks = addressTaskService.findAllEffectiveTasksByParams(userId, Arrays.asList(1,2), 0, type, 5);
if(addressTasks!=null && addressTasks.size()>0){
@@ -207,7 +207,7 @@ public class AddressAnalyController {
String userId = LoginUtil.getUserId(request);
if(StringUtils.isNotBlank(userId)){
String type = model.getType().equals("fk")?"风控":"营销";
String type = model.getType().equals("fk")?"风控":"营销";
List<AddressTask> addressTasks = addressTaskService.findTasksByParams(userId, -1, 0, type, 5);
if(addressTasks!=null && addressTasks.size()>0){
for(AddressTask task : addressTasks){
@@ -250,7 +250,7 @@ public class AddressAnalyController {
public Object yxindexAction(AddressAnalyModel model, HttpServletRequest request) {
model.setTitle("营销");
model.setTitle("营销");
model.setExistsOverTask(isExistsOverTask(LoginUtil.getUserId(request), model.getTitle()));
String userId = LoginUtil.getUserId(request);
List<AddressTask> finishAddressTasks = addressTaskService.findTasksByUserId(userId, 3, 0,model.getTitle(), 5);
@@ -274,21 +274,21 @@ public class AddressAnalyController {
BufferedOutputStream fos = null;
HSSFWorkbook wb = createSimpleExcel(model.getType());
String fileName = "抵押品模板.xls";
String fileName = "抵押品模板.xls";
if(StringUtils.isNotBlank(model.getType()) && model.getType().equals("yx")){
fileName = "精准营销模板.xls";
fileName = "精准营销模板.xls";
}
try {
HttpServletResponse response = ActionContext.getContext().getResponse();
response.setCharacterEncoding("UTF-8");
//response.reset();// 清空输出流
//response.reset();// 清空输出流
response.setContentType("application/x-download;charset=UTF-8");
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
if(fileName.length()>150){//解决IE 6.0 bug
if(fileName.length()>150){//解决IE 6.0 bug
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
}
response.setHeader( "Content-Disposition", "attachment;filename=" + fileName);
os = response.getOutputStream();// 取得输出流
os = response.getOutputStream();// 取得输出流
wb.write(os);
os.flush();
}catch (Exception e) {
@@ -312,18 +312,18 @@ public class AddressAnalyController {
private HSSFWorkbook createSimpleExcel(String type){
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet s = wb.createSheet();
wb.setSheetName(0, "样本");
wb.setSheetName(0, "样本");
HSSFCellStyle style = wb.createCellStyle(); // 样式对象
HSSFCellStyle style = wb.createCellStyle(); // 样式对象
HSSFFont font=wb.createFont();
font.setColor(HSSFColor.RED.index);//HSSFColor.VIOLET.index //字体颜色
//把字体应用到当前的样式
font.setColor(HSSFColor.RED.index);//HSSFColor.VIOLET.index //字体颜色
//把字体应用到当前的样式
style.setFont(font);
style.setWrapText(true);
HSSFRow onerow = s.createRow(0);
onerow.createCell(0).setCellValue("城市(必填)");
onerow.createCell(1).setCellValue("地址(必填)");
onerow.createCell(0).setCellValue("城市(必填)");
onerow.createCell(1).setCellValue("地址(必填)");
s.setColumnWidth(0, 15 * 256);
s.setColumnWidth(1, 50 * 256);
@@ -332,30 +332,30 @@ public class AddressAnalyController {
s.setColumnWidth(4, 50 * 256);
if(type.equals("yx")){
onerow.createCell(2).setCellValue("面积");
onerow.createCell(3).setCellValue("客户价值指数");
onerow.createCell(2).setCellValue("面积");
onerow.createCell(3).setCellValue("客户价值指数");
HSSFCell cell = onerow.createCell(4);
cell.setCellValue("备注:1.表头不可修改\r\n 2.免费试用城市仅支持上海\r\n 3. 在中国,房产资产是用户最大的资产项,房产价值在最大程度上表明了一个中国用户的财富和购买力指数。\r\n 而“客户价值指数”是地址对应客户的价值特征值,可以是指数,可以是账户资产,客单价,访问频率,购买力等衡量客户等级的数值。可以根据该数值和客户资产价值为您进行客户价值分类,挖掘潜在客户。");
cell.setCellValue("备注:1.表头不可修改\r\n 2.免费试用城市仅支持上海\r\n 3. 在中国,房产资产是用户最大的资产项,房产价值在最大程度上表明了一个中国用户的财富和购买力指数。\r\n 而“客户价值指数”是地址对应客户的价值特征值,可以是指数,可以是账户资产,客单价,访问频率,购买力等衡量客户等级的数值。可以根据该数值和客户资产价值为您进行客户价值分类,挖掘潜在客户。");
cell.setCellStyle(style);
}else{
onerow.createCell(2).setCellValue("面积(必填)");
onerow.createCell(3).setCellValue("贷款余额");
onerow.createCell(2).setCellValue("面积(必填)");
onerow.createCell(3).setCellValue("贷款余额");
HSSFCell cell = onerow.createCell(4);
cell.setCellValue("备注:1.表头不可修改,请按照给出的样例插入数据。\r\n 2.免费试用城市仅支持上海。\r\n 3.输入贷款余额可以算出CLTV(即时抵押率),及时将超过预警的房产导出,有针对性的进行处理。");
cell.setCellValue("备注:1.表头不可修改,请按照给出的样例插入数据。\r\n 2.免费试用城市仅支持上海。\r\n 3.输入贷款余额可以算出CLTV(即时抵押率),及时将超过预警的房产导出,有针对性的进行处理。");
cell.setCellStyle(style);
}
HSSFRow row1 = s.createRow(1);
row1.createCell(0).setCellValue("上海");
row1.createCell(0).setCellValue("上海");
if(type.equals("yx")){
row1.createCell(1).setCellValue("上海市闵行区中春路8888弄218号102室");
row1.createCell(1).setCellValue("上海市闵行区中春路8888弄218号102室");
row1.createCell(2).setCellValue("144");
row1.createCell(3).setCellValue("3600355.43");
}else{
row1.createCell(1).setCellValue("上海市浦东新区莱阳路301弄17号402室");
row1.createCell(1).setCellValue("上海市浦东新区莱阳路301弄17号402室");
row1.createCell(2).setCellValue("57.49");
row1.createCell(3).setCellValue("501230");
}
@@ -376,9 +376,9 @@ public class AddressAnalyController {
/**
* 获取地址分析结果
* 获取地址分析结果
* @author yinjihuan
* @date 2016年6月24日
* @date 2016年6月24日
* @param model
* @return
*/
@@ -395,9 +395,9 @@ public class AddressAnalyController {
result.setFileName(addressTask.getFileName());
result.setFinishDate(DateUtil.formatByPattern(addressTask.getFinishDate(), "yyyy-MM-dd HH:mm"));
//根据任务ID查询分析的结果数据
//根据任务ID查询分析的结果数据
AnalyticsOverview overview = analyticsOverviewService.getAnalyticsOverview(taskId);
//区域个数信息
//区域个数信息
List<RegionInfo> regionInfos = new ArrayList<RegionInfo>();
List<AddressRegionCount> addressRegionCountList = addressRegionCountService.queryAddressRegionCountByTaskId(model.getTaskId(), model.getQueryCity());
for (AddressRegionCount addReg : addressRegionCountList) {
@@ -405,7 +405,7 @@ public class AddressAnalyController {
}
result.setRegionInfos(regionInfos);
//价格区间个数信息
//价格区间个数信息
List<PriceSectionInfo> priceSectionInfos = new ArrayList<PriceSectionInfo>();
Map<String, Integer> totalPriceMap = overview.getTotalPriceDistribution();
for (String key : totalPriceMap.keySet()) {
@@ -413,7 +413,7 @@ public class AddressAnalyController {
}
result.setPriceSectionInfos(priceSectionInfos);
//房产总价走势信息
//房产总价走势信息
List<DistrictTotalPriceInfo> districtTotalPriceInfos = new ArrayList<DistrictTotalPriceInfo>();
Map<String, Long> totalAssetsMap = overview.getTotalAssetsTrend();
for (String key : totalAssetsMap.keySet()) {
@@ -422,10 +422,10 @@ public class AddressAnalyController {
result.setDistrictTotalPriceInfos(districtTotalPriceInfos);
if(districtTotalPriceInfos.size() > 0){
//房产总价
//房产总价
result.setDistrictTotalPrice(districtTotalPriceInfos.get(districtTotalPriceInfos.size()-1).getTotalPrice());
if (model.getType().equals("yingxiao")){
//住宅类型数量信息
//住宅类型数量信息
List<DistrictTypeCountInfo> districtTypeCountInfos = new ArrayList<DistrictTypeCountInfo>();
Map<String, Integer> estateTypeMap = overview.getEstateTypeDistribution();
for (String key : estateTypeMap.keySet()) {
@@ -433,7 +433,7 @@ public class AddressAnalyController {
}
result.setDistrictTypeCountInfos(districtTypeCountInfos);
//房价客户价值信息
//房价客户价值信息
List<List<Object>> totalPriceAndCustomerValues = new ArrayList<List<Object>>();
List<AddressAnalyticsResult> results = addressAnalyticsResultService.queryAddressAnalyticsResults(taskId);
@@ -454,7 +454,7 @@ public class AddressAnalyController {
}
if (model.getType().equals("fengkong")){
//涨跌幅信息
//涨跌幅信息
List<List<Object>> totalPriceAndFloatInfos = new ArrayList<List<Object>>();
List<AddressAnalyticsResult> results = addressAnalyticsResultService.queryAddressAnalyticsResults(taskId);
for (AddressAnalyticsResult re : results) {
@@ -472,7 +472,7 @@ public class AddressAnalyController {
dieZhangFuInfos.add(new DistrictFloatInfo("fall", addressAnalyticsResultService.queryDistrictFloatInfo(taskId, "fall")));
result.setDieZhangFuInfos(dieZhangFuInfos);
//贷款余额信息
//贷款余额信息
List<List<Object>> totalPriceAndBalanceInfos = new ArrayList<List<Object>>();
for (AddressAnalyticsResult re : results) {
if(re.getTotalPrice() != null) {
@@ -497,9 +497,9 @@ public class AddressAnalyController {
}
/**
* 获取贷款余额LVR预警数据
* 获取贷款余额LVR预警数据
* @author yinjihuan
* @date 2016年6月28日
* @date 2016年6月28日
* @param model
* @return
*/
@@ -530,10 +530,10 @@ public class AddressAnalyController {
}
/**
* 查询解析后的价格数据,百度地图展示用
* 查询解析后的价格数据,百度地图展示用
*
* @author yinjihuan
* @date 2016年6月27日
* @date 2016年6月27日
* @param model
* @return
*/
@@ -541,7 +541,7 @@ public class AddressAnalyController {
AddressAnalyJsonModel result = new AddressAnalyJsonModel();
if(model.getCurPage() == null) model.setCurPage(1);
if(model.getPageSize() == null) model.setPageSize(100);
//地址解析后的价格信息 地图上显示
//地址解析后的价格信息 地图上显示
List<AddressAnalyPriceInfo> addressAnalyPriceInfos = new ArrayList<AddressAnalyPriceInfo>();
//List<AddressAnalyticsResult> addressAnalyticList = addressAnalyticsResultService.queryAddressAnalyticsResultByTaskId(model.getTaskId(), model.getCurPage(), model.getPageSize());
List<AddressAnalyticsResult> addressAnalyticList = addressAnalyticsResultService.queryAddressAnalyticsResultByTaskId(model.getTaskId(), model.getCurPage(), Integer.MAX_VALUE);
@@ -560,9 +560,9 @@ public class AddressAnalyController {
}
/**
* 导出图表数据
* 导出图表数据
* @author yinjihuan
* @date 2016年6月28日
* @date 2016年6月28日
* @param model
* @return
*/
@@ -570,30 +570,30 @@ public class AddressAnalyController {
OutputStream os = null;
BufferedOutputStream fos = null;
String[] titles = null;
String fileName = "模板.xls";
String fileName = "模板.xls";
List<Object[]> datas = new ArrayList<Object[]>();
List<AddressAnalyticsResult> results = addressAnalyticsResultService.queryAddressAnalyticsResults(model.getTaskId());
if(model.getType().equals("diezhanfu")) {
fileName = "房产总价与涨跌幅数据_"+model.getStart()+"-"+model.getEnd()+".xls";
titles = new String[]{"城市","地址", "面积", "贷款余额", "房价(元)", "涨跌幅"};
fileName = "房产总价与涨跌幅数据_"+model.getStart()+"-"+model.getEnd()+".xls";
titles = new String[]{"城市","地址", "面积", "贷款余额", "房价(元)", "涨跌幅"};
processDieZhanFu(model, datas, results);
} else if(model.getType().equals("daikuan")) {
fileName = "房产总价与贷款余额数据_"+model.getStart()+"-"+model.getEnd()+".xls";
titles = new String[]{"城市","地址", "面积", "贷款余额", "房价(元)"};
fileName = "房产总价与贷款余额数据_"+model.getStart()+"-"+model.getEnd()+".xls";
titles = new String[]{"城市","地址", "面积", "贷款余额", "房价(元)"};
processDaikuan(model, datas, results);
} else if(model.getType().equals("jiazhiPrice")) {
fileName = "房产总价数据_"+model.getStart()+"-"+model.getEnd()+".xls";
titles = new String[]{"城市","地址", "面积", "客户价值指数", "房价(元)"};
fileName = "房产总价数据_"+model.getStart()+"-"+model.getEnd()+".xls";
titles = new String[]{"城市","地址", "面积", "客户价值指数", "房价(元)"};
processJiaZhiPrice(model, datas, results);
} else if(model.getType().equals("jiazhiPriceAndValue")) {
fileName = "房产总价与客户价值数据_"+model.getStart()+"-"+model.getEnd()+".xls";
titles = new String[]{"城市","地址", "面积", "客户价值指数", "房价(元)"};
fileName = "房产总价与客户价值数据_"+model.getStart()+"-"+model.getEnd()+".xls";
titles = new String[]{"城市","地址", "面积", "客户价值指数", "房价(元)"};
processJiaZhiPriceAndValue(model, datas, results);
}else if(model.getType().equals("fengkong")) {
AddressTask task = addressTaskService.findTaskById(model.getTaskId());
fileName = task.getFileName().substring(0, task.getFileName().lastIndexOf("."))+".xls";
titles = new String[]{"城市","地址", "面积", "贷款余额", "房产总价"};
titles = new String[]{"城市","地址", "面积", "贷款余额", "房产总价"};
List<AddressDetail> addressDetails = addressDetailService.findAddressDetailById(model.getTaskId());
Map<Integer, AddressAnalyticsResult> resultMap = getAnalyticsMap(results);
@@ -613,7 +613,7 @@ public class AddressAnalyController {
List<AddressDetail> addressDetails = addressDetailService.findAddressDetailById(model.getTaskId());
Map<Integer, AddressAnalyticsResult> resultMap = getAnalyticsMap(results);
fileName = task.getFileName().substring(0, task.getFileName().lastIndexOf("."))+".xls";
titles = new String[]{"城市","地址", "面积", "客户价值指数", "房产总价"};
titles = new String[]{"城市","地址", "面积", "客户价值指数", "房产总价"};
for (AddressDetail detail : addressDetails) {
AddressAnalyticsResult analy = resultMap.get(detail.getNumber());
if(analy == null){
@@ -629,14 +629,14 @@ public class AddressAnalyController {
try {
HttpServletResponse response = ActionContext.getContext().getResponse();
response.setCharacterEncoding("UTF-8");
//response.reset();// 清空输出流
//response.reset();// 清空输出流
response.setContentType("application/x-download;charset=UTF-8");
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
if(fileName.length()>150){//解决IE 6.0 bug
if(fileName.length()>150){//解决IE 6.0 bug
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
}
response.setHeader( "Content-Disposition", "attachment;filename=" + fileName);
os = response.getOutputStream();// 取得输出流
os = response.getOutputStream();// 取得输出流
wb.write(os);
os.flush();
} catch (Exception e) {
@@ -708,7 +708,7 @@ public class AddressAnalyController {
List<Object[]> datas, List<AddressAnalyticsResult> results) {
for (AddressAnalyticsResult re : results) {
if(re.getTotalPrice() != null && re.getCustomerValue() != null) {
//客户价值判断
//客户价值判断
boolean flag = false;
if(model.getOperateType().equals(1)){
if(re.getCustomerValue() >= model.getStart()){
@@ -723,7 +723,7 @@ public class AddressAnalyController {
continue;
}
boolean flag2 = false;
//房产总价判断
//房产总价判断
if(model.getOperateType2().equals(1)){
if(re.getTotalPrice() >= model.getEnd() * 10000){
flag2 = true;
@@ -786,9 +786,9 @@ public class AddressAnalyController {
this.addressAnalyApplyService = addressAnalyApplyService;
}
/**
* 判断用户是否存在完成的任务
* 判断用户是否存在完成的任务
* @author yinjihuan
* @date 2016年6月29日
* @date 2016年6月29日
* @param userId
* @return
*/
@@ -46,7 +46,7 @@ public class AddressEvaluationController {
Date curTime = new Date();
String ip = AnalyticsUtil.getIpAddress(req);
System.out.println("批量估价: "+ip);
System.out.println("批量估价: "+ip);
//if(curTime.getTime() < startTestTime.getTime() && !ip.equals("116.247.70.58")){
// model.setShowFlag("false");
//}
@@ -82,22 +82,22 @@ public class AddressEvaluationController {
OutputStream os = null;
BufferedOutputStream fos = null;
String fileName = "地址估价结果.xls";
String fileName = "地址估价结果.xls";
if(StringUtils.isNotBlank(uploadVerion)){
List<AddressInfo> addressResults = addressInfoService.findAllAnalyAddress(uploadVerion);
//String[] titles = new String[]{"省","市","区域","小区名称","产证地址","面积","楼层","总楼层","建成年代","匹配名称","匹配可信度","总价","估价类型","最终价格","房价网均价","房估估均价","云估价均价","链家均价","安居客均价","赶集网均价","搜房网均价","兔博士均价","价格对比"};
String[] titles = new String[]{"省","市","区域","小区名称","产证地址","面积","楼层","总楼层","建成年代","最终价格"};
//String[] titles = new String[]{"省","市","区域","小区名称","产证地址","面积","楼层","总楼层","建成年代","匹配名称","匹配可信度","总价","估价类型","最终价格","房价网均价","房估估均价","云估价均价","链家均价","安居客均价","赶集网均价","搜房网均价","兔博士均价","价格对比"};
String[] titles = new String[]{"省","市","区域","小区名称","产证地址","面积","楼层","总楼层","建成年代","最终价格"};
List<Object[]> datas = new ArrayList<Object[]>();
for(AddressInfo info : addressResults){
String way = "";
if("house".equals(info.getEvaluateWay())){
way = "房源估价";
way = "房源估价";
}else if("cpdb".equals(info.getEvaluateWay())){
way = "小区估价";
way = "小区估价";
}else if("geo".equals(info.getEvaluateWay())){
way = "周边估价";
way = "周边估价";
}
//datas.add(new Object[] {info.getProvince(), info.getCity(), info.getRegion(), info.getDistrictName(), info.getAddress(), info.getArea(), info.getFloor(), info.getHeight(), info.getBuildDate(),info.getMatchName(), info.getEvalCredit(), info.getTotalPrice(), way, info.getLastPrice(),info.getFjwPrice(), info.getFggPrice(), info.getYgjPrice(), info.getLianjiaPrice(), info.getAjkPrice(), info.getGanjiPrice(), info.getSoufunPrice(), info.getTbsPrice(), info.getPriceLevel()});
datas.add(new Object[] {info.getProvince(), info.getCity(), info.getRegion(), info.getDistrictName(), info.getAddress(), info.getArea(), info.getFloor(), info.getHeight(), info.getBuildDate(), info.getLastPrice()});
@@ -107,14 +107,14 @@ public class AddressEvaluationController {
try {
HttpServletResponse response = ActionContext.getContext().getResponse();
response.setCharacterEncoding("UTF-8");
//response.reset();// 清空输出流
//response.reset();// 清空输出流
response.setContentType("application/x-download;charset=UTF-8");
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
if(fileName.length()>150){//解决IE 6.0 bug
if(fileName.length()>150){//解决IE 6.0 bug
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
}
response.setHeader( "Content-Disposition", "attachment;filename=" + fileName);
os = response.getOutputStream();// 取得输出流
os = response.getOutputStream();// 取得输出流
wb.write(os);
os.flush();
} catch (Exception e) {
@@ -8,27 +8,27 @@ import com.fangjia.coresite.model.ContractModel;
/**
* 估价
* 估价
*
*/
public class AdvisoryMoreController {
public Object commAdvisoryAction(ContractModel model) throws Exception {
Map<Integer, String> map = new HashMap<Integer,String>();
map.put(1, "房产估值");
map.put(2, "地址分析");
map.put(3, "反欺诈");
map.put(4, "精准营销");
map.put(5, "商业选址");
map.put(6, "分析报告");
map.put(7, "面向银行的解决方案");
map.put(8, "面向互联网金融的解决方案");
map.put(9, "面向传统金融的解决方案");
map.put(10, "面向征信机构的解决方案");
map.put(11, "面向政府职能的解决方案");
map.put(12, "面向商业连锁的解决方案");
map.put(13, "面向评估机构的解决方案");
map.put(14, "面向更多用户的解决方案");
map.put(1, "房产估值");
map.put(2, "地址分析");
map.put(3, "反欺诈");
map.put(4, "精准营销");
map.put(5, "商业选址");
map.put(6, "分析报告");
map.put(7, "面向银行的解决方案");
map.put(8, "面向互联网金融的解决方案");
map.put(9, "面向传统金融的解决方案");
map.put(10, "面向征信机构的解决方案");
map.put(11, "面向政府职能的解决方案");
map.put(12, "面向商业连锁的解决方案");
map.put(13, "面向评估机构的解决方案");
map.put(14, "面向更多用户的解决方案");
map.put(15, model.getMess());
Integer from = model.getFrom();
if(from!=null){
@@ -46,7 +46,7 @@ import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
/**
* 用户服务协议
* 用户服务协议
*/
public class AgreementController {
@@ -65,25 +65,25 @@ public class AgreementController {
}
private Map<String,String> bankMap = new HashMap<String , String>(){{
put("中国工商银行", "ICBC");
put("中国银行","BOC");
put("中国建设银行", "CCB");
put("中国邮政储蓄银行","PSBC");
put("中信银行","ECITIC");
put("中国光大银行","CEB");
put("招商银行","CMBCHINA");
put("兴业银行","CIB");
put("浦东发展银行","SPDB");
put("平安银行","SZPA");
put("民生银行","CMBC");
put("广发银行","GDB");
put("北京银行","BCCB");
put("中国农业银行", "ABC");
put("中国交通银行","BOCO");
put("中国工商银行", "ICBC");
put("中国银行","BOC");
put("中国建设银行", "CCB");
put("中国邮政储蓄银行","PSBC");
put("中信银行","ECITIC");
put("中国光大银行","CEB");
put("招商银行","CMBCHINA");
put("兴业银行","CIB");
put("浦东发展银行","SPDB");
put("平安银行","SZPA");
put("民生银行","CMBC");
put("广发银行","GDB");
put("北京银行","BCCB");
put("中国农业银行", "ABC");
put("中国交通银行","BOCO");
}};
/**
* 用户服务协议页面
* 用户服务协议页面
* @param model
* @return
*/
@@ -113,7 +113,7 @@ public class AgreementController {
if(loanAgreement.getCardStatus()==1){
model.setReload(1);
}
if(loanAgreement.getSignStatus()!=0){ //流程已走完(已签约或拒签或失效)
if(loanAgreement.getSignStatus()!=0){ //流程已走完(已签约或拒签或失效)
model.setReload(2);
}
model.setSignStatus(loanAgreement.getSignStatus());
@@ -127,7 +127,7 @@ public class AgreementController {
}
/**
* 提交绑定银行卡
* 提交绑定银行卡
* @param model
* @return
*/
@@ -137,7 +137,7 @@ public class AgreementController {
Agreement agreement = agreementService.findById(model.getId());
if(agreement.getStatus() == 0){
map.put("success", false);
map.put("msg", "该条协议已废除");
map.put("msg", "该条协议已废除");
return JsonUtils.toJson(map);
}
LoanAgreement loanAgreement = loanAgreementService.findById(model.getLoanAgreementId());
@@ -152,7 +152,7 @@ public class AgreementController {
map.put("requestno",model.getRequestno());
if(resultMap.get("errorcode")!=null && "DK8010046".equals(resultMap.get("errorcode").toString())){
map.put("success", false);
map.put("msg", "请一分钟以后再进行操作");
map.put("msg", "请一分钟以后再进行操作");
return JsonUtils.toJson(map);
}
if((bankMap.get(model.getBank())).equals(resultMap.get("bankcode"))){
@@ -170,7 +170,7 @@ public class AgreementController {
map.put("success", true);
}else{
map.put("success", false);
map.put("msg", "银行信息填写错误");
map.put("msg", "银行信息填写错误");
}
}else{
map.put("success", false);
@@ -182,13 +182,13 @@ public class AgreementController {
}
}else{
map.put("success", false);
map.put("msg", "认证失败");
map.put("msg", "认证失败");
}
} catch (Exception e) {
map.put("success", false);
map.put("msg", "认证失败");
map.put("msg", "认证失败");
}
}else{
@@ -201,7 +201,7 @@ public class AgreementController {
}
/**
* 重发短信
* 重发短信
* @param model
* @return
*/
@@ -219,10 +219,10 @@ public class AgreementController {
yoprequest.addParam(s.getKey(), s.getValue());
}
LOGGER.error("yoprequest:"+yoprequest.getParams());
//向YOP发请求
//向YOP发请求
YopResponse yopresponse = YopClient3.postRsa(FangjiaConfig.getConfig().get("authbindcardresend","/rest/v1.0/paperorder/auth/resend"), yoprequest);
LOGGER.error("yoprequest result:"+yopresponse.toString());
//成功则进行相关处理
//成功则进行相关处理
Map<String,Object> resultMap = new HashMap<String, Object>();
if (yopresponse.getStringResult() != null) {
resultMap = JXMConvertUtil.JsonConvertHashMap(yopresponse.getStringResult());
@@ -243,17 +243,17 @@ public class AgreementController {
}
}else{
map.put("success", false);
map.put("msg", "认证失败");
map.put("msg", "认证失败");
}
} catch (Exception e) {
map.put("success", false);
map.put("msg", "认证失败");
map.put("msg", "认证失败");
}
return JsonUtils.toJson(map);
}
/**
* 确认绑卡
* 确认绑卡
* @param model
* @return
*/
@@ -275,10 +275,10 @@ public class AgreementController {
yoprequest.addParam(s.getKey(), s.getValue());
}
LOGGER.error("yoprequest:"+yoprequest.getParams());
//向YOP发请求
//向YOP发请求
YopResponse yopresponse = YopClient3.postRsa(FangjiaConfig.getConfig().get("authbindcardconfirm","/rest/v1.0/paperorder/auth/confirm"), yoprequest);
LOGGER.error("yoprequest result:"+yopresponse.toString());
//成功则进行相关处理
//成功则进行相关处理
Map<String,Object> resultMap = new HashMap<String, Object>();
if (yopresponse.getStringResult() != null) {
resultMap = JXMConvertUtil.JsonConvertHashMap(yopresponse.getStringResult());
@@ -301,13 +301,13 @@ public class AgreementController {
}
}else{
map.put("success", false);
map.put("msg", "认证失败");
map.put("msg", "认证失败");
}
} catch (Exception e) {
map.put("success", false);
map.put("msg", "认证失败");
map.put("msg", "认证失败");
}
}else{
@@ -320,17 +320,17 @@ public class AgreementController {
}
/**
* 代扣交易接口
* 代扣交易接口
* @param request
* @param response
* @return
* @throws Exception
*/
private Map<String,Object> checkCard(AgreementModel model,HttpServletResponse response,HttpServletRequest request) throws Exception{
String acc_no = model.getCardNumber();//银行卡卡号
String id_card = model.getNumber();//身份证号码
String id_holder = model.getName();//姓名
String mobile = model.getMobile();//银行预留手机号
String acc_no = model.getCardNumber();//银行卡卡号
String id_card = model.getNumber();//身份证号码
String id_holder = model.getName();//姓名
String mobile = model.getMobile();//银行预留手机号
Map<String,String> paramMap = wrapBindParams(acc_no,id_card,id_holder,mobile);
model.setMerchantno(paramMap.get("merchantno"));
model.setRequestno(paramMap.get("requestno"));
@@ -341,10 +341,10 @@ public class AgreementController {
yoprequest.addParam(s.getKey(), s.getValue());
}
LOGGER.error("yoprequest:"+yoprequest.getParams());
//向YOP发请求
//向YOP发请求
YopResponse yopresponse = YopClient3.postRsa(FangjiaConfig.getConfig().get("authbindcardreqUri","/rest/v1.0/paperorder/unified/auth/request"), yoprequest);
LOGGER.error("yoprequest result:"+yopresponse.toString());
//成功则进行相关处理
//成功则进行相关处理
Map<String,Object> result = new HashMap<String, Object>();
if (yopresponse.getStringResult() != null) {
result = JXMConvertUtil.JsonConvertHashMap(yopresponse.getStringResult());
@@ -353,27 +353,27 @@ public class AgreementController {
}
/**
* 封装绑卡验证参数
* acc_no 银行卡卡号
* id_card 身份证号码
* id_holder 姓名
* mobile 银行预留手机号
* 封装绑卡验证参数
* acc_no 银行卡卡号
* id_card 身份证号码
* id_holder 姓名
* mobile 银行预留手机号
*/
private Map<String,String> wrapBindParams(String acc_no,String id_card,String id_holder,String mobile){
String merchantno = format(FangjiaConfig.getConfig().get("merchantno","10000469946")); //商户编号
String requestno = UUID.randomUUID().toString().replace("-", ""); //业务请求号
String merchantno = format(FangjiaConfig.getConfig().get("merchantno","10000469946")); //商户编号
String requestno = UUID.randomUUID().toString().replace("-", ""); //业务请求号
String identityid = format(id_card); //用户标识
String identitytype = "ID_CARD"; //用户标识类型
String cardno = format(acc_no); //卡号
String idcardno = format(id_card); //证件号
String idcardtype = "ID"; //证件类型
String username = format(id_holder); //用户名
String phone = format(mobile); //手机号
String issms = "true"; //是否有短信验证码
//String callbackurl = format(request.getParameter("callbackurl")); //回调地址
String identityid = format(id_card); //用户标识
String identitytype = "ID_CARD"; //用户标识类型
String cardno = format(acc_no); //卡号
String idcardno = format(id_card); //证件号
String idcardtype = "ID"; //证件类型
String username = format(id_holder); //用户名
String phone = format(mobile); //手机号
String issms = "true"; //是否有短信验证码
//String callbackurl = format(request.getParameter("callbackurl")); //回调地址
String requesttime = DateUtil.formatByPattern(new Date(),"yyyy-MM-dd HH:mm:ss");;
String authtype = "COMMON_FOUR"; //鉴权类型
String authtype = "COMMON_FOUR"; //鉴权类型
Map<String,String> map = new HashMap<String,String>();
map.put("merchantno", merchantno);
@@ -396,7 +396,7 @@ public class AgreementController {
}
/**
* 明文参数
* 明文参数
* @param Url
* @param Parms
* @return
@@ -412,40 +412,40 @@ public class AgreementController {
}*/
/**
* Base64加密
* Base64加密
*/
public static String Base64Encode(String str) throws UnsupportedEncodingException {
return new BASE64Encoder().encode(str.getBytes("UTF-8"));
}
/**
* 解密
* 解密
*/
public static String Base64Decode(String str) throws UnsupportedEncodingException, IOException {
// str = str.replaceAll(" ", "+");
return new String(new BASE64Decoder().decodeBuffer(str), "UTF-8");
}
/**
* 签名保存图片
* 签名保存图片
* @param model
* @param request
* @return
*/
public Object uploadImageAction(AgreementModel model,HttpServletRequest request) {
Map<String,Object> map = new HashMap<String,Object>();
// 通过base64来转化图片
// 通过base64来转化图片
String imageFile = model.getImageFile();
if(StringUtils.isBlank(imageFile)){
map.put("success", false);
return JsonUtils.toJson(map);
}
BASE64Decoder decoder = new BASE64Decoder();
// Base64解码
// Base64解码
byte[] imageByte = null;
try {
imageByte = decoder.decodeBuffer(imageFile);
for (int i = 0; i < imageByte.length; ++i) {
if (imageByte[i] < 0) {// 调整异常数据
if (imageByte[i] < 0) {// 调整异常数据
imageByte[i] += 256;
}
}
@@ -480,7 +480,7 @@ public class AgreementController {
if(agreement != null){
if(agreement.getStatus() == 0){
map.put("success", false);
map.put("msg", "该条协议已废除");
map.put("msg", "该条协议已废除");
return JsonUtils.toJson(map);
}
String link = jsonObj.getJSONObject("result").getString("link");
@@ -506,7 +506,7 @@ public class AgreementController {
}
/**
* 拒签
* 拒签
* @param model
* @return
*/
@@ -518,7 +518,7 @@ public class AgreementController {
Agreement agreement = agreementService.findById(model.getId());
if(agreement.getStatus() == 0){
map.put("success", false);
map.put("msg", "该条协议已废除");
map.put("msg", "该条协议已废除");
return JsonUtils.toJson(map);
}
LoanAgreement loanAgreement = loanAgreementService.findById(model.getLoanAgreementId());
@@ -542,7 +542,7 @@ public class AgreementController {
}
/**
* 完成签约
* 完成签约
* @param model
* @return
*/
@@ -552,14 +552,14 @@ public class AgreementController {
Agreement agreement = agreementService.findById(model.getId());
if(agreement.getStatus() == 0){
map.put("success", false);
map.put("msg", "该条协议已废除");
map.put("msg", "该条协议已废除");
return JsonUtils.toJson(map);
}
LoanAgreement loanAgreement = loanAgreementService.findById(model.getLoanAgreementId());
if(loanAgreement.getCardStatus() != 1){
map.put("cardStatus", -1);
map.put("success", false);
map.put("msg", "请先认证卡信息");
map.put("msg", "请先认证卡信息");
return JsonUtils.toJson(map);
}
if(loanAgreement != null && agreement!=null){
@@ -581,7 +581,7 @@ public class AgreementController {
}
/*if (StringUtils.isBlank(model.getMobile()) || StringUtils.isBlank(model.getSmsCode())) {
map.put("success", false);
map.put("msg", "信息不完整");
map.put("msg", "信息不完整");
return JsonUtils.toJson(map);
}
String smsCacheCode = getCacheCode(model.getMobile(), Message.SMS_CODE_TYPE_REG);
@@ -603,10 +603,10 @@ public class AgreementController {
}
/**
* 获取缓存的验证码
* 获取缓存的验证码
* @author yinjihuan
* @param mobile 手机
* @param type 类型
* @param mobile 手机
* @param type 类型
* @return
*/
private String getCacheCode(String mobile, String type) {
@@ -46,11 +46,11 @@ import com.fangjia.service.web.FangjiaHighlighter;
import com.fangjia.service.web.MenuService;
/**
* 精品公寓controller
* 精品公寓controller
*
* @author Jenis
*
* 2018年6月29日 下午14:28:28
* 2018年6月29日 下午14:28:28
*/
public class ApartmentController {
private final static Logger LOGGER = LoggerFactory.getLogger(ApartmentController.class);
@@ -62,7 +62,7 @@ public class ApartmentController {
private AdvertisementService advertisementService;
/**
* 精品公寓列表
* 精品公寓列表
*
* @param model
* @param request
@@ -70,34 +70,34 @@ public class ApartmentController {
* @throws Exception
*/
public Object listAction(RentHouseModel model, HttpServletRequest request) throws Exception {
LOGGER.info("精品公寓 listAction(RentHouseModel model, HttpServletRequest request) 请求 开始");
boolean isBlockFormat = false; // 标记是否有不限作为条件
boolean isStationFormat = false; // 标记是否有不限作为条件
LOGGER.info("精品公寓 listAction(RentHouseModel model, HttpServletRequest request) 请求 开始");
boolean isBlockFormat = false; // 标记是否有不限作为条件
boolean isStationFormat = false; // 标记是否有不限作为条件
Pager pager = model.getPager();
if (pager == null) {
pager = new Pager(20, FangjiaConfig.getConfig().getSearchListMaxPageNo());
} else {
model.setIsPageQuery("true");// 代表请求过分页
model.setIsPageQuery("true");// 代表请求过分页
pager.setPageSize(20);
pager.setMaxPage(FangjiaConfig.getConfig().getSearchListMaxPageNo());
}
if (StringUtils.isNotBlank(model.getKeyword()) && model.getKeyword().length() > 100) {
model.setKeyword(model.getKeyword().substring(0, 100));
}
boolean facetByRegion = false;// 是否按区域,板块分面
// 格式化参数
boolean facetByRegion = false;// 是否按区域,板块分面
// 格式化参数
formatParam(model);
if ("不限".equals(model.getBlock())) {
if ("不限".equals(model.getBlock())) {
model.setBlock(null);
isBlockFormat = true;
}
if ("不限".equals(model.getStation())) {
if ("不限".equals(model.getStation())) {
model.setStation(null);
isStationFormat = true;
}
// 针对精品公寓数据筛选
// 针对精品公寓数据筛选
model.setSiteNames(Arrays.asList("ziroom.com", "mogoroom.com", "dankegongyu.com", "zhuge.com", "zhugefang.com"));
// 构造Menu菜单(Menu有缓存)
// 构造Menu菜单(Menu有缓存)
Menu menu = menuService.menuApartmentMaker(FangjiaServerAreaContextHolder.getServerAreaDefault(),
MenuCategoryEnum.zufang, getCurrentParams(), 0);
@@ -106,59 +106,59 @@ public class ApartmentController {
RentHouseQueryBean queryBean = this.buildHouseQueryBean(model);
FacetQueryResult<RentHouseBo> result = null;
// 构造排序
// 构造排序
Sort sort = getSort(model);
// 地铁+站点是通过metro_info sonar索引查找
// 地铁+站点是通过metro_info sonar索引查找
result = rentHouseService.findWithFacetSearchNoRemoveMenu(menu, pager, queryBean, sort.getFld(), sort.isAsc(),
facetByRegion);
// 当result查找为空, 仅用当前城市过滤查出房源为'猜您喜欢'
// 页面Menu参数回显不用处理, 就是让用户知道参数筛选无数据
// 当result查找为空, 仅用当前城市过滤查出房源为'猜您喜欢'
// 页面Menu参数回显不用处理, 就是让用户知道参数筛选无数据
if (CollectionUtils.isEmpty(result)) {
// 重置筛选条件
// 重置筛选条件
RentHouseModel model_ = new RentHouseModel();
BeanUtils.copyProperties(model, model_);
resetParam(model_);
// 重置pager, 猜您喜欢, 只查3条
// 重置pager, 猜您喜欢, 只查3条
pager = new Pager(3, FangjiaConfig.getConfig().getSearchListMaxPageNo());
Menu menu_similar = menuService.menuApartmentMaker(FangjiaServerAreaContextHolder.getServerAreaDefault(),
MenuCategoryEnum.zufang, getCurrentParams(), 0);
RentHouseQueryBean queryBean_ = this.buildHouseQueryBean(model_);
FacetQueryResult<RentHouseBo> result_ = null;
// 构造排序
// 构造排序
Sort sort_ = getSort(model_);
result_ = rentHouseService.findWithFacetSearchNoRemoveMenu(menu_similar, pager, queryBean_, sort_.getFld(),
sort_.isAsc(), facetByRegion);
// 构造pager
// 构造pager
pager = safeCheckPager(result_.getNumberFound(), pager);
model.setPager(pager);
// 精品公寓查询
// 精品公寓查询
model.setSimilarHouseBoList(feedAndFilterHouseBoList(result_, model));
} else {
// 构造pager
// 构造pager
pager = safeCheckPager(result.getNumberFound(), pager);
model.setPager(pager);
// 精品公寓查询
// 精品公寓查询
model.setHouseBoList(feedAndFilterHouseBoList(result, model));
}
model.setMenu(changeMenu(menu, menu_));
// 房源列表中间的广告
// 房源列表中间的广告
List<Advertisement> ads1 = getAdvertisements(AdSourceEnum.RENT_HOUSE_M_DETAIL.getId());
// 房源列表上面广告
// 房源列表上面广告
List<Advertisement> ads2 = getAdvertisements(AdSourceEnum.RENT_HOUSE_T_DETAIL.getId());
model.setMidAdList(ads1);
model.setTopAdList(ads2);
LOGGER.info("精品公寓 listAction(RentHouseModel model, HttpServletRequest request) 请求 结束");
LOGGER.info("精品公寓 listAction(RentHouseModel model, HttpServletRequest request) 请求 结束");
if (isBlockFormat) {
model.setBlock("不限");
model.setBlock("不限");
}
if (isStationFormat) {
model.setStation("不限");
model.setStation("不限");
}
return model;
}
/**
* 精品公寓列表
* 精品公寓列表
*
* @param model
* @param request
@@ -176,26 +176,26 @@ public class ApartmentController {
if (StringUtils.isNotBlank(model.getKeyword()) && model.getKeyword().length() > 100) {
model.setKeyword(model.getKeyword().substring(0, 100));
}
boolean facetByRegion = false;// 是否按区域,板块分面
// 格式化参数
boolean facetByRegion = false;// 是否按区域,板块分面
// 格式化参数
formatParam(model);
// 针对精品公寓数据筛选
// 针对精品公寓数据筛选
model.setSiteNames(Arrays.asList("ziroom.com", "mogoroom.com", "dankegongyu.com"));
// 构造Menu菜单(Menu有缓存)
// 构造Menu菜单(Menu有缓存)
Menu menu = menuService.menuApartmentMaker(FangjiaServerAreaContextHolder.getServerAreaDefault(),
MenuCategoryEnum.zufang, getCurrentParams(), 0);
RentHouseQueryBean queryBean = this.buildHouseQueryBean(model);
FacetQueryResult<RentHouseBo> result = null;
// 构造排序
// 构造排序
Sort sort = getSort(model);
// 地铁+站点是通过metro_info sonar索引查找
// 地铁+站点是通过metro_info sonar索引查找
result = rentHouseService.findWithFacetSearchNoRemoveMenu(menu, pager, queryBean, sort.getFld(), sort.isAsc(),
facetByRegion);
// 构造pager
// 构造pager
pager = safeCheckPager(result.getNumberFound(), pager);
model.setPager(pager);
// 精品公寓查询
// 精品公寓查询
model.setHouseBoList(feedAndFilterHouseBoList(result, model));
JsonModel ret = new JsonModel();
ret.setJsonModel(result);
@@ -203,7 +203,7 @@ public class ApartmentController {
}
/**
* 首页推荐房源
* 首页推荐房源
*
* @param model
* @return
@@ -214,7 +214,7 @@ public class ApartmentController {
Pager pager = model.getPager(10);
Integer menuType = 1;
model.setSiteNames(Arrays.asList("ziroom.com", "mogoroom.com", "dankegongyu.com"));
boolean facetByRegion = false;// 是否按区域,板块分面
boolean facetByRegion = false;// 是否按区域,板块分面
Menu menu = menuService.menuApartmentMaker(FangjiaServerAreaContextHolder.getServerAreaDefault(),
MenuCategoryEnum.zufang, getCurrentParams(), 0);
@@ -230,7 +230,7 @@ public class ApartmentController {
}
/**
* 精品公寓详情
* 精品公寓详情
*
* @param model
* @return
@@ -256,7 +256,7 @@ public class ApartmentController {
}
/**
* 同步最新的Menu(区域、板块不用处理, 只需要处理地铁和站点)
* 同步最新的Menu(区域、板块不用处理, 只需要处理地铁和站点)
*
* @param menu
* @param menu_
@@ -267,24 +267,24 @@ public class ApartmentController {
List<Group> newGroupList = new ArrayList<Group>();
boolean changeFlag = false;
for (Group group_ : menu_.getGroupList()) {
if (group_.getCaption().equals("区域") || group_.getCaption().equals("板块") || group_.getCaption().equals("面积")
|| group_.getCaption().equals("租金") || group_.getCaption().equals("房型")
|| group_.getCaption().equals("类型") || group_.getCaption().equals("发布")) {
// 此类型已最Menu初为准
if (group_.getCaption().equals("区域") || group_.getCaption().equals("板块") || group_.getCaption().equals("面积")
|| group_.getCaption().equals("租金") || group_.getCaption().equals("房型")
|| group_.getCaption().equals("类型") || group_.getCaption().equals("发布")) {
// 此类型已最Menu初为准
newGroupList.add(group_);
} else if (group_.getCaption().equals("地铁") || group_.getCaption().equals("站点")) {
// 如果menu查询result后, 本身就没有地铁和站点, 也不用显示
// 始终以后面的menu同步menu_
} else if (group_.getCaption().equals("地铁") || group_.getCaption().equals("站点")) {
// 如果menu查询result后, 本身就没有地铁和站点, 也不用显示
// 始终以后面的menu同步menu_
if (!changeFlag) {
for (Group group : menu.getGroupList()) {
if (group.getCaption().equals("地铁") || group.getCaption().equals("站点")) {
if (group.getCaption().equals("地铁") || group.getCaption().equals("站点")) {
newGroupList.add(group);
}
}
changeFlag = true;
}
} else {
// 未知类型, 暂时也放入
// 未知类型, 暂时也放入
newGroupList.add(group_);
}
}
@@ -293,7 +293,7 @@ public class ApartmentController {
}
/**
* 起始位置比总数大,说明当前页数不对,从第一页开始
* 起始位置比总数大,说明当前页数不对,从第一页开始
*
* @param maxRow
* @param pager
@@ -308,7 +308,7 @@ public class ApartmentController {
}
/**
* 前端Menu统一通过hidden构造到form中 需要处理参数为“”
* 前端Menu统一通过hidden构造到form中 需要处理参数为“”
*
* @param model
*/
@@ -337,7 +337,7 @@ public class ApartmentController {
}
/**
* 推荐房源重置筛选条件, 只用当前城市查询
* 推荐房源重置筛选条件, 只用当前城市查询
*
* @param model
*/
@@ -405,7 +405,7 @@ public class ApartmentController {
}
/**
* 构造查询queryBean
* 构造查询queryBean
*
* @param model
* @return
@@ -422,7 +422,7 @@ public class ApartmentController {
queryBean.setFullTextSearch(true);
/**
* 如果是命名查询
* 如果是命名查询
*/
if (StringUtils.isNotBlank(model.getCustomQuery())) {
Customquery customquery = customqueryService.findByName(model.getCustomQuery());
@@ -455,7 +455,7 @@ public class ApartmentController {
}
/**
* 构造sort
* 构造sort
*
* @param model
* @return
@@ -496,7 +496,7 @@ public class ApartmentController {
if ("rentPrice".equalsIgnoreCase(sortField)) {
sortField = "totalPrice";
}
if ("totalPrice".equals(sortField) || "area".equals(sortField) || "bscore".equals(sortField)) { // TODO:启用bscore作为默认排序后,去除此处的bscore
if ("totalPrice".equals(sortField) || "area".equals(sortField) || "bscore".equals(sortField)) { // TODO:启用bscore作为默认排序后,去除此处的bscore
} else {
sortField = null;
@@ -507,7 +507,7 @@ public class ApartmentController {
}
/**
* 构造当前request params
* 构造当前request params
*
* @return
*/
@@ -518,7 +518,7 @@ public class ApartmentController {
for (String key : paramMap.keySet()) {
Object[] obj = paramMap.get(key);
if (obj != null && obj.length > 0) {
if (!"不限".equals(obj[0].toString())) {
if (!"不限".equals(obj[0].toString())) {
ret.put(key, obj[0].toString());
}
}
@@ -580,7 +580,7 @@ public class ApartmentController {
}
/**
* 加载右侧广告
* 加载右侧广告
*
* @param model
* @return
@@ -107,8 +107,8 @@ public class ApiController {
List<ApiDetail> freeApiDetails = new ArrayList<ApiDetail>();
for (ApiDetail apiDetail : freeApis) {
String name = apiDetail.getName();
if(name.equals("房屋总价")||name.equals("小区均价")||name.equals("区域住宅均价")||name.equals("城市住宅均价")||name.equals("房屋价格走势")||name.equals("小区价格走势")
||name.equals("小区名址匹配")||name.equals("公交")||name.equals("商场")||name.equals("学校")||name.equals("银行/ATM")||name.equals("小区周边人口密度")){
if(name.equals("房屋总价")||name.equals("小区均价")||name.equals("区域住宅均价")||name.equals("城市住宅均价")||name.equals("房屋价格走势")||name.equals("小区价格走势")
||name.equals("小区名址匹配")||name.equals("公交")||name.equals("商场")||name.equals("学校")||name.equals("银行/ATM")||name.equals("小区周边人口密度")){
freeApiDetails.add(apiDetail);
}
}
@@ -128,12 +128,12 @@ public class ApiController {
JsonModel ret = new JsonModel();
Map<String, String> data = new HashMap<String, String>();
if(user == null){//没有登录
if(user == null){//没有登录
data.put("info", "fail");
String backUrl = model.getCityUrl()+"/"+model.getMethodName();
data.put("backUrl", URLEncoder.encode(backUrl,"UTF-8"));
}else{
data.put("info", "success");//已登录
data.put("info", "success");//已登录
}
ret.setJsonModel(data);
@@ -150,12 +150,12 @@ public class ApiController {
JsonModel ret = new JsonModel();
Map<String, Object> data = new HashMap<String, Object>();
if(user == null){//没有登录
if(user == null){//没有登录
data.put("info", "fail");
}else{
data.put("info", "success");//已登录
data.put("info", "success");//已登录
}
data.put("user", user);//已登录
data.put("user", user);//已登录
ret.setJsonModel(data);
return ret;
}
@@ -201,9 +201,9 @@ public class ApiController {
}
/**
* 进入测试申请页面
* 进入测试申请页面
* @author yinjihuan
* @date 2016年6月7日
* @date 2016年6月7日
* @param model
* @return
*/
@@ -212,7 +212,7 @@ public class ApiController {
model.setApiDetails(apiDetailService.findFreeTestApiDetails());
String userId = LoginUtil.getUserId(request);
model.setTabTitle(apiService.getTabTitle(userId));
if(model.getTabTitle().equals("我的测试申请")){
if(model.getTabTitle().equals("我的测试申请")){
ApiTestApply apply = apiService.getTestApply(userId);
if(apply != null) {
model.setTabTitle(apply.getAuditSchedule());
@@ -225,9 +225,9 @@ public class ApiController {
}
/**
* 添加测试申请
* 添加测试申请
* @author yinjihuan
* @date 2016年6月7日
* @date 2016年6月7日
* @param model
* @param request
* @return
@@ -240,7 +240,7 @@ public class ApiController {
FangJiaUser fjUser = fangJiaUserService.getUserById(userId);
if(fjUser == null) return result;
if(model.getTestFields().split(",").length > 10){
result.setMsg("测试字段不能超过10个");
result.setMsg("测试字段不能超过10个");
return result;
}
if(apiService.getTestApply(userId) == null){
@@ -249,10 +249,10 @@ public class ApiController {
String sendMobile = StringUtil.getProperty("api.test.apply.mobile", "fangjia-coresite.properties");
String[] mobiles = sendMobile.split(",");
for (String mobile : mobiles) {
smsService.send(mobile, "【房价网】API免费在线测试申请,申请人:"+model.getName()+",账号:"+fjUser.getMobile()+"。请及时审核。");
smsService.send(mobile, "【房价网】API免费在线测试申请,申请人:"+model.getName()+",账号:"+fjUser.getMobile()+"。请及时审核。");
}
} else {
result.setMsg("您已申请过");
result.setMsg("您已申请过");
}
result.setResult(Message.RESULT_SUCCESS);
return result;
@@ -263,9 +263,9 @@ public class ApiController {
}
/**
* 重新申请
* 重新申请
* @author yinjihuan
* @date 2016年6月7日
* @date 2016年6月7日
* @param model
* @param request
* @return
@@ -288,9 +288,9 @@ public class ApiController {
}
}
/**
* 获取测试申请记录
* 获取测试申请记录
* @author yinjihuan
* @date 2016年6月8日
* @date 2016年6月8日
* @param request
* @return
*/
@@ -300,7 +300,7 @@ public class ApiController {
try {
String userId = LoginUtil.getUserId(request);
if(userId.equals("")){
result.setMsg("没有登录");
result.setMsg("没有登录");
} else {
ApiTestApply apply = apiService.getTestApply(userId);
if(apply != null) {
@@ -334,9 +334,9 @@ public class ApiController {
}
/**
* 获取接口调用记录
* 获取接口调用记录
* @author yinjihuan
* @date 2016年6月8日
* @date 2016年6月8日
* @param request
* @return
*/
@@ -346,7 +346,7 @@ public class ApiController {
try {
String userId = LoginUtil.getUserId(request);
if(userId.equals("")){
result.setMsg("没有登录");
result.setMsg("没有登录");
} else {
User u = userService.findByUserId(userId);
if(u != null) {
@@ -355,7 +355,7 @@ public class ApiController {
result.setApiKey(apiUser.getAppKey());
}
List<ApiVisitRecord> apiVisitRecords = new ArrayList<ApiVisitRecord>();
//查询调用记录
//查询调用记录
ApiUserAuthority apiUserAuthority = apiUserAuthorityService.findByUserIdNoChahe(apiUser.getId());
if(apiUserAuthority != null){
Map<String, Integer> totalMap = apiUserAuthority.getTotalCountMap();
@@ -406,9 +406,9 @@ public class ApiController {
}
/**
* 进入所有API页面
* 进入所有API页面
* @author yinjihuan
* @date 2016年10月9日
* @date 2016年10月9日
* @param model
* @return
*/
@@ -424,9 +424,9 @@ public class ApiController {
}
/**
* 进入API购买申请页面
* 进入API购买申请页面
* @author yinjihuan
* @date 2016年10月13日
* @date 2016年10月13日
* @return
*/
public Object apiBuyApplyAction(ApiQueryModel model, HttpServletRequest req) {
@@ -439,9 +439,9 @@ public class ApiController {
}
/**
* 进入API押品风控页面
* 进入API押品风控页面
* @author yinjihuan
* @date 2016年10月13日
* @date 2016年10月13日
* @return
*/
public Object yapinfengkongAction(ApiQueryModel model) {
@@ -451,9 +451,9 @@ public class ApiController {
}
/**
* 进入API价值分析页面
* 进入API价值分析页面
* @author yinjihuan
* @date 2016年10月13日
* @date 2016年10月13日
* @return
*/
public Object jiazhifenxiAction(ApiQueryModel model) {
@@ -463,9 +463,9 @@ public class ApiController {
}
/**
* 进入API店址分析页面
* 进入API店址分析页面
* @author yinjihuan
* @date 2016年10月13日
* @date 2016年10月13日
* @return
*/
public Object dianzhifenxiAction(ApiQueryModel model) {
@@ -474,9 +474,9 @@ public class ApiController {
return model;
}
/**
* 进入API不动产管理页面
* 进入API不动产管理页面
* @author yinjihuan
* @date 2016年10月13日
* @date 2016年10月13日
* @return
*/
public Object budongchanAction(ApiQueryModel model) {
@@ -489,28 +489,28 @@ public class ApiController {
String type = "";
switch (id) {
case 1:
type = "价格信息";
type = "价格信息";
break;
case 2:
type = "价格走势信息";
type = "价格走势信息";
break;
case 3:
type = "小区基础信息";
type = "小区基础信息";
break;
case 4:
type = "小区配套信息";
type = "小区配套信息";
break;
case 5:
type = "小区周边交通状况";
type = "小区周边交通状况";
break;
case 6:
type = "小区周边消费场所";
type = "小区周边消费场所";
break;
case 7:
type = "小区周边配套场所";
type = "小区周边配套场所";
break;
case 8:
type = "其他";
type = "其他";
break;
default:
break;
@@ -568,9 +568,9 @@ public class ApiController {
}
/**
* 查询API字段数据
* 查询API字段数据
* @author yinjihuan
* @date 2016年10月13日
* @date 2016年10月13日
* @param model
* @return
*/
@@ -101,8 +101,8 @@ public class ApplyApiController {
List<ApiDetail> freeApiDetails = new ArrayList<ApiDetail>();
for (ApiDetail apiDetail : freeApis) {
String name = apiDetail.getName();
if(name.equals("房屋总价")||name.equals("小区均价")||name.equals("区域住宅均价")||name.equals("城市住宅均价")||name.equals("房屋价格走势")||name.equals("小区价格走势")
||name.equals("小区名址匹配")||name.equals("公交")||name.equals("商场")||name.equals("学校")||name.equals("银行/ATM")||name.equals("小区周边人口密度")){
if(name.equals("房屋总价")||name.equals("小区均价")||name.equals("区域住宅均价")||name.equals("城市住宅均价")||name.equals("房屋价格走势")||name.equals("小区价格走势")
||name.equals("小区名址匹配")||name.equals("公交")||name.equals("商场")||name.equals("学校")||name.equals("银行/ATM")||name.equals("小区周边人口密度")){
freeApiDetails.add(apiDetail);
}
}
@@ -122,12 +122,12 @@ public class ApplyApiController {
JsonModel ret = new JsonModel();
Map<String, String> data = new HashMap<String, String>();
if(user == null){//没有登录
if(user == null){//没有登录
data.put("info", "fail");
String backUrl = model.getCityUrl()+"/"+model.getMethodName();
data.put("backUrl", URLEncoder.encode(backUrl,"UTF-8"));
}else{
data.put("info", "success");//已登录
data.put("info", "success");//已登录
}
ret.setJsonModel(data);
@@ -144,12 +144,12 @@ public class ApplyApiController {
JsonModel ret = new JsonModel();
Map<String, Object> data = new HashMap<String, Object>();
if(user == null){//没有登录
if(user == null){//没有登录
data.put("info", "fail");
}else{
data.put("info", "success");//已登录
data.put("info", "success");//已登录
}
data.put("user", user);//已登录
data.put("user", user);//已登录
ret.setJsonModel(data);
return ret;
}
@@ -195,9 +195,9 @@ public class ApplyApiController {
}
/**
* 进入测试申请页面
* 进入测试申请页面
* @author yinjihuan
* @date 2016年6月7日
* @date 2016年6月7日
* @param model
* @return
*/
@@ -207,7 +207,7 @@ public class ApplyApiController {
String userId = LoginUtil.getUserId(request);
model.setTabTitle(apiService.getTabTitle(userId));
if(model.getTabTitle().equals("我的测试申请")){
if(model.getTabTitle().equals("我的测试申请")){
ApiTestApply apply = apiService.getTestApply(userId);
if(apply != null) {
model.setTabTitle(apply.getAuditSchedule());
@@ -220,9 +220,9 @@ public class ApplyApiController {
}
/**
* 重新申请
* 重新申请
* @author yinjihuan
* @date 2016年6月7日
* @date 2016年6月7日
* @param model
* @param request
* @return
@@ -245,9 +245,9 @@ public class ApplyApiController {
}
}
/**
* 添加测试申请
* 添加测试申请
* @author yinjihuan
* @date 2016年6月7日
* @date 2016年6月7日
* @param model
* @param request
* @return
@@ -260,7 +260,7 @@ public class ApplyApiController {
FangJiaUser fjUser = fangJiaUserService.getUserById(userId);
if(fjUser == null) return result;
if(model.getTestFields().split(",").length > 10){
result.setMsg("测试字段不能超过10个");
result.setMsg("测试字段不能超过10个");
return result;
}
if(apiService.getTestApply(userId) == null){
@@ -269,10 +269,10 @@ public class ApplyApiController {
String sendMobile = StringUtil.getProperty("api.test.apply.mobile", "fangjia-coresite.properties");
String[] mobiles = sendMobile.split(",");
for (String mobile : mobiles) {
smsService.send(mobile, "【房价网】API免费在线测试申请,申请人:"+model.getName()+",账号:"+fjUser.getMobile()+"。请及时审核。");
smsService.send(mobile, "【房价网】API免费在线测试申请,申请人:"+model.getName()+",账号:"+fjUser.getMobile()+"。请及时审核。");
}
} else {
result.setMsg("您已申请过");
result.setMsg("您已申请过");
}
result.setResult(Message.RESULT_SUCCESS);
return result;
@@ -283,9 +283,9 @@ public class ApplyApiController {
}
/**
* 获取测试申请记录
* 获取测试申请记录
* @author yinjihuan
* @date 2016年6月8日
* @date 2016年6月8日
* @param request
* @return
*/
@@ -295,7 +295,7 @@ public class ApplyApiController {
try {
String userId = LoginUtil.getUserId(request);
if(userId.equals("")){
result.setMsg("没有登录");
result.setMsg("没有登录");
} else {
ApiTestApply apply = apiService.getTestApply(userId);
if(apply != null) {
@@ -329,9 +329,9 @@ public class ApplyApiController {
}
/**
* 获取接口调用记录
* 获取接口调用记录
* @author yinjihuan
* @date 2016年6月8日
* @date 2016年6月8日
* @param request
* @return
*/
@@ -341,7 +341,7 @@ public class ApplyApiController {
try {
String userId = LoginUtil.getUserId(request);
if(userId.equals("")){
result.setMsg("没有登录");
result.setMsg("没有登录");
} else {
User u = userService.findByUserId(userId);
if(u != null) {
@@ -350,7 +350,7 @@ public class ApplyApiController {
result.setApiKey(apiUser.getAppKey());
}
List<ApiVisitRecord> apiVisitRecords = new ArrayList<ApiVisitRecord>();
//查询调用记录
//查询调用记录
ApiUserAuthority apiUserAuthority = apiUserAuthorityService.findByUserIdNoChahe(apiUser.getId());
if(apiUserAuthority != null){
Map<String, Integer> totalMap = apiUserAuthority.getTotalCountMap();
@@ -401,9 +401,9 @@ public class ApplyApiController {
}
/**
* 进入所有API页面
* 进入所有API页面
* @author yinjihuan
* @date 2016年10月9日
* @date 2016年10月9日
* @param model
* @return
*/
@@ -419,9 +419,9 @@ public class ApplyApiController {
}
/**
* 进入API购买申请页面
* 进入API购买申请页面
* @author yinjihuan
* @date 2016年10月13日
* @date 2016年10月13日
* @return
*/
public Object apiBuyApplyAction(ApiQueryModel model, HttpServletRequest req) {
@@ -434,9 +434,9 @@ public class ApplyApiController {
}
/**
* 进入API押品风控页面
* 进入API押品风控页面
* @author yinjihuan
* @date 2016年10月13日
* @date 2016年10月13日
* @return
*/
public Object yapinfengkongAction(ApiQueryModel model) {
@@ -446,9 +446,9 @@ public class ApplyApiController {
}
/**
* 进入API价值分析页面
* 进入API价值分析页面
* @author yinjihuan
* @date 2016年10月13日
* @date 2016年10月13日
* @return
*/
public Object jiazhifenxiAction(ApiQueryModel model) {
@@ -458,9 +458,9 @@ public class ApplyApiController {
}
/**
* 进入API店址分析页面
* 进入API店址分析页面
* @author yinjihuan
* @date 2016年10月13日
* @date 2016年10月13日
* @return
*/
public Object dianzhifenxiAction(ApiQueryModel model) {
@@ -469,9 +469,9 @@ public class ApplyApiController {
return model;
}
/**
* 进入API不动产管理页面
* 进入API不动产管理页面
* @author yinjihuan
* @date 2016年10月13日
* @date 2016年10月13日
* @return
*/
public Object budongchanAction(ApiQueryModel model) {
@@ -484,28 +484,28 @@ public class ApplyApiController {
String type = "";
switch (id) {
case 1:
type = "价格信息";
type = "价格信息";
break;
case 2:
type = "价格走势信息";
type = "价格走势信息";
break;
case 3:
type = "小区基础信息";
type = "小区基础信息";
break;
case 4:
type = "小区配套信息";
type = "小区配套信息";
break;
case 5:
type = "小区周边交通状况";
type = "小区周边交通状况";
break;
case 6:
type = "小区周边消费场所";
type = "小区周边消费场所";
break;
case 7:
type = "小区周边配套场所";
type = "小区周边配套场所";
break;
case 8:
type = "其他";
type = "其他";
break;
default:
break;
@@ -563,9 +563,9 @@ public class ApplyApiController {
}
/**
* 查询API字段数据
* 查询API字段数据
* @author yinjihuan
* @date 2016年10月13日
* @date 2016年10月13日
* @param model
* @return
*/
@@ -41,7 +41,7 @@ public class AutoCompleteController {
/********************************************* new start *****************************************************/
/**
* 自动完成新实现
* 自动完成新实现
*
* @param cat
* @param type
@@ -58,7 +58,7 @@ public class AutoCompleteController {
if (StringUtils.isBlank(city)) {
city = FangjiaServerAreaContextHolder.getServerAreaDefault().getDisplay();
}
//请求auto库数据
//请求auto库数据
//List<AutoCompleteBo> suggestList = autoCompleteService.suggest(cat, type, city, keyword, limit);
List<AutoCompleteBo> suggestList = getDistrictByKeyword(cat, city, keyword, limit);
model.setJsonModel(suggestList);
@@ -87,7 +87,7 @@ public class AutoCompleteController {
//nameQuery.add(new TermQuery(new Term("address", keyword)), Occur.SHOULD);
//nameQuery.add(new TermQuery(new Term("addr_alias_std", keyword)), Occur.SHOULD);
nameQuery.add(new TermQuery(new Term("keyword", keyword)), Occur.SHOULD);
//nameQuery.add(new TermQuery(new Term("keyword_cjk", keyword)), Occur.SHOULD);//这个重要,因seaweed不支持模糊搜索,当输入"中远两"需用此进行搜索
//nameQuery.add(new TermQuery(new Term("keyword_cjk", keyword)), Occur.SHOULD);//这个重要,因seaweed不支持模糊搜索,当输入"中远两"需用此进行搜索
srQuery1.add(nameQuery, Occur.SHOULD);
params.add(new QueryParam("$sr", new SrQuery(srQuery1)));
List<District> districts = districtService.findAllByParams(params, 0, limit, new String[] { "region", "name","address", "addrAlias" });
@@ -102,7 +102,7 @@ public class AutoCompleteController {
bo.setRegion(district.getRegion());
ret.add(bo);
}
//对自动完成出来的结果按长短排序
//对自动完成出来的结果按长短排序
if(ret.size() > 0){
Collections.sort(ret, new Comparator<AutoCompleteBo>() {
public int compare(AutoCompleteBo o1, AutoCompleteBo o2) {
@@ -127,7 +127,7 @@ public class AutoCompleteController {
/********************************************* new end *****************************************************/
/**
* 小区搜索的自动完成功能(调用goojia-auto实现)
* 小区搜索的自动完成功能(调用goojia-auto实现)
*
* @deprecated
* @param key
@@ -139,7 +139,7 @@ public class AutoCompleteController {
}
/**
* 小区搜索的自动完成功能(调用goojia-auto实现)
* 小区搜索的自动完成功能(调用goojia-auto实现)
*
* @deprecated
* @param key
@@ -151,7 +151,7 @@ public class AutoCompleteController {
}
/**
* 学区房搜索的自动完成功能(调用fangjia-auto实现)
* 学区房搜索的自动完成功能(调用fangjia-auto实现)
*
* @deprecated
* @param key
@@ -162,7 +162,7 @@ public class AutoCompleteController {
}
/**
* 苏州房产网移动端自动补全
* 苏州房产网移动端自动补全
* @param keyword
* @param city
* @param limit
@@ -173,7 +173,7 @@ public class AutoCompleteController {
}
/**
* PDS中的获取楼号接口
* PDS中的获取楼号接口
* @param model
* @return
*/
@@ -210,7 +210,7 @@ public class AutoCompleteController {
}
/**
* PDS中的室号获取接口,需要模拟补全
* PDS中的室号获取接口,需要模拟补全
* @param model
* @return
*/
@@ -228,7 +228,7 @@ public class AutoCompleteController {
}
for (Map<String, Object> r : roomNumbers) {
RoomDto dto = new RoomDto();
dto.setDisplay(r.get("rn") + "室");
dto.setDisplay(r.get("rn") + "室");
dto.setRoom(r.get("rn").toString());
Object floor = r.get("floor");
if (floor != null) {
@@ -243,7 +243,7 @@ public class AutoCompleteController {
}
/**
* 根据当前经纬度附近的小区
* 根据当前经纬度附近的小区
* @param lat
* @param lng
* @param radius
@@ -262,7 +262,7 @@ public class AutoCompleteController {
if (limit == null || limit > 100 || limit <= 0) {
limit = 10;
}
//通过经纬度搜索对应radius距离小区, 固定查询100条数据, 防止未根据距离排序后, 后面过滤到有效数据
//通过经纬度搜索对应radius距离小区, 固定查询100条数据, 防止未根据距离排序后, 后面过滤到有效数据
List<District> districts = districtService.findAllDistrict(lat, lng, radius, null, 100);
List<DistrictDto> result = new ArrayList<DistrictDto>();
for (District d : districts) {
@@ -289,7 +289,7 @@ public class AutoCompleteController {
return dis1 - dis2;
}
});
//排序后, 只返回limit大小
//排序后, 只返回limit大小
if(result.size() >= limit){
result = result.subList(0, limit);
}
@@ -299,7 +299,7 @@ public class AutoCompleteController {
}
/**
* 全国最近搜索条件(调用goojia-auto实现)
* 全国最近搜索条件(调用goojia-auto实现)
*
* @deprecated
* @param key
@@ -15,7 +15,7 @@ public class BrokerController {
private RentHouseService rentHouseService;
/**
* 异步请求,取得经纪人房源量
* 异步请求,取得经纪人房源量
*
* @param model
* @return
@@ -3,14 +3,14 @@ package com.fangjia.coresite.controllers;
import com.fangjia.coresite.model.FangjiaModel;
/**
* 公司介绍控制器
* 公司介绍控制器
* @author yinjihuan
*
*/
public class CompanyController {
/**
* 关于我们
* 关于我们
* @param model
* @return
*/
@@ -19,7 +19,7 @@ public class CompanyController {
}
/**
* 人才招聘
* 人才招聘
* @return
*/
public Object recruitmentAction(FangjiaModel model) {
@@ -27,7 +27,7 @@ public class CompanyController {
}
/**
* 用户服务协议
* 用户服务协议
* @param model
* @return
* @throws Exception
@@ -37,7 +37,7 @@ public class CompanyController {
}
/**
* 客户
* 客户
*/
public Object cstmAction(FangjiaModel model){
return model;
@@ -51,11 +51,11 @@ public class ContactController {
private static List<String> APPLY_BUY_MOBILE = new ArrayList<String>();
static {
NOTICE_MOBILES.add("13916992399"); // 蒋
NOTICE_MOBILES.add("13681915777"); // 钟
NOTICE_MOBILES.add("13916992399"); // 蒋
NOTICE_MOBILES.add("13681915777"); // 钟
NOTICE_MOBILES.add("15201904147");
APPLY_BUY_MOBILE.add("18061756492");//王
APPLY_BUY_MOBILE.add("18061756492");//王
APPLY_BUY_MOBILE.add("13681915777");//
APPLY_BUY_MOBILE.add("15201904147");//
}
@@ -70,7 +70,7 @@ public class ContactController {
if(StringUtils.isBlank(baiduType)){
baiduType = "";
} else {
baiduType = "【" + baiduType + "】";
baiduType = "【" + baiduType + "】";
}
Map<String, Boolean> data = new HashMap<String, Boolean>();
@@ -84,28 +84,28 @@ public class ContactController {
String mess=request.getParameter("mess");
String from=request.getParameter("from");
if(resPage.equals("0")){
contact.setSource("房价网API购买" + baiduType);
contact.setSource("房价网API购买" + baiduType);
if(from.equals("15")){
contact.setContent("登录手机号:"+COOKIE_CONTEXT.getCookieValue(request,"login_username") + ";具体信息:"+"API购买("+mess+"接口)");
contact.setContent("登录手机号:"+COOKIE_CONTEXT.getCookieValue(request,"login_username") + ";具体信息:"+"API购买("+mess+"接口)");
}else {
contact.setContent("登录手机号:" + COOKIE_CONTEXT.getCookieValue(request, "login_username") + ";合作内容:" + contact.getContent());
contact.setContent("登录手机号:" + COOKIE_CONTEXT.getCookieValue(request, "login_username") + ";合作内容:" + contact.getContent());
}
}
else if(resPage.equals("1")){
contact.setSource("房价网商用数据" + baiduType);
contact.setContent("登录手机号:"+COOKIE_CONTEXT.getCookieValue(request,"login_username") +";具体信息:"+mess);
contact.setSource("房价网商用数据" + baiduType);
contact.setContent("登录手机号:"+COOKIE_CONTEXT.getCookieValue(request,"login_username") +";具体信息:"+mess);
}
else if(resPage.equals("2")){
contact.setSource("房价网联系我们" + baiduType);
contact.setContent("登录手机号:"+COOKIE_CONTEXT.getCookieValue(request,"login_username") + ";合作内容:"+contact.getContent());
contact.setSource("房价网联系我们" + baiduType);
contact.setContent("登录手机号:"+COOKIE_CONTEXT.getCookieValue(request,"login_username") + ";合作内容:"+contact.getContent());
}*/
contact.setSource("房价网API购买" + baiduType);
contact.setContent("登录手机号:" + COOKIE_CONTEXT.getCookieValue(request, "login_username") + ";合作内容:" + contact.getContent());
contact.setSource("房价网API购买" + baiduType);
contact.setContent("登录手机号:" + COOKIE_CONTEXT.getCookieValue(request, "login_username") + ";合作内容:" + contact.getContent());
contact.setIp(AnalyticsUtil.getIpAddress(request));
contact.setCreateDate(new Date());
customerConsultService.save(contact);
data.put("success", Boolean.TRUE);
//String smsContent = "FangJia China 收到留言:\n " + "联系人:" + contact.getName() + " \n邮箱:" + contact.getEmail() + " \n联系电话:" + contact.getPhone();
//String smsContent = "FangJia China 收到留言:\n " + "联系人:" + contact.getName() + " \n邮箱:" + contact.getEmail() + " \n联系电话:" + contact.getPhone();
/* if(StringUtils.isNotBlank(contact.getContent())){
smsContent += "\n" + contact.getContent();
}
@@ -116,7 +116,7 @@ public class ContactController {
}
} catch (SmsException e) {
e.printStackTrace();
logger.error("FangJia China 短信发送失败:", smsContent);
logger.error("FangJia China 短信发送失败:", smsContent);
}*/
return jsonModel;
}
@@ -159,13 +159,13 @@ public class ContactController {
}
public void sendSms(ApiBuyApply apiBuyApply, CustomerModel model, ApiModel apiModel){
String smsContent = "【房价网】API接口申请:" ;
String smsContent = "【房价网】API接口申请:" ;
Map<String, String> serviceMsgMap = apiModel.getServiceIdMsgMap();
if(StringUtils.isNotBlank(apiBuyApply.getServiceId())){
smsContent += serviceMsgMap.get(apiBuyApply.getServiceId());
}
smsContent = smsContent+ " 申请人:" + apiBuyApply.getName() + " 账号:" + apiBuyApply.getMobile()+" ,请及时回复";
smsContent = smsContent+ " 申请人:" + apiBuyApply.getName() + " 账号:" + apiBuyApply.getMobile()+" ,请及时回复";
try {
for (String mobile : APPLY_BUY_MOBILE) {
smsService.send(mobile, smsContent);
@@ -173,7 +173,7 @@ public class ContactController {
}
} catch (SmsException e) {
e.printStackTrace();
logger.error("【房价网】:", smsContent);
logger.error("【房价网】:", smsContent);
}
}
@@ -213,8 +213,8 @@ public class ContactController {
addressAnalyApplyService.save(apply);
data.put("success", Boolean.TRUE);
String smsContent = "【房价网】地址分析平台购买申请," ;
smsContent = smsContent+ " 申请人:" + apply.getName() + " 账号:" + apply.getMobile()+" ,请及时回复";
String smsContent = "【房价网】地址分析平台购买申请," ;
smsContent = smsContent+ " 申请人:" + apply.getName() + " 账号:" + apply.getMobile()+" ,请及时回复";
System.out.println(smsContent);
try {
for (String mobile : APPLY_BUY_MOBILE) {
@@ -222,7 +222,7 @@ public class ContactController {
}
} catch (SmsException e) {
e.printStackTrace();
logger.error("【房价网】:", smsContent);
logger.error("【房价网】:", smsContent);
}
@@ -230,13 +230,13 @@ public class ContactController {
}
public void sendEmail(ApiBuyApply apiBuyApply, CustomerModel model, ApiModel apiModel){
try {
// 发邮件给用户
// 发邮件给用户
Mail mail = new Mail();
mail.setReceiver(new MailUser(apiBuyApply.getEmail()));
mail.setSubject("线下购买接口");
mail.setSubject("线下购买接口");
StringBuffer emailMsg = new StringBuffer();
String smsContent = "【购买线下接口】\n " + "联系人:" + apiBuyApply.getName() + " \n邮箱:" + apiBuyApply.getEmail() + " \n联系电话:" + apiBuyApply.getMobile()+" \n接口服务编码:"+apiBuyApply.getServiceId();
String smsContent = "【购买线下接口】\n " + "联系人:" + apiBuyApply.getName() + " \n邮箱:" + apiBuyApply.getEmail() + " \n联系电话:" + apiBuyApply.getMobile()+" \n接口服务编码:"+apiBuyApply.getServiceId();
Map<String, String> serviceMsgMap = apiModel.getServiceIdMsgMap();
if(StringUtils.isNotBlank(apiBuyApply.getServiceId())){
smsContent += "\n" + serviceMsgMap.get(apiBuyApply.getServiceId());
@@ -248,9 +248,9 @@ public class ContactController {
emailService.sendHtmlMailWithFile(mail);
// smsCodeService.sendNotices("13391219237", email, mobile);
} catch (Exception e) {
// ret.setMsg("发送失败,请稍后重试");
// ret.setMsg("发送失败,请稍后重试");
}
// ret.setMsg("申请成功,请等待客服处理");
// ret.setMsg("申请成功,请等待客服处理");
}
@@ -70,7 +70,7 @@ public class Controller {
/**
* 房价网城市首页
* 房价网城市首页
*
* @return
*/
@@ -89,7 +89,7 @@ public class Controller {
model.setEvaluateCount(evalCount == null ? 0l : (Long) evalCount.getValue());
int userId = model.getRealUserId();
model.setRole(fjtUsersService.findUsersRole(userId));
//资产,房源
//资产,房源
//model.setLatelyNews(getLatelyNews());
if (requestUrl.contains(model.getWwwUrl())) {
String ipAddressString = AnalyticsUtil.getIpAddress(request);
@@ -99,7 +99,7 @@ public class Controller {
}
if (userAgent.contains("baidu") || userAgent.contains("google") || userAgent.contains("soso")
|| (StringUtils.isNotBlank(refererUrl) && refererUrl.contains(model.getDomain()))) {
// 若refererUrl为本站域名,则去往全国首页
// 若refererUrl为本站域名,则去往全国首页
model.setLatelyNews(getLatelyNews());
ServerArea ipCity = findServerAreaByIpAddress(ipAddressString, ServerAreaData.defaultServerArea);
@@ -110,20 +110,20 @@ public class Controller {
model.setServerAreaMap(model.getSortedServerAreaMapGroupByFirstSpell());
model.setCurrentCity(ipCity.getName());
} else if (null == FangjiaServerAreaContextHolder.getServerArea()) {
// 直接键入wwwUrl,判断是否存在cookie,根据IP判断所在城市,若有城市则去往城市首页,否则,去全国首页
// 直接键入wwwUrl,判断是否存在cookie,根据IP判断所在城市,若有城市则去往城市首页,否则,去全国首页
String citySpell = CoresiteCookieContext.getInstance().getCookieValue(request, CookieName.COOKIE_CITY);
ServerArea cookieCity = null;
if (StringUtils.isNotBlank(citySpell)) {// 从cookie获取城市信息
if (StringUtils.isNotBlank(citySpell)) {// 从cookie获取城市信息
cookieCity = ServerAreaData.getServerAreaByNameOrSpellDefaultNull(citySpell);
}
if (null != cookieCity) {// cookie中城市存在,跳转到城市首页
if (null != cookieCity) {// cookie中城市存在,跳转到城市首页
model.setCurrentCity(cookieCity.getName());
} else {// Cookie城市不存在,从IP获取城市
} else {// Cookie城市不存在,从IP获取城市
ServerArea ipCity = findServerAreaByIpAddress(ipAddressString, null);
if (ipCity != null) {// IP城市存在,跳转到城市首页
if (ipCity != null) {// IP城市存在,跳转到城市首页
model.setCurrentCity(ipCity.getName());
} else {// IP城市不存在,到全国首页
} else {// IP城市不存在,到全国首页
model.setIpCity(ServerAreaData.defaultServerArea);
if(ServerAreaData.defaultServerArea != null){
model.setCurrentCity(ServerAreaData.defaultServerArea.getName());
@@ -133,7 +133,7 @@ public class Controller {
}
}
}
//公告
//公告
List<NewsInfo> newsInfos = newsDynamicService.findNewsByParams("news", null,null, new Date(), 0, 3);
if(newsInfos!=null && newsInfos.size()>0){
@@ -150,18 +150,18 @@ public class Controller {
String subDomainName = getCitySpell(requestUrl);
if ("sou".equalsIgnoreCase(subDomainName)) {
// "sou"转向到咨询列表页
// "sou"转向到咨询列表页
model.setViewType("redirect");
model.setViewParam("statusCode", 301);
model.setViewParam("location", "/zixun/");
} else if ("support".equalsIgnoreCase(subDomainName)) {
// "support"转向到关于我们页面
// "support"转向到关于我们页面
model.setViewType("redirect");
model.setViewParam("statusCode", 301);
model.setViewParam("location", "/help/aboutUs");
}
model.setCurrentCity(((ServerArea) FangjiaServerAreaContextHolder.getServerAreaDefault()).getSpell());
//横排广告
//横排广告
List<Advertisement> ads = getAdvertisements(AdSourceEnum.HOME_NEW_T_DETAIL.getId());
model.setAdsList(ads);
return model;
@@ -187,7 +187,7 @@ public class Controller {
}
/**
* 房价网城市首页
* 房价网城市首页
*
* @return
*/
@@ -206,7 +206,7 @@ public class Controller {
model.setEvaluateCount(evalCount == null ? 0l : (Long) evalCount.getValue());
int userId = model.getRealUserId();
model.setRole(fjtUsersService.findUsersRole(userId));
//资产,房源
//资产,房源
model.setLatelyNews(getLatelyNews());
if (requestUrl.contains(model.getWwwUrl())) {
String ipAddressString = AnalyticsUtil.getIpAddress(request);
@@ -216,7 +216,7 @@ public class Controller {
}
if (userAgent.contains("baidu") || userAgent.contains("google") || userAgent.contains("soso")
|| (StringUtils.isNotBlank(refererUrl) && refererUrl.contains(model.getDomain()))) {
// 若refererUrl为本站域名,则去往全国首页
// 若refererUrl为本站域名,则去往全国首页
model.setLatelyNews(getLatelyNews());
ServerArea ipCity = findServerAreaByIpAddress(ipAddressString, ServerAreaData.defaultServerArea);
@@ -227,20 +227,20 @@ public class Controller {
model.setServerAreaMap(model.getSortedServerAreaMapGroupByFirstSpell());
model.setCurrentCity(ipCity.getName());
} else if (null == FangjiaServerAreaContextHolder.getServerArea()) {
// 直接键入wwwUrl,判断是否存在cookie,根据IP判断所在城市,若有城市则去往城市首页,否则,去全国首页
// 直接键入wwwUrl,判断是否存在cookie,根据IP判断所在城市,若有城市则去往城市首页,否则,去全国首页
String citySpell = CoresiteCookieContext.getInstance().getCookieValue(request, CookieName.COOKIE_CITY);
ServerArea cookieCity = null;
if (StringUtils.isNotBlank(citySpell)) {// 从cookie获取城市信息
if (StringUtils.isNotBlank(citySpell)) {// 从cookie获取城市信息
cookieCity = ServerAreaData.getServerAreaByNameOrSpellDefaultNull(citySpell);
}
if (null != cookieCity) {// cookie中城市存在,跳转到城市首页
if (null != cookieCity) {// cookie中城市存在,跳转到城市首页
model.setCurrentCity(cookieCity.getName());
} else {// Cookie城市不存在,从IP获取城市
} else {// Cookie城市不存在,从IP获取城市
ServerArea ipCity = findServerAreaByIpAddress(ipAddressString, null);
if (ipCity != null) {// IP城市存在,跳转到城市首页
if (ipCity != null) {// IP城市存在,跳转到城市首页
model.setCurrentCity(ipCity.getName());
} else {// IP城市不存在,到全国首页
} else {// IP城市不存在,到全国首页
model.setIpCity(ServerAreaData.defaultServerArea);
if(ServerAreaData.defaultServerArea != null){
model.setCurrentCity(ServerAreaData.defaultServerArea.getName());
@@ -250,7 +250,7 @@ public class Controller {
}
}
}
//公告
//公告
List<NewsInfo> newsInfos = newsDynamicService.findNewsByParams("news", null,null, new Date(), 0, 3);
if(newsInfos!=null && newsInfos.size()>0){
@@ -267,12 +267,12 @@ public class Controller {
String subDomainName = getCitySpell(requestUrl);
if ("sou".equalsIgnoreCase(subDomainName)) {
// "sou"转向到咨询列表页
// "sou"转向到咨询列表页
model.setViewType("redirect");
model.setViewParam("statusCode", 301);
model.setViewParam("location", "/zixun/");
} else if ("support".equalsIgnoreCase(subDomainName)) {
// "support"转向到关于我们页面
// "support"转向到关于我们页面
model.setViewType("redirect");
model.setViewParam("statusCode", 301);
model.setViewParam("location", "/help/aboutUs");
@@ -282,18 +282,18 @@ public class Controller {
}
/**
* IP存在,根据IP 获取城市,获取不到或者IP不存在,设置默认城市
* IP存在,根据IP 获取城市,获取不到或者IP不存在,设置默认城市
*
* @param ipAddressString
* IP地址
* IP地址
* @param defaultServerArea
* 默认城市
* 默认城市
* @return
*/
private ServerArea findServerAreaByIpAddress(String ipAddressString, ServerArea defaultServerArea) {
// ServerArea ipCity = defaultServerArea;
// IpAddress ipAddress = ipAddressService.findByIp(ipAddressString);
// // IP存在,根据IP 获取城市,获取不到,设置默认城市
// // IP存在,根据IP 获取城市,获取不到,设置默认城市
// if (ipAddress != null) {
// ipCity =
// ServerAreaData.getServerAreaContainsCity(ipAddress.getCountry(),
@@ -319,7 +319,7 @@ public class Controller {
}
/**
* 统计API和估价记录数
* 统计API和估价记录数
* @return
*/
public Object statisticAction(){
@@ -354,7 +354,7 @@ public class Controller {
@SuppressWarnings("unchecked")
private List<News> getLatelyNews() {
/**
* 首页地图底部SEO最新资讯(缓存一小时)
* 首页地图底部SEO最新资讯(缓存一小时)
*/
String cacheKey = "latelyNews";
FacetQueryResult<News> newsResultList = (FacetQueryResult<News>) CacheUtils.getValue(this.getClass(), cacheKey);
@@ -427,7 +427,7 @@ public class Controller {
}
/**
* 房价网全国首页
* 房价网全国首页
*
* @return
*/
@@ -462,7 +462,7 @@ public class Controller {
}
/**
* 错误页面
* 错误页面
*
* @param model
* @return
@@ -57,21 +57,21 @@ public class CpcClickController {
}
/**
* CPC 点击日志记录
* CPC 点击日志记录
*
* @param model
* @return
*/
public Object logAction(CpcClickLogModel model) {
HttpServletRequest request = ActionContext.getContext().getRequest();
boolean isFangjiaUser = false; // 是否是房价网内部用户点击
if (FangjiaConfig.getConfig().isProductionEnvironment()) { // 线上
boolean isFangjiaUser = false; // 是否是房价网内部用户点击
if (FangjiaConfig.getConfig().isProductionEnvironment()) { // 线上
String ip = AnalyticsUtil.getIpAddress(request);
if (ip.indexOf(" 116.247.70.58") > -1) {
isFangjiaUser = true;
}
}
if (!isFangjiaUser) { // 非房价网内部用户点击
if (!isFangjiaUser) { // 非房价网内部用户点击
String houseId = model.getId();
String houseType = model.getType();
if (StringUtils.isNotEmpty(houseId) && StringUtils.isNotEmpty(houseType)) {
@@ -159,7 +159,7 @@ public class CpcClickController {
}
/**
* CPC 点击记录for小工具条
* CPC 点击记录for小工具条
*
* @param model
* @return
@@ -58,19 +58,19 @@ public class DaikuanController {
private BusinessEstateService businessEstateService;
/**
* 频道首页
* 频道首页
*/
public Object indexAction(DaikuanModel model) {
return model;
}
/**
* 表单填写页
* 表单填写页
*/
public Object formAction(DaikuanModel model) {
// if (null == model.getEvaluation() ||
// StringUtils.isBlank(model.getEvaluation().getDistrictName())
// || "请填写小区名/地址".equals(model.getEvaluation().getDistrictName())) {
// || "请填写小区名/地址".equals(model.getEvaluation().getDistrictName())) {
// model.setViewType("redirect");
// model.setViewParam("location", "/daikuan/");
// return model;
@@ -80,7 +80,7 @@ public class DaikuanController {
}
/**
* 表单异步提交处理
* 表单异步提交处理
*/
public Object evaluationAction(DaikuanModel model) {
Evaluation evaluation = model.getEvaluation();
@@ -98,7 +98,7 @@ public class DaikuanController {
String buildType = evaluation.getBuildType();
if ("公寓".equals(buildType) || "别墅".equals(buildType)) {
if ("公寓".equals(buildType) || "别墅".equals(buildType)) {
List<District> districts = districtService.findByKeyword(model.getCityName(), evaluation.getDistrictName(),"district");
List<DistrictKey> districtKeys = new ArrayList<DistrictKey>(districts.size());
for(District d:districts){
@@ -109,7 +109,7 @@ public class DaikuanController {
}
if (CollectionUtils.isNotEmpty(districtKeys)) {
for (DistrictKey key : districtKeys) {
// 知识库匹配出的结果需要城市相同、有区域信息、且和表单中提交的区域相同,表单中没有区域则用第一个小区
// 知识库匹配出的结果需要城市相同、有区域信息、且和表单中提交的区域相同,表单中没有区域则用第一个小区
if (!evaluation.getCity().equals(key.getCity())) {
continue;
}
@@ -131,7 +131,7 @@ public class DaikuanController {
evaluation.setModificationDate(new Date());
evaluationService.saveEvaluation(evaluation);
}
} else if ("商铺".equals(buildType)) {
} else if ("商铺".equals(buildType)) {
district = businessEstateService.findShop(new DistrictKey(evaluation.getCity(), evaluation.getRegion(), evaluation
.getDistrictName()));
if (null != district) {
@@ -143,7 +143,7 @@ public class DaikuanController {
evaluation.setModificationDate(new Date());
evaluation = evaluationService.saveShopEvaluation(evaluation, district);
}
} else if ("写字楼".equals(buildType)) {
} else if ("写字楼".equals(buildType)) {
district = businessEstateService.findOffice(new DistrictKey(evaluation.getCity(), evaluation.getRegion(), evaluation
.getDistrictName()));
if (null != district) {
@@ -163,7 +163,7 @@ public class DaikuanController {
}
/**
* 贷款产品列表
* 贷款产品列表
*/
public Object listAction(DaikuanModel model) {
if (StringUtils.isNotBlank(model.getRefererUrl())
@@ -245,7 +245,7 @@ public class DaikuanController {
}
/**
* 贷款产品详情
* 贷款产品详情
*/
public Object showAction(DaikuanModel model) {
Integer loanType = model.getLoanType();
@@ -295,20 +295,20 @@ public class DaikuanController {
}
/**
* 保存申请信息并发送短信
* 保存申请信息并发送短信
*/
public Object saveLoanerInfoAction(DaikuanModel model, HttpServletRequest request) {
JsonModel jsonModel = new JsonModel();
Map<String, String> res = new HashMap<String, String>();
if (StringUtils.isBlank(model.getSqName())) {
res.put("msg", "用户名不能为空");
res.put("msg", "用户名不能为空");
} else if (StringUtils.isBlank(model.getSqMobile()) || !DataUtil.isCellPhoneNumber(model.getSqMobile())) {
res.put("msg", "手机号码错误");
res.put("msg", "手机号码错误");
} else if (StringUtils.isBlank(model.getId()) || !ObjectId.isValid(model.getId())) {
res.put("msg", "输入错误,请重新选择贷款产品再试!");
res.put("msg", "输入错误,请重新选择贷款产品再试!");
} else if (model.getLoanAmount() <= 0 || model.getLoanMonth() <= 0) {
res.put("msg", "输入错误,请重新选择贷款产品再试!");
res.put("msg", "输入错误,请重新选择贷款产品再试!");
}
if (res.size() > 0) {
@@ -387,8 +387,8 @@ public class DaikuanController {
fjLoanerInfoService.saveUserLoneInfo(loanerInfo);
StringBuffer msg = new StringBuffer();
msg.append(model.getSqName()).append("(手机").append(model.getSqMobile()).append(")申请了:").append(comName).append("的")
.append(prdName).append(",信贷员为").append(allLoanOffers.get(0).getName()).append("。【贷款频道】");
msg.append(model.getSqName()).append("(手机").append(model.getSqMobile()).append(")申请了:").append(comName).append("的")
.append(prdName).append(",信贷员为").append(allLoanOffers.get(0).getName()).append("。【贷款频道】");
try {
smsService.sendForRongshidai("15026780660", msg.toString());
@@ -404,7 +404,7 @@ public class DaikuanController {
}
/**
* 处理给用户和信贷员发送短信通知
* 处理给用户和信贷员发送短信通知
*/
private void processSendMsg(DaikuanModel model, String cat, String offerId) {
FjLoanBo productInfo = null;
@@ -444,12 +444,12 @@ public class DaikuanController {
}
/**
* 给管理员发送通知短信
* 给管理员发送通知短信
*/
private void sendAdminMsg(FjLoanBo productInfo, FjBaseLoan loanInfo, DaikuanModel model) {
StringBuffer msg = new StringBuffer();
msg.append("【抵押贷款频道】").append(model.getSqName()).append("(手机").append(model.getSqMobile()).append(")申请了:")
.append(productInfo.getAgencyName()).append("的").append(loanInfo.getProductName()).append("。此条无需转发!");
msg.append("【抵押贷款频道】").append(model.getSqName()).append("(手机").append(model.getSqMobile()).append(")申请了:")
.append(productInfo.getAgencyName()).append("的").append(loanInfo.getProductName()).append("。此条无需转发!");
try {
smsService.send("13681915777", msg.toString());
@@ -459,7 +459,7 @@ public class DaikuanController {
}
/**
* 给用户发送短信
* 给用户发送短信
*/
private void sendUserMsg(FjLoanBo productInfo, FjBaseLoan loanInfo, FjLoanOfficer officerInfo, DaikuanModel model) {
String callNumber = getOfficerCallNumber(officerInfo);
@@ -470,9 +470,9 @@ public class DaikuanController {
StringBuffer msg = new StringBuffer();
msg.append(productInfo.getAgencyName()).append(" ");
msg.append(loanInfo.getProductName()).append(" ");
msg.append("信贷员 ").append(officerInfo.getName()).append("的联系方式为").append(callNumber);
msg.append("信贷员 ").append(officerInfo.getName()).append("的联系方式为").append(callNumber);
msg.append(" 贷款产品尽在sh.fangjia.com");
msg.append(" 贷款产品尽在sh.fangjia.com");
try {
smsService.send(model.getSqMobile(), msg.toString());
@@ -482,7 +482,7 @@ public class DaikuanController {
}
/**
* 给信贷员发送短信
* 给信贷员发送短信
*/
private void sendOfficerMsg(FjBaseLoan loanInfo, FjLoanOfficer officerInfo, DaikuanModel model) {
String mobile = getOfficerMobile(officerInfo);
@@ -491,15 +491,15 @@ public class DaikuanController {
}
StringBuffer msg = new StringBuffer();
msg.append(model.getSqName()).append("(手机").append(model.getSqMobile()).append(")选择了您发布的“")
.append(loanInfo.getProductName()).append("”。");
msg.append(model.getSqName()).append("(手机").append(model.getSqMobile()).append(")选择了您发布的“")
.append(loanInfo.getProductName()).append("”。");
Evaluation evaluation = evaluationService.findEvaluationById(model.getEvaId());
if (null != evaluation) {
msg.append("房产信息:").append(evaluation.getRegion()).append(evaluation.getDistrictName())
.append(evaluation.getHouseNum()).append("号").append(evaluation.getRoomNum()).append("室")
.append(evaluation.getArea()).append("平米,估价").append((int) (evaluation.getTotalPrice() / 10000))
.append("万,申请").append(model.getLoanAmount()).append("万贷款,期限").append(model.getLoanMonth()).append("个月。");
msg.append("房产信息:").append(evaluation.getRegion()).append(evaluation.getDistrictName())
.append(evaluation.getHouseNum()).append("号").append(evaluation.getRoomNum()).append("室")
.append(evaluation.getArea()).append("平米,估价").append((int) (evaluation.getTotalPrice() / 10000))
.append("万,申请").append(model.getLoanAmount()).append("万贷款,期限").append(model.getLoanMonth()).append("个月。");
}
try {
@@ -510,7 +510,7 @@ public class DaikuanController {
}
/**
* 根据信贷员资料取得400轮播电话(手机+固话)
* 根据信贷员资料取得400轮播电话(手机+固话)
*/
private String getOfficerCallNumber(FjLoanOfficer info) {
if (null == info) {
@@ -531,7 +531,7 @@ public class DaikuanController {
}
/**
* 根据信贷员资料取得对应手机号
* 根据信贷员资料取得对应手机号
*/
private String getOfficerMobile(FjLoanOfficer info) {
if (null == info) {
@@ -553,14 +553,14 @@ public class DaikuanController {
}
/**
* 无法估价
* 无法估价
*/
public Object failAction(DaikuanModel model) {
return model;
}
/**
* 保存无法估价的信息
* 保存无法估价的信息
*/
public Object saveFailAction(DaikuanModel model, HttpServletRequest request) {
DaikuanFail entity = new DaikuanFail();
@@ -54,8 +54,8 @@ public class DiaoyudaoController {
public String dataAction() {
StringBuffer xml = new StringBuffer("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n");
xml.append("<data>\n<area id=\"000\" cnname=\"µöÓ㵺\" enname=\"diaoyudao\" grade=\"2\">\n");
xml.append("<childmap id=\"1\" active=\"1\" cnname=\"µöÓ㵺\" enname=\"zhangjiagang\" link=\"htttp://www.fangjia.com/011\" normalColor=\"0Xffffff\" overColor=\"0Xf4ab00\">\n");
xml.append("<data>\n<area id=\"000\" cnname=\"钓鱼岛\" enname=\"diaoyudao\" grade=\"2\">\n");
xml.append("<childmap id=\"1\" active=\"1\" cnname=\"钓鱼岛\" enname=\"zhangjiagang\" link=\"htttp://www.fangjia.com/011\" normalColor=\"0Xffffff\" overColor=\"0Xf4ab00\">\n");
xml.append("\t<ico></ico>\n");
xml.append("\t<avgPrice></avgPrice>\n");
xml.append("\t<onSell></onSell>\n");
@@ -64,7 +64,7 @@ public class DiaoyudaoController {
xml.append("\t<onRent></onRent>\n");
xml.append("</childmap>\n");
xml.append("<childmap id=\"2\" active=\"1\" cnname=\"»ÆÎ²Óì\" enname=\"changshu\" link=\"htttp://www.fangjia.com/011\" normalColor=\"0Xffffff\" overColor=\"0Xf4ab00\">\n");
xml.append("<childmap id=\"2\" active=\"1\" cnname=\"黄尾屿\" enname=\"changshu\" link=\"htttp://www.fangjia.com/011\" normalColor=\"0Xffffff\" overColor=\"0Xf4ab00\">\n");
xml.append("\t<ico></ico>\n");
xml.append("\t<avgPrice></avgPrice>\n");
xml.append("\t<onSell></onSell>\n");
@@ -73,7 +73,7 @@ public class DiaoyudaoController {
xml.append("\t<onRent></onRent>\n");
xml.append("</childmap>\n");
xml.append("<childmap id=\"3\" active=\"1\" cnname=\"³àβÓì\" enname=\"taicang\" link=\"htttp://www.fangjia.com/011\" normalColor=\"0Xffffff\" overColor=\"0Xf4ab00\">\n");
xml.append("<childmap id=\"3\" active=\"1\" cnname=\"赤尾屿\" enname=\"taicang\" link=\"htttp://www.fangjia.com/011\" normalColor=\"0Xffffff\" overColor=\"0Xf4ab00\">\n");
xml.append("\t<ico></ico>\n");
xml.append("\t<avgPrice></avgPrice>\n");
xml.append("\t<onSell></onSell>\n");
@@ -124,7 +124,7 @@ public class DistrictController {
private AddressMatchLogService addressMatchLogService;
/**
* 根据城市 , 或 IP 取得城市的价格走势
* 根据城市 , 或 IP 取得城市的价格走势
*
* @param model
* @return
@@ -227,10 +227,10 @@ public class DistrictController {
String parent = "block".equals(keywordMap.get("type")) ? keywordMap.get("region") : city;
model.setParent(parent);
String name = keywordMap.get("name");
// 所有区域都要展示均价
// 所有区域都要展示均价
// if
// (!this.regionBlockService.isRegionVisi("city".equals(keywordMap.get("type"))
// ? null : parent, name)) { // 如果查询的是城市,parent为null
// ? null : parent, name)) { // 如果查询的是城市,parent为null
// return;
// }
RegionStat regionStat;
@@ -332,7 +332,7 @@ public class DistrictController {
// Pager pager = model.getPager(20);
// pager.setMaxPage(FangjiaConfig.getConfig().getSearchListMaxPageNo());
//
// // 小区列表支持新盘搜索
// // 小区列表支持新盘搜索
// model.setCategory("district");
// Object obj = FangjiaRudder.listMan(model.getKeyword());
// if (obj != null) {
@@ -348,7 +348,7 @@ public class DistrictController {
// DistrictQueryBean queryBean = modelToBean(model);
// queryBean.setCity(city);
//
// // 老网站的URL中区域是带“区”的
// // 老网站的URL中区域是带“区”的
// if (StringUtils.isNotBlank(queryBean.getRegion())) {
// List<Group> gList = menu.getGroupList();
// for (Group g : gList) {
@@ -395,7 +395,7 @@ public class DistrictController {
// MenuCategoryEnum.xiaoqu, getCurrentParams()));
//
//// */
//// * gasm统计
//// * gasm统计
//// */
// model.addGaMap(Gakey.rc, pager.getTotalRows());
//
@@ -410,7 +410,7 @@ public class DistrictController {
Pager pager = model.getPager(20);
pager.setMaxPage(FangjiaConfig.getConfig().getSearchListMaxPageNo());
// 小区列表支持新盘搜索
// 小区列表支持新盘搜索
model.setCategory("district");
Object obj = FangjiaRudder.listMan(model.getKeyword());
if (obj != null) {
@@ -426,7 +426,7 @@ public class DistrictController {
DistrictQueryBean queryBean = modelToBean(model);
queryBean.setCity(city);
// 老网站的URL中区域是带“区”的
// 老网站的URL中区域是带“区”的
if (StringUtils.isNotBlank(queryBean.getRegion())) {
List<Group> gList = menu.getGroupList();
for (Group g : gList) {
@@ -481,12 +481,12 @@ public class DistrictController {
}
/**
* 底部热门推荐
* 底部热门推荐
*
* @param model
*/
private void feedFooter(DistrictModel model) {
// 底部热门推荐其他小区
// 底部热门推荐其他小区
int maxCount = 20;
int maxRecommendCount = 7;
DistrictQueryBean queryBean = new DistrictQueryBean();
@@ -501,7 +501,7 @@ public class DistrictController {
}
model.setFooterDistricts(limit(districtList));
// 底部热门推荐的其他城市
// 底部热门推荐的其他城市
queryBean = new DistrictQueryBean();
FacetQuery facetQuery = new FacetQuery();
facetQuery.setFields(Arrays.asList("city"));
@@ -672,31 +672,31 @@ public class DistrictController {
}
/**
* 按时间做Seed获取的随机筛选的区域信息
* 按时间做Seed获取的随机筛选的区域信息
*
* @return 随机筛选的区域信息
* @return 随机筛选的区域信息
*/
private List<DistrictInfo> limit(List<DistrictInfo> districts) {
int needCount = 6;// 获取的数据个数7个
int needCount = 6;// 获取的数据个数7个
int changeDay = 20;// 设置更新频率为20天
int changeDay = 20;// 设置更新频率为20天
int currentCount = districts.size();// 当前获取的Region总数
int currentCount = districts.size();// 当前获取的Region总数
if (currentCount <= needCount)
return districts;
Calendar oldTime = Calendar.getInstance();
oldTime.set(2011, 8, 1);// 初始化时间为2011年09月01日
oldTime.set(2011, 8, 1);// 初始化时间为2011年09月01日
Calendar newTime = Calendar.getInstance();
int reduceDay = SimRandom.getReduceDay(newTime, oldTime);// 获取日期与初始日期相差天数
int reduceDay = SimRandom.getReduceDay(newTime, oldTime);// 获取日期与初始日期相差天数
int seed = (int) reduceDay / changeDay;// 计算simRandom变化频率,20表示20天更新一次
int seed = (int) reduceDay / changeDay;// 计算simRandom变化频率,20表示20天更新一次
List<Integer> simIndexs = SimRandom.getSimRandom(seed, currentCount, needCount);// 获取随机Index
List<Integer> simIndexs = SimRandom.getSimRandom(seed, currentCount, needCount);// 获取随机Index
List<DistrictInfo> ret = new ArrayList<DistrictInfo>(needCount);
for (int index : simIndexs) {
@@ -705,7 +705,7 @@ public class DistrictController {
return ret;
}
static final String[] fwords = { "http://t\\.cn/\\w+", "安居客", "赶集", "百姓网", "搜房", "58同城", "(via)" };
static final String[] fwords = { "http://t\\.cn/\\w+", "安居客", "赶集", "百姓网", "搜房", "58同城", "(via)" };
public Object wshowAction(DistrictModel model) {
if (StringUtils.isBlank(model.getDistrictName()) || StringUtils.isBlank(model.getRegion())) {
@@ -832,7 +832,7 @@ public class DistrictController {
}
// Pager microBlogPager = new Pager(10);// 微博分页,固定,显示前五条
// Pager microBlogPager = new Pager(10);// 微博分页,固定,显示前五条
// List<MicroBlog> microBlogs = microBlogService.findByKeyWord(microBlogPager, district.getName());
//
// for (MicroBlog wb : microBlogs) {
@@ -867,10 +867,10 @@ public class DistrictController {
model.setPicCount(getPicCount(district, "all"));
// 小区是否存在均价,不存在的话不显示小区房价tab
// 小区是否存在均价,不存在的话不显示小区房价tab
DistrictStatBo statBo = districtStatService.findDistrictStat(districtKey);
// 拿均价用于页面meta显示(seo)
// 拿均价用于页面meta显示(seo)
if (null != statBo.getDefaultDistrictStat()) {
model.setDistrictStat(statBo.getDefaultDistrictStat());
} else if (null != statBo.getDistrictStat()) {
@@ -884,7 +884,7 @@ public class DistrictController {
model.setHouseBoList(getDistrictHouses(model));
model.setRentHouseBoList(getDistrictRentHouses(model));
// 小区经纪人推荐去掉,数据不好 yukai 2011-11-16
// 小区经纪人推荐去掉,数据不好 yukai 2011-11-16
// List<BrokerBo> brokerBoList =
// brokerService.findBrokerTop5(districtKey);
// for (BrokerBo brokerBo : brokerBoList) {
@@ -975,24 +975,24 @@ public class DistrictController {
if (ArrayUtils.contains(kinds, DistrictKindEnum.bieshu.getValue())) {
if (null != districtStatBo.getVillaDistrictStat()) {
DistrictStat districtStat = districtStatBo.getVillaDistrictStat();
shareMessage.append("本周别墅均价:").append((districtStat.getAvgPrice() / 100) * 100).append("元/㎡ ");
shareMessage.append("本周别墅均价:").append((districtStat.getAvgPrice() / 100) * 100).append("元/㎡ ");
if (districtStat.getWeekendMarkup() < 0) {
shareMessage.append("下跌 ").append(districtStat.getWeekendMarkup() / 100.0).append("% ");
shareMessage.append("下跌 ").append(districtStat.getWeekendMarkup() / 100.0).append("% ");
} else if (districtStat.getWeekendMarkup() > 0) {
shareMessage.append("上涨 ").append(districtStat.getWeekendMarkup() / 100.0).append("% ");
shareMessage.append("上涨 ").append(districtStat.getWeekendMarkup() / 100.0).append("% ");
} else {
shareMessage.append("持平 ");
shareMessage.append("持平 ");
}
}
if (kinds.length > 1 && null != districtStatBo.getDistrictStat()) {
DistrictStat districtStat = districtStatBo.getDistrictStat();
shareMessage.append(" 本周公寓均价:").append((districtStat.getAvgPrice() / 100) * 100).append("元/㎡ ");
shareMessage.append(" 本周公寓均价:").append((districtStat.getAvgPrice() / 100) * 100).append("元/㎡ ");
if (districtStat.getWeekendMarkup() < 0) {
shareMessage.append("下跌 ").append(districtStat.getWeekendMarkup() / 100.0).append("% ");
shareMessage.append("下跌 ").append(districtStat.getWeekendMarkup() / 100.0).append("% ");
} else if (districtStat.getWeekendMarkup() > 0) {
shareMessage.append("上涨 ").append(districtStat.getWeekendMarkup() / 100.0).append("% ");
shareMessage.append("上涨 ").append(districtStat.getWeekendMarkup() / 100.0).append("% ");
} else {
shareMessage.append("持平 ");
shareMessage.append("持平 ");
}
}
}
@@ -1001,7 +1001,7 @@ public class DistrictController {
}
/**
* 小区看房日记
* 小区看房日记
*
* @param model
* @return
@@ -1034,7 +1034,7 @@ public class DistrictController {
// filter invalid pictures first.
model.setDistrict(district);
// 图片数
// 图片数
if (model.getPicCount() == 0) {
String showPic = "";
if (!CollectionUtils.isEmpty(district.getOutPics())) {
@@ -1085,10 +1085,10 @@ public class DistrictController {
DataUtil.removeHtml(DataUtil.balanceTags(news.getName()))));
}
if (null != news.getPublishDate()) {
// 当天的资讯,时间显示为“**小时前更新”
// 当天的资讯,时间显示为“**小时前更新”
if (news.getPublishDate().after(range[0]) && news.getPublishDate().before(range[1])) {
newsBo.setPublishDateStr((DateUtil.getHour(new Date()) - DateUtil.getHour(news.getPublishDate()))
+ "小时前更新");
+ "小时前更新");
} else {
newsBo.setPublishDateStr(sdf.format(news.getPublishDate()));
}
@@ -1115,7 +1115,7 @@ public class DistrictController {
}
/**
* 小区房价tab页
* 小区房价tab页
*
* @param model
* @return
@@ -1156,7 +1156,7 @@ public class DistrictController {
*
* // filter invalid pictures first. model.setDistrict(district);
*
* // 图片数 if (model.getPicCount() == 0) { String showPic = ""; if
* // 图片数 if (model.getPicCount() == 0) { String showPic = ""; if
* (!CollectionUtils.isEmpty(district.getOutPics())) {
*
* if (StringUtils.isBlank(showPic)) { showPic =
@@ -1181,14 +1181,14 @@ public class DistrictController {
* model.setDistrictStatStr(getDistrictStatToString(model, district,
* statBo).toString());
*
* // 周边小区均价 DistrictQueryBean queryBean = new DistrictQueryBean();
* // 周边小区均价 DistrictQueryBean queryBean = new DistrictQueryBean();
* queryBean.setLat(district.getLat());
* queryBean.setLng(district.getLng()); queryBean.setRange(3);
* queryBean
* .setCity(FangjiaServerAreaContextHolder.getServerAreaDefault
* ().getDisplay());
*
* // 获取周边10个小区 Pager pager = new Pager(10,
* // 获取周边10个小区 Pager pager = new Pager(10,
* FangjiaConfig.getConfig().getSearchListMaxPageNo());
* List<District> aroundDistrictList =
* districtService.findByQueryBean(pager, queryBean, true);
@@ -1334,7 +1334,7 @@ public class DistrictController {
}
/**
* 小区估价
* 小区估价
*
* @param model
* @return
@@ -1408,29 +1408,29 @@ public class DistrictController {
} else if (parseMap.containsKey("area")) {
evaluation.setArea(Double.parseDouble(parseMap.get("area").toString()));
model.setArea(Double.parseDouble(parseMap.get("area").toString()));
builder.append(parseMap.get("area").toString()).append("平米");
builder.append(parseMap.get("area").toString()).append("平米");
}
if (model.getRoom() > 0) {
evaluation.setRoom(model.getRoom());
model.setRoom(model.getRoom());
builder.append(model.getRoom()).append("室").append(",");
builder.append(model.getRoom()).append("室").append(",");
} else if (parseMap.get("room") != null) {
evaluation.setRoom(Integer.parseInt(parseMap.get("room").toString()));
model.setRoom(Integer.parseInt(parseMap.get("room").toString()));
builder.append(parseMap.get("room").toString()).append("室").append(",");
builder.append(parseMap.get("room").toString()).append("室").append(",");
}
if (parseMap.get("hall") != null) {
evaluation.setHall(Integer.parseInt(parseMap.get("hall").toString()));
model.setHall(Integer.parseInt(parseMap.get("hall").toString()));
builder.append(parseMap.get("hall").toString()).append("厅").append(",");
builder.append(parseMap.get("hall").toString()).append("厅").append(",");
}
if (parseMap.get("toilet") != null) {
evaluation.setToilet(Integer.parseInt(parseMap.get("toilet").toString()));
model.setToilet(Integer.parseInt(parseMap.get("toilet").toString()));
builder.append(parseMap.get("toilet").toString()).append("卫").append(",");
builder.append(parseMap.get("toilet").toString()).append("卫").append(",");
}
int avgPrice = 0;
@@ -1444,19 +1444,19 @@ public class DistrictController {
if (areas.get(0) <= 0) {
evaluation.setArea(Double.parseDouble(areas.get(1).toString()));
model.setEvaluationPrice(evaluationRateService.evaluation(avgPrice, evaluation) / 10000);
builder.insert(0, areas.get(1).toString() + "平米,");
builder.insert(0, areas.get(1).toString() + "平米,");
model.setArea(Double.parseDouble(areas.get(1).toString()));
} else if (areas.get(1) >= Integer.MAX_VALUE) {
evaluation.setArea(Double.parseDouble(areas.get(0).toString()));
model.setEvaluationPrice(evaluationRateService.evaluation(avgPrice, evaluation) / 10000);
builder.insert(0, areas.get(0).toString() + "平米,");
builder.insert(0, areas.get(0).toString() + "平米,");
model.setArea(Double.parseDouble(areas.get(0).toString()));
} else {
evaluation.setArea(Double.parseDouble(areas.get(0).toString()));
model.setMinEvaluationPrice(evaluationRateService.evaluation(avgPrice, evaluation) / 10000);
evaluation.setArea(Double.parseDouble(areas.get(1).toString()));
model.setMaxEvaluationPrice(evaluationRateService.evaluation(avgPrice, evaluation) / 10000);
builder.insert(0, areas.get(0).toString() + "-" + areas.get(1).toString() + "平米");
builder.insert(0, areas.get(0).toString() + "-" + areas.get(1).toString() + "平米");
model.setArea(Double.parseDouble(areas.get(0).toString()));
}
} else {
@@ -1472,7 +1472,7 @@ public class DistrictController {
}
/**
* 小区信息
* 小区信息
*
* @param model
* @return
@@ -1522,7 +1522,7 @@ public class DistrictController {
}
/**
* 显示小区在租房源5笔
* 显示小区在租房源5笔
*
* @param model
* @author xingwang
@@ -1548,7 +1548,7 @@ public class DistrictController {
}
/**
* ajax方式展示小区
* ajax方式展示小区
*
* @param model
* @return
@@ -1561,13 +1561,13 @@ public class DistrictController {
((ServerArea) FangjiaServerAreaContextHolder.getServerAreaDefault()).getDisplay(), model.getRegion(),
model.getDistrictName());
if (0 != model.getLatMapMax() && 0 != model.getLatMapMin() && 0 != model.getLngMapMax() && 0 != model.getLngMapMin()) {
int radius = 3;// 周边三公里
int radius = 3;// 周边三公里
long lnn = (model.getCurLng() - (radius * 100000000));
long lnx = (model.getCurLng() + (radius * 100000000));
long lan = (model.getCurLat() - (radius * 100000000));
long lax = (model.getCurLat() + (radius * 100000000));
// 用于查询的经纬度
// 用于查询的经纬度
long lngMax = DataUtil.matchMax(lnx, lnn, model.getLngMapMax());
long lngMin = DataUtil.matchMin(lnx, lnn, model.getLngMapMin());
long latMax = DataUtil.matchMax(lax, lan, model.getLatMapMax());
@@ -1606,7 +1606,7 @@ public class DistrictController {
}
/**
* ajax方式取得小区信息
* ajax方式取得小区信息
*
* @param model
* @return
@@ -1628,7 +1628,7 @@ public class DistrictController {
}
/**
* 根据小区组装DistrictBo
* 根据小区组装DistrictBo
*
* @param district
* @return
@@ -1693,7 +1693,7 @@ public class DistrictController {
}
/**
* 小区最新二手房房源
* 小区最新二手房房源
*
* @param model
* @return
@@ -1718,7 +1718,7 @@ public class DistrictController {
}
/**
* 小区相关均价(小区均价和小区所在区域均价)
* 小区相关均价(小区均价和小区所在区域均价)
*
* @param model
* @return
@@ -1814,10 +1814,10 @@ public class DistrictController {
// // startRow,
// // pageSize,
// // totalRow);
// // // 不需要分页
// // // 不需要分页
// model.setDistrictPicMaps(subListPics);
//
// // 小区是否存在均价,不存在的话不显示小区房价tab
// // 小区是否存在均价,不存在的话不显示小区房价tab
// DistrictStatBo statBo = districtStatService.findDistrictStat(districtKey);
// model.setDistrictStatExist(null != statBo.getDefaultDistrictStat());
// model.setDiaryExist(isDistrictDiaryExist(districtKey));
@@ -1830,7 +1830,7 @@ public class DistrictController {
/**
* 小区信息
* 小区信息
*
* @param model
* @return
@@ -2029,7 +2029,7 @@ public class DistrictController {
}
/**
* 根据IP得到城市
* 根据IP得到城市
*
* @throws Exception
*/
@@ -2066,7 +2066,7 @@ public class DistrictController {
addressMatchLog.setInput(model.getKeyword());
addressMatchLog.setIp(AnalyticsUtil.getIpAddress(request));
addressMatchLog.setUid(cookieContext.getCookieValue(request, CookieName.UID));
addressMatchLog.setSource("房价网");
addressMatchLog.setSource("房价网");
addressMatchLog.setCreationDate(new Date());
addressMatchLog.setModificationDate(new Date());
@@ -2078,7 +2078,7 @@ public class DistrictController {
addressMatchLog.setStatus(status);
}
if(status == 0){//如果open接口返回多个时,此处需要改
if(status == 0){//如果open接口返回多个时,此处需要改
List<Map<String,String>> result = new ArrayList<Map<String,String>>();
Map<String,String> map = new HashMap<String,String>();
map.put("city", (String) resultMap.get("city"));
@@ -64,7 +64,7 @@ public class ElevateWordController {
private FriendLinkService friendLinkService;
/**
* 竞品词页面
* 竞品词页面
*
* @param model
* @param request
@@ -105,7 +105,7 @@ public class ElevateWordController {
model.setCurrentHouseCity(ServerAreaData.getServerAreaByDisplay(currentArea.getDisplay()).getName());
model.setCurrentHouseCityName(currentArea.getDisplay());
// 变量替换
// 变量替换
elevateWord = placeHolderReplacer(elevateWord, currentArea.getDisplay());
if (StringUtils.isBlank(model.getHouseType())) {
@@ -135,9 +135,9 @@ public class ElevateWordController {
}
queryBean.setCity(currentArea.getDisplay());
FacetQueryResult<RentHouseBo> rentHouseResult = rentHouseResult(queryBean, model, 14);
// 推荐租房
// 推荐租房
List<RentHouseBo> recommendRentHouseList = Collections.emptyList();
// 租房列表
// 租房列表
List<RentHouseBo> rentHouseList = Collections.emptyList();
if (CollectionUtils.isNotEmpty(rentHouseResult)) {
if (rentHouseResult.size() >= 10) {
@@ -172,9 +172,9 @@ public class ElevateWordController {
}
queryBean.setCity(currentArea.getDisplay());
FacetQueryResult<HouseBo> houseResultList = houseResult(queryBean, model, 14);
// 推荐二手房
// 推荐二手房
List<HouseBo> recommendHouseList = Collections.emptyList();
// 二手房列表
// 二手房列表
List<HouseBo> houseList = Collections.emptyList();
if (CollectionUtils.isNotEmpty(houseResultList)) {
if (houseResultList.size() >= 10) {
@@ -242,7 +242,7 @@ public class ElevateWordController {
}
/**
* 当前城市4套推荐租房
* 当前城市4套推荐租房
*
* @param elevateWord
* @param currentArea
@@ -263,7 +263,7 @@ public class ElevateWordController {
}
/**
* 当前竞品词有房源的城市列表
* 当前竞品词有房源的城市列表
*
* @param elevateWord
* @param model
@@ -315,7 +315,7 @@ public class ElevateWordController {
}
/**
* 随即资讯
* 随即资讯
*
* @param elevateWord
* @param model
@@ -363,7 +363,7 @@ public class ElevateWordController {
model.redirectPermanently(model.getCityUrl());
return model;
// 更新域名
// 更新域名
// fangjiaDomainHandler.update();
// List<ElevateWord> list = elevateWordService.findElevateWords();
// List<ElevateWord> list = elevateWordService.findAdjustElevateWordsByCity(model.getElevateWordShowCity());
@@ -385,7 +385,7 @@ public class ElevateWordController {
}
private void feedFooter(ElevateWordModel model) {
// 最新上线的城市
// 最新上线的城市
List<CityGroup> newCitys = new ArrayList<CityGroup>();
List<ServerArea> serverAreaList = ServerAreaData.getServerAreaList(15);
List<String> cityNames = CollectionUtils.collect(serverAreaList, new Closure<String, ServerArea>() {
@@ -405,10 +405,10 @@ public class ElevateWordController {
}
/**
* 获取当前城市
* 获取当前城市
*
* @param request
* @return 当前城市
* @return 当前城市
*/
private ServerArea getSuggestCity(HttpServletRequest request) {
String ip = AnalyticsUtil.getIpAddress(request);
@@ -427,7 +427,7 @@ public class ElevateWordController {
}
/**
* 城市首页 底部竞品词列表
* 城市首页 底部竞品词列表
*
* @param model
* @return
@@ -436,11 +436,11 @@ public class ElevateWordController {
return model.redirectPermanently(model.getCityUrl());
// List<ElevateWordBo> boList = new ArrayList<ElevateWordBo>();
// List<ElevateWord> elevateWords = null;
// // 城市列表
// // 城市列表
// /*if (StringUtils.isNotBlank(model.getElevateWordShowCity())) {
// elevateWords = elevateWordService.findElevateWordsByCity(model.getElevateWordShowCity());
// } else {
// // 全国首页
// // 全国首页
// elevateWords = elevateWordService.findElevateWords(model.getPlacement());
// }*/
// elevateWords = elevateWordService.findAdjustElevateWordsByCity(model.getElevateWordShowCity());
@@ -562,7 +562,7 @@ public class ElevateWordController {
}
/**
* 当前竞品词 的房源 如果当前城市 没有,显示推荐城市二手房房源
* 当前竞品词 的房源 如果当前城市 没有,显示推荐城市二手房房源
*
* @param elevateWord
* @param model
@@ -618,7 +618,7 @@ public class ElevateWordController {
}
/**
* 当前竞品词 的房源 如果当前城市 没有,显示推荐城市租房房源
* 当前竞品词 的房源 如果当前城市 没有,显示推荐城市租房房源
*
* @param elevateWord
* @param model
@@ -679,7 +679,7 @@ public class ElevateWordController {
}
/**
* 友情链接
* 友情链接
*
* @return
*/
@@ -16,7 +16,7 @@ import com.fangjia.service.mongo.fangjia.EvaluationConditionService;
import com.fangjia.service.mongo.fangjia.EvaluationFactorService;
/**
* 估价
* 估价
*
*/
public class EvaluationPriceController {
@@ -25,13 +25,13 @@ public class EvaluationPriceController {
private EvaluationPriceService evaluationPriceService;
public Object saleAction(EvaluationPriceModel model) {
// 根据传入的estateType去查询所有的condition
if (model.getEstateType() == null || model.getEstateType().equals("不限")) {
model.setEstateType("小区");
// 根据传入的estateType去查询所有的condition
if (model.getEstateType() == null || model.getEstateType().equals("不限")) {
model.setEstateType("小区");
}
List<EvaluationCondition> evaluationConditions = evaluationConditionService
.findEvaluationConditionsByParams(model.getEstateType());
// 在根据condition去查询所有的factor
// 在根据condition去查询所有的factor
// List<EvaluationCondition> evaluationConditions =
// evaluationConditionService.findAllEvaluationConditions();
model.setEvaluationConditions(evaluationConditions);
@@ -39,7 +39,7 @@ public class EvaluationPriceController {
for (EvaluationCondition evaluationCondition : evaluationConditions) {
ConditionAndFactorModel conditionAndFactorModel = new ConditionAndFactorModel();
List<EvaluationFactor> evaluationFactors = evaluationFactorService
.findEvaluationFactorsByParams("上海", model.getEstateType(),
.findEvaluationFactorsByParams("上海", model.getEstateType(),
evaluationCondition.getCondition());
conditionAndFactorModel.setConditionName(evaluationCondition
.getCondition());
@@ -52,27 +52,27 @@ public class EvaluationPriceController {
return model;
}
// 估算别墅价格
// 估算别墅价格
public Object doEvaluationAction(EvaluationPriceModel model) {
// 根据传入的条件估算价格
model.getEvaluationPrice().setCity("上海");
model.getEvaluationPrice().setRegion("浦东");
// 根据传入的条件估算价格
model.getEvaluationPrice().setCity("上海");
model.getEvaluationPrice().setRegion("浦东");
model.getEvaluationPrice().setArea(200d);
evaluationPriceService.doEvaluation(model.getEvaluationPrice());
return model;
}
// 根据物业类型刷新估价条件
// 根据物业类型刷新估价条件
public Object flashConditionAction(EvaluationPriceModel model) {
// 根据传入的estateType去查询所有的condition
// 根据传入的estateType去查询所有的condition
JsonModel jsonModel = new JsonModel();
System.out.println(model.getEstateType());
if (model.getEstateType() == null || model.getEstateType().equals("不限")) {
model.setEstateType("小区");
if (model.getEstateType() == null || model.getEstateType().equals("不限")) {
model.setEstateType("小区");
}
List<EvaluationCondition> evaluationConditions = evaluationConditionService
.findEvaluationConditionsByParams(model.getEstateType());
// 在根据condition去查询所有的factor
// 在根据condition去查询所有的factor
model.setEvaluationConditions(evaluationConditions);
List<ConditionAndFactorModel> conditionAndFactorModels = new ArrayList<ConditionAndFactorModel>();
for (EvaluationCondition evaluationCondition : evaluationConditions) {
@@ -91,7 +91,7 @@ public class EvaluationPriceController {
return jsonModel;
}
// 计算房子价格
// 计算房子价格
public Object doPriceAction(EvaluationPriceModel model) {
JsonModel jsonModel = new JsonModel();
@@ -102,7 +102,7 @@ public class EvaluationPriceController {
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
// 对ajax参数进行解析
// 对ajax参数进行解析
double totalPrice = evaluationPriceService.doPrice(decodeCondition);
Map<String, Double> maxAndMinPriceMap = evaluationPriceService.doMinAndMaxPrice(decodeCondition);
model.setTotalPrice(totalPrice);
@@ -19,7 +19,7 @@ import com.fangjia.service.fangjia.FangJiaUserService;
import com.fangjia.service.mongo.fangjia.ServerAreaService;
/**
* 用户评估目的分析
* 用户评估目的分析
* @author yinjihuan
*
*/
@@ -31,7 +31,7 @@ public class EvaluationPurposeAnalysisController {
private FangJiaUserService fangJiaUserService;
/**
* 估价Service
* 估价Service
*/
private EvaluationService evaluationService;
@@ -129,7 +129,7 @@ public class EvaluationReportController {
}
/**
* 关闭数据流
* 关闭数据流
*
* @param inputStream
* @param outputStream
@@ -150,10 +150,10 @@ public class EvaluationReportController {
}
/**
* Evaluation Report No.生成规则
* Evaluation Report No.生成规则
*
* @param evaluationId
* 估价ID
* 估价ID
* @return Evaluation Report No
*/
private String getEvaluationReportNo(String evaluationId) {
@@ -161,13 +161,13 @@ public class EvaluationReportController {
}
/**
* PDF视图设置
* PDF视图设置
*
* @param inputStream
* 文件流
* 文件流
* @param evaluationReportId
* @param postfix
* URL显示的文件后缀
* URL显示的文件后缀
* @return ReportModelAndView
*/
private ReportModelAndView getReportModelAndView(InputStream inputStream, String evaluationReportId, String postfix) {
@@ -181,7 +181,7 @@ public class EvaluationReportController {
}
/**
* 获取小区面积20%的房源
* 获取小区面积20%的房源
*
* @param evaluation
* @param pager
@@ -206,7 +206,7 @@ public class EvaluationReportController {
}
/**
* 获取面积范围
* 获取面积范围
*
* @param area
* @param offset
@@ -227,7 +227,7 @@ public class EvaluationReportController {
}
/**
* 获取周边radius公里的查询条件
* 获取周边radius公里的查询条件
*
* @param lat
* @param lng
@@ -248,7 +248,7 @@ public class EvaluationReportController {
}
/**
* 获取价格范围
* 获取价格范围
*
* @param price
* @param offset
@@ -263,7 +263,7 @@ public class EvaluationReportController {
}
/**
* 获取相似房源
* 获取相似房源
*
* @param evaluation
* @return
@@ -272,32 +272,32 @@ public class EvaluationReportController {
Pager pager = new Pager(3);
// 面积20%
// 面积20%
String areaRange = null;
if (evaluation.getArea() != null && evaluation.getArea() > 0) {
areaRange = getAreaRange(evaluation.getArea(), 0.2);
}
// 获取小区内相似房源
// 获取小区内相似房源
List<HouseBo> houseBoList = districtAreaSimilarHouse(evaluation, pager, areaRange);
// 价格20%范围
// 价格20%范围
String totalPriceRange = null;
if (evaluation.getTotalPrice() != null && evaluation.getTotalPrice() > 0) {
totalPriceRange = getTotalPriceRange(evaluation.getTotalPrice(), 0.2);
}
// 补充周边房源
// 补充周边房源
if (isHouseNotEnough(houseBoList, pager)) {
// 获取周边3公里的查询条件
// 获取周边3公里的查询条件
DistrictQueryBean disQueryBean = getDistrictQueryBean(lat, lng, 3);
FacetQueryResult<District> districtResult = districtService.findByQueryBean(new Pager(30), disQueryBean, false);
// 周边房源存在
// 周边房源存在
if (districtResult.size() > 0) {
// 按Region排序
// 按Region排序
Map<String, List<District>> districtMap = CollectionUtils.groupBy(districtResult,
new Closure<String, District>() {
public String execute(District input) {
@@ -329,7 +329,7 @@ public class EvaluationReportController {
CollectionUtils.addAll(houseBoList, houseService.findByQueryBean(pager, addQueryBean)
.iterator());
} else {
// 房源数满足后 ,break
// 房源数满足后 ,break
break;
}
}
@@ -344,7 +344,7 @@ public class EvaluationReportController {
}
/**
* 补充房源查询条件
* 补充房源查询条件
*
* @return
*/
@@ -364,7 +364,7 @@ public class EvaluationReportController {
}
/**
* 判断房源是否满足显示条件
* 判断房源是否满足显示条件
*
* @param result
* @return
@@ -374,7 +374,7 @@ public class EvaluationReportController {
}
/**
* 获取_google地图地址
* 获取_google地图地址
*
* @param orgLat
* @param orgLng
@@ -389,7 +389,7 @@ public class EvaluationReportController {
}
/**
* 估价报告数据集
* 估价报告数据集
*
* @param reportId
* @param reportNo
@@ -410,9 +410,9 @@ public class EvaluationReportController {
Report report = new Report();
// 估价报告 作者信息
report.setReportAuto("房价网");
report.setReportDate(DateUtil.formatByPattern(date, "yyyy年MM月dd日"));
// 估价报告 作者信息
report.setReportAuto("房价网");
report.setReportDate(DateUtil.formatByPattern(date, "yyyy年MM月dd日"));
report.setReportNo(reportNo);
report.setDistrictName(evaluation.getDistrictName());
@@ -440,7 +440,7 @@ public class EvaluationReportController {
report.setEvaluationDescription(autoMakeEvaluationDescription(evaluation));
// 估价报告 相关图片
// 估价报告 相关图片
if (district != null) {
report.setGoogleMap(getGoogleMap(district.getLat(), district.getLng()));
} else {
@@ -453,7 +453,7 @@ public class EvaluationReportController {
}
/**
* 获取走势图
* 获取走势图
*
* @param evaluation
* @return
@@ -466,7 +466,7 @@ public class EvaluationReportController {
}
/**
* 生成_google走势图配置
* 生成_google走势图配置
*
* @param width
* @param height
@@ -514,7 +514,7 @@ public class EvaluationReportController {
}
/**
* 获取走势图
* 获取走势图
*
* @param dss
* @param evaluation
@@ -542,7 +542,7 @@ public class EvaluationReportController {
}
/**
* 获取估价显示名称
* 获取估价显示名称
*
* @param districtName
* @param houseNum
@@ -554,56 +554,56 @@ public class EvaluationReportController {
if (StringUtils.isNotBlank(districtName)) {
evaluationName.append(districtName);
}
// 只做字符串处理,不做数字处理,传入的值可能是 中文数字 (例如 :四十等)
// 只做字符串处理,不做数字处理,传入的值可能是 中文数字 (例如 :四十等)
if (StringUtils.isNotEmpty(houseNum)) {
evaluationName.append(houseNum);
evaluationName.append("号");
evaluationName.append("号");
}
if (StringUtils.isNotBlank(roomNum)) {
evaluationName.append(roomNum);
evaluationName.append("室");
evaluationName.append("室");
}
return evaluationName.toString();
}
/**
* 获取估价报告描述
* 获取估价报告描述
*
* @param evaluation
* @return
*/
private String autoMakeEvaluationDescription(final Evaluation evaluation) {
String prefix = "分析对象:";// 没有数据的时候 不显示 prefix
String prefix = "分析对象:";// 没有数据的时候 不显示 prefix
StringBuffer eDesc = new StringBuffer();
eDesc.append(joinAroundFix("装修情况", null, evaluation.getFitment(), true));// 装修
eDesc.append(joinAroundFix("小区位置", null, evaluation.getInsidepos(), true));// 小区位置
eDesc.append(joinAroundFix("朝向", null, evaluation.getDirection(), true));// 朝向
eDesc.append(joinAroundFix("装修情况", null, evaluation.getFitment(), true));// 装修
eDesc.append(joinAroundFix("小区位置", null, evaluation.getInsidepos(), true));// 小区位置
eDesc.append(joinAroundFix("朝向", null, evaluation.getDirection(), true));// 朝向
if (evaluation.getFitmentCharge() != null) {
eDesc.append(joinAroundFix("装修价格", null, evaluation.getFitmentCharge() + "元", true));// 装修价格
eDesc.append(joinAroundFix("装修价格", null, evaluation.getFitmentCharge() + "元", true));// 装修价格
}
if (evaluation.getFitmentAge() != null) {
eDesc.append(joinAroundFix("装修年限", null, getFitmentAge(evaluation.getFitmentAge()), true));// 装修年限
eDesc.append(joinAroundFix("装修年限", null, getFitmentAge(evaluation.getFitmentAge()), true));// 装修年限
}
eDesc.append(joinAroundFix("景观情况", null, evaluation.getSight(), true));
eDesc.append(joinAroundFix("采光通风", null, evaluation.getLightingVentilation(), true));
eDesc.append(joinAroundFix("噪音情况", null, evaluation.getNoise(), true));
eDesc.append(joinAroundFix("景观情况", null, evaluation.getSight(), true));
eDesc.append(joinAroundFix("采光通风", null, evaluation.getLightingVentilation(), true));
eDesc.append(joinAroundFix("噪音情况", null, evaluation.getNoise(), true));
if (evaluation.getGardenArea() != null || evaluation.getBasementArea() != null) {
eDesc.append("赠送面积");
eDesc.append("赠送面积");
if (evaluation.getGardenArea() != null) {
eDesc.append(joinAroundFix("花园", null, evaluation.getGardenArea() + "平米", true));
eDesc.append(joinAroundFix("花园", null, evaluation.getGardenArea() + "平米", true));
}
if (evaluation.getBasementArea() != null) {
eDesc.append(joinAroundFix("地下室", null, evaluation.getBasementArea() + "平米", true));
eDesc.append(joinAroundFix("地下室", null, evaluation.getBasementArea() + "平米", true));
}
}
eDesc.append(joinAroundFix("边套装置", null, evaluation.getSideset(), true));
eDesc.append(joinAroundFix("厌恶因素", null, evaluation.getWorryFactor(), true));
eDesc.append(joinAroundFix("建筑质量", null, evaluation.getBuildQuality(), true));
eDesc.append(joinAroundFix("厌恶设施", null, evaluation.getWorryFacility(), true));
eDesc.append(joinAroundFix("自有车位", null, evaluation.getCarport(), true));
eDesc.append(joinAroundFix("小区配套", null, evaluation.getFacilities(), true));
eDesc.append(joinAroundFix("其他因素", null, evaluation.getOtherFactor(), false));
eDesc.append(joinAroundFix("边套装置", null, evaluation.getSideset(), true));
eDesc.append(joinAroundFix("厌恶因素", null, evaluation.getWorryFactor(), true));
eDesc.append(joinAroundFix("建筑质量", null, evaluation.getBuildQuality(), true));
eDesc.append(joinAroundFix("厌恶设施", null, evaluation.getWorryFacility(), true));
eDesc.append(joinAroundFix("自有车位", null, evaluation.getCarport(), true));
eDesc.append(joinAroundFix("小区配套", null, evaluation.getFacilities(), true));
eDesc.append(joinAroundFix("其他因素", null, evaluation.getOtherFactor(), false));
if (eDesc.length() > 0) {
return prefix + eDesc.toString();
}
@@ -611,20 +611,20 @@ public class EvaluationReportController {
}
/**
* 获取装修年限的字符串
* 获取装修年限的字符串
*
* @param fitmentAge
* @return
*/
private String getFitmentAge(int fitmentAge) {
if (fitmentAge == 5) {
return "4年以上";
return "4年以上";
}
return fitmentAge + "年";
return fitmentAge + "年";
}
/**
* 拼接字符串
* 拼接字符串
*
* @param prefix
* @param postfix
@@ -644,12 +644,12 @@ public class EvaluationReportController {
if (appendFlag) {
return prefix + content + postfix + ",";
} else {
return prefix + content + postfix + "。";
return prefix + content + postfix + "。";
}
}
/**
* 获取文件inputStream
* 获取文件inputStream
*
* @param path
* @return
@@ -659,37 +659,37 @@ public class EvaluationReportController {
}
/**
* 估价信息表格数据
* 估价信息表格数据
*
* @param report
* @return
*/
private List<String> getEvaluationTableDatas(Report report) {
List<String> evaluationTableDatas = new ArrayList<String>(16);
evaluationTableDatas.add("幢号:");
evaluationTableDatas.add("幢号:");
evaluationTableDatas.add(report.getHouseNum());
evaluationTableDatas.add("室号:");
evaluationTableDatas.add("室号:");
evaluationTableDatas.add(report.getRoomNum());
evaluationTableDatas.add("建筑面积:");
evaluationTableDatas.add("建筑面积:");
evaluationTableDatas.add(report.getArea());
evaluationTableDatas.add("楼层:");
evaluationTableDatas.add("楼层:");
evaluationTableDatas.add(report.getFloor());
evaluationTableDatas.add("建筑类型:");
evaluationTableDatas.add("建筑类型:");
evaluationTableDatas.add(report.getBuildType());
evaluationTableDatas.add("用途:");
evaluationTableDatas.add("住宅");
evaluationTableDatas.add("用途:");
evaluationTableDatas.add("住宅");
evaluationTableDatas.add("房龄:");
evaluationTableDatas.add("房龄:");
evaluationTableDatas.add(report.getAge());
evaluationTableDatas.add("产权属性:");
evaluationTableDatas.add("产权属性:");
evaluationTableDatas.add(report.getHouseProperty());
return evaluationTableDatas;
}
/**
* 从_intputstream中获取bytes
* 从_intputstream中获取bytes
*
* @param is
* @return
@@ -730,7 +730,7 @@ public class EvaluationReportController {
}
/**
* 忽略NULL值
* 忽略NULL值
*
* @param obj
* @return
@@ -27,7 +27,7 @@ import com.fangjia.service.menu.Value;
import com.fangjia.service.web.MenuService;
/**
* 估价
* 估价
*
*/
public class EvaluationSearchController {
@@ -35,7 +35,7 @@ public class EvaluationSearchController {
private MenuService menuService;
/**
* 估价历史 列表页面
* 估价历史 列表页面
*
* @param model
* @return
@@ -53,7 +53,7 @@ public class EvaluationSearchController {
// }
//
// Menu menu = menuService.menuMaker(FangjiaServerAreaContextHolder.getServerAreaDefault(), MenuCategoryEnum.goojia,
// getCurrentParams(), 1);// 默认用区域菜单
// getCurrentParams(), 1);// 默认用区域菜单
//
// EvaluationQueryBean queryBean = new EvaluationQueryBean();
// BeanUtils.copyProperties(model, queryBean);
@@ -61,20 +61,20 @@ public class EvaluationSearchController {
// queryBean.setCity(city);
// queryBean.setFullTextSearch(true);
//
// // 获取面积范围
// // 获取面积范围
// if (NumberUtils.isDigits(queryBean.getHouseAreaRange())) {
// Value value = menuService.getValue(FangjiaServerAreaContextHolder.getServerAreaDefault(), MenuCategoryEnum.goojia,
// "houseAreaRange", queryBean.getHouseAreaRange());
// queryBean.setHouseAreaRange(value.getMin() + "_" + value.getMax());
// }
// // 获取价格范围
// // 获取价格范围
// if (NumberUtils.isDigits(queryBean.getTotalPriceRange())) {
// Value value = menuService.getValue(FangjiaServerAreaContextHolder.getServerAreaDefault(), MenuCategoryEnum.goojia,
// "totalPriceRange", queryBean.getTotalPriceRange());
// queryBean.setTotalPriceRange(value.getMin() + "_" + value.getMax());
// }
// queryBean.setKeyword(null);
// FacetQueryResult<EvaluationBo> evaluationBoResult = findWithFacetSearch(menu, pager, queryBean, "modificationDate", false);// 按创建时间降序creationDate,
// FacetQueryResult<EvaluationBo> evaluationBoResult = findWithFacetSearch(menu, pager, queryBean, "modificationDate", false);// 按创建时间降序creationDate,
//
// pager = safeCheckPager(evaluationBoResult.getNumberFound(), pager);
// pager.setTotalRows(evaluationBoResult.getNumberFound());
@@ -101,14 +101,14 @@ public class EvaluationSearchController {
//
// if (queryBean.getRegion() == null && queryBean.getHouseAreaRange() == null && queryBean.getTotalPriceRange() == null
// && queryBean.getRoom() == null) {
// // 只输入了关键词(这里是从上一个页面带过来的小区名)
// // 只输入了关键词(这里是从上一个页面带过来的小区名)
// FacetQueryResult<EvaluationBo> evaluationBoResult = facetSearch(pager, queryBean, menu, sortField, asc);
// if (evaluationBoResult != null) {
// menuService.operationMenuWithFacet(menu, evaluationBoResult.getFacetResults(), evaluationBoResult.size());
// }
// return evaluationBoResult;
// } else {
// // 关键词 + region + areaRange 等的组合检索
// // 关键词 + region + areaRange 等的组合检索
// FacetQueryResult<EvaluationBo> evaluationBoResult = evaluationService.findBoByQueryBeanSort(pager, queryBean,
// sortField, asc);
//
@@ -165,7 +165,7 @@ public class EvaluationSearchController {
// }
//
// /**
// * 起始位置比总数大,说明当前页数不对,从第一页开始
// * 起始位置比总数大,说明当前页数不对,从第一页开始
// *
// * @param maxRow
// * @param pager
@@ -98,7 +98,7 @@ public class FangjiaController {
private UrlFilterService urlFilterService;
/**
* 查询网站过滤的url
* 查询网站过滤的url
* @param model
* @return
*/
@@ -111,14 +111,14 @@ public class FangjiaController {
}
/**
* 城市首页|二手房列表|租房列表|小区列表 展示的友情链接 根据type查询相应的记录
* 城市首页|二手房列表|租房列表|小区列表 展示的友情链接 根据type查询相应的记录
*
* @param model
* @return
*/
public Object friendLinkAction(FriendLinkModel model) {
String city = ((ServerArea) FangjiaServerAreaContextHolder.getServerAreaDefault()).getDisplay();
if (model.getType() == 7 || model.getType() == 6) {// 城市首页清空城市
if (model.getType() == 7 || model.getType() == 6) {// 城市首页清空城市
city = "all";
}
final FriendLinkPlacementEnum placementEnum = FriendLinkPlacementEnum.findByPlacement(model.getType());
@@ -134,7 +134,7 @@ public class FangjiaController {
}
/**
* 缓存友情链接查询
* 缓存友情链接查询
*
* @param city
* @param placementEnum
@@ -151,7 +151,7 @@ public class FangjiaController {
}
/**
* 根据首页输入框中关键字进行频道切换
* 根据首页输入框中关键字进行频道切换
*
* @param model
* @return
@@ -176,7 +176,7 @@ public class FangjiaController {
FangjiaServerAreaContextHolder.setServerArea(serverArea);
}
// 判断当前城市是否开通新盘
// 判断当前城市是否开通新盘
boolean isSupportXinfang = (null != model.getCity() && model.getCity().isSupportXinfang()) == true ? true : false;
CategoryEnum channel = knowbaseService.parseKeyWord(model.getKeyword(), isSupportXinfang);
String channelUrl = null;
@@ -184,20 +184,20 @@ public class FangjiaController {
if (StringUtils.isNotBlank(model.getKeyword())) {
s = URLEncoder.encode(model.getKeyword(), "UTF-8") + "--__y-1";
}
if (CategoryEnum.sell == channel) { // 二手房
if (CategoryEnum.sell == channel) { // 二手房
channelUrl = model.getCityUrl() + "/ershoufang/" + s;
} else if (CategoryEnum.rent == channel) { // 租房
} else if (CategoryEnum.rent == channel) { // 租房
channelUrl = model.getCityUrl() + "/zufang/" + s;
} else if (CategoryEnum.district == channel) { // 小区
} else if (CategoryEnum.district == channel) { // 小区
channelUrl = model.getCityUrl() + "/xiaoqu/" + s;
} else if (CategoryEnum.evaluation == channel) { // 估价
} else if (CategoryEnum.evaluation == channel) { // 估价
channelUrl = model.getCityUrl() + "/evaluation/report?keyword=" + URLEncoder.encode(model.getKeyword(), "UTF-8");
} else if (CategoryEnum.news == channel) { // 资讯
} else if (CategoryEnum.news == channel) { // 资讯
channelUrl = model.getSouUrl() + "/xinwen/" + s;
} else if (CategoryEnum.map == channel) { // 地图找房
} else if (CategoryEnum.map == channel) { // 地图找房
channelUrl = model.getCityUrl() + "/map/list?category=ershoufang&keyword="
+ URLEncoder.encode(model.getKeyword(), "UTF-8");
} else if (CategoryEnum.new_district == channel) {// 新盘
} else if (CategoryEnum.new_district == channel) {// 新盘
channelUrl = model.getCityUrl() + "/xinfang/" + s;
} else {
channelUrl = model.getCityUrl() + "/ershoufang/" + s;
@@ -210,7 +210,7 @@ public class FangjiaController {
}
/**
* 热门区域及小区显示
* 热门区域及小区显示
*
* @param model
* @return
@@ -267,7 +267,7 @@ public class FangjiaController {
}
/**
* 首页相似房源
* 首页相似房源
*
* @return
*/
@@ -275,7 +275,7 @@ public class FangjiaController {
FangjiaModel model = new FangjiaModel();
String uid = CoresiteCookieContext.getInstance().getCookieValue(ActionContext.getContext().getRequest(), CookieName.UID);
SnapData snapData = snapDataService.findHistoryRecord(uid, SnapData.SNAP_CAT_HOUSE);
// 获取首页类似房源
// 获取首页类似房源
getSimilarHouseList(snapData, model);
return model;
}
@@ -289,7 +289,7 @@ public class FangjiaController {
}
/**
* 获取全国的城市信息
* 获取全国的城市信息
*
* @return
*/
@@ -323,13 +323,13 @@ public class FangjiaController {
private void getSimilarHouseList(SnapData snapData, FangjiaModel model) {
if (null == snapData || CollectionUtils.isEmpty(snapData.getData())) {
// 默认推荐5套二手房
// 默认推荐5套二手房
getDefaultHouseList(model);
return;
}
Map<String, Object> mapData = snapData.getData().get(snapData.getData().size() - 1);
// 当前城市与最后浏览的房源城市不一致
// 当前城市与最后浏览的房源城市不一致
if (!FangjiaServerAreaContextHolder.getServerAreaDefault().getDisplay().equals(mapData.get(SnapData.DATE_KEY_CITY))) {
// getDefaultHouseList(model);
return;
@@ -354,7 +354,7 @@ public class FangjiaController {
}
}
private void getSellHouseList(SnapData snapData, FangjiaModel model) {// 二手房
private void getSellHouseList(SnapData snapData, FangjiaModel model) {// 二手房
HouseQueryBean query = new HouseQueryBean();
Map<String, Object> queryMap = snapData.getData().get(snapData.getData().size() - 1);
@@ -376,7 +376,7 @@ public class FangjiaController {
query.setLat(Long.parseLong(queryMap.get(key).toString()));
} else if (SnapData.DATE_KEY_LNG.equals(key) && null != queryMap.get(key)) {
query.setLng(Long.parseLong(queryMap.get(key).toString()));
} else if (SnapData.DATE_KEY_AREARANGE.equals(key) && null != queryMap.get(key)) {// 面积范围
} else if (SnapData.DATE_KEY_AREARANGE.equals(key) && null != queryMap.get(key)) {// 面积范围
query.setHouseAgeRange(queryMap.get(key).toString());
} else if (SnapData.DATE_KEY_CITY.equals(key) && null != queryMap.get(key)) {
query.setCity(queryMap.get(SnapData.DATE_KEY_CITY).toString());
@@ -385,7 +385,7 @@ public class FangjiaController {
query.setPicEnum(HousePicEnum.EXISTS);
// query.setExcludeId(snapData.getObjId());
List<HouseBo> ret = houseService.findSimilarHouseList(query, 6);// 设置要获取的相似房源的数量
List<HouseBo> ret = houseService.findSimilarHouseList(query, 6);// 设置要获取的相似房源的数量
if (CollectionUtils.isNotEmpty(ret)) {
HouseBo remove = null;
for (HouseBo bo : ret) {
@@ -403,7 +403,7 @@ public class FangjiaController {
}
}
private void getRentHouseList(SnapData snapData, FangjiaModel model) {// 出租房
private void getRentHouseList(SnapData snapData, FangjiaModel model) {// 出租房
RentHouseQueryBean query = new RentHouseQueryBean();
Map<String, Object> queryMap = snapData.getData().get(snapData.getData().size() - 1);
@@ -420,7 +420,7 @@ public class FangjiaController {
query.setLat(Long.parseLong(queryMap.get(key).toString()));
} else if (SnapData.DATE_KEY_LNG.equals(key) && null != queryMap.get(key)) {
query.setLng(Long.parseLong(queryMap.get(key).toString()));
} else if (SnapData.DATE_KEY_ROOM.equals(key) && null != queryMap.get(key)) {// 出租房按“室”数查询
} else if (SnapData.DATE_KEY_ROOM.equals(key) && null != queryMap.get(key)) {// 出租房按“室”数查询
query.setRoom(Integer.parseInt(queryMap.get(key).toString()));
} else if (SnapData.DATE_KEY_AREARANGE.equals(key) && null != queryMap.get(key)) {
query.setHouseAreaRange(queryMap.get(key).toString());
@@ -450,7 +450,7 @@ public class FangjiaController {
}
/**
* 全国flash,地图Action(获取均价分段)
* 全国flash,地图Action(获取均价分段)
*
* @param model
* @return
@@ -476,7 +476,7 @@ public class FangjiaController {
}
/**
* 城市首页tab切换页
* 城市首页tab切换页
*
* @param model
* @return
@@ -510,7 +510,7 @@ public class FangjiaController {
if (city.isSupportMetro()) {
List<Metro> allMetro = metroService.getAllMetroByCity(city.getDisplay());
// 最终按地铁线路有序排列的列表
// 最终按地铁线路有序排列的列表
List<List<Metro>> ret = new ArrayList<List<Metro>>();
if (CollectionUtils.isNotEmpty(allMetro)) {
String curLine = "";
@@ -598,7 +598,7 @@ public class FangjiaController {
}
/**
* 获取城市内的区域信息,在城市首页flash不出现时显示
* 获取城市内的区域信息,在城市首页flash不出现时显示
*
* @param model
*/
@@ -674,7 +674,7 @@ public class FangjiaController {
}
/**
* 获取城市均价
* 获取城市均价
*
* @param model
*/
@@ -687,7 +687,7 @@ public class FangjiaController {
}
/**
* 全国flash,获取全国每个城市的情况
* 全国flash,获取全国每个城市的情况
*
* @param model
* @return
@@ -708,7 +708,7 @@ public class FangjiaController {
}
/**
* 获取城市中每个区域的情况
* 获取城市中每个区域的情况
*
* @param model
* @return
@@ -740,7 +740,7 @@ public class FangjiaController {
}
/**
* 全国flash,获取全国地图数据
* 全国flash,获取全国地图数据
*
* @param root
* @param staticUrl
@@ -750,33 +750,33 @@ public class FangjiaController {
private String getNationMapData(String root, String staticUrl, Map<Integer, ServerArea> citys) {
StringBuffer xml = new StringBuffer("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n");
xml.append("<data>\n<area id=\"");
xml.append(86); // 地图编号-地区号
xml.append(86); // 地图编号-地区号
xml.append("\" cnname=\"");
xml.append("中国");
xml.append("中国");
xml.append("\" enname=\"");
xml.append("cn");
xml.append("\" grade=\"");
xml.append(1); // 地图级别
xml.append(1); // 地图级别
xml.append("\">\n");
NumberRange citysNr = getCityStatListMaxMin(citys);
xml.append(getNationalSituation(root, staticUrl, citys, citysNr));
xml.append("<childmap id=\"99\" active=\"1\" cnname=\"钓鱼岛\" enname=\"diaoyudao\" link=\"http://support."
xml.append("<childmap id=\"99\" active=\"1\" cnname=\"钓鱼岛\" enname=\"diaoyudao\" link=\"http://support."
+ FangjiaConfig.getConfig().getDomainName() + root
+ "/diaoyudao/?__from=national_home\" normalColor=\"0X000000\" overColor=\"0Xff6600\">\n");
xml.append("<ico>" + staticUrl + "/images/bgtu/diaoyudao/dyd.jpg</ico>\n");
xml.append("<avgPrice>无价</avgPrice>\n");
xml.append("<avgPrice>无价</avgPrice>\n");
xml.append("<onSell>0</onSell>\n");
xml.append("<situation>0</situation>\n");
xml.append("<value>0</value>\n");
xml.append("<onRent>0</onRent>\n");
xml.append("</childmap>\n");
xml.append("<childmap id=\"598\" active=\"1\" cnname=\"钓鱼岛\" enname=\"diaoyudao\" link=\"http://support."
xml.append("<childmap id=\"598\" active=\"1\" cnname=\"钓鱼岛\" enname=\"diaoyudao\" link=\"http://support."
+ FangjiaConfig.getConfig().getDomainName() + root
+ "/diaoyudao/?__from=national_home\" normalColor=\"0Xff6600\" overColor=\"0XFF0000\">\n");
xml.append("<ico>" + staticUrl + "/images/bgtu/diaoyudao/dyd.jpg</ico>\n");
xml.append("<avgPrice>无价</avgPrice>\n");
xml.append("<avgPrice>无价</avgPrice>\n");
xml.append("<onSell>0</onSell>\n");
xml.append("<situation>0</situation>\n");
xml.append("<value>0</value>\n");
@@ -789,7 +789,7 @@ public class FangjiaController {
}
/**
* 城市flash,获取城市地图数据
* 城市flash,获取城市地图数据
*
* @param cityUrl
* @param staticUrl
@@ -800,13 +800,13 @@ public class FangjiaController {
private String getCityMapData(String cityUrl, String staticUrl, ServerArea city) throws UnsupportedEncodingException {
StringBuffer xml = new StringBuffer("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n");
xml.append("<data>\n<area id=\"");
xml.append(city.getTelPrefix()); // 地图编号-地区号
xml.append(city.getTelPrefix()); // 地图编号-地区号
xml.append("\" cnname=\"");
xml.append(city.getDisplay());
xml.append("\" enname=\"");
xml.append(city.getSpell());
xml.append("\" grade=\"");
xml.append(1); // 地图级别
xml.append(1); // 地图级别
xml.append("\">\n");
List<Item> regions = this.menuService.getRegionsByCity(city, MenuCategoryEnum.ershoufang);
if (CollectionUtils.isNotEmpty(regions)) {
@@ -818,7 +818,7 @@ public class FangjiaController {
}
/**
* 全国flash,获取所有城市的情况
* 全国flash,获取所有城市的情况
*
* @param cityId
* @param city
@@ -840,7 +840,7 @@ public class FangjiaController {
if (null != cityStat) {
avgPrice = DataUtil.formatAvgPrice(cityStat.getAvgPrice());
weekendMarkupStatus = cityStat.getWeekendMarkup() > 0 ? 1 : cityStat.getWeekendMarkup() == 0 ? 0 : -1;
weekendMarkup = (weekendMarkupStatus == 0) ? "—" : Math.abs((float) cityStat.getWeekendMarkup() / 100) + "%";
weekendMarkup = (weekendMarkupStatus == 0) ? "—" : Math.abs((float) cityStat.getWeekendMarkup() / 100) + "%";
}
HouseQueryBean houseQueryBean = new HouseQueryBean();
@@ -850,16 +850,16 @@ public class FangjiaController {
RentHouseQueryBean rentHouseQueryBean = new RentHouseQueryBean();
rentHouseQueryBean.setCity(cityName);
long rentCount = this.rentHouseService.findRentHouseCountByQueryBean(rentHouseQueryBean);
// 是否可用
// 是否可用
int active = (0 == avgPrice && 0 == sellCount && 0 == rentCount) ? 0 : 1;
FlashMapUtil.NationalColorEnum color = FlashMapUtil.getNationalColors(citys.size(), avgPrice, citysNr);
/*
* 默认字体不变色
* 默认字体不变色
*/
xml.append("<childmap id=\"");
xml.append(cityId); // 小图块id
xml.append(cityId); // 小图块id
xml.append("\" active=\"" + active + "\" cnname=\"");
xml.append(cityName);
xml.append("\" enname=\"");
@@ -867,12 +867,12 @@ public class FangjiaController {
xml.append("\" link=\"");
xml.append(FangjiaConfig.getConfig().getCityDomainName(city) + root).append("?__from=national_home");
xml.append("\" normalColor=\"");
xml.append("0X000000");// 正常颜色
// xml.append(color.getNormalColor()); // 变色
xml.append("0X000000");// 正常颜色
// xml.append(color.getNormalColor()); // 变色
xml.append("\" overColor=\"");
xml.append("0Xff6600");// 鼠标悬浮 ;
// xml.append(color.getOverColor());// 鼠标悬浮; //变色
xml.append("0Xff6600");// 鼠标悬浮 ;
// xml.append(color.getOverColor());// 鼠标悬浮; //变色
xml.append("\">\n<ico>");
xml.append(staticUrl
@@ -880,24 +880,24 @@ public class FangjiaController {
+ TemplateUtils.encodePicUrl(city.getId() + ((null != city.getIcoVersion()) ? city.getIcoVersion() : "")
+ "ico", "m", "city_ico"));
xml.append("</ico>\n<avgPrice>");
String apStatus = (avgPrice == 0) ? "暂无均价" : avgPrice + "元/㎡";// +
// "元/㎡"
String apStatus = (avgPrice == 0) ? "暂无均价" : avgPrice + "元/㎡";// +
// "元/㎡"
xml.append(apStatus);
xml.append("</avgPrice>\n<onSell>");
xml.append(sellCount + "套");
xml.append(sellCount + "套");
xml.append("</onSell>\n<situation>");
xml.append(weekendMarkupStatus);
xml.append("</situation>\n<value>");
xml.append(weekendMarkup);
xml.append("</value>\n<onRent>");
xml.append(rentCount + "套");
xml.append(rentCount + "套");
xml.append("</onRent>\n</childmap>\n");
/*
* 给图标(小圆点)变色的
* 给图标(小圆点)变色的
*/
xml.append("<childmap id=\"");
xml.append(cityId + 499); // 小图块id
xml.append(cityId + 499); // 小图块id
xml.append("\" active=\"" + active + "\" cnname=\"");
xml.append(cityName);
xml.append("\" enname=\"");
@@ -905,28 +905,28 @@ public class FangjiaController {
xml.append("\" link=\"");
xml.append(FangjiaConfig.getConfig().getCityDomainName(city) + root).append("?__from=national_home");
xml.append("\" normalColor=\"");
xml.append(color.getNormalColor()); // 正常颜色//变色:
xml.append(color.getNormalColor()); // 正常颜色//变色:
// xml.append("0X000000");
xml.append("\" overColor=\"");
// xml.append(color.getOverColor());
xml.append("0XFF0000");// 鼠标悬浮 ;
xml.append("0XFF0000");// 鼠标悬浮 ;
xml.append("\">\n<ico>");
xml.append(staticUrl
+ "/fs/"
+ TemplateUtils.encodePicUrl(city.getId() + ((null != city.getIcoVersion()) ? city.getIcoVersion() : "")
+ "ico", "m", "city_ico"));
xml.append("</ico>\n<avgPrice>");
// String apStatus = (avgPrice == 0) ? "暂无均价" : avgPrice +
// "元/㎡";
// String apStatus = (avgPrice == 0) ? "暂无均价" : avgPrice +
// "元/㎡";
xml.append(apStatus);
xml.append("</avgPrice>\n<onSell>");
xml.append(sellCount + "套");
xml.append(sellCount + "套");
xml.append("</onSell>\n<situation>");
xml.append(weekendMarkupStatus);
xml.append("</situation>\n<value>");
xml.append(weekendMarkup);
xml.append("</value>\n<onRent>");
xml.append(rentCount + "套");
xml.append(rentCount + "套");
xml.append("</onRent>\n</childmap>\n");
}
}
@@ -934,7 +934,7 @@ public class FangjiaController {
}
/**
* 获取全国城市均价范围
* 获取全国城市均价范围
*
* @param citys
* @return
@@ -955,10 +955,10 @@ public class FangjiaController {
}
/**
* 获取某城市可获得区域内的二手房量、出租房量、二手房均价及涨幅等
* 获取某城市可获得区域内的二手房量、出租房量、二手房均价及涨幅等
*
* @param region
* 区域
* 区域
* @return
* @throws UnsupportedEncodingException
*/
@@ -970,7 +970,7 @@ public class FangjiaController {
}
}
List<RegionStat> regionStatList = this.regionStatService.findRegionStatByCity(city.getDisplay(), rs);
Map<String, RegionStat> regionMap = new HashMap<String, RegionStat>();// 均价map
Map<String, RegionStat> regionMap = new HashMap<String, RegionStat>();// 均价map
for (RegionStat regSt : regionStatList) {
regionMap.put(regSt.getRegion(), regSt);
}
@@ -987,7 +987,7 @@ public class FangjiaController {
FacetQueryResult<HouseBo> houseBoList = houseService.findFacetByQueryBean(queryBean);
List<FacetResult> facetResult = houseBoList.getFacetResults();
Map<String, Count> houseMap = new HashMap<String, Count>();// 二手房数量map
Map<String, Count> houseMap = new HashMap<String, Count>();// 二手房数量map
if (null != facetResult && facetResult.size() > 0 && null != facetResult.get(0)) {
List<Count> countList = facetResult.get(0).getValues();
if (CollectionUtils.isNotEmpty(countList)) {
@@ -1004,7 +1004,7 @@ public class FangjiaController {
rentQueryBean.setFacetQuery(facetQuery);
FacetQueryResult<RentHouseBo> rentHouseBoList = rentHouseService.findFacetByQueryBean(rentQueryBean);
List<FacetResult> rentFacetResult = rentHouseBoList.getFacetResults();
Map<String, Count> rentHouseMap = new HashMap<String, Count>();// 租房数量map
Map<String, Count> rentHouseMap = new HashMap<String, Count>();// 租房数量map
if (null != rentFacetResult && rentFacetResult.size() > 0 && null != rentFacetResult.get(0)) {
List<Count> countListRent = rentFacetResult.get(0).getValues();
if (CollectionUtils.isNotEmpty(countListRent)) {
@@ -1034,18 +1034,18 @@ public class FangjiaController {
avgPrice = DataUtil.formatAvgPrice(regionStat.getAvgPrice());
weekendMarkupStatus = !showAvgPrice ? 0 : regionStat.getWeekendMarkup() > 0 ? 1
: regionStat.getWeekendMarkup() == 0 ? 0 : -1;
weekendMarkup = (weekendMarkupStatus == 0 || !showAvgPrice) ? "—" : Math.abs((float) regionStat
weekendMarkup = (weekendMarkupStatus == 0 || !showAvgPrice) ? "—" : Math.abs((float) regionStat
.getWeekendMarkup() / 100) + "%";
}
long sellCount = houseMap.get(reg.getName()) == null ? 0 : houseMap.get(reg.getName()).getCount();
long rentCount = rentHouseMap.get(reg.getName()) == null ? 0 : rentHouseMap.get(reg.getName()).getCount();
// 是否可用
// 是否可用
int active = 1;
FlashMapUtil.ColorEnum color = FlashMapUtil.getColors(rs.size(), avgPrice, nr);
xml.append("<childmap id=\"");
xml.append(regionId); // 小图块id
xml.append(regionId); // 小图块id
xml.append("\" active=\"" + active + "\" cnname=\"");
xml.append(fullName);
xml.append("\" enname=\"");
@@ -1057,7 +1057,7 @@ public class FangjiaController {
} catch (UnsupportedEncodingException e) {
}
xml.append("\" normalColor=\"");
xml.append(color.getNormalColor()); // 正常颜色
xml.append(color.getNormalColor()); // 正常颜色
xml.append("\" overColor=\"");
xml.append(color.getOverColor());
xml.append("\">\n<ico>");
@@ -1066,16 +1066,16 @@ public class FangjiaController {
+ TemplateUtils.encodePicUrl(city.getId() + ((null != city.getIcoVersion()) ? city.getIcoVersion() : "")
+ "ico", "m", "city_ico"));
xml.append("</ico>\n<avgPrice>");
String apStatus = (avgPrice == 0 || !showAvgPrice) ? "暂无均价" : avgPrice + "元/㎡";
String apStatus = (avgPrice == 0 || !showAvgPrice) ? "暂无均价" : avgPrice + "元/㎡";
xml.append(apStatus);
xml.append("</avgPrice>\n<onSell>");
xml.append(sellCount != 0 ? (sellCount + "套") : "—");
xml.append(sellCount != 0 ? (sellCount + "套") : "—");
xml.append("</onSell>\n<situation>");
xml.append(weekendMarkupStatus);
xml.append("</situation>\n<value>");
xml.append(weekendMarkup);
xml.append("</value>\n<onRent>");
xml.append(rentCount != 0 ? (rentCount + "套") : "—");
xml.append(rentCount != 0 ? (rentCount + "套") : "—");
xml.append("</onRent>\n</childmap>\n");
}
@@ -1083,10 +1083,10 @@ public class FangjiaController {
}
/**
* 获取当前城市
* 获取当前城市
*
* @param request
* @return 当前城市
* @return 当前城市
*/
private ServerArea getSuggestCity(HttpServletRequest request) {
String ip = AnalyticsUtil.getIpAddress(request);
@@ -28,7 +28,7 @@ public class FirstTitleController {
}
/**
* 贷款申请
* 贷款申请
*/
public Object registerAction(FirstTitleModel model, HttpServletRequest request) {
String ip = AnalyticsUtil.getIpAddress(request);
@@ -61,7 +61,7 @@ public class FirstTitleController {
}
/**
* 联系客服
* 联系客服
*/
public Object redirectAction(final FirstTitleModel model, HttpServletRequest request) {
String ip = AnalyticsUtil.getIpAddress(request);
@@ -72,7 +72,7 @@ public class FirstTitleController {
String useIdFinal = cookieContext.getCookieValue(request, CookieName.UID);
FTCustomerRed record = new FTCustomerRed();
record.setKind("中易安");
record.setKind("中易安");
record.setIp(ip);
record.setRedirectUrl(model.getUrl());
record.setCity(abbreCity);
@@ -22,14 +22,14 @@ public class FjtLoginController {
public Object loginAction(FjtLoginModel model, HttpServletResponse response) {
JSONObject ret = fjtLoginService.login(model.getUserName(), model.getPassword(), model.getAutoLogin());
if (null == ret || ret.isNullObject()) {
model.setMsg("服务器异常,请稍后登录");
model.setMsg("服务器异常,请稍后登录");
} else if (ret.getInt("code") == 0) {
saveFjtCookie(ret.getInt("userId"), ret.getString("email"), ret.getString("token"));
if (model.getAutoLogin() == 1) {
addCookie(CoresiteCookieContext.getInstance(), response, "autoLogin", "1");
}
if(ret.getInt("role") != 1){
model.setMsg("该账号为企业账号,请在房价通中登录!");
model.setMsg("该账号为企业账号,请在房价通中登录!");
}else{
model.setMsg("OK");
}
@@ -72,7 +72,7 @@ public class FjtLoginController {
String limitTime = cookieContext.getCookieValue(request, "limit_time");
JSONObject ret = fjtLoginService.regist(model.getUserName(), model.getPassword(), rgTimes, limitTime);
if (null == ret || ret.isNullObject()) {
model.setMsg("服务器异常,请稍后注册");
model.setMsg("服务器异常,请稍后注册");
} else if (ret.getInt("code") == 0) {
saveFjtCookie(ret.getInt("userId"), ret.getString("email"), ret.getString("token"));
@@ -104,7 +104,7 @@ public class FjtLoginController {
public Object checkEmailAction(FjtLoginModel model) {
JSONObject ret = fjtLoginService.checkEmail(model.getEmail());
if (null == ret || ret.isNullObject()) {
model.setMsg("服务器异常,请稍后注册");
model.setMsg("服务器异常,请稍后注册");
} else {
model.setMsg(ret.getString("message"));
}
@@ -58,11 +58,11 @@ import com.fangjia.service.menu.MenuCategoryEnum;
import com.fangjia.service.web.MenuService;
/**
* 走势图
* 走势图
*
*/
public class FlashChartController {
// 区域均价Service
// 区域均价Service
private RegionStatService regionStatService;
private DistrictStatService districtStatService;
private ChartGenerator ofcLineGenerator;
@@ -74,7 +74,7 @@ public class FlashChartController {
private KnowbaseService knowbaseService;
/**
* 走势图模块
* 走势图模块
*
* @param model
* @return
@@ -154,7 +154,7 @@ public class FlashChartController {
}
/**
* 城市二手房走势
* 城市二手房走势
*
* @param model
* @return
@@ -178,7 +178,7 @@ public class FlashChartController {
}
/**
* 小区和所在区域及所在板块的二手房走势
* 小区和所在区域及所在板块的二手房走势
*
* @param model
* @return
@@ -237,13 +237,13 @@ public class FlashChartController {
new DistrictKey(district.getCity(), district.getRegion(), district.getName()),
DistrictKindEnum.gongyu.getValue(), new Date(), model.getWeekCount());
}
// 区域均价
// 区域均价
List<RegionStat> regionStatList = null;
if (model.isShowRegionTrend() && StringUtils.isNotBlank(model.getRegion())) {
regionStatList = regionStatService.findRegionStat(model.getCityName(), model.getRegion(), null, new Date(),
model.getWeekCount());
}
// 板块均价
// 板块均价
List<RegionStat> blockStatList = null;
if (model.isShowBlockTrend() && StringUtils.isNotBlank(model.getBlock())) {
ServerArea areaEnum = ServerAreaData.getServerAreaByDisplay(model.getCityName());
@@ -270,14 +270,14 @@ public class FlashChartController {
result = ofcLineGenerator.generat(config, districtData);
}
} else {
// 小区不存在返回板块均价
// 小区不存在返回板块均价
return regionTrendAction(model);
}
return result;
}
/**
* 区域,板块走势图
* 区域,板块走势图
*
* @param model
* @return
@@ -293,7 +293,7 @@ public class FlashChartController {
config.setHeight(height);
config.setWidth(model.getWidth());
config.setXStep(OfcChartUtils.getStep(model.getWeekCount(), config.getWidth(), model.getDatePattern()));
// 区域均价
// 区域均价
List<RegionStat> regionStatList = regionStatService.findRegionStat(model.getCityName(), model.getRegion(), null,
new Date(), model.getWeekCount());
LineChartDataProvider regiondDataProvider = null;
@@ -316,7 +316,7 @@ public class FlashChartController {
}
/**
* 板块走势图
* 板块走势图
*
* @param model
* @return
@@ -332,7 +332,7 @@ public class FlashChartController {
config.setHeight(height);
config.setWidth(model.getWidth());
config.setXStep(OfcChartUtils.getStep(model.getWeekCount(), config.getWidth(), model.getDatePattern()));
// 板块均价
// 板块均价
List<RegionStat> regionStatList = regionStatService.findRegionStat(model.getCityName(), model.getRegion(),
DataUtil.formatBlock(model.getBlock()), new Date(), model.getWeekCount());
LineChartDataProvider blockDataProvider = null;
@@ -350,7 +350,7 @@ public class FlashChartController {
}
/**
* 小区信息饼图Action
* 小区信息饼图Action
*
* @param model
* @return
@@ -13,7 +13,7 @@ public class GetImageController {
public Object getWXImageAction(ImageManagerModel model) {
model.setViewType("json");
ImageManager imageManager = imageManagerService.queryByName("微信群二维码");
ImageManager imageManager = imageManagerService.queryByName("微信群二维码");
model.setImageManager(imageManager);
return model;
}
@@ -82,7 +82,7 @@ public class GjsController {
evaluateApplicationService.save(entity);
StringBuilder sb = new StringBuilder();
// sb.append("有房价网").append(name).append("(手机").append(mobile).append(")申请估价师服务,请您立刻回电!");
// sb.append("有房价网").append(name).append("(手机").append(mobile).append(")申请估价师服务,请您立刻回电!");
// try {
// smsService.sendForRongshidai("15026780660", sb.toString());
// } catch (SmsException e) {
@@ -90,7 +90,7 @@ public class GjsController {
// }
sb = new StringBuilder();
sb.append("【估价师频道】").append(name).append("(手机").append(mobile).append(")申请了:").append(master.getName()).append("的服务!");
sb.append("【估价师频道】").append(name).append("(手机").append(mobile).append(")申请了:").append(master.getName()).append("的服务!");
try {
smsService.sendForRongshidai("15026780660", sb.toString());
smsService.sendForRongshidai("13681915777", sb.toString());
@@ -24,7 +24,7 @@ import com.fangjia.service.district.DistrictStatService;
public class GoogleChartController {
/**
* 图表generator
* 图表generator
*/
private ChartGenerator gicGenerator;
@@ -33,7 +33,7 @@ public class GoogleChartController {
private DistrictStatService districtStatService;
/**
* 估价走势图
* 估价走势图
*
* @return
*/
@@ -34,7 +34,7 @@ public class HelpController {
private FeedbackService feedbackService;
/**
* 友链页面的文字连接和图片连接
* 友链页面的文字连接和图片连接
*
* @param model
* @return
@@ -102,7 +102,7 @@ public class HelpController {
return;
}
// 最新上线的城市
// 最新上线的城市
List<CityGroup> newCitys = new ArrayList<CityGroup>();
List<ServerArea> serverAreaList = ServerAreaData.getServerAreaList(15);
List<String> cityNames = CollectionUtils.collect(serverAreaList, new Closure<String, ServerArea>() {
@@ -129,10 +129,10 @@ public class HelpController {
}
/**
* 获取当前城市
* 获取当前城市
*
* @param request
* @return 当前城市
* @return 当前城市
*/
private ServerArea getSuggestCity(HttpServletRequest request) {
String ip = AnalyticsUtil.getIpAddress(request);
@@ -76,7 +76,7 @@ public class HouseController {
private ReportHouseService reportHouseService;
/**
* 房源展现
* 房源展现
*
* @param model
* @return
@@ -92,10 +92,10 @@ public class HouseController {
return model.notFound("/error");
}
// 房源不存在时(物理删除)重定向到列表页,如果从搜索引擎过来,带关键字,否直接重定向
// 房源不存在时(物理删除)重定向到列表页,如果从搜索引擎过来,带关键字,否直接重定向
if (house == null || StringUtils.isBlank(house.getCity()) || StringUtils.isBlank(house.getMobile())
|| StringUtils.isBlank(house.getName())) {
StringBuilder re_url = new StringBuilder();// 重定向的url
StringBuilder re_url = new StringBuilder();// 重定向的url
re_url.append("/sellHouseSearch/list?notfound=1");
String keyword = model.getSearchEngineKeyword();
if (StringUtils.isNotEmpty(keyword)) {
@@ -189,7 +189,7 @@ public class HouseController {
model.setCpcBo(cpcBo);
overdays = 21;
}
// 房子的状态不为0或者发布时间超过90天(cpc21天),房源过期,页面显示类似房源链接
// 房子的状态不为0或者发布时间超过90天(cpc21天),房源过期,页面显示类似房源链接
if (house.getPublishDate() != null
&& (0 != house.getStatus() || house.getPublishDate().before(DateUtil.getBeforeDay(new Date(), overdays)))) {
model.setOverdate(house.getPublishDate().before(DateUtil.getBeforeDay(new Date(), overdays)));
@@ -201,10 +201,10 @@ public class HouseController {
MenuCategoryEnum.ershoufang, "totalPriceRange", house.getTotalPrice()));
houseBo.setRoom(house.getRoom());
// 房源状态不正常,或考期,重定向到列表页,带入参数和上面一致
// 房源状态不正常,或考期,重定向到列表页,带入参数和上面一致
if (0 != house.getStatus() || (model.isOverdate() && model.getOverDays() > overdays + 90)) {
String keyword = model.getSearchEngineKeyword();
StringBuilder re_url = new StringBuilder("/sellHouseSearch/list?");// 重定向的url
StringBuilder re_url = new StringBuilder("/sellHouseSearch/list?");// 重定向的url
if (StringUtils.isEmpty(keyword)) {
re_url.append("totalPriceRange=");
re_url.append(menuService.getRange(ServerAreaData.getServerAreaByDisplay(house.getCity()),
@@ -229,12 +229,12 @@ public class HouseController {
// model.getId());
// model.setUserFeeling(userFeeling);
// 底部区域推荐
// 底部区域推荐
ServerArea serverArea = FangjiaServerAreaContextHolder.getServerAreaDefault();
List<Item> autoRegionRecommends = menuService.getRegionsByCity(serverArea, MenuCategoryEnum.ershoufang);
model.setAutoRegionRecommends(limit(autoRegionRecommends));
// 底部热门推荐的其他城市
// 底部热门推荐的其他城市
List<CityGroup> footerCitys = new ArrayList<CityGroup>(10);
List<String> cityNames = ServerAreaData.getServerAreaDisplayList(10);
for (String name : cityNames) {
@@ -246,7 +246,7 @@ public class HouseController {
}
/**
* 异步获取400号码
* 异步获取400号码
*
* @param model
* @return
@@ -266,7 +266,7 @@ public class HouseController {
.getDistrictName()), false);
boolean needMap400 = false;
// 链家 为站外跳转 用自己的400号码
// 链家 为站外跳转 用自己的400号码
if (StringUtils.isNotBlank(house.getMobile()) && !house.getMobile().trim().startsWith("400")) {
house.setMobile(PhoneNormalizer.normalizeContactPhone(ServerAreaData.getServerAreaByDisplay(house.getCity()), false,
house.getMobile()));
@@ -301,32 +301,32 @@ public class HouseController {
}
/**
* 按时间做Seed获取的随机筛选的区域信息
* 按时间做Seed获取的随机筛选的区域信息
*
* @param 区域菜单信息
* @return 随机筛选的区域信息
* @param 区域菜单信息
* @return 随机筛选的区域信息
*/
private List<Item> limit(List<Item> items) {
int needCount = 9;// 获取的数据个数10个
int needCount = 9;// 获取的数据个数10个
int changeDay = 20;// 设置更新频率为20天
int changeDay = 20;// 设置更新频率为20天
int currentCount = items.size();// 当前获取的Region总数
int currentCount = items.size();// 当前获取的Region总数
if (currentCount <= needCount)
return items;
Calendar oldTime = Calendar.getInstance();
oldTime.set(2011, 8, 1);// 初始化时间为2011年09月01日
oldTime.set(2011, 8, 1);// 初始化时间为2011年09月01日
Calendar newTime = Calendar.getInstance();
int reduceDay = SimRandom.getReduceDay(newTime, oldTime);// 获取日期与初始日期相差天数
int reduceDay = SimRandom.getReduceDay(newTime, oldTime);// 获取日期与初始日期相差天数
int seed = (int) reduceDay / changeDay;// 计算simRandom变化频率,20表示20天更新一次
int seed = (int) reduceDay / changeDay;// 计算simRandom变化频率,20表示20天更新一次
List<Integer> simIndexs = SimRandom.getSimRandom(seed, currentCount, needCount);// 获取随机Index
List<Integer> simIndexs = SimRandom.getSimRandom(seed, currentCount, needCount);// 获取随机Index
List<Item> limitedRegions = new ArrayList<Item>(needCount);
for (int index : simIndexs) {
@@ -337,11 +337,11 @@ public class HouseController {
/**
* <p>
* 获取同小区内相似房源
* 获取同小区内相似房源
* </p>
*
* <p>
* 同小区+面积范围+价格范围,显示5套房源,不足5套就用“同小区+价格范围”补上
* 同小区+面积范围+价格范围,显示5套房源,不足5套就用“同小区+价格范围”补上
* </p>
*
* @param model
@@ -393,18 +393,18 @@ public class HouseController {
}
/**
* 根据关键字推荐房源 取 4 条
* 根据关键字推荐房源 取 4 条
*
* @param model
* @return
*/
public Object newsSuggestHouseAction(final HouseModel model, HttpServletRequest request) {
if (StringUtils.isNotBlank(model.getDistrictName()) && StringUtils.isNotBlank(model.getDiaryCity())) {
// 有小区名的看房日记
// 有小区名的看房日记
District d = districtService.findDistrict(new DistrictKey(model.getDiaryCity(), model.getRegion(), model
.getDistrictName()), true);
if (null != d) {
// 匹配不到小区时,按原流程
// 匹配不到小区时,按原流程
HouseQueryBean queryBean = new HouseQueryBean();
queryBean.setCity(d.getCity());
queryBean.setDistrictName(d.getName());
@@ -435,7 +435,7 @@ public class HouseController {
Pager pager = new Pager();
pager.setPageSize(4);
// 站内搜推荐关键词相关全国房源
// 站内搜推荐关键词相关全国房源
if (StringUtils.isNotBlank(model.getRecommendCityType()) && model.getRecommendCityType().equals("ALL")) {
List<HouseBo> houseBoList = houseService.findByQueryBean(pager, queryBean);
for (HouseBo houseBo : houseBoList) {
@@ -447,7 +447,7 @@ public class HouseController {
return model;
}
// 推荐关键词当前城市相关房源
// 推荐关键词当前城市相关房源
ServerArea suggestCity = getSuggestCity(request);
if (null != suggestCity) {
model.setIpCity(suggestCity);
@@ -459,7 +459,7 @@ public class HouseController {
}
/**
* 获取房源的推荐城市
* 获取房源的推荐城市
*
* @param request
* @return
@@ -469,7 +469,7 @@ public class HouseController {
ServerArea suggestCity = ipAddressService.locationByIp(ip, null);
if (null == suggestCity) {
// 无结果,从cookie取
// 无结果,从cookie取
CoresiteCookieContext cookieContext = CoresiteCookieContext.getInstance();
suggestCity = ServerAreaData.getServerAreaByNameOrSpellDefaultNull(cookieContext.getCookieValue(request,
CookieName.COOKIE_CITY));
@@ -489,7 +489,7 @@ public class HouseController {
}
/**
* 小区推荐房源 取 5 条
* 小区推荐房源 取 5 条
*
* @param model
* @return
@@ -521,11 +521,11 @@ public class HouseController {
/**
* <p>
* 区域相似房源
* 区域相似房源
* <p>
*
* <p>
* 规则:同区域+面积范围+价格范围,显示5套,更多:同区域+价格范围
* 规则:同区域+面积范围+价格范围,显示5套,更多:同区域+价格范围
* </p>
*
* @return
@@ -561,12 +561,12 @@ public class HouseController {
/**
*
* 相似房源
* 相似房源
*
* 规则: 同小区,面积相差15%以内,若房源不足用周边三公里以内,
* 面积价格相差15%以内的房源补上。“更多”带入区域,价格,面积参数到二手房列表页。
* 规则: 同小区,面积相差15%以内,若房源不足用周边三公里以内,
* 面积价格相差15%以内的房源补上。“更多”带入区域,价格,面积参数到二手房列表页。
* </p>
* 估价结果页面过来的相似房源
* 估价结果页面过来的相似房源
*
* @return
* @throws Exception
@@ -615,7 +615,7 @@ public class HouseController {
}
houseBoList = houseService.findByQueryBean(pager, queryBean);
// 下面参数为更多链接所用
// 下面参数为更多链接所用
if (null != evaluation.getArea() && 0 != evaluation.getArea()) {
String areaRange = ((Number) (evaluation.getArea() * 0.85)).intValue() + "_"
+ ((Number) (evaluation.getArea() * 1.15)).intValue();
@@ -653,7 +653,7 @@ public class HouseController {
MenuCategoryEnum.ershoufang, "houseAreaRange", (int) (houseBo.getHouse().getArea() * 100) / 100));
}
}
// 加入cpc
// 加入cpc
cpcService.checkCpcUserEnable(houseBoList);
schoolService.signShoolHouse(houseBoList, FangjiaServerAreaContextHolder.getServerAreaDefault());
metroService.signMetroHouse(houseBoList);
@@ -687,7 +687,7 @@ public class HouseController {
}
/**
* 去除房源中的空字符串图片链接
* 去除房源中的空字符串图片链接
*
* @param bo
* @return
@@ -728,7 +728,7 @@ public class HouseController {
/***************************************************************************
*
* 由house取得小区信息*
* 由house取得小区信息*
* *
*/
private void getDistrictSituation(House house, HouseModel model) {
@@ -57,14 +57,14 @@ public class HouseReportController {
private LoanProductTagService loanProductTagService;
private FangJiaUserService fangJiaUserService;
/**买房报告-首页*/
/**买房报告-首页*/
public Object buyAction(HouseReportModel model){
model.setReportTitle("买房报告");
model.setReportTitle("买房报告");
if(StringUtils.isNotBlank(model.getEid())){
Evaluation evaluation = evaluationService.findEvaluationById(model.getEid());
model.setEvaluation(evaluation);
List<LoanProduct> creditProductList = loanProductService.findProductByType("信用贷",LoanProductPositionEnum.BUY_REPORT.getId());
List<LoanProduct> houseProductList = loanProductService.findProductByType("房抵贷",LoanProductPositionEnum.BUY_REPORT.getId());
List<LoanProduct> creditProductList = loanProductService.findProductByType("信用贷",LoanProductPositionEnum.BUY_REPORT.getId());
List<LoanProduct> houseProductList = loanProductService.findProductByType("房抵贷",LoanProductPositionEnum.BUY_REPORT.getId());
if(creditProductList!=null && creditProductList.size()>0){
LoanProduct creditProduct = creditProductList.get(0);
List<String> tagList = new ArrayList<String>();
@@ -108,19 +108,19 @@ public class HouseReportController {
}
}
/**房评卡-指数综合得分*/
/**房评卡-指数综合得分*/
public Object indexScoreAction(HouseReportModel model){
JsonModel ret = new JsonModel();
DistrictKey districtKey = new DistrictKey(model.getCityName(), model.getRegion(), model.getDistrictName());
District district = districtService.findDistrict(districtKey,"district");
//房价指数
//房价指数
model.setPriceScore(houseReportService.getPredictIndex(districtKey));
//潜力指数
//潜力指数
model.setPredictScore(houseReportService.getPredictIndex(districtKey));
//稀缺指数
//稀缺指数
model.setRankScore(houseReportService.getRareIndex(districtKey));
//消费指数
//消费指数
double lat = 0;
double lng = 0;
if(null != district.getLat2()){
@@ -130,9 +130,9 @@ public class HouseReportController {
lng = district.getLng2()/10000000000d;
}
model.setConsumScore(houseReportService.getConsumIndex(lat, lng, model.getBaiduMapKey()));
//配套指数
//配套指数
model.setAroundScore(houseReportService.getAroundIndex(districtKey, lat, lng, model.getBaiduMapKey()));
//楼盘指数
//楼盘指数
model.setDetailScore(houseReportService.getDetailIndex(district));
double totalScore = 0d;
@@ -159,7 +159,7 @@ public class HouseReportController {
return ret;
}
/**加载小区经纬度*/
/**加载小区经纬度*/
public Object loadDistrictLocationAction(HouseReportModel model){
JsonModel ret = new JsonModel();
DistrictKey districtKey = new DistrictKey(model.getCityName(), model.getRegion(), model.getDistrictName());
@@ -188,9 +188,9 @@ public class HouseReportController {
return ret;
}
/**出租分析*/
/**出租分析*/
public Object analysisAction(HouseReportModel model){
model.setReportTitle("租房分析");
model.setReportTitle("租房分析");
if(StringUtils.isNotBlank(model.getEid())){
Evaluation evaluation = evaluationService.findEvaluationById(model.getEid());
model.setEvaluation(evaluation);
@@ -210,7 +210,7 @@ public class HouseReportController {
}
/**
* 齐家装修
* 齐家装修
* @param model
* @param req
* @return
@@ -233,7 +233,7 @@ public class HouseReportController {
// String url = "http://m.jia.com/new_zhuangxiu/fjApply?city_name="+model.getCityName()+"&area="+model.getArea().toString()+"&mobile=13200000011";
json = JSONObject.fromObject(request.get(url, "UTF-8"));
System.out.println("数据:"+json.toString());
System.out.println("数据:"+json.toString());
if(json.getInt("status") == 200){
Map<String, Object> dataMap = new HashMap<String, Object>();
@@ -244,61 +244,61 @@ public class HouseReportController {
double v1 = 0,v2 = 0,v3 = 0,v4 = 0,v5 = 0,v6 = 0;
if(jsonObj.containsKey("total_price")){
totalPrice = jsonObj.getDouble("total_price");
dataMap.put("总计", totalPrice);
dataMap.put("总计", totalPrice);
}
if(jsonObj.containsKey("labour_price")){
Double labourPrice = jsonObj.getDouble("labour_price");
dataMap.put("人工费", labourPrice);
dataMap.put("人工费", labourPrice);
}
if(jsonObj.containsKey("material_price")){
Double materialPrice = jsonObj.getDouble("material_price");
dataMap.put("材料费", materialPrice);
dataMap.put("材料费", materialPrice);
}
if(jsonObj.containsKey("parlour_price")){
Double parlourPrice = jsonObj.getDouble("parlour_price");
priceMap.put("客厅", parlourPrice);
priceMap.put("客厅", parlourPrice);
v1 = DataUtil.getRound(2, parlourPrice*100.0/totalPrice);
precentMap.put("客厅", v1);
precentMap.put("客厅", v1);
}
if(jsonObj.containsKey("bedroom_price")){
Double bedroomPrice = jsonObj.getDouble("bedroom_price");
priceMap.put("卧室", bedroomPrice);
priceMap.put("卧室", bedroomPrice);
v2 = DataUtil.getRound(2, bedroomPrice*100.0/totalPrice);
precentMap.put("卧室", v2);
precentMap.put("卧室", v2);
}
if(jsonObj.containsKey("kitchen_price")){
Double kitchenPrice = jsonObj.getDouble("kitchen_price");
priceMap.put("厨房", kitchenPrice);
priceMap.put("厨房", kitchenPrice);
v3 = DataUtil.getRound(2, kitchenPrice*100.0/totalPrice);
precentMap.put("厨房", v3);
precentMap.put("厨房", v3);
}
if(jsonObj.containsKey("toilet_price")){
Double toiletPrice = jsonObj.getDouble("toilet_price");
priceMap.put("卫生间", toiletPrice);
priceMap.put("卫生间", toiletPrice);
v4 = DataUtil.getRound(2, toiletPrice*100.0/totalPrice);
precentMap.put("卫生间", v4);
precentMap.put("卫生间", v4);
}
if(jsonObj.containsKey("balcony_price")){
Double balconyPrice = jsonObj.getDouble("balcony_price");
priceMap.put("阳台/过道", balconyPrice);
priceMap.put("阳台/过道", balconyPrice);
v5 = DataUtil.getRound(2, balconyPrice*100.0/totalPrice);
precentMap.put("阳台/过道", v5);
precentMap.put("阳台/过道", v5);
}
if(jsonObj.containsKey("hydropower_price")){
Double hydropowerPrice = jsonObj.getDouble("hydropower_price");
priceMap.put("水电", hydropowerPrice);
priceMap.put("水电", hydropowerPrice);
v6 = 100 - (v1+v2+v3+v4+v5);
precentMap.put("水电", DataUtil.getRound(2, v6));
precentMap.put("水电", DataUtil.getRound(2, v6));
}
dataMap.put("price", priceMap);
@@ -3,14 +3,14 @@ package com.fangjia.coresite.controllers;
import com.fangjia.coresite.model.FangjiaModel;
/**
* 行业应用介绍
* 行业应用介绍
* @author yinjihuan
*
*/
public class IndustryController {
/**
* 银行
* 银行
* @param model
* @return
*/
@@ -19,7 +19,7 @@ public class IndustryController {
}
/**
* 互联网金融
* 互联网金融
* @param model
* @return
*/
@@ -28,7 +28,7 @@ public class IndustryController {
}
/**
* 大数据行业
* 大数据行业
* @param model
* @return
*/
@@ -37,7 +37,7 @@ public class IndustryController {
}
/**
* 评估机构
* 评估机构
* @param model
* @return
*/
@@ -46,7 +46,7 @@ public class IndustryController {
}
/**
* 政府部门
* 政府部门
* @param model
* @return
*/
@@ -55,7 +55,7 @@ public class IndustryController {
}
/**
* 征信机构
* 征信机构
* @param model
* @return
*/
@@ -64,7 +64,7 @@ public class IndustryController {
}
/**
* 行业企业
* 行业企业
* @param model
* @return
*/
@@ -73,7 +73,7 @@ public class IndustryController {
}
/**
* 咨询研究
* 咨询研究
* @param model
* @return
*/
@@ -83,7 +83,7 @@ public class IndustryController {
/**
* 证券
* 证券
* @param model
* @return
*/
@@ -93,16 +93,16 @@ public class IndustryController {
/**
* 金融消费
* 金融消费
*/
public Object costAction(FangjiaModel model){return model;}
/**
* 非银金融
* 非银金融
*/
public Object notBankAction(FangjiaModel model){return model;}
/**
* 零售连锁
* 零售连锁
*/
public Object retailAction(FangjiaModel model){return model;}
}
@@ -95,7 +95,7 @@ public class InformationController {
private MenuService menuService;
/**
* 处理二手房分面查询
* 处理二手房分面查询
*
* @param model
* @param pager
@@ -137,7 +137,7 @@ public class InformationController {
}
/**
* 识别所有的城市
* 识别所有的城市
*
* @param fields
* @return
@@ -148,7 +148,7 @@ public class InformationController {
}
/**
* 获取Facet结果中的所有字段列表
* 获取Facet结果中的所有字段列表
*
* @param results
* @return
@@ -169,7 +169,7 @@ public class InformationController {
}
/**
* 处理租房分面查询
* 处理租房分面查询
*
* @param model
* @param pager
@@ -211,7 +211,7 @@ public class InformationController {
}
/**
* 处理小区分面检索
* 处理小区分面检索
*
* @param model
* @param pager
@@ -242,7 +242,7 @@ public class InformationController {
for (District district : districtList) {
DistrictBo districtBo = new DistrictBo(district);
districtBo.setStat(statMap.get(district.getDistrictKey()));
districtBo.setCityUrl(model.getCityUrl(district.getCity()));// 设置CityURL
districtBo.setCityUrl(model.getCityUrl(district.getCity()));// 设置CityURL
highlightDistrictKeyword(model, districtBo);
districtBoList.add(districtBo);
}
@@ -257,10 +257,10 @@ public class InformationController {
}
/**
* 获取当前城市
* 获取当前城市
*
* @param request
* @return 当前城市
* @return 当前城市
*/
private ServerArea getSuggestCity(HttpServletRequest request) {
String ip = AnalyticsUtil.getIpAddress(request);
@@ -282,7 +282,7 @@ public class InformationController {
}
/**
* 主体资讯列表
* 主体资讯列表
*
* @param model
* @param pager
@@ -310,7 +310,7 @@ public class InformationController {
}
/**
* 分面检索字段列表
* 分面检索字段列表
*
* @return
*/
@@ -328,7 +328,7 @@ public class InformationController {
model.setKeyword(keywordBaidu.getKeyName());
Pager pager = model.getPager(20, FangjiaConfig.getConfig().getSearchListMaxPageNo());
CategoryEnum channel = knowbaseService.parseKeyWord(model.getKeyword(), false);// 默认:SEO列表不给往新盘跳转
CategoryEnum channel = knowbaseService.parseKeyWord(model.getKeyword(), false);// 默认:SEO列表不给往新盘跳转
if (CategoryEnum.sell == channel) {
processSellHouseChannel(model, pager);
model.setCategory(channel.name());
@@ -348,7 +348,7 @@ public class InformationController {
processNewsChannel(model, pager, getFacetFields());
model.setCategory(channel.name());
} else {
// 其他频道归类到二手房
// 其他频道归类到二手房
processSellHouseChannel(model, pager);
model.setCategory(CategoryEnum.sell.name());
ServerArea city = getSuggestCity(request);
@@ -356,7 +356,7 @@ public class InformationController {
model.setAreaGroup(group);
}
// 查询相关检索词
// 查询相关检索词
int offset = 0;
if (null == model.getOffset()) {
offset = keywordsBaiduService.getOffsetById(model.getWordId());
@@ -373,7 +373,7 @@ public class InformationController {
}
/**
* 进入SEO列表页面
* 进入SEO列表页面
*
* @param model
* @return
@@ -381,7 +381,7 @@ public class InformationController {
public Object listAction(final InformationModel model, HttpServletRequest request) {
if (StringUtils.isNotBlank(model.getKeyword())) {
KeywordsBaidu keywordBaidu = keywordsBaiduService.ifKeyWordVisible(model.getKeyword());
if (null != keywordBaidu && keywordBaidu.getVisible() == 1) {// 关键词在百度关键词中存在,状态为1(不显示),跳转到404页面
if (null != keywordBaidu && keywordBaidu.getVisible() == 1) {// 关键词在百度关键词中存在,状态为1(不显示),跳转到404页面
return Models.NOT_FOUNT;
}
}
@@ -391,7 +391,7 @@ public class InformationController {
return model.redirectPermanently("/");
}
CategoryEnum channel = knowbaseService.parseKeyWord(model.getKeyword(), false);// 默认:SEO列表不给往新盘跳转
CategoryEnum channel = knowbaseService.parseKeyWord(model.getKeyword(), false);// 默认:SEO列表不给往新盘跳转
if (CategoryEnum.sell == channel) {
processSellHouseChannel(model, pager);
model.setCategory(channel.name());
@@ -411,7 +411,7 @@ public class InformationController {
processNewsChannel(model, pager, getFacetFields());
model.setCategory(channel.name());
} else {
// 其他频道归类到二手房
// 其他频道归类到二手房
processSellHouseChannel(model, pager);
model.setCategory(CategoryEnum.sell.name());
ServerArea city = getSuggestCity(request);
@@ -419,7 +419,7 @@ public class InformationController {
model.setAreaGroup(group);
}
// 查询相关检索词
// 查询相关检索词
int offset = 0;
if (null == model.getOffset()) {
offset = keywordsBaiduService.getOffset(model.getKeyword());
@@ -434,7 +434,7 @@ public class InformationController {
}
private void feedFooter(InformationModel model) {
// 最新上线的城市
// 最新上线的城市
List<CityGroup> newCitys = new ArrayList<CityGroup>();
List<ServerArea> serverAreaList = ServerAreaData.getServerAreaList(15);
List<String> cityNames = org.sothis.core.util.CollectionUtils.collect(serverAreaList, new Closure<String, ServerArea>() {
@@ -454,7 +454,7 @@ public class InformationController {
}
/**
* 根据城市和类型获取面积范围MENU
* 根据城市和类型获取面积范围MENU
*
* @param city
* @return
@@ -464,7 +464,7 @@ public class InformationController {
}
/**
* 根据城市获取所有的CityURL
* 根据城市获取所有的CityURL
*
* @param citys
* @param model
@@ -479,7 +479,7 @@ public class InformationController {
}
/**
* 查询相关检索词
* 查询相关检索词
*
* @param keyWord
* @param offset
@@ -503,7 +503,7 @@ public class InformationController {
}
/**
* 批量获取DistrictKey
* 批量获取DistrictKey
*
* @param districtList
* @return
@@ -517,30 +517,30 @@ public class InformationController {
}
/**
* SEO结果页城市、区域、板块模块
* SEO结果页城市、区域、板块模块
*
* @param model
* @return
*/
public Object newsRegionFragmentAction(InformationModel model) {
// 先根据IP判断所在城市
// 先根据IP判断所在城市
ServerArea serverArea = getCityByIp(ActionContext.getContext().getRequest());
if (null == serverArea) {
serverArea = FangjiaServerAreaContextHolder.getServerArea();
}
// 关键字为空,显示城市模块
// 关键字为空,显示城市模块
if (StringUtils.isBlank(model.getKeyword())) {
cityFragment(model, serverArea);
} else {
Map<String, String> keywordMap = getKeyword(model, serverArea);
if (MapUtils.isEmpty(keywordMap)) {
if (keywordMap == null) {
// 知识库匹配无结果,显示城市模块
// 知识库匹配无结果,显示城市模块
cityFragment(model, serverArea);
}
} else {
// 按知识库匹配结果,显示对应模块
// 按知识库匹配结果,显示对应模块
regionFragment(model, keywordMap);
}
}
@@ -548,7 +548,7 @@ public class InformationController {
}
/**
* SEO结果页小区模块
* SEO结果页小区模块
*
* @param model
* @return
@@ -569,7 +569,7 @@ public class InformationController {
Map<String, Object> konwbase = knowbaseService.parseWord(model.getKeyword());
List<Map<String, Object>> districts = (null != konwbase && null != konwbase.get("district_name")) ? (List<Map<String, Object>>) konwbase
.get("district_name") : Collections.EMPTY_LIST;
String matchValue = null; // 匹配到的小区名
String matchValue = null; // 匹配到的小区名
if (CollectionUtils.isNotEmpty(districts)) {
List<District> sameNameDistricts = new ArrayList<District>();
for (Map<String, Object> districtData : districts) {
@@ -603,9 +603,9 @@ public class InformationController {
model.setSameNameDistricts(sameNameDistricts);
}
}
// 知识库知道
// 知识库知道
if (null != district) {
// 如果匹配的是别名,则显示
// 如果匹配的是别名,则显示
if (!StringUtils.equals(district.getName(), matchValue)) {
model.setSearchAlia(matchValue);
}
@@ -618,7 +618,7 @@ public class InformationController {
evaluation.setCity(currentCity);
evaluation.setRegion(district.getRegion());
/**
* 有小区域 别墅的小区均价 则估价 继续
* 有小区域 别墅的小区均价 则估价 继续
*/
if (null != district && null != districtStatBo
&& (null != districtStatBo.getVillaDistrictStat() || null != districtStatBo.getDistrictStat())) {
@@ -657,7 +657,7 @@ public class InformationController {
model.setDistrictStatBo(districtStatBo);
model.setPermissionEvaluation(true);
} else {
// 是否有房源
// 是否有房源
Pager pager = new Pager();
pager.setCurrentPage(0);
pager.setPageSize(1);
@@ -677,7 +677,7 @@ public class InformationController {
model.setDistrictExistHouse(true);
List<Map.Entry<String, Long>> districtRoomAvgPrice = new ArrayList<Map.Entry<String, Long>>();
/**
* 有房源 显示小区房型价格
* 有房源 显示小区房型价格
*/
List<FacetResult> facetResult = houseBos.getFacetResults();
List<Count> counts = Collections.emptyList();
@@ -723,7 +723,7 @@ public class InformationController {
model.setDistrictRoomAvgPrice(districtRoomAvgPrice);
} else {
/**
* 无房源 显示区域价格
* 无房源 显示区域价格
*/
RegionStat regionStat = regionStatService.findRegionStat(currentCity, district.getRegion());
model.setRegionStat(regionStat);
@@ -755,7 +755,7 @@ public class InformationController {
/************************** private Method ********************************************************/
/**
* 处理城市、区域、板块的走势、房源数
* 处理城市、区域、板块的走势、房源数
*
* @param model
* @param keywordMap
@@ -829,11 +829,11 @@ public class InformationController {
}
/**
* 从关键字解析出要显示那个模块(板块>区域>小区)
* 从关键字解析出要显示那个模块(板块>区域>小区)
*
* @param model
* @param serverArea
* @return null:没有匹配到结果;EmptyMap:匹配到小区
* @return null:没有匹配到结果;EmptyMap:匹配到小区
*/
@SuppressWarnings("unchecked")
private Map<String, String> getKeyword(InformationModel model, ServerArea serverArea) {
@@ -843,13 +843,13 @@ public class InformationController {
Map<String, String> ret = new HashMap<String, String>();
// 匹配出小区名,不处理,有独立模块
// 匹配出小区名,不处理,有独立模块
Map<String, Object> konwbase = knowbaseService.parseKeyword(model.getKeyword());
if (konwbase.containsKey("district_name")) {
return Collections.emptyMap();
}
// 匹配出板块,用匹配出板块的城市
// 匹配出板块,用匹配出板块的城市
if (konwbase.containsKey("block")) {
Map<String, Object> blockMap = (Map<String, Object>) konwbase.get("block");
Map<String, Object> extraData = (Map<String, Object>) blockMap.get("extra_data");
@@ -860,7 +860,7 @@ public class InformationController {
return ret;
}
// 匹配出区域,优先用城市相同的区域,否则取第一个
// 匹配出区域,优先用城市相同的区域,否则取第一个
if (konwbase.containsKey("region")) {
List<Map<String, Object>> list = (List<Map<String, Object>>) konwbase.get("region");
if (CollectionUtils.isNotEmpty(list)) {
@@ -887,7 +887,7 @@ public class InformationController {
}
}
// 匹配出城市,用匹配出的城市
// 匹配出城市,用匹配出的城市
if (konwbase.containsKey("city")) {
Map<String, Object> cityMap = (Map<String, Object>) konwbase.get("city");
ret.put("city", (String) cityMap.get("value"));
@@ -900,7 +900,7 @@ public class InformationController {
}
/**
* 显示城市模块
* 显示城市模块
*
* @param model
* @param serverArea
@@ -931,7 +931,7 @@ public class InformationController {
}
/**
* 根据IP得到城市
* 根据IP得到城市
*
* @throws Exception
*/
@@ -986,7 +986,7 @@ public class InformationController {
}
/**
* 取得 去除html "\n", "\r", "\t", " " 字符的文本 字符串
* 取得 去除html "\n", "\r", "\t", " " 字符的文本 字符串
*
* @param string
* @return
@@ -15,7 +15,7 @@ import com.fangjia.service.cnAnalyzer.KeywordEnum;
import com.fangjia.service.cnAnalyzer.Token;
/**
* 小区名纠错
* 小区名纠错
*
* @author dxy
*
@@ -21,8 +21,8 @@ import com.fangjia.dal.mongo.fangjia.model.LoanBurialPoint;
import com.fangjia.service.fangjia.LoanBurialPointService;
/**
* 新版房价网广点通快速贷款-埋点需求
* 规则:触发输入框或者点击按钮,每日做一次数量统计
* 新版房价网广点通快速贷款-埋点需求
* 规则:触发输入框或者点击按钮,每日做一次数量统计
* @author JENIS
*
*/
@@ -32,54 +32,54 @@ public class LoanBurialPointController {
private LoanBurialPointService loanBurialPointService;
/**
* 埋点保存
* 埋点保存
*
* @param model
* @param req
* @return
*/
public Object saveLoanBurialPointAction(LoanBurialPointModel model, HttpServletRequest req) {
LOG.info("saveLoanBurialPointAction 参数LoanBurialPointModel 为" + JsonUtils.toJson(model));
LOG.info("saveLoanBurialPointAction 参数LoanBurialPointModel 为" + JsonUtils.toJson(model));
JsonModel jsonModel = new JsonModel();
Map<String,Object> result = new HashMap<String,Object>();
try{
if(model == null){
result.put("status", false);
result.put("message", "参数‘Model’为空!");
result.put("message", "参数‘Model’为空!");
jsonModel.setJsonModel(result);
return jsonModel;
}
if(StringUtils.isEmpty(model.getLoanType())){
result.put("status", false);
result.put("message", "参数‘贷款类型’为空!");
result.put("message", "参数‘贷款类型’为空!");
jsonModel.setJsonModel(result);
return jsonModel;
}
if(StringUtils.isEmpty(model.getLeadsSource())){
result.put("status", false);
result.put("message", "参数‘渠道名称’为空!");
result.put("message", "参数‘渠道名称’为空!");
jsonModel.setJsonModel(result);
return jsonModel;
}
if(StringUtils.isEmpty(model.getSource())){
result.put("status", false);
result.put("message", "参数‘贷款页面来源’为空!");
result.put("message", "参数‘贷款页面来源’为空!");
jsonModel.setJsonModel(result);
return jsonModel;
}
if(StringUtils.isEmpty(model.getBurialPointType())){
result.put("status", false);
result.put("message", "参数‘埋点源类型’为空!");
result.put("message", "参数‘埋点源类型’为空!");
jsonModel.setJsonModel(result);
return jsonModel;
}
if(LoanBurialPointEnum.getByBurialPointType(model.getBurialPointType()) == null){
result.put("status", false);
result.put("message", "参数‘埋点源类型’不正确!");
result.put("message", "参数‘埋点源类型’不正确!");
jsonModel.setJsonModel(result);
return jsonModel;
}
//构造QueryParam
//构造QueryParam
List<QueryParam> params = new ArrayList<QueryParam>();
params.add(new QueryParam("burialPointType", model.getBurialPointType()));
params.add(new QueryParam("intraday", Integer.parseInt(DateUtil.formatToTightYYYYMMDD(new Date()))));
@@ -87,10 +87,10 @@ public class LoanBurialPointController {
params.add(new QueryParam("leadsSource", model.getLeadsSource()));
params.add(new QueryParam("source", model.getSource()));
LoanBurialPoint loanBurialPoint = loanBurialPointService.findByParams(params);
//获取埋点枚举对象
//获取埋点枚举对象
LoanBurialPointEnum em = LoanBurialPointEnum.getByBurialPointType(model.getBurialPointType());
if(loanBurialPoint == null){
//新增数据
//新增数据
loanBurialPoint = new LoanBurialPoint();
loanBurialPoint.setIntraday(Integer.parseInt(DateUtil.formatToTightYYYYMMDD(new Date())));
loanBurialPoint.setTimes(1);
@@ -105,17 +105,17 @@ public class LoanBurialPointController {
loanBurialPoint.setModifyDate(new Date());
loanBurialPointService.save(loanBurialPoint);
}else{
//修改当天统计次数
//修改当天统计次数
loanBurialPoint.setTimes(loanBurialPoint.getTimes()+1);
loanBurialPoint.setModifyDate(new Date());
loanBurialPointService.update(loanBurialPoint);
}
result.put("status", true);
result.put("message", "埋点保存成功!");
result.put("message", "埋点保存成功!");
}catch (Exception e) {
LOG.error("saveLoanBurialPointAction 发生异常, 异常信息为: " + e);
LOG.error("saveLoanBurialPointAction 发生异常, 异常信息为: " + e);
result.put("status", false);
result.put("message", "服务异常, 请稍后再试!");
result.put("message", "服务异常, 请稍后再试!");
}
jsonModel.setJsonModel(result);
return jsonModel;
@@ -63,7 +63,7 @@ import com.fangjia.service.pds.PdsApiProxyService.Method;
import com.fangjia.service.util.PdsConstants;
/**
* 贷款线索控制器
* 贷款线索控制器
* @author yinjihuan
*
*/
@@ -115,54 +115,54 @@ public class LoanLeadsController {
}
/**
* 房金所开通的城市
* 房金所开通的城市
*/
private Set<String> FJSSet = new HashSet<String>(){{
add("北京");
add("广州");
add("深圳");
add("郑州");
add("杭州");
add("北京");
add("广州");
add("深圳");
add("郑州");
add("杭州");
}};
/**
* 房互网、房金所开通的城市
* 房互网、房金所开通的城市
*/
private Set<String> CommonSet = new HashSet<String>(){{
add("北京");
add("广州");
add("深圳");
add("北京");
add("广州");
add("深圳");
}};
/**
* 房互网开通的城市
* 房互网开通的城市
*/
private Set<String> FHWSet = new HashSet<String>(){{
add("北京");
add("广州");
add("深圳");
add("天津");
add("南京");
add("成都");
add("武汉");
add("苏州");
add("东莞");
add("廊坊");
add("珠海");
add("南通");
add("无锡");
add("中山");
add("惠州");
add("泉州");
add("扬州");
add("燕郊");
add("宜昌");
add("承德");
add("绵阳");
add("北京");
add("广州");
add("深圳");
add("天津");
add("南京");
add("成都");
add("武汉");
add("苏州");
add("东莞");
add("廊坊");
add("珠海");
add("南通");
add("无锡");
add("中山");
add("惠州");
add("泉州");
add("扬州");
add("燕郊");
add("宜昌");
add("承德");
add("绵阳");
}};
/**
* 添加贷款线索
* 添加贷款线索
* @return
*/
public Object addLeadsAction(LoanLeadsModel model, HttpServletRequest req) {
@@ -183,11 +183,11 @@ public class LoanLeadsController {
result.setMsg(Message.PARAM_NOT_NULL);
return result;
}
// 自动化测试使用,只允许公司内部的IP才可以
// 自动化测试使用,只允许公司内部的IP才可以
String ip = AnalyticsUtil.getIpAddress(req);
if (("8888".equals(model.getSmsCode()) && "116.247.70.58".equals(ip))
|| ("8888".equals(model.getSmsCode()) && ip.startsWith("192.168"))) {
LOGGER.info("自动化测试,不做验证码认证:"+ip);
LOGGER.info("自动化测试,不做验证码认证:"+ip);
} else {
String smsCacheCode = getCacheCode(model.getMobile(), Message.SMS_CODE_TYPE_REG);
if (smsCacheCode == null) {
@@ -221,7 +221,7 @@ public class LoanLeadsController {
leads.setLoanUserName(model.getLoanName());
leads.setSex(model.getSex());
leads.setSource(model.getSource());
// 网站来源
// 网站来源
String source = COOKIE_CONTEXT.getCookieValue(req, CookieName.SITE_SOURCE);
String channelType = SourceUtils.getSampleBaiduSiteType(source);
leads.setClueSource(source);
@@ -230,37 +230,37 @@ public class LoanLeadsController {
if (serverArea != null) {
leads.setProvince(serverArea.getProvince());
}
//发送邮件
//发送邮件
String loanName = "";
if(StringUtils.isBlank(model.getLoanProductId())){
loanName = model.getLoanType();
leads.setLoanType(loanName);
leads.setLoanProductName(loanName);
//评估结果页和我要贷款页逻辑处理
/*if("评估结果页".equals(model.getSource()) && "无抵押".equals(model.getLoanType())){
leads.setEnterpriseRemark("线索已给泰隆银行");
//评估结果页和我要贷款页逻辑处理
/*if("评估结果页".equals(model.getSource()) && "无抵押".equals(model.getLoanType())){
leads.setEnterpriseRemark("线索已给泰隆银行");
}
if(("评估结果页".equals(model.getSource()) && !"无抵押".equals(model.getLoanType())) ||
("贷款着陆页".equals(model.getSource()) && "房抵贷".equals(model.getLoanType()))){
if(("评估结果页".equals(model.getSource()) && !"无抵押".equals(model.getLoanType())) ||
("贷款着陆页".equals(model.getSource()) && "房抵贷".equals(model.getLoanType()))){
if(CommonSet.contains(model.getDisCity())){
boolean fjsFlag = postFJSParam(model);
boolean fhwFlag = postFHWParam(model);
if(fjsFlag && !fhwFlag){
leads.setEnterpriseRemark("线索已给房金所");
leads.setEnterpriseRemark("线索已给房金所");
}
if(!fjsFlag && fhwFlag){
leads.setEnterpriseRemark("线索已给房互网");
leads.setEnterpriseRemark("线索已给房互网");
}
if(fjsFlag && fhwFlag){
leads.setEnterpriseRemark("线索已给房互网和房金所");
leads.setEnterpriseRemark("线索已给房互网和房金所");
}
}else if(FHWSet.contains(model.getDisCity())){
if(postFHWParam(model)){
leads.setEnterpriseRemark("线索已给房互网");
leads.setEnterpriseRemark("线索已给房互网");
}
}else if(FJSSet.contains(model.getDisCity())){
if(postFJSParam(model)){
leads.setEnterpriseRemark("线索已给房金所");
leads.setEnterpriseRemark("线索已给房金所");
}
}
}*/
@@ -270,33 +270,33 @@ public class LoanLeadsController {
leads.setLoanProductName(product.getName());
leads.setLoanProductId(product.getId());
loanName = product.getName();
/*if("房抵贷".equals(product.getType())){
/*if("房抵贷".equals(product.getType())){
if(CommonSet.contains(model.getDisCity())){
boolean fjsFlag = postFJSParam(model);
boolean fhwFlag = postFHWParam(model);
if(fjsFlag && !fhwFlag){
leads.setEnterpriseRemark("线索已给房金所");
leads.setEnterpriseRemark("线索已给房金所");
}
if(!fjsFlag && fhwFlag){
leads.setEnterpriseRemark("线索已给房互网");
leads.setEnterpriseRemark("线索已给房互网");
}
if(fjsFlag && fhwFlag){
leads.setEnterpriseRemark("线索已给房互网和房金所");
leads.setEnterpriseRemark("线索已给房互网和房金所");
}
}else if(FHWSet.contains(model.getDisCity())){
if(postFHWParam(model)){
leads.setEnterpriseRemark("线索已给房互网");
leads.setEnterpriseRemark("线索已给房互网");
}
}else if(FJSSet.contains(model.getDisCity())){
if(postFJSParam(model)){
leads.setEnterpriseRemark("线索已给房金所");
leads.setEnterpriseRemark("线索已给房金所");
}
}
}*/
//添加调用次数
//添加调用次数
int count = 0;
if(product.getClickCount() == 0){ //第一次处理的时候
if(product.getClickCount() == 0){ //第一次处理的时候
count = loanLeadsService.countByParam("loanProductId", model.getLoanProductId(), null, null, 0, null);
}else{
count = product.getClickCount()+1;
@@ -315,15 +315,15 @@ public class LoanLeadsController {
//sendEmail("jiangxiaochun@fangjia.com", model, loanName,smsContent);
//sendEmail("yanshenbing@fangjia.com", model, loanName,smsContent);
//sendEmail("wanglei379@fangjia.com", model, loanName,smsContent);
if(StringUtils.isNotBlank(model.getDisCity()) && model.getDisCity().equals("上海")){
if(StringUtils.isNotBlank(model.getDisCity()) && model.getDisCity().equals("上海")){
sendEmail("yaojingmeng@fangjia.com", model, loanName,smsContent);
sendEmail("zhaolingzhi@fangjia.com", model, loanName,smsContent);
}
//发送钉钉消息
//发送钉钉消息
JSONObject jsonBody = getDingDingContent(loanName, model.getLoanName(), smsContent);
if(StringUtils.isNotBlank(model.getDisCity()) && model.getDisCity().equals("上海")){
if(StringUtils.isNotBlank(model.getDisCity()) && model.getDisCity().equals("上海")){
pdsApiProxyService.invoke(PdsConstants.DINGDING_URL_LOANAPPLY, jsonBody, null, "UTF-8", false);
}
@@ -339,7 +339,7 @@ public class LoanLeadsController {
public String getEmailContent(String loanName, String sex, String mobile, String city, String address, String districtName, Double loanAmount, Long totalPrice, Double area, Integer avgPrice, String loanType){
String smsContent = "";
if(StringUtils.isNotBlank(loanName) || StringUtils.isNotBlank(sex)){
smsContent += "客户名:";
smsContent += "客户名:";
if(StringUtils.isNotBlank(loanName)){
smsContent += loanName;
}
@@ -349,31 +349,31 @@ public class LoanLeadsController {
smsContent += " <br>";
}
if(StringUtils.isNotBlank(mobile)){
smsContent += "手机号:" +mobile+" <br>省份:" + ProvinceData.getProvince(city)
+" <br>城市:" + city;
smsContent += "手机号:" +mobile+" <br>省份:" + ProvinceData.getProvince(city)
+" <br>城市:" + city;
}
if(StringUtils.isNotBlank(address)){
smsContent += " <br>地址:" + address;
smsContent += " <br>地址:" + address;
}
if(StringUtils.isNotBlank(districtName)){
smsContent += " <br>小区名:" + districtName;
smsContent += " <br>小区名:" + districtName;
}
if(loanAmount!=null && loanAmount>0){
smsContent += " <br>贷款金额:" + loanAmount*10000;
smsContent += " <br>贷款金额:" + loanAmount*10000;
}
if(totalPrice!=null && totalPrice>0){
smsContent += " <br>评估总价:" + totalPrice;
smsContent += " <br>评估总价:" + totalPrice;
}
if(area!=null && area>0){
smsContent += " <br>面积:" + area;
smsContent += " <br>面积:" + area;
}
if(avgPrice!=null && avgPrice>0){
smsContent += " <br>评估单价:" + avgPrice;
smsContent += " <br>评估单价:" + avgPrice;
}
SimpleDateFormat sf = new SimpleDateFormat("yyyy/MM/dd HH:mm");
smsContent += " <br>申请日期:" + sf.format(new Date());
smsContent += " <br>申请日期:" + sf.format(new Date());
if(StringUtils.isNotBlank(loanType)){
smsContent += " <br>贷款类型:"+loanType;
smsContent += " <br>贷款类型:"+loanType;
}
return smsContent;
}
@@ -383,9 +383,9 @@ public class LoanLeadsController {
jsonBody.put("msgtype", "markdown");
JSONObject markdown = new JSONObject();
if(StringUtils.isBlank(loanName)){
markdown.put("title", name+"客户申请了贷款");
markdown.put("title", name+"客户申请了贷款");
}else{
markdown.put("title", name+"客户申请了"+loanName+"类型的贷款");
markdown.put("title", name+"客户申请了"+loanName+"类型的贷款");
}
markdown.put("text", smsContent);
jsonBody.put("markdown", markdown);
@@ -393,7 +393,7 @@ public class LoanLeadsController {
}
/**
* 快捷添加贷款线索
* 快捷添加贷款线索
* @return
*/
public Object addFastLeadsAction(LoanLeadsModel model, HttpServletRequest req) {
@@ -422,7 +422,7 @@ public class LoanLeadsController {
String smsContent = getEmailContent(model.getLoanName(),model.getSex(),model.getMobile(),model.getDisCity(), model.getAddress(), model.getName(),model.getAmount(),model.getTotalPrice(),model.getArea(),model.getAvgPrice(),model.getLoanType());
JSONObject jsonBody = getDingDingContent(model.getLoanType(), model.getLoanName(), smsContent);
if(StringUtils.isNotBlank(model.getDisCity()) && model.getDisCity().equals("上海")){
if(StringUtils.isNotBlank(model.getDisCity()) && model.getDisCity().equals("上海")){
sendEmail("yaojingmeng@fangjia.com", model, model.getLoanName(),smsContent);
sendEmail("zhaolingzhi@fangjia.com", model, model.getLoanName(),smsContent);
sendEmail("gaojuan@fangjia.com", model, model.getLoanName(),smsContent);
@@ -436,7 +436,7 @@ public class LoanLeadsController {
}
/**
* 房互网添加贷款线索
* 房互网添加贷款线索
* @return
*/
public Object addFHWLeadsAction(LoanLeadsModel model, HttpServletRequest req) {
@@ -464,7 +464,7 @@ public class LoanLeadsController {
leads.setSex("");
leads.setSource(model.getSource());
// 网站来源
// 网站来源
String source = COOKIE_CONTEXT.getCookieValue(req, CookieName.SITE_SOURCE);
String channelType = SourceUtils.getSampleBaiduSiteType(source);
leads.setClueSource(source);
@@ -473,15 +473,15 @@ public class LoanLeadsController {
if (serverArea != null) {
leads.setProvince(serverArea.getProvince());
}
if("无抵押".equals(model.getLoanType()) && ("评估结果页".equals(model.getSource()))){
if("无抵押".equals(model.getLoanType()) && ("评估结果页".equals(model.getSource()))){
leads.setLoanType(model.getLoanType());
leads.setLoanProductName(model.getLoanType());
//leads.setEnterpriseRemark("线索已给泰隆银行");
//leads.setEnterpriseRemark("线索已给泰隆银行");
}else{
LoanProduct product = loanProductService.findById(model.getLoanProductId());
//添加调用次数
//添加调用次数
int count = 0;
if(product.getClickCount() == 0){ //第一次处理的时候
if(product.getClickCount() == 0){ //第一次处理的时候
count = loanLeadsService.countByParam("loanProductId", model.getLoanProductId(), null, null, 0, null);
}else{
count = product.getClickCount()+1;
@@ -502,7 +502,7 @@ public class LoanLeadsController {
}
/**
* 推送房金所数据
* 推送房金所数据
* @param model
* @return
*/
@@ -517,10 +517,10 @@ public class LoanLeadsController {
params.put("address", model.getAddress());
params.put("loan_amount", String.valueOf(model.getAmount()*10000));
if(StringUtils.isBlank(model.getLoanName())){
//截取当前时间戳的后六位
//截取当前时间戳的后六位
String timeStr = String.valueOf(new Date().getTime());
timeStr = timeStr.substring(timeStr.length()-7, timeStr.length()-1);
params.put("uname", "客户"+timeStr);
params.put("uname", "客户"+timeStr);
}else{
params.put("uname", model.getLoanName());
}
@@ -540,7 +540,7 @@ public class LoanLeadsController {
}
/**
* 推送房互网数据
* 推送房互网数据
* @param model
* @return
*/
@@ -602,7 +602,7 @@ public class LoanLeadsController {
private String getSign(Map<String, String> params) {
Map<String, String> sortMap = new TreeMap<String, String>();
sortMap.putAll(params);
// 以k1=v1&k2=v2...方式拼接参数
// 以k1=v1&k2=v2...方式拼接参数
StringBuilder builder = new StringBuilder();
for (Map.Entry<String, String> s : sortMap.entrySet()) {
String k = s.getKey();
@@ -619,11 +619,11 @@ public class LoanLeadsController {
return builder.toString();
}
/**
* 评估结果页房屋网url处理
* 评估结果页房屋网url处理
* @param req
*/
private String dealProduct(LoanLeadsModel model, HttpServletRequest req){
//新增一次估价次数(用户已登录)
//新增一次估价次数(用户已登录)
FangJiaUser user = getLoginUser(req);
CoresiteCookieContext context = CoresiteCookieContext.getInstance();
String userId = context.getCookieValue(req, CookieName.UID);
@@ -644,9 +644,9 @@ public class LoanLeadsController {
}
private String wrapUrlParames(LoanLeadsModel model,String userId,String uName,String mobile){
//&address=房产地址&name=小区名称&hosueNum=楼栋&floor=楼层&area=面积&totalPrice=房产总格&uname=用户姓名&uid=用户ID&mobile=手机号码&
//&channel=fangjiawang&sign=加密串
//加密
//&address=房产地址&name=小区名称&hosueNum=楼栋&floor=楼层&area=面积&totalPrice=房产总格&uname=用户姓名&uid=用户ID&mobile=手机号码&
//&channel=fangjiawang&sign=加密串
//加密
String key = md5("fangjiawang");
Map<String,String> params = new LinkedHashMap<String,String>();
params.put("mobile", mobile);
@@ -695,10 +695,10 @@ public class LoanLeadsController {
public void sendEmail(String eamilAddress,LoanLeadsModel model, String loanName, String smsContent){
try {
// 发邮件给用户
// 发邮件给用户
Mail mail = new Mail();
mail.setReceiver(new MailUser(eamilAddress));
String subject = model.getMobile()+"客户申请了"+loanName+"类型的贷款";
String subject = model.getMobile()+"客户申请了"+loanName+"类型的贷款";
mail.setSubject(subject);
StringBuffer emailMsg = new StringBuffer();
@@ -708,19 +708,19 @@ public class LoanLeadsController {
mail.setAttachment(false);
emailService.sendHtmlMailWithFile(mail);
} catch (Exception e) {
// ret.setMsg("发送失败,请稍后重试");
// ret.setMsg("发送失败,请稍后重试");
//System.out.println(e);
LOGGER.info("发送失败,请稍后重试");
LOGGER.info("发送失败,请稍后重试");
}
LOGGER.info("发送成功");
// ret.setMsg("申请成功,请等待客服处理");
LOGGER.info("发送成功");
// ret.setMsg("申请成功,请等待客服处理");
}
/**
* 获取缓存的验证码
* 获取缓存的验证码
* @author yinjihuan
* @param mobile 手机
* @param type 类型
* @param mobile 手机
* @param type 类型
* @return
*/
private String getCacheCode(String mobile, String type) {
@@ -729,7 +729,7 @@ public class LoanLeadsController {
}
/**
* 添加成功页面
* 添加成功页面
* @param model
* @return
*/
@@ -33,9 +33,9 @@ public class LoginController {
public Object indexAction(LoginModel model) {
String loginUserName = model.getLoginUserName();
if (StringUtils.isBlank(loginUserName)) {
// 未登录
// 未登录
if (StringUtils.isBlank(model.getToken())) {
// 未授权
// 未授权
model.setViewType("redirect");
model.setViewParam("location", model.getCityUrl());
return model;
@@ -81,7 +81,7 @@ public class LoginController {
String api_key = fangjiaConfig.getDengluApiKey();
try {
Denglu denglu = new Denglu(app_id, api_key, null, null);
JSONObject jsonObj = denglu.getUserInfoByToken(token); // 调用获取用户信息接口
JSONObject jsonObj = denglu.getUserInfoByToken(token); // 调用获取用户信息接口
User dbUser = userService.getDBUserByMediaUserId(jsonObj.getInt("mediaUserID"), jsonObj.getString("screenName"),
DengluMediaEnum.getMediaNameByMediaId(jsonObj.getInt("mediaID")));
if (null == dbUser) {
@@ -12,7 +12,7 @@ import com.fangjia.service.common.CookieName;
public class LogoutController {
/**
* 登出
* 登出
*/
public Object indexAction(LoginModel model) {
removeLoginCookie();
@@ -13,7 +13,7 @@ public class MallController {
private MallService mallService;
/**
* 新盘列表商城推广
* 新盘列表商城推广
*
* @param model
* @return
@@ -36,7 +36,7 @@ public class MallController {
}
/**
* 二手房、租房、小区、新房列表置顶推广
* 二手房、租房、小区、新房列表置顶推广
*
* @param model
* @return
@@ -53,7 +53,7 @@ public class MallController {
}
/**
* 小区、新房列表页菜单下方推广
* 小区、新房列表页菜单下方推广
*
* @param model
* @return
@@ -64,7 +64,7 @@ public class MallController {
}
/**
* 新盘详情页右侧推广
* 新盘详情页右侧推广
*
* @param model
* @return
@@ -97,7 +97,7 @@ import com.fangjia.service.util.PhoneNormalizer;
import com.fangjia.service.web.MenuService;
import com.fangjia.core.util.DateUtil;
/**
* 地图找房
* 地图找房
*
*
*/
@@ -123,7 +123,7 @@ public class MapController {
/**
* 地图找房
* 地图找房
*
* @param model
* @return
@@ -135,7 +135,7 @@ public class MapController {
model.setLat(new Double(serverAreaEnum.getLat() * 10000000000L).longValue());
model.setLng(new Double(serverAreaEnum.getLng() * 10000000000L).longValue());
// 底部热门推荐的其他城市
// 底部热门推荐的其他城市
List<CityGroup> footerCitys = new ArrayList<CityGroup>(10);
List<String> cityNames = ServerAreaData.getServerAreaDisplayList(10);
for (String name : cityNames) {
@@ -279,7 +279,7 @@ public class MapController {
/***
*
* 取得地图中心点位置和新的缩放级别
* 取得地图中心点位置和新的缩放级别
*
* **/
public Object getMapCenterAction(MapModel model) {
@@ -348,7 +348,7 @@ public class MapController {
}
/**
* 地图找房
* 地图找房
*
* @param model
* @return
@@ -425,7 +425,7 @@ public class MapController {
}
/**
* 显示范围内地铁站信息
* 显示范围内地铁站信息
*
* **/
public Object getMetroInfoAction(MapModel model) {
@@ -437,7 +437,7 @@ public class MapController {
}
/**
* hash参数转换为页面显示值
* hash参数转换为页面显示值
*
* **/
public Object paramsToDisplayAction(MapModel model) {
@@ -457,7 +457,7 @@ public class MapController {
model.setTotalPriceRange(priceItem.getCaption());
}
} else {
model.setTotalPriceRange(model.getCategory().equals("zufang") ? "租 金" : "总 价");
model.setTotalPriceRange(model.getCategory().equals("zufang") ? "租 金" : "总 价");
}
}
if (StringUtils.isNotBlank(model.getHouseAreaRange())) {
@@ -466,7 +466,7 @@ public class MapController {
model.setHouseAreaRange(areaItem.getCaption());
}
} else {
model.setHouseAreaRange("面 积");
model.setHouseAreaRange("面 积");
}
if (StringUtils.isNotBlank(model.getAvgPriceRange())) {
@@ -475,7 +475,7 @@ public class MapController {
model.setAveragePriceRange(avgPriceItem.getCaption());
}
} else {
model.setAveragePriceRange("均价");
model.setAveragePriceRange("均价");
}
if (StringUtils.isNotBlank(model.getMetro())) {
@@ -489,7 +489,7 @@ public class MapController {
}
/**
* 显示区域信息
* 显示区域信息
*
* **/
public Object getRegionInfoAction(MapModel model) {
@@ -501,7 +501,7 @@ public class MapController {
}
/**
* 地图找房小区模块,小区房源列表
* 地图找房小区模块,小区房源列表
*
* **/
public Object districtFragmentAction(MapModel model) {
@@ -611,7 +611,7 @@ public class MapController {
}
/**
* 小区房源
* 小区房源
*
* @param model
* @return
@@ -644,7 +644,7 @@ public class MapController {
pager.setTotalRows(houseBoResult.getNumberFound());
if (CollectionUtils.isNotEmpty(houseBoResult)) {
// 加入cpc
// 加入cpc
cpcService.checkCpcUserEnable(houseBoResult);
for (HouseBo bo : houseBoResult) {
bo.setTitle(CommonUtil.getShowTitle(bo.getHouse()));
@@ -677,7 +677,7 @@ public class MapController {
pager.setTotalRows(houseBoResult.getNumberFound());
if (CollectionUtils.isNotEmpty(houseBoResult)) {
// 加入cpc
// 加入cpc
cpcService.checkCpcUserEnable(houseBoResult);
for (RentHouseBo bo : houseBoResult) {
bo.setTitle(CommonUtil.getShowTitle(bo.getHouse()));
@@ -730,7 +730,7 @@ public class MapController {
Map<String, Object> ret = new HashMap<String, Object>();
Object obj = parseMap.get("district_name");
List list = (List) obj;
if (CollectionUtils.isEmpty(list)) {// 小区没配备上,去匹配关键字,区域等
if (CollectionUtils.isEmpty(list)) {// 小区没配备上,去匹配关键字,区域等
Map<String, Object> konwbase = knowbaseService.parseKeyword(keyword);
if (konwbase.containsKey("district_name")) {
return null;
@@ -818,7 +818,7 @@ public class MapController {
}
/**
* 地图中概况模块Action
* 地图中概况模块Action
*
* @param model
* @return
@@ -838,7 +838,7 @@ public class MapController {
}
/**
* 小区概况
* 小区概况
*
* @param model
* @return
@@ -870,7 +870,7 @@ public class MapController {
}
/**
* 板块、区域、城市概况
* 板块、区域、城市概况
*
* @param model
* @return
@@ -909,7 +909,7 @@ public class MapController {
}
/**
* 解析关键字中的小区或板块或区域
* 解析关键字中的小区或板块或区域
*
* @param model
*/
@@ -918,7 +918,7 @@ public class MapController {
String currentCity = ((ServerArea) FangjiaServerAreaContextHolder.getServerAreaDefault()).getDisplay();
Map<String, Object> konwbase = knowbaseService.parseWord(model.getKeyword());
if (MapUtils.isNotEmpty(konwbase)) {
// 判断是否存在小区
// 判断是否存在小区
if (konwbase.containsKey("district_name")) {
List<Map<String, Object>> districts = (List<Map<String, Object>>) konwbase.get("district_name");
if (CollectionUtils.isNotEmpty(districts)) {
@@ -1059,7 +1059,7 @@ public class MapController {
districts.addAll(newDistricts);
districts = getDistrictCommDataInfo(districts, model);
//排序
//排序
NameComparator comparator = new NameComparator();
Collections.sort(offices,comparator);
Collections.sort(districts,comparator);
@@ -1152,7 +1152,7 @@ public class MapController {
in_districts = getDistrictCommDataInfo(in_districts, model);
setValue(model, "in");
//排序
//排序
NameComparator comparator = new NameComparator();
Collections.sort(in_offices,comparator);
Collections.sort(in_districts,comparator);
@@ -1195,12 +1195,12 @@ public class MapController {
model.setCommonDistrictHouseCountOut(model.getCommonDistrictHouseCount());
model.setHightDistrictHouseCountOut(model.getHightDistrictHouseCount());
model.setTotalDistrictCountOut(model.getTotalDistrictCount());//总小区数
model.setCommonDistrictCountOut(model.getCommonDistrictCount());//高级小区数
model.setHightDistrictCountOut(model.getHightDistrictCount());//普通小区数
model.setTotalDistrictCountOut(model.getTotalDistrictCount());//总小区数
model.setCommonDistrictCountOut(model.getCommonDistrictCount());//高级小区数
model.setHightDistrictCountOut(model.getHightDistrictCount());//普通小区数
model.setOldHouseCountOut(model.getOldHouseCount());//老工房 户数
model.setOldDistrictCountOut(model.getOldDistrictCount());//老工户 小区数
model.setOldHouseCountOut(model.getOldHouseCount());//老工房 户数
model.setOldDistrictCountOut(model.getOldDistrictCount());//老工户 小区数
}else{
model.setTotalHouseCountIn(model.getTotalHouseCount());
model.setCommonDistrictHouseCountIn(model.getCommonDistrictHouseCount());
@@ -1256,18 +1256,18 @@ public class MapController {
OutputStream os = null;
BufferedOutputStream fos = null;
HSSFWorkbook wb = writeExcel(model.getResult(), model.getInResult(), model.getOutResult());
String fileName = "概况统计.xls";
String fileName = "概况统计.xls";
try {
HttpServletResponse response = ActionContext.getContext().getResponse();
response.setCharacterEncoding("UTF-8");
//response.reset();// 清空输出流
//response.reset();// 清空输出流
response.setContentType("application/x-download;charset=UTF-8");
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
if(fileName.length()>150){//解决IE 6.0 bug
if(fileName.length()>150){//解决IE 6.0 bug
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
}
response.setHeader( "Content-Disposition", "attachment;filename=" + fileName);
os = response.getOutputStream();// 取得输出流
os = response.getOutputStream();// 取得输出流
wb.write(os);
os.flush();
}catch (Exception e) {
@@ -1306,13 +1306,13 @@ public class MapController {
private HSSFWorkbook createComplexExcel(String result, String inResult, String outResult){
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet s = wb.createSheet();
wb.setSheetName(0, "概况");
s = createExcelData(result, s, "内圆");
wb.setSheetName(0, "概况");
s = createExcelData(result, s, "内圆");
if(StringUtils.isNotBlank(outResult)){
s = createExcelData(inResult, s, "内环");
s = createExcelData(outResult, s, "外环");
s = createExcelData(inResult, s, "内环");
s = createExcelData(outResult, s, "外环");
}else{
s = createExcelData(inResult, s, "外环");
s = createExcelData(inResult, s, "外环");
}
@@ -1323,31 +1323,31 @@ public class MapController {
private HSSFSheet createExcelData(String result, HSSFSheet s, String keyword){
String[] array = result.split("-");
HSSFRow row = s.createRow(s.getPhysicalNumberOfRows()+1 );
row.createCell((short)0).setCellValue(keyword+ "总户数");
row.createCell((short)1).setCellValue(array[0] + "户");
row.createCell((short)0).setCellValue(keyword+ "总户数");
row.createCell((short)1).setCellValue(array[0] + "户");
HSSFRow row1 = s.createRow(s.getPhysicalNumberOfRows()+1 );
row1.createCell((short)1).setCellValue(keyword + "半径:"+array[1]+"米");
row1.createCell((short)1).setCellValue(keyword + "半径:"+array[1]+"米");
if(Integer.parseInt(array[2])!=0 || Integer.parseInt(array[3])!=0){
HSSFRow row2 = s.createRow(s.getPhysicalNumberOfRows()+1 );
row2.createCell((short)1).setCellValue("老工房:"+array[2]+"户("+array[3]+"小区)");
row2.createCell((short)1).setCellValue("老工房:"+array[2]+"户("+array[3]+"小区)");
}
if(Integer.parseInt(array[4])!=0 || Integer.parseInt(array[5])!=0){
HSSFRow row3 = s.createRow(s.getPhysicalNumberOfRows()+1 );
row3.createCell((short)1).setCellValue("高级商品房:"+array[4]+"户("+array[5]+"小区)");
row3.createCell((short)1).setCellValue("高级商品房:"+array[4]+"户("+array[5]+"小区)");
}
if(Integer.parseInt(array[6])!=0 || Integer.parseInt(array[7])!=0){
HSSFRow row4 = s.createRow(s.getPhysicalNumberOfRows()+1 );
row4.createCell((short)1).setCellValue("普通商品房:"+array[6]+"户("+array[7]+"小区)");
row4.createCell((short)1).setCellValue("普通商品房:"+array[6]+"户("+array[7]+"小区)");
}
if(Integer.parseInt(array[8])!=0 || Integer.parseInt(array[9])!=0){
HSSFRow row5 = s.createRow(s.getPhysicalNumberOfRows() +1);
row5.createCell((short)1).setCellValue("写字楼人数" + array[8]+"人("+array[9]+"个)");
row5.createCell((short)1).setCellValue("写字楼人数" + array[8]+"人("+array[9]+"个)");
}
s.createRow(s.getPhysicalNumberOfRows() + 1);
@@ -1360,38 +1360,38 @@ public class MapController {
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet s = wb.createSheet();
wb.setSheetName(0, "概况");
wb.setSheetName(0, "概况");
if(Integer.parseInt(array[0]) > 0){
HSSFRow row = s.createRow(s.getPhysicalNumberOfRows() );
HSSFCell cell = row.createCell(0);
row.createCell((short)0).setCellValue("查询半径");
row.createCell((short)1).setCellValue(array[0] + "米");
row.createCell((short)0).setCellValue("查询半径");
row.createCell((short)1).setCellValue(array[0] + "米");
s.createRow(s.getPhysicalNumberOfRows());
}
HSSFRow row2 = s.createRow(s.getPhysicalNumberOfRows() );
row2.createCell((short)0).setCellValue("商品房人数");
row2.createCell((short)1).setCellValue(array[1]+"户");
row2.createCell((short)0).setCellValue("商品房人数");
row2.createCell((short)1).setCellValue(array[1]+"户");
HSSFRow row3 = s.createRow(s.getPhysicalNumberOfRows() );
row3.createCell((short)1).setCellValue("老工房:"+array[2]+"户("+array[3]+"小区)");
row3.createCell((short)1).setCellValue("老工房:"+array[2]+"户("+array[3]+"小区)");
HSSFRow row4 = s.createRow(s.getPhysicalNumberOfRows() );
row4.createCell((short)1).setCellValue("高级商品房:"+array[4]+"户("+array[5]+"小区)");
row4.createCell((short)1).setCellValue("高级商品房:"+array[4]+"户("+array[5]+"小区)");
HSSFRow row5 = s.createRow(s.getPhysicalNumberOfRows() );
row5.createCell((short)1).setCellValue("普通商品房:"+array[6]+"户("+array[7]+"小区)");
row5.createCell((short)1).setCellValue("普通商品房:"+array[6]+"户("+array[7]+"小区)");
s.createRow(s.getPhysicalNumberOfRows());
HSSFRow row6 = s.createRow(s.getPhysicalNumberOfRows() );
row6.createCell((short)0).setCellValue("写字楼人数");
row6.createCell((short)1).setCellValue(array[8]+"人("+array[9]+"个)");
row6.createCell((short)0).setCellValue("写字楼人数");
row6.createCell((short)1).setCellValue(array[8]+"人("+array[9]+"个)");
return wb;
}
@@ -1444,7 +1444,7 @@ public class MapController {
district.setHouseholdCount(count);
district.setAvgPrice(avgPrice);
if(district.getName().endsWith("村")){
if(district.getName().endsWith("村")){
oldHouseCount += count;
oldDistrictCount ++;
}else{
@@ -1460,26 +1460,26 @@ public class MapController {
}
model.setTotalHouseCount(oldHouseCount + hightLevelDistrictHouseCount + commonDistrictHouseCount);//总户数
model.setCommonDistrictHouseCount(commonDistrictHouseCount);//高级商品房户数
model.setHightDistrictHouseCount(hightLevelDistrictHouseCount);//普通户数
model.setTotalHouseCount(oldHouseCount + hightLevelDistrictHouseCount + commonDistrictHouseCount);//总户数
model.setCommonDistrictHouseCount(commonDistrictHouseCount);//高级商品房户数
model.setHightDistrictHouseCount(hightLevelDistrictHouseCount);//普通户数
model.setTotalDistrictCount(oldDistrictCount + commonDistrictCount + hightLevelDistrictCount);//总小区数
model.setCommonDistrictCount(commonDistrictCount);//高级小区数
model.setHightDistrictCount(hightLevelDistrictCount);//普通小区数
model.setTotalDistrictCount(oldDistrictCount + commonDistrictCount + hightLevelDistrictCount);//总小区数
model.setCommonDistrictCount(commonDistrictCount);//高级小区数
model.setHightDistrictCount(hightLevelDistrictCount);//普通小区数
model.setOldHouseCount(oldHouseCount);//老工房 户数
model.setOldDistrictCount(oldDistrictCount);//老工户 小区数
model.setOldHouseCount(oldHouseCount);//老工房 户数
model.setOldDistrictCount(oldDistrictCount);//老工户 小区数
}
return model;
}
private List<DistrictInfoBo> districtNameByStages(List<DistrictInfoBo> districts){
//移除有分期的
//移除有分期的
for(int i=districts.size()-1;i>=0;i--){
DistrictInfoBo district = districts.get(i);
boolean flag = false;
String tempName = district.getName().replace("一期", "").replace("二期", "").replace("三期", "").replace("四期", "").replace("五期", "");
String tempName = district.getName().replace("一期", "").replace("二期", "").replace("三期", "").replace("四期", "").replace("五期", "");
if(!district.getName().equals(tempName)){
for(DistrictInfoBo tempDistrict : districts){
@@ -1523,7 +1523,7 @@ public class MapController {
// }
// }
//
// if(districtKey.getName().endsWith("村")){
// if(districtKey.getName().endsWith("村")){
// oldHouseCount += count;
// oldDistrictCount ++;
// }else{
@@ -1606,7 +1606,7 @@ public class MapController {
private int calLivePecent(String liveDate){
if(StringUtils.isNotBlank(liveDate)){
if(liveDate.equals("暂无资料")){
if(liveDate.equals("暂无资料")){
return 0;
}else{
String start = "";
@@ -1639,9 +1639,9 @@ public class MapController {
private DistrictInfoBo handleOfficeBuildArea(DistrictInfoBo district){
if(StringUtils.isNotBlank(district.getBuildArea())){
String buildArea = district.getBuildArea().replace("暂无资料", "");
String buildArea = district.getBuildArea().replace("暂无资料", "");
if(StringUtils.isNotBlank(buildArea)){
buildArea = patternParse(buildArea, "([0-9\\.]+)[万平方米|平方米|平方|平米|㎡]");
buildArea = patternParse(buildArea, "([0-9\\.]+)[万平方米|平方米|平方|平米|㎡]");
int buildAreaNum = isNumber(buildArea);
if(buildAreaNum > 0){
int houseCount = buildAreaNum/15;
@@ -4,7 +4,7 @@ import com.fangjia.coresite.model.BaseModel;
public class MobileController {
/**
* 手机客户端下载页面
* 手机客户端下载页面
*
* @param model
* @return
@@ -201,11 +201,11 @@ public class NewDistrictController {
//
// feedFooter(model);
//
// // "在售"、"打折"搜索
// // "在售"、"打折"搜索
// processUserConditions(model);
//
// /**
// * gasm统计
// * gasm统计
// */
// model.addGaMap(Gakey.rc, pager.getTotalRows());
// return model;
@@ -233,13 +233,13 @@ public class NewDistrictController {
}
if (null != model.getIfSale() && model.getIfSale() == 1) {
cons.add("在售");
consMap.add(new Item("1", "在售", new Group("ifSale")));
cons.add("在售");
consMap.add(new Item("1", "在售", new Group("ifSale")));
}
if (null != model.getIfDiscount() && model.getIfDiscount() == 1) {
cons.add("打折");
consMap.add(new Item("1", "打折", new Group("ifDiscount")));
cons.add("打折");
consMap.add(new Item("1", "打折", new Group("ifDiscount")));
}
model.setConditions(cons);
@@ -247,12 +247,12 @@ public class NewDistrictController {
}
/**
* 底部热门推荐
* 底部热门推荐
*
* @param model
*/
private void feedFooter(NewDistrictModel model) {
// 底部热门推荐其他小区
// 底部热门推荐其他小区
int maxCount = 20;
int maxRecommendCount = 7;
DistrictQueryBean queryBean = new DistrictQueryBean();
@@ -267,7 +267,7 @@ public class NewDistrictController {
}
model.setFooterDistricts(limit(districtList));
// 底部热门推荐的其他城市
// 底部热门推荐的其他城市
queryBean = new DistrictQueryBean();
FacetQuery facetQuery = new FacetQuery();
facetQuery.setFields(Arrays.asList("city"));
@@ -301,32 +301,32 @@ public class NewDistrictController {
}
/**
* 按时间做Seed获取的随机筛选的区域信息
* 按时间做Seed获取的随机筛选的区域信息
*
* @param 区域菜单信息
* @return 随机筛选的区域信息
* @param 区域菜单信息
* @return 随机筛选的区域信息
*/
private List<DistrictInfo> limit(List<DistrictInfo> districts) {
int needCount = 6;// 获取的数据个数7个
int needCount = 6;// 获取的数据个数7个
int changeDay = 20;// 设置更新频率为20天
int changeDay = 20;// 设置更新频率为20天
int currentCount = districts.size();// 当前获取的Region总数
int currentCount = districts.size();// 当前获取的Region总数
if (currentCount <= needCount)
return districts;
Calendar oldTime = Calendar.getInstance();
oldTime.set(2011, 8, 1);// 初始化时间为2011年09月01日
oldTime.set(2011, 8, 1);// 初始化时间为2011年09月01日
Calendar newTime = Calendar.getInstance();
int reduceDay = SimRandom.getReduceDay(newTime, oldTime);// 获取日期与初始日期相差天数
int reduceDay = SimRandom.getReduceDay(newTime, oldTime);// 获取日期与初始日期相差天数
int seed = (int) reduceDay / changeDay;// 计算simRandom变化频率,20表示20天更新一次
int seed = (int) reduceDay / changeDay;// 计算simRandom变化频率,20表示20天更新一次
List<Integer> simIndexs = SimRandom.getSimRandom(seed, currentCount, needCount);// 获取随机Index
List<Integer> simIndexs = SimRandom.getSimRandom(seed, currentCount, needCount);// 获取随机Index
List<DistrictInfo> ret = new ArrayList<DistrictInfo>(needCount);
for (int index : simIndexs) {
@@ -336,32 +336,32 @@ public class NewDistrictController {
}
/**
* 按时间做Seed获取的随机筛选的区域信息
* 按时间做Seed获取的随机筛选的区域信息
*
* @param 区域菜单信息
* @return 随机筛选的区域信息
* @param 区域菜单信息
* @return 随机筛选的区域信息
*/
private List<Item> getRandomSubList(List<Item> items) {
int needCount = 7;// 获取的数据个数8个
int needCount = 7;// 获取的数据个数8个
int changeDay = 20;// 设置更新频率为20天
int changeDay = 20;// 设置更新频率为20天
int currentCount = items.size();// 当前获取的Region总数
int currentCount = items.size();// 当前获取的Region总数
if (currentCount <= needCount)
return items;
Calendar oldTime = Calendar.getInstance();
oldTime.set(2011, 8, 1);// 初始化时间为2011年09月01日
oldTime.set(2011, 8, 1);// 初始化时间为2011年09月01日
Calendar newTime = Calendar.getInstance();
int reduceDay = SimRandom.getReduceDay(newTime, oldTime);// 获取日期与初始日期相差天数
int reduceDay = SimRandom.getReduceDay(newTime, oldTime);// 获取日期与初始日期相差天数
int seed = (int) reduceDay / changeDay;// 计算simRandom变化频率,20表示20天更新一次
int seed = (int) reduceDay / changeDay;// 计算simRandom变化频率,20表示20天更新一次
List<Integer> simIndexs = SimRandom.getSimRandom(seed, currentCount, needCount);// 获取随机Index
List<Integer> simIndexs = SimRandom.getSimRandom(seed, currentCount, needCount);// 获取随机Index
List<Item> limitedRegions = new ArrayList<Item>(needCount);
for (int index : simIndexs) {
@@ -435,7 +435,7 @@ public class NewDistrictController {
}
/**
* 新房详情页面
* 新房详情页面
*
* @param model
* @return
@@ -460,14 +460,14 @@ public class NewDistrictController {
String city = model.getCity().getDisplay();
// 新盘评论,动态
// 新盘评论,动态
Pager pager = model.getPager(4);
pager.setStartRow(0);
// 新盘评论模块数据
// 新盘评论模块数据
List<DistrictComment> comments = findDistrictComment(pager, city, district.getName(), district.getRegion());
model.setDistrictComments(comments);
// 新盘动态模块数据
// 新盘动态模块数据
List<DistrictDynamics> dynamics = findDistrictDynamics(pager, city, district.getName(), district.getRegion());
model.setDistrictDynamics(dynamics);
@@ -478,7 +478,7 @@ public class NewDistrictController {
}
/**
* 异步获取400号码
* 异步获取400号码
*
* @param model
* @return
@@ -523,7 +523,7 @@ public class NewDistrictController {
}
/**
* 查询新盘动态数据
* 查询新盘动态数据
*
* @return
*/
@@ -536,7 +536,7 @@ public class NewDistrictController {
}
/**
* 查询新盘评论数据
* 查询新盘评论数据
*
* @return
*/
@@ -546,7 +546,7 @@ public class NewDistrictController {
queryBean.setDistrictName(districtName);
queryBean.setRegion(region);
List<DistrictComment> resultList = districtCommentService.findByQueryBeanAndSort(pager, queryBean, "publishDate", false);
// 如果加区域查询出来的楼评为空,去掉区域再查一次
// 如果加区域查询出来的楼评为空,去掉区域再查一次
if (resultList.size() == 0) {
queryBean.setRegion(null);
resultList = districtCommentService.findByQueryBeanAndSort(pager, queryBean, "publishDate", false);
@@ -612,10 +612,10 @@ public class NewDistrictController {
// model.setDistrictPics(subListPics);
}
// 新盘评论是否存在
// 新盘评论是否存在
model.setIfCommentExist(ifCommentExist(district));
// 新盘动态是否存在
// 新盘动态是否存在
DistrictDynamicsQueryBean dynamicsQuery = new DistrictDynamicsQueryBean();
dynamicsQuery.setCategory("district_dynamics");
dynamicsQuery.setCity(district.getCity());
@@ -676,7 +676,7 @@ public class NewDistrictController {
}
/**
* 新盘动态
* 新盘动态
*
* @param model
* @return
@@ -701,7 +701,7 @@ public class NewDistrictController {
//
// Pager pager = model.getPager(20, FangjiaConfig.getConfig().getSearchListMaxPageNo());
//
// // 新盘动态模块数据
// // 新盘动态模块数据
// DistrictDynamicsQueryBean dynamicsQuery = new DistrictDynamicsQueryBean();
// dynamicsQuery.setCategory("district_dynamics");
// dynamicsQuery.setCity(district.getCity());
@@ -719,14 +719,14 @@ public class NewDistrictController {
// .balanceTags(dynamics.getName()))));
// }
//
// newsBo.setPublishDateStr(DateUtil.getHourDateRangeStr(dynamics.getPublishDate(), "yyyy-MM-dd")); // +"更新"
// newsBo.setPublishDateStr(DateUtil.getHourDateRangeStr(dynamics.getPublishDate(), "yyyy-MM-dd")); // +"更新"
// newsBo.setCategory(dynamics.getCategory());
// newsBo.setSummary(NewsServiceImpl.getListSummary(model.getKeyword(), newsBo.getDescription()));
// newsBo.setSummaryNoHtml(DataUtil.removeHtml(DataUtil.balanceTags(newsBo.getSummary())));
// newsBoList.add(newsBo);
// }
//
// // 新盘评论是否存在
// // 新盘评论是否存在
// model.setIfCommentExist(ifCommentExist(district));
//
// pager.setTotalRows(resultList.size());
@@ -741,7 +741,7 @@ public class NewDistrictController {
}
/**
* 判断新盘评论是否存在,先按区域查找,没有再去掉区域查询
* 判断新盘评论是否存在,先按区域查找,没有再去掉区域查询
*
* @param district
* @return
@@ -762,7 +762,7 @@ public class NewDistrictController {
}
/**
* 新盘评论
* 新盘评论
*
* @param model
* @return
@@ -783,7 +783,7 @@ public class NewDistrictController {
Pager pager = model.getPager(20, FangjiaConfig.getConfig().getSearchListMaxPageNo());
// 新盘评论模块数据
// 新盘评论模块数据
DistrictCommentQueryBean commentQuery = new DistrictCommentQueryBean();
commentQuery.setCategory("louping");
commentQuery.setCity(district.getCity());
@@ -792,7 +792,7 @@ public class NewDistrictController {
List<DistrictComment> resultList = districtCommentService.findByQueryBeanAndSort(pager, commentQuery, "publishDate",
false);
// 如果加区域查询出来的楼评为空,去掉区域再查一次
// 如果加区域查询出来的楼评为空,去掉区域再查一次
if (resultList.size() == 0) {
commentQuery.setRegion(null);
resultList = districtCommentService.findByQueryBeanAndSort(pager, commentQuery, "publishDate", false);
@@ -807,14 +807,14 @@ public class NewDistrictController {
.balanceTags(comment.getName()))));
}
newsBo.setPublishDateStr(DateUtil.getHourDateRangeStr(comment.getPublishDate(), "yyyy-MM-dd")); // +"更新"
newsBo.setPublishDateStr(DateUtil.getHourDateRangeStr(comment.getPublishDate(), "yyyy-MM-dd")); // +"更新"
newsBo.setCategory(comment.getCategory());
newsBo.setSummary(NewsServiceImpl.getListSummary(model.getKeyword(), newsBo.getDescription()));
newsBo.setSummaryNoHtml(DataUtil.removeHtml(DataUtil.balanceTags(newsBo.getSummary())));
newsBoList.add(newsBo);
}
// 新盘动态 数据 是否存在
// 新盘动态 数据 是否存在
DistrictDynamicsQueryBean dynamicsQuery = new DistrictDynamicsQueryBean();
dynamicsQuery.setCategory("district_dynamics");
dynamicsQuery.setCity(district.getCity());
@@ -204,7 +204,7 @@ public class NewsController {
Pattern p = Pattern.compile("<script.*>.*</script>", Pattern.DOTALL);
s = p.matcher(s).replaceAll("");
s = s.replaceAll("&nbsp;", " ").replaceAll("[ ]+", " ").replaceAll("<p.*>\\s</p>\\r*\\n*", "").replaceAll(
"<li.*>\\s</li>\\r*\\n*", "").replaceAll("</?a[^>]*>", "").replaceAll("<p>", "<p>  ");
"<li.*>\\s</li>\\r*\\n*", "").replaceAll("</?a[^>]*>", "").replaceAll("<p>", "<p>  ");
StringBuffer sb = new StringBuffer();
boolean isInTag = false;
@@ -254,7 +254,7 @@ public class NewsController {
}
/**
* 进入资讯详情
* 进入资讯详情
*
* @param model
* @return
@@ -277,16 +277,16 @@ public class NewsController {
// model.setNewsBo(newsBo);
//
// /**
// * 用户顶踩信息
// * 用户顶踩信息
// */
// UserFeeling userFeeling = this.userFeelingService.findUserFeeling("news", model.getId());
// model.setUserFeeling(userFeeling);
//
// Pager microBlogPager = new Pager(5);// 微博分页,固定,显示前五条
// Pager microBlogPager = new Pager(5);// 微博分页,固定,显示前五条
// List<MicroBlog> microBlogs = microBlogService.findByKeyWord(microBlogPager, newsBo.getKeywords());
// // sortMicroBlogsByPublishDate(microBlogs);// 按PUBLISHDATE排序微博列表
// // sortMicroBlogsByPublishDate(microBlogs);// 按PUBLISHDATE排序微博列表
// model.setMicroBlogs(microBlogs);
// // 最新上线的城市
// // 最新上线的城市
// List<CityGroup> newCitys = new ArrayList<CityGroup>();
// List<ServerArea> serverAreaList = ServerAreaData.getServerAreaList(10);
// List<String> cityNames = CollectionUtils.collect(serverAreaList, new Closure<String, ServerArea>() {
@@ -306,7 +306,7 @@ public class NewsController {
}
// /**
// * 按PUBLISHDATE排序微博列表
// * 按PUBLISHDATE排序微博列表
// *
// * @param microBlogs
// */
@@ -317,7 +317,7 @@ public class NewsController {
// public int compare(Object firstObj, Object secObj) {
// MicroBlog firstBlog = (MicroBlog) firstObj;
// MicroBlog secBlog = (MicroBlog) secObj;
// // 按时间由近到远排序
// // 按时间由近到远排序
// long diff = firstBlog.getPublishDate().getTime() -
// secBlog.getPublishDate().getTime();
// if (diff > 0) {
@@ -332,7 +332,7 @@ public class NewsController {
// }
/**
* 进入看房日记详情
* 进入看房日记详情
*
* @param model
* @return
@@ -371,11 +371,11 @@ public class NewsController {
// }
//
// model.setNewsBo(newsBo);
// // 用户顶踩信息
// // 用户顶踩信息
// UserFeeling userFeeling = this.userFeelingService.findUserFeeling("news", model.getId());
// model.setUserFeeling(userFeeling);
//
// // 最新上线的城市
// // 最新上线的城市
// List<CityGroup> newCitys = new ArrayList<CityGroup>();
// List<ServerArea> serverAreaList = ServerAreaData.getServerAreaList(10);
// List<String> cityNames = CollectionUtils.collect(serverAreaList, new Closure<String, ServerArea>() {
@@ -397,7 +397,7 @@ public class NewsController {
}
/**
* 进入新盘评论
* 进入新盘评论
*
* @param model
* @return
@@ -422,7 +422,7 @@ public class NewsController {
}
/**
* 进入新盘动态
* 进入新盘动态
*
* @param model
* @return
@@ -436,7 +436,7 @@ public class NewsController {
//
// String sortField = null;
// // if (isOrderByTime(model.getKeyword(), model.getSort())) {
// // 排序条件不存在时按时间排序
// // 排序条件不存在时按时间排序
// if (StringUtils.isBlank(model.getSort()) || "1".equals(model.getSort())) {
// sortField = "publishDate";
// model.setSort("1");
@@ -471,17 +471,17 @@ public class NewsController {
// newsBo.setName(news.getName());
// }
// if (null != news.getPublishDate()) {
// // 当天的资讯,时间显示为“**小时前更新”
// // 当天的资讯,时间显示为“**小时前更新”
// if (news.getPublishDate().after(range[0]) && news.getPublishDate().before(range[1])) {
// int diffHour = DateUtil.getHour(new Date()) - DateUtil.getHour(news.getPublishDate());
// if (diffHour > 0) {
// newsBo.setPublishDateStr(diffHour + "小时前更新");
// newsBo.setPublishDateStr(diffHour + "小时前更新");
// } else {
// int diffMinute = DateUtil.getMinute(new Date()) - DateUtil.getMinute(news.getPublishDate());
// if (diffMinute <= 0) {
// diffMinute = 1;
// }
// newsBo.setPublishDateStr(diffMinute + "分钟前更新");
// newsBo.setPublishDateStr(diffMinute + "分钟前更新");
// }
//
// } else {
@@ -496,7 +496,7 @@ public class NewsController {
// model.setNewsBoList(newsBoList);
// model.setPager(pager);
//
// // 最新上线的城市
// // 最新上线的城市
// List<CityGroup> newCitys = new ArrayList<CityGroup>();
// List<ServerArea> serverAreaList = ServerAreaData.getServerAreaList(10);
// List<String> cityNames = CollectionUtils.collect(serverAreaList, new Closure<String, ServerArea>() {
@@ -515,14 +515,14 @@ public class NewsController {
// model.setIpCityUrl(model.getCityUrl(model.getIpCity().getDisplay()));
//
// /**
// * gasm统计
// * gasm统计
// */
// model.addGaMap(Gakey.rc, pager.getTotalRows());
return model.redirectPermanently("/");
}
/**
* 新闻列表
* 新闻列表
*
* @param model
* @return
@@ -533,10 +533,10 @@ public class NewsController {
}
/**
* 获取当前城市
* 获取当前城市
*
* @param request
* @return 当前城市
* @return 当前城市
*/
private ServerArea getSuggestCity(HttpServletRequest request) {
String ip = AnalyticsUtil.getIpAddress(request);
@@ -553,7 +553,7 @@ public class NewsController {
}
/**
* 新闻列表
* 新闻列表
*
* @param model
* @return
@@ -564,7 +564,7 @@ public class NewsController {
}
/**
* 新闻预览
* 新闻预览
*
* @param model
* @return
@@ -575,7 +575,7 @@ public class NewsController {
}
/**
* 新闻预览测试页面
* 新闻预览测试页面
*
* @param model
* @return
@@ -593,7 +593,7 @@ public class NewsController {
}
/**
* 根据关键字显示走势
* 根据关键字显示走势
*
* @param model
* @param request
@@ -605,7 +605,7 @@ public class NewsController {
}
/**
* 取得板块的信息
* 取得板块的信息
*
* @param suggestCity
* @param blockList
@@ -616,8 +616,8 @@ public class NewsController {
if (CollectionUtils.isEmpty(blockList)) {
return null;
}
// {block={_matcher_value=田林, pattern=[田林], value=田林,
// extra_data={region=徐汇, city=上海}}}
// {block={_matcher_value=田林, pattern=[田林], value=田林,
// extra_data={region=徐汇, city=上海}}}
Map<String, Object> blockMap = new HashMap<String, Object>();
boolean ipFindCity = false;
if (null != suggestCity) {
@@ -654,7 +654,7 @@ public class NewsController {
}
/**
* 取得区域的信息
* 取得区域的信息
*
* @param suggestCity
* @return
@@ -664,8 +664,8 @@ public class NewsController {
if (CollectionUtils.isEmpty(regionList)) {
return null;
}
// {region=[{_matcher_value=徐汇, pattern=[徐汇], value=徐汇,
// extra_data={city=上海}}]}
// {region=[{_matcher_value=徐汇, pattern=[徐汇], value=徐汇,
// extra_data={city=上海}}]}
boolean ipFindCity = false;
Map<String, Object> region = new HashMap<String, Object>();
if (null != suggestCity) {
@@ -699,7 +699,7 @@ public class NewsController {
}
/**
* 取得小区信息
* 取得小区信息
*
* @param suggestCity
* @param districtList
@@ -56,11 +56,11 @@ public class PersonalcenterController {
private ApiUserAccountService apiUserAccountService;
public Object indexAction(PersonalcenterModel model, HttpServletRequest req) {
//判断是否登录
//判断是否登录
// long userId = 211108;
String userId = LoginUtil.getUserId(req);
FangJiaUser fangJiaUser = fangJiaUserService.getUserById(userId);
//未登录或无此用户
//未登录或无此用户
if(fangJiaUser == null) {
return model;
}
@@ -70,7 +70,7 @@ public class PersonalcenterController {
model.setAmount(amount);
PaymentModel paymentModel = new PaymentModel();
paymentModel.setBody("购买房豆");
paymentModel.setBody("购买房豆");
paymentModel.setReturn_url(model.getCityUrl()+"/personalcenter/paySuccess");
paymentModel.setOut_trade_no("");
@@ -78,7 +78,7 @@ public class PersonalcenterController {
paymentModel.setPayment_type("1");
paymentModel.setSeller_email(AlipayConfig.alipayEmail);
paymentModel.setService(AlipayConfig.service);
paymentModel.setSubject("购买房豆");
paymentModel.setSubject("购买房豆");
paymentModel.setTotal_fee("0.01");
paymentModel.setShow_url("");
paymentModel.setPaymethod("bankPay");
@@ -96,7 +96,7 @@ public class PersonalcenterController {
public Object rechargeHistoryAction(HttpServletRequest req, RechargeHistoryModel model) {
long userId = NumberUtils.toLong(LoginUtil.getUserId(req), -1);
//未登录或无此用户
//未登录或无此用户
if(!isLogined(userId)) {
return model;
}
@@ -117,11 +117,11 @@ public class PersonalcenterController {
for (String key : keys) {
sb.append("&"+key+"="+request.getParameter(key));
if (!(key.equals("sign_type") || key.equals("sign"))) {
// 除去sign和sign_type两个参数
// 除去sign和sign_type两个参数
params_sign.put(key, request.getParameter(key));
}
}
LOGGER.info("支付宝回调:" + request.getRequestURL() + "?" + sb.substring(1));
LOGGER.info("支付宝回调:" + request.getRequestURL() + "?" + sb.substring(1));
String alipayKey = AlipayConfig.alipayKey;
String sign = Alipayment.CreateUrl(params_sign, alipayKey);
if (!sign.equals(request.getParameter("sign"))) {
@@ -157,10 +157,10 @@ public class PersonalcenterController {
data.put("status", "success");
purchaseRecordService.updateById(purchaseRecord.getId(), data);
//增加房豆
/*fjtUsersService.addGold(purchaseRecord.getUserId(), purchaseRecord.getNumber(), "充值");
//增加房豆
/*fjtUsersService.addGold(purchaseRecord.getUserId(), purchaseRecord.getNumber(), "充值");
//未设置支付密码
//未设置支付密码
if(StringUtils.isBlank(usersInfoService.getPayPassword(purchaseRecord.getUserId()))) {
return model.redirect("/api/setPassword");
}*/
@@ -175,13 +175,13 @@ public class PersonalcenterController {
paymentModel.setViewParam("config", null);
DecimalFormat df = new DecimalFormat("0.00");
//判断是否登录
//判断是否登录
// long userId = 22L;
long userId = NumberUtils.toLong(LoginUtil.getUserId(request), -1);
//未登录或无此用户
//未登录或无此用户
if(!isLogined(userId)) {
JsonModel resultModel = new JsonModel();
resultModel.setJsonModel(ImmutableMap.of("status", "not_login", "msg", "未登录"));
resultModel.setJsonModel(ImmutableMap.of("status", "not_login", "msg", "未登录"));
return resultModel;
}
@@ -191,20 +191,20 @@ public class PersonalcenterController {
String key = AlipayConfig.alipayKey;
String partner = AlipayConfig.alipayPartner;
String seller_email = AlipayConfig.alipayEmail;
String out_trade_no = ObjectId.get().toString();//生成订单号
String service = paymentModel.getService();// 快速付款交易服务
String payment_type = "1";// 支付宝类型.1代表商品购买
String paymethod = "bankPay";// 赋值:bankPay(网银);cartoon(卡通);
String out_trade_no = ObjectId.get().toString();//生成订单号
String service = paymentModel.getService();// 快速付款交易服务
String payment_type = "1";// 支付宝类型.1代表商品购买
String paymethod = "bankPay";// 赋值:bankPay(网银);cartoon(卡通);
String defaultbank = paymentModel.getDefaultbank();
if("AliPay".equalsIgnoreCase(defaultbank)) {
paymethod = "";
}
//计算出购买房豆的总价
//计算出购买房豆的总价
int totalCost = getTotalCost(personalcenterModel);
total_fee = df.format(totalCost);
body = "购买房豆";
subject = "购买房豆";
body = "购买房豆";
subject = "购买房豆";
return_url = paymentModel.getCityUrl() + "/personalcenter/paySuccess";// AlipayConfig.return_url;
/*notify_url = "http://local153.fangjia.com:4082/fangjia-coresite/recharge/buySuccess";*/
// return_url = "http://local153.fangjia.com:4082/fangjia-coresite/personalcenter/paySuccess";
@@ -217,11 +217,11 @@ public class PersonalcenterController {
if (ip.equals("116.247.70.58") || FangjiaConfig.getConfig().isTestEnvironment() || FangjiaConfig.getConfig().isDevelopmentEnvironment()) {
total_fee = "0.01";
paymentModel.setTotal_fee("0.01");
paymentModel.setPrice("0.01");// 公司测试ip
paymentModel.setPrice("0.01");// 公司测试ip
}
if(StringUtils.isBlank(defaultbank)) {
throw new Exception("请选择支付渠道");
throw new Exception("请选择支付渠道");
}
// CacheUtils.putValue(CacheUtils.CachePolicyEnum.SHORT, PersonalcenterController.class, out_trade_no, System.currentTimeMillis());
@@ -253,14 +253,14 @@ public class PersonalcenterController {
paymentModel.setTotal_fee(total_fee);
paymentModel.setOut_trade_no(out_trade_no);
//API购买需要入库,并且状态设置为待支付
//API购买需要入库,并且状态设置为待支付
// recordPurchase(userId, new BigDecimal(totalCost), getTotalFd(personalcenterModel), out_trade_no, new Date(), defaultbank, "pending");
return paymentModel;
}
/**
* 余额支付
* 余额支付
* @param request
* @param model
* @param personalcenterModel
@@ -269,17 +269,17 @@ public class PersonalcenterController {
*/
public Object buySubmitAction(HttpServletRequest request, RechargeModel model, PersonalcenterModel personalcenterModel) throws Exception {
JsonModel resultModel = new JsonModel();
//1.判断是否登录
//1.判断是否登录
String userId = LoginUtil.getUserId(request);
FangJiaUser fangJiaUser = fangJiaUserService.getUserById(userId);
//未登录或无此用户 or未创建API用户
//2.判断是否已经创建api_user,没有则创建
//未登录或无此用户 or未创建API用户
//2.判断是否已经创建api_user,没有则创建
if(StringUtils.isBlank(userId) || fangJiaUser==null) {
resultModel.setJsonModel(ImmutableMap.of("status", "account_not_exists", "msg", Message.ACCOUNT_NOT_EXISTS));
return resultModel;
}
//判断验证码的正确性
//判断验证码的正确性
String cacheCode = (String) CacheUtils.getValue(UsersInfoService.class, model.getPhone() + "_" + Message.SMS_CODE_TYPE_PAY);
if (cacheCode == null) {
resultModel.setJsonModel(ImmutableMap.of("status", "not_send", "msg", Message.MOBILE_NOT_SEND_CODE));
@@ -289,69 +289,69 @@ public class PersonalcenterController {
resultModel.setJsonModel(ImmutableMap.of("status", "code_error", "msg", Message.CODE_ERROR));
return resultModel;
}
//判断支付密码的正确性
//判断支付密码的正确性
String savedPwd = fangJiaUser.getPayPassword();
//未设置支付密码
//未设置支付密码
if (StringUtils.isBlank(savedPwd)) {
resultModel.setJsonModel(ImmutableMap.of("status", "no_pay_password", "msg", Message.NOT_SET_PAY_PASSWORD));
return resultModel;
}
//支付密码不正确
//支付密码不正确
if (!savedPwd.equals(DigestUtils.md5Hex(model.getPassword()))) {
resultModel.setJsonModel(ImmutableMap.of("status", "pay_password_error", "msg", Message.PAY_PASSWORD_ERROR));
return resultModel;
}
//判断余额
//判断余额
BigDecimal amount = apiUserAccountService.findAmountByUserId(userId);
int totalCost = getTotalCost(personalcenterModel);
int totalFd = getTotalFd(personalcenterModel);
if(totalCost<=0 || totalFd<=0) {
resultModel.setJsonModel(ImmutableMap.of("status", "fail", "msg", "操作不合法"));
resultModel.setJsonModel(ImmutableMap.of("status", "fail", "msg", "操作不合法"));
return resultModel;
}
if(amount.compareTo(new BigDecimal(totalCost)) < 0) {
resultModel.setJsonModel(ImmutableMap.of("status", "insufficient_balance", "msg", "余额不足"));
resultModel.setJsonModel(ImmutableMap.of("status", "insufficient_balance", "msg", "余额不足"));
return resultModel;
}
//验证完毕,代表购买成功:
//保存购买记录
//验证完毕,代表购买成功:
//保存购买记录
Date now = new Date();
recordPurchase(userId, new BigDecimal(totalCost), totalFd, ObjectId.get().toString(), now, "余额", "success");
//增加房豆
// fjtUsersService.addGold(userId, totalFd, "充值");
//扣减余额
recordPurchase(userId, new BigDecimal(totalCost), totalFd, ObjectId.get().toString(), now, "余额", "success");
//增加房豆
// fjtUsersService.addGold(userId, totalFd, "充值");
//扣减余额
ApiUserAccount apiUserAccount = new ApiUserAccount();
apiUserAccount.setUserId(userId);
apiUserAccount.setChange(new BigDecimal(totalCost).multiply(new BigDecimal("-1")));
apiUserAccount.setAmount(amount.subtract(new BigDecimal(totalCost)));
apiUserAccount.setCreateDate(now);
apiUserAccount.setChangeWay("线上");
apiUserAccount.setChangeWay("线上");
apiUserAccount.setStatus("success");
apiUserAccountService.saveApiUserAccount(apiUserAccount);
//4.购买成功
resultModel.setJsonModel(ImmutableMap.of("status", "success", "msg", "操作成功"));
//4.购买成功
resultModel.setJsonModel(ImmutableMap.of("status", "success", "msg", "操作成功"));
return resultModel;
}
/**
* 发送短信验证码
* 发送短信验证码
* @param model
* @param resultModel
* @return
*/
public Object sendSmsAction(HttpServletRequest request, RechargeModel model, SendCodeJsonModel resultModel) throws Exception {
//判断是否登录
//判断是否登录
long userId = NumberUtils.toLong(LoginUtil.getUserId(request), -1);
//未登录或无此用户
//未登录或无此用户
if(!isLogined(userId)) {
resultModel.setResult(Message.RESULT_FAIL);
resultModel.setMsg(Message.NOT_LOGIN);
return resultModel;
}
//检测支付密码是否正确
//检测支付密码是否正确
String savedPwd = usersInfoService.getPayPassword(userId);
if(StringUtils.isBlank(savedPwd)) {
resultModel.setResult(Message.RESULT_FAIL);
@@ -365,7 +365,7 @@ public class PersonalcenterController {
}
Long sendCodeTime = (Long) CacheUtils.getValue(UsersInfoService.class, model.getPhone() + "_" + model.getType() + "_time");
//验证码一分钟只能发一次
//验证码一分钟只能发一次
if(sendCodeTime != null) {
if(new Date().getTime() - sendCodeTime < 60 * 1000) {
resultModel.setResult(Message.RESULT_FAIL);
@@ -375,7 +375,7 @@ public class PersonalcenterController {
}
String code = usersInfoService.randomCode();
try {
smsService.send(model.getPhone(), "【房价网】你的验证码是" + code + ",验证码5分钟内有效,请立即验证。");
smsService.send(model.getPhone(), "【房价网】你的验证码是" + code + ",验证码5分钟内有效,请立即验证。");
resultModel.setResult(Message.RESULT_SUCCESS);
CacheUtils.putValue(CacheUtils.CachePolicyEnum.TINY, UsersInfoService.class, model.getPhone() + "_" + model.getType(), code);
CacheUtils.putValue(CacheUtils.CachePolicyEnum.SMALL, UsersInfoService.class, model.getPhone() + "_" + model.getType() + "_time", new Date().getTime());
@@ -387,10 +387,10 @@ public class PersonalcenterController {
}
public Object setPasswordAction(HttpServletRequest req, RechargeModel model) throws Exception {
//判断是否登录
//判断是否登录
long userId = NumberUtils.toLong(LoginUtil.getUserId(req), -1);
JsonModel jsonModel = new JsonModel();
//未登录或无此用户
//未登录或无此用户
if(!"post".equalsIgnoreCase(req.getMethod())) {
return model;
}
@@ -406,7 +406,7 @@ public class PersonalcenterController {
}
/**
* 判断是否登录
* 判断是否登录
* @param userId
* @return
*/
@@ -418,21 +418,21 @@ public class PersonalcenterController {
}
/**
* 获取总花费
* 获取总花费
* @return
*/
private int getTotalCost(PersonalcenterModel model) {
int total = 0;
if(model.getTc1() != null) {// 1元/1房豆
if(model.getTc1() != null) {// 1元/1房豆
total += model.getTc1() * 1;
}
if(model.getTc2() != null) {// 30元/35房豆
if(model.getTc2() != null) {// 30元/35房豆
total += model.getTc2() * 30;
}
if(model.getTc3() != null) {// 50元/58房豆
if(model.getTc3() != null) {// 50元/58房豆
total += model.getTc3() * 50;
}
if(model.getTc4() != null) {// 100元/150房豆
if(model.getTc4() != null) {// 100元/150房豆
total += model.getTc4() * 100;
}
@@ -440,22 +440,22 @@ public class PersonalcenterController {
}
/**
* 获取购买的房豆总数
* 获取购买的房豆总数
* @param model
* @return
*/
private int getTotalFd(PersonalcenterModel model) {
int total = 0;
if(model.getTc1() != null) {// 1元/1房豆
if(model.getTc1() != null) {// 1元/1房豆
total += model.getTc1() * 1;
}
if(model.getTc2() != null) {// 30元/35房豆
if(model.getTc2() != null) {// 30元/35房豆
total += model.getTc2() * 35;
}
if(model.getTc3() != null) {// 50元/58房豆
if(model.getTc3() != null) {// 50元/58房豆
total += model.getTc3() * 58;
}
if(model.getTc4() != null) {// 100元/150房豆
if(model.getTc4() != null) {// 100元/150房豆
total += model.getTc4() * 150;
}
@@ -463,16 +463,16 @@ public class PersonalcenterController {
}
/**
* 增加购买记录
* 增加购买记录
*/
private void recordPurchase(String userId, BigDecimal totalCost, int totalFd, String orderNumber, Date date, String defaultbank, String status) {
PurchaseRecord purchaseRecord = new PurchaseRecord();
purchaseRecord.setCreateTime(date);
purchaseRecord.setUserId(userId);
purchaseRecord.setStatus(status);
purchaseRecord.setChannel("线上");
purchaseRecord.setTotalFee(totalCost);//总花费
purchaseRecord.setNumber(totalFd);//购买的房豆数
purchaseRecord.setChannel("线上");
purchaseRecord.setTotalFee(totalCost);//总花费
purchaseRecord.setNumber(totalFd);//购买的房豆数
purchaseRecord.setOrderNumber(orderNumber);
purchaseRecord.setBankCode(defaultbank);
purchaseRecord.setCat("fd");
@@ -28,14 +28,14 @@ public class PriceSubscribeController {
PriceSubscribe subscribe = new PriceSubscribe();
String email = StringUtils.trimToNull(model.getEmail());
if (StringUtils.isBlank(email)) {
model.setRetMsg("请输入订阅邮箱地址!");
model.setRetMsg("请输入订阅邮箱地址!");
return model;
}
Pattern p = Pattern.compile("\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*");
Matcher m = p.matcher(email);
if (!m.matches()) {
model.setRetMsg("邮箱地址不合法!");
model.setRetMsg("邮箱地址不合法!");
return model;
}
@@ -61,7 +61,7 @@ public class PriceSubscribeController {
subscribe.setUserId(getLoginedUserId(model));
priceSubscribeService.saveSubscribe(subscribe);
model.setRetMsg("订阅成功!");
model.setRetMsg("订阅成功!");
return model;
}
@@ -5,7 +5,7 @@ import com.fangjia.coresite.model.FangjiaModel;
public class ProductController {
/**
* PDS介绍
* PDS介绍
* @param model
* @return
*/
@@ -14,7 +14,7 @@ public class ProductController {
}
/**
* AMP介绍
* AMP介绍
* @param model
* @return
*/
@@ -23,7 +23,7 @@ public class ProductController {
}
/**
* 房价通介绍
* 房价通介绍
* @param model
* @return
*/
@@ -52,9 +52,9 @@ import java.util.*;
public class RechargeController {
private final static Logger LOGGER = LoggerFactory.getLogger(RechargeController.class);
private final static String APIPURCHASE_SUCCESS = "success";//支付成功
private final static String APIPURCHASE_FAIL = "fail";//支付失败
private final static String APIPURCHASE_PENDING = "pending";//待支付
private final static String APIPURCHASE_SUCCESS = "success";//支付成功
private final static String APIPURCHASE_FAIL = "fail";//支付失败
private final static String APIPURCHASE_PENDING = "pending";//待支付
private UsersService usersService;
private ApiUserAccountService apiUserAccountService;
@@ -69,15 +69,15 @@ public class RechargeController {
private ApiDetailService apiDetailService;
private FangJiaUserService fangJiaUserService;
/**
* 短信Service
* 短信Service
*/
private SmsService smsService;
public Object prechargePayAction(HttpServletRequest req, RechargeModel model) throws Exception {
DecimalFormat df = new DecimalFormat("0.00");
//判断是否登录
//判断是否登录
String userId = LoginUtil.getUserId(req);
//未登录或无此用户
//未登录或无此用户
FangJiaUser fangJiaUser = fangJiaUserService.getUserById(userId);
if(fangJiaUser == null) {
return model;
@@ -85,7 +85,7 @@ public class RechargeController {
model.setUserId(userId);
model.setLogined(true);
model.setTabTitle(apiService.getTabTitle(userId+""));
//返回账户余额和产品的单价
//返回账户余额和产品的单价
BigDecimal amount = apiUserAccountService.findAmountByUserId(userId);
//
List<ApiProduct> apiProducts = apiProductService.findAllAvailable();
@@ -94,9 +94,9 @@ public class RechargeController {
model.setAmount(df.format(amount));
model.setProducts(apiProducts);
String out_trade_no = ObjectId.get().toString();// 请与贵网站订单系统中的唯一订单号匹配
String out_trade_no = ObjectId.get().toString();// 请与贵网站订单系统中的唯一订单号匹配
PaymentModel paymentModel = new PaymentModel();
paymentModel.setBody("API账户充值");
paymentModel.setBody("API账户充值");
paymentModel.setNotify_url(model.getCityUrl()+"/recharge/paySuccess1");
paymentModel.setReturn_url(model.getCityUrl()+"/recharge/paySuccess");
/*paymentModel.setNotify_url("http://local153.fangjia.com:4082/fangjia-coresite/recharge/paySuccess");
@@ -107,7 +107,7 @@ public class RechargeController {
paymentModel.setPayment_type("1");
paymentModel.setSeller_email(AlipayConfig.alipayEmail);
paymentModel.setService(AlipayConfig.service);
paymentModel.setSubject("API账户充值");
paymentModel.setSubject("API账户充值");
paymentModel.setTotal_fee("0.01");
paymentModel.setShow_url("");
paymentModel.setPaymethod("bankPay");
@@ -128,27 +128,27 @@ public class RechargeController {
model.setViewParam("config", null);
DecimalFormat df = new DecimalFormat("0.00");
//判断是否登录
//判断是否登录
String userId = LoginUtil.getUserId(request);
//未登录或无此用户
//未登录或无此用户
if(StringUtils.isBlank(userId)) {
JsonModel resultModel = new JsonModel();
resultModel.setJsonModel(ImmutableMap.of("status", "not_login", "msg", "未登录"));
resultModel.setJsonModel(ImmutableMap.of("status", "not_login", "msg", "未登录"));
return resultModel;
}
//计算出购买接口的总价
BigDecimal totalCost = new BigDecimal(0);//购买接口的总花费
//计算出购买接口的总价
BigDecimal totalCost = new BigDecimal(0);//购买接口的总花费
List<ApiPurchaseRecord> apiPurchaseRecords = Lists.newArrayList();
String total_fee, body, subject, notify_url, return_url;
String input_charset = AlipayConfig.input_charset;
String key = AlipayConfig.alipayKey;
String partner = AlipayConfig.alipayPartner;
String seller_email = AlipayConfig.alipayEmail;
String out_trade_no = ObjectId.get().toString();//生成订单号
String service = model.getService();// 快速付款交易服务
String payment_type = "1";// 支付宝类型.1代表商品购买
String paymethod = "bankPay";// 赋值:bankPay(网银);cartoon(卡通);
String out_trade_no = ObjectId.get().toString();//生成订单号
String service = model.getService();// 快速付款交易服务
String payment_type = "1";// 支付宝类型.1代表商品购买
String paymethod = "bankPay";// 赋值:bankPay(网银);cartoon(卡通);
String defaultbank = model.getDefaultbank();
if("AliPay".equalsIgnoreCase(defaultbank)) {
paymethod = "";
@@ -160,7 +160,7 @@ public class RechargeController {
BigDecimal price = apiProductService.getPriceBySubcode(entry.getKey());
if (price == null) {
JsonModel resultModel = new JsonModel();
resultModel.setJsonModel(ImmutableMap.of("status", "not_find_product", "msg", "不存在此产品"));
resultModel.setJsonModel(ImmutableMap.of("status", "not_find_product", "msg", "不存在此产品"));
return resultModel;
}
BigDecimal cost = price.multiply(new BigDecimal(1000)).multiply(new BigDecimal(entry.getValue()));
@@ -172,8 +172,8 @@ public class RechargeController {
apiPurchaseRecords.add(apiPurchaseRecord);
}
total_fee = df.format(totalCost);
body = "API购买";
subject = "API购买";
body = "API购买";
subject = "API购买";
notify_url = model.getCityUrl() + "/recharge/buySuccess1";
return_url = model.getCityUrl() + "/recharge/buySuccess";// AlipayConfig.return_url;
/*notify_url = "http://local153.fangjia.com:4082/fangjia-coresite/recharge/buySuccess";
@@ -183,9 +183,9 @@ public class RechargeController {
model.setNotify_url(notify_url);
model.setReturn_url(return_url);
} else {
total_fee = df.format(new BigDecimal(model.getPrice())); // 订单总价
body = "API账户充值"; // 商品描述,推荐格式:商品名称(订单编号:订单编号)
subject = "API账户充值"; // 商品名称
total_fee = df.format(new BigDecimal(model.getPrice())); // 订单总价
body = "API账户充值"; // 商品描述,推荐格式:商品名称(订单编号:订单编号)
subject = "API账户充值"; // 商品名称
notify_url = model.getCityUrl() + "/recharge/paySuccess1";
return_url = model.getCityUrl() + "/recharge/paySuccess";// AlipayConfig.return_url;
CacheUtils.putValue(CacheUtils.CachePolicyEnum.MIDDLE, RechargeController.class, out_trade_no, System.currentTimeMillis());
@@ -198,7 +198,7 @@ public class RechargeController {
ApiUserAccount apiUserAccount = new ApiUserAccount();
apiUserAccount.setUserId(userId);
apiUserAccount.setChangeWay("线上");
apiUserAccount.setChangeWay("线上");
apiUserAccount.setChannel(model.getDefaultbank());
apiUserAccount.setOutTradeNo(out_trade_no);
apiUserAccount.setStatus("pending");
@@ -212,21 +212,21 @@ public class RechargeController {
if (ip.equals("116.247.70.58") || FangjiaConfig.getConfig().isTestEnvironment() || FangjiaConfig.getConfig().isDevelopmentEnvironment()) {
total_fee = "0.01";
model.setTotal_fee("0.01");
model.setPrice("0.01");// 公司测试ip
model.setPrice("0.01");// 公司测试ip
}
if(NumberUtils.createBigDecimal(total_fee).compareTo(new BigDecimal(0)) <= 0) {
if("charge".equalsIgnoreCase(model.getPayUsage())) {
throw new Exception("充值金额不合法");
throw new Exception("充值金额不合法");
} else if("buy".equalsIgnoreCase(model.getPayUsage())) {
throw new Exception("未选择需购买的字段");
throw new Exception("未选择需购买的字段");
}
}
if(StringUtils.isBlank(defaultbank)) {
throw new Exception("请选择支付渠道");
throw new Exception("请选择支付渠道");
}
/*//首先保存记录到数据库,交易状态设置为待支付,回调成功后修改状态为支付成功或失败
apiUserAccountService.savePendingRecharge(getLoginedUserId(model), total_fee, "线上", defaultbank);*/
/*//首先保存记录到数据库,交易状态设置为待支付,回调成功后修改状态为支付成功或失败
apiUserAccountService.savePendingRecharge(getLoginedUserId(model), total_fee, "线上", defaultbank);*/
Map<String, String> params = new HashMap<String, String>();
params.put("service", service);
@@ -251,18 +251,18 @@ public class RechargeController {
params.put("quantity", "1");
}
Map<String, String> sPara = AlipayFunction.ParaFilter(params);
//生成签名结果
//生成签名结果
String ItemUrl = Alipayment.CreateUrl(sPara, key);
model.setItemUrl(ItemUrl);
model.setTotal_fee(total_fee);
model.setOut_trade_no(out_trade_no);
//API购买需要入库,并且状态设置为待支付
//API购买需要入库,并且状态设置为待支付
if(apiPurchaseRecords != null && apiPurchaseRecords.size() > 0) {
Date purchaseDate = new Date();
for (ApiPurchaseRecord apiPurchaseRecord : apiPurchaseRecords) {
apiPurchaseRecord.setOrderDate(purchaseDate);
apiPurchaseRecord.setChannel("线上");
apiPurchaseRecord.setChannel("线上");
apiPurchaseRecord.setOrderNumber(out_trade_no);
apiPurchaseRecord.setUserId(userId);
apiPurchaseRecord.setStatus(APIPURCHASE_PENDING);
@@ -275,7 +275,7 @@ public class RechargeController {
}
/**
* 购买接口回调
* 购买接口回调
* @param request
* @param model
* @return
@@ -288,11 +288,11 @@ public class RechargeController {
for (String key : keys) {
sb.append("&"+key+"="+request.getParameter(key));
if (!(key.equals("sign_type") || key.equals("sign"))) {
// 除去sign和sign_type两个参数
// 除去sign和sign_type两个参数
params_sign.put(key, request.getParameter(key));
}
}
LOGGER.info("支付宝回调:" + request.getRequestURL() + "?" + sb.substring(1));
LOGGER.info("支付宝回调:" + request.getRequestURL() + "?" + sb.substring(1));
String alipayKey = AlipayConfig.alipayKey;
String sign = Alipayment.CreateUrl(params_sign, alipayKey);
if (!sign.equals(request.getParameter("sign"))) {
@@ -304,15 +304,15 @@ public class RechargeController {
return Models.NOT_FOUNT;
}
//修改订单状态
//修改订单状态
apiPurchaseRecordService.updateStatusByTradeNo(request.getParameter("out_trade_no"), APIPURCHASE_SUCCESS);
List<ApiPurchaseRecord> apiPurchaseRecords = apiPurchaseRecordService.findAllByTradeNo(request.getParameter("out_trade_no"));
String clientIP = AnalyticsUtil.getIpAddress(request);
//增加api调用次数
//增加api调用次数
for(ApiPurchaseRecord apiPurchaseRecord : apiPurchaseRecords) {
Long apiUserId = createApiUser(apiPurchaseRecord.getUserId(), "");
//更新次数
//更新次数
apiUserAuthorityService.increaseVisitCount(apiUserId, "/property/transaction", apiPurchaseRecord.getSubServiceCode(), apiPurchaseRecord.getNumber(), new SimpleDateFormat("yyyy").parse("2099"));
}
@@ -320,15 +320,15 @@ public class RechargeController {
}
/**
* 创建APIUser
* @param userId 房价网userId
* @param ip 白名单
* @return 创建的APIUser的id
* 创建APIUser
* @param userId 房价网userId
* @param ip 白名单
* @return 创建的APIUser的id
* @throws Exception
*/
private Long createApiUser(String userId, String ip) throws Exception {
Long apiUserId;
//创建或更改API-USER的状态
//创建或更改API-USER的状态
FangJiaUser fjuser = fangJiaUserService.getUserById(userId);
User old = userService.findByUserId(userId);
if(old == null) {
@@ -363,7 +363,7 @@ public class RechargeController {
}
/**
* 充值回调
* 充值回调
* @param request
* @param model
* @return
@@ -376,11 +376,11 @@ public class RechargeController {
for (String key : keys) {
sb.append("&"+key+"="+request.getParameter(key));
if (!(key.equals("sign_type") || key.equals("sign"))) {
// 除去sign和sign_type两个参数
// 除去sign和sign_type两个参数
params_sign.put(key, request.getParameter(key));
}
}
LOGGER.info("支付宝回调:" + request.getRequestURL() + "?" + sb.substring(1));
LOGGER.info("支付宝回调:" + request.getRequestURL() + "?" + sb.substring(1));
String alipayKey = AlipayConfig.alipayKey;
String sign = Alipayment.CreateUrl(params_sign, alipayKey);
if (!sign.equals(request.getParameter("sign"))) {
@@ -404,7 +404,7 @@ public class RechargeController {
userId = LoginUtil.getUserId(request);
} else {
userId = apiUserAccount.getUserId();
//订单已经支付
//订单已经支付
if("success".equalsIgnoreCase(apiUserAccount.getStatus())) {
return Models.NOT_FOUNT;
}
@@ -425,7 +425,7 @@ public class RechargeController {
apiUserAccountService.updateByUserId(userId, data);
FangJiaUser fangjiaUser = fangJiaUserService.getUserById(userId);
//未设置支付密码
//未设置支付密码
if(fangjiaUser == null || StringUtils.isBlank(fangjiaUser.getPassword())) {
return model.redirect("/api/setPassword");
}
@@ -438,30 +438,30 @@ public class RechargeController {
public Object buySubmitAction(HttpServletRequest request, RechargeModel model) throws Exception {
JsonModel resultModel = new JsonModel();
Map<String, String> buyProducts = DataUtil.stringToMap(model.getBuyProducts(), ",", "__");
//1.判断是否登录
//1.判断是否登录
String userId = LoginUtil.getUserId(request);
//未登录或无此用户 or未创建API用户
//2.判断是否已经创建api_user,没有则创建
//未登录或无此用户 or未创建API用户
//2.判断是否已经创建api_user,没有则创建
FangJiaUser fangjiaUser = fangJiaUserService.getUserById(userId);
if(fangjiaUser==null) {
resultModel.setJsonModel(ImmutableMap.of("status", "account_not_exists", "msg", Message.ACCOUNT_NOT_EXISTS));
return resultModel;
}
// User user = userService.findByUserId(userId);
//3.判断支付类型:
// 如果余额支付
// 判断验证码是否正确、
// 判断支付密码是否正确、
// 判断余额是否充足;
// 否则:
// 直接走调用第三方支付接口
//3.判断支付类型:
// 如果余额支付
// 判断验证码是否正确、
// 判断支付密码是否正确、
// 判断余额是否充足;
// 否则:
// 直接走调用第三方支付接口
//
String orderNumber = ObjectId.get().toString();
// String ip = AnalyticsUtil.getIpAddress(request);
if("1".equals(model.getPayType())) {//payType==1 支付宝
} else if("2".equals(model.getPayType())) {//payType==2 银行
} else if("3".equals(model.getPayType())) {//payType==3 余额
//判断验证码的正确性
if("1".equals(model.getPayType())) {//payType==1 支付宝
} else if("2".equals(model.getPayType())) {//payType==2 银行
} else if("3".equals(model.getPayType())) {//payType==3 余额
//判断验证码的正确性
String cacheCode = (String) CacheUtils.getValue(UsersInfoService.class, model.getPhone() + "_" + Message.SMS_CODE_TYPE_PAY);
if (cacheCode == null) {
resultModel.setJsonModel(ImmutableMap.of("status", "not_send", "msg", Message.MOBILE_NOT_SEND_CODE));
@@ -471,26 +471,26 @@ public class RechargeController {
resultModel.setJsonModel(ImmutableMap.of("status", "code_error", "msg", Message.CODE_ERROR));
return resultModel;
}
//判断支付密码的正确性
//判断支付密码的正确性
String savedPwd = fangjiaUser.getPayPassword();
//未设置支付密码
//未设置支付密码
if (StringUtils.isBlank(savedPwd)) {
resultModel.setJsonModel(ImmutableMap.of("status", "no_pay_password", "msg", Message.NOT_SET_PAY_PASSWORD));
return resultModel;
}
//支付密码不正确
//支付密码不正确
if (!savedPwd.equals(DigestUtils.md5Hex(model.getPassword()))) {
resultModel.setJsonModel(ImmutableMap.of("status", "pay_password_error", "msg", Message.PAY_PASSWORD_ERROR));
return resultModel;
}
//判断余额
//判断余额
BigDecimal amount = apiUserAccountService.findAmountByUserId(userId);
BigDecimal totalCost = new BigDecimal(0);//购买接口的总花费
BigDecimal totalCost = new BigDecimal(0);//购买接口的总花费
List<ApiPurchaseRecord> apiPurchaseRecords = Lists.newArrayList();
for(Map.Entry<String, String> entry : buyProducts.entrySet()) {
BigDecimal price = apiProductService.getPriceBySubcode(entry.getKey());
if(price==null) {
resultModel.setJsonModel(ImmutableMap.of("status", "not_find_product", "msg", "不存在此产品"));
resultModel.setJsonModel(ImmutableMap.of("status", "not_find_product", "msg", "不存在此产品"));
return resultModel;
}
BigDecimal cost = price.multiply(new BigDecimal(1000)).multiply(new BigDecimal(entry.getValue()));
@@ -503,39 +503,39 @@ public class RechargeController {
apiPurchaseRecords.add(apiPurchaseRecord);
}
if(amount.compareTo(totalCost) < 0) {
resultModel.setJsonModel(ImmutableMap.of("status", "insufficient_balance", "msg", "余额不足"));
resultModel.setJsonModel(ImmutableMap.of("status", "insufficient_balance", "msg", "余额不足"));
return resultModel;
}
//验证完毕,代表购买成功:
//(1)创建ApiUser,有则不创建
//验证完毕,代表购买成功:
//(1)创建ApiUser,有则不创建
Long apiUserId = createApiUser(userId, "");
//(2)保存购买记录
//(2)保存购买记录
Date apiPurchaseDate = new Date();
for(ApiPurchaseRecord apiPurchaseRecord : apiPurchaseRecords) {
apiPurchaseRecord.setChannel("线上");
apiPurchaseRecord.setChannel("线上");
apiPurchaseRecord.setOrderNumber(orderNumber);
apiPurchaseRecord.setUserId(userId);
apiPurchaseRecord.setStatus(APIPURCHASE_SUCCESS);
apiPurchaseRecord.setBankCode("余额");
apiPurchaseRecord.setBankCode("余额");
apiPurchaseRecord.setOrderDate(apiPurchaseDate);
//增加可调用次数
//增加可调用次数
apiUserAuthorityService.increaseVisitCount(apiUserId, "/property/transaction", apiPurchaseRecord.getSubServiceCode(), apiPurchaseRecord.getNumber(), new SimpleDateFormat("yyyy").parse("2099"));
}
apiPurchaseRecordService.save(apiPurchaseRecords);
//记录改动
//记录改动
ApiUserAccount apiUserAccount = new ApiUserAccount();
apiUserAccount.setUserId(userId);
apiUserAccount.setChange(totalCost.multiply(new BigDecimal("-1")));
apiUserAccount.setAmount(amount.subtract(totalCost));
apiUserAccount.setCreateDate(apiPurchaseDate);
apiUserAccount.setChangeWay("线上");
apiUserAccount.setChangeWay("线上");
apiUserAccount.setStatus("success");
apiUserAccountService.saveApiUserAccount(apiUserAccount);
}
//4.购买成功,调转到购买记录页
resultModel.setJsonModel(ImmutableMap.of("status", "success", "msg", "操作成功"));
//4.购买成功,调转到购买记录页
resultModel.setJsonModel(ImmutableMap.of("status", "success", "msg", "操作成功"));
return resultModel;
}
@@ -544,10 +544,10 @@ public class RechargeController {
}
public Object setPasswordAction(HttpServletRequest req, RechargeModel model) throws Exception {
//判断是否登录
//判断是否登录
long userId = NumberUtils.toLong(LoginUtil.getUserId(req), -1);
JsonModel jsonModel = new JsonModel();
//未登录或无此用户
//未登录或无此用户
if(!"post".equalsIgnoreCase(req.getMethod())) {
return model;
}
@@ -563,10 +563,10 @@ public class RechargeController {
}
public Object rechargeListAction(HttpServletRequest request, RechargeModel model) throws Exception {
//判断是否登录
//判断是否登录
String userId = LoginUtil.getUserId(request);
FangJiaUser fangJiaUser = fangJiaUserService.getUserById(userId);
//未登录或无此用户
//未登录或无此用户
if(fangJiaUser == null) {
return model;
}
@@ -585,10 +585,10 @@ public class RechargeController {
}
public Object buyListAction(HttpServletRequest request, RechargeModel model) throws Exception {
//判断是否登录
//判断是否登录
String userId = LoginUtil.getUserId(request);
FangJiaUser fangJiaUser = fangJiaUserService.getUserById(userId);
//未登录或无此用户
//未登录或无此用户
if(fangJiaUser == null) {
return model;
}
@@ -604,7 +604,7 @@ public class RechargeController {
return model;
}
Map<String, List<ApiPurchaseRecord>> apiPurchaseRecordMap = Maps.newLinkedHashMap();
//合并相同订单号的订单
//合并相同订单号的订单
for(ApiPurchaseRecord apiPurchaseRecord : apiPurchaseRecords) {
String orderNumber = apiPurchaseRecord.getOrderNumber();
if(apiPurchaseRecordMap.containsKey(orderNumber)) {
@@ -644,10 +644,10 @@ public class RechargeController {
}
public Object buyList2Action(HttpServletRequest request, RechargeModel model) throws Exception {
//判断是否登录
//判断是否登录
String userId = LoginUtil.getUserId(request);
FangJiaUser fangJiaUser = fangJiaUserService.getUserById(userId);
//未登录或无此用户
//未登录或无此用户
if(fangJiaUser == null) {
return model;
}
@@ -663,7 +663,7 @@ public class RechargeController {
return model;
}
Map<String, List<ApiPurchaseRecord>> apiPurchaseRecordMap = Maps.newLinkedHashMap();
//合并相同订单号的订单
//合并相同订单号的订单
for(ApiPurchaseRecord apiPurchaseRecord : apiPurchaseRecords) {
String orderNumber = apiPurchaseRecord.getOrderNumber();
if(apiPurchaseRecordMap.containsKey(orderNumber)) {
@@ -703,22 +703,22 @@ public class RechargeController {
}
/**
* 发送短信验证码
* 发送短信验证码
* @param model
* @param resultModel
* @return
*/
public Object sendSmsAction(HttpServletRequest request, RechargeModel model, SendCodeJsonModel resultModel) throws Exception {
//判断是否登录
//判断是否登录
long userId = NumberUtils.toLong(LoginUtil.getUserId(request), -1);
//未登录或无此用户
//未登录或无此用户
if(!isLogined(userId)) {
resultModel.setResult(Message.RESULT_FAIL);
resultModel.setMsg(Message.NOT_LOGIN);
return resultModel;
}
//检测支付密码是否正确
//检测支付密码是否正确
String savedPwd = usersInfoService.getPayPassword(userId);
if(StringUtils.isBlank(savedPwd)) {
resultModel.setResult(Message.RESULT_FAIL);
@@ -732,7 +732,7 @@ public class RechargeController {
}
Long sendCodeTime = (Long) CacheUtils.getValue(UsersInfoService.class, model.getPhone() + "_" + model.getType() + "_time");
//验证码一分钟只能发一次
//验证码一分钟只能发一次
if(sendCodeTime != null) {
if(new Date().getTime() - sendCodeTime < 60 * 1000) {
resultModel.setResult(Message.RESULT_FAIL);
@@ -742,7 +742,7 @@ public class RechargeController {
}
String code = usersInfoService.randomCode();
try {
smsService.send(model.getPhone(), "【房价网】你的验证码是" + code + ",验证码5分钟内有效,请立即验证。");
smsService.send(model.getPhone(), "【房价网】你的验证码是" + code + ",验证码5分钟内有效,请立即验证。");
resultModel.setResult(Message.RESULT_SUCCESS);
CacheUtils.putValue(CacheUtils.CachePolicyEnum.TINY, UsersInfoService.class, model.getPhone() + "_" + model.getType(), code);
CacheUtils.putValue(CacheUtils.CachePolicyEnum.SMALL, UsersInfoService.class, model.getPhone() + "_" + model.getType() + "_time", new Date().getTime());
@@ -767,7 +767,7 @@ public class RechargeController {
}*/
/**
* 判断是否登录
* 判断是否登录
* @param userId
* @return
*/
@@ -779,8 +779,8 @@ public class RechargeController {
}
static class ProductCodeComparator implements Comparator {
public int compare(Object object1, Object object2) {// 实现接口中的方法
ApiPurchaseRecord p1 = (ApiPurchaseRecord) object1; // 强制转换
public int compare(Object object1, Object object2) {// 实现接口中的方法
ApiPurchaseRecord p1 = (ApiPurchaseRecord) object1; // 强制转换
ApiPurchaseRecord p2 = (ApiPurchaseRecord) object2;
return p1.getSubServiceCode().compareTo(p2.getSubServiceCode());
}
@@ -35,7 +35,7 @@ public class RecommendController {
private CpcService cpcService;
/**
* 二手房详情页推荐房源。优先根据搜索引擎关键字搜索;再推荐“看了还看”房源,无数据则用区域内推荐。
* 二手房详情页推荐房源。优先根据搜索引擎关键字搜索;再推荐“看了还看”房源,无数据则用区域内推荐。
*
* @param model
* @return
@@ -44,7 +44,7 @@ public class RecommendController {
model.setViewParam("path", "recommendHouse");
String keyword = model.getKeyword();
// 搜索引擎过来的,根据关键字搜索
// 搜索引擎过来的,根据关键字搜索
if (StringUtils.isNotBlank(keyword)) {
HouseQueryBean queryBean = new HouseQueryBean();
queryBean.setCity(model.getCityName());
@@ -57,27 +57,27 @@ public class RecommendController {
return model;
}
// 没有带房源id,则根据区域推荐
// 没有带房源id,则根据区域推荐
if (StringUtils.isBlank(model.getHouseId()) || !ObjectId.isValid(model.getHouseId())) {
getSimilarHouseInRegion(model);
return model;
}
// 该房源没有看了还看数据,则根据区域推荐
// 该房源没有看了还看数据,则根据区域推荐
List<String> ids = recommendService.findCommendIds(model.getHouseId(), 1, model.getCityName());
if (CollectionUtils.isEmpty(ids)) {
getSimilarHouseInRegion(model);
return model;
}
// 看了还看关联的id查不到房源,则根据区域推荐
// 看了还看关联的id查不到房源,则根据区域推荐
List<HouseBo> houseBoList = houseService.findByIds(ids);
if (CollectionUtils.isEmpty(houseBoList)) {
getSimilarHouseInRegion(model);
return model;
}
// 按发布时间,取最新的5套关联房源
// 按发布时间,取最新的5套关联房源
houseBoList = sortHouseBo(houseBoList, 6);
for (HouseBo bo : houseBoList) {
bo.setShowPic(picService.getShowPic(bo.getHouse(), null));
@@ -97,7 +97,7 @@ public class RecommendController {
}
/**
* 推荐区域内相似房源
* 推荐区域内相似房源
*
* @param model
*/
@@ -136,7 +136,7 @@ public class RecommendController {
}
/**
* 租房详情页推荐房源。优先根据搜索引擎关键字搜索;再推荐“看了还看”房源,无数据则用区域内推荐。
* 租房详情页推荐房源。优先根据搜索引擎关键字搜索;再推荐“看了还看”房源,无数据则用区域内推荐。
*
* @param model
* @return
@@ -145,7 +145,7 @@ public class RecommendController {
model.setViewParam("path", "recommendHouse");
String keyword = model.getKeyword();
// 搜索引擎过来的,根据关键字搜索
// 搜索引擎过来的,根据关键字搜索
if (StringUtils.isNotBlank(keyword)) {
RentHouseQueryBean queryBean = new RentHouseQueryBean();
queryBean.setCity(model.getCityName());
@@ -158,27 +158,27 @@ public class RecommendController {
return model;
}
// 没有带房源id,则根据区域推荐
// 没有带房源id,则根据区域推荐
if (StringUtils.isBlank(model.getHouseId()) || !ObjectId.isValid(model.getHouseId())) {
getSimilarRentHouseInRegion(model);
return model;
}
// 该房源没有看了还看数据,则根据区域推荐
// 该房源没有看了还看数据,则根据区域推荐
List<String> ids = recommendService.findCommendIds(model.getHouseId(), 2, model.getCityName());
if (CollectionUtils.isEmpty(ids)) {
getSimilarRentHouseInRegion(model);
return model;
}
// 看了还看关联的id查不到房源,则根据区域推荐
// 看了还看关联的id查不到房源,则根据区域推荐
List<RentHouseBo> rentHouseBoList = rentHouseService.findByIds(ids);
if (CollectionUtils.isEmpty(rentHouseBoList)) {
getSimilarRentHouseInRegion(model);
return model;
}
// 按发布时间,取最新的5套关联房源
// 按发布时间,取最新的5套关联房源
rentHouseBoList = sortRentHouseBo(rentHouseBoList, 6);
for (RentHouseBo bo : rentHouseBoList) {
bo.setShowPic(picService.getShowPic(bo.getHouse(), null));
@@ -198,7 +198,7 @@ public class RecommendController {
}
/**
* 推荐区域内相似租房
* 推荐区域内相似租房
*
* @param model
*/
@@ -238,7 +238,7 @@ public class RecommendController {
}
/**
* 根据发布日期排序,取前几条记录
* 根据发布日期排序,取前几条记录
*
* @param houseBoList
* @param size
@@ -254,7 +254,7 @@ public class RecommendController {
}
/**
* 去除推荐模块房源列表中的当前房源
* 去除推荐模块房源列表中的当前房源
*
* @param model
*/
@@ -57,13 +57,13 @@ import com.fangjia.service.web.MenuService;
import com.fangjia.service.web.FangjiaInternalLinksUtil.InternalLinksCategoryEnum;
/**
* 和出租房相关的controller
* 和出租房相关的controller
*
* @author liupei
*/
public class RentHouseController {
/**
* 出租信息service
* 出租信息service
*/
private RentHouseService rentHouseService;
private MenuService menuService;
@@ -76,7 +76,7 @@ public class RentHouseController {
private IpAddressService ipAddressService;
/**
* 显示出租信息详细页
* 显示出租信息详细页
*
* @param model
* @author liupei
@@ -94,9 +94,9 @@ public class RentHouseController {
}
RentHouseBo houseBo = new RentHouseBo(rent);
// 房源不存在时(物理删除)重定向到列表页,如果从搜索引擎过来,带关键字,否直接重定向
// 房源不存在时(物理删除)重定向到列表页,如果从搜索引擎过来,带关键字,否直接重定向
if (rent == null || StringUtils.isBlank(rent.getCity())) {
StringBuilder re_url = new StringBuilder();// 重定向的url
StringBuilder re_url = new StringBuilder();// 重定向的url
re_url.append("/rentHouseSearch/list?notfound=1");
String keyword = model.getSearchEngineKeyword();
if (StringUtils.isNotEmpty(keyword)) {
@@ -164,19 +164,19 @@ public class RentHouseController {
model.setRegion(rent.getRegion());
model.setHouseBo(formatHouseBo(houseBo));
// 链家 为站外跳转 用自己的400号码
// 链家 为站外跳转 用自己的400号码
if (StringUtils.isNotBlank(rent.getMobile()) && !rent.getMobile().trim().startsWith("400")) {
rent.setMobile(PhoneNormalizer.normalizeContactPhone(ServerAreaData.getServerAreaByDisplay(rent.getCity()), false,
rent.getMobile()));
} else if (StringUtils.isNotBlank(rent.getMobile())) {
// 租房去掉400
// 租房去掉400
// houseBo.setPhone400(PhoneNormalizer.normalizeContact400Phone(rent.getMobile()));
}
int overdays = 21;
CpcBo cpcBo = cpcService.checkCpcUserEnable(rent);
if (null != cpcBo) {
model.setCpcBo(cpcBo);
// 租房去掉400
// 租房去掉400
// if ((cpcBo.getEnabled400() &&
// StringUtils.isNotBlank(rent.getMobile()))) {
// if (!rent.getMobile().trim().startsWith("400")) {
@@ -186,7 +186,7 @@ public class RentHouseController {
// }
// }
}
// 租房去掉400
// 租房去掉400
// if (!needMap400 && StringUtils.isEmpty(houseBo.getPhone400())) {
// Setting400 setting400 =
// setting400Service.findSetting400ByCityAndCategory(rent.getCity(),
@@ -205,7 +205,7 @@ public class RentHouseController {
// PpcMapCategoryEnum.RENT_HOUSE, rent.getId(), rent.getMobile());
// houseBo.setPhone400(phone400);
// }
// 房子的状态不为0或者发布时间超过一个星期,房源过期,页面显示类似房源链接
// 房子的状态不为0或者发布时间超过一个星期,房源过期,页面显示类似房源链接
if (0 != rent.getStatus() || rent.getPublishDate().before(DateUtil.getBeforeDay(new Date(), overdays))) {
model.setOverdate(rent.getPublishDate().before(DateUtil.getBeforeDay(new Date(), overdays)));
model.setOverDays((int) DateUtil.between(new Date(), rent.getPublishDate(), Calendar.DATE));
@@ -216,10 +216,10 @@ public class RentHouseController {
houseBo.setTotalPriceRange(menuService.getRange(ServerAreaData.getServerAreaByDisplay(rent.getCity()),
MenuCategoryEnum.zufang, "totalPriceRange", rent.getTotalPrice()));
// 房源被逻辑删除时,重定向到列表页,带入参数和上面一致
// 房源被逻辑删除时,重定向到列表页,带入参数和上面一致
if (0 != rent.getStatus() || (model.isOverdate() && model.getOverDays() > overdays + 7)) {
String keyword = model.getSearchEngineKeyword();
StringBuilder re_url = new StringBuilder("/rentHouseSearch/list?");// 重定向的url
StringBuilder re_url = new StringBuilder("/rentHouseSearch/list?");// 重定向的url
if (StringUtils.isEmpty(keyword)) {
re_url.append("totalPriceRange=");
re_url.append(menuService.getRange(ServerAreaData.getServerAreaByDisplay(rent.getCity()),
@@ -244,12 +244,12 @@ public class RentHouseController {
// model.getId());
// model.setUserFeeling(userFeeling);
// 底部区域推荐
// 底部区域推荐
/*ServerArea serverArea = FangjiaServerAreaContextHolder.getServerAreaDefault();
List<Item> autoRegionRecommends = menuService.getRegionsByCity(serverArea, MenuCategoryEnum.zufang);
model.setAutoRegionRecommends(limit(autoRegionRecommends));*/
// 底部热门推荐的其他城市
// 底部热门推荐的其他城市
/*List<CityGroup> footerCitys = new ArrayList<CityGroup>(10);
List<String> cityNames = ServerAreaData.getServerAreaDisplayList(10);
for (String name : cityNames) {
@@ -260,32 +260,32 @@ public class RentHouseController {
}
/**
* 按时间做Seed获取的随机筛选的区域信息
* 按时间做Seed获取的随机筛选的区域信息
*
* @param 区域菜单信息
* @return 随机筛选的区域信息
* @param 区域菜单信息
* @return 随机筛选的区域信息
*/
private List<Item> limit(List<Item> items) {
int needCount = 9;// 获取的数据个数10个
int needCount = 9;// 获取的数据个数10个
int changeDay = 20;// 设置更新频率为20天
int changeDay = 20;// 设置更新频率为20天
int currentCount = items.size();// 当前获取的Region总数
int currentCount = items.size();// 当前获取的Region总数
if (currentCount <= needCount)
return items;
Calendar oldTime = Calendar.getInstance();
oldTime.set(2011, 8, 1);// 设定初始化时间为2011年09月01日
oldTime.set(2011, 8, 1);// 设定初始化时间为2011年09月01日
Calendar newTime = Calendar.getInstance();
int reduceDay = SimRandom.getReduceDay(newTime, oldTime);// 获取日期与初始日期相差天数
int reduceDay = SimRandom.getReduceDay(newTime, oldTime);// 获取日期与初始日期相差天数
int seed = (int) reduceDay / changeDay;// 计算simRandom变化频率
int seed = (int) reduceDay / changeDay;// 计算simRandom变化频率
List<Integer> simIndexs = SimRandom.getSimRandom(seed, currentCount, needCount);// 获取随机Index
List<Integer> simIndexs = SimRandom.getSimRandom(seed, currentCount, needCount);// 获取随机Index
List<Item> limitedRegions = new ArrayList<Item>(needCount);
for (int index : simIndexs) {
@@ -295,7 +295,7 @@ public class RentHouseController {
}
/**
* 显示同小区相似房源,需要除掉当前这套房源 不足5套时去掉面积参数
* 显示同小区相似房源,需要除掉当前这套房源 不足5套时去掉面积参数
*
* @param model
* @author
@@ -349,7 +349,7 @@ public class RentHouseController {
}
/**
* 显示同区域相同房源,需要去掉当前房源的小区 不足5套时去掉面积参数
* 显示同区域相同房源,需要去掉当前房源的小区 不足5套时去掉面积参数
*
* @param model
* @author
@@ -388,7 +388,7 @@ public class RentHouseController {
}
/**
* 根据关键字推荐房源 取 4 条
* 根据关键字推荐房源 取 4 条
*
* @param model
* @return
@@ -402,7 +402,7 @@ public class RentHouseController {
queryBean.setKeyword(keyword);
Pager pager = new Pager();
pager.setPageSize(4);
// 站内搜推荐关键词相关全国房源
// 站内搜推荐关键词相关全国房源
if (StringUtils.isNotBlank(model.getRecommendCityType()) && model.getRecommendCityType().equals("ALL")) {
FacetQueryResult<RentHouseBo> houseBoList = rentHouseService.findByQueryBean(pager, queryBean);
for (RentHouseBo houseBo : houseBoList) {
@@ -434,7 +434,7 @@ public class RentHouseController {
}
/**
* 获取房源的推荐城市
* 获取房源的推荐城市
*
* @param request
* @return
@@ -444,7 +444,7 @@ public class RentHouseController {
ServerArea suggestCity = ipAddressService.locationByIp(ip, null);
;
if (null == suggestCity) {
// 无结果,从cookie取
// 无结果,从cookie取
CoresiteCookieContext cookieContext = CoresiteCookieContext.getInstance();
suggestCity = ServerAreaData.getServerAreaByNameOrSpellDefaultNull(cookieContext.getCookieValue(request,
CookieName.COOKIE_CITY));
@@ -453,7 +453,7 @@ public class RentHouseController {
}
/**
* 去除房源中的空字符串图片链接
* 去除房源中的空字符串图片链接
*
* @param bo
* @return
@@ -494,7 +494,7 @@ public class RentHouseController {
/***
*
* 由house取得小区信息*
* 由house取得小区信息*
*
* *
* */
@@ -53,9 +53,9 @@ public class RentHouseReportController {
private DistrictService districtService;
private DistrictHousetypeService districtHousetypeService;
/**出租报告-首页*/
/**出租报告-首页*/
public Object rentAction(HouseReportModel model){
model.setReportTitle("出租报告");
model.setReportTitle("出租报告");
if(StringUtils.isNotBlank(model.getEid())){
Evaluation evaluation = evaluationService.findEvaluationById(model.getEid());
model.setEvaluation(evaluation);
@@ -75,7 +75,7 @@ public class RentHouseReportController {
return model;
}
/**租金回报率*/
/**租金回报率*/
public Object loadRentRateAction(HouseReportModel model){
JsonModel jsonRet = new JsonModel();
@@ -87,16 +87,16 @@ public class RentHouseReportController {
return jsonRet;
}
/**租金同比*/
/**租金同比*/
public Object loadRentYoyAction(HouseReportModel model){
JsonModel jsonRet = new JsonModel();
//上个月
//上个月
Date lastMonth = DateUtil.getLastDayOfMonth(new Date(), -1);
String lastMonthStr = DateUtil.formatByPattern(lastMonth, "yyyy-MM-dd");
SqmetreRent sqmetreRent1 = sqmetreRentService.findNearestSqmetreRent(model.getCityName(), model.getRegion(), model.getDistrictName(), lastMonthStr, "district");
//去年
//去年
Date lastYearMonth = DateUtil.getLastDayOfMonth(new Date(), -13);
String lastYearMonthStr = DateUtil.formatByPattern(lastYearMonth, "yyyy-MM-dd");
SqmetreRent sqmetreRent2 = sqmetreRentService.findNearestSqmetreRent(model.getCityName(), model.getRegion(), model.getDistrictName(), lastYearMonthStr, "district");
@@ -121,22 +121,22 @@ public class RentHouseReportController {
}
/**租金走势*/
/**租金走势*/
public Object loadRentTrendAction(HouseReportModel model){
int week = 3;
int type = 0; //月份
int type = 0; //月份
JsonModel jsonRet = new JsonModel();
if(model.getType() == 1){ //季度
if(model.getType() == 1){ //季度
week = 3;
type = -3;
}else if(model.getType() == 2){ //半年
}else if(model.getType() == 2){ //半年
week = 6;
type = -6;
}else if(model.getType() == 3){ //一年
}else if(model.getType() == 3){ //一年
week = 12;
type = -12;
}else if(model.getType() == 4){ //两年
}else if(model.getType() == 4){ //两年
week = 24;
type = -24;
}
@@ -168,9 +168,9 @@ public class RentHouseReportController {
}
District district = districtService.findDistrict(districtKey,"district");
String estateType = "小区";
if(null != district && district.getEstateType2().contains("别墅")){
estateType = "别墅";
String estateType = "小区";
if(null != district && district.getEstateType2().contains("别墅")){
estateType = "别墅";
}
List<DistrictStatRentBo> rentBos = districtStatRentService.findDistrictStatRentsByParams(model.getCityName(), model.getRegion(), model.getDistrictName(), model.getRoom(), dates.get(0), null, null, null, 0, week, false);
Map<String, Integer> distMap = null;
@@ -196,7 +196,7 @@ public class RentHouseReportController {
}
/**租房挂牌房源*/
/**租房挂牌房源*/
public Object loadHousesAction(HouseReportModel model){
JsonModel jsonRet = new JsonModel();
@@ -212,7 +212,7 @@ public class RentHouseReportController {
}
/**租房挂牌房源-列表*/
/**租房挂牌房源-列表*/
public Object housesAction(HouseReportModel model){
if(StringUtils.isNotBlank(model.getEid())){
Evaluation evaluation = evaluationService.findEvaluationById(model.getEid());
@@ -228,14 +228,14 @@ public class RentHouseReportController {
return model;
}
/**加载小区的室*/
/**加载小区的室*/
public Object loadRoomsAction(HouseReportModel model){
JsonModel jsonRet = new JsonModel();
DistrictKey districtKey = new DistrictKey(model.getCityName(), model.getRegion(), model.getDistrictName());
District district = districtService.findDistrict(districtKey,"district");
String estateType = "小区";
if(null != district && district.getEstateType2().contains("别墅")){
estateType = "别墅";
String estateType = "小区";
if(null != district && district.getEstateType2().contains("别墅")){
estateType = "别墅";
}
List<DistrictStatRentBo> bos = districtStatRentService.findByDistrictStatRent(districtKey);
@@ -107,10 +107,10 @@ public class RentHouseSearchController {
throws Exception {
if (CollectionUtils.isNotEmpty(result)) {
FacetQueryResult<RentHouseBo> houseBoList = new FacetQueryResult<RentHouseBo>();
// 暂停CPC逻辑
// 暂停CPC逻辑
// cpcService.checkCpcUserEnable(result);
// 增加最后的CPC房源 13/01/09
// 增加最后的CPC房源 13/01/09
addCpcHouse(result, model);
for (RentHouseBo houseBo : result) {
@@ -155,7 +155,7 @@ public class RentHouseSearchController {
}
/**
* 起始位置比总数大,说明当前页数不对,从第一页开始
* 起始位置比总数大,说明当前页数不对,从第一页开始
*
* @param maxRow
* @param pager
@@ -170,7 +170,7 @@ public class RentHouseSearchController {
}
/**
* 出租信息列表页
* 出租信息列表页
*
* @param model
* @param request
@@ -191,7 +191,7 @@ public class RentHouseSearchController {
pager.setMaxPage(FangjiaConfig.getConfig().getSearchListMaxPageNo());
}
// 菜单类型,如果城市不支持地铁,或地铁参数不对,则默认用区域菜单
// 菜单类型,如果城市不支持地铁,或地铁参数不对,则默认用区域菜单
Integer menuType = model.getMenuType();
if (!FangjiaServerAreaContextHolder.getServerAreaDefault().isSupportMetro() || null == menuType || menuType > 2
|| menuType < 0) {
@@ -215,9 +215,9 @@ public class RentHouseSearchController {
}
// String similarInfo = "";
boolean facetByRegion = false;// 是否按区域,板块分面
// 有经纬度的相似房源查询
// if (StringUtils.isNotBlank(model.getSimilarInfo())) {// 从菜单获取得相似信息
boolean facetByRegion = false;// 是否按区域,板块分面
// 有经纬度的相似房源查询
// if (StringUtils.isNotBlank(model.getSimilarInfo())) {// 从菜单获取得相似信息
// facetByRegion = true;
// queryBean = getQueryBySimilarInfo(model, similarInfo);
// }
@@ -230,12 +230,12 @@ public class RentHouseSearchController {
Menu menu = menuService.menuMaker(FangjiaServerAreaContextHolder.getServerAreaDefault(), MenuCategoryEnum.zufang,
getCurrentParams(), 0);// getCurrentParams();
// 如果获取得出租小区无经纬度 或 选择菜单查找,则按以前的方式查找相似房源
if (queryBean == null) {// 普通查询
// 如果获取得出租小区无经纬度 或 选择菜单查找,则按以前的方式查找相似房源
if (queryBean == null) {// 普通查询
queryBean = this.buildHouseQueryBean(model);
}
// 老网站的URL中区域是带“区”的
// 老网站的URL中区域是带“区”的
if (StringUtils.isNotBlank(queryBean.getRegion())) {
List<Group> gList = menu.getGroupList();
for (Group g : gList) {
@@ -257,7 +257,7 @@ public class RentHouseSearchController {
FacetQueryResult<RentHouseBo> result = null;
Sort sort = getSort(model);
if (sort == null) {
// 如果是学区房检索
// 如果是学区房检索
if (null != model.getIfSchool()) {
result = schoolRentHouseSearch(model, pager, menu, queryBean, null, false, facetByRegion);
} else {
@@ -298,7 +298,7 @@ public class RentHouseSearchController {
metroService.signMetroRentHouse(result);
}
}
setSimilarInfoToList(result);// 处理类似房源信息
setSimilarInfoToList(result);// 处理类似房源信息
model.setMenu(menu);
List<String> conditions = menuService.getConditions(FangjiaServerAreaContextHolder.getServerAreaDefault(),
@@ -314,21 +314,21 @@ public class RentHouseSearchController {
model.setConditionItems(conditionItems);
/**
* gasm统计
* gasm统计
*/
model.addGaMap(Gakey.rc, pager.getTotalRows());
/**
* 租房列表页底部SEO推荐区域
* 租房列表页底部SEO推荐区域
*/
ServerArea serverArea = FangjiaServerAreaContextHolder.getServerAreaDefault();
List<Item> autoRegionRecommends = menuService.getRegionsByCity(serverArea, MenuCategoryEnum.zufang);
model.setAutoRegionRecommends(limit(autoRegionRecommends));
// 自定义面积、价格范围搜索
// 自定义面积、价格范围搜索
processUserConditions(model);
// 搜索无结果时,根据关键字推荐其他城市的小区
// 搜索无结果时,根据关键字推荐其他城市的小区
if (pager.getTotalRows() == 0 && StringUtils.isNotBlank(model.getKeyword())) {
Map<String, Object> konwbase = knowbaseService.parseWord(model.getKeyword());
List<Map<String, Object>> districts = (null != konwbase && null != konwbase.get("district_name")) ? (List<Map<String, Object>>) konwbase
@@ -369,7 +369,7 @@ public class RentHouseSearchController {
model.setOtherCityDistrictList(otherCitiesDistrict);
}
// 底部热门推荐的其他城市
// 底部热门推荐的其他城市
List<CityGroup> footerCitys = new ArrayList<CityGroup>(10);
List<String> cityNames = ServerAreaData.getServerAreaDisplayList(10);
for (String name : cityNames) {
@@ -387,10 +387,10 @@ public class RentHouseSearchController {
List<RentHouseBo> extraBoList;
Pager pager = new Pager(3);
if ("三亚".equals(cityDisplay)) {
extraBoList = getExtraHouses("德佑地产", cityDisplay, true, pager);
} else if ("厦门".equals(cityDisplay)) {
extraBoList = getExtraHouses("黄金屋", cityDisplay, true, pager);
if ("三亚".equals(cityDisplay)) {
extraBoList = getExtraHouses("德佑地产", cityDisplay, true, pager);
} else if ("厦门".equals(cityDisplay)) {
extraBoList = getExtraHouses("黄金屋", cityDisplay, true, pager);
} else {
extraBoList = getExtraHouses("firstvilla.com.cn", cityDisplay, false, pager);
}
@@ -451,7 +451,7 @@ public class RentHouseSearchController {
if ("rentPrice".equalsIgnoreCase(sortField)) {
sortField = "totalPrice";
}
if ("totalPrice".equals(sortField) || "area".equals(sortField) || "bscore".equals(sortField)) { // TODO:启用bscore作为默认排序后,去除此处的bscore
if ("totalPrice".equals(sortField) || "area".equals(sortField) || "bscore".equals(sortField)) { // TODO:启用bscore作为默认排序后,去除此处的bscore
} else {
sortField = null;
@@ -463,7 +463,7 @@ public class RentHouseSearchController {
}
/**
* 处理列表上方的筛选条件
* 处理列表上方的筛选条件
*
* @param model
*/
@@ -500,11 +500,11 @@ public class RentHouseSearchController {
String cancelPrice = "";
if (null != model.getMinPrice() && null != model.getMaxPrice()) {
cancelPrice = model.getMinPrice() + "-" + model.getMaxPrice() + "元";
cancelPrice = model.getMinPrice() + "-" + model.getMaxPrice() + "元";
} else if (null != model.getMinPrice()) {
cancelPrice = model.getMinPrice() + "元以上";
cancelPrice = model.getMinPrice() + "元以上";
} else if (null != model.getMaxPrice()) {
cancelPrice = model.getMaxPrice() + "元以下";
cancelPrice = model.getMaxPrice() + "元以下";
}
if (StringUtils.isNotBlank(cancelPrice)) {
@@ -539,11 +539,11 @@ public class RentHouseSearchController {
String cancelArea = "";
if (null != model.getMinArea() && null != model.getMaxArea()) {
cancelArea = model.getMinArea() + "-" + model.getMaxArea() + "平米";
cancelArea = model.getMinArea() + "-" + model.getMaxArea() + "平米";
} else if (null != model.getMinArea()) {
cancelArea = model.getMinArea() + "平米以上";
cancelArea = model.getMinArea() + "平米以上";
} else if (null != model.getMaxArea()) {
cancelArea = model.getMaxArea() + "平米以下";
cancelArea = model.getMaxArea() + "平米以下";
}
if (StringUtils.isNotBlank(cancelArea)) {
@@ -556,13 +556,13 @@ public class RentHouseSearchController {
}
if (null != model.getIfSchool() && model.getIfSchool() == 1 && (null == model.getMenuType() || model.getMenuType() != 3)) {
cons.add("学区房");
consMap.add(new Item("1", "学区房", new Group("ifSchool")));
cons.add("学区房");
consMap.add(new Item("1", "学区房", new Group("ifSchool")));
}
if (null != model.getIfMetro() && model.getIfMetro() == 1 && (null == model.getMenuType() || model.getMenuType() != 2)) {
cons.add("地铁房");
consMap.add(new Item("1", "地铁房", new Group("ifMetro")));
cons.add("地铁房");
consMap.add(new Item("1", "地铁房", new Group("ifMetro")));
}
model.setConditions(cons);
@@ -570,24 +570,24 @@ public class RentHouseSearchController {
}
/**
* 给有经纬度的房源的similarInfo赋值
* 给有经纬度的房源的similarInfo赋值
*
* @param houseBoResult
*/
private void setSimilarInfoToList(FacetQueryResult<RentHouseBo> rentHouseBoResult) {
for (RentHouseBo rentHouseBo : rentHouseBoResult) {
if (null != rentHouseBo.getDistrict()) {
// "黄浦区_上海康城_2室_98平米_126万_相似房源"
// "黄浦区_上海康城_2室_98平米_126万_相似房源"
String districtName = rentHouseBo.getDistrictName();
// 去掉小区的高亮字符,eg:<font color='red'>上海康城</font>
// 去掉小区的高亮字符,eg:<font color='red'>上海康城</font>
if (districtName.contains("<font color='red'>") || districtName.contains("<font+color%3D'red'>")) {
districtName = districtName.substring(18, districtName.length() - 7);
}
int area = rentHouseBo.getHouse().getArea() == null ? 0 : (int) ((double) rentHouseBo.getHouse().getArea());
String similarInfo = rentHouseBo.getRegion() + "区_" + districtName + "_" + rentHouseBo.getHouse().getRoom()
+ "室_" + area + "平米_月租" + rentHouseBo.getHouse().getTotalPrice() + "元_类似房源";
String similarInfo = rentHouseBo.getRegion() + "区_" + districtName + "_" + rentHouseBo.getHouse().getRoom()
+ "室_" + area + "平米_月租" + rentHouseBo.getHouse().getTotalPrice() + "元_类似房源";
rentHouseBo.setSimilarInfo(similarInfo);
}
@@ -598,11 +598,11 @@ public class RentHouseSearchController {
RentHouseQueryBean queryBean, String sortField, boolean asc, boolean facetByRegion) {
/***** schoolQueryResult **********************************************/
FacetQueryResult<RentHouseBo> result = new FacetQueryResult<RentHouseBo>();
// 输入的关键字
// 输入的关键字
// if (StringUtils.isNotBlank(queryBean.getSchool())) {
result = rentHouseService.findWithFacetSearch(menu, pager, queryBean, sortField, asc, facetByRegion);
// } else {
// // 不分面
// // 不分面
// result = rentHouseService.findByQueryBeanSort(pager, queryBean,
// sortField, asc);
// }
@@ -621,7 +621,7 @@ public class RentHouseSearchController {
queryBean.setFullTextSearch(true);
/**
* 如果是命名查询
* 如果是命名查询
*/
if (StringUtils.isNotBlank(model.getCustomQuery())) {
Customquery customquery = customqueryService.findByName(model.getCustomQuery());
@@ -682,32 +682,32 @@ public class RentHouseSearchController {
}
/**
* 按时间做Seed获取的随机筛选的区域信息
* 按时间做Seed获取的随机筛选的区域信息
*
* @param 区域菜单信息
* @return 随机筛选的区域信息
* @param 区域菜单信息
* @return 随机筛选的区域信息
*/
private List<Item> limit(List<Item> items) {
int needCount = 9;// 获取的数据个数10个
int needCount = 9;// 获取的数据个数10个
int changeDay = 20;// 设置更新频率为20天
int changeDay = 20;// 设置更新频率为20天
int currentCount = items.size();// 当前获取的Region总数
int currentCount = items.size();// 当前获取的Region总数
if (currentCount <= needCount)
return items;
Calendar oldTime = Calendar.getInstance();
oldTime.set(2011, 8, 1);// 设定初始化时间为2011年09月01日
oldTime.set(2011, 8, 1);// 设定初始化时间为2011年09月01日
Calendar newTime = Calendar.getInstance();
int reduceDay = SimRandom.getReduceDay(newTime, oldTime);// 获取日期与初始日期相差天数
int reduceDay = SimRandom.getReduceDay(newTime, oldTime);// 获取日期与初始日期相差天数
int seed = (int) reduceDay / changeDay;// 计算simRandom变化频率
int seed = (int) reduceDay / changeDay;// 计算simRandom变化频率
List<Integer> simIndexs = SimRandom.getSimRandom(seed, currentCount, needCount);// 获取随机Index
List<Integer> simIndexs = SimRandom.getSimRandom(seed, currentCount, needCount);// 获取随机Index
List<Item> limitedRegions = new ArrayList<Item>(needCount);
for (int index : simIndexs) {
@@ -722,7 +722,7 @@ public class RentHouseSearchController {
// Pager pager = new Pager(10);
// FacetQueryResult<RentHouseBo> result = null;
//
// // 如果默认搜索为空,解析关键字。如关键字中带小区,则搜索周边3公里内房源;否则拆解关键字再进行搜索。
// // 如果默认搜索为空,解析关键字。如关键字中带小区,则搜索周边3公里内房源;否则拆解关键字再进行搜索。
// Map<String, Object> konwbase =
// knowbaseService.parseWord(model.getKeyword());
// List<Map<String, Object>> districts = (null != konwbase && null !=
@@ -756,10 +756,10 @@ public class RentHouseSearchController {
// queryBean.setKeyword(model.getKeyword());
// queryBean.setCity(((ServerArea)
// FangjiaServerAreaContextHolder.getServerAreaDefault()).getDisplay());
// queryBean.setFullTextSearch(true); // 为true,搜索时自动拆分关键字
// queryBean.setFullTextSearch(true); // 为true,搜索时自动拆分关键字
// result = rentHouseService.findByQueryBean(pager, queryBean);
// } else {
// int radius = 3;// 周边三公里
// int radius = 3;// 周边三公里
// long lnn = (district.getLng() - (radius * 100000000));
// long lnx = (district.getLng() + (radius * 100000000));
// long lan = (district.getLat() - (radius * 100000000));
@@ -775,7 +775,7 @@ public class RentHouseSearchController {
// result = rentHouseService.findByQueryBean(pager, queryBean);
// }
//
// // 默认列表
// // 默认列表
// if (CollectionUtils.isEmpty(result)) {
// RentHouseQueryBean queryBean = new RentHouseQueryBean();
// queryBean.setCity(((ServerArea)
@@ -840,7 +840,7 @@ public class RentHouseSearchController {
}
// /**
// * 按房源相似信息获取QueryBean
// * 按房源相似信息获取QueryBean
// *
// * @param queryBean
// * @param model
@@ -859,7 +859,7 @@ public class RentHouseSearchController {
// }
// if (StringUtils.isNotBlank(similarInfoStr[1]) &&
// similarInfoStr[1].length() > 0) {
// model.setDistrictName(similarInfoStr[1]);// 这里把小区名放进去了,后面要从model中去掉
// model.setDistrictName(similarInfoStr[1]);// 这里把小区名放进去了,后面要从model中去掉
// }
//
// String room = similarInfoStr[2].substring(0, similarInfoStr[2].length() -
@@ -895,17 +895,17 @@ public class RentHouseSearchController {
// queryBean.setRegion(region);
// }
//
// if (null != model.getRegion()) { // 如果是重新选择了区域,板块,则在经纬度基础上加 区域,板块
// // 的条件
// if (null != model.getRegion()) { // 如果是重新选择了区域,板块,则在经纬度基础上加 区域,板块
// // 的条件
// queryBean.setRegion(model.getRegion());
// if (null != model.getBlock()) {
// queryBean.setBlock(model.getBlock());
// }
// } else {
// model.setRegion(region);// 按区域分面
// model.setRegion(region);// 按区域分面
// }
//
// // 装修,类型,标签
// // 装修,类型,标签
// if (null != model.getFitment()) {
// queryBean.setFitment(model.getFitment());
// }
@@ -915,7 +915,7 @@ public class RentHouseSearchController {
// if (null != model.getHouseTag()) {
// queryBean.setHouseTag(model.getHouseTag());
// }
// // 去掉小区
// // 去掉小区
// if (null != model.getDistrictName()) {
// model.setDistrictName(null);
// }
@@ -927,7 +927,7 @@ public class RentHouseSearchController {
// }
/**
* 地铁房Query
* 地铁房Query
*
* @param model
* @return
@@ -938,23 +938,23 @@ public class RentHouseSearchController {
}
/**
* 构建 HouseQueryBean 来检索 条件:有经纬度的,周边五公里以内,面积 价格 相差10%,同室数,从近到远排序。没有经纬度就按原先规则
* 构建 HouseQueryBean 来检索 条件:有经纬度的,周边五公里以内,面积 价格 相差10%,同室数,从近到远排序。没有经纬度就按原先规则
*
* 用于构建经纬度查询参数
* 用于构建经纬度查询参数
* @return
*/
private RentHouseQueryBean buildSimilarQueryByLatLng(RentHouseModel model) {
if (null != model) {
RentHouseQueryBean queryBean = new RentHouseQueryBean();
// 构建经纬度条件(有经纬度的才进行)
// 构建经纬度条件(有经纬度的才进行)
Long lat = Long.parseLong(model.getLat());
Long lng = Long.parseLong(model.getLng());
// double dlat = (double) (lat / 10000000000.0);
// double dlng = (double) (lng / 10000000000.0);//
// 纬度必须为正负90,经度为正负180
// 纬度必须为正负90,经度为正负180
// if (!(dlat >= -90 && dlat <= 90 && dlng >= -180 && dlng <= 180))
// {// 经纬度不符合规范,按原来的查
// {// 经纬度不符合规范,按原来的查
// return null;
// }
// queryBean.setLat(lat);
@@ -968,7 +968,7 @@ public class RentHouseSearchController {
return null;
}
Integer room = model.getRoom();// 租房用相同“室”数找相似房源
Integer room = model.getRoom();// 租房用相同“室”数找相似房源
if (null != room && room > 0)
queryBean.setRoom(room);
String region = model.getRegion();
@@ -3,14 +3,14 @@ package com.fangjia.coresite.controllers;
import com.fangjia.coresite.model.FangjiaModel;
/**
* 房产报告控制器
* 房产报告控制器
* @author yinjihuan
*
*/
public class ReportController {
/**
* 进入房调报告页面
* 进入房调报告页面
* @param model
* @return
*/
@@ -95,7 +95,7 @@ public class ReportDetailController {
private final static Logger LOGGER = LoggerFactory.getLogger(ReportDetailController.class);
/**
* 单项的样例页
* 单项的样例页
*/
public Object sampleAction(ReportDetailModel model, HttpServletRequest request) {
int type = model.getType();
@@ -118,31 +118,31 @@ public class ReportDetailController {
return Models.NOT_FOUNT;
}
String body = "购买《成交参考》"; // 商品描述,推荐格式:商品名称(订单编号:订单编号)
String body = "购买《成交参考》"; // 商品描述,推荐格式:商品名称(订单编号:订单编号)
switch (type) {
case 1:
body = "购买《成交参考》";
body = "购买《成交参考》";
break;
case 2:
body = "购买《租金/租赁情况》";
body = "购买《租金/租赁情况》";
break;
case 3:
body = "购买《楼盘情报》";
body = "购买《楼盘情报》";
break;
case 4:
body = "购买《江湖地位/口碑》";
body = "购买《江湖地位/口碑》";
break;
case 5:
body = "购买《中介实力排行》";
body = "购买《中介实力排行》";
break;
case 6:
body = "购买《房价走势&涨跌幅预测》";
body = "购买《房价走势&涨跌幅预测》";
break;
case 7:
body = "购买《房子稀缺程度》";
body = "购买《房子稀缺程度》";
break;
case 8:
body = "购买《生活便利指数》";
body = "购买《生活便利指数》";
break;
}
@@ -150,7 +150,7 @@ public class ReportDetailController {
String region = evaluation.getRegion();
String districtName = evaluation.getDistrictName();
DistrictKey districtKey = new DistrictKey(city, region, districtName);
boolean isVilla = StringUtils.contains(evaluation.getBuildType(), "别墅");
boolean isVilla = StringUtils.contains(evaluation.getBuildType(), "别墅");
model.setVilla(isVilla);
int houseRoom = null == evaluation.getRoom() ? 2 : evaluation.getRoom();
HouseLoudong houseInfo = realHouseService.findHouseInfo(districtKey, evaluation.getHouseNum(), evaluation.getRoomNum());
@@ -158,9 +158,9 @@ public class ReportDetailController {
houseRoom = houseInfo.getRoom();
}
model.setHouseRooms(houseRoom);
String buildType = isVilla ? "别墅" : "小区";
String buildType = isVilla ? "别墅" : "小区";
// 判断是否有数据出售
// 判断是否有数据出售
if (type == 1) {
List<HouseTradeHistory> similarTradeHouses = realHouseService.findHouseTradeHistory(districtKey, houseRoom,
evaluation.getArea(), 10, isVilla);
@@ -275,7 +275,7 @@ public class ReportDetailController {
break;
}
if (!"未知".equals(detail.get("full_name"))) {
if (!"未知".equals(detail.get("full_name"))) {
agencys.add(detail);
}
}
@@ -345,20 +345,20 @@ public class ReportDetailController {
}
}
String subject = body; // 商品名称
String subject = body; // 商品名称
String notify_url = model.getCityUrl() + "/reportDetail/notify";
String return_url = model.getCityUrl() + "/reportDetail/paySuccess";
String partner = AlipayConfig.alipayPartner;
String seller_email = AlipayConfig.alipayEmail;
String payment_type = "1";// 支付宝类型.1代表商品购买
String payment_type = "1";// 支付宝类型.1代表商品购买
String ip = AnalyticsUtil.getIpAddress(request);
Double money = 10D;
if (ip.equals("116.247.70.58") || ip.startsWith("192.168.0.") || ip.startsWith("192.168.10.")) {
money = 0.01;// 公司测试ip
money = 0.01;// 公司测试ip
}
String total_fee = String.valueOf(money); // 订单总价
String paymethod = "bankPay";// 赋值:bankPay(网银);cartoon(卡通);
String total_fee = String.valueOf(money); // 订单总价
String paymethod = "bankPay";// 赋值:bankPay(网银);cartoon(卡通);
model.setBody(body);
model.setNotify_url(notify_url);
@@ -398,13 +398,13 @@ public class ReportDetailController {
String region = eva.getRegion();
String block = eva.getBlock();
model.setRegionOrg(regionBlockService.getOrgName(city, region, "region"));
model.setBlockOrg(block + "板块");
model.setBlockOrg(block + "板块");
String districtName = eva.getDistrictName();
DistrictKey districtKey = new DistrictKey(city, region, districtName);
boolean isVilla = StringUtils.contains(eva.getBuildType(), "别墅");
boolean isVilla = StringUtils.contains(eva.getBuildType(), "别墅");
model.setVilla(isVilla);
int houseRoom = null == eva.getRoom() ? 2 : eva.getRoom();
String buildType = isVilla ? "别墅" : "小区";
String buildType = isVilla ? "别墅" : "小区";
int weekCounts = 12;
Date now = new Date();
@@ -418,7 +418,7 @@ public class ReportDetailController {
model.setDistrict(district);
if (type == 1) {
// 同类成交
// 同类成交
List<HouseTradeHistory> similarTradeHouses = realHouseService.findHouseTradeHistory(districtKey, houseRoom,
eva.getArea(), 10, isVilla);
if (CollectionUtils.isEmpty(similarTradeHouses) || similarTradeHouses.size() < 10) {
@@ -482,7 +482,7 @@ public class ReportDetailController {
}
model.setSimilarTradeHouses(similarTradeHouses);
} else if (type == 2) {
// 租金情况
// 租金情况
model.setDistrictHot(districtHotService.findByDistrictKey(districtKey));
StringBuilder urlBuilder = new StringBuilder();
urlBuilder.append("pt=1&c=").append(city).append("&r=").append(region).append("&dn=").append(districtName)
@@ -554,11 +554,11 @@ public class ReportDetailController {
return Models.NOT_FOUNT;
/*
* // 3.2 开发商 model.setDeveloper(developerService.findByName(city,
* district.getDeveloper())); // 3.2 物业公司
* // 3.2 开发商 model.setDeveloper(developerService.findByName(city,
* district.getDeveloper())); // 3.2 物业公司
* model.setManagementCompany(
* managementCompanyService.findByName(city,
* district.getEstateCompany())); // 4.1 3.3 周边配套信息
* district.getEstateCompany())); // 4.1 3.3 周边配套信息
* DistrictFacilitys facilitys =
* districtService.findDistrictFacilitys(districtKey); if (null !=
* facilitys) {
@@ -573,7 +573,7 @@ public class ReportDetailController {
return Models.NOT_FOUNT;
/*
* // 4 排行榜
* // 4 排行榜
* model.setRegionDistrictCount(districtService.findRegionDistrictCount
* (city, region));
* model.setBlockDistrictCount(districtService.findBlockDistrictCount
@@ -629,7 +629,7 @@ public class ReportDetailController {
* block, districtName, buildType));
*/
} else if (type == 5) {
// 7.1 小区成交中介排名
// 7.1 小区成交中介排名
List<AgentMasterBo> masterBos = new ArrayList<AgentMasterBo>(10);
AgencyDistrictTradeRank districtAgencys = districtService.findAgencyDistrictTradeRank(districtKey);
if (null != districtAgencys) {
@@ -641,14 +641,14 @@ public class ReportDetailController {
break;
}
if (!"未知".equals(detail.get("full_name"))) {
if (!"未知".equals(detail.get("full_name"))) {
agencys.add(detail);
}
}
model.setDistrictAgencys(agencys);
// 7.2 中介详情
String maxSellAddress = "暂无";
// 7.2 中介详情
String maxSellAddress = "暂无";
long dLat = district.getLat();
long dLng = district.getLng();
for (int i = 0; i < agencys.size(); i++) {
@@ -722,8 +722,8 @@ public class ReportDetailController {
model.setMasterBos(masterBos);
} else if (type == 6) {
model.setStatWeekCounts(weekCounts);
model.setBlockOrg(district.getBlock() + "板块");
// 1.2 小区走势图信息
model.setBlockOrg(district.getBlock() + "板块");
// 1.2 小区走势图信息
int[] districtMinMaxPrice = districtStatService.findMinMaxDistrictStat(districtKey, buildType, now, weekCounts);
model.setDistrictMinPrice(CurrencyConverter.toMicrometer(Integer.toString(districtMinMaxPrice[0])));
model.setDistrictMaxPrice(CurrencyConverter.toMicrometer(Integer.toString(districtMinMaxPrice[1])));
@@ -741,7 +741,7 @@ public class ReportDetailController {
model.setDistrictStatImgUrl(model.getCityUrl() + "/cImg/" + SecurityUtil.encode(urlBuilder.toString())
+ "?__refresh_cache=1");
// 1.2 板块走势图信息
// 1.2 板块走势图信息
if (StringUtils.isNotBlank(block)) {
int[] blockMinMaxPrice = regionStatService.findMinMaxRegionStat(city, region, block, now, weekCounts);
if (blockMinMaxPrice[0] < Integer.MAX_VALUE && blockMinMaxPrice[1] > Integer.MIN_VALUE) {
@@ -752,7 +752,7 @@ public class ReportDetailController {
model.setBlockYearMarkup(null == blockStatBo.getYearMarkup() ? 0 : blockStatBo.getYearMarkup());
model.setBlockMonthMarkup(null == blockStatBo.getMonthMarkup() ? 0 : blockStatBo.getMonthMarkup());
// 6 预测
// 6 预测
BigDecimal bg = new BigDecimal((Math.random() + 1) * 3);
double markup = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
model.setBlockPredictMarkup((int) (markup * 100));
@@ -767,17 +767,17 @@ public class ReportDetailController {
}
}
// 1.2 城市走势图信息
// 1.2 城市走势图信息
RegionStatBo cityStatBo = regionStatService.findYearPeriodStatBoByCity(city);
if (null != cityStatBo) {
// 6 预测
// 6 预测
BigDecimal bg = new BigDecimal((Math.random() + 1) * 3);
double markup = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
model.setCityPredictMarkup((int) (markup * 100));
model.setCityPredictPrice((int) (cityStatBo.getAvgPrice() * (1 + markup / 100)));
}
// 6 房价预测
// 6 房价预测
BigDecimal bg = new BigDecimal((Math.random() + 1) * 3);
double markup = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
model.setHousePredictMarkup((int) (markup * 100));
@@ -880,53 +880,53 @@ public class ReportDetailController {
return Models.NOT_FOUNT;
}
String body = "购买《成交参考》"; // 商品描述,推荐格式:商品名称(订单编号:订单编号)
String body = "购买《成交参考》"; // 商品描述,推荐格式:商品名称(订单编号:订单编号)
switch (type) {
case 1:
body = "购买《成交参考》";
body = "购买《成交参考》";
break;
case 2:
body = "购买《租金/租赁情况》";
body = "购买《租金/租赁情况》";
break;
case 3:
return Models.NOT_FOUNT;
/*
* body = "购买《楼盘情报》"; break;
* body = "购买《楼盘情报》"; break;
*/
case 4:
return Models.NOT_FOUNT;
/*
* body = "购买《江湖地位/口碑》"; break;
* body = "购买《江湖地位/口碑》"; break;
*/
case 5:
body = "购买《中介实力排行》";
body = "购买《中介实力排行》";
break;
case 6:
body = "购买《房价走势&涨跌幅预测》";
body = "购买《房价走势&涨跌幅预测》";
break;
case 7:
body = "购买《房子稀缺程度》";
body = "购买《房子稀缺程度》";
break;
case 8:
body = "购买《生活便利指数》";
body = "购买《生活便利指数》";
break;
}
String subject = body; // 商品名称
String subject = body; // 商品名称
String notify_url = model.getCityUrl() + "/reportDetail/notify";
String return_url = model.getCityUrl() + "/reportDetail/paySuccess";
String partner = AlipayConfig.alipayPartner;
String seller_email = AlipayConfig.alipayEmail;
String payment_type = "1";// 支付宝类型.1代表商品购买
String payment_type = "1";// 支付宝类型.1代表商品购买
String ip = AnalyticsUtil.getIpAddress(request);
Double money = 10D;
if (ip.equals("116.247.70.58") || ip.startsWith("192.168.0.") || ip.startsWith("192.168.10.")) {
money = 0.01;// 公司测试ip
money = 0.01;// 公司测试ip
}
String total_fee = String.valueOf(money); // 订单总价
String paymethod = "bankPay";// 赋值:bankPay(网银);cartoon(卡通);
String total_fee = String.valueOf(money); // 订单总价
String paymethod = "bankPay";// 赋值:bankPay(网银);cartoon(卡通);
String input_charset = AlipayConfig.input_charset;
String key = AlipayConfig.alipayKey;
@@ -944,7 +944,7 @@ public class ReportDetailController {
entity.setType(type);
entity.setCity(evaluation.getCity());
entity.setEvaluationId(evaluation.getId());
entity.setTypeDesc(body.replace("购买", ""));
entity.setTypeDesc(body.replace("购买", ""));
if (ip.equals("116.247.70.58") || ip.startsWith("192.168.0.") || ip.startsWith("192.168.10.")) {
entity.setStatus(1);
} else {
@@ -952,7 +952,7 @@ public class ReportDetailController {
}
entity.setTotalFee(money);
entity.setBank(model.getDefaultbank());
entity.setCardType(model.getCardType() == 0 ? "储蓄卡" : "信用卡");
entity.setCardType(model.getCardType() == 0 ? "储蓄卡" : "信用卡");
entity.setUid(CoresiteCookieContext.getInstance().getCookieValue(request, CookieName.UID));
entity.setSid(CoresiteCookieContext.getInstance().getCookieValue(request, CookieName.SID));
entity.setIp(ip);
@@ -990,7 +990,7 @@ public class ReportDetailController {
Set<String> keys = params.keySet();
for (String key : keys) {
if (!(key.equals("sign_type") || key.equals("sign"))) {
// 除去sign和sign_type两个参数
// 除去sign和sign_type两个参数
params_sign.put(key, request.getParameter(key));
}
}
@@ -1015,7 +1015,7 @@ public class ReportDetailController {
LOGGER.warn("----------paySuccess entityId:" + entity.getId());
// 支付宝交易号
// 支付宝交易号
String trade_no = request.getParameter("trade_no") == null ? "" : request.getParameter("trade_no");
Map<String, Object> data = new HashMap<String, Object>();
data.put("status", 1);
@@ -1052,7 +1052,7 @@ public class ReportDetailController {
Calendar ca = Calendar.getInstance();
ca.setTime(endDate);
ca.add(Calendar.MONTH, -6);
// 半年前月份第一天
// 半年前月份第一天
Date halfYearMonth = ca.getTime();
params.add(new QueryParam("publishDate", QueryParam.GREATER_THAN_OPERATOR, halfYearMonth));
params.add(new QueryParam("publishDate", QueryParam.LESS_THAN_OPERATOR, endDate));
@@ -21,7 +21,7 @@ import java.util.List;
import java.util.Map;
/**
* 资源中心Controller
* 资源中心Controller
*/
public class ResourceController {
@@ -41,7 +41,7 @@ public class ResourceController {
List<NewsResource> newsResources = newsResourceService.findNewsResource(null, null, null, pager);
model.setNewsResources(newsResources);
model.setTotal(total);
//封装广告信息
//封装广告信息
wrapAdvertisement(model,AdSourceEnum.SOURCE.getId());
return model;
@@ -68,9 +68,9 @@ public class ResourceController {
}
}
//PC端轮播广告如果为两个时循环两遍(添加重复的两条)
//PC端轮播广告如果为两个时循环两遍(添加重复的两条)
if(carouselAdvertisementList!=null){
//有两张以上轮播图片时适应前端排序(把最后一张图片移到最前面)
//有两张以上轮播图片时适应前端排序(把最后一张图片移到最前面)
if(carouselAdvertisementList.size() > 1){
carouselAdvertisementList.add(0, carouselAdvertisementList.get(carouselAdvertisementList.size()-1));
carouselAdvertisementList.remove(carouselAdvertisementList.size()-1);
@@ -91,7 +91,7 @@ public class ResourceController {
List<NewsResource> newsResources = newsResourceService.findNewsResource(NewsResourceTypeEnum.getById("case"), null,null, pager);
model.setNewsResources(newsResources);
model.setTotal(total);
//封装广告信息
//封装广告信息
wrapAdvertisement(model,AdSourceEnum.SOURCE.getId());
return model;
}
@@ -103,7 +103,7 @@ public class ResourceController {
List<NewsResource> newsResources = newsResourceService.findNewsResource(NewsResourceTypeEnum.getById("industry"), null,null, pager);
model.setNewsResources(newsResources);
model.setTotal(total);
//封装广告信息
//封装广告信息
wrapAdvertisement(model,AdSourceEnum.SOURCE.getId());
return model;
}
@@ -115,7 +115,7 @@ public class ResourceController {
List<NewsResource> newsResources = newsResourceService.findNewsResource(NewsResourceTypeEnum.getById("analysis"), null, null,pager);
model.setNewsResources(newsResources);
model.setTotal(total);
//封装广告信息
//封装广告信息
wrapAdvertisement(model,AdSourceEnum.SOURCE.getId());
return model;
}
@@ -127,7 +127,7 @@ public class ResourceController {
List<NewsResource> newsResources = newsResourceService.findNewsResource(NewsResourceTypeEnum.getById("company"), null, null,pager);
model.setNewsResources(newsResources);
model.setTotal(total);
//封装广告信息
//封装广告信息
wrapAdvertisement(model,AdSourceEnum.SOURCE.getId());
return model;
}
@@ -149,7 +149,7 @@ public class ResourceController {
List<NewsResource> newsResources = newsResourceService.findNewsResource(NewsResourceTypeEnum.getById(newsResource.getType()), null, model.getId(), new Pager(3));
model.setNewsResources(newsResources);
model.setNewsResource(newsResource);
//封装广告信息
//封装广告信息
wrapAdvertisement(model,AdSourceEnum.SOURCE_DETAIL.getId());
return model;
}
@@ -162,7 +162,7 @@ public class ResourceController {
Pager pager = new Pager(model.getLimit());
List<NewsResource> newsResources = newsResourceService.findNewsResource(null, NewResourceRecommendEnum.getById(model.getModule()),null, pager);
model.setNewsResources(newsResources);
//封装广告信息
//封装广告信息
wrapAdvertisement(model,AdSourceEnum.SOURCE.getId());
return model;
}
@@ -53,12 +53,12 @@ public class SaleLeadsController {
private ServerAreaService serverAreaService;
private NewsResourceService newsResourceService;
/**
* 短信Service
* 短信Service
*/
private SmsService smsService;
/**
* 用户Service
* 用户Service
*/
private FangJiaUserService fangJiaUserService;
@@ -70,7 +70,7 @@ public class SaleLeadsController {
}
/**
* 地数公众号咨询
* 地数公众号咨询
* @param model
* @return
*/
@@ -105,17 +105,17 @@ public class SaleLeadsController {
model.setViewParam("location", "/saleLeads/apply?mid="+model.getMid()+"&backUrl=" + URLEncoder.encode(refUrl));
return model;
}
// 城市所在省
// 城市所在省
ServerArea serverArea = serverAreaService.findByDisplay(saleLeads
.getCity());
if (serverArea != null) {
saleLeads.setProvince(serverArea.getProvince());
}
// 用户
// 用户
saleLeads.setTempId(tempId);
saleLeads.setUserId(LoginUtil.getUserId(req));
//第一次进来,没的业务需求时,用mid设置业务需求
//第一次进来,没的业务需求时,用mid设置业务需求
if(StringUtils.isBlank(saleLeads.getBusiness())){
saleLeads.setBusiness(SalesLeadEnum.getById(model.getMid())
.getValue());
@@ -129,8 +129,8 @@ public class SaleLeadsController {
}
//下载标题
if(model.getMid().equals(SalesLeadEnum.getByValues("下载申请").getId())){
//下载标题
if(model.getMid().equals(SalesLeadEnum.getByValues("下载申请").getId())){
if(StringUtils.isNotBlank(model.getResourceId())){
NewsResource newsResource = newsResourceService.findById(model.getResourceId());
saleLeads.setDownContent(newsResource.getTitle());
@@ -139,7 +139,7 @@ public class SaleLeadsController {
saleLeads.setCreateDate(new Date());
saleLeads.setModifyDate(new Date());
// 网站来源
// 网站来源
String source = COOKIE_CONTEXT.getCookieValue(req,
CookieName.SITE_SOURCE);
if (StringUtils.isNotBlank(source)) {
@@ -172,27 +172,27 @@ public class SaleLeadsController {
saleLeads = converValue(saleLeads);
String body =
"业务需求:" + saleLeads.getBusiness() + " " + saleLeads.getOtherBusiness() + "\n\n"
+ "姓名:" + saleLeads.getUname() + "\n\n"
+ "城市:" + saleLeads.getCity() + "\n\n"
+ "工作职能:" + saleLeads.getWork() + " " + saleLeads.getOtherWork() + "\n\n"
+ "手机:" + saleLeads.getMobile() + "\n\n"
+ "邮箱:" + saleLeads.getEmail() + "\n\n"
+ "公司名称:" + saleLeads.getCompany() + "\n\n"
+ "行业性质:" + saleLeads.getIndustryNature() + " " + saleLeads.getOtherIndustryNature() + "\n\n";
body = body.replaceAll("null", "").replaceAll("其他,请填写", "");
"业务需求:" + saleLeads.getBusiness() + " " + saleLeads.getOtherBusiness() + "\n\n"
+ "姓名:" + saleLeads.getUname() + "\n\n"
+ "城市:" + saleLeads.getCity() + "\n\n"
+ "工作职能:" + saleLeads.getWork() + " " + saleLeads.getOtherWork() + "\n\n"
+ "手机:" + saleLeads.getMobile() + "\n\n"
+ "邮箱:" + saleLeads.getEmail() + "\n\n"
+ "公司名称:" + saleLeads.getCompany() + "\n\n"
+ "行业性质:" + saleLeads.getIndustryNature() + " " + saleLeads.getOtherIndustryNature() + "\n\n";
body = body.replaceAll("null", "").replaceAll("其他,请填写", "");
if (StringUtils.isNotBlank(refUrl) && refUrl.contains("bd_vid")) {
body += "线索来源:百度";
body += "线索来源:百度";
} else if (StringUtils.isNotBlank(refUrl) && refUrl.contains("didata.wechat")) {
body += "线索来源: 地数公众号";
body += "线索来源: 地数公众号";
} else {
body += "线索来源:房价网";
body += "线索来源:房价网";
}
try {
JSONObject requestBody = new JSONObject();
requestBody.put("msgtype", "text");
JSONObject markdown = new JSONObject();
markdown.put("title", "销售线索");
markdown.put("title", "销售线索");
markdown.put("content", body);
requestBody.put("text", markdown);
HttpRequest request = new HttpRequest();
@@ -205,7 +205,7 @@ public class SaleLeadsController {
}
saleLeadsService.save(saleLeads);
// 对于百度广告过来的信息,进行回传
// 对于百度广告过来的信息,进行回传
try {
if (StringUtils.isNotBlank(refUrl) && refUrl.contains("bd_vid")) {
HttpRequest httpRequest = new HttpRequest();
@@ -223,7 +223,7 @@ public class SaleLeadsController {
jsonArray.add(contentJson);
requestBody.put("conversionTypes", jsonArray);
String result = httpRequest.postWithBody(baiduUrl, requestBody, bdHeaders, "UTF-8");
LOG.info("百度回传成功:" + result);
LOG.info("百度回传成功:" + result);
}
} catch (HttpRequestException e) {
e.printStackTrace();
@@ -238,7 +238,7 @@ public class SaleLeadsController {
}
}
//是下载,并且是第一次,除了要保存业务需求还需保存下载代码
//是下载,并且是第一次,除了要保存业务需求还需保存下载代码
if(model.getMid().equals("1016") && !workCode.contains("1016")){
workCode = workCode + "_1016";
}
@@ -253,7 +253,7 @@ public class SaleLeadsController {
if(StringUtils.isNotBlank(refUrl) && refUrl.contains("/resource/info")){
url = refUrl.substring(refUrl.indexOf("/resource/info"), refUrl.length());
} else if (StringUtils.isNotBlank(refUrl) && refUrl.contains("didata.wechat")) { // 地数公众号跳转
} else if (StringUtils.isNotBlank(refUrl) && refUrl.contains("didata.wechat")) { // 地数公众号跳转
url = "/enquire/didataSuccess";
if (StringUtils.isNotBlank(refUrl)) {
url = url + "?backUrl=" + URLEncoder.encode(refUrl);
@@ -353,31 +353,31 @@ public class SaleLeadsController {
// refUrl = req.getScheme() + "//www.fangjia.com";
// }
// 城市所在省
// 城市所在省
ServerArea serverArea = serverAreaService.findByDisplay(saleLeads
.getCity());
if (serverArea != null) {
saleLeads.setProvince(serverArea.getProvince());
}
// 用户
// 用户
String tempId = COOKIE_CONTEXT.getCookieValue(req, CookieName.UID);
saleLeads.setTempId(tempId);
saleLeads.setUserId(LoginUtil.getUserId(req));
//第一次进来,没的业务需求时,用mid设置业务需求
//第一次进来,没的业务需求时,用mid设置业务需求
if(StringUtils.isBlank(saleLeads.getBusiness())){
try{
saleLeads.setBusiness(SalesLeadEnum.getById(model.getMid())
.getValue());
}catch (Exception e){
System.out.println("无法转换Mid: "+model.getMid());
System.out.println("无法转换Mid: "+model.getMid());
}
}
saleLeads.setCreateDate(new Date());
saleLeads.setModifyDate(new Date());
// 网站来源
// 网站来源
String source = COOKIE_CONTEXT.getCookieValue(req,
CookieName.SITE_SOURCE);
if (StringUtils.isNotBlank(source)) {
@@ -397,40 +397,40 @@ public class SaleLeadsController {
String ip = AnalyticsUtil.getIpAddress(req);
saleLeads = converValue(saleLeads);
String body =
"业务需求:" + saleLeads.getBusiness() + "\n\n"
+ "姓名:" + saleLeads.getUname() + "\n\n"
+ "手机:" + saleLeads.getMobile() + "\n\n"
+ "公司:" + saleLeads.getCompany() + "\n\n"
+ "职位:" + saleLeads.getWork()+ "\n\n"
+ "咨询内容:" + saleLeads.getRemarks()+ "\n\n"
+ "IP:" + ip+ "\n\n" ;
body = body.replaceAll("null", "").replaceAll("其他,请填写", "");
"业务需求:" + saleLeads.getBusiness() + "\n\n"
+ "姓名:" + saleLeads.getUname() + "\n\n"
+ "手机:" + saleLeads.getMobile() + "\n\n"
+ "公司:" + saleLeads.getCompany() + "\n\n"
+ "职位:" + saleLeads.getWork()+ "\n\n"
+ "咨询内容:" + saleLeads.getRemarks()+ "\n\n"
+ "IP:" + ip+ "\n\n" ;
body = body.replaceAll("null", "").replaceAll("其他,请填写", "");
if (StringUtils.isNotBlank(refUrl) && refUrl.contains("bd_vid")) {
body += "线索来源:百度";
body += "线索来源:百度";
} else if (StringUtils.isNotBlank(refUrl) && refUrl.contains("didata.wechat")) {
body += "线索来源: 地数公众号";
body += "线索来源: 地数公众号";
} else {
body += "线索来源:房价网";
body += "线索来源:房价网";
}
System.out.println(body);
try {
JSONObject requestBody = new JSONObject();
requestBody.put("msgtype", "text");
JSONObject markdown = new JSONObject();
markdown.put("title", "销售线索");
markdown.put("title", "销售线索");
markdown.put("content", body);
requestBody.put("text", markdown);
HttpRequest request = new HttpRequest();
final String ding_url = "https://oapi.dingtalk.com/robot/send?access_token=894650a12af9497bed599df1d5f93b21d6da5bbae45f35f18c5825580ebbdf64";
Map<String, String> headers = new HashMap<String, String>();
headers.put("Content-Type", "application/json; charset=utf-8");
request.postWithBody(ding_url, requestBody, headers, "UTF-8"); //测试时先去掉
request.postWithBody(ding_url, requestBody, headers, "UTF-8"); //测试时先去掉
} catch (Exception e) {
e.printStackTrace();
}
saleLeadsService.save(saleLeads);
// 对于百度广告过来的信息,进行回传
// 对于百度广告过来的信息,进行回传
try {
if (StringUtils.isNotBlank(refUrl) && refUrl.contains("bd_vid")) {
HttpRequest httpRequest = new HttpRequest();
@@ -448,7 +448,7 @@ public class SaleLeadsController {
jsonArray.add(contentJson);
requestBody.put("conversionTypes", jsonArray);
String result1 = httpRequest.postWithBody(baiduUrl, requestBody, bdHeaders, "UTF-8");
LOG.info("百度回传成功:" + result1);
LOG.info("百度回传成功:" + result1);
}
} catch (HttpRequestException e) {
e.printStackTrace();
@@ -472,7 +472,7 @@ public class SaleLeadsController {
//
// if(StringUtils.isNotBlank(refUrl) && refUrl.contains("/resource/info")){
// url = refUrl.substring(refUrl.indexOf("/resource/info"), refUrl.length());
// } else if (StringUtils.isNotBlank(refUrl) && refUrl.contains("didata.wechat")) { // 地数公众号跳转
// } else if (StringUtils.isNotBlank(refUrl) && refUrl.contains("didata.wechat")) { // 地数公众号跳转
// url = "/enquire/didataSuccess";
// if (StringUtils.isNotBlank(refUrl)) {
// url = url + "?backUrl=" + URLEncoder.encode(refUrl);
@@ -518,7 +518,7 @@ public class SaleLeadsController {
HttpServletResponse res){
String tempId = COOKIE_CONTEXT.getCookieValue(req, CookieName.UID);
//下载标题
//下载标题
String title = null;
if(StringUtils.isNotBlank(model.getResourceId())){
NewsResource newsResource = newsResourceService.findById(model.getResourceId());
@@ -562,7 +562,7 @@ public class SaleLeadsController {
Long ipVisitCount = (Long) CacheUtils.getValue(FangJiaUserService.class, ip);
if(ipVisitCount != null && ipVisitCount > 3){
resultModel.setResult(Message.RESULT_FAIL);
resultModel.setMsg("该IP短信发送频繁");
resultModel.setMsg("该IP短信发送频繁");
return resultModel;
}
if(ipVisitCount == null){
@@ -570,9 +570,9 @@ public class SaleLeadsController {
}
CacheUtils.putValue(CacheUtils.CachePolicyEnum.TODAY, FangJiaUserService.class, ip, ipVisitCount+1);
System.out.println(mobile + " 验证码 【"+ code+"】");
//测试先去掉发短信
smsService.send(model.getMobile(), "【房价网】你的验证码是" + code + ",验证码5分钟内有效,请立即验证。");
System.out.println(mobile + " 验证码 【"+ code+"】");
//测试先去掉发短信
smsService.send(model.getMobile(), "【房价网】你的验证码是" + code + ",验证码5分钟内有效,请立即验证。");
resultModel.setResult(Message.RESULT_SUCCESS);
CacheUtils.putValue(CacheUtils.CachePolicyEnum.TINY, FangJiaUserService.class, mobile + "_" + type, code);
CacheUtils.putValue(CacheUtils.CachePolicyEnum.TINY, FangJiaUserService.class, mobile, new Date().getTime());
@@ -592,10 +592,10 @@ public class SaleLeadsController {
}
/**
* 获取缓存的验证码
* 获取缓存的验证码
* @author yinjihuan
* @param mobile 手机
* @param type 类型
* @param mobile 手机
* @param type 类型
* @return
*/
private String getCacheCode(String mobile, String type) {
@@ -607,7 +607,7 @@ public class SaleLeadsController {
/**
* 数据能力
* 数据能力
* @param model
* @return
* @throws Exception
@@ -80,32 +80,32 @@ public class SchoolController {
}
/**
* 按时间做Seed获取的随机筛选的区域信息
* 按时间做Seed获取的随机筛选的区域信息
*
* @param 区域菜单信息
* @return 随机筛选的区域信息
* @param 区域菜单信息
* @return 随机筛选的区域信息
*/
private List<Item> limit(List<Item> items) {
int needCount = 7;// 获取的数据个数8个
int needCount = 7;// 获取的数据个数8个
int changeDay = 20;// 设置更新频率为20天
int changeDay = 20;// 设置更新频率为20天
int currentCount = items.size();// 当前获取的Region总数
int currentCount = items.size();// 当前获取的Region总数
if (currentCount <= needCount)
return items;
Calendar oldTime = Calendar.getInstance();
oldTime.set(2011, 8, 1);// 初始化时间为2011年09月01日
oldTime.set(2011, 8, 1);// 初始化时间为2011年09月01日
Calendar newTime = Calendar.getInstance();
int reduceDay = SimRandom.getReduceDay(newTime, oldTime);// 获取日期与初始日期相差天数
int reduceDay = SimRandom.getReduceDay(newTime, oldTime);// 获取日期与初始日期相差天数
int seed = (int) reduceDay / changeDay;// 计算simRandom变化频率,20表示20天更新一次
int seed = (int) reduceDay / changeDay;// 计算simRandom变化频率,20表示20天更新一次
List<Integer> simIndexs = SimRandom.getSimRandom(seed, currentCount, needCount);// 获取随机Index
List<Integer> simIndexs = SimRandom.getSimRandom(seed, currentCount, needCount);// 获取随机Index
List<Item> limitedRegions = new ArrayList<Item>(needCount);
for (int index : simIndexs) {
@@ -52,12 +52,12 @@ public class SellHouseReportController {
private final static Logger LOGGER = LoggerFactory.getLogger(SellHouseReportController.class);
/**
* 房源挂牌数据列表
* 房源挂牌数据列表
* @param model
* @return
*/
public Object quoteListAction(HouseReportModel model){
LOGGER.info("SellHouseReportController.quoteListAction 参数model为" + JsonUtils.toJson(model));
LOGGER.info("SellHouseReportController.quoteListAction 参数model为" + JsonUtils.toJson(model));
Evaluation eval = evaluationService.findEvaluationById(model.getEid());
model.setEvaluation(eval);
Pager pager = model.getPager(20);
@@ -73,12 +73,12 @@ public class SellHouseReportController {
}
/**
* 成交数据列表
* 成交数据列表
* @param model
* @return
*/
public Object dealListAction(HouseReportModel model){
LOGGER.info("SellHouseReportController.dealListAction 参数model为" + JsonUtils.toJson(model));
LOGGER.info("SellHouseReportController.dealListAction 参数model为" + JsonUtils.toJson(model));
Evaluation eval = evaluationService.findEvaluationById(model.getEid());
model.setEvaluation(eval);
Pager pager = model.getPager(20);
@@ -95,12 +95,12 @@ public class SellHouseReportController {
}
/**
* 简要报告
* 简要报告
* @param model
* @return
*/
public Object briefAction(HouseReportModel model){
model.setReportTitle("简要报告");
model.setReportTitle("简要报告");
Evaluation eval = evaluationService.findEvaluationById(model.getEid());
model.setEvaluation(eval);
SqmetreRent sqmetreRent = sqmetreRentService.findNearestSqmetreRent(eval.getCity(), eval.getRegion(), eval.getDistrictName(), "district");
@@ -108,8 +108,8 @@ public class SellHouseReportController {
int rentPrice = (int) (sqmetreRent.getAvgPrice().intValue() * eval.getArea());
model.setRentPrice(rentPrice);
}
List<LoanProduct> creditProductList = loanProductService.findProductByType("信用贷",LoanProductPositionEnum.SIMPLE_REPORT.getId());
List<LoanProduct> houseProductList = loanProductService.findProductByType("房抵贷",LoanProductPositionEnum.SIMPLE_REPORT.getId());
List<LoanProduct> creditProductList = loanProductService.findProductByType("信用贷",LoanProductPositionEnum.SIMPLE_REPORT.getId());
List<LoanProduct> houseProductList = loanProductService.findProductByType("房抵贷",LoanProductPositionEnum.SIMPLE_REPORT.getId());
if(creditProductList!=null && creditProductList.size()>0){
LoanProduct creditProduct = creditProductList.get(0);
List<String> tagList = new ArrayList<String>();
@@ -137,16 +137,16 @@ public class SellHouseReportController {
}
/**
* 卖房报告
* 卖房报告
* @param model
* @return
*/
public Object sellAction(HouseReportModel model){
model.setReportTitle("卖房报告");
model.setReportTitle("卖房报告");
Evaluation eval = evaluationService.findEvaluationById(model.getEid());
model.setEvaluation(eval);
List<LoanProduct> creditProductList = loanProductService.findProductByType("信用贷",LoanProductPositionEnum.SELL_REPORT.getId());
List<LoanProduct> houseProductList = loanProductService.findProductByType("房抵贷",LoanProductPositionEnum.SELL_REPORT.getId());
List<LoanProduct> creditProductList = loanProductService.findProductByType("信用贷",LoanProductPositionEnum.SELL_REPORT.getId());
List<LoanProduct> houseProductList = loanProductService.findProductByType("房抵贷",LoanProductPositionEnum.SELL_REPORT.getId());
if(creditProductList!=null && creditProductList.size()>0){
LoanProduct creditProduct = creditProductList.get(0);
List<String> tagList = new ArrayList<String>();
@@ -190,7 +190,7 @@ public class SellHouseReportController {
}
/**
* 挂牌信息
* 挂牌信息
* @param model
* @return
*/
@@ -213,7 +213,7 @@ public class SellHouseReportController {
}
/**
* 成交信息模块
* 成交信息模块
* @param model
* @return
*/
@@ -107,7 +107,7 @@ public class SellHouseSearchController {
}
/**
* 列表页上的估价,异步实现
* 列表页上的估价,异步实现
*
* @param model
* @return
@@ -131,10 +131,10 @@ public class SellHouseSearchController {
private FacetQueryResult<HouseBo> feedAndFilterHouseBoList(FacetQueryResult<HouseBo> houseBoResult, HouseModel model)
throws Exception {
// 暂停CPC逻辑
// 暂停CPC逻辑
// cpcService.checkCpcUserEnable(houseBoResult);
// 增加最后的CPC房源 13/01/09
// 增加最后的CPC房源 13/01/09
// addCpcHouse(houseBoResult, model);
for (HouseBo bo : houseBoResult) {
@@ -153,7 +153,7 @@ public class SellHouseSearchController {
bo.setName(StringUtils.replaceChars(StringUtils.substring(DataUtil.removeHtml(bo.getHouse().getName()), 0, 20),
'@', ' '));
// 关键词高亮
// 关键词高亮
if (model != null && (StringUtils.isNotBlank(model.getKeyword()) || StringUtils.isNotBlank(model.getHouseTag()))) {
String highLightWord = "";
if (StringUtils.isNotBlank(model.getKeyword())) {
@@ -205,7 +205,7 @@ public class SellHouseSearchController {
}
/**
* 起始位置比总数大,说明当前页数不对,从第一页开始
* 起始位置比总数大,说明当前页数不对,从第一页开始
*
* @param maxRow
* @param pager
@@ -226,7 +226,7 @@ public class SellHouseSearchController {
}
/**
* 二手房搜索列表页面
* 二手房搜索列表页面
*
* @param model
* @return
@@ -258,14 +258,14 @@ public class SellHouseSearchController {
//// }
//// }
//
// // 菜单类型,如果城市不支持地铁,或地铁参数不对,则默认用区域菜单(学校使用默认菜单)
// // 菜单类型,如果城市不支持地铁,或地铁参数不对,则默认用区域菜单(学校使用默认菜单)
// if (!FangjiaServerAreaContextHolder.getServerAreaDefault().isSupportMetro() || null == menuType || menuType > 2
// || menuType < 0) {
// menuType = 1;
// }
//
// HouseQueryBean queryBean = null;
// boolean facetByRegion = false;// 是否按区域,板块分面
// boolean facetByRegion = false;// 是否按区域,板块分面
//
// Menu menu = menuService.menuMaker(FangjiaServerAreaContextHolder.getServerAreaDefault(), MenuCategoryEnum.ershoufang,
// getCurrentParams(), 0);
@@ -275,13 +275,13 @@ public class SellHouseSearchController {
// model.setShowSchool(1);
//// queryBean = this.buildSchoolHouseQueryBean(model);
// }
// if (queryBean == null) {// 普通查询
// if (queryBean == null) {// 普通查询
// queryBean = this.buildHouseQueryBean(model);
// }
// String city = FangjiaServerAreaContextHolder.getServerAreaDefault().getDisplay();
// queryBean.setCity(city);
//
// // 老网站的URL中区域是带“区”的
// // 老网站的URL中区域是带“区”的
// if (StringUtils.isNotBlank(queryBean.getRegion())) {
// List<Group> gList = menu.getGroupList();
// for (Group g : gList) {
@@ -302,8 +302,8 @@ public class SellHouseSearchController {
// queryBean.setWebsiteName("fangjia.com");
// FacetQueryResult<HouseBo> houseBoResult = new FacetQueryResult<HouseBo>();
// Sort sort = getSort(model);
// if (sort == null) {// 没有排序条件
// // 如果是学区房检索
// if (sort == null) {// 没有排序条件
// // 如果是学区房检索
//// if (null != model.getIfSchool()) {
//// houseBoResult = schoolHouseSearch(model, pager, menu, queryBean, null, false, facetByRegion);
//// } else {
@@ -347,7 +347,7 @@ public class SellHouseSearchController {
// model.setSuggestList(suggestList);
// }
//
// // 处理类似房源信息
// // 处理类似房源信息
// setSimilarInfoToList(houseBoResult);//
// model.setMenu(menu);
// List<String> conditions = menuService.getConditions(FangjiaServerAreaContextHolder.getServerAreaDefault(),
@@ -363,21 +363,21 @@ public class SellHouseSearchController {
// model.setConditionItems(conditionItems);
//
// /**
// * gasm统计
// * gasm统计
// */
// model.addGaMap(Gakey.rc, pager.getTotalRows());
//
// /**
// * 二手房列表底部SEO推荐区域
// * 二手房列表底部SEO推荐区域
// */
// ServerArea serverArea = FangjiaServerAreaContextHolder.getServerAreaDefault();
// List<Item> autoRegionRecommends = menuService.getRegionsByCity(serverArea, MenuCategoryEnum.ershoufang);
// model.setAutoRegionRecommends(limit(autoRegionRecommends));
//
// // 自定义面积、价格范围搜索
// // 自定义面积、价格范围搜索
// processUserConditions(model);
//
// // 搜索无结果时,根据关键字推荐其他城市的小区
// // 搜索无结果时,根据关键字推荐其他城市的小区
// if (pager.getTotalRows() == 0 && StringUtils.isNotBlank(model.getKeyword())) {
// Map<String, Object> konwbase = knowbaseService.parseWord(model.getKeyword());
// List<Map<String, Object>> districts = (null != konwbase && null != konwbase.get("district_name")) ? (List<Map<String, Object>>) konwbase
@@ -419,7 +419,7 @@ public class SellHouseSearchController {
// model.setDistrict(district);
// }
//
// // 底部热门推荐的其他城市
// // 底部热门推荐的其他城市
// List<CityGroup> footerCitys = new ArrayList<CityGroup>(10);
// List<String> cityNames = ServerAreaData.getServerAreaDisplayList(10);
// for (String name : cityNames) {
@@ -439,10 +439,10 @@ public class SellHouseSearchController {
List<HouseBo> extraBoList;
Pager pager = new Pager(3);
if ("三亚".equals(cityDisplay)) {
extraBoList = getExtraHouses("德佑地产", cityDisplay, true, pager);
} else if ("厦门".equals(cityDisplay)) {
extraBoList = getExtraHouses("黄金屋", cityDisplay, true, pager);
if ("三亚".equals(cityDisplay)) {
extraBoList = getExtraHouses("德佑地产", cityDisplay, true, pager);
} else if ("厦门".equals(cityDisplay)) {
extraBoList = getExtraHouses("黄金屋", cityDisplay, true, pager);
} else {
extraBoList = getExtraHouses("firstvilla.com.cn", cityDisplay, false, pager);
}
@@ -511,7 +511,7 @@ public class SellHouseSearchController {
}
/**
* 处理列表上方的筛选条件
* 处理列表上方的筛选条件
*
* @param model
*/
@@ -527,7 +527,7 @@ public class SellHouseSearchController {
String totalPriceRange = model.getTotalPriceRange();
if (NumberUtils.isDigits(totalPriceRange)) {
// 菜单中选择
// 菜单中选择
Value v = menuService.getValue(FangjiaServerAreaContextHolder.getServerAreaDefault(), MenuCategoryEnum.ershoufang,
"totalPriceRange", totalPriceRange);
model.setMinPrice(v.getMin() / 10000);
@@ -549,11 +549,11 @@ public class SellHouseSearchController {
String cancelPrice = "";
if (null != model.getMinPrice() && null != model.getMaxPrice()) {
cancelPrice = model.getMinPrice() + "-" + model.getMaxPrice() + "万";
cancelPrice = model.getMinPrice() + "-" + model.getMaxPrice() + "万";
} else if (null != model.getMinPrice()) {
cancelPrice = model.getMinPrice() + "万以上";
cancelPrice = model.getMinPrice() + "万以上";
} else if (null != model.getMaxPrice()) {
cancelPrice = model.getMaxPrice() + "万以下";
cancelPrice = model.getMaxPrice() + "万以下";
}
if (StringUtils.isNotBlank(cancelPrice)) {
@@ -588,11 +588,11 @@ public class SellHouseSearchController {
String cancelArea = "";
if (null != model.getMinArea() && null != model.getMaxArea()) {
cancelArea = model.getMinArea() + "-" + model.getMaxArea() + "平米";
cancelArea = model.getMinArea() + "-" + model.getMaxArea() + "平米";
} else if (null != model.getMinArea()) {
cancelArea = model.getMinArea() + "平米以上";
cancelArea = model.getMinArea() + "平米以上";
} else if (null != model.getMaxArea()) {
cancelArea = model.getMaxArea() + "平米以下";
cancelArea = model.getMaxArea() + "平米以下";
}
if (StringUtils.isNotBlank(cancelArea)) {
@@ -605,13 +605,13 @@ public class SellHouseSearchController {
}
if (null != model.getIfSchool() && model.getIfSchool() == 1 && (null == model.getMenuType() || model.getMenuType() != 3)) {
cons.add("学区房");
consMap.add(new Item("1", "学区房", new Group("ifSchool")));
cons.add("学区房");
consMap.add(new Item("1", "学区房", new Group("ifSchool")));
}
if (null != model.getIfMetro() && model.getIfMetro() == 1 && (null == model.getMenuType() || model.getMenuType() != 2)) {
cons.add("地铁房");
consMap.add(new Item("1", "地铁房", new Group("ifMetro")));
cons.add("地铁房");
consMap.add(new Item("1", "地铁房", new Group("ifMetro")));
}
if (StringUtils.isNotBlank(model.getCompanyStd())) {
@@ -624,30 +624,30 @@ public class SellHouseSearchController {
}
/**
* 给有经纬度的房源的similarInfo赋值
* 给有经纬度的房源的similarInfo赋值
*
* @param houseBoResult
*/
private void setSimilarInfoToList(FacetQueryResult<HouseBo> houseBoResult) {
for (HouseBo houseBo : houseBoResult) {
if (houseBo.isMatchedDistrict()) {
// "黄浦区_上海康城_2室_98平米_126万_相似房源"
// "黄浦区_上海康城_2室_98平米_126万_相似房源"
String districtName = houseBo.getDistrictName();
// 去掉小区的高亮字符,eg:<font+color%3D'red'>上海康城<%2Ffont>;<font
// 去掉小区的高亮字符,eg:<font+color%3D'red'>上海康城<%2Ffont>;<font
// color='red'>
if (districtName.contains("<font color='red'>") || districtName.contains("<font+color%3D'red'>")) {
districtName = DataUtil.removeHtml(districtName);
}
// DataUtil.removeHtml(str)
String similarInfo = houseBo.getRegion() + "区_" + districtName + "_" + houseBo.getHouse().getRoom() + "室_"
+ (int) ((double) houseBo.getHouse().getArea()) + "平米_" + getAvgPrice(houseBo.getHouse()) + "元(㎡)_类似房源";
String similarInfo = houseBo.getRegion() + "区_" + districtName + "_" + houseBo.getHouse().getRoom() + "室_"
+ (int) ((double) houseBo.getHouse().getArea()) + "平米_" + getAvgPrice(houseBo.getHouse()) + "元(㎡)_类似房源";
houseBo.setSimilarInfo(similarInfo);
}
}
}
/**
* 计算房屋单价
* 计算房屋单价
*
* @param house
* @return
@@ -671,21 +671,21 @@ public class SellHouseSearchController {
String sortField, boolean asc, boolean facetByRegion) {
/***** schoolQueryResult **********************************************/
FacetQueryResult<HouseBo> houseBoResult = new FacetQueryResult<HouseBo>(0);
// 输入的关键字
// 输入的关键字
// if (StringUtils.isNotBlank(queryBean.getSchool())) {
houseBoResult = houseService.findWithFacetSearch(menu, pager, queryBean, sortField, asc, facetByRegion);
// } else {
// // 不分面
// // 不分面
// houseBoResult = houseService.findByQueryBeanSort(pager, queryBean,
// sortField, asc);
// // 分面
// // 分面
// }
/***** schoolQueryResult **********************************************/
return houseBoResult;
}
/**
* 地铁房Query
* 地铁房Query
*
* @param model
* @return
@@ -696,7 +696,7 @@ public class SellHouseSearchController {
}
/**
* 普通Query构建
* 普通Query构建
*
* @param model
* @return
@@ -714,7 +714,7 @@ public class SellHouseSearchController {
queryBean.setFullTextSearch(true);
/**
* 如果是命名查询
* 如果是命名查询
*/
if (StringUtils.isNotBlank(model.getCustomQuery())) {
Customquery customquery = customqueryService.findByName(model.getCustomQuery());
@@ -746,7 +746,7 @@ public class SellHouseSearchController {
}
/**
* 学区房Query
* 学区房Query
*
* @param model
* @return
@@ -785,32 +785,32 @@ public class SellHouseSearchController {
}
/**
* 按时间做Seed获取的随机筛选的区域信息
* 按时间做Seed获取的随机筛选的区域信息
*
* @param items
* @return 随机筛选的区域信息
* @return 随机筛选的区域信息
*/
private List<Item> limit(List<Item> items) {
int needCount = 9;// 获取的数据个数10个
int needCount = 9;// 获取的数据个数10个
int changeDay = 20;// 设置更新频率为20天
int changeDay = 20;// 设置更新频率为20天
int currentCount = items.size();// 当前获取的Region总数
int currentCount = items.size();// 当前获取的Region总数
if (currentCount <= needCount)
return items;
Calendar oldTime = Calendar.getInstance();
oldTime.set(2011, 8, 1);// 初始化时间为2011年09月01日
oldTime.set(2011, 8, 1);// 初始化时间为2011年09月01日
Calendar newTime = Calendar.getInstance();
int reduceDay = SimRandom.getReduceDay(newTime, oldTime);// 获取日期与初始日期相差天数
int reduceDay = SimRandom.getReduceDay(newTime, oldTime);// 获取日期与初始日期相差天数
int seed = (int) reduceDay / changeDay;// 计算simRandom变化频率,20表示20天更新一次
int seed = (int) reduceDay / changeDay;// 计算simRandom变化频率,20表示20天更新一次
List<Integer> simIndexs = SimRandom.getSimRandom(seed, currentCount, needCount);// 获取随机Index
List<Integer> simIndexs = SimRandom.getSimRandom(seed, currentCount, needCount);// 获取随机Index
List<Item> limitedRegions = new ArrayList<Item>(needCount);
for (int index : simIndexs) {
@@ -857,7 +857,7 @@ public class SellHouseSearchController {
model.setDistrictName(district.getName());
}
/**---------------------------2015/10/08 舍弃使用知识库 王文艳
/**---------------------------2015/10/08 舍弃使用知识库 王文艳
Map<String, Object> currentDistrict = null;
Map<String, Object> konwbase = knowbaseService.parseWord(model.getKeyword());
List<Map<String, Object>> districts = (null != konwbase && null != konwbase.get("district_name")) ? (List<Map<String, Object>>) konwbase
@@ -885,7 +885,7 @@ public class SellHouseSearchController {
District district = districtService.findDistrict(new DistrictKey(city, region, district_name), false);
model.setDistrict(district);
model.setRegion(region);
// 右侧小区地图
// 右侧小区地图
if (null != district && null != district.getLat() && null != district.getLng()) {
double lat = (double) (district.getLat()) / 10000000000L;
double lng = (double) (district.getLng()) / 10000000000L;
@@ -912,7 +912,7 @@ public class SellHouseSearchController {
}
/**
* 重新评估
* 重新评估
*
* @param model
* @return
@@ -949,7 +949,7 @@ public class SellHouseSearchController {
}
// /**
// * 按房源相似信息获取QueryBean
// * 按房源相似信息获取QueryBean
// *
// * @param queryBean
// * @param model
@@ -994,13 +994,13 @@ public class SellHouseSearchController {
// }
// if (similarInfoStr.length >= 5 &&
// StringUtils.isNotBlank(similarInfoStr[4])) {
// if (similarInfoStr[4].endsWith("元(㎡)")) {
// if (similarInfoStr[4].endsWith("元(㎡)")) {
// String avgPrice = similarInfoStr[4].substring(0,
// similarInfoStr[4].length() - 4);
// if (StringUtils.isNumeric(avgPrice)) {
// model.setAvgPrice(Integer.parseInt(avgPrice));
// }
// } else if (similarInfoStr[4].endsWith("万")) {
// } else if (similarInfoStr[4].endsWith("万")) {
// String totalPrice = similarInfoStr[4].substring(0,
// similarInfoStr[4].length() - 1);
// if (StringUtils.isNumeric(totalPrice)) {
@@ -1014,10 +1014,10 @@ public class SellHouseSearchController {
// District district = districtService.findDistrict(key, true);
//
// if (null != district && (DataUtil.verifyLatLng(district.getLat(),
// district.getLng()))) {// 小区存在,并检验经纬度
// district.getLng()))) {// 小区存在,并检验经纬度
// model.setLat(String.valueOf(district.getLat()));
// model.setLng(String.valueOf(district.getLng()));
// } else {// 未匹配获得小区,返回,按照普通查询
// } else {// 未匹配获得小区,返回,按照普通查询
// model.setDistrictName(null);
// return null;
// }
@@ -1027,14 +1027,14 @@ public class SellHouseSearchController {
// queryBean.setRegion(region);
// }
//
// if (null != model.getRegion()) { // 如果是重新选择了区域,板块,则在经纬度基础上加 区域,板块
// // 的条件
// if (null != model.getRegion()) { // 如果是重新选择了区域,板块,则在经纬度基础上加 区域,板块
// // 的条件
// queryBean.setRegion(model.getRegion());
// if (null != model.getBlock()) {
// queryBean.setBlock(model.getBlock());
// }
// } else {
// model.setRegion(region);// 按区域分面
// model.setRegion(region);// 按区域分面
// }
// if (null != model.getFloorRange()) {
// queryBean.setFloorRange(model.getFloorRange());
@@ -1043,7 +1043,7 @@ public class SellHouseSearchController {
// queryBean.setHouseTag(model.getHouseTag());
// }
// if (null != model.getDistrictName()) {
// model.setDistrictName(null);// 去掉小区名
// model.setDistrictName(null);// 去掉小区名
// }
// return queryBean;
// } else {
@@ -1053,7 +1053,7 @@ public class SellHouseSearchController {
// }
/**
* 构建 HouseQueryBean 来检索 条件:按经纬度周边5公里,物业类型, 面积,价格 (正负10%),从近到远排序
* 构建 HouseQueryBean 来检索 条件:按经纬度周边5公里,物业类型, 面积,价格 (正负10%),从近到远排序
*
* @param
*
@@ -1076,9 +1076,9 @@ public class SellHouseSearchController {
}
// double dlat = (double) (lat / 10000000000.0);
// double dlng = (double) (lng / 10000000000.0);//
// 纬度必须为正负90,经度为正负180
// 纬度必须为正负90,经度为正负180
// if (!(dlat >= -90 && dlat <= 90 && dlng >= -180 && dlng <= 180))
// {// 经纬度不符合规范,按原来的查
// {// 经纬度不符合规范,按原来的查
// return null;
// }
// queryBean.setLat(lat);
@@ -79,7 +79,7 @@ public class SitemapController {
}
/**
* 页码集列表
* 页码集列表
*
* @param model
* @return
@@ -99,7 +99,7 @@ public class SitemapController {
}
pager.setTotalRows(NUMBER_FOUND);
// 随机推荐100个有效关键词
// 随机推荐100个有效关键词
Pager randomPager = new Pager();
if (pager.getStartRow() < 100 * 100) {
int startRow = RandomUtils.nextInt(100 * 100 * 100 - pager.getPageSize());
@@ -114,7 +114,7 @@ public class SitemapController {
if (pager.getStartRow() > 10000) {
List<KeywordsBaidu> links = keywordsBaiduService.getKeywordsList(pager);
List<KeywordsBaidu> showLinks = new ArrayList<KeywordsBaidu>();
// 过滤无效的数据
// 过滤无效的数据
for (KeywordsBaidu link : links) {
if (link.getVisible() == 0) {
showLinks.add(link);
@@ -122,7 +122,7 @@ public class SitemapController {
}
model.setPageLinks(showLinks);
} else {
// 页码集页面显示所有数据
// 页码集页面显示所有数据
model.setPageLinks(keywordsBaiduService.getKeywordsList(pager));
}
feedFooter(model);
@@ -142,13 +142,13 @@ public class SitemapController {
}
private String getSiteMapDirType(Pager pager) {
if (pager == null) {// 默认一级目录
if (pager == null) {// 默认一级目录
return "first";
} else {
if (pager.getStartRow() > NUMBER_FOUND * 2) {
return "first";
}
if (pager.getCurrentPage() <= 100) {// 二级目录 1-100,三级目录>100
if (pager.getCurrentPage() <= 100) {// 二级目录 1-100,三级目录>100
return "second";
}
}
@@ -156,7 +156,7 @@ public class SitemapController {
}
/**
* 热点地图2
* 热点地图2
*
* @param model
* @return
@@ -164,7 +164,7 @@ public class SitemapController {
public Object list2Action(SiteMapModel model) {
Pager pager = model.getPager();
String dirType = getSiteMapDirType(pager);
if (pager == null) {// 默认一级目录
if (pager == null) {// 默认一级目录
pager = new Pager(100);
} else {
pager.setPageSize(100);
@@ -174,7 +174,7 @@ public class SitemapController {
model.setKeywords(getRandomKeywordsList());
model.setPageLinks(getKeywordsList(pager, false));
} else if (dirType.equals("second")) {
model.setKeywords(getRandomKeywordsList());// 二级目录有随机关键词 ,三级目录没有
model.setKeywords(getRandomKeywordsList());// 二级目录有随机关键词 ,三级目录没有
pager.setStartRow((pager.getCurrentPage()) * 100 + NUMBER_FOUND);
model.setPageLinks(getKeywordsList(pager, false));
} else {
@@ -188,18 +188,18 @@ public class SitemapController {
}
/**
* 查询关键词
* 查询关键词
*
* @param pager
* @param filter
* 是否过滤无效关键词
* @return 关键词列表
* 是否过滤无效关键词
* @return 关键词列表
*/
private List<KeywordsBaidu> getKeywordsList(Pager pager, boolean filter) {
if (filter) {
List<KeywordsBaidu> links = keywordsBaiduService.getKeywordsList(pager);
List<KeywordsBaidu> showLinks = new ArrayList<KeywordsBaidu>();
// 过滤无效的数据
// 过滤无效的数据
for (KeywordsBaidu link : links) {
if (link.getVisible() == 0) {
showLinks.add(link);
@@ -212,7 +212,7 @@ public class SitemapController {
}
private void feedFooter(SiteMapModel model) {
// 最新上线的城市
// 最新上线的城市
List<CityGroup> newCitys = new ArrayList<CityGroup>();
List<ServerArea> serverAreaList = ServerAreaData.getServerAreaList(15);
List<String> cityNames = org.sothis.core.util.CollectionUtils.collect(serverAreaList, new Closure<String, ServerArea>() {
@@ -232,10 +232,10 @@ public class SitemapController {
}
/**
* 获取当前城市
* 获取当前城市
*
* @param request
* @return 当前城市
* @return 当前城市
*/
private ServerArea getSuggestCity(HttpServletRequest request) {
String ip = AnalyticsUtil.getIpAddress(request);
@@ -253,7 +253,7 @@ public class SitemapController {
}
/**
* 随即上限设定
* 随即上限设定
*
* @param maxSize
* @param visibleMaxSize
@@ -268,7 +268,7 @@ public class SitemapController {
}
/**
* 生成SEO关键词SiteMap索引文件
* 生成SEO关键词SiteMap索引文件
*
* @param model
* @return
@@ -295,7 +295,7 @@ public class SitemapController {
}
/**
* 生成SEO关键词页面SiteMap
* 生成SEO关键词页面SiteMap
*
* @param model
* @return
@@ -332,7 +332,7 @@ public class SitemapController {
}
/**
* 页面siteMap
* 页面siteMap
*
* @param model
* @return
@@ -347,7 +347,7 @@ public class SitemapController {
}
/**
* 页面siteMap
* 页面siteMap
*
* @param model
* @return
@@ -364,7 +364,7 @@ public class SitemapController {
model.setCategory("district");
}
// 默认category是district
// 默认category是district
if ("district".equals(model.getCategory())) {
pager.setPageSize(200);
FacetQueryResult<District> result;
@@ -422,7 +422,7 @@ public class SitemapController {
}
/**
* 页面siteMap
* 页面siteMap
*
* @param model
* @return
@@ -441,7 +441,7 @@ public class SitemapController {
/**
*
* 热门标签 小区 地铁 板块SiteMap索引文件
* 热门标签 小区 地铁 板块SiteMap索引文件
*
* @param model
* @return
@@ -453,12 +453,12 @@ public class SitemapController {
ServerArea serverArea = ServerAreaData.getServerAreaByDisplay(display);
String cityUrl = model.getCityUrl(display);
if (serverArea.isSupportBlock()) {
maps.add(new Sitemap(cityUrl + "/sitemap/block", lastModDate));// 板块
maps.add(new Sitemap(cityUrl + "/sitemap/block", lastModDate));// 板块
}
if (serverArea.isSupportMetro()) {
maps.add(new Sitemap(cityUrl + "/sitemap/metro", lastModDate));// 地铁
maps.add(new Sitemap(cityUrl + "/sitemap/metro", lastModDate));// 地铁
}
maps.add(new Sitemap(cityUrl + "/sitemap/hotTag", lastModDate));// 热门标签
maps.add(new Sitemap(cityUrl + "/sitemap/hotTag", lastModDate));// 热门标签
maps.addAll(getDetailLink(model, lastModDate));
}
Sitemapindex mapIndex = new Sitemapindex();
@@ -467,7 +467,7 @@ public class SitemapController {
}
/**
* 按城市获取SiteMap详情链接
* 按城市获取SiteMap详情链接
*
* @param cityUrl
* @return
@@ -476,14 +476,14 @@ public class SitemapController {
List<Sitemap> urls = new ArrayList<Sitemap>();
Map<String, Long> stats = districtService.findFacetDistrictCountByCity();
for (Entry<String, Long> stat : stats.entrySet()) {
int value = (int) (stat.getValue() / 100) + 1;// 分页默认大小 100
int value = (int) (stat.getValue() / 100) + 1;// 分页默认大小 100
urls.addAll(getDistrictUrls(model.getCityUrl(stat.getKey()), value, lastModDate));
}
return urls;
}
/**
* 获取小区_sitemap详细页
* 获取小区_sitemap详细页
*
* @param cityUrl
* @param city
@@ -501,7 +501,7 @@ public class SitemapController {
/**
*
* 热门标签 _sitemap 详细页 (包括二手房热门标签和租房热门标签)
* 热门标签 _sitemap 详细页 (包括二手房热门标签和租房热门标签)
*
*/
public Object hotTagAction(SiteMapModel model, HttpServletResponse response) {
@@ -512,7 +512,7 @@ public class SitemapController {
}
/**
* 区域_Sitemap详细页
* 区域_Sitemap详细页
*
* @param model
* @return
@@ -529,7 +529,7 @@ public class SitemapController {
}
/**
* 获取所有的板块搜索链接
* 获取所有的板块搜索链接
*
* @param model
* @param blocks
@@ -544,7 +544,7 @@ public class SitemapController {
}
/**
* 获取所有的板块搜索链接
* 获取所有的板块搜索链接
*
* @param tags
* @param menus
@@ -569,7 +569,7 @@ public class SitemapController {
}
/**
* 查询当前城市的所有小区
* 查询当前城市的所有小区
*
* @return
*/
@@ -582,7 +582,7 @@ public class SitemapController {
/**
*
* 小区 _sitemap 详细页 包括 小区详情页链接、 二手房列表小区搜索、租房列表小区搜索
* 小区 _sitemap 详细页 包括 小区详情页链接、 二手房列表小区搜索、租房列表小区搜索
*/
public Object districtAction(SiteMapModel model, HttpServletResponse response) {
@@ -597,14 +597,14 @@ public class SitemapController {
List<Url> urls = new ArrayList<Url>();
FacetQueryResult<District> districts = findAllDistricts(pager);
if (CollectionUtils.isNotEmpty(districts)) {
// 添加所有小区详情页的链接
// 添加所有小区详情页的链接
for (District district : districts) {
if (!StringUtils.isBlank(district.getName())) {
urls.add(new Url(model.getCityUrl() + "/xiaoqu-xinxi-" + encode(district.getName()) + "-"
+ encode(district.getRegion()), Priority.PRIORITY_DETAIL));
}
}
// 添加二手房 租房搜索链接
// 添加二手房 租房搜索链接
urls.addAll(getDistrictSearchUrls(model, getDistrictNames(districts), response));
}
model.setPager(pager);
@@ -614,7 +614,7 @@ public class SitemapController {
}
/**
* 地铁_Sitemap详细页
* 地铁_Sitemap详细页
*
* @param model
* @return
@@ -633,7 +633,7 @@ public class SitemapController {
}
/**
* 获取二手房 租房列表 地铁搜索URL
* 获取二手房 租房列表 地铁搜索URL
*
* @param model
* @return
@@ -642,15 +642,15 @@ public class SitemapController {
private List<Url> getMertorsURI(SiteMapModel model, List<Metro> districts, HttpServletResponse response) {
List<Group> sellMenu = getMenuList(model.getCity(), MenuCategoryEnum.ershoufang);
List<Group> rentMenu = getMenuList(model.getCity(), MenuCategoryEnum.zufang);
// 添加所有的二手房地铁搜索链接
// 添加所有的二手房地铁搜索链接
List<Url> urls = findMetroSearchLinks(districts, sellMenu, getCityDomain(model), "/sellHouseSearch/list", response);
// 添加所有的租房地铁搜索链接
// 添加所有的租房地铁搜索链接
urls.addAll(findMetroSearchLinks(districts, rentMenu, getCityDomain(model), "/rentHouseSearch/list", response));
return urls;
}
/**
* 获取城市domain
* 获取城市domain
*
* @param model
* @return
@@ -660,7 +660,7 @@ public class SitemapController {
}
/**
* 获取所有的地铁搜索链接
* 获取所有的地铁搜索链接
*
* @param tags
* @param menus
@@ -685,7 +685,7 @@ public class SitemapController {
}
/**
* 获取二手房 租房列表 小区搜索URL
* 获取二手房 租房列表 小区搜索URL
*
* @param model
* @return
@@ -699,7 +699,7 @@ public class SitemapController {
}
/**
* 获取所有的小区名
* 获取所有的小区名
*
* @param districts
* @return
@@ -714,104 +714,104 @@ public class SitemapController {
}
/**
* 获取初始化标签信息
* 获取初始化标签信息
*
* @return
*/
private List<String> getHotHouseTag() {
List<String> tags = new ArrayList<String>();
tags.add("小户型");
tags.add("地热采暖");
tags.add("地铁沿线");
tags.add("拎包入住");
tags.add("带露台");
tags.add("交通便利");
tags.add("全朝南");
tags.add("随时带看");
tags.add("景观房");
tags.add("高性价比");
tags.add("带车位");
tags.add("学区房");
tags.add("商住两用");
tags.add("带地下室");
tags.add("免佣金");
tags.add("复式房");
tags.add("小区环境好");
tags.add("投资");
tags.add("家电齐全");
tags.add("采光好");
tags.add("豪华装修");
tags.add("带阁楼");
tags.add("繁华地段");
tags.add("带花园");
tags.add("免税房");
tags.add("南北通透");
tags.add("房东急售");
tags.add("小户型");
tags.add("地热采暖");
tags.add("地铁沿线");
tags.add("拎包入住");
tags.add("带露台");
tags.add("交通便利");
tags.add("全朝南");
tags.add("随时带看");
tags.add("景观房");
tags.add("高性价比");
tags.add("带车位");
tags.add("学区房");
tags.add("商住两用");
tags.add("带地下室");
tags.add("免佣金");
tags.add("复式房");
tags.add("小区环境好");
tags.add("投资");
tags.add("家电齐全");
tags.add("采光好");
tags.add("豪华装修");
tags.add("带阁楼");
tags.add("繁华地段");
tags.add("带花园");
tags.add("免税房");
tags.add("南北通透");
tags.add("房东急售");
return tags;
}
/**
* 租房标签
* 租房标签
*
* @return
*/
private List<String> getRentHouseTag() {
List<String> tags = new ArrayList<String>();
tags.add("小户型");
tags.add("随时带看");
tags.add("异性合租");
tags.add("家电齐全");
tags.add("带地下室");
tags.add("地铁沿线");
tags.add("拎包入住");
tags.add("小区环境好");
tags.add("全朝南");
tags.add("景观房");
tags.add("交通便利");
tags.add("高性价比");
tags.add("采光好");
tags.add("大学生租房");
tags.add("商住两用");
tags.add("带车位");
tags.add("免佣金");
tags.add("房东急租");
tags.add("改底单");
tags.add("南北通透");
tags.add("豪华装修");
tags.add("带露台");
tags.add("投资");
tags.add("地热采暖");
tags.add("带阁楼");
tags.add("学区房");
tags.add("带花园");
tags.add("复式房");
tags.add("温泉热水");
tags.add("小户型");
tags.add("随时带看");
tags.add("异性合租");
tags.add("家电齐全");
tags.add("带地下室");
tags.add("地铁沿线");
tags.add("拎包入住");
tags.add("小区环境好");
tags.add("全朝南");
tags.add("景观房");
tags.add("交通便利");
tags.add("高性价比");
tags.add("采光好");
tags.add("大学生租房");
tags.add("商住两用");
tags.add("带车位");
tags.add("免佣金");
tags.add("房东急租");
tags.add("改底单");
tags.add("南北通透");
tags.add("豪华装修");
tags.add("带露台");
tags.add("投资");
tags.add("地热采暖");
tags.add("带阁楼");
tags.add("学区房");
tags.add("带花园");
tags.add("复式房");
tags.add("温泉热水");
return tags;
}
/**
* 获取二手房 租房 热门标签的所有组合链接
* 获取二手房 租房 热门标签的所有组合链接
*
* @param model
* @return
*/
private List<Url> getAllHotHouseTagURI(SiteMapModel model, HttpServletResponse response) {
ServerArea city = model.getCity();
// 二手房链接前缀
// 二手房链接前缀
String sellPreUri = "/sellHouseSearch/list";
// 租房链接前缀
// 租房链接前缀
String rentPreUri = "/rentHouseSearch/list";
// 获取二手房搜索链接
// 获取二手房搜索链接
List<Url> urls = getAllLinks(getHotHouseTag(), getMenuList(city, MenuCategoryEnum.ershoufang), getCityDomain(model),
sellPreUri, response);
// 获取租房搜索链接
// 获取租房搜索链接
urls.addAll(getAllLinks(getRentHouseTag(), getMenuList(city, MenuCategoryEnum.zufang), getCityDomain(model), rentPreUri,
response));
return urls;
}
/**
* 获取Menus对应类型的搜索链接
* 获取Menus对应类型的搜索链接
*
* @param keywords
* @param menus
@@ -828,7 +828,7 @@ public class SitemapController {
}
/**
* 获取KeyWord和Menus组合的搜索链接
* 获取KeyWord和Menus组合的搜索链接
*
* @param keyword
* @param menus
@@ -849,7 +849,7 @@ public class SitemapController {
}
/**
* 获取搜索URL
* 获取搜索URL
*
* @param keyword
* @param item
@@ -864,7 +864,7 @@ public class SitemapController {
}
/**
* Encode 编码UTF-8
* Encode 编码UTF-8
*
* @param value
* @return
@@ -36,7 +36,7 @@ public class SnapDataController {
private RentHouseService rentHouseService;
/**
* 保存房源浏览记录
* 保存房源浏览记录
*
* @param model
* @return
@@ -74,7 +74,7 @@ public class SnapDataController {
}
/**
* 保存搜索关键字
* 保存搜索关键字
*
* @param model
* @return
@@ -85,17 +85,17 @@ public class SnapDataController {
// String uid = CoresiteCookieContext.getInstance().getCookieValue(ActionContext.getContext().getRequest(), CookieName.UID);
//
// String url = "";
// if ("sell".equals(model.getType())) { // 二手房
// if ("sell".equals(model.getType())) { // 二手房
// url = model.getCityUrl() + "/ershoufang/" + URLEncoder.encode(model.getKeyword(), "UTF-8");
// } else if ("rent".equals(model.getType())) { // 租房
// } else if ("rent".equals(model.getType())) { // 租房
// url = model.getCityUrl() + "/zufang/" + URLEncoder.encode(model.getKeyword(), "UTF-8");
// } else if ("district".equals(model.getType())) { // 小区
// } else if ("district".equals(model.getType())) { // 小区
// url = model.getCityUrl() + "/xiaoqu/" + URLEncoder.encode(model.getKeyword(), "UTF-8");
// } else if ("evaluation".equals(model.getType())) { // 估价
// } else if ("evaluation".equals(model.getType())) { // 估价
// url = model.getCityUrl() + "/evaluation/report?keyword=" + URLEncoder.encode(model.getKeyword(), "UTF-8");
// } else if ("news".equals(model.getType())) { // 资讯
// } else if ("news".equals(model.getType())) { // 资讯
// url = model.getSouUrl() + "/xinwen/" + URLEncoder.encode(model.getKeyword(), "UTF-8");
// } else if ("newDistrict".equals(model.getType())) { // 新盘
// } else if ("newDistrict".equals(model.getType())) { // 新盘
// url = model.getCityUrl() + "/xinfang/" + URLEncoder.encode(model.getKeyword(), "UTF-8");
// } else {
// if (model.getKeyword() == null) {
@@ -111,7 +111,7 @@ public class SnapDataController {
}
/**
* 保存估价记录
* 保存估价记录
*
* @param model
* @return
@@ -136,7 +136,7 @@ public class SnapDataController {
}
/**
* 获取历史记录(房源浏览,搜索,估价记录)
* 获取历史记录(房源浏览,搜索,估价记录)
*
* @param model
* @return
@@ -147,7 +147,7 @@ public class SnapDataController {
List<Map<String, Object>> data = null;
if (null != sd && CollectionUtils.isNotEmpty(sd.getData())) {
data = sd.getData();
// 倒排序
// 倒排序
Collections.sort(data, new Comparator<Map<String, Object>>() {
public int compare(Map<String, Object> o1, Map<String, Object> o2) {
return 1;
@@ -180,7 +180,7 @@ public class SnapDataController {
}
/**
* 给Url标记为来自工具条
* 给Url标记为来自工具条
*
* @param data
*/
@@ -209,14 +209,14 @@ public class SnapDataController {
}
/**
* 房源浏览记录加入cpc逻辑判断
* 房源浏览记录加入cpc逻辑判断
*
* @param model
* @return
*/
@SuppressWarnings("unchecked")
private void addCpcInfoIfexists(List<Map<String, Object>> data) {
// // 加入cpc
// // 加入cpc
// try {
// List<ObjectId> idListSell = new ArrayList<ObjectId>();
// List<ObjectId> idListRent = new ArrayList<ObjectId>();
@@ -12,14 +12,14 @@ import java.util.HashMap;
import java.util.Map;
/**
* 解决方案 控制器
* 解决方案 控制器
* @author yinjihuan
*
*/
public class SolutionController {
/**
* API介绍
* API介绍
* @param model
* @return
*/
@@ -28,7 +28,7 @@ public class SolutionController {
}
/**
* API文档
* API文档
* @param model
* @return
*/
@@ -37,7 +37,7 @@ public class SolutionController {
}
/**
* 贷前估值解决方案
* 贷前估值解决方案
* @param model
* @return
*/
@@ -46,7 +46,7 @@ public class SolutionController {
}
/**
* 银行内屏解决方案
* 银行内屏解决方案
* @param model
* @return
*/
@@ -55,7 +55,7 @@ public class SolutionController {
}
/**
* 贷中估值解决方案
* 贷中估值解决方案
* @param model
* @return
*/
@@ -67,7 +67,7 @@ public class SolutionController {
return model;
}
/**
* 贷后管理解决方案
* 贷后管理解决方案
* @param model
* @return
*/
@@ -76,7 +76,7 @@ public class SolutionController {
}
/**
* 房生活金融客户端营销解决方案
* 房生活金融客户端营销解决方案
* @param model
* @return
*/
@@ -85,7 +85,7 @@ public class SolutionController {
}
/**
* 房贷业务获客解决方案
* 房贷业务获客解决方案
* @param model
* @return
*/
@@ -94,7 +94,7 @@ public class SolutionController {
}
/**
* 地址精准营销解决方案
* 地址精准营销解决方案
* @param model
* @return
*/
@@ -103,7 +103,7 @@ public class SolutionController {
}
/**
* 地址标准化解决方案
* 地址标准化解决方案
* @param model
* @return
*/
@@ -113,21 +113,21 @@ public class SolutionController {
/**
* 法拍房解决方案
* 法拍房解决方案
* @param model
* @return
*/
public Object paimaiAction(FangjiaModel model){return model;}
/**
* 财力评级解决方案
* 财力评级解决方案
* @param model
* @return
*/
public Object financialAction(FangjiaModel model){return model;}
/**
* 一房一价
* 一房一价
* @param model
* @return
*/
@@ -135,91 +135,91 @@ public class SolutionController {
/**
* 楼盘评级
* 楼盘评级
* @param model
* @return
*/
public Object levelAction(FangjiaModel model){return model;}
/**
* 地址治理
* 地址治理
* @param model
* @return
*/
public Object addrProAction(FangjiaModel model){return model;}
/**
* 网点布局
* 网点布局
*/
public Object outletsAction(FangjiaModel model){return model;}
/**
* 信用卡
* 信用卡
* @param model
* @return
*/
public Object cardAction(FangjiaModel model){return model;}
/**
* 地数
* 地数
* @param model
* @return
*/
public Object dishuAction(FangjiaModel model){return model;}
/**
* 客户分层
* 客户分层
* @param model
* @return
*/
public Object layerCustomerAction(FangjiaModel model){return model;}
/**
* 高净值客户筛选
* 高净值客户筛选
* @param model
* @return
*/
public Object filterCustomerAction(FangjiaModel model){return model;}
/**
* 睡眠户激活
* 睡眠户激活
* @param model
* @return
*/
public Object activateCustomerAction(FangjiaModel model){return model;}
/**
* 贷前获客
* 贷前获客
* @param model
* @return
*/
public Object preLoanCustomerAction(FangjiaModel model){return model;}
/**
* 押品风控
* 押品风控
* @param model
* @return
*/
public Object yapingAction(FangjiaModel model){return model;}
/**
* 调额增信
* 调额增信
* @param model
* @return
*/
public Object creditAction(FangjiaModel model){return model;}
/**
* 房产基础数据库建设
* 房产基础数据库建设
* @param model
* @return
*/
public Object buildingDatabaseAction(FangjiaModel model){return model;}
/**
* 网周营销
* 网周营销
* @param model
* @return
*/
public Object networkMarketingAction(FangjiaModel model){return model;}
/**
* 专家服务
* 专家服务
* @param model
* @return
*/
@@ -73,13 +73,13 @@ public class TaskController {
}
model.setTokens(StringUtils.join(tokenList, ","));
model.setDetails(StringUtils.join(tokens, ", "));
if ("二手房".equals(model.getChannel())) {
if ("二手房".equals(model.getChannel())) {
model.setQuerys(boostQuerySellPolicy.create(model.getK()).toString());
} else if ("租房".equals(model.getChannel())) {
} else if ("租房".equals(model.getChannel())) {
model.setQuerys(boostQueryRentPolicy.create(model.getK()).toString());
} else if ("小区".equals(model.getChannel())) {
} else if ("小区".equals(model.getChannel())) {
model.setQuerys(boostQueryDistrictPolicy.create(model.getK()).toString());
} else if ("新闻".equals(model.getChannel())) {
} else if ("新闻".equals(model.getChannel())) {
model.setQuerys(boostQueryNewsPolicy.create(model.getK()).toString());
}
return model;
@@ -111,7 +111,7 @@ public class TaskController {
}
/**
* 词典重新加载
* 词典重新加载
*
* @param model
* @return
@@ -6,7 +6,7 @@ import com.fangjia.coresite.model.ResourceModel;
public class TermsController {
/**
* 用户协议
* 用户协议
* @return
*/
public Object agreementAction(FangjiaModel model) {
@@ -14,7 +14,7 @@ public class TermsController {
}
/**
* 版权声明
* 版权声明
* @return
*/
public Object copyrightAction(FangjiaModel model) {
@@ -22,7 +22,7 @@ public class TermsController {
}
/**
* 免责条款
* 免责条款
* @return
*/
public Object disclaimerAction(FangjiaModel model) {
@@ -30,7 +30,7 @@ public class TermsController {
}
/**
* 友达介绍
* 友达介绍
* @param model
* @return
*/
@@ -106,7 +106,7 @@ public class TrendController {
}
/**
* 走势图小模块
* 走势图小模块
*
* @param model
* @param request
@@ -122,7 +122,7 @@ public class TrendController {
return model;
}
/**
* 房产评估次数
* 房产评估次数
*
* @param model
* @return
@@ -140,7 +140,7 @@ public class TrendController {
}
/**
* 走势图
* 走势图
*
* @param model
* @return
@@ -248,7 +248,7 @@ public class TrendController {
}*/
//由于有针对本次均价有导常进行拟合的机制,造成district_stat与district_new_price以前的价格不一致问题,所以还是查district_stat表
//由于有针对本次均价有导常进行拟合的机制,造成district_stat与district_new_price以前的价格不一致问题,所以还是查district_stat表
//DistrictNewPrice lastStat = districtNewPriceService.findDistrictStatByWeekend(new DistrictKey(district.getCity(), district.getRegion(), district.getDistrictName()), DateUtil.getFirstDayOfWeek(DateUtil.add(new Date(),-7)));
//DistrictStat lastStat = districtStatService.findDistrictStatByWeekend(new DistrictKey(district.getCity(), district.getRegion(), district.getDistrictName()), DateUtil.getFirstDayOfWeek(DateUtil.add(new Date(),-7)));
Date agoMonth = DateUtil.addMonthToDate(lastMonth, -1);
@@ -297,14 +297,14 @@ public class TrendController {
/**
* 城市房价排行
* 城市房价排行
*/
private List<CityStatInfoBo> findCitysAvgPrice(int limit){
List<CityStatInfoBo> cityStatInfoBos = new ArrayList<CityStatInfoBo>();
Date date = new Date();
//当前城市均价
//当前城市均价
Date weekend = DateUtil.getFirstDayOfWeek(date);
List<RegionStat> regionStats = regionStatService.findCityStatByWeekend(weekend,limit);
@@ -312,11 +312,11 @@ public class TrendController {
for(RegionStat regionStat : regionStats){
cityNames.add(regionStat.getCity());
}
//上个月城市均价
//上个月城市均价
Date lastMonthDate = DateUtil.getThisWeekInLastMonth(-1);
Date lastWeekend = DateUtil.getFirstDayOfWeek(lastMonthDate);
List<RegionStat> lastMonthRegionStats = regionStatService.findCityStatByWeekend(lastWeekend,cityNames,limit);
//去年城市均价
//去年城市均价
Date lastYearDate = DateUtil.getThisWeekInLastYear();
Date lastYearWeekend = DateUtil.getFirstDayOfWeek(lastYearDate);
List<RegionStat> lastYearRegionStats = regionStatService.findCityStatByWeekend(lastYearWeekend,cityNames,limit);
@@ -358,7 +358,7 @@ public class TrendController {
}
/**
* 移动页面走势图
* 移动页面走势图
*/
public Object wtrendAction(TrendModel model) {
// Object mav = FangjiaRudder.listMan(model.getKeyword());
@@ -450,7 +450,7 @@ public class TrendController {
}
/**
* 获取相关城市的行情
* 获取相关城市的行情
*
* @return
*/
@@ -504,7 +504,7 @@ public class TrendController {
}
}
String[] defaultCitys = { "北京", "上海", "广州", "深圳", "天津" };
String[] defaultCitys = { "北京", "上海", "广州", "深圳", "天津" };
for (int i = 0; i < 5; i++) {
if (ret.size() >= 5) {
break;
@@ -528,7 +528,7 @@ public class TrendController {
}
/**
* 季度数据集
* 季度数据集
*
* @param model
* @return
@@ -541,7 +541,7 @@ public class TrendController {
}
/**
* 半年数据集
* 半年数据集
*
* @param model
* @return
@@ -554,7 +554,7 @@ public class TrendController {
}
/**
* 一年数据集
* 一年数据集
*
* @param model
* @return
@@ -566,7 +566,7 @@ public class TrendController {
return mav;
}
/**
* 两年数据集
* 两年数据集
*
* @param model
* @return
@@ -579,7 +579,7 @@ public class TrendController {
}
/**
* 历史所有数据集
* 历史所有数据集
*
* @param model
* @return
@@ -609,7 +609,7 @@ public class TrendController {
addBlockStat(seriesOptions, trendView.getCityName(), trendView.getRegion(), trendView.getBlock(), weeks);
}
} else if (ViewType.block.equals(trendView.getType())) {
//title = trendView.getRegion() + trendView.getBlock() + "板块";
//title = trendView.getRegion() + trendView.getBlock() + "板块";
addCityColumnStat(seriesOptions, trendView.getCityName(), trendView.getRegion(), trendView.getBlock(), weeks);
addRegionStat(seriesOptions, trendView.getCityName(), trendView.getRegion(), weeks);
addBlockStat(seriesOptions, trendView.getCityName(), trendView.getRegion(), trendView.getBlock(), weeks);
@@ -627,16 +627,16 @@ public class TrendController {
List datas = (List) seriesOptions.get(0).get("data");
List firsList = (List) datas.get(0);
List lastList = (List) datas.get(datas.size()-1);
title = DateUtil.formatByPattern(new Date((Long) firsList.get(0)), "yyyy年MM月")+"-"+DateUtil.formatByPattern(new Date((Long) lastList.get(0)), "yyyy年MM月");
title = DateUtil.formatByPattern(new Date((Long) firsList.get(0)), "yyyy年MM月")+"-"+DateUtil.formatByPattern(new Date((Long) lastList.get(0)), "yyyy年MM月");
}
// if (weeks <= QUARTER_WEEK) {
// title += "二手房房价走势";
// title += "二手房房价走势";
// } else if (weeks <= QUARTER_WEEK * 2) {
// title += "二手房房价走势(近半年)";
// title += "二手房房价走势(近半年)";
// } else if (weeks <= QUARTER_WEEK * 4) {
// title += "二手房房价走势(最近一年)";
// title += "二手房房价走势(最近一年)";
// } else {
// title += "二手房房价两年走势";
// title += "二手房房价两年走势";
// }
HighchartsModel highchartsModel = new HighchartsModel();
@@ -646,7 +646,7 @@ public class TrendController {
}
private void addDistrictStat(List<JSONObject> seriesOptions, DistrictKey districtKey, int weeks) {
List<String> list = Arrays.asList(StringUtils.split(districtService.findDistrictKind(districtKey), ",,"));
List<String> list = Arrays.asList(StringUtils.split(districtService.findDistrictKind(districtKey), ",,"));
List<DistrictStatBo> districtStatBoList = districtStatService.findAllDistrictStatByKind(districtKey, new Date(), weeks,
list);
JSONArray districtJa = new JSONArray();
@@ -688,7 +688,7 @@ public class TrendController {
if (villaJa.length() > 0) {
JSONObject jo2 = new JSONObject();
jo2.put("name", districtKey.getName() + "(别墅)");
jo2.put("name", districtKey.getName() + "(别墅)");
jo2.put("data", villaJa.toString());
jo2.put("yAxis", 0);
seriesOptions.add(jo2);
@@ -703,7 +703,7 @@ public class TrendController {
Date currentDate = new Date();
if (city != null && region != null && block != null) {
regionStatList = regionStatService.findRegionStat(city, region, block, currentDate, weeks);
oprions.put("name", block + "板块");
oprions.put("name", block + "板块");
} else if (city != null && region != null) {
//regionStatList = regionStatService.findRegionStat(city, region, null, currentDate, weeks);
int month = weeks / 4;
@@ -790,7 +790,7 @@ public class TrendController {
if (columnJa.length() > 0) {
JSONObject jo = new JSONObject();
jo.put("name", "成交量");
jo.put("name", "成交量");
jo.put("data", columnJa.toString());
jo.put("type", "column");
jo.put("yAxis", 1);
@@ -802,7 +802,7 @@ public class TrendController {
}
private void addCityColumnStat(List<JSONObject> seriesOptions, String city, String region, String block, int weeks) {
if (!"上海".equals(city)) {
if (!"上海".equals(city)) {
return;
}
if (weeks > QUARTER_WEEK * 4 || weeks <= QUARTER_WEEK) {
@@ -814,10 +814,10 @@ public class TrendController {
List<Date> fromDates = DateUtil.getSundayListOfWeek(currentDate, weeks);
if (city != null && region != null && block != null) {
cityTradeStats = this.tradeStatService.findCityTradeStats(fromDates.get(0), currentDate, city, region, block);
oprions.put("name", block + "板块");
oprions.put("name", block + "板块");
} else if (city != null && region != null) {
cityTradeStats = this.tradeStatService.findCityTradeStats(fromDates.get(0), currentDate, city, region);
oprions.put("name", "成交量");
oprions.put("name", "成交量");
} else if (city != null) {
cityTradeStats = this.tradeStatService.findCityTradeStats(fromDates.get(0), currentDate, city);
oprions.put("name", city);
@@ -837,7 +837,7 @@ public class TrendController {
if (columnJa.length() > 0) {
JSONObject jo = new JSONObject();
jo.put("name", "成交量");
jo.put("name", "成交量");
jo.put("data", columnJa.toString());
jo.put("type", "column");
jo.put("yAxis", 1);
@@ -894,7 +894,7 @@ public class TrendController {
}
/**
* 区域均价
* 区域均价
*
* @param city
* @return
@@ -1012,7 +1012,7 @@ public class TrendController {
DistrictStatBo bo = new DistrictStatBo();
if(stats.size()==2){
DistrictStat lastStat = stats.get(1);//上周
DistrictStat lastStat = stats.get(1);//上周
Date lastMonth = DateUtils.addMonths(new Date(), -1);
int lastPrice = 0;
if(lastStat.getWeekend().getTime()>= lastMonth.getTime()){
@@ -1020,9 +1020,9 @@ public class TrendController {
lastPrice = lastStat.getAvgPrice();
}
DistrictStat curStat = stats.get(0);//本周
DistrictStat curStat = stats.get(0);//本周
if(curStat.getWeekend().getTime()>= lastMonth.getTime()){
if(lastPrice>0){//重新计算均价涨跌幅
if(lastPrice>0){//重新计算均价涨跌幅
int markup = (curStat.getAvgPrice()-lastPrice)*10000/lastPrice;
curStat.setWeekendMarkup(markup);
}
@@ -1031,7 +1031,7 @@ public class TrendController {
}else{
Date lastMonth = DateUtils.addMonths(new Date(), -1);
DistrictStat curStat = stats.get(0);//本周
DistrictStat curStat = stats.get(0);//本周
if(curStat.getWeekend().getTime()>= lastMonth.getTime()){
bo.setDistrictStat(curStat);
}
@@ -1064,7 +1064,7 @@ public class TrendController {
statBo = null;
}
// 同比数据
// 同比数据
if (statBo != null) {
Date date = DateUtil.getThisWeekInLastYear();
@@ -56,17 +56,17 @@ public class UserController {
private final static Logger LOGGER = LoggerFactory.getLogger(UserController.class);
/**
* 用户Service
* 用户Service
*/
private FangJiaUserService fangJiaUserService;
/**
* 短信Service
* 短信Service
*/
private SmsService smsService;
/**
* 估价Service
* 估价Service
*/
private EvaluationService evaluationService;
@@ -85,7 +85,7 @@ public class UserController {
}
/**
* 进入用户注册页面
* 进入用户注册页面
* @author yinjihuan
* @return
*/
@@ -94,7 +94,7 @@ public class UserController {
}
/**
* 进入用户登录页面
* 进入用户登录页面
* @author yinjihuan
* @param model
* @return
@@ -104,7 +104,7 @@ public class UserController {
}
/**
* 进入重置密码页面
* 进入重置密码页面
* @author yinjihuan
* @param model
* @return
@@ -114,7 +114,7 @@ public class UserController {
}
/**
* 发送验证码到指定的手机上
* 发送验证码到指定的手机上
* @author yinjihuan
* @param model
* @return
@@ -140,7 +140,7 @@ public class UserController {
}
/**
* 发送验证码(贷款)
* 发送验证码(贷款)
* @author yinjihuan
* @param model
* @param resultModel
@@ -152,7 +152,7 @@ public class UserController {
SmsSendLog smsSendLog = smsService.findLastSmsSendLog(model.getMobile());
if(smsSendLog != null && System.currentTimeMillis() - smsSendLog.getCreateDate().getTime() < 1000 * 60){
resultModel.setResult(Message.RESULT_FAIL);
resultModel.setMsg("该手机号短信发送频繁");
resultModel.setMsg("该手机号短信发送频繁");
return resultModel;
}
@@ -161,19 +161,19 @@ public class UserController {
long count = smsService.countSmsSendLog(ip, calendar.getTime());
if(count > 100){
resultModel.setResult(Message.RESULT_FAIL);
resultModel.setMsg("该IP短信发送频繁");
resultModel.setMsg("该IP短信发送频繁");
return resultModel;
}
String code = fangJiaUserService.randomCode();
try {
smsService.send(model.getMobile(), "【房价网】你的验证码是" + code + ",验证码5分钟内有效,请立即验证。");
smsService.send(model.getMobile(), "【房价网】你的验证码是" + code + ",验证码5分钟内有效,请立即验证。");
smsSendLog = new SmsSendLog();
smsSendLog.setContent("【房价网】你的验证码是" + code + ",验证码5分钟内有效,请立即验证。");
smsSendLog.setContent("【房价网】你的验证码是" + code + ",验证码5分钟内有效,请立即验证。");
smsSendLog.setMobile(model.getMobile());
smsSendLog.setCreateDate(new Date());
smsSendLog.setIp(ip);
smsSendLog.setPurpose("房价网");
smsSendLog.setPurpose("房价网");
smsService.saveSmsSendLog(smsSendLog);
resultModel.setResult(Message.RESULT_SUCCESS);
@@ -187,7 +187,7 @@ public class UserController {
}
/**
* 发送验证码到指定的手机上
* 发送验证码到指定的手机上
* @author yinjihuan
* @param model
* @return
@@ -241,8 +241,8 @@ public class UserController {
}
/**
* 非登录状态发送验证码到指定的手机上(不需要图形验证码)
* 用户不存在, 直接注册
* 非登录状态发送验证码到指定的手机上(不需要图形验证码)
* 用户不存在, 直接注册
* @author JENIS
* @param model
* @return
@@ -259,10 +259,10 @@ public class UserController {
try {
FangJiaUser users = fangJiaUserService.getUser(mobile);
if (users == null) {
fangJiaUserService.addUser(ObjectId.get().toStringMongod(), mobile, null, "房价网", "房价网");
fangJiaUserService.addUser(ObjectId.get().toStringMongod(), mobile, null, "房价网", "房价网");
}
} catch (Exception e) {
LOGGER.error("非登录状态发送验证码到指定的手机上(不需要图形验证码), 判断用户是否存在异常, 异常信息为:" + e);
LOGGER.error("非登录状态发送验证码到指定的手机上(不需要图形验证码), 判断用户是否存在异常, 异常信息为:" + e);
resultModel.setResult(Message.RESULT_FAIL);
resultModel.setMsg(Message.ACCOUNT_SAVE_FAIL);
return resultModel;
@@ -272,7 +272,7 @@ public class UserController {
}
/**
* 发送验证码到指定的手机上(不需要图形验证码)
* 发送验证码到指定的手机上(不需要图形验证码)
* @author yinjihuan
* @param model
* @return
@@ -299,7 +299,7 @@ public class UserController {
}
/**
* 用户注册
* 用户注册
* @author yinjihuan
* @param model
* @return
@@ -329,10 +329,10 @@ public class UserController {
return result;
}
// 自动化测试使用,只允许公司内部的IP才可以
// 自动化测试使用,只允许公司内部的IP才可以
String ip = AnalyticsUtil.getIpAddress(req);
if (("8888".equals(code) && "116.247.70.58".equals(ip)) || ("8888".equals(code) && ip.startsWith("192.168"))) {
LOGGER.info("自动化测试,不做验证码认证:"+ip);
LOGGER.info("自动化测试,不做验证码认证:"+ip);
} else {
String cacheCode = getCacheCode(mobile, Message.SMS_CODE_TYPE_REG);
if (cacheCode == null) {
@@ -352,7 +352,7 @@ public class UserController {
/**
* 用户登录
* 用户登录
* @author yinjihuan
* @param model
* @return
@@ -369,7 +369,7 @@ public class UserController {
result.setMsg(Message.PARAM_NOT_NULL);
return result;
}
// 密码为空表示短信验证码登录,否则账号密码登录
// 密码为空表示短信验证码登录,否则账号密码登录
if (StringUtils.isBlank(pass)) {
return smsCodeLogin(response, req, result, username, code);
} else {
@@ -379,7 +379,7 @@ public class UserController {
}
/**
* 检查账号是否存在库中
* 检查账号是否存在库中
* @author yinjihuan
* @param model
* @return
@@ -399,7 +399,7 @@ public class UserController {
}
/**
* 找回密码
* 找回密码
* @author yinjihuan
* @return
*/
@@ -459,7 +459,7 @@ public class UserController {
}
/**
* 检查用户是否登录
* 检查用户是否登录
* @author yinjihuan
* @param model
* @param request
@@ -481,7 +481,7 @@ public class UserController {
}
/**
* 发送验证码
* 发送验证码
* @author yinjihuan
* @param model
* @param resultModel
@@ -508,7 +508,7 @@ public class UserController {
Long ipVisitCount = (Long) CacheUtils.getValue(FangJiaUserService.class, ip);
if(ipVisitCount != null && ipVisitCount > 2){
resultModel.setResult(Message.RESULT_FAIL);
resultModel.setMsg("该IP短信发送频繁");
resultModel.setMsg("该IP短信发送频繁");
return resultModel;
}
if(ipVisitCount == null){
@@ -516,7 +516,7 @@ public class UserController {
}
CacheUtils.putValue(CachePolicyEnum.TODAY, FangJiaUserService.class, ip, ipVisitCount+1);
smsService.send(model.getMobile(), "【房价网】你的验证码是" + code + ",验证码5分钟内有效,请立即验证。");
smsService.send(model.getMobile(), "【房价网】你的验证码是" + code + ",验证码5分钟内有效,请立即验证。");
resultModel.setResult(Message.RESULT_SUCCESS);
CacheUtils.putValue(CachePolicyEnum.TINY, FangJiaUserService.class, mobile + "_" + type, code);
CacheUtils.putValue(CachePolicyEnum.TINY, FangJiaUserService.class, mobile, new Date().getTime());
@@ -530,7 +530,7 @@ public class UserController {
}
/**
* 账号登录
* 账号登录
* @author yinjihuan
* @param req
* @param result
@@ -540,10 +540,10 @@ public class UserController {
* @return
*/
private Object accountLogin(HttpServletRequest req, UserRegJsonModel result, String username, String pass, String code, String codeToken) {
// 自动化测试使用,只允许公司内部的IP才可以
// 自动化测试使用,只允许公司内部的IP才可以
String ip = AnalyticsUtil.getIpAddress(req);
if (("FJWT".equals(code) && "116.247.70.58".equals(ip)) || ("FJWT".equals(code) && ip.startsWith("192.168"))) {
LOGGER.info("自动化测试,不做验证码认证:"+ip);
LOGGER.info("自动化测试,不做验证码认证:"+ip);
} else {
String cacheCode = getCacheCode(codeToken, Message.SMS_CODE_TYPE_LOGIN);
if (cacheCode == null) {
@@ -557,7 +557,7 @@ public class UserController {
}
// 查询数据库看账号是否存在
// 查询数据库看账号是否存在
try {
String usernameType = "email";
if (checkIsMobile(username)) {
@@ -577,7 +577,7 @@ public class UserController {
String login_uid = LoginUtil.generateRandomAuthCode(users.getId()+"");
result.setMsg(login_uid);
} catch (Exception e) {
result.setMsg("网络异常请重试");
result.setMsg("网络异常请重试");
return result;
}
result.setResult(Message.RESULT_SUCCESS);
@@ -585,7 +585,7 @@ public class UserController {
}
/**
* 短信验证码登录
* 短信验证码登录
* @author yinjihuan
* @param req
* @param result
@@ -613,7 +613,7 @@ public class UserController {
result.setMsg(login_uid);
removeCacheCode(username, Message.SMS_CODE_TYPE_LOGIN);
} catch (Exception e) {
result.setMsg("网络异常请重试");
result.setMsg("网络异常请重试");
return result;
}
result.setResult(Message.RESULT_SUCCESS);
@@ -621,7 +621,7 @@ public class UserController {
}
/**
* 用户注册
* 用户注册
* @author yinjihuan
* @param result
* @param mobile
@@ -636,7 +636,7 @@ public class UserController {
result.setMsg(Message.ACCOUNT_EXISTS);
return result;
}
// 网站来源
// 网站来源
String source = CoresiteCookieContext.getInstance().getCookieValue(req, CookieName.SITE_SOURCE);
String channelType = SourceUtils.getSampleBaiduSiteType(source);
fangJiaUserService.addUser(oid, mobile, uPass, source, channelType);
@@ -654,9 +654,9 @@ public class UserController {
/**
* 检测是不是正确的手机号码
* 检测是不是正确的手机号码
* @author yinjihuan
* @param mobile 手机
* @param mobile 手机
* @return
*/
private boolean checkIsMobile(String mobile) {
@@ -666,10 +666,10 @@ public class UserController {
}
/**
* 获取缓存的验证码
* 获取缓存的验证码
* @author yinjihuan
* @param mobile 手机
* @param type 类型
* @param mobile 手机
* @param type 类型
* @return
*/
private String getCacheCode(String mobile, String type) {
@@ -679,10 +679,10 @@ public class UserController {
/**
* 清除缓存的验证码
* 清除缓存的验证码
* @author yinjihuan
* @param mobile 手机
* @param type 类型
* @param mobile 手机
* @param type 类型
* @return
*/
private void removeCacheCode(String mobile, String type) {
@@ -715,7 +715,7 @@ public class UserController {
}
/**
* 获取引用页面地址返回到页面,操作成功跳转用
* 获取引用页面地址返回到页面,操作成功跳转用
* @author yinjihuan
* @param model
* @param req
@@ -732,7 +732,7 @@ public class UserController {
}
/**
* 注册成功页面
* 注册成功页面
* @param model
* @return
*/
@@ -741,7 +741,7 @@ public class UserController {
}
/**
* 个人资料
* 个人资料
* @param model
* @return
*/
@@ -753,7 +753,7 @@ public class UserController {
}
/**
* 修改个人信息
* 修改个人信息
* @param model
* @return
*/
@@ -801,7 +801,7 @@ public class UserController {
}
/**
* 评估历史
* 评估历史
* @param model
* @return
*/
@@ -816,7 +816,7 @@ public class UserController {
}
/**
* 链接请求直接登录(新需求)
* 链接请求直接登录(新需求)
* @param model
* @param req
* @param response
@@ -14,7 +14,7 @@ import com.fangjia.service.mongo.fangjia.UserClickService;
import com.fangjia.service.mongo.fangjia.UserFeelingService;
/**
* "顶"和"踩"的处理(二手房,租房,资讯)
* "顶"和"踩"的处理(二手房,租房,资讯)
*
* @author
*
@@ -26,7 +26,7 @@ public class UserFeelingController {
private UserClickService userClickService;
/**
* 用户顶踩信息
* 用户顶踩信息
*
* @param model
*/
@@ -34,27 +34,27 @@ public class UserFeelingController {
String uid = getCookieUid();//
// model.getRelateId());
model.setViewType("json");
// 根据Id查询,看是否有评论记录
// 根据Id查询,看是否有评论记录
UserClick userClick = this.userClickService.findUserClick(uid, model.getRelateId());
if (userClick != null) {// 用户已评论过了
if (userClick != null) {// 用户已评论过了
model.setResult(false);
return model;
} else {// 添加新纪录,并更新计数
} else {// 添加新纪录,并更新计数
userClick = new UserClick();
UserFeeling userFeeling = new UserFeeling();
userFeeling.setCategory(model.getCategory());// sell
// 资讯新闻页面不记录城市信息
// 资讯新闻页面不记录城市信息
if (StringUtils.isNotBlank(model.getCategory()) && !model.getCategory().equals("news")) {
userFeeling.setCity(model.getCityName());
}
userFeeling.setRelateId(model.getRelateId());
String incField = "like";// 类型
String category = "tip";//顶:踩,给用户点击表记录点击类型
String incField = "like";// 类型
String category = "tip";//顶:踩,给用户点击表记录点击类型
if(StringUtils.isNotBlank(model.getType())){
incField = "ding".equalsIgnoreCase( model.getType()) ? "like" : "unlike";// 类型
category= "ding".equalsIgnoreCase( model.getType()) ? "tip" : "trample"; //顶:踩,给用户点击表记录点击类型
incField = "ding".equalsIgnoreCase( model.getType()) ? "like" : "unlike";// 类型
category= "ding".equalsIgnoreCase( model.getType()) ? "tip" : "trample"; //顶:踩,给用户点击表记录点击类型
}else{
return model;
}
@@ -8,7 +8,7 @@ import com.fangjia.coresite.model.WapModel;
*/
public class WapController {
/**
* iphone页面
* iphone页面
*
* @param model
* @return
@@ -18,7 +18,7 @@ public class WapController {
}
/**
* andriod页面
* andriod页面
*
* @param model
* @return
@@ -28,7 +28,7 @@ public class WapController {
}
/**
* 转到iphone应用下载页面
* 转到iphone应用下载页面
*
* @param model
* @return
@@ -40,7 +40,7 @@ public class WapController {
}
/**
* 转向到android应用下载地址
* 转向到android应用下载地址
*
* @param model
* @return
@@ -39,7 +39,7 @@ public class WithHoldController {
}
/**
* 易宝代扣回调接口
* 易宝代扣回调接口
* @author xuhe
* @param model
* @param request
@@ -52,7 +52,7 @@ public class WithHoldController {
}
Map<String,String> jsonMap=null;
try {
//开始解密
//开始解密
DigitalEnvelopeDTO dto = new DigitalEnvelopeDTO();
dto.setCipherText(responseMsg);
PrivateKey privateKey = InternalConfig.getISVPrivateKey(CertTypeEnum.RSA2048);
@@ -74,7 +74,7 @@ public class WithHoldController {
if(StringUtils.isNotBlank(yborderid)){
LoanWithHold loanWithHold = loanWithHoldService.findByParam(null,yborderid,null);
if(loanWithHold!=null){
//订单状态 0-等待代扣,1-代扣成功,2-代扣失败,3-处理中,4-超时失败,5-系统异常
//订单状态 0-等待代扣,1-代扣成功,2-代扣失败,3-处理中,4-超时失败,5-系统异常
if("PAY_SUCCESS".equals(status)){
loanWithHold.setStatus(1);
loanWithHold.setFinishTime(new Date());
@@ -82,7 +82,7 @@ public class WithHoldController {
loanWithHold.setStatus(2);
}else if("TIME_OUT".equals(status)){
loanWithHold.setStatus(4);
}else{ //默认代扣失败
}else{ //默认代扣失败
loanWithHold.setStatus(2);
}
loanWithHold.setErrorMsg(errormsg);;
@@ -115,7 +115,7 @@ public class WithHoldController {
private Map<String, String> parseResponse(String yopresponse){
Map<String,String> jsonMap = new HashMap<String, String>();
jsonMap = JSON.parseObject(yopresponse, new TypeReference<TreeMap<String,String>>() {});
System.out.println("将结果yopresponse转化为map格式之后: "+jsonMap);
System.out.println("将结果yopresponse转化为map格式之后: "+jsonMap);
return jsonMap;
}
@@ -161,7 +161,7 @@ public class WordMapController {
bo.setName(StringUtils.replaceChars(StringUtils.substring(DataUtil.removeHtml(bo.getHouse().getName()), 0, 20),
'@', ' '));
// 关键词高亮
// 关键词高亮
if (StringUtils.isNotBlank(keyword)) {
bo.setDistrictName(bo.getHouse().getDistrictName());
bo.setRegion(bo.getHouse().getRegion());
@@ -213,7 +213,7 @@ public class WordMapController {
List<Token> tokens = CnTokenizer.tokenizer(wordMap.getName());
for (Token token : tokens) {
if (token.containsType(KeywordEnum.city)) {
if (token.getName().endsWith("市")) {
if (token.getName().endsWith("市")) {
return token.getName().substring(0, token.getName().length() - 1);
}
return token.getName();
@@ -57,8 +57,8 @@ import com.fangjia.service.util.PdsConstants;
import com.fangjia.service.web.AddressService;
/**
* 银联公众号需求
* 公众号跳转+评估+结果页
* 银联公众号需求
* 公众号跳转+评估+结果页
*
* @author JENIS
*/
@@ -104,7 +104,7 @@ public class YinLianEvaluationController {
}
/**
* 银联公众号跳转评估
* 银联公众号跳转评估
*
* @param model
* @param req
@@ -112,28 +112,28 @@ public class YinLianEvaluationController {
*/
public Object homePageAction(YinLianEvaluationModel model, HttpServletRequest req) {
try{
LOG.info("YinLianEvaluationController.homePageAction 参数model为" + JsonUtils.toJson(model));
LOG.info("YinLianEvaluationController.homePageAction 参数model为" + JsonUtils.toJson(model));
if(StringUtils.isEmpty(model.getUserId()) || StringUtils.isEmpty(model.getToken())){
LOG.info("YinLianEvaluationController.homePageAction 参数userid 或 token为空");
LOG.info("YinLianEvaluationController.homePageAction 参数userid 或 token为空");
model.setViewType("redirect");
model.setViewParam("location", "/");
return model;
}
String tokenKey = FangjiaConfig.getConfig().get("yinlian.jumppage.tokenKey", TOKENKEY);
if(StringUtils.isEmpty(tokenKey)){
LOG.info("YinLianEvaluationController.homePageAction 配置变量yinlian.jumppage.tokenKey为空");
LOG.info("YinLianEvaluationController.homePageAction 配置变量yinlian.jumppage.tokenKey为空");
model.setViewType("redirect");
model.setViewParam("location", "/");
return model;
}
boolean flag = yinLianUserInfoService.verifyTokenAndTimestamp(model.getUserId(), model.getTimestamp(), model.getToken(), tokenKey);
if(!flag){
LOG.info("YinLianEvaluationController.homePageAction token验证失败");
LOG.info("YinLianEvaluationController.homePageAction token验证失败");
model.setViewType("redirect");
model.setViewParam("location", "/");
return model;
}
//构造QueryParam
//构造QueryParam
List<QueryParam> params = new ArrayList<QueryParam>();
params.add(new QueryParam("userId", model.getUserId()));
YinLianUserInfo userInfo = yinLianUserInfoService.findByParams(params);
@@ -147,7 +147,7 @@ public class YinLianEvaluationController {
model.setViewParam("location", "/yinLianEvaluation/index?id=" + userInfo.getId());
return model;
}catch (Exception e) {
LOG.error("YinLianEvaluationController.homePageAction 发生异常, 异常信息为:" + e);
LOG.error("YinLianEvaluationController.homePageAction 发生异常, 异常信息为:" + e);
model.setViewType("redirect");
model.setViewParam("location", "/");
return model;
@@ -155,13 +155,13 @@ public class YinLianEvaluationController {
}
/**
* 首页
* 首页
* @param model
* @param req
* @return
*/
public Object indexAction(TrendModel model, HttpServletRequest req) {
LOG.info("YinLianEvaluationController 参数indexAction 为" + JsonUtils.toJson(model));
LOG.info("YinLianEvaluationController 参数indexAction 为" + JsonUtils.toJson(model));
String city = null;
if(StringUtils.isNotBlank(model.getCityName())){
city = model.getCityName();
@@ -193,15 +193,15 @@ public class YinLianEvaluationController {
}
/**
* 检查小区是否有均价以及当前用户当天只能评估10次<br>
* 无均价则不能估价,超过10次也提示<br>
* 检查小区是否有均价以及当前用户当天只能评估10次<br>
* 无均价则不能估价,超过10次也提示<br>
* @param model
* @return
*/
public Object checkPriceAction(TrendModel model, HttpServletRequest req){
model.setViewType("json");
model.setViewParam("config", null);
//判断userId
//判断userId
YinLianUserInfo userInfo = yinLianUserInfoService.findById(model.getId());
if(userInfo == null){
model.setCode(2);
@@ -211,12 +211,12 @@ public class YinLianEvaluationController {
DistrictKey districtKey = new DistrictKey(model.getCityName(), model.getRegion(), model.getDistrictName());
District district = districtService.findDistrict(districtKey, "district");
if(district==null){
model.setErrMsg("未找到该小区");
model.setErrMsg("未找到该小区");
model.setCode(-1);
return model;
}
//获取地址评分
//获取地址评分
Map<String, Object> resultMap = null;
if(StringUtils.isNotBlank(district.getAddress())){
resultMap = getDistrictScore(model.getCityName(), district.getAddress());
@@ -226,7 +226,7 @@ public class YinLianEvaluationController {
}
if(resultMap==null){
model.setErrMsg("未找到数据");
model.setErrMsg("未找到数据");
model.setCode(3);
return model;
}
@@ -234,11 +234,11 @@ public class YinLianEvaluationController {
String userId = userInfo.getUserId();
if (StringUtils.isNotBlank(userId)) {
//最多评估10次
//最多评估10次
int count = yinLianEvaluationService.getCountToday(userId);
//if (count > 9) {
if (count > evaluationlimit) {
model.setErrMsg("单日查询超过上限");
model.setErrMsg("单日查询超过上限");
model.setCode(-1);
return model;
}else{
@@ -251,7 +251,7 @@ public class YinLianEvaluationController {
}
if(districtStatBo == null){
model.setCode(-1);
model.setErrMsg("您的小区暂不支持估价");
model.setErrMsg("您的小区暂不支持估价");
return model;
}
YinLianEvaluation yinLianEvaluation = new YinLianEvaluation();
@@ -274,7 +274,7 @@ public class YinLianEvaluationController {
if(stats.size() > 0){
DistrictStatBo bo = new DistrictStatBo();
if(stats.size()==2){
DistrictStat lastStat = stats.get(1);//上周
DistrictStat lastStat = stats.get(1);//上周
Date lastMonth = DateUtils.addMonths(new Date(), -1);
int lastPrice = 0;
if(lastStat.getWeekend().getTime()>= lastMonth.getTime()){
@@ -282,9 +282,9 @@ public class YinLianEvaluationController {
lastPrice = lastStat.getAvgPrice();
}
DistrictStat curStat = stats.get(0);//本周
DistrictStat curStat = stats.get(0);//本周
if(curStat.getWeekend().getTime()>= lastMonth.getTime()){
if(lastPrice>0){//重新计算均价涨跌幅
if(lastPrice>0){//重新计算均价涨跌幅
int markup = (curStat.getAvgPrice()-lastPrice)*10000/lastPrice;
curStat.setWeekendMarkup(markup);
}
@@ -293,7 +293,7 @@ public class YinLianEvaluationController {
}else{
Date lastMonth = DateUtils.addMonths(new Date(), -1);
DistrictStat curStat = stats.get(0);//本周
DistrictStat curStat = stats.get(0);//本周
if(curStat.getWeekend().getTime()>= lastMonth.getTime()){
bo.setDistrictStat(curStat);
}
@@ -342,7 +342,7 @@ public class YinLianEvaluationController {
/**
* 评估结果页
* 评估结果页
* @param model
* @param req
* @return
@@ -355,7 +355,7 @@ public class YinLianEvaluationController {
model.setViewParam("location", "/yinLianEvaluation/index?id=" + model.getId());
return model;
}else{
//最多评估10次
//最多评估10次
int count = yinLianEvaluationService.getCountToday(userInfo.getUserId());
//if (count > 10) {
if (count > evaluationlimit) {
@@ -365,13 +365,13 @@ public class YinLianEvaluationController {
}
}
//获取小区基本信息
//获取小区基本信息
District district = null;
if(StringUtils.isNotBlank(model.getCityName()) && StringUtils.isNotBlank(model.getRegion()) && StringUtils.isNotBlank(model.getName())){
DistrictKey districtKey = new DistrictKey(model.getCityName(), model.getRegion(), model.getName());
district = districtService.findDistrict(districtKey, "district");
model.setDistrict(district);
//小区均价
//小区均价
if(district!=null){
if(StringUtils.isNotBlank(district.getDescription())){
district.setDescription(DataUtil.removeHtml(district.getDescription()));
@@ -380,7 +380,7 @@ public class YinLianEvaluationController {
DistrictStatBo statBo = getNearestDistrictStat(districtKey);
model.setDistrictStatBo(statBo);
//附近小区
//附近小区
List<DistrictDto> nearDistricts = getNearestDistricts(district);
model.setNearDistricts(nearDistricts);
@@ -392,7 +392,7 @@ public class YinLianEvaluationController {
}
//获取地址评分
//获取地址评分
Map<String, Object> resultMap = null;
if(StringUtils.isNotBlank(model.getAddress())){
resultMap = getDistrictScore(model.getCityName(), model.getAddress());
@@ -452,7 +452,7 @@ public class YinLianEvaluationController {
dto.setName(d.getName());
dto.setDistance((int) dis);
if(stats.size()>0){
DistrictStat curStat = stats.get(0);//本周
DistrictStat curStat = stats.get(0);//本周
dto.setAvgPrice(curStat.getAvgPrice());
}
result.add(dto);
@@ -91,12 +91,12 @@ public class DingyueController {
return model;
}
// 验证时间戳
// 验证时间戳
Calendar ca = Calendar.getInstance();
ca.setTimeInMillis(Long.parseLong(cancelInfo[3]));
Date cookieDate = ca.getTime();
// cookie超过2天默认失效
// cookie超过2天默认失效
ca.setTime(new Date());
ca.add(Calendar.DAY_OF_MONTH, -2);
if (cookieDate.before(ca.getTime())) {
@@ -54,7 +54,7 @@ public class UserController {
private static long MAX_PIC_SIZE = 2 * 1024 * 1024;
/**
* 用户登录页
* 用户登录页
*
* @param model
* @return
@@ -62,7 +62,7 @@ public class UserController {
@Sothis(stack = "default", defaultView = "ftl")
public Object indexAction(UserModel model) {
if (getLoginedUserId(model) > 0) {
// 已登录直接到用户房源列表
// 已登录直接到用户房源列表
model.setViewType("redirect");
model.setViewParam("location", "/user/user/houseList");
return model;
@@ -73,7 +73,7 @@ public class UserController {
}
/**
* 用户房源列表
* 用户房源列表
*
* @param model
* @return
@@ -101,7 +101,7 @@ public class UserController {
}
/**
* 处理房源城市url
* 处理房源城市url
*
* @param model
*/
@@ -120,7 +120,7 @@ public class UserController {
}
/**
* 进入编辑页面
* 进入编辑页面
*
* @param model
* @return
@@ -129,7 +129,7 @@ public class UserController {
int userId = getLoginedUserId(model);
String houseCity = "";
// 编辑二手房
// 编辑二手房
if (ObjectId.isValid(model.getHouseId())) {
House house = houseService.findHouseById(model.getHouseId());
if (null != house && userId == house.getUserId()) {
@@ -138,7 +138,7 @@ public class UserController {
}
}
// 编辑租房
// 编辑租房
if (ObjectId.isValid(model.getRentHouseId())) {
RentHouse rentHouse = rentHouseService.findRentHouseById(model.getRentHouseId());
if (null != rentHouse && userId == rentHouse.getUserId()) {
@@ -160,7 +160,7 @@ public class UserController {
}
/**
* 保存修改
* 保存修改
*
* @param model
* @return
@@ -182,7 +182,7 @@ public class UserController {
}
/**
* 删除房源
* 删除房源
*
* @param model
* @return
@@ -213,7 +213,7 @@ public class UserController {
}
/**
* 刷新房源
* 刷新房源
*
* @param model
* @return
@@ -247,7 +247,7 @@ public class UserController {
}
/**
* 验证用户是否登录
* 验证用户是否登录
*
* @param model
* @return
@@ -269,7 +269,7 @@ public class UserController {
}
/**
* 验证房源表单信息是否完成
* 验证房源表单信息是否完成
*
* @param model
* @return
@@ -281,58 +281,58 @@ public class UserController {
return false;
}
// 类型
// 类型
if (!"sell".equals(model.getCategory()) && !"rent".equals(model.getCategory())) {
return false;
}
// 区域、板块、小区
// 区域、板块、小区
if (StringUtils.isBlank(model.getRegion()) || StringUtils.isBlank(model.getDistrictName())
|| model.getDistrictName().length() < 1 || model.getDistrictName().length() > 10) {
return false;
}
// 房型
// 房型
if (null == model.getRoom() || null == model.getHall() || null == model.getToilet()) {
return false;
}
// 面积
// 面积
if (null == model.getArea()) {
return false;
}
// 售价/租金
// 售价/租金
if (null == model.getTotalPrice()) {
return false;
}
// 楼层
// 楼层
if (null == model.getHeight() || null == model.getFloor() || model.getFloor() > model.getHeight()) {
return false;
}
// 房龄
// 房龄
if (null == model.getAge() || model.getAge() < 1900 || model.getAge() > Calendar.getInstance().get(Calendar.YEAR)) {
return false;
}
// 朝向
// 朝向
if (StringUtils.isBlank(model.getDirection())) {
return false;
}
// 装修
// 装修
if (StringUtils.isBlank(model.getFitment())) {
return false;
}
// 标题
// 标题
if (StringUtils.isBlank(model.getName()) || model.getName().length() < 6 || model.getName().length() > 25) {
return false;
}
// 描述
// 描述
if (StringUtils.isBlank(model.getDescription())) {
return false;
} else {
@@ -342,13 +342,13 @@ public class UserController {
}
}
// 联系人
// 联系人
if (StringUtils.isBlank(model.getContactPeople()) || model.getContactPeople().length() < 2
|| model.getContactPeople().length() > 4) {
return false;
}
// 手机/电话
// 手机/电话
String phone = model.getMobile();
if (StringUtils.isBlank(phone)) {
return false;
@@ -364,7 +364,7 @@ public class UserController {
}
/**
* 处理保存
* 处理保存
*
* @param model
*/
@@ -385,7 +385,7 @@ public class UserController {
house.setStatus(0);
house.setModificationDate(now);
house.setBuildDate(model.getAge() + "年");
house.setBuildDate(model.getAge() + "年");
house.setTotalPrice(model.getTotalPrice() * 10000);
if (ObjectId.isValid(model.getId())) {
houseService.updateHouse(house);
@@ -408,7 +408,7 @@ public class UserController {
rentHouse.setStatus(0);
rentHouse.setModificationDate(now);
rentHouse.setBuildDate(model.getAge() + "年");
rentHouse.setBuildDate(model.getAge() + "年");
rentHouse.setFacilities(getFacilities(model.getFacilityArr()));
if (ObjectId.isValid(model.getId())) {
rentHouseService.updateRentHouse(rentHouse);
@@ -447,14 +447,14 @@ public class UserController {
}
/**
* 处理图片,包括删除、新增图片,最后返回图片ID列表
* 处理图片,包括删除、新增图片,最后返回图片ID列表
*
* @param houseId
* @param model
* @return
*/
private List<String> processPics(String houseId, UserModel model, int userId) {
// 删除图片
// 删除图片
fileService.delPics(model.getDelPics(), FileServiceImpl.SIZE_ORIGINAL);
List<String> ret = new ArrayList<String>();
@@ -491,7 +491,7 @@ public class UserController {
}
/**
* 处理重名图片
* 处理重名图片
*
* @param orgName
* @param nameList
@@ -512,7 +512,7 @@ public class UserController {
}
/**
* 验证图片文件类型,目前支持gif、jpg
* 验证图片文件类型,目前支持gif、jpg
*
* @param pic
* @return
@@ -550,12 +550,12 @@ public class UserController {
}
/**
* 底部信息
* 底部信息
*
* @param model
*/
private void feedFooter(UserModel model) {
// 最新上线的城市
// 最新上线的城市
List<CityGroup> newCitys = new ArrayList<CityGroup>();
List<ServerArea> serverAreaList = ServerAreaData.getServerAreaList(15);
List<String> cityNames = CollectionUtils.collect(serverAreaList, new Closure<String, ServerArea>() {
@@ -574,10 +574,10 @@ public class UserController {
}
/**
* 获取当前城市
* 获取当前城市
*
* @param request
* @return 当前城市
* @return 当前城市
*/
private ServerArea getSuggestCity(HttpServletRequest request) {
String ip = AnalyticsUtil.getIpAddress(request);
@@ -57,7 +57,7 @@ public class AccessLogFilter implements Filter {
request.setAttribute("scheme", request.getScheme());
String source = CookieUtils.getCookieValue(request, CookieName.SITE_SOURCE);
if(StringUtils.isBlank(source)){
//添加百度sem推广标识
//添加百度sem推广标识
StringBuilder sb = new StringBuilder();
String referer = request.getHeader("Referer");
if(StringUtils.isNotBlank(referer)){
@@ -121,7 +121,7 @@ public class AccessLogFilter implements Filter {
LOGGER.error("error process request: request_url=" + analyticsBean.requestUrl + ", referer="
+ analyticsBean.refererUrl, rootCause);
}
// 记录运行超过1秒的请求到日志中
// 记录运行超过1秒的请求到日志中
final long time = System.currentTimeMillis() - start;
final String actionUri = (String) request.getAttribute(ActionContext.ACTION_URI);
if (time > 1000 || (!FangjiaConfig.getConfig().isProductionEnvironment() && executeCounter.getTotalCount() > 0)) {
@@ -142,7 +142,7 @@ public class AccessLogFilter implements Filter {
private void writeAccessLog(AnalyticsBean analyticsBean, long duration, String actionUri, int statusCode, String method) {
StringBuilder logStr = new StringBuilder();
// 不要改变顺序
// 不要改变顺序
logStr.append(DATE_FORMAT.format(analyticsBean.startTime));// 1
logStr.append(SPLIT).append(StringUtils.defaultString(analyticsBean.connectionIp));// 2
logStr.append(SPLIT).append(StringUtils.defaultString(analyticsBean.ip));// 3
@@ -105,7 +105,7 @@ public class AnalyticsBean {
}
/**
* 获得连接客户端的IP(部署环境下一般都设有nginx等http服务器)
* 获得连接客户端的IP(部署环境下一般都设有nginx等http服务器)
*
* @param request
* @return
@@ -123,7 +123,7 @@ public class AnalyticsBean {
String citySpell = getCitySpell(request.getRequestURL().toString(),request);
ServerArea city = ServerAreaData.getServerAreaByNameOrSpellDefaultNull(citySpell);
if (null != city) {
// 保存至cookie
// 保存至cookie
Cookie cityCookie = cookieContext.createCookie(CookieName.COOKIE_CITY, citySpell);
cityCookie.setMaxAge(Integer.MAX_VALUE);
response.addCookie(cityCookie);
@@ -137,7 +137,7 @@ public class AnalyticsBean {
}
private String createUID(HttpServletRequest request, HttpServletResponse response) {
// 设置UUID
// 设置UUID
String uuid = new ObjectId().toString();
Cookie uuidCookie = cookieContext.createCookie(CookieName.UID, uuid);
uuidCookie.setMaxAge(Integer.MAX_VALUE);
@@ -152,7 +152,7 @@ public class AnalyticsBean {
}
private String createSID(HttpServletRequest request, HttpServletResponse response) {
// 设置session id
// 设置session id
String sid = new ObjectId().toString();
Cookie uuidCookie = cookieContext.createCookie(CookieName.SID, sid);
uuidCookie.setMaxAge(-1);
@@ -165,7 +165,7 @@ public class AnalyticsBean {
}
/**
* 请求url,不包括query string
* 请求url,不包括query string
*
* @return
*/
@@ -174,7 +174,7 @@ public class AnalyticsBean {
}
/**
* 请求url后的请求参数,如果参数不为空则包括问号在内
* 请求url后的请求参数,如果参数不为空则包括问号在内
*
* @return
*/
@@ -183,7 +183,7 @@ public class AnalyticsBean {
}
/**
* 请求uri
* 请求uri
*
* @return
*/
@@ -192,7 +192,7 @@ public class AnalyticsBean {
}
/**
* 来源url
* 来源url
*
* @return
*/
@@ -201,7 +201,7 @@ public class AnalyticsBean {
}
/**
* 完整的请求url,包括query string
* 完整的请求url,包括query string
*
* @return
*/
@@ -210,7 +210,7 @@ public class AnalyticsBean {
}
/**
* 是否刷新缓存
* 是否刷新缓存
*
* @return
*/
@@ -219,7 +219,7 @@ public class AnalyticsBean {
}
/**
* 当前城市,可能为null
* 当前城市,可能为null
*
* @return
*/
@@ -228,7 +228,7 @@ public class AnalyticsBean {
}
/**
* 当前城市,不会为null
* 当前城市,不会为null
*
* @return
*/
@@ -237,7 +237,7 @@ public class AnalyticsBean {
}
/**
* cookie中的uid,如果没有则生成新的uid
* cookie中的uid,如果没有则生成新的uid
*
* @return
*/
@@ -246,7 +246,7 @@ public class AnalyticsBean {
}
/**
* 全局的请求id
* 全局的请求id
*
* @return
*/
@@ -255,7 +255,7 @@ public class AnalyticsBean {
}
/**
* cookie中的会话id,如果没有则生成新的sid
* cookie中的会话id,如果没有则生成新的sid
*
* @return
*/
@@ -264,7 +264,7 @@ public class AnalyticsBean {
}
/**
* 是否为ajax请求
* 是否为ajax请求
*
* @return
*/
@@ -273,7 +273,7 @@ public class AnalyticsBean {
}
/**
* 访问者的真实ip
* 访问者的真实ip
*
* @return
*/
@@ -282,7 +282,7 @@ public class AnalyticsBean {
}
/**
* 访问者标识,可能为null
* 访问者标识,可能为null
*
* @return
*/
@@ -291,7 +291,7 @@ public class AnalyticsBean {
}
/**
* 连接ip
* 连接ip
*
* @return
*/
@@ -300,7 +300,7 @@ public class AnalyticsBean {
}
/**
* cookie中的uid,如果没有则为空字符串
* cookie中的uid,如果没有则为空字符串
*
* @return
*/
@@ -309,7 +309,7 @@ public class AnalyticsBean {
}
/**
* cookie中的会话id,如果没有则为空字符串
* cookie中的会话id,如果没有则为空字符串
*
* @return
*/
@@ -318,7 +318,7 @@ public class AnalyticsBean {
}
/**
* 请求开始时间
* 请求开始时间
*
* @return
*/
@@ -70,7 +70,7 @@ public class AnalyticsFilter implements Filter {
private void realDoFilter(HttpServletRequest request, HttpServletResponse response, FilterChain chain) throws IOException,
ServletException {
//登录判断
//登录判断
String uri = request.getRequestURI();
String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort();
if (request.getRequestURI().contains("fangjia-coresite")) {
@@ -100,7 +100,7 @@ public class AnalyticsFilter implements Filter {
final AnalyticsBean analyticsBean = AnalyticsBean.get(request, response);
// 点击日志
// 点击日志
if (analyticsBean.requestUrl.indexOf("/__utm.gif") > -1) {
processUtmGifLog(request, response, analyticsBean);
return;
@@ -113,16 +113,16 @@ public class AnalyticsFilter implements Filter {
}*/
// 判断URL是否合法,不合法则重定向
// 判断URL是否合法,不合法则重定向
String redirectUrl = checkUrlFormat(analyticsBean, request);
// if (null == redirectUrl) {
// redirectUrl = checkPhone(analyticsBean, request, response);
// }
// 默认的需要走这个重定向逻辑,官网需要以城市开头的二级域名,目前有个需求是贷款页面投放,需要套用别人的域名,解析到我们的程序中,如果有跳转会有问题
// 这个做一个开关,默认是没有redirectStatus,这样就还是会跳转,套户的那个节点加上这个参数就表示不重定向
// 默认的需要走这个重定向逻辑,官网需要以城市开头的二级域名,目前有个需求是贷款页面投放,需要套用别人的域名,解析到我们的程序中,如果有跳转会有问题
// 这个做一个开关,默认是没有redirectStatus,这样就还是会跳转,套户的那个节点加上这个参数就表示不重定向
if (System.getProperty("redirectStatus") == null) {
//如果是需要过滤的url则跳转到首页,防爬虫抓取之前报错的页面
//如果是需要过滤的url则跳转到首页,防爬虫抓取之前报错的页面
if(null == redirectUrl){
redirectUrl = checkNoUseUrl(analyticsBean, request, response);
}
@@ -148,7 +148,7 @@ public class AnalyticsFilter implements Filter {
threadLocalData.put(ThreadLocalKey.DisableCache, "1");
}
// 切换城市
// 切换城市
FangjiaServerAreaContextHolder.setServerArea(analyticsBean.city);
threadLocalData.put(ThreadLocalKey.FromSpider, analyticsBean.isSpider());
@@ -178,7 +178,7 @@ public class AnalyticsFilter implements Filter {
/**
* 检查是否为手机浏览,若是跳往wap页面
* 检查是否为手机浏览,若是跳往wap页面
*
* @param analyticsBean
* @author liupei
@@ -216,7 +216,7 @@ public class AnalyticsFilter implements Filter {
responseOutputStream.close();
String userAgent = analyticsBean.userAgent;
if (userAgent != null && (userAgent.indexOf("Googlebot-Image") >= 0 || userAgent.indexOf("Baidu") >= 0)) {
// 过滤爬虫的访问
// 过滤爬虫的访问
return;
}
jmsTemplate.send(utmgifDestination, new MessageCreator() {
@@ -262,7 +262,7 @@ public class AnalyticsFilter implements Filter {
}
/**
* 判断URL是否合法,合法则返回null,否则返回重定向URL
* 判断URL是否合法,合法则返回null,否则返回重定向URL
*
* @param analyticsBean
* @param request
@@ -283,7 +283,7 @@ public class AnalyticsFilter implements Filter {
return "http://user.fangjia.com/fangjiatong2/users/fjtLogin";
}
String schemePrefix = request.getScheme() + "://";
// 如果hostName中有端口号,则把端口号去掉
// 如果hostName中有端口号,则把端口号去掉
int index = hostName.indexOf(":");
if (index > 0) {
hostName = hostName.substring(0, index);
@@ -305,21 +305,21 @@ public class AnalyticsFilter implements Filter {
return fangjiaConfig.getCityDomainName(city) + analyticsBean.requestUri + analyticsBean.queryString;
}
if (city != null || secondLevelDomains().contains(prefixSplit[0])) {
// 找到对应的城市,或者是一个有效的二级域名
// 找到对应的城市,或者是一个有效的二级域名
return null;
}
if (prefixSplit[0].equalsIgnoreCase("www")) {
// return null;
String s = StringUtils.substringAfter(analyticsBean.getRequestUri(), contextPath);
// if (analyticsBean.getRequestUri().equals(contextPath + "/") || analyticsBean.getRequestUri().equals(contextPath)) {
// // 访问全国首页
// // 访问全国首页
// return null;
// } else
if (s != null && (s.startsWith("/s/") || s.startsWith("/r/"))) {
// 访问全国首页
// 访问全国首页
return null;
} else {
// 以www开头的内页,转到对应的城市内页
// 以www开头的内页,转到对应的城市内页
if(analyticsBean.getRequestUri().contains("gujia")||analyticsBean.getRequestUri().contains("zouzhi")||analyticsBean.getRequestUri().equals(contextPath + "/") || analyticsBean.getRequestUri().equals(contextPath)){
city = guessCity(analyticsBean);
if (city != null) {
@@ -21,8 +21,8 @@ import java.util.List;
import java.util.Map;
/**
* 反爬虫Filter
* @author 王文艳
* 反爬虫Filter
* @author 王文艳
* @create 2016-10-17
**/
public class AntiSpiderFilter implements Filter {
@@ -48,7 +48,7 @@ public class AntiSpiderFilter implements Filter {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) resp;
// 放开首页不做爬虫验证
// 放开首页不做爬虫验证
if (request.getRequestURL().toString().endsWith("fangjia.com") || request.getRequestURL().toString().endsWith("fangjia.com/")) {
chain.doFilter(req, resp);
return;
@@ -87,7 +87,7 @@ public class AntiSpiderFilter implements Filter {
String key = "spider_blacklist_" + snapshoot.getIp();
CacheUtils.putValue(CacheUtils.CachePolicyEnum.MIDDLE, Spider.class,key, spider, true);
spiderService.upsertByIp(spider);
LOGGER.info("发现疑似爬虫:" + spider);
LOGGER.info("发现疑似爬虫:" + spider);
if(StringUtils.isNotBlank(url)){
response.sendRedirect(request.getContextPath() + "/validate?backUrl=" + DataUtil.urlEncode(url));
}else{
@@ -53,7 +53,7 @@ public class SpiderValidateFilter implements Filter {
private void checkReload() {
if (this.reloading.compareAndSet(false, true)) {
try {
// 5分钟reload一次
// 5分钟reload一次
if (System.currentTimeMillis() - lastReloadTimestamp < 300000) {
return;
}
@@ -87,13 +87,13 @@ public class SpiderValidateFilter implements Filter {
if (isValidUserAgent(ua)) {
for (String spiderName : spiderDomains.keySet()) {
if (!ua.contains(spiderName)) {
// 未声明自己为spider则跳过
// 未声明自己为spider则跳过
continue;
}
if (null == ip) {
spider = new Spider(spiderName, ip, ua);
spider.setFake(true);
// 对ip为null的蜘蛛暂时不入数据库
// 对ip为null的蜘蛛暂时不入数据库
} else {
spider = spiders.get(ip);
if (null == spider) {
@@ -106,7 +106,7 @@ public class SpiderValidateFilter implements Filter {
} else {
spider = new Spider("unkown", ip, ua);
spider.setFake(true);
// 对userAgent为null的蜘蛛暂时不入数据库
// 对userAgent为null的蜘蛛暂时不入数据库
}
}
if (spider != null && spider.isFake()) {
@@ -145,7 +145,7 @@ public class SpiderValidateFilter implements Filter {
private void validateSpider(Spider spider) {
if (null == spider.getId()) {
// 新发现的蜘蛛
// 新发现的蜘蛛
checkSpider(spider);
spiderService.upsertByIp(spider);
spiders.put(spider.getIp(), spider);
@@ -153,23 +153,23 @@ public class SpiderValidateFilter implements Filter {
LOGGER.info("find new spider: " + spider);
}
} else if (spider.isVerified()) {
// 已人工验证的蜘蛛
// 已人工验证的蜘蛛
spiders.put(spider.getIp(), spider);
} else if (spider.isFake()) {
// 已发现的假蜘蛛
// 已发现的假蜘蛛
Date yestoday = DateUtils.addDays(new Date(), -1);
if (spider.getModificationDate().before(yestoday)) {
// 删除超过1天的假蜘蛛信息
// 删除超过1天的假蜘蛛信息
spiderService.deleteByIp(spider.getIp());
spiders.remove(spider.getIp());
} else {
spiders.put(spider.getIp(), spider);
}
} else {
// 已发现的真蜘蛛
// 已发现的真蜘蛛
Date lastWeek = DateUtils.addDays(new Date(), -7);
if (spider.getModificationDate().before(lastWeek)) {
// 重新验证超过7天的真蜘蛛
// 重新验证超过7天的真蜘蛛
checkSpider(spider);
if (spider.isFake()) {
spiderService.deleteByIp(spider.getIp());
@@ -191,10 +191,10 @@ public class SpiderValidateFilter implements Filter {
String host = nslookup(spider.getIp());
if (null != host) {
spider.setHost(host);
// 不是相同域的为假蜘蛛
// 不是相同域的为假蜘蛛
spider.setFake(!isSameDomain(host, spiderDomains.get(spider.getName())));
} else {
// 反向解析失败,则默认为真蜘蛛
// 反向解析失败,则默认为真蜘蛛
spider.setHost(spider.getIp());
spider.setFake(false);
}
@@ -12,7 +12,7 @@ import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
/**
* 防止xss攻击 过滤器(顺便过滤了 sql攻击)
* 防止xss攻击 过滤器(顺便过滤了 sql攻击)
*/
public class XSSFilter implements Filter {
@Override
@@ -22,15 +22,15 @@ public class XSSFilter implements Filter {
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
// 初始化自定义HttpServletRequestWrapper
// 初始化自定义HttpServletRequestWrapper
XssFilterWrapper xssFilterWrapper = new XssFilterWrapper((HttpServletRequest) servletRequest);
// 获取所有参数集合
// 获取所有参数集合
Map<String, String[]> parameterMap = new HashMap<String, String[]>(xssFilterWrapper.getParameterMap());
// 将集合存到自定义HttpServletRequestWrapper
// 将集合存到自定义HttpServletRequestWrapper
xssFilterWrapper.setParameterMap(parameterMap);
//使用包装器
//使用包装器
filterChain.doFilter(xssFilterWrapper,servletResponse);
}
@@ -12,23 +12,23 @@ import java.util.regex.Pattern;
public class XssFilterWrapper extends HttpServletRequestWrapper {
private Map<String, String[]> parameterMap; // 所有参数的Map集合
private Map<String, String[]> parameterMap; // 所有参数的Map集合
/**
* ChangeRequestWrapper构造函数
* ChangeRequestWrapper构造函数
* @param request
*/
public XssFilterWrapper(HttpServletRequest request) {
super(request);
// 给参数集合赋值
// 给参数集合赋值
parameterMap = request.getParameterMap();
}
/**
* 获取所有参数名
* 获取所有参数名
*
* @return 返回所有参数名
* @return 返回所有参数名
*/
@Override
public Enumeration<String> getParameterNames() {
@@ -37,10 +37,10 @@ public class XssFilterWrapper extends HttpServletRequestWrapper {
}
/**
* 获取指定参数名的值,如果有重复的参数名,则返回第一个的值 接收一般变量 ,如text类型
* 获取指定参数名的值,如果有重复的参数名,则返回第一个的值 接收一般变量 ,如text类型
*
* @param name 指定参数名
* @return 指定参数名的值
* @param name 指定参数名
* @return 指定参数名的值
*/
@Override
public String getParameter(String name) {
@@ -50,8 +50,8 @@ public class XssFilterWrapper extends HttpServletRequestWrapper {
/**
* 获取指定参数名的所有值的数组,如:checkbox的所有数据
* 接收数组变量 ,如checkobx类型
* 获取指定参数名的所有值的数组,如:checkbox的所有数据
* 接收数组变量 ,如checkobx类型
*/
@Override
public String[] getParameterValues(String name) {
@@ -102,7 +102,7 @@ public class XssFilterWrapper extends HttpServletRequestWrapper {
Pattern.compile("vbscript:", Pattern.CASE_INSENSITIVE),
// onload(...)=...
Pattern.compile("onload(.*?)=", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL),
//现场安全测试增加校验
//现场安全测试增加校验
Pattern.compile("alert(.*?)", Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL),
Pattern.compile("<", Pattern.MULTILINE | Pattern.DOTALL),
Pattern.compile(">", Pattern.MULTILINE | Pattern.DOTALL),
@@ -6,8 +6,8 @@ import java.util.Map;
import java.util.TreeMap;
/**
* 用户行为快照
* @author 王文艳
* 用户行为快照
* @author 王文艳
* @create 2016-10-18
**/
public class UserBehaviorSnapshoot implements Serializable{
@@ -1,8 +1,8 @@
package com.fangjia.coresite.http;
/**
* 类名称:CharSet
* 类描述:
* 类名称:CharSet
* 类描述:
* @version
*/
public class CharSet {
@@ -7,8 +7,8 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
/**
* 类名称:表单参数
* 类描述:
* 类名称:表单参数
* 类描述:
* @version
*/
@XmlRootElement
@@ -14,7 +14,7 @@ import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.message.BasicNameValuePair;
/**
* 类名称:表单参数
* 类名称:表单参数
* @version
*/
@XmlRootElement
@@ -58,16 +58,16 @@ public class HttpSendModel implements Serializable {
}
/**
* 注意:<br>
* 比如招行的提交地址https://netpay.cmbchina.com/netpayment/BaseHttp.dll?PrePayC1<br>
* 用get拼好的url串https://netpay.cmbchina.com/netpayment/BaseHttp.dll?PrePayC1?
* a=1 这种情况适用<br>
* 注意:<br>
* 比如招行的提交地址https://netpay.cmbchina.com/netpayment/BaseHttp.dll?PrePayC1<br>
* 用get拼好的url串https://netpay.cmbchina.com/netpayment/BaseHttp.dll?PrePayC1?
* a=1 这种情况适用<br>
* <br>
* 同时,需要非常注意的是:如果参数中有中文并且你已经url编码过了,那么,请保证url和urlPath保持一致,并使用get方式!
* 同时,需要非常注意的是:如果参数中有中文并且你已经url编码过了,那么,请保证url和urlPath保持一致,并使用get方式!
*
* @param url
* @param urlPath
* 不带参数的纯地址
* 不带参数的纯地址
* @throws Exception
*/
public HttpSendModel(String url, String urlPath) throws Exception {
@@ -79,7 +79,7 @@ public class HttpSendModel implements Serializable {
this.url = url;
} else {
if (!url.startsWith(urlPath)) {
throw new Exception("地址不匹配");
throw new Exception("地址不匹配");
}
if (url.length() == urlPath.length()) {
@@ -88,7 +88,7 @@ public class HttpSendModel implements Serializable {
}
if (url.charAt(urlPath.length()) != '?') {
throw new Exception("地址不匹配");
throw new Exception("地址不匹配");
}
this.url = urlPath;
@@ -125,7 +125,7 @@ public class HttpSendModel implements Serializable {
}
/**
* 生成get模式的请求地址
* 生成get模式的请求地址
*
* @return
*/
@@ -149,11 +149,11 @@ public class HttpSendModel implements Serializable {
* 20140512 yfj modify
* requestUrl += "?" + appender;
*/
// 用于url不存在参数的情况
// 用于url不存在参数的情况
if (url.indexOf("?") == -1) {
requestUrl += "?" + appender;
}
// 用于url已存在参数的情况
// 用于url已存在参数的情况
else {
requestUrl += "&" + appender;
}
@@ -20,26 +20,26 @@ public class SimpleHttpClient {
private HttpClient httpclient;
/**
* 请求超时
* 请求超时
*/
private int connectionTimeout;
/**
* 读取超时
* 读取超时
*/
private int soTimeout;
/**
* 默认请求超时(单位:毫秒)
* 默认请求超时(单位:毫秒)
*/
private static final int DEFAULT_CONNECTION_TIMEOUT = 30000;
/**
* 默认读取超时(单位:毫秒)
* 默认读取超时(单位:毫秒)
*/
private static final int DEFAULT_SO_TIMEOUT = 90000;
/**
* 按默认请求超时,读取超时设置
* 按默认请求超时,读取超时设置
*/
public SimpleHttpClient() {
this.connectionTimeout = DEFAULT_CONNECTION_TIMEOUT;
@@ -55,9 +55,9 @@ public class SimpleHttpClient {
/**
* @param connectionTimeout
* 请求超时
* 请求超时
* @param soTimeout
* 读取超时
* 读取超时
*/
public SimpleHttpClient(int connectionTimeout, int soTimeout) {
this.connectionTimeout = connectionTimeout;
@@ -5,7 +5,7 @@ import java.io.Serializable;
import com.fangjia.coresite.util.HttpUtil;
/**
* 类名称:表单参数
* 类名称:表单参数
* @version
*/
public class SimpleHttpResponse implements Serializable {
@@ -32,7 +32,7 @@ public class SimpleHttpResponse implements Serializable {
}
/**
* 是否成功
* 是否成功
*
* @return
*/
@@ -5,36 +5,36 @@ public class AdviceLeadsModel extends BaseModel{
private static final long serialVersionUID = -5664116886759283515L;
/**
* 姓名
* 姓名
*/
private String name;
/**
* 手机
* 手机
*/
private String mobile;
/**
* 邮箱
* 邮箱
*/
private String email;
/**
* 公司
* 公司
*/
private String company;
/**
* 部门
* 部门
*/
private String department;
/**
* 职位
* 职位
*/
private String position;
@@ -6,67 +6,67 @@ public class AgreementModel extends BaseModel {
private static final long serialVersionUID = 1L;
/**
* 编号
* 编号
*/
private String id;
/**
* 协议编号
* 协议编号
*/
private String loanAgreementId;
/**
* 账户名
* 账户名
*/
private String name;
/**
* 手机号
* 手机号
*/
private String mobile;
/**
* 贷款金额
* 贷款金额
*/
private double loanAmount;
/**
* 服务费比率
* 服务费比率
*/
private double serviceRate;
/**
* 协议编号
* 协议编号
*/
private String agreementId;
/**
* 证件类型
* 证件类型
*/
private String certificate;
/**
* 证件号码
* 证件号码
*/
private String number;
/**
* 银行卡号
* 银行卡号
*/
private String cardNumber;
/**
* 开户行
* 开户行
*/
private String bank;
/**
* 签名图片Url
* 签名图片Url
*/
private String signatureUrl;
/**
* 是否有效 1:有效 0:无效
* 是否有效 1:有效 0:无效
*/
private int status;
/**
* 添加时间
* 添加时间
*/
private Date addTime;
/**
* 修改时间
* 修改时间
*/
private Date modTime;
@@ -76,52 +76,52 @@ public class AgreementModel extends BaseModel {
private String msg;
/**
* 当前年份
* 当前年份
*/
private String nowYear;
/**
* 当前月份
* 当前月份
*/
private String nowMonth;
/**
* 当天
* 当天
*/
private String nowDay;
/**
* 64位加密后图片
* 64位加密后图片
*/
private String imageFile;
/**
* 是否重新加载
* 是否重新加载
*/
private int reload;
/**
* 贷款金额(中文大写)
* 贷款金额(中文大写)
*/
private String amountToChinese;
/**
* 短信验证码
* 短信验证码
*/
private String smsCode;
/**
* 签约状态 0:未签约 1:已签约 2:已失效 3:已拒绝
* 签约状态 0:未签约 1:已签约 2:已失效 3:已拒绝
*/
private int signStatus;
/**
* 商户编号
* 商户编号
*/
private String merchantno;
/**
* 绑卡请求号
* 绑卡请求号
*/
private String requestno;
@@ -4,53 +4,53 @@ import java.util.Date;
import java.util.List;
/**
* 精品公寓Model
* 精品公寓Model
*
* @author Jenis
*
* 2018年6月29日 下午15:14:28
* 2018年6月29日 下午15:14:28
*/
public class ApartmentModel extends BaseModel {
private static final long serialVersionUID = 4803131874204818108L;
private String id;
private String region; // 区域
private String block; // 板块
private String region; // 区域
private String block; // 板块
private String station;
private Integer walktime;
private Integer room; // 室
private Integer room; // 室
private String totalPriceRange;
private String houseAreaRange;
private String houseAgeRange;
private String creationDateRange;
private String keyword;
private String districtName; // 小区名
private String name; // 标题
private String city2; // 城市
private List<String> pics; // 图片
private Integer totalPrice; // 租金
private Double area; // 面积
private Integer hall; // 厅
private Integer toilet; // 卫
private String address; // 地址
private String districtName; // 小区名
private String name; // 标题
private String city2; // 城市
private List<String> pics; // 图片
private Integer totalPrice; // 租金
private Double area; // 面积
private Integer hall; // 厅
private Integer toilet; // 卫
private String address; // 地址
private String mobile; // mobile
private Date publishDate; // 发布时间
private Integer floor; // 所在楼层
private Integer height; // 楼高
private String contactPeople; // 联系人
private String fitment; // 装修情况
private String direction; // 朝向
private String buildDate; // 建筑年代
private String estateType; // 物业类型
private String description; // 描述
private String rentType; // 出租类型
private String checkInTime; // 可入住时间
private String houseAllocation;// 房屋配置,分割
private String houseRequire;// 房屋要求
private String houseAdvantage;// 房屋亮点
private String payType; // 付款方式
private String metro; // 地铁
private String line; // 线路
private String subject; // 来源(交易主体个人或者中介等)
private Date publishDate; // 发布时间
private Integer floor; // 所在楼层
private Integer height; // 楼高
private String contactPeople; // 联系人
private String fitment; // 装修情况
private String direction; // 朝向
private String buildDate; // 建筑年代
private String estateType; // 物业类型
private String description; // 描述
private String rentType; // 出租类型
private String checkInTime; // 可入住时间
private String houseAllocation;// 房屋配置,分割
private String houseRequire;// 房屋要求
private String houseAdvantage;// 房屋亮点
private String payType; // 付款方式
private String metro; // 地铁
private String line; // 线路
private String subject; // 来源(交易主体个人或者中介等)
private Double lat;
private Double lng;
private String defaultPic;
@@ -23,17 +23,17 @@ public class ApiModel extends BaseModel {
/**
* 区域
* 区域
*/
private String region;
/**
* 小区
* 小区
*/
private String districtName;
/**
* 均价
* 均价
*/
private JSONObject stat;
private Map<String, String> serviceIdMap;
@@ -144,30 +144,30 @@ public class ApiModel extends BaseModel {
public final Map<String, String> getServiceIdMsgMap(){
serviceIdMsgMap = new HashMap<String, String>();
serviceIdMsgMap.put("S001", "房屋总价");
serviceIdMsgMap.put("S002", "房屋租金");
serviceIdMsgMap.put("S003", "房屋总价月涨跌幅");
serviceIdMsgMap.put("S004", "房屋租金月涨跌幅");
serviceIdMsgMap.put("S005", "周边相似挂牌房源");
serviceIdMsgMap.put("S006", "周边相似挂牌量");
serviceIdMsgMap.put("S007", "小区名址匹配");
serviceIdMsgMap.put("S008", "小区均价");
serviceIdMsgMap.put("S009", "小区平均租金");
serviceIdMsgMap.put("S010", "小区均价月涨跌幅");
serviceIdMsgMap.put("S011", "小区平均租金月涨跌幅");
serviceIdMsgMap.put("S012", "小区周边交通状况");
serviceIdMsgMap.put("S013", "小区周边居住人口密度");
serviceIdMsgMap.put("S014", "小区物业类型");
serviceIdMsgMap.put("S015", "小区挂牌量");
serviceIdMsgMap.put("S016", "小区周边均价");
serviceIdMsgMap.put("S017", "小区周边平均租金");
serviceIdMsgMap.put("S018", "小区周边平均餐饮消费");
serviceIdMsgMap.put("S019", "区域住宅均价");
serviceIdMsgMap.put("S020", "区域住宅均价月涨跌幅");
serviceIdMsgMap.put("S021", "区域餐饮平均消费");
serviceIdMsgMap.put("S022", "城市住宅均价");
serviceIdMsgMap.put("S023", "城市住宅均价月涨跌幅");
serviceIdMsgMap.put("S024", "城市餐饮平均消费");
serviceIdMsgMap.put("S001", "房屋总价");
serviceIdMsgMap.put("S002", "房屋租金");
serviceIdMsgMap.put("S003", "房屋总价月涨跌幅");
serviceIdMsgMap.put("S004", "房屋租金月涨跌幅");
serviceIdMsgMap.put("S005", "周边相似挂牌房源");
serviceIdMsgMap.put("S006", "周边相似挂牌量");
serviceIdMsgMap.put("S007", "小区名址匹配");
serviceIdMsgMap.put("S008", "小区均价");
serviceIdMsgMap.put("S009", "小区平均租金");
serviceIdMsgMap.put("S010", "小区均价月涨跌幅");
serviceIdMsgMap.put("S011", "小区平均租金月涨跌幅");
serviceIdMsgMap.put("S012", "小区周边交通状况");
serviceIdMsgMap.put("S013", "小区周边居住人口密度");
serviceIdMsgMap.put("S014", "小区物业类型");
serviceIdMsgMap.put("S015", "小区挂牌量");
serviceIdMsgMap.put("S016", "小区周边均价");
serviceIdMsgMap.put("S017", "小区周边平均租金");
serviceIdMsgMap.put("S018", "小区周边平均餐饮消费");
serviceIdMsgMap.put("S019", "区域住宅均价");
serviceIdMsgMap.put("S020", "区域住宅均价月涨跌幅");
serviceIdMsgMap.put("S021", "区域餐饮平均消费");
serviceIdMsgMap.put("S022", "城市住宅均价");
serviceIdMsgMap.put("S023", "城市住宅均价月涨跌幅");
serviceIdMsgMap.put("S024", "城市餐饮平均消费");
return serviceIdMsgMap;
}
@@ -4,34 +4,34 @@ public class ApplyLoanModel extends BaseModel{
private static final long serialVersionUID = 1L;
//小区名
//小区名
private String name;
//地址
//地址
private String address;
//总价
//总价
private long totalPrice;
//面积
//面积
private Double area;
//均价
//均价
private Integer avgPrice;
//贷款id
//贷款id
private String productId;
//申请贷款页面来源
//申请贷款页面来源
private String source;
//贷款类型
//贷款类型
private String loanType;
//上一页面链接
//上一页面链接
private String backUrl;
//手机号
//手机号
private String mobile;
public String getProductId() {

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