| | |
| | | if (houseResource.getHouseTypeId()!=null)req.setHouseTypeId(houseResource.getHouseTypeId().toString()); |
| | | fillSearchHistory(req); |
| | | HouseResourceInfoRes houseResourceInfoRes = new HouseResourceInfoRes(); |
| | | houseResourceInfoRes.setAge(houseResource.getAge()); |
| | | houseResourceInfoRes.setDataType(houseResource.getDataType()); |
| | | houseResourceInfoRes.setId(id); |
| | | houseResourceInfoRes.setBuildingOrientation(houseResource.getBuildingOrientation()); |
| | |
| | | } |
| | | } |
| | | HouseResource houseResource = new HouseResource(); |
| | | |
| | | houseResource.setPlatform(req.getPlatform()); |
| | | BeanUtils.copyProperties(req,houseResource); |
| | | houseResource.setType(req.getType()); |
| | |
| | | } |
| | | houseResource.setInsertTime(new Date()); |
| | | houseResource.setGoodHouse(0); |
| | | houseResource.setAge(req.getAge()); |
| | | houseResource.setIsDelete(0); |
| | | houseResource.setInsertUserId(appUserId); |
| | | houseResource.setViewsNumber(0); |
| | | houseResource.setUpdateTime(new Date()); |
| | | // todo 修改回审核和上下架状态 |
| | | houseResource.setStatus(1); |
| | | houseResource.setHeadImg(req.getHeadImg()); |
| | | houseResource.setDataType(req.getDataType()); |
| | | houseResource.setAuthStatus(2); |
| | | houseResource.setLeaseTime(req.getTime()); |
| | | houseResource.setAppUserId(appUserId); |
| | | houseResource.setFirmHouse(req.getFirmHouse()); |
| | | if(req.getRentalMoney()!=null){ |
| | | // 如果勾选了同时可租 |
| | | houseResource.setKeepPet(null); |
| | | houseResource.setLeaseTime(null); |
| | | houseResource.setStartTime(""); |
| | | } |
| | | if (StringUtils.hasLength(req.getTime())){ |
| | | if (req.getTime().contains("年")){ |
| | | houseResource.setRentalDuration(2); |
| | |
| | | this.baseMapper.updateById(houseResource); |
| | | } |
| | | } |
| | | HouseResource houseResource2 = new HouseResource(); |
| | | if(req.getRentalMoney()!=null){ |
| | | BeanUtils.copyProperties(houseResource,houseResource2); |
| | | houseResource2.setDataType(1); |
| | | houseResource2.setId(null); |
| | | houseResource2.setLeaseTime(req.getTime()); |
| | | houseResource2.setKeepPet(req.getKeepPet()); |
| | | houseResource2.setStartTime(req.getStartTime()); |
| | | this.baseMapper.insert(houseResource2); |
| | | if (req.getType()==2){ |
| | | getQRCode(houseResource2); |
| | | } |
| | | |
| | | } |
| | | if (req.getType()==2 && req.getId()==null){ |
| | | if(req.getRentalMoney()!=null && houseResource2.getId()!=null){ |
| | | PointLocation pointLocation = new PointLocation(); |
| | | GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(req.getLongitude()),Double.valueOf(req.getLatitude())); |
| | | pointLocation.setGeoJsonPoint(geoJsonPoint); |
| | | pointLocation.setHouseId(houseResource2.getId()); |
| | | mongoTemplate.insert(pointLocation); |
| | | houseResource2.setCode(pointLocation.getId()); |
| | | houseResource2.setAuthStatus(2); |
| | | houseResource2.setAuthTime(new Date()); |
| | | this.baseMapper.updateById(houseResource2); |
| | | } |
| | | |
| | | PointLocation pointLocation = new PointLocation(); |
| | | GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(req.getLongitude()),Double.valueOf(req.getLatitude())); |
| | | pointLocation.setGeoJsonPoint(geoJsonPoint); |
| | |
| | | houseResource.setAuthStatus(2); |
| | | houseResource.setAuthTime(new Date()); |
| | | this.baseMapper.updateById(houseResource); |
| | | getQRCode(houseResource); |
| | | } |
| | | if (req.getType()==2 && req.getId()!=null){ |
| | | if(req.getRentalMoney()!=null && houseResource2.getId()!=null){ |
| | | PointLocation pointLocation = new PointLocation(); |
| | | GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(req.getLongitude()),Double.valueOf(req.getLatitude())); |
| | | pointLocation.setGeoJsonPoint(geoJsonPoint); |
| | | pointLocation.setHouseId(houseResource2.getId()); |
| | | mongoTemplate.insert(pointLocation); |
| | | houseResource2.setCode(pointLocation.getId()); |
| | | houseResource2.setAuthStatus(2); |
| | | houseResource2.setAuthTime(new Date()); |
| | | this.baseMapper.updateById(houseResource2); |
| | | } |
| | | HouseResource houseResource1 = this.baseMapper.selectById(req.getId()); |
| | | if (!StringUtils.hasLength(houseResource1.getCode())){ |
| | | PointLocation pointLocation = new PointLocation(); |
| | | GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(req.getLongitude()),Double.valueOf(req.getLatitude())); |
| | | pointLocation.setGeoJsonPoint(geoJsonPoint); |
| | | pointLocation.setHouseId(req.getId()); |
| | | mongoTemplate.insert(pointLocation); |
| | | houseResource1.setCode(pointLocation.getId()); |
| | | houseResource1.setAuthStatus(2); |
| | | this.baseMapper.updateById(houseResource1); |
| | | } |
| | | Query query = Query.query(Criteria.where("_id").is(houseResource1.getCode())); |
| | | PointLocation pointLocation = new PointLocation(); |
| | | pointLocation.setId(houseResource1.getCode()); |
| | | pointLocation.setHouseId(houseResource.getId()); |
| | | GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(req.getLongitude()),Double.valueOf(req.getLatitude())); |
| | | pointLocation.setGeoJsonPoint(geoJsonPoint); |
| | | org.bson.Document document = (org.bson.Document)mongoTemplate.getConverter() .convertToMongoType(pointLocation); |
| | | Update update = Update.fromDocument (document); |
| | | UpdateResult updateResult = mongoTemplate.updateFirst(query, update, PointLocation.class); |
| | | System.err.println(updateResult.getModifiedCount()); |
| | | } |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | public void getQRCode(HouseResource houseResource) { |
| | | InputStream inputStream = null; |
| | | OutputStream outputStream = null; |
| | | String accessToken = wxAppletTools.getAccessToken(); |
| | |
| | | String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken; |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("scene","id="+houseResource.getId()); |
| | | //pageA/houseDetail |
| | | param.put("page", "pageA/houseDetail"); |
| | | param.put("check_path", false); |
| | | param.put("env_version", "trial"); |
| | |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | if (req.getType()==2 && req.getId()!=null){ |
| | | HouseResource houseResource1 = this.baseMapper.selectById(req.getId()); |
| | | if (!StringUtils.hasLength(houseResource1.getCode())){ |
| | | PointLocation pointLocation = new PointLocation(); |
| | | GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(req.getLongitude()),Double.valueOf(req.getLatitude())); |
| | | pointLocation.setGeoJsonPoint(geoJsonPoint); |
| | | pointLocation.setHouseId(req.getId()); |
| | | mongoTemplate.insert(pointLocation); |
| | | houseResource1.setCode(pointLocation.getId()); |
| | | houseResource1.setAuthStatus(2); |
| | | this.baseMapper.updateById(houseResource1); |
| | | } |
| | | Query query = Query.query(Criteria.where("_id").is(houseResource1.getCode())); |
| | | PointLocation pointLocation = new PointLocation(); |
| | | pointLocation.setId(houseResource1.getCode()); |
| | | pointLocation.setHouseId(houseResource.getId()); |
| | | GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(req.getLongitude()),Double.valueOf(req.getLatitude())); |
| | | pointLocation.setGeoJsonPoint(geoJsonPoint); |
| | | org.bson.Document document = (org.bson.Document)mongoTemplate.getConverter() .convertToMongoType(pointLocation); |
| | | Update update = Update.fromDocument (document); |
| | | UpdateResult updateResult = mongoTemplate.updateFirst(query, update, PointLocation.class); |
| | | System.err.println(updateResult.getModifiedCount()); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | |
| | | @Override |