章节修改double 完善知识点

master
youahng 3 months ago committed by yh
parent 23a31c3a51
commit 372e0c84c9
  1. 1
      docs/文档说明.md
  2. 13
      src/main/java/com/teaching/backend/controller/Know/KnowController.java
  3. 2
      src/main/java/com/teaching/backend/controller/records/Bf.java
  4. 6
      src/main/java/com/teaching/backend/controller/resource/ResourceController.java
  5. 8
      src/main/java/com/teaching/backend/mapper/know/KnowRepository.java
  6. 6
      src/main/java/com/teaching/backend/model/dto/Know/KnowChapterCreateRequest.java
  7. 3
      src/main/java/com/teaching/backend/model/dto/Know/KnowCourseCreateRequest.java
  8. 1
      src/main/java/com/teaching/backend/model/dto/Knowtmp/KnowtempAdd.java
  9. 1
      src/main/java/com/teaching/backend/model/dto/Knowtmp/KnowtempUpdate.java
  10. 2
      src/main/java/com/teaching/backend/model/dto/chapter/ChapterDTO.java
  11. 2
      src/main/java/com/teaching/backend/model/entity/chapter/Chapter.java
  12. 6
      src/main/java/com/teaching/backend/model/entity/know/Know.java
  13. 5
      src/main/java/com/teaching/backend/model/entity/know/KnowChapter.java
  14. 1
      src/main/java/com/teaching/backend/model/entity/know/KnowCourse.java
  15. 4
      src/main/java/com/teaching/backend/model/entity/knowtmp/Knowtmp.java
  16. 5
      src/main/java/com/teaching/backend/service/Know/KnowService.java
  17. 8
      src/main/java/com/teaching/backend/service/impl/chapter/ChapterServiceImpl.java
  18. 4
      src/main/java/com/teaching/backend/service/impl/courses/CoursesServiceImpl.java
  19. 20
      src/main/java/com/teaching/backend/service/impl/know/knowServiceImpl.java
  20. 12
      src/main/java/com/teaching/backend/service/impl/resource/ResourceServiceImpl.java
  21. 6
      src/main/java/com/teaching/backend/service/resource/ResourceService.java
  22. 2
      src/main/java/com/teaching/backend/utils/MinioUtils.java

@ -33,3 +33,4 @@ http://39.106.16.162:7474/
用户名 neo4j
密码123456

@ -124,20 +124,9 @@ public class KnowController {
//获取课程下的所有知识点
@GetMapping("/getAllKnowByCourseId")
BaseKnowReturn getAllKnowByCourseId(@RequestParam String id){
BaseResponse<BaseKnowReturn> getAllKnowByCourseId(@RequestParam String id){
return knowService.getAllKnowByCourseId(id);
}
//获取课程下的所有资源
@GetMapping("/getAllResourcesByCourseId")
BaseResponse<Set<KnowVO1>> getAllResourcesByCourseId(@RequestParam String id){
return knowService.getAllResourcesByCourseId(id);
}
//获取知识点下二级的所有资源
@GetMapping("/getSecondResources")
Set<Resources> getSecondResources(@RequestParam Long id){
return knowService.getSecondResources(id);
}
}

@ -8,7 +8,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;
import java.io.OutputStream;
import java.util.AbstractCollection;
@RestController
@RequestMapping("/api/bf")
public class Bf {

@ -62,19 +62,19 @@ public class ResourceController {
//查询课程下资源
@GetMapping("/queryByCourseId")
Set<Resources> queryResourcesByCourseId(String courseId){
BaseResponse<Set<Resources>> queryResourcesByCourseId(@RequestParam String courseId){
return resourceService.queryResourcesByCourseId(courseId);
}
//查询章节下资源
@GetMapping("/queryByChapterId")
Set<Resources> queryResourcesByChapterId(Long chapterId){
BaseResponse<Set<Resources>> queryResourcesByChapterId(@RequestParam Long chapterId){
return resourceService.queryResourcesByChapterId(chapterId);
}
//查询二级节点下资源
@GetMapping("/queryBesidesKnow")
Set<Resources> queryBesidesKnowToResources(Long KnowId){
BaseResponse<Set<Resources>> queryBesidesKnowToResources(@RequestParam Long KnowId){
return resourceService.queryBesidesKnowToResources(KnowId);
}

@ -36,8 +36,8 @@ public interface KnowRepository extends Neo4jRepository<Know, Long> {
//=============================
@Query("CREATE (n:Know {name: $name, courseId: $courseId,info:$info}) return count(n)")
int addCourse(String courseId, String name, String info);
@Query("CREATE (n:Know {name: $name, courseId: $courseId,info:$info,hour:$hour}) return count(n)")
int addCourse(String courseId, String name, String info,double hour);
@Query("MATCH (p:Know {courseId:$courseId }) SET p.name = $name set p.info= $info RETURN count(p);")
int updateCourse(String courseId, String name, String info);
@ -50,8 +50,8 @@ public interface KnowRepository extends Neo4jRepository<Know, Long> {
//====================
@Query("CREATE (n:Know {name: $name, chapterId:$chapterId,info:$info}) return count(n)")
int addChapter(Long chapterId, String name, String info);
@Query("CREATE (n:Know {name: $name, chapterId:$chapterId,info:$info,hour:$hour}) return count(n)")
int addChapter(Long chapterId, String name, String info,double hour);
@Query("MATCH (p:Know {chapterId:$chapterId }) SET p.name = $name set p.info= $info RETURN count(p);")
int updateChapter(Long chapterId, String name, String info);

@ -23,6 +23,12 @@ public class KnowChapterCreateRequest implements Serializable {
private String info;
/**
* 学时
*/
private double hour;
}

@ -23,6 +23,9 @@ public class KnowCourseCreateRequest implements Serializable {
private String info;
private double hour;

@ -23,6 +23,7 @@ public class KnowtempAdd implements Serializable {
private Integer ordernum;
private double hour;
}

@ -24,6 +24,7 @@ public class KnowtempUpdate implements Serializable {
private Long chapterid;
private Integer ordernum;
private double hour;
}

@ -62,7 +62,7 @@ public class ChapterDTO implements Serializable {
private String courseObjectivesId;
@ApiModelProperty(value = "总学时")
private String totalClassHours;
private double totalClassHours;
@ApiModelProperty(value = "要求")
private String requirement;

@ -70,7 +70,7 @@ public class Chapter implements Serializable {
private String courseObjectivesId;
@ApiModelProperty(value = "总学时")
private String totalClassHours;
private double totalClassHours;
@ApiModelProperty(value = "要求")
private String requirement;

@ -31,5 +31,11 @@ public class Know implements Serializable {
@Property
private String info;
/**
* 学时
*/
@Property
private double hour;
}

@ -37,6 +37,11 @@ public class KnowChapter implements Serializable {
*/
private String info;
/**
* 学时
*/
private double hour;
}

@ -35,6 +35,7 @@ public class KnowCourse implements Serializable {
* 信息
*/
private String info;
private double hour;

@ -3,6 +3,7 @@ package com.teaching.backend.model.entity.knowtmp;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
@ -16,6 +17,7 @@ import java.io.Serializable;
* @since 2024-05-31
*/
@Data
@TableName(value = "knowtmp")
public class Knowtmp implements Serializable {
@TableField(exist = false)
@ -32,5 +34,7 @@ public class Knowtmp implements Serializable {
private Long chapterid;
private double hour;
}

@ -72,13 +72,12 @@ public interface KnowService {
//=====================
//获取课程下的所有知识点
BaseKnowReturn getAllKnowByCourseId(String id);
BaseResponse<BaseKnowReturn> getAllKnowByCourseId(String id);
//获取课程下的所有资源
BaseResponse<Set<KnowVO1>> getAllResourcesByCourseId(String id);
//获取知识点下二级的所有资源
Set<Resources> getSecondResources(Long id);
}

@ -445,17 +445,17 @@ public class ChapterServiceImpl extends ServiceImpl<ChapterMapper, Chapter> impl
List<Chapter> subChapters = chapterMapper.selectByIdAndPid(chapterId, courseId);
BigDecimal totalClassHours = BigDecimal.ZERO;
double totalClassHours = 0.0;
for (Chapter subChapter : subChapters) {
try {
BigDecimal classHours = new BigDecimal(subChapter.getTotalClassHours());
totalClassHours = totalClassHours.add(classHours);
double classHours = subChapter.getTotalClassHours();
totalClassHours = totalClassHours+classHours;
} catch (NumberFormatException e) {
throw new BusinessException(ErrorCode.OPERATION_ERROR, "无效的总学时数据");
}
}
chapter.setTotalClassHours(String.valueOf(totalClassHours));
chapter.setTotalClassHours(totalClassHours);
} else {
chapter.setTotalClassHours(chapter.getTotalClassHours());
}

@ -411,8 +411,8 @@ public class CoursesServiceImpl extends ServiceImpl<CoursesMapper, Courses> impl
List<Chapter> list = chapterMapper.selectList(wrapper);
int total=0;
for (Chapter sum: list){
String totalclasshours = sum.getTotalClassHours();
total= total+Integer.parseInt(totalclasshours);
double totalclasshours = sum.getTotalClassHours();
total= total+(int) totalclasshours;
}
// System.out.println(size);
return total;

@ -85,7 +85,7 @@ public class knowServiceImpl implements KnowService {
public void addAllKnowTransation(String courseId) throws Exception{
// 2.从课程表查出课程节点 并添加到 neo
Courses courses = coursesMapper.selectById(courseId);
int f = knowRepository.addCourse(courseId,courses.getName(),courses.getDescription());
int f = knowRepository.addCourse(courseId,courses.getName(),courses.getDescription(),courses.getClasshours());
if(f <= 0){
throw new RuntimeException("添加课程失败");
}
@ -93,7 +93,7 @@ public class knowServiceImpl implements KnowService {
List<Chapter> chapterList = chapterMapper.selectSectionsByCourseId(courseId);
for (int i = 0; i < chapterList.size(); i++) {
Chapter chapter = chapterList.get(i);
f =knowRepository.addChapter(chapter.getId(),chapter.getName(),chapter.getContent());
f =knowRepository.addChapter(chapter.getId(),chapter.getName(),chapter.getContent(),chapter.getTotalClassHours());
if(f <= 0){
throw new RuntimeException("添加章节失败");
}
@ -187,7 +187,7 @@ public class knowServiceImpl implements KnowService {
public BaseResponse<String> addCourse(KnowCourseCreateRequest knowCourseCreateRequest) {
KnowCourse knowCourse = new KnowCourse();
BeanUtils.copyProperties(knowCourseCreateRequest,knowCourse);
int f = knowRepository.addCourse(knowCourse.getCourseId(),knowCourse.getName(),knowCourse.getInfo());
int f = knowRepository.addCourse(knowCourse.getCourseId(),knowCourse.getName(),knowCourse.getInfo(),knowCourse.getHour());
if(f >0){
return ResultUtils.success("添加知识点成功");
}else{
@ -232,7 +232,7 @@ public class knowServiceImpl implements KnowService {
public BaseResponse<String> addChapter(KnowChapterCreateRequest knowChapterCreateRequest) {
KnowChapter knowChapter = new KnowChapter();
BeanUtils.copyProperties(knowChapterCreateRequest,knowChapter);
int f = knowRepository.addChapter(knowChapter.getChapterId(),knowChapter.getName(),knowChapter.getInfo());
int f = knowRepository.addChapter(knowChapter.getChapterId(),knowChapter.getName(),knowChapter.getInfo(),knowChapter.getHour());
if(f>0){
return ResultUtils.success("添加章节成功");
}else{
@ -272,7 +272,7 @@ public class knowServiceImpl implements KnowService {
//获取课程下的所有知识点
@Override
public BaseKnowReturn getAllKnowByCourseId(String id) {
public BaseResponse<BaseKnowReturn> getAllKnowByCourseId(String id) {
Collection<Map<String, Object>> all =
neo4jClient.query( "match(n:Know)-[r*0..]->(p:Know) where n.courseId = '"+id+"' return n as `n`,r as `r`,p as `p`,length(r) as `d`").fetch().all();
@ -319,7 +319,7 @@ public class knowServiceImpl implements KnowService {
}
BaseKnowReturn baseKnowReturn = new BaseKnowReturn(knowList,linksList);
return baseKnowReturn;
return ResultUtils.success(baseKnowReturn);
}
//获取课程下的所有资源
@ -343,12 +343,6 @@ public class knowServiceImpl implements KnowService {
return ResultUtils.success(knowList);
}
//获取知识点下二级的所有资源
@Override
public Set<Resources> getSecondResources(Long id) {
Set<Resources>resourcesSet ;
resourcesSet = knowRepository.queryBesidesKnowToResources(id);
return resourcesSet;
}
}

@ -139,28 +139,28 @@ public class ResourceServiceImpl implements ResourceService {
}
@Override
//查询课程下资源
public Set<Resources> queryResourcesByCourseId(String courseId){
public BaseResponse<Set<Resources>> queryResourcesByCourseId(String courseId){
// todo 判空,查询
Set<Resources>resourcesSet;
resourcesSet = resourcesRepository.queryResourcesByCourseId(courseId);
return resourcesSet;
return ResultUtils.success(resourcesSet);
}
@Override
//查询章节下资源
public Set<Resources> queryResourcesByChapterId(Long chapterId){
public BaseResponse<Set<Resources>> queryResourcesByChapterId(Long chapterId){
// todo 判空,查询
Set<Resources>resourcesSet ;
resourcesSet = resourcesRepository.queryResourcesByChapterId(chapterId);
return resourcesSet;
return ResultUtils.success(resourcesSet);
}
@Override
//查询二级节点下资源
public Set<Resources> queryBesidesKnowToResources(Long KnowId){
public BaseResponse<Set<Resources>> queryBesidesKnowToResources(Long KnowId){
// todo 判空,查询
Set<Resources>resourcesSet ;
resourcesSet = resourcesRepository.queryBesidesKnowToResources(KnowId);
return resourcesSet;
return ResultUtils.success(resourcesSet);
}

@ -32,13 +32,13 @@ public interface ResourceService {
BaseResponse<String> addResourcesAndKnowById(Long id, List<Long> resourcesIds);
//查询课程下资源
Set<Resources> queryResourcesByCourseId(String courseId);
BaseResponse<Set<Resources>> queryResourcesByCourseId(String courseId);
//查询章节下资源
Set<Resources> queryResourcesByChapterId(Long chapterId);
BaseResponse<Set<Resources>> queryResourcesByChapterId(Long chapterId);
//查询二级节点下资源
Set<Resources> queryBesidesKnowToResources(Long KnowId);
BaseResponse<Set<Resources>> queryBesidesKnowToResources(Long KnowId);
}

@ -109,7 +109,7 @@ public class MinioUtils {
.Action("s3:GetObject")
.Resource("arn:aws:s3:::"+bucketName+"/*.**").build();
return BucketPolicyConfigDto.builder()
.Version("2012-10-17")
.Version("2024-8-10")
.Statement(CollUtil.toList(statement))
.build();
}

Loading…
Cancel
Save