mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-25 10:42:59 +08:00
merge: AI课程特性融合至新的在线管理
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
package com.xboe.module.course.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.xboe.common.OrderCondition;
|
||||
import com.xboe.common.PageList;
|
||||
import com.xboe.common.exception.AppException;
|
||||
@@ -15,12 +17,14 @@ import com.xboe.enums.CourseCreateFromEnum;
|
||||
import com.xboe.enums.CourseStatusEnum;
|
||||
import com.xboe.module.course.dao.CourseDao;
|
||||
import com.xboe.module.course.dao.CourseTeacherDao;
|
||||
import com.xboe.module.course.dto.BoeaiCourseDto;
|
||||
import com.xboe.module.course.dto.CoursePageQueryDTO;
|
||||
import com.xboe.module.course.dto.ServiceResponse;
|
||||
import com.xboe.module.course.entity.Course;
|
||||
import com.xboe.module.course.entity.CourseTeacher;
|
||||
import com.xboe.module.course.service.ICourseFullTextSearch;
|
||||
import com.xboe.module.course.service.ICoursePageService;
|
||||
import com.xboe.module.course.utils.HttpUtils;
|
||||
import com.xboe.module.course.vo.CoursePageVo;
|
||||
import com.xboe.module.excel.ExportsExcelSenderUtil;
|
||||
import com.xboe.module.type.entity.Type;
|
||||
@@ -28,6 +32,7 @@ import com.xboe.module.type.service.ITypeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -44,6 +49,9 @@ import java.util.stream.Collectors;
|
||||
@Slf4j
|
||||
public class CoursePageServiceImpl implements ICoursePageService {
|
||||
|
||||
@Value("${kjb.aicoreUrl}")
|
||||
private String aicoreUrl;
|
||||
|
||||
@Autowired
|
||||
private MySqlSchemaProperties mySqlSchemaProperties;
|
||||
|
||||
@@ -114,6 +122,8 @@ public class CoursePageServiceImpl implements ICoursePageService {
|
||||
vo.setIsTop(false);
|
||||
}
|
||||
}
|
||||
// AI课程相关
|
||||
handleAiInfoFromKJB(voList);
|
||||
}
|
||||
|
||||
PageList<CoursePageVo> result = new PageList<>();
|
||||
@@ -475,4 +485,40 @@ public class CoursePageServiceImpl implements ICoursePageService {
|
||||
query.addOrder(createTimeOc);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleAiInfoFromKJB(List<CoursePageVo> courseList) {
|
||||
// 获取ai课程信息
|
||||
String url = aicoreUrl + "/aiVideo/getCourseList";
|
||||
// 入参
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
List<String> courseIds = courseList.stream()
|
||||
.map(CoursePageVo::getId)
|
||||
.collect(Collectors.toList());
|
||||
jsonObject.put("courseIds", courseIds);
|
||||
// 请求
|
||||
String result = HttpUtils.sendMessage(jsonObject.toJSONString(), url);
|
||||
log.info("---KJB --getCourseList 接口返回结果result: {}", result);
|
||||
JSONObject jsonResult = JSONObject.parseObject(result);
|
||||
String data = jsonResult.getString("rows");
|
||||
|
||||
List<BoeaiCourseDto> boeaiCourseDto = JSON.parseArray(data, BoeaiCourseDto.class);
|
||||
// 反解析
|
||||
if (boeaiCourseDto != null && !boeaiCourseDto.isEmpty()) {
|
||||
for (BoeaiCourseDto boeaiCourse : boeaiCourseDto) {
|
||||
String courseId = boeaiCourse.getCourseId();
|
||||
courseList.stream()
|
||||
.filter(course -> StringUtils.equals(course.getId(), courseId))
|
||||
.findFirst().ifPresent(course -> {
|
||||
course.setSummaryContent(boeaiCourseDto.get(0).getSummaryContent());
|
||||
course.setSummaryStatus(boeaiCourseDto.get(0).getSummaryStatus());
|
||||
course.setAiSet(boeaiCourseDto.get(0).getAiSet());
|
||||
course.setAiAbstract(boeaiCourseDto.get(0).getAiAbstract());
|
||||
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(",")));
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,9 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.Transient;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class CoursePageVo {
|
||||
@@ -191,4 +193,46 @@ public class CoursePageVo {
|
||||
* TODO 在线课优化二期会对此字段进行其他的赋值操作
|
||||
*/
|
||||
private Boolean isPermission = true;
|
||||
}
|
||||
|
||||
//region AI课程项目组相关字段
|
||||
/**
|
||||
* 0:关闭;1:打开;
|
||||
*/
|
||||
private Integer aiSet;
|
||||
|
||||
/**
|
||||
* 摘要 0:上架;1:下架;
|
||||
*/
|
||||
private Integer aiAbstract;
|
||||
|
||||
/**
|
||||
* 文稿 0:上架;1:下架;
|
||||
*/
|
||||
private Integer aiDraft;
|
||||
|
||||
/**
|
||||
* 翻译 0:上架;1:下架;
|
||||
*/
|
||||
private Integer aiTranslate;
|
||||
|
||||
/**
|
||||
* 语言 0:关闭;1:打开;
|
||||
*/
|
||||
private Integer languageStatus;
|
||||
|
||||
/**
|
||||
* 语言 zh-CN,en-US,ja-JP,ko-KR
|
||||
*/
|
||||
private List<String> languageCode;
|
||||
|
||||
/**
|
||||
* 摘要
|
||||
*/
|
||||
private String summaryContent;
|
||||
|
||||
/**
|
||||
* 摘要状态 0:下架;1:上架
|
||||
*/
|
||||
private Integer summaryStatus;
|
||||
//endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user