liujie
2026-05-14 c8dcc1a567c234e8bada64f01bc22256576268bc
xp-robotaxi-operation-boot/src/main/java/com/xiaopeng/operation/controller/XpFeedbackTypeManagementController.java
@@ -1,8 +1,11 @@
package com.xiaopeng.operation.controller;
import com.xiaopeng.api.feignClient.maintenance.XpWorkOrderClient;
import com.xiaopeng.api.model.operation.XpFeedbackType;
import com.xiaopeng.common.core.domain.R;
import com.xiaopeng.common.core.exception.ServiceException;
import com.xiaopeng.operation.constant.I18nKeyConstant;
import com.xiaopeng.operation.service.IXpFeedbackTypeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -10,6 +13,9 @@
import org.springframework.web.bind.annotation.*;
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;
/**
 * <p>
@@ -28,9 +34,14 @@
    private final IXpFeedbackTypeService xpFeedbackTypeService;
    private final XpWorkOrderClient xpWorkOrderClient;
    public XpFeedbackTypeManagementController(IXpFeedbackTypeService xpFeedbackTypeService) {
    public XpFeedbackTypeManagementController(IXpFeedbackTypeService xpFeedbackTypeService, XpWorkOrderClient xpWorkOrderClient) {
        this.xpFeedbackTypeService = xpFeedbackTypeService;
        this.xpWorkOrderClient = xpWorkOrderClient;
    }
    @GetMapping("/getList")
    @ApiOperation(value = "获取意见反馈类型列表")
@@ -40,17 +51,40 @@
    }
    @ApiOperation(value = "新增意见反馈类型")
    @PostMapping(value = "/saveFeedbackType")
    @AdminOperationLog(
            businessType = AdminBusinessType.FEEDBACK_TYPE_MANAGEMENT,
            operationType = AdminOperationType.ADD,
            content = "新增意见反馈类型",
            appendRequestData = true
    )
    public R<Boolean> add(@RequestBody XpFeedbackType xpFeedbackType) {
        return R.ok(xpFeedbackTypeService.save(xpFeedbackType));
    }
    @ApiOperation(value = "编辑意见反馈类型")
    @PostMapping(value = "/updateFeedbackType")
    @AdminOperationLog(
            businessType = AdminBusinessType.FEEDBACK_TYPE_MANAGEMENT,
            operationType = AdminOperationType.EDIT,
            content = "编辑意见反馈类型",
            appendRequestData = true
    )
    public R<Boolean> updateFeedbackType(@RequestBody XpFeedbackType xpFeedbackType) {
        return R.ok(xpFeedbackTypeService.updateById(xpFeedbackType));
    }
    @ApiOperation(value = "删除意见反馈类型")
    @DeleteMapping(value = "/deleteFeedbackType")
    @AdminOperationLog(
            businessType = AdminBusinessType.FEEDBACK_TYPE_MANAGEMENT,
            operationType = AdminOperationType.DELETE,
            contentExpression = "'删除意见反馈类型,id=' + #p0",
            appendRequestData = false
    )
    public R<Boolean> deleteFeedbackType(Long id) {
        // 判断工单是否包含这个类型
        R<Boolean> include = xpWorkOrderClient.include(id);
        if(include==null || include.getData()){
           throw new ServiceException("该类型被工单引用,无法删除",I18nKeyConstant.INCLUDE);
        }
        return R.ok(xpFeedbackTypeService.removeById(id));
    }
}