Przeglądaj źródła

BUGfix:酒吧演出上线下线接口报错(传的格式与前端不对应)及上传海报提交判断报错问题

panzhilin 3 miesięcy temu
rodzic
commit
9b506e0cbc

+ 6 - 6
alien-entity/src/main/java/shop/alien/entity/store/vo/SportsEquipmentFacilityVo.java

@@ -58,22 +58,22 @@ public class SportsEquipmentFacilityVo implements Serializable {
     @ApiModelProperty(value = "图片列表")
     private List<String> imageList;
 
-    @ApiModelProperty(value = "区域ID(关联sports_facility_area.id)")
+    @ApiModelProperty(value = "区域ID")
     private Integer areaId;
 
-    @ApiModelProperty(value = "设备ID列表(fitness_equipment_info表的id,用逗号分隔)")
+    @ApiModelProperty(value = "设备ID列表")
     private String fitnessEquipmentIds;
 
-    @ApiModelProperty(value = "设备名称(用于创建fitness_equipment_info记录)")
+    @ApiModelProperty(value = "设备名称")
     private String equipmentName;
 
-    @ApiModelProperty(value = "设备数量(用于创建fitness_equipment_info记录)")
+    @ApiModelProperty(value = "设备数量")
     private Integer equipmentNums;
 
-    @ApiModelProperty(value = "设备图片URL(用于创建fitness_equipment_info记录)")
+    @ApiModelProperty(value = "设备图片URL")
     private String equipmentImage;
 
-    @ApiModelProperty(value = "设备ID(fitness_equipment_info表的主键ID,用于修改时根据设备ID查询设施记录)")
+    @ApiModelProperty(value = "设备ID")
     private Integer equipmentId;
 }
 

+ 11 - 15
alien-store/src/main/java/shop/alien/store/controller/BarPerformanceController.java

@@ -8,10 +8,8 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.web.bind.annotation.*;
 import shop.alien.entity.result.R;
 import shop.alien.entity.store.BarPerformance;
+import shop.alien.entity.store.dto.BarPerformanceOnlineStatusDto;
 import shop.alien.store.service.BarPerformanceService;
-import shop.alien.util.myBaticsPlus.QueryBuilder;
-
-import java.util.List;
 
 /**
  * 酒吧演出Controller
@@ -133,29 +131,27 @@ public class BarPerformanceController {
     /**
      * 设置演出上线下线状态
      *
-     * @param id          演出ID
-     * @param onlineStatus 上线状态(0-下线,1-上线)
+     * @param dto 包含演出ID和上线状态的DTO对象
      * @return 操作结果
      */
     @ApiOperation("设置演出上线状态")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "id", value = "演出ID", dataType = "Integer", paramType = "query", required = true),
-            @ApiImplicitParam(name = "onlineStatus", value = "上线状态(0-下线,1-上线)", dataType = "Integer", paramType = "query", required = true)
-    })
     @PostMapping("/setOnlineStatus")
-    public R<Integer> setOnlineStatus(
-            @RequestParam Integer id,
-            @RequestParam Integer onlineStatus) {
-        log.info("BarPerformanceController.setOnlineStatus?id={}, onlineStatus={}", id, onlineStatus);
+    public R<Integer> setOnlineStatus(@RequestBody BarPerformanceOnlineStatusDto dto) {
+        log.info("BarPerformanceController.setOnlineStatus?dto={}", dto);
         try {
-            Integer result = barPerformanceService.setOnlineStatus(id, onlineStatus);
+            // 参数验证
+            if (dto == null || dto.getId() == null || dto.getOnlineStatus() == null) {
+                log.warn("设置演出上线状态参数不完整:dto={}", dto);
+                return R.fail("参数不完整,演出ID和上线状态不能为空");
+            }
+            Integer result = barPerformanceService.setOnlineStatus(dto.getId(), dto.getOnlineStatus());
             if (result > 0) {
                 return R.success("设置成功");
             } else {
                 return R.fail("设置失败");
             }
         } catch (Exception e) {
-            log.error("设置演出上线状态失败", e);
+            log.error("设置演出上线状态失败,dto={}", dto, e);
             return R.fail("设置演出上线状态失败:" + e.getMessage());
         }
     }

+ 15 - 8
alien-store/src/main/java/shop/alien/store/service/impl/BarPerformanceServiceImpl.java

@@ -59,11 +59,6 @@ public class BarPerformanceServiceImpl implements BarPerformanceService {
         if (StringUtils.isEmpty(barPerformance.getPerformancePoster())) {
             throw new IllegalArgumentException("演出海报不能为空");
         }
-        // 检查海报是否有多张(逗号分隔)
-        String[] posterImages = barPerformance.getPerformancePoster().split(",");
-        if (posterImages.length > 1) {
-            throw new IllegalArgumentException("演出海报最多只能上传1张");
-        }
 
         // 3. 演出类型和频次的关联验证:特邀演出(0)只能选单次(0)
         if (barPerformance.getPerformanceType() != null && barPerformance.getPerformanceType() == 0) {
@@ -214,12 +209,18 @@ public class BarPerformanceServiceImpl implements BarPerformanceService {
         // 调用AI内容审核接口,如果检测到违规内容会抛出异常
         AiContentModerationUtil.AuditResult auditResult = aiContentModerationUtil.auditContent(moderationText, imageUrls);
         if (auditResult == null || !auditResult.isPassed()) {
+            // AI审核失败,设置审核状态为2(审核拒绝)并记录拒绝原因
             String failureReason = (auditResult != null && StringUtils.isNotEmpty(auditResult.getFailureReason()))
                     ? auditResult.getFailureReason()
                     : "内容包含违规信息";
+            barPerformance.setReviewStatus(2); // 审核拒绝
+            barPerformance.setRejectReason(failureReason);
             log.warn("酒吧演出内容审核失败:{}", failureReason);
             throw new IllegalArgumentException("内容审核未通过:" + failureReason);
         }
+        // AI审核通过,设置审核状态为1(审核通过),清除拒绝原因
+        barPerformance.setReviewStatus(1); // 审核通过
+        barPerformance.setRejectReason(null); // 清除拒绝原因
         log.info("酒吧演出内容审核通过");
 
         Integer id = barPerformance.getId();
@@ -232,15 +233,17 @@ public class BarPerformanceServiceImpl implements BarPerformanceService {
             if (barPerformance.getDeleteFlag() == null) {
                 barPerformance.setDeleteFlag(0);
             }
-            // 设置默认状态为待审核(0)
+            // 设置默认状态为禁用(0)
             if (barPerformance.getStatus() == null) {
                 barPerformance.setStatus(0);
             }
-            // 设置默认审核状态为待审核(0),对应数据库字段 review_status
+            // 审核状态已在AI审核结果后设置(1-审核通过 或 2-审核拒绝)
+            // 如果AI审核通过,reviewStatus已设置为1;如果AI审核失败,reviewStatus已设置为2
+            // 如果为null(理论上不应该出现,因为已经执行了AI审核),设置为0(待审核)
             if (barPerformance.getReviewStatus() == null) {
                 barPerformance.setReviewStatus(0);
             }
-            // 设置默认上线状态为下线(0)
+            // 设置默认上线状态为下线(0),AI审核通过后仍然保持下线状态
             if (barPerformance.getOnlineStatus() == null) {
                 barPerformance.setOnlineStatus(0);
             }
@@ -270,9 +273,13 @@ public class BarPerformanceServiceImpl implements BarPerformanceService {
                 if (barPerformance.getStatus() == null) {
                     barPerformance.setStatus(0);
                 }
+                // 审核状态已在AI审核结果后设置(1-审核通过 或 2-审核拒绝)
+                // 如果AI审核通过,reviewStatus已设置为1;如果AI审核失败,reviewStatus已设置为2
+                // 如果为null(理论上不应该出现,因为已经执行了AI审核),设置为0(待审核)
                 if (barPerformance.getReviewStatus() == null) {
                     barPerformance.setReviewStatus(0);
                 }
+                // 设置默认上线状态为下线(0),AI审核通过后仍然保持下线状态
                 if (barPerformance.getOnlineStatus() == null) {
                     barPerformance.setOnlineStatus(0);
                 }