|
@@ -7,12 +7,14 @@ import com.qmth.teachcloud.common.bean.params.BasicSemesterParams;
|
|
|
import com.qmth.teachcloud.common.contant.SystemConstant;
|
|
|
import com.qmth.teachcloud.common.entity.BasicSchool;
|
|
|
import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
|
|
|
+import com.qmth.teachcloud.common.service.BasicCourseService;
|
|
|
import com.qmth.teachcloud.common.service.BasicSemesterService;
|
|
|
import com.qmth.teachcloud.common.util.AuthThirdUtil;
|
|
|
import com.qmth.teachcloud.common.util.JacksonUtil;
|
|
|
import com.qmth.teachcloud.common.util.Result;
|
|
|
import com.qmth.teachcloud.common.util.ResultUtil;
|
|
|
import com.qmth.teachcloud.report.business.bean.params.TBExamParam;
|
|
|
+import com.qmth.teachcloud.report.business.service.TBExamCourseService;
|
|
|
import com.qmth.teachcloud.report.business.service.TBExamService;
|
|
|
import io.swagger.annotations.*;
|
|
|
import org.slf4j.Logger;
|
|
@@ -26,7 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import javax.annotation.Resource;
|
|
|
import java.io.IOException;
|
|
|
import java.net.URLDecoder;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.Optional;
|
|
|
|
|
|
|
|
|
* <p>
|
|
@@ -49,20 +51,22 @@ public class OpenApiController {
|
|
|
@Resource
|
|
|
TBExamService tbExamService;
|
|
|
|
|
|
+ @Resource
|
|
|
+ BasicCourseService basicCourseService;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ TBExamCourseService tbExamCourseService;
|
|
|
+
|
|
|
@ApiOperation(value = "学期创建/更新接口")
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "学期创建/更新接口", response = Object.class)})
|
|
|
@RequestMapping(value = "/semester_edit", method = RequestMethod.POST)
|
|
|
@Aac(auth = BOOL.FALSE)
|
|
|
public Result semesterEdit(@ApiParam(value = "接收学期数据信息", required = true) @RequestBody String result) throws IOException, InterruptedException, IllegalAccessException {
|
|
|
- if (Objects.isNull(result)) {
|
|
|
- throw ExceptionResultEnum.PARAMS_ERROR.exception("数据为空");
|
|
|
- }
|
|
|
+ Optional.ofNullable(result).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("数据为空"));
|
|
|
String decodeJson = URLDecoder.decode(result, SystemConstant.CHARSET_NAME);
|
|
|
log.info("semesterEdit进来了,result:{}", decodeJson);
|
|
|
BasicSemesterParams basicSemesterParams = JacksonUtil.readJson(decodeJson, BasicSemesterParams.class);
|
|
|
- if (Objects.isNull(basicSemesterParams)) {
|
|
|
- throw ExceptionResultEnum.PARAMS_ERROR.exception("转换后的数据为空");
|
|
|
- }
|
|
|
+ Optional.ofNullable(basicSemesterParams).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("转换后的数据为空"));
|
|
|
basicSemesterParams.validParams();
|
|
|
BasicSchool basicSchool = AuthThirdUtil.hasPermission();
|
|
|
return ResultUtil.ok(basicSemesterService.saveBasicSemesterCommon(basicSemesterParams, basicSchool.getId(), null));
|
|
@@ -73,15 +77,11 @@ public class OpenApiController {
|
|
|
@RequestMapping(value = "/exam_edit", method = RequestMethod.POST)
|
|
|
@Aac(auth = BOOL.FALSE)
|
|
|
public Result examEdit(@ApiParam(value = "接收考试数据信息", required = true) @RequestBody String result) throws IOException, InterruptedException {
|
|
|
- if (Objects.isNull(result)) {
|
|
|
- throw ExceptionResultEnum.PARAMS_ERROR.exception("数据为空");
|
|
|
- }
|
|
|
+ Optional.ofNullable(result).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("数据为空"));
|
|
|
String decodeJson = URLDecoder.decode(result, SystemConstant.CHARSET_NAME);
|
|
|
log.info("examEdit进来了,result:{}", decodeJson);
|
|
|
TBExamParam tbExamParam = JacksonUtil.readJson(decodeJson, TBExamParam.class);
|
|
|
- if (Objects.isNull(tbExamParam)) {
|
|
|
- throw ExceptionResultEnum.PARAMS_ERROR.exception("转换后的数据为空");
|
|
|
- }
|
|
|
+ Optional.ofNullable(tbExamParam).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("转换后的数据为空"));
|
|
|
tbExamParam.validParams();
|
|
|
BasicSchool basicSchool = AuthThirdUtil.hasPermission();
|
|
|
tbExamParam.setSchoolId(basicSchool.getId());
|
|
@@ -92,7 +92,12 @@ public class OpenApiController {
|
|
|
@ApiResponses({@ApiResponse(code = 200, message = "分析课程(试卷)创建/更新接口", response = Object.class)})
|
|
|
@RequestMapping(value = "/course_edit", method = RequestMethod.POST)
|
|
|
public Result courseEdit(@ApiParam(value = "接收分析课程(试卷)数据信息", required = true) @RequestBody String result) throws IOException, InterruptedException {
|
|
|
- log.info("courseEdit进来了,result:{}", result);
|
|
|
+ Optional.ofNullable(result).orElseThrow(() -> ExceptionResultEnum.PARAMS_ERROR.exception("数据为空"));
|
|
|
+ String decodeJson = URLDecoder.decode(result, SystemConstant.CHARSET_NAME);
|
|
|
+ log.info("courseEdit进来了进来了,result:{}", decodeJson);
|
|
|
+ BasicSchool basicSchool = AuthThirdUtil.hasPermission();
|
|
|
+
|
|
|
+
|
|
|
return ResultUtil.ok(true);
|
|
|
}
|
|
|
|