liujie
2026-03-19 43cfe64aa9337eb7f382edd9d2a603cf68267f5d
xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/service/impl/XpBannerServiceImpl.java
@@ -2,6 +2,7 @@
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -50,16 +51,20 @@
                vo.setId(item.getId());
                vo.setJumpType(item.getJumpType());
                vo.setJumpUrl(item.getJumpUrl());
                JSONObject jsonObject = JSON.parseArray(item.getBannerPictures()).getJSONObject(0);
                String downloadUrl = null;
                try {
                    // 1
                    downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
                } catch (UnsupportedEncodingException e) {
                    throw new RuntimeException(e);
                JSONArray jsonArray = JSONArray.parseArray(item.getBannerPictures());
                for (Object o : jsonArray) {
                    JSONObject jsonObject = (JSONObject) o;
                    String downloadUrl = null;
                    try {
                        // 1
                        downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
                    } catch (UnsupportedEncodingException e) {
                        throw new RuntimeException(e);
                    }
                    jsonObject.put("url", downloadUrl);
                }
                jsonObject.put("url", downloadUrl);
                vo.setImageUrl(jsonObject.toJSONString());
                vo.setImageUrl(JSONArray.toJSONString(jsonArray));
                return vo;
            }).collect(Collectors.toList());
        }
@@ -71,16 +76,21 @@
        PageInfo<XpBanner> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
        List<XpBanner> list = this.baseMapper.pageList(pageInfo, query);
        for (XpBanner xpBanner : list) {
            JSONObject jsonObject = JSON.parseArray(xpBanner.getBannerPictures()).getJSONObject(0);
            String downloadUrl = null;
            try {
                // 1
                downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
            } catch (UnsupportedEncodingException e) {
                throw new RuntimeException(e);
            JSONArray jsonArray = JSONArray.parse(xpBanner.getBannerPictures());
            for (Object o : jsonArray) {
                JSONObject jsonObject = (JSONObject) o;
                String downloadUrl = null;
                try {
                    // 1
                    downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
                } catch (UnsupportedEncodingException e) {
                    throw new RuntimeException(e);
                }
                jsonObject.put("url", downloadUrl);
            }
            jsonObject.put("url", downloadUrl);
            xpBanner.setBannerPictures(jsonObject.toJSONString());
            xpBanner.setBannerPictures(JSONArray.toJSONString(jsonArray));
        }
        pageInfo.setRecords(list);
        return pageInfo;