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