mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-15 22:06:50 +08:00
新的提供给第三方的添加考试任务的接口,增加了检查
This commit is contained in:
@@ -25,7 +25,7 @@ public class AloneExamExtendApi extends ApiBaseController {
|
|||||||
IAloneExamService aloneExamService;
|
IAloneExamService aloneExamService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加考试任务,针对单个用户
|
* 添加考试任务,针对单个用户.如果已经存在,就会返回已存在的
|
||||||
* */
|
* */
|
||||||
@PostMapping("/save")
|
@PostMapping("/save")
|
||||||
public JsonResponse<AloneExam> save(@RequestBody AloneExam aloneExam){
|
public JsonResponse<AloneExam> save(@RequestBody AloneExam aloneExam){
|
||||||
@@ -42,6 +42,11 @@ public class AloneExamExtendApi extends ApiBaseController {
|
|||||||
return badRequest("缺少关联类型");
|
return badRequest("缺少关联类型");
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
//检查,一个用户,一个考试 只能有一个考试 任务
|
||||||
|
AloneExam has =aloneExamService.getAloneByAidAndTestId(aloneExam.getAid(), aloneExam.getTestId());
|
||||||
|
if(has!=null) {
|
||||||
|
return success(has);
|
||||||
|
}
|
||||||
aloneExamService.save(aloneExam);
|
aloneExamService.save(aloneExam);
|
||||||
return success(aloneExam);
|
return success(aloneExam);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user