Merge remote-tracking branch 'origin/master'

master
xiaoCJ 8 months ago
commit dc4b52ab3f

@ -60,8 +60,8 @@ public class ObjectiveApi {
*/ */
@AnonymousAccess @AnonymousAccess
@ApiOperation("新增单个试题") //新增 题干不允许重复 @ApiOperation("新增单个试题") //新增 题干不允许重复
@PostMapping("addTopic") @PostMapping("insertObjective")
private Boolean addTopic(@RequestBody SysObjectiveQuestionsDto objectiveQuestion) { private Boolean insertObjective(@RequestBody SysObjectiveQuestionsDto objectiveQuestion) {
if (StringUtils.isBlank(objectiveQuestion.getContent())) { if (StringUtils.isBlank(objectiveQuestion.getContent())) {
return false; return false;
} }
@ -141,9 +141,9 @@ public class ObjectiveApi {
List<String> ids = new ArrayList<>(); List<String> ids = new ArrayList<>();
for (SysObjectiveQuestions sysObjectiveQuestion : sysObjectiveQuestions) { for (SysObjectiveQuestions sysObjectiveQuestion : sysObjectiveQuestions) {
if (sysObjectiveQuestion.getSource().equals(schoolId)) { if (sysObjectiveQuestion.getSource().equals(schoolId)) {
continue;
} else {
ids.add(sysObjectiveQuestion.getObjectiveId()); ids.add(sysObjectiveQuestion.getObjectiveId());
} else {
continue;
} }
} }
try { try {
@ -162,16 +162,16 @@ public class ObjectiveApi {
*/ */
@AnonymousAccess @AnonymousAccess
@ApiOperation("课程配置/题目条件查询") @ApiOperation("课程配置/题目条件查询")
@PostMapping("getTopicByConfig") //todo 关于老师删除的题库如何查询 @PostMapping("selectObjectiveList") //todo 关于老师删除的题库如何查询
private PageInfo<SysObjectiveQuestionsDto> getTopicByConfig(@RequestParam Integer index, private PageInfo<SysObjectiveQuestionsDto> selectObjectiveList(@RequestParam Integer index,
@RequestParam Integer size, @RequestParam Integer size,
@RequestParam(required = false) String courseId, @RequestParam(required = false) String courseId,
@RequestParam(required = false) String threeID, @RequestParam(required = false) String chapterId,
@RequestParam(required = false) String type, @RequestParam(required = false) String type,
@RequestParam String schoolId, @RequestParam String schoolId,
@ApiParam("题干") @RequestParam(required = false) String content) { @ApiParam("题干") @RequestParam(required = false) String content) {
PageHelper.startPage(index, size); PageHelper.startPage(index, size);
List<SysObjectiveQuestionsDto> list = sysObjectiveQuestionMapper.getTopicByConfig(null, courseId, threeID, type, schoolId, content); List<SysObjectiveQuestionsDto> list = sysObjectiveQuestionMapper.getTopicByConfig(null, courseId, chapterId, type, schoolId, content);
PageInfo<SysObjectiveQuestionsDto> pageInfo = new PageInfo(list); PageInfo<SysObjectiveQuestionsDto> pageInfo = new PageInfo(list);
return (pageInfo); return (pageInfo);
} }
@ -185,7 +185,7 @@ public class ObjectiveApi {
@AnonymousAccess @AnonymousAccess
@ApiOperation("客观题单个详情查看") @ApiOperation("客观题单个详情查看")
@PostMapping("selectObjectiveDetails") @PostMapping("selectObjectiveDetails")
private SysObjectiveQuestions getById(@RequestParam String objectiveId) { private SysObjectiveQuestions selectObjectiveDetails(@RequestParam String objectiveId) {
SysObjectiveQuestions sysObjectiveQuestions = sysObjectiveQuestionMapper.selectByPrimaryKey(objectiveId); SysObjectiveQuestions sysObjectiveQuestions = sysObjectiveQuestionMapper.selectByPrimaryKey(objectiveId);
return sysObjectiveQuestions; return sysObjectiveQuestions;
} }
@ -196,7 +196,7 @@ public class ObjectiveApi {
* response * response
* return:void * return:void
*/ */
@GetMapping("downloadResource") @PostMapping("downloadResource")
@ApiOperation("客观题导入模板下载") @ApiOperation("客观题导入模板下载")
@AnonymousAccess @AnonymousAccess
public void downloadResource(HttpServletResponse response) { public void downloadResource(HttpServletResponse response) {
@ -211,7 +211,7 @@ public class ObjectiveApi {
*/ */
@AnonymousAccess @AnonymousAccess
@ApiOperation("本地excel导入试题") @ApiOperation("本地excel导入试题")
@PostMapping("importTopicByLocal") @PostMapping("insertObjectiveByExcel")
private Boolean importTopicByLocal(@RequestParam MultipartFile file, private Boolean importTopicByLocal(@RequestParam MultipartFile file,
@RequestParam String schoolId) throws IOException, InvalidFormatException { @RequestParam String schoolId) throws IOException, InvalidFormatException {
if (file == null) { if (file == null) {

@ -0,0 +1,39 @@
package com.sztzjy.resource_center.controller.api;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@Api(tags = "资源方面API")
@RequestMapping("api/tea/ResourceApi")
public class ResourceApi {
/**
*
* uploadResource
* MultipartFile schoolId courseId resourceType systemOwner
* return: boolean
*/
/**
*
* selectResource
* schoolId twoId oneId
* return: List<SysResource>
*/
/**
*
* selectResourceByChapterId
* threeId oneId
* return: List<SysResource>
*/
/**
*
* downloadResource
* resourceDataName resourceId response
* return: void
* method GET
*/
}

@ -1,5 +1,6 @@
package com.sztzjy.resource_center.controller.api; package com.sztzjy.resource_center.controller.api;
import cn.hutool.core.util.CharsetUtil;
import com.sztzjy.resource_center.annotation.AnonymousAccess; import com.sztzjy.resource_center.annotation.AnonymousAccess;
import com.sztzjy.resource_center.entity.SysCaseQuestion; import com.sztzjy.resource_center.entity.SysCaseQuestion;
import com.sztzjy.resource_center.entity.SysResourceData; import com.sztzjy.resource_center.entity.SysResourceData;
@ -11,13 +12,20 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.BufferedInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
@ -32,8 +40,6 @@ public class ResourceDataApi {
private SysCaseQuestionMapper caseQuestionMapper; private SysCaseQuestionMapper caseQuestionMapper;
@Autowired @Autowired
IFileUtil fileUtil; IFileUtil fileUtil;
@Value("${file.path}")
private String filePath;
/** /**
@ -113,16 +119,14 @@ public class ResourceDataApi {
*/ */
@AnonymousAccess @AnonymousAccess
@ApiOperation("数据集下载") @ApiOperation("数据集下载")
@PostMapping("downloadResourceData") @GetMapping("downloadResourceData")
private Boolean selectResourceDataList(@RequestParam String resourceId, private void selectResourceDataList(@RequestParam String resourceId,
HttpServletResponse response) { HttpServletResponse response) {
try { try {
SysResourceData sysResourceData = sysResourceDataMapper.selectByPrimaryKey(resourceId); SysResourceData sysResourceData = sysResourceDataMapper.selectByPrimaryKey(resourceId);
String resourceName = sysResourceData.getResourceName(); String resourceName = sysResourceData.getResourceName();
fileUtil.download(response,resourceName ,sysResourceData.getUrl()); fileUtil.download(response, resourceName, sysResourceData.getUrl());
} catch (Exception e) { } catch (Exception e) {
return false;
} }
return true;
} }
} }

Loading…
Cancel
Save