| | |
| | | } |
| | | @Override |
| | | public ResultUtil addHouse(AddHouseReq req) { |
| | | Integer appUserId = appUserService.getAppUser().getId(); |
| | | // Integer appUserId = appUserService.getAppUser().getId(); |
| | | AppUser appUser = appUserService.selectOne(new EntityWrapper<AppUser>() |
| | | .eq("id", appUserId) |
| | | .eq("id", 40) |
| | | .eq("status", 1)); |
| | | if (appUser!=null){ |
| | | if (req.getId()==null){ |
| | |
| | | if (appUser.getAuth()!=2){ |
| | | // 未认证 只能能发布三条房源信息 |
| | | List<HouseResource> houseResources = this.selectList(new EntityWrapper<HouseResource>() |
| | | .eq("app_user_id", appUserId) |
| | | .eq("app_user_id", 40) |
| | | .eq("is_delete", 0) |
| | | .eq("type", 2) |
| | | ); |
| | |
| | | houseResource.setInsertTime(new Date()); |
| | | houseResource.setGoodHouse(0); |
| | | houseResource.setIsDelete(0); |
| | | houseResource.setInsertUserId(appUserId); |
| | | houseResource.setInsertUserId(40); |
| | | houseResource.setViewsNumber(0); |
| | | houseResource.setUpdateTime(new Date()); |
| | | // todo 修改回审核和上下架状态 |
| | |
| | | houseResource.setDataType(req.getDataType()); |
| | | houseResource.setAuthStatus(1); |
| | | houseResource.setLeaseTime(req.getTime()); |
| | | houseResource.setAppUserId(appUserService.getAppUser().getId()); |
| | | houseResource.setAppUserId(40); |
| | | houseResource.setFirmHouse(req.getFirmHouse()); |
| | | if (StringUtils.hasLength(req.getTime())){ |
| | | if (req.getTime().contains("年")){ |
| | |
| | | } |
| | | } |
| | | if (req.getType()==2){ |
| | | if (req.getId()==null){ |
| | | this.baseMapper.insert(houseResource); |
| | | }else{ |
| | | this.baseMapper.updateById(houseResource); |
| | | } |
| | | }else{ |
| | | if (req.getId()==null){ |
| | | this.baseMapper.insert(houseResource); |
| | | }else{ |
| | | this.baseMapper.updateById(houseResource); |
| | | } |
| | | } |
| | | if (req.getType()==2 && req.getId()==null){ |
| | | PointLocation pointLocation = new PointLocation(); |
| | | GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(req.getLongitude()),Double.valueOf(req.getLatitude())); |
| | | pointLocation.setGeoJsonPoint(geoJsonPoint); |
| | | pointLocation.setHouseId(houseResource.getId()); |
| | | mongoTemplate.insert(pointLocation); |
| | | houseResource.setCode(pointLocation.getId()); |
| | | this.baseMapper.updateById(houseResource); |
| | | InputStream inputStream = null; |
| | | OutputStream outputStream = null; |
| | | String accessToken = wxAppletTools.getAccessToken(); |
| | | try { |
| | | String url = "https://api.weixin.qq.com/cgi-bin/wxaapp/createwxaqrcode?access_token=" + accessToken; |
| | | String url = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" + accessToken; |
| | | Map<String, Object> param = new HashMap<>(); |
| | | param.put("path", "pages/home/home"); |
| | | // param.put("page", "pages/index/index"); // 路径 如果没有默认跳转到首页面微信小程序发布后才可以使用不能添加参数 |
| | | param.put("scene","id="+houseResource.getId()); |
| | | //pageA/houseDetail |
| | | param.put("page", "pageA/houseDetail"); |
| | | param.put("check_path", false); |
| | | param.put("env_version", "trial"); |
| | | param.put("width", 200); //二维码尺寸 |
| | | param.put("is_hyaline", true); // 是否需要透明底色, is_hyaline 为true时,生成透明底色的小程序码 参数仅对小程序码生效 |
| | | param.put("auto_color", true); // 自动配置线条颜色,如果颜色依然是黑色,则说明不建议配置主色调 参数仅对小程序码生效 |
| | |
| | | // oss中的文件夹名 |
| | | String objectName = sdf.format(new Date()) + "/" + finalFileName; |
| | | // 上传oss |
| | | ossService.uploadFile2OSS(inputStream, objectName); |
| | | String s = ossService.uploadFile2OSS(inputStream, objectName); |
| | | //获取文件的URl地址 |
| | | String imgUrl = ossService.getImgUrl(objectName); |
| | | houseResource.setQrCode(imgUrl); |
| | | this.baseMapper.updateById(houseResource); |
| | | System.err.println("看看文件路径" + imgUrl); |
| | | } catch (Exception e) { |
| | | System.err.println("调用小程序生成微信永久小程序码URL接口异常" + e); |
| | |
| | | return null; |
| | | } |
| | | } |
| | | if (req.getId()==null){ |
| | | this.baseMapper.insert(houseResource); |
| | | }else{ |
| | | this.baseMapper.updateById(houseResource); |
| | | } |
| | | }else{ |
| | | if (req.getId()==null){ |
| | | this.baseMapper.insert(houseResource); |
| | | }else{ |
| | | this.baseMapper.updateById(houseResource); |
| | | } |
| | | } |
| | | if (req.getType()==2 && req.getId()==null){ |
| | | PointLocation pointLocation = new PointLocation(); |
| | | GeoJsonPoint geoJsonPoint = new GeoJsonPoint(Double.valueOf(req.getLongitude()),Double.valueOf(req.getLatitude())); |
| | | pointLocation.setGeoJsonPoint(geoJsonPoint); |
| | | pointLocation.setHouseId(houseResource.getId()); |
| | | mongoTemplate.insert(pointLocation); |
| | | houseResource.setCode(pointLocation.getId()); |
| | | this.baseMapper.updateById(houseResource); |
| | | } |
| | | if (req.getType()==2 && req.getId()!=null){ |
| | | HouseResource houseResource1 = this.baseMapper.selectById(req.getId()); |