Пример #1
0
  public EntrustSaleHouseSyn convertToSyncObj(String operationId) {
    EntrustSaleHouseSyn entrustSaleHouseSyn = new EntrustSaleHouseSyn();
    entrustSaleHouseSyn.setItemID(String.valueOf(getId()));
    if (operationId == null) {
      entrustSaleHouseSyn.setOperationId("1");
    } else {
      entrustSaleHouseSyn.setOperationId(operationId);
    }

    entrustSaleHouseSyn.setRequestID(UUID.randomUUID().toString());
    entrustSaleHouseSyn.setSubdistrictID(StringUtil.trimToEmpty(getCommunityId()));
    entrustSaleHouseSyn.setSubdistrictName(StringUtil.trimToEmpty(getCommunityName()));
    entrustSaleHouseSyn.setBuildingNo(String.valueOf(getBuildingNo()));
    entrustSaleHouseSyn.setUnitNo(String.valueOf(getUnitNo()));
    entrustSaleHouseSyn.setRoomNo(String.valueOf(getRoomNo()));
    entrustSaleHouseSyn.setArea(String.valueOf(getArea()));
    entrustSaleHouseSyn.setPrice(String.valueOf(getPrice()));
    entrustSaleHouseSyn.setRoomCount(String.valueOf(getShi()));
    entrustSaleHouseSyn.setLivingRoomCount(String.valueOf(getTing()));
    entrustSaleHouseSyn.setOtherRequirement(StringUtil.trimToEmpty(getOtherRequirement()));
    entrustSaleHouseSyn.setClientName(getUserName());
    if (getGender() == null || getGender() == 0) {
      entrustSaleHouseSyn.setAppellation("先生");
      entrustSaleHouseSyn.setGender("男");
    } else {
      entrustSaleHouseSyn.setAppellation("女士");
      entrustSaleHouseSyn.setGender("女");
    }

    entrustSaleHouseSyn.setMobilePhone(getTelePhone());
    entrustSaleHouseSyn.setOtherContactInfo(StringUtil.trimToEmpty(getOtherContact()));
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    String timeStr = getLastModified() == null ? "" : sdf.format(getLastModified());
    entrustSaleHouseSyn.setCreateTime(timeStr);
    return entrustSaleHouseSyn;
  }
Пример #2
0
  public static THouse fromHouse(HouseSecondHandHouse house) {
    if (house.getPictures() == null || house.getPictures().size() < 1) {
      System.out.println("The other picture size <0	 secondHouse_id:" + house.getHouseId());
      return null;
    }
    // 这一步,会在获取数据源的时候,给没有封面的房源附上封面
    if (house.getCoverImage() == null) {
      System.out.println("The cover image is empty secondHouse_id:" + house.getHouseId());
      return null;
    }

    THouse h = new THouse();
    h.setBuildNum("0"); // 无楼号,用0代替
    h.setBuildType(TBuildType.其它);
    h.setBuildUnit(BigInteger.valueOf(0)); // 无单元号,用0代替
    h.setCovorImage("http://" + StringUtil.HSHB_DOMAIN + "/frontImages" + house.getCoverImage());
    // 没有装修 则 其他 20150518
    if (house.getDecoration() != null)
      h.setDecoration(TDecoration.fromHBValue(house.getDecoration().getDecorationName()));
    else h.setDecoration(TDecoration.fromHBValue("其他"));

    h.setHouseArea(String.valueOf(house.getArea()) + "m2");
    h.setHouseAllFloor(String.valueOf(house.getStoreyCount()) + "层");

    for (HousePicture img : house.getPictures())
      h.getHouseImage()
          .add("http://" + StringUtil.HSHB_DOMAIN + "/frontImages" + img.getPictureUri());

    h.setHouseImageNum(String.valueOf(house.getPictures().size()) + "张");
    //    		h.setHouseImageNum("0张");

    String fn = "中";
    if (house.getStoreyCount() > 0) {
      double f = house.getStorey() * 0.1 / house.getStoreyCount() * 0.1;
      if (f >= 2f) fn = "上";
      else if (f < 2f && f >= 1f) fn = "中";
      else if (f < 1f) fn = "下";
    }

    h.setHouseFloor(fn + "层");
    //    	朝向 没有则 其他
    if (house.getOrientation() != null)
      h.setHouseOrientation(
          THouseOrientation.fromHBValue(house.getOrientation().getOrientationName()));
    else h.setHouseOrientation(THouseOrientation.fromHBValue("其他"));
    // 房源状态
    h.setHouseSituation(THouseSituation.fromHBValue(house.getUsageStatus()));
    h.setHouseStructurename(THouseStructurename.fromHBValue(house.getShi()));
    h.setHouseStructureshi(house.getShi() + "室");
    h.setHouseStructureting(house.getTing() + "厅");
    h.setHouseStructurewei(house.getWei() + "卫");

    //    	没有小区,答案 其他
    //    	if(house.getCommunity() == null){
    //    			h.setHouseType(THouseType.fromHBValue("其他"));
    ////    		return null;
    //    		}else if(house.getCommunity().getPropertyTypeId().getPropertyType() == null){
    //    			h.setHouseType(THouseType.fromHBValue("其他"));
    //    		}else{
    //
    //	h.setHouseType(THouseType.fromHBValue(house.getCommunity().getPropertyType().getUsageName()));
    //    	}
    if (StringUtil.isNotEmpty(house.getPropertyTypeName()))
      h.setHouseType(THouseType.fromHBValue(house.getPropertyTypeName()));
    else h.setHouseType(THouseType.fromHBValue("其他"));
    h.setPropertyVerified("1");
    h.setRoomNum(BigInteger.valueOf(0)); // 房间号,不能为空,但不能写详细房号,所以置0
    //
    //	h.setUrl("http://www.hshb.cn/houseSecond/houseSecondDetail/"+house.getHouseNo()+"/"+house.getBroker().getErpId());
    //    	String url = "http://www.hshb.cn/houseSecond/houseSecondDetail/"+house.getHouseNo();
    //    	if(house.getBroker()!=null)
    //    		url += "/"+house.getBroker().getErpId();
    String url = "http://www.hshb.cn/chushou/" + house.getHouseId() + ".html";
    h.setUrl(url);

    // 因为数据库里没有分户型图、室内图、室外图,所以都为0
    h.setLayoutImage("0");
    h.setIndoorImage("0");
    h.setOutdoorImage("0");

    return h;
  }