|
@@ -10,15 +10,18 @@ import com.qmth.distributed.print.business.service.TCFinalScoreService;
|
|
|
import com.qmth.teachcloud.common.annotation.OperationLogDetail;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.MarkQuestion;
|
|
|
+import com.qmth.teachcloud.common.entity.SysUser;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.teachcloud.common.enums.log.CustomizedOperationTypeEnum;
|
|
|
import com.qmth.teachcloud.common.util.ResultUtil;
|
|
|
+import com.qmth.teachcloud.common.util.ServletUtil;
|
|
|
import com.qmth.teachcloud.mark.service.MarkQuestionService;
|
|
|
import io.swagger.annotations.*;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.validation.BindingResult;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -43,7 +46,6 @@ import java.util.Objects;
|
|
|
@Api(tags = "课程目标达成度-成绩管理-期末考试成绩Controller")
|
|
|
@RestController
|
|
|
@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_COURSE_DEGREE)
|
|
|
-@Validated
|
|
|
public class TCFinalScoreController {
|
|
|
private final static Logger log = LoggerFactory.getLogger(TCFinalScoreController.class);
|
|
|
|
|
@@ -121,8 +123,16 @@ public class TCFinalScoreController {
|
|
|
@OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UPDATE)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "保存", response = EditResult.class)})
|
|
|
@Transactional
|
|
|
- public Object finalScoreSave(@ApiParam(value = "期末考试成绩信息", required = true) @Valid @RequestBody TCFinalScore tcFinalScore) throws IOException {
|
|
|
- return ResultUtil.ok(true);
|
|
|
+ public Object finalScoreSave(@ApiParam(value = "期末考试成绩信息", required = true) @Valid @RequestBody TCFinalScore tcFinalScore, BindingResult bindingResult) throws IOException {
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
|
+ }
|
|
|
+ TCFinalScore tcFinalScoreDb = tcFinalScoreService.getById(tcFinalScore.getId());
|
|
|
+ Objects.requireNonNull(tcFinalScoreDb, "未找到期末成绩信息");
|
|
|
+
|
|
|
+ SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
+ tcFinalScoreDb.updateInfo(tcFinalScore, sysUser.getId());
|
|
|
+ return ResultUtil.ok(tcFinalScoreService.updateById(tcFinalScoreDb));
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "期末成绩启用/禁用")
|
|
@@ -135,6 +145,8 @@ public class TCFinalScoreController {
|
|
|
TCFinalScore tcFinalScore = tcFinalScoreService.getById(id);
|
|
|
Objects.requireNonNull(tcFinalScore, "未找到期末成绩信息");
|
|
|
tcFinalScore.setEnable(enable);
|
|
|
+ SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
+ tcFinalScore.updateInfo(sysUser.getId());
|
|
|
return ResultUtil.ok(tcFinalScoreService.updateById(tcFinalScore));
|
|
|
}
|
|
|
|
|
@@ -143,7 +155,10 @@ public class TCFinalScoreController {
|
|
|
@OperationLogDetail(customizedOperationType = CustomizedOperationTypeEnum.UPDATE)
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "试卷蓝图保存", response = Object.class)})
|
|
|
@Transactional
|
|
|
- public Object finalScorePaperStructSave(@ApiParam(value = "试卷蓝图结构", required = true) @RequestBody Object body) throws IOException {
|
|
|
+ public Object finalScorePaperStructSave(@ApiParam(value = "试卷蓝图结构", required = true) @Valid @RequestBody Object body, BindingResult bindingResult) throws IOException {
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
|
+ }
|
|
|
return ResultUtil.ok(true);
|
|
|
}
|
|
|
|