|
|
@@ -5,6 +5,7 @@ import cn.seecoder.seecoderportalserver.service.HttpService;
|
|
|
import cn.seecoder.seecoderportalserver.service.subsystem.SubsystemService;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -17,6 +18,7 @@ import java.util.List;
|
|
|
* @date 2025/2/24 下午6:44
|
|
|
* @description: EaiService
|
|
|
*/
|
|
|
+@Slf4j
|
|
|
@Service
|
|
|
public class EaiService implements SubsystemService {
|
|
|
private final HttpService httpService;
|
|
|
@@ -29,6 +31,8 @@ public class EaiService implements SubsystemService {
|
|
|
|
|
|
@Override
|
|
|
public JSONObject createCourse(CourseVO courseVO) {
|
|
|
+// log.info("EAI新建课程:", courseVO);
|
|
|
+ System.out.println("EAI新建课程:" + courseVO.toString());
|
|
|
String uri = eaiHost + "/api/course";
|
|
|
String token = httpService.getToken();
|
|
|
JSONObject requestBody = new JSONObject();
|
|
|
@@ -40,7 +44,8 @@ public class EaiService implements SubsystemService {
|
|
|
courseImages.add(courseVO.getImageUrl());
|
|
|
|
|
|
List<Long> teacherIds = new ArrayList<>();
|
|
|
- teacherIds.add(courseVO.getId());
|
|
|
+ teacherIds.add(courseVO.getTeacher().getId());
|
|
|
+ System.out.println(courseVO.getTeacher());
|
|
|
|
|
|
//对应eai中的CourseDT0
|
|
|
requestBody.put("courseName", courseVO.getName());
|
|
|
@@ -49,6 +54,9 @@ public class EaiService implements SubsystemService {
|
|
|
requestBody.put("startTime", Date.from(courseVO.getStartTime().toInstant()));
|
|
|
requestBody.put("endTime", Date.from(courseVO.getEndTime().toInstant()));
|
|
|
requestBody.put("description", courseVO.getDescription());
|
|
|
+ requestBody.put("enrollCode", courseVO.getInvitationCode());
|
|
|
+
|
|
|
+
|
|
|
|
|
|
//对应eai中的CourseVO
|
|
|
// requestBody.put("courseName", courseVO.getName());
|
|
|
@@ -65,6 +73,8 @@ public class EaiService implements SubsystemService {
|
|
|
String result = null;
|
|
|
try {
|
|
|
result = httpService.sendPost(uri, requestBody, null, token);
|
|
|
+// log.info("EAI新建课程结果: " ,result);
|
|
|
+ System.out.println("EAI新建课程结果: " + result);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|