修改代码字符编码

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
+1 -1
View File
@@ -7,7 +7,7 @@
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<name>script</name> <name>script</name>
<properties> <properties>
<project.build.sourceEncoding>GBK</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<build> <build>
<finalName>script</finalName> <finalName>script</finalName>
@@ -24,18 +24,18 @@ public class FetchPageToDB {
private StringBuffer verificationErrors = new StringBuffer(); private StringBuffer verificationErrors = new StringBuffer();
private Set<String> URLset = new HashSet<String>(); private Set<String> URLset = new HashSet<String>();
private String baseUrl = "http://bol.szhome.com/";//基础url private String baseUrl = "http://bol.szhome.com/";//基础url
private String firstEndUrl = "/search.aspx";//用基础url拼接成进入页面第一个URl private String firstEndUrl = "/search.aspx";//用基础url拼接成进入页面第一个URl
private String detailStartUrl = "";//把它作为前置Url拼接A标记的href, private String detailStartUrl = "";//把它作为前置Url拼接A标记的href,
static final String CITY = "深圳";//城市 static final String CITY = "深圳";//城市
static final String SITE_NAME = "深圳房地产信息网";//网站名称 static final String SITE_NAME = "深圳房地产信息网";//网站名称
static final String PAGE_NAME = "详细信息";//页面类型 static final String PAGE_NAME = "详细信息";//页面类型
static final String CATEGORY = "district"; static final String CATEGORY = "district";
static final String charset = "utf-8";//编码格式utf-8 static final String charset = "utf-8";//编码格式utf-8
static final String nextPageStr = ">";//下一页按钮的文本内容一般为:“下一页”or">" static final String nextPageStr = ">";//下一页按钮的文本内容一般为:“下一页”or">"
static final int BreakPointpageCount = 1; //断点位置页数(即为开始页) static final int BreakPointpageCount = 1; //断点位置页数(即为开始页)
static final int pageCount = 200; //分页总数 static final int pageCount = 200; //分页总数
static final String selectAeleStr = ".imgdiv a";//每页内容中选择到详细页面url标记 static final String selectAeleStr = ".imgdiv a";//每页内容中选择到详细页面url标记
@Before @Before
public void setUp() throws Exception { public void setUp() throws Exception {
@@ -50,25 +50,25 @@ public class FetchPageToDB {
driver.get(baseUrl + firstEndUrl); driver.get(baseUrl + firstEndUrl);
dryRun(driver,BreakPointpageCount);//空跑到断点页面 dryRun(driver,BreakPointpageCount);//空跑到断点页面
fetchDetail(driver);//获取第一个页面的内容 fetchDetail(driver);//获取第一个页面的内容
System.out.printf("处理完成第%d页\r\n",BreakPointpageCount); System.out.printf("处理完成第%d页\r\n",BreakPointpageCount);
for(int i=BreakPointpageCount+1;i<=pageCount;i++) { //循环分页处理页面内容 for(int i=BreakPointpageCount+1;i<=pageCount;i++) { //循环分页处理页面内容
Thread.sleep(500); Thread.sleep(500);
WebDriverWait webDriverWait = new WebDriverWait(driver, 10); WebDriverWait webDriverWait = new WebDriverWait(driver, 10);
webDriverWait.until(ExpectedConditions.presenceOfElementLocated(By.linkText(nextPageStr))).click(); webDriverWait.until(ExpectedConditions.presenceOfElementLocated(By.linkText(nextPageStr))).click();
fetchDetail(driver); fetchDetail(driver);
System.out.printf("处理完成第%d页\r\n",i); System.out.printf("处理完成第%d页\r\n",i);
} }
} }
/** /**
* 空跑到上一个发生错误的页面 * 空跑到上一个发生错误的页面
* @param driver * @param driver
* @param BreakPointpageCount * @param BreakPointpageCount
* @throws InterruptedException * @throws InterruptedException
@@ -87,7 +87,7 @@ public class FetchPageToDB {
} }
/** /**
* 获取页面详细内容保存到数据库 * 获取页面详细内容保存到数据库
* @param driver * @param driver
*/ */
public void fetchDetail(WebDriver driver){ public void fetchDetail(WebDriver driver){
@@ -101,7 +101,7 @@ public class FetchPageToDB {
} }
String detailContent = InvokeHttpRequest.get(detailUrl, charset,null); String detailContent = InvokeHttpRequest.get(detailUrl, charset,null);
URLset.add(detailUrl); URLset.add(detailUrl);
SaveToWebpage.DataSaveToWebpage(CITY, SITE_NAME, PAGE_NAME, CATEGORY, detailUrl, detailContent);//保存数据 SaveToWebpage.DataSaveToWebpage(CITY, SITE_NAME, PAGE_NAME, CATEGORY, detailUrl, detailContent);//保存数据
} }
} }
@After @After
@@ -22,7 +22,7 @@ public class FetchPageUtil {
/** /**
* 打印传入页面渲染后的源码 * 打印传入页面渲染后的源码
* @param url * @param url
* @throws InterruptedException * @throws InterruptedException
*/ */
@@ -33,7 +33,7 @@ public class FetchPageUtil {
driver.quit(); driver.quit();
} }
/** /**
* 打印页面源码和选择器匹配后的结果 * 打印页面源码和选择器匹配后的结果
* @param url * @param url
* @param selectStr * @param selectStr
* @throws InterruptedException * @throws InterruptedException
@@ -46,7 +46,7 @@ public class FetchPageUtil {
driver.quit(); driver.quit();
} }
/** /**
* 测试分页是否正常运行 * 测试分页是否正常运行
* @param url * @param url
* @param nextStr * @param nextStr
* @throws InterruptedException * @throws InterruptedException
@@ -75,8 +75,8 @@ public class FetchPageUtil {
} }
@Test @Test
public void runMain() throws InterruptedException{ public void runMain() throws InterruptedException{
//printPageSource("http://bol.szhome.com/search.aspx");//第一步,查看分页的渲染后源码 //printPageSource("http://bol.szhome.com/search.aspx");//第一步,查看分页的渲染后源码
printselects("http://bol.szhome.com/search.aspx",".imgdiv a");//根据源码写出选择器String printselects("http://bol.szhome.com/search.aspx",".imgdiv a");//根据源码写出选择器String
//TestNext("http://bol.szhome.com/search.aspx",">");//测试分页 //TestNext("http://bol.szhome.com/search.aspx",">");//测试分页
} }
} }
@@ -46,7 +46,7 @@ public class JQueryUtils {
try{ try{
if(repeatTimes>0){ if(repeatTimes>0){
Thread.sleep(1000); Thread.sleep(1000);
System.out.println( "准备尝试第"+(repeatTimes+1)+"次请求:$url"); System.out.println( "准备尝试第"+(repeatTimes+1)+"次请求:$url");
} }
doc = Jsoup.parse(new URL(url), 5*1000); doc = Jsoup.parse(new URL(url), 5*1000);
if(doc != null){ if(doc != null){
@@ -58,7 +58,7 @@ public class JQueryUtils {
} }
if(doc==null){ if(doc==null){
System.out.println("检测到不可访问链接:$url"); System.out.println("检测到不可访问链接:$url");
} }
return doc; return doc;
} }
@@ -69,7 +69,7 @@ public class JQueryUtils {
try{ try{
if(repeatTimes>0){ if(repeatTimes>0){
Thread.sleep(1000); Thread.sleep(1000);
System.out.println("准备尝试第"+(repeatTimes+1)+"次请求:$url"); System.out.println("准备尝试第"+(repeatTimes+1)+"次请求:$url");
} }
URL _url = new URL(url); URL _url = new URL(url);
input = _url.openStream(); input = _url.openStream();
@@ -92,7 +92,7 @@ public class JQueryUtils {
} }
if(doc==null){ if(doc==null){
System.out.println("检测到不可访问链接:$url"); System.out.println("检测到不可访问链接:$url");
} }
return doc; return doc;
} }
@@ -70,7 +70,7 @@ public class SaveToWebpage {
} }
/** /**
* ѹËõ * 压缩
* *
* @param content * @param content
* @return * @return
+2 -2
View File
@@ -7,7 +7,7 @@
<version>0.0.1-SNAPSHOT</version> <version>0.0.1-SNAPSHOT</version>
<name>chafangtong-dal</name> <name>chafangtong-dal</name>
<properties> <properties>
<project.build.sourceEncoding>GBK</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<build> <build>
<finalName>chafangtong-dal</finalName> <finalName>chafangtong-dal</finalName>
@@ -19,7 +19,7 @@
<configuration> <configuration>
<source>1.6</source> <source>1.6</source>
<target>1.6</target> <target>1.6</target>
<encoding>GBK</encoding> <encoding>UTF-8</encoding>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
@@ -10,7 +10,7 @@ import javax.persistence.Table;
import com.fangjia.dal.MongoEntity; import com.fangjia.dal.MongoEntity;
/** /**
* ·¿ÆÀ¿¨Óû§·´À¡±í * 房评卡用户反馈表
* *
*/ */
@Entity @Entity
@@ -11,7 +11,7 @@ import javax.persistence.Table;
import com.fangjia.dal.MongoEntity; import com.fangjia.dal.MongoEntity;
/** /**
* 房评卡报告下载记录表 * 房评卡报告下载记录表
* *
*/ */
@Entity @Entity
@@ -25,9 +25,9 @@ public class FpkDownload implements MongoEntity {
private String city; private String city;
private String region; private String region;
private String districtName; private String districtName;
private int actionType;//1:住宅 2:商铺 private int actionType;//1:住宅 2:商铺
private int valid; //0:有效 1:无效 private int valid; //0:有效 1:无效
// TODO 按需求加字段 如:报告的一些信息 // TODO 按需求加字段 如:报告的一些信息
private Date downloadDate; private Date downloadDate;
private String userName; private String userName;
private String roleName; private String roleName;
@@ -11,7 +11,7 @@ import javax.persistence.Table;
import com.fangjia.dal.MongoEntity; import com.fangjia.dal.MongoEntity;
/** /**
* ·¿ÆÀ¿¨Óû§·´À¡±í * 房评卡用户反馈表
* *
*/ */
@Entity @Entity
@@ -11,7 +11,7 @@ import javax.persistence.Table;
import com.fangjia.dal.MongoEntity; import com.fangjia.dal.MongoEntity;
/** /**
* 房评卡菜单表 * 房评卡菜单表
* *
*/ */
@Entity @Entity
@@ -20,10 +20,10 @@ public class FpkMenu implements MongoEntity {
private static final long serialVersionUID = -6309545731097038246L; private static final long serialVersionUID = -6309545731097038246L;
private String id; private String id;
private String name; // 名称 private String name; // 名称
private String type; // 类型 目前分住宅、商铺 private String type; // 类型 目前分住宅、商铺
private String uri; // 访问地址 如:/local/shop private String uri; // 访问地址 如:/local/shop
private int sn; // 序号 从小到大排序 private int sn; // 序号 从小到大排序
private Date creationDate; private Date creationDate;
private Date modificationDate; private Date modificationDate;
@@ -12,7 +12,7 @@ import javax.persistence.Table;
import com.fangjia.dal.MongoEntity; import com.fangjia.dal.MongoEntity;
/** /**
* 角色 * 角色
* *
*/ */
@Entity @Entity
@@ -21,9 +21,9 @@ public class FpkRole implements MongoEntity {
private static final long serialVersionUID = 6346725824282407782L; private static final long serialVersionUID = 6346725824282407782L;
private String id; private String id;
private String name; // 名称 private String name; // 名称
private String desc; // 描述 private String desc; // 描述
private List<String> menuStrs; // 权限菜单 有序 private List<String> menuStrs; // 权限菜单 有序
private Date creationDate; private Date creationDate;
private Date modificationDate; private Date modificationDate;
@@ -12,7 +12,7 @@ import javax.persistence.Table;
import com.fangjia.dal.MongoEntity; import com.fangjia.dal.MongoEntity;
/** /**
* 房评卡用户表 * 房评卡用户表
* *
*/ */
@Entity @Entity
@@ -26,10 +26,10 @@ public class FpkUsers implements MongoEntity {
private String name; private String name;
private String password; private String password;
private boolean enabled; private boolean enabled;
private String role; // 用户类型 private String role; // 用户类型
private Date creationDate; // 创建日期 private Date creationDate; // 创建日期
private Date modificationDate; // 修改日期 private Date modificationDate; // 修改日期
private Date expiryDate; // 有效期(截至日期) private Date expiryDate; // 有效期(截至日期)
private int fangpingApplyAdd; private int fangpingApplyAdd;
private int fangpingApplyCount; private int fangpingApplyCount;
private int fangpingDownloadCount; private int fangpingDownloadCount;
@@ -37,8 +37,8 @@ public class FpkUsers implements MongoEntity {
private int shopApplyCount; private int shopApplyCount;
private int shopDownloadCount; private int shopDownloadCount;
private String company; private String company;
private List<String> propertySupportCitys; // 住宅开通城市 private List<String> propertySupportCitys; // 住宅开通城市
private List<String> shopSupportCitys; //商铺开通城市 private List<String> shopSupportCitys; //商铺开通城市
private String email; private String email;
private String defaultCity; private String defaultCity;
@@ -32,7 +32,7 @@ public class ChafangtongContextLoaderListener extends ContextLoaderListener {
} }
super.contextInitialized(event); super.contextInitialized(event);
// Ô¤ÈÈ // 预热
if (LOGGER.isInfoEnabled()) { if (LOGGER.isInfoEnabled()) {
LOGGER.info("warm up keyword links..."); LOGGER.info("warm up keyword links...");
} }
@@ -30,7 +30,7 @@ import com.fangjia.dal.seaweed.model.District;
import com.fangjia.service.mongo.fangjia.BusStationService; import com.fangjia.service.mongo.fangjia.BusStationService;
/** /**
* 环境指数 * 环境指数
* @author yk * @author yk
* *
*/ */
@@ -54,13 +54,13 @@ public class AroundController extends BaseController {
double lng = district.getLng2()/10000000000d; double lng = district.getLng2()/10000000000d;
double radius = getRadius(); double radius = getRadius();
Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius); Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius);
model.setMetroStations(stationMap.get("地铁")); model.setMetroStations(stationMap.get("地铁"));
model.setBusStations(stationMap.get("公交")); model.setBusStations(stationMap.get("公交"));
String[] ks = new String[] { "医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园", "机场", "网吧" }; String[] ks = new String[] { "医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园", "机场", "网吧" };
//厌恶设施 //厌恶设施
String[] keys = new String[]{"发电厂","变电站","垃圾焚烧厂","化工厂"}; String[] keys = new String[]{"发电厂","变电站","垃圾焚烧厂","化工厂"};
Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length); Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
@@ -71,24 +71,24 @@ public class AroundController extends BaseController {
JSONObject json = baiduApiService.searchNearby(keys[i], lat, lng, 1000, model.getBaiduMapKey()); JSONObject json = baiduApiService.searchNearby(keys[i], lat, lng, 1000, model.getBaiduMapKey());
countMap.put(keys[i], getTotal(json)); countMap.put(keys[i], getTotal(json));
} }
countMap.put("地铁站", null == model.getMetroStations() ? null : model.getMetroStations().size()); countMap.put("地铁站", null == model.getMetroStations() ? null : model.getMetroStations().size());
countMap.put("公交点", null == model.getBusStations() ? null : model.getBusStations().size()); countMap.put("公交点", null == model.getBusStations() ? null : model.getBusStations().size());
// 虹桥机场 121.352578,31.200062 // 虹桥机场 121.352578,31.200062
// 浦东机场 121.807085,31.160702 // 浦东机场 121.807085,31.160702
double dis = GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062); double dis = GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062);
if (dis <= radius) { if (dis <= radius) {
model.setAirPort("虹桥机场"); model.setAirPort("虹桥机场");
model.setAirPortLat(31.200062); model.setAirPortLat(31.200062);
model.setAirPortLng(121.352578); model.setAirPortLng(121.352578);
countMap.put("机场", 1); countMap.put("机场", 1);
} else { } else {
dis = GeoUtils.calculateDistance(lng, lat, 121.807085, 31.160702); dis = GeoUtils.calculateDistance(lng, lat, 121.807085, 31.160702);
if (dis <= radius) { if (dis <= radius) {
model.setAirPort("浦东机场"); model.setAirPort("浦东机场");
model.setAirPortLat(31.160702); model.setAirPortLat(31.160702);
model.setAirPortLng(121.807085); model.setAirPortLng(121.807085);
countMap.put("机场", 1); countMap.put("机场", 1);
} }
} }
@@ -120,22 +120,22 @@ public class AroundController extends BaseController {
double lng = mall.getLng2()/10000000000d; double lng = mall.getLng2()/10000000000d;
double radius = getRadius(); double radius = getRadius();
Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius); Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius);
model.setMetroStations(stationMap.get("地铁")); model.setMetroStations(stationMap.get("地铁"));
model.setBusStations(stationMap.get("公交")); model.setBusStations(stationMap.get("公交"));
String[] ks = new String[] { "医院", "公园", "学校", "体育馆" }; String[] ks = new String[] { "医院", "公园", "学校", "体育馆" };
Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length); Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
JSONObject json = baiduApiService.searchNearby(ks[i], lat, lng, radius, model.getBaiduMapKey()); JSONObject json = baiduApiService.searchNearby(ks[i], lat, lng, radius, model.getBaiduMapKey());
countMap.put(ks[i], getTotal(json)); countMap.put(ks[i], getTotal(json));
} }
countMap.put("地铁站", null == model.getMetroStations() ? null : model.getMetroStations().size()); countMap.put("地铁站", null == model.getMetroStations() ? null : model.getMetroStations().size());
countMap.put("公交点", null == model.getBusStations() ? null : model.getBusStations().size()); countMap.put("公交点", null == model.getBusStations() ? null : model.getBusStations().size());
double score1 = ShopScoreUtil.aroundScore1(countMap); double score1 = ShopScoreUtil.aroundScore1(countMap);
model.setScore1(score1); model.setScore1(score1);
ks = new String[] { "银行", "商场", "大型超市", "餐饮" }; ks = new String[] { "银行", "商场", "大型超市", "餐饮" };
countMap = new HashMap<String, Integer>(ks.length); countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
JSONObject json = baiduApiService.searchNearby(ks[i], lat, lng, radius, model.getBaiduMapKey()); JSONObject json = baiduApiService.searchNearby(ks[i], lat, lng, radius, model.getBaiduMapKey());
@@ -123,7 +123,7 @@ public class AutocompleteController {
//nameQuery.add(new TermQuery(new Term("address", keyword)), Occur.SHOULD); //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("addr_alias_std", keyword)), Occur.SHOULD);
nameQuery.add(new TermQuery(new Term("keyword", 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); srQuery1.add(nameQuery, Occur.SHOULD);
params.add(new QueryParam("$sr", new SrQuery(srQuery1))); params.add(new QueryParam("$sr", new SrQuery(srQuery1)));
List<District> districts = districtService.findAllByParams(params, 0, limit, new String[] { "region", "name","address", "addrAlias" }); List<District> districts = districtService.findAllByParams(params, 0, limit, new String[] { "region", "name","address", "addrAlias" });
@@ -138,7 +138,7 @@ public class AutocompleteController {
bo.setRegion(district.getRegion()); bo.setRegion(district.getRegion());
ret.add(bo); ret.add(bo);
} }
//对自动完成出来的结果按长短排序 //对自动完成出来的结果按长短排序
if(ret.size() > 0){ if(ret.size() > 0){
Collections.sort(ret, new Comparator<AutoCompleteBo>() { Collections.sort(ret, new Comparator<AutoCompleteBo>() {
public int compare(AutoCompleteBo o1, AutoCompleteBo o2) { public int compare(AutoCompleteBo o1, AutoCompleteBo o2) {
@@ -104,16 +104,16 @@ public abstract class BaseController {
} }
/** /**
* 根据cookie或者用户输入关键字,填充经纬度、mall信息到cookie和model * 根据cookie或者用户输入关键字,填充经纬度、mall信息到cookie和model
*/ */
protected void fillShop2CookieModel(ChafangtongModel model) { protected void fillShop2CookieModel(ChafangtongModel model) {
// TODO 不用每次都去seaweed查询mall,可根据是否是新提交表单、存下的mallid来查,优化性能 // TODO 不用每次都去seaweed查询mall,可根据是否是新提交表单、存下的mallid来查,优化性能
HttpServletResponse response = ActionContext.getContext().getResponse(); HttpServletResponse response = ActionContext.getContext().getResponse();
String keyword = model.getQ(); String keyword = model.getQ();
if (StringUtils.isNotBlank(keyword)) { if (StringUtils.isNotBlank(keyword)) {
Shop mall = null; Shop mall = null;
// open地址匹配 // open地址匹配
Map<String, Object> resMap = addressService.parse(model.getCityName(), keyword, "shop", false); Map<String, Object> resMap = addressService.parse(model.getCityName(), keyword, "shop", false);
if (MapUtils.isNotEmpty(resMap)) { if (MapUtils.isNotEmpty(resMap)) {
if (resMap.containsKey("status") && (Integer) resMap.get("status") == 0 && resMap.containsKey("precise") if (resMap.containsKey("status") && (Integer) resMap.get("status") == 0 && resMap.containsKey("precise")
@@ -124,14 +124,14 @@ public abstract class BaseController {
} }
if ("general".equals(model.getControllerName())) { if ("general".equals(model.getControllerName())) {
// 记录用户搜索词open匹配结果 // 记录用户搜索词open匹配结果
HttpServletRequest request = ActionContext.getContext().getRequest(); HttpServletRequest request = ActionContext.getContext().getRequest();
AddressMatchLog addressMatchLog = new AddressMatchLog(); AddressMatchLog addressMatchLog = new AddressMatchLog();
addressMatchLog.setCity(model.getCityName()); addressMatchLog.setCity(model.getCityName());
addressMatchLog.setInput(model.getQ()); addressMatchLog.setInput(model.getQ());
addressMatchLog.setIp(AnalyticsUtil.getIpAddress(request)); addressMatchLog.setIp(AnalyticsUtil.getIpAddress(request));
addressMatchLog.setUid(cookieContext.getCookieValue(request, "fpk_uid")); addressMatchLog.setUid(cookieContext.getCookieValue(request, "fpk_uid"));
addressMatchLog.setSource("房评卡"); addressMatchLog.setSource("房评卡");
addressMatchLog.setUserName(cookieContext.getCookieValue(request, "fpk_name")); addressMatchLog.setUserName(cookieContext.getCookieValue(request, "fpk_name"));
addressMatchLog.setCreationDate(new Date()); addressMatchLog.setCreationDate(new Date());
addressMatchLog.setModificationDate(new Date()); addressMatchLog.setModificationDate(new Date());
@@ -203,7 +203,7 @@ public abstract class BaseController {
} }
protected void fillDistrict2CookieModel(ChafangtongModel model) { protected void fillDistrict2CookieModel(ChafangtongModel model) {
// TODO 不用每次都去seaweed查询district,可根据是否是新提交表单、存下的districtid来查,优化性能 // TODO 不用每次都去seaweed查询district,可根据是否是新提交表单、存下的districtid来查,优化性能
HttpServletResponse response = ActionContext.getContext().getResponse(); HttpServletResponse response = ActionContext.getContext().getResponse();
String keyword = model.getQ(); String keyword = model.getQ();
if (StringUtils.isNotBlank(keyword)) { if (StringUtils.isNotBlank(keyword)) {
@@ -31,7 +31,7 @@ import com.fangjia.dal.seaweed.model.District;
import com.fangjia.service.mongo.fangjia.BizShopService; import com.fangjia.service.mongo.fangjia.BizShopService;
/** /**
* 消费指数 * 消费指数
* @author yk * @author yk
* *
*/ */
@@ -54,7 +54,7 @@ public class ConsumController extends BaseController {
double lat = district.getLat2()/10000000000d; double lat = district.getLat2()/10000000000d;
double lng = district.getLng2()/10000000000d; double lng = district.getLng2()/10000000000d;
double radius = getRadius(); double radius = getRadius();
model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "美食")); model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "美食"));
double cityConsumMin = model.getCityConsumMin()!=null?model.getCityConsumMin():15; double cityConsumMin = model.getCityConsumMin()!=null?model.getCityConsumMin():15;
double cityConsumMax = model.getCityConsumMax()!=null?model.getCityConsumMax():150; double cityConsumMax = model.getCityConsumMax()!=null?model.getCityConsumMax():150;
@@ -62,7 +62,7 @@ public class ConsumController extends BaseController {
model.setHigher((model.getAvgConsumption() - cityConsumMin) * 100.0 / (cityConsumMax - cityConsumMin)); model.setHigher((model.getAvgConsumption() - cityConsumMin) * 100.0 / (cityConsumMax - cityConsumMin));
} }
String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" }; String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" };
Map<String, JSONObject> result = baiduApiService.searchNearBy(Arrays.asList(ks), lat, lng, 1000, model.getBaiduMapKey()); Map<String, JSONObject> result = baiduApiService.searchNearBy(Arrays.asList(ks), lat, lng, 1000, model.getBaiduMapKey());
Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length); Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length);
for (String k : ks) { for (String k : ks) {
@@ -87,13 +87,13 @@ public class ConsumController extends BaseController {
// model.setAroundSell(aroundMarkers); // model.setAroundSell(aroundMarkers);
// } // }
double radius = getRadius(); double radius = getRadius();
model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅")); model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅"));
double cityConsumMin = model.getCityConsumMin(); double cityConsumMin = model.getCityConsumMin();
double cityConsumMax = model.getCityConsumMax(); double cityConsumMax = model.getCityConsumMax();
if (null != model.getAvgConsumption()) { if (null != model.getAvgConsumption()) {
model.setHigher((model.getAvgConsumption() - cityConsumMin) * 100.0 / (cityConsumMax - cityConsumMin)); model.setHigher((model.getAvgConsumption() - cityConsumMin) * 100.0 / (cityConsumMax - cityConsumMin));
} }
String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" }; String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" };
Map<String, JSONObject> result = baiduApiService.searchNearBy(Arrays.asList(ks), lat, lng, 1000, model.getBaiduMapKey()); Map<String, JSONObject> result = baiduApiService.searchNearBy(Arrays.asList(ks), lat, lng, 1000, model.getBaiduMapKey());
Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length); Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length);
for (String k : ks) { for (String k : ks) {
@@ -13,7 +13,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
* Òâ¼û·´À¡ * 意见反馈
* Created by wenyan on 2015/11/24. * Created by wenyan on 2015/11/24.
*/ */
public class FeedbackController { public class FeedbackController {
@@ -54,7 +54,7 @@ import com.fangjia.service.mongo.fangjia.DistrictHotService;
import com.fangjia.service.mongo.fangjia.PricePredictService; import com.fangjia.service.mongo.fangjia.PricePredictService;
/** /**
* 首页 * 首页
* *
* @author yk * @author yk
* *
@@ -92,7 +92,7 @@ public class GeneralController extends BaseController {
} }
model.setDistrict(district); model.setDistrict(district);
/* 坐标 */ /* 坐标 */
double lat = district.getLat2()/10000000000d; double lat = district.getLat2()/10000000000d;
double lng = district.getLng2()/10000000000d; double lng = district.getLng2()/10000000000d;
double radius = getRadius(); double radius = getRadius();
@@ -100,16 +100,16 @@ public class GeneralController extends BaseController {
String city = district.getCity(); String city = district.getCity();
String region = district.getRegion(); String region = district.getRegion();
// 房价指数 // 房价指数
RegionStat cityStat = regionStatService.findByCity(model.getCityName()); RegionStat cityStat = regionStatService.findByCity(model.getCityName());
DistrictStatBo statBo = districtStatService.findYearPeriodStatBo(districtKey); DistrictStatBo statBo = districtStatService.findYearPeriodStatBo(districtKey);
model.setStatBo(statBo); model.setStatBo(statBo);
DistrictStat stat = statBo.getDefaultDistrictStat(); DistrictStat stat = statBo.getDefaultDistrictStat();
String estateType = district.getEstateType2(); String estateType = district.getEstateType2();
if(!estateType.contains("别墅")){ if(!estateType.contains("别墅")){
estateType = "小区"; estateType = "小区";
}else{ }else{
estateType = "别墅"; estateType = "别墅";
} }
List<Integer> rentList = new ArrayList<Integer>(); List<Integer> rentList = new ArrayList<Integer>();
Map<Integer,Integer> districtStatRents = districtStatRentService.findByDistrictStatRent(districtKey, estateType); Map<Integer,Integer> districtStatRents = districtStatRentService.findByDistrictStatRent(districtKey, estateType);
@@ -134,13 +134,13 @@ public class GeneralController extends BaseController {
model.setPriceScore(DistrictScoreUtil.priceScore2(null == stat ? null: stat.getAvgPrice(), pricelist.get(0), pricelist.get(1), rentList)); model.setPriceScore(DistrictScoreUtil.priceScore2(null == stat ? null: stat.getAvgPrice(), pricelist.get(0), pricelist.get(1), rentList));
// 潜力指数 // 潜力指数
int avgPrice = 0; int avgPrice = 0;
String buildType = "小区"; String buildType = "小区";
if (null == statBo.getDistrictStat() if (null == statBo.getDistrictStat()
&& null != statBo.getVillaDistrictStat()) { && null != statBo.getVillaDistrictStat()) {
avgPrice = statBo.getVillaDistrictStat().getAvgPrice(); avgPrice = statBo.getVillaDistrictStat().getAvgPrice();
buildType = "别墅"; buildType = "别墅";
} else if (null != statBo.getDistrictStat()) { } else if (null != statBo.getDistrictStat()) {
avgPrice = statBo.getDistrictStat().getAvgPrice(); avgPrice = statBo.getDistrictStat().getAvgPrice();
} }
@@ -166,54 +166,54 @@ public class GeneralController extends BaseController {
} }
model.setRankScore(DistrictScoreUtil.rankScore2(houseCountRatio, dealPriceCountRatio)); model.setRankScore(DistrictScoreUtil.rankScore2(houseCountRatio, dealPriceCountRatio));
// 消费指数 // 消费指数
Double avgConsumption = bizShopService.findAroundAvgConsumption(lat,lng, 1000, "美食"); Double avgConsumption = bizShopService.findAroundAvgConsumption(lat,lng, 1000, "美食");
String[] allKw = new String[]{"KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴","医院", String[] allKw = new String[]{"KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴","医院",
"学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园","机场", "网吧", "发电厂", "变电站", "垃圾焚烧厂", "化工厂"}; "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园","机场", "网吧", "发电厂", "变电站", "垃圾焚烧厂", "化工厂"};
Map<String,JSONObject> searchResult = baiduApiService.searchNearBy(Arrays.asList(allKw), lat, lng, 1000, model.getBaiduMapKey()); Map<String,JSONObject> searchResult = baiduApiService.searchNearBy(Arrays.asList(allKw), lat, lng, 1000, model.getBaiduMapKey());
String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" }; String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" };
Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length); Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
countMap.put(ks[i], getTotal(searchResult.get(ks[i]))); countMap.put(ks[i], getTotal(searchResult.get(ks[i])));
} }
model.setConsumScore(DistrictScoreUtil.consumScore(avgConsumption,countMap)); model.setConsumScore(DistrictScoreUtil.consumScore(avgConsumption,countMap));
// 环境指数 // 环境指数
ks = new String[] { "医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园","机场", "网吧" }; ks = new String[] { "医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园","机场", "网吧" };
// 厌恶设施 // 厌恶设施
String[] keys = new String[] { "发电厂", "变电站", "垃圾焚烧厂", "化工厂" }; String[] keys = new String[] { "发电厂", "变电站", "垃圾焚烧厂", "化工厂" };
countMap = new HashMap<String, Integer>(ks.length); countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
countMap.put(ks[i], getTotal(searchResult.get(ks[i]))); countMap.put(ks[i], getTotal(searchResult.get(ks[i])));
} }
// 添加厌恶设施 // 添加厌恶设施
for (int i = 0; i < keys.length; i++) { for (int i = 0; i < keys.length; i++) {
countMap.put(keys[i], getTotal(searchResult.get(ks[i]))); countMap.put(keys[i], getTotal(searchResult.get(ks[i])));
} }
Map<String, List<BusStation>> stationMap = busStationService Map<String, List<BusStation>> stationMap = busStationService
.getNearByStations(city, lat, lng, 1000); .getNearByStations(city, lat, lng, 1000);
countMap.put("地铁站", null == stationMap.get("地铁") ? null : stationMap countMap.put("地铁站", null == stationMap.get("地铁") ? null : stationMap
.get("地铁").size()); .get("地铁").size());
countMap.put("公交点", null == stationMap.get("公交") ? null : stationMap countMap.put("公交点", null == stationMap.get("公交") ? null : stationMap
.get("公交").size()); .get("公交").size());
model.setAroundScore(DistrictScoreUtil.aroundScore(countMap)); model.setAroundScore(DistrictScoreUtil.aroundScore(countMap));
// 虹桥机场 121.352578,31.200062 // 虹桥机场 121.352578,31.200062
// 浦东机场 121.807085,31.160702 // 浦东机场 121.807085,31.160702
double dis = GeoUtils double dis = GeoUtils
.calculateDistance(lng, lat, 121.352578, 31.200062); .calculateDistance(lng, lat, 121.352578, 31.200062);
if (dis <= radius) { if (dis <= radius) {
countMap.put("机场", 1); countMap.put("机场", 1);
} else { } else {
dis = GeoUtils.calculateDistance(lng, lat, 121.807085, 31.160702); dis = GeoUtils.calculateDistance(lng, lat, 121.807085, 31.160702);
if (dis <= radius) { if (dis <= radius) {
countMap.put("机场", 1); countMap.put("机场", 1);
} }
} }
// 楼盘指数 // 楼盘指数
model.setDetailScore(DistrictScoreUtil.detailScore(district,seaweedNumbericDao.findDistrict(city, region,district.getName()))); model.setDetailScore(DistrictScoreUtil.detailScore(district,seaweedNumbericDao.findDistrict(city, region,district.getName())));
double totalScore = 0d; double totalScore = 0d;
@@ -509,12 +509,12 @@ public class GeneralController extends BaseController {
double radius = getRadius(); double radius = getRadius();
List<BusStation> metros = null; List<BusStation> metros = null;
List<BusStation> buses = null; List<BusStation> buses = null;
// 综合得分 // 综合得分
SeaweedNumberic numberic = seaweedNumbericDao.findShop(mall.getCity(), SeaweedNumberic numberic = seaweedNumbericDao.findShop(mall.getCity(),
mall.getRegion(), mall.getName()); mall.getRegion(), mall.getName());
model.setDetailScore(ShopScoreUtil.detailScore(mall, numberic)); model.setDetailScore(ShopScoreUtil.detailScore(mall, numberic));
// 房价 // 房价
BizRegionStat cityStat = bizRegionStatService.findCitySellPrice(mall.getCity(), BizRegionStat cityStat = bizRegionStatService.findCitySellPrice(mall.getCity(),
weekend); weekend);
DistrictStatBo statBo = shopStatService.findAllShopStat( DistrictStatBo statBo = shopStatService.findAllShopStat(
@@ -524,22 +524,22 @@ public class GeneralController extends BaseController {
null == cityStat ? null : cityStat.getAvgPrice())); null == cityStat ? null : cityStat.getAvgPrice()));
model.setStatBo(statBo); model.setStatBo(statBo);
// 租金 // 租金
BizRegionStat cityStatRent = bizRegionStatService.findCityRentPrice(mall.getCity(), weekend); BizRegionStat cityStatRent = bizRegionStatService.findCityRentPrice(mall.getCity(), weekend);
DistrictBusinessStatRentBo statRentBo = districtBusinessStatRentService DistrictBusinessStatRentBo statRentBo = districtBusinessStatRentService
.findMallStatBo(new DistrictKey(mall.getCity(), mall.getRegion(), mall.getName()), weekend); .findMallStatBo(new DistrictKey(mall.getCity(), mall.getRegion(), mall.getName()), weekend);
model.setRentScore(ShopScoreUtil.rentScore(statRentBo,null == cityStatRent ? null : cityStatRent.getAvgPrice(), mall.getPaymentPattern())); model.setRentScore(ShopScoreUtil.rentScore(statRentBo,null == cityStatRent ? null : cityStatRent.getAvgPrice(), mall.getPaymentPattern()));
// 地段 // 地段
Map<String, List<BusStation>> stationMap = busStationService Map<String, List<BusStation>> stationMap = busStationService
.getNearByStations(mall.getCity(), lat, lng, radius); .getNearByStations(mall.getCity(), lat, lng, radius);
metros = stationMap.get("地铁"); metros = stationMap.get("地铁");
buses = stationMap.get("公交"); buses = stationMap.get("公交");
model.setLocalScore(ShopScoreUtil.localScore(mall.getLoopLineInfo(), model.setLocalScore(ShopScoreUtil.localScore(mall.getLoopLineInfo(),
null == metros ? 0 : metros.size(), null == metros ? 0 : metros.size(),
null == buses ? 0 : buses.size())); null == buses ? 0 : buses.size()));
// 人口 // 人口
int cityAvgPrice = cityPriceLevelService.findCityPriceLevel(city); int cityAvgPrice = cityPriceLevelService.findCityPriceLevel(city);
cityAvgPrice = cityAvgPrice == 0 ? 7000 : cityAvgPrice; cityAvgPrice = cityAvgPrice == 0 ? 7000 : cityAvgPrice;
@@ -547,7 +547,7 @@ public class GeneralController extends BaseController {
lng, radius); lng, radius);
int totalHouseCount = getTotalHouseCount(districts, cityAvgPrice); int totalHouseCount = getTotalHouseCount(districts, cityAvgPrice);
// 居民人口密度 // 居民人口密度
double circleArea = Math.PI * Math.pow(radius / 1000.0, 2); double circleArea = Math.PI * Math.pow(radius / 1000.0, 2);
double density = totalHouseCount * 2.49 / circleArea; double density = totalHouseCount * 2.49 / circleArea;
double peopleScore1 = ShopScoreUtil.peopleScore1(density); double peopleScore1 = ShopScoreUtil.peopleScore1(density);
@@ -556,38 +556,38 @@ public class GeneralController extends BaseController {
radius); radius);
int totalOfficeCount = getTotalOfficeCount(offices); int totalOfficeCount = getTotalOfficeCount(offices);
// 办公人口 // 办公人口
density = totalOfficeCount / circleArea; density = totalOfficeCount / circleArea;
double peopleScore2 = ShopScoreUtil.peopleScore2(density); double peopleScore2 = ShopScoreUtil.peopleScore2(density);
model.setPeopleScore(peopleScore1 > peopleScore2 ? peopleScore1 model.setPeopleScore(peopleScore1 > peopleScore2 ? peopleScore1
: peopleScore2); : peopleScore2);
String[] allKs = new String[]{"KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴", String[] allKs = new String[]{"KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴",
"医院", "公园", "学校", "体育馆","银行", "商场", "大型超市", "餐饮" "医院", "公园", "学校", "体育馆","银行", "商场", "大型超市", "餐饮"
}; };
Map<String,JSONObject> searchResult = baiduApiService.searchNearBy(Arrays.asList(allKs), lat, lng, radius, model.getBaiduMapKey()); Map<String,JSONObject> searchResult = baiduApiService.searchNearBy(Arrays.asList(allKs), lat, lng, radius, model.getBaiduMapKey());
// 消费 // 消费
String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" }; String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" };
Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length); Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length);
for (String k : ks){ for (String k : ks){
countMap.put(k, getTotal(searchResult.get(k))); countMap.put(k, getTotal(searchResult.get(k)));
} }
Double avgConsumption = bizShopService.findAroundAvgConsumption(lat,lng, radius, "餐厅"); Double avgConsumption = bizShopService.findAroundAvgConsumption(lat,lng, radius, "餐厅");
model.setConsumScore(ShopScoreUtil.consumScore(avgConsumption, countMap)); model.setConsumScore(ShopScoreUtil.consumScore(avgConsumption, countMap));
// 环境 // 环境
ks = new String[] { "医院", "公园", "学校", "体育馆" }; ks = new String[] { "医院", "公园", "学校", "体育馆" };
countMap = new HashMap<String, Integer>(ks.length); countMap = new HashMap<String, Integer>(ks.length);
for (String k : ks){ for (String k : ks){
countMap.put(k, getTotal(searchResult.get(k))); countMap.put(k, getTotal(searchResult.get(k)));
} }
countMap.put("地铁站", null == metros ? null : metros.size()); countMap.put("地铁站", null == metros ? null : metros.size());
countMap.put("公交点", null == buses ? null : buses.size()); countMap.put("公交点", null == buses ? null : buses.size());
double aroundScore1 = ShopScoreUtil.aroundScore1(countMap); double aroundScore1 = ShopScoreUtil.aroundScore1(countMap);
ks = new String[] { "银行", "商场", "大型超市", "餐饮" }; ks = new String[] { "银行", "商场", "大型超市", "餐饮" };
countMap = new HashMap<String, Integer>(ks.length); countMap = new HashMap<String, Integer>(ks.length);
for (String k : ks){ for (String k : ks){
countMap.put(k, getTotal(searchResult.get(k))); countMap.put(k, getTotal(searchResult.get(k)));
@@ -750,7 +750,7 @@ public class GeneralController extends BaseController {
district.setAvgPrice(avgPrice); district.setAvgPrice(avgPrice);
district.setKind(commData.getKind()); district.setKind(commData.getKind());
if (district.getName().endsWith("村")) { if (district.getName().endsWith("村")) {
oldHouseCount += count; oldHouseCount += count;
} else { } else {
@@ -769,7 +769,7 @@ public class GeneralController extends BaseController {
} }
return oldHouseCount + hightLevelDistrictHouseCount return oldHouseCount + hightLevelDistrictHouseCount
+ commonDistrictHouseCount;// 总户数 + commonDistrictHouseCount;// 总户数
} }
return 0; return 0;
} }
@@ -846,13 +846,13 @@ public class GeneralController extends BaseController {
} }
if (StringUtils.isNotBlank(office.getBedKind())) { if (StringUtils.isNotBlank(office.getBedKind())) {
if (office.getBedKind().equals("甲级")) { if (office.getBedKind().equals("甲级")) {
bestLevelCount = bestLevelCount bestLevelCount = bestLevelCount
+ office.getHouseholdCount(); + office.getHouseholdCount();
} else if (office.getBedKind().equals("乙级")) { } else if (office.getBedKind().equals("乙级")) {
betterLevelCount = betterLevelCount betterLevelCount = betterLevelCount
+ office.getHouseholdCount(); + office.getHouseholdCount();
} else if (office.getBedKind().equals("丙级")) { } else if (office.getBedKind().equals("丙级")) {
goodLevelCount = goodLevelCount goodLevelCount = goodLevelCount
+ office.getHouseholdCount(); + office.getHouseholdCount();
} else { } else {
@@ -41,12 +41,12 @@ public class LocalController extends BaseController {
double lng = mall.getLng2()/10000000000.0; double lng = mall.getLng2()/10000000000.0;
double radius = getRadius(); double radius = getRadius();
Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(model.getCityName(), lat, lng, radius); Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(model.getCityName(), lat, lng, radius);
model.setMetroStations(stationMap.get("地铁")); model.setMetroStations(stationMap.get("地铁"));
model.setBusStations(stationMap.get("公交")); model.setBusStations(stationMap.get("公交"));
if("上海".equals(model.getCityName())){ if("上海".equals(model.getCityName())){
// 虹桥机场 121.352578,31.200062 // 虹桥机场 121.352578,31.200062
model.setDisHongqiaoAirport(GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062)); model.setDisHongqiaoAirport(GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062));
// 虹桥火车站 121.32795,31.1991 // 虹桥火车站 121.32795,31.1991
model.setDisHongqiaoStation(GeoUtils.calculateDistance(lng, lat, 121.32795, 31.1991)); model.setDisHongqiaoStation(GeoUtils.calculateDistance(lng, lat, 121.32795, 31.1991));
} }
model.setTabScore(ShopScoreUtil.localScore(mall.getLoopLineInfo(), null == model.getMetroStations() ? 0 : model model.setTabScore(ShopScoreUtil.localScore(mall.getLoopLineInfo(), null == model.getMetroStations() ? 0 : model
@@ -42,7 +42,7 @@ public class NodistrictController extends BaseController {
final double lng = model.getLng(); final double lng = model.getLng();
final double radius = getRadius(); final double radius = getRadius();
// 周边没小区,直接返回 // 周边没小区,直接返回
List<District> districts = districtService.findDistrict(lat, lng, radius, model.getCityName()); List<District> districts = districtService.findDistrict(lat, lng, radius, model.getCityName());
if (CollectionUtils.isEmpty(districts)) { if (CollectionUtils.isEmpty(districts)) {
return model; return model;
@@ -54,7 +54,7 @@ public class NodistrictController extends BaseController {
model.setCityPrice(cityStat.getAvgPrice()); model.setCityPrice(cityStat.getAvgPrice());
} }
// 按距离排序,由近到远 // 按距离排序,由近到远
Collections.sort(districts, new Comparator<District>() { Collections.sort(districts, new Comparator<District>() {
public int compare(District o1, District o2) { public int compare(District o1, District o2) {
double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0); double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0);
@@ -102,11 +102,11 @@ public class NodistrictController extends BaseController {
model.setPriceNearest(priceNearest); model.setPriceNearest(priceNearest);
// 范围内均价 // 范围内均价
if (priceCount > 0 && stats.size() > 0) { if (priceCount > 0 && stats.size() > 0) {
model.setAreaPrice(priceCount / stats.size()); model.setAreaPrice(priceCount / stats.size());
Map<String, Integer> priceMap = districtStatService.getCityDistriceMinAndMaxPrice(model.getCityName()); Map<String, Integer> priceMap = districtStatService.getCityDistriceMinAndMaxPrice(model.getCityName());
//设置价格 //设置价格
model.setCityDistrictMinSellPrice(priceMap.get("cityDistrictMinSellPrice")); model.setCityDistrictMinSellPrice(priceMap.get("cityDistrictMinSellPrice"));
model.setCityDistrictMaxSellPrice(priceMap.get("cityDistrictMaxSellPrice")); model.setCityDistrictMaxSellPrice(priceMap.get("cityDistrictMaxSellPrice"));
@@ -124,7 +124,7 @@ public class NodistrictController extends BaseController {
} }
} }
// 由低到高排序 // 由低到高排序
Collections.sort(stats, new Comparator<DistrictStat>() { Collections.sort(stats, new Comparator<DistrictStat>() {
public int compare(DistrictStat o1, DistrictStat o2) { public int compare(DistrictStat o1, DistrictStat o2) {
return o1.getAvgPrice() - o2.getAvgPrice(); return o1.getAvgPrice() - o2.getAvgPrice();
@@ -139,7 +139,7 @@ public class NodistrictController extends BaseController {
} }
model.setPriceBtm5(priceBtm5); model.setPriceBtm5(priceBtm5);
// 由高到低排序 // 由高到低排序
Collections.reverse(stats); Collections.reverse(stats);
List<DistrictStat> priceTop5 = new ArrayList<DistrictStat>(5); List<DistrictStat> priceTop5 = new ArrayList<DistrictStat>(5);
for (DistrictStat s : stats) { for (DistrictStat s : stats) {
@@ -158,13 +158,13 @@ public class NodistrictController extends BaseController {
final double lng = model.getLng(); final double lng = model.getLng();
final double radius = getRadius(); final double radius = getRadius();
// 周边没小区,直接返回 // 周边没小区,直接返回
List<District> districts = districtService.findDistrict(lat, lng, radius, model.getCityName()); List<District> districts = districtService.findDistrict(lat, lng, radius, model.getCityName());
if (CollectionUtils.isEmpty(districts)) { if (CollectionUtils.isEmpty(districts)) {
return model; return model;
} }
// 按距离排序,由近到远 // 按距离排序,由近到远
Collections.sort(districts, new Comparator<District>() { Collections.sort(districts, new Comparator<District>() {
public int compare(District o1, District o2) { public int compare(District o1, District o2) {
double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0); double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0);
@@ -325,7 +325,7 @@ public class NodistrictController extends BaseController {
double lng = model.getLng(); double lng = model.getLng();
double radius = getRadius(); double radius = getRadius();
model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅")); model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅"));
double cityConsumMin = model.getCityConsumMin(); double cityConsumMin = model.getCityConsumMin();
double cityConsumMax = model.getCityConsumMax(); double cityConsumMax = model.getCityConsumMax();
@@ -342,20 +342,20 @@ public class NodistrictController extends BaseController {
double lng = model.getLng(); double lng = model.getLng();
double radius = getRadius(); double radius = getRadius();
Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius); Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius);
model.setMetroStations(stationMap.get("地铁")); model.setMetroStations(stationMap.get("地铁"));
model.setBusStations(stationMap.get("公交")); model.setBusStations(stationMap.get("公交"));
// 虹桥机场 121.352578,31.200062 // 虹桥机场 121.352578,31.200062
// 浦东机场 121.807085,31.160702 // 浦东机场 121.807085,31.160702
double dis = GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062); double dis = GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062);
if (dis <= radius) { if (dis <= radius) {
model.setAirPort("虹桥机场"); model.setAirPort("虹桥机场");
model.setAirPortLat(31.200062); model.setAirPortLat(31.200062);
model.setAirPortLng(121.352578); model.setAirPortLng(121.352578);
} else { } else {
dis = GeoUtils.calculateDistance(lng, lat, 121.807085, 31.160702); dis = GeoUtils.calculateDistance(lng, lat, 121.807085, 31.160702);
if (dis <= radius) { if (dis <= radius) {
model.setAirPort("浦东机场"); model.setAirPort("浦东机场");
model.setAirPortLat(31.160702); model.setAirPortLat(31.160702);
model.setAirPortLng(121.807085); model.setAirPortLng(121.807085);
} }
@@ -32,7 +32,7 @@ public class NofoundController extends BaseController {
return model.redirect("/general/district?q=" + URLEncoder.encode(model.getQ(), "UTF-8")+"&cityName="+URLEncoder.encode(model.getCityName(), "UTF-8")); return model.redirect("/general/district?q=" + URLEncoder.encode(model.getQ(), "UTF-8")+"&cityName="+URLEncoder.encode(model.getCityName(), "UTF-8"));
} }
// 查询半径内小区 // 查询半径内小区
final double lat = model.getLat(); final double lat = model.getLat();
final double lng = model.getLng(); final double lng = model.getLng();
final double radius = getRadius(); final double radius = getRadius();
@@ -50,7 +50,7 @@ public class NofoundController extends BaseController {
return model; return model;
} }
// 按距离排序,由近到远 // 按距离排序,由近到远
Collections.sort(tmpDistricts, new Comparator<District>() { Collections.sort(tmpDistricts, new Comparator<District>() {
public int compare(District o1, District o2) { public int compare(District o1, District o2) {
double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0); double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0);
@@ -106,7 +106,7 @@ public class NofoundController extends BaseController {
final double lat = model.getLat(); final double lat = model.getLat();
final double lng = model.getLng(); final double lng = model.getLng();
List<Shop> shops = shopService.searchNearby(lat, lng, getRadius()); List<Shop> shops = shopService.searchNearby(lat, lng, getRadius());
// 按距离排序,由近到远 // 按距离排序,由近到远
Collections.sort(shops, new Comparator<Shop>() { Collections.sort(shops, new Comparator<Shop>() {
public int compare(Shop o1, Shop o2) { public int compare(Shop o1, Shop o2) {
double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0); double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0);
@@ -49,7 +49,7 @@ public class NoshopController extends BaseController {
final double lng = model.getLng(); final double lng = model.getLng();
final double radius = getRadius(); final double radius = getRadius();
// 周边没商铺,直接返回 // 周边没商铺,直接返回
List<Shop> shops = shopService.searchNearby(lat, lng, radius); List<Shop> shops = shopService.searchNearby(lat, lng, radius);
if (CollectionUtils.isEmpty(shops)) { if (CollectionUtils.isEmpty(shops)) {
return model; return model;
@@ -61,7 +61,7 @@ public class NoshopController extends BaseController {
model.setCityPrice(cityStat.getAvgPrice()); model.setCityPrice(cityStat.getAvgPrice());
} }
// 按距离排序,由近到远 // 按距离排序,由近到远
Collections.sort(shops, new Comparator<Shop>() { Collections.sort(shops, new Comparator<Shop>() {
public int compare(Shop o1, Shop o2) { public int compare(Shop o1, Shop o2) {
double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0); double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0);
@@ -102,7 +102,7 @@ public class NoshopController extends BaseController {
model.setPriceNearest(priceNearest); model.setPriceNearest(priceNearest);
// 范围内均价 // 范围内均价
if (priceCount > 0 && stats.size() > 0) { if (priceCount > 0 && stats.size() > 0) {
model.setAreaPrice(priceCount / stats.size()); model.setAreaPrice(priceCount / stats.size());
@@ -120,7 +120,7 @@ public class NoshopController extends BaseController {
} }
} }
// 由低到高排序 // 由低到高排序
Collections.sort(stats, new Comparator<DistrictStat>() { Collections.sort(stats, new Comparator<DistrictStat>() {
public int compare(DistrictStat o1, DistrictStat o2) { public int compare(DistrictStat o1, DistrictStat o2) {
return o1.getAvgPrice() - o2.getAvgPrice(); return o1.getAvgPrice() - o2.getAvgPrice();
@@ -135,7 +135,7 @@ public class NoshopController extends BaseController {
} }
model.setPriceBtm5(priceBtm5); model.setPriceBtm5(priceBtm5);
// 由高到低排序 // 由高到低排序
Collections.reverse(stats); Collections.reverse(stats);
List<DistrictStat> priceTop5 = new ArrayList<DistrictStat>(5); List<DistrictStat> priceTop5 = new ArrayList<DistrictStat>(5);
for (DistrictStat s : stats) { for (DistrictStat s : stats) {
@@ -154,7 +154,7 @@ public class NoshopController extends BaseController {
final double lng = model.getLng(); final double lng = model.getLng();
final double radius = getRadius(); final double radius = getRadius();
// 周边没商铺,直接返回 // 周边没商铺,直接返回
List<Shop> shops = shopService.searchNearby(lat, lng, radius); List<Shop> shops = shopService.searchNearby(lat, lng, radius);
if (CollectionUtils.isEmpty(shops)) { if (CollectionUtils.isEmpty(shops)) {
return model; return model;
@@ -166,7 +166,7 @@ public class NoshopController extends BaseController {
model.setCityRentPrice(cityStat.getAvgPrice()); model.setCityRentPrice(cityStat.getAvgPrice());
} }
// 按距离排序,由近到远 // 按距离排序,由近到远
Collections.sort(shops, new Comparator<Shop>() { Collections.sort(shops, new Comparator<Shop>() {
public int compare(Shop o1, Shop o2) { public int compare(Shop o1, Shop o2) {
double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0); double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0);
@@ -201,7 +201,7 @@ public class NoshopController extends BaseController {
model.setRentNearest(priceNearest); model.setRentNearest(priceNearest);
// 范围内均价 // 范围内均价
if (priceCount > 0 && stats.size() > 0) { if (priceCount > 0 && stats.size() > 0) {
model.setAreaRentPrice(priceCount / stats.size()); model.setAreaRentPrice(priceCount / stats.size());
@@ -219,7 +219,7 @@ public class NoshopController extends BaseController {
} }
} }
// 由低到高排序 // 由低到高排序
Collections.sort(stats, new Comparator<DistrictBusinessStatRent>() { Collections.sort(stats, new Comparator<DistrictBusinessStatRent>() {
public int compare(DistrictBusinessStatRent o1, DistrictBusinessStatRent o2) { public int compare(DistrictBusinessStatRent o1, DistrictBusinessStatRent o2) {
return o1.getAvgPrice() - o2.getAvgPrice(); return o1.getAvgPrice() - o2.getAvgPrice();
@@ -234,7 +234,7 @@ public class NoshopController extends BaseController {
} }
model.setRentBtm5(priceBtm5); model.setRentBtm5(priceBtm5);
// 由高到低排序 // 由高到低排序
Collections.reverse(stats); Collections.reverse(stats);
List<DistrictBusinessStatRent> priceTop5 = new ArrayList<DistrictBusinessStatRent>(5); List<DistrictBusinessStatRent> priceTop5 = new ArrayList<DistrictBusinessStatRent>(5);
for (DistrictBusinessStatRent s : stats) { for (DistrictBusinessStatRent s : stats) {
@@ -254,16 +254,16 @@ public class NoshopController extends BaseController {
final double radius = getRadius(); final double radius = getRadius();
Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(model.getCityName(), lat, lng, radius); Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(model.getCityName(), lat, lng, radius);
model.setMetroStations(stationMap.get("地铁")); model.setMetroStations(stationMap.get("地铁"));
model.setBusStations(stationMap.get("公交")); model.setBusStations(stationMap.get("公交"));
// 虹桥机场 121.352578,31.200062 // 虹桥机场 121.352578,31.200062
model.setDisHongqiaoAirport(GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062)); model.setDisHongqiaoAirport(GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062));
// 虹桥火车站 121.32795,31.1991 // 虹桥火车站 121.32795,31.1991
model.setDisHongqiaoStation(GeoUtils.calculateDistance(lng, lat, 121.32795, 31.1991)); model.setDisHongqiaoStation(GeoUtils.calculateDistance(lng, lat, 121.32795, 31.1991));
// 周边没商铺,直接返回 // 周边没商铺,直接返回
List<Shop> shops = shopService.searchNearby(lat, lng, radius); List<Shop> shops = shopService.searchNearby(lat, lng, radius);
if (CollectionUtils.isNotEmpty(shops)) { if (CollectionUtils.isNotEmpty(shops)) {
int priceCount = 0; int priceCount = 0;
@@ -278,7 +278,7 @@ public class NoshopController extends BaseController {
} }
} }
// 范围内均价 // 范围内均价
if (priceCount > 0 && count > 0) { if (priceCount > 0 && count > 0) {
model.setAreaPrice(priceCount / count); model.setAreaPrice(priceCount / count);
} }
@@ -380,7 +380,7 @@ public class NoshopController extends BaseController {
double lat = model.getLat(); double lat = model.getLat();
double lng = model.getLng(); double lng = model.getLng();
double radius = getRadius(); double radius = getRadius();
model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅")); model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅"));
double cityConsumMin = model.getCityConsumMin(); double cityConsumMin = model.getCityConsumMin();
double cityConsumMax = model.getCityConsumMax(); double cityConsumMax = model.getCityConsumMax();
@@ -397,8 +397,8 @@ public class NoshopController extends BaseController {
double lng = model.getLng(); double lng = model.getLng();
double radius = getRadius(); double radius = getRadius();
Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius); Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius);
model.setMetroStations(stationMap.get("地铁")); model.setMetroStations(stationMap.get("地铁"));
model.setBusStations(stationMap.get("公交")); model.setBusStations(stationMap.get("公交"));
return model; return model;
} }
@@ -617,7 +617,7 @@ public class NoshopController extends BaseController {
district.setAvgPrice(avgPrice); district.setAvgPrice(avgPrice);
district.setKind(commData.getKind()); district.setKind(commData.getKind());
if (district.getName().endsWith("村")) { if (district.getName().endsWith("村")) {
oldHouseCount += count; oldHouseCount += count;
oldDistrictCount++; oldDistrictCount++;
@@ -636,15 +636,15 @@ public class NoshopController extends BaseController {
} }
} }
model.setTotalHouseCount(oldHouseCount + hightLevelDistrictHouseCount + commonDistrictHouseCount);// 总户数 model.setTotalHouseCount(oldHouseCount + hightLevelDistrictHouseCount + commonDistrictHouseCount);// 总户数
model.setCommonDistrictHouseCount(commonDistrictHouseCount);// 高级商品房户数 model.setCommonDistrictHouseCount(commonDistrictHouseCount);// 高级商品房户数
model.setHightDistrictHouseCount(hightLevelDistrictHouseCount);// 普通户数 model.setHightDistrictHouseCount(hightLevelDistrictHouseCount);// 普通户数
model.setTotalDistrictCount(oldDistrictCount + commonDistrictCount + hightLevelDistrictCount);// 总小区数 model.setTotalDistrictCount(oldDistrictCount + commonDistrictCount + hightLevelDistrictCount);// 总小区数
model.setCommonDistrictCount(commonDistrictCount);// 高级小区数 model.setCommonDistrictCount(commonDistrictCount);// 高级小区数
model.setHightDistrictCount(hightLevelDistrictCount);// 普通小区数 model.setHightDistrictCount(hightLevelDistrictCount);// 普通小区数
model.setOldHouseCount(oldHouseCount);// 老工房 户数 model.setOldHouseCount(oldHouseCount);// 老工房 户数
model.setOldDistrictCount(oldDistrictCount);// 老工户 小区数 model.setOldDistrictCount(oldDistrictCount);// 老工户 小区数
} }
return model; return model;
@@ -691,11 +691,11 @@ public class NoshopController extends BaseController {
} }
if (StringUtils.isNotBlank(office.getBedKind())) { if (StringUtils.isNotBlank(office.getBedKind())) {
if (office.getBedKind().equals("甲级")) { if (office.getBedKind().equals("甲级")) {
bestLevelCount = bestLevelCount + office.getHouseholdCount(); bestLevelCount = bestLevelCount + office.getHouseholdCount();
} else if (office.getBedKind().equals("乙级")) { } else if (office.getBedKind().equals("乙级")) {
betterLevelCount = betterLevelCount + office.getHouseholdCount(); betterLevelCount = betterLevelCount + office.getHouseholdCount();
} else if (office.getBedKind().equals("丙级")) { } else if (office.getBedKind().equals("丙级")) {
goodLevelCount = goodLevelCount + office.getHouseholdCount(); goodLevelCount = goodLevelCount + office.getHouseholdCount();
} else { } else {
otherLevelCount = otherLevelCount + office.getHouseholdCount(); otherLevelCount = otherLevelCount + office.getHouseholdCount();
@@ -78,13 +78,13 @@ public class PeopleController extends BaseController {
JSONArray officesObj = JSONArray.fromObject(offices); JSONArray officesObj = JSONArray.fromObject(offices);
model.setOffices(officesObj.toString()); model.setOffices(officesObj.toString());
// 居民人口密度 // 居民人口密度
double circleArea = Math.PI * Math.pow(radius / 1000.0, 2); double circleArea = Math.PI * Math.pow(radius / 1000.0, 2);
int totalHouseCount = model.getTotalHouseCount(); int totalHouseCount = model.getTotalHouseCount();
double density = totalHouseCount * 2.49 / circleArea; double density = totalHouseCount * 2.49 / circleArea;
double score1 = ShopScoreUtil.populationScore(density); double score1 = ShopScoreUtil.populationScore(density);
data.put("populationScore",score1); data.put("populationScore",score1);
// 办公人口 // 办公人口
int totalCountOffice = model.getTotalCountOffice(); int totalCountOffice = model.getTotalCountOffice();
density = totalCountOffice / circleArea; density = totalCountOffice / circleArea;
double score2 = ShopScoreUtil.officePopulationScore(density); double score2 = ShopScoreUtil.officePopulationScore(density);
@@ -124,26 +124,26 @@ public class PeopleController extends BaseController {
JSONArray officesObj = JSONArray.fromObject(offices); JSONArray officesObj = JSONArray.fromObject(offices);
model.setOffices(officesObj.toString()); model.setOffices(officesObj.toString());
// 居民人口密度 // 居民人口密度
/*double circleArea = Math.PI * Math.pow(radius / 1000.0, 2); /*double circleArea = Math.PI * Math.pow(radius / 1000.0, 2);
int totalHouseCount = model.getTotalHouseCount(); int totalHouseCount = model.getTotalHouseCount();
double density = totalHouseCount * 2.49 / circleArea; double density = totalHouseCount * 2.49 / circleArea;
double score1 = ShopScoreUtil.peopleScore1(density); double score1 = ShopScoreUtil.peopleScore1(density);
model.setScore1(score1); model.setScore1(score1);
// 办公人口 // 办公人口
int totalCountOffice = model.getTotalCountOffice(); int totalCountOffice = model.getTotalCountOffice();
density = totalCountOffice / circleArea; density = totalCountOffice / circleArea;
double score2 = ShopScoreUtil.peopleScore2(density); double score2 = ShopScoreUtil.peopleScore2(density);
model.setScore2(score2);*/ model.setScore2(score2);*/
//圆形面积 //圆形面积
double circleArea = Math.PI * Math.pow(radius / 1000.0, 2); double circleArea = Math.PI * Math.pow(radius / 1000.0, 2);
//设置居民人口密度得分 //设置居民人口密度得分
double peopleDensityScore = setPeopleDensityScore(model, radius, circleArea); double peopleDensityScore = setPeopleDensityScore(model, radius, circleArea);
//设置办公人口得分 //设置办公人口得分
double officeDensityScore = setOfficeDensityScore(model, circleArea); double officeDensityScore = setOfficeDensityScore(model, circleArea);
model.setTabScore(peopleDensityScore > officeDensityScore ? peopleDensityScore : officeDensityScore); model.setTabScore(peopleDensityScore > officeDensityScore ? peopleDensityScore : officeDensityScore);
@@ -182,7 +182,7 @@ public class PeopleController extends BaseController {
} }
/** /**
* 设置办公人口得分 * 设置办公人口得分
* @author yinjihuan * @author yinjihuan
* @date 2016-03-04 * @date 2016-03-04
* @param model * @param model
@@ -190,18 +190,18 @@ public class PeopleController extends BaseController {
* @return * @return
*/ */
private double setOfficeDensityScore(PeopleModel model, double circleArea) { private double setOfficeDensityScore(PeopleModel model, double circleArea) {
//办公人数总数 //办公人数总数
int totalCountOffice = model.getTotalCountOffice(); int totalCountOffice = model.getTotalCountOffice();
//办公人口密度=(圆形区域内办公人数总数/圆形面积) //办公人口密度=(圆形区域内办公人数总数/圆形面积)
double density = totalCountOffice / circleArea; double density = totalCountOffice / circleArea;
//办公人口密度得分 //办公人口密度得分
double officeDensityScore = ShopScoreUtil.calcOfficeDensityScore(density); double officeDensityScore = ShopScoreUtil.calcOfficeDensityScore(density);
model.setScore2(officeDensityScore); model.setScore2(officeDensityScore);
return officeDensityScore; return officeDensityScore;
} }
/** /**
* 设置居民人口密度得分 * 设置居民人口密度得分
* @author yinjihuan * @author yinjihuan
* @date 2016-03-04 * @date 2016-03-04
* @param model * @param model
@@ -209,11 +209,11 @@ public class PeopleController extends BaseController {
* @return * @return
*/ */
private double setPeopleDensityScore(PeopleModel model, double radius, double circleArea) { private double setPeopleDensityScore(PeopleModel model, double radius, double circleArea) {
// 圆形区域内总户数 // 圆形区域内总户数
int totalHouseCount = model.getTotalHouseCount(); int totalHouseCount = model.getTotalHouseCount();
//居民人口密度(居民人口密度 = 圆形区域内总户数*2.49/圆形面积) //居民人口密度(居民人口密度 = 圆形区域内总户数*2.49/圆形面积)
double density = totalHouseCount * 2.49 / circleArea; double density = totalHouseCount * 2.49 / circleArea;
//人口密度得分 //人口密度得分
double peopleDensityScore = ShopScoreUtil.calcPeopleDensityScore(density); double peopleDensityScore = ShopScoreUtil.calcPeopleDensityScore(density);
model.setScore1(peopleDensityScore); model.setScore1(peopleDensityScore);
return peopleDensityScore; return peopleDensityScore;
@@ -319,7 +319,7 @@ public class PeopleController extends BaseController {
district.setAvgPrice(avgPrice); district.setAvgPrice(avgPrice);
district.setKind(commData.getKind()); district.setKind(commData.getKind());
if (district.getName().endsWith("村")) { if (district.getName().endsWith("村")) {
oldHouseCount += count; oldHouseCount += count;
oldDistrictCount++; oldDistrictCount++;
@@ -338,15 +338,15 @@ public class PeopleController extends BaseController {
} }
} }
model.setTotalHouseCount(oldHouseCount + hightLevelDistrictHouseCount + commonDistrictHouseCount);// 总户数 model.setTotalHouseCount(oldHouseCount + hightLevelDistrictHouseCount + commonDistrictHouseCount);// 总户数
model.setCommonDistrictHouseCount(commonDistrictHouseCount);// 高级商品房户数 model.setCommonDistrictHouseCount(commonDistrictHouseCount);// 高级商品房户数
model.setHightDistrictHouseCount(hightLevelDistrictHouseCount);// 普通户数 model.setHightDistrictHouseCount(hightLevelDistrictHouseCount);// 普通户数
model.setTotalDistrictCount(oldDistrictCount + commonDistrictCount + hightLevelDistrictCount);// 总小区数 model.setTotalDistrictCount(oldDistrictCount + commonDistrictCount + hightLevelDistrictCount);// 总小区数
model.setCommonDistrictCount(commonDistrictCount);// 高级小区数 model.setCommonDistrictCount(commonDistrictCount);// 高级小区数
model.setHightDistrictCount(hightLevelDistrictCount);// 普通小区数 model.setHightDistrictCount(hightLevelDistrictCount);// 普通小区数
model.setOldHouseCount(oldHouseCount);// 老工房 户数 model.setOldHouseCount(oldHouseCount);// 老工房 户数
model.setOldDistrictCount(oldDistrictCount);// 老工户 小区数 model.setOldDistrictCount(oldDistrictCount);// 老工户 小区数
} }
return model; return model;
@@ -393,11 +393,11 @@ public class PeopleController extends BaseController {
} }
if (StringUtils.isNotBlank(office.getBedKind())) { if (StringUtils.isNotBlank(office.getBedKind())) {
if (office.getBedKind().equals("甲级")) { if (office.getBedKind().equals("甲级")) {
bestLevelCount = bestLevelCount + office.getHouseholdCount(); bestLevelCount = bestLevelCount + office.getHouseholdCount();
} else if (office.getBedKind().equals("乙级")) { } else if (office.getBedKind().equals("乙级")) {
betterLevelCount = betterLevelCount + office.getHouseholdCount(); betterLevelCount = betterLevelCount + office.getHouseholdCount();
} else if (office.getBedKind().equals("丙级")) { } else if (office.getBedKind().equals("丙级")) {
goodLevelCount = goodLevelCount + office.getHouseholdCount(); goodLevelCount = goodLevelCount + office.getHouseholdCount();
} else { } else {
otherLevelCount = otherLevelCount + office.getHouseholdCount(); otherLevelCount = otherLevelCount + office.getHouseholdCount();
@@ -43,10 +43,10 @@ public class PredictController extends BaseController{
model.setStatBo(statBo); model.setStatBo(statBo);
int avgPrice = 0; int avgPrice = 0;
String buildType = "Ð¡Çø"; String buildType = "小区";
if (null == statBo.getDistrictStat() && null != statBo.getVillaDistrictStat()) { if (null == statBo.getDistrictStat() && null != statBo.getVillaDistrictStat()) {
avgPrice = statBo.getVillaDistrictStat().getAvgPrice(); avgPrice = statBo.getVillaDistrictStat().getAvgPrice();
buildType = "±ðÊû"; buildType = "别墅";
} else if (null != statBo.getDistrictStat()) { } else if (null != statBo.getDistrictStat()) {
avgPrice = statBo.getDistrictStat().getAvgPrice(); avgPrice = statBo.getDistrictStat().getAvgPrice();
} }
@@ -81,7 +81,7 @@ public class PredictController extends BaseController{
} }
private void addDistrictStat(List<JSONObject> seriesOptions, DistrictKey districtKey, int weeks) { 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<DistrictStatBo> districtStatBoList = districtStatService.findAllDistrictStatByKind(districtKey, new Date(), weeks,
list); list);
JSONArray districtJa = new JSONArray(); JSONArray districtJa = new JSONArray();
@@ -130,7 +130,7 @@ public class PredictController extends BaseController{
if (villaJa.length() > 0) { if (villaJa.length() > 0) {
JSONObject jo2 = new JSONObject(); JSONObject jo2 = new JSONObject();
jo2.put("name", districtKey.getName() + "(±ðÊû)"); jo2.put("name", districtKey.getName() + "(别墅)");
jo2.put("data", villaJa.toString()); jo2.put("data", villaJa.toString());
jo2.put("yAxis", 0); jo2.put("yAxis", 0);
seriesOptions.add(jo2); seriesOptions.add(jo2);
@@ -35,7 +35,7 @@ import java.net.URLEncoder;
import java.util.*; import java.util.*;
/** /**
* 价格指数 * 价格指数
* @author yk * @author yk
* *
*/ */
@@ -51,15 +51,15 @@ public class PriceController extends BaseController {
final static ChafangtongCookieContext cookieContext = ChafangtongCookieContext.getInstance(); final static ChafangtongCookieContext cookieContext = ChafangtongCookieContext.getInstance();
public Object districtAction(PriceModel model) throws UnsupportedEncodingException { public Object districtAction(PriceModel model) throws UnsupportedEncodingException {
/** /**
* 将"全市相对最低"指标数字变更成上海小区均价升序,前0到3%的均价的中位数。 * 将"全市相对最低"指标数字变更成上海小区均价升序,前0到3%的均价的中位数。
* "全市相对最高"指标数字变更成上海小区均价升序,前97%到100%的均价的中位数 * "全市相对最高"指标数字变更成上海小区均价升序,前97%到100%的均价的中位数
* 2016-07-05 yinjihuan修改 * 2016-07-05 yinjihuan修改
*/ */
Map<String, Integer> priceMap = districtStatService.getCityDistriceMinAndMaxPrice(model.getCityName()); Map<String, Integer> priceMap = districtStatService.getCityDistriceMinAndMaxPrice(model.getCityName());
if (null == priceMap) { if (null == priceMap) {
return model.redirect("/noResult/district?q=" + URLEncoder.encode(model.getDistrictName(), "UTF-8") + "&cityName=" +URLEncoder.encode(model.getCityName(), "UTF-8")); return model.redirect("/noResult/district?q=" + URLEncoder.encode(model.getDistrictName(), "UTF-8") + "&cityName=" +URLEncoder.encode(model.getCityName(), "UTF-8"));
} }
//设置价格 //设置价格
model.setCityDistrictMinSellPrice(priceMap.get("cityDistrictMinSellPrice")); model.setCityDistrictMinSellPrice(priceMap.get("cityDistrictMinSellPrice"));
model.setCityDistrictMaxSellPrice(priceMap.get("cityDistrictMaxSellPrice")); model.setCityDistrictMaxSellPrice(priceMap.get("cityDistrictMaxSellPrice"));
@@ -108,17 +108,17 @@ public class PriceController extends BaseController {
if(StringUtils.isNotBlank(district.getRegion())){ if(StringUtils.isNotBlank(district.getRegion())){
params.add(new QueryParam("region", district.getRegion())); params.add(new QueryParam("region", district.getRegion()));
} }
Date lastMonthEndDate = DateUtil.getLastEndMonthDate(new Date());// 检索上上月的数据 Date lastMonthEndDate = DateUtil.getLastEndMonthDate(new Date());// 检索上上月的数据
params.add(new QueryParam("endMonthDate", lastMonthEndDate)); params.add(new QueryParam("endMonthDate", lastMonthEndDate));
List<RegionStatRent> regionStatRentList=regionStatRentDao.findAllByParams(params); List<RegionStatRent> regionStatRentList=regionStatRentDao.findAllByParams(params);
model.setRegionStatRents(regionStatRentList); model.setRegionStatRents(regionStatRentList);
model.setRentStatBos(rentBos); model.setRentStatBos(rentBos);
String estateType = district.getEstateType2(); String estateType = district.getEstateType2();
if(!estateType.contains("别墅")){ if(!estateType.contains("别墅")){
estateType = "小区"; estateType = "小区";
}else{ }else{
estateType = "别墅"; estateType = "别墅";
} }
List<Integer> rentList = new ArrayList<Integer>(); List<Integer> rentList = new ArrayList<Integer>();
Map<Integer,Integer> districtStatRents = districtStatRentService.findByDistrictStatRent(districtKey, estateType); Map<Integer,Integer> districtStatRents = districtStatRentService.findByDistrictStatRent(districtKey, estateType);
@@ -211,7 +211,7 @@ public class PriceController extends BaseController {
} }
List<JSONObject> seriesOptions = new ArrayList<JSONObject>(); List<JSONObject> seriesOptions = new ArrayList<JSONObject>();
String title = name + "均价走势"; String title = name + "均价走势";
DistrictKey districtKey = new DistrictKey(city, region, name); DistrictKey districtKey = new DistrictKey(city, region, name);
addDistrictStat(seriesOptions, districtKey, weeks); addDistrictStat(seriesOptions, districtKey, weeks);
@@ -114,7 +114,7 @@ public class RentController extends BaseController {
} }
List<JSONObject> seriesOptions = new ArrayList<JSONObject>(); List<JSONObject> seriesOptions = new ArrayList<JSONObject>();
String title = name + "×â½ð×ßÊÆ"; String title = name + "租金走势";
DistrictKey districtKey = new DistrictKey(city, region, name); DistrictKey districtKey = new DistrictKey(city, region, name);
addDistrictStat(seriesOptions, districtKey, weeks); addDistrictStat(seriesOptions, districtKey, weeks);
@@ -124,7 +124,7 @@ public class ReportController extends BaseController {
model.setShowPdfLink(true); model.setShowPdfLink(true);
} }
// 综合指数 // 综合指数
SeaweedNumberic numberic = seaweedNumbericDao.findShop(shop.getCity(), shop.getRegion(), shop.getName()); SeaweedNumberic numberic = seaweedNumbericDao.findShop(shop.getCity(), shop.getRegion(), shop.getName());
model.setDetailScore(ShopScoreUtil.detailScore(shop, numberic)); model.setDetailScore(ShopScoreUtil.detailScore(shop, numberic));
model.setDetailScore1(ShopScoreUtil.detailScore1(shop.getEstateType(), null == numberic ? null : numberic.getBuildArea())); model.setDetailScore1(ShopScoreUtil.detailScore1(shop.getEstateType(), null == numberic ? null : numberic.getBuildArea()));
@@ -132,7 +132,7 @@ public class ReportController extends BaseController {
model.setDetailScore3(ShopScoreUtil.detailScore3(shop.getCarSiteCount())); model.setDetailScore3(ShopScoreUtil.detailScore3(shop.getCarSiteCount()));
model.setDetailScore4(ShopScoreUtil.detailScore4(null == numberic ? null : numberic.getFinishBuildYear())); model.setDetailScore4(ShopScoreUtil.detailScore4(null == numberic ? null : numberic.getFinishBuildYear()));
// 房价指数 // 房价指数
Date weekend = DateUtil.getFirstDayOfWeek(new Date()); Date weekend = DateUtil.getFirstDayOfWeek(new Date());
BizRegionStat cityStat = bizRegionStatService.findCitySellPrice(city, weekend); BizRegionStat cityStat = bizRegionStatService.findCitySellPrice(city, weekend);
if (null != cityStat) { if (null != cityStat) {
@@ -170,7 +170,7 @@ public class ReportController extends BaseController {
model.setSellTradeUrl(model.getCityUrl() + "/cImg/" + SecurityUtil.encode(urlBuilder.toString()) model.setSellTradeUrl(model.getCityUrl() + "/cImg/" + SecurityUtil.encode(urlBuilder.toString())
+ (isRefreshCache ? "?__refresh_cache=1" : "")); + (isRefreshCache ? "?__refresh_cache=1" : ""));
// 租金指数 // 租金指数
DistrictBusinessStatRentBo retnStatBo = districtBusinessStatRentService.findMallStatBo(new DistrictKey(shop.getCity(), DistrictBusinessStatRentBo retnStatBo = districtBusinessStatRentService.findMallStatBo(new DistrictKey(shop.getCity(),
shop.getRegion(), shop.getName()), weekend); shop.getRegion(), shop.getName()), weekend);
model.setRentStatBo(retnStatBo); model.setRentStatBo(retnStatBo);
@@ -203,15 +203,15 @@ public class ReportController extends BaseController {
model.setRentTradeUrl(model.getCityUrl() + "/cImg/" + SecurityUtil.encode(urlBuilder.toString()) model.setRentTradeUrl(model.getCityUrl() + "/cImg/" + SecurityUtil.encode(urlBuilder.toString())
+ (isRefreshCache ? "?__refresh_cache=1" : "")); + (isRefreshCache ? "?__refresh_cache=1" : ""));
// 地段指数 // 地段指数
Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius); Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius);
model.setMetroStations(stationMap.get("地铁")); model.setMetroStations(stationMap.get("地铁"));
model.setBusStations(stationMap.get("公交")); model.setBusStations(stationMap.get("公交"));
// 虹桥机场 121.352578,31.200062 // 虹桥机场 121.352578,31.200062
model.setDisHongqiaoAirport(GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062)); model.setDisHongqiaoAirport(GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062));
// 虹桥火车站 121.32795,31.1991 // 虹桥火车站 121.32795,31.1991
model.setDisHongqiaoStation(GeoUtils.calculateDistance(lng, lat, 121.32795, 31.1991)); model.setDisHongqiaoStation(GeoUtils.calculateDistance(lng, lat, 121.32795, 31.1991));
model.setLocalScore(ShopScoreUtil.localScore(shop.getLoopLineInfo(), null == model.getMetroStations() ? 0 : model model.setLocalScore(ShopScoreUtil.localScore(shop.getLoopLineInfo(), null == model.getMetroStations() ? 0 : model
@@ -263,7 +263,7 @@ public class ReportController extends BaseController {
model.setPieColors(Arrays.asList(new String[]{"#5491c7" ,"#f0776e" ,"#66bd7d" ,"#f5a549" ,"#c075eb"})); model.setPieColors(Arrays.asList(new String[]{"#5491c7" ,"#f0776e" ,"#66bd7d" ,"#f5a549" ,"#c075eb"}));
model.setPieMarkers(jFreeChartImageService.getAroundBizTypePieMarkers(lat, lng, radius)); model.setPieMarkers(jFreeChartImageService.getAroundBizTypePieMarkers(lat, lng, radius));
// 人口指数 // 人口指数
int cityAvgPrice = cityPriceLevelService.findCityPriceLevel(city); int cityAvgPrice = cityPriceLevelService.findCityPriceLevel(city);
cityAvgPrice = cityAvgPrice == 0 ? 7000 : cityAvgPrice; cityAvgPrice = cityAvgPrice == 0 ? 7000 : cityAvgPrice;
model.setCityAvgPrice(cityAvgPrice); model.setCityAvgPrice(cityAvgPrice);
@@ -274,14 +274,14 @@ public class ReportController extends BaseController {
List<DistrictInfoBo> offices = findDistricts(city, "office", lat, lng, radius); List<DistrictInfoBo> offices = findDistricts(city, "office", lat, lng, radius);
offices = getOfficeCommDataInfo(offices, model); offices = getOfficeCommDataInfo(offices, model);
// 居民人口密度 // 居民人口密度
double circleArea = Math.PI * Math.pow(radius / 1000.0, 2); double circleArea = Math.PI * Math.pow(radius / 1000.0, 2);
int totalHouseCount = model.getTotalHouseCount(); int totalHouseCount = model.getTotalHouseCount();
double density = totalHouseCount * 2.49 / circleArea; double density = totalHouseCount * 2.49 / circleArea;
double peopleScore1 = ShopScoreUtil.peopleScore1(density); double peopleScore1 = ShopScoreUtil.peopleScore1(density);
model.setPeopleScore1(peopleScore1); model.setPeopleScore1(peopleScore1);
// 办公人口 // 办公人口
int totalCountOffice = model.getTotalCountOffice(); int totalCountOffice = model.getTotalCountOffice();
density = totalCountOffice / circleArea; density = totalCountOffice / circleArea;
double peopleScore2 = ShopScoreUtil.peopleScore2(density); double peopleScore2 = ShopScoreUtil.peopleScore2(density);
@@ -289,17 +289,17 @@ public class ReportController extends BaseController {
model.setPeopleScore(peopleScore1 > peopleScore2 ? peopleScore1 : peopleScore2); model.setPeopleScore(peopleScore1 > peopleScore2 ? peopleScore1 : peopleScore2);
// 消费指数 // 消费指数
model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅")); model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅"));
double cityConsumMin = model.getCityConsumMin(); double cityConsumMin = model.getCityConsumMin();
double cityConsumMax = model.getCityConsumMax(); double cityConsumMax = model.getCityConsumMax();
if (null != model.getAvgConsumption()) { if (null != model.getAvgConsumption()) {
model.setHigher((model.getAvgConsumption() - cityConsumMin) * 100.0 / (cityConsumMax - cityConsumMin)); model.setHigher((model.getAvgConsumption() - cityConsumMin) * 100.0 / (cityConsumMax - cityConsumMin));
} }
List<String> allKw = Arrays.asList(new String[]{ "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市", List<String> allKw = Arrays.asList(new String[]{ "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市",
"高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴","医院", "公园", "学校", "体育馆","银行", "商场", "大型超市", "餐饮"}); "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴","医院", "公园", "学校", "体育馆","银行", "商场", "大型超市", "餐饮"});
Map<String,JSONObject> baiduKwResult = baiduApiService.searchNearBy(allKw, lat, lng, radius, model.getBaiduMapKey()); Map<String,JSONObject> baiduKwResult = baiduApiService.searchNearBy(allKw, lat, lng, radius, model.getBaiduMapKey());
String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" }; String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" };
Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length); Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
Integer c = getTotal(baiduKwResult.get(ks[i])); Integer c = getTotal(baiduKwResult.get(ks[i]));
@@ -310,8 +310,8 @@ public class ReportController extends BaseController {
model.setConsumCountMap(countMap); model.setConsumCountMap(countMap);
model.setConsumScore(ShopScoreUtil.consumScore(model.getAvgConsumption(), countMap)); model.setConsumScore(ShopScoreUtil.consumScore(model.getAvgConsumption(), countMap));
// 环境指数 // 环境指数
ks = new String[] { "医院", "公园", "学校", "体育馆" }; ks = new String[] { "医院", "公园", "学校", "体育馆" };
Map<String, Integer> aroundCountMap = new HashMap<String, Integer>(); Map<String, Integer> aroundCountMap = new HashMap<String, Integer>();
countMap = new HashMap<String, Integer>(ks.length); countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
@@ -320,14 +320,14 @@ public class ReportController extends BaseController {
countMap.put(ks[i], c); countMap.put(ks[i], c);
} }
} }
countMap.put("地铁站", null == model.getMetroStations() ? null : model.getMetroStations().size()); countMap.put("地铁站", null == model.getMetroStations() ? null : model.getMetroStations().size());
countMap.put("公交点", null == model.getBusStations() ? null : model.getBusStations().size()); countMap.put("公交点", null == model.getBusStations() ? null : model.getBusStations().size());
aroundCountMap.putAll(countMap); aroundCountMap.putAll(countMap);
double aroundScore1 = ShopScoreUtil.aroundScore1(countMap); double aroundScore1 = ShopScoreUtil.aroundScore1(countMap);
model.setAroundScore1(aroundScore1); model.setAroundScore1(aroundScore1);
ks = new String[] { "银行", "商场", "大型超市", "餐饮" }; ks = new String[] { "银行", "商场", "大型超市", "餐饮" };
countMap = new HashMap<String, Integer>(ks.length); countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
Integer c = getTotal(baiduKwResult.get(ks[i])); Integer c = getTotal(baiduKwResult.get(ks[i]));
@@ -438,7 +438,7 @@ public class ReportController extends BaseController {
model.setShowPdfLink(true); model.setShowPdfLink(true);
} }
// 楼盘指数 // 楼盘指数
SeaweedNumberic numberic = seaweedNumbericDao.findDistrict(city, region, district.getName()); SeaweedNumberic numberic = seaweedNumbericDao.findDistrict(city, region, district.getName());
model.setDetailScore(DistrictScoreUtil.detailScore(district, numberic)); model.setDetailScore(DistrictScoreUtil.detailScore(district, numberic));
@@ -451,9 +451,9 @@ public class ReportController extends BaseController {
model.setDetailScore4(DistrictScoreUtil.detailScore4(nullNumberic ? null : numberic.getCubagePercent())); model.setDetailScore4(DistrictScoreUtil.detailScore4(nullNumberic ? null : numberic.getCubagePercent()));
model.setDetailScore5(DistrictScoreUtil.detailScore5(district.getBuildType(), nullNumberic ? null : numberic.getCarSiteCount())); model.setDetailScore5(DistrictScoreUtil.detailScore5(district.getBuildType(), nullNumberic ? null : numberic.getCarSiteCount()));
// 房价指数 // 房价指数
RegionStat cityStat = regionStatService.findByCity(city); RegionStat cityStat = regionStatService.findByCity(city);
// Integer cityLeave = 0;//最高房价和最低房价的差值 // Integer cityLeave = 0;//最高房价和最低房价的差值
if (null != cityStat) { if (null != cityStat) {
model.setCityPrice(cityStat.getAvgPrice()); model.setCityPrice(cityStat.getAvgPrice());
// Integer citySellMin = model.getCityDistrictMinSellPrice(); // Integer citySellMin = model.getCityDistrictMinSellPrice();
@@ -478,7 +478,7 @@ public class ReportController extends BaseController {
if(StringUtils.isNotBlank(district.getRegion())){ if(StringUtils.isNotBlank(district.getRegion())){
params.add(new QueryParam("region", district.getRegion())); params.add(new QueryParam("region", district.getRegion()));
} }
Date lastMonthEndDate = DateUtil.getLastEndMonthDate(new Date());// 检索上上月的数据 Date lastMonthEndDate = DateUtil.getLastEndMonthDate(new Date());// 检索上上月的数据
params.add(new QueryParam("endMonthDate", lastMonthEndDate)); params.add(new QueryParam("endMonthDate", lastMonthEndDate));
List<RegionStatRent> regionStatRentList=regionStatRentDao.findAllByParams(params); List<RegionStatRent> regionStatRentList=regionStatRentDao.findAllByParams(params);
model.setRegionStatRents(regionStatRentList); model.setRegionStatRents(regionStatRentList);
@@ -487,10 +487,10 @@ public class ReportController extends BaseController {
rentBo = districtStatRentService.findByDistrictStatRent(districtKey,2); rentBo = districtStatRentService.findByDistrictStatRent(districtKey,2);
List<Integer> rentList = new ArrayList<Integer>(); List<Integer> rentList = new ArrayList<Integer>();
String estateType = district.getEstateType2(); String estateType = district.getEstateType2();
if(!estateType.contains("别墅")){ if(!estateType.contains("别墅")){
estateType = "小区"; estateType = "小区";
}else{ }else{
estateType = "别墅"; estateType = "别墅";
} }
Map<Integer,Integer> districtStatRents = districtStatRentService.findByDistrictStatRent(districtKey, estateType); Map<Integer,Integer> districtStatRents = districtStatRentService.findByDistrictStatRent(districtKey, estateType);
@@ -520,7 +520,7 @@ public class ReportController extends BaseController {
if (null != stat) { if (null != stat) {
Map<String, Integer> priceMap = districtStatService.getCityDistriceMinAndMaxPrice(model.getCityName()); Map<String, Integer> priceMap = districtStatService.getCityDistriceMinAndMaxPrice(model.getCityName());
//设置价格 //设置价格
model.setCityDistrictMinSellPrice(priceMap.get("cityDistrictMinSellPrice")); model.setCityDistrictMinSellPrice(priceMap.get("cityDistrictMinSellPrice"));
model.setCityDistrictMaxSellPrice(priceMap.get("cityDistrictMaxSellPrice")); model.setCityDistrictMaxSellPrice(priceMap.get("cityDistrictMaxSellPrice"));
@@ -538,11 +538,11 @@ public class ReportController extends BaseController {
} }
} }
// 潜力指数 // 潜力指数
String buildType = "小区"; String buildType = "小区";
if (null == statBo.getDistrictStat() && null != statBo.getVillaDistrictStat()) { if (null == statBo.getDistrictStat() && null != statBo.getVillaDistrictStat()) {
avgPrice = statBo.getVillaDistrictStat().getAvgPrice(); avgPrice = statBo.getVillaDistrictStat().getAvgPrice();
buildType = "别墅"; buildType = "别墅";
} else if (null != statBo.getDistrictStat()) { } else if (null != statBo.getDistrictStat()) {
avgPrice = statBo.getDistrictStat().getAvgPrice(); avgPrice = statBo.getDistrictStat().getAvgPrice();
} }
@@ -569,9 +569,9 @@ public class ReportController extends BaseController {
model.setSellTradeUrl(model.getCityUrl() + "/cImg/" + SecurityUtil.encode(urlBuilder.toString()) model.setSellTradeUrl(model.getCityUrl() + "/cImg/" + SecurityUtil.encode(urlBuilder.toString())
+ (isRefreshCache ? "?__refresh_cache=1" : "")); + (isRefreshCache ? "?__refresh_cache=1" : ""));
// 稀缺指数 // 稀缺指数
model.setRegionOrg(regionBlockService.getOrgName(city, region, "region")); model.setRegionOrg(regionBlockService.getOrgName(city, region, "region"));
model.setBlockOrg(block + "板块"); model.setBlockOrg(block + "板块");
model.setRegionDistrictCount(districtService.findRegionDistrictCount(city, region)); model.setRegionDistrictCount(districtService.findRegionDistrictCount(city, region));
//model.setBlockDistrictCount(districtService.findBlockDistrictCount(city, region, block)); //model.setBlockDistrictCount(districtService.findBlockDistrictCount(city, region, block));
model.setCityDistrictCount(districtService.findCityDistrictCount(city)); model.setCityDistrictCount(districtService.findCityDistrictCount(city));
@@ -612,8 +612,8 @@ public class ReportController extends BaseController {
model.setMaxDealPriceCount(districtAnalyDataService.findMaxDealCountByCity(city)); model.setMaxDealPriceCount(districtAnalyDataService.findMaxDealCountByCity(city));
model.setMaxSellCount(districtAnalyDataService.findMaxSellCountByCity(city)); model.setMaxSellCount(districtAnalyDataService.findMaxSellCountByCity(city));
model.setDistrictAnalyData(districtAnalyData); model.setDistrictAnalyData(districtAnalyData);
// 消费指数 // 消费指数
model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅")); model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅"));
double cityConsumMin = model.getCityConsumMin(); double cityConsumMin = model.getCityConsumMin();
double cityConsumMax = model.getCityConsumMax(); double cityConsumMax = model.getCityConsumMax();
@@ -621,11 +621,11 @@ public class ReportController extends BaseController {
model.setHigher((model.getAvgConsumption() - cityConsumMin) * 100.0 / (cityConsumMax - cityConsumMin)); model.setHigher((model.getAvgConsumption() - cityConsumMin) * 100.0 / (cityConsumMax - cityConsumMin));
} }
List<String> allKs = Arrays.asList(new String[]{ List<String> allKs = Arrays.asList(new String[]{
"KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴", "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴",
"医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园", "网吧", "医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园", "网吧" "医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园", "网吧", "医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园", "网吧"
}); });
Map<String,JSONObject> kwResult = baiduApiService.searchNearBy(allKs, lat, lng, radius, model.getBaiduMapKey()); Map<String,JSONObject> kwResult = baiduApiService.searchNearBy(allKs, lat, lng, radius, model.getBaiduMapKey());
String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" , "银行"}; String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" , "银行"};
Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length); Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
countMap.put(ks[i], getTotal(kwResult.get(ks[i]))); countMap.put(ks[i], getTotal(kwResult.get(ks[i])));
@@ -633,34 +633,34 @@ public class ReportController extends BaseController {
model.setConsumCountMap(countMap); model.setConsumCountMap(countMap);
model.setConsumScore(DistrictScoreUtil.consumScore(model.getAvgConsumption(), countMap)); model.setConsumScore(DistrictScoreUtil.consumScore(model.getAvgConsumption(), countMap));
// 环境指数 // 环境指数
Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius); Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius);
model.setMetroStations(stationMap.get("地铁")); model.setMetroStations(stationMap.get("地铁"));
model.setBusStations(stationMap.get("公交")); model.setBusStations(stationMap.get("公交"));
ks = new String[] { "医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园", "网吧"}; ks = new String[] { "医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园", "网吧"};
//厌恶设施 //厌恶设施
String[] keys = new String[]{"发电厂","变电站","垃圾焚烧厂","化工厂"}; String[] keys = new String[]{"发电厂","变电站","垃圾焚烧厂","化工厂"};
countMap = new HashMap<String, Integer>(ks.length); countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
countMap.put(ks[i], getTotal(kwResult.get(ks[i]))); countMap.put(ks[i], getTotal(kwResult.get(ks[i])));
} }
//添加厌恶设施 //添加厌恶设施
for (int i = 0; i < keys.length; i++) { for (int i = 0; i < keys.length; i++) {
countMap.put(ks[i], getTotal(kwResult.get(ks[i]))); countMap.put(ks[i], getTotal(kwResult.get(ks[i])));
} }
countMap.put("地铁站", null == model.getMetroStations() ? null : model.getMetroStations().size()); countMap.put("地铁站", null == model.getMetroStations() ? null : model.getMetroStations().size());
countMap.put("公交点", null == model.getBusStations() ? null : model.getBusStations().size()); countMap.put("公交点", null == model.getBusStations() ? null : model.getBusStations().size());
// 虹桥机场 121.352578,31.200062 // 虹桥机场 121.352578,31.200062
// 浦东机场 121.807085,31.160702 // 浦东机场 121.807085,31.160702
double dis = GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062); double dis = GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062);
if (dis <= radius) { if (dis <= radius) {
countMap.put("机场", 1); countMap.put("机场", 1);
} else { } else {
dis = GeoUtils.calculateDistance(lng, lat, 121.807085, 31.160702); dis = GeoUtils.calculateDistance(lng, lat, 121.807085, 31.160702);
if (dis <= radius) { if (dis <= radius) {
countMap.put("机场", 1); countMap.put("机场", 1);
} }
} }
@@ -760,7 +760,7 @@ public class ReportController extends BaseController {
district.setAvgPrice(avgPrice); district.setAvgPrice(avgPrice);
district.setKind(commData.getKind()); district.setKind(commData.getKind());
if (district.getName().endsWith("村")) { if (district.getName().endsWith("村")) {
oldHouseCount += count; oldHouseCount += count;
} else { } else {
if (avgPrice >= model.getCityAvgPrice()) { if (avgPrice >= model.getCityAvgPrice()) {
@@ -772,10 +772,10 @@ public class ReportController extends BaseController {
} }
} }
} }
model.setTotalHouseCount(oldHouseCount + hightLevelDistrictHouseCount + commonDistrictHouseCount);// 总户数 model.setTotalHouseCount(oldHouseCount + hightLevelDistrictHouseCount + commonDistrictHouseCount);// 总户数
model.setCommonDistrictHouseCount(commonDistrictHouseCount);// 高级商品房户数 model.setCommonDistrictHouseCount(commonDistrictHouseCount);// 高级商品房户数
model.setHightDistrictHouseCount(hightLevelDistrictHouseCount);// 普通户数 model.setHightDistrictHouseCount(hightLevelDistrictHouseCount);// 普通户数
model.setOldHouseCount(oldHouseCount);// 老工房 户数 model.setOldHouseCount(oldHouseCount);// 老工房 户数
} }
return model; return model;
} }
@@ -820,11 +820,11 @@ public class ReportController extends BaseController {
} }
if (StringUtils.isNotBlank(office.getBedKind())) { if (StringUtils.isNotBlank(office.getBedKind())) {
if (office.getBedKind().equals("甲级")) { if (office.getBedKind().equals("甲级")) {
bestLevelCount = bestLevelCount + office.getHouseholdCount(); bestLevelCount = bestLevelCount + office.getHouseholdCount();
} else if (office.getBedKind().equals("乙级")) { } else if (office.getBedKind().equals("乙级")) {
betterLevelCount = betterLevelCount + office.getHouseholdCount(); betterLevelCount = betterLevelCount + office.getHouseholdCount();
} else if (office.getBedKind().equals("丙级")) { } else if (office.getBedKind().equals("丙级")) {
goodLevelCount = goodLevelCount + office.getHouseholdCount(); goodLevelCount = goodLevelCount + office.getHouseholdCount();
} else { } else {
otherLevelCount = otherLevelCount + office.getHouseholdCount(); otherLevelCount = otherLevelCount + office.getHouseholdCount();
@@ -872,7 +872,7 @@ public class ReportController extends BaseController {
return model; return model;
} }
//获取报告编号 //获取报告编号
public String getNumber(){ public String getNumber(){
String number = ""; String number = "";
while(StringUtil.isBlank(number)){ while(StringUtil.isBlank(number)){
@@ -914,7 +914,7 @@ public class ReportController extends BaseController {
DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district.getCity(), district DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district.getCity(), district
.getRegion(), district.getName())); .getRegion(), district.getName()));
DistrictStat districtStat = null; DistrictStat districtStat = null;
if (StringUtils.contains(evaluation.getBuildType(), "别墅")) { if (StringUtils.contains(evaluation.getBuildType(), "别墅")) {
districtStat = districtStatBo.getVillaDistrictStat(); districtStat = districtStatBo.getVillaDistrictStat();
} else { } else {
districtStat = districtStatBo.getDistrictStat(); districtStat = districtStatBo.getDistrictStat();
@@ -959,7 +959,7 @@ public class ReportController extends BaseController {
DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district.getCity(), district DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district.getCity(), district
.getRegion(), district.getName())); .getRegion(), district.getName()));
DistrictStat districtStat = null; DistrictStat districtStat = null;
if (StringUtils.contains(district.getEstateType2(), "别墅")) { if (StringUtils.contains(district.getEstateType2(), "别墅")) {
districtStat = districtStatBo.getVillaDistrictStat(); districtStat = districtStatBo.getVillaDistrictStat();
} else { } else {
districtStat = districtStatBo.getDistrictStat(); districtStat = districtStatBo.getDistrictStat();
@@ -33,7 +33,7 @@ import java.util.List;
import java.util.Random; import java.util.Random;
/** /**
*估价报告查看 *估价报告查看
*@author wenyan *@author wenyan
*/ */
public class ReportViewController extends BaseController { public class ReportViewController extends BaseController {
@@ -47,7 +47,7 @@ public class ReportViewController extends BaseController {
String serialNumber; String serialNumber;
// 根据id查找商铺 // 根据id查找商铺
Shop shop = null; Shop shop = null;
if (StringUtils.isNotBlank(model.getId()) && ObjectId.isValid(model.getId())) { if (StringUtils.isNotBlank(model.getId()) && ObjectId.isValid(model.getId())) {
shop = shopService.findById(model.getId()); shop = shopService.findById(model.getId());
@@ -240,7 +240,7 @@ public class ReportViewController extends BaseController {
DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district.getCity(), district DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district.getCity(), district
.getRegion(), district.getName())); .getRegion(), district.getName()));
DistrictStat districtStat = null; DistrictStat districtStat = null;
if (StringUtils.contains(district.getEstateType2(), "别墅")) { if (StringUtils.contains(district.getEstateType2(), "别墅")) {
districtStat = districtStatBo.getVillaDistrictStat(); districtStat = districtStatBo.getVillaDistrictStat();
} else { } else {
districtStat = districtStatBo.getDistrictStat(); districtStat = districtStatBo.getDistrictStat();
@@ -258,7 +258,7 @@ public class ReportViewController extends BaseController {
return avgPrice; return avgPrice;
} }
//获取报告编号 //获取报告编号
public String getNumber(){ public String getNumber(){
String number = ""; String number = "";
while(StringUtil.isBlank(number)){ while(StringUtil.isBlank(number)){
@@ -27,7 +27,7 @@ import com.fangjia.service.bo.DistrictStatBo;
import com.fangjia.service.district.ShopStatService; import com.fangjia.service.district.ShopStatService;
/** /**
* 报告样例 * 报告样例
* Created by wenyan on 2015/11/27. * Created by wenyan on 2015/11/27.
*/ */
public class SampleController extends BaseController{ public class SampleController extends BaseController{
@@ -41,7 +41,7 @@ public class SampleController extends BaseController{
DistrictKey districtKey = new DistrictKey(model.getCityName(), model.getRegion(), model.getDistrictName()); DistrictKey districtKey = new DistrictKey(model.getCityName(), model.getRegion(), model.getDistrictName());
District district = districtService.findDistrict(districtKey,"district"); District district = districtService.findDistrict(districtKey,"district");
model.setDistrict(district); model.setDistrict(district);
/* 获取下载份数,菜单控制by tom */ /* 获取下载份数,菜单控制by tom */
String uid = cookieContext.getCookieValue(request, "fpk_uid"); String uid = cookieContext.getCookieValue(request, "fpk_uid");
if (StringUtils.isNotBlank(uid)) { if (StringUtils.isNotBlank(uid)) {
FpkUsers fpkUser = fpkUsersService.findById(SecurityUtil FpkUsers fpkUser = fpkUsersService.findById(SecurityUtil
@@ -61,7 +61,7 @@ public class SampleController extends BaseController{
DistrictKey districtKey = new DistrictKey(model.getCityName(), model.getRegion(), model.getDistrictName()); DistrictKey districtKey = new DistrictKey(model.getCityName(), model.getRegion(), model.getDistrictName());
District district = districtService.findDistrict(districtKey,"shop"); District district = districtService.findDistrict(districtKey,"shop");
model.setDistrict(district); model.setDistrict(district);
/* 获取下载份数,菜单控制by tom */ /* 获取下载份数,菜单控制by tom */
String uid = cookieContext.getCookieValue(request, "fpk_uid"); String uid = cookieContext.getCookieValue(request, "fpk_uid");
if (StringUtils.isNotBlank(uid)) { if (StringUtils.isNotBlank(uid)) {
FpkUsers fpkUser = fpkUsersService.findById(SecurityUtil FpkUsers fpkUser = fpkUsersService.findById(SecurityUtil
@@ -136,7 +136,7 @@ public class SearchController {
//nameQuery.add(new TermQuery(new Term("address", keyword)), Occur.SHOULD); //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("addr_alias_std", keyword)), Occur.SHOULD);
nameQuery.add(new TermQuery(new Term("keyword", 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); srQuery1.add(nameQuery, Occur.SHOULD);
params.add(new QueryParam("$sr", new SrQuery(srQuery1))); params.add(new QueryParam("$sr", new SrQuery(srQuery1)));
List<District> districts = districtService.findAllByParams(params, 0, limit, new String[] { "region", "name","address", "addrAlias" }); List<District> districts = districtService.findAllByParams(params, 0, limit, new String[] { "region", "name","address", "addrAlias" });
@@ -151,7 +151,7 @@ public class SearchController {
bo.setRegion(district.getRegion()); bo.setRegion(district.getRegion());
ret.add(bo); ret.add(bo);
} }
//对自动完成出来的结果按长短排序 //对自动完成出来的结果按长短排序
if(ret.size() > 0){ if(ret.size() > 0){
Collections.sort(ret, new Comparator<AutoCompleteBo>() { Collections.sort(ret, new Comparator<AutoCompleteBo>() {
public int compare(AutoCompleteBo o1, AutoCompleteBo o2) { public int compare(AutoCompleteBo o1, AutoCompleteBo o2) {
@@ -35,11 +35,11 @@ public class ShapeController {
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
g2d.setColor(new Color(178,178,178));//改变扇形颜色 g2d.setColor(new Color(178,178,178));//改变扇形颜色
g2d.fillArc(0,0,400,400,90,360); g2d.fillArc(0,0,400,400,90,360);
g2d.setColor(new Color(0,115,230));//改变扇形颜色 g2d.setColor(new Color(0,115,230));//改变扇形颜色
g2d.fillArc(0,0,400,400,90,rim); g2d.fillArc(0,0,400,400,90,rim);
g2d.setColor(new Color(229,229,229));//改变扇形颜色 g2d.setColor(new Color(229,229,229));//改变扇形颜色
g2d.fillArc(50,50,300,300,90,360); g2d.fillArc(50,50,300,300,90,360);
g2d.setColor(new Color(0,115,230)); g2d.setColor(new Color(0,115,230));
Map<TextAttribute, Object> attributes = new HashMap<TextAttribute, Object>(); Map<TextAttribute, Object> attributes = new HashMap<TextAttribute, Object>();
@@ -61,7 +61,7 @@ public class ShapeController {
unitStart = 200 + 25; unitStart = 200 + 25;
}else if("0".equals(scoreStr)){ }else if("0".equals(scoreStr)){
scoreStr ="-"; scoreStr ="-";
g2d.setFont(new Font("微软雅黑", Font.BOLD, 12*a).deriveFont(attributes)); g2d.setFont(new Font("微软雅黑", Font.BOLD, 12*a).deriveFont(attributes));
g2d.drawString(scoreStr, 200 - w + 10, 230); g2d.drawString(scoreStr, 200 - w + 10, 230);
unitStart = 175; unitStart = 175;
}else{ }else{
@@ -70,11 +70,11 @@ public class ShapeController {
} }
if("0".equals(scoreStr)){ if("0".equals(scoreStr)){
g2d.setFont(new Font("微软雅黑", Font.BOLD, 12*a).deriveFont(attributes)); g2d.setFont(new Font("微软雅黑", Font.BOLD, 12*a).deriveFont(attributes));
g2d.drawString("分", unitStart, 200); g2d.drawString("分", unitStart, 200);
}else{ }else{
g2d.setFont(new Font("微软雅黑", Font.BOLD, 12*a).deriveFont(attributes)); g2d.setFont(new Font("微软雅黑", Font.BOLD, 12*a).deriveFont(attributes));
g2d.drawString("分", unitStart, 252); g2d.drawString("分", unitStart, 252);
} }
g2d.dispose(); g2d.dispose();
cache.put(model.getScore(), image); cache.put(model.getScore(), image);
@@ -37,33 +37,33 @@ public class UserController {
mav.setModel(data); mav.setModel(data);
String password = model.getPassword(); String password = model.getPassword();
if (StringUtils.isBlank(model.getUserName())) { if (StringUtils.isBlank(model.getUserName())) {
data.put("userNameMsg","用户名不能为空"); data.put("userNameMsg","用户名不能为空");
return mav; return mav;
} }
if (StringUtils.isBlank(model.getPassword())) { if (StringUtils.isBlank(model.getPassword())) {
data.put("passwordMsg","密码不能为空"); data.put("passwordMsg","密码不能为空");
return mav; return mav;
} }
FpkUsers user = fpkUsersDao.findByName(model.getUserName()); FpkUsers user = fpkUsersDao.findByName(model.getUserName());
if (null == user) { if (null == user) {
data.put("userNameMsg","用户名不存在"); data.put("userNameMsg","用户名不存在");
return mav; return mav;
} }
if (!user.getPassword().equals(DigestUtils.md5Hex(password))) { if (!user.getPassword().equals(DigestUtils.md5Hex(password))) {
data.put("passwordMsg","密码错误"); data.put("passwordMsg","密码错误");
return mav; return mav;
} }
if(!user.isEnabled()){ if(!user.isEnabled()){
data.put("userNameMsg","账户被禁用,请联系我们!"); data.put("userNameMsg","账户被禁用,请联系我们!");
return mav; return mav;
} }
if(user.getExpiryDate() != null && user.getExpiryDate().before(new Date())){ if(user.getExpiryDate() != null && user.getExpiryDate().before(new Date())){
data.put("userNameMsg","您的账户已过期!"); data.put("userNameMsg","您的账户已过期!");
return mav; return mav;
} }
@@ -86,7 +86,7 @@ public class UserController {
} }
} }
if(city == null || location == null){ if(city == null || location == null){
data.put("userNameMsg","权限不足!"); data.put("userNameMsg","权限不足!");
}else{ }else{
if(StringUtils.isNotBlank(model.getForm())){ if(StringUtils.isNotBlank(model.getForm())){
location = URLDecoder.decode(model.getForm(),"UTF-8"); location = URLDecoder.decode(model.getForm(),"UTF-8");
@@ -122,7 +122,7 @@ public class UserController {
mav.setModel(data); mav.setModel(data);
FpkUsers users = model.getUser(); FpkUsers users = model.getUser();
if(!users.getPassword().equals(DigestUtils.md5Hex(model.getPasswordOld()))){ if(!users.getPassword().equals(DigestUtils.md5Hex(model.getPasswordOld()))){
data.put("passwordOldMsg","原密码错误"); data.put("passwordOldMsg","原密码错误");
return mav; return mav;
} }
Map<String,Object> map = new HashMap<String, Object>(); Map<String,Object> map = new HashMap<String, Object>();
@@ -151,7 +151,7 @@ public class UserController {
} }
/** /**
* 链接请求直接登录(新需求) * 链接请求直接登录(新需求)
* @param model * @param model
* @param req * @param req
* @param response * @param response
@@ -191,7 +191,7 @@ public class UserController {
} }
try { try {
return model.redirect("/noResult/district?cityName="+URLEncoder.encode("上海", "utf-8")); return model.redirect("/noResult/district?cityName="+URLEncoder.encode("上海", "utf-8"));
} catch (UnsupportedEncodingException e) { } catch (UnsupportedEncodingException e) {
e.printStackTrace(); e.printStackTrace();
} }
@@ -73,7 +73,7 @@ public class AccessLogFilter implements Filter {
LOGGER.error("error process request: request_url=" + analyticsBean.requestUrl + ", referer=" LOGGER.error("error process request: request_url=" + analyticsBean.requestUrl + ", referer="
+ analyticsBean.refererUrl, rootCause); + analyticsBean.refererUrl, rootCause);
} }
// 记录运行超过1秒的请求到日志中 // 记录运行超过1秒的请求到日志中
final long time = System.currentTimeMillis() - start; final long time = System.currentTimeMillis() - start;
final String actionUri = (String) request.getAttribute(ActionContext.ACTION_URI); final String actionUri = (String) request.getAttribute(ActionContext.ACTION_URI);
if (time > 1000 || (!ChafangtongConfig.getConfig().isProductionEnvironment() && executeCounter.getTotalCount() > 0)) { if (time > 1000 || (!ChafangtongConfig.getConfig().isProductionEnvironment() && executeCounter.getTotalCount() > 0)) {
@@ -94,7 +94,7 @@ public class AccessLogFilter implements Filter {
private void writeAccessLog(AnalyticsBean analyticsBean, long duration, String actionUri, int statusCode, String method) { private void writeAccessLog(AnalyticsBean analyticsBean, long duration, String actionUri, int statusCode, String method) {
StringBuilder logStr = new StringBuilder(); StringBuilder logStr = new StringBuilder();
// 不要改变顺序 // 不要改变顺序
logStr.append(DATE_FORMAT.format(analyticsBean.startTime));// 1 logStr.append(DATE_FORMAT.format(analyticsBean.startTime));// 1
logStr.append(SPLIT).append(StringUtils.defaultString(analyticsBean.connectionIp));// 2 logStr.append(SPLIT).append(StringUtils.defaultString(analyticsBean.connectionIp));// 2
logStr.append(SPLIT).append(StringUtils.defaultString(analyticsBean.ip));// 3 logStr.append(SPLIT).append(StringUtils.defaultString(analyticsBean.ip));// 3
@@ -105,7 +105,7 @@ public class AnalyticsBean {
} }
/** /**
* 获得连接客户端的IP(部署环境下一般都设有nginx等http服务器) * 获得连接客户端的IP(部署环境下一般都设有nginx等http服务器)
* *
* @param request * @param request
* @return * @return
@@ -123,7 +123,7 @@ public class AnalyticsBean {
String citySpell = getCitySpell(request.getRequestURL().toString()); String citySpell = getCitySpell(request.getRequestURL().toString());
ServerArea city = ServerAreaData.getServerAreaByNameOrSpellDefaultNull(citySpell); ServerArea city = ServerAreaData.getServerAreaByNameOrSpellDefaultNull(citySpell);
if (null != city) { if (null != city) {
// 保存至cookie // 保存至cookie
Cookie cityCookie = cookieContext.createCookie(CookieName.COOKIE_CITY, citySpell); Cookie cityCookie = cookieContext.createCookie(CookieName.COOKIE_CITY, citySpell);
cityCookie.setMaxAge(Integer.MAX_VALUE); cityCookie.setMaxAge(Integer.MAX_VALUE);
response.addCookie(cityCookie); response.addCookie(cityCookie);
@@ -137,7 +137,7 @@ public class AnalyticsBean {
} }
private String createUID(HttpServletRequest request, HttpServletResponse response) { private String createUID(HttpServletRequest request, HttpServletResponse response) {
// 设置UUID // 设置UUID
String uuid = new ObjectId().toString(); String uuid = new ObjectId().toString();
Cookie uuidCookie = cookieContext.createCookie(CookieName.UID, uuid); Cookie uuidCookie = cookieContext.createCookie(CookieName.UID, uuid);
uuidCookie.setMaxAge(Integer.MAX_VALUE); uuidCookie.setMaxAge(Integer.MAX_VALUE);
@@ -152,7 +152,7 @@ public class AnalyticsBean {
} }
private String createSID(HttpServletRequest request, HttpServletResponse response) { private String createSID(HttpServletRequest request, HttpServletResponse response) {
// 设置session id // 设置session id
String sid = new ObjectId().toString(); String sid = new ObjectId().toString();
Cookie uuidCookie = cookieContext.createCookie(CookieName.SID, sid); Cookie uuidCookie = cookieContext.createCookie(CookieName.SID, sid);
uuidCookie.setMaxAge(-1); uuidCookie.setMaxAge(-1);
@@ -165,7 +165,7 @@ public class AnalyticsBean {
} }
/** /**
* 请求url,不包括query string * 请求url,不包括query string
* *
* @return * @return
*/ */
@@ -174,7 +174,7 @@ public class AnalyticsBean {
} }
/** /**
* 请求url后的请求参数,如果参数不为空则包括问号在内 * 请求url后的请求参数,如果参数不为空则包括问号在内
* *
* @return * @return
*/ */
@@ -183,7 +183,7 @@ public class AnalyticsBean {
} }
/** /**
* 请求uri * 请求uri
* *
* @return * @return
*/ */
@@ -192,7 +192,7 @@ public class AnalyticsBean {
} }
/** /**
* 来源url * 来源url
* *
* @return * @return
*/ */
@@ -201,7 +201,7 @@ public class AnalyticsBean {
} }
/** /**
* 完整的请求url,包括query string * 完整的请求url,包括query string
* *
* @return * @return
*/ */
@@ -210,7 +210,7 @@ public class AnalyticsBean {
} }
/** /**
* 是否刷新缓存 * 是否刷新缓存
* *
* @return * @return
*/ */
@@ -219,7 +219,7 @@ public class AnalyticsBean {
} }
/** /**
* 当前城市,可能为null * 当前城市,可能为null
* *
* @return * @return
*/ */
@@ -228,7 +228,7 @@ public class AnalyticsBean {
} }
/** /**
* 当前城市,不会为null * 当前城市,不会为null
* *
* @return * @return
*/ */
@@ -237,7 +237,7 @@ public class AnalyticsBean {
} }
/** /**
* cookie中的uid,如果没有则生成新的uid * cookie中的uid,如果没有则生成新的uid
* *
* @return * @return
*/ */
@@ -246,7 +246,7 @@ public class AnalyticsBean {
} }
/** /**
* 全局的请求id * 全局的请求id
* *
* @return * @return
*/ */
@@ -255,7 +255,7 @@ public class AnalyticsBean {
} }
/** /**
* cookie中的会话id,如果没有则生成新的sid * cookie中的会话id,如果没有则生成新的sid
* *
* @return * @return
*/ */
@@ -264,7 +264,7 @@ public class AnalyticsBean {
} }
/** /**
* 是否为ajax请求 * 是否为ajax请求
* *
* @return * @return
*/ */
@@ -273,7 +273,7 @@ public class AnalyticsBean {
} }
/** /**
* 访问者的真实ip * 访问者的真实ip
* *
* @return * @return
*/ */
@@ -282,7 +282,7 @@ public class AnalyticsBean {
} }
/** /**
* 访问者标识,可能为null * 访问者标识,可能为null
* *
* @return * @return
*/ */
@@ -291,7 +291,7 @@ public class AnalyticsBean {
} }
/** /**
* 连接ip * 连接ip
* *
* @return * @return
*/ */
@@ -300,7 +300,7 @@ public class AnalyticsBean {
} }
/** /**
* cookie中的uid,如果没有则为空字符串 * cookie中的uid,如果没有则为空字符串
* *
* @return * @return
*/ */
@@ -309,7 +309,7 @@ public class AnalyticsBean {
} }
/** /**
* cookie中的会话id,如果没有则为空字符串 * cookie中的会话id,如果没有则为空字符串
* *
* @return * @return
*/ */
@@ -318,7 +318,7 @@ public class AnalyticsBean {
} }
/** /**
* 请求开始时间 * 请求开始时间
* *
* @return * @return
*/ */
@@ -59,12 +59,12 @@ public class AnalyticsFilter implements Filter {
ServletException { ServletException {
final AnalyticsBean analyticsBean = AnalyticsBean.get(request, response); final AnalyticsBean analyticsBean = AnalyticsBean.get(request, response);
// 点击日志 // 点击日志
if (analyticsBean.requestUrl.indexOf("/__utm.gif") > -1) { if (analyticsBean.requestUrl.indexOf("/__utm.gif") > -1) {
processUtmGifLog(request, response, analyticsBean); processUtmGifLog(request, response, analyticsBean);
return; return;
} }
// 判断URL是否合法,不合法则重定向 // 判断URL是否合法,不合法则重定向
String redirectUrl = checkUrlFormat(analyticsBean); String redirectUrl = checkUrlFormat(analyticsBean);
if (null != redirectUrl) { if (null != redirectUrl) {
if (analyticsBean.isSpider()) { if (analyticsBean.isSpider()) {
@@ -84,7 +84,7 @@ public class AnalyticsFilter implements Filter {
threadLocalData.put(ThreadLocalKey.DisableCache, "1"); threadLocalData.put(ThreadLocalKey.DisableCache, "1");
} }
// 切换城市 // 切换城市
FangjiaServerAreaContextHolder.setServerArea(analyticsBean.city); FangjiaServerAreaContextHolder.setServerArea(analyticsBean.city);
threadLocalData.put(ThreadLocalKey.FromSpider, analyticsBean.isSpider()); threadLocalData.put(ThreadLocalKey.FromSpider, analyticsBean.isSpider());
chain.doFilter(request, response); chain.doFilter(request, response);
@@ -105,7 +105,7 @@ public class AnalyticsFilter implements Filter {
responseOutputStream.close(); responseOutputStream.close();
String userAgent = analyticsBean.userAgent; String userAgent = analyticsBean.userAgent;
if (userAgent != null && (userAgent.indexOf("Googlebot-Image") >= 0 || userAgent.indexOf("Baidu") >= 0)) { if (userAgent != null && (userAgent.indexOf("Googlebot-Image") >= 0 || userAgent.indexOf("Baidu") >= 0)) {
// 过滤爬虫的访问 // 过滤爬虫的访问
return; return;
} }
jmsTemplate.send(utmgifDestination, new MessageCreator() { jmsTemplate.send(utmgifDestination, new MessageCreator() {
@@ -138,7 +138,7 @@ public class AnalyticsFilter implements Filter {
} }
/** /**
* 判断URL是否合法,合法则返回null,否则返回重定向URL * 判断URL是否合法,合法则返回null,否则返回重定向URL
* *
* @param requestUrl * @param requestUrl
* @param requestUri * @param requestUri
@@ -148,7 +148,7 @@ public class AnalyticsFilter implements Filter {
private String checkUrlFormat(AnalyticsBean analyticsBean) { private String checkUrlFormat(AnalyticsBean analyticsBean) {
ChafangtongConfig fangjiaConfig = ChafangtongConfig.getConfig(); ChafangtongConfig fangjiaConfig = ChafangtongConfig.getConfig();
String hostName = StringUtils.substringBetween(analyticsBean.requestUrl, "http://", "/"); String hostName = StringUtils.substringBetween(analyticsBean.requestUrl, "http://", "/");
// 如果hostName中有端口号,则把端口号去掉 // 如果hostName中有端口号,则把端口号去掉
int index = hostName.indexOf(":"); int index = hostName.indexOf(":");
if (index > 0) { if (index > 0) {
hostName = hostName.substring(0, index); hostName = hostName.substring(0, index);
@@ -168,7 +168,7 @@ public class AnalyticsFilter implements Filter {
return fangjiaConfig.getCityDomainName(city) + analyticsBean.requestUri + analyticsBean.queryString; return fangjiaConfig.getCityDomainName(city) + analyticsBean.requestUri + analyticsBean.queryString;
} }
if (city != null) { if (city != null) {
// 找到对应的城市,或者是一个有效的二级域名 // 找到对应的城市,或者是一个有效的二级域名
return null; return null;
} }
if (prefixSplit[0].equalsIgnoreCase("www")) { if (prefixSplit[0].equalsIgnoreCase("www")) {
@@ -53,7 +53,7 @@ public class SpiderValidateFilter implements Filter {
private void checkReload() { private void checkReload() {
if (this.reloading.compareAndSet(false, true)) { if (this.reloading.compareAndSet(false, true)) {
try { try {
// 5分钟reload一次 // 5分钟reload一次
if (System.currentTimeMillis() - lastReloadTimestamp < 300000) { if (System.currentTimeMillis() - lastReloadTimestamp < 300000) {
return; return;
} }
@@ -87,13 +87,13 @@ public class SpiderValidateFilter implements Filter {
if (isValidUserAgent(ua)) { if (isValidUserAgent(ua)) {
for (String spiderName : spiderDomains.keySet()) { for (String spiderName : spiderDomains.keySet()) {
if (!ua.contains(spiderName)) { if (!ua.contains(spiderName)) {
// 未声明自己为spider则跳过 // 未声明自己为spider则跳过
continue; continue;
} }
if (null == ip) { if (null == ip) {
spider = new Spider(spiderName, ip, ua); spider = new Spider(spiderName, ip, ua);
spider.setFake(true); spider.setFake(true);
// 对ip为null的蜘蛛暂时不入数据库 // 对ip为null的蜘蛛暂时不入数据库
} else { } else {
spider = spiders.get(ip); spider = spiders.get(ip);
if (null == spider) { if (null == spider) {
@@ -106,7 +106,7 @@ public class SpiderValidateFilter implements Filter {
} else { } else {
spider = new Spider("unkown", ip, ua); spider = new Spider("unkown", ip, ua);
spider.setFake(true); spider.setFake(true);
// 对userAgent为null的蜘蛛暂时不入数据库 // 对userAgent为null的蜘蛛暂时不入数据库
} }
} }
if (spider != null && spider.isFake()) { if (spider != null && spider.isFake()) {
@@ -145,7 +145,7 @@ public class SpiderValidateFilter implements Filter {
private void validateSpider(Spider spider) { private void validateSpider(Spider spider) {
if (null == spider.getId()) { if (null == spider.getId()) {
// 新发现的蜘蛛 // 新发现的蜘蛛
checkSpider(spider); checkSpider(spider);
spiderService.upsertByIp(spider); spiderService.upsertByIp(spider);
spiders.put(spider.getIp(), spider); spiders.put(spider.getIp(), spider);
@@ -153,23 +153,23 @@ public class SpiderValidateFilter implements Filter {
LOGGER.info("find new spider: " + spider); LOGGER.info("find new spider: " + spider);
} }
} else if (spider.isVerified()) { } else if (spider.isVerified()) {
// 已人工验证的蜘蛛 // 已人工验证的蜘蛛
spiders.put(spider.getIp(), spider); spiders.put(spider.getIp(), spider);
} else if (spider.isFake()) { } else if (spider.isFake()) {
// 已发现的假蜘蛛 // 已发现的假蜘蛛
Date yestoday = DateUtils.addDays(new Date(), -1); Date yestoday = DateUtils.addDays(new Date(), -1);
if (spider.getModificationDate().before(yestoday)) { if (spider.getModificationDate().before(yestoday)) {
// 删除超过1天的假蜘蛛信息 // 删除超过1天的假蜘蛛信息
spiderService.deleteByIp(spider.getIp()); spiderService.deleteByIp(spider.getIp());
spiders.remove(spider.getIp()); spiders.remove(spider.getIp());
} else { } else {
spiders.put(spider.getIp(), spider); spiders.put(spider.getIp(), spider);
} }
} else { } else {
// 已发现的真蜘蛛 // 已发现的真蜘蛛
Date lastWeek = DateUtils.addDays(new Date(), -7); Date lastWeek = DateUtils.addDays(new Date(), -7);
if (spider.getModificationDate().before(lastWeek)) { if (spider.getModificationDate().before(lastWeek)) {
// 重新验证超过7天的真蜘蛛 // 重新验证超过7天的真蜘蛛
checkSpider(spider); checkSpider(spider);
if (spider.isFake()) { if (spider.isFake()) {
spiderService.deleteByIp(spider.getIp()); spiderService.deleteByIp(spider.getIp());
@@ -191,10 +191,10 @@ public class SpiderValidateFilter implements Filter {
String host = nslookup(spider.getIp()); String host = nslookup(spider.getIp());
if (null != host) { if (null != host) {
spider.setHost(host); spider.setHost(host);
// 不是相同域的为假蜘蛛 // 不是相同域的为假蜘蛛
spider.setFake(!isSameDomain(host, spiderDomains.get(spider.getName()))); spider.setFake(!isSameDomain(host, spiderDomains.get(spider.getName())));
} else { } else {
// 反向解析失败,则默认为真蜘蛛 // 反向解析失败,则默认为真蜘蛛
spider.setHost(spider.getIp()); spider.setHost(spider.getIp());
spider.setFake(false); spider.setFake(false);
} }
@@ -31,7 +31,7 @@ import java.net.URLEncoder;
import java.util.*; import java.util.*;
/** /**
* 查房通权限拦截器 * 查房通权限拦截器
* Created by wenyan on 2015/11/12. * Created by wenyan on 2015/11/12.
*/ */
public class AuthenticationInterceptor implements Interceptor { public class AuthenticationInterceptor implements Interceptor {
@@ -75,11 +75,11 @@ public class AuthenticationInterceptor implements Interceptor {
isPassed = false; isPassed = false;
} }
if(isPassed && city == null){ if(isPassed && city == null){
LOGGER.info("无法访问" + request.getRequestURI() + "请用cityName 指定访问资源所在的城市"); LOGGER.info("无法访问" + request.getRequestURI() + "请用cityName 指定访问资源所在的城市");
error = "noAuth"; error = "noAuth";
} }
if(isPassed && !isAccessible(user, city, request)){ if(isPassed && !isAccessible(user, city, request)){
LOGGER.info("无法访问" + request.getRequestURI() + "!!!请到菜单管理添加菜单"); LOGGER.info("无法访问" + request.getRequestURI() + "!!!请到菜单管理添加菜单");
isPassed = false; isPassed = false;
error = "noAuth"; error = "noAuth";
} }
@@ -235,7 +235,7 @@ public class BaseModel extends ModelAndViewSupport {
} }
/** /**
* 如果queryString不为空则在前面加上问号"?",否则不加 * 如果queryString不为空则在前面加上问号"?",否则不加
* *
* @return * @return
*/ */
@@ -5,7 +5,7 @@ import com.fangjia.service.bo.DistrictStatBo;
public class ConsumModel extends ChafangtongModel { public class ConsumModel extends ChafangtongModel {
private static final long serialVersionUID = 6142958920656840695L; private static final long serialVersionUID = 6142958920656840695L;
private Double avgConsumption; // 周边餐饮人均消费 private Double avgConsumption; // 周边餐饮人均消费
private DistrictStatBo statBo; private DistrictStatBo statBo;
private Double higher; private Double higher;
@@ -3,17 +3,17 @@ package com.fangjia.chafangtong.model;
public final class Models { public final class Models {
/** /**
* 404错误面页的model * 404错误面页的model
*/ */
public static final BaseModel NOT_FOUNT = createModel(404, "/error"); public static final BaseModel NOT_FOUNT = createModel(404, "/error");
/** /**
* 一般错误面页的model * 一般错误面页的model
*/ */
public static final BaseModel ERROR = createModel(500, "/error"); public static final BaseModel ERROR = createModel(500, "/error");
/** /**
* 500错误面页的model * 500错误面页的model
*/ */
public static final BaseModel FORBIDDEN = createModel(400, "/forbidden"); public static final BaseModel FORBIDDEN = createModel(400, "/forbidden");
@@ -13,7 +13,7 @@ public class NoResultModel extends ChafangtongModel {
private double maxLng; private double maxLng;
double centerLat; double centerLat;
double centerLng; double centerLng;
String type; // r: 矩形搜索(最大最小经纬度),c:圆形搜索(中心点、半径) String type; // r: 矩形搜索(最大最小经纬度),c:圆形搜索(中心点、半径)
List<Map<String, String>> result; List<Map<String, String>> result;
public List<AroundMarker> getInsideShops() { public List<AroundMarker> getInsideShops() {
@@ -11,15 +11,15 @@ import com.fangjia.service.bo.DistrictStatRentBo;
public class NodistrictModel extends ChafangtongModel { public class NodistrictModel extends ChafangtongModel {
private static final long serialVersionUID = -2866501361955105846L; private static final long serialVersionUID = -2866501361955105846L;
// 房价 // 房价
Integer areaPrice; Integer areaPrice;
Integer cityPrice; Integer cityPrice;
Double priceLeft; Double priceLeft;
List<DistrictStatBo> priceNearest; // 最近的3个商铺价格 List<DistrictStatBo> priceNearest; // 最近的3个商铺价格
List<DistrictStat> priceTop5; // 最高的5个 List<DistrictStat> priceTop5; // 最高的5个
List<DistrictStat> priceBtm5; // 最低的5个 List<DistrictStat> priceBtm5; // 最低的5个
// 租金 // 租金
Integer areaRent1; Integer areaRent1;
Integer areaRent2; Integer areaRent2;
Integer areaRent3; Integer areaRent3;
@@ -30,7 +30,7 @@ public class NodistrictModel extends ChafangtongModel {
DistrictStatRent[] rentRank3; DistrictStatRent[] rentRank3;
DistrictStatRent[] rentRank4; DistrictStatRent[] rentRank4;
Double avgConsumption; // 周边餐饮人均消费 Double avgConsumption; // 周边餐饮人均消费
Double higher; Double higher;
List<BusStation> metroStations; List<BusStation> metroStations;
@@ -11,30 +11,30 @@ import com.fangjia.service.bo.DistrictStatBo;
public class NoshopModel extends ChafangtongModel { public class NoshopModel extends ChafangtongModel {
private static final long serialVersionUID = -170439161907268598L; private static final long serialVersionUID = -170439161907268598L;
// 房价 // 房价
Integer areaPrice; Integer areaPrice;
Integer cityPrice; Integer cityPrice;
Double priceLeft; Double priceLeft;
List<DistrictStatBo> priceNearest; // 最近的3个商铺价格 List<DistrictStatBo> priceNearest; // 最近的3个商铺价格
List<DistrictStat> priceTop5; // 最高的5个 List<DistrictStat> priceTop5; // 最高的5个
List<DistrictStat> priceBtm5; // 最低的5个 List<DistrictStat> priceBtm5; // 最低的5个
// 租金 // 租金
Integer areaRentPrice; Integer areaRentPrice;
Integer cityRentPrice; Integer cityRentPrice;
Double rentLeft; Double rentLeft;
List<DistrictBusinessStatRent> rentNearest; // 最近的3个商铺价格 List<DistrictBusinessStatRent> rentNearest; // 最近的3个商铺价格
List<DistrictBusinessStatRent> rentTop5; // 最高的5个 List<DistrictBusinessStatRent> rentTop5; // 最高的5个
List<DistrictBusinessStatRent> rentBtm5; // 最低的5个 List<DistrictBusinessStatRent> rentBtm5; // 最低的5个
// 地段 // 地段
List<BusStation> metroStations; List<BusStation> metroStations;
List<BusStation> busStations; List<BusStation> busStations;
double disHongqiaoAirport; double disHongqiaoAirport;
double disHongqiaoStation; double disHongqiaoStation;
Map<String, Double> typePercentMap; Map<String, Double> typePercentMap;
// 人口 // 人口
int cityAvgPrice; int cityAvgPrice;
String districts; String districts;
String offices; String offices;
@@ -55,8 +55,8 @@ public class NoshopModel extends ChafangtongModel {
Double left1; Double left1;
Double left2; Double left2;
// 消费 // 消费
Double avgConsumption; // 周边餐饮人均消费 Double avgConsumption; // 周边餐饮人均消费
Double higher; Double higher;
private final String[] PIE_COLOR_RGBS = new String[] { "#C6DBF7", "#F5EEBD", "#DEE7C6", "#FFD7BD", "#D6C3E7", "#C3E1E7", private final String[] PIE_COLOR_RGBS = new String[] { "#C6DBF7", "#F5EEBD", "#DEE7C6", "#FFD7BD", "#D6C3E7", "#C3E1E7",
@@ -29,7 +29,7 @@ public class ReportModel extends ChafangtongModel {
List<String> pieColors; List<String> pieColors;
List<String> pieMarkers; List<String> pieMarkers;
// 综合指数 // 综合指数
double detailScore; double detailScore;
double detailScore1; double detailScore1;
double detailScore2; double detailScore2;
@@ -39,7 +39,7 @@ public class ReportModel extends ChafangtongModel {
double shopArea; double shopArea;
List<Object[]> aroundTypes; List<Object[]> aroundTypes;
// 房价指数 // 房价指数
double priceScore; double priceScore;
Integer cityPrice; Integer cityPrice;
DistrictStatBo statBo; DistrictStatBo statBo;
@@ -48,21 +48,21 @@ public class ReportModel extends ChafangtongModel {
List<RegionStatRent> regionStatRents; List<RegionStatRent> regionStatRents;
List<DistrictStatRentBo> rentStatBos; List<DistrictStatRentBo> rentStatBos;
// 租金指数 // 租金指数
double rentScore; double rentScore;
DistrictBusinessStatRentBo rentStatBo; DistrictBusinessStatRentBo rentStatBo;
String regionPayment; String regionPayment;
Double rentLeft; Double rentLeft;
String rentTradeUrl; String rentTradeUrl;
// 地段指数 // 地段指数
double localScore; double localScore;
double localScore1; double localScore1;
double localScore2; double localScore2;
Integer regionPrice; Integer regionPrice;
String aroundPieUrl; String aroundPieUrl;
// 人口指数 // 人口指数
double peopleScore; double peopleScore;
double peopleScore1; double peopleScore1;
double peopleScore2; double peopleScore2;
@@ -79,26 +79,26 @@ public class ReportModel extends ChafangtongModel {
Double left1; Double left1;
Double left2; Double left2;
// 消费指数 // 消费指数
double consumScore; double consumScore;
Double avgConsumption; // 周边餐饮人均消费 Double avgConsumption; // 周边餐饮人均消费
Double higher; Double higher;
Map<String, Integer> consumCountMap; Map<String, Integer> consumCountMap;
// 环境指数 // 环境指数
double aroundScore; double aroundScore;
double aroundScore1; double aroundScore1;
double aroundScore2; double aroundScore2;
Map<String, Integer> aroundCountMap; Map<String, Integer> aroundCountMap;
// 潜力指数 // 潜力指数
double predictScore; double predictScore;
Integer predictPrice; Integer predictPrice;
Double predictMarkup; Double predictMarkup;
Integer districtMinPrice; Integer districtMinPrice;
Integer districtMaxPrice; Integer districtMaxPrice;
// 稀缺指数 // 稀缺指数
double rankScore; double rankScore;
DistrictHot districtHot; DistrictHot districtHot;
DistrictAttentionRank districtAttention; DistrictAttentionRank districtAttention;
@@ -113,7 +113,7 @@ public class ReportModel extends ChafangtongModel {
double totalScore; double totalScore;
private FpkDownload fpkDownload; private FpkDownload fpkDownload;
//报告编号 //报告编号
private String serialNum; private String serialNum;
private Integer totalPrice; private Integer totalPrice;
@@ -3,7 +3,7 @@ package com.fangjia.chafangtong.model;
import org.sothis.web.mvc.ModelAndViewSupport; import org.sothis.web.mvc.ModelAndViewSupport;
/** /**
* 用于restAPI的ModelAndView * 用于restAPI的ModelAndView
* *
* @author velna * @author velna
* *
@@ -49,7 +49,7 @@ public class ChartImgServlet extends HttpServlet {
@Override @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");// 注意编码 request.setCharacterEncoding("UTF-8");// 注意编码
String reqUrl = request.getRequestURI(); String reqUrl = request.getRequestURI();
String i = reqUrl.substring(reqUrl.indexOf("/cImg/") + 6, reqUrl.length()); String i = reqUrl.substring(reqUrl.indexOf("/cImg/") + 6, reqUrl.length());
@@ -107,7 +107,7 @@ public class ChartImgServlet extends HttpServlet {
} }
/** /**
* 处理均价类走势图 * 处理均价类走势图
* *
* @throws IOException * @throws IOException
*/ */
@@ -170,7 +170,7 @@ public class ChartImgServlet extends HttpServlet {
} }
/** /**
* 处理租金类走势图 * 处理租金类走势图
* *
* @throws IOException * @throws IOException
*/ */
@@ -233,7 +233,7 @@ public class ChartImgServlet extends HttpServlet {
} }
/** /**
* 周边行业饼图 * 周边行业饼图
* *
* @throws IOException * @throws IOException
*/ */
@@ -305,7 +305,7 @@ public class ChartImgServlet extends HttpServlet {
} }
/** /**
* 卖家关注度排行柱状图 * 卖家关注度排行柱状图
* *
* @throws IOException * @throws IOException
*/ */
@@ -56,7 +56,7 @@ public class ReportServlet extends HttpServlet {
System.setProperty("javax.xml.transform.TransformerFactory", System.setProperty("javax.xml.transform.TransformerFactory",
"com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"); "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
// 字体文件 // 字体文件
ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
FONT_PATHS.add(classLoader.getResource("districtreport/SIMSUN.TTC").toString()); FONT_PATHS.add(classLoader.getResource("districtreport/SIMSUN.TTC").toString());
FONT_PATHS.add(classLoader.getResource("districtreport/SIMHEI.TTF").toString()); FONT_PATHS.add(classLoader.getResource("districtreport/SIMHEI.TTF").toString());
@@ -106,11 +106,11 @@ public class ReportServlet extends HttpServlet {
PdfCopy copy = new PdfCopy(document, resp.getOutputStream()); PdfCopy copy = new PdfCopy(document, resp.getOutputStream());
document.open(); document.open();
document.newPage(); document.newPage();
// // 封面 // // 封面
// PdfReader reader = new PdfReader(FRONTCOVER_DATA); // PdfReader reader = new PdfReader(FRONTCOVER_DATA);
// PdfImportedPage coverPage = copy.getImportedPage(reader, 1); // PdfImportedPage coverPage = copy.getImportedPage(reader, 1);
// copy.addPage(coverPage); // copy.addPage(coverPage);
// // 目录 // // 目录
// reader = new PdfReader(DIRECTORY_DATA); // reader = new PdfReader(DIRECTORY_DATA);
// PdfImportedPage directoryPage = copy.getImportedPage(reader, 1); // PdfImportedPage directoryPage = copy.getImportedPage(reader, 1);
// copy.addPage(directoryPage); // copy.addPage(directoryPage);
@@ -129,7 +129,7 @@ public class ReportServlet extends HttpServlet {
} }
/** /**
* 根据页面URL获取内容 * 根据页面URL获取内容
*/ */
private byte[] getPageData(String pagePath,HttpServletRequest request) { private byte[] getPageData(String pagePath,HttpServletRequest request) {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
@@ -151,7 +151,7 @@ public class ReportServlet extends HttpServlet {
html = html.replaceAll("&ensp;", "&#8194;"); html = html.replaceAll("&ensp;", "&#8194;");
renderer.setDocumentFromString(html); renderer.setDocumentFromString(html);
// 解决中文支持问题 // 解决中文支持问题
ITextFontResolver fontResolver = renderer.getFontResolver(); ITextFontResolver fontResolver = renderer.getFontResolver();
for (String path : FONT_PATHS) { for (String path : FONT_PATHS) {
fontResolver.addFont(path, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); fontResolver.addFont(path, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
@@ -19,9 +19,9 @@ public class DesUtils {
private final static String DES = "DES"; private final static String DES = "DES";
/** /**
* Description 根据键值进行加密 * Description 根据键值进行加密
* @param data * @param data
* @param key 加密键byte数组 * @param key 加密键byte数组
* @return * @return
* @throws Exception * @throws Exception
*/ */
@@ -32,9 +32,9 @@ public class DesUtils {
} }
/** /**
* Description 根据键值进行解密 * Description 根据键值进行解密
* @param data * @param data
* @param key 加密键byte数组 * @param key 加密键byte数组
* @return * @return
* @throws IOException * @throws IOException
* @throws Exception * @throws Exception
@@ -50,27 +50,27 @@ public class DesUtils {
} }
/** /**
* Description 根据键值进行加密 * Description 根据键值进行加密
* @param data * @param data
* @param key 加密键byte数组 * @param key 加密键byte数组
* @return * @return
* @throws Exception * @throws Exception
*/ */
private static byte[] encrypt(byte[] data, byte[] key) throws Exception { private static byte[] encrypt(byte[] data, byte[] key) throws Exception {
// 生成一个可信任的随机数源 // 生成一个可信任的随机数源
SecureRandom sr = new SecureRandom(); SecureRandom sr = new SecureRandom();
// 从原始密钥数据创建DESKeySpec对象 // 从原始密钥数据创建DESKeySpec对象
DESKeySpec dks = new DESKeySpec(key); DESKeySpec dks = new DESKeySpec(key);
// 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象 // 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES); SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
SecretKey securekey = keyFactory.generateSecret(dks); SecretKey securekey = keyFactory.generateSecret(dks);
// Cipher对象实际完成加密操作 // Cipher对象实际完成加密操作
Cipher cipher = Cipher.getInstance(DES); Cipher cipher = Cipher.getInstance(DES);
// 用密钥初始化Cipher对象 // 用密钥初始化Cipher对象
cipher.init(Cipher.ENCRYPT_MODE, securekey, sr); cipher.init(Cipher.ENCRYPT_MODE, securekey, sr);
return cipher.doFinal(data); return cipher.doFinal(data);
@@ -78,27 +78,27 @@ public class DesUtils {
/** /**
* Description 根据键值进行解密 * Description 根据键值进行解密
* @param data * @param data
* @param key 加密键byte数组 * @param key 加密键byte数组
* @return * @return
* @throws Exception * @throws Exception
*/ */
private static byte[] decrypt(byte[] data, byte[] key) throws Exception { private static byte[] decrypt(byte[] data, byte[] key) throws Exception {
// 生成一个可信任的随机数源 // 生成一个可信任的随机数源
SecureRandom sr = new SecureRandom(); SecureRandom sr = new SecureRandom();
// 从原始密钥数据创建DESKeySpec对象 // 从原始密钥数据创建DESKeySpec对象
DESKeySpec dks = new DESKeySpec(key); DESKeySpec dks = new DESKeySpec(key);
// 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象 // 创建一个密钥工厂,然后用它把DESKeySpec转换成SecretKey对象
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES); SecretKeyFactory keyFactory = SecretKeyFactory.getInstance(DES);
SecretKey securekey = keyFactory.generateSecret(dks); SecretKey securekey = keyFactory.generateSecret(dks);
// Cipher对象实际完成解密操作 // Cipher对象实际完成解密操作
Cipher cipher = Cipher.getInstance(DES); Cipher cipher = Cipher.getInstance(DES);
// 用密钥初始化Cipher对象 // 用密钥初始化Cipher对象
cipher.init(Cipher.DECRYPT_MODE, securekey, sr); cipher.init(Cipher.DECRYPT_MODE, securekey, sr);
return cipher.doFinal(data); return cipher.doFinal(data);
@@ -106,7 +106,7 @@ public class DesUtils {
/** /**
* Description 获取字符串MD5值 * Description 获取字符串MD5值
* @param sourceStr * @param sourceStr
*/ */
private static String MD5(String sourceStr) { private static String MD5(String sourceStr) {
@@ -137,12 +137,12 @@ public class DesUtils {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
String data = "18616348076_1234561"; String data = "18616348076_1234561";
String key = "fangjia_pds_goojia"; //秘钥 String key = "fangjia_pds_goojia"; //秘钥
String encode = encrypt(data, key); String encode = encrypt(data, key);
System.err.println("加密:"+encode); System.err.println("加密:"+encode);
System.err.println("加密encode:"+URLEncoder.encode(encode, "utf-8")); System.err.println("加密encode:"+URLEncoder.encode(encode, "utf-8"));
System.err.println("加密decode:"+URLDecoder.decode(URLEncoder.encode(encode, "utf-8"), "utf-8")); System.err.println("加密decode:"+URLDecoder.decode(URLEncoder.encode(encode, "utf-8"), "utf-8"));
String dcode = decrypt(encode, key); String dcode = decrypt(encode, key);
System.err.println("解密:"+dcode); System.err.println("解密:"+dcode);
} }
} }
@@ -14,68 +14,68 @@ import com.fangjia.service.bo.DistrictStatRentBo;
public class DistrictScoreUtil { public class DistrictScoreUtil {
/** /**
* 城市平均租金(确认) * 城市平均租金(确认)
*/ */
private final static int CITY_AVG_RENT_PRICE = 5847; private final static int CITY_AVG_RENT_PRICE = 5847;
/** /**
* 市均餐饮人均消费(确认) * 市均餐饮人均消费(确认)
*/ */
private final static int CITY_AVG_CONSUMPTION = 50; private final static int CITY_AVG_CONSUMPTION = 50;
/** /**
* 上月房源平均发布量(确认) * 上月房源平均发布量(确认)
* modify by shibb 2015-6-18 * modify by shibb 2015-6-18
*/ */
// private final static int LAST_MONTH_HOUSES_AVG = 200; // private final static int LAST_MONTH_HOUSES_AVG = 200;
private final static int LAST_MONTH_HOUSES_AVG = 65; private final static int LAST_MONTH_HOUSES_AVG = 65;
/** /**
* 半年房源平均发布量(确认) * 半年房源平均发布量(确认)
*/ */
private final static int HALF_YEAR_HOUSES_AVG = 1000; private final static int HALF_YEAR_HOUSES_AVG = 1000;
/** /**
* 市均容积率(确认) * 市均容积率(确认)
*/ */
private final static double CITY_AVG_CUBAGE_PERCENT = 2.0; private final static double CITY_AVG_CUBAGE_PERCENT = 2.0;
/** /**
* 市均绿化率(确认) * 市均绿化率(确认)
*/ */
private final static double CITY_AVG_VIRESCENCE_PERCENT = 40; private final static double CITY_AVG_VIRESCENCE_PERCENT = 40;
/** /**
* 城市户均占地面积(确认) * 城市户均占地面积(确认)
*/ */
private final static double CITY_AVG_HOUSEHOLD_ALLAREA = 50; private final static double CITY_AVG_HOUSEHOLD_ALLAREA = 50;
/** /**
* 城市户均建筑面积(确认) * 城市户均建筑面积(确认)
*/ */
private final static double CITY_AVG_HOUSEHOLD_BUILDAREA = 100; private final static double CITY_AVG_HOUSEHOLD_BUILDAREA = 100;
/** /**
* 市均停车位(确认) * 市均停车位(确认)
*/ */
private final static double CITY_AVG_CAR_SITE = 300; private final static double CITY_AVG_CAR_SITE = 300;
/** /**
* 市均物业费(确认) * 市均物业费(确认)
*/ */
private final static double CITY_AVG_ESTATE_CHARGE = 1.59; private final static double CITY_AVG_ESTATE_CHARGE = 1.59;
/** /**
* 稀缺度指数中关注度所占比重 * 稀缺度指数中关注度所占比重
*/ */
private final static int ATTENTION_RATIO = 7; private final static int ATTENTION_RATIO = 7;
/** /**
* 稀缺度指数中挂牌量所占比重 * 稀缺度指数中挂牌量所占比重
*/ */
private final static int HOT_RATIO = 3; private final static int HOT_RATIO = 3;
/** /**
* 房价指数 * 房价指数
* modify by shibb 2015-6-19 * modify by shibb 2015-6-19
*/ */
public static double priceScore(Integer districtPrice, Integer cityPrice, Integer leave, List<DistrictStatRentBo> rentBos) { public static double priceScore(Integer districtPrice, Integer cityPrice, Integer leave, List<DistrictStatRentBo> rentBos) {
@@ -184,11 +184,11 @@ public class DistrictScoreUtil {
} }
/** /**
* 新的计算房价指数的方法 * 新的计算房价指数的方法
* *
* @param districtAvgPrice 小区均价 * @param districtAvgPrice 小区均价
* @param cityAvgPrice * @param cityAvgPrice
* @param mPrice 方差 * @param mPrice 方差
* @param rentBos * @param rentBos
* @return * @return
*/ */
@@ -254,32 +254,32 @@ public class DistrictScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "属于城市中房价较低的住宅"; return "属于城市中房价较低的住宅";
case 2: case 2:
return "属于城市中房价较低的住宅"; return "属于城市中房价较低的住宅";
case 3: case 3:
return "属于城市中房价较低的住宅"; return "属于城市中房价较低的住宅";
case 4: case 4:
return "属于接近城市均价的住宅"; return "属于接近城市均价的住宅";
case 5: case 5:
return "属于接近城市均价的住宅"; return "属于接近城市均价的住宅";
case 6: case 6:
return "属于略高于城市均价的住宅"; return "属于略高于城市均价的住宅";
case 7: case 7:
return "属于城市中房价较高的住宅"; return "属于城市中房价较高的住宅";
case 8: case 8:
return "属于城市中房价较高的住宅"; return "属于城市中房价较高的住宅";
case 9: case 9:
return "属于城市中房价非常高的住宅"; return "属于城市中房价非常高的住宅";
case 10: case 10:
return "属于城市中房价非常高的住宅"; return "属于城市中房价非常高的住宅";
default: default:
return ""; return "";
} }
} }
/** /**
* 消费指数 * 消费指数
* modify by shibb 2015-6-18 * modify by shibb 2015-6-18
*/ */
public static double consumScore(Double avgConsumption, Map<String, Integer> countMap) { public static double consumScore(Double avgConsumption, Map<String, Integer> countMap) {
@@ -317,12 +317,12 @@ public class DistrictScoreUtil {
} }
} }
if (null != countMap.get("商场")) { if (null != countMap.get("商场")) {
ret += 0.2; ret += 0.2;
// if (countMap.get("商场") >= 5) { // if (countMap.get("商场") >= 5) {
// ret += 0.3; // ret += 0.3;
// } // }
if (countMap.get("商场") >= 8) { if (countMap.get("商场") >= 8) {
ret += 0.3; ret += 0.3;
} }
} }
@@ -335,48 +335,48 @@ public class DistrictScoreUtil {
ret += 0.1; ret += 0.1;
} }
} }
if (null != countMap.get("电影院")) { if (null != countMap.get("电影院")) {
ret += 0.1; ret += 0.1;
} }
if (null != countMap.get("健身中心")) { if (null != countMap.get("健身中心")) {
ret += 0.2; ret += 0.2;
} }
if (null != countMap.get("美容院")) { if (null != countMap.get("美容院")) {
ret += 0.1; ret += 0.1;
// if (countMap.get("美容院") >= 5) { // if (countMap.get("美容院") >= 5) {
// ret += 0.2; // ret += 0.2;
// } // }
if (countMap.get("美容院") >= 20) { if (countMap.get("美容院") >= 20) {
ret += 0.1; ret += 0.1;
} }
} }
if (null != countMap.get("大型超市")) { if (null != countMap.get("大型超市")) {
ret += 0.2; ret += 0.2;
} }
if (null != countMap.get("高尔夫球场")) { if (null != countMap.get("高尔夫球场")) {
ret += 0.5; ret += 0.5;
} }
if (null != countMap.get("私立学校")) { if (null != countMap.get("私立学校")) {
ret += 0.2; ret += 0.2;
if (countMap.get("私立学校") >= 5) { if (countMap.get("私立学校") >= 5) {
ret += 0.3; ret += 0.3;
} }
} }
if (null != countMap.get("整形")) { if (null != countMap.get("整形")) {
ret += 0.2; ret += 0.2;
if (countMap.get("整形") >= 3) { if (countMap.get("整形") >= 3) {
ret += 0.3; ret += 0.3;
} }
} }
if (null != countMap.get("洗浴")) { if (null != countMap.get("洗浴")) {
ret += 0.1; ret += 0.1;
} }
if (null != countMap.get("私立医院")) { if (null != countMap.get("私立医院")) {
ret += 0.2; ret += 0.2;
} }
if (null != countMap.get("星级酒店")) { if (null != countMap.get("星级酒店")) {
ret += 0.2; ret += 0.2;
// if (countMap.get("星级酒店") >= 5) { // if (countMap.get("星级酒店") >= 5) {
// ret += 0.2; // ret += 0.2;
// } // }
} }
@@ -388,44 +388,44 @@ public class DistrictScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "周边消费水平非常低,生活成<br>本低廉"; return "周边消费水平非常低,生活成<br>本低廉";
case 2: case 2:
return "周边消费水平非常低,生活成<br>本低廉"; return "周边消费水平非常低,生活成<br>本低廉";
case 3: case 3:
return "周边消费水平较低,生活成<br>本较低"; return "周边消费水平较低,生活成<br>本较低";
case 4: case 4:
return "周边消费水平较低,生活成<br>本较低"; return "周边消费水平较低,生活成<br>本较低";
case 5: case 5:
return "周边消费水平一般"; return "周边消费水平一般";
case 6: case 6:
return "周边消费水平一般"; return "周边消费水平一般";
case 7: case 7:
return "周边消费水平较高,生活成<br>本较高"; return "周边消费水平较高,生活成<br>本较高";
case 8: case 8:
return "周边消费水平较高,生活成<br>本较高"; return "周边消费水平较高,生活成<br>本较高";
case 9: case 9:
return "周边消费水平非常高,生活成<br>本昂贵"; return "周边消费水平非常高,生活成<br>本昂贵";
case 10: case 10:
return "周边消费水平非常高,生活成<br>本昂贵"; return "周边消费水平非常高,生活成<br>本昂贵";
default: default:
return ""; return "";
} }
} }
/** /**
* 环境指数计算 * 环境指数计算
* modify by shibb 2015-6-18 * modify by shibb 2015-6-18
*/ */
public static double aroundScore(Map<String, Integer> countMap) { public static double aroundScore(Map<String, Integer> countMap) {
double ret = 0d; double ret = 0d;
int schoolCount = null == countMap.get("学校") ? 0 : countMap.get("学校"); int schoolCount = null == countMap.get("学校") ? 0 : countMap.get("学校");
int hospitalCount = null == countMap.get("医院") ? 0 : countMap.get("医院"); int hospitalCount = null == countMap.get("医院") ? 0 : countMap.get("医院");
int bankCount = null == countMap.get("银行") ? 0 : countMap.get("银行"); int bankCount = null == countMap.get("银行") ? 0 : countMap.get("银行");
if (null != countMap.get("公交点")) { if (null != countMap.get("公交点")) {
int busCount = countMap.get("公交点"); int busCount = countMap.get("公交点");
if (null == countMap.get("地铁站") || countMap.get("地铁站") == 0) { if (null == countMap.get("地铁站") || countMap.get("地铁站") == 0) {
if (busCount <= 3) { if (busCount <= 3) {
ret += 1; ret += 1;
} else if (busCount <= 8) { } else if (busCount <= 8) {
@@ -438,7 +438,7 @@ public class DistrictScoreUtil {
ret += 5; ret += 5;
} }
} else { } else {
int metroCount = countMap.get("地铁站"); int metroCount = countMap.get("地铁站");
if (metroCount < 1) { if (metroCount < 1) {
if (busCount <= 3) { if (busCount <= 3) {
ret += 1; ret += 1;
@@ -490,27 +490,27 @@ public class DistrictScoreUtil {
} }
} }
if (null != countMap.get("写字楼") && countMap.get("写字楼") >= 5) { if (null != countMap.get("写字楼") && countMap.get("写字楼") >= 5) {
ret += 0.5; ret += 0.5;
} }
if (null != countMap.get("停车场")) { if (null != countMap.get("停车场")) {
ret += 0.5; ret += 0.5;
} }
// if (null != countMap.get("超市") && countMap.get("超市") >= 5) { // if (null != countMap.get("超市") && countMap.get("超市") >= 5) {
// ret += 0.5; // ret += 0.5;
// } // }
if (null != countMap.get("超市") && countMap.get("超市") >= 15) { if (null != countMap.get("超市") && countMap.get("超市") >= 15) {
ret += 0.5; ret += 0.5;
} }
// if (null != countMap.get("公园") && countMap.get("公园") >= 5) { // if (null != countMap.get("公园") && countMap.get("公园") >= 5) {
// ret += 0.5; // ret += 0.5;
// } // }
if (null != countMap.get("公园")) { if (null != countMap.get("公园")) {
ret += 0.5; ret += 0.5;
} }
//add by shibb //add by shibb
if (null != countMap.get("发电站") || null != countMap.get("变电站") || null != countMap.get("垃圾焚烧厂") || null != countMap.get("化工厂")) { if (null != countMap.get("发电站") || null != countMap.get("变电站") || null != countMap.get("垃圾焚烧厂") || null != countMap.get("化工厂")) {
ret -= 1; ret -= 1;
} }
@@ -521,32 +521,32 @@ public class DistrictScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "周边公共配套非常差,生活很不便"; return "周边公共配套非常差,生活很不便";
case 2: case 2:
return "周边公共配套非常差,生活很不便"; return "周边公共配套非常差,生活很不便";
case 3: case 3:
return "周边公共配套较差,生活较为不便"; return "周边公共配套较差,生活较为不便";
case 4: case 4:
return "周边公共配套较差,生活较为不便"; return "周边公共配套较差,生活较为不便";
case 5: case 5:
return "周边公共配套一般,生活便利<br>指数一般"; return "周边公共配套一般,生活便利<br>指数一般";
case 6: case 6:
return "周边公共配套一般,生活便利<br>指数一般"; return "周边公共配套一般,生活便利<br>指数一般";
case 7: case 7:
return "周边公共配套较成熟,生活便利"; return "周边公共配套较成熟,生活便利";
case 8: case 8:
return "周边公共配套较成熟,生活便利"; return "周边公共配套较成熟,生活便利";
case 9: case 9:
return "周边公共配套非常成熟,生活<br>很便利"; return "周边公共配套非常成熟,生活<br>很便利";
case 10: case 10:
return "周边公共配套非常成熟,生活<br>很便利"; return "周边公共配套非常成熟,生活<br>很便利";
default: default:
return ""; return "";
} }
} }
/** /**
* 小区综合指数 * 小区综合指数
*/ */
public static double detailScore(District district, SeaweedNumberic numberic) { public static double detailScore(District district, SeaweedNumberic numberic) {
double ret = 0d; double ret = 0d;
@@ -556,11 +556,11 @@ public class DistrictScoreUtil {
year = numberic.getFinishBuildYear(); year = numberic.getFinishBuildYear();
} }
// 类型 // 类型
if (StringUtils.endsWith(district.getName(), "洋房")) { if (StringUtils.endsWith(district.getName(), "洋房")) {
ret += 9; ret += 9;
} else { } else {
if (StringUtils.contains(district.getEstateType2(), "别墅")) { if (StringUtils.contains(district.getEstateType2(), "别墅")) {
if (year >= 1920 && year <= 1949) { if (year >= 1920 && year <= 1949) {
ret += 9; ret += 9;
} else { } else {
@@ -577,7 +577,7 @@ public class DistrictScoreUtil {
} }
} }
// 户均占地面积 // 户均占地面积
if (null != numberic && null != numberic.getHouseholdCount() && null != numberic.getAllArea() if (null != numberic && null != numberic.getHouseholdCount() && null != numberic.getAllArea()
&& numberic.getHouseholdCount() > 0 && numberic.getAllArea() > 0) { && numberic.getHouseholdCount() > 0 && numberic.getAllArea() > 0) {
double d = numberic.getAllArea() * 1.0 / numberic.getHouseholdCount(); double d = numberic.getAllArea() * 1.0 / numberic.getHouseholdCount();
@@ -589,7 +589,7 @@ public class DistrictScoreUtil {
} }
} }
// 户均建筑面积 // 户均建筑面积
if (null != numberic && null != numberic.getHouseholdCount() && null != numberic.getBuildArea() if (null != numberic && null != numberic.getHouseholdCount() && null != numberic.getBuildArea()
&& numberic.getHouseholdCount() > 0 && numberic.getBuildArea() > 0) { && numberic.getHouseholdCount() > 0 && numberic.getBuildArea() > 0) {
double d = numberic.getBuildArea() * 1.0 / numberic.getHouseholdCount(); double d = numberic.getBuildArea() * 1.0 / numberic.getHouseholdCount();
@@ -602,7 +602,7 @@ public class DistrictScoreUtil {
} }
} }
// 绿化率 // 绿化率
if (null != numberic && null != numberic.getVirescencePercent()) { if (null != numberic && null != numberic.getVirescencePercent()) {
double d = numberic.getVirescencePercent(); double d = numberic.getVirescencePercent();
if (d > CITY_AVG_VIRESCENCE_PERCENT && ((d - CITY_AVG_VIRESCENCE_PERCENT) / CITY_AVG_VIRESCENCE_PERCENT > 0.2)) { if (d > CITY_AVG_VIRESCENCE_PERCENT && ((d - CITY_AVG_VIRESCENCE_PERCENT) / CITY_AVG_VIRESCENCE_PERCENT > 0.2)) {
@@ -612,7 +612,7 @@ public class DistrictScoreUtil {
} }
} }
// 容积率 // 容积率
if (null != numberic && null != numberic.getCubagePercent()) { if (null != numberic && null != numberic.getCubagePercent()) {
double d = numberic.getCubagePercent(); double d = numberic.getCubagePercent();
if (d > CITY_AVG_CUBAGE_PERCENT && ((d - CITY_AVG_CUBAGE_PERCENT) / CITY_AVG_CUBAGE_PERCENT > 0.2)) { if (d > CITY_AVG_CUBAGE_PERCENT && ((d - CITY_AVG_CUBAGE_PERCENT) / CITY_AVG_CUBAGE_PERCENT > 0.2)) {
@@ -622,7 +622,7 @@ public class DistrictScoreUtil {
} }
} }
// 停车位 // 停车位
if (null != numberic && null != numberic.getCarSiteCount()) { if (null != numberic && null != numberic.getCarSiteCount()) {
double d = numberic.getCarSiteCount(); double d = numberic.getCarSiteCount();
if (d > CITY_AVG_CAR_SITE && ((d - CITY_AVG_CAR_SITE) / CITY_AVG_CAR_SITE > 0.2)) { if (d > CITY_AVG_CAR_SITE && ((d - CITY_AVG_CAR_SITE) / CITY_AVG_CAR_SITE > 0.2)) {
@@ -639,7 +639,7 @@ public class DistrictScoreUtil {
ret += 0.5; ret += 0.5;
} }
// 物业费 // 物业费
if (null != numberic && null != numberic.getEstateCharge()) { if (null != numberic && null != numberic.getEstateCharge()) {
double d = numberic.getEstateCharge(); double d = numberic.getEstateCharge();
if (d > CITY_AVG_ESTATE_CHARGE && ((d - CITY_AVG_ESTATE_CHARGE) * 1.0 / CITY_AVG_ESTATE_CHARGE > 0.2)) { if (d > CITY_AVG_ESTATE_CHARGE && ((d - CITY_AVG_ESTATE_CHARGE) * 1.0 / CITY_AVG_ESTATE_CHARGE > 0.2)) {
@@ -656,32 +656,32 @@ public class DistrictScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "属于城市的普通住宅"; return "属于城市的普通住宅";
case 2: case 2:
return "属于城市的普通住宅"; return "属于城市的普通住宅";
case 3: case 3:
return "属于城市的普通住宅"; return "属于城市的普通住宅";
case 4: case 4:
return "属于城市的普通住宅"; return "属于城市的普通住宅";
case 5: case 5:
return "属于城市的普通住宅"; return "属于城市的普通住宅";
case 6: case 6:
return "属于城市的普通住宅"; return "属于城市的普通住宅";
case 7: case 7:
return "属于城市的优质住宅"; return "属于城市的优质住宅";
case 8: case 8:
return "属于城市的优质住宅"; return "属于城市的优质住宅";
case 9: case 9:
return "属于城市的高端住宅"; return "属于城市的高端住宅";
case 10: case 10:
return "属于城市的高端住宅"; return "属于城市的高端住宅";
default: default:
return ""; return "";
} }
} }
/** /**
* 户均占地面积 * 户均占地面积
*/ */
public static double detailScore1(Integer householdCount, Integer allArea) { public static double detailScore1(Integer householdCount, Integer allArea) {
if (null == householdCount || null == allArea || householdCount <= 0 || allArea <= 0) { if (null == householdCount || null == allArea || householdCount <= 0 || allArea <= 0) {
@@ -705,7 +705,7 @@ public class DistrictScoreUtil {
} }
/** /**
* 户均建筑面积 * 户均建筑面积
*/ */
public static double detailScore2(Integer householdCount, Integer buildArea) { public static double detailScore2(Integer householdCount, Integer buildArea) {
if (null == householdCount || null == buildArea || householdCount <= 0 || buildArea <= 0) { if (null == householdCount || null == buildArea || householdCount <= 0 || buildArea <= 0) {
@@ -729,7 +729,7 @@ public class DistrictScoreUtil {
} }
/** /**
* 绿化率 * 绿化率
*/ */
public static double detailScore3(Double virescencePercent) { public static double detailScore3(Double virescencePercent) {
if (null == virescencePercent) { if (null == virescencePercent) {
@@ -752,7 +752,7 @@ public class DistrictScoreUtil {
} }
/** /**
* 容积率 * 容积率
*/ */
public static double detailScore4(Double cubagePercent) { public static double detailScore4(Double cubagePercent) {
if (null == cubagePercent) { if (null == cubagePercent) {
@@ -777,13 +777,13 @@ public class DistrictScoreUtil {
} }
/** /**
* 停车位 * 停车位
*/ */
public static double detailScore5(String buildType, Integer carSiteCount) { public static double detailScore5(String buildType, Integer carSiteCount) {
if (StringUtils.isNotBlank(buildType)) { if (StringUtils.isNotBlank(buildType)) {
buildType = buildType.replaceAll(",", ""); buildType = buildType.replaceAll(",", "");
if ("独栋".equals(buildType) || "双拼".equals(buildType) || "联排".equals(buildType) || "叠加".equals(buildType) if ("独栋".equals(buildType) || "双拼".equals(buildType) || "联排".equals(buildType) || "叠加".equals(buildType)
|| "花园洋房".equals(buildType) || "老洋房".equals(buildType) || "四合院".equals(buildType)) { || "花园洋房".equals(buildType) || "老洋房".equals(buildType) || "四合院".equals(buildType)) {
return 9d; return 9d;
} }
} }
@@ -810,8 +810,8 @@ public class DistrictScoreUtil {
} }
/** /**
* 潜力指数 * 潜力指数
* 稀缺指数 * 稀缺指数
* modify by shibb * modify by shibb
*/ */
public static double rankScore(int regionClickRank, int regionDistrictCount, int lastMonthHouses, int halfYearHouse) { public static double rankScore(int regionClickRank, int regionDistrictCount, int lastMonthHouses, int halfYearHouse) {
@@ -897,7 +897,7 @@ public class DistrictScoreUtil {
// ret -= 1; // ret -= 1;
// } // }
//regionDistrictCount小区平均关注度 //regionDistrictCount小区平均关注度
if (regionClickRank > regionDistrictCount) { if (regionClickRank > regionDistrictCount) {
double d = (regionClickRank - regionDistrictCount) * 1.0 / regionDistrictCount; double d = (regionClickRank - regionDistrictCount) * 1.0 / regionDistrictCount;
if (d > 0.3) { if (d > 0.3) {
@@ -914,8 +914,8 @@ public class DistrictScoreUtil {
} }
/** /**
* 潜力指数 * 潜力指数
* 稀缺指数 * 稀缺指数
* add by shibb * add by shibb
*/ */
public static double rankScore2(double hotRatio, double attentionRatio) { public static double rankScore2(double hotRatio, double attentionRatio) {
@@ -927,27 +927,27 @@ public class DistrictScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 0: case 0:
return "市场上有大量挂牌房源"; return "市场上有大量挂牌房源";
case 1: case 1:
return "市场上有大量挂牌房源"; return "市场上有大量挂牌房源";
case 2: case 2:
return "市场上有大量挂牌房源"; return "市场上有大量挂牌房源";
case 3: case 3:
return "挂牌房源量较充足"; return "挂牌房源量较充足";
case 4: case 4:
return "挂牌房源量较充足"; return "挂牌房源量较充足";
case 5: case 5:
return "挂牌房源量一般"; return "挂牌房源量一般";
case 6: case 6:
return "挂牌房源量一般"; return "挂牌房源量一般";
case 7: case 7:
return "市场上房源较稀缺"; return "市场上房源较稀缺";
case 8: case 8:
return "市场上房源较稀缺"; return "市场上房源较稀缺";
case 9: case 9:
return "市场上房源非常稀缺"; return "市场上房源非常稀缺";
case 10: case 10:
return "市场上房源非常稀缺"; return "市场上房源非常稀缺";
default: default:
return ""; return "";
} }
@@ -997,23 +997,23 @@ public class DistrictScoreUtil {
case 1: case 1:
return ""; return "";
case 2: case 2:
return "房价跌幅明显,预计升值能力较弱"; return "房价跌幅明显,预计升值能力较弱";
case 3: case 3:
return "房价跌幅较明显,预计升值能力较弱"; return "房价跌幅较明显,预计升值能力较弱";
case 4: case 4:
return "房价走势较为平稳,预计未来<br>波动不大"; return "房价走势较为平稳,预计未来<br>波动不大";
case 5: case 5:
return "房价走势平稳,预计未来波动不大"; return "房价走势平稳,预计未来波动不大";
case 6: case 6:
return "房价走势较为平稳,预计未来<br>波动不大"; return "房价走势较为平稳,预计未来<br>波动不大";
case 7: case 7:
return "房价涨幅明显,未来走势理想"; return "房价涨幅明显,未来走势理想";
case 8: case 8:
return "房价涨幅明显,未来走势理想"; return "房价涨幅明显,未来走势理想";
case 9: case 9:
return "房价涨幅较高,未来走势乐观"; return "房价涨幅较高,未来走势乐观";
case 10: case 10:
return "房价涨幅较高,未来走势乐观"; return "房价涨幅较高,未来走势乐观";
default: default:
return ""; return "";
} }
@@ -1024,7 +1024,7 @@ public class DistrictScoreUtil {
if (StringUtils.isBlank(date)) { if (StringUtils.isBlank(date)) {
return 0; return 0;
} }
Pattern p = Pattern.compile("(\\d{4})[-|年|.]?(\\d{1,2})?[-|月|.]?(\\d{1,2})?日?"); Pattern p = Pattern.compile("(\\d{4})[-|年|.]?(\\d{1,2})?[-|月|.]?(\\d{1,2})?日?");
Matcher m = p.matcher(date); Matcher m = p.matcher(date);
Integer year = 0; Integer year = 0;
if (m.find()) { if (m.find()) {
@@ -12,52 +12,52 @@ import com.fangjia.service.bo.DistrictStatBo;
public class ShopScoreUtil { public class ShopScoreUtil {
/** /**
* 市均停车位(确认) * 市均停车位(确认)
*/ */
private final static int CITY_AVG_CAR_SITE_COUNT = 683; private final static int CITY_AVG_CAR_SITE_COUNT = 683;
/** /**
* 市均餐饮人均消费(确认) * 市均餐饮人均消费(确认)
*/ */
private final static int CITY_AVG_CONSUMPTION = 50; private final static int CITY_AVG_CONSUMPTION = 50;
/** /**
* 市均商场建筑规模(面积)(确认) * 市均商场建筑规模(面积)(确认)
*/ */
private final static int CITY_AVG_MALL_AREA = 119250; private final static int CITY_AVG_MALL_AREA = 119250;
/** /**
* 市均居民人口密度(确认) * 市均居民人口密度(确认)
*/ */
//private final static double CITY_AVG_HOUSE_DENSITY = 3030; //private final static double CITY_AVG_HOUSE_DENSITY = 3030;
private final static double CITY_AVG_HOUSE_DENSITY = 3631; private final static double CITY_AVG_HOUSE_DENSITY = 3631;
/** /**
* 市均办公人口密度(确认) * 市均办公人口密度(确认)
*/ */
//private final static double CITY_AVG_OFFICE_DENSITY = 3030; //private final static double CITY_AVG_OFFICE_DENSITY = 3030;
private final static double CITY_AVG_OFFICE_DENSITY = 3631; private final static double CITY_AVG_OFFICE_DENSITY = 3631;
/** /**
* 市均商场竣工年份(确认) * 市均商场竣工年份(确认)
*/ */
private final static int CITY_AVG_FINISH_YAER = 2007; private final static int CITY_AVG_FINISH_YAER = 2007;
/** /**
* 市均商场物业费(确认) * 市均商场物业费(确认)
*/ */
private final static double CITY_AVG_ESTATE_CHARGE = 3.57; private final static double CITY_AVG_ESTATE_CHARGE = 3.57;
/** /**
* 地段指数 * 地段指数
*/ */
public static double localScore(String loopLineInfo, int metros, int buses) { public static double localScore(String loopLineInfo, int metros, int buses) {
double ret = 0d; double ret = 0d;
if ("内环以内".equals(loopLineInfo)) { if ("内环以内".equals(loopLineInfo)) {
ret += 8; ret += 8;
} else if ("中内之间".equals(loopLineInfo) || "中内环间".equals(loopLineInfo)) { } else if ("中内之间".equals(loopLineInfo) || "中内环间".equals(loopLineInfo)) {
ret += 6; ret += 6;
} else if ("中外之间".equals(loopLineInfo) || "中外环间".equals(loopLineInfo)) { } else if ("中外之间".equals(loopLineInfo) || "中外环间".equals(loopLineInfo)) {
ret += 5; ret += 5;
} else if ("外环以外".equals(loopLineInfo)) { } else if ("外环以外".equals(loopLineInfo)) {
ret += 4; ret += 4;
} else { } else {
ret += 3; ret += 3;
@@ -69,8 +69,8 @@ public class ShopScoreUtil {
ret += 0.5; ret += 0.5;
} }
// TODO 板块 // TODO 板块
// TODO A类+1,B类+0.5 // TODO A类+1,B类+0.5
return ret > 10 ? 10 : ret; return ret > 10 ? 10 : ret;
} }
@@ -79,32 +79,32 @@ public class ShopScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "位于城市中偏远的地段"; return "位于城市中偏远的地段";
case 2: case 2:
return "位于城市中偏远的地段"; return "位于城市中偏远的地段";
case 3: case 3:
return "位于城市中较偏远的地段"; return "位于城市中较偏远的地段";
case 4: case 4:
return "位于城市中较偏远的地段"; return "位于城市中较偏远的地段";
case 5: case 5:
return "位于城市中普通地段"; return "位于城市中普通地段";
case 6: case 6:
return "位于城市中普通地段"; return "位于城市中普通地段";
case 7: case 7:
return "位于城市中较好的地段"; return "位于城市中较好的地段";
case 8: case 8:
return "位于城市中较好的地段"; return "位于城市中较好的地段";
case 9: case 9:
return "位于城市中黄金地段"; return "位于城市中黄金地段";
case 10: case 10:
return "位于城市中黄金地段"; return "位于城市中黄金地段";
default: default:
return ""; return "";
} }
} }
/** /**
* 地段指数--公共交通 * 地段指数--公共交通
*/ */
public static double localScore1(int metroCount, int busCount) { public static double localScore1(int metroCount, int busCount) {
if (metroCount > 2) { if (metroCount > 2) {
@@ -137,7 +137,7 @@ public class ShopScoreUtil {
} }
/** /**
* 地段指数--周边业态 * 地段指数--周边业态
*/ */
public static double localScore2(Map<String, Integer> typeCountMap) { public static double localScore2(Map<String, Integer> typeCountMap) {
double ret = 0d; double ret = 0d;
@@ -160,7 +160,7 @@ public class ShopScoreUtil {
} }
/** /**
* 消费指数 * 消费指数
*/ */
public static double consumScore(Double avgConsumption, Map<String, Integer> countMap) { public static double consumScore(Double avgConsumption, Map<String, Integer> countMap) {
double ret = 0d; double ret = 0d;
@@ -197,9 +197,9 @@ public class ShopScoreUtil {
} }
} }
if (null != countMap.get("商场")) { if (null != countMap.get("商场")) {
ret += 0.2; ret += 0.2;
if (countMap.get("商场") >= 5) { if (countMap.get("商场") >= 5) {
ret += 0.3; ret += 0.3;
} }
} }
@@ -209,45 +209,45 @@ public class ShopScoreUtil {
ret += 0.2; ret += 0.2;
} }
} }
if (null != countMap.get("电影院")) { if (null != countMap.get("电影院")) {
ret += 0.1; ret += 0.1;
} }
if (null != countMap.get("健身中心")) { if (null != countMap.get("健身中心")) {
ret += 0.2; ret += 0.2;
} }
if (null != countMap.get("美容院")) { if (null != countMap.get("美容院")) {
ret += 0.1; ret += 0.1;
if (countMap.get("美容院") >= 5) { if (countMap.get("美容院") >= 5) {
ret += 0.2; ret += 0.2;
} }
} }
if (null != countMap.get("大型超市")) { if (null != countMap.get("大型超市")) {
ret += 0.2; ret += 0.2;
} }
if (null != countMap.get("高尔夫球场")) { if (null != countMap.get("高尔夫球场")) {
ret += 0.5; ret += 0.5;
} }
if (null != countMap.get("私立学校")) { if (null != countMap.get("私立学校")) {
ret += 0.2; ret += 0.2;
if (countMap.get("私立学校") >= 5) { if (countMap.get("私立学校") >= 5) {
ret += 0.3; ret += 0.3;
} }
} }
if (null != countMap.get("整形")) { if (null != countMap.get("整形")) {
ret += 0.2; ret += 0.2;
if (countMap.get("整形") >= 5) { if (countMap.get("整形") >= 5) {
ret += 0.1; ret += 0.1;
} }
} }
if (null != countMap.get("洗浴")) { if (null != countMap.get("洗浴")) {
ret += 0.1; ret += 0.1;
} }
if (null != countMap.get("私立医院")) { if (null != countMap.get("私立医院")) {
ret += 0.2; ret += 0.2;
} }
if (null != countMap.get("星级酒店")) { if (null != countMap.get("星级酒店")) {
ret += 0.2; ret += 0.2;
if (countMap.get("星级酒店") >= 5) { if (countMap.get("星级酒店") >= 5) {
ret += 0.2; ret += 0.2;
} }
} }
@@ -259,32 +259,32 @@ public class ShopScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "周边人群消费能力弱"; return "周边人群消费能力弱";
case 2: case 2:
return "周边人群消费能力弱"; return "周边人群消费能力弱";
case 3: case 3:
return "周边人群消费能力较弱"; return "周边人群消费能力较弱";
case 4: case 4:
return "周边人群消费能力较弱"; return "周边人群消费能力较弱";
case 5: case 5:
return "周边人群消费能力一般"; return "周边人群消费能力一般";
case 6: case 6:
return "周边人群消费能力一般"; return "周边人群消费能力一般";
case 7: case 7:
return "周边人群具有一定的消费能力"; return "周边人群具有一定的消费能力";
case 8: case 8:
return "周边人群具有一定的消费能力"; return "周边人群具有一定的消费能力";
case 9: case 9:
return "周边人群具有很强的消费能力"; return "周边人群具有很强的消费能力";
case 10: case 10:
return "周边人群具有很强的消费能力"; return "周边人群具有很强的消费能力";
default: default:
return ""; return "";
} }
} }
/** /**
* 房价指数 * 房价指数
*/ */
public static double priceScore(DistrictStatBo statBo, Integer cityPrice) { public static double priceScore(DistrictStatBo statBo, Integer cityPrice) {
double ret = 0d; double ret = 0d;
@@ -350,32 +350,32 @@ public class ShopScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "属于城市中价位较低的商铺"; return "属于城市中价位较低的商铺";
case 2: case 2:
return "属于城市中价位较低的商铺"; return "属于城市中价位较低的商铺";
case 3: case 3:
return "属于城市中价位较低的商铺"; return "属于城市中价位较低的商铺";
case 4: case 4:
return "属于略低于城市均价的商铺"; return "属于略低于城市均价的商铺";
case 5: case 5:
return "属于接近城市均价的商铺"; return "属于接近城市均价的商铺";
case 6: case 6:
return "属于略高于城市均价的商铺"; return "属于略高于城市均价的商铺";
case 7: case 7:
return "属于城市中价位较高的商铺"; return "属于城市中价位较高的商铺";
case 8: case 8:
return "属于城市中价位较高的商铺"; return "属于城市中价位较高的商铺";
case 9: case 9:
return "属于城市中价位非常高的商铺"; return "属于城市中价位非常高的商铺";
case 10: case 10:
return "属于城市中价位非常高的商铺"; return "属于城市中价位非常高的商铺";
default: default:
return ""; return "";
} }
} }
/** /**
* 租金指数 * 租金指数
*/ */
public static double rentScore(DistrictBusinessStatRentBo statBo, Integer cityPrice, String paymentPattern) { public static double rentScore(DistrictBusinessStatRentBo statBo, Integer cityPrice, String paymentPattern) {
double ret = 0d; double ret = 0d;
@@ -422,7 +422,7 @@ public class ShopScoreUtil {
} }
} }
if ("押三付三".equals(paymentPattern) || "付三押三".equals(paymentPattern)) { if ("押三付三".equals(paymentPattern) || "付三押三".equals(paymentPattern)) {
ret += 0.5; ret += 0.5;
} }
} }
@@ -434,63 +434,63 @@ public class ShopScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "属于城市中租金便宜的商铺"; return "属于城市中租金便宜的商铺";
case 2: case 2:
return "属于城市中租金便宜的商铺"; return "属于城市中租金便宜的商铺";
case 3: case 3:
return "属于城市中租金较便宜的商铺"; return "属于城市中租金较便宜的商铺";
case 4: case 4:
return "属于略低于城市租金均价的商铺"; return "属于略低于城市租金均价的商铺";
case 5: case 5:
return "属于接近城市租金均价的商铺"; return "属于接近城市租金均价的商铺";
case 6: case 6:
return "属于略高于城市租金均价的商铺"; return "属于略高于城市租金均价的商铺";
case 7: case 7:
return "属于城市中租金较高的商铺"; return "属于城市中租金较高的商铺";
case 8: case 8:
return "属于城市中租金较高的商铺"; return "属于城市中租金较高的商铺";
case 9: case 9:
return "属于城市中租金昂贵的商铺"; return "属于城市中租金昂贵的商铺";
case 10: case 10:
return "属于城市中租金昂贵的商铺"; return "属于城市中租金昂贵的商铺";
default: default:
return ""; return "";
} }
} }
/** /**
* 商铺综合指数 * 商铺综合指数
*/ */
public static double detailScore(District mall, SeaweedNumberic numberic) { public static double detailScore(District mall, SeaweedNumberic numberic) {
double ret = 0d; double ret = 0d;
// 商铺类型 // 商铺类型
String estateType = mall.getEstateCharge(); String estateType = mall.getEstateCharge();
if (StringUtils.contains(estateType, "购物中心")) { if (StringUtils.contains(estateType, "购物中心")) {
ret += 8; ret += 8;
} else if (StringUtils.contains(estateType, "写字楼商铺")) { } else if (StringUtils.contains(estateType, "写字楼商铺")) {
ret += 7; ret += 7;
} else if ("专项商铺".equals(estateType)) { } else if ("专项商铺".equals(estateType)) {
ret += 6; ret += 6;
} else { } else {
ret += 5; ret += 5;
} }
// 商圈 // 商圈
String businessQuarter = mall.getBusinessQuarter(); String businessQuarter = mall.getBusinessQuarter();
// TODO A类+1,B类+0.5 // TODO A类+1,B类+0.5
if (StringUtils.isNotBlank(businessQuarter)) { if (StringUtils.isNotBlank(businessQuarter)) {
ret += 0.5; ret += 0.5;
} }
// 板块 // 板块
String block = ""; String block = "";
// TODO A类+1,B类+0.5 // TODO A类+1,B类+0.5
if (StringUtils.isNotBlank(block)) { if (StringUtils.isNotBlank(block)) {
ret += 0.5; ret += 0.5;
} }
// 建筑规模 // 建筑规模
if (null != numberic && null != numberic.getBuildArea()) { if (null != numberic && null != numberic.getBuildArea()) {
int area = numberic.getBuildArea(); int area = numberic.getBuildArea();
if (area > CITY_AVG_MALL_AREA && ((area - CITY_AVG_MALL_AREA) * 1.0 / CITY_AVG_MALL_AREA > 0.2)) { if (area > CITY_AVG_MALL_AREA && ((area - CITY_AVG_MALL_AREA) * 1.0 / CITY_AVG_MALL_AREA > 0.2)) {
@@ -500,10 +500,10 @@ public class ShopScoreUtil {
} }
} }
// 装修状况 // 装修状况
// TODO 目前没有装修字段 // TODO 目前没有装修字段
// 停车位 // 停车位
if (null != mall.getCarSiteCount()) { if (null != mall.getCarSiteCount()) {
double t = (mall.getCarSiteCount() - CITY_AVG_CAR_SITE_COUNT) * 1.0 / CITY_AVG_CAR_SITE_COUNT; double t = (mall.getCarSiteCount() - CITY_AVG_CAR_SITE_COUNT) * 1.0 / CITY_AVG_CAR_SITE_COUNT;
if (t > 0.2) { if (t > 0.2) {
@@ -513,7 +513,7 @@ public class ShopScoreUtil {
} }
} }
// 楼龄 // 楼龄
if (null != numberic && null != numberic.getFinishBuildYear()) { if (null != numberic && null != numberic.getFinishBuildYear()) {
int year = numberic.getFinishBuildYear(); int year = numberic.getFinishBuildYear();
if (year > CITY_AVG_FINISH_YAER && ((year - CITY_AVG_FINISH_YAER) * 1.0 / CITY_AVG_FINISH_YAER > 0.2)) { if (year > CITY_AVG_FINISH_YAER && ((year - CITY_AVG_FINISH_YAER) * 1.0 / CITY_AVG_FINISH_YAER > 0.2)) {
@@ -530,7 +530,7 @@ public class ShopScoreUtil {
ret += 0.5; ret += 0.5;
} }
// 物业费 // 物业费
if (null != numberic && null != numberic.getEstateCharge()) { if (null != numberic && null != numberic.getEstateCharge()) {
double c = numberic.getEstateCharge(); double c = numberic.getEstateCharge();
if (c > CITY_AVG_ESTATE_CHARGE && ((c - CITY_AVG_ESTATE_CHARGE) * 1.0 / CITY_AVG_ESTATE_CHARGE > 0.2)) { if (c > CITY_AVG_ESTATE_CHARGE && ((c - CITY_AVG_ESTATE_CHARGE) * 1.0 / CITY_AVG_ESTATE_CHARGE > 0.2)) {
@@ -547,35 +547,35 @@ public class ShopScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "属于城市的普通商铺"; return "属于城市的普通商铺";
case 2: case 2:
return "属于城市的普通商铺"; return "属于城市的普通商铺";
case 3: case 3:
return "属于城市的普通商铺"; return "属于城市的普通商铺";
case 4: case 4:
return "属于城市的普通商铺"; return "属于城市的普通商铺";
case 5: case 5:
return "属于城市的普通商铺"; return "属于城市的普通商铺";
case 6: case 6:
return "属于城市的普通商铺"; return "属于城市的普通商铺";
case 7: case 7:
return "属于城市的优质商铺"; return "属于城市的优质商铺";
case 8: case 8:
return "属于城市的优质商铺"; return "属于城市的优质商铺";
case 9: case 9:
return "属于城市的高端商铺"; return "属于城市的高端商铺";
case 10: case 10:
return "属于城市的高端商铺"; return "属于城市的高端商铺";
default: default:
return ""; return "";
} }
} }
/** /**
* 商铺综合指数--建筑规模 * 商铺综合指数--建筑规模
*/ */
public static double detailScore1(String estateType, Integer buildArea) { public static double detailScore1(String estateType, Integer buildArea) {
if (StringUtils.contains(estateType, "购物中心")) { if (StringUtils.contains(estateType, "购物中心")) {
if (null == buildArea) { if (null == buildArea) {
return 5d; return 5d;
} }
@@ -593,9 +593,9 @@ public class ShopScoreUtil {
} else { } else {
return 5d; return 5d;
} }
} else if (StringUtils.contains(estateType, "写字楼商铺")) { } else if (StringUtils.contains(estateType, "写字楼商铺")) {
return 6d; return 6d;
} else if ("专项商铺".equals(estateType)) { } else if ("专项商铺".equals(estateType)) {
return 7d; return 7d;
} else { } else {
return 5d; return 5d;
@@ -603,15 +603,15 @@ public class ShopScoreUtil {
} }
/** /**
* 商铺综合指数--装修 * 商铺综合指数--装修
*/ */
public static double detailScore2(String estateType, String buildArea) { public static double detailScore2(String estateType, String buildArea) {
// TODO 目前没有装修字段 // TODO 目前没有装修字段
return 5d; return 5d;
} }
/** /**
* 商铺综合指数--停车位 * 商铺综合指数--停车位
*/ */
public static double detailScore3(Integer carSiteCount) { public static double detailScore3(Integer carSiteCount) {
if (null == carSiteCount) { if (null == carSiteCount) {
@@ -637,7 +637,7 @@ public class ShopScoreUtil {
} }
/** /**
* 商铺综合指数--楼龄 * 商铺综合指数--楼龄
*/ */
public static double detailScore4(Integer year) { public static double detailScore4(Integer year) {
if (null == year) { if (null == year) {
@@ -666,44 +666,44 @@ public class ShopScoreUtil {
} }
/** /**
* 环境指数--公共聚客点 * 环境指数--公共聚客点
*/ */
public static double aroundScore1(Map<String, Integer> countMap) { public static double aroundScore1(Map<String, Integer> countMap) {
double ret = 0d; double ret = 0d;
if (null != countMap.get("医院")) { if (null != countMap.get("医院")) {
ret += 1; ret += 1;
if (countMap.get("医院") >= 3) { if (countMap.get("医院") >= 3) {
ret += 0.5; ret += 0.5;
} }
} }
if (null != countMap.get("地铁站")) { if (null != countMap.get("地铁站")) {
ret += 1; ret += 1;
if (countMap.get("地铁站") >= 3) { if (countMap.get("地铁站") >= 3) {
ret += 0.5; ret += 0.5;
} }
} }
if (null != countMap.get("公交点")) { if (null != countMap.get("公交点")) {
ret += 1; ret += 1;
if (countMap.get("公交点") >= 3) { if (countMap.get("公交点") >= 3) {
ret += 0.5; ret += 0.5;
} }
} }
if (null != countMap.get("公园")) { if (null != countMap.get("公园")) {
ret += 1; ret += 1;
if (countMap.get("公园") >= 2) { if (countMap.get("公园") >= 2) {
ret += 0.5; ret += 0.5;
} }
} }
if (null != countMap.get("学校")) { if (null != countMap.get("学校")) {
ret += 1; ret += 1;
if (countMap.get("学校") >= 3) { if (countMap.get("学校") >= 3) {
ret += 0.5; ret += 0.5;
} }
} }
if (null != countMap.get("体育馆")) { if (null != countMap.get("体育馆")) {
ret += 1; ret += 1;
if (countMap.get("体育馆") >= 2) { if (countMap.get("体育馆") >= 2) {
ret += 0.5; ret += 0.5;
} }
} }
@@ -712,32 +712,32 @@ public class ShopScoreUtil {
} }
/** /**
* 环境指数--商业聚客点 * 环境指数--商业聚客点
*/ */
public static double aroundScore2(Map<String, Integer> countMap) { public static double aroundScore2(Map<String, Integer> countMap) {
double ret = 0d; double ret = 0d;
if (null != countMap.get("银行")) { if (null != countMap.get("银行")) {
ret += 1; ret += 1;
if (countMap.get("银行") >= 3) { if (countMap.get("银行") >= 3) {
ret += 0.5; ret += 0.5;
} }
} }
if (null != countMap.get("商场")) { if (null != countMap.get("商场")) {
ret += 1; ret += 1;
if (countMap.get("商场") >= 3) { if (countMap.get("商场") >= 3) {
ret += 0.5; ret += 0.5;
} }
} }
if (null != countMap.get("大型超市")) { if (null != countMap.get("大型超市")) {
ret += 1; ret += 1;
if (countMap.get("大型超市") >= 3) { if (countMap.get("大型超市") >= 3) {
ret += 0.5; ret += 0.5;
} }
} }
if (null != countMap.get("餐饮")) { if (null != countMap.get("餐饮")) {
ret += 1; ret += 1;
if (countMap.get("餐饮") >= 10) { if (countMap.get("餐饮") >= 10) {
ret += 0.5; ret += 0.5;
} }
} }
@@ -749,32 +749,32 @@ public class ShopScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "周边公共或商业配套非常差,客源稀少"; return "周边公共或商业配套非常差,客源稀少";
case 2: case 2:
return "周边公共或商业配套非常差,客源稀少"; return "周边公共或商业配套非常差,客源稀少";
case 3: case 3:
return "周边公共或商业配套较差,客源较少"; return "周边公共或商业配套较差,客源较少";
case 4: case 4:
return "周边公共或商业配套较差,客源较少"; return "周边公共或商业配套较差,客源较少";
case 5: case 5:
return "周边公共或商业配套一般,客源一般"; return "周边公共或商业配套一般,客源一般";
case 6: case 6:
return "周边公共或商业配套一般,客源一般"; return "周边公共或商业配套一般,客源一般";
case 7: case 7:
return "周边公共或商业配套较成熟,客源较丰富"; return "周边公共或商业配套较成熟,客源较丰富";
case 8: case 8:
return "周边公共或商业配套较成熟,客源较丰富"; return "周边公共或商业配套较成熟,客源较丰富";
case 9: case 9:
return "周边公共或商业配套非常成熟,客源丰富"; return "周边公共或商业配套非常成熟,客源丰富";
case 10: case 10:
return "周边公共或商业配套非常成熟,客源丰富"; return "周边公共或商业配套非常成熟,客源丰富";
default: default:
return ""; return "";
} }
} }
/** /**
* 人口指数--居民人口 * 人口指数--居民人口
*/ */
@Deprecated @Deprecated
public static double peopleScore1(double density) { public static double peopleScore1(double density) {
@@ -810,56 +810,56 @@ public class ShopScoreUtil {
} }
/** /**
* 计算居民人口密度得分 * 计算居民人口密度得分
* @author yinjihuan * @author yinjihuan
* @date 2016-03-04 * @date 2016-03-04
* @param density 居民人口密度 * @param density 居民人口密度
* @return 居民人口密度得分 * @return 居民人口密度得分
*/ */
public static double calcPeopleDensityScore(double density) { public static double calcPeopleDensityScore(double density) {
/*居民人口密度得分规则如下: /*居民人口密度得分规则如下:
10 10*市均人口密度 < 居民人口密度 10 10*市均人口密度 < 居民人口密度
9 9*市均人口密度 < 居民人口密度 <= 10*市均人口密度 9 9*市均人口密度 < 居民人口密度 <= 10*市均人口密度
8 8*市均人口密度 < 居民人口密度 <= 9*市均人口密度 8 8*市均人口密度 < 居民人口密度 <= 9*市均人口密度
7 7*市均人口密度 < 居民人口密度 <= 8*市均人口密度 7 7*市均人口密度 < 居民人口密度 <= 8*市均人口密度
6 6*市均人口密度 < 居民人口密度 <= 7*市均人口密度 6 6*市均人口密度 < 居民人口密度 <= 7*市均人口密度
5 4*市均人口密度 < 居民人口密度 <= 6*市均人口密度 5 4*市均人口密度 < 居民人口密度 <= 6*市均人口密度
4 2*市均人口密度 < 居民人口密度 <= 4*市均人口密度 4 2*市均人口密度 < 居民人口密度 <= 4*市均人口密度
3 1*市均人口密度 < 居民人口密度 <= 2*市均人口密度 3 1*市均人口密度 < 居民人口密度 <= 2*市均人口密度
2 0.5*市均人口密度 < 居民人口密度 <= 1*市均人口密度 2 0.5*市均人口密度 < 居民人口密度 <= 1*市均人口密度
1 居民人口密度 <= 0.5*市均人口密度 */ 1 居民人口密度 <= 0.5*市均人口密度 */
return doCalcDensityScore(density, CITY_AVG_HOUSE_DENSITY); return doCalcDensityScore(density, CITY_AVG_HOUSE_DENSITY);
} }
/** /**
* 计算办公人口密度得分 * 计算办公人口密度得分
* @author yinjihuan * @author yinjihuan
* @date 2016-03-04 * @date 2016-03-04
* @param density 办公人口密度 * @param density 办公人口密度
* @return 居民人口密度得分 * @return 居民人口密度得分
*/ */
public static double calcOfficeDensityScore(double density) { public static double calcOfficeDensityScore(double density) {
/*办公人口密度计算规则如下: /*办公人口密度计算规则如下:
10 10*市均办公人口密度 < 办公人口密度 10 10*市均办公人口密度 < 办公人口密度
9 9*市均办公人口密度 < 办公人口密度 <= 10*市均办公人口密度 9 9*市均办公人口密度 < 办公人口密度 <= 10*市均办公人口密度
8 8*市均办公人口密度 < 办公人口密度 <= 9*市均办公人口密度 8 8*市均办公人口密度 < 办公人口密度 <= 9*市均办公人口密度
7 7*市均办公人口密度 < 办公人口密度 <= 8*市均办公人口密度 7 7*市均办公人口密度 < 办公人口密度 <= 8*市均办公人口密度
6 6*市均办公人口密度 < 办公人口密度 <= 7*市均办公人口密度 6 6*市均办公人口密度 < 办公人口密度 <= 7*市均办公人口密度
5 4*市均办公人口密度 < 办公人口密度 <= 6*市均办公人口密度 5 4*市均办公人口密度 < 办公人口密度 <= 6*市均办公人口密度
4 2*市均办公人口密度 < 办公人口密度 <= 4*市均办公人口密度 4 2*市均办公人口密度 < 办公人口密度 <= 4*市均办公人口密度
3 1*市均办公人口密度 < 办公人口密度 <= 2*市均办公人口密度 3 1*市均办公人口密度 < 办公人口密度 <= 2*市均办公人口密度
2 0.5*市均办公人口密度 < 办公人口密度 <= 1*市均办公人口密度 2 0.5*市均办公人口密度 < 办公人口密度 <= 1*市均办公人口密度
1 办公人口密度 <= 0.5*市均办公人口密度 */ 1 办公人口密度 <= 0.5*市均办公人口密度 */
return doCalcDensityScore(density, CITY_AVG_OFFICE_DENSITY); return doCalcDensityScore(density, CITY_AVG_OFFICE_DENSITY);
} }
/** /**
* 计算密度得分 * 计算密度得分
* @param density 密度 * @param density 密度
* @param cityAvgDensity 市平均密度 * @param cityAvgDensity 市平均密度
* @return * @return
*/ */
private static double doCalcDensityScore(double density, double cityAvgDensity) { private static double doCalcDensityScore(double density, double cityAvgDensity) {
@@ -917,7 +917,7 @@ public class ShopScoreUtil {
} }
/** /**
* 人口指数--办公人口 * 人口指数--办公人口
*/ */
@Deprecated @Deprecated
public static double peopleScore2(double density) { public static double peopleScore2(double density) {
@@ -991,25 +991,25 @@ public class ShopScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "人流量稀少"; return "人流量稀少";
case 2: case 2:
return "人流量稀少"; return "人流量稀少";
case 3: case 3:
return "人流量较少"; return "人流量较少";
case 4: case 4:
return "人流量较少"; return "人流量较少";
case 5: case 5:
return "人流量一般"; return "人流量一般";
case 6: case 6:
return "人流量一般"; return "人流量一般";
case 7: case 7:
return "人流量较大"; return "人流量较大";
case 8: case 8:
return "人流量较大"; return "人流量较大";
case 9: case 9:
return "人流量庞大"; return "人流量庞大";
case 10: case 10:
return "人流量庞大"; return "人流量庞大";
default: default:
return ""; return "";
} }
@@ -21,17 +21,17 @@ public class Test {
g2d.dispose(); g2d.dispose();
g2d = image.createGraphics(); g2d = image.createGraphics();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(new Color(178,178,178));//改变扇形颜色 g2d.setColor(new Color(178,178,178));//改变扇形颜色
g2d.fillArc(0,0,400,400,90,360); g2d.fillArc(0,0,400,400,90,360);
g2d.setColor(new Color(0,115,230));//改变扇形颜色 g2d.setColor(new Color(0,115,230));//改变扇形颜色
g2d.fillArc(0,0,400,400,90,180); g2d.fillArc(0,0,400,400,90,180);
g2d.setColor(new Color(229,229,229));//改变扇形颜色 g2d.setColor(new Color(229,229,229));//改变扇形颜色
g2d.fillArc(40,40,320,320,90,360); g2d.fillArc(40,40,320,320,90,360);
g2d.setColor(new Color(0,115,230)); g2d.setColor(new Color(0,115,230));
g2d.setFont(new Font("宋体",Font.BOLD,120)); g2d.setFont(new Font("宋体",Font.BOLD,120));
g2d.drawString("4分",126,250); g2d.drawString("4分",126,250);
g2d.dispose(); g2d.dispose();
ImageIO.write(image, "png", new File("D:/test.png")); ImageIO.write(image, "png", new File("D:/test.png"));
} }
@@ -30,7 +30,7 @@ public class ChafangtongContextLoaderListener extends ContextLoaderListener {
} }
super.contextInitialized(event); super.contextInitialized(event);
// Ф¤ИИ // 预热
if (LOGGER.isInfoEnabled()) { if (LOGGER.isInfoEnabled()) {
LOGGER.info("warm up keyword links..."); LOGGER.info("warm up keyword links...");
} }
@@ -30,7 +30,7 @@ import com.fangjia.dal.seaweed.model.District;
import com.fangjia.service.mongo.fangjia.BusStationService; import com.fangjia.service.mongo.fangjia.BusStationService;
/** /**
* 环境指数 * 环境指数
* @author yk * @author yk
* *
*/ */
@@ -54,13 +54,13 @@ public class AroundController extends BaseController {
double lng = district.getLng2()/10000000000d; double lng = district.getLng2()/10000000000d;
double radius = getRadius(); double radius = getRadius();
Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius); Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius);
model.setMetroStations(stationMap.get("地铁")); model.setMetroStations(stationMap.get("地铁"));
model.setBusStations(stationMap.get("公交")); model.setBusStations(stationMap.get("公交"));
String[] ks = new String[] { "医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园", "机场", "网吧" }; String[] ks = new String[] { "医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园", "机场", "网吧" };
//厌恶设施 //厌恶设施
String[] keys = new String[]{"发电厂","变电站","垃圾焚烧厂","化工厂"}; String[] keys = new String[]{"发电厂","变电站","垃圾焚烧厂","化工厂"};
Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length); Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
@@ -71,24 +71,24 @@ public class AroundController extends BaseController {
JSONObject json = baiduApiService.searchNearby(keys[i], lat, lng, 1000, model.getBaiduMapKey()); JSONObject json = baiduApiService.searchNearby(keys[i], lat, lng, 1000, model.getBaiduMapKey());
countMap.put(keys[i], getTotal(json)); countMap.put(keys[i], getTotal(json));
} }
countMap.put("地铁站", null == model.getMetroStations() ? null : model.getMetroStations().size()); countMap.put("地铁站", null == model.getMetroStations() ? null : model.getMetroStations().size());
countMap.put("公交点", null == model.getBusStations() ? null : model.getBusStations().size()); countMap.put("公交点", null == model.getBusStations() ? null : model.getBusStations().size());
// 虹桥机场 121.352578,31.200062 // 虹桥机场 121.352578,31.200062
// 浦东机场 121.807085,31.160702 // 浦东机场 121.807085,31.160702
double dis = GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062); double dis = GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062);
if (dis <= radius) { if (dis <= radius) {
model.setAirPort("虹桥机场"); model.setAirPort("虹桥机场");
model.setAirPortLat(31.200062); model.setAirPortLat(31.200062);
model.setAirPortLng(121.352578); model.setAirPortLng(121.352578);
countMap.put("机场", 1); countMap.put("机场", 1);
} else { } else {
dis = GeoUtils.calculateDistance(lng, lat, 121.807085, 31.160702); dis = GeoUtils.calculateDistance(lng, lat, 121.807085, 31.160702);
if (dis <= radius) { if (dis <= radius) {
model.setAirPort("浦东机场"); model.setAirPort("浦东机场");
model.setAirPortLat(31.160702); model.setAirPortLat(31.160702);
model.setAirPortLng(121.807085); model.setAirPortLng(121.807085);
countMap.put("机场", 1); countMap.put("机场", 1);
} }
} }
@@ -120,22 +120,22 @@ public class AroundController extends BaseController {
double lng = mall.getLng2()/10000000000d; double lng = mall.getLng2()/10000000000d;
double radius = getRadius(); double radius = getRadius();
Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius); Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius);
model.setMetroStations(stationMap.get("地铁")); model.setMetroStations(stationMap.get("地铁"));
model.setBusStations(stationMap.get("公交")); model.setBusStations(stationMap.get("公交"));
String[] ks = new String[] { "医院", "公园", "学校", "体育馆" }; String[] ks = new String[] { "医院", "公园", "学校", "体育馆" };
Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length); Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
JSONObject json = baiduApiService.searchNearby(ks[i], lat, lng, radius, model.getBaiduMapKey()); JSONObject json = baiduApiService.searchNearby(ks[i], lat, lng, radius, model.getBaiduMapKey());
countMap.put(ks[i], getTotal(json)); countMap.put(ks[i], getTotal(json));
} }
countMap.put("地铁站", null == model.getMetroStations() ? null : model.getMetroStations().size()); countMap.put("地铁站", null == model.getMetroStations() ? null : model.getMetroStations().size());
countMap.put("公交点", null == model.getBusStations() ? null : model.getBusStations().size()); countMap.put("公交点", null == model.getBusStations() ? null : model.getBusStations().size());
double score1 = ShopScoreUtil.aroundScore1(countMap); double score1 = ShopScoreUtil.aroundScore1(countMap);
model.setScore1(score1); model.setScore1(score1);
ks = new String[] { "银行", "商场", "大型超市", "餐饮" }; ks = new String[] { "银行", "商场", "大型超市", "餐饮" };
countMap = new HashMap<String, Integer>(ks.length); countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
JSONObject json = baiduApiService.searchNearby(ks[i], lat, lng, radius, model.getBaiduMapKey()); JSONObject json = baiduApiService.searchNearby(ks[i], lat, lng, radius, model.getBaiduMapKey());
@@ -123,7 +123,7 @@ public class AutocompleteController {
//nameQuery.add(new TermQuery(new Term("address", keyword)), Occur.SHOULD); //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("addr_alias_std", keyword)), Occur.SHOULD);
nameQuery.add(new TermQuery(new Term("keyword", 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); srQuery1.add(nameQuery, Occur.SHOULD);
params.add(new QueryParam("$sr", new SrQuery(srQuery1))); params.add(new QueryParam("$sr", new SrQuery(srQuery1)));
List<District> districts = districtService.findAllByParams(params, 0, limit, new String[] { "region", "name","address", "addrAlias" }); List<District> districts = districtService.findAllByParams(params, 0, limit, new String[] { "region", "name","address", "addrAlias" });
@@ -138,7 +138,7 @@ public class AutocompleteController {
bo.setRegion(district.getRegion()); bo.setRegion(district.getRegion());
ret.add(bo); ret.add(bo);
} }
//对自动完成出来的结果按长短排序 //对自动完成出来的结果按长短排序
if(ret.size() > 0){ if(ret.size() > 0){
Collections.sort(ret, new Comparator<AutoCompleteBo>() { Collections.sort(ret, new Comparator<AutoCompleteBo>() {
public int compare(AutoCompleteBo o1, AutoCompleteBo o2) { public int compare(AutoCompleteBo o1, AutoCompleteBo o2) {
@@ -104,16 +104,16 @@ public abstract class BaseController {
} }
/** /**
* 根据cookie或者用户输入关键字,填充经纬度、mall信息到cookie和model * 根据cookie或者用户输入关键字,填充经纬度、mall信息到cookie和model
*/ */
protected void fillShop2CookieModel(ChafangtongModel model) { protected void fillShop2CookieModel(ChafangtongModel model) {
// TODO 不用每次都去seaweed查询mall,可根据是否是新提交表单、存下的mallid来查,优化性能 // TODO 不用每次都去seaweed查询mall,可根据是否是新提交表单、存下的mallid来查,优化性能
HttpServletResponse response = ActionContext.getContext().getResponse(); HttpServletResponse response = ActionContext.getContext().getResponse();
String keyword = model.getQ(); String keyword = model.getQ();
if (StringUtils.isNotBlank(keyword)) { if (StringUtils.isNotBlank(keyword)) {
Shop mall = null; Shop mall = null;
// open地址匹配 // open地址匹配
Map<String, Object> resMap = addressService.parse(model.getCityName(), keyword, "shop", false); Map<String, Object> resMap = addressService.parse(model.getCityName(), keyword, "shop", false);
if (MapUtils.isNotEmpty(resMap)) { if (MapUtils.isNotEmpty(resMap)) {
if (resMap.containsKey("status") && (Integer) resMap.get("status") == 0 && resMap.containsKey("precise") if (resMap.containsKey("status") && (Integer) resMap.get("status") == 0 && resMap.containsKey("precise")
@@ -124,14 +124,14 @@ public abstract class BaseController {
} }
if ("general".equals(model.getControllerName())) { if ("general".equals(model.getControllerName())) {
// 记录用户搜索词open匹配结果 // 记录用户搜索词open匹配结果
HttpServletRequest request = ActionContext.getContext().getRequest(); HttpServletRequest request = ActionContext.getContext().getRequest();
AddressMatchLog addressMatchLog = new AddressMatchLog(); AddressMatchLog addressMatchLog = new AddressMatchLog();
addressMatchLog.setCity(model.getCityName()); addressMatchLog.setCity(model.getCityName());
addressMatchLog.setInput(model.getQ()); addressMatchLog.setInput(model.getQ());
addressMatchLog.setIp(AnalyticsUtil.getIpAddress(request)); addressMatchLog.setIp(AnalyticsUtil.getIpAddress(request));
addressMatchLog.setUid(cookieContext.getCookieValue(request, "fpk_uid")); addressMatchLog.setUid(cookieContext.getCookieValue(request, "fpk_uid"));
addressMatchLog.setSource("房评卡"); addressMatchLog.setSource("房评卡");
addressMatchLog.setUserName(cookieContext.getCookieValue(request, "fpk_name")); addressMatchLog.setUserName(cookieContext.getCookieValue(request, "fpk_name"));
addressMatchLog.setCreationDate(new Date()); addressMatchLog.setCreationDate(new Date());
addressMatchLog.setModificationDate(new Date()); addressMatchLog.setModificationDate(new Date());
@@ -203,7 +203,7 @@ public abstract class BaseController {
} }
protected void fillDistrict2CookieModel(ChafangtongModel model) { protected void fillDistrict2CookieModel(ChafangtongModel model) {
// TODO 不用每次都去seaweed查询district,可根据是否是新提交表单、存下的districtid来查,优化性能 // TODO 不用每次都去seaweed查询district,可根据是否是新提交表单、存下的districtid来查,优化性能
HttpServletResponse response = ActionContext.getContext().getResponse(); HttpServletResponse response = ActionContext.getContext().getResponse();
String keyword = model.getQ(); String keyword = model.getQ();
if (StringUtils.isNotBlank(keyword)) { if (StringUtils.isNotBlank(keyword)) {
@@ -31,7 +31,7 @@ import com.fangjia.dal.seaweed.model.District;
import com.fangjia.service.mongo.fangjia.BizShopService; import com.fangjia.service.mongo.fangjia.BizShopService;
/** /**
* 消费指数 * 消费指数
* @author yk * @author yk
* *
*/ */
@@ -54,7 +54,7 @@ public class ConsumController extends BaseController {
double lat = district.getLat2()/10000000000d; double lat = district.getLat2()/10000000000d;
double lng = district.getLng2()/10000000000d; double lng = district.getLng2()/10000000000d;
double radius = getRadius(); double radius = getRadius();
model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "美食")); model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "美食"));
double cityConsumMin = model.getCityConsumMin()!=null?model.getCityConsumMin():15; double cityConsumMin = model.getCityConsumMin()!=null?model.getCityConsumMin():15;
double cityConsumMax = model.getCityConsumMax()!=null?model.getCityConsumMax():150; double cityConsumMax = model.getCityConsumMax()!=null?model.getCityConsumMax():150;
@@ -62,7 +62,7 @@ public class ConsumController extends BaseController {
model.setHigher((model.getAvgConsumption() - cityConsumMin) * 100.0 / (cityConsumMax - cityConsumMin)); model.setHigher((model.getAvgConsumption() - cityConsumMin) * 100.0 / (cityConsumMax - cityConsumMin));
} }
String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" }; String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" };
Map<String, JSONObject> result = baiduApiService.searchNearBy(Arrays.asList(ks), lat, lng, 1000, model.getBaiduMapKey()); Map<String, JSONObject> result = baiduApiService.searchNearBy(Arrays.asList(ks), lat, lng, 1000, model.getBaiduMapKey());
Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length); Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length);
for (String k : ks) { for (String k : ks) {
@@ -87,13 +87,13 @@ public class ConsumController extends BaseController {
// model.setAroundSell(aroundMarkers); // model.setAroundSell(aroundMarkers);
// } // }
double radius = getRadius(); double radius = getRadius();
model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅")); model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅"));
double cityConsumMin = model.getCityConsumMin(); double cityConsumMin = model.getCityConsumMin();
double cityConsumMax = model.getCityConsumMax(); double cityConsumMax = model.getCityConsumMax();
if (null != model.getAvgConsumption()) { if (null != model.getAvgConsumption()) {
model.setHigher((model.getAvgConsumption() - cityConsumMin) * 100.0 / (cityConsumMax - cityConsumMin)); model.setHigher((model.getAvgConsumption() - cityConsumMin) * 100.0 / (cityConsumMax - cityConsumMin));
} }
String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" }; String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" };
Map<String, JSONObject> result = baiduApiService.searchNearBy(Arrays.asList(ks), lat, lng, 1000, model.getBaiduMapKey()); Map<String, JSONObject> result = baiduApiService.searchNearBy(Arrays.asList(ks), lat, lng, 1000, model.getBaiduMapKey());
Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length); Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length);
for (String k : ks) { for (String k : ks) {
@@ -35,7 +35,7 @@ import javax.swing.plaf.synth.Region;
import java.util.*; import java.util.*;
/** /**
* 数据中心展示Controller * 数据中心展示Controller
* *
* @author wenyan * @author wenyan
*/ */
@@ -48,39 +48,39 @@ public class DataCenterController {
private DistrictService districtService; private DistrictService districtService;
private HouseService houseService; private HouseService houseService;
private RegionStatTrendService regionStatTrendService; private RegionStatTrendService regionStatTrendService;
private static final List<String> OPEN_CITY_LIST = Arrays.asList("上海", "北京"); private static final List<String> OPEN_CITY_LIST = Arrays.asList("上海", "北京");
private Map<String, String> PROVINCE_CITY = new HashMap<String, String>(){{ private Map<String, String> PROVINCE_CITY = new HashMap<String, String>(){{
put("北京","北京"); put("北京","北京");
put("天津","天津"); put("天津","天津");
put("上海","上海"); put("上海","上海");
put("重庆","重庆"); put("重庆","重庆");
put("河北","石家庄"); put("河北","石家庄");
put("山西","太原"); put("山西","太原");
put("内蒙古","呼和浩特"); put("内蒙古","呼和浩特");
put("辽宁","沈阳"); put("辽宁","沈阳");
put("吉林","长春"); put("吉林","长春");
put("黑龙江","哈尔滨"); put("黑龙江","哈尔滨");
put("江苏","南京"); put("江苏","南京");
put("浙江","杭州"); put("浙江","杭州");
put("安徽","合肥"); put("安徽","合肥");
put("福建","福州"); put("福建","福州");
put("江西","南昌"); put("江西","南昌");
put("山东","济南"); put("山东","济南");
put("河南","郑州"); put("河南","郑州");
put("湖北","武汉"); put("湖北","武汉");
put("湖南","长沙"); put("湖南","长沙");
put("广东","广州"); put("广东","广州");
put("广西","南宁"); put("广西","南宁");
put("海南","海口"); put("海南","海口");
put("四川","成都"); put("四川","成都");
put("贵州","贵阳"); put("贵州","贵阳");
put("云南","昆明"); put("云南","昆明");
put("西藏","拉萨"); put("西藏","拉萨");
put("陕西","西安"); put("陕西","西安");
put("甘肃","兰州"); put("甘肃","兰州");
put("青海","西宁"); put("青海","西宁");
put("宁夏","银川"); put("宁夏","银川");
put("新疆","乌鲁木齐"); put("新疆","乌鲁木齐");
}}; }};
public DataCenterModel summaryAction(DataCenterModel model) { public DataCenterModel summaryAction(DataCenterModel model) {
@@ -215,7 +215,7 @@ public class DataCenterController {
public Object findCityAvgPriceAction(@Param(name = "province") String province) { public Object findCityAvgPriceAction(@Param(name = "province") String province) {
JsonModel model = new JsonModel(); JsonModel model = new JsonModel();
Map<String, Object> result = new HashMap<String, Object>(); Map<String, Object> result = new HashMap<String, Object>();
if(RegionData.getAllCity().contains(province) && !"吉林".equals(province)){ if(RegionData.getAllCity().contains(province) && !"吉林".equals(province)){
result.put("type", "city"); result.put("type", "city");
result.put("cityStat", regionStatService.findRegionStat(province, null)); result.put("cityStat", regionStatService.findRegionStat(province, null));
List<RegionStat> stats = new ArrayList<RegionStat>(RegionData.getAllRegions(province).size()); List<RegionStat> stats = new ArrayList<RegionStat>(RegionData.getAllRegions(province).size());
@@ -260,7 +260,7 @@ public class DataCenterController {
private List<RegionStat> getAllCityPrice() { private List<RegionStat> getAllCityPrice() {
List<String> citys = serverAreaService.findAllSupportGujia(); List<String> citys = serverAreaService.findAllSupportGujia();
citys.add("拉萨"); citys.add("拉萨");
List<RegionStat> cityStats = regionStatService.findRegionStatByCityName(citys); List<RegionStat> cityStats = regionStatService.findRegionStatByCityName(citys);
return cityStats; return cityStats;
} }
@@ -13,7 +13,7 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
* Òâ¼û·´À¡ * 意见反馈
* Created by wenyan on 2015/11/24. * Created by wenyan on 2015/11/24.
*/ */
public class FeedbackController { public class FeedbackController {
@@ -53,7 +53,7 @@ import com.fangjia.service.mongo.fangjia.DistrictHotService;
import com.fangjia.service.mongo.fangjia.PricePredictService; import com.fangjia.service.mongo.fangjia.PricePredictService;
/** /**
* 首页 * 首页
* *
* @author yk * @author yk
* *
@@ -91,7 +91,7 @@ public class GeneralController extends BaseController {
} }
model.setDistrict(district); model.setDistrict(district);
/* 坐标 */ /* 坐标 */
double lat = district.getLat2()/10000000000d; double lat = district.getLat2()/10000000000d;
double lng = district.getLng2()/10000000000d; double lng = district.getLng2()/10000000000d;
double radius = getRadius(); double radius = getRadius();
@@ -99,16 +99,16 @@ public class GeneralController extends BaseController {
String city = district.getCity(); String city = district.getCity();
String region = district.getRegion(); String region = district.getRegion();
// 房价指数 // 房价指数
RegionStat cityStat = regionStatService.findByCity(model.getCityName()); RegionStat cityStat = regionStatService.findByCity(model.getCityName());
DistrictStatBo statBo = districtStatService.findYearPeriodStatBo(districtKey); DistrictStatBo statBo = districtStatService.findYearPeriodStatBo(districtKey);
model.setStatBo(statBo); model.setStatBo(statBo);
DistrictStat stat = statBo.getDefaultDistrictStat(); DistrictStat stat = statBo.getDefaultDistrictStat();
String estateType = district.getEstateType2(); String estateType = district.getEstateType2();
if(!estateType.contains("别墅")){ if(!estateType.contains("别墅")){
estateType = "小区"; estateType = "小区";
}else{ }else{
estateType = "别墅"; estateType = "别墅";
} }
List<Integer> rentList = new ArrayList<Integer>(); List<Integer> rentList = new ArrayList<Integer>();
Map<Integer,Integer> districtStatRents = districtStatRentService.findByDistrictStatRent(districtKey, estateType); Map<Integer,Integer> districtStatRents = districtStatRentService.findByDistrictStatRent(districtKey, estateType);
@@ -133,13 +133,13 @@ public class GeneralController extends BaseController {
model.setPriceScore(DistrictScoreUtil.priceScore2(null == stat ? null: stat.getAvgPrice(), pricelist.get(0), pricelist.get(1), rentList)); model.setPriceScore(DistrictScoreUtil.priceScore2(null == stat ? null: stat.getAvgPrice(), pricelist.get(0), pricelist.get(1), rentList));
// 潜力指数 // 潜力指数
int avgPrice = 0; int avgPrice = 0;
String buildType = "小区"; String buildType = "小区";
if (null == statBo.getDistrictStat() if (null == statBo.getDistrictStat()
&& null != statBo.getVillaDistrictStat()) { && null != statBo.getVillaDistrictStat()) {
avgPrice = statBo.getVillaDistrictStat().getAvgPrice(); avgPrice = statBo.getVillaDistrictStat().getAvgPrice();
buildType = "别墅"; buildType = "别墅";
} else if (null != statBo.getDistrictStat()) { } else if (null != statBo.getDistrictStat()) {
avgPrice = statBo.getDistrictStat().getAvgPrice(); avgPrice = statBo.getDistrictStat().getAvgPrice();
} }
@@ -166,56 +166,56 @@ public class GeneralController extends BaseController {
model.setRankScore(DistrictScoreUtil.rankScore2(houseCountRatio, dealPriceCountRatio)); model.setRankScore(DistrictScoreUtil.rankScore2(houseCountRatio, dealPriceCountRatio));
long t = System.currentTimeMillis(); long t = System.currentTimeMillis();
// 消费指数 // 消费指数
Double avgConsumption = bizShopService.findAroundAvgConsumption(lat,lng, 1000, "美食"); Double avgConsumption = bizShopService.findAroundAvgConsumption(lat,lng, 1000, "美食");
String[] allKw = new String[]{"KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴","医院", String[] allKw = new String[]{"KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴","医院",
"学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园","机场", "网吧", "发电厂", "变电站", "垃圾焚烧厂", "化工厂"}; "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园","机场", "网吧", "发电厂", "变电站", "垃圾焚烧厂", "化工厂"};
Map<String,JSONObject> searchResult = baiduApiService.searchNearBy(Arrays.asList(allKw), lat, lng, 1000, model.getBaiduMapKey()); Map<String,JSONObject> searchResult = baiduApiService.searchNearBy(Arrays.asList(allKw), lat, lng, 1000, model.getBaiduMapKey());
String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" }; String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" };
Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length); Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
countMap.put(ks[i], getTotal(searchResult.get(ks[i]))); countMap.put(ks[i], getTotal(searchResult.get(ks[i])));
} }
model.setConsumScore(DistrictScoreUtil.consumScore(avgConsumption,countMap)); model.setConsumScore(DistrictScoreUtil.consumScore(avgConsumption,countMap));
// 环境指数 // 环境指数
ks = new String[] { "医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园","机场", "网吧" }; ks = new String[] { "医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园","机场", "网吧" };
// 厌恶设施 // 厌恶设施
String[] keys = new String[] { "发电厂", "变电站", "垃圾焚烧厂", "化工厂" }; String[] keys = new String[] { "发电厂", "变电站", "垃圾焚烧厂", "化工厂" };
countMap = new HashMap<String, Integer>(ks.length); countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
countMap.put(ks[i], getTotal(searchResult.get(ks[i]))); countMap.put(ks[i], getTotal(searchResult.get(ks[i])));
} }
// 添加厌恶设施 // 添加厌恶设施
for (int i = 0; i < keys.length; i++) { for (int i = 0; i < keys.length; i++) {
countMap.put(keys[i], getTotal(searchResult.get(ks[i]))); countMap.put(keys[i], getTotal(searchResult.get(ks[i])));
} }
System.out.println("API耗时:" + (System.currentTimeMillis() -t)); System.out.println("API耗时:" + (System.currentTimeMillis() -t));
Map<String, List<BusStation>> stationMap = busStationService Map<String, List<BusStation>> stationMap = busStationService
.getNearByStations(city, lat, lng, 1000); .getNearByStations(city, lat, lng, 1000);
countMap.put("地铁站", null == stationMap.get("地铁") ? null : stationMap countMap.put("地铁站", null == stationMap.get("地铁") ? null : stationMap
.get("地铁").size()); .get("地铁").size());
countMap.put("公交点", null == stationMap.get("公交") ? null : stationMap countMap.put("公交点", null == stationMap.get("公交") ? null : stationMap
.get("公交").size()); .get("公交").size());
model.setAroundScore(DistrictScoreUtil.aroundScore(countMap)); model.setAroundScore(DistrictScoreUtil.aroundScore(countMap));
// 虹桥机场 121.352578,31.200062 // 虹桥机场 121.352578,31.200062
// 浦东机场 121.807085,31.160702 // 浦东机场 121.807085,31.160702
double dis = GeoUtils double dis = GeoUtils
.calculateDistance(lng, lat, 121.352578, 31.200062); .calculateDistance(lng, lat, 121.352578, 31.200062);
if (dis <= radius) { if (dis <= radius) {
countMap.put("机场", 1); countMap.put("机场", 1);
} else { } else {
dis = GeoUtils.calculateDistance(lng, lat, 121.807085, 31.160702); dis = GeoUtils.calculateDistance(lng, lat, 121.807085, 31.160702);
if (dis <= radius) { if (dis <= radius) {
countMap.put("机场", 1); countMap.put("机场", 1);
} }
} }
// 楼盘指数 // 楼盘指数
model.setDetailScore(DistrictScoreUtil.detailScore(district,seaweedNumbericDao.findDistrict(city, region,district.getName()))); model.setDetailScore(DistrictScoreUtil.detailScore(district,seaweedNumbericDao.findDistrict(city, region,district.getName())));
double totalScore = 0d; double totalScore = 0d;
@@ -511,12 +511,12 @@ public class GeneralController extends BaseController {
double radius = getRadius(); double radius = getRadius();
List<BusStation> metros = null; List<BusStation> metros = null;
List<BusStation> buses = null; List<BusStation> buses = null;
// 综合得分 // 综合得分
SeaweedNumberic numberic = seaweedNumbericDao.findShop(mall.getCity(), SeaweedNumberic numberic = seaweedNumbericDao.findShop(mall.getCity(),
mall.getRegion(), mall.getName()); mall.getRegion(), mall.getName());
model.setDetailScore(ShopScoreUtil.detailScore(mall, numberic)); model.setDetailScore(ShopScoreUtil.detailScore(mall, numberic));
// 房价 // 房价
BizRegionStat cityStat = bizRegionStatService.findCitySellPrice(mall.getCity(), BizRegionStat cityStat = bizRegionStatService.findCitySellPrice(mall.getCity(),
weekend); weekend);
DistrictStatBo statBo = shopStatService.findAllShopStat( DistrictStatBo statBo = shopStatService.findAllShopStat(
@@ -526,22 +526,22 @@ public class GeneralController extends BaseController {
null == cityStat ? null : cityStat.getAvgPrice())); null == cityStat ? null : cityStat.getAvgPrice()));
model.setStatBo(statBo); model.setStatBo(statBo);
// 租金 // 租金
BizRegionStat cityStatRent = bizRegionStatService.findCityRentPrice(mall.getCity(), weekend); BizRegionStat cityStatRent = bizRegionStatService.findCityRentPrice(mall.getCity(), weekend);
DistrictBusinessStatRentBo statRentBo = districtBusinessStatRentService DistrictBusinessStatRentBo statRentBo = districtBusinessStatRentService
.findMallStatBo(new DistrictKey(mall.getCity(), mall.getRegion(), mall.getName()), weekend); .findMallStatBo(new DistrictKey(mall.getCity(), mall.getRegion(), mall.getName()), weekend);
model.setRentScore(ShopScoreUtil.rentScore(statRentBo,null == cityStatRent ? null : cityStatRent.getAvgPrice(), mall.getPaymentPattern())); model.setRentScore(ShopScoreUtil.rentScore(statRentBo,null == cityStatRent ? null : cityStatRent.getAvgPrice(), mall.getPaymentPattern()));
// 地段 // 地段
Map<String, List<BusStation>> stationMap = busStationService Map<String, List<BusStation>> stationMap = busStationService
.getNearByStations(mall.getCity(), lat, lng, radius); .getNearByStations(mall.getCity(), lat, lng, radius);
metros = stationMap.get("地铁"); metros = stationMap.get("地铁");
buses = stationMap.get("公交"); buses = stationMap.get("公交");
model.setLocalScore(ShopScoreUtil.localScore(mall.getLoopLineInfo(), model.setLocalScore(ShopScoreUtil.localScore(mall.getLoopLineInfo(),
null == metros ? 0 : metros.size(), null == metros ? 0 : metros.size(),
null == buses ? 0 : buses.size())); null == buses ? 0 : buses.size()));
// 人口 // 人口
int cityAvgPrice = cityPriceLevelService.findCityPriceLevel(city); int cityAvgPrice = cityPriceLevelService.findCityPriceLevel(city);
cityAvgPrice = cityAvgPrice == 0 ? 7000 : cityAvgPrice; cityAvgPrice = cityAvgPrice == 0 ? 7000 : cityAvgPrice;
@@ -549,7 +549,7 @@ public class GeneralController extends BaseController {
lng, radius); lng, radius);
int totalHouseCount = getTotalHouseCount(districts, cityAvgPrice); int totalHouseCount = getTotalHouseCount(districts, cityAvgPrice);
// 居民人口密度 // 居民人口密度
double circleArea = Math.PI * Math.pow(radius / 1000.0, 2); double circleArea = Math.PI * Math.pow(radius / 1000.0, 2);
double density = totalHouseCount * 2.49 / circleArea; double density = totalHouseCount * 2.49 / circleArea;
double peopleScore1 = ShopScoreUtil.peopleScore1(density); double peopleScore1 = ShopScoreUtil.peopleScore1(density);
@@ -558,38 +558,38 @@ public class GeneralController extends BaseController {
radius); radius);
int totalOfficeCount = getTotalOfficeCount(offices); int totalOfficeCount = getTotalOfficeCount(offices);
// 办公人口 // 办公人口
density = totalOfficeCount / circleArea; density = totalOfficeCount / circleArea;
double peopleScore2 = ShopScoreUtil.peopleScore2(density); double peopleScore2 = ShopScoreUtil.peopleScore2(density);
model.setPeopleScore(peopleScore1 > peopleScore2 ? peopleScore1 model.setPeopleScore(peopleScore1 > peopleScore2 ? peopleScore1
: peopleScore2); : peopleScore2);
String[] allKs = new String[]{"KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴", String[] allKs = new String[]{"KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴",
"医院", "公园", "学校", "体育馆","银行", "商场", "大型超市", "餐饮" "医院", "公园", "学校", "体育馆","银行", "商场", "大型超市", "餐饮"
}; };
Map<String,JSONObject> searchResult = baiduApiService.searchNearBy(Arrays.asList(allKs), lat, lng, radius, model.getBaiduMapKey()); Map<String,JSONObject> searchResult = baiduApiService.searchNearBy(Arrays.asList(allKs), lat, lng, radius, model.getBaiduMapKey());
// 消费 // 消费
String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" }; String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店","大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" };
Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length); Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length);
for (String k : ks){ for (String k : ks){
countMap.put(k, getTotal(searchResult.get(k))); countMap.put(k, getTotal(searchResult.get(k)));
} }
Double avgConsumption = bizShopService.findAroundAvgConsumption(lat,lng, radius, "餐厅"); Double avgConsumption = bizShopService.findAroundAvgConsumption(lat,lng, radius, "餐厅");
model.setConsumScore(ShopScoreUtil.consumScore(avgConsumption, countMap)); model.setConsumScore(ShopScoreUtil.consumScore(avgConsumption, countMap));
// 环境 // 环境
ks = new String[] { "医院", "公园", "学校", "体育馆" }; ks = new String[] { "医院", "公园", "学校", "体育馆" };
countMap = new HashMap<String, Integer>(ks.length); countMap = new HashMap<String, Integer>(ks.length);
for (String k : ks){ for (String k : ks){
countMap.put(k, getTotal(searchResult.get(k))); countMap.put(k, getTotal(searchResult.get(k)));
} }
countMap.put("地铁站", null == metros ? null : metros.size()); countMap.put("地铁站", null == metros ? null : metros.size());
countMap.put("公交点", null == buses ? null : buses.size()); countMap.put("公交点", null == buses ? null : buses.size());
double aroundScore1 = ShopScoreUtil.aroundScore1(countMap); double aroundScore1 = ShopScoreUtil.aroundScore1(countMap);
ks = new String[] { "银行", "商场", "大型超市", "餐饮" }; ks = new String[] { "银行", "商场", "大型超市", "餐饮" };
countMap = new HashMap<String, Integer>(ks.length); countMap = new HashMap<String, Integer>(ks.length);
for (String k : ks){ for (String k : ks){
countMap.put(k, getTotal(searchResult.get(k))); countMap.put(k, getTotal(searchResult.get(k)));
@@ -752,7 +752,7 @@ public class GeneralController extends BaseController {
district.setAvgPrice(avgPrice); district.setAvgPrice(avgPrice);
district.setKind(commData.getKind()); district.setKind(commData.getKind());
if (district.getName().endsWith("村")) { if (district.getName().endsWith("村")) {
oldHouseCount += count; oldHouseCount += count;
} else { } else {
@@ -771,7 +771,7 @@ public class GeneralController extends BaseController {
} }
return oldHouseCount + hightLevelDistrictHouseCount return oldHouseCount + hightLevelDistrictHouseCount
+ commonDistrictHouseCount;// 总户数 + commonDistrictHouseCount;// 总户数
} }
return 0; return 0;
} }
@@ -848,13 +848,13 @@ public class GeneralController extends BaseController {
} }
if (StringUtils.isNotBlank(office.getBedKind())) { if (StringUtils.isNotBlank(office.getBedKind())) {
if (office.getBedKind().equals("甲级")) { if (office.getBedKind().equals("甲级")) {
bestLevelCount = bestLevelCount bestLevelCount = bestLevelCount
+ office.getHouseholdCount(); + office.getHouseholdCount();
} else if (office.getBedKind().equals("乙级")) { } else if (office.getBedKind().equals("乙级")) {
betterLevelCount = betterLevelCount betterLevelCount = betterLevelCount
+ office.getHouseholdCount(); + office.getHouseholdCount();
} else if (office.getBedKind().equals("丙级")) { } else if (office.getBedKind().equals("丙级")) {
goodLevelCount = goodLevelCount goodLevelCount = goodLevelCount
+ office.getHouseholdCount(); + office.getHouseholdCount();
} else { } else {
@@ -41,12 +41,12 @@ public class LocalController extends BaseController {
double lng = mall.getLng2()/10000000000.0; double lng = mall.getLng2()/10000000000.0;
double radius = getRadius(); double radius = getRadius();
Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(model.getCityName(), lat, lng, radius); Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(model.getCityName(), lat, lng, radius);
model.setMetroStations(stationMap.get("地铁")); model.setMetroStations(stationMap.get("地铁"));
model.setBusStations(stationMap.get("公交")); model.setBusStations(stationMap.get("公交"));
if("上海".equals(model.getCityName())){ if("上海".equals(model.getCityName())){
// 虹桥机场 121.352578,31.200062 // 虹桥机场 121.352578,31.200062
model.setDisHongqiaoAirport(GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062)); model.setDisHongqiaoAirport(GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062));
// 虹桥火车站 121.32795,31.1991 // 虹桥火车站 121.32795,31.1991
model.setDisHongqiaoStation(GeoUtils.calculateDistance(lng, lat, 121.32795, 31.1991)); model.setDisHongqiaoStation(GeoUtils.calculateDistance(lng, lat, 121.32795, 31.1991));
} }
model.setTabScore(ShopScoreUtil.localScore(mall.getLoopLineInfo(), null == model.getMetroStations() ? 0 : model model.setTabScore(ShopScoreUtil.localScore(mall.getLoopLineInfo(), null == model.getMetroStations() ? 0 : model
@@ -42,7 +42,7 @@ public class NodistrictController extends BaseController {
final double lng = model.getLng(); final double lng = model.getLng();
final double radius = getRadius(); final double radius = getRadius();
// 周边没小区,直接返回 // 周边没小区,直接返回
List<District> districts = districtService.findDistrict(lat, lng, radius, model.getCityName()); List<District> districts = districtService.findDistrict(lat, lng, radius, model.getCityName());
if (CollectionUtils.isEmpty(districts)) { if (CollectionUtils.isEmpty(districts)) {
return model; return model;
@@ -54,7 +54,7 @@ public class NodistrictController extends BaseController {
model.setCityPrice(cityStat.getAvgPrice()); model.setCityPrice(cityStat.getAvgPrice());
} }
// 按距离排序,由近到远 // 按距离排序,由近到远
Collections.sort(districts, new Comparator<District>() { Collections.sort(districts, new Comparator<District>() {
public int compare(District o1, District o2) { public int compare(District o1, District o2) {
double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0); double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0);
@@ -102,11 +102,11 @@ public class NodistrictController extends BaseController {
model.setPriceNearest(priceNearest); model.setPriceNearest(priceNearest);
// 范围内均价 // 范围内均价
if (priceCount > 0 && stats.size() > 0) { if (priceCount > 0 && stats.size() > 0) {
model.setAreaPrice(priceCount / stats.size()); model.setAreaPrice(priceCount / stats.size());
Map<String, Integer> priceMap = districtStatService.getCityDistriceMinAndMaxPrice(model.getCityName()); Map<String, Integer> priceMap = districtStatService.getCityDistriceMinAndMaxPrice(model.getCityName());
//设置价格 //设置价格
model.setCityDistrictMinSellPrice(priceMap.get("cityDistrictMinSellPrice")); model.setCityDistrictMinSellPrice(priceMap.get("cityDistrictMinSellPrice"));
model.setCityDistrictMaxSellPrice(priceMap.get("cityDistrictMaxSellPrice")); model.setCityDistrictMaxSellPrice(priceMap.get("cityDistrictMaxSellPrice"));
@@ -124,7 +124,7 @@ public class NodistrictController extends BaseController {
} }
} }
// 由低到高排序 // 由低到高排序
Collections.sort(stats, new Comparator<DistrictStat>() { Collections.sort(stats, new Comparator<DistrictStat>() {
public int compare(DistrictStat o1, DistrictStat o2) { public int compare(DistrictStat o1, DistrictStat o2) {
return o1.getAvgPrice() - o2.getAvgPrice(); return o1.getAvgPrice() - o2.getAvgPrice();
@@ -139,7 +139,7 @@ public class NodistrictController extends BaseController {
} }
model.setPriceBtm5(priceBtm5); model.setPriceBtm5(priceBtm5);
// 由高到低排序 // 由高到低排序
Collections.reverse(stats); Collections.reverse(stats);
List<DistrictStat> priceTop5 = new ArrayList<DistrictStat>(5); List<DistrictStat> priceTop5 = new ArrayList<DistrictStat>(5);
for (DistrictStat s : stats) { for (DistrictStat s : stats) {
@@ -158,13 +158,13 @@ public class NodistrictController extends BaseController {
final double lng = model.getLng(); final double lng = model.getLng();
final double radius = getRadius(); final double radius = getRadius();
// 周边没小区,直接返回 // 周边没小区,直接返回
List<District> districts = districtService.findDistrict(lat, lng, radius, model.getCityName()); List<District> districts = districtService.findDistrict(lat, lng, radius, model.getCityName());
if (CollectionUtils.isEmpty(districts)) { if (CollectionUtils.isEmpty(districts)) {
return model; return model;
} }
// 按距离排序,由近到远 // 按距离排序,由近到远
Collections.sort(districts, new Comparator<District>() { Collections.sort(districts, new Comparator<District>() {
public int compare(District o1, District o2) { public int compare(District o1, District o2) {
double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0); double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0);
@@ -325,7 +325,7 @@ public class NodistrictController extends BaseController {
double lng = model.getLng(); double lng = model.getLng();
double radius = getRadius(); double radius = getRadius();
model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅")); model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅"));
double cityConsumMin = model.getCityConsumMin(); double cityConsumMin = model.getCityConsumMin();
double cityConsumMax = model.getCityConsumMax(); double cityConsumMax = model.getCityConsumMax();
@@ -342,20 +342,20 @@ public class NodistrictController extends BaseController {
double lng = model.getLng(); double lng = model.getLng();
double radius = getRadius(); double radius = getRadius();
Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius); Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius);
model.setMetroStations(stationMap.get("地铁")); model.setMetroStations(stationMap.get("地铁"));
model.setBusStations(stationMap.get("公交")); model.setBusStations(stationMap.get("公交"));
// 虹桥机场 121.352578,31.200062 // 虹桥机场 121.352578,31.200062
// 浦东机场 121.807085,31.160702 // 浦东机场 121.807085,31.160702
double dis = GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062); double dis = GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062);
if (dis <= radius) { if (dis <= radius) {
model.setAirPort("虹桥机场"); model.setAirPort("虹桥机场");
model.setAirPortLat(31.200062); model.setAirPortLat(31.200062);
model.setAirPortLng(121.352578); model.setAirPortLng(121.352578);
} else { } else {
dis = GeoUtils.calculateDistance(lng, lat, 121.807085, 31.160702); dis = GeoUtils.calculateDistance(lng, lat, 121.807085, 31.160702);
if (dis <= radius) { if (dis <= radius) {
model.setAirPort("浦东机场"); model.setAirPort("浦东机场");
model.setAirPortLat(31.160702); model.setAirPortLat(31.160702);
model.setAirPortLng(121.807085); model.setAirPortLng(121.807085);
} }
@@ -32,7 +32,7 @@ public class NofoundController extends BaseController {
return model.redirect("/general/district?q=" + URLEncoder.encode(model.getQ(), "UTF-8")+"&cityName="+URLEncoder.encode(model.getCityName(), "UTF-8")); return model.redirect("/general/district?q=" + URLEncoder.encode(model.getQ(), "UTF-8")+"&cityName="+URLEncoder.encode(model.getCityName(), "UTF-8"));
} }
// 查询半径内小区 // 查询半径内小区
final double lat = model.getLat(); final double lat = model.getLat();
final double lng = model.getLng(); final double lng = model.getLng();
final double radius = getRadius(); final double radius = getRadius();
@@ -50,7 +50,7 @@ public class NofoundController extends BaseController {
return model; return model;
} }
// 按距离排序,由近到远 // 按距离排序,由近到远
Collections.sort(tmpDistricts, new Comparator<District>() { Collections.sort(tmpDistricts, new Comparator<District>() {
public int compare(District o1, District o2) { public int compare(District o1, District o2) {
double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0); double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0);
@@ -106,7 +106,7 @@ public class NofoundController extends BaseController {
final double lat = model.getLat(); final double lat = model.getLat();
final double lng = model.getLng(); final double lng = model.getLng();
List<Shop> shops = shopService.searchNearby(lat, lng, getRadius()); List<Shop> shops = shopService.searchNearby(lat, lng, getRadius());
// 按距离排序,由近到远 // 按距离排序,由近到远
Collections.sort(shops, new Comparator<Shop>() { Collections.sort(shops, new Comparator<Shop>() {
public int compare(Shop o1, Shop o2) { public int compare(Shop o1, Shop o2) {
double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0); double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0);
@@ -49,7 +49,7 @@ public class NoshopController extends BaseController {
final double lng = model.getLng(); final double lng = model.getLng();
final double radius = getRadius(); final double radius = getRadius();
// 周边没商铺,直接返回 // 周边没商铺,直接返回
List<Shop> shops = shopService.searchNearby(lat, lng, radius); List<Shop> shops = shopService.searchNearby(lat, lng, radius);
if (CollectionUtils.isEmpty(shops)) { if (CollectionUtils.isEmpty(shops)) {
return model; return model;
@@ -61,7 +61,7 @@ public class NoshopController extends BaseController {
model.setCityPrice(cityStat.getAvgPrice()); model.setCityPrice(cityStat.getAvgPrice());
} }
// 按距离排序,由近到远 // 按距离排序,由近到远
Collections.sort(shops, new Comparator<Shop>() { Collections.sort(shops, new Comparator<Shop>() {
public int compare(Shop o1, Shop o2) { public int compare(Shop o1, Shop o2) {
double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0); double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0);
@@ -102,7 +102,7 @@ public class NoshopController extends BaseController {
model.setPriceNearest(priceNearest); model.setPriceNearest(priceNearest);
// 范围内均价 // 范围内均价
if (priceCount > 0 && stats.size() > 0) { if (priceCount > 0 && stats.size() > 0) {
model.setAreaPrice(priceCount / stats.size()); model.setAreaPrice(priceCount / stats.size());
@@ -120,7 +120,7 @@ public class NoshopController extends BaseController {
} }
} }
// 由低到高排序 // 由低到高排序
Collections.sort(stats, new Comparator<DistrictStat>() { Collections.sort(stats, new Comparator<DistrictStat>() {
public int compare(DistrictStat o1, DistrictStat o2) { public int compare(DistrictStat o1, DistrictStat o2) {
return o1.getAvgPrice() - o2.getAvgPrice(); return o1.getAvgPrice() - o2.getAvgPrice();
@@ -135,7 +135,7 @@ public class NoshopController extends BaseController {
} }
model.setPriceBtm5(priceBtm5); model.setPriceBtm5(priceBtm5);
// 由高到低排序 // 由高到低排序
Collections.reverse(stats); Collections.reverse(stats);
List<DistrictStat> priceTop5 = new ArrayList<DistrictStat>(5); List<DistrictStat> priceTop5 = new ArrayList<DistrictStat>(5);
for (DistrictStat s : stats) { for (DistrictStat s : stats) {
@@ -154,7 +154,7 @@ public class NoshopController extends BaseController {
final double lng = model.getLng(); final double lng = model.getLng();
final double radius = getRadius(); final double radius = getRadius();
// 周边没商铺,直接返回 // 周边没商铺,直接返回
List<Shop> shops = shopService.searchNearby(lat, lng, radius); List<Shop> shops = shopService.searchNearby(lat, lng, radius);
if (CollectionUtils.isEmpty(shops)) { if (CollectionUtils.isEmpty(shops)) {
return model; return model;
@@ -166,7 +166,7 @@ public class NoshopController extends BaseController {
model.setCityRentPrice(cityStat.getAvgPrice()); model.setCityRentPrice(cityStat.getAvgPrice());
} }
// 按距离排序,由近到远 // 按距离排序,由近到远
Collections.sort(shops, new Comparator<Shop>() { Collections.sort(shops, new Comparator<Shop>() {
public int compare(Shop o1, Shop o2) { public int compare(Shop o1, Shop o2) {
double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0); double dis1 = GeoUtils.calculateDistance(lng, lat, o1.getLng2() / 10000000000.0, o1.getLat2() / 10000000000.0);
@@ -201,7 +201,7 @@ public class NoshopController extends BaseController {
model.setRentNearest(priceNearest); model.setRentNearest(priceNearest);
// 范围内均价 // 范围内均价
if (priceCount > 0 && stats.size() > 0) { if (priceCount > 0 && stats.size() > 0) {
model.setAreaRentPrice(priceCount / stats.size()); model.setAreaRentPrice(priceCount / stats.size());
@@ -219,7 +219,7 @@ public class NoshopController extends BaseController {
} }
} }
// 由低到高排序 // 由低到高排序
Collections.sort(stats, new Comparator<DistrictBusinessStatRent>() { Collections.sort(stats, new Comparator<DistrictBusinessStatRent>() {
public int compare(DistrictBusinessStatRent o1, DistrictBusinessStatRent o2) { public int compare(DistrictBusinessStatRent o1, DistrictBusinessStatRent o2) {
return o1.getAvgPrice() - o2.getAvgPrice(); return o1.getAvgPrice() - o2.getAvgPrice();
@@ -234,7 +234,7 @@ public class NoshopController extends BaseController {
} }
model.setRentBtm5(priceBtm5); model.setRentBtm5(priceBtm5);
// 由高到低排序 // 由高到低排序
Collections.reverse(stats); Collections.reverse(stats);
List<DistrictBusinessStatRent> priceTop5 = new ArrayList<DistrictBusinessStatRent>(5); List<DistrictBusinessStatRent> priceTop5 = new ArrayList<DistrictBusinessStatRent>(5);
for (DistrictBusinessStatRent s : stats) { for (DistrictBusinessStatRent s : stats) {
@@ -254,16 +254,16 @@ public class NoshopController extends BaseController {
final double radius = getRadius(); final double radius = getRadius();
Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(model.getCityName(), lat, lng, radius); Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(model.getCityName(), lat, lng, radius);
model.setMetroStations(stationMap.get("地铁")); model.setMetroStations(stationMap.get("地铁"));
model.setBusStations(stationMap.get("公交")); model.setBusStations(stationMap.get("公交"));
// 虹桥机场 121.352578,31.200062 // 虹桥机场 121.352578,31.200062
model.setDisHongqiaoAirport(GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062)); model.setDisHongqiaoAirport(GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062));
// 虹桥火车站 121.32795,31.1991 // 虹桥火车站 121.32795,31.1991
model.setDisHongqiaoStation(GeoUtils.calculateDistance(lng, lat, 121.32795, 31.1991)); model.setDisHongqiaoStation(GeoUtils.calculateDistance(lng, lat, 121.32795, 31.1991));
// 周边没商铺,直接返回 // 周边没商铺,直接返回
List<Shop> shops = shopService.searchNearby(lat, lng, radius); List<Shop> shops = shopService.searchNearby(lat, lng, radius);
if (CollectionUtils.isNotEmpty(shops)) { if (CollectionUtils.isNotEmpty(shops)) {
int priceCount = 0; int priceCount = 0;
@@ -278,7 +278,7 @@ public class NoshopController extends BaseController {
} }
} }
// 范围内均价 // 范围内均价
if (priceCount > 0 && count > 0) { if (priceCount > 0 && count > 0) {
model.setAreaPrice(priceCount / count); model.setAreaPrice(priceCount / count);
} }
@@ -380,7 +380,7 @@ public class NoshopController extends BaseController {
double lat = model.getLat(); double lat = model.getLat();
double lng = model.getLng(); double lng = model.getLng();
double radius = getRadius(); double radius = getRadius();
model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅")); model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅"));
double cityConsumMin = model.getCityConsumMin(); double cityConsumMin = model.getCityConsumMin();
double cityConsumMax = model.getCityConsumMax(); double cityConsumMax = model.getCityConsumMax();
@@ -397,8 +397,8 @@ public class NoshopController extends BaseController {
double lng = model.getLng(); double lng = model.getLng();
double radius = getRadius(); double radius = getRadius();
Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius); Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius);
model.setMetroStations(stationMap.get("地铁")); model.setMetroStations(stationMap.get("地铁"));
model.setBusStations(stationMap.get("公交")); model.setBusStations(stationMap.get("公交"));
return model; return model;
} }
@@ -617,7 +617,7 @@ public class NoshopController extends BaseController {
district.setAvgPrice(avgPrice); district.setAvgPrice(avgPrice);
district.setKind(commData.getKind()); district.setKind(commData.getKind());
if (district.getName().endsWith("村")) { if (district.getName().endsWith("村")) {
oldHouseCount += count; oldHouseCount += count;
oldDistrictCount++; oldDistrictCount++;
@@ -636,15 +636,15 @@ public class NoshopController extends BaseController {
} }
} }
model.setTotalHouseCount(oldHouseCount + hightLevelDistrictHouseCount + commonDistrictHouseCount);// 总户数 model.setTotalHouseCount(oldHouseCount + hightLevelDistrictHouseCount + commonDistrictHouseCount);// 总户数
model.setCommonDistrictHouseCount(commonDistrictHouseCount);// 高级商品房户数 model.setCommonDistrictHouseCount(commonDistrictHouseCount);// 高级商品房户数
model.setHightDistrictHouseCount(hightLevelDistrictHouseCount);// 普通户数 model.setHightDistrictHouseCount(hightLevelDistrictHouseCount);// 普通户数
model.setTotalDistrictCount(oldDistrictCount + commonDistrictCount + hightLevelDistrictCount);// 总小区数 model.setTotalDistrictCount(oldDistrictCount + commonDistrictCount + hightLevelDistrictCount);// 总小区数
model.setCommonDistrictCount(commonDistrictCount);// 高级小区数 model.setCommonDistrictCount(commonDistrictCount);// 高级小区数
model.setHightDistrictCount(hightLevelDistrictCount);// 普通小区数 model.setHightDistrictCount(hightLevelDistrictCount);// 普通小区数
model.setOldHouseCount(oldHouseCount);// 老工房 户数 model.setOldHouseCount(oldHouseCount);// 老工房 户数
model.setOldDistrictCount(oldDistrictCount);// 老工户 小区数 model.setOldDistrictCount(oldDistrictCount);// 老工户 小区数
} }
return model; return model;
@@ -691,11 +691,11 @@ public class NoshopController extends BaseController {
} }
if (StringUtils.isNotBlank(office.getBedKind())) { if (StringUtils.isNotBlank(office.getBedKind())) {
if (office.getBedKind().equals("甲级")) { if (office.getBedKind().equals("甲级")) {
bestLevelCount = bestLevelCount + office.getHouseholdCount(); bestLevelCount = bestLevelCount + office.getHouseholdCount();
} else if (office.getBedKind().equals("乙级")) { } else if (office.getBedKind().equals("乙级")) {
betterLevelCount = betterLevelCount + office.getHouseholdCount(); betterLevelCount = betterLevelCount + office.getHouseholdCount();
} else if (office.getBedKind().equals("丙级")) { } else if (office.getBedKind().equals("丙级")) {
goodLevelCount = goodLevelCount + office.getHouseholdCount(); goodLevelCount = goodLevelCount + office.getHouseholdCount();
} else { } else {
otherLevelCount = otherLevelCount + office.getHouseholdCount(); otherLevelCount = otherLevelCount + office.getHouseholdCount();
@@ -78,13 +78,13 @@ public class PeopleController extends BaseController {
JSONArray officesObj = JSONArray.fromObject(offices); JSONArray officesObj = JSONArray.fromObject(offices);
model.setOffices(officesObj.toString()); model.setOffices(officesObj.toString());
// 居民人口密度 // 居民人口密度
double circleArea = Math.PI * Math.pow(radius / 1000.0, 2); double circleArea = Math.PI * Math.pow(radius / 1000.0, 2);
int totalHouseCount = model.getTotalHouseCount(); int totalHouseCount = model.getTotalHouseCount();
double density = totalHouseCount * 2.49 / circleArea; double density = totalHouseCount * 2.49 / circleArea;
double score1 = ShopScoreUtil.populationScore(density); double score1 = ShopScoreUtil.populationScore(density);
data.put("populationScore",score1); data.put("populationScore",score1);
// 办公人口 // 办公人口
int totalCountOffice = model.getTotalCountOffice(); int totalCountOffice = model.getTotalCountOffice();
density = totalCountOffice / circleArea; density = totalCountOffice / circleArea;
double score2 = ShopScoreUtil.officePopulationScore(density); double score2 = ShopScoreUtil.officePopulationScore(density);
@@ -124,26 +124,26 @@ public class PeopleController extends BaseController {
JSONArray officesObj = JSONArray.fromObject(offices); JSONArray officesObj = JSONArray.fromObject(offices);
model.setOffices(officesObj.toString()); model.setOffices(officesObj.toString());
// 居民人口密度 // 居民人口密度
/*double circleArea = Math.PI * Math.pow(radius / 1000.0, 2); /*double circleArea = Math.PI * Math.pow(radius / 1000.0, 2);
int totalHouseCount = model.getTotalHouseCount(); int totalHouseCount = model.getTotalHouseCount();
double density = totalHouseCount * 2.49 / circleArea; double density = totalHouseCount * 2.49 / circleArea;
double score1 = ShopScoreUtil.peopleScore1(density); double score1 = ShopScoreUtil.peopleScore1(density);
model.setScore1(score1); model.setScore1(score1);
// 办公人口 // 办公人口
int totalCountOffice = model.getTotalCountOffice(); int totalCountOffice = model.getTotalCountOffice();
density = totalCountOffice / circleArea; density = totalCountOffice / circleArea;
double score2 = ShopScoreUtil.peopleScore2(density); double score2 = ShopScoreUtil.peopleScore2(density);
model.setScore2(score2);*/ model.setScore2(score2);*/
//圆形面积 //圆形面积
double circleArea = Math.PI * Math.pow(radius / 1000.0, 2); double circleArea = Math.PI * Math.pow(radius / 1000.0, 2);
//设置居民人口密度得分 //设置居民人口密度得分
double peopleDensityScore = setPeopleDensityScore(model, radius, circleArea); double peopleDensityScore = setPeopleDensityScore(model, radius, circleArea);
//设置办公人口得分 //设置办公人口得分
double officeDensityScore = setOfficeDensityScore(model, circleArea); double officeDensityScore = setOfficeDensityScore(model, circleArea);
model.setTabScore(peopleDensityScore > officeDensityScore ? peopleDensityScore : officeDensityScore); model.setTabScore(peopleDensityScore > officeDensityScore ? peopleDensityScore : officeDensityScore);
@@ -182,7 +182,7 @@ public class PeopleController extends BaseController {
} }
/** /**
* 设置办公人口得分 * 设置办公人口得分
* @author yinjihuan * @author yinjihuan
* @date 2016-03-04 * @date 2016-03-04
* @param model * @param model
@@ -190,18 +190,18 @@ public class PeopleController extends BaseController {
* @return * @return
*/ */
private double setOfficeDensityScore(PeopleModel model, double circleArea) { private double setOfficeDensityScore(PeopleModel model, double circleArea) {
//办公人数总数 //办公人数总数
int totalCountOffice = model.getTotalCountOffice(); int totalCountOffice = model.getTotalCountOffice();
//办公人口密度=(圆形区域内办公人数总数/圆形面积) //办公人口密度=(圆形区域内办公人数总数/圆形面积)
double density = totalCountOffice / circleArea; double density = totalCountOffice / circleArea;
//办公人口密度得分 //办公人口密度得分
double officeDensityScore = ShopScoreUtil.calcOfficeDensityScore(density); double officeDensityScore = ShopScoreUtil.calcOfficeDensityScore(density);
model.setScore2(officeDensityScore); model.setScore2(officeDensityScore);
return officeDensityScore; return officeDensityScore;
} }
/** /**
* 设置居民人口密度得分 * 设置居民人口密度得分
* @author yinjihuan * @author yinjihuan
* @date 2016-03-04 * @date 2016-03-04
* @param model * @param model
@@ -209,11 +209,11 @@ public class PeopleController extends BaseController {
* @return * @return
*/ */
private double setPeopleDensityScore(PeopleModel model, double radius, double circleArea) { private double setPeopleDensityScore(PeopleModel model, double radius, double circleArea) {
// 圆形区域内总户数 // 圆形区域内总户数
int totalHouseCount = model.getTotalHouseCount(); int totalHouseCount = model.getTotalHouseCount();
//居民人口密度(居民人口密度 = 圆形区域内总户数*2.49/圆形面积) //居民人口密度(居民人口密度 = 圆形区域内总户数*2.49/圆形面积)
double density = totalHouseCount * 2.49 / circleArea; double density = totalHouseCount * 2.49 / circleArea;
//人口密度得分 //人口密度得分
double peopleDensityScore = ShopScoreUtil.calcPeopleDensityScore(density); double peopleDensityScore = ShopScoreUtil.calcPeopleDensityScore(density);
model.setScore1(peopleDensityScore); model.setScore1(peopleDensityScore);
return peopleDensityScore; return peopleDensityScore;
@@ -319,7 +319,7 @@ public class PeopleController extends BaseController {
district.setAvgPrice(avgPrice); district.setAvgPrice(avgPrice);
district.setKind(commData.getKind()); district.setKind(commData.getKind());
if (district.getName().endsWith("村")) { if (district.getName().endsWith("村")) {
oldHouseCount += count; oldHouseCount += count;
oldDistrictCount++; oldDistrictCount++;
@@ -338,15 +338,15 @@ public class PeopleController extends BaseController {
} }
} }
model.setTotalHouseCount(oldHouseCount + hightLevelDistrictHouseCount + commonDistrictHouseCount);// 总户数 model.setTotalHouseCount(oldHouseCount + hightLevelDistrictHouseCount + commonDistrictHouseCount);// 总户数
model.setCommonDistrictHouseCount(commonDistrictHouseCount);// 高级商品房户数 model.setCommonDistrictHouseCount(commonDistrictHouseCount);// 高级商品房户数
model.setHightDistrictHouseCount(hightLevelDistrictHouseCount);// 普通户数 model.setHightDistrictHouseCount(hightLevelDistrictHouseCount);// 普通户数
model.setTotalDistrictCount(oldDistrictCount + commonDistrictCount + hightLevelDistrictCount);// 总小区数 model.setTotalDistrictCount(oldDistrictCount + commonDistrictCount + hightLevelDistrictCount);// 总小区数
model.setCommonDistrictCount(commonDistrictCount);// 高级小区数 model.setCommonDistrictCount(commonDistrictCount);// 高级小区数
model.setHightDistrictCount(hightLevelDistrictCount);// 普通小区数 model.setHightDistrictCount(hightLevelDistrictCount);// 普通小区数
model.setOldHouseCount(oldHouseCount);// 老工房 户数 model.setOldHouseCount(oldHouseCount);// 老工房 户数
model.setOldDistrictCount(oldDistrictCount);// 老工户 小区数 model.setOldDistrictCount(oldDistrictCount);// 老工户 小区数
} }
return model; return model;
@@ -393,11 +393,11 @@ public class PeopleController extends BaseController {
} }
if (StringUtils.isNotBlank(office.getBedKind())) { if (StringUtils.isNotBlank(office.getBedKind())) {
if (office.getBedKind().equals("甲级")) { if (office.getBedKind().equals("甲级")) {
bestLevelCount = bestLevelCount + office.getHouseholdCount(); bestLevelCount = bestLevelCount + office.getHouseholdCount();
} else if (office.getBedKind().equals("乙级")) { } else if (office.getBedKind().equals("乙级")) {
betterLevelCount = betterLevelCount + office.getHouseholdCount(); betterLevelCount = betterLevelCount + office.getHouseholdCount();
} else if (office.getBedKind().equals("丙级")) { } else if (office.getBedKind().equals("丙级")) {
goodLevelCount = goodLevelCount + office.getHouseholdCount(); goodLevelCount = goodLevelCount + office.getHouseholdCount();
} else { } else {
otherLevelCount = otherLevelCount + office.getHouseholdCount(); otherLevelCount = otherLevelCount + office.getHouseholdCount();
@@ -43,10 +43,10 @@ public class PredictController extends BaseController{
model.setStatBo(statBo); model.setStatBo(statBo);
int avgPrice = 0; int avgPrice = 0;
String buildType = "小区"; String buildType = "小区";
if (null == statBo.getDistrictStat() && null != statBo.getVillaDistrictStat()) { if (null == statBo.getDistrictStat() && null != statBo.getVillaDistrictStat()) {
avgPrice = statBo.getVillaDistrictStat().getAvgPrice(); avgPrice = statBo.getVillaDistrictStat().getAvgPrice();
buildType = "别墅"; buildType = "别墅";
} else if (null != statBo.getDistrictStat()) { } else if (null != statBo.getDistrictStat()) {
avgPrice = statBo.getDistrictStat().getAvgPrice(); avgPrice = statBo.getDistrictStat().getAvgPrice();
} }
@@ -81,7 +81,7 @@ public class PredictController extends BaseController{
} }
private void addDistrictStat(List<JSONObject> seriesOptions, DistrictKey districtKey, int weeks) { 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<DistrictStatBo> districtStatBoList = districtStatService.findAllDistrictStatByKind(districtKey, new Date(), weeks,
list); list);
JSONArray districtJa = new JSONArray(); JSONArray districtJa = new JSONArray();
@@ -130,7 +130,7 @@ public class PredictController extends BaseController{
if (villaJa.length() > 0) { if (villaJa.length() > 0) {
JSONObject jo2 = new JSONObject(); JSONObject jo2 = new JSONObject();
jo2.put("name", districtKey.getName() + "(别墅)"); jo2.put("name", districtKey.getName() + "(别墅)");
jo2.put("data", villaJa.toString()); jo2.put("data", villaJa.toString());
jo2.put("yAxis", 0); jo2.put("yAxis", 0);
seriesOptions.add(jo2); seriesOptions.add(jo2);
@@ -35,7 +35,7 @@ import java.net.URLEncoder;
import java.util.*; import java.util.*;
/** /**
* 价格指数 * 价格指数
* @author yk * @author yk
* *
*/ */
@@ -51,15 +51,15 @@ public class PriceController extends BaseController {
final static ChafangtongCookieContext cookieContext = ChafangtongCookieContext.getInstance(); final static ChafangtongCookieContext cookieContext = ChafangtongCookieContext.getInstance();
public Object districtAction(PriceModel model) throws UnsupportedEncodingException { public Object districtAction(PriceModel model) throws UnsupportedEncodingException {
/** /**
* 将"全市相对最低"指标数字变更成上海小区均价升序,前0到3%的均价的中位数。 * 将"全市相对最低"指标数字变更成上海小区均价升序,前0到3%的均价的中位数。
* "全市相对最高"指标数字变更成上海小区均价升序,前97%到100%的均价的中位数 * "全市相对最高"指标数字变更成上海小区均价升序,前97%到100%的均价的中位数
* 2016-07-05 yinjihuan修改 * 2016-07-05 yinjihuan修改
*/ */
Map<String, Integer> priceMap = districtStatService.getCityDistriceMinAndMaxPrice(model.getCityName()); Map<String, Integer> priceMap = districtStatService.getCityDistriceMinAndMaxPrice(model.getCityName());
if (null == priceMap) { if (null == priceMap) {
return model.redirect("/noResult/district?q=" + URLEncoder.encode(model.getDistrictName(), "UTF-8") + "&cityName=" +URLEncoder.encode(model.getCityName(), "UTF-8")); return model.redirect("/noResult/district?q=" + URLEncoder.encode(model.getDistrictName(), "UTF-8") + "&cityName=" +URLEncoder.encode(model.getCityName(), "UTF-8"));
} }
//设置价格 //设置价格
model.setCityDistrictMinSellPrice(priceMap.get("cityDistrictMinSellPrice")); model.setCityDistrictMinSellPrice(priceMap.get("cityDistrictMinSellPrice"));
model.setCityDistrictMaxSellPrice(priceMap.get("cityDistrictMaxSellPrice")); model.setCityDistrictMaxSellPrice(priceMap.get("cityDistrictMaxSellPrice"));
@@ -108,17 +108,17 @@ public class PriceController extends BaseController {
if(StringUtils.isNotBlank(district.getRegion())){ if(StringUtils.isNotBlank(district.getRegion())){
params.add(new QueryParam("region", district.getRegion())); params.add(new QueryParam("region", district.getRegion()));
} }
Date lastMonthEndDate = DateUtil.getLastEndMonthDate(new Date());// 检索上上月的数据 Date lastMonthEndDate = DateUtil.getLastEndMonthDate(new Date());// 检索上上月的数据
params.add(new QueryParam("endMonthDate", lastMonthEndDate)); params.add(new QueryParam("endMonthDate", lastMonthEndDate));
List<RegionStatRent> regionStatRentList=regionStatRentDao.findAllByParams(params); List<RegionStatRent> regionStatRentList=regionStatRentDao.findAllByParams(params);
model.setRegionStatRents(regionStatRentList); model.setRegionStatRents(regionStatRentList);
model.setRentStatBos(rentBos); model.setRentStatBos(rentBos);
String estateType = district.getEstateType2(); String estateType = district.getEstateType2();
if(!estateType.contains("别墅")){ if(!estateType.contains("别墅")){
estateType = "小区"; estateType = "小区";
}else{ }else{
estateType = "别墅"; estateType = "别墅";
} }
List<Integer> rentList = new ArrayList<Integer>(); List<Integer> rentList = new ArrayList<Integer>();
Map<Integer,Integer> districtStatRents = districtStatRentService.findByDistrictStatRent(districtKey, estateType); Map<Integer,Integer> districtStatRents = districtStatRentService.findByDistrictStatRent(districtKey, estateType);
@@ -211,7 +211,7 @@ public class PriceController extends BaseController {
} }
List<JSONObject> seriesOptions = new ArrayList<JSONObject>(); List<JSONObject> seriesOptions = new ArrayList<JSONObject>();
String title = name + "均价走势"; String title = name + "均价走势";
DistrictKey districtKey = new DistrictKey(city, region, name); DistrictKey districtKey = new DistrictKey(city, region, name);
addDistrictStat(seriesOptions, districtKey, weeks); addDistrictStat(seriesOptions, districtKey, weeks);
@@ -114,7 +114,7 @@ public class RentController extends BaseController {
} }
List<JSONObject> seriesOptions = new ArrayList<JSONObject>(); List<JSONObject> seriesOptions = new ArrayList<JSONObject>();
String title = name + "×â½ð×ßÊÆ"; String title = name + "租金走势";
DistrictKey districtKey = new DistrictKey(city, region, name); DistrictKey districtKey = new DistrictKey(city, region, name);
addDistrictStat(seriesOptions, districtKey, weeks); addDistrictStat(seriesOptions, districtKey, weeks);
@@ -124,7 +124,7 @@ public class ReportController extends BaseController {
model.setShowPdfLink(true); model.setShowPdfLink(true);
} }
// 综合指数 // 综合指数
SeaweedNumberic numberic = seaweedNumbericDao.findShop(shop.getCity(), shop.getRegion(), shop.getName()); SeaweedNumberic numberic = seaweedNumbericDao.findShop(shop.getCity(), shop.getRegion(), shop.getName());
model.setDetailScore(ShopScoreUtil.detailScore(shop, numberic)); model.setDetailScore(ShopScoreUtil.detailScore(shop, numberic));
model.setDetailScore1(ShopScoreUtil.detailScore1(shop.getEstateType(), null == numberic ? null : numberic.getBuildArea())); model.setDetailScore1(ShopScoreUtil.detailScore1(shop.getEstateType(), null == numberic ? null : numberic.getBuildArea()));
@@ -132,7 +132,7 @@ public class ReportController extends BaseController {
model.setDetailScore3(ShopScoreUtil.detailScore3(shop.getCarSiteCount())); model.setDetailScore3(ShopScoreUtil.detailScore3(shop.getCarSiteCount()));
model.setDetailScore4(ShopScoreUtil.detailScore4(null == numberic ? null : numberic.getFinishBuildYear())); model.setDetailScore4(ShopScoreUtil.detailScore4(null == numberic ? null : numberic.getFinishBuildYear()));
// 房价指数 // 房价指数
Date weekend = DateUtil.getFirstDayOfWeek(new Date()); Date weekend = DateUtil.getFirstDayOfWeek(new Date());
BizRegionStat cityStat = bizRegionStatService.findCitySellPrice(city, weekend); BizRegionStat cityStat = bizRegionStatService.findCitySellPrice(city, weekend);
if (null != cityStat) { if (null != cityStat) {
@@ -170,7 +170,7 @@ public class ReportController extends BaseController {
model.setSellTradeUrl(model.getCityUrl() + "/cImg/" + SecurityUtil.encode(urlBuilder.toString()) model.setSellTradeUrl(model.getCityUrl() + "/cImg/" + SecurityUtil.encode(urlBuilder.toString())
+ (isRefreshCache ? "?__refresh_cache=1" : "")); + (isRefreshCache ? "?__refresh_cache=1" : ""));
// 租金指数 // 租金指数
DistrictBusinessStatRentBo retnStatBo = districtBusinessStatRentService.findMallStatBo(new DistrictKey(shop.getCity(), DistrictBusinessStatRentBo retnStatBo = districtBusinessStatRentService.findMallStatBo(new DistrictKey(shop.getCity(),
shop.getRegion(), shop.getName()), weekend); shop.getRegion(), shop.getName()), weekend);
model.setRentStatBo(retnStatBo); model.setRentStatBo(retnStatBo);
@@ -203,15 +203,15 @@ public class ReportController extends BaseController {
model.setRentTradeUrl(model.getCityUrl() + "/cImg/" + SecurityUtil.encode(urlBuilder.toString()) model.setRentTradeUrl(model.getCityUrl() + "/cImg/" + SecurityUtil.encode(urlBuilder.toString())
+ (isRefreshCache ? "?__refresh_cache=1" : "")); + (isRefreshCache ? "?__refresh_cache=1" : ""));
// 地段指数 // 地段指数
Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius); Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius);
model.setMetroStations(stationMap.get("地铁")); model.setMetroStations(stationMap.get("地铁"));
model.setBusStations(stationMap.get("公交")); model.setBusStations(stationMap.get("公交"));
// 虹桥机场 121.352578,31.200062 // 虹桥机场 121.352578,31.200062
model.setDisHongqiaoAirport(GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062)); model.setDisHongqiaoAirport(GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062));
// 虹桥火车站 121.32795,31.1991 // 虹桥火车站 121.32795,31.1991
model.setDisHongqiaoStation(GeoUtils.calculateDistance(lng, lat, 121.32795, 31.1991)); model.setDisHongqiaoStation(GeoUtils.calculateDistance(lng, lat, 121.32795, 31.1991));
model.setLocalScore(ShopScoreUtil.localScore(shop.getLoopLineInfo(), null == model.getMetroStations() ? 0 : model model.setLocalScore(ShopScoreUtil.localScore(shop.getLoopLineInfo(), null == model.getMetroStations() ? 0 : model
@@ -263,7 +263,7 @@ public class ReportController extends BaseController {
model.setPieColors(Arrays.asList(new String[]{"#5491c7" ,"#f0776e" ,"#66bd7d" ,"#f5a549" ,"#c075eb"})); model.setPieColors(Arrays.asList(new String[]{"#5491c7" ,"#f0776e" ,"#66bd7d" ,"#f5a549" ,"#c075eb"}));
model.setPieMarkers(jFreeChartImageService.getAroundBizTypePieMarkers(lat, lng, radius)); model.setPieMarkers(jFreeChartImageService.getAroundBizTypePieMarkers(lat, lng, radius));
// 人口指数 // 人口指数
int cityAvgPrice = cityPriceLevelService.findCityPriceLevel(city); int cityAvgPrice = cityPriceLevelService.findCityPriceLevel(city);
cityAvgPrice = cityAvgPrice == 0 ? 7000 : cityAvgPrice; cityAvgPrice = cityAvgPrice == 0 ? 7000 : cityAvgPrice;
model.setCityAvgPrice(cityAvgPrice); model.setCityAvgPrice(cityAvgPrice);
@@ -274,14 +274,14 @@ public class ReportController extends BaseController {
List<DistrictInfoBo> offices = findDistricts(city, "office", lat, lng, radius); List<DistrictInfoBo> offices = findDistricts(city, "office", lat, lng, radius);
offices = getOfficeCommDataInfo(offices, model); offices = getOfficeCommDataInfo(offices, model);
// 居民人口密度 // 居民人口密度
double circleArea = Math.PI * Math.pow(radius / 1000.0, 2); double circleArea = Math.PI * Math.pow(radius / 1000.0, 2);
int totalHouseCount = model.getTotalHouseCount(); int totalHouseCount = model.getTotalHouseCount();
double density = totalHouseCount * 2.49 / circleArea; double density = totalHouseCount * 2.49 / circleArea;
double peopleScore1 = ShopScoreUtil.peopleScore1(density); double peopleScore1 = ShopScoreUtil.peopleScore1(density);
model.setPeopleScore1(peopleScore1); model.setPeopleScore1(peopleScore1);
// 办公人口 // 办公人口
int totalCountOffice = model.getTotalCountOffice(); int totalCountOffice = model.getTotalCountOffice();
density = totalCountOffice / circleArea; density = totalCountOffice / circleArea;
double peopleScore2 = ShopScoreUtil.peopleScore2(density); double peopleScore2 = ShopScoreUtil.peopleScore2(density);
@@ -289,17 +289,17 @@ public class ReportController extends BaseController {
model.setPeopleScore(peopleScore1 > peopleScore2 ? peopleScore1 : peopleScore2); model.setPeopleScore(peopleScore1 > peopleScore2 ? peopleScore1 : peopleScore2);
// 消费指数 // 消费指数
model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅")); model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅"));
double cityConsumMin = model.getCityConsumMin(); double cityConsumMin = model.getCityConsumMin();
double cityConsumMax = model.getCityConsumMax(); double cityConsumMax = model.getCityConsumMax();
if (null != model.getAvgConsumption()) { if (null != model.getAvgConsumption()) {
model.setHigher((model.getAvgConsumption() - cityConsumMin) * 100.0 / (cityConsumMax - cityConsumMin)); model.setHigher((model.getAvgConsumption() - cityConsumMin) * 100.0 / (cityConsumMax - cityConsumMin));
} }
List<String> allKw = Arrays.asList(new String[]{ "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市", List<String> allKw = Arrays.asList(new String[]{ "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市",
"高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴","医院", "公园", "学校", "体育馆","银行", "商场", "大型超市", "餐饮"}); "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴","医院", "公园", "学校", "体育馆","银行", "商场", "大型超市", "餐饮"});
Map<String,JSONObject> baiduKwResult = baiduApiService.searchNearBy(allKw, lat, lng, radius, model.getBaiduMapKey()); Map<String,JSONObject> baiduKwResult = baiduApiService.searchNearBy(allKw, lat, lng, radius, model.getBaiduMapKey());
String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" }; String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" };
Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length); Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
Integer c = getTotal(baiduKwResult.get(ks[i])); Integer c = getTotal(baiduKwResult.get(ks[i]));
@@ -310,8 +310,8 @@ public class ReportController extends BaseController {
model.setConsumCountMap(countMap); model.setConsumCountMap(countMap);
model.setConsumScore(ShopScoreUtil.consumScore(model.getAvgConsumption(), countMap)); model.setConsumScore(ShopScoreUtil.consumScore(model.getAvgConsumption(), countMap));
// 环境指数 // 环境指数
ks = new String[] { "医院", "公园", "学校", "体育馆" }; ks = new String[] { "医院", "公园", "学校", "体育馆" };
Map<String, Integer> aroundCountMap = new HashMap<String, Integer>(); Map<String, Integer> aroundCountMap = new HashMap<String, Integer>();
countMap = new HashMap<String, Integer>(ks.length); countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
@@ -320,14 +320,14 @@ public class ReportController extends BaseController {
countMap.put(ks[i], c); countMap.put(ks[i], c);
} }
} }
countMap.put("地铁站", null == model.getMetroStations() ? null : model.getMetroStations().size()); countMap.put("地铁站", null == model.getMetroStations() ? null : model.getMetroStations().size());
countMap.put("公交点", null == model.getBusStations() ? null : model.getBusStations().size()); countMap.put("公交点", null == model.getBusStations() ? null : model.getBusStations().size());
aroundCountMap.putAll(countMap); aroundCountMap.putAll(countMap);
double aroundScore1 = ShopScoreUtil.aroundScore1(countMap); double aroundScore1 = ShopScoreUtil.aroundScore1(countMap);
model.setAroundScore1(aroundScore1); model.setAroundScore1(aroundScore1);
ks = new String[] { "银行", "商场", "大型超市", "餐饮" }; ks = new String[] { "银行", "商场", "大型超市", "餐饮" };
countMap = new HashMap<String, Integer>(ks.length); countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
Integer c = getTotal(baiduKwResult.get(ks[i])); Integer c = getTotal(baiduKwResult.get(ks[i]));
@@ -441,7 +441,7 @@ public class ReportController extends BaseController {
model.setShowPdfLink(true); model.setShowPdfLink(true);
} }
// 楼盘指数 // 楼盘指数
SeaweedNumberic numberic = seaweedNumbericDao.findDistrict(city, region, district.getName()); SeaweedNumberic numberic = seaweedNumbericDao.findDistrict(city, region, district.getName());
model.setDetailScore(DistrictScoreUtil.detailScore(district, numberic)); model.setDetailScore(DistrictScoreUtil.detailScore(district, numberic));
@@ -454,9 +454,9 @@ public class ReportController extends BaseController {
model.setDetailScore4(DistrictScoreUtil.detailScore4(nullNumberic ? null : numberic.getCubagePercent())); model.setDetailScore4(DistrictScoreUtil.detailScore4(nullNumberic ? null : numberic.getCubagePercent()));
model.setDetailScore5(DistrictScoreUtil.detailScore5(district.getBuildType(), nullNumberic ? null : numberic.getCarSiteCount())); model.setDetailScore5(DistrictScoreUtil.detailScore5(district.getBuildType(), nullNumberic ? null : numberic.getCarSiteCount()));
// 房价指数 // 房价指数
RegionStat cityStat = regionStatService.findByCity(city); RegionStat cityStat = regionStatService.findByCity(city);
// Integer cityLeave = 0;//最高房价和最低房价的差值 // Integer cityLeave = 0;//最高房价和最低房价的差值
if (null != cityStat) { if (null != cityStat) {
model.setCityPrice(cityStat.getAvgPrice()); model.setCityPrice(cityStat.getAvgPrice());
// Integer citySellMin = model.getCityDistrictMinSellPrice(); // Integer citySellMin = model.getCityDistrictMinSellPrice();
@@ -481,7 +481,7 @@ public class ReportController extends BaseController {
if(StringUtils.isNotBlank(district.getRegion())){ if(StringUtils.isNotBlank(district.getRegion())){
params.add(new QueryParam("region", district.getRegion())); params.add(new QueryParam("region", district.getRegion()));
} }
Date lastMonthEndDate = DateUtil.getLastEndMonthDate(new Date());// 检索上上月的数据 Date lastMonthEndDate = DateUtil.getLastEndMonthDate(new Date());// 检索上上月的数据
params.add(new QueryParam("endMonthDate", lastMonthEndDate)); params.add(new QueryParam("endMonthDate", lastMonthEndDate));
List<RegionStatRent> regionStatRentList=regionStatRentDao.findAllByParams(params); List<RegionStatRent> regionStatRentList=regionStatRentDao.findAllByParams(params);
model.setRegionStatRents(regionStatRentList); model.setRegionStatRents(regionStatRentList);
@@ -490,10 +490,10 @@ public class ReportController extends BaseController {
rentBo = districtStatRentService.findByDistrictStatRent(districtKey,2); rentBo = districtStatRentService.findByDistrictStatRent(districtKey,2);
List<Integer> rentList = new ArrayList<Integer>(); List<Integer> rentList = new ArrayList<Integer>();
String estateType = district.getEstateType2(); String estateType = district.getEstateType2();
if(!estateType.contains("别墅")){ if(!estateType.contains("别墅")){
estateType = "小区"; estateType = "小区";
}else{ }else{
estateType = "别墅"; estateType = "别墅";
} }
Map<Integer,Integer> districtStatRents = districtStatRentService.findByDistrictStatRent(districtKey, estateType); Map<Integer,Integer> districtStatRents = districtStatRentService.findByDistrictStatRent(districtKey, estateType);
@@ -523,7 +523,7 @@ public class ReportController extends BaseController {
if (null != stat) { if (null != stat) {
Map<String, Integer> priceMap = districtStatService.getCityDistriceMinAndMaxPrice(model.getCityName()); Map<String, Integer> priceMap = districtStatService.getCityDistriceMinAndMaxPrice(model.getCityName());
//设置价格 //设置价格
model.setCityDistrictMinSellPrice(priceMap.get("cityDistrictMinSellPrice")); model.setCityDistrictMinSellPrice(priceMap.get("cityDistrictMinSellPrice"));
model.setCityDistrictMaxSellPrice(priceMap.get("cityDistrictMaxSellPrice")); model.setCityDistrictMaxSellPrice(priceMap.get("cityDistrictMaxSellPrice"));
@@ -541,11 +541,11 @@ public class ReportController extends BaseController {
} }
} }
// 潜力指数 // 潜力指数
String buildType = "小区"; String buildType = "小区";
if (null == statBo.getDistrictStat() && null != statBo.getVillaDistrictStat()) { if (null == statBo.getDistrictStat() && null != statBo.getVillaDistrictStat()) {
avgPrice = statBo.getVillaDistrictStat().getAvgPrice(); avgPrice = statBo.getVillaDistrictStat().getAvgPrice();
buildType = "别墅"; buildType = "别墅";
} else if (null != statBo.getDistrictStat()) { } else if (null != statBo.getDistrictStat()) {
avgPrice = statBo.getDistrictStat().getAvgPrice(); avgPrice = statBo.getDistrictStat().getAvgPrice();
} }
@@ -572,9 +572,9 @@ public class ReportController extends BaseController {
model.setSellTradeUrl(model.getCityUrl() + "/cImg/" + SecurityUtil.encode(urlBuilder.toString()) model.setSellTradeUrl(model.getCityUrl() + "/cImg/" + SecurityUtil.encode(urlBuilder.toString())
+ (isRefreshCache ? "?__refresh_cache=1" : "")); + (isRefreshCache ? "?__refresh_cache=1" : ""));
// 稀缺指数 // 稀缺指数
model.setRegionOrg(regionBlockService.getOrgName(city, region, "region")); model.setRegionOrg(regionBlockService.getOrgName(city, region, "region"));
model.setBlockOrg(block + "板块"); model.setBlockOrg(block + "板块");
model.setRegionDistrictCount(districtService.findRegionDistrictCount(city, region)); model.setRegionDistrictCount(districtService.findRegionDistrictCount(city, region));
//model.setBlockDistrictCount(districtService.findBlockDistrictCount(city, region, block)); //model.setBlockDistrictCount(districtService.findBlockDistrictCount(city, region, block));
model.setCityDistrictCount(districtService.findCityDistrictCount(city)); model.setCityDistrictCount(districtService.findCityDistrictCount(city));
@@ -615,8 +615,8 @@ public class ReportController extends BaseController {
model.setMaxDealPriceCount(districtAnalyDataService.findMaxDealCountByCity(city)); model.setMaxDealPriceCount(districtAnalyDataService.findMaxDealCountByCity(city));
model.setMaxSellCount(districtAnalyDataService.findMaxSellCountByCity(city)); model.setMaxSellCount(districtAnalyDataService.findMaxSellCountByCity(city));
model.setDistrictAnalyData(districtAnalyData); model.setDistrictAnalyData(districtAnalyData);
// 消费指数 // 消费指数
model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅")); model.setAvgConsumption(bizShopService.findAroundAvgConsumption(lat, lng, radius, "餐厅"));
double cityConsumMin = model.getCityConsumMin(); double cityConsumMin = model.getCityConsumMin();
double cityConsumMax = model.getCityConsumMax(); double cityConsumMax = model.getCityConsumMax();
@@ -624,11 +624,11 @@ public class ReportController extends BaseController {
model.setHigher((model.getAvgConsumption() - cityConsumMin) * 100.0 / (cityConsumMax - cityConsumMin)); model.setHigher((model.getAvgConsumption() - cityConsumMin) * 100.0 / (cityConsumMax - cityConsumMin));
} }
List<String> allKs = Arrays.asList(new String[]{ List<String> allKs = Arrays.asList(new String[]{
"KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴", "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴",
"医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园", "网吧", "医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园", "网吧" "医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园", "网吧", "医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园", "网吧"
}); });
Map<String,JSONObject> kwResult = baiduApiService.searchNearBy(allKs, lat, lng, radius, model.getBaiduMapKey()); Map<String,JSONObject> kwResult = baiduApiService.searchNearBy(allKs, lat, lng, radius, model.getBaiduMapKey());
String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" }; String[] ks = new String[] { "KTV", "电影院", "健身中心", "商场", "美容院", "星级酒店", "大型超市", "高尔夫球场", "私立学校", "整形", "咖啡厅", "洗浴" };
Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length); Map<String, Integer> countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
countMap.put(ks[i], getTotal(kwResult.get(ks[i]))); countMap.put(ks[i], getTotal(kwResult.get(ks[i])));
@@ -636,34 +636,34 @@ public class ReportController extends BaseController {
model.setConsumCountMap(countMap); model.setConsumCountMap(countMap);
model.setConsumScore(DistrictScoreUtil.consumScore(model.getAvgConsumption(), countMap)); model.setConsumScore(DistrictScoreUtil.consumScore(model.getAvgConsumption(), countMap));
// 环境指数 // 环境指数
Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius); Map<String, List<BusStation>> stationMap = busStationService.getNearByStations(city, lat, lng, radius);
model.setMetroStations(stationMap.get("地铁")); model.setMetroStations(stationMap.get("地铁"));
model.setBusStations(stationMap.get("公交")); model.setBusStations(stationMap.get("公交"));
ks = new String[] { "医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园", "网吧" }; ks = new String[] { "医院", "学校", "写字楼", "银行", "ATM", "超市", "停车场", "公园", "网吧" };
//厌恶设施 //厌恶设施
String[] keys = new String[]{"发电厂","变电站","垃圾焚烧厂","化工厂"}; String[] keys = new String[]{"发电厂","变电站","垃圾焚烧厂","化工厂"};
countMap = new HashMap<String, Integer>(ks.length); countMap = new HashMap<String, Integer>(ks.length);
for (int i = 0; i < ks.length; i++) { for (int i = 0; i < ks.length; i++) {
countMap.put(ks[i], getTotal(kwResult.get(ks[i]))); countMap.put(ks[i], getTotal(kwResult.get(ks[i])));
} }
//添加厌恶设施 //添加厌恶设施
for (int i = 0; i < keys.length; i++) { for (int i = 0; i < keys.length; i++) {
countMap.put(ks[i], getTotal(kwResult.get(ks[i]))); countMap.put(ks[i], getTotal(kwResult.get(ks[i])));
} }
countMap.put("地铁站", null == model.getMetroStations() ? null : model.getMetroStations().size()); countMap.put("地铁站", null == model.getMetroStations() ? null : model.getMetroStations().size());
countMap.put("公交点", null == model.getBusStations() ? null : model.getBusStations().size()); countMap.put("公交点", null == model.getBusStations() ? null : model.getBusStations().size());
// 虹桥机场 121.352578,31.200062 // 虹桥机场 121.352578,31.200062
// 浦东机场 121.807085,31.160702 // 浦东机场 121.807085,31.160702
double dis = GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062); double dis = GeoUtils.calculateDistance(lng, lat, 121.352578, 31.200062);
if (dis <= radius) { if (dis <= radius) {
countMap.put("机场", 1); countMap.put("机场", 1);
} else { } else {
dis = GeoUtils.calculateDistance(lng, lat, 121.807085, 31.160702); dis = GeoUtils.calculateDistance(lng, lat, 121.807085, 31.160702);
if (dis <= radius) { if (dis <= radius) {
countMap.put("机场", 1); countMap.put("机场", 1);
} }
} }
@@ -763,7 +763,7 @@ public class ReportController extends BaseController {
district.setAvgPrice(avgPrice); district.setAvgPrice(avgPrice);
district.setKind(commData.getKind()); district.setKind(commData.getKind());
if (district.getName().endsWith("村")) { if (district.getName().endsWith("村")) {
oldHouseCount += count; oldHouseCount += count;
} else { } else {
if (avgPrice >= model.getCityAvgPrice()) { if (avgPrice >= model.getCityAvgPrice()) {
@@ -775,10 +775,10 @@ public class ReportController extends BaseController {
} }
} }
} }
model.setTotalHouseCount(oldHouseCount + hightLevelDistrictHouseCount + commonDistrictHouseCount);// 总户数 model.setTotalHouseCount(oldHouseCount + hightLevelDistrictHouseCount + commonDistrictHouseCount);// 总户数
model.setCommonDistrictHouseCount(commonDistrictHouseCount);// 高级商品房户数 model.setCommonDistrictHouseCount(commonDistrictHouseCount);// 高级商品房户数
model.setHightDistrictHouseCount(hightLevelDistrictHouseCount);// 普通户数 model.setHightDistrictHouseCount(hightLevelDistrictHouseCount);// 普通户数
model.setOldHouseCount(oldHouseCount);// 老工房 户数 model.setOldHouseCount(oldHouseCount);// 老工房 户数
} }
return model; return model;
} }
@@ -823,11 +823,11 @@ public class ReportController extends BaseController {
} }
if (StringUtils.isNotBlank(office.getBedKind())) { if (StringUtils.isNotBlank(office.getBedKind())) {
if (office.getBedKind().equals("甲级")) { if (office.getBedKind().equals("甲级")) {
bestLevelCount = bestLevelCount + office.getHouseholdCount(); bestLevelCount = bestLevelCount + office.getHouseholdCount();
} else if (office.getBedKind().equals("乙级")) { } else if (office.getBedKind().equals("乙级")) {
betterLevelCount = betterLevelCount + office.getHouseholdCount(); betterLevelCount = betterLevelCount + office.getHouseholdCount();
} else if (office.getBedKind().equals("丙级")) { } else if (office.getBedKind().equals("丙级")) {
goodLevelCount = goodLevelCount + office.getHouseholdCount(); goodLevelCount = goodLevelCount + office.getHouseholdCount();
} else { } else {
otherLevelCount = otherLevelCount + office.getHouseholdCount(); otherLevelCount = otherLevelCount + office.getHouseholdCount();
@@ -875,7 +875,7 @@ public class ReportController extends BaseController {
return model; return model;
} }
//获取报告编号 //获取报告编号
public String getNumber(){ public String getNumber(){
String number = ""; String number = "";
while(StringUtil.isBlank(number)){ while(StringUtil.isBlank(number)){
@@ -917,7 +917,7 @@ public class ReportController extends BaseController {
DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district.getCity(), district DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district.getCity(), district
.getRegion(), district.getName())); .getRegion(), district.getName()));
DistrictStat districtStat = null; DistrictStat districtStat = null;
if (StringUtils.contains(evaluation.getBuildType(), "别墅")) { if (StringUtils.contains(evaluation.getBuildType(), "别墅")) {
districtStat = districtStatBo.getVillaDistrictStat(); districtStat = districtStatBo.getVillaDistrictStat();
} else { } else {
districtStat = districtStatBo.getDistrictStat(); districtStat = districtStatBo.getDistrictStat();
@@ -962,7 +962,7 @@ public class ReportController extends BaseController {
DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district.getCity(), district DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district.getCity(), district
.getRegion(), district.getName())); .getRegion(), district.getName()));
DistrictStat districtStat = null; DistrictStat districtStat = null;
if (StringUtils.contains(district.getEstateType2(), "别墅")) { if (StringUtils.contains(district.getEstateType2(), "别墅")) {
districtStat = districtStatBo.getVillaDistrictStat(); districtStat = districtStatBo.getVillaDistrictStat();
} else { } else {
districtStat = districtStatBo.getDistrictStat(); districtStat = districtStatBo.getDistrictStat();
@@ -33,7 +33,7 @@ import java.util.List;
import java.util.Random; import java.util.Random;
/** /**
*估价报告查看 *估价报告查看
*@author wenyan *@author wenyan
*/ */
public class ReportViewController extends BaseController { public class ReportViewController extends BaseController {
@@ -47,7 +47,7 @@ public class ReportViewController extends BaseController {
String serialNumber; String serialNumber;
// 根据id查找商铺 // 根据id查找商铺
Shop shop = null; Shop shop = null;
if (ObjectId.isValid(model.getId())) { if (ObjectId.isValid(model.getId())) {
shop = shopService.findById(model.getId()); shop = shopService.findById(model.getId());
@@ -236,7 +236,7 @@ public class ReportViewController extends BaseController {
DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district.getCity(), district DistrictStatBo districtStatBo = districtStatService.findDistrictStat(new DistrictKey(district.getCity(), district
.getRegion(), district.getName())); .getRegion(), district.getName()));
DistrictStat districtStat = null; DistrictStat districtStat = null;
if (StringUtils.contains(district.getEstateType2(), "别墅")) { if (StringUtils.contains(district.getEstateType2(), "别墅")) {
districtStat = districtStatBo.getVillaDistrictStat(); districtStat = districtStatBo.getVillaDistrictStat();
} else { } else {
districtStat = districtStatBo.getDistrictStat(); districtStat = districtStatBo.getDistrictStat();
@@ -254,7 +254,7 @@ public class ReportViewController extends BaseController {
return avgPrice; return avgPrice;
} }
//获取报告编号 //获取报告编号
public String getNumber(){ public String getNumber(){
String number = ""; String number = "";
while(StringUtil.isBlank(number)){ while(StringUtil.isBlank(number)){
@@ -27,7 +27,7 @@ import com.fangjia.service.bo.DistrictStatBo;
import com.fangjia.service.district.ShopStatService; import com.fangjia.service.district.ShopStatService;
/** /**
* 报告样例 * 报告样例
* Created by wenyan on 2015/11/27. * Created by wenyan on 2015/11/27.
*/ */
public class SampleController extends BaseController{ public class SampleController extends BaseController{
@@ -41,7 +41,7 @@ public class SampleController extends BaseController{
DistrictKey districtKey = new DistrictKey(model.getCityName(), model.getRegion(), model.getDistrictName()); DistrictKey districtKey = new DistrictKey(model.getCityName(), model.getRegion(), model.getDistrictName());
District district = districtService.findDistrict(districtKey,"district"); District district = districtService.findDistrict(districtKey,"district");
model.setDistrict(district); model.setDistrict(district);
/* 获取下载份数,菜单控制by tom */ /* 获取下载份数,菜单控制by tom */
String uid = cookieContext.getCookieValue(request, "fpk_uid"); String uid = cookieContext.getCookieValue(request, "fpk_uid");
if (StringUtils.isNotBlank(uid)) { if (StringUtils.isNotBlank(uid)) {
FpkUsers fpkUser = fpkUsersService.findById(SecurityUtil FpkUsers fpkUser = fpkUsersService.findById(SecurityUtil
@@ -61,7 +61,7 @@ public class SampleController extends BaseController{
DistrictKey districtKey = new DistrictKey(model.getCityName(), model.getRegion(), model.getDistrictName()); DistrictKey districtKey = new DistrictKey(model.getCityName(), model.getRegion(), model.getDistrictName());
District district = districtService.findDistrict(districtKey,"shop"); District district = districtService.findDistrict(districtKey,"shop");
model.setDistrict(district); model.setDistrict(district);
/* 获取下载份数,菜单控制by tom */ /* 获取下载份数,菜单控制by tom */
String uid = cookieContext.getCookieValue(request, "fpk_uid"); String uid = cookieContext.getCookieValue(request, "fpk_uid");
if (StringUtils.isNotBlank(uid)) { if (StringUtils.isNotBlank(uid)) {
FpkUsers fpkUser = fpkUsersService.findById(SecurityUtil FpkUsers fpkUser = fpkUsersService.findById(SecurityUtil
@@ -136,7 +136,7 @@ public class SearchController {
//nameQuery.add(new TermQuery(new Term("address", keyword)), Occur.SHOULD); //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("addr_alias_std", keyword)), Occur.SHOULD);
nameQuery.add(new TermQuery(new Term("keyword", 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); srQuery1.add(nameQuery, Occur.SHOULD);
params.add(new QueryParam("$sr", new SrQuery(srQuery1))); params.add(new QueryParam("$sr", new SrQuery(srQuery1)));
List<District> districts = districtService.findAllByParams(params, 0, limit, new String[] { "region", "name","address", "addrAlias" }); List<District> districts = districtService.findAllByParams(params, 0, limit, new String[] { "region", "name","address", "addrAlias" });
@@ -151,7 +151,7 @@ public class SearchController {
bo.setRegion(district.getRegion()); bo.setRegion(district.getRegion());
ret.add(bo); ret.add(bo);
} }
//对自动完成出来的结果按长短排序 //对自动完成出来的结果按长短排序
if(ret.size() > 0){ if(ret.size() > 0){
Collections.sort(ret, new Comparator<AutoCompleteBo>() { Collections.sort(ret, new Comparator<AutoCompleteBo>() {
public int compare(AutoCompleteBo o1, AutoCompleteBo o2) { public int compare(AutoCompleteBo o1, AutoCompleteBo o2) {
@@ -35,11 +35,11 @@ public class ShapeController {
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY); g2d.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
g2d.setColor(new Color(178,178,178));//改变扇形颜色 g2d.setColor(new Color(178,178,178));//改变扇形颜色
g2d.fillArc(0,0,400,400,90,360); g2d.fillArc(0,0,400,400,90,360);
g2d.setColor(new Color(0,115,230));//改变扇形颜色 g2d.setColor(new Color(0,115,230));//改变扇形颜色
g2d.fillArc(0,0,400,400,90,rim); g2d.fillArc(0,0,400,400,90,rim);
g2d.setColor(new Color(229,229,229));//改变扇形颜色 g2d.setColor(new Color(229,229,229));//改变扇形颜色
g2d.fillArc(50,50,300,300,90,360); g2d.fillArc(50,50,300,300,90,360);
g2d.setColor(new Color(0,115,230)); g2d.setColor(new Color(0,115,230));
Map<TextAttribute, Object> attributes = new HashMap<TextAttribute, Object>(); Map<TextAttribute, Object> attributes = new HashMap<TextAttribute, Object>();
@@ -61,7 +61,7 @@ public class ShapeController {
unitStart = 200 + 25; unitStart = 200 + 25;
}else if("0".equals(scoreStr)){ }else if("0".equals(scoreStr)){
scoreStr ="-"; scoreStr ="-";
g2d.setFont(new Font("微软雅黑", Font.BOLD, 12*a).deriveFont(attributes)); g2d.setFont(new Font("微软雅黑", Font.BOLD, 12*a).deriveFont(attributes));
g2d.drawString(scoreStr, 200 - w + 10, 230); g2d.drawString(scoreStr, 200 - w + 10, 230);
unitStart = 175; unitStart = 175;
}else{ }else{
@@ -70,11 +70,11 @@ public class ShapeController {
} }
if("0".equals(scoreStr)){ if("0".equals(scoreStr)){
g2d.setFont(new Font("微软雅黑", Font.BOLD, 12*a).deriveFont(attributes)); g2d.setFont(new Font("微软雅黑", Font.BOLD, 12*a).deriveFont(attributes));
g2d.drawString("分", unitStart, 200); g2d.drawString("分", unitStart, 200);
}else{ }else{
g2d.setFont(new Font("微软雅黑", Font.BOLD, 12*a).deriveFont(attributes)); g2d.setFont(new Font("微软雅黑", Font.BOLD, 12*a).deriveFont(attributes));
g2d.drawString("分", unitStart, 252); g2d.drawString("分", unitStart, 252);
} }
g2d.dispose(); g2d.dispose();
cache.put(model.getScore(), image); cache.put(model.getScore(), image);
@@ -33,33 +33,33 @@ public class UserController {
mav.setModel(data); mav.setModel(data);
String password = model.getPassword(); String password = model.getPassword();
if (StringUtils.isBlank(model.getUserName())) { if (StringUtils.isBlank(model.getUserName())) {
data.put("userNameMsg","用户名不能为空"); data.put("userNameMsg","用户名不能为空");
return mav; return mav;
} }
if (StringUtils.isBlank(model.getPassword())) { if (StringUtils.isBlank(model.getPassword())) {
data.put("passwordMsg","密码不能为空"); data.put("passwordMsg","密码不能为空");
return mav; return mav;
} }
FpkUsers user = fpkUsersDao.findByName(model.getUserName()); FpkUsers user = fpkUsersDao.findByName(model.getUserName());
if (null == user) { if (null == user) {
data.put("userNameMsg","用户名不存在"); data.put("userNameMsg","用户名不存在");
return mav; return mav;
} }
if (!user.getPassword().equals(DigestUtils.md5Hex(password))) { if (!user.getPassword().equals(DigestUtils.md5Hex(password))) {
data.put("passwordMsg","密码错误"); data.put("passwordMsg","密码错误");
return mav; return mav;
} }
if(!user.isEnabled()){ if(!user.isEnabled()){
data.put("userNameMsg","账户被禁用,请联系我们!"); data.put("userNameMsg","账户被禁用,请联系我们!");
return mav; return mav;
} }
if(user.getExpiryDate() != null && user.getExpiryDate().before(new Date())){ if(user.getExpiryDate() != null && user.getExpiryDate().before(new Date())){
data.put("userNameMsg","您的账户已过期!"); data.put("userNameMsg","您的账户已过期!");
return mav; return mav;
} }
@@ -82,7 +82,7 @@ public class UserController {
} }
} }
if(city == null || location == null){ if(city == null || location == null){
data.put("userNameMsg","权限不足!"); data.put("userNameMsg","权限不足!");
}else{ }else{
if(StringUtils.isNotBlank(model.getForm())){ if(StringUtils.isNotBlank(model.getForm())){
location = URLDecoder.decode(model.getForm(),"UTF-8"); location = URLDecoder.decode(model.getForm(),"UTF-8");
@@ -118,7 +118,7 @@ public class UserController {
mav.setModel(data); mav.setModel(data);
FpkUsers users = model.getUser(); FpkUsers users = model.getUser();
if(!users.getPassword().equals(DigestUtils.md5Hex(model.getPasswordOld()))){ if(!users.getPassword().equals(DigestUtils.md5Hex(model.getPasswordOld()))){
data.put("passwordOldMsg","原密码错误"); data.put("passwordOldMsg","原密码错误");
return mav; return mav;
} }
Map<String,Object> map = new HashMap<String, Object>(); Map<String,Object> map = new HashMap<String, Object>();
@@ -12,7 +12,7 @@ import java.io.IOException;
import java.util.Map; import java.util.Map;
/** /**
* 该标签主要用于把Java对象转成JavaScript对象输出 * 该标签主要用于把Java对象转成JavaScript对象输出
*/ */
public class JsonDirective implements TemplateDirectiveModel { public class JsonDirective implements TemplateDirectiveModel {
@@ -73,7 +73,7 @@ public class AccessLogFilter implements Filter {
LOGGER.error("error process request: request_url=" + analyticsBean.requestUrl + ", referer=" LOGGER.error("error process request: request_url=" + analyticsBean.requestUrl + ", referer="
+ analyticsBean.refererUrl, rootCause); + analyticsBean.refererUrl, rootCause);
} }
// 记录运行超过1秒的请求到日志中 // 记录运行超过1秒的请求到日志中
final long time = System.currentTimeMillis() - start; final long time = System.currentTimeMillis() - start;
final String actionUri = (String) request.getAttribute(ActionContext.ACTION_URI); final String actionUri = (String) request.getAttribute(ActionContext.ACTION_URI);
if (time > 1000 || (!ChafangtongConfig.getConfig().isProductionEnvironment() && executeCounter.getTotalCount() > 0)) { if (time > 1000 || (!ChafangtongConfig.getConfig().isProductionEnvironment() && executeCounter.getTotalCount() > 0)) {
@@ -94,7 +94,7 @@ public class AccessLogFilter implements Filter {
private void writeAccessLog(AnalyticsBean analyticsBean, long duration, String actionUri, int statusCode, String method) { private void writeAccessLog(AnalyticsBean analyticsBean, long duration, String actionUri, int statusCode, String method) {
StringBuilder logStr = new StringBuilder(); StringBuilder logStr = new StringBuilder();
// 不要改变顺序 // 不要改变顺序
logStr.append(DATE_FORMAT.format(analyticsBean.startTime));// 1 logStr.append(DATE_FORMAT.format(analyticsBean.startTime));// 1
logStr.append(SPLIT).append(StringUtils.defaultString(analyticsBean.connectionIp));// 2 logStr.append(SPLIT).append(StringUtils.defaultString(analyticsBean.connectionIp));// 2
logStr.append(SPLIT).append(StringUtils.defaultString(analyticsBean.ip));// 3 logStr.append(SPLIT).append(StringUtils.defaultString(analyticsBean.ip));// 3
@@ -105,7 +105,7 @@ public class AnalyticsBean {
} }
/** /**
* 获得连接客户端的IP(部署环境下一般都设有nginx等http服务器) * 获得连接客户端的IP(部署环境下一般都设有nginx等http服务器)
* *
* @param request * @param request
* @return * @return
@@ -123,7 +123,7 @@ public class AnalyticsBean {
String citySpell = getCitySpell(request.getRequestURL().toString()); String citySpell = getCitySpell(request.getRequestURL().toString());
ServerArea city = ServerAreaData.getServerAreaByNameOrSpellDefaultNull(citySpell); ServerArea city = ServerAreaData.getServerAreaByNameOrSpellDefaultNull(citySpell);
if (null != city) { if (null != city) {
// 保存至cookie // 保存至cookie
Cookie cityCookie = cookieContext.createCookie(CookieName.COOKIE_CITY, citySpell); Cookie cityCookie = cookieContext.createCookie(CookieName.COOKIE_CITY, citySpell);
cityCookie.setMaxAge(Integer.MAX_VALUE); cityCookie.setMaxAge(Integer.MAX_VALUE);
response.addCookie(cityCookie); response.addCookie(cityCookie);
@@ -137,7 +137,7 @@ public class AnalyticsBean {
} }
private String createUID(HttpServletRequest request, HttpServletResponse response) { private String createUID(HttpServletRequest request, HttpServletResponse response) {
// 设置UUID // 设置UUID
String uuid = new ObjectId().toString(); String uuid = new ObjectId().toString();
Cookie uuidCookie = cookieContext.createCookie(CookieName.UID, uuid); Cookie uuidCookie = cookieContext.createCookie(CookieName.UID, uuid);
uuidCookie.setMaxAge(Integer.MAX_VALUE); uuidCookie.setMaxAge(Integer.MAX_VALUE);
@@ -152,7 +152,7 @@ public class AnalyticsBean {
} }
private String createSID(HttpServletRequest request, HttpServletResponse response) { private String createSID(HttpServletRequest request, HttpServletResponse response) {
// 设置session id // 设置session id
String sid = new ObjectId().toString(); String sid = new ObjectId().toString();
Cookie uuidCookie = cookieContext.createCookie(CookieName.SID, sid); Cookie uuidCookie = cookieContext.createCookie(CookieName.SID, sid);
uuidCookie.setMaxAge(-1); uuidCookie.setMaxAge(-1);
@@ -165,7 +165,7 @@ public class AnalyticsBean {
} }
/** /**
* 请求url,不包括query string * 请求url,不包括query string
* *
* @return * @return
*/ */
@@ -174,7 +174,7 @@ public class AnalyticsBean {
} }
/** /**
* 请求url后的请求参数,如果参数不为空则包括问号在内 * 请求url后的请求参数,如果参数不为空则包括问号在内
* *
* @return * @return
*/ */
@@ -183,7 +183,7 @@ public class AnalyticsBean {
} }
/** /**
* 请求uri * 请求uri
* *
* @return * @return
*/ */
@@ -192,7 +192,7 @@ public class AnalyticsBean {
} }
/** /**
* 来源url * 来源url
* *
* @return * @return
*/ */
@@ -201,7 +201,7 @@ public class AnalyticsBean {
} }
/** /**
* 完整的请求url,包括query string * 完整的请求url,包括query string
* *
* @return * @return
*/ */
@@ -210,7 +210,7 @@ public class AnalyticsBean {
} }
/** /**
* 是否刷新缓存 * 是否刷新缓存
* *
* @return * @return
*/ */
@@ -219,7 +219,7 @@ public class AnalyticsBean {
} }
/** /**
* 当前城市,可能为null * 当前城市,可能为null
* *
* @return * @return
*/ */
@@ -228,7 +228,7 @@ public class AnalyticsBean {
} }
/** /**
* 当前城市,不会为null * 当前城市,不会为null
* *
* @return * @return
*/ */
@@ -237,7 +237,7 @@ public class AnalyticsBean {
} }
/** /**
* cookie中的uid,如果没有则生成新的uid * cookie中的uid,如果没有则生成新的uid
* *
* @return * @return
*/ */
@@ -246,7 +246,7 @@ public class AnalyticsBean {
} }
/** /**
* 全局的请求id * 全局的请求id
* *
* @return * @return
*/ */
@@ -255,7 +255,7 @@ public class AnalyticsBean {
} }
/** /**
* cookie中的会话id,如果没有则生成新的sid * cookie中的会话id,如果没有则生成新的sid
* *
* @return * @return
*/ */
@@ -264,7 +264,7 @@ public class AnalyticsBean {
} }
/** /**
* 是否为ajax请求 * 是否为ajax请求
* *
* @return * @return
*/ */
@@ -273,7 +273,7 @@ public class AnalyticsBean {
} }
/** /**
* 访问者的真实ip * 访问者的真实ip
* *
* @return * @return
*/ */
@@ -282,7 +282,7 @@ public class AnalyticsBean {
} }
/** /**
* 访问者标识,可能为null * 访问者标识,可能为null
* *
* @return * @return
*/ */
@@ -291,7 +291,7 @@ public class AnalyticsBean {
} }
/** /**
* 连接ip * 连接ip
* *
* @return * @return
*/ */
@@ -300,7 +300,7 @@ public class AnalyticsBean {
} }
/** /**
* cookie中的uid,如果没有则为空字符串 * cookie中的uid,如果没有则为空字符串
* *
* @return * @return
*/ */
@@ -309,7 +309,7 @@ public class AnalyticsBean {
} }
/** /**
* cookie中的会话id,如果没有则为空字符串 * cookie中的会话id,如果没有则为空字符串
* *
* @return * @return
*/ */
@@ -318,7 +318,7 @@ public class AnalyticsBean {
} }
/** /**
* 请求开始时间 * 请求开始时间
* *
* @return * @return
*/ */
@@ -59,12 +59,12 @@ public class AnalyticsFilter implements Filter {
ServletException { ServletException {
final AnalyticsBean analyticsBean = AnalyticsBean.get(request, response); final AnalyticsBean analyticsBean = AnalyticsBean.get(request, response);
// 点击日志 // 点击日志
if (analyticsBean.requestUrl.indexOf("/__utm.gif") > -1) { if (analyticsBean.requestUrl.indexOf("/__utm.gif") > -1) {
processUtmGifLog(request, response, analyticsBean); processUtmGifLog(request, response, analyticsBean);
return; return;
} }
// // 判断URL是否合法,不合法则重定向 // // 判断URL是否合法,不合法则重定向
// String redirectUrl = checkUrlFormat(analyticsBean); // String redirectUrl = checkUrlFormat(analyticsBean);
// if (null != redirectUrl) { // if (null != redirectUrl) {
// if (analyticsBean.isSpider()) { // if (analyticsBean.isSpider()) {
@@ -84,7 +84,7 @@ public class AnalyticsFilter implements Filter {
threadLocalData.put(ThreadLocalKey.DisableCache, "1"); threadLocalData.put(ThreadLocalKey.DisableCache, "1");
} }
// //
// // 切换城市 // // 切换城市
// FangjiaServerAreaContextHolder.setServerArea(analyticsBean.city); // FangjiaServerAreaContextHolder.setServerArea(analyticsBean.city);
// threadLocalData.put(ThreadLocalKey.FromSpider, analyticsBean.isSpider()); // threadLocalData.put(ThreadLocalKey.FromSpider, analyticsBean.isSpider());
chain.doFilter(request, response); chain.doFilter(request, response);
@@ -105,7 +105,7 @@ public class AnalyticsFilter implements Filter {
responseOutputStream.close(); responseOutputStream.close();
String userAgent = analyticsBean.userAgent; String userAgent = analyticsBean.userAgent;
if (userAgent != null && (userAgent.indexOf("Googlebot-Image") >= 0 || userAgent.indexOf("Baidu") >= 0)) { if (userAgent != null && (userAgent.indexOf("Googlebot-Image") >= 0 || userAgent.indexOf("Baidu") >= 0)) {
// 过滤爬虫的访问 // 过滤爬虫的访问
return; return;
} }
jmsTemplate.send(utmgifDestination, new MessageCreator() { jmsTemplate.send(utmgifDestination, new MessageCreator() {
@@ -138,7 +138,7 @@ public class AnalyticsFilter implements Filter {
} }
/** /**
* 判断URL是否合法,合法则返回null,否则返回重定向URL * 判断URL是否合法,合法则返回null,否则返回重定向URL
* *
* @param requestUrl * @param requestUrl
* @param requestUri * @param requestUri
@@ -148,7 +148,7 @@ public class AnalyticsFilter implements Filter {
private String checkUrlFormat(AnalyticsBean analyticsBean) { private String checkUrlFormat(AnalyticsBean analyticsBean) {
ChafangtongConfig fangjiaConfig = ChafangtongConfig.getConfig(); ChafangtongConfig fangjiaConfig = ChafangtongConfig.getConfig();
String hostName = StringUtils.substringBetween(analyticsBean.requestUrl, "http://", "/"); String hostName = StringUtils.substringBetween(analyticsBean.requestUrl, "http://", "/");
// 如果hostName中有端口号,则把端口号去掉 // 如果hostName中有端口号,则把端口号去掉
int index = hostName.indexOf(":"); int index = hostName.indexOf(":");
if (index > 0) { if (index > 0) {
hostName = hostName.substring(0, index); hostName = hostName.substring(0, index);
@@ -168,7 +168,7 @@ public class AnalyticsFilter implements Filter {
return fangjiaConfig.getCityDomainName(city) + analyticsBean.requestUri + analyticsBean.queryString; return fangjiaConfig.getCityDomainName(city) + analyticsBean.requestUri + analyticsBean.queryString;
} }
if (city != null) { if (city != null) {
// 找到对应的城市,或者是一个有效的二级域名 // 找到对应的城市,或者是一个有效的二级域名
return null; return null;
} }
if (prefixSplit[0].equalsIgnoreCase("www")) { if (prefixSplit[0].equalsIgnoreCase("www")) {
@@ -53,7 +53,7 @@ public class SpiderValidateFilter implements Filter {
private void checkReload() { private void checkReload() {
if (this.reloading.compareAndSet(false, true)) { if (this.reloading.compareAndSet(false, true)) {
try { try {
// 5分钟reload一次 // 5分钟reload一次
if (System.currentTimeMillis() - lastReloadTimestamp < 300000) { if (System.currentTimeMillis() - lastReloadTimestamp < 300000) {
return; return;
} }
@@ -87,13 +87,13 @@ public class SpiderValidateFilter implements Filter {
if (isValidUserAgent(ua)) { if (isValidUserAgent(ua)) {
for (String spiderName : spiderDomains.keySet()) { for (String spiderName : spiderDomains.keySet()) {
if (!ua.contains(spiderName)) { if (!ua.contains(spiderName)) {
// 未声明自己为spider则跳过 // 未声明自己为spider则跳过
continue; continue;
} }
if (null == ip) { if (null == ip) {
spider = new Spider(spiderName, ip, ua); spider = new Spider(spiderName, ip, ua);
spider.setFake(true); spider.setFake(true);
// 对ip为null的蜘蛛暂时不入数据库 // 对ip为null的蜘蛛暂时不入数据库
} else { } else {
spider = spiders.get(ip); spider = spiders.get(ip);
if (null == spider) { if (null == spider) {
@@ -106,7 +106,7 @@ public class SpiderValidateFilter implements Filter {
} else { } else {
spider = new Spider("unkown", ip, ua); spider = new Spider("unkown", ip, ua);
spider.setFake(true); spider.setFake(true);
// 对userAgent为null的蜘蛛暂时不入数据库 // 对userAgent为null的蜘蛛暂时不入数据库
} }
} }
if (spider != null && spider.isFake()) { if (spider != null && spider.isFake()) {
@@ -145,7 +145,7 @@ public class SpiderValidateFilter implements Filter {
private void validateSpider(Spider spider) { private void validateSpider(Spider spider) {
if (null == spider.getId()) { if (null == spider.getId()) {
// 新发现的蜘蛛 // 新发现的蜘蛛
checkSpider(spider); checkSpider(spider);
spiderService.upsertByIp(spider); spiderService.upsertByIp(spider);
spiders.put(spider.getIp(), spider); spiders.put(spider.getIp(), spider);
@@ -153,23 +153,23 @@ public class SpiderValidateFilter implements Filter {
LOGGER.info("find new spider: " + spider); LOGGER.info("find new spider: " + spider);
} }
} else if (spider.isVerified()) { } else if (spider.isVerified()) {
// 已人工验证的蜘蛛 // 已人工验证的蜘蛛
spiders.put(spider.getIp(), spider); spiders.put(spider.getIp(), spider);
} else if (spider.isFake()) { } else if (spider.isFake()) {
// 已发现的假蜘蛛 // 已发现的假蜘蛛
Date yestoday = DateUtils.addDays(new Date(), -1); Date yestoday = DateUtils.addDays(new Date(), -1);
if (spider.getModificationDate().before(yestoday)) { if (spider.getModificationDate().before(yestoday)) {
// 删除超过1天的假蜘蛛信息 // 删除超过1天的假蜘蛛信息
spiderService.deleteByIp(spider.getIp()); spiderService.deleteByIp(spider.getIp());
spiders.remove(spider.getIp()); spiders.remove(spider.getIp());
} else { } else {
spiders.put(spider.getIp(), spider); spiders.put(spider.getIp(), spider);
} }
} else { } else {
// 已发现的真蜘蛛 // 已发现的真蜘蛛
Date lastWeek = DateUtils.addDays(new Date(), -7); Date lastWeek = DateUtils.addDays(new Date(), -7);
if (spider.getModificationDate().before(lastWeek)) { if (spider.getModificationDate().before(lastWeek)) {
// 重新验证超过7天的真蜘蛛 // 重新验证超过7天的真蜘蛛
checkSpider(spider); checkSpider(spider);
if (spider.isFake()) { if (spider.isFake()) {
spiderService.deleteByIp(spider.getIp()); spiderService.deleteByIp(spider.getIp());
@@ -191,10 +191,10 @@ public class SpiderValidateFilter implements Filter {
String host = nslookup(spider.getIp()); String host = nslookup(spider.getIp());
if (null != host) { if (null != host) {
spider.setHost(host); spider.setHost(host);
// 不是相同域的为假蜘蛛 // 不是相同域的为假蜘蛛
spider.setFake(!isSameDomain(host, spiderDomains.get(spider.getName()))); spider.setFake(!isSameDomain(host, spiderDomains.get(spider.getName())));
} else { } else {
// 反向解析失败,则默认为真蜘蛛 // 反向解析失败,则默认为真蜘蛛
spider.setHost(spider.getIp()); spider.setHost(spider.getIp());
spider.setFake(false); spider.setFake(false);
} }
@@ -31,7 +31,7 @@ import java.net.URLEncoder;
import java.util.*; import java.util.*;
/** /**
* 查房通权限拦截器 * 查房通权限拦截器
* Created by wenyan on 2015/11/12. * Created by wenyan on 2015/11/12.
*/ */
public class AuthenticationInterceptor implements Interceptor { public class AuthenticationInterceptor implements Interceptor {
@@ -75,11 +75,11 @@ public class AuthenticationInterceptor implements Interceptor {
isPassed = false; isPassed = false;
} }
if(isPassed && city == null){ if(isPassed && city == null){
LOGGER.info("无法访问" + request.getRequestURI() + "请用cityName 指定访问资源所在的城市"); LOGGER.info("无法访问" + request.getRequestURI() + "请用cityName 指定访问资源所在的城市");
error = "noAuth"; error = "noAuth";
} }
if(isPassed && !isAccessible(user, city, request)){ if(isPassed && !isAccessible(user, city, request)){
LOGGER.info("无法访问" + request.getRequestURI() + "!!!请到菜单管理添加菜单"); LOGGER.info("无法访问" + request.getRequestURI() + "!!!请到菜单管理添加菜单");
isPassed = false; isPassed = false;
error = "noAuth"; error = "noAuth";
} }
@@ -235,7 +235,7 @@ public class BaseModel extends ModelAndViewSupport {
} }
/** /**
* 如果queryString不为空则在前面加上问号"?",否则不加 * 如果queryString不为空则在前面加上问号"?",否则不加
* *
* @return * @return
*/ */
@@ -5,7 +5,7 @@ import com.fangjia.service.bo.DistrictStatBo;
public class ConsumModel extends ChafangtongModel { public class ConsumModel extends ChafangtongModel {
private static final long serialVersionUID = 6142958920656840695L; private static final long serialVersionUID = 6142958920656840695L;
private Double avgConsumption; // 周边餐饮人均消费 private Double avgConsumption; // 周边餐饮人均消费
private DistrictStatBo statBo; private DistrictStatBo statBo;
private Double higher; private Double higher;
@@ -3,17 +3,17 @@ package com.fangjia.chafangtong.model;
public final class Models { public final class Models {
/** /**
* 404错误面页的model * 404错误面页的model
*/ */
public static final BaseModel NOT_FOUNT = createModel(404, "/error"); public static final BaseModel NOT_FOUNT = createModel(404, "/error");
/** /**
* 一般错误面页的model * 一般错误面页的model
*/ */
public static final BaseModel ERROR = createModel(500, "/error"); public static final BaseModel ERROR = createModel(500, "/error");
/** /**
* 500错误面页的model * 500错误面页的model
*/ */
public static final BaseModel FORBIDDEN = createModel(400, "/forbidden"); public static final BaseModel FORBIDDEN = createModel(400, "/forbidden");
@@ -13,7 +13,7 @@ public class NoResultModel extends ChafangtongModel {
private double maxLng; private double maxLng;
double centerLat; double centerLat;
double centerLng; double centerLng;
String type; // r: 矩形搜索(最大最小经纬度),c:圆形搜索(中心点、半径) String type; // r: 矩形搜索(最大最小经纬度),c:圆形搜索(中心点、半径)
List<Map<String, String>> result; List<Map<String, String>> result;
public List<AroundMarker> getInsideShops() { public List<AroundMarker> getInsideShops() {
@@ -11,15 +11,15 @@ import com.fangjia.service.bo.DistrictStatRentBo;
public class NodistrictModel extends ChafangtongModel { public class NodistrictModel extends ChafangtongModel {
private static final long serialVersionUID = -2866501361955105846L; private static final long serialVersionUID = -2866501361955105846L;
// 房价 // 房价
Integer areaPrice; Integer areaPrice;
Integer cityPrice; Integer cityPrice;
Double priceLeft; Double priceLeft;
List<DistrictStatBo> priceNearest; // 最近的3个商铺价格 List<DistrictStatBo> priceNearest; // 最近的3个商铺价格
List<DistrictStat> priceTop5; // 最高的5个 List<DistrictStat> priceTop5; // 最高的5个
List<DistrictStat> priceBtm5; // 最低的5个 List<DistrictStat> priceBtm5; // 最低的5个
// 租金 // 租金
Integer areaRent1; Integer areaRent1;
Integer areaRent2; Integer areaRent2;
Integer areaRent3; Integer areaRent3;
@@ -30,7 +30,7 @@ public class NodistrictModel extends ChafangtongModel {
DistrictStatRent[] rentRank3; DistrictStatRent[] rentRank3;
DistrictStatRent[] rentRank4; DistrictStatRent[] rentRank4;
Double avgConsumption; // 周边餐饮人均消费 Double avgConsumption; // 周边餐饮人均消费
Double higher; Double higher;
List<BusStation> metroStations; List<BusStation> metroStations;
@@ -11,30 +11,30 @@ import com.fangjia.service.bo.DistrictStatBo;
public class NoshopModel extends ChafangtongModel { public class NoshopModel extends ChafangtongModel {
private static final long serialVersionUID = -170439161907268598L; private static final long serialVersionUID = -170439161907268598L;
// 房价 // 房价
Integer areaPrice; Integer areaPrice;
Integer cityPrice; Integer cityPrice;
Double priceLeft; Double priceLeft;
List<DistrictStatBo> priceNearest; // 最近的3个商铺价格 List<DistrictStatBo> priceNearest; // 最近的3个商铺价格
List<DistrictStat> priceTop5; // 最高的5个 List<DistrictStat> priceTop5; // 最高的5个
List<DistrictStat> priceBtm5; // 最低的5个 List<DistrictStat> priceBtm5; // 最低的5个
// 租金 // 租金
Integer areaRentPrice; Integer areaRentPrice;
Integer cityRentPrice; Integer cityRentPrice;
Double rentLeft; Double rentLeft;
List<DistrictBusinessStatRent> rentNearest; // 最近的3个商铺价格 List<DistrictBusinessStatRent> rentNearest; // 最近的3个商铺价格
List<DistrictBusinessStatRent> rentTop5; // 最高的5个 List<DistrictBusinessStatRent> rentTop5; // 最高的5个
List<DistrictBusinessStatRent> rentBtm5; // 最低的5个 List<DistrictBusinessStatRent> rentBtm5; // 最低的5个
// 地段 // 地段
List<BusStation> metroStations; List<BusStation> metroStations;
List<BusStation> busStations; List<BusStation> busStations;
double disHongqiaoAirport; double disHongqiaoAirport;
double disHongqiaoStation; double disHongqiaoStation;
Map<String, Double> typePercentMap; Map<String, Double> typePercentMap;
// 人口 // 人口
int cityAvgPrice; int cityAvgPrice;
String districts; String districts;
String offices; String offices;
@@ -55,8 +55,8 @@ public class NoshopModel extends ChafangtongModel {
Double left1; Double left1;
Double left2; Double left2;
// 消费 // 消费
Double avgConsumption; // 周边餐饮人均消费 Double avgConsumption; // 周边餐饮人均消费
Double higher; Double higher;
private final String[] PIE_COLOR_RGBS = new String[] { "#C6DBF7", "#F5EEBD", "#DEE7C6", "#FFD7BD", "#D6C3E7", "#C3E1E7", private final String[] PIE_COLOR_RGBS = new String[] { "#C6DBF7", "#F5EEBD", "#DEE7C6", "#FFD7BD", "#D6C3E7", "#C3E1E7",
@@ -29,7 +29,7 @@ public class ReportModel extends ChafangtongModel {
List<String> pieColors; List<String> pieColors;
List<String> pieMarkers; List<String> pieMarkers;
// 综合指数 // 综合指数
double detailScore; double detailScore;
double detailScore1; double detailScore1;
double detailScore2; double detailScore2;
@@ -39,7 +39,7 @@ public class ReportModel extends ChafangtongModel {
double shopArea; double shopArea;
List<Object[]> aroundTypes; List<Object[]> aroundTypes;
// 房价指数 // 房价指数
double priceScore; double priceScore;
Integer cityPrice; Integer cityPrice;
DistrictStatBo statBo; DistrictStatBo statBo;
@@ -48,21 +48,21 @@ public class ReportModel extends ChafangtongModel {
List<RegionStatRent> regionStatRents; List<RegionStatRent> regionStatRents;
List<DistrictStatRentBo> rentStatBos; List<DistrictStatRentBo> rentStatBos;
// 租金指数 // 租金指数
double rentScore; double rentScore;
DistrictBusinessStatRentBo rentStatBo; DistrictBusinessStatRentBo rentStatBo;
String regionPayment; String regionPayment;
Double rentLeft; Double rentLeft;
String rentTradeUrl; String rentTradeUrl;
// 地段指数 // 地段指数
double localScore; double localScore;
double localScore1; double localScore1;
double localScore2; double localScore2;
Integer regionPrice; Integer regionPrice;
String aroundPieUrl; String aroundPieUrl;
// 人口指数 // 人口指数
double peopleScore; double peopleScore;
double peopleScore1; double peopleScore1;
double peopleScore2; double peopleScore2;
@@ -79,26 +79,26 @@ public class ReportModel extends ChafangtongModel {
Double left1; Double left1;
Double left2; Double left2;
// 消费指数 // 消费指数
double consumScore; double consumScore;
Double avgConsumption; // 周边餐饮人均消费 Double avgConsumption; // 周边餐饮人均消费
Double higher; Double higher;
Map<String, Integer> consumCountMap; Map<String, Integer> consumCountMap;
// 环境指数 // 环境指数
double aroundScore; double aroundScore;
double aroundScore1; double aroundScore1;
double aroundScore2; double aroundScore2;
Map<String, Integer> aroundCountMap; Map<String, Integer> aroundCountMap;
// 潜力指数 // 潜力指数
double predictScore; double predictScore;
Integer predictPrice; Integer predictPrice;
Double predictMarkup; Double predictMarkup;
Integer districtMinPrice; Integer districtMinPrice;
Integer districtMaxPrice; Integer districtMaxPrice;
// 稀缺指数 // 稀缺指数
double rankScore; double rankScore;
DistrictHot districtHot; DistrictHot districtHot;
DistrictAttentionRank districtAttention; DistrictAttentionRank districtAttention;
@@ -113,7 +113,7 @@ public class ReportModel extends ChafangtongModel {
double totalScore; double totalScore;
private FpkDownload fpkDownload; private FpkDownload fpkDownload;
//报告编号 //报告编号
private String serialNum; private String serialNum;
private Integer totalPrice; private Integer totalPrice;
@@ -3,7 +3,7 @@ package com.fangjia.chafangtong.model;
import org.sothis.web.mvc.ModelAndViewSupport; import org.sothis.web.mvc.ModelAndViewSupport;
/** /**
* 用于restAPI的ModelAndView * 用于restAPI的ModelAndView
* *
* @author velna * @author velna
* *
@@ -49,7 +49,7 @@ public class ChartImgServlet extends HttpServlet {
@Override @Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.setCharacterEncoding("UTF-8");// 注意编码 request.setCharacterEncoding("UTF-8");// 注意编码
String reqUrl = request.getRequestURI(); String reqUrl = request.getRequestURI();
String i = reqUrl.substring(reqUrl.indexOf("/cImg/") + 6, reqUrl.length()); String i = reqUrl.substring(reqUrl.indexOf("/cImg/") + 6, reqUrl.length());
@@ -107,7 +107,7 @@ public class ChartImgServlet extends HttpServlet {
} }
/** /**
* 处理均价类走势图 * 处理均价类走势图
* *
* @throws IOException * @throws IOException
*/ */
@@ -170,7 +170,7 @@ public class ChartImgServlet extends HttpServlet {
} }
/** /**
* 处理租金类走势图 * 处理租金类走势图
* *
* @throws IOException * @throws IOException
*/ */
@@ -233,7 +233,7 @@ public class ChartImgServlet extends HttpServlet {
} }
/** /**
* 周边行业饼图 * 周边行业饼图
* *
* @throws IOException * @throws IOException
*/ */
@@ -305,7 +305,7 @@ public class ChartImgServlet extends HttpServlet {
} }
/** /**
* 卖家关注度排行柱状图 * 卖家关注度排行柱状图
* *
* @throws IOException * @throws IOException
*/ */
@@ -56,7 +56,7 @@ public class ReportServlet extends HttpServlet {
System.setProperty("javax.xml.transform.TransformerFactory", System.setProperty("javax.xml.transform.TransformerFactory",
"com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl"); "com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl");
// 字体文件 // 字体文件
ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
FONT_PATHS.add(classLoader.getResource("districtreport/SIMSUN.TTC").toString()); FONT_PATHS.add(classLoader.getResource("districtreport/SIMSUN.TTC").toString());
FONT_PATHS.add(classLoader.getResource("districtreport/SIMHEI.TTF").toString()); FONT_PATHS.add(classLoader.getResource("districtreport/SIMHEI.TTF").toString());
@@ -106,11 +106,11 @@ public class ReportServlet extends HttpServlet {
PdfCopy copy = new PdfCopy(document, resp.getOutputStream()); PdfCopy copy = new PdfCopy(document, resp.getOutputStream());
document.open(); document.open();
document.newPage(); document.newPage();
// // 封面 // // 封面
// PdfReader reader = new PdfReader(FRONTCOVER_DATA); // PdfReader reader = new PdfReader(FRONTCOVER_DATA);
// PdfImportedPage coverPage = copy.getImportedPage(reader, 1); // PdfImportedPage coverPage = copy.getImportedPage(reader, 1);
// copy.addPage(coverPage); // copy.addPage(coverPage);
// // 目录 // // 目录
// reader = new PdfReader(DIRECTORY_DATA); // reader = new PdfReader(DIRECTORY_DATA);
// PdfImportedPage directoryPage = copy.getImportedPage(reader, 1); // PdfImportedPage directoryPage = copy.getImportedPage(reader, 1);
// copy.addPage(directoryPage); // copy.addPage(directoryPage);
@@ -129,7 +129,7 @@ public class ReportServlet extends HttpServlet {
} }
/** /**
* 根据页面URL获取内容 * 根据页面URL获取内容
*/ */
private byte[] getPageData(String pagePath,HttpServletRequest request) { private byte[] getPageData(String pagePath,HttpServletRequest request) {
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();
@@ -151,7 +151,7 @@ public class ReportServlet extends HttpServlet {
html = html.replaceAll("&ensp;", "&#8194;"); html = html.replaceAll("&ensp;", "&#8194;");
renderer.setDocumentFromString(html); renderer.setDocumentFromString(html);
// 解决中文支持问题 // 解决中文支持问题
ITextFontResolver fontResolver = renderer.getFontResolver(); ITextFontResolver fontResolver = renderer.getFontResolver();
for (String path : FONT_PATHS) { for (String path : FONT_PATHS) {
fontResolver.addFont(path, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED); fontResolver.addFont(path, BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
@@ -14,68 +14,68 @@ import com.fangjia.service.bo.DistrictStatRentBo;
public class DistrictScoreUtil { public class DistrictScoreUtil {
/** /**
* 城市平均租金(确认) * 城市平均租金(确认)
*/ */
private final static int CITY_AVG_RENT_PRICE = 5847; private final static int CITY_AVG_RENT_PRICE = 5847;
/** /**
* 市均餐饮人均消费(确认) * 市均餐饮人均消费(确认)
*/ */
private final static int CITY_AVG_CONSUMPTION = 50; private final static int CITY_AVG_CONSUMPTION = 50;
/** /**
* 上月房源平均发布量(确认) * 上月房源平均发布量(确认)
* modify by shibb 2015-6-18 * modify by shibb 2015-6-18
*/ */
// private final static int LAST_MONTH_HOUSES_AVG = 200; // private final static int LAST_MONTH_HOUSES_AVG = 200;
private final static int LAST_MONTH_HOUSES_AVG = 65; private final static int LAST_MONTH_HOUSES_AVG = 65;
/** /**
* 半年房源平均发布量(确认) * 半年房源平均发布量(确认)
*/ */
private final static int HALF_YEAR_HOUSES_AVG = 1000; private final static int HALF_YEAR_HOUSES_AVG = 1000;
/** /**
* 市均容积率(确认) * 市均容积率(确认)
*/ */
private final static double CITY_AVG_CUBAGE_PERCENT = 2.0; private final static double CITY_AVG_CUBAGE_PERCENT = 2.0;
/** /**
* 市均绿化率(确认) * 市均绿化率(确认)
*/ */
private final static double CITY_AVG_VIRESCENCE_PERCENT = 40; private final static double CITY_AVG_VIRESCENCE_PERCENT = 40;
/** /**
* 城市户均占地面积(确认) * 城市户均占地面积(确认)
*/ */
private final static double CITY_AVG_HOUSEHOLD_ALLAREA = 50; private final static double CITY_AVG_HOUSEHOLD_ALLAREA = 50;
/** /**
* 城市户均建筑面积(确认) * 城市户均建筑面积(确认)
*/ */
private final static double CITY_AVG_HOUSEHOLD_BUILDAREA = 100; private final static double CITY_AVG_HOUSEHOLD_BUILDAREA = 100;
/** /**
* 市均停车位(确认) * 市均停车位(确认)
*/ */
private final static double CITY_AVG_CAR_SITE = 300; private final static double CITY_AVG_CAR_SITE = 300;
/** /**
* 市均物业费(确认) * 市均物业费(确认)
*/ */
private final static double CITY_AVG_ESTATE_CHARGE = 1.59; private final static double CITY_AVG_ESTATE_CHARGE = 1.59;
/** /**
* 稀缺度指数中关注度所占比重 * 稀缺度指数中关注度所占比重
*/ */
private final static int ATTENTION_RATIO = 7; private final static int ATTENTION_RATIO = 7;
/** /**
* 稀缺度指数中挂牌量所占比重 * 稀缺度指数中挂牌量所占比重
*/ */
private final static int HOT_RATIO = 3; private final static int HOT_RATIO = 3;
/** /**
* 房价指数 * 房价指数
* modify by shibb 2015-6-19 * modify by shibb 2015-6-19
*/ */
public static double priceScore(Integer districtPrice, Integer cityPrice, Integer leave, List<DistrictStatRentBo> rentBos) { public static double priceScore(Integer districtPrice, Integer cityPrice, Integer leave, List<DistrictStatRentBo> rentBos) {
@@ -184,11 +184,11 @@ public class DistrictScoreUtil {
} }
/** /**
* 新的计算房价指数的方法 * 新的计算房价指数的方法
* *
* @param districtAvgPrice 小区均价 * @param districtAvgPrice 小区均价
* @param cityAvgPrice * @param cityAvgPrice
* @param mPrice 方差 * @param mPrice 方差
* @param rentBos * @param rentBos
* @return * @return
*/ */
@@ -254,32 +254,32 @@ public class DistrictScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "属于城市中房价较低的住宅"; return "属于城市中房价较低的住宅";
case 2: case 2:
return "属于城市中房价较低的住宅"; return "属于城市中房价较低的住宅";
case 3: case 3:
return "属于城市中房价较低的住宅"; return "属于城市中房价较低的住宅";
case 4: case 4:
return "属于接近城市均价的住宅"; return "属于接近城市均价的住宅";
case 5: case 5:
return "属于接近城市均价的住宅"; return "属于接近城市均价的住宅";
case 6: case 6:
return "属于略高于城市均价的住宅"; return "属于略高于城市均价的住宅";
case 7: case 7:
return "属于城市中房价较高的住宅"; return "属于城市中房价较高的住宅";
case 8: case 8:
return "属于城市中房价较高的住宅"; return "属于城市中房价较高的住宅";
case 9: case 9:
return "属于城市中房价非常高的住宅"; return "属于城市中房价非常高的住宅";
case 10: case 10:
return "属于城市中房价非常高的住宅"; return "属于城市中房价非常高的住宅";
default: default:
return ""; return "";
} }
} }
/** /**
* 消费指数 * 消费指数
* modify by shibb 2015-6-18 * modify by shibb 2015-6-18
*/ */
public static double consumScore(Double avgConsumption, Map<String, Integer> countMap) { public static double consumScore(Double avgConsumption, Map<String, Integer> countMap) {
@@ -317,12 +317,12 @@ public class DistrictScoreUtil {
} }
} }
if (null != countMap.get("商场")) { if (null != countMap.get("商场")) {
ret += 0.2; ret += 0.2;
// if (countMap.get("商场") >= 5) { // if (countMap.get("商场") >= 5) {
// ret += 0.3; // ret += 0.3;
// } // }
if (countMap.get("商场") >= 8) { if (countMap.get("商场") >= 8) {
ret += 0.3; ret += 0.3;
} }
} }
@@ -335,48 +335,48 @@ public class DistrictScoreUtil {
ret += 0.1; ret += 0.1;
} }
} }
if (null != countMap.get("电影院")) { if (null != countMap.get("电影院")) {
ret += 0.1; ret += 0.1;
} }
if (null != countMap.get("健身中心")) { if (null != countMap.get("健身中心")) {
ret += 0.2; ret += 0.2;
} }
if (null != countMap.get("美容院")) { if (null != countMap.get("美容院")) {
ret += 0.1; ret += 0.1;
// if (countMap.get("美容院") >= 5) { // if (countMap.get("美容院") >= 5) {
// ret += 0.2; // ret += 0.2;
// } // }
if (countMap.get("美容院") >= 20) { if (countMap.get("美容院") >= 20) {
ret += 0.1; ret += 0.1;
} }
} }
if (null != countMap.get("大型超市")) { if (null != countMap.get("大型超市")) {
ret += 0.2; ret += 0.2;
} }
if (null != countMap.get("高尔夫球场")) { if (null != countMap.get("高尔夫球场")) {
ret += 0.5; ret += 0.5;
} }
if (null != countMap.get("私立学校")) { if (null != countMap.get("私立学校")) {
ret += 0.2; ret += 0.2;
if (countMap.get("私立学校") >= 5) { if (countMap.get("私立学校") >= 5) {
ret += 0.3; ret += 0.3;
} }
} }
if (null != countMap.get("整形")) { if (null != countMap.get("整形")) {
ret += 0.2; ret += 0.2;
if (countMap.get("整形") >= 3) { if (countMap.get("整形") >= 3) {
ret += 0.3; ret += 0.3;
} }
} }
if (null != countMap.get("洗浴")) { if (null != countMap.get("洗浴")) {
ret += 0.1; ret += 0.1;
} }
if (null != countMap.get("私立医院")) { if (null != countMap.get("私立医院")) {
ret += 0.2; ret += 0.2;
} }
if (null != countMap.get("星级酒店")) { if (null != countMap.get("星级酒店")) {
ret += 0.2; ret += 0.2;
// if (countMap.get("星级酒店") >= 5) { // if (countMap.get("星级酒店") >= 5) {
// ret += 0.2; // ret += 0.2;
// } // }
} }
@@ -388,44 +388,44 @@ public class DistrictScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "周边消费水平非常低,生活成<br>本低廉"; return "周边消费水平非常低,生活成<br>本低廉";
case 2: case 2:
return "周边消费水平非常低,生活成<br>本低廉"; return "周边消费水平非常低,生活成<br>本低廉";
case 3: case 3:
return "周边消费水平较低,生活成<br>本较低"; return "周边消费水平较低,生活成<br>本较低";
case 4: case 4:
return "周边消费水平较低,生活成<br>本较低"; return "周边消费水平较低,生活成<br>本较低";
case 5: case 5:
return "周边消费水平一般"; return "周边消费水平一般";
case 6: case 6:
return "周边消费水平一般"; return "周边消费水平一般";
case 7: case 7:
return "周边消费水平较高,生活成<br>本较高"; return "周边消费水平较高,生活成<br>本较高";
case 8: case 8:
return "周边消费水平较高,生活成<br>本较高"; return "周边消费水平较高,生活成<br>本较高";
case 9: case 9:
return "周边消费水平非常高,生活成<br>本昂贵"; return "周边消费水平非常高,生活成<br>本昂贵";
case 10: case 10:
return "周边消费水平非常高,生活成<br>本昂贵"; return "周边消费水平非常高,生活成<br>本昂贵";
default: default:
return ""; return "";
} }
} }
/** /**
* 环境指数计算 * 环境指数计算
* modify by shibb 2015-6-18 * modify by shibb 2015-6-18
*/ */
public static double aroundScore(Map<String, Integer> countMap) { public static double aroundScore(Map<String, Integer> countMap) {
double ret = 0d; double ret = 0d;
int schoolCount = null == countMap.get("学校") ? 0 : countMap.get("学校"); int schoolCount = null == countMap.get("学校") ? 0 : countMap.get("学校");
int hospitalCount = null == countMap.get("医院") ? 0 : countMap.get("医院"); int hospitalCount = null == countMap.get("医院") ? 0 : countMap.get("医院");
int bankCount = null == countMap.get("银行") ? 0 : countMap.get("银行"); int bankCount = null == countMap.get("银行") ? 0 : countMap.get("银行");
if (null != countMap.get("公交点")) { if (null != countMap.get("公交点")) {
int busCount = countMap.get("公交点"); int busCount = countMap.get("公交点");
if (null == countMap.get("地铁站") || countMap.get("地铁站") == 0) { if (null == countMap.get("地铁站") || countMap.get("地铁站") == 0) {
if (busCount <= 3) { if (busCount <= 3) {
ret += 1; ret += 1;
} else if (busCount <= 8) { } else if (busCount <= 8) {
@@ -438,7 +438,7 @@ public class DistrictScoreUtil {
ret += 5; ret += 5;
} }
} else { } else {
int metroCount = countMap.get("地铁站"); int metroCount = countMap.get("地铁站");
if (metroCount < 1) { if (metroCount < 1) {
if (busCount <= 3) { if (busCount <= 3) {
ret += 1; ret += 1;
@@ -490,27 +490,27 @@ public class DistrictScoreUtil {
} }
} }
if (null != countMap.get("写字楼") && countMap.get("写字楼") >= 5) { if (null != countMap.get("写字楼") && countMap.get("写字楼") >= 5) {
ret += 0.5; ret += 0.5;
} }
if (null != countMap.get("停车场")) { if (null != countMap.get("停车场")) {
ret += 0.5; ret += 0.5;
} }
// if (null != countMap.get("超市") && countMap.get("超市") >= 5) { // if (null != countMap.get("超市") && countMap.get("超市") >= 5) {
// ret += 0.5; // ret += 0.5;
// } // }
if (null != countMap.get("超市") && countMap.get("超市") >= 15) { if (null != countMap.get("超市") && countMap.get("超市") >= 15) {
ret += 0.5; ret += 0.5;
} }
// if (null != countMap.get("公园") && countMap.get("公园") >= 5) { // if (null != countMap.get("公园") && countMap.get("公园") >= 5) {
// ret += 0.5; // ret += 0.5;
// } // }
if (null != countMap.get("公园")) { if (null != countMap.get("公园")) {
ret += 0.5; ret += 0.5;
} }
//add by shibb //add by shibb
if (null != countMap.get("发电站") || null != countMap.get("变电站") || null != countMap.get("垃圾焚烧厂") || null != countMap.get("化工厂")) { if (null != countMap.get("发电站") || null != countMap.get("变电站") || null != countMap.get("垃圾焚烧厂") || null != countMap.get("化工厂")) {
ret -= 1; ret -= 1;
} }
@@ -521,32 +521,32 @@ public class DistrictScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "周边公共配套非常差,生活很不便"; return "周边公共配套非常差,生活很不便";
case 2: case 2:
return "周边公共配套非常差,生活很不便"; return "周边公共配套非常差,生活很不便";
case 3: case 3:
return "周边公共配套较差,生活较为不便"; return "周边公共配套较差,生活较为不便";
case 4: case 4:
return "周边公共配套较差,生活较为不便"; return "周边公共配套较差,生活较为不便";
case 5: case 5:
return "周边公共配套一般,生活便利<br>指数一般"; return "周边公共配套一般,生活便利<br>指数一般";
case 6: case 6:
return "周边公共配套一般,生活便利<br>指数一般"; return "周边公共配套一般,生活便利<br>指数一般";
case 7: case 7:
return "周边公共配套较成熟,生活便利"; return "周边公共配套较成熟,生活便利";
case 8: case 8:
return "周边公共配套较成熟,生活便利"; return "周边公共配套较成熟,生活便利";
case 9: case 9:
return "周边公共配套非常成熟,生活<br>很便利"; return "周边公共配套非常成熟,生活<br>很便利";
case 10: case 10:
return "周边公共配套非常成熟,生活<br>很便利"; return "周边公共配套非常成熟,生活<br>很便利";
default: default:
return ""; return "";
} }
} }
/** /**
* 小区综合指数 * 小区综合指数
*/ */
public static double detailScore(District district, SeaweedNumberic numberic) { public static double detailScore(District district, SeaweedNumberic numberic) {
double ret = 0d; double ret = 0d;
@@ -556,11 +556,11 @@ public class DistrictScoreUtil {
year = numberic.getFinishBuildYear(); year = numberic.getFinishBuildYear();
} }
// 类型 // 类型
if (StringUtils.endsWith(district.getName(), "洋房")) { if (StringUtils.endsWith(district.getName(), "洋房")) {
ret += 9; ret += 9;
} else { } else {
if (StringUtils.contains(district.getEstateType2(), "别墅")) { if (StringUtils.contains(district.getEstateType2(), "别墅")) {
if (year >= 1920 && year <= 1949) { if (year >= 1920 && year <= 1949) {
ret += 9; ret += 9;
} else { } else {
@@ -577,7 +577,7 @@ public class DistrictScoreUtil {
} }
} }
// 户均占地面积 // 户均占地面积
if (null != numberic && null != numberic.getHouseholdCount() && null != numberic.getAllArea() if (null != numberic && null != numberic.getHouseholdCount() && null != numberic.getAllArea()
&& numberic.getHouseholdCount() > 0 && numberic.getAllArea() > 0) { && numberic.getHouseholdCount() > 0 && numberic.getAllArea() > 0) {
double d = numberic.getAllArea() * 1.0 / numberic.getHouseholdCount(); double d = numberic.getAllArea() * 1.0 / numberic.getHouseholdCount();
@@ -589,7 +589,7 @@ public class DistrictScoreUtil {
} }
} }
// 户均建筑面积 // 户均建筑面积
if (null != numberic && null != numberic.getHouseholdCount() && null != numberic.getBuildArea() if (null != numberic && null != numberic.getHouseholdCount() && null != numberic.getBuildArea()
&& numberic.getHouseholdCount() > 0 && numberic.getBuildArea() > 0) { && numberic.getHouseholdCount() > 0 && numberic.getBuildArea() > 0) {
double d = numberic.getBuildArea() * 1.0 / numberic.getHouseholdCount(); double d = numberic.getBuildArea() * 1.0 / numberic.getHouseholdCount();
@@ -602,7 +602,7 @@ public class DistrictScoreUtil {
} }
} }
// 绿化率 // 绿化率
if (null != numberic && null != numberic.getVirescencePercent()) { if (null != numberic && null != numberic.getVirescencePercent()) {
double d = numberic.getVirescencePercent(); double d = numberic.getVirescencePercent();
if (d > CITY_AVG_VIRESCENCE_PERCENT && ((d - CITY_AVG_VIRESCENCE_PERCENT) / CITY_AVG_VIRESCENCE_PERCENT > 0.2)) { if (d > CITY_AVG_VIRESCENCE_PERCENT && ((d - CITY_AVG_VIRESCENCE_PERCENT) / CITY_AVG_VIRESCENCE_PERCENT > 0.2)) {
@@ -612,7 +612,7 @@ public class DistrictScoreUtil {
} }
} }
// 容积率 // 容积率
if (null != numberic && null != numberic.getCubagePercent()) { if (null != numberic && null != numberic.getCubagePercent()) {
double d = numberic.getCubagePercent(); double d = numberic.getCubagePercent();
if (d > CITY_AVG_CUBAGE_PERCENT && ((d - CITY_AVG_CUBAGE_PERCENT) / CITY_AVG_CUBAGE_PERCENT > 0.2)) { if (d > CITY_AVG_CUBAGE_PERCENT && ((d - CITY_AVG_CUBAGE_PERCENT) / CITY_AVG_CUBAGE_PERCENT > 0.2)) {
@@ -622,7 +622,7 @@ public class DistrictScoreUtil {
} }
} }
// 停车位 // 停车位
if (null != numberic && null != numberic.getCarSiteCount()) { if (null != numberic && null != numberic.getCarSiteCount()) {
double d = numberic.getCarSiteCount(); double d = numberic.getCarSiteCount();
if (d > CITY_AVG_CAR_SITE && ((d - CITY_AVG_CAR_SITE) / CITY_AVG_CAR_SITE > 0.2)) { if (d > CITY_AVG_CAR_SITE && ((d - CITY_AVG_CAR_SITE) / CITY_AVG_CAR_SITE > 0.2)) {
@@ -639,7 +639,7 @@ public class DistrictScoreUtil {
ret += 0.5; ret += 0.5;
} }
// 物业费 // 物业费
if (null != numberic && null != numberic.getEstateCharge()) { if (null != numberic && null != numberic.getEstateCharge()) {
double d = numberic.getEstateCharge(); double d = numberic.getEstateCharge();
if (d > CITY_AVG_ESTATE_CHARGE && ((d - CITY_AVG_ESTATE_CHARGE) * 1.0 / CITY_AVG_ESTATE_CHARGE > 0.2)) { if (d > CITY_AVG_ESTATE_CHARGE && ((d - CITY_AVG_ESTATE_CHARGE) * 1.0 / CITY_AVG_ESTATE_CHARGE > 0.2)) {
@@ -656,32 +656,32 @@ public class DistrictScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "属于城市的普通住宅"; return "属于城市的普通住宅";
case 2: case 2:
return "属于城市的普通住宅"; return "属于城市的普通住宅";
case 3: case 3:
return "属于城市的普通住宅"; return "属于城市的普通住宅";
case 4: case 4:
return "属于城市的普通住宅"; return "属于城市的普通住宅";
case 5: case 5:
return "属于城市的普通住宅"; return "属于城市的普通住宅";
case 6: case 6:
return "属于城市的普通住宅"; return "属于城市的普通住宅";
case 7: case 7:
return "属于城市的优质住宅"; return "属于城市的优质住宅";
case 8: case 8:
return "属于城市的优质住宅"; return "属于城市的优质住宅";
case 9: case 9:
return "属于城市的高端住宅"; return "属于城市的高端住宅";
case 10: case 10:
return "属于城市的高端住宅"; return "属于城市的高端住宅";
default: default:
return ""; return "";
} }
} }
/** /**
* 户均占地面积 * 户均占地面积
*/ */
public static double detailScore1(Integer householdCount, Integer allArea) { public static double detailScore1(Integer householdCount, Integer allArea) {
if (null == householdCount || null == allArea || householdCount <= 0 || allArea <= 0) { if (null == householdCount || null == allArea || householdCount <= 0 || allArea <= 0) {
@@ -705,7 +705,7 @@ public class DistrictScoreUtil {
} }
/** /**
* 户均建筑面积 * 户均建筑面积
*/ */
public static double detailScore2(Integer householdCount, Integer buildArea) { public static double detailScore2(Integer householdCount, Integer buildArea) {
if (null == householdCount || null == buildArea || householdCount <= 0 || buildArea <= 0) { if (null == householdCount || null == buildArea || householdCount <= 0 || buildArea <= 0) {
@@ -729,7 +729,7 @@ public class DistrictScoreUtil {
} }
/** /**
* 绿化率 * 绿化率
*/ */
public static double detailScore3(Double virescencePercent) { public static double detailScore3(Double virescencePercent) {
if (null == virescencePercent) { if (null == virescencePercent) {
@@ -752,7 +752,7 @@ public class DistrictScoreUtil {
} }
/** /**
* 容积率 * 容积率
*/ */
public static double detailScore4(Double cubagePercent) { public static double detailScore4(Double cubagePercent) {
if (null == cubagePercent) { if (null == cubagePercent) {
@@ -777,13 +777,13 @@ public class DistrictScoreUtil {
} }
/** /**
* 停车位 * 停车位
*/ */
public static double detailScore5(String buildType, Integer carSiteCount) { public static double detailScore5(String buildType, Integer carSiteCount) {
if (StringUtils.isNotBlank(buildType)) { if (StringUtils.isNotBlank(buildType)) {
buildType = buildType.replaceAll(",", ""); buildType = buildType.replaceAll(",", "");
if ("独栋".equals(buildType) || "双拼".equals(buildType) || "联排".equals(buildType) || "叠加".equals(buildType) if ("独栋".equals(buildType) || "双拼".equals(buildType) || "联排".equals(buildType) || "叠加".equals(buildType)
|| "花园洋房".equals(buildType) || "老洋房".equals(buildType) || "四合院".equals(buildType)) { || "花园洋房".equals(buildType) || "老洋房".equals(buildType) || "四合院".equals(buildType)) {
return 9d; return 9d;
} }
} }
@@ -810,8 +810,8 @@ public class DistrictScoreUtil {
} }
/** /**
* 潜力指数 * 潜力指数
* 稀缺指数 * 稀缺指数
* modify by shibb * modify by shibb
*/ */
public static double rankScore(int regionClickRank, int regionDistrictCount, int lastMonthHouses, int halfYearHouse) { public static double rankScore(int regionClickRank, int regionDistrictCount, int lastMonthHouses, int halfYearHouse) {
@@ -897,7 +897,7 @@ public class DistrictScoreUtil {
// ret -= 1; // ret -= 1;
// } // }
//regionDistrictCount小区平均关注度 //regionDistrictCount小区平均关注度
if (regionClickRank > regionDistrictCount) { if (regionClickRank > regionDistrictCount) {
double d = (regionClickRank - regionDistrictCount) * 1.0 / regionDistrictCount; double d = (regionClickRank - regionDistrictCount) * 1.0 / regionDistrictCount;
if (d > 0.3) { if (d > 0.3) {
@@ -914,8 +914,8 @@ public class DistrictScoreUtil {
} }
/** /**
* 潜力指数 * 潜力指数
* 稀缺指数 * 稀缺指数
* add by shibb * add by shibb
*/ */
public static double rankScore2(double hotRatio, double attentionRatio) { public static double rankScore2(double hotRatio, double attentionRatio) {
@@ -927,27 +927,27 @@ public class DistrictScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 0: case 0:
return "市场上有大量挂牌房源"; return "市场上有大量挂牌房源";
case 1: case 1:
return "市场上有大量挂牌房源"; return "市场上有大量挂牌房源";
case 2: case 2:
return "市场上有大量挂牌房源"; return "市场上有大量挂牌房源";
case 3: case 3:
return "挂牌房源量较充足"; return "挂牌房源量较充足";
case 4: case 4:
return "挂牌房源量较充足"; return "挂牌房源量较充足";
case 5: case 5:
return "挂牌房源量一般"; return "挂牌房源量一般";
case 6: case 6:
return "挂牌房源量一般"; return "挂牌房源量一般";
case 7: case 7:
return "市场上房源较稀缺"; return "市场上房源较稀缺";
case 8: case 8:
return "市场上房源较稀缺"; return "市场上房源较稀缺";
case 9: case 9:
return "市场上房源非常稀缺"; return "市场上房源非常稀缺";
case 10: case 10:
return "市场上房源非常稀缺"; return "市场上房源非常稀缺";
default: default:
return ""; return "";
} }
@@ -997,23 +997,23 @@ public class DistrictScoreUtil {
case 1: case 1:
return ""; return "";
case 2: case 2:
return "房价跌幅明显,预计升值能力较弱"; return "房价跌幅明显,预计升值能力较弱";
case 3: case 3:
return "房价跌幅较明显,预计升值能力较弱"; return "房价跌幅较明显,预计升值能力较弱";
case 4: case 4:
return "房价走势较为平稳,预计未来<br>波动不大"; return "房价走势较为平稳,预计未来<br>波动不大";
case 5: case 5:
return "房价走势平稳,预计未来波动不大"; return "房价走势平稳,预计未来波动不大";
case 6: case 6:
return "房价走势较为平稳,预计未来<br>波动不大"; return "房价走势较为平稳,预计未来<br>波动不大";
case 7: case 7:
return "房价涨幅明显,未来走势理想"; return "房价涨幅明显,未来走势理想";
case 8: case 8:
return "房价涨幅明显,未来走势理想"; return "房价涨幅明显,未来走势理想";
case 9: case 9:
return "房价涨幅较高,未来走势乐观"; return "房价涨幅较高,未来走势乐观";
case 10: case 10:
return "房价涨幅较高,未来走势乐观"; return "房价涨幅较高,未来走势乐观";
default: default:
return ""; return "";
} }
@@ -1024,7 +1024,7 @@ public class DistrictScoreUtil {
if (StringUtils.isBlank(date)) { if (StringUtils.isBlank(date)) {
return 0; return 0;
} }
Pattern p = Pattern.compile("(\\d{4})[-|年|.]?(\\d{1,2})?[-|月|.]?(\\d{1,2})?日?"); Pattern p = Pattern.compile("(\\d{4})[-|年|.]?(\\d{1,2})?[-|月|.]?(\\d{1,2})?日?");
Matcher m = p.matcher(date); Matcher m = p.matcher(date);
Integer year = 0; Integer year = 0;
if (m.find()) { if (m.find()) {
@@ -12,52 +12,52 @@ import com.fangjia.service.bo.DistrictStatBo;
public class ShopScoreUtil { public class ShopScoreUtil {
/** /**
* 市均停车位(确认) * 市均停车位(确认)
*/ */
private final static int CITY_AVG_CAR_SITE_COUNT = 683; private final static int CITY_AVG_CAR_SITE_COUNT = 683;
/** /**
* 市均餐饮人均消费(确认) * 市均餐饮人均消费(确认)
*/ */
private final static int CITY_AVG_CONSUMPTION = 50; private final static int CITY_AVG_CONSUMPTION = 50;
/** /**
* 市均商场建筑规模(面积)(确认) * 市均商场建筑规模(面积)(确认)
*/ */
private final static int CITY_AVG_MALL_AREA = 119250; private final static int CITY_AVG_MALL_AREA = 119250;
/** /**
* 市均居民人口密度(确认) * 市均居民人口密度(确认)
*/ */
//private final static double CITY_AVG_HOUSE_DENSITY = 3030; //private final static double CITY_AVG_HOUSE_DENSITY = 3030;
private final static double CITY_AVG_HOUSE_DENSITY = 3631; private final static double CITY_AVG_HOUSE_DENSITY = 3631;
/** /**
* 市均办公人口密度(确认) * 市均办公人口密度(确认)
*/ */
//private final static double CITY_AVG_OFFICE_DENSITY = 3030; //private final static double CITY_AVG_OFFICE_DENSITY = 3030;
private final static double CITY_AVG_OFFICE_DENSITY = 3631; private final static double CITY_AVG_OFFICE_DENSITY = 3631;
/** /**
* 市均商场竣工年份(确认) * 市均商场竣工年份(确认)
*/ */
private final static int CITY_AVG_FINISH_YAER = 2007; private final static int CITY_AVG_FINISH_YAER = 2007;
/** /**
* 市均商场物业费(确认) * 市均商场物业费(确认)
*/ */
private final static double CITY_AVG_ESTATE_CHARGE = 3.57; private final static double CITY_AVG_ESTATE_CHARGE = 3.57;
/** /**
* 地段指数 * 地段指数
*/ */
public static double localScore(String loopLineInfo, int metros, int buses) { public static double localScore(String loopLineInfo, int metros, int buses) {
double ret = 0d; double ret = 0d;
if ("内环以内".equals(loopLineInfo)) { if ("内环以内".equals(loopLineInfo)) {
ret += 8; ret += 8;
} else if ("中内之间".equals(loopLineInfo) || "中内环间".equals(loopLineInfo)) { } else if ("中内之间".equals(loopLineInfo) || "中内环间".equals(loopLineInfo)) {
ret += 6; ret += 6;
} else if ("中外之间".equals(loopLineInfo) || "中外环间".equals(loopLineInfo)) { } else if ("中外之间".equals(loopLineInfo) || "中外环间".equals(loopLineInfo)) {
ret += 5; ret += 5;
} else if ("外环以外".equals(loopLineInfo)) { } else if ("外环以外".equals(loopLineInfo)) {
ret += 4; ret += 4;
} else { } else {
ret += 3; ret += 3;
@@ -69,8 +69,8 @@ public class ShopScoreUtil {
ret += 0.5; ret += 0.5;
} }
// TODO 板块 // TODO 板块
// TODO A类+1,B类+0.5 // TODO A类+1,B类+0.5
return ret > 10 ? 10 : ret; return ret > 10 ? 10 : ret;
} }
@@ -79,32 +79,32 @@ public class ShopScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "位于城市中偏远的地段"; return "位于城市中偏远的地段";
case 2: case 2:
return "位于城市中偏远的地段"; return "位于城市中偏远的地段";
case 3: case 3:
return "位于城市中较偏远的地段"; return "位于城市中较偏远的地段";
case 4: case 4:
return "位于城市中较偏远的地段"; return "位于城市中较偏远的地段";
case 5: case 5:
return "位于城市中普通地段"; return "位于城市中普通地段";
case 6: case 6:
return "位于城市中普通地段"; return "位于城市中普通地段";
case 7: case 7:
return "位于城市中较好的地段"; return "位于城市中较好的地段";
case 8: case 8:
return "位于城市中较好的地段"; return "位于城市中较好的地段";
case 9: case 9:
return "位于城市中黄金地段"; return "位于城市中黄金地段";
case 10: case 10:
return "位于城市中黄金地段"; return "位于城市中黄金地段";
default: default:
return ""; return "";
} }
} }
/** /**
* 地段指数--公共交通 * 地段指数--公共交通
*/ */
public static double localScore1(int metroCount, int busCount) { public static double localScore1(int metroCount, int busCount) {
if (metroCount > 2) { if (metroCount > 2) {
@@ -137,7 +137,7 @@ public class ShopScoreUtil {
} }
/** /**
* 地段指数--周边业态 * 地段指数--周边业态
*/ */
public static double localScore2(Map<String, Integer> typeCountMap) { public static double localScore2(Map<String, Integer> typeCountMap) {
double ret = 0d; double ret = 0d;
@@ -160,7 +160,7 @@ public class ShopScoreUtil {
} }
/** /**
* 消费指数 * 消费指数
*/ */
public static double consumScore(Double avgConsumption, Map<String, Integer> countMap) { public static double consumScore(Double avgConsumption, Map<String, Integer> countMap) {
double ret = 0d; double ret = 0d;
@@ -197,9 +197,9 @@ public class ShopScoreUtil {
} }
} }
if (null != countMap.get("商场")) { if (null != countMap.get("商场")) {
ret += 0.2; ret += 0.2;
if (countMap.get("商场") >= 5) { if (countMap.get("商场") >= 5) {
ret += 0.3; ret += 0.3;
} }
} }
@@ -209,45 +209,45 @@ public class ShopScoreUtil {
ret += 0.2; ret += 0.2;
} }
} }
if (null != countMap.get("电影院")) { if (null != countMap.get("电影院")) {
ret += 0.1; ret += 0.1;
} }
if (null != countMap.get("健身中心")) { if (null != countMap.get("健身中心")) {
ret += 0.2; ret += 0.2;
} }
if (null != countMap.get("美容院")) { if (null != countMap.get("美容院")) {
ret += 0.1; ret += 0.1;
if (countMap.get("美容院") >= 5) { if (countMap.get("美容院") >= 5) {
ret += 0.2; ret += 0.2;
} }
} }
if (null != countMap.get("大型超市")) { if (null != countMap.get("大型超市")) {
ret += 0.2; ret += 0.2;
} }
if (null != countMap.get("高尔夫球场")) { if (null != countMap.get("高尔夫球场")) {
ret += 0.5; ret += 0.5;
} }
if (null != countMap.get("私立学校")) { if (null != countMap.get("私立学校")) {
ret += 0.2; ret += 0.2;
if (countMap.get("私立学校") >= 5) { if (countMap.get("私立学校") >= 5) {
ret += 0.3; ret += 0.3;
} }
} }
if (null != countMap.get("整形")) { if (null != countMap.get("整形")) {
ret += 0.2; ret += 0.2;
if (countMap.get("整形") >= 5) { if (countMap.get("整形") >= 5) {
ret += 0.1; ret += 0.1;
} }
} }
if (null != countMap.get("洗浴")) { if (null != countMap.get("洗浴")) {
ret += 0.1; ret += 0.1;
} }
if (null != countMap.get("私立医院")) { if (null != countMap.get("私立医院")) {
ret += 0.2; ret += 0.2;
} }
if (null != countMap.get("星级酒店")) { if (null != countMap.get("星级酒店")) {
ret += 0.2; ret += 0.2;
if (countMap.get("星级酒店") >= 5) { if (countMap.get("星级酒店") >= 5) {
ret += 0.2; ret += 0.2;
} }
} }
@@ -259,32 +259,32 @@ public class ShopScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "周边人群消费能力弱"; return "周边人群消费能力弱";
case 2: case 2:
return "周边人群消费能力弱"; return "周边人群消费能力弱";
case 3: case 3:
return "周边人群消费能力较弱"; return "周边人群消费能力较弱";
case 4: case 4:
return "周边人群消费能力较弱"; return "周边人群消费能力较弱";
case 5: case 5:
return "周边人群消费能力一般"; return "周边人群消费能力一般";
case 6: case 6:
return "周边人群消费能力一般"; return "周边人群消费能力一般";
case 7: case 7:
return "周边人群具有一定的消费能力"; return "周边人群具有一定的消费能力";
case 8: case 8:
return "周边人群具有一定的消费能力"; return "周边人群具有一定的消费能力";
case 9: case 9:
return "周边人群具有很强的消费能力"; return "周边人群具有很强的消费能力";
case 10: case 10:
return "周边人群具有很强的消费能力"; return "周边人群具有很强的消费能力";
default: default:
return ""; return "";
} }
} }
/** /**
* 房价指数 * 房价指数
*/ */
public static double priceScore(DistrictStatBo statBo, Integer cityPrice) { public static double priceScore(DistrictStatBo statBo, Integer cityPrice) {
double ret = 0d; double ret = 0d;
@@ -350,32 +350,32 @@ public class ShopScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "属于城市中价位较低的商铺"; return "属于城市中价位较低的商铺";
case 2: case 2:
return "属于城市中价位较低的商铺"; return "属于城市中价位较低的商铺";
case 3: case 3:
return "属于城市中价位较低的商铺"; return "属于城市中价位较低的商铺";
case 4: case 4:
return "属于略低于城市均价的商铺"; return "属于略低于城市均价的商铺";
case 5: case 5:
return "属于接近城市均价的商铺"; return "属于接近城市均价的商铺";
case 6: case 6:
return "属于略高于城市均价的商铺"; return "属于略高于城市均价的商铺";
case 7: case 7:
return "属于城市中价位较高的商铺"; return "属于城市中价位较高的商铺";
case 8: case 8:
return "属于城市中价位较高的商铺"; return "属于城市中价位较高的商铺";
case 9: case 9:
return "属于城市中价位非常高的商铺"; return "属于城市中价位非常高的商铺";
case 10: case 10:
return "属于城市中价位非常高的商铺"; return "属于城市中价位非常高的商铺";
default: default:
return ""; return "";
} }
} }
/** /**
* 租金指数 * 租金指数
*/ */
public static double rentScore(DistrictBusinessStatRentBo statBo, Integer cityPrice, String paymentPattern) { public static double rentScore(DistrictBusinessStatRentBo statBo, Integer cityPrice, String paymentPattern) {
double ret = 0d; double ret = 0d;
@@ -422,7 +422,7 @@ public class ShopScoreUtil {
} }
} }
if ("押三付三".equals(paymentPattern) || "付三押三".equals(paymentPattern)) { if ("押三付三".equals(paymentPattern) || "付三押三".equals(paymentPattern)) {
ret += 0.5; ret += 0.5;
} }
} }
@@ -434,63 +434,63 @@ public class ShopScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "属于城市中租金便宜的商铺"; return "属于城市中租金便宜的商铺";
case 2: case 2:
return "属于城市中租金便宜的商铺"; return "属于城市中租金便宜的商铺";
case 3: case 3:
return "属于城市中租金较便宜的商铺"; return "属于城市中租金较便宜的商铺";
case 4: case 4:
return "属于略低于城市租金均价的商铺"; return "属于略低于城市租金均价的商铺";
case 5: case 5:
return "属于接近城市租金均价的商铺"; return "属于接近城市租金均价的商铺";
case 6: case 6:
return "属于略高于城市租金均价的商铺"; return "属于略高于城市租金均价的商铺";
case 7: case 7:
return "属于城市中租金较高的商铺"; return "属于城市中租金较高的商铺";
case 8: case 8:
return "属于城市中租金较高的商铺"; return "属于城市中租金较高的商铺";
case 9: case 9:
return "属于城市中租金昂贵的商铺"; return "属于城市中租金昂贵的商铺";
case 10: case 10:
return "属于城市中租金昂贵的商铺"; return "属于城市中租金昂贵的商铺";
default: default:
return ""; return "";
} }
} }
/** /**
* 商铺综合指数 * 商铺综合指数
*/ */
public static double detailScore(District mall, SeaweedNumberic numberic) { public static double detailScore(District mall, SeaweedNumberic numberic) {
double ret = 0d; double ret = 0d;
// 商铺类型 // 商铺类型
String estateType = mall.getEstateCharge(); String estateType = mall.getEstateCharge();
if (StringUtils.contains(estateType, "购物中心")) { if (StringUtils.contains(estateType, "购物中心")) {
ret += 8; ret += 8;
} else if (StringUtils.contains(estateType, "写字楼商铺")) { } else if (StringUtils.contains(estateType, "写字楼商铺")) {
ret += 7; ret += 7;
} else if ("专项商铺".equals(estateType)) { } else if ("专项商铺".equals(estateType)) {
ret += 6; ret += 6;
} else { } else {
ret += 5; ret += 5;
} }
// 商圈 // 商圈
String businessQuarter = mall.getBusinessQuarter(); String businessQuarter = mall.getBusinessQuarter();
// TODO A类+1,B类+0.5 // TODO A类+1,B类+0.5
if (StringUtils.isNotBlank(businessQuarter)) { if (StringUtils.isNotBlank(businessQuarter)) {
ret += 0.5; ret += 0.5;
} }
// 板块 // 板块
String block = ""; String block = "";
// TODO A类+1,B类+0.5 // TODO A类+1,B类+0.5
if (StringUtils.isNotBlank(block)) { if (StringUtils.isNotBlank(block)) {
ret += 0.5; ret += 0.5;
} }
// 建筑规模 // 建筑规模
if (null != numberic && null != numberic.getBuildArea()) { if (null != numberic && null != numberic.getBuildArea()) {
int area = numberic.getBuildArea(); int area = numberic.getBuildArea();
if (area > CITY_AVG_MALL_AREA && ((area - CITY_AVG_MALL_AREA) * 1.0 / CITY_AVG_MALL_AREA > 0.2)) { if (area > CITY_AVG_MALL_AREA && ((area - CITY_AVG_MALL_AREA) * 1.0 / CITY_AVG_MALL_AREA > 0.2)) {
@@ -500,10 +500,10 @@ public class ShopScoreUtil {
} }
} }
// 装修状况 // 装修状况
// TODO 目前没有装修字段 // TODO 目前没有装修字段
// 停车位 // 停车位
if (null != mall.getCarSiteCount()) { if (null != mall.getCarSiteCount()) {
double t = (mall.getCarSiteCount() - CITY_AVG_CAR_SITE_COUNT) * 1.0 / CITY_AVG_CAR_SITE_COUNT; double t = (mall.getCarSiteCount() - CITY_AVG_CAR_SITE_COUNT) * 1.0 / CITY_AVG_CAR_SITE_COUNT;
if (t > 0.2) { if (t > 0.2) {
@@ -513,7 +513,7 @@ public class ShopScoreUtil {
} }
} }
// 楼龄 // 楼龄
if (null != numberic && null != numberic.getFinishBuildYear()) { if (null != numberic && null != numberic.getFinishBuildYear()) {
int year = numberic.getFinishBuildYear(); int year = numberic.getFinishBuildYear();
if (year > CITY_AVG_FINISH_YAER && ((year - CITY_AVG_FINISH_YAER) * 1.0 / CITY_AVG_FINISH_YAER > 0.2)) { if (year > CITY_AVG_FINISH_YAER && ((year - CITY_AVG_FINISH_YAER) * 1.0 / CITY_AVG_FINISH_YAER > 0.2)) {
@@ -530,7 +530,7 @@ public class ShopScoreUtil {
ret += 0.5; ret += 0.5;
} }
// 物业费 // 物业费
if (null != numberic && null != numberic.getEstateCharge()) { if (null != numberic && null != numberic.getEstateCharge()) {
double c = numberic.getEstateCharge(); double c = numberic.getEstateCharge();
if (c > CITY_AVG_ESTATE_CHARGE && ((c - CITY_AVG_ESTATE_CHARGE) * 1.0 / CITY_AVG_ESTATE_CHARGE > 0.2)) { if (c > CITY_AVG_ESTATE_CHARGE && ((c - CITY_AVG_ESTATE_CHARGE) * 1.0 / CITY_AVG_ESTATE_CHARGE > 0.2)) {
@@ -547,35 +547,35 @@ public class ShopScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "属于城市的普通商铺"; return "属于城市的普通商铺";
case 2: case 2:
return "属于城市的普通商铺"; return "属于城市的普通商铺";
case 3: case 3:
return "属于城市的普通商铺"; return "属于城市的普通商铺";
case 4: case 4:
return "属于城市的普通商铺"; return "属于城市的普通商铺";
case 5: case 5:
return "属于城市的普通商铺"; return "属于城市的普通商铺";
case 6: case 6:
return "属于城市的普通商铺"; return "属于城市的普通商铺";
case 7: case 7:
return "属于城市的优质商铺"; return "属于城市的优质商铺";
case 8: case 8:
return "属于城市的优质商铺"; return "属于城市的优质商铺";
case 9: case 9:
return "属于城市的高端商铺"; return "属于城市的高端商铺";
case 10: case 10:
return "属于城市的高端商铺"; return "属于城市的高端商铺";
default: default:
return ""; return "";
} }
} }
/** /**
* 商铺综合指数--建筑规模 * 商铺综合指数--建筑规模
*/ */
public static double detailScore1(String estateType, Integer buildArea) { public static double detailScore1(String estateType, Integer buildArea) {
if (StringUtils.contains(estateType, "购物中心")) { if (StringUtils.contains(estateType, "购物中心")) {
if (null == buildArea) { if (null == buildArea) {
return 5d; return 5d;
} }
@@ -593,9 +593,9 @@ public class ShopScoreUtil {
} else { } else {
return 5d; return 5d;
} }
} else if (StringUtils.contains(estateType, "写字楼商铺")) { } else if (StringUtils.contains(estateType, "写字楼商铺")) {
return 6d; return 6d;
} else if ("专项商铺".equals(estateType)) { } else if ("专项商铺".equals(estateType)) {
return 7d; return 7d;
} else { } else {
return 5d; return 5d;
@@ -603,15 +603,15 @@ public class ShopScoreUtil {
} }
/** /**
* 商铺综合指数--装修 * 商铺综合指数--装修
*/ */
public static double detailScore2(String estateType, String buildArea) { public static double detailScore2(String estateType, String buildArea) {
// TODO 目前没有装修字段 // TODO 目前没有装修字段
return 5d; return 5d;
} }
/** /**
* 商铺综合指数--停车位 * 商铺综合指数--停车位
*/ */
public static double detailScore3(Integer carSiteCount) { public static double detailScore3(Integer carSiteCount) {
if (null == carSiteCount) { if (null == carSiteCount) {
@@ -637,7 +637,7 @@ public class ShopScoreUtil {
} }
/** /**
* 商铺综合指数--楼龄 * 商铺综合指数--楼龄
*/ */
public static double detailScore4(Integer year) { public static double detailScore4(Integer year) {
if (null == year) { if (null == year) {
@@ -666,44 +666,44 @@ public class ShopScoreUtil {
} }
/** /**
* 环境指数--公共聚客点 * 环境指数--公共聚客点
*/ */
public static double aroundScore1(Map<String, Integer> countMap) { public static double aroundScore1(Map<String, Integer> countMap) {
double ret = 0d; double ret = 0d;
if (null != countMap.get("医院")) { if (null != countMap.get("医院")) {
ret += 1; ret += 1;
if (countMap.get("医院") >= 3) { if (countMap.get("医院") >= 3) {
ret += 0.5; ret += 0.5;
} }
} }
if (null != countMap.get("地铁站")) { if (null != countMap.get("地铁站")) {
ret += 1; ret += 1;
if (countMap.get("地铁站") >= 3) { if (countMap.get("地铁站") >= 3) {
ret += 0.5; ret += 0.5;
} }
} }
if (null != countMap.get("公交点")) { if (null != countMap.get("公交点")) {
ret += 1; ret += 1;
if (countMap.get("公交点") >= 3) { if (countMap.get("公交点") >= 3) {
ret += 0.5; ret += 0.5;
} }
} }
if (null != countMap.get("公园")) { if (null != countMap.get("公园")) {
ret += 1; ret += 1;
if (countMap.get("公园") >= 2) { if (countMap.get("公园") >= 2) {
ret += 0.5; ret += 0.5;
} }
} }
if (null != countMap.get("学校")) { if (null != countMap.get("学校")) {
ret += 1; ret += 1;
if (countMap.get("学校") >= 3) { if (countMap.get("学校") >= 3) {
ret += 0.5; ret += 0.5;
} }
} }
if (null != countMap.get("体育馆")) { if (null != countMap.get("体育馆")) {
ret += 1; ret += 1;
if (countMap.get("体育馆") >= 2) { if (countMap.get("体育馆") >= 2) {
ret += 0.5; ret += 0.5;
} }
} }
@@ -712,32 +712,32 @@ public class ShopScoreUtil {
} }
/** /**
* 环境指数--商业聚客点 * 环境指数--商业聚客点
*/ */
public static double aroundScore2(Map<String, Integer> countMap) { public static double aroundScore2(Map<String, Integer> countMap) {
double ret = 0d; double ret = 0d;
if (null != countMap.get("银行")) { if (null != countMap.get("银行")) {
ret += 1; ret += 1;
if (countMap.get("银行") >= 3) { if (countMap.get("银行") >= 3) {
ret += 0.5; ret += 0.5;
} }
} }
if (null != countMap.get("商场")) { if (null != countMap.get("商场")) {
ret += 1; ret += 1;
if (countMap.get("商场") >= 3) { if (countMap.get("商场") >= 3) {
ret += 0.5; ret += 0.5;
} }
} }
if (null != countMap.get("大型超市")) { if (null != countMap.get("大型超市")) {
ret += 1; ret += 1;
if (countMap.get("大型超市") >= 3) { if (countMap.get("大型超市") >= 3) {
ret += 0.5; ret += 0.5;
} }
} }
if (null != countMap.get("餐饮")) { if (null != countMap.get("餐饮")) {
ret += 1; ret += 1;
if (countMap.get("餐饮") >= 10) { if (countMap.get("餐饮") >= 10) {
ret += 0.5; ret += 0.5;
} }
} }
@@ -749,32 +749,32 @@ public class ShopScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "周边公共或商业配套非常差,客源稀少"; return "周边公共或商业配套非常差,客源稀少";
case 2: case 2:
return "周边公共或商业配套非常差,客源稀少"; return "周边公共或商业配套非常差,客源稀少";
case 3: case 3:
return "周边公共或商业配套较差,客源较少"; return "周边公共或商业配套较差,客源较少";
case 4: case 4:
return "周边公共或商业配套较差,客源较少"; return "周边公共或商业配套较差,客源较少";
case 5: case 5:
return "周边公共或商业配套一般,客源一般"; return "周边公共或商业配套一般,客源一般";
case 6: case 6:
return "周边公共或商业配套一般,客源一般"; return "周边公共或商业配套一般,客源一般";
case 7: case 7:
return "周边公共或商业配套较成熟,客源较丰富"; return "周边公共或商业配套较成熟,客源较丰富";
case 8: case 8:
return "周边公共或商业配套较成熟,客源较丰富"; return "周边公共或商业配套较成熟,客源较丰富";
case 9: case 9:
return "周边公共或商业配套非常成熟,客源丰富"; return "周边公共或商业配套非常成熟,客源丰富";
case 10: case 10:
return "周边公共或商业配套非常成熟,客源丰富"; return "周边公共或商业配套非常成熟,客源丰富";
default: default:
return ""; return "";
} }
} }
/** /**
* 人口指数--居民人口 * 人口指数--居民人口
*/ */
@Deprecated @Deprecated
public static double peopleScore1(double density) { public static double peopleScore1(double density) {
@@ -810,56 +810,56 @@ public class ShopScoreUtil {
} }
/** /**
* 计算居民人口密度得分 * 计算居民人口密度得分
* @author yinjihuan * @author yinjihuan
* @date 2016-03-04 * @date 2016-03-04
* @param density 居民人口密度 * @param density 居民人口密度
* @return 居民人口密度得分 * @return 居民人口密度得分
*/ */
public static double calcPeopleDensityScore(double density) { public static double calcPeopleDensityScore(double density) {
/*居民人口密度得分规则如下: /*居民人口密度得分规则如下:
10 10*市均人口密度 < 居民人口密度 10 10*市均人口密度 < 居民人口密度
9 9*市均人口密度 < 居民人口密度 <= 10*市均人口密度 9 9*市均人口密度 < 居民人口密度 <= 10*市均人口密度
8 8*市均人口密度 < 居民人口密度 <= 9*市均人口密度 8 8*市均人口密度 < 居民人口密度 <= 9*市均人口密度
7 7*市均人口密度 < 居民人口密度 <= 8*市均人口密度 7 7*市均人口密度 < 居民人口密度 <= 8*市均人口密度
6 6*市均人口密度 < 居民人口密度 <= 7*市均人口密度 6 6*市均人口密度 < 居民人口密度 <= 7*市均人口密度
5 4*市均人口密度 < 居民人口密度 <= 6*市均人口密度 5 4*市均人口密度 < 居民人口密度 <= 6*市均人口密度
4 2*市均人口密度 < 居民人口密度 <= 4*市均人口密度 4 2*市均人口密度 < 居民人口密度 <= 4*市均人口密度
3 1*市均人口密度 < 居民人口密度 <= 2*市均人口密度 3 1*市均人口密度 < 居民人口密度 <= 2*市均人口密度
2 0.5*市均人口密度 < 居民人口密度 <= 1*市均人口密度 2 0.5*市均人口密度 < 居民人口密度 <= 1*市均人口密度
1 居民人口密度 <= 0.5*市均人口密度 */ 1 居民人口密度 <= 0.5*市均人口密度 */
return doCalcDensityScore(density, CITY_AVG_HOUSE_DENSITY); return doCalcDensityScore(density, CITY_AVG_HOUSE_DENSITY);
} }
/** /**
* 计算办公人口密度得分 * 计算办公人口密度得分
* @author yinjihuan * @author yinjihuan
* @date 2016-03-04 * @date 2016-03-04
* @param density 办公人口密度 * @param density 办公人口密度
* @return 居民人口密度得分 * @return 居民人口密度得分
*/ */
public static double calcOfficeDensityScore(double density) { public static double calcOfficeDensityScore(double density) {
/*办公人口密度计算规则如下: /*办公人口密度计算规则如下:
10 10*市均办公人口密度 < 办公人口密度 10 10*市均办公人口密度 < 办公人口密度
9 9*市均办公人口密度 < 办公人口密度 <= 10*市均办公人口密度 9 9*市均办公人口密度 < 办公人口密度 <= 10*市均办公人口密度
8 8*市均办公人口密度 < 办公人口密度 <= 9*市均办公人口密度 8 8*市均办公人口密度 < 办公人口密度 <= 9*市均办公人口密度
7 7*市均办公人口密度 < 办公人口密度 <= 8*市均办公人口密度 7 7*市均办公人口密度 < 办公人口密度 <= 8*市均办公人口密度
6 6*市均办公人口密度 < 办公人口密度 <= 7*市均办公人口密度 6 6*市均办公人口密度 < 办公人口密度 <= 7*市均办公人口密度
5 4*市均办公人口密度 < 办公人口密度 <= 6*市均办公人口密度 5 4*市均办公人口密度 < 办公人口密度 <= 6*市均办公人口密度
4 2*市均办公人口密度 < 办公人口密度 <= 4*市均办公人口密度 4 2*市均办公人口密度 < 办公人口密度 <= 4*市均办公人口密度
3 1*市均办公人口密度 < 办公人口密度 <= 2*市均办公人口密度 3 1*市均办公人口密度 < 办公人口密度 <= 2*市均办公人口密度
2 0.5*市均办公人口密度 < 办公人口密度 <= 1*市均办公人口密度 2 0.5*市均办公人口密度 < 办公人口密度 <= 1*市均办公人口密度
1 办公人口密度 <= 0.5*市均办公人口密度 */ 1 办公人口密度 <= 0.5*市均办公人口密度 */
return doCalcDensityScore(density, CITY_AVG_OFFICE_DENSITY); return doCalcDensityScore(density, CITY_AVG_OFFICE_DENSITY);
} }
/** /**
* 计算密度得分 * 计算密度得分
* @param density 密度 * @param density 密度
* @param cityAvgDensity 市平均密度 * @param cityAvgDensity 市平均密度
* @return * @return
*/ */
private static double doCalcDensityScore(double density, double cityAvgDensity) { private static double doCalcDensityScore(double density, double cityAvgDensity) {
@@ -917,7 +917,7 @@ public class ShopScoreUtil {
} }
/** /**
* 人口指数--办公人口 * 人口指数--办公人口
*/ */
@Deprecated @Deprecated
public static double peopleScore2(double density) { public static double peopleScore2(double density) {
@@ -991,25 +991,25 @@ public class ShopScoreUtil {
int s = (int) score; int s = (int) score;
switch (s) { switch (s) {
case 1: case 1:
return "人流量稀少"; return "人流量稀少";
case 2: case 2:
return "人流量稀少"; return "人流量稀少";
case 3: case 3:
return "人流量较少"; return "人流量较少";
case 4: case 4:
return "人流量较少"; return "人流量较少";
case 5: case 5:
return "人流量一般"; return "人流量一般";
case 6: case 6:
return "人流量一般"; return "人流量一般";
case 7: case 7:
return "人流量较大"; return "人流量较大";
case 8: case 8:
return "人流量较大"; return "人流量较大";
case 9: case 9:
return "人流量庞大"; return "人流量庞大";
case 10: case 10:
return "人流量庞大"; return "人流量庞大";
default: default:
return ""; return "";
} }
@@ -21,17 +21,17 @@ public class Test {
g2d.dispose(); g2d.dispose();
g2d = image.createGraphics(); g2d = image.createGraphics();
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setColor(new Color(178,178,178));//改变扇形颜色 g2d.setColor(new Color(178,178,178));//改变扇形颜色
g2d.fillArc(0,0,400,400,90,360); g2d.fillArc(0,0,400,400,90,360);
g2d.setColor(new Color(0,115,230));//改变扇形颜色 g2d.setColor(new Color(0,115,230));//改变扇形颜色
g2d.fillArc(0,0,400,400,90,180); g2d.fillArc(0,0,400,400,90,180);
g2d.setColor(new Color(229,229,229));//改变扇形颜色 g2d.setColor(new Color(229,229,229));//改变扇形颜色
g2d.fillArc(40,40,320,320,90,360); g2d.fillArc(40,40,320,320,90,360);
g2d.setColor(new Color(0,115,230)); g2d.setColor(new Color(0,115,230));
g2d.setFont(new Font("宋体",Font.BOLD,120)); g2d.setFont(new Font("宋体",Font.BOLD,120));
g2d.drawString("4分",126,250); g2d.drawString("4分",126,250);
g2d.dispose(); g2d.dispose();
ImageIO.write(image, "png", new File("D:/test.png")); ImageIO.write(image, "png", new File("D:/test.png"));
} }
@@ -14,7 +14,7 @@ import com.fangjia.auto.service.AutocompleteService;
import com.fangjia.core.util.DataUtil; import com.fangjia.core.util.DataUtil;
/** /**
* 自动完成接口 * 自动完成接口
* *
* @author dxy * @author dxy
* @deprecated instead of {@link AutocompleteController} * @deprecated instead of {@link AutocompleteController}
@@ -22,7 +22,7 @@ import com.fangjia.core.util.DataUtil;
*/ */
public class AutoController { public class AutoController {
/** /**
* 自动完成 * 自动完成
* *
* @deprecated * @deprecated
* @param model * @param model
@@ -40,7 +40,7 @@ public class AutoController {
DataUtil.escapeSolr(model.getQ()), (model.getLimit() > 100 || model.getLimit() <= 0 ? 10 : model.getLimit())); DataUtil.escapeSolr(model.getQ()), (model.getLimit() > 100 || model.getLimit() <= 0 ? 10 : model.getLimit()));
/** /**
* 该方法以及过期,这个地方仅仅是为了兼容老版本 * 该方法以及过期,这个地方仅仅是为了兼容老版本
*/ */
List<Map<String, Object>> suggestList = new ArrayList<Map<String, Object>>(); List<Map<String, Object>> suggestList = new ArrayList<Map<String, Object>>();
for (Map<String, Object> obj : list) { for (Map<String, Object> obj : list) {
@@ -63,7 +63,7 @@ public class AutoController {
} }
/** /**
* 输入纠错 * 输入纠错
* *
* @deprecated * @deprecated
* @param model * @param model
@@ -9,7 +9,7 @@ import com.fangjia.auto.service.AutocompleteService;
import com.fangjia.core.util.DataUtil; import com.fangjia.core.util.DataUtil;
/** /**
* 新自动完成接口 * 新自动完成接口
* *
* @author dxy * @author dxy
* *
@@ -17,7 +17,7 @@ import com.fangjia.core.util.DataUtil;
public class AutocompleteController { public class AutocompleteController {
/** /**
* 自动完成 * 自动完成
* *
* @param model * @param model
* @return * @return
@@ -34,7 +34,7 @@ public class AutocompleteController {
} }
/** /**
* 输入纠错 * 输入纠错
* *
* @param model * @param model
* @return * @return
@@ -3,7 +3,7 @@ package com.fangjia.auto.model;
import org.sothis.web.mvc.ModelAndViewSupport; import org.sothis.web.mvc.ModelAndViewSupport;
/** /**
* 用于restAPI的ModelAndView * 用于restAPI的ModelAndView
* *
* @author velna * @author velna
* *
@@ -79,13 +79,13 @@ public class AutocompleteService {
} }
/** /**
* 自动完成 * 自动完成
* *
* @param cat * @param cat
* @param city * @param city
* @param keyword * @param keyword
* @param limit * @param limit
* @param isDupl 默认不重复 * @param isDupl 默认不重复
* @return * @return
*/ */
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@@ -168,7 +168,7 @@ public class AutocompleteService {
} }
/** /**
* 输入纠错 * 输入纠错
* *
* @param cat * @param cat
* @param type * @param type
@@ -16,23 +16,23 @@ public class AveragerConfigModel extends BaseModel {
private String display; private String display;
private String region; private String region;
private String name; private String name;
private Integer status; // 0-正常 1-禁用 private Integer status; // 0-正常 1-禁用
private Integer sampleFetchCount; // 样本获取数量 private Integer sampleFetchCount; // 样本获取数量
private Integer sampleMaxValue; // 样本允许最大值 private Integer sampleMaxValue; // 样本允许最大值
private Integer sampleMinValue; // 样本允许最小值 private Integer sampleMinValue; // 样本允许最小值
private Integer ownTypeLimit; // 自身样本计算的最低要求 private Integer ownTypeLimit; // 自身样本计算的最低要求
private Integer sampleQueueStart; // 样本队列取值区间最小值 private Integer sampleQueueStart; // 样本队列取值区间最小值
private Integer sampleQueueEnd; // 样本队列取值区间最大值 private Integer sampleQueueEnd; // 样本队列取值区间最大值
private Integer aroundRadius; // 周边最大半径 private Integer aroundRadius; // 周边最大半径
private Integer aroundLimit; // 周边小区最大数量限制 private Integer aroundLimit; // 周边小区最大数量限制
private Integer valueCluType; //类簇的用值类型 0-默认 1-中位数 2-最大值 3-最小值 private Integer valueCluType; //类簇的用值类型 0-默认 1-中位数 2-最大值 3-最小值
private Integer aroundDiffMinPercent; //样本与周边对比的最小相差比例 private Integer aroundDiffMinPercent; //样本与周边对比的最小相差比例
private Integer aroundDiffMaxPercent; //样本与周边对比的最大相差比例 private Integer aroundDiffMaxPercent; //样本与周边对比的最大相差比例
private Integer guidingPriceExpirationDay; //指导价过期天数 private Integer guidingPriceExpirationDay; //指导价过期天数
private Integer uncomforableSampleDay; //样本换算需要间隔时间 private Integer uncomforableSampleDay; //样本换算需要间隔时间
private Integer masterIntervenePercent; //主小区影响从小区可信度衰减比例 private Integer masterIntervenePercent; //主小区影响从小区可信度衰减比例
private Integer time; private Integer time;
private String site; private String site;
@@ -58,12 +58,12 @@ public class AdController {
} else { } else {
adSpace.setCity("all"); adSpace.setCity("all");
} }
if (StringUtils.isNotBlank(model.getPageId()) && model.getPageId().equals("全国首页")) { if (StringUtils.isNotBlank(model.getPageId()) && model.getPageId().equals("全国首页")) {
adSpace.setCity("all"); adSpace.setCity("all");
} }
adSpaceService.saveOrUpdate(adSpace); adSpaceService.saveOrUpdate(adSpace);
BeanUtils.copyProperties(adSpace, model); BeanUtils.copyProperties(adSpace, model);
model.flash().setAttribute("message", StringUtils.isBlank(model.getId()) ? "添加成功" : "修改成功"); model.flash().setAttribute("message", StringUtils.isBlank(model.getId()) ? "添加成功" : "修改成功");
return model.redirect("show?id=" + adSpace.getId()); return model.redirect("show?id=" + adSpace.getId());
} else if (StringUtils.isNotBlank(model.getId())) { } else if (StringUtils.isNotBlank(model.getId())) {
AdSpace adSpace = adSpaceService.findAdSpaceById(model.getId()); AdSpace adSpace = adSpaceService.findAdSpaceById(model.getId());
@@ -108,38 +108,38 @@ public class AdController {
} }
try { try {
// 发邮件给用户 // 发邮件给用户
Mail mail = new Mail(); Mail mail = new Mail();
mail.setReceiver(new MailUser(cpdbApp.getEmail())); mail.setReceiver(new MailUser(cpdbApp.getEmail()));
mail.setSubject("房价网—中国不动产大数据库CPDB演示"); mail.setSubject("房价网—中国不动产大数据库CPDB演示");
StringBuffer emailMsg = new StringBuffer(); StringBuffer emailMsg = new StringBuffer();
emailMsg.append("尊敬的用户:<br/><br/>") emailMsg.append("尊敬的用户:<br/><br/>")
.append("&emsp;&emsp;感谢您申请房价网的<b>房价数据测试平台</b>免费试用账号!<br/><br/>") .append("&emsp;&emsp;感谢您申请房价网的<b>房价数据测试平台</b>免费试用账号!<br/><br/>")
.append("&emsp;&emsp;您现在可以在48小时内免费体验<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;登陆链接:<a href=\"http://user.fangjia.com/fangjiatong2/users/userCenterLogin?__from=cpdbemail\">房价数据测试平台</a><br/>")
.append("&emsp;&emsp;用户名:") .append("&emsp;&emsp;用户名:")
.append(cpdbApp.getEmail()) .append(cpdbApp.getEmail())
.append("<br/>") .append("<br/>")
.append("&emsp;&emsp;密码:") .append("&emsp;&emsp;密码:")
.append(fjtuser.getPassword()) .append(fjtuser.getPassword())
.append("<br/><br/>") .append("<br/><br/>")
.append("&emsp;&emsp;由于该账号为<b>限时使用</b>,所以请尽快开始使用。<br/><br/>") .append("&emsp;&emsp;由于该账号为<b>限时使用</b>,所以请尽快开始使用。<br/><br/>")
.append("&emsp;&emsp;<b>房价数据测试平台</b>是凭借<b>中国不动产大数据库CPDB</b>的基础上,整合优势力量,推出的测试平台。<br/><br/>") .append("&emsp;&emsp;<b>房价数据测试平台</b>是凭借<b>中国不动产大数据库CPDB</b>的基础上,整合优势力量,推出的测试平台。<br/><br/>")
.append("&emsp;&emsp;CPDB大数据库包括") .append("&emsp;&emsp;CPDB大数据库包括")
.append("&emsp;&emsp;<ul><li>住宅物业的实时挂牌价格、成交参考、房源、楼盘详情、照片、地图</li>") .append("&emsp;&emsp;<ul><li>住宅物业的实时挂牌价格、成交参考、房源、楼盘详情、照片、地图</li>")
.append("&emsp;&emsp;<li>商业地产的均价、详情、消费分析、竞争对手情报</li>") .append("&emsp;&emsp;<li>商业地产的均价、详情、消费分析、竞争对手情报</li>")
.append("&emsp;&emsp;<li>城市行情、历史数据等</li></ul><br/>") .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(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;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;关于<b>中国不动产大数据库CPDB</b>的更多相关内容,您可以通过附件中的PPT演示文稿更全面的了解。<br/><br/>")
.append("&emsp;&emsp;您可以将此封邮件转发给其他用到不动产大数据库的伙伴,比如银行、电商平台、贷款公司、评估机构、房地产营销机构、软件公司、金融类网站等等,相信给会他们带来极大帮助。<br/><br/>") .append("&emsp;&emsp;您可以将此封邮件转发给其他用到不动产大数据库的伙伴,比如银行、电商平台、贷款公司、评估机构、房地产营销机构、软件公司、金融类网站等等,相信给会他们带来极大帮助。<br/><br/>")
.append("&emsp;&emsp;如有任何疑问,欢迎您致电客服电话:021-6239 2522。<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;祝您生活愉快,工作顺利。");
mail.setContent(emailMsg.toString()); mail.setContent(emailMsg.toString());
mail.setImportant(true); mail.setImportant(true);
mail.setAttachment(true); mail.setAttachment(true);
mail.setAttachmentDes("CPDB大数据库示例"); mail.setAttachmentDes("CPDB大数据库示例");
mail.setAttachmentName("CPDB大数据库示例.pptx"); mail.setAttachmentName("CPDB大数据库示例.pptx");
mail.setAttachmentUrl("http://static.fangjia.com/res/static_logo/CPDB.pptx"); mail.setAttachmentUrl("http://static.fangjia.com/res/static_logo/CPDB.pptx");
emailService.sendHtmlMailWithFile(mail); emailService.sendHtmlMailWithFile(mail);
@@ -179,17 +179,17 @@ public class AdController {
private Map<String, String> getPositionMap() { private Map<String, String> getPositionMap() {
Map<String, String> positionMap = new ListOrderedMap(); Map<String, String> positionMap = new ListOrderedMap();
positionMap.put("header;right;top", "头部右上"); positionMap.put("header;right;top", "头部右上");
positionMap.put("header;center;middle", "头部居中"); positionMap.put("header;center;middle", "头部居中");
positionMap.put("body;right;top", "体部右上"); positionMap.put("body;right;top", "体部右上");
positionMap.put("body;right;middle", "体部右中"); positionMap.put("body;right;middle", "体部右中");
positionMap.put("body;right;down", "体部右下"); positionMap.put("body;right;down", "体部右下");
positionMap.put("body;center;top", "体部中上"); positionMap.put("body;center;top", "体部中上");
positionMap.put("body;center;middle", "体部居中"); positionMap.put("body;center;middle", "体部居中");
positionMap.put("body;center;down", "体部中下"); positionMap.put("body;center;down", "体部中下");
positionMap.put("footer;center;middle", "底部居中"); positionMap.put("footer;center;middle", "底部居中");
positionMap.put("side;left;middle", "对联左中"); positionMap.put("side;left;middle", "对联左中");
positionMap.put("side;right;middle", "对联右中"); positionMap.put("side;right;middle", "对联右中");
return positionMap; return positionMap;
} }
@@ -110,9 +110,9 @@ public class AddressAnalyController {
OutputStream os = null; OutputStream os = null;
BufferedOutputStream fos = null; BufferedOutputStream fos = null;
if(model.getType().equals("风控")){ if(model.getType().equals("风控")){
titles = new String[]{"城市","地址", "面积", "贷款余额", "房价总价","区域","近12月涨幅","CLTV值","物业类型"}; titles = new String[]{"城市","地址", "面积", "贷款余额", "房价总价","区域","近12月涨幅","CLTV值","物业类型"};
for (AddressDetail detail : addressDetails) { for (AddressDetail detail : addressDetails) {
AddressAnalyticsResult analy = resultMap.get(detail.getNumber()); AddressAnalyticsResult analy = resultMap.get(detail.getNumber());
if(analy == null){ if(analy == null){
@@ -128,9 +128,9 @@ public class AddressAnalyController {
} }
} }
}else if(model.getType().equals("营销")){ }else if(model.getType().equals("营销")){
titles = new String[]{"城市","地址", "面积", "贷款余额", "房价总价","区域","近12月涨幅","物业类型"}; titles = new String[]{"城市","地址", "面积", "贷款余额", "房价总价","区域","近12月涨幅","物业类型"};
for (AddressDetail detail : addressDetails) { for (AddressDetail detail : addressDetails) {
AddressAnalyticsResult analy = resultMap.get(detail.getNumber()); AddressAnalyticsResult analy = resultMap.get(detail.getNumber());
if(analy == null){ if(analy == null){
@@ -148,14 +148,14 @@ public class AddressAnalyController {
try { try {
HttpServletResponse response = ActionContext.getContext().getResponse(); HttpServletResponse response = ActionContext.getContext().getResponse();
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
//response.reset();// 清空输出流 //response.reset();// 清空输出流
response.setContentType("application/x-download;charset=UTF-8"); response.setContentType("application/x-download;charset=UTF-8");
fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1"); 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"); fileName = new String(fileName.getBytes("GBK"),"ISO-8859-1");
} }
response.setHeader( "Content-Disposition", "attachment;filename=" + fileName); response.setHeader( "Content-Disposition", "attachment;filename=" + fileName);
os = response.getOutputStream();// 取得输出流 os = response.getOutputStream();// 取得输出流
wb.write(os); wb.write(os);
os.flush(); os.flush();
} catch (Exception e) { } catch (Exception e) {

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