wenyu441069198 3 months ago
parent 395d4b0078
commit 04df7b2cc3
  1. 3
      src/main/java/com/teaching/backend/controller/cms/CmsEssayController.java
  2. 2
      src/main/java/com/teaching/backend/mapper/KnowGraph/KnowledgeLearningNumberMapper.java
  3. 2
      src/main/java/com/teaching/backend/mapper/courses/CourseLearningNumberMapper.java
  4. 17
      src/main/java/com/teaching/backend/mapper/records/RecordKnowledgeFinishMapper.java
  5. 17
      src/main/java/com/teaching/backend/mapper/records/RecordResourceFinishMapper.java
  6. 5
      src/main/java/com/teaching/backend/model/entity/cms/CmsEssay.java
  7. 4
      src/main/java/com/teaching/backend/model/entity/records/CourseLearningNumber.java
  8. 2
      src/main/java/com/teaching/backend/model/entity/records/CourseLearningRecord.java
  9. 4
      src/main/java/com/teaching/backend/model/entity/records/KnowledgeLearningNumber.java
  10. 6
      src/main/java/com/teaching/backend/model/entity/records/KnowledgeLearningRecord.java
  11. 47
      src/main/java/com/teaching/backend/model/entity/records/RecordKnowledgeFinish.java
  12. 50
      src/main/java/com/teaching/backend/model/entity/records/RecordResourceFinish.java
  13. 2
      src/main/java/com/teaching/backend/model/entity/records/ResourceLearningNumber.java
  14. 15
      src/main/java/com/teaching/backend/model/entity/records/ResourceLearningRecord.java
  15. 4
      src/main/java/com/teaching/backend/model/vo/records/KnowledgeLearningRecordVo.java
  16. 6
      src/main/java/com/teaching/backend/model/vo/records/ResourceLearingRecordVo.java
  17. 2
      src/main/java/com/teaching/backend/service/KnowGraph/IKnowledgeLearningNumberService.java
  18. 2
      src/main/java/com/teaching/backend/service/courses/ICourseLearningNumberService.java
  19. 2
      src/main/java/com/teaching/backend/service/impl/courses/CourseLearningNumberServiceImpl.java
  20. 2
      src/main/java/com/teaching/backend/service/impl/knowledge/KnowledgeLearningNumberServiceImpl.java
  21. 2
      src/main/java/com/teaching/backend/service/impl/records/CourseLearningRecordServiceImpl.java
  22. 4
      src/main/java/com/teaching/backend/service/impl/records/KnowledgeLearningRecordServiceImpl.java
  23. 21
      src/main/java/com/teaching/backend/service/impl/records/RecordKnowledgeFinishServiceImpl.java
  24. 21
      src/main/java/com/teaching/backend/service/impl/records/RecordResourceFinishServiceImpl.java
  25. 20
      src/main/java/com/teaching/backend/service/impl/records/ResourceLearningRecordServiceImpl.java
  26. 17
      src/main/java/com/teaching/backend/service/records/IRecordKnowledgeFinishService.java
  27. 17
      src/main/java/com/teaching/backend/service/records/IRecordResourceFinishService.java

@ -53,7 +53,8 @@ public class CmsEssayController {
* @return
*/
@PutMapping("/edit")
public BaseResponse<String> editEssay(CmsEssay cmsEssay){
public BaseResponse<String> editEssay(@RequestBody CmsEssay cmsEssay){
System.out.println(cmsEssay);
return cmsEssayService.editEssay(cmsEssay);
}

@ -2,7 +2,7 @@ package com.teaching.backend.mapper.KnowGraph;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.KnowGraph.KnowledgeLearningNumber;
import com.teaching.backend.model.entity.records.KnowledgeLearningNumber;
/**
* <p>

@ -2,7 +2,7 @@ package com.teaching.backend.mapper.courses;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.courses.CourseLearningNumber;
import com.teaching.backend.model.entity.records.CourseLearningNumber;
/**
* <p>

@ -0,0 +1,17 @@
package com.teaching.backend.mapper.records;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.records.RecordKnowledgeFinish;
/**
* <p>
* Mapper 接口
* </p>
*
* @author author
* @since 2024-08-20
*/
public interface RecordKnowledgeFinishMapper extends BaseMapper<RecordKnowledgeFinish> {
}

@ -0,0 +1,17 @@
package com.teaching.backend.mapper.records;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.teaching.backend.model.entity.records.RecordResourceFinish;
/**
* <p>
* Mapper 接口
* </p>
*
* @author author
* @since 2024-08-20
*/
public interface RecordResourceFinishMapper extends BaseMapper<RecordResourceFinish> {
}

@ -2,8 +2,10 @@ package com.teaching.backend.model.entity.cms;
import com.baomidou.mybatisplus.annotation.*;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.time.LocalTime;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
@ -44,7 +46,8 @@ public class CmsEssay implements Serializable {
private String content;
@ApiModelProperty(value = "发布时间")
private LocalDateTime publishTime;
@JsonFormat (locale= "zh", timezone= "GMT+8", pattern= "yyyy-MM-dd")
private LocalDate publishTime;
@ApiModelProperty(value = "浏览次数")
private Integer readingNumber;

@ -1,4 +1,4 @@
package com.teaching.backend.model.entity.courses;
package com.teaching.backend.model.entity.records;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
@ -22,7 +22,7 @@ import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("course_learning_number")
@TableName("record_course_number")
@ApiModel(value="CourseLearningNumber对象", description="")
public class CourseLearningNumber implements Serializable {

@ -23,7 +23,7 @@ import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("course_learning_record")
@TableName("record_course_learning")
@ApiModel(value="CourseLearningRecord对象", description="")
public class CourseLearningRecord implements Serializable {

@ -1,4 +1,4 @@
package com.teaching.backend.model.entity.KnowGraph;
package com.teaching.backend.model.entity.records;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
@ -22,7 +22,7 @@ import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("knowledge_learning_number")
@TableName("record_knowledge_number")
@ApiModel(value="KnowledgeLearningNumber对象", description="")
public class KnowledgeLearningNumber implements Serializable {

@ -23,7 +23,7 @@ import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("knowledge_learning_record")
@TableName("record_knowledge_learning")
@ApiModel(value="KnowledgeLearningRecord对象", description="")
public class KnowledgeLearningRecord implements Serializable {
@ -61,5 +61,9 @@ public class KnowledgeLearningRecord implements Serializable {
@TableField("times")
private LocalDateTime times;
@ApiModelProperty(value = "完成状态")
@TableField("finish")
private Integer finish;
}

@ -0,0 +1,47 @@
package com.teaching.backend.model.entity.records;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author author
* @since 2024-08-20
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("record_knowledge_finish")
@ApiModel(value="RecordKnowledgeFinish对象", description="")
public class RecordKnowledgeFinish implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "知识点完成状态id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "用户id")
private String userId;
@ApiModelProperty(value = "课程id")
private String courseId;
@ApiModelProperty(value = "知识点id")
private String knowledgeId;
@ApiModelProperty(value = "完成状态")
private Integer finish;
}

@ -0,0 +1,50 @@
package com.teaching.backend.model.entity.records;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author author
* @since 2024-08-20
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("record_resource_finish")
@ApiModel(value="RecordResourceFinish对象", description="")
public class RecordResourceFinish implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "资源学习状态id")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "用户id")
private String userId;
@ApiModelProperty(value = "课程id")
private String courseId;
@ApiModelProperty(value = "知识点id")
private String knowledgeId;
@ApiModelProperty(value = "资源id")
private String resourceId;
@ApiModelProperty(value = "是否完成:1已完成;2;未完成")
private Integer finish;
}

@ -21,7 +21,7 @@ import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("resource_learning_number")
@TableName("record_resource_number")
@ApiModel(value="ResourceLearningNumber对象", description="")
public class ResourceLearningNumber implements Serializable {

@ -23,7 +23,7 @@ import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("resource_learning_record")
@TableName("record_resource_learning")
@ApiModel(value="ResourceLearningRecord对象", description="")
public class ResourceLearningRecord implements Serializable {
@ -67,19 +67,22 @@ public class ResourceLearningRecord implements Serializable {
@ApiModelProperty(value = "学习时长")
@TableField("duration")
private Integer duration;
private double duration;
@ApiModelProperty(value = "总时长")
@TableField("total_duration")
private double totalDuration;
@ApiModelProperty(value = "是否完成观看")
@TableField("finish")
private Integer finish;
@ApiModelProperty(value = "记录封面")
@TableField("img")
private String img;
@ApiModelProperty(value = "最近学习时间")
@TableField("times")
private LocalDateTime times;
@ApiModelProperty(value = "资源类型: 1:视频, 2:音频,3:文本资源,4:pdf,5:文件,6:压缩文件")
@TableField("type")
private Integer type;
}

@ -34,4 +34,8 @@ public class KnowledgeLearningRecordVo {
* 学习时间
*/
private String time;
/**
* 完成状态
*/
private Integer finish;
}

@ -26,4 +26,10 @@ public class ResourceLearingRecordVo {
* 学习时间
*/
private String time;
/**
* 完成状态
*/
private Integer finish;
}

@ -2,7 +2,7 @@ package com.teaching.backend.service.KnowGraph;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.model.entity.KnowGraph.KnowledgeLearningNumber;
import com.teaching.backend.model.entity.records.KnowledgeLearningNumber;
/**
* <p>

@ -2,7 +2,7 @@ package com.teaching.backend.service.courses;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.model.entity.courses.CourseLearningNumber;
import com.teaching.backend.model.entity.records.CourseLearningNumber;
/**
* <p>

@ -3,7 +3,7 @@ package com.teaching.backend.service.impl.courses;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.mapper.courses.CourseLearningNumberMapper;
import com.teaching.backend.model.entity.courses.CourseLearningNumber;
import com.teaching.backend.model.entity.records.CourseLearningNumber;
import com.teaching.backend.service.courses.ICourseLearningNumberService;
import org.springframework.stereotype.Service;

@ -3,7 +3,7 @@ package com.teaching.backend.service.impl.knowledge;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.mapper.KnowGraph.KnowledgeLearningNumberMapper;
import com.teaching.backend.model.entity.KnowGraph.KnowledgeLearningNumber;
import com.teaching.backend.model.entity.records.KnowledgeLearningNumber;
import com.teaching.backend.service.KnowGraph.IKnowledgeLearningNumberService;
import org.springframework.stereotype.Service;

@ -7,7 +7,7 @@ import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.mapper.courses.CoursesMapper;
import com.teaching.backend.mapper.records.CourseLearningRecordMapper;
import com.teaching.backend.model.entity.courses.CourseLearningNumber;
import com.teaching.backend.model.entity.records.CourseLearningNumber;
import com.teaching.backend.mapper.umsAdmin.UmsUserMapper;
import com.teaching.backend.model.entity.courses.Courses;
import com.teaching.backend.model.entity.records.CourseLearningRecord;

@ -10,7 +10,7 @@ import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.mapper.records.KnowledgeLearningRecordMapper;
import com.teaching.backend.mapper.umsAdmin.UmsUserMapper;
import com.teaching.backend.model.entity.KnowGraph.KnowledgeLearningNumber;
import com.teaching.backend.model.entity.records.KnowledgeLearningNumber;
import com.teaching.backend.model.entity.knowtmp.Knowtmp;
import com.teaching.backend.model.entity.records.KnowledgeLearningRecord;
@ -111,6 +111,7 @@ public class KnowledgeLearningRecordServiceImpl extends ServiceImpl<KnowledgeLea
.eq("courses_id",courseId).page(new Page<>(pagenum, pagesize));
Page<KnowledgeLearningRecordVo> page1 = new Page<>();
List<KnowledgeLearningRecord> records = page.getRecords();
//System.out.println(records);
BeanUtil.copyProperties(page, page1);
List<KnowledgeLearningRecordVo> recordsVos = new ArrayList<>();
//copy集合
@ -123,6 +124,7 @@ public class KnowledgeLearningRecordServiceImpl extends ServiceImpl<KnowledgeLea
knowledgeLearningRecordVo.setNumber(knowledgeLearningNumberService.getById(knowledgeLearningRecord.getNumber()).getNumber());
recordsVos.add(knowledgeLearningRecordVo);
});
//System.out.println(recordsVos);
page1.setRecords(recordsVos);
return ResultUtils.success(page1);
}

@ -0,0 +1,21 @@
package com.teaching.backend.service.impl.records;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.mapper.records.RecordKnowledgeFinishMapper;
import com.teaching.backend.model.entity.records.RecordKnowledgeFinish;
import com.teaching.backend.service.records.IRecordKnowledgeFinishService;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author author
* @since 2024-08-20
*/
@Service
public class RecordKnowledgeFinishServiceImpl extends ServiceImpl<RecordKnowledgeFinishMapper, RecordKnowledgeFinish> implements IRecordKnowledgeFinishService {
}

@ -0,0 +1,21 @@
package com.teaching.backend.service.impl.records;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.mapper.records.RecordResourceFinishMapper;
import com.teaching.backend.model.entity.records.RecordResourceFinish;
import com.teaching.backend.service.records.IRecordResourceFinishService;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author author
* @since 2024-08-20
*/
@Service
public class RecordResourceFinishServiceImpl extends ServiceImpl<RecordResourceFinishMapper, RecordResourceFinish> implements IRecordResourceFinishService {
}

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.teaching.backend.common.BaseResponse;
import com.teaching.backend.common.ResultUtils;
import com.teaching.backend.mapper.records.ResourceLearningRecordMapper;
import com.teaching.backend.model.entity.records.KnowledgeLearningRecord;
import com.teaching.backend.model.entity.records.ResourceLearningNumber;
import com.teaching.backend.model.entity.records.ResourceLearningRecord;
@ -35,6 +36,8 @@ public class ResourceLearningRecordServiceImpl extends ServiceImpl<ResourceLearn
@Resource
private ResourceLearningNumberServiceImpl resourceLearningNumberService;
@Resource
private KnowledgeLearningRecordServiceImpl knowledgeLearningRecordService;
@Override
public BaseResponse<String> saveCoursesRecords(ResourceLearningRecord resourceLearningRecord) {
@ -81,6 +84,21 @@ public class ResourceLearningRecordServiceImpl extends ServiceImpl<ResourceLearn
.eq("knowledge_id",knowledgeId)
.eq("resource_id",resourceId).one().getId();
resourceLearningRecord.setNumber(numberId);
//判断该资源是否学习完成
if (resourceLearningRecord.getFinish() == 1){
//如果完成将该资源,新加一条所属知识点已完成的学习记录
KnowledgeLearningRecord kl = new KnowledgeLearningRecord();
kl.setFinish(1);
kl.setCoursesId(resourceLearningRecord.getCoursesId());
kl.setUserId(resourceLearningRecord.getUserId());
kl.setKnowledgeId(resourceLearningRecord.getKnowledgeId());
// kl.setKnowledgeName()
System.out.println(kl);
// kl.setFinish(1);
//更新知识点完成状态
knowledgeLearningRecordService.save(kl);
//knowledgeLearningRecordService.updateById(kl);
}
//保存记录
save(resourceLearningRecord);
return ResultUtils.success("添加成功");
@ -88,7 +106,7 @@ public class ResourceLearningRecordServiceImpl extends ServiceImpl<ResourceLearn
@Override
public BaseResponse<Page> getPage(int pagenum, int pagesize, String userId, String knowledgeId, String courseId) {
//格式化时间
//格式化时间
String strDateFormat = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(strDateFormat);
//分页查询

@ -0,0 +1,17 @@
package com.teaching.backend.service.records;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.model.entity.records.RecordKnowledgeFinish;
/**
* <p>
* 服务类
* </p>
*
* @author author
* @since 2024-08-20
*/
public interface IRecordKnowledgeFinishService extends IService<RecordKnowledgeFinish> {
}

@ -0,0 +1,17 @@
package com.teaching.backend.service.records;
import com.baomidou.mybatisplus.extension.service.IService;
import com.teaching.backend.model.entity.records.RecordResourceFinish;
/**
* <p>
* 服务类
* </p>
*
* @author author
* @since 2024-08-20
*/
public interface IRecordResourceFinishService extends IService<RecordResourceFinish> {
}
Loading…
Cancel
Save