批量课程AI设置

This commit is contained in:
huangrun
2025-12-08 10:05:37 +08:00
parent 80b444c188
commit 6c3f380bcb
4 changed files with 39 additions and 3 deletions

View File

@@ -24,6 +24,7 @@ import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -70,6 +71,8 @@ public class CourseAuditApi extends ApiBaseController{
@Value("${kjb.aicoreUrl}")
private String aicoreUrl;
@Value("${kjb.videoUrlPrefix}")
private String videoUrlPerfix;
/**
@@ -462,8 +465,10 @@ public class CourseAuditApi extends ApiBaseController{
log.info("aiSet:"+course.getAiSet()+",aiAbstract:"+course.getAiAbstract()+",aiDraft:"+course.getAiDraft()+",aiTranslate:"+course.getAiTranslate()+",languageCode:"+course.getLanguageCode());
List<CourseTeacher> teachers = dto.getTeachers();
StringBuilder teacherNames = new StringBuilder();
for (CourseTeacher teacher : teachers) {
teacherNames.append(teacher.getTeacherName()).append(",");
if(!CollectionUtils.isEmpty(teachers)){
for (CourseTeacher teacher : teachers) {
teacherNames.append(teacher.getTeacherName()).append(",");
}
}
List<CourseContent> cclist = ccontentService.getByCourseId(course.getId());
List<String> languageCode = course.getLanguageCode();
@@ -492,7 +497,7 @@ public class CourseAuditApi extends ApiBaseController{
continue;
}
String videoUrl = json.getString("url");
String videoUrlPerfix = "https://u-pre.boe.com/upload"; //测试
//String videoUrlPerfix = "https://u-pre.boe.com/upload"; //测试
//String videoUrlPerfix = "https://u.boe.com/upload"; //生产
String videoType = videoUrl.substring(videoUrl.lastIndexOf(".")+1);
videoList.add(BoeaiVideoResourceDto.builder()

View File

@@ -14,6 +14,7 @@ import com.xboe.api.ThirdApi;
import com.xboe.module.course.dto.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@@ -102,6 +103,8 @@ public class CourseManageApi extends ApiBaseController{
IDataUserSyncService userSyncService;
@Resource
private ThirdApi thirdApi;
@Resource
CourseAuditApi courseAuditApi;
// @PostMapping("/test")
// public JsonResponse<PageList<Course>> findTest(Pagination pager,CourseQueryDto dto){
@@ -383,6 +386,28 @@ public class CourseManageApi extends ApiBaseController{
return error("保存失败",e.getMessage());
}
}
@PostMapping("/benchAiSet")
@AutoLog(module = "课程",action = "批量课程AI设置",info = "")
public JsonResponse<CourseFullDto> benchAiSet(@RequestBody CourseFullDto dto){
log.info("--------------- 批量课程AI设置 ----------");
if(CollectionUtils.isEmpty(dto.getCourseList())) {
return badRequest("请选择要设置的课程");
}
try {
CourseFullDto item;
for (Course course : dto.getCourseList()) {
item = new CourseFullDto();
item.setCourse(course);
courseAuditApi.sendMessageToKJB(item);
}
return success(dto);
} catch (Exception e) {
log.error("批量课程AI设置错误",e);
return error("保存失败",e.getMessage());
}
}
private String checkForSubmit(Course c) {
String error=null;

View File

@@ -31,6 +31,11 @@ public class CourseFullDto {
* 课程的信息
*/
private Course course;
/**
* 批量课程AI设置课
*/
private List<Course> courseList;
/**
* 课程资源信息

View File

@@ -121,6 +121,7 @@ boe:
kjb:
aicoreUrl: http://10.251.186.27:8088
videoUrlPrefix: https://u-pre.boe.com/upload
ok:
http: