|
@@ -2,11 +2,30 @@ package com.qmth.distributed.print.api.mark;
|
|
|
|
|
|
|
|
|
import com.qmth.boot.api.constant.ApiConstant;
|
|
|
+import com.qmth.boot.api.exception.ApiException;
|
|
|
+import com.qmth.distributed.print.business.bean.result.EditResult;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
+import com.qmth.teachcloud.common.enums.FieldUniqueEnum;
|
|
|
+import com.qmth.teachcloud.common.util.Result;
|
|
|
+import com.qmth.teachcloud.common.util.ResultUtil;
|
|
|
+import com.qmth.teachcloud.mark.bean.ai.MarkAiQuestionParamResult;
|
|
|
+import com.qmth.teachcloud.mark.entity.MarkAiQuestionLevel;
|
|
|
+import com.qmth.teachcloud.mark.entity.MarkAiQuestionParam;
|
|
|
+import com.qmth.teachcloud.mark.entity.MarkAiQuestionPoint;
|
|
|
+import com.qmth.teachcloud.mark.service.MarkAiQuestionLevelService;
|
|
|
+import com.qmth.teachcloud.mark.service.MarkAiQuestionParamService;
|
|
|
+import com.qmth.teachcloud.mark.service.MarkAiQuestionPointService;
|
|
|
+import io.swagger.annotations.*;
|
|
|
+import org.slf4j.Logger;
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
+import org.springframework.dao.DuplicateKeyException;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.validation.BindingResult;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import javax.annotation.Resource;
|
|
|
+import javax.validation.Valid;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -20,5 +39,84 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
@RestController
|
|
|
@RequestMapping(ApiConstant.DEFAULT_URI_PREFIX + SystemConstant.PREFIX_URL_MARK + "/ai_question_param")
|
|
|
public class MarkAiQuestionParamController {
|
|
|
+ private final static Logger log = LoggerFactory.getLogger(MarkAiQuestionParamController.class);
|
|
|
|
|
|
+ @Resource
|
|
|
+ MarkAiQuestionParamService markAiQuestionParamService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ MarkAiQuestionPointService markAiQuestionPointService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ MarkAiQuestionLevelService markAiQuestionLevelService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "AI评卷参数新增/修改")
|
|
|
+ @RequestMapping(value = "/save", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "新增", response = EditResult.class)})
|
|
|
+ @Transactional
|
|
|
+ public Result save(@ApiParam(value = "AI评卷参数信息", required = true) @Valid @RequestBody MarkAiQuestionParam markAiQuestionParam, BindingResult bindingResult) {
|
|
|
+ if (bindingResult.hasErrors()) {
|
|
|
+ return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
|
+ }
|
|
|
+ try {
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error(SystemConstant.LOG_ERROR, e);
|
|
|
+ if (e instanceof DuplicateKeyException) {
|
|
|
+ String errorColumn = e.getCause().toString();
|
|
|
+ String columnStr = errorColumn.substring(errorColumn.lastIndexOf("key") + 3, errorColumn.length()).replaceAll("'", "");
|
|
|
+ throw ExceptionResultEnum.SQL_ERROR.exception("[" + FieldUniqueEnum.convertToTitle(columnStr) + "]数据不允许重复插入");
|
|
|
+ } else if (e instanceof ApiException) {
|
|
|
+ ResultUtil.error((ApiException) e, ((ApiException) e).getCode(), e.getMessage());
|
|
|
+ } else {
|
|
|
+ ResultUtil.error(e.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ResultUtil.ok(true);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "AI评卷参数查询")
|
|
|
+ @RequestMapping(value = "/info", method = RequestMethod.POST)
|
|
|
+ @ApiResponses({@ApiResponse(code = 200, message = "AI评卷参数查询", response = MarkAiQuestionParamResult.class)})
|
|
|
+ public Result info(@ApiParam(value = "主键", required = true) @RequestParam Long id) {
|
|
|
+ return ResultUtil.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+// @ApiOperation(value = "AI评卷参数得分点新增/修改")
|
|
|
+// @RequestMapping(value = "/point/save", method = RequestMethod.POST)
|
|
|
+// @ApiResponses({@ApiResponse(code = 200, message = "AI评卷参数得分点信息", response = EditResult.class)})
|
|
|
+// @Transactional
|
|
|
+// public Result pointSave(@ApiParam(value = "AI评卷参数得分点信息", required = true) @Valid @RequestBody MarkAiQuestionPoint markAiQuestionPoint, BindingResult bindingResult) {
|
|
|
+// if (bindingResult.hasErrors()) {
|
|
|
+// return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
|
+// }
|
|
|
+// return ResultUtil.ok();
|
|
|
+// }
|
|
|
+//
|
|
|
+// @ApiOperation(value = "AI评卷参数档次新增/修改")
|
|
|
+// @RequestMapping(value = "/level/save", method = RequestMethod.POST)
|
|
|
+// @ApiResponses({@ApiResponse(code = 200, message = "新增/修改成功", response = EditResult.class)})
|
|
|
+// @Transactional
|
|
|
+// public Result levelSave(@ApiParam(value = "AI评卷参数档次信息", required = true) @Valid @RequestBody MarkAiQuestionLevel markAiQuestionLevel, BindingResult bindingResult) {
|
|
|
+// if (bindingResult.hasErrors()) {
|
|
|
+// return ResultUtil.error(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
|
|
+// }
|
|
|
+// return ResultUtil.ok();
|
|
|
+// }
|
|
|
+//
|
|
|
+// @ApiOperation(value = "AI评卷参数得分点删除")
|
|
|
+// @RequestMapping(value = "/point/delete", method = RequestMethod.POST)
|
|
|
+// @ApiResponses({@ApiResponse(code = 200, message = "得分点删除", response = EditResult.class)})
|
|
|
+// @Transactional
|
|
|
+// public Result pointDelete(@ApiParam(value = "主键", required = true) @RequestParam Long pointId) {
|
|
|
+// return ResultUtil.ok(markAiQuestionPointService.removeById(pointId));
|
|
|
+// }
|
|
|
+//
|
|
|
+// @ApiOperation(value = "AI评卷参数档次删除")
|
|
|
+// @RequestMapping(value = "/level/delete", method = RequestMethod.POST)
|
|
|
+// @ApiResponses({@ApiResponse(code = 200, message = "档次删除", response = EditResult.class)})
|
|
|
+// @Transactional
|
|
|
+// public Result levelDelete(@ApiParam(value = "主键", required = true) @RequestParam Long levelId) {
|
|
|
+// return ResultUtil.ok(markAiQuestionLevelService.removeById(levelId));
|
|
|
+// }
|
|
|
}
|