merge backend
This commit is contained in:
commit
b4ec889080
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
@ -62,7 +62,7 @@ public class Board {
|
||||
return ResponseBoardSummaryDto.builder()
|
||||
.id(id)
|
||||
.title(title)
|
||||
.name(user.getUserId())
|
||||
.name(user.getName())
|
||||
.createdAt(createdAt)
|
||||
.build();
|
||||
}
|
||||
@ -70,7 +70,7 @@ public class Board {
|
||||
public ResponseBoardDetailDto makeDetailDto(){
|
||||
return ResponseBoardDetailDto.builder()
|
||||
.id(id)
|
||||
.name(user.getEmail())
|
||||
.name(user.getName())
|
||||
.title(title)
|
||||
.content(content)
|
||||
.viewCount(viewCount)
|
||||
|
@ -42,7 +42,7 @@ public class Comment {
|
||||
public ResponseCommentDto makeCommentDto() {
|
||||
return ResponseCommentDto.builder()
|
||||
.id(id)
|
||||
.name(user.getEmail())
|
||||
.name(user.getName())
|
||||
.content(content)
|
||||
.createAt(createdAt)
|
||||
.modifiedAt(modifiedAt)
|
||||
|
@ -14,6 +14,7 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@ -83,8 +84,9 @@ public class LectureController {
|
||||
|
||||
@GetMapping("/mylecture")
|
||||
public ResponseEntity<?> findMyLecture(@RequestHeader(value = "Authorization", required = false) String accessToken) {
|
||||
|
||||
if (accessToken == null) {
|
||||
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
|
||||
return new ResponseEntity<>(new ArrayList<>(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
Long userId = Long.parseLong(jwtUtil.getUserId(accessToken));
|
||||
@ -93,4 +95,9 @@ public class LectureController {
|
||||
|
||||
return new ResponseEntity<>(myLectures, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/isLive/{lectureId}")
|
||||
public ResponseEntity<Boolean> checkIsLive(@PathVariable long lectureId) {
|
||||
return new ResponseEntity<>(lectureService.getState(lectureId), HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
@ -1,19 +1,28 @@
|
||||
package com.edufocus.edufocus.report.controller;
|
||||
|
||||
import com.edufocus.edufocus.report.entity.dto.ReportDetailResponseDto;
|
||||
import com.edufocus.edufocus.report.entity.dto.ReportListResponseDto;
|
||||
import com.edufocus.edufocus.report.entity.dto.ReportResponse;
|
||||
import com.edufocus.edufocus.report.entity.vo.Report;
|
||||
import com.edufocus.edufocus.report.entity.dto.ReportRequset;
|
||||
import com.edufocus.edufocus.report.service.ReportService;
|
||||
import com.edufocus.edufocus.user.model.entity.vo.User;
|
||||
import com.edufocus.edufocus.user.model.entity.vo.UserRole;
|
||||
import com.edufocus.edufocus.user.model.repository.UserRepository;
|
||||
import com.edufocus.edufocus.user.model.service.UserService;
|
||||
import com.edufocus.edufocus.user.model.service.UserServiceImpl;
|
||||
import com.edufocus.edufocus.user.util.JWTUtil;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/report")
|
||||
@ -23,15 +32,75 @@ public class ReportController{
|
||||
|
||||
|
||||
private final ReportService reportService;
|
||||
private final JWTUtil jwtUtil;
|
||||
private final UserService userService;
|
||||
private final UserRepository userRepository;
|
||||
//SUBMIT 할떄 LECTURE ID 저장해놓기
|
||||
|
||||
@PostMapping("/submit/{lectreId}/quizset/{quizsetId}")
|
||||
public ResponseEntity<?> submit(@PathVariable("lectreId") Long lectureId, @PathVariable("quizsetId") Long quizestId, @RequestBody ReportRequset reportRequset, HttpServletRequest request) throws SQLException {
|
||||
|
||||
String token = request.getHeader("Authorization");
|
||||
Long userId = Long.parseLong(jwtUtil.getUserId(token));
|
||||
User findUser = userRepository.findById(userId).orElse(null);
|
||||
if (findUser.getRole() == UserRole.ADMIN) {
|
||||
|
||||
return new ResponseEntity<>("강사는 퀴즈제출을 할수 없습니다", HttpStatus.FORBIDDEN);
|
||||
|
||||
}
|
||||
ReportResponse report = reportService.grading(userId, quizestId, reportRequset, lectureId);
|
||||
|
||||
@PostMapping("/submit")
|
||||
public ResponseEntity<ReportResponse> submit(@RequestBody ReportRequset reportRequset) throws SQLException {
|
||||
ReportResponse report = reportService.grading(reportRequset);
|
||||
return new ResponseEntity<>(report, HttpStatus.CREATED);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/myreport")
|
||||
public ResponseEntity<List<ReportListResponseDto>> myreport(HttpServletRequest request) throws SQLException {
|
||||
String token = request.getHeader("Authorization");
|
||||
Long userId = Long.parseLong(jwtUtil.getUserId(token));
|
||||
|
||||
|
||||
List<ReportListResponseDto> reportList = reportService.resultList(userId);
|
||||
|
||||
return new ResponseEntity<>(reportList, HttpStatus.CREATED);
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/myreportdetail/{id}")
|
||||
public ResponseEntity<ReportDetailResponseDto> myreportdetail(@PathVariable("id") Long reportId) throws SQLException {
|
||||
|
||||
ReportDetailResponseDto detailReport = reportService.reportDetail(reportId);
|
||||
return new ResponseEntity<>(detailReport, HttpStatus.CREATED);
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/studentreport/{lecturid}")
|
||||
public ResponseEntity<List<ReportListResponseDto>> studentreport(@PathVariable("lecturid") Long lectureId) throws SQLException {
|
||||
|
||||
|
||||
List<ReportListResponseDto> reportList = reportService.studentResultList(lectureId);
|
||||
|
||||
return new ResponseEntity<>(reportList, HttpStatus.CREATED);
|
||||
|
||||
}
|
||||
|
||||
@GetMapping("/studentreportdetail/{id}")
|
||||
public ResponseEntity<ReportDetailResponseDto> studentdetailreport(@PathVariable("id") Long reportId) throws SQLException {
|
||||
|
||||
ReportDetailResponseDto detailReport = reportService.reportDetail(reportId);
|
||||
return new ResponseEntity<>(detailReport, HttpStatus.CREATED);
|
||||
|
||||
}
|
||||
|
||||
// 강좌에 대한 퀴즈셋
|
||||
// lecture id가 똑같은 report들 제목 + 작성자 + 맞틀 개수 미리 보여주기
|
||||
// @GetMapping("/detailreport/{id}")
|
||||
// public ResponseEntity<ReportDetailResponseDto> (@PathVariable("id") Long reportId) throws SQLException {
|
||||
//
|
||||
// ReportDetailResponseDto detailReport = reportService.reportDetail(reportId);
|
||||
// return new ResponseEntity<>(detailReport, HttpStatus.CREATED);
|
||||
//
|
||||
// } v 9
|
||||
|
||||
}
|
||||
|
@ -5,7 +5,8 @@ import lombok.Getter;
|
||||
@Getter
|
||||
public class AnswerInput {
|
||||
|
||||
Long answerinputID;
|
||||
|
||||
String answer;
|
||||
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
package com.edufocus.edufocus.report.entity.dto;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.Setter;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public class ChoiceDto {
|
||||
int num;
|
||||
String content;
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.edufocus.edufocus.report.entity.dto;
|
||||
|
||||
import com.edufocus.edufocus.quiz.entity.Choice;
|
||||
import com.edufocus.edufocus.quiz.entity.QuizSet;
|
||||
import com.fasterxml.jackson.annotation.JsonBackReference;
|
||||
import com.fasterxml.jackson.annotation.JsonManagedReference;
|
||||
import jakarta.persistence.*;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public class QuizDto {
|
||||
|
||||
|
||||
private long id;
|
||||
|
||||
|
||||
private String question;
|
||||
|
||||
private String image;
|
||||
|
||||
private String answer;
|
||||
private String userAnswer;
|
||||
private List<ChoiceDto> choices;
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.edufocus.edufocus.report.entity.dto;
|
||||
|
||||
import com.edufocus.edufocus.quiz.entity.Quiz;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public class ReportDetailResponseDto {
|
||||
private int allCount;
|
||||
private String title;
|
||||
private int correctCount;
|
||||
private Date testAt;
|
||||
private List<QuizDto> correctQuizzes;
|
||||
private List<QuizDto> incorrectQuizzes;
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.edufocus.edufocus.report.entity.dto;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
public class ReportListResponseDto {
|
||||
private String title;
|
||||
private Date date;
|
||||
private Long reportId;
|
||||
private String name;
|
||||
private int allCount;
|
||||
private int correctCount;
|
||||
}
|
@ -10,11 +10,9 @@ import java.util.List;
|
||||
public class ReportRequset {
|
||||
|
||||
|
||||
private Long userId;
|
||||
private Long quizsetId;
|
||||
List<AnswerInput> answerInputList;
|
||||
|
||||
List<String> answer;
|
||||
|
||||
// [1,2,,3]
|
||||
// List<answerDto> a
|
||||
// userID :
|
||||
// quizSetId :
|
||||
|
@ -17,7 +17,6 @@ public class Answer {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
private long id;
|
||||
|
||||
private String userAnswer;
|
||||
private boolean isCorrect;
|
||||
|
||||
|
@ -23,7 +23,7 @@ public class Report {
|
||||
private int allCount;
|
||||
private int correctCount;
|
||||
private Date testAt;
|
||||
|
||||
private Long lectureId;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "user_id")
|
||||
private User user;
|
||||
|
@ -3,5 +3,9 @@ package com.edufocus.edufocus.report.repository;
|
||||
import com.edufocus.edufocus.report.entity.vo.Answer;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface AnswerRepository extends JpaRepository<Answer, Long> {
|
||||
List<Answer> findByReport_Id(Long reportId);
|
||||
|
||||
}
|
||||
|
@ -4,6 +4,12 @@ import com.edufocus.edufocus.report.entity.vo.Report;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Repository
|
||||
public interface ReportRepository extends JpaRepository<Report, Long> {
|
||||
List<Report> findByUser_Id(Long userId);
|
||||
|
||||
List<Report> findByLectureId(Long lectureId);
|
||||
|
||||
}
|
||||
|
@ -1,14 +1,21 @@
|
||||
package com.edufocus.edufocus.report.service;
|
||||
|
||||
import com.edufocus.edufocus.report.entity.dto.ReportDetailResponseDto;
|
||||
import com.edufocus.edufocus.report.entity.dto.ReportListResponseDto;
|
||||
import com.edufocus.edufocus.report.entity.dto.ReportResponse;
|
||||
import com.edufocus.edufocus.report.entity.vo.Report;
|
||||
import com.edufocus.edufocus.report.entity.dto.ReportRequset;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public interface ReportService {
|
||||
ReportResponse grading(ReportRequset reportRequset) throws SQLException;
|
||||
ReportResponse grading(Long userId, Long quizesetId, ReportRequset reportRequset, Long lectureId) throws SQLException;
|
||||
|
||||
ReportDetailResponseDto reportDetail(Long userId) throws SQLException;
|
||||
|
||||
List<ReportListResponseDto> resultList(Long userId) throws SQLException;
|
||||
|
||||
List<ReportListResponseDto> studentResultList(Long lectureId) throws SQLException;
|
||||
}
|
||||
|
@ -1,23 +1,26 @@
|
||||
package com.edufocus.edufocus.report.service;
|
||||
|
||||
import com.edufocus.edufocus.quiz.entity.Choice;
|
||||
import com.edufocus.edufocus.quiz.entity.Quiz;
|
||||
import com.edufocus.edufocus.quiz.entity.QuizSet;
|
||||
import com.edufocus.edufocus.quiz.repository.QuizRepository;
|
||||
import com.edufocus.edufocus.quiz.repository.QuizSetRepository;
|
||||
import com.edufocus.edufocus.quiz.service.QuizService;
|
||||
import com.edufocus.edufocus.quiz.service.QuizSetService;
|
||||
import com.edufocus.edufocus.report.entity.dto.ReportResponse;
|
||||
import com.edufocus.edufocus.report.entity.dto.*;
|
||||
import com.edufocus.edufocus.report.entity.vo.Answer;
|
||||
import com.edufocus.edufocus.report.entity.dto.AnswerInput;
|
||||
import com.edufocus.edufocus.report.entity.vo.Report;
|
||||
import com.edufocus.edufocus.report.entity.dto.ReportRequset;
|
||||
import com.edufocus.edufocus.report.repository.AnswerRepository;
|
||||
import com.edufocus.edufocus.report.repository.ReportRepository;
|
||||
import com.edufocus.edufocus.user.model.entity.vo.User;
|
||||
import com.edufocus.edufocus.user.model.repository.UserRepository;
|
||||
import jakarta.transaction.Transactional;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.checkerframework.checker.units.qual.C;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@ -32,63 +35,71 @@ public class ReportServiceImpl implements ReportService {
|
||||
private final ReportRepository reportRepository;
|
||||
private final QuizRepository quizRepository;
|
||||
|
||||
|
||||
private final AnswerRepository answerRepository;
|
||||
private final AnswerService answerService;
|
||||
private final UserRepository userRepository;
|
||||
private final QuizSetRepository quizSetRepository;
|
||||
|
||||
|
||||
@Override
|
||||
public ReportResponse grading(ReportRequset reportRequset) throws SQLException {
|
||||
public ReportResponse grading(Long userId, Long quizsetId, ReportRequset reportRequset, Long lectureId) throws SQLException {
|
||||
|
||||
|
||||
QuizSet quizSet = quizSetService.findQuizSet(reportRequset.getQuizsetId());
|
||||
System.out.println(quizSet.toString());
|
||||
QuizSet quizSet = quizSetService.findQuizSet(quizsetId);
|
||||
List<Quiz> quizList = quizSet.getQuizzes();
|
||||
List<AnswerInput> answerInputList = reportRequset.getAnswerInputList();
|
||||
List<String> answerInputList = reportRequset.getAnswer();
|
||||
|
||||
Report report = new Report();
|
||||
List<Answer> answerList = new ArrayList<>();
|
||||
|
||||
Long reportNum = report.getId();
|
||||
int allCount = quizList.size();
|
||||
int correctCount = 0;
|
||||
|
||||
User testuser = userRepository.findById(reportRequset.getUserId()).orElse(null);
|
||||
User testuser = userRepository.findById(userId).orElse(null);
|
||||
|
||||
for (Quiz quiz : quizList) {
|
||||
for (AnswerInput answerInput : answerInputList) {
|
||||
if (quiz.getId() == answerInput.getAnswerinputID()) {
|
||||
|
||||
if (quiz.getAnswer().equals(answerInput.getAnswer())) {
|
||||
for (int idx = 0; idx < answerInputList.size(); idx++) {
|
||||
Quiz quiz = quizList.get(idx);
|
||||
String inputAnswer = answerInputList.get(idx);
|
||||
Answer answer;
|
||||
//
|
||||
if (quiz.getAnswer().equals(inputAnswer)) {
|
||||
correctCount++;
|
||||
|
||||
Answer answer = Answer.builder()
|
||||
.userAnswer(answerInput.getAnswer())
|
||||
answer = Answer.builder()
|
||||
.userAnswer(inputAnswer)
|
||||
.isCorrect(true)
|
||||
.report(report)
|
||||
.report(null)
|
||||
.quiz(quiz)
|
||||
.build();
|
||||
|
||||
} else {
|
||||
Answer answer = Answer.builder()
|
||||
.userAnswer(answerInput.getAnswer())
|
||||
answer = Answer.builder()
|
||||
.userAnswer(inputAnswer)
|
||||
.isCorrect(false)
|
||||
.report(report)
|
||||
.report(null)
|
||||
.quiz(quiz)
|
||||
.build();
|
||||
|
||||
|
||||
}
|
||||
answerList.add(answer);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
report = Report.builder()
|
||||
Report report = Report.builder()
|
||||
.user(testuser)
|
||||
.quizSet(quizSet)
|
||||
.allCount(allCount)
|
||||
.correctCount(correctCount)
|
||||
.testAt(new Date()).build();
|
||||
.testAt(new Date())
|
||||
.lectureId(lectureId)
|
||||
.build();
|
||||
|
||||
|
||||
reportRepository.save(report);
|
||||
|
||||
|
||||
for (Answer answer : answerList) {
|
||||
answer.setReport(report);
|
||||
answerRepository.save(answer);
|
||||
}
|
||||
|
||||
|
||||
ReportResponse reportResponse = ReportResponse.builder()
|
||||
.quizesetId(quizSet.getId())
|
||||
.userId(testuser.getId())
|
||||
@ -100,4 +111,121 @@ public class ReportServiceImpl implements ReportService {
|
||||
|
||||
return reportResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReportDetailResponseDto reportDetail(Long repordId) {
|
||||
|
||||
Report report = reportRepository.findById(repordId).orElse(null);
|
||||
|
||||
QuizSet quizSet = quizSetService.findQuizSet(report.getQuizSet().getId());
|
||||
|
||||
List<QuizDto> correctQuiz = new ArrayList<>();
|
||||
List<QuizDto> incorrectQuiz = new ArrayList<>();
|
||||
|
||||
List<Answer> myAnswer = answerRepository.findByReport_Id(report.getId());
|
||||
|
||||
for (Answer answer : myAnswer) {
|
||||
QuizDto quizDto;
|
||||
Quiz quiz = quizRepository.findById(answer.getQuiz().getId()).orElse(null);
|
||||
|
||||
ArrayList<ChoiceDto> choiceDtos = new ArrayList<>();
|
||||
|
||||
for (Choice c : quiz.getChoices()) {
|
||||
ChoiceDto choiceDto = null;
|
||||
choiceDto = choiceDto.builder()
|
||||
.num(c.getNum())
|
||||
.content(c.getContent())
|
||||
.build();
|
||||
choiceDtos.add(choiceDto);
|
||||
|
||||
}
|
||||
if (answer.isCorrect()) {
|
||||
|
||||
quizDto = QuizDto.builder()
|
||||
.id(quiz.getId())
|
||||
.question(quiz.getQuestion())
|
||||
.image(quiz.getImage())
|
||||
.question(quiz.getQuestion())
|
||||
.answer(quiz.getAnswer())
|
||||
.userAnswer(answer.getUserAnswer())
|
||||
.choices(choiceDtos)
|
||||
.build();
|
||||
correctQuiz.add(quizDto);
|
||||
} else {
|
||||
quizDto = QuizDto.builder()
|
||||
.id(quiz.getId())
|
||||
.question(quiz.getQuestion())
|
||||
.image(quiz.getImage())
|
||||
.question(quiz.getQuestion())
|
||||
.answer(quiz.getAnswer())
|
||||
.userAnswer(answer.getUserAnswer())
|
||||
.choices(choiceDtos)
|
||||
.build();
|
||||
incorrectQuiz.add(quizDto);
|
||||
|
||||
}
|
||||
}
|
||||
ReportDetailResponseDto dto = ReportDetailResponseDto.builder()
|
||||
.title(quizSet.getTitle())
|
||||
.testAt(report.getTestAt())
|
||||
.allCount(report.getAllCount())
|
||||
.correctCount(report.getCorrectCount())
|
||||
.correctQuizzes(correctQuiz)
|
||||
.incorrectQuizzes(incorrectQuiz)
|
||||
.build();
|
||||
|
||||
return dto;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ReportListResponseDto> resultList(Long userId) throws SQLException {
|
||||
|
||||
List<Report> reportList = reportRepository.findByUser_Id(userId);
|
||||
|
||||
List<ReportListResponseDto> reportListResponseDtoList = new ArrayList<>();
|
||||
|
||||
|
||||
for (Report report : reportList) {
|
||||
|
||||
QuizSet quizSet = quizSetService.findQuizSet(report.getQuizSet().getId());
|
||||
ReportListResponseDto dto = ReportListResponseDto.builder()
|
||||
.title(quizSet.getTitle()) // Assuming QuizSet has a method getTitle()
|
||||
.date(report.getTestAt())
|
||||
.reportId(report.getId())// Assuming QuizSet has a method getDate()
|
||||
.build();
|
||||
reportListResponseDtoList.add(dto);
|
||||
|
||||
}
|
||||
|
||||
return reportListResponseDtoList;
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ReportListResponseDto> studentResultList(Long lectureId) throws SQLException {
|
||||
|
||||
List<Report> reportList = reportRepository.findByLectureId(lectureId);
|
||||
|
||||
List<ReportListResponseDto> reportListResponseDtoList = new ArrayList<>();
|
||||
|
||||
|
||||
for (Report report : reportList) {
|
||||
|
||||
System.out.println(report.toString());
|
||||
QuizSet quizSet = quizSetService.findQuizSet(report.getQuizSet().getId());
|
||||
ReportListResponseDto dto = ReportListResponseDto.builder()
|
||||
.title(quizSet.getTitle())
|
||||
.date(report.getTestAt())
|
||||
.reportId(report.getId())
|
||||
.allCount(report.getAllCount())
|
||||
.correctCount(report.getCorrectCount())
|
||||
.build();
|
||||
reportListResponseDtoList.add(dto);
|
||||
|
||||
}
|
||||
|
||||
return reportListResponseDtoList;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,9 @@ public class UserController {
|
||||
if (userService.isUserIdExist(requestJoinDto.getUserId()))
|
||||
return new ResponseEntity<>("아이디가 중복 됐습니다.", HttpStatus.CONFLICT);
|
||||
|
||||
if(userService.isEmailExist(requestJoinDto.getEmail()))
|
||||
return new ResponseEntity<>("이메일이 중복 됐습니다.", HttpStatus.CONFLICT);
|
||||
|
||||
userService.join(requestJoinDto);
|
||||
|
||||
return ResponseEntity.ok("User registered successfully");
|
||||
|
@ -109,6 +109,11 @@ public class UserServiceImpl implements UserService {
|
||||
return userRepository.findByUserId(userId).isPresent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEmailExist(String email) {
|
||||
return userRepository.findByEmail(email).isPresent();
|
||||
}
|
||||
|
||||
public String getTempPassword() {
|
||||
char[] charSet = new char[]{'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
|
||||
'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'};
|
||||
|
@ -29,7 +29,7 @@ public class VideoServiceImpl implements VideoSertvice {
|
||||
|
||||
@Override
|
||||
public void stopOnline(Long userId, Long lectureId) throws SQLException {
|
||||
lectureService.startClass(lectureId);
|
||||
lectureService.stopClass(lectureId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,2 @@
|
||||
package com.edufocus.edufocus.board.controller;public class BoardControllerTest {
|
||||
}
|
Loading…
Reference in New Issue
Block a user