新增三方接口

master
xiaoCJ 8 months ago
parent 6362ec1712
commit 4a4d913e13

@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors;
@RestController @RestController
@Api(tags = "案例题方面API") @Api(tags = "案例题方面API")
@ -265,12 +266,22 @@ public class CaseApi {
} }
/** /**
* IdList * IdList
* selectCaseByChapterIdList * selectCaseByChapterIdList
* List<String> chapterIdList * List<String> chapterIdList
* return:List<SysCaseQuestion> * return:List<SysCaseQuestion>
*/ */
@PostMapping("selectCaseByChapterIdList")
@ApiOperation("根据章节IdList查询案例题")
public List<SysCaseQuestion> selectCaseByChapterIdList(@RequestParam List<String> chapterIdList) {
SysTopicAndCourseExample example = new SysTopicAndCourseExample();
example.createCriteria().andThreeIdIn(chapterIdList);
List<SysTopicAndCourse> sysTopicAndCourses = topicAndCourseMapper.selectByExample(example);
List<String> idList = sysTopicAndCourses.stream().map(SysTopicAndCourse::getTopicId).collect(Collectors.toList());
SysCaseQuestionExample sysCaseQuestionExample = new SysCaseQuestionExample();
sysCaseQuestionExample.createCriteria().andCaseIdIn(idList);
return caseQuestionMapper.selectByExampleWithBLOBs(sysCaseQuestionExample);
}
} }

@ -49,7 +49,7 @@ public class CourseApi {
@PostMapping("selectThreeCatalogListByTwoId") @PostMapping("selectThreeCatalogListByTwoId")
@ApiOperation("根据二级目录ID查寻所有三级目录信息") @ApiOperation("根据二级目录ID查寻所有三级目录信息")
@AnonymousAccess @AnonymousAccess
public List<SysThreeCatalog> selectChapterByCourseId(@RequestParam String twoId,@RequestParam String schoolId) { public List<SysThreeCatalog> selectChapterByCourseId(@RequestParam String twoId, @RequestParam String schoolId) {
SysThreeCatalogExample example = new SysThreeCatalogExample(); SysThreeCatalogExample example = new SysThreeCatalogExample();
ArrayList<String> list = new ArrayList<>(); ArrayList<String> list = new ArrayList<>();
list.add(schoolId); list.add(schoolId);
@ -146,6 +146,18 @@ public class CourseApi {
* systemOwner * systemOwner
* return:List<SysTwoCatalog> * return:List<SysTwoCatalog>
*/ */
@AnonymousAccess
@ApiOperation("获取内置课程 并排序ASC")
@PostMapping("selectTwoCataLogByInnerAndAsc")
public List<SysTwoCatalog> selectTwoCataLogByInnerAndAsc(@RequestParam String systemOwner) {
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
String oneId = sysOneCatalogs.getOneId();
SysTwoCatalogExample example = new SysTwoCatalogExample();
example.createCriteria().andOneIdEqualTo(oneId).andCreatorEqualTo("管理员");
example.setOrderByClause("sort");
List<SysTwoCatalog> sysTwoCatalogs = twoCatalogMapper.selectByExample(example);
return sysTwoCatalogs;
}
/** /**
* IDList * IDList
@ -153,6 +165,16 @@ public class CourseApi {
* List<String> courseIds * List<String> courseIds
* return:List<SysThreeCatalog> * return:List<SysThreeCatalog>
*/ */
@AnonymousAccess
@ApiOperation("根据课程IDList查询章节集合并排序")
@PostMapping("selectChaptersByCourseIdsAndAsc")
public List<SysThreeCatalog> selectChaptersByCourseIdsAndAsc(@RequestParam List<String> courseIds) {
SysThreeCatalogExample example = new SysThreeCatalogExample();
example.createCriteria().andTwoIdIn(courseIds);
example.setOrderByClause("sort");
return threeCatalogMapper.selectByExample(example);
}
/** /**
* *
@ -160,7 +182,14 @@ public class CourseApi {
* systemOwner * systemOwner
* return:Integer * return:Integer
*/ */
@AnonymousAccess
@ApiOperation("查询总章节数量")
@PostMapping("getTotalChapterCount")
public Integer getTotalChapterCount(String systemOwner) {
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
String oneId = sysOneCatalogs.getOneId();
return threeCatalogMapper.countByOneId(oneId);
}
/** /**
* ID * ID
* selectChapterByChapterId * selectChapterByChapterId

@ -2,10 +2,7 @@ package com.sztzjy.resource_center.controller.api;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.sztzjy.resource_center.annotation.AnonymousAccess; import com.sztzjy.resource_center.annotation.AnonymousAccess;
import com.sztzjy.resource_center.entity.SysOneCatalog; import com.sztzjy.resource_center.entity.*;
import com.sztzjy.resource_center.entity.SysOneCatalogExample;
import com.sztzjy.resource_center.entity.SysResource;
import com.sztzjy.resource_center.entity.SysResourceAndCourse;
import com.sztzjy.resource_center.entity.dto.SysResourceDto; import com.sztzjy.resource_center.entity.dto.SysResourceDto;
import com.sztzjy.resource_center.mapper.SysCaseQuestionMapper; import com.sztzjy.resource_center.mapper.SysCaseQuestionMapper;
import com.sztzjy.resource_center.mapper.SysOneCatalogMapper; import com.sztzjy.resource_center.mapper.SysOneCatalogMapper;
@ -21,8 +18,11 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@RestController @RestController
@Api(tags = "资源方面API") @Api(tags = "资源方面API")
@ -151,6 +151,19 @@ public class ResourceApi {
* schoolId systemOwner * schoolId systemOwner
* return: Map<String,Integer> 121 * return: Map<String,Integer> 121
*/ */
@AnonymousAccess
@ApiOperation("获取资源类型数量")
@PostMapping("getResourceTypeCount")
public Map<String, Integer> getResourceTypeCount(@RequestParam String systemOwner,
@RequestParam String schoolId) {
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
SysResourceAndCourseExample example = new SysResourceAndCourseExample();
example.createCriteria().andOneIdEqualTo(sysOneCatalogs.getOneId());
List<SysResourceAndCourse> sysResourceAndCourses = sysResourceAndCourseMapper.selectByExample(example);
List<String> ids = sysResourceAndCourses.stream().map(SysResourceAndCourse::getResourceId).collect(Collectors.toList());
return sysResourceMapper.getCountByType(ids, schoolId);
}
/** /**
* *
@ -158,6 +171,24 @@ public class ResourceApi {
* systemOwner schoolId * systemOwner schoolId
* return: Integer * return: Integer
*/ */
@AnonymousAccess
@ApiOperation("获取该系统下 学校上传和内置的全部资源数量")
@PostMapping("getTotalResource")
public Integer getTotalResource(@RequestParam String systemOwner,
@RequestParam String schoolId) {
SysOneCatalog sysOneCatalogs = getSysOneCatalogs(systemOwner);
SysResourceAndCourseExample example = new SysResourceAndCourseExample();
example.createCriteria().andOneIdEqualTo(sysOneCatalogs.getOneId());
List<SysResourceAndCourse> sysResourceAndCourses = sysResourceAndCourseMapper.selectByExample(example);
List<String> ids = sysResourceAndCourses.stream().map(SysResourceAndCourse::getResourceId).collect(Collectors.toList());
List<String> list = Arrays.asList(schoolId, "管理员");
SysResourceExample example1 = new SysResourceExample();
example1.createCriteria().andResourceIdIn(ids).andResourceIdIn(list);
List<SysResource> sysResources = sysResourceMapper.selectByExample(example1);
return sysResources.size();
}
/** /**
* *

@ -51,7 +51,7 @@ public class AdminDataController {
@Transactional @Transactional
ResultEntity<String> add(@RequestParam String adminDataDtoJSON, ResultEntity<String> add(@RequestParam String adminDataDtoJSON,
@RequestParam MultipartFile pictureFile, @RequestParam MultipartFile pictureFile,
@RequestParam List<MultipartFile> dataFile) { @RequestParam(required = false) List<MultipartFile> dataFile) {
Gson gson = new Gson(); Gson gson = new Gson();
AdminDataDto adminDataDto = null; AdminDataDto adminDataDto = null;
try { try {
@ -212,12 +212,22 @@ public class AdminDataController {
// return new ResultEntity<>(HttpStatus.OK,"编辑成功!"); // return new ResultEntity<>(HttpStatus.OK,"编辑成功!");
// } // }
@PostMapping("updateAdminData") @PostMapping("updateAdminData")
@ApiOperation("编辑") @ApiOperation("编辑")
@AnonymousAccess @AnonymousAccess
@Transactional @Transactional
ResultEntity<String> updateAdminData(@RequestBody AdminDataDto adminDataDto, ResultEntity<String> updateAdminData(@RequestParam String adminDataDtoJSON,
@RequestParam MultipartFile pictureFile) { @RequestParam(required = false) MultipartFile pictureFile,
@RequestPart List<FileData> fileDataList) {
Gson gson = new Gson();
AdminDataDto adminDataDto = null;
try {
adminDataDto = gson.fromJson(adminDataDtoJSON, AdminDataDto.class);
} catch (JsonSyntaxException e) {
e.printStackTrace();
return new ResultEntity<>(HttpStatus.INTERNAL_SERVER_ERROR, "服务器错误,请联系管理员");
}
//新增 //新增
try { try {
AdminDataWithBLOBs adminDataWithBLOBs = adminDataMapper.selectByPrimaryKey(adminDataDto.getDataId()); AdminDataWithBLOBs adminDataWithBLOBs = adminDataMapper.selectByPrimaryKey(adminDataDto.getDataId());
@ -243,9 +253,7 @@ public class AdminDataController {
} }
// 文件数据并行处理 // 文件数据并行处理
if (adminDataDto.getFileDataList() != null && !adminDataDto.getFileDataList().isEmpty()) { if (fileDataList != null && !fileDataList.isEmpty()) {
List<FileData> fileDataList = adminDataDto.getFileDataList();
// 并行上传文件 // 并行上传文件
fileDataList.parallelStream().forEach(fileData -> { fileDataList.parallelStream().forEach(fileData -> {
if (fileData.getFile() != null && fileData.getFileId() != null) { if (fileData.getFile() != null && fileData.getFileId() != null) {

@ -16,6 +16,4 @@ import java.util.Map;
public class AdminDataDto extends AdminDataWithBLOBs { public class AdminDataDto extends AdminDataWithBLOBs {
@ApiModelProperty("标签集合") @ApiModelProperty("标签集合")
private List<AdminLabel> adminLabelList; private List<AdminLabel> adminLabelList;
@ApiModelProperty("编辑时传")
private List<FileData> fileDataList;
} }

@ -4,6 +4,7 @@ import com.sztzjy.resource_center.entity.SysResource;
import com.sztzjy.resource_center.entity.SysResourceExample; import com.sztzjy.resource_center.entity.SysResourceExample;
import java.util.List; import java.util.List;
import java.util.Map;
import com.sztzjy.resource_center.entity.dto.SysResourceDto; import com.sztzjy.resource_center.entity.dto.SysResourceDto;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -44,4 +45,5 @@ public interface SysResourceMapper {
@Param("threeId") String threeId, @Param("threeId") String threeId,
@Param("resourceName") String resourceName); @Param("resourceName") String resourceName);
Map<String, Integer> getCountByType(@Param("list") List<String> ids,@Param("schoolId") String schoolId);
} }

@ -36,4 +36,7 @@ public interface SysThreeCatalogMapper {
List<Map<String, String>> getAllThreeCatalogList(@Param("oneId")String oneId, @Param("twoId")String twoId); List<Map<String, String>> getAllThreeCatalogList(@Param("oneId")String oneId, @Param("twoId")String twoId);
void updateByBatch(@Param("sysThreeCatalogs") List<SysThreeCatalog> sysThreeCatalogs); void updateByBatch(@Param("sysThreeCatalogs") List<SysThreeCatalog> sysThreeCatalogs);
@Select("select count(*) from sys_three_catalog where ont_id = #{oneId}")
Integer countByOneId(@Param("oneId") String oneId);
} }

@ -421,4 +421,16 @@
</where> </where>
order by sr.create_time order by sr.create_time
</select> </select>
<select id="getCountByType" resultType="map">
SELECT resource_type, count(*) as count
FROM sys_resource
WHERE resource_id IN
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">
#{item}
</foreach>
AND source = #{schoolId}
GROUP BY resource_type
</select>
</mapper> </mapper>
Loading…
Cancel
Save