Commit 04a80ddf by aye

代码提交

parent c58b9da6
...@@ -6,6 +6,8 @@ import com.jty.wsxt.interfaces.dto.PaperSearchDto; ...@@ -6,6 +6,8 @@ import com.jty.wsxt.interfaces.dto.PaperSearchDto;
import com.jty.wsxt.interfaces.dto.PaperSearchForCreatorDto; import com.jty.wsxt.interfaces.dto.PaperSearchForCreatorDto;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import java.util.List;
/** /**
* PaperService * PaperService
* *
...@@ -45,4 +47,25 @@ public interface PaperService { ...@@ -45,4 +47,25 @@ public interface PaperService {
* @return paper * @return paper
*/ */
Paper findPaperDetailById(Integer id); Paper findPaperDetailById(Integer id);
/**
* 获取答案
* @param id id
* @return List
*/
List<String> getAnswerById(Integer id);
/**
* 获取第一次反馈
* @param id id
* @return List
*/
List<String> getFirstFeedbackById(Integer id);
/**
* 获取第二次反馈
* @param id id
* @return List
*/
List<String> getSecondFeedbackById(Integer id);
} }
...@@ -69,6 +69,24 @@ public class PaperServiceImpl implements PaperService { ...@@ -69,6 +69,24 @@ public class PaperServiceImpl implements PaperService {
public Paper findPaperDetailById(Integer id) { public Paper findPaperDetailById(Integer id) {
return DomainRegistry.paperRepository().findById(id).orElseThrow(()->new BusinessException(ResultCode.RESULT_DATA_NONE)); return DomainRegistry.paperRepository().findById(id).orElseThrow(()->new BusinessException(ResultCode.RESULT_DATA_NONE));
} }
@Override
public List<String> getAnswerById(Integer id) {
Paper paper = this.findPaperDetailById(id);
return JSON.parseArray(paper.getAnswer(), String.class);
}
@Override
public List<String> getFirstFeedbackById(Integer id) {
Paper paper = this.findPaperDetailById(id);
return JSON.parseArray(paper.getFirstFeedback(), String.class);
}
@Override
public List<String> getSecondFeedbackById(Integer id) {
Paper paper = this.findPaperDetailById(id);
return JSON.parseArray(paper.getSecondFeedback(), String.class);
}
} }
class PaperDsl { class PaperDsl {
public static Specification<Paper> getNrscTeachersWhereClause(PaperSearchForCreatorDto searchDto) { public static Specification<Paper> getNrscTeachersWhereClause(PaperSearchForCreatorDto searchDto) {
......
...@@ -59,20 +59,17 @@ public class PaperController { ...@@ -59,20 +59,17 @@ public class PaperController {
@GetMapping("/paper/download-first-feedback/{paperId}") @GetMapping("/paper/download-first-feedback/{paperId}")
public Result downloadFirstFeedback(@PathVariable Integer paperId){ public Result downloadFirstFeedback(@PathVariable Integer paperId){
Paper paper = ApplicationRegistry.paperService().findPaperDetailById(paperId); return Result.success(ApplicationRegistry.paperService().getFirstFeedbackById(paperId));
return Result.success(paper.cashToPaperDto());
} }
@GetMapping("/paper/download-second-feedback/{paperId}") @GetMapping("/paper/download-second-feedback/{paperId}")
public Result downloadSecondFeedback(@PathVariable Integer paperId){ public Result downloadSecondFeedback(@PathVariable Integer paperId){
Paper paper = ApplicationRegistry.paperService().findPaperDetailById(paperId); return Result.success(ApplicationRegistry.paperService().getSecondFeedbackById(paperId));
return Result.success(paper.cashToPaperDto());
} }
@GetMapping("/paper/download-answer/{paperId}") @GetMapping("/paper/download-answer/{paperId}")
public Result downloadAnswer(@PathVariable Integer paperId){ public Result downloadAnswer(@PathVariable Integer paperId){
Paper paper = ApplicationRegistry.paperService().findPaperDetailById(paperId); return Result.success(ApplicationRegistry.paperService().getAnswerById(paperId));
return Result.success(paper.cashToPaperDto());
} }
@DeleteMapping("/paper/{paperId}") @DeleteMapping("/paper/{paperId}")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment