| | |
| | | if (pointAddDto.getElectronicAreaId() == null) { |
| | | throw new ServiceException("运营区域ID不能为空", I18nKeyConstant.POINT_ELECTRONIC_AREA_ID_EMPTY); |
| | | } |
| | | validatePointNameUnique(pointAddDto.getPointName(), null); |
| | | |
| | | String cityPrefix = buildCityPrefix(pointAddDto.getElectronicAreaId()); |
| | | String lockKey = buildPointNumberLockKey(cityPrefix, POINT_BIZ_TYPE); |
| | |
| | | xpPoint.setPointNumber(pointNumber); |
| | | this.save(xpPoint); |
| | | return xpPoint; |
| | | } |
| | | |
| | | @Override |
| | | public void validatePointNameUnique(String pointName, Long excludeId) { |
| | | if (!StringUtils.hasText(pointName)) { |
| | | return; |
| | | } |
| | | long count = this.lambdaQuery() |
| | | .eq(XpPoint::getPointName, pointName) |
| | | .ne(excludeId != null, XpPoint::getId, excludeId) |
| | | .count(); |
| | | if (count > 0) { |
| | | throw new ServiceException("点位名称已存在", I18nKeyConstant.POINT_NAME_EXISTS); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | List<XpPoint> list = this.baseMapper.listAll(query); |
| | | for (XpPoint xpPoint : list) { |
| | | String pointPictures = xpPoint.getPointPictures(); |
| | | if (org.apache.commons.lang3.StringUtils.isNotBlank(pointPictures)) { |
| | | log.info("pointPictures:{}", pointPictures); |
| | | if (StringUtils.isNotBlank(pointPictures)) { |
| | | log.info("pointPictures进入处理:{}", pointPictures); |
| | | |
| | | JSONArray jsonArray = JSONArray.parseArray(pointPictures); |
| | | for (int i = 0; i < jsonArray.size(); i++) { |
| | | JSONObject jsonObject = jsonArray.getJSONObject(i); |
| | | if (Objects.isNull(jsonObject)) { |
| | | continue; |
| | | } |
| | | String downloadUrl = jsonObject.getString("url");; |
| | | String downloadUrl =""; |
| | | try { |
| | | downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true); |
| | | log.info("downloadUrl:{}", downloadUrl); |
| | | } catch (UnsupportedEncodingException e) { |
| | | log.error("获取图片下载地址失败", e); |
| | | } |
| | | jsonObject.put("url", downloadUrl); |
| | | } |
| | | log.info("jsonArray:{}", jsonArray); |
| | | xpPoint.setPointPictures(JSONArray.toJSONString(jsonArray)); |
| | | log.info("xpPoint:{}", xpPoint.getPointPictures()); |
| | | } |
| | | |
| | | } |