Java tutorial
package form.house; import form.BaseForm; import helper.DateUtil; import models.*; import org.apache.commons.lang3.StringUtils; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; import java.util.stream.Collectors; /** * @Created_With kitchen * @Author: kris * @Email: wubinwu@meituan.com * @Date: 16/12/18 ?3:32 * @Descrition: */ public class NewHouseForm extends BaseForm { /** * */ //? private Integer businessLicence = 0; //? private Integer wholeBusiness = 0; //???? private Integer foodAndBeverageBusinessLicense = 0; //? private Integer fireSafetyPermission = 0; //? private Integer invoice = 0; public Credential toCredential() { Credential credential = new Credential(); credential.setBusinessLicence(this.businessLicence); credential.setWholeBusiness(this.wholeBusiness); credential.setFoodAndBeverageBusinessLicense(this.foodAndBeverageBusinessLicense); credential.setFireSafetyPermission(this.fireSafetyPermission); credential.setInvoice(this.invoice); return credential; } /** * ? */ //?? private String contactName = ""; //???? private String contactMobile = ""; //? 1 private Integer contactType = 1; public Contact toContact() { Contact contact = new Contact(); contact.setMobile(this.contactMobile); contact.setName(this.contactName); contact.setType(this.contactType); return contact; } /** * ? */ // private Integer rentBusinessType = 1; //? private Integer rentStatus = 1; public void pushRentInfo(House house) { house.setRentBusinessType(this.rentBusinessType); house.setRentStatus(this.rentStatus); } /** * ?? */ //? private Integer provinceCode = 110000; //?? private Integer cityCode = 110100; //?? private Integer areaCode = 110101; //?? private Integer districtCode = 0; //? private String address = ""; // List<Integer> signs = new ArrayList<>(); //url private String mapUrl = ""; // private String wholeMapUrl = ""; //: todo private String hotMapUrl = ""; public List<Signs> toSign() { if (null == signs || signs.size() == 0) return Collections.EMPTY_LIST; return signs.stream().map(sign -> new Signs(sign)).collect(Collectors.toList()); } private void pushAddress(House house) { house.setProvinceCode(this.provinceCode); house.setCityCode(this.cityCode); house.setAreaCode(this.areaCode); house.setDistrictCode(this.districtCode); house.setAddress(this.address); house.setHotMapUrl(hotMapUrl); house.setWholeMapUrl(wholeMapUrl); house.setMapUrl(mapUrl); } /** * ?? */ //??? //? ? private Integer operateStatus = 0; //??? private String businessName = ""; //??(/??) //todo private List<Integer> businessStatus = new ArrayList<>(); public void pushStatus(House house) { house.setOperateStatus(this.operateStatus); house.setBusinessName(this.businessName); } /** * ? */ //? private List<String> pictures; // public List<Picture> toPicture(){ // if (null == pictures || pictures.size() == 0) return Collections.EMPTY_LIST; // List<Picture> result = new ArrayList<>(); // return pictures.stream().map(picUrl -> new Picture(picUrl)).collect(Collectors.toList()); // } // todo, private Integer houseType = 1; //? private String owner = ""; //? private Integer ownerType = 1; // private Integer propertyRightType = 1; // private String floor = "1"; //? private String areas = "0"; //? private String buildAreas = "0"; //? private String useAreas = "0"; //? private String showLength = "0"; // private String height = "0"; //? private String shade = "0"; //0, 1 private Integer decoration = 0; public void pushBuildInfo(House house) { house.setHouseType(this.houseType); house.setOwner(this.owner); house.setOwnerType(this.ownerType); house.setPropertyRightType(propertyRightType); house.setFloor(this.floor); house.setAreas(StringUtils.isNumeric(areas) ? Long.valueOf(this.areas) : 0l); house.setBuildAreas(StringUtils.isNumeric(buildAreas) ? Long.valueOf(this.buildAreas) : 0l); house.setUseAreas(StringUtils.isNumeric(useAreas) ? Long.valueOf(this.useAreas) : 0l); house.setShowLength(this.showLength); house.setHeight(StringUtils.isNumeric(this.height) ? Long.valueOf(this.height) : 0l); house.setShade(StringUtils.isNumeric(this.shade) ? Long.valueOf(this.shade) : 0l); house.setDecoration(this.decoration); } /** * ? */ //1 private String shopSignSizeOne; //2 private String shopSignSizeTwo; //? todo private List<Integer> facilities; //? private String capacitance; // private String downPipeDiameter; //? private String ductRate; //?? private Integer selfCarPortSize; //?? private Integer aroundCarPortSize; private void pushFacility(House house) { house.setShopSignSizeOne(stringToLong(this.shopSignSizeOne)); house.setShopSignSizeTwo(stringToLong(this.shopSignSizeTwo)); house.setPower(this.power); // house.setCapacityIncrease(this.capacityIncrease); house.setUpPipe(this.upPipe); house.setDownPipe(this.downPipe); house.setBlowOff(this.blowOff); house.setGreaseTrap(this.greaseTrap); house.setFire(this.fire); house.setGas(this.gas); house.setGasCylinders(this.gasCylinders); house.setDuct(this.duct); house.setOilFume(this.oilFume); house.setOutWard(this.outWard); house.setCapacitance(this.capacitance); house.setDownPipeDiameter(this.downPipeDiameter); house.setDuctRate(stringToLong(this.ductRate)); house.setSelfCarPortSize(this.selfCarPortSize); house.setAroundCarPortSize(this.aroundCarPortSize); } /** * */ // ?? private Long chummageDaily = 0l; // private Long chummageMonth = 0l; // private Long chummageYear = 0l; // private Integer chummageIncrease = 0; // private String chummageIncreaseRule = ""; // private Long transferCost = 0l; // private String pledgeMonth = "0"; // private String payMonth = "0"; // private Long propertyFee = 0l; // private Long waterFee = 0l; // private Long elasFee = 0l; // private Long gasFee = 0l; private void pushCharge(House house) { house.setChummageDaily(this.chummageDaily); house.setChummageMonth(this.chummageMonth); house.setChummageYear(this.chummageYear); house.setChummageIncrease(this.chummageIncrease); house.setChummageIncreaseRule(this.chummageIncreaseRule); house.setTransferCost(this.transferCost); house.setPledgeMonth(this.pledgeMonth); house.setPayMonth(this.payMonth); house.setPropertyFee(this.propertyFee); house.setWaterFee(this.waterFee); house.setElasFee(this.elasFee); house.setGasFee(this.gasFee); } /** * */ // private Long nextPayRentDate = -1l; //? private String maxRentYear = "0"; //??? private Integer repetition = 0; public void pushRent(House house) { house.setNextPayRentDate(new Date(this.nextPayRentDate)); house.setMaxRentYear(this.maxRentYear); house.setRepetition(this.repetition); } /** * */ // private Integer marchatLevel = 10; // private Integer houseLevel = 10; //? kaishi private Long perPersonMin = 0l; //? jieshu private Long perPersonMax = 0l; //? todo private List<Integer> businesss; // private String good; // private String bad; public void pushEvelate(House house) { house.setMarchatLevel(this.marchatLevel); house.setHouseLevel(this.houseLevel); house.setPerPersonMin(this.perPersonMin); house.setPerPersonMax(this.perPersonMax); house.setGood(this.good); house.setBad(this.bad); } /** * ?? */ private Integer houseSource = 8; private String sourceName = ""; private String describtion = ""; public void pushSource(House house) { house.setHouseSource(this.houseSource); house.setSourceName(this.sourceName); house.setDescribtion(this.describtion); } /** * */ //; private String location; // //? private Integer rentType; //? private String business; //??? private String contact; //?? //? // private String maxFloor; // private Integer power; //? private Integer capacityIncrease; //? private Integer upPipe; // private Integer downPipe; // private Integer blowOff; //? private Integer greaseTrap; // private Integer gas; // private Integer gasCylinders; //? private Integer fire; //? private Integer duct; //? private Integer oilFume; // private Integer outWard; //? private String proposed; //? public House toHouse() { House house = new House(); pushStatus(house); pushAddress(house); pushFacility(house); pushCharge(house); pushRentInfo(house); pushBuildInfo(house); pushRent(house); pushEvelate(house); pushSource(house); return house; } private Long stringToLong(String number) { if (!StringUtils.isNumeric(number)) return 0l; Double result = Double.valueOf(number) * 100; return result.longValue(); } //setter and getter public Integer getBusinessLicence() { return businessLicence; } public void setBusinessLicence(Integer businessLicence) { this.businessLicence = businessLicence; } public Integer getWholeBusiness() { return wholeBusiness; } public void setWholeBusiness(Integer wholeBusiness) { this.wholeBusiness = wholeBusiness; } public Integer getFoodAndBeverageBusinessLicense() { return foodAndBeverageBusinessLicense; } public void setFoodAndBeverageBusinessLicense(Integer foodAndBeverageBusinessLicense) { this.foodAndBeverageBusinessLicense = foodAndBeverageBusinessLicense; } public Integer getFireSafetyPermission() { return fireSafetyPermission; } public void setFireSafetyPermission(Integer fireSafetyPermission) { this.fireSafetyPermission = fireSafetyPermission; } public Integer getInvoice() { return invoice; } public void setInvoice(Integer invoice) { this.invoice = invoice; } public String getContactName() { return contactName; } public void setContactName(String contactName) { this.contactName = contactName; } public String getContactMobile() { return contactMobile; } public void setContactMobile(String contactMobile) { this.contactMobile = contactMobile; } public Integer getContactType() { return contactType; } public void setContactType(Integer contactType) { this.contactType = contactType; } public Integer getRentBusinessType() { return rentBusinessType; } public void setRentBusinessType(Integer rentBusinessType) { this.rentBusinessType = rentBusinessType; } public Integer getRentStatus() { return rentStatus; } public void setRentStatus(Integer rentStatus) { this.rentStatus = rentStatus; } public Integer getProvinceCode() { return provinceCode; } public void setProvinceCode(Integer provinceCode) { this.provinceCode = provinceCode; } public Integer getCityCode() { return cityCode; } public void setCityCode(Integer cityCode) { this.cityCode = cityCode; } public Integer getAreaCode() { return areaCode; } public void setAreaCode(Integer areaCode) { this.areaCode = areaCode; } public Integer getDistrictCode() { return districtCode; } public void setDistrictCode(Integer districtCode) { this.districtCode = districtCode; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public List<Integer> getSigns() { return signs; } public void setSigns(List<Integer> signs) { this.signs = signs; } public String getMapUrl() { return mapUrl; } public void setMapUrl(String mapUrl) { this.mapUrl = mapUrl; } public String getWholeMapUrl() { return wholeMapUrl; } public void setWholeMapUrl(String wholeMapUrl) { this.wholeMapUrl = wholeMapUrl; } public String getHotMapUrl() { return hotMapUrl; } public void setHotMapUrl(String hotMapUrl) { this.hotMapUrl = hotMapUrl; } public Integer getOperateStatus() { return operateStatus; } public void setOperateStatus(Integer operateStatus) { this.operateStatus = operateStatus; } public String getBusinessName() { return businessName; } public void setBusinessName(String businessName) { this.businessName = businessName; } public List<Integer> getBusinessStatus() { return businessStatus; } public void setBusinessStatus(List<Integer> businessStatus) { this.businessStatus = businessStatus; } public List<String> getPictures() { return pictures; } public void setPictures(List<String> pictures) { this.pictures = pictures; } public Integer getHouseType() { return houseType; } public void setHouseType(Integer houseType) { this.houseType = houseType; } public String getOwner() { return owner; } public void setOwner(String owner) { this.owner = owner; } public Integer getOwnerType() { return ownerType; } public void setOwnerType(Integer ownerType) { this.ownerType = ownerType; } public Integer getPropertyRightType() { return propertyRightType; } public void setPropertyRightType(Integer propertyRightType) { this.propertyRightType = propertyRightType; } public String getFloor() { return floor; } public void setFloor(String floor) { this.floor = floor; } public String getAreas() { return areas; } public void setAreas(String areas) { this.areas = areas; } public String getBuildAreas() { return buildAreas; } public void setBuildAreas(String buildAreas) { this.buildAreas = buildAreas; } public String getUseAreas() { return useAreas; } public void setUseAreas(String useAreas) { this.useAreas = useAreas; } public String getShowLength() { return showLength; } public void setShowLength(String showLength) { this.showLength = showLength; } public String getHeight() { return height; } public void setHeight(String height) { this.height = height; } public String getShade() { return shade; } public void setShade(String shade) { this.shade = shade; } public Integer getDecoration() { return decoration; } public void setDecoration(Integer decoration) { this.decoration = decoration; } public String getShopSignSizeOne() { return shopSignSizeOne; } public void setShopSignSizeOne(String shopSignSizeOne) { this.shopSignSizeOne = shopSignSizeOne; } public String getShopSignSizeTwo() { return shopSignSizeTwo; } public void setShopSignSizeTwo(String shopSignSizeTwo) { this.shopSignSizeTwo = shopSignSizeTwo; } public List<Integer> getFacilities() { return facilities; } public void setFacilities(List<Integer> facilities) { this.facilities = facilities; } public String getCapacitance() { return capacitance; } public void setCapacitance(String capacitance) { this.capacitance = capacitance; } public String getDownPipeDiameter() { return downPipeDiameter; } public void setDownPipeDiameter(String downPipeDiameter) { this.downPipeDiameter = downPipeDiameter; } public String getDuctRate() { return ductRate; } public void setDuctRate(String ductRate) { this.ductRate = ductRate; } public Integer getSelfCarPortSize() { return selfCarPortSize; } public void setSelfCarPortSize(Integer selfCarPortSize) { this.selfCarPortSize = selfCarPortSize; } public Integer getAroundCarPortSize() { return aroundCarPortSize; } public void setAroundCarPortSize(Integer aroundCarPortSize) { this.aroundCarPortSize = aroundCarPortSize; } public Long getChummageDaily() { return chummageDaily; } public void setChummageDaily(Long chummageDaily) { this.chummageDaily = chummageDaily; } public Long getChummageMonth() { return chummageMonth; } public void setChummageMonth(Long chummageMonth) { this.chummageMonth = chummageMonth; } public Long getChummageYear() { return chummageYear; } public void setChummageYear(Long chummageYear) { this.chummageYear = chummageYear; } public Integer getChummageIncrease() { return chummageIncrease; } public void setChummageIncrease(Integer chummageIncrease) { this.chummageIncrease = chummageIncrease; } public String getChummageIncreaseRule() { return chummageIncreaseRule; } public void setChummageIncreaseRule(String chummageIncreaseRule) { this.chummageIncreaseRule = chummageIncreaseRule; } public Long getTransferCost() { return transferCost; } public void setTransferCost(Long transferCost) { this.transferCost = transferCost; } public String getPledgeMonth() { return pledgeMonth; } public void setPledgeMonth(String pledgeMonth) { this.pledgeMonth = pledgeMonth; } public String getPayMonth() { return payMonth; } public void setPayMonth(String payMonth) { this.payMonth = payMonth; } public Long getPropertyFee() { return propertyFee; } public void setPropertyFee(Long propertyFee) { this.propertyFee = propertyFee; } public Long getWaterFee() { return waterFee; } public void setWaterFee(Long waterFee) { this.waterFee = waterFee; } public Long getElasFee() { return elasFee; } public void setElasFee(Long elasFee) { this.elasFee = elasFee; } public Long getGasFee() { return gasFee; } public void setGasFee(Long gasFee) { this.gasFee = gasFee; } public Long getNextPayRentDate() { return nextPayRentDate; } public void setNextPayRentDate(Long nextPayRentDate) { this.nextPayRentDate = nextPayRentDate; } public String getMaxRentYear() { return maxRentYear; } public void setMaxRentYear(String maxRentYear) { this.maxRentYear = maxRentYear; } public Integer getRepetition() { return repetition; } public void setRepetition(Integer repetition) { this.repetition = repetition; } public Integer getMarchatLevel() { return marchatLevel; } public void setMarchatLevel(Integer marchatLevel) { this.marchatLevel = marchatLevel; } public Integer getHouseLevel() { return houseLevel; } public void setHouseLevel(Integer houseLevel) { this.houseLevel = houseLevel; } public Long getPerPersonMin() { return perPersonMin; } public void setPerPersonMin(Long perPersonMin) { this.perPersonMin = perPersonMin; } public Long getPerPersonMax() { return perPersonMax; } public void setPerPersonMax(Long perPersonMax) { this.perPersonMax = perPersonMax; } public List<Integer> getBusinesss() { return businesss; } public void setBusinesss(List<Integer> businesss) { this.businesss = businesss; } public String getGood() { return good; } public void setGood(String good) { this.good = good; } public String getBad() { return bad; } public void setBad(String bad) { this.bad = bad; } public Integer getHouseSource() { return houseSource; } public void setHouseSource(Integer houseSource) { this.houseSource = houseSource; } public String getSourceName() { return sourceName; } public void setSourceName(String sourceName) { this.sourceName = sourceName; } public String getDescribtion() { return describtion; } public void setDescribtion(String describtion) { this.describtion = describtion; } public String getLocation() { return location; } public void setLocation(String location) { this.location = location; } public Integer getRentType() { return rentType; } public void setRentType(Integer rentType) { this.rentType = rentType; } public String getBusiness() { return business; } public void setBusiness(String business) { this.business = business; } public String getContact() { return contact; } public void setContact(String contact) { this.contact = contact; } public String getMaxFloor() { return maxFloor; } public void setMaxFloor(String maxFloor) { this.maxFloor = maxFloor; } public Integer getPower() { return power; } public void setPower(Integer power) { this.power = power; } public Integer getCapacityIncrease() { return capacityIncrease; } public void setCapacityIncrease(Integer capacityIncrease) { this.capacityIncrease = capacityIncrease; } public Integer getUpPipe() { return upPipe; } public void setUpPipe(Integer upPipe) { this.upPipe = upPipe; } public Integer getDownPipe() { return downPipe; } public void setDownPipe(Integer downPipe) { this.downPipe = downPipe; } public Integer getBlowOff() { return blowOff; } public void setBlowOff(Integer blowOff) { this.blowOff = blowOff; } public Integer getGreaseTrap() { return greaseTrap; } public void setGreaseTrap(Integer greaseTrap) { this.greaseTrap = greaseTrap; } public Integer getGas() { return gas; } public void setGas(Integer gas) { this.gas = gas; } public Integer getGasCylinders() { return gasCylinders; } public void setGasCylinders(Integer gasCylinders) { this.gasCylinders = gasCylinders; } public Integer getFire() { return fire; } public void setFire(Integer fire) { this.fire = fire; } public Integer getDuct() { return duct; } public void setDuct(Integer duct) { this.duct = duct; } public Integer getOilFume() { return oilFume; } public void setOilFume(Integer oilFume) { this.oilFume = oilFume; } public Integer getOutWard() { return outWard; } public void setOutWard(Integer outWard) { this.outWard = outWard; } public String getProposed() { return proposed; } public void setProposed(String proposed) { this.proposed = proposed; } }