Compare commits

...

9 Commits

Author SHA1 Message Date
huangrun
9219b77895 课程详情接口优化 2025-12-09 10:19:32 +08:00
huangrun
e727f266ec 课程详情接口优化 2025-12-09 10:06:23 +08:00
huangrun
49e42edf6f 课程AI设置优化 2025-12-08 19:38:26 +08:00
huangrun
f4d9847e8b 课程AI设置优化 2025-12-08 18:48:14 +08:00
huangrun
a0e1fea805 课程AI设置优化 2025-12-08 17:55:29 +08:00
huangrun
d0c5d2d561 课程详情 2025-12-08 15:45:45 +08:00
huangrun
951f2b0105 课程详情 2025-12-08 14:56:41 +08:00
huangrun
aa14fffd6c 课程详情 2025-12-08 14:55:07 +08:00
huangrun
1d7e478aac 课程详情 2025-12-08 14:47:41 +08:00
6 changed files with 68 additions and 34 deletions

View File

@@ -450,8 +450,8 @@ public class CourseAuditApi extends ApiBaseController{
log.info("---------------在线课同步到讲师管理完毕 -------");
//AI视频处理-调用接口
//需求调整-课程AI设置放在课程提交审核之前
// this.sendMessageToKJB(dto);
// log.info("---------------AI视频处理-调用接口完毕 -------");
this.sendMessageToKJB(dto);
log.info("---------------**审核**AI视频处理-调用接口完毕 -------");
return success(true);
} catch (Exception e) {
log.error("默认管理员提交直接发布处理失败",e);
@@ -462,7 +462,7 @@ public class CourseAuditApi extends ApiBaseController{
}
public void sendMessageToKJB(CourseFullDto dto) throws JsonProcessingException {
Course course = dto.getCourse();
log.info("---------------AI视频处理-调用接口 -------");
//log.info("---------------AI视频处理-调用接口 -------");
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();
@@ -490,25 +490,27 @@ public class CourseAuditApi extends ApiBaseController{
.aiSet(course.getAiSet())
.languageStatus(course.getLanguageStatus())
.build() ;
for (CourseContent cc : cclist) {
//筛选视频资源
if(cc.getContentType() == 10 ){
JSONObject json = JSONObject.parseObject(cc.getContent());
if(json == null || json.getString("url") == null) {
continue;
if(cclist != null && !cclist.isEmpty()){
for (CourseContent cc : cclist) {
//筛选视频资源
if(cc.getContentType() == 10 ){
JSONObject json = JSONObject.parseObject(cc.getContent());
if(json == null || json.getString("url") == null) {
continue;
}
String videoUrl = json.getString("url");
//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()
.courseId(cc.getCourseId())
.videoId(cc.getId())
.title(cc.getContentName())
.originalUrl(videoUrlPerfix+videoUrl)
.duration(cc.getDuration())
.format(videoType)
.build());
}
String videoUrl = json.getString("url");
//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()
.courseId(cc.getCourseId())
.videoId(cc.getId())
.title(cc.getContentName())
.originalUrl(videoUrlPerfix+videoUrl)
.duration(cc.getDuration())
.format(videoType)
.build());
}
}
boeaiCourseDto.setBoeaiVideoResourceReqList(videoList);

View File

@@ -332,7 +332,7 @@ public class CourseFullTextApi extends ApiBaseController{
cids.add(c.getId());
}
log.info("---- KJB 开始获取课程摘要信息 ---");
this.getCourseFromKJB(c);
this.getCourseFromKJB(c,new Course());
}
List<Course> clist=null;
if(!cids.isEmpty()) {
@@ -424,9 +424,9 @@ public class CourseFullTextApi extends ApiBaseController{
}
public void getCourseFromKJB(CourseFullText courseFull){
public void getCourseFromKJB(CourseFullText courseFull,Course course){
String courseId = courseFull.getId();
log.info("------------KJB---获取课程摘要信息---------courseId = " + courseId);
log.info("------------KJB---获取课程详情 start ---------courseId = " + courseId);
//String url = env.getProperty("kjb.url") + "/api/course/getCourseFromKJB?courseId=" + courseId;
String url = aicoreUrl + "/aiVideo/getCourseList";
@@ -445,10 +445,20 @@ public class CourseFullTextApi extends ApiBaseController{
List<BoeaiCourseDto> boeaiCourseDto = JSON.parseArray(data, BoeaiCourseDto.class);
//List<BoeaiCourseDto> aiVideoResourceRsp = Collections.singletonList(JSON.parseObject(data, BoeaiCourseDto.class));
if(boeaiCourseDto != null && !boeaiCourseDto.isEmpty()){
log.info("KJB摘要信息"+boeaiCourseDto.get(0).getSummaryContent());
//log.info("KJB摘要信息"+boeaiCourseDto.get(0).getSummaryContent());
courseFull.setAiAbstract(boeaiCourseDto.get(0).getAiAbstract());
courseFull.setSummaryContent(boeaiCourseDto.get(0).getSummaryContent());
course.setAiSet(boeaiCourseDto.get(0).getAiSet());
course.setAiAbstract(boeaiCourseDto.get(0).getAiAbstract());
//course.setSummaryStatus(boeaiCourseDto.get(0).getSummaryStatus());
course.setSummaryContent(boeaiCourseDto.get(0).getSummaryContent());
course.setAiDraft(boeaiCourseDto.get(0).getAiDraft());
course.setAiTranslate(boeaiCourseDto.get(0).getAiTranslate());
course.setLanguageStatus(boeaiCourseDto.get(0).getLanguageStatus());
course.setLanguageCode(boeaiCourseDto.get(0).getLanguageCode() == null ? new ArrayList<>() :Arrays.asList(boeaiCourseDto.get(0).getLanguageCode().split(",")));
}
log.info("------------KJB---获取课程详情 end ---------");
}
private void getTeacherStatusByCode(String token, PageList<CourseFullText> coursePageList) {

View File

@@ -106,6 +106,9 @@ public class CourseManageApi extends ApiBaseController{
@Resource
CourseAuditApi courseAuditApi;
@Resource
CourseFullTextApi courseFullTextApi;
// @PostMapping("/test")
// public JsonResponse<PageList<Course>> findTest(Pagination pager,CourseQueryDto dto){
// //dto.setOrgAid("7003708665807110150");
@@ -186,6 +189,13 @@ public class CourseManageApi extends ApiBaseController{
isPermission = dicts.contains(course.getOrgId());
rs.put("dicts",dicts);
}
//void getCourseFromKJB(CourseFullText courseFull,Course course){
log.info("-------课程详情(KJB)查询开始-------");
CourseFullText courseFull = new CourseFullText();
courseFull.setId(course.getId());
courseFullTextApi.getCourseFromKJB(courseFull,course);
log.info("-------课程详情(KJB)查询结束-------");
log.error("-------是否仅内网查看 = " + isPermission);
rs.put("course",course);
rs.put("contents",cclist);
@@ -345,7 +355,7 @@ public class CourseManageApi extends ApiBaseController{
log.info("---------------在线课同步到讲师管理完毕 -------");
//AI视频处理-调用接口
log.info("---------------AI视频处理-调用接口开始 -------");
new CourseAuditApi().sendMessageToKJB(dto);
courseAuditApi.sendMessageToKJB(dto);
log.info("---------------AI视频处理-调用接口结束 -------");
return success(dto);

View File

@@ -462,7 +462,7 @@ public class CourseServiceImpl implements ICourseService {
rs.setCount(listByFilters2.size());
rs.setPageSize(pageSize);
rs.setList(paginate);
if (!paginate.isEmpty()) {
if (paginate != null && !paginate.isEmpty()) {
log.info("-----KJB------ getCourse");
for (Course course : paginate) {
this.getCourseFromKJB(course);

View File

@@ -18,9 +18,8 @@ import java.nio.charset.StandardCharsets;
@Slf4j
public class HttpUtils {
public static String sendMessage(String message,String url) {
log.info("----------------发送消息开始 -------");
//log.info("----------------发送消息url -------{}",url);
log.info("----------------发送消息参数 -------{}",message);
//log.info("----------------发送消息开始 -------");
log.info("----------------发送消息参数 -------{}url:{}",message,url);
// POST 请求
try (CloseableHttpClient httpClient = HttpClients.createDefault()) {
// POST 请求
@@ -43,7 +42,7 @@ public class HttpUtils {
// System.out.println("响应体: " + EntityUtils.toString(response.getEntity()));
} catch (Exception e) {
log.error("KJB-发送消息错误",e);
log.error("KJB-接口调用失败",e);
throw new RuntimeException(e);
}
}

View File

@@ -17,8 +17,10 @@ import com.boe.feign.api.infrastructure.entity.CommonSearchVo;
import com.boe.feign.api.infrastructure.entity.Dict;
import com.xboe.api.ThirdApi;
import com.xboe.constants.CacheName;
import com.xboe.module.course.api.CourseFullTextApi;
import com.xboe.module.course.dto.AiVideoResourceRsp;
import com.xboe.module.course.dto.BoeaiSubtitleRsp;
import com.xboe.module.course.dto.CourseFullText;
import com.xboe.module.course.utils.HttpUtils;
import com.xboe.module.course.vo.TeacherVo;
import com.xboe.module.usergroup.service.IUserGroupService;
@@ -110,6 +112,9 @@ public class StudyCourseApi extends ApiBaseController{
@Autowired
StringRedisTemplate redisTemplate;
@Autowired
CourseFullTextApi courseFullTextApi;
@Value("${kjb.aicoreUrl}")
private String aicoreUrl;
@@ -179,6 +184,12 @@ public class StudyCourseApi extends ApiBaseController{
if(course==null || course.getDeleted()){
return badRequest("课程不存在或已被删除");
}
//获取课程AI详情
log.info("---- KJB 获取课程详情 ---");
CourseFullText courseFullText = new CourseFullText();
courseFullText.setId(cid);
courseFullTextApi.getCourseFromKJB(courseFullText,course);
rs.put("course",course);
List<CourseCrowd> courseCrowdList = courseService.findCrowdByCourseId(cid);
@@ -217,9 +228,11 @@ public class StudyCourseApi extends ApiBaseController{
List<CourseSection> sectionlist=sectionService.getByCourseId(cid);
List<CourseTeacher> teachers=courseService.findTeachersByCourseId(cid);
for (CourseContent cc : cclist) {
log.info("根据视频信息查询AI字幕数据cc = " + cc.toString());
this.getVtt( cid , cc);
if(cclist!=null && !cclist.isEmpty()){
for (CourseContent cc : cclist) {
log.info("根据视频信息查询AI字幕数据cc = " + cc.toString());
this.getVtt( cid , cc);
}
}
//获取教师的介绍信息,因为一门课程 的教师不会太多,所以这里简单直接遍历查询,后续再优化