|
|
@@ -53,7 +53,7 @@ public class BarPerformanceServiceImpl implements BarPerformanceService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public int addOrUpdateBarPerformance(BarPerformance barPerformance) {
|
|
|
+ public BarPerformance addOrUpdateBarPerformance(BarPerformance barPerformance) {
|
|
|
// 1. 演出名称验证:必填且限20字
|
|
|
if (StringUtils.isEmpty(barPerformance.getPerformanceName())) {
|
|
|
throw new IllegalArgumentException("演出名称不能为空");
|
|
|
@@ -215,22 +215,23 @@ public class BarPerformanceServiceImpl implements BarPerformanceService {
|
|
|
}
|
|
|
}
|
|
|
// 调用AI内容审核接口,文本和图片分开审核
|
|
|
- // 如果检测到违规内容会抛出异常
|
|
|
+ // 审核失败时保存数据但标记为审核拒绝状态
|
|
|
AiContentModerationUtil.AuditResult auditResult = aiContentModerationUtil.auditContent(moderationText, imageUrls);
|
|
|
if (auditResult == null || !auditResult.isPassed()) {
|
|
|
- // AI审核失败,设置审核状态为2(审核拒绝)并记录拒绝原因
|
|
|
+ // 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);
|
|
|
+ log.warn("酒吧演出内容审核失败:{},将保存数据并标记为审核拒绝状态", failureReason);
|
|
|
+ // 不抛出异常,继续保存数据,但reviewStatus已设置为2(审核拒绝)
|
|
|
+ } else {
|
|
|
+ // AI审核通过,设置审核状态为1(审核通过),清除拒绝原因
|
|
|
+ barPerformance.setReviewStatus(1); // 审核通过
|
|
|
+ barPerformance.setRejectReason(null); // 清除拒绝原因
|
|
|
+ log.info("酒吧演出内容审核通过");
|
|
|
}
|
|
|
- // AI审核通过,设置审核状态为1(审核通过),清除拒绝原因
|
|
|
- barPerformance.setReviewStatus(1); // 审核通过
|
|
|
- barPerformance.setRejectReason(null); // 清除拒绝原因
|
|
|
- log.info("酒吧演出内容审核通过");
|
|
|
|
|
|
Integer id = barPerformance.getId();
|
|
|
|
|
|
@@ -266,7 +267,12 @@ public class BarPerformanceServiceImpl implements BarPerformanceService {
|
|
|
if (barPerformance.getPerformanceWeek() == null) {
|
|
|
barPerformance.setPerformanceWeek("");
|
|
|
}
|
|
|
- return barPerformanceMapper.insert(barPerformance);
|
|
|
+ int result = barPerformanceMapper.insert(barPerformance);
|
|
|
+ if (result > 0) {
|
|
|
+ // 返回保存后的对象,包含自动生成的ID和审核状态
|
|
|
+ return barPerformance;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
} else {
|
|
|
// 更新操作:先查询记录是否存在
|
|
|
BarPerformance existing = barPerformanceMapper.selectById(id);
|
|
|
@@ -299,10 +305,20 @@ public class BarPerformanceServiceImpl implements BarPerformanceService {
|
|
|
if (barPerformance.getPerformanceWeek() == null) {
|
|
|
barPerformance.setPerformanceWeek("");
|
|
|
}
|
|
|
- return barPerformanceMapper.insert(barPerformance);
|
|
|
+ int result = barPerformanceMapper.insert(barPerformance);
|
|
|
+ if (result > 0) {
|
|
|
+ // 返回保存后的对象,包含自动生成的ID和审核状态
|
|
|
+ return barPerformance;
|
|
|
+ }
|
|
|
+ return null;
|
|
|
} else {
|
|
|
// 记录存在,执行更新
|
|
|
- return barPerformanceMapper.updateById(barPerformance);
|
|
|
+ int result = barPerformanceMapper.updateById(barPerformance);
|
|
|
+ if (result > 0) {
|
|
|
+ // 返回更新后的对象(重新查询以获取完整信息)
|
|
|
+ return barPerformanceMapper.selectById(id);
|
|
|
+ }
|
|
|
+ return null;
|
|
|
}
|
|
|
}
|
|
|
}
|