城市、区域、小区价格指数
This commit is contained in:
+282
@@ -0,0 +1,282 @@
|
||||
package com.fangjia.dal.mongo.model;
|
||||
|
||||
import com.fangjia.dal.MongoEntity;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* ¼Û¸ñÖ¸Êý
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "fangjia_stat.property_stats_index")
|
||||
public class PropertyStatsIndex implements MongoEntity{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = -9102764355476337768L;
|
||||
|
||||
private String id;
|
||||
|
||||
private String city;
|
||||
|
||||
private String district;
|
||||
|
||||
private String name;
|
||||
|
||||
private String yearmonth;
|
||||
|
||||
private Integer source;
|
||||
|
||||
private String remark;
|
||||
|
||||
private Double chain;
|
||||
|
||||
private Double yeartoyear;
|
||||
|
||||
private Double fixedbase;
|
||||
|
||||
private Double belowChain;
|
||||
|
||||
private Double belowYeartoyear;
|
||||
|
||||
private Double belowFixedbase;
|
||||
|
||||
private Double amongChain;
|
||||
|
||||
private Double amongYeartoyear;
|
||||
|
||||
private Double amongFixedbase;
|
||||
|
||||
private Double aboveChain;
|
||||
|
||||
private Double aboveYeartoyear;
|
||||
|
||||
private Double aboveFixedbase;
|
||||
|
||||
private Date cDate;
|
||||
|
||||
private String cat;
|
||||
|
||||
private Double fangIndex;
|
||||
|
||||
private Double fangChain;
|
||||
|
||||
private String type;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
@Column(name = "_id")
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Column(name = "city")
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
@Column(name = "district")
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
@Column(name = "name")
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Column(name = "c_date")
|
||||
public Date getcDate() {
|
||||
return cDate;
|
||||
}
|
||||
|
||||
public void setcDate(Date cDate) {
|
||||
this.cDate = cDate;
|
||||
}
|
||||
|
||||
@Column(name = "yearmonth")
|
||||
public String getYearmonth() {
|
||||
return yearmonth;
|
||||
}
|
||||
|
||||
public void setYearmonth(String yearmonth) {
|
||||
this.yearmonth = yearmonth;
|
||||
}
|
||||
|
||||
@Column(name = "source")
|
||||
public Integer getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
public void setSource(Integer source) {
|
||||
this.source = source;
|
||||
}
|
||||
|
||||
@Column(name = "remark")
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
@Column(name = "below_chain")
|
||||
public Double getBelowChain() {
|
||||
return belowChain;
|
||||
}
|
||||
|
||||
public void setBelowChain(Double belowChain) {
|
||||
this.belowChain = belowChain;
|
||||
}
|
||||
|
||||
@Column(name = "below_yeartoyear")
|
||||
public Double getBelowYeartoyear() {
|
||||
return belowYeartoyear;
|
||||
}
|
||||
|
||||
public void setBelowYeartoyear(Double belowYeartoyear) {
|
||||
this.belowYeartoyear = belowYeartoyear;
|
||||
}
|
||||
|
||||
@Column(name = "below_fixedbase")
|
||||
public Double getBelowFixedbase() {
|
||||
return belowFixedbase;
|
||||
}
|
||||
|
||||
public void setBelowFixedbase(Double belowFixedbase) {
|
||||
this.belowFixedbase = belowFixedbase;
|
||||
}
|
||||
|
||||
@Column(name = "among_chain")
|
||||
public Double getAmongChain() {
|
||||
return amongChain;
|
||||
}
|
||||
|
||||
public void setAmongChain(Double amongChain) {
|
||||
this.amongChain = amongChain;
|
||||
}
|
||||
|
||||
@Column(name = "among_yeartoyear")
|
||||
public Double getAmongYeartoyear() {
|
||||
return amongYeartoyear;
|
||||
}
|
||||
|
||||
public void setAmongYeartoyear(Double amongYeartoyear) {
|
||||
this.amongYeartoyear = amongYeartoyear;
|
||||
}
|
||||
|
||||
@Column(name = "among_fixedbase")
|
||||
public Double getAmongFixedbase() {
|
||||
return amongFixedbase;
|
||||
}
|
||||
|
||||
public void setAmongFixedbase(Double amongFixedbase) {
|
||||
this.amongFixedbase = amongFixedbase;
|
||||
}
|
||||
|
||||
@Column(name = "above_chain")
|
||||
public Double getAboveChain() {
|
||||
return aboveChain;
|
||||
}
|
||||
|
||||
public void setAboveChain(Double aboveChain) {
|
||||
this.aboveChain = aboveChain;
|
||||
}
|
||||
|
||||
@Column(name = "above_yeartoyear")
|
||||
public Double getAboveYeartoyear() {
|
||||
return aboveYeartoyear;
|
||||
}
|
||||
|
||||
public void setAboveYeartoyear(Double aboveYeartoyear) {
|
||||
this.aboveYeartoyear = aboveYeartoyear;
|
||||
}
|
||||
|
||||
@Column(name = "above_fixedbase")
|
||||
public Double getAboveFixedbase() {
|
||||
return aboveFixedbase;
|
||||
}
|
||||
|
||||
public void setAboveFixedbase(Double aboveFixedbase) {
|
||||
this.aboveFixedbase = aboveFixedbase;
|
||||
}
|
||||
|
||||
@Column(name = "cat")
|
||||
public String getCat() {
|
||||
return cat;
|
||||
}
|
||||
|
||||
public void setCat(String cat) {
|
||||
this.cat = cat;
|
||||
}
|
||||
|
||||
@Column(name = "fang_index")
|
||||
public Double getFangIndex() {
|
||||
return fangIndex;
|
||||
}
|
||||
|
||||
public void setFangIndex(Double fangIndex) {
|
||||
this.fangIndex = fangIndex;
|
||||
}
|
||||
|
||||
@Column(name = "fang_chain")
|
||||
public Double getFangChain() {
|
||||
return fangChain;
|
||||
}
|
||||
|
||||
public void setFangChain(Double fangChain) {
|
||||
this.fangChain = fangChain;
|
||||
}
|
||||
|
||||
@Column(name = "chain")
|
||||
public Double getChain() {
|
||||
return chain;
|
||||
}
|
||||
|
||||
public void setChain(Double chain) {
|
||||
this.chain = chain;
|
||||
}
|
||||
|
||||
@Column(name = "yeartoyear")
|
||||
public Double getYeartoyear() {
|
||||
return yeartoyear;
|
||||
}
|
||||
|
||||
public void setYeartoyear(Double yeartoyear) {
|
||||
this.yeartoyear = yeartoyear;
|
||||
}
|
||||
|
||||
@Column(name = "fixedbase")
|
||||
public Double getFixedbase() {
|
||||
return fixedbase;
|
||||
}
|
||||
|
||||
public void setFixedbase(Double fixedbase) {
|
||||
this.fixedbase = fixedbase;
|
||||
}
|
||||
|
||||
@Column(name = "type")
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import com.fangjia.dal.MongoEntity;
|
||||
* ¼Û¸ñÖ¸Êý
|
||||
*/
|
||||
@Entity
|
||||
@Table(name = "fangjia.stats_index")
|
||||
@Table(name = "fangjia_stat.stats_index")
|
||||
public class StatsIndex implements MongoEntity{
|
||||
/**
|
||||
*
|
||||
@@ -24,6 +24,8 @@ public class StatsIndex implements MongoEntity{
|
||||
private String id;
|
||||
|
||||
private String city;
|
||||
|
||||
private String district;
|
||||
|
||||
private String yearmonth;
|
||||
|
||||
@@ -31,12 +33,15 @@ public class StatsIndex implements MongoEntity{
|
||||
|
||||
private String remark;
|
||||
|
||||
private Double newChain;
|
||||
|
||||
private Double newYeartoyear;
|
||||
|
||||
private Double newFixedbase;
|
||||
|
||||
// private Double newChain;
|
||||
private Double chain;
|
||||
|
||||
// private Double newYeartoyear;
|
||||
private Double yeartoyear;
|
||||
|
||||
// private Double newFixedbase;
|
||||
private Double fixedbase;
|
||||
|
||||
private Double belowChain;
|
||||
|
||||
private Double belowYeartoyear;
|
||||
@@ -62,6 +67,8 @@ public class StatsIndex implements MongoEntity{
|
||||
private Double fangIndex;
|
||||
|
||||
private Double fangChain;
|
||||
|
||||
private String type;
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
@Column(name = "_id")
|
||||
@@ -82,6 +89,14 @@ public class StatsIndex implements MongoEntity{
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
@Column(name = "district")
|
||||
public String getDistrict() {
|
||||
return district;
|
||||
}
|
||||
|
||||
public void setDistrict(String district) {
|
||||
this.district = district;
|
||||
}
|
||||
|
||||
@Column(name = "c_date")
|
||||
public Date getcDate() {
|
||||
@@ -118,34 +133,6 @@ public class StatsIndex implements MongoEntity{
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
@Column(name = "new_chain")
|
||||
public Double getNewChain() {
|
||||
return newChain;
|
||||
}
|
||||
|
||||
public void setNewChain(Double newChain) {
|
||||
this.newChain = newChain;
|
||||
}
|
||||
|
||||
@Column(name = "new_yeartoyear")
|
||||
public Double getNewYeartoyear() {
|
||||
return newYeartoyear;
|
||||
}
|
||||
|
||||
public void setNewYeartoyear(Double newYeartoyear) {
|
||||
this.newYeartoyear = newYeartoyear;
|
||||
}
|
||||
|
||||
@Column(name = "new_fixedbase")
|
||||
public Double getNewFixedbase() {
|
||||
return newFixedbase;
|
||||
}
|
||||
|
||||
public void setNewFixedbase(Double newFixedbase) {
|
||||
this.newFixedbase = newFixedbase;
|
||||
}
|
||||
|
||||
@Column(name = "below_chain")
|
||||
public Double getBelowChain() {
|
||||
return belowChain;
|
||||
@@ -253,6 +240,40 @@ public class StatsIndex implements MongoEntity{
|
||||
public void setFangChain(Double fangChain) {
|
||||
this.fangChain = fangChain;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Column(name = "chain")
|
||||
public Double getChain() {
|
||||
return chain;
|
||||
}
|
||||
|
||||
public void setChain(Double chain) {
|
||||
this.chain = chain;
|
||||
}
|
||||
|
||||
@Column(name = "yeartoyear")
|
||||
public Double getYeartoyear() {
|
||||
return yeartoyear;
|
||||
}
|
||||
|
||||
public void setYeartoyear(Double yeartoyear) {
|
||||
this.yeartoyear = yeartoyear;
|
||||
}
|
||||
|
||||
@Column(name = "fixedbase")
|
||||
public Double getFixedbase() {
|
||||
return fixedbase;
|
||||
}
|
||||
|
||||
public void setFixedbase(Double fixedbase) {
|
||||
this.fixedbase = fixedbase;
|
||||
}
|
||||
|
||||
@Column(name = "type")
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
|
||||
+449
-370
@@ -5,7 +5,13 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fangjia.dal.mongo.model.FangjiaOfficialAreaMap;
|
||||
import com.fangjia.dal.mongo.model.PropertyStatsIndex;
|
||||
import com.fangjia.dal.seaweed.model.District;
|
||||
import com.fangjia.open.model.BasicModel;
|
||||
import com.fangjia.service.datastore.DistrictService;
|
||||
import com.fangjia.service.mongo.fangjia.PropertyStatsIndexService;
|
||||
import com.fangjia.service.open.FangjiaOfficialAreaService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.fangjia.core.util.DistrictCodeUtils;
|
||||
@@ -22,380 +28,453 @@ import com.fangjia.service.bo.IndexBo;
|
||||
import com.fangjia.service.bo.LandPriceIndexBo;
|
||||
import com.fangjia.service.mongo.fangjia.LandPriceIndexService;
|
||||
import com.fangjia.service.mongo.fangjia.StatsIndexService;
|
||||
import org.sothis.core.util.CollectionUtils;
|
||||
|
||||
public class StatsIndexController {
|
||||
private StatsIndexService statsIndexService;
|
||||
private LandPriceIndexService landPriceIndexService;
|
||||
private StatsIndexService statsIndexService;
|
||||
private LandPriceIndexService landPriceIndexService;
|
||||
|
||||
/**
|
||||
*查询
|
||||
* param y:city : ,yearmonth: yyyyMM cat:商铺,写字楼,住宅
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
public Object searchAction(StatsIndexModel model) throws Exception {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if(StringUtils.isBlank(model.getCity())){
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "请输入城市编码"));
|
||||
return mav;
|
||||
}
|
||||
String cityName = DistrictCodeUtils.getCityName(model.getCity());
|
||||
if(cityName == null){
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码"));
|
||||
return mav;
|
||||
}
|
||||
if (StringUtils.isBlank(model.getYearmonth())) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "请输入要查询的年月"));
|
||||
return mav;
|
||||
}
|
||||
Map<String, Object> resMap = new HashMap<String, Object>();
|
||||
List<StatsIndex> statsIndexs=statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), true,model.getCat());
|
||||
List<StatsIndex> statsIndexList=new ArrayList<StatsIndex>();
|
||||
if("商铺".equalsIgnoreCase(model.getCat()) || "写字楼".equalsIgnoreCase(model.getCat())){
|
||||
for(StatsIndex statsIndex:statsIndexs){
|
||||
StatsIndex newStatsIndex=new StatsIndex();
|
||||
newStatsIndex.setFangChain(statsIndex.getFangChain());
|
||||
newStatsIndex.setFangIndex(statsIndex.getFangIndex());
|
||||
newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity()));
|
||||
newStatsIndex.setYearmonth(statsIndex.getYearmonth());
|
||||
if(StringUtils.isNotBlank(newStatsIndex.getCity())){
|
||||
statsIndexList.add(newStatsIndex);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for(StatsIndex statsIndex:statsIndexs){
|
||||
StatsIndex newStatsIndex=new StatsIndex();
|
||||
newStatsIndex.setNewChain(statsIndex.getNewChain());
|
||||
newStatsIndex.setNewYeartoyear(statsIndex.getNewYeartoyear());
|
||||
newStatsIndex.setNewFixedbase(statsIndex.getNewFixedbase());
|
||||
|
||||
newStatsIndex.setBelowChain(statsIndex.getBelowChain());
|
||||
newStatsIndex.setBelowYeartoyear(statsIndex.getBelowYeartoyear());
|
||||
newStatsIndex.setBelowFixedbase(statsIndex.getBelowFixedbase());
|
||||
|
||||
newStatsIndex.setAmongChain(statsIndex.getAmongChain());
|
||||
newStatsIndex.setAmongYeartoyear(statsIndex.getAmongYeartoyear());
|
||||
newStatsIndex.setAmongFixedbase(statsIndex.getAmongFixedbase());
|
||||
|
||||
newStatsIndex.setAboveChain(statsIndex.getAboveChain());
|
||||
newStatsIndex.setAboveYeartoyear(statsIndex.getAboveYeartoyear());
|
||||
newStatsIndex.setAboveFixedbase(statsIndex.getAboveFixedbase());
|
||||
|
||||
newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity()));
|
||||
newStatsIndex.setYearmonth(String.valueOf(statsIndex.getSource()));
|
||||
if(StringUtils.isNotBlank(newStatsIndex.getCity())){
|
||||
statsIndexList.add(newStatsIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(statsIndexList.isEmpty()){
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "请检查输入的城市或者年月"));
|
||||
return mav;
|
||||
}
|
||||
resMap.put("results",statsIndexList.get(0));
|
||||
if(statsIndexList.size()>0){
|
||||
resMap.put("count", statsIndexList.size());
|
||||
if("商铺".equals(model.getCat())){
|
||||
resMap.put("type", "商铺");
|
||||
}else if("写字楼".equals(model.getCat())){
|
||||
resMap.put("type", "写字楼");
|
||||
}else{
|
||||
resMap.put("type", "住宅");
|
||||
}
|
||||
}
|
||||
mav.setModel(resMap);
|
||||
return mav;
|
||||
}
|
||||
private FangjiaOfficialAreaService fangjiaOfficialAreaService;
|
||||
private DistrictService districtService;
|
||||
|
||||
/**
|
||||
*查询新房指数
|
||||
* param yearmonth: yyyyMM
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
public Object searchNewDistrictIndexAction(StatsIndexModel model) throws Exception {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if(StringUtils.isNotBlank(model.getCity())){
|
||||
String cityName = DistrictCodeUtils.getCityName(model.getCity());
|
||||
if(cityName == null){
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码"));
|
||||
return mav;
|
||||
}
|
||||
model.setCity(cityName);
|
||||
}
|
||||
if(StringUtils.isBlank(model.getYearmonth())){
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM"));
|
||||
return mav;
|
||||
}
|
||||
List<StatsIndex> statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), false, "住宅");
|
||||
List<IndexBo> statsIndexList = new ArrayList<IndexBo>();
|
||||
|
||||
if(statsIndexs != null && statsIndexs.size() > 0){
|
||||
for(StatsIndex statsIndex : statsIndexs){
|
||||
IndexBo newStatsIndex = new IndexBo();
|
||||
newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity()));
|
||||
newStatsIndex.setYearmonth(statsIndex.getYearmonth());
|
||||
newStatsIndex.setMOM(statsIndex.getNewChain());
|
||||
newStatsIndex.setYOY(statsIndex.getNewYeartoyear());
|
||||
newStatsIndex.setFixedBase(statsIndex.getNewFixedbase());
|
||||
newStatsIndex.setSource(String.valueOf(statsIndex.getSource()));
|
||||
if(StringUtils.isNotBlank(newStatsIndex.getCity())){
|
||||
statsIndexList.add(newStatsIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(statsIndexList.isEmpty()){
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
Map<String, Object> resMap = new HashMap<String, Object>();
|
||||
resMap.put("results",statsIndexList);
|
||||
resMap.put("count", statsIndexList.size());
|
||||
resMap.put("type", "新建商品房");
|
||||
mav.setModel(resMap);
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
*查询二手房指数
|
||||
* param yearmonth: yyyyMM
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
public Object searchDistrictIndexAction(StatsIndexModel model) throws Exception {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if(StringUtils.isNotBlank(model.getCity())){
|
||||
String cityName = DistrictCodeUtils.getCityName(model.getCity());
|
||||
if(cityName == null){
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码"));
|
||||
return mav;
|
||||
}
|
||||
model.setCity(cityName);
|
||||
}
|
||||
if(StringUtils.isBlank(model.getYearmonth())){
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM"));
|
||||
return mav;
|
||||
}
|
||||
List<StatsIndex> statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), false, "住宅");
|
||||
List<IndexBo> statsIndexList = new ArrayList<IndexBo>();
|
||||
|
||||
if(statsIndexs != null && statsIndexs.size() > 0){
|
||||
for(StatsIndex statsIndex:statsIndexs){
|
||||
IndexBo newStatsIndex = new IndexBo();
|
||||
newStatsIndex.setSmallMOM(statsIndex.getBelowChain());
|
||||
newStatsIndex.setSmallYOY(statsIndex.getBelowYeartoyear());
|
||||
newStatsIndex.setSmallFixedBase(statsIndex.getBelowFixedbase());
|
||||
|
||||
newStatsIndex.setMediumMOM(statsIndex.getAmongChain());
|
||||
newStatsIndex.setMediumYOY(statsIndex.getAmongYeartoyear());
|
||||
newStatsIndex.setMediumFixedBase(statsIndex.getAmongFixedbase());
|
||||
|
||||
newStatsIndex.setLargeMOM(statsIndex.getAboveChain());
|
||||
newStatsIndex.setLargeYOY(statsIndex.getAboveYeartoyear());
|
||||
newStatsIndex.setLargeFixedBase(statsIndex.getAboveFixedbase());
|
||||
|
||||
newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity()));
|
||||
newStatsIndex.setYearmonth(statsIndex.getYearmonth());
|
||||
newStatsIndex.setSource(String.valueOf(statsIndex.getSource()));
|
||||
if(StringUtils.isNotBlank(newStatsIndex.getCity())){
|
||||
statsIndexList.add(newStatsIndex);
|
||||
}else{
|
||||
System.out.println(statsIndex.getCity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(statsIndexList.isEmpty()){
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
Map<String, Object> resMap = new HashMap<String, Object>();
|
||||
resMap.put("results",statsIndexList);
|
||||
resMap.put("count", statsIndexList.size());
|
||||
resMap.put("type", "二手住宅");
|
||||
mav.setModel(resMap);
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
*查询商铺指数
|
||||
* param yearmonth: yyyyMM
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
public Object searchShopIndexAction(StatsIndexModel model) throws Exception {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if(StringUtils.isNotBlank(model.getCity())){
|
||||
String cityName = DistrictCodeUtils.getCityName(model.getCity());
|
||||
if(cityName == null){
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码"));
|
||||
return mav;
|
||||
}
|
||||
model.setCity(cityName);
|
||||
}
|
||||
if(StringUtils.isBlank(model.getYearmonth())){
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM"));
|
||||
return mav;
|
||||
}
|
||||
List<StatsIndex> statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), true, "商铺");
|
||||
List<IndexBo> statsIndexList = new ArrayList<IndexBo>();
|
||||
|
||||
if(statsIndexs != null && statsIndexs.size() > 0){
|
||||
for(StatsIndex statsIndex:statsIndexs){
|
||||
IndexBo newStatsIndex = new IndexBo();
|
||||
newStatsIndex.setMOM(statsIndex.getFangChain());
|
||||
newStatsIndex.setIndex(statsIndex.getFangIndex());
|
||||
newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity()));
|
||||
newStatsIndex.setYearmonth(statsIndex.getYearmonth());
|
||||
newStatsIndex.setSource(String.valueOf(statsIndex.getSource()));
|
||||
if(StringUtils.isNotBlank(newStatsIndex.getCity())){
|
||||
statsIndexList.add(newStatsIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(statsIndexList.isEmpty()){
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
Map<String, Object> resMap = new HashMap<String, Object>();
|
||||
resMap.put("results",statsIndexList);
|
||||
resMap.put("count", statsIndexList.size());
|
||||
resMap.put("type", "商铺");
|
||||
mav.setModel(resMap);
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
*查询写字楼指数
|
||||
* yearmonth: yyyyMM
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
public Object searchOfficeIndexAction(StatsIndexModel model) throws Exception {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if(StringUtils.isNotBlank(model.getCity())){
|
||||
String cityName = DistrictCodeUtils.getCityName(model.getCity());
|
||||
if(cityName == null){
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码"));
|
||||
return mav;
|
||||
}
|
||||
model.setCity(cityName);
|
||||
}
|
||||
if(StringUtils.isBlank(model.getYearmonth())){
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
List<StatsIndex> statsIndexs=statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), true, "写字楼");
|
||||
List<IndexBo> statsIndexList = new ArrayList<IndexBo>();
|
||||
|
||||
if(statsIndexs != null && statsIndexs.size() > 0){
|
||||
for(StatsIndex statsIndex:statsIndexs){
|
||||
IndexBo newStatsIndex = new IndexBo();
|
||||
newStatsIndex.setMOM(statsIndex.getFangChain());
|
||||
newStatsIndex.setIndex(statsIndex.getFangIndex());
|
||||
newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity()));
|
||||
newStatsIndex.setYearmonth(statsIndex.getYearmonth());
|
||||
newStatsIndex.setSource(String.valueOf(statsIndex.getSource()));
|
||||
if(StringUtils.isNotBlank(newStatsIndex.getCity())){
|
||||
statsIndexList.add(newStatsIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(statsIndexList.isEmpty()){
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
Map<String, Object> resMap = new HashMap<String, Object>();
|
||||
resMap.put("results",statsIndexList);
|
||||
resMap.put("count", statsIndexList.size());
|
||||
resMap.put("type", "写字楼");
|
||||
mav.setModel(resMap);
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
*查询
|
||||
* param city:城市 , year:年份
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
public Object searchLandIndexAction(LandPriceIndexModel model) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if(StringUtils.isNotBlank(model.getCity())) {
|
||||
String cityName = DistrictCodeUtils.getCityName(model.getCity());
|
||||
if(cityName == null){
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码"));
|
||||
return mav;
|
||||
}
|
||||
model.setCity(cityName);
|
||||
}
|
||||
if(model.getYear() <= 0){
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年份必须输入,格式:yyyy"));
|
||||
return mav;
|
||||
}
|
||||
List<LandPriceIndex> landPriceIndexList = new ArrayList<LandPriceIndex>();
|
||||
if(StringUtils.isNotBlank(model.getCity())) {
|
||||
landPriceIndexList = landPriceIndexService.findByCityAndYear(model.getCity(), model.getYear());
|
||||
} else {
|
||||
landPriceIndexList = landPriceIndexService.findAllByYear(model.getYear());
|
||||
}
|
||||
List<LandPriceIndexBo> landPriceIndexBoList = new ArrayList<LandPriceIndexBo>();
|
||||
|
||||
if(landPriceIndexList != null && landPriceIndexList.size() > 0){
|
||||
for(LandPriceIndex landPriceIndex:landPriceIndexList){
|
||||
LandPriceIndexBo landPriceIndexBo = new LandPriceIndexBo();
|
||||
|
||||
landPriceIndexBo.setCity(DistrictCodeUtils.getCityCode(landPriceIndex.getCity()));
|
||||
landPriceIndexBo.setYear(landPriceIndex.getYear());
|
||||
landPriceIndexBo.setCompositeIndex(landPriceIndex.getComprehensiveIndex());
|
||||
landPriceIndexBo.setCommercialIndex(landPriceIndex.getCommercialIndex());
|
||||
landPriceIndexBo.setResidentialIndex(landPriceIndex.getDistrictIndex());
|
||||
landPriceIndexBo.setIndustrialIndex(landPriceIndex.getIndustryIndex());
|
||||
|
||||
if(StringUtils.isNotBlank(landPriceIndexBo.getCity())){
|
||||
landPriceIndexBoList.add(landPriceIndexBo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(landPriceIndexBoList.isEmpty()){
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
Map<String, Object> resMap = new HashMap<String, Object>();
|
||||
resMap.put("results",landPriceIndexBoList);
|
||||
resMap.put("count", landPriceIndexBoList.size());
|
||||
resMap.put("type", "土地");
|
||||
mav.setModel(resMap);
|
||||
return mav;
|
||||
}
|
||||
|
||||
private String getSourceString(int source){
|
||||
if(source == 1){
|
||||
return "统计局";
|
||||
}else if(source == 2){
|
||||
return "房价网";
|
||||
}else if(source == 3){
|
||||
return "手工输入";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public void setStatsIndexService(StatsIndexService statsIndexService) {
|
||||
this.statsIndexService = statsIndexService;
|
||||
}
|
||||
private PropertyStatsIndexService propertyStatsIndexService;
|
||||
|
||||
public void setLandPriceIndexService(LandPriceIndexService landPriceIndexService) {
|
||||
this.landPriceIndexService = landPriceIndexService;
|
||||
}
|
||||
/**
|
||||
* 查询城市级别价格指数
|
||||
* param y:city : ,yearmonth: yyyyMM cat:商铺,写字楼,住宅
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
public Object cityAction(StatsIndexModel model) throws Exception {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(model.getCity())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("请输入城市编码"));
|
||||
return mav;
|
||||
}
|
||||
if (StringUtils.isBlank(model.getYearmonth())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("请输入要查询的年月"));
|
||||
return mav;
|
||||
}
|
||||
String cityName = DistrictCodeUtils.getCityName(model.getCity());
|
||||
if (cityName == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("无法匹配到该城市编码"));
|
||||
return mav;
|
||||
}
|
||||
Map<String, Object> resMap = new HashMap<String, Object>();
|
||||
StatsIndex statsIndex = statsIndexService.findStatsIndex(cityName, "", "城市", "", model.getYearmonth(), model.getCat());
|
||||
if (statsIndex != null) {
|
||||
StatsIndex newStatsIndex = new StatsIndex();
|
||||
newStatsIndex.setChain(statsIndex.getChain());
|
||||
newStatsIndex.setYeartoyear(statsIndex.getYeartoyear());
|
||||
newStatsIndex.setFixedbase(statsIndex.getFixedbase());
|
||||
|
||||
newStatsIndex.setBelowChain(statsIndex.getBelowChain());
|
||||
newStatsIndex.setBelowYeartoyear(statsIndex.getBelowYeartoyear());
|
||||
newStatsIndex.setBelowFixedbase(statsIndex.getBelowFixedbase());
|
||||
|
||||
newStatsIndex.setAmongChain(statsIndex.getAmongChain());
|
||||
newStatsIndex.setAmongYeartoyear(statsIndex.getAmongYeartoyear());
|
||||
newStatsIndex.setAmongFixedbase(statsIndex.getAmongFixedbase());
|
||||
|
||||
newStatsIndex.setAboveChain(statsIndex.getAboveChain());
|
||||
newStatsIndex.setAboveYeartoyear(statsIndex.getAboveYeartoyear());
|
||||
newStatsIndex.setAboveFixedbase(statsIndex.getAboveFixedbase());
|
||||
|
||||
newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity()));
|
||||
newStatsIndex.setYearmonth(model.getYearmonth());
|
||||
resMap.put("results", newStatsIndex);
|
||||
}
|
||||
resMap.put("status", "200");
|
||||
resMap.put("msg", "ok");
|
||||
mav.setModel(resMap);
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询区域级别价格指数
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
|
||||
@Authority(role = Role.USER)
|
||||
public Object districtAction(StatsIndexModel model) throws Exception {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(model.getDistrict())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("请输入区域编码"));
|
||||
return mav;
|
||||
}
|
||||
if (StringUtils.isBlank(model.getYearmonth())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("请输入要查询的年月"));
|
||||
return mav;
|
||||
}
|
||||
FangjiaOfficialAreaMap fangjiaOfficialAreaMap = fangjiaOfficialAreaService.convertOfficialCodeToFangjia(model.getDistrict());
|
||||
if (fangjiaOfficialAreaMap == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("无法匹配到该区域编码"));
|
||||
return mav;
|
||||
}
|
||||
Map<String, Object> resMap = new HashMap<String, Object>();
|
||||
StatsIndex statsIndex = statsIndexService.findStatsIndex(fangjiaOfficialAreaMap.getFangjiaCity(), fangjiaOfficialAreaMap.getFangjiaDistrict(), "区域", "", model.getYearmonth(), model.getCat());
|
||||
if (statsIndex != null) {
|
||||
StatsIndex newStatsIndex = new StatsIndex();
|
||||
newStatsIndex.setChain(statsIndex.getChain());
|
||||
newStatsIndex.setYeartoyear(statsIndex.getYeartoyear());
|
||||
newStatsIndex.setFixedbase(statsIndex.getFixedbase());
|
||||
newStatsIndex.setDistrict(model.getDistrict());
|
||||
newStatsIndex.setYearmonth(model.getYearmonth());
|
||||
resMap.put("results", newStatsIndex);
|
||||
}
|
||||
resMap.put("status", "200");
|
||||
resMap.put("msg", "ok");
|
||||
mav.setModel(resMap);
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 小区价格指数
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
public Object propertyAction(StatsIndexModel model) throws Exception {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isBlank(model.getId())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("请输入小区id"));
|
||||
return mav;
|
||||
}
|
||||
if (StringUtils.isBlank(model.getYearmonth())) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("请输入要查询的年月"));
|
||||
return mav;
|
||||
}
|
||||
District district = districtService.findById(model.getId());
|
||||
if (district == null) {
|
||||
mav.setModel(BasicModel.buildBadRequestModel("无法匹配到小区"));
|
||||
return mav;
|
||||
}
|
||||
Map<String, Object> resMap = new HashMap<String, Object>();
|
||||
PropertyStatsIndex statsIndex = propertyStatsIndexService.findStatsIndex(district.getCity(), district.getRegion(), district.getName(), model.getYearmonth(), model.getCat());
|
||||
if (statsIndex != null) {
|
||||
PropertyStatsIndex newStatsIndex = new PropertyStatsIndex();
|
||||
newStatsIndex.setChain(statsIndex.getChain());
|
||||
newStatsIndex.setYeartoyear(statsIndex.getYeartoyear());
|
||||
newStatsIndex.setFixedbase(statsIndex.getFixedbase());
|
||||
newStatsIndex.setDistrict(model.getDistrict());
|
||||
newStatsIndex.setYearmonth(model.getYearmonth());
|
||||
newStatsIndex.setId(model.getId());
|
||||
resMap.put("results", newStatsIndex);
|
||||
}
|
||||
|
||||
resMap.put("status", "200");
|
||||
resMap.put("msg", "ok");
|
||||
mav.setModel(resMap);
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询新房指数
|
||||
* param yearmonth: yyyyMM
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
public Object searchNewDistrictIndexAction(StatsIndexModel model) throws Exception {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isNotBlank(model.getCity())) {
|
||||
String cityName = DistrictCodeUtils.getCityName(model.getCity());
|
||||
if (cityName == null) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码"));
|
||||
return mav;
|
||||
}
|
||||
model.setCity(cityName);
|
||||
}
|
||||
if (StringUtils.isBlank(model.getYearmonth())) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM"));
|
||||
return mav;
|
||||
}
|
||||
List<StatsIndex> statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), false, "住宅");
|
||||
List<IndexBo> statsIndexList = new ArrayList<IndexBo>();
|
||||
|
||||
if (statsIndexs != null && statsIndexs.size() > 0) {
|
||||
for (StatsIndex statsIndex : statsIndexs) {
|
||||
IndexBo newStatsIndex = new IndexBo();
|
||||
newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity()));
|
||||
newStatsIndex.setYearmonth(statsIndex.getYearmonth());
|
||||
newStatsIndex.setMOM(statsIndex.getChain());
|
||||
newStatsIndex.setYOY(statsIndex.getYeartoyear());
|
||||
newStatsIndex.setFixedBase(statsIndex.getFixedbase());
|
||||
newStatsIndex.setSource(String.valueOf(statsIndex.getSource()));
|
||||
if (StringUtils.isNotBlank(newStatsIndex.getCity())) {
|
||||
statsIndexList.add(newStatsIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (statsIndexList.isEmpty()) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
Map<String, Object> resMap = new HashMap<String, Object>();
|
||||
resMap.put("results", statsIndexList);
|
||||
resMap.put("count", statsIndexList.size());
|
||||
resMap.put("type", "新建商品房");
|
||||
mav.setModel(resMap);
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询二手房指数
|
||||
* param yearmonth: yyyyMM
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
public Object searchDistrictIndexAction(StatsIndexModel model) throws Exception {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isNotBlank(model.getCity())) {
|
||||
String cityName = DistrictCodeUtils.getCityName(model.getCity());
|
||||
if (cityName == null) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码"));
|
||||
return mav;
|
||||
}
|
||||
model.setCity(cityName);
|
||||
}
|
||||
if (StringUtils.isBlank(model.getYearmonth())) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM"));
|
||||
return mav;
|
||||
}
|
||||
List<StatsIndex> statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), false, "住宅");
|
||||
List<IndexBo> statsIndexList = new ArrayList<IndexBo>();
|
||||
|
||||
if (statsIndexs != null && statsIndexs.size() > 0) {
|
||||
for (StatsIndex statsIndex : statsIndexs) {
|
||||
IndexBo newStatsIndex = new IndexBo();
|
||||
newStatsIndex.setSmallMOM(statsIndex.getBelowChain());
|
||||
newStatsIndex.setSmallYOY(statsIndex.getBelowYeartoyear());
|
||||
newStatsIndex.setSmallFixedBase(statsIndex.getBelowFixedbase());
|
||||
|
||||
newStatsIndex.setMediumMOM(statsIndex.getAmongChain());
|
||||
newStatsIndex.setMediumYOY(statsIndex.getAmongYeartoyear());
|
||||
newStatsIndex.setMediumFixedBase(statsIndex.getAmongFixedbase());
|
||||
|
||||
newStatsIndex.setLargeMOM(statsIndex.getAboveChain());
|
||||
newStatsIndex.setLargeYOY(statsIndex.getAboveYeartoyear());
|
||||
newStatsIndex.setLargeFixedBase(statsIndex.getAboveFixedbase());
|
||||
|
||||
newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity()));
|
||||
newStatsIndex.setYearmonth(statsIndex.getYearmonth());
|
||||
newStatsIndex.setSource(String.valueOf(statsIndex.getSource()));
|
||||
if (StringUtils.isNotBlank(newStatsIndex.getCity())) {
|
||||
statsIndexList.add(newStatsIndex);
|
||||
} else {
|
||||
System.out.println(statsIndex.getCity());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (statsIndexList.isEmpty()) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
Map<String, Object> resMap = new HashMap<String, Object>();
|
||||
resMap.put("results", statsIndexList);
|
||||
resMap.put("count", statsIndexList.size());
|
||||
resMap.put("type", "二手住宅");
|
||||
mav.setModel(resMap);
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商铺指数
|
||||
* param yearmonth: yyyyMM
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
public Object searchShopIndexAction(StatsIndexModel model) throws Exception {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isNotBlank(model.getCity())) {
|
||||
String cityName = DistrictCodeUtils.getCityName(model.getCity());
|
||||
if (cityName == null) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码"));
|
||||
return mav;
|
||||
}
|
||||
model.setCity(cityName);
|
||||
}
|
||||
if (StringUtils.isBlank(model.getYearmonth())) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM"));
|
||||
return mav;
|
||||
}
|
||||
List<StatsIndex> statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), true, "商铺");
|
||||
List<IndexBo> statsIndexList = new ArrayList<IndexBo>();
|
||||
|
||||
if (statsIndexs != null && statsIndexs.size() > 0) {
|
||||
for (StatsIndex statsIndex : statsIndexs) {
|
||||
IndexBo newStatsIndex = new IndexBo();
|
||||
newStatsIndex.setMOM(statsIndex.getFangChain());
|
||||
newStatsIndex.setIndex(statsIndex.getFangIndex());
|
||||
newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity()));
|
||||
newStatsIndex.setYearmonth(statsIndex.getYearmonth());
|
||||
newStatsIndex.setSource(String.valueOf(statsIndex.getSource()));
|
||||
if (StringUtils.isNotBlank(newStatsIndex.getCity())) {
|
||||
statsIndexList.add(newStatsIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (statsIndexList.isEmpty()) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
Map<String, Object> resMap = new HashMap<String, Object>();
|
||||
resMap.put("results", statsIndexList);
|
||||
resMap.put("count", statsIndexList.size());
|
||||
resMap.put("type", "商铺");
|
||||
mav.setModel(resMap);
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询写字楼指数
|
||||
* yearmonth: yyyyMM
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
public Object searchOfficeIndexAction(StatsIndexModel model) throws Exception {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isNotBlank(model.getCity())) {
|
||||
String cityName = DistrictCodeUtils.getCityName(model.getCity());
|
||||
if (cityName == null) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码"));
|
||||
return mav;
|
||||
}
|
||||
model.setCity(cityName);
|
||||
}
|
||||
if (StringUtils.isBlank(model.getYearmonth())) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年月必须输入,格式:yyyyMM"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
List<StatsIndex> statsIndexs = statsIndexService.findAllStats(model.getCity(), model.getYearmonth(), true, "写字楼");
|
||||
List<IndexBo> statsIndexList = new ArrayList<IndexBo>();
|
||||
|
||||
if (statsIndexs != null && statsIndexs.size() > 0) {
|
||||
for (StatsIndex statsIndex : statsIndexs) {
|
||||
IndexBo newStatsIndex = new IndexBo();
|
||||
newStatsIndex.setMOM(statsIndex.getFangChain());
|
||||
newStatsIndex.setIndex(statsIndex.getFangIndex());
|
||||
newStatsIndex.setCity(DistrictCodeUtils.getCityCode(statsIndex.getCity()));
|
||||
newStatsIndex.setYearmonth(statsIndex.getYearmonth());
|
||||
newStatsIndex.setSource(String.valueOf(statsIndex.getSource()));
|
||||
if (StringUtils.isNotBlank(newStatsIndex.getCity())) {
|
||||
statsIndexList.add(newStatsIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (statsIndexList.isEmpty()) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
Map<String, Object> resMap = new HashMap<String, Object>();
|
||||
resMap.put("results", statsIndexList);
|
||||
resMap.put("count", statsIndexList.size());
|
||||
resMap.put("type", "写字楼");
|
||||
mav.setModel(resMap);
|
||||
return mav;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询
|
||||
* param city:城市 , year:年份
|
||||
*/
|
||||
@Authority(role = Role.USER)
|
||||
public Object searchLandIndexAction(LandPriceIndexModel model) {
|
||||
RestfulModelAndView mav = new RestfulModelAndView();
|
||||
mav.setViewType("rest");
|
||||
if (StringUtils.isNotBlank(model.getCity())) {
|
||||
String cityName = DistrictCodeUtils.getCityName(model.getCity());
|
||||
if (cityName == null) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "无法匹配到该城市编码"));
|
||||
return mav;
|
||||
}
|
||||
model.setCity(cityName);
|
||||
}
|
||||
if (model.getYear() <= 0) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.ARGUMENT_LOSE, "年份必须输入,格式:yyyy"));
|
||||
return mav;
|
||||
}
|
||||
List<LandPriceIndex> landPriceIndexList = new ArrayList<LandPriceIndex>();
|
||||
if (StringUtils.isNotBlank(model.getCity())) {
|
||||
landPriceIndexList = landPriceIndexService.findByCityAndYear(model.getCity(), model.getYear());
|
||||
} else {
|
||||
landPriceIndexList = landPriceIndexService.findAllByYear(model.getYear());
|
||||
}
|
||||
List<LandPriceIndexBo> landPriceIndexBoList = new ArrayList<LandPriceIndexBo>();
|
||||
|
||||
if (landPriceIndexList != null && landPriceIndexList.size() > 0) {
|
||||
for (LandPriceIndex landPriceIndex : landPriceIndexList) {
|
||||
LandPriceIndexBo landPriceIndexBo = new LandPriceIndexBo();
|
||||
|
||||
landPriceIndexBo.setCity(DistrictCodeUtils.getCityCode(landPriceIndex.getCity()));
|
||||
landPriceIndexBo.setYear(landPriceIndex.getYear());
|
||||
landPriceIndexBo.setCompositeIndex(landPriceIndex.getComprehensiveIndex());
|
||||
landPriceIndexBo.setCommercialIndex(landPriceIndex.getCommercialIndex());
|
||||
landPriceIndexBo.setResidentialIndex(landPriceIndex.getDistrictIndex());
|
||||
landPriceIndexBo.setIndustrialIndex(landPriceIndex.getIndustryIndex());
|
||||
|
||||
if (StringUtils.isNotBlank(landPriceIndexBo.getCity())) {
|
||||
landPriceIndexBoList.add(landPriceIndexBo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (landPriceIndexBoList.isEmpty()) {
|
||||
mav.setModel(new HttpCode(OpenHttpCodeEnum.TARGET_DATA_NOT_EXIST, "目标数据不存在"));
|
||||
return mav;
|
||||
}
|
||||
|
||||
Map<String, Object> resMap = new HashMap<String, Object>();
|
||||
resMap.put("results", landPriceIndexBoList);
|
||||
resMap.put("count", landPriceIndexBoList.size());
|
||||
resMap.put("type", "土地");
|
||||
mav.setModel(resMap);
|
||||
return mav;
|
||||
}
|
||||
|
||||
private String getSourceString(int source) {
|
||||
if (source == 1) {
|
||||
return "统计局";
|
||||
} else if (source == 2) {
|
||||
return "房价网";
|
||||
} else if (source == 3) {
|
||||
return "手工输入";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public void setStatsIndexService(StatsIndexService statsIndexService) {
|
||||
this.statsIndexService = statsIndexService;
|
||||
}
|
||||
|
||||
public void setLandPriceIndexService(LandPriceIndexService landPriceIndexService) {
|
||||
this.landPriceIndexService = landPriceIndexService;
|
||||
}
|
||||
|
||||
public void setFangjiaOfficialAreaService(FangjiaOfficialAreaService fangjiaOfficialAreaService) {
|
||||
this.fangjiaOfficialAreaService = fangjiaOfficialAreaService;
|
||||
}
|
||||
|
||||
public void setDistrictService(DistrictService districtService) {
|
||||
this.districtService = districtService;
|
||||
}
|
||||
|
||||
public void setPropertyStatsIndexService(PropertyStatsIndexService propertyStatsIndexService) {
|
||||
this.propertyStatsIndexService = propertyStatsIndexService;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user