增加资源模块需求

master
yz 8 months ago
parent 8403d560ea
commit a7ca0e125c

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

@ -0,0 +1,38 @@
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
*/
}

@ -1,5 +1,6 @@
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.entity.SysCaseQuestion;
import com.sztzjy.resource_center.entity.SysResourceData;
@ -11,13 +12,20 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.ServletOutputStream;
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.UUID;
@ -32,8 +40,6 @@ public class ResourceDataApi {
private SysCaseQuestionMapper caseQuestionMapper;
@Autowired
IFileUtil fileUtil;
@Value("${file.path}")
private String filePath;
/**
@ -113,16 +119,14 @@ public class ResourceDataApi {
*/
@AnonymousAccess
@ApiOperation("数据集下载")
@PostMapping("downloadResourceData")
private Boolean selectResourceDataList(@RequestParam String resourceId,
@GetMapping("downloadResourceData")
private void selectResourceDataList(@RequestParam String resourceId,
HttpServletResponse response) {
try {
SysResourceData sysResourceData = sysResourceDataMapper.selectByPrimaryKey(resourceId);
String resourceName = sysResourceData.getResourceName();
fileUtil.download(response, resourceName, sysResourceData.getUrl());
} catch (Exception e) {
return false;
}
return true;
}
}

Loading…
Cancel
Save