liujie
2026-06-09 c96fbe6b0aeb413a17c429133ee6d81d138144b9
xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpBannerManagementController.java
@@ -7,6 +7,9 @@
import com.xiaopeng.common.core.domain.R;
import com.xiaopeng.common.core.web.controller.BaseController;
import com.xiaopeng.common.core.web.page.PageInfo;
import com.xiaopeng.common.log.annotation.AdminOperationLog;
import com.xiaopeng.common.log.enums.AdminBusinessType;
import com.xiaopeng.common.log.enums.AdminOperationType;
import com.xiaopeng.evi.oss.service.AliOssService;
import com.xiaopeng.operation.query.BannerPageListQuery;
import com.xiaopeng.operation.query.WhitelistPageListQuery;
@@ -19,6 +22,9 @@
import java.io.UnsupportedEncodingException;
import java.util.List;
import com.xiaopeng.common.log.annotation.AdminOperationLog;
import com.xiaopeng.common.log.enums.AdminBusinessType;
import com.xiaopeng.common.log.enums.AdminOperationType;
@Slf4j
@RestController
@@ -44,12 +50,24 @@
    }
    @ApiOperation(value = "新增banner")
    @PostMapping("/saveBanner")
    @AdminOperationLog(
            businessType = AdminBusinessType.BANNER_MANAGEMENT,
            operationType = AdminOperationType.ADD,
            content = "新增banner",
            appendRequestData = true
    )
    public R saveBanner(@RequestBody XpBanner dto) {
        xpBannerService.save(dto);
        return R.ok();
    }
    @ApiOperation(value = "修改banner")
    @PostMapping("/updateBanner")
    @AdminOperationLog(
            businessType = AdminBusinessType.BANNER_MANAGEMENT,
            operationType = AdminOperationType.EDIT,
            content = "修改banner",
            appendRequestData = true
    )
    public R updateBanner(@RequestBody XpBanner dto) {
        xpBannerService.updateById(dto);
        return R.ok();
@@ -62,18 +80,25 @@
        JSONObject jsonObject = JSON.parseArray(xpBanner.getBannerPictures()).getJSONObject(0);
        String downloadUrl = null;
        try {
            // 2
            // 1
            downloadUrl = aliOssService.getDownloadUrl(jsonObject.getString("id"), jsonObject.getString("name"), true);
        } catch (UnsupportedEncodingException e) {
            throw new RuntimeException(e);
        }
        xpBanner.setBannerPictures(downloadUrl);
        jsonObject.put("url", downloadUrl);
        xpBanner.setBannerPictures(jsonObject.toJSONString());
        return R.ok(xpBanner);
    }
    @ApiOperation(value = "删除banner")
    @DeleteMapping("/deleteBanner")
    @AdminOperationLog(
            businessType = AdminBusinessType.BANNER_MANAGEMENT,
            operationType = AdminOperationType.DELETE,
            contentExpression = "'删除banner,id=' + #p0",
            appendRequestData = false
    )
    public R deleteBanner(Long id) {
        xpBannerService.removeById(id);
        return R.ok();