소스 검색

删除无用代码

reghao 2 주 전
부모
커밋
21179ef44a
100개의 변경된 파일0개의 추가작업 그리고 4662개의 파일을 삭제
  1. 0 71
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/controller/ChartController.java
  2. 0 58
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/controller/VoteController.java
  3. 0 14
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/db/mapper/VoteMapper.java
  4. 0 16
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/db/mapper/VoteOptionMapper.java
  5. 0 14
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/db/mapper/VoteResultMapper.java
  6. 0 33
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/dto/AudioPublishSbt.java
  7. 0 19
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/dto/AudioScopeUpdate.java
  8. 0 11
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/dto/VoteDto.java
  9. 0 8
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/dto/VoteProgressDto.java
  10. 0 35
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/po/AudioFile.java
  11. 0 43
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/po/AudioPost.java
  12. 0 20
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/po/Vote.java
  13. 0 13
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/po/VoteOption.java
  14. 0 14
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/po/VoteResult.java
  15. 0 29
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/vo/AudioInfo.java
  16. 0 20
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/vo/UserAudioCard.java
  17. 0 149
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/service/ChartService.java
  18. 0 41
      content/content-service/src/main/java/cn/reghao/tnb/content/app/data/service/VoteService.java
  19. 0 86
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/controller/ExamController.java
  20. 0 60
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/controller/ExamResultController.java
  21. 0 81
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/controller/MarkController.java
  22. 0 84
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/controller/PaperController.java
  23. 0 67
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/controller/QuestionController.java
  24. 0 48
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/controller/SubjectController.java
  25. 0 22
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/db/mapper/PaperAnswerMapper.java
  26. 0 22
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/db/mapper/PaperMapper.java
  27. 0 21
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/db/mapper/PaperQuestionMapper.java
  28. 0 25
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/db/mapper/PaperResultMapper.java
  29. 0 29
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/db/mapper/QuestionMapper.java
  30. 0 17
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/db/mapper/QuestionOptionMapper.java
  31. 0 13
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/db/mapper/SubjectMapper.java
  32. 0 28
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/chart/LineChartData.java
  33. 0 56
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/constant/PaperViewType.java
  34. 0 55
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/constant/QuestionLevel.java
  35. 0 60
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/constant/QuestionType.java
  36. 0 22
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/dto/ExamMarkResult.java
  37. 0 39
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/dto/PaperAddDto.java
  38. 0 60
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/dto/QuestionAddDto.java
  39. 0 34
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/dto/UserResult.java
  40. 0 48
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/po/Paper.java
  41. 0 47
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/po/PaperAnswer.java
  42. 0 45
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/po/PaperQuestion.java
  43. 0 36
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/po/PaperResult.java
  44. 0 86
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/po/Question.java
  45. 0 41
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/po/QuestionOption.java
  46. 0 15
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/po/Subject.java
  47. 0 31
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/provider/QuestionAddGroupSequenceProvider.java
  48. 0 69
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/query/ExamQuery.java
  49. 0 20
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/query/GetPaperQuery.java
  50. 0 70
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/query/PaperQuery.java
  51. 0 70
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/query/QuestionQuery.java
  52. 0 34
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/EvalPaper.java
  53. 0 25
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/ExamMark.java
  54. 0 39
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/ExamResult.java
  55. 0 18
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/ExamResults.java
  56. 0 39
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/PaperDetail.java
  57. 0 43
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/PaperQuestionInfo.java
  58. 0 34
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/PaperView.java
  59. 0 63
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/QuestionAnswer.java
  60. 0 27
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/QuestionAnswerInfo.java
  61. 0 36
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/QuestionDetail.java
  62. 0 35
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/QuestionInfo.java
  63. 0 22
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/QuestionOptionDetail.java
  64. 0 24
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/QuestionResult.java
  65. 0 22
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/QuestionView.java
  66. 0 25
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/SubjectInfo.java
  67. 0 194
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/service/ExamService.java
  68. 0 92
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/service/MarkService.java
  69. 0 212
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/service/PaperService.java
  70. 0 323
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/service/PaperViewService.java
  71. 0 181
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/service/QuestionService.java
  72. 0 51
      content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/service/SubjectService.java
  73. 0 70
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/controller/CartController.java
  74. 0 51
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/controller/DeliveryController.java
  75. 0 55
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/controller/LogisticsController.java
  76. 0 84
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/controller/ProductController.java
  77. 0 16
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/db/mapper/DeliveryMapper.java
  78. 0 15
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/db/mapper/LogisticsMapper.java
  79. 0 16
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/db/mapper/LogisticsProgressMapper.java
  80. 0 18
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/db/mapper/ProductMapper.java
  81. 0 16
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/db/mapper/ProductSnapshotMapper.java
  82. 0 52
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/db/repository/MallRepository.java
  83. 0 13
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/feign/DiscoveryClientConfig.java
  84. 0 79
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/feign/FeignClientConfig.java
  85. 0 51
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/feign/LoadBalanceConfig.java
  86. 0 51
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/feign/UserDiscoveryClient.java
  87. 0 28
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/feign/UserFeignClient.java
  88. 0 47
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/feign/UserLoadBalancerClient.java
  89. 0 43
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/constant/LogisticsStatus.java
  90. 0 23
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/dto/BuyItem.java
  91. 0 19
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/dto/BuyProductDto.java
  92. 0 17
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/dto/CartDto.java
  93. 0 18
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/dto/ProductAddDto.java
  94. 0 21
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/po/Delivery.java
  95. 0 19
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/po/Logistics.java
  96. 0 31
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/po/LogisticsProgress.java
  97. 0 49
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/po/Product.java
  98. 0 29
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/po/ProductSnapshot.java
  99. 0 27
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/vo/CartCard.java
  100. 0 50
      content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/rpc/MallServiceImpl.java

+ 0 - 71
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/controller/ChartController.java

@@ -1,71 +0,0 @@
-package cn.reghao.tnb.content.app.data.controller;
-
-import cn.reghao.tnb.common.web.WebResult;
-import cn.reghao.tnb.common.auth.AuthUser;
-import cn.reghao.tnb.content.app.data.service.ChartService;
-import cn.reghao.tnb.content.app.exam.model.chart.LineChartData;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2025-08-19 21:44:54
- */
-@Tag(name = "图表数据接口")
-@RestController
-@RequestMapping("/api/content/chart")
-public class ChartController {
-    private final ChartService chartService;
-
-    public ChartController(ChartService chartService) {
-        this.chartService = chartService;
-    }
-
-    @Operation(summary = "获取用户考试结果的统计数据", description = "N")
-    @GetMapping(value = "/exam/count", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getExamCount() {
-        List<String> list = new ArrayList<>();
-        list.add("试卷1,试卷2,试卷3,试卷4,试卷4,试卷6,试卷7");
-        list.add("8,4,1,8,0,0,0");
-        return WebResult.success(list);
-    }
-
-    @Operation(summary = "获取用户的考试通过率", description = "N")
-    @GetMapping(value = "/exam/rate", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getExamPassRate() {
-        List<String> list = new ArrayList<>();
-        list.add("试卷1,试卷2,试卷3,试卷4,试卷4,试卷6,试卷7");
-        list.add("0.5,1.0,1.0,1.0,0.0,0.0,0.0");
-        return WebResult.success(list);
-    }
-
-    @Operation(summary = "获取折线图数据", description = "N")
-    @GetMapping(value = "/exam/linechart", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getLineChart() {
-        LineChartData lineChartData = chartService.getLineChartData();
-        return WebResult.success(lineChartData);
-    }
-
-    @AuthUser
-    @Operation(summary = "用户最近一周观看视频时长统计", description = "N")
-    @GetMapping(value = "/video/watch", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getWatchLineChart() {
-        List<String> list = chartService.getWatchLineChart();
-        return WebResult.success(list);
-    }
-
-    @AuthUser
-    @Operation(summary = "用户最近一周观看视频分区统计", description = "N")
-    @GetMapping(value = "/video/region", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getRegionPieChart() {
-        List<String> list = chartService.getRegionPieChart();
-        return WebResult.success(list);
-    }
-}

+ 0 - 58
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/controller/VoteController.java

@@ -1,58 +0,0 @@
-package cn.reghao.tnb.content.app.data.controller;
-
-import cn.reghao.jutil.jdk.web.db.PageList;
-import cn.reghao.tnb.common.web.WebResult;
-import cn.reghao.tnb.content.app.data.model.dto.VoteDto;
-import cn.reghao.tnb.content.app.data.model.dto.VoteProgressDto;
-import cn.reghao.tnb.content.app.data.model.po.Vote;
-import cn.reghao.tnb.content.app.data.service.VoteService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * @author reghao
- * @date 2025-08-05 17:04:55
- */
-@Tag(name = "投票接口")
-@RestController
-@RequestMapping("/api/content/vote")
-public class VoteController {
-    private final VoteService voteService;
-
-    public VoteController(VoteService voteService) {
-        this.voteService = voteService;
-    }
-
-    @Operation(summary = "添加新投票", description = "N")
-    @PostMapping("/add")
-    public String addVote(@RequestBody @Validated VoteDto voteDto) {
-        return WebResult.success();
-    }
-
-    @Operation(summary = "获取投票列表", description = "N")
-    @GetMapping("/list")
-    public String getVoteList(@RequestParam("pn") Integer pn) {
-        PageList<Vote> pageList = PageList.empty();
-        return WebResult.success(pageList);
-    }
-
-    @Operation(summary = "获取某项投票", description = "N")
-    @GetMapping("/get/{voteId}")
-    public String getVote(@PathVariable("voteId") Long voteId) {
-        return WebResult.success();
-    }
-
-    @Operation(summary = "进行投票", description = "N")
-    @PostMapping("/progress")
-    public String publishVote(@RequestBody @Validated VoteProgressDto voteProgressDto) {
-        return WebResult.success();
-    }
-
-    @Operation(summary = "获取某项投票结果", description = "N")
-    @GetMapping("/result/{voteId}")
-    public String getVoteResult(@PathVariable("voteId") Long voteId) {
-        return WebResult.success();
-    }
-}

+ 0 - 14
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/db/mapper/VoteMapper.java

@@ -1,14 +0,0 @@
-package cn.reghao.tnb.content.app.data.db.mapper;
-
-import cn.reghao.jutil.jdk.web.db.BaseMapper;
-import cn.reghao.tnb.content.app.data.model.po.Vote;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * @author reghao
- * @date 2025-08-05 17:17:16
- */
-@Mapper
-public interface VoteMapper extends BaseMapper<Vote> {
-    Vote findByVoteId(long voteId);
-}

+ 0 - 16
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/db/mapper/VoteOptionMapper.java

@@ -1,16 +0,0 @@
-package cn.reghao.tnb.content.app.data.db.mapper;
-
-import cn.reghao.jutil.jdk.web.db.BaseMapper;
-import cn.reghao.tnb.content.app.data.model.po.VoteOption;
-import org.apache.ibatis.annotations.Mapper;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2025-08-05 17:25:29
- */
-@Mapper
-public interface VoteOptionMapper extends BaseMapper<VoteOption> {
-    List<VoteOption> findByVoteId(long voteId);
-}

+ 0 - 14
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/db/mapper/VoteResultMapper.java

@@ -1,14 +0,0 @@
-package cn.reghao.tnb.content.app.data.db.mapper;
-
-import cn.reghao.jutil.jdk.web.db.BaseMapper;
-import cn.reghao.tnb.content.app.data.model.po.VoteResult;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * @author reghao
- * @date 2025-08-05 17:17:36
- */
-@Mapper
-public interface VoteResultMapper extends BaseMapper<VoteResult> {
-    VoteResult findByVoteId(long voteId);
-}

+ 0 - 33
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/dto/AudioPublishSbt.java

@@ -1,33 +0,0 @@
-package cn.reghao.tnb.content.app.data.model.dto;
-
-import cn.reghao.tnb.content.api.constant.PostScope;
-import cn.reghao.jutil.jdk.web.validator.ValidEnum;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-import jakarta.validation.constraints.NotBlank;
-import jakarta.validation.constraints.NotNull;
-import java.io.Serializable;
-import java.time.LocalDateTime;
-
-/**
- * @author reghao
- * @date 2023-01-29 10:13:28
- */
-@NoArgsConstructor
-@Setter
-@Getter
-public class AudioPublishSbt implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    @NotBlank
-    private String audioFileId;
-    @NotBlank
-    private String title;
-    @ValidEnum(value = PostScope.class, message = "可见范围不正确")
-    private Integer scope;
-    private LocalDateTime scheduledPubDate;
-    @NotNull
-    private Integer channelCode;
-}

+ 0 - 19
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/dto/AudioScopeUpdate.java

@@ -1,19 +0,0 @@
-package cn.reghao.tnb.content.app.data.model.dto;
-
-import cn.reghao.tnb.content.api.constant.PostScope;
-import cn.reghao.jutil.jdk.web.validator.ValidEnum;
-import lombok.Getter;
-
-import jakarta.validation.constraints.NotBlank;
-
-/**
- * @author reghao
- * @date 2023-10-07 16:38:14
- */
-@Getter
-public class AudioScopeUpdate {
-    @NotBlank
-    private String audioId;
-    @ValidEnum(value = PostScope.class, message = "可见范围不正确")
-    private Integer scope;
-}

+ 0 - 11
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/dto/VoteDto.java

@@ -1,11 +0,0 @@
-package cn.reghao.tnb.content.app.data.model.dto;
-
-import lombok.Getter;
-
-/**
- * @author reghao
- * @date 2025-08-05 17:13:45
- */
-@Getter
-public class VoteDto {
-}

+ 0 - 8
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/dto/VoteProgressDto.java

@@ -1,8 +0,0 @@
-package cn.reghao.tnb.content.app.data.model.dto;
-
-/**
- * @author reghao
- * @date 2025-08-05 17:14:29
- */
-public class VoteProgressDto {
-}

+ 0 - 35
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/po/AudioFile.java

@@ -1,35 +0,0 @@
-package cn.reghao.tnb.content.app.data.model.po;
-
-import cn.reghao.jutil.jdk.web.db.BaseObject;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.NoArgsConstructor;
-
-/**
- * 音频文件
- *
- * @author reghao
- * @date 2023-07-05 16:42:01
- */
-@AllArgsConstructor
-@NoArgsConstructor
-@EqualsAndHashCode(callSuper = true)
-@Data
-public class AudioFile extends BaseObject<Integer> {
-    private String audioFileId;
-    private String objectId;
-    private int duration;
-    private String codec;
-    private Long bitRate;
-    private String url;
-
-    public AudioFile(String audioFileId, String objectId, String url, AudioFile audioFile) {
-        this.audioFileId = audioFileId;
-        this.objectId = objectId;
-        this.duration = audioFile.getDuration();
-        this.codec = audioFile.getCodec();
-        this.bitRate = audioFile.getBitRate();
-        this.url = url;
-    }
-}

+ 0 - 43
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/po/AudioPost.java

@@ -1,43 +0,0 @@
-package cn.reghao.tnb.content.app.data.model.po;
-
-import cn.reghao.jutil.jdk.web.db.BaseObject;
-import cn.reghao.tnb.content.api.constant.PostScope;
-import cn.reghao.tnb.common.auth.UserContext;
-import cn.reghao.tnb.content.app.data.model.dto.AudioPublishSbt;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.NoArgsConstructor;
-
-import java.time.LocalDateTime;
-
-/**
- * @author reghao
- * @date 2023-01-29 10:07:12
- */
-@NoArgsConstructor
-@EqualsAndHashCode(callSuper = true)
-@Data
-public class AudioPost extends BaseObject<Integer> {
-    private String audioId;
-    private String audioFileId;
-    private Integer channelCode;
-    private String audioUrl;
-    private String title;
-    private int duration;
-    private String codec;
-    private int scope;
-    private LocalDateTime publishAt;
-    private Long publishBy;
-
-    public AudioPost(String audioId, String audioUrl, int duration, String codec, AudioPublishSbt audioPublishSbt) {
-        this.audioId = audioId;
-        this.audioFileId = audioPublishSbt.getAudioFileId();
-        this.audioUrl = audioUrl;
-        this.title = audioPublishSbt.getTitle();
-        this.duration = duration;
-        this.codec = codec;
-        this.scope = PostScope.PUBLIC.getCode();
-        this.publishAt = audioPublishSbt.getScheduledPubDate() != null ? audioPublishSbt.getScheduledPubDate() : LocalDateTime.now();
-        this.publishBy = UserContext.getUserId();
-    }
-}

+ 0 - 20
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/po/Vote.java

@@ -1,20 +0,0 @@
-package cn.reghao.tnb.content.app.data.model.po;
-
-import cn.reghao.jutil.jdk.web.db.BaseObject;
-
-/**
- * @author reghao
- * @date 2025-08-05 17:02:28
- */
-public class Vote extends BaseObject<Integer> {
-    private Long voteId;
-    private String title;
-    private Integer expectNum;
-    private Integer actualNum;
-    private Long startTime;
-    private Long endTime;
-    private Integer status;
-    private String result;
-    private Long createAt;
-    private Long createBy;
-}

+ 0 - 13
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/po/VoteOption.java

@@ -1,13 +0,0 @@
-package cn.reghao.tnb.content.app.data.model.po;
-
-import cn.reghao.jutil.jdk.web.db.BaseObject;
-
-/**
- * @author reghao
- * @date 2025-08-05 17:02:49
- */
-public class VoteOption extends BaseObject<Integer> {
-    private Long voteId;
-    private Long optionId;
-    private String name;
-}

+ 0 - 14
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/po/VoteResult.java

@@ -1,14 +0,0 @@
-package cn.reghao.tnb.content.app.data.model.po;
-
-import cn.reghao.jutil.jdk.web.db.BaseObject;
-
-/**
- * @author reghao
- * @date 2025-08-05 17:02:55
- */
-public class VoteResult extends BaseObject<Integer> {
-    private Long voteId;
-    private Long optionId;
-    private Long voteAt;
-    private Long voteBy;
-}

+ 0 - 29
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/vo/AudioInfo.java

@@ -1,29 +0,0 @@
-package cn.reghao.tnb.content.app.data.model.vo;
-
-import cn.reghao.tnb.content.app.data.model.po.AudioPost;
-
-import java.time.LocalDateTime;
-
-/**
- * @author reghao
- * @date 2023-10-12 14:03:14
- */
-public class AudioInfo {
-    private String audioId;
-    private String title;
-    private String audioUrl;
-    private int duration;
-    private LocalDateTime publishAt;
-    private long publishBy;
-    private double currentTime;
-
-    public AudioInfo(AudioPost audioPost, String audioUrl, double currentTime) {
-        this.audioId = audioPost.getAudioId();
-        this.title = audioPost.getTitle();
-        this.audioUrl = audioUrl;
-        this.duration = audioPost.getDuration();
-        this.publishAt = audioPost.getPublishAt();
-        this.publishBy = audioPost.getPublishBy();
-        this.currentTime = currentTime;
-    }
-}

+ 0 - 20
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/model/vo/UserAudioCard.java

@@ -1,20 +0,0 @@
-package cn.reghao.tnb.content.app.data.model.vo;
-
-import lombok.Data;
-
-import java.time.LocalDateTime;
-
-/**
- * @author reghao
- * @date 2023-01-29 10:48:11
- */
-@Data
-public class UserAudioCard {
-    private String audioId;
-    private String title;
-    private String audioUrl;
-    private int duration;
-    private String codec;
-    private LocalDateTime publishAt;
-    private int scope;
-}

+ 0 - 149
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/service/ChartService.java

@@ -1,149 +0,0 @@
-package cn.reghao.tnb.content.app.data.service;
-
-import cn.reghao.jutil.jdk.converter.DateTimeConverter;
-import cn.reghao.jutil.jdk.io.TextFile;
-import cn.reghao.tnb.common.auth.UserContext;
-import cn.reghao.tnb.content.api.dto.VideoRegion;
-import cn.reghao.tnb.content.app.exam.model.chart.LineChartData;
-import cn.reghao.tnb.content.app.vod.service.CategoryService;
-import org.springframework.stereotype.Service;
-
-import java.security.SecureRandom;
-import java.time.LocalDateTime;
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * @author reghao
- * @date 2025-08-14 09:31:22
- */
-@Service
-public class ChartService {
-    private final TextFile textFile = new TextFile();
-    private final CategoryService categoryService;
-
-    public ChartService(CategoryService categoryService) {
-        this.categoryService = categoryService;
-    }
-
-    public LineChartData getLineChartData() {
-        String filePath = "/home/reghao/Downloads/2010四川高考一分一段.txt";
-        List<String> lines = textFile.read(filePath);
-        Map<Integer, Integer> map = new TreeMap<>();
-        for (String line : lines) {
-            String[] arr = line.split("\\s+");
-            int score = Integer.parseInt(arr[0].replace("分", ""));
-            int num = Integer.parseInt(arr[1]);
-            int total = Integer.parseInt(arr[2]);
-            map.put(score, num);
-        }
-
-        int level1 = 512;
-        int level2 = 441;
-        int level3 = 413;
-        int level4 = 361;
-        int level0 = level1+100;
-        int level5 = level4-50;
-
-        Map<String, Integer> map1 = new TreeMap<>();
-        int num0 = getNum(map, level0, 750);
-        map1.put("level0", num0);
-
-        int num1 = getNum(map, level1, level0);
-        map1.put("level1", num1);
-
-        int num2 = getNum(map, level2, level1);
-        map1.put("level2", num2);
-
-        int num3 = getNum(map, level3, level2);
-        map1.put("level3", num3);
-
-        int num4 = getNum(map, level4, level3);
-        map1.put("level4", num4);
-
-        int num5 = getNum(map, level5, level4);
-        map1.put("level5", num5);
-
-        int num6 = getNum(map, 1, level5);
-        map1.put("level6", num6);
-
-        int max = map1.values().stream().mapToInt(i -> i).max().orElse(-1);
-        LineChartData chartData = new LineChartData("人数", 0, max, 10, "分数段");
-        chartData.setXLabel(map1.keySet().toArray(new String[0]));
-        chartData.setXValue(map1.values().toArray(new Integer[0]));
-        return chartData;
-    }
-
-    private int getNum(Map<Integer, Integer> map, int start, int end) {
-        int num = 0;
-        for (int i = start; i < end; i++) {
-            if (map.get(i) != null) {
-                num += map.get(i);
-            } else {
-                System.out.println(i + " get null");
-            }
-        }
-
-        return num;
-    }
-
-    public List<String> getWatchLineChart() {
-        long loginUser = UserContext.getUserId();
-
-        List<String> xAxis = new ArrayList<>();
-        LocalDateTime current = LocalDateTime.now();
-        int i = 8;
-        while (i-- > 1) {
-            LocalDateTime localDateTime = current.minusDays(i);
-            String dtStr = DateTimeConverter.format(localDateTime);
-            xAxis.add(dtStr.split(" ")[0]);
-        }
-        String xStr = xAxis.toString().replace("[", "").replace("]", "");
-
-        List<String> yAxis = new ArrayList<>();
-        for (int j = 0; j < 7; j++) {
-            yAxis.add(String.format("%.2f", getRandomDouble()));
-        }
-        String yStr = yAxis.toString().replace("[", "").replace("]", "");
-
-        List<String> list = new ArrayList<>();
-        list.add(xStr);
-        list.add(yStr);
-        return list;
-    }
-
-    public List<String> getRegionPieChart() {
-        List<VideoRegion> list = categoryService.getCategories(true);
-        List<String> names = list.stream().map(VideoRegion::getName).collect(Collectors.toList());
-        int total = names.size();
-        List<String> xAxis = new ArrayList<>();
-        int i = 8;
-        while (i-- > 1) {
-            xAxis.add(names.get(getRandomInt(total)));
-        }
-        String xStr = xAxis.toString().replace("[", "").replace("]", "");
-
-        List<String> yAxis = new ArrayList<>();
-        for (int j = 0; j < 7; j++) {
-            yAxis.add(String.valueOf(getRandomInt(100)));
-        }
-        String yStr = yAxis.toString().replace("[", "").replace("]", "");
-
-        List<String> dataList = new ArrayList<>();
-        dataList.add(xStr);
-        dataList.add(yStr);
-        return dataList;
-    }
-
-    Random random = new SecureRandom();
-    private double getRandomDouble() {
-        int max = 86400;
-        double randomNum = getRandomInt(max);
-        return randomNum/3600;
-    }
-
-    private int getRandomInt(int max) {
-        int min = 0;
-        return min + random.nextInt(max - min);
-    }
-}

+ 0 - 41
content/content-service/src/main/java/cn/reghao/tnb/content/app/data/service/VoteService.java

@@ -1,41 +0,0 @@
-package cn.reghao.tnb.content.app.data.service;
-
-import cn.reghao.jutil.jdk.web.db.PageList;
-import cn.reghao.tnb.content.app.data.db.mapper.VoteMapper;
-import cn.reghao.tnb.content.app.data.db.mapper.VoteOptionMapper;
-import cn.reghao.tnb.content.app.data.db.mapper.VoteResultMapper;
-import cn.reghao.tnb.content.app.data.model.dto.VoteDto;
-import cn.reghao.tnb.content.app.data.model.dto.VoteProgressDto;
-import cn.reghao.tnb.content.app.data.model.po.Vote;
-import org.springframework.stereotype.Service;
-
-/**
- * @author reghao
- * @date 2025-08-05 17:09:44
- */
-@Service
-public class VoteService {
-    private VoteMapper voteMapper;
-    private VoteOptionMapper voteOptionMapper;
-    private VoteResultMapper voteResultMapper;
-
-    public VoteService(VoteMapper voteMapper, VoteOptionMapper voteOptionMapper, VoteResultMapper voteResultMapper) {
-        this.voteMapper = voteMapper;
-        this.voteOptionMapper = voteOptionMapper;
-        this.voteResultMapper = voteResultMapper;
-    }
-
-    public void createVote(VoteDto voteDto) {
-    }
-
-    public PageList<Vote> getVoteList(int pn) {
-        return PageList.empty();
-    }
-
-    public Vote getVote(long voteId) {
-        return null;
-    }
-
-    public void progressVote(VoteProgressDto voteProgressDto) {
-    }
-}

+ 0 - 86
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/controller/ExamController.java

@@ -1,86 +0,0 @@
-package cn.reghao.tnb.content.app.exam.controller;
-
-import cn.reghao.jutil.jdk.web.db.PageList;
-import cn.reghao.tnb.common.web.WebResult;
-import cn.reghao.tnb.common.auth.AccountRole;
-import cn.reghao.tnb.common.auth.UserContext;
-import cn.reghao.tnb.content.app.exam.model.constant.PaperViewType;
-import cn.reghao.tnb.content.app.exam.model.dto.UserResult;
-import cn.reghao.tnb.content.app.exam.model.query.PaperQuery;
-import cn.reghao.tnb.content.app.exam.model.vo.*;
-import cn.reghao.tnb.content.app.exam.service.ExamService;
-import cn.reghao.tnb.content.app.exam.service.PaperService;
-import cn.reghao.tnb.content.app.exam.service.PaperViewService;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import org.springframework.http.MediaType;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-08-24 13:29:10
- */
-@Tag(name = "测评接口")
-@RestController
-@RequestMapping("/api/content/exam/eval")
-public class ExamController {
-    private final ExamService examService;
-    private final PaperService paperService;
-    private final PaperViewService paperViewService;
-
-    public ExamController(ExamService examService, PaperService paperService, PaperViewService paperViewService) {
-        this.examService = examService;
-        this.paperService = paperService;
-        this.paperViewService = paperViewService;
-    }
-
-    @Operation(summary = "获取测评试卷列表", description = "N")
-    @GetMapping(value = "/list", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getExams(PaperQuery paperQuery) {
-        int role = -1;
-        /*if (UserContext.getUserRoles().contains(AccountRole.examAdmin.getValue())) {
-            role = 1;
-        } else if (UserContext.getUserRoles().contains(AccountRole.examUser.getValue())) {
-            role = 2;
-        }*/
-
-        paperQuery.setScope(role);
-        PageList<EvalPaper> pageList1 = paperService.getEvalPapers(paperQuery);
-        return WebResult.success(pageList1);
-    }
-
-    @Operation(summary = "获取试卷开始测评", description = "N")
-    @GetMapping(value = "/start/{paperId}", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getExamPaperView(@PathVariable("paperId") int paperId) {
-        int viewType = PaperViewType.PaperExam.getCode();
-        long userId = UserContext.getUserId();
-
-        int resultId = 0;
-        PaperDetail paperDetail = paperViewService.getPaperDetail(paperId, viewType, resultId);
-        return WebResult.success(paperDetail);
-    }
-
-    @Operation(summary = "获取试卷中的试题", description = "N")
-    @GetMapping(value = "/paper/{paperId}/question", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getExamQuestions1(@PathVariable("paperId") Integer paperId) {
-        List<QuestionInfo> list1 = paperService.getPaperQuestions(paperId);
-        return WebResult.success(list1);
-    }
-
-    @Operation(summary = "暂存用户提交的试卷答案", description = "N")
-    @PostMapping(value = "/cache", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String cacheExamPaper(@Validated @RequestBody UserResult userResult) {
-        examService.cacheUserAnswers(userResult);
-        return WebResult.success();
-    }
-
-    @Operation(summary = "用户提交试卷答案", description = "N")
-    @PostMapping(value = "/submit", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String submitExamPaper(@Validated @RequestBody UserResult userResult) {
-        int resultId = examService.submitExamPaper(userResult);
-        return WebResult.success(resultId);
-    }
-}

+ 0 - 60
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/controller/ExamResultController.java

@@ -1,60 +0,0 @@
-package cn.reghao.tnb.content.app.exam.controller;
-
-import cn.reghao.tnb.common.web.WebResult;
-import cn.reghao.tnb.common.auth.UserContext;
-import cn.reghao.tnb.content.app.exam.model.constant.PaperViewType;
-import cn.reghao.tnb.content.app.exam.model.po.PaperResult;
-import cn.reghao.tnb.content.app.exam.model.vo.PaperDetail;
-import cn.reghao.tnb.content.app.exam.service.PaperService;
-import cn.reghao.tnb.content.app.exam.service.PaperViewService;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * @author reghao
- * @date 2024-08-29 09:54:34
- */
-@Tag(name = "考试结果接口")
-@RestController
-@RequestMapping("/api/content/exam/result")
-public class ExamResultController {
-    private final PaperService paperService;
-    private final PaperViewService paperViewService;
-
-    public ExamResultController(PaperService paperService, PaperViewService paperViewService) {
-        this.paperService = paperService;
-        this.paperViewService = paperViewService;
-    }
-
-    @Operation(summary = "获取试卷结果", description = "N")
-    @GetMapping(value = "/view/{paperId}", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getExamMark(@PathVariable("paperId") Integer paperId) {
-        int viewType = PaperViewType.PaperResult.getCode();
-        long loginUser = UserContext.getUserId();
-
-        PaperResult paperResult = paperService.getPaperResult(paperId, loginUser);
-        if (paperResult == null) {
-            // 试卷结果不存在
-            PaperDetail paperDetail = new PaperDetail(paperId, 5);
-            return WebResult.success(paperDetail);
-        }
-
-        if (!paperResult.getMarked()) {
-            // 试卷尚未批改
-            PaperDetail paperDetail = new PaperDetail(paperId, 6);
-            return WebResult.success(paperDetail);
-        }
-
-        int resultId = paperResult.getId();
-        PaperDetail paperDetail = paperViewService.getPaperDetail(paperId, viewType, resultId);
-        return WebResult.success(paperDetail);
-    }
-
-    @Operation(summary = "获取用户的考试成绩", description = "N")
-    @GetMapping(value = "/score", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getExamScore() {
-        return WebResult.success();
-    }
-}

+ 0 - 81
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/controller/MarkController.java

@@ -1,81 +0,0 @@
-package cn.reghao.tnb.content.app.exam.controller;
-
-import cn.reghao.jutil.jdk.web.db.PageList;
-import cn.reghao.tnb.common.web.WebResult;
-import cn.reghao.tnb.common.auth.UserContext;
-import cn.reghao.tnb.content.app.exam.model.constant.PaperViewType;
-import cn.reghao.tnb.content.app.exam.model.dto.UserResult;
-import cn.reghao.tnb.content.app.exam.model.po.PaperResult;
-import cn.reghao.tnb.content.app.exam.model.query.ExamQuery;
-import cn.reghao.tnb.content.app.exam.model.vo.ExamMark;
-import cn.reghao.tnb.content.app.exam.model.vo.PaperDetail;
-import cn.reghao.tnb.content.app.exam.service.MarkService;
-import cn.reghao.tnb.content.app.exam.service.PaperService;
-import cn.reghao.tnb.content.app.exam.service.PaperViewService;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import org.springframework.http.MediaType;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * @author reghao
- * @date 2025-08-11 17:14:46
- */
-@Tag(name = "阅卷接口")
-@RestController
-@RequestMapping("/api/content/exam/mark")
-public class MarkController {
-    private PaperService paperService;
-    private final PaperViewService paperViewService;
-    private final MarkService markService;
-
-    public MarkController(PaperService paperService, PaperViewService paperViewService, MarkService markService) {
-        this.paperService = paperService;
-        this.paperViewService = paperViewService;
-        this.markService = markService;
-    }
-
-    @Operation(summary = "获取阅卷列表", description = "N")
-    @GetMapping(value = "/list", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getExamMark(ExamQuery examQuery) {
-        PageList<ExamMark> pageList = markService.getExamReviewList(examQuery);
-        return WebResult.success(pageList);
-    }
-
-    @Operation(summary = "获取阅卷视图", description = "N")
-    @GetMapping(value = "/view", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getMarkPaperView(@RequestParam("paperId") int paperId,
-                                   @RequestParam("userId") long userId) {
-        int viewType = PaperViewType.PaperMark.getCode();
-        long loginUser = UserContext.getUserId();
-        if (userId == 0) {
-            userId = loginUser;
-        }
-
-        PaperResult paperResult = paperService.getPaperResult(paperId, userId);
-        if (paperResult == null) {
-            // 试卷结果不存在
-            PaperDetail paperDetail = new PaperDetail(paperId, 5);
-            return WebResult.success(paperDetail);
-        }
-
-        boolean marked = paperResult.getMarked();
-        if (marked) {
-            // 试卷已批改
-            PaperDetail paperDetail = new PaperDetail(paperId, 7);
-            return WebResult.success(paperDetail);
-        }
-
-        int resultId = paperResult.getId();
-        PaperDetail paperDetail = paperViewService.getPaperDetail(paperId, viewType, resultId);
-        return WebResult.success(paperDetail);
-    }
-
-    @Operation(summary = "提交阅卷结果", description = "N")
-    @PostMapping(value = "/submit", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String submitExamMark(@RequestBody @Validated UserResult userResult) {
-        markService.markExamResult(userResult);
-        return WebResult.success();
-    }
-}

+ 0 - 84
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/controller/PaperController.java

@@ -1,84 +0,0 @@
-package cn.reghao.tnb.content.app.exam.controller;
-
-import cn.reghao.jutil.jdk.web.db.PageList;
-import cn.reghao.jutil.jdk.web.result.Result;
-import cn.reghao.tnb.common.web.WebResult;
-import cn.reghao.tnb.common.auth.AuthUser;
-import cn.reghao.tnb.common.db.KeyValue;
-import cn.reghao.tnb.content.app.exam.model.dto.PaperAddDto;
-import cn.reghao.tnb.content.app.exam.model.query.GetPaperQuery;
-import cn.reghao.tnb.content.app.exam.model.query.PaperQuery;
-import cn.reghao.tnb.content.app.exam.model.vo.PaperDetail;
-import cn.reghao.tnb.content.app.exam.model.vo.PaperView;
-import cn.reghao.tnb.content.app.exam.service.PaperService;
-import cn.reghao.tnb.content.app.exam.service.PaperViewService;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import org.springframework.http.MediaType;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import jakarta.validation.Valid;
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-08-27 17:20:34
- */
-@Tag(name = "试卷接口")
-@RestController
-@RequestMapping("/api/content/exam/paper")
-public class PaperController {
-    private final PaperService paperService;
-    private final PaperViewService paperViewService;
-
-    public PaperController(PaperService paperService, PaperViewService paperViewService) {
-        this.paperService = paperService;
-        this.paperViewService = paperViewService;
-    }
-
-    @AuthUser
-    @Operation(summary = "创建试卷", description = "N")
-    @PostMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String addPaper(@RequestBody @Valid PaperAddDto paperAddDto) {
-        Result result = paperService.createExamPaper(paperAddDto);
-        return WebResult.result(result);
-    }
-
-    @AuthUser
-    @Operation(summary = "删除试卷", description = "N")
-    @DeleteMapping(value = "/{paperId}", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String deletePaper(@PathVariable("paperId") Integer paperId) {
-        Result result = paperService.deleteExamPaper(paperId);
-        return WebResult.result(result);
-    }
-
-    @AuthUser
-    @Operation(summary = "获取试卷列表", description = "N")
-    @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getPapers(PaperQuery paperQuery) {
-        PageList<PaperView> pageList = paperService.getExamPapers(paperQuery);
-        return WebResult.success(pageList);
-    }
-
-    @AuthUser
-    @Operation(summary = "获取试卷详情", description = "N")
-    @GetMapping(value = "/detail", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getPaper(@Validated GetPaperQuery getPaperQuery) {
-        int paperId = getPaperQuery.getPaperId();
-        int viewType = getPaperQuery.getViewType();
-        Long userId = getPaperQuery.getUserId();
-
-        int resultId = 0;
-        PaperDetail paperDetail = paperViewService.getPaperDetail(paperId, viewType, resultId);
-        return WebResult.success(paperDetail);
-    }
-
-    @AuthUser
-    @Operation(summary = "获取试卷 KV 列表", description = "N")
-    @GetMapping(value = "/kv", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getPaperKeyValue() {
-        List<KeyValue> list = paperService.getKeyValues();
-        return WebResult.success(list);
-    }
-}

+ 0 - 67
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/controller/QuestionController.java

@@ -1,67 +0,0 @@
-package cn.reghao.tnb.content.app.exam.controller;
-
-import cn.reghao.jutil.jdk.web.db.PageList;
-import cn.reghao.jutil.jdk.web.result.Result;
-import cn.reghao.tnb.common.web.WebResult;
-import cn.reghao.tnb.common.db.KeyValue;
-import cn.reghao.tnb.content.app.exam.model.dto.QuestionAddDto;
-import cn.reghao.tnb.content.app.exam.model.query.QuestionQuery;
-import cn.reghao.tnb.content.app.exam.model.vo.*;
-import cn.reghao.tnb.content.app.exam.service.QuestionService;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.*;
-
-import jakarta.validation.Valid;
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-08-24 23:57:42
- */
-@Tag(name = "试题接口")
-@RestController
-@RequestMapping("/api/content/exam/question")
-public class QuestionController {
-    private final QuestionService questionService;
-
-    public QuestionController(QuestionService questionService) {
-        this.questionService = questionService;
-    }
-
-    @Operation(summary = "添加试题", description = "N")
-    @PostMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String addQuestion(@RequestBody @Valid QuestionAddDto questionAddDto) {
-        Result result = questionService.addQuestion(questionAddDto);
-        return WebResult.result(result);
-    }
-
-    @Operation(summary = "删除试题", description = "N")
-    @DeleteMapping(value = "/{questionId}", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String deleteQuestion(@PathVariable("questionId") Long questionId) {
-        Result result = questionService.deleteQuestion(questionId);
-        return WebResult.result(result);
-    }
-
-    @Operation(summary = "获取试题列表", description = "N")
-    @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getQuestions(QuestionQuery questionQuery) {
-        PageList<QuestionView> pageList = questionService.getQuestions(questionQuery);
-        return WebResult.success(pageList);
-    }
-
-    @Operation(summary = "获取试题详情", description = "N")
-    @GetMapping(value = "/{questionId}", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getQuestion(@PathVariable("questionId") Long questionId) {
-        QuestionDetail questionDetail = questionService.getQuestionDetail(questionId);
-        return WebResult.success(questionDetail);
-    }
-
-    @Operation(summary = "获取试题类型 KV 列表", description = "N")
-    @GetMapping(value = "/type", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getQuestionType() {
-        List<KeyValue> list = questionService.getKeyValues();
-        return WebResult.success(list);
-    }
-}

+ 0 - 48
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/controller/SubjectController.java

@@ -1,48 +0,0 @@
-package cn.reghao.tnb.content.app.exam.controller;
-
-import cn.reghao.jutil.jdk.web.db.PageList;
-import cn.reghao.tnb.common.web.WebResult;
-import cn.reghao.tnb.common.db.KeyValue;
-import cn.reghao.tnb.content.app.exam.model.vo.SubjectInfo;
-import cn.reghao.tnb.content.app.exam.service.SubjectService;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-08-24 23:23:28
- */
-@Tag(name = "科目接口")
-@RestController
-@RequestMapping("/api/content/exam/subject")
-public class SubjectController {
-    private final SubjectService subjectService;
-
-    public SubjectController(SubjectService subjectService) {
-        this.subjectService = subjectService;
-    }
-
-    @Operation(summary = "获取科目列表", description = "N")
-    @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getSubjects(@RequestParam(value = "pn", required = false) Integer pageNumber,
-                              @RequestParam(value = "pz", required = false) Integer pageSize) {
-        pageNumber = 1;
-        pageSize = 10;
-        PageList<SubjectInfo> pageList = subjectService.getSubjectInfos(pageNumber, pageSize);
-        return WebResult.success(pageList);
-    }
-
-    @Operation(summary = "获取科目 KV 列表", description = "N")
-    @GetMapping(value = "/kv", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getSubjectKeyValue() {
-        List<KeyValue> list = subjectService.getKeyValues();
-        return WebResult.success(list);
-    }
-}

+ 0 - 22
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/db/mapper/PaperAnswerMapper.java

@@ -1,22 +0,0 @@
-package cn.reghao.tnb.content.app.exam.db.mapper;
-
-import cn.reghao.jutil.jdk.web.db.BaseMapper;
-import cn.reghao.tnb.content.app.exam.model.po.PaperAnswer;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-09-02 09:41:29
- */
-@Mapper
-public interface PaperAnswerMapper extends BaseMapper<PaperAnswer> {
-    void updatePaperAnswer(@Param("resultId") int resultId,
-                           @Param("questionId") long questionId,
-                           @Param("review") String review,
-                           @Param("score") int score);
-
-    List<PaperAnswer> findByResultId(int resultId);
-}

+ 0 - 22
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/db/mapper/PaperMapper.java

@@ -1,22 +0,0 @@
-package cn.reghao.tnb.content.app.exam.db.mapper;
-
-import cn.reghao.jutil.jdk.web.db.BaseMapper;
-import cn.reghao.jutil.jdk.web.db.Page;
-import cn.reghao.tnb.content.app.exam.model.po.Paper;
-import cn.reghao.tnb.content.app.exam.model.query.PaperQuery;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-08-24 23:44:07
- */
-@Mapper
-public interface PaperMapper extends BaseMapper<Paper> {
-    void deleteById(int paperId);
-
-    int countByCriteria(PaperQuery paperQuery);
-    List<Paper> findPaperByPage(Page page, @Param("paperQuery") PaperQuery paperQuery);
-}

+ 0 - 21
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/db/mapper/PaperQuestionMapper.java

@@ -1,21 +0,0 @@
-package cn.reghao.tnb.content.app.exam.db.mapper;
-
-import cn.reghao.jutil.jdk.web.db.BaseMapper;
-import cn.reghao.tnb.content.app.exam.model.po.PaperQuestion;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-08-28 09:21:25
- */
-@Mapper
-public interface PaperQuestionMapper extends BaseMapper<PaperQuestion> {
-    void deleteByPaperId(int paperId);
-    List<PaperQuestion> findByPaperId(int paperId);
-    PaperQuestion findPaperQuestion(@Param("paperId") int paperId, @Param("questionId") long questionId);
-    @Deprecated
-    List<PaperQuestion> findByPaperIdAndPid(@Param("paperId") int paperId, @Param("pid") long pid);
-}

+ 0 - 25
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/db/mapper/PaperResultMapper.java

@@ -1,25 +0,0 @@
-package cn.reghao.tnb.content.app.exam.db.mapper;
-
-import cn.reghao.jutil.jdk.web.db.BaseMapper;
-import cn.reghao.jutil.jdk.web.db.Page;
-import cn.reghao.tnb.content.app.exam.model.po.PaperResult;
-import cn.reghao.tnb.content.app.exam.model.query.ExamQuery;
-import cn.reghao.tnb.content.app.exam.model.vo.ExamResults;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-08-28 15:20:45
- */
-@Mapper
-public interface PaperResultMapper extends BaseMapper<PaperResult> {
-    void updateSetResultMarked(@Param("resultId") int resultId, @Param("subjectiveScore") int subjectiveScore);
-
-    List<PaperResult> findByPaperId(int paperId);
-    int countByCriteria(ExamQuery examQuery);
-    List<ExamResults> findExamResultsByPage(Page page, @Param("examQuery") ExamQuery examQuery);
-    List<PaperResult> findPaperResultByPage(Page page, @Param("examQuery") ExamQuery examQuery);
-}

+ 0 - 29
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/db/mapper/QuestionMapper.java

@@ -1,29 +0,0 @@
-package cn.reghao.tnb.content.app.exam.db.mapper;
-
-import cn.reghao.jutil.jdk.web.db.BaseMapper;
-import cn.reghao.jutil.jdk.web.db.Page;
-import cn.reghao.tnb.common.db.GroupCount;
-import cn.reghao.tnb.content.app.exam.model.po.Question;
-import cn.reghao.tnb.content.app.exam.model.query.QuestionQuery;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-08-24 23:28:40
- */
-@Mapper
-public interface QuestionMapper extends BaseMapper<Question> {
-    void deleteByQuestionId(long questionId);
-
-    List<Question> findBySubjectId(int subjectId);
-    Question findByQuestionId(long questionId);
-    List<Question> findByPid(long pid);
-    List<Question> findByQuestionIds(List<Long> list);
-    List<GroupCount> findGroupBySubjectId(int subjectId);
-
-    int countByCriteria(QuestionQuery questionQuery);
-    List<Question> findQuestionByPage(Page page, @Param("questionQuery") QuestionQuery questionQuery);
-}

+ 0 - 17
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/db/mapper/QuestionOptionMapper.java

@@ -1,17 +0,0 @@
-package cn.reghao.tnb.content.app.exam.db.mapper;
-
-import cn.reghao.jutil.jdk.web.db.BaseMapper;
-import cn.reghao.tnb.content.app.exam.model.po.QuestionOption;
-import org.apache.ibatis.annotations.Mapper;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-08-25 20:34:08
- */
-@Mapper
-public interface QuestionOptionMapper extends BaseMapper<QuestionOption> {
-    void deleteByQuestionId(long questionId);
-    List<QuestionOption> findByQuestionId(long questionId);
-}

+ 0 - 13
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/db/mapper/SubjectMapper.java

@@ -1,13 +0,0 @@
-package cn.reghao.tnb.content.app.exam.db.mapper;
-
-import cn.reghao.jutil.jdk.web.db.BaseMapper;
-import cn.reghao.tnb.content.app.exam.model.po.Subject;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * @author reghao
- * @date 2024-08-24 23:26:00
- */
-@Mapper
-public interface SubjectMapper extends BaseMapper<Subject> {
-}

+ 0 - 28
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/chart/LineChartData.java

@@ -1,28 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.chart;
-
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * @author reghao
- * @date 2025-08-14 09:28:59
- */
-@Setter
-@Getter
-public class LineChartData {
-    private String xName;
-    private String[] xLabel = {};
-    private Integer[] xValue = {};
-    private String yName;
-    private int yMin;
-    private int yMax;
-    private int ySplitNumber;
-
-    public LineChartData(String yName, int yMin, int yMax, int ySplitNumber, String xName) {
-        this.xName = xName;
-        this.yName = yName;
-        this.yMin = yMin;
-        this.yMax = yMax;
-        this.ySplitNumber = ySplitNumber;
-    }
-}

+ 0 - 56
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/constant/PaperViewType.java

@@ -1,56 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.constant;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author reghao
- * @date 2024-09-02 11:19:11
- */
-public enum PaperViewType {
-    PaperPreview(1, "试卷预览"),
-    PaperExam(2, "测评预览"),
-    PaperMark(3, "阅卷预览"),
-    PaperResult(4, "结果预览");
-
-    private final int code;
-    private final String desc;
-    private static Map<Integer, String> descMap = new HashMap<>();
-    static {
-        for (PaperViewType eNumber : PaperViewType.values()) {
-            descMap.put(eNumber.code, eNumber.desc);
-        }
-    }
-
-    PaperViewType(Integer code, String desc) {
-        this.code = code;
-        this.desc = desc;
-    }
-
-    public String getName() {
-        return this.name();
-    }
-
-    /**
-     * 提供给 @ValidEnum 调用
-     *
-     * @param
-     * @return
-     * @date 2023-10-11 14:44:42
-     */
-    public int getValue() {
-        return this.code;
-    }
-
-    public Integer getCode() {
-        return code;
-    }
-
-    public String getDesc() {
-        return desc;
-    }
-
-    public static String getDescByCode(int code) {
-        return descMap.get(code);
-    }
-}

+ 0 - 55
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/constant/QuestionLevel.java

@@ -1,55 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.constant;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author reghao
- * @date 2024-08-25 14:52:04
- */
-public enum QuestionLevel {
-    EASY(1, "简单"),
-    MEDIUM(2, "中等"),
-    HARD(3, "困难");
-
-    private final int code;
-    private final String desc;
-    private static Map<Integer, String> descMap = new HashMap<>();
-    static {
-        for (QuestionLevel level : QuestionLevel.values()) {
-            descMap.put(level.code, level.desc);
-        }
-    }
-
-    QuestionLevel(Integer code, String desc) {
-        this.code = code;
-        this.desc = desc;
-    }
-
-    public String getName() {
-        return this.name();
-    }
-
-    /**
-     * 提供给 @ValidEnum 调用
-     *
-     * @param
-     * @return
-     * @date 2023-10-11 14:44:42
-     */
-    public int getValue() {
-        return this.code;
-    }
-
-    public Integer getCode() {
-        return code;
-    }
-
-    public String getDesc() {
-        return desc;
-    }
-
-    public static String getDescByCode(int code) {
-        return descMap.get(code);
-    }
-}

+ 0 - 60
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/constant/QuestionType.java

@@ -1,60 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.constant;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * 试题类型
- *
- * @author reghao
- * @date 2024-08-24 23:31:18
- */
-public enum QuestionType {
-    QUESTION1(1, "单选题"),
-    QUESTION2(2, "多选题"),
-    QUESTION3(3, "判断题"),
-    QUESTION4(4, "填空题"),
-    QUESTION5(5, "问答题"),
-    QUESTION6(6, "组合题");
-
-    private final int code;
-    private final String desc;
-    private static Map<Integer, String> descMap = new HashMap<>();
-    static {
-        for (QuestionType type : QuestionType.values()) {
-            descMap.put(type.code, type.desc);
-        }
-    }
-
-    QuestionType(Integer code, String desc) {
-        this.code = code;
-        this.desc = desc;
-    }
-
-    public String getName() {
-        return this.name();
-    }
-
-    /**
-     * 提供给 @ValidEnum 调用
-     *
-     * @param
-     * @return
-     * @date 2023-10-11 14:44:42
-     */
-    public int getValue() {
-        return this.code;
-    }
-
-    public Integer getCode() {
-        return code;
-    }
-
-    public String getDesc() {
-        return desc;
-    }
-
-    public static String getDescByCode(int code) {
-        return descMap.get(code);
-    }
-}

+ 0 - 22
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/dto/ExamMarkResult.java

@@ -1,22 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.dto;
-
-import lombok.Getter;
-import lombok.Setter;
-
-import jakarta.validation.constraints.NotNull;
-
-/**
- * @author reghao
- * @date 2024-08-29 17:06:02
- */
-@Setter
-@Getter
-public class ExamMarkResult {
-    @NotNull
-    private Long questionId;
-    @NotNull
-    private Integer pos;
-    @NotNull
-    private Integer score;
-    private String review;
-}

+ 0 - 39
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/dto/PaperAddDto.java

@@ -1,39 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.dto;
-
-import cn.reghao.tnb.content.app.exam.model.po.PaperQuestion;
-import lombok.Getter;
-import lombok.Setter;
-import org.springframework.format.annotation.DateTimeFormat;
-
-import jakarta.validation.constraints.NotBlank;
-import jakarta.validation.constraints.NotNull;
-import jakarta.validation.constraints.Size;
-import java.util.Date;
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-08-27 17:42:05
- */
-@Setter
-@Getter
-public class PaperAddDto {
-    @NotBlank
-    private String examName;
-    private String examDesc;
-    @Size(min = 1, max = 100, message = "一套试卷中的试题不能超过 100 道")
-    private List<PaperQuestion> paperQuestions;
-    @NotNull
-    private Integer passScore;
-    @NotNull
-    private Integer totalScore;
-    @NotNull
-    private Integer examDuration;
-    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @NotNull
-    private Date startTime;
-    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
-    @NotNull
-    private Date endTime;
-    private String examPassword;
-}

+ 0 - 60
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/dto/QuestionAddDto.java

@@ -1,60 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.dto;
-
-import cn.reghao.jutil.jdk.web.validator.ValidEnum;
-import cn.reghao.tnb.content.app.exam.model.constant.QuestionLevel;
-import cn.reghao.tnb.content.app.exam.model.constant.QuestionType;
-import cn.reghao.tnb.content.app.exam.model.provider.QuestionAddGroupSequenceProvider;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import jakarta.validation.constraints.NotBlank;
-import jakarta.validation.constraints.NotNull;
-import jakarta.validation.constraints.Size;
-
-/**
- * @author reghao
- * @date 2024-08-25 15:46:19
- */
-//@GroupSequenceProvider(QuestionAddGroupSequenceProvider.class)
-@Data
-@AllArgsConstructor
-@NoArgsConstructor
-public class QuestionAddDto {
-    @ValidEnum(value = QuestionType.class, message = "请选择正确的试题类型")
-    private Integer questionType;
-    private Long questionId;
-    @ValidEnum(value = QuestionLevel.class, message = "请选择正确的难度等级")
-    private Integer questionLevel;
-    @NotNull
-    private Integer subjectId;
-    @NotBlank
-    private String questionContent;
-    private String[] images;
-    // 试题解析
-    private String analysis;
-    private String createPerson;
-    @Size(min = 1, max = 10, message = "至少要有一个答案", groups = NoneGroupQuestion.class)
-    private Option[] options;
-    private QuestionAddDto[] children;
-
-    // 答案对象
-    @Data
-    @AllArgsConstructor
-    @NoArgsConstructor
-    public static class Option {
-        private Integer id;
-        @NotBlank
-        private String content;
-        private String analysis;
-        private String[] images;
-        @NotNull
-        private Boolean correct;
-    }
-
-    public interface GroupQuestion {
-    }
-
-    public interface NoneGroupQuestion {
-    }
-}

+ 0 - 34
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/dto/UserResult.java

@@ -1,34 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.dto;
-
-import cn.reghao.tnb.content.app.exam.model.vo.QuestionAnswer;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-import jakarta.validation.constraints.NotNull;
-import jakarta.validation.constraints.Size;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author reghao
- * @date 2024-08-24 16:39:41
- */
-@AllArgsConstructor
-@NoArgsConstructor
-@Setter
-@Getter
-public class UserResult {
-    @NotNull
-    private Integer paperId;
-    private Map<Long, QuestionAnswer> cachedUserAnswers;
-    @Size(min = 1, max = 100)
-    private List<QuestionAnswer> submitUserAnswers;
-
-    public UserResult(int paperId, Map<Long, QuestionAnswer> questionAnswerMap) {
-        this.paperId = paperId;
-        this.cachedUserAnswers = questionAnswerMap;
-    }
-}

+ 0 - 48
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/po/Paper.java

@@ -1,48 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.po;
-
-import cn.reghao.jutil.jdk.web.db.BaseObject;
-import cn.reghao.tnb.common.auth.UserContext;
-import cn.reghao.tnb.content.app.exam.model.dto.PaperAddDto;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-
-import java.time.LocalDateTime;
-import java.time.ZoneId;
-import java.util.List;
-
-/**
- * 试卷
- *
- * @author reghao
- * @date 2024-08-24 23:29:46
- */
-@NoArgsConstructor
-@Getter
-public class Paper extends BaseObject<Integer> {
-    private Integer subjectId;
-    private String name;
-    private Integer markType;
-    private Integer scope;
-    private Integer duration;
-    private Integer totalScore;
-    private LocalDateTime startTime;
-    private String passcode;
-    private Boolean hasSubjective;
-    private LocalDateTime createAt;
-    private Long createBy;
-    private transient List<PaperQuestion> paperQuestionList;
-
-    public Paper(PaperAddDto paperAddDto) {
-        this.subjectId = 1;
-        this.name = paperAddDto.getExamName();
-        this.markType = 1;
-        this.scope = 1;
-        this.duration = paperAddDto.getExamDuration();
-        this.totalScore = paperAddDto.getTotalScore();
-        this.startTime = LocalDateTime.ofInstant(paperAddDto.getStartTime().toInstant(), ZoneId.systemDefault());
-        this.passcode = paperAddDto.getExamPassword();
-        this.hasSubjective = false;
-        this.createAt = LocalDateTime.now();
-        this.createBy = UserContext.getUserId();
-    }
-}

+ 0 - 47
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/po/PaperAnswer.java

@@ -1,47 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.po;
-
-import cn.reghao.jutil.jdk.web.db.BaseObject;
-import cn.reghao.tnb.content.app.exam.model.vo.QuestionAnswer;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-/**
- * 用户提交的答案
- *
- * @author reghao
- * @date 2024-09-02 09:37:46
- */
-@NoArgsConstructor
-@Setter
-@Getter
-public class PaperAnswer extends BaseObject<Integer> {
-    private Integer resultId;
-    private Integer pos;
-    private Long pid;
-    private Long questionId;
-    private Integer questionType;
-    private String answer;
-    private Boolean correct;
-    private Integer score;
-    private String review;
-
-    public PaperAnswer(QuestionAnswer userAnswer) {
-        this.pos = userAnswer.getPos();
-        this.pid = userAnswer.getPid();
-        this.questionId = userAnswer.getQuestionId();
-        this.questionType = userAnswer.getQuestionType();
-    }
-
-    public void setResultId(Integer resultId) {
-        this.resultId = resultId;
-    }
-
-    public void setCorrect(Boolean correct) {
-        this.correct = correct;
-    }
-
-    public void setScore(Integer score) {
-        this.score = score;
-    }
-}

+ 0 - 45
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/po/PaperQuestion.java

@@ -1,45 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.po;
-
-import cn.reghao.jutil.jdk.web.db.BaseObject;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-import jakarta.validation.constraints.NotNull;
-import jakarta.validation.constraints.Size;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * @author reghao
- * @date 2024-08-28 08:48:47
- */
-@NoArgsConstructor
-@Setter
-@Getter
-public class PaperQuestion extends BaseObject<Integer> {
-    private Integer paperId;
-    @NotNull
-    private Integer pos;
-    @NotNull
-    private Long questionId;
-    @NotNull
-    private Integer type;
-    @NotNull
-    private Integer score;
-    // 组合题
-    @Size(max = 20)
-    private transient List<PaperQuestion> children = new ArrayList<>();
-
-    public PaperQuestion(int pos, Question question, int score) {
-        this.questionId = question.getQuestionId();
-        this.type = question.getType();
-        this.pos = pos;
-        this.score = score;
-    }
-
-    public void setPaperId(Integer paperId) {
-        this.paperId = paperId;
-    }
-}

+ 0 - 36
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/po/PaperResult.java

@@ -1,36 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.po;
-
-import cn.reghao.jutil.jdk.web.db.BaseObject;
-import cn.reghao.tnb.common.auth.UserContext;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-
-import java.time.LocalDateTime;
-
-/**
- * @author reghao
- * @date 2024-08-28 15:20:08
- */
-@NoArgsConstructor
-@Getter
-public class PaperResult extends BaseObject<Integer> {
-    private Integer paperId;
-    private Integer objectiveScore;
-    private Integer subjectiveScore;
-    private Integer userScore;
-    private LocalDateTime examTime;
-    private Integer consumedTime;
-    private Long createBy;
-    private Boolean marked;
-
-    public PaperResult(int paperId, int objectiveScore, boolean marked) {
-        this.paperId = paperId;
-        this.objectiveScore = objectiveScore;
-        this.subjectiveScore = 0;
-        this.userScore = this.objectiveScore + this.subjectiveScore;
-        this.examTime = LocalDateTime.now();
-        this.consumedTime = 0;
-        this.createBy = UserContext.getUserId();
-        this.marked = marked;
-    }
-}

+ 0 - 86
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/po/Question.java

@@ -1,86 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.po;
-
-import cn.reghao.jutil.jdk.web.db.BaseObject;
-import cn.reghao.tnb.content.app.exam.model.constant.QuestionLevel;
-import cn.reghao.tnb.content.app.exam.model.constant.QuestionType;
-import cn.reghao.tnb.content.app.exam.model.dto.QuestionAddDto;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * 试题
- *
- * @author reghao
- * @date 2024-08-24 23:28:02
- */
-@NoArgsConstructor
-@Getter
-@Setter
-public class Question extends BaseObject<Integer> {
-    private Long questionId;
-    private Integer subjectId;
-    private Integer type;
-    private Integer level;
-    private String content;
-    private String analysis;
-    private Long createBy;
-    private Long pid;
-    private Boolean child;
-    private Integer pos;
-    private String extra;
-    private transient List<QuestionOption> questionOptions;
-
-    public Question(long questionId, String content, int questionType, String extra) {
-        this.questionId = questionId;
-        this.subjectId = 1;
-        this.type = questionType;
-        this.level = QuestionLevel.EASY.getCode();
-        this.content = content;
-        this.analysis = "";
-        this.pid = 0L;
-        this.child = questionType == QuestionType.QUESTION6.getCode();
-        this.pos = 0;
-        this.extra = extra;
-    }
-
-    public Question(long questionId, QuestionAddDto questionAddDto) {
-        this.questionId = questionId;
-        this.subjectId = questionAddDto.getSubjectId();
-        this.type = questionAddDto.getQuestionType();
-        this.level = questionAddDto.getQuestionLevel();
-        this.content = questionAddDto.getQuestionContent();
-        this.analysis = questionAddDto.getAnalysis();
-        this.pid = 0L;
-        this.child = Objects.equals(questionAddDto.getQuestionType(), QuestionType.QUESTION6.getCode());
-        this.pos = 0;
-    }
-
-    public Question(long questionId, QuestionAddDto questionAddDto, boolean child) {
-        this.questionId = questionId;
-        this.subjectId = questionAddDto.getSubjectId();
-        this.type = questionAddDto.getQuestionType();
-        this.level = questionAddDto.getQuestionLevel();
-        this.content = questionAddDto.getQuestionContent();
-        this.analysis = questionAddDto.getAnalysis();
-        this.pid = 0L;
-        this.child = child;
-        this.pos = 0;
-    }
-
-    public void setSubjectId(Integer subjectId) {
-        this.subjectId = subjectId;
-    }
-
-    public void setPid(Long pid) {
-        this.pid = pid;
-    }
-
-    public void setPos(Integer pos) {
-        this.pos = pos;
-    }
-}

+ 0 - 41
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/po/QuestionOption.java

@@ -1,41 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.po;
-
-import cn.reghao.jutil.jdk.web.db.BaseObject;
-import cn.reghao.tnb.content.app.exam.model.dto.QuestionAddDto;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-/**
- * @author reghao
- * @date 2024-08-25 20:32:55
- */
-@NoArgsConstructor
-@Setter
-@Getter
-public class QuestionOption extends BaseObject<Integer> {
-    private Long questionId;
-    private Integer pos;
-    private String content;
-    private String analysis;
-    private Boolean correct;
-
-    public QuestionOption(long questionId, String content, int pos, boolean correct) {
-        this.questionId = questionId;
-        this.pos = pos;
-        this.content = content;
-        this.analysis = "";
-        this.correct = correct;
-    }
-
-    public QuestionOption(int pos, QuestionAddDto.Option option) {
-        this.pos = pos;
-        this.content = option.getContent();
-        this.analysis = option.getAnalysis();
-        this.correct = option.getCorrect();
-    }
-
-    public void setQuestionId(long questionId) {
-        this.questionId = questionId;
-    }
-}

+ 0 - 15
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/po/Subject.java

@@ -1,15 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.po;
-
-import cn.reghao.jutil.jdk.web.db.BaseObject;
-import lombok.Getter;
-
-/**
- * 科目
- *
- * @author reghao
- * @date 2024-08-24 23:25:47
- */
-@Getter
-public class Subject extends BaseObject<Integer> {
-    private String name;
-}

+ 0 - 31
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/provider/QuestionAddGroupSequenceProvider.java

@@ -1,31 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.provider;
-
-import cn.reghao.tnb.content.app.exam.model.constant.QuestionType;
-import cn.reghao.tnb.content.app.exam.model.dto.QuestionAddDto;
-//import org.hibernate.validator.spi.group.DefaultGroupSequenceProvider;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-09-01 10:13:47
- */
-public class QuestionAddGroupSequenceProvider /*implements DefaultGroupSequenceProvider<QuestionAddDto>*/ {
-    //@Override
-    public List<Class<?>> getValidationGroups(QuestionAddDto questionAddDto) {
-        List<Class<?>> defaultGroupSequence = new ArrayList<>();
-        defaultGroupSequence.add(QuestionAddDto.class);
-
-        if (questionAddDto != null) {
-            int questionType = questionAddDto.getQuestionType();
-            if (questionType == QuestionType.QUESTION6.getCode()) {
-                defaultGroupSequence.add(QuestionAddDto.GroupQuestion.class);
-            } else {
-                defaultGroupSequence.add(QuestionAddDto.NoneGroupQuestion.class);
-            }
-        }
-
-        return defaultGroupSequence;
-    }
-}

+ 0 - 69
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/query/ExamQuery.java

@@ -1,69 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.query;
-
-import cn.reghao.jutil.jdk.web.db.Page;
-import cn.reghao.tnb.common.auth.UserContext;
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * @author reghao
- * @date 2024-08-27 17:24:31
- */
-@Setter
-@Getter
-public class ExamQuery {
-    private Integer pageNumber;
-    private Integer pageSize;
-    private Long loginUser;
-    private Integer paperId;
-    private Boolean marked;
-
-    public ExamQuery() {
-        this.pageNumber = 1;
-        this.pageSize = 10;
-    }
-
-    private ExamQuery(Builder builder) {
-        this.pageNumber = builder.pageNumber;
-        this.pageSize = builder.pageSize;
-        this.loginUser = builder.loginUser;
-        this.paperId = builder.paperId;
-        this.marked = builder.marked;
-    }
-
-    public Page getPage() {
-        return new Page(pageNumber, pageSize);
-    }
-
-    public static final class Builder {
-        private Integer pageNumber;
-        private Integer pageSize;
-        private Long loginUser;
-        private Integer paperId;
-        private Boolean marked;
-
-        public Builder() {
-            this.pageNumber = 1;
-            this.pageSize = 10;
-        }
-
-        public Builder loginUser(long loginUser) {
-            this.loginUser = loginUser;
-            return this;
-        }
-
-        public Builder paperId(int paperId) {
-            this.paperId = paperId;
-            return this;
-        }
-
-        public Builder marked(boolean marked) {
-            this.marked = marked;
-            return this;
-        }
-
-        public ExamQuery build() {
-            return new ExamQuery(this);
-        }
-    }
-}

+ 0 - 20
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/query/GetPaperQuery.java

@@ -1,20 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.query;
-
-import lombok.Getter;
-import lombok.Setter;
-
-import jakarta.validation.constraints.NotNull;
-
-/**
- * @author reghao
- * @date 2025-08-11 14:33:52
- */
-@Setter
-@Getter
-public class GetPaperQuery {
-    @NotNull
-    private Integer paperId;
-    @NotNull
-    private Integer viewType;
-    private Long userId;
-}

+ 0 - 70
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/query/PaperQuery.java

@@ -1,70 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.query;
-
-import cn.reghao.jutil.jdk.web.db.Page;
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * @author reghao
- * @date 2024-08-27 17:24:31
- */
-@Setter
-@Getter
-public class PaperQuery {
-    private Integer pageNumber;
-    private Integer pageSize;
-    private Integer subjectId;
-    private Integer scope;
-
-    public PaperQuery() {
-        this.pageNumber = 1;
-        this.pageSize = 10;
-    }
-
-    private PaperQuery(Builder builder) {
-        this.pageNumber = builder.pageNumber;
-        this.pageSize = builder.pageSize;
-        this.subjectId = builder.subjectId;
-        this.scope = builder.scope;
-    }
-
-    public Page getPage() {
-        return new Page(pageNumber, pageSize);
-    }
-
-    public static final class Builder {
-        private Integer pageNumber;
-        private Integer pageSize;
-        private Integer subjectId;
-        private Integer scope;
-
-        public Builder() {
-            this.pageNumber = 1;
-            this.pageSize = 10;
-        }
-
-        public Builder pageNumber(int pageNumber) {
-            this.pageNumber = pageNumber;
-            return this;
-        }
-
-        public Builder pageSize(int pageSize) {
-            this.pageSize = pageSize;
-            return this;
-        }
-
-        public Builder subjectId(int subjectId) {
-            this.subjectId = subjectId;
-            return this;
-        }
-
-        public Builder scope(int scope) {
-            this.scope = scope;
-            return this;
-        }
-
-        public PaperQuery build() {
-            return new PaperQuery(this);
-        }
-    }
-}

+ 0 - 70
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/query/QuestionQuery.java

@@ -1,70 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.query;
-
-import cn.reghao.jutil.jdk.web.db.Page;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-/**
- * @author reghao
- * @date 2023-09-18 11:36:52
- */
-@NoArgsConstructor
-@Setter
-@Getter
-public class QuestionQuery {
-    private Integer pageNumber;
-    private Integer pageSize;
-    private Integer subjectId;
-    private Integer type;
-    private Integer level;
-
-    private QuestionQuery(Builder builder) {
-        this.pageNumber = builder.pageNumber;
-        this.pageSize = builder.pageSize;
-        this.subjectId = builder.subjectId;
-        this.type = builder.type;
-        this.level = builder.level;
-    }
-
-    public Page getPage() {
-        return new Page(pageNumber, pageSize);
-    }
-
-    public static final class Builder {
-        private Integer pageNumber;
-        private Integer pageSize;
-        private Integer subjectId;
-        private Integer type;
-        private Integer level;
-
-        public Builder pageNumber(int pageNumber) {
-            this.pageNumber = pageNumber;
-            return this;
-        }
-
-        public Builder pageSize(int pageSize) {
-            this.pageSize = pageSize;
-            return this;
-        }
-
-        public Builder subjectId(int subjectId) {
-            this.subjectId = subjectId;
-            return this;
-        }
-
-        public Builder level(int level) {
-            this.level = level;
-            return this;
-        }
-
-        public Builder type(int type) {
-            this.type = type;
-            return this;
-        }
-
-        public QuestionQuery build() {
-            return new QuestionQuery(this);
-        }
-    }
-}

+ 0 - 34
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/EvalPaper.java

@@ -1,34 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.vo;
-
-import cn.reghao.jutil.jdk.converter.DateTimeConverter;
-import cn.reghao.tnb.content.app.exam.model.po.Paper;
-import lombok.Getter;
-
-/**
- * @author reghao
- * @date 2024-08-28 09:02:59
- */
-@Getter
-public class EvalPaper {
-    private Integer examId;
-    private String examName;
-    private Boolean needPasscode;
-    private String password;
-    private Integer duration;
-    private String startTime;
-    private Integer totalScore;
-    private String myScore;
-    private Integer evalStatus;
-
-    public EvalPaper(Paper paper, int status, int userScore) {
-        this.needPasscode = false;
-        this.examId = paper.getId();
-        this.examName = paper.getName();
-        this.password = paper.getPasscode();
-        this.duration = paper.getDuration();
-        this.startTime = paper.getStartTime() != null ? DateTimeConverter.format(paper.getStartTime()) : "Anytime";
-        this.totalScore = paper.getTotalScore();
-        this.myScore = userScore != 0 ? ""+userScore : "N/A";
-        this.evalStatus = status;
-    }
-}

+ 0 - 25
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/ExamMark.java

@@ -1,25 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.vo;
-
-/**
- * @author reghao
- * @date 2024-08-29 10:59:50
- */
-public class ExamMark {
-    private int resultId;
-    private int paperId;
-    private String name;
-    private int totalScore;
-    private String examTime;
-    private String student;
-    private long userId;
-
-    public ExamMark(ExamResults examResults, String student, long userId) {
-        this.resultId = examResults.getResultId();
-        this.paperId = examResults.getPaperId();
-        this.name = examResults.getName();
-        this.totalScore = examResults.getTotalScore();
-        this.examTime = examResults.getExamTime();
-        this.student = student;
-        this.userId = userId;
-    }
-}

+ 0 - 39
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/ExamResult.java

@@ -1,39 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.vo;
-
-import cn.reghao.jutil.jdk.converter.DateTimeConverter;
-import cn.reghao.tnb.content.app.exam.model.po.Paper;
-import cn.reghao.tnb.content.app.exam.model.po.PaperResult;
-import lombok.Getter;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-08-24 20:02:44
- */
-@Getter
-public class ExamResult {
-    private int resultId;
-    private int examId;
-    private String examName;
-    private int paperScore;
-    private long userId;
-    private String examTime;
-    private int objectiveScore;
-    private int subjectiveScore;
-    private int userScore;
-    private List<QuestionResult> questionResults;
-
-    public ExamResult(Paper paper, PaperResult paperResult, List<QuestionResult> questionResults) {
-        this.resultId = paperResult.getId();
-        this.examId = paper.getId();
-        this.examName = paper.getName();
-        this.paperScore = paper.getTotalScore();
-        this.userId = 1;
-        this.examTime = DateTimeConverter.format(paperResult.getExamTime());
-        this.objectiveScore = paperResult.getObjectiveScore();
-        this.subjectiveScore = paperResult.getSubjectiveScore();
-        this.userScore = paperResult.getUserScore();
-        this.questionResults = questionResults;
-    }
-}

+ 0 - 18
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/ExamResults.java

@@ -1,18 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.vo;
-
-import lombok.Getter;
-
-/**
- * @author reghao
- * @date 2024-08-29 10:59:50
- */
-@Getter
-public class ExamResults {
-    private int resultId;
-    private int paperId;
-    private String name;
-    private int totalScore;
-    private int userScore;
-    private String examTime;
-    private Long student;
-}

+ 0 - 39
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/PaperDetail.java

@@ -1,39 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.vo;
-
-import cn.reghao.tnb.content.app.exam.model.dto.UserResult;
-import cn.reghao.tnb.content.app.exam.model.po.Paper;
-import lombok.Setter;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @author reghao
- * @date 2024-08-29 17:48:51
- */
-@Setter
-public class PaperDetail {
-    private int paperId;
-    private String name;
-    private int status;
-    private int duration;
-    private int totalScore;
-    // questionType -> list
-    private Map<Integer, List<QuestionInfo>> questionMap;
-    private UserResult userResult;
-
-    public PaperDetail(Paper paper, int status, Map<Integer, List<QuestionInfo>> questionMap, UserResult userResult) {
-        this.paperId = paper.getId();
-        this.name = paper.getName();
-        this.status = status;
-        this.duration = paper.getDuration();
-        this.totalScore = paper.getTotalScore();
-        this.questionMap = questionMap;
-        this.userResult = userResult;
-    }
-
-    public PaperDetail(int paperId, int status) {
-        this.paperId = paperId;
-        this.status = status;
-    }
-}

+ 0 - 43
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/PaperQuestionInfo.java

@@ -1,43 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.vo;
-
-import cn.reghao.tnb.content.app.exam.model.po.PaperQuestion;
-import cn.reghao.tnb.content.app.exam.model.po.Question;
-import cn.reghao.tnb.content.app.exam.model.po.QuestionOption;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2025-08-08 16:18:35
- */
-public class PaperQuestionInfo {
-    private int pos;
-    private int type;
-    private long questionId;
-    private String questionContent;
-    private List<QuestionOptionInfo> questionOptions;
-    private int score;
-    private List<PaperQuestionInfo> children;
-
-    public PaperQuestionInfo(PaperQuestion paperQuestion, Question question) {
-        this.pos = paperQuestion.getPos();
-        this.type = question.getType();
-        this.questionId = question.getQuestionId();
-        this.questionContent = question.getContent();
-        this.score = paperQuestion.getScore();
-    }
-
-    class QuestionOptionInfo {
-        private Long questionId;
-        private Integer pos;
-        private String optionContent;
-        private Boolean correct;
-
-        public QuestionOptionInfo(QuestionOption questionOption) {
-            this.questionId = questionOption.getQuestionId();
-            this.pos = questionOption.getPos();
-            this.optionContent = questionOption.getContent();
-            this.correct = null;
-        }
-    }
-}

+ 0 - 34
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/PaperView.java

@@ -1,34 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.vo;
-
-import cn.reghao.jutil.jdk.converter.DateTimeConverter;
-import cn.reghao.tnb.content.app.exam.model.po.Paper;
-
-/**
- * @author reghao
- * @date 2024-08-28 09:02:59
- */
-public class PaperView {
-    private Integer paperId;
-    private String paperName;
-    private String subject;
-    private Integer markType;
-    private Integer scope;
-    private String passcode;
-    private Integer duration;
-    private String startTime;
-    private Integer totalScore;
-    private Boolean expired;
-
-    public PaperView(String subject, Paper paper, boolean expired) {
-        this.subject = subject;
-        this.paperId = paper.getId();
-        this.paperName = paper.getName();
-        this.markType = paper.getMarkType();
-        this.scope = paper.getScope();
-        this.passcode = paper.getPasscode();
-        this.duration = paper.getDuration();
-        this.startTime = paper.getStartTime() != null ? DateTimeConverter.format(paper.getStartTime()) : "Anytime";
-        this.totalScore = paper.getTotalScore();
-        this.expired = expired;
-    }
-}

+ 0 - 63
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/QuestionAnswer.java

@@ -1,63 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.vo;
-
-import cn.reghao.tnb.content.app.exam.model.po.PaperAnswer;
-import cn.reghao.tnb.content.app.exam.model.po.Question;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-import jakarta.validation.constraints.NotNull;
-import jakarta.validation.constraints.Size;
-import java.io.Serializable;
-
-/**
- * @author reghao
- * @date 2025-08-09 14:00:42
- */
-@NoArgsConstructor
-@Setter
-@Getter
-public class QuestionAnswer implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    @NotNull
-    private Long questionId;
-    @NotNull
-    private Integer questionType;
-    @NotNull
-    private Integer pos;
-    @Size(min = 1, max = 20)
-    private Object[] submitAnswer = {};
-    @Size(min = 1, max = 20)
-    private Object[] correctAnswer = {};
-    @NotNull
-    private Integer submitScore;
-    @NotNull
-    private Integer correctScore;
-
-    private Long pid = 0L;
-
-    public QuestionAnswer(QuestionInfo questionInfo) {
-        this.questionId = questionInfo.getQuestionId();
-        this.questionType = questionInfo.getQuestionType();
-        this.pos = questionInfo.getPos();
-        this.submitScore = 0;
-        this.correctScore = questionInfo.getScore();
-    }
-
-    public QuestionAnswer(PaperAnswer paperAnswer, int correctScore) {
-        this.questionId = paperAnswer.getQuestionId();
-        this.questionType = paperAnswer.getQuestionType();
-        this.pos = paperAnswer.getPos();
-        this.submitScore = paperAnswer.getScore();
-        this.correctScore = correctScore;
-    }
-
-    public QuestionAnswer(Question question, int correctScore) {
-        this.questionId = question.getQuestionId();
-        this.questionType = question.getType();
-        this.pos = 1;
-        this.submitScore = 0;
-        this.correctScore = correctScore;
-    }
-}

+ 0 - 27
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/QuestionAnswerInfo.java

@@ -1,27 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.vo;
-
-import cn.reghao.tnb.content.app.exam.model.po.QuestionOption;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-/**
- * @author reghao
- * @date 2024-08-24 16:06:37
- */
-@NoArgsConstructor
-@AllArgsConstructor
-@Setter
-@Getter
-public class QuestionAnswerInfo {
-    private Long questionId;
-    private Integer pos;
-    private String content;
-
-    public QuestionAnswerInfo(QuestionOption questionOption) {
-        this.questionId = questionOption.getQuestionId();
-        this.pos = questionOption.getPos();
-        this.content = questionOption.getContent();
-    }
-}

+ 0 - 36
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/QuestionDetail.java

@@ -1,36 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.vo;
-
-import cn.reghao.tnb.content.app.exam.model.po.Question;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-08-25 17:42:04
- */
-public class QuestionDetail {
-    private long questionId;
-    private String subject;
-    private int type;
-    private String typeStr;
-    private String level;
-    private String content;
-    private String analysis;
-    private List<QuestionOptionDetail> options;
-    private List<QuestionDetail> children;
-
-    public QuestionDetail(Question question, String subject, String type, String level, List<QuestionOptionDetail> options) {
-        this.questionId = question.getQuestionId();
-        this.subject = subject;
-        this.type = question.getType();
-        this.typeStr = type;
-        this.level = level;
-        this.content = question.getContent();
-        this.analysis = question.getAnalysis().isBlank() ? "无" : question.getAnalysis();
-        this.options = options;
-    }
-
-    public void setChildren(List<QuestionDetail> children) {
-        this.children = children;
-    }
-}

+ 0 - 35
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/QuestionInfo.java

@@ -1,35 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.vo;
-
-import cn.reghao.tnb.content.app.exam.model.po.Question;
-import lombok.Getter;
-import lombok.Setter;
-
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-08-24 16:03:44
- */
-@Setter
-@Getter
-public class QuestionInfo {
-    private int pos;
-    private int questionType;
-    private long questionId;
-    private String questionContent;
-    private List<QuestionAnswerInfo> questionOptions;
-    private int score;
-    @Deprecated
-    private List<QuestionAnswerInfo> answer;
-    private List<QuestionInfo> children;
-
-    public QuestionInfo(int pos, Question question, int score) {
-        this.pos = pos;
-        this.questionType = question.getType();
-        this.questionId = question.getQuestionId();
-        this.questionContent = question.getContent();
-        this.answer = Collections.emptyList();
-        this.score = score;
-    }
-}

+ 0 - 22
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/QuestionOptionDetail.java

@@ -1,22 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.vo;
-
-import cn.reghao.tnb.common.util.StringUtil;
-import cn.reghao.tnb.content.app.exam.model.po.QuestionOption;
-
-/**
- * @author reghao
- * @date 2024-08-25 22:36:35
- */
-public class QuestionOptionDetail {
-    private String option;
-    private String content;
-    private String analysis;
-    private boolean correct;
-
-    public QuestionOptionDetail(QuestionOption option) {
-        this.option = StringUtil.getUppercaseLetter(option.getPos());
-        this.content = option.getContent();
-        this.analysis = option.getAnalysis().isBlank() ? "无" : option.getAnalysis();
-        this.correct = option.getCorrect();
-    }
-}

+ 0 - 24
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/QuestionResult.java

@@ -1,24 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.vo;
-
-import lombok.Getter;
-import lombok.Setter;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-09-02 11:23:41
- */
-@Setter
-@Getter
-public class QuestionResult {
-    private QuestionInfo questionInfo;
-    private Object correctAnswer;
-    private Object userAnswer;
-    private Integer userScore;
-    private List<QuestionResult> children;
-
-    public QuestionResult() {
-        this.userScore = 0;
-    }
-}

+ 0 - 22
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/QuestionView.java

@@ -1,22 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.vo;
-
-
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-
-/**
- * @author reghao
- * @date 2024-08-25 17:10:36
- */
-@AllArgsConstructor
-@Getter
-public class QuestionView {
-    private long questionId;
-    private String subject;
-    private String type;
-    private int typeCode;
-    private String level;
-    private String content;
-    private String createBy;
-    private String createAt;
-}

+ 0 - 25
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/model/vo/SubjectInfo.java

@@ -1,25 +0,0 @@
-package cn.reghao.tnb.content.app.exam.model.vo;
-
-import cn.reghao.tnb.content.app.exam.model.po.Subject;
-
-/**
- * @author reghao
- * @date 2024-08-24 23:49:23
- */
-public class SubjectInfo {
-    private int subjectId;
-    private String subjectName;
-    private int question1Count;
-    private int question2Count;
-    private int question3Count;
-    private int question4Count;
-    private int question5Count;
-    private int question6Count;
-    private int question7Count;
-    private int paperCount;
-
-    public SubjectInfo(Subject subject) {
-        this.subjectId  = subject.getId();
-        this.subjectName  = subject.getName();
-    }
-}

+ 0 - 194
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/service/ExamService.java

@@ -1,194 +0,0 @@
-package cn.reghao.tnb.content.app.exam.service;
-
-import cn.reghao.tnb.common.auth.UserContext;
-import cn.reghao.tnb.content.app.exam.db.mapper.*;
-import cn.reghao.tnb.content.app.exam.model.constant.QuestionType;
-import cn.reghao.tnb.content.app.exam.model.dto.UserResult;
-import cn.reghao.tnb.content.app.exam.model.po.*;
-import cn.reghao.tnb.content.app.exam.model.vo.QuestionAnswer;
-import cn.reghao.tnb.content.app.util.redis.ds.RedisHash;
-import cn.reghao.tnb.content.app.util.redis.ds.RedisOps;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * @author reghao
- * @date 2024-08-24 15:17:48
- */
-@Service
-public class ExamService {
-    private String keyPrefix = "tnb:exam:result";
-    private final QuestionMapper questionMapper;
-    private final QuestionOptionMapper questionOptionMapper;
-    private final PaperQuestionMapper paperQuestionMapper;
-    private final PaperResultMapper paperResultMapper;
-    private final PaperAnswerMapper paperAnswerMapper;
-    private RedisHash redisHash;
-    private RedisOps redisOps;
-
-    public ExamService(QuestionMapper questionMapper, QuestionOptionMapper questionOptionMapper,
-                       PaperQuestionMapper paperQuestionMapper, PaperResultMapper paperResultMapper,
-                       PaperAnswerMapper paperAnswerMapper, RedisHash redisHash, RedisOps redisOps) {
-        this.questionMapper = questionMapper;
-        this.questionOptionMapper = questionOptionMapper;
-        this.paperQuestionMapper = paperQuestionMapper;
-        this.paperResultMapper = paperResultMapper;
-        this.paperAnswerMapper = paperAnswerMapper;
-        this.redisHash = redisHash;
-        this.redisOps = redisOps;
-    }
-
-    public void cacheUserAnswers(UserResult userResult) {
-        long loginUser = UserContext.getUserId();
-        int paperId = userResult.getPaperId();
-        String key = String.format("%s:%s:%s", keyPrefix, paperId, loginUser);
-
-        List<QuestionAnswer> submitUserAnswers = userResult.getSubmitUserAnswers();
-        for (QuestionAnswer userAnswer : submitUserAnswers) {
-            long questionId = userAnswer.getQuestionId();
-            redisHash.hset(key, ""+questionId, userAnswer);
-        }
-    }
-
-    public int submitExamPaper(UserResult userResult) {
-        int paperId = userResult.getPaperId();
-        List<PaperQuestion> paperQuestions = paperQuestionMapper.findByPaperId(paperId);
-        // 客观题数量
-        Long totalObjectiveQuestions = paperQuestions.stream()
-                .filter(paperQuestion -> {
-                    int type = paperQuestion.getType();
-                    return type <= QuestionType.QUESTION3.getCode();
-                }).count();
-
-        Map<Long, Integer> scoreMap = paperQuestions.stream()
-                .collect(Collectors.toMap(PaperQuestion::getQuestionId, PaperQuestion::getScore));
-
-        // pid -> List<QuestionAnswer>
-        Map<Long, List<QuestionAnswer>> group = userResult.getSubmitUserAnswers().stream()
-                .collect(Collectors.groupingBy(QuestionAnswer::getPid));
-        List<PaperAnswer> paperAnswers = new ArrayList<>();
-        for (Map.Entry<Long, List<QuestionAnswer>> entry : group.entrySet()) {
-            long pid = entry.getKey();
-            List<QuestionAnswer> answers = entry.getValue();
-            if (pid == 0) {
-                List<PaperAnswer> list1 = calculateScore(answers, scoreMap);
-                paperAnswers.addAll(list1);
-            } else {
-                List<PaperQuestion> list = paperQuestionMapper.findByPaperIdAndPid(paperId, pid);
-                Map<Long, Integer> scoreMap1 = list.stream()
-                        .collect(Collectors.toMap(PaperQuestion::getQuestionId, PaperQuestion::getScore));
-                List<PaperAnswer> list2 = calculateScore(answers, scoreMap1);
-                paperAnswers.addAll(list2);
-            }
-        }
-
-        int objectiveScore = paperAnswers.stream()
-                .map(PaperAnswer::getScore)
-                .filter(Objects::nonNull)
-                .mapToInt(Integer::intValue)
-                .sum();
-
-        boolean marked = totalObjectiveQuestions.intValue() == paperQuestions.size();
-        PaperResult paperResult = new PaperResult(paperId, objectiveScore, marked);
-        int resultId = savePaperResult(paperResult, paperAnswers);
-
-        long loginUser = UserContext.getUserId();
-        String key = String.format("%s:%s:%s", keyPrefix, paperId, loginUser);
-        redisOps.del(key);
-        return resultId;
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    public int savePaperResult(PaperResult paperResult, List<PaperAnswer> paperAnswers) {
-        paperResultMapper.save(paperResult);
-        int resultId = paperResult.getId();
-        paperAnswers.forEach(paperAnswer -> paperAnswer.setResultId(resultId));
-        paperAnswerMapper.saveAll(paperAnswers);
-        return resultId;
-    }
-
-    /**
-     * 对客观题进行算分
-     *
-     * @param
-     * @return
-     * @date 2025-08-06 10:18:57
-     */
-    private List<PaperAnswer> calculateScore(List<QuestionAnswer> userAnswers, Map<Long, Integer> scoreMap) {
-        List<PaperAnswer> list = new ArrayList<>();
-        for (QuestionAnswer userAnswer : userAnswers) {
-            PaperAnswer paperAnswer = new PaperAnswer(userAnswer);
-            long questionId = userAnswer.getQuestionId();
-            Object[] submitAnswers = userAnswer.getSubmitAnswer();
-            Question question = questionMapper.findByQuestionId(questionId);
-            List<QuestionOption> correctOptions = questionOptionMapper.findByQuestionId(questionId).stream()
-                    .filter(QuestionOption::getCorrect)
-                    .collect(Collectors.toList());
-
-            String answer = "";
-            int type = question.getType();
-            if (type == QuestionType.QUESTION1.getCode() || type == QuestionType.QUESTION3.getCode()) {
-                // 单选和判断
-                int option = (int)submitAnswers[0];
-                answer += option;
-                int correctOption = correctOptions.get(0).getPos();
-                if (option == correctOption) {
-                    paperAnswer.setCorrect(true);
-                    paperAnswer.setScore(scoreMap.get(questionId));
-                } else {
-                    paperAnswer.setCorrect(false);
-                    paperAnswer.setScore(0);
-                }
-            } else if (type == QuestionType.QUESTION2.getCode()) {
-                // 多选
-                StringBuilder sb = new StringBuilder();
-                for (Object obj : submitAnswers) {
-                    sb.append((String) obj).append(",");
-                }
-                answer = sb.toString();
-                int idx = answer.lastIndexOf(",");
-                answer = answer.substring(0, idx);
-
-                Set<Integer> correctAnswers = correctOptions.stream()
-                        .map(QuestionOption::getPos)
-                        .collect(Collectors.toSet());
-
-                if (submitAnswers.length == correctAnswers.size()) {
-                    long total = Arrays.stream(submitAnswers).filter(correctAnswers::contains).count();
-                    if (correctAnswers.size() == total) {
-                        paperAnswer.setCorrect(true);
-                        paperAnswer.setScore(scoreMap.get(questionId));
-                        list.add(paperAnswer);
-                        continue;
-                    }
-                }
-                paperAnswer.setCorrect(false);
-                paperAnswer.setScore(0);
-            } else if (type == QuestionType.QUESTION4.getCode()) {
-                // 填空题
-                StringBuilder sb = new StringBuilder();
-                for (Object obj : userAnswer.getSubmitAnswer()) {
-                    sb.append(obj).append(",");
-                }
-                answer = sb.toString();
-                int idx = answer.lastIndexOf(",");
-                answer = answer.substring(0, idx);
-            } else if (type == QuestionType.QUESTION5.getCode()) {
-                // 问答题
-                answer = (String) userAnswer.getSubmitAnswer()[0];
-            } else if (type == QuestionType.QUESTION6.getCode()) {
-                // 组合题
-                answer = (String) userAnswer.getSubmitAnswer()[0];
-            } else {
-                answer = (String) userAnswer.getSubmitAnswer()[0];
-            }
-            paperAnswer.setAnswer(answer);
-            list.add(paperAnswer);
-        }
-
-        return list;
-    }
-}

+ 0 - 92
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/service/MarkService.java

@@ -1,92 +0,0 @@
-package cn.reghao.tnb.content.app.exam.service;
-
-import cn.reghao.jutil.jdk.web.db.Page;
-import cn.reghao.jutil.jdk.web.db.PageList;
-import cn.reghao.tnb.auth.api.dto.AccountInfo;
-import cn.reghao.tnb.auth.api.iface.AccountQuery;
-import cn.reghao.tnb.common.auth.UserContext;
-import cn.reghao.tnb.content.app.exam.db.mapper.*;
-import cn.reghao.tnb.content.app.exam.model.constant.QuestionType;
-import cn.reghao.tnb.content.app.exam.model.dto.UserResult;
-import cn.reghao.tnb.content.app.exam.model.po.*;
-import cn.reghao.tnb.content.app.exam.model.query.ExamQuery;
-import cn.reghao.tnb.content.app.exam.model.vo.*;
-import org.apache.dubbo.config.annotation.DubboReference;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * @author reghao
- * @date 2024-08-29 09:55:20
- */
-@Service
-public class MarkService {
-    @DubboReference(check = false, retries = 0)
-    private AccountQuery accountQuery;
-
-    private final PaperResultMapper paperResultMapper;
-    private final PaperAnswerMapper paperAnswerMapper;
-
-    public MarkService(PaperResultMapper paperResultMapper, PaperAnswerMapper paperAnswerMapper) {
-        this.paperResultMapper = paperResultMapper;
-        this.paperAnswerMapper = paperAnswerMapper;
-    }
-
-    public PageList<ExamMark> getExamReviewList(ExamQuery examQuery) {
-        int total = paperResultMapper.countByCriteria(examQuery);
-        Page page = examQuery.getPage();
-        List<ExamResults> list = paperResultMapper.findExamResultsByPage(page, examQuery);
-        List<ExamMark> list1 = list.stream()
-                .map(examResults -> {
-                    long userId = examResults.getStudent();
-                    String student = ""+userId;
-                    AccountInfo accountInfo = accountQuery.getAccountInfo(userId);
-                    if (accountInfo != null) {
-                        student = accountInfo.getScreenName();
-                    }
-                    return new ExamMark(examResults, student, userId);
-                })
-                .collect(Collectors.toList());
-        return PageList.pageList(page, total, list1);
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    public void markExamResult(UserResult userResult) {
-        int paperId = userResult.getPaperId();
-        long loginUser = UserContext.getUserId();
-        PaperResult paperResult = getPaperResult(paperId, loginUser);
-        if (paperResult == null) {
-            return;
-        }
-
-        int totalSubjectiveScore = 0;
-        int resultId = paperResult.getId();
-        for (QuestionAnswer questionAnswer : userResult.getSubmitUserAnswers()) {
-            long questionId = questionAnswer.getQuestionId();
-            int questionType = questionAnswer.getQuestionType();
-            if (questionType <= QuestionType.QUESTION3.getCode()) {
-                continue;
-            }
-
-            String review = "";
-            int submitScore = questionAnswer.getSubmitScore();
-            paperAnswerMapper.updatePaperAnswer(resultId, questionId, review, submitScore);
-            totalSubjectiveScore += submitScore;
-        }
-
-        paperResultMapper.updateSetResultMarked(resultId, totalSubjectiveScore);
-    }
-
-    private PaperResult getPaperResult(int paperId, long userId) {
-        ExamQuery examQuery = new ExamQuery.Builder()
-                .loginUser(userId)
-                .paperId(paperId)
-                .build();
-        Page page = examQuery.getPage();
-        List<PaperResult> list = paperResultMapper.findPaperResultByPage(page, examQuery);
-        return list.isEmpty() ? null : list.get(0);
-    }
-}

+ 0 - 212
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/service/PaperService.java

@@ -1,212 +0,0 @@
-package cn.reghao.tnb.content.app.exam.service;
-
-import cn.reghao.jutil.jdk.converter.DateTimeConverter;
-import cn.reghao.jutil.jdk.web.db.Page;
-import cn.reghao.jutil.jdk.web.db.PageList;
-import cn.reghao.jutil.jdk.web.result.Result;
-import cn.reghao.tnb.common.auth.UserContext;
-import cn.reghao.tnb.common.db.KeyValue;
-import cn.reghao.tnb.content.app.exam.db.mapper.*;
-import cn.reghao.tnb.content.app.exam.model.dto.PaperAddDto;
-import cn.reghao.tnb.content.app.exam.model.po.*;
-import cn.reghao.tnb.content.app.exam.model.query.ExamQuery;
-import cn.reghao.tnb.content.app.exam.model.query.PaperQuery;
-import cn.reghao.tnb.content.app.exam.model.vo.*;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.time.LocalDateTime;
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * @author reghao
- * @date 2024-08-27 17:21:01
- */
-@Slf4j
-@Service
-public class PaperService {
-    private final SubjectMapper subjectMapper;
-    private final PaperMapper paperMapper;
-    private final PaperQuestionMapper paperQuestionMapper;
-    private final QuestionMapper questionMapper;
-    private final QuestionOptionMapper questionOptionMapper;
-    private final PaperResultMapper paperResultMapper;
-
-    public PaperService(SubjectMapper subjectMapper, PaperMapper paperMapper, PaperQuestionMapper paperQuestionMapper,
-                        QuestionMapper questionMapper, QuestionOptionMapper questionOptionMapper,
-                        PaperResultMapper paperResultMapper) {
-        this.subjectMapper = subjectMapper;
-        this.paperMapper = paperMapper;
-        this.paperQuestionMapper = paperQuestionMapper;
-        this.questionMapper = questionMapper;
-        this.questionOptionMapper = questionOptionMapper;
-        this.paperResultMapper = paperResultMapper;
-    }
-
-    public Result createExamPaper(PaperAddDto paperAddDto) {
-        Paper paper = new Paper(paperAddDto);
-        List<PaperQuestion> paperQuestions = paperAddDto.getPaperQuestions();
-        save(paper, paperQuestions);
-        return Result.success();
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    public void save(Paper paper, List<PaperQuestion> list) {
-        paperMapper.save(paper);
-        int paperId = paper.getId();
-        list.forEach(paperQuestion -> {
-            paperQuestion.setPaperId(paperId);
-        });
-        /*List<PaperQuestion> list1 = list.stream()
-                .map(paperQuestion -> {
-                    if (paperQuestion.getChildren().isEmpty()) {
-                        return null;
-                    }
-
-                    long questionId = paperQuestion.getQuestionId();
-                    paperQuestion.getChildren().forEach(paperQuestion1 -> {
-                        paperQuestion1.setPaperId(paperId);
-                        paperQuestion1.setPid(questionId);
-                    });
-                    return paperQuestion.getChildren();
-                })
-                .filter(Objects::nonNull)
-                .flatMap(Collection::stream)
-                .collect(Collectors.toList());*/
-        paperQuestionMapper.saveAll(list);
-        /*if (!list1.isEmpty()) {
-            paperQuestionMapper.saveAll(list1);
-        }*/
-    }
-
-    public Result deleteExamPaper(int paperId) {
-        paperMapper.deleteById(paperId);
-        return Result.success();
-    }
-
-    public PageList<EvalPaper> getEvalPapers(PaperQuery paperQuery) {
-        long loginUser = UserContext.getUserId();
-        int total = paperMapper.countByCriteria(paperQuery);
-        Page page = paperQuery.getPage();
-        List<Paper> list = paperMapper.findPaperByPage(page, paperQuery);
-        List<EvalPaper> list1 = list.stream()
-                .map(paper -> {
-                    int paperId = paper.getId();
-                    int markType = paper.getMarkType();
-                    PaperResult paperResult = getPaperResult(paperId, loginUser);
-                    int status;
-                    // 1. 试卷未完成
-                    // 2. 试卷已完成, 自己批改
-                    // 3. 试卷已完成, 他人批改
-                    // 4. 试卷已完成, 已批改
-                    int userScore = 0;
-                    if (paperResult == null) {
-                        status = 1;
-                    } else if (paperResult.getMarked()) {
-                        status = 4;
-                        userScore = paperResult.getUserScore();
-                    } else if (markType == 2) {
-                        status = 2;
-                    } else {
-                        status = 3;
-                    }
-
-                    return new EvalPaper(paper, status, userScore);
-                })
-                .collect(Collectors.toList());
-
-        return PageList.pageList(page, total, list1);
-    }
-
-    public PageList<PaperView> getExamPapers(PaperQuery paperQuery) {
-        int total = paperMapper.countByCriteria(paperQuery);
-        Page page = paperQuery.getPage();
-        List<Paper> list = paperMapper.findPaperByPage(page, paperQuery);
-        List<PaperView> list1 = list.stream()
-                .map(paper -> {
-                    int subjectId = paper.getSubjectId();
-                    String subject = subjectMapper.findById(subjectId).getName();
-
-                    boolean expired = false;
-                    LocalDateTime startTime = paper.getStartTime();
-                    if (startTime != null) {
-                        long expireAt = DateTimeConverter.msTimestamp(startTime) + paper.getDuration()*60*1000L;
-                        expired = expireAt < System.currentTimeMillis();
-                    }
-                    return new PaperView(subject, paper, expired);
-                })
-                .collect(Collectors.toList());
-
-        return PageList.pageList(page, total, list1);
-    }
-
-    public List<QuestionInfo> getPaperQuestions(int paperId) {
-        List<PaperQuestion> paperQuestions = paperQuestionMapper.findByPaperId(paperId);
-        // questionId -> pos
-        Map<Long, PaperQuestion> questionMap = paperQuestions.stream()
-                .collect(Collectors.toMap(PaperQuestion::getQuestionId, k -> k));
-        List<Question> list1 = questionMapper.findByQuestionIds(new ArrayList<>(questionMap.keySet()));
-        return list1.stream().map(question -> {
-            QuestionInfo questionInfo = getQuestionInfo(question, questionMap);
-            long questionId = question.getQuestionId();
-            boolean child = question.getChild();
-            if (child) {
-                List<QuestionInfo> children = getGroupQuestion(paperId, questionId);
-                questionInfo.setChildren(children);
-            }
-            return questionInfo;
-        }).sorted(Comparator.comparingInt(QuestionInfo::getPos)).collect(Collectors.toList());
-    }
-
-    private List<QuestionInfo> getGroupQuestion(int paperId, long pid) {
-        List<Question> questions = questionMapper.findByPid(pid);
-        Map<Long, PaperQuestion> questionMap = paperQuestionMapper.findByPaperIdAndPid(paperId, pid).stream()
-                .collect(Collectors.toMap(PaperQuestion::getQuestionId, k -> k));
-
-        return questions.stream()
-                .map(question -> getQuestionInfo(question, questionMap))
-                .collect(Collectors.toList());
-    }
-
-    private QuestionInfo getQuestionInfo(Question question, Map<Long, PaperQuestion> questionMap) {
-        long questionId = question.getQuestionId();
-        int pos = questionMap.get(questionId).getPos();
-        int score = questionMap.get(questionId).getScore();
-
-        QuestionInfo questionInfo = new QuestionInfo(pos, question, score);
-        List<QuestionOption> list2 = questionOptionMapper.findByQuestionId(questionId);
-        if (!list2.isEmpty()) {
-            List<QuestionAnswerInfo> answerInfos = list2.stream()
-                    .map(QuestionAnswerInfo::new)
-                    .sorted(Comparator.comparingInt(QuestionAnswerInfo::getPos))
-                    .collect(Collectors.toList());
-            questionInfo.setAnswer(answerInfos);
-            questionInfo.setQuestionOptions(answerInfos);
-        }
-
-        return questionInfo;
-    }
-
-    public PaperResult getPaperResult(int paperId, long userId) {
-        ExamQuery examQuery = new ExamQuery.Builder()
-                .loginUser(userId)
-                .paperId(paperId)
-                .build();
-        Page page = examQuery.getPage();
-        List<PaperResult> list = paperResultMapper.findPaperResultByPage(page, examQuery);
-        return list.isEmpty() ? null : list.get(0);
-    }
-
-    public List<KeyValue> getKeyValues() {
-        PaperQuery paperQuery = new PaperQuery.Builder().pageSize(10).build();
-        Page page = paperQuery.getPage();
-        List<Paper> list = paperMapper.findPaperByPage(page, paperQuery);
-        return list.stream().map(paper -> {
-            int paperId = paper.getId();
-            String paperName = paper.getName();
-            return new KeyValue(paperId, paperName);
-        }).collect(Collectors.toList());
-    }
-}

+ 0 - 323
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/service/PaperViewService.java

@@ -1,323 +0,0 @@
-package cn.reghao.tnb.content.app.exam.service;
-
-import cn.reghao.tnb.common.auth.AccountRole;
-import cn.reghao.tnb.common.auth.UserContext;
-import cn.reghao.tnb.content.app.exam.db.mapper.*;
-import cn.reghao.tnb.content.app.exam.model.constant.PaperViewType;
-import cn.reghao.tnb.content.app.exam.model.constant.QuestionType;
-import cn.reghao.tnb.content.app.exam.model.dto.UserResult;
-import cn.reghao.tnb.content.app.exam.model.po.*;
-import cn.reghao.tnb.content.app.exam.model.vo.*;
-import cn.reghao.tnb.content.app.util.redis.ds.RedisHash;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
-
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * @author reghao
- * @date 2025-08-12 14:48:05
- */
-@Slf4j
-@Service
-public class PaperViewService {
-    private String keyPrefix = "tnb:exam:result";
-    private final PaperMapper paperMapper;
-    private final PaperQuestionMapper paperQuestionMapper;
-    private final QuestionMapper questionMapper;
-    private final QuestionOptionMapper questionOptionMapper;
-    private final RedisHash redisHash;
-    private PaperAnswerMapper paperAnswerMapper;
-
-    public PaperViewService(PaperMapper paperMapper, PaperQuestionMapper paperQuestionMapper,
-                            QuestionMapper questionMapper, QuestionOptionMapper questionOptionMapper,
-                            RedisHash redisHash, PaperAnswerMapper paperAnswerMapper) {
-        this.paperMapper = paperMapper;
-        this.paperQuestionMapper = paperQuestionMapper;
-        this.questionMapper = questionMapper;
-        this.questionOptionMapper = questionOptionMapper;
-        this.redisHash = redisHash;
-        this.paperAnswerMapper = paperAnswerMapper;
-    }
-
-    private int getRole() {
-        int role = -1;
-        /*if (UserContext.getUserRoles().contains(AccountRole.examAdmin.getValue())) {
-            role = 1;
-        } else if (UserContext.getUserRoles().contains(AccountRole.examUser.getValue())) {
-            role = 2;
-        }*/
-        return role;
-    }
-
-    public PaperDetail getPaperDetail(int paperId, int viewType, int resultId) {
-        long loginUser = UserContext.getUserId();
-        int role = getRole();
-        Paper paper = paperMapper.findById(paperId);
-        Map<Long, QuestionAnswer> paperAnswers;
-        if (viewType == PaperViewType.PaperPreview.getCode()) {
-            if (role > 1) {
-                // 用户只有做题的权限
-                return new PaperDetail(paperId, 3);
-            }
-
-            paperAnswers = getPaperAnswersFromCorrect(paperId);
-        } else if (viewType == PaperViewType.PaperExam.getCode()) {
-            if (role == 1) {
-                // 用户只有管理的权限
-                return new PaperDetail(paperId, 2);
-            }
-
-            paperAnswers = getPaperAnswersFromCache(paperId, loginUser);
-        } else if (viewType == PaperViewType.PaperMark.getCode()) {
-            int markType = paper.getMarkType();
-            if (markType == 2) {
-                // 自己批改
-                if (role == 1) {
-                    // 试卷由用户自己批改
-                    return new PaperDetail(paperId, 4);
-                }
-            } else if (markType == 3) {
-                // 他人批改
-                if (role > 1) {
-                    // 用户只有做题的权限
-                    return new PaperDetail(paperId, 3);
-                }
-            }
-
-            // 批改试卷不需要客观题
-            paperAnswers = getPaperAnswersFromResult(paperId, resultId, false);
-        } else if (viewType == PaperViewType.PaperResult.getCode()) {
-            if (role == 1) {
-                // 用户只有管理的权限
-                return new PaperDetail(paperId, 2);
-            }
-
-            paperAnswers = getPaperAnswersFromResult(paperId, resultId, true);
-        } else {
-            // 试卷访问类型 viewType 未知
-            return new PaperDetail(paperId, 7);
-        }
-
-        int paperViewStatus = 9;
-        Set<Integer> questionTypes = paperAnswers.values().stream()
-                .collect(Collectors.groupingBy(QuestionAnswer::getQuestionType))
-                .keySet();
-        Map<Integer, List<QuestionInfo>> questionMap = getPaperQuestions(paperId).stream()
-                .filter(questionInfo -> {
-                    int questionType = questionInfo.getQuestionType();
-                    return questionTypes.contains(questionType);
-                })
-                .collect(Collectors.groupingBy(QuestionInfo::getQuestionType));
-        UserResult userResult = new UserResult(paperId, paperAnswers);
-        return new PaperDetail(paper, paperViewStatus, questionMap, userResult);
-    }
-
-    public List<QuestionInfo> getPaperQuestions(int paperId) {
-        List<PaperQuestion> paperQuestions = paperQuestionMapper.findByPaperId(paperId);
-        // questionId -> pos
-        Map<Long, PaperQuestion> questionMap = paperQuestions.stream()
-                .collect(Collectors.toMap(PaperQuestion::getQuestionId, k -> k));
-        List<Question> list1 = questionMapper.findByQuestionIds(new ArrayList<>(questionMap.keySet()));
-        return list1.stream().map(question -> {
-            QuestionInfo questionInfo = getQuestionInfo(question, questionMap);
-            long questionId = question.getQuestionId();
-            boolean child = question.getChild();
-            if (child) {
-                List<QuestionInfo> children = getGroupQuestion(paperId, questionId);
-                questionInfo.setChildren(children);
-            }
-            return questionInfo;
-        }).sorted(Comparator.comparingInt(QuestionInfo::getPos)).collect(Collectors.toList());
-    }
-
-    private List<QuestionInfo> getGroupQuestion(int paperId, long pid) {
-        List<Question> questions = questionMapper.findByPid(pid);
-        Map<Long, PaperQuestion> questionMap = paperQuestionMapper.findByPaperIdAndPid(paperId, pid).stream()
-                .collect(Collectors.toMap(PaperQuestion::getQuestionId, k -> k));
-
-        return questions.stream()
-                .map(question -> getQuestionInfo(question, questionMap))
-                .collect(Collectors.toList());
-    }
-
-    private QuestionInfo getQuestionInfo(Question question, Map<Long, PaperQuestion> questionMap) {
-        long questionId = question.getQuestionId();
-        int pos = questionMap.get(questionId).getPos();
-        int score = questionMap.get(questionId).getScore();
-
-        QuestionInfo questionInfo = new QuestionInfo(pos, question, score);
-        List<QuestionOption> list2 = questionOptionMapper.findByQuestionId(questionId);
-        if (!list2.isEmpty()) {
-            List<QuestionAnswerInfo> answerInfos = list2.stream()
-                    .map(QuestionAnswerInfo::new)
-                    .sorted(Comparator.comparingInt(QuestionAnswerInfo::getPos))
-                    .collect(Collectors.toList());
-            questionInfo.setAnswer(answerInfos);
-            questionInfo.setQuestionOptions(answerInfos);
-        }
-
-        return questionInfo;
-    }
-
-    private Map<Long, QuestionAnswer> getPaperAnswersFromCache(int paperId, long userId) {
-        Map<Long, QuestionAnswer> map = new HashMap<>();
-        String key = String.format("%s:%s:%s", keyPrefix, paperId, userId);
-        redisHash.hgetall(key).forEach((k, v) -> {
-            QuestionAnswer questionAnswer = (QuestionAnswer) v;
-            long questionId = questionAnswer.getQuestionId();
-            Object[] submitAnswer = questionAnswer.getSubmitAnswer();
-            int questionType = questionAnswer.getQuestionType();
-            if (questionType == QuestionType.QUESTION1.getCode()) {
-                if (submitAnswer[0] instanceof String) {
-                    Object[] submitAnswer1 = new Object[] {Integer.parseInt((String) submitAnswer[0])};
-                    questionAnswer.setSubmitAnswer(submitAnswer1);
-                }
-            }
-            map.put(questionId, questionAnswer);
-        });
-        if (!map.isEmpty()) {
-            return map;
-        }
-
-        return getEmptyPaperAnswers(paperId);
-    }
-
-    /**
-     * 获取空白的试卷答案
-     *
-     * @param
-     * @return
-     * @date 2025-08-10 18:08:71
-     */
-    private Map<Long, QuestionAnswer> getEmptyPaperAnswers(int paperId) {
-        Map<Long, QuestionAnswer> map = new HashMap<>();
-        List<QuestionInfo> questions = getPaperQuestions(paperId);
-        for (QuestionInfo questionInfo : questions) {
-            QuestionAnswer questionAnswer = new QuestionAnswer(questionInfo);
-            long questionId = questionInfo.getQuestionId();
-            int type = questionInfo.getQuestionType();
-            List<QuestionOption> questionOptionList = questionOptionMapper.findByQuestionId(questionId);
-            long count = questionOptionList.stream().filter(QuestionOption::getCorrect).count();
-            List<Object> list = new ArrayList<>();
-            for (int i = 0; i < count; i++) {
-                if (type == QuestionType.QUESTION1.getCode() || type == QuestionType.QUESTION3.getCode()) {
-                    // 单选题和判断题前端使用 radio, 需要 int 类型来表示选中的 radio
-                    list.add(-1);
-                } else if (type == QuestionType.QUESTION2.getCode()) {
-                    // 多选题前端使用 checkbox, 使用 string[] 来表示选中的 checkbox
-                    // 空数组表示没有选中
-                } else {
-                    // 填空题和简答题使用空字符串占位
-                    list.add("");
-                }
-                questionAnswer.setSubmitAnswer(list.toArray(new Object[0]));
-            }
-
-            map.putIfAbsent(questionId, questionAnswer);
-        }
-
-        return map;
-    }
-
-    private Map<Long, QuestionAnswer> getPaperAnswersFromResult(int paperId, int resultId, boolean hasObjective) {
-        Map<Long, QuestionAnswer> map = new HashMap<>();
-        List<PaperAnswer> paperAnswerList = paperAnswerMapper.findByResultId(resultId);
-        paperAnswerList.forEach(paperAnswer -> {
-            long questionId = paperAnswer.getQuestionId();
-            int questionType = paperAnswer.getQuestionType();
-            if (questionType <= QuestionType.QUESTION3.getCode() && !hasObjective) {
-                return;
-            }
-
-            PaperQuestion paperQuestion = paperQuestionMapper.findPaperQuestion(paperId, questionId);
-            int correctScore = paperQuestion.getScore();
-            QuestionAnswer questionAnswer = new QuestionAnswer(paperAnswer, correctScore);
-
-            setSubmitAnswer(paperAnswer, questionAnswer);
-            setCorrectAnswer(questionAnswer);
-            map.put(questionId, questionAnswer);
-        });
-
-        return map;
-    }
-
-    private void setCorrectAnswer(QuestionAnswer questionAnswer) {
-        long questionId = questionAnswer.getQuestionId();
-        List<QuestionOption> list = questionOptionMapper.findByQuestionId(questionId);
-        List<Object> correctAnswers = list.stream()
-                .filter(QuestionOption::getCorrect)
-                .map(QuestionOption::getContent)
-                .collect(Collectors.toList());
-        questionAnswer.setCorrectAnswer(correctAnswers.toArray(new Object[0]));
-    }
-
-    private void setSubmitAnswer(PaperAnswer paperAnswer, QuestionAnswer questionAnswer) {
-        int type = paperAnswer.getQuestionType();
-        String submitAnswer = paperAnswer.getAnswer();
-        List<Object> submitAnswerList;
-        if (type == QuestionType.QUESTION1.getCode() || type == QuestionType.QUESTION3.getCode()) {
-            // 单选题和判断题前端使用 radio, 需要 int 类型来表示选中的 radio
-            submitAnswerList = List.of(Integer.parseInt(submitAnswer));
-        } else if (type == QuestionType.QUESTION2.getCode()) {
-            // 多选题前端使用 checkbox, 使用 string[] 来表示选中的 checkbox
-            String[] answerArr = submitAnswer.split(",");
-            submitAnswerList = List.of(answerArr);
-        } else if (type == QuestionType.QUESTION4.getCode()) {
-            // 填空题
-            String[] answerArr = submitAnswer.split(",");
-            submitAnswerList = List.of(answerArr);
-        } else if (type == QuestionType.QUESTION5.getCode()) {
-            // 问答题
-            submitAnswerList = List.of(submitAnswer);
-        } else if (type == QuestionType.QUESTION6.getCode()) {
-            // 组合题
-            submitAnswerList = List.of(submitAnswer);
-        } else {
-            submitAnswerList = List.of(submitAnswer);
-        }
-        questionAnswer.setSubmitAnswer(submitAnswerList.toArray(new Object[0]));
-    }
-
-    private Map<Long, QuestionAnswer> getPaperAnswersFromCorrect(int paperId) {
-        Map<Long, QuestionAnswer> map = new HashMap<>();
-        List<PaperQuestion> paperQuestions = paperQuestionMapper.findByPaperId(paperId);
-        Map<Long, PaperQuestion> paperQuestionMap = paperQuestions.stream()
-                .collect(Collectors.toMap(PaperQuestion::getQuestionId, k -> k));
-        //List<Long> questionIds = paperQuestions.stream().map(PaperQuestion::getQuestionId).collect(Collectors.toList());
-        List<Long> questionIds = new ArrayList<>(paperQuestionMap.keySet());
-
-        List<Question> questions = questionMapper.findByQuestionIds(questionIds);
-        questions.forEach(question -> {
-            long questionId = question.getQuestionId();
-            int type = question.getType();
-            int correctScore = paperQuestionMap.get(questionId).getScore();
-            QuestionAnswer questionAnswer = new QuestionAnswer(question, correctScore);
-
-            List<QuestionOption> list = questionOptionMapper.findByQuestionId(questionId);
-            // 正确答案
-            List<Object> correctAnswerList;
-            if (type == QuestionType.QUESTION1.getCode() || type == QuestionType.QUESTION3.getCode()) {
-                correctAnswerList = list.stream()
-                        .filter(QuestionOption::getCorrect)
-                        .map(QuestionOption::getPos)
-                        .collect(Collectors.toList());
-            } else if (type == QuestionType.QUESTION2.getCode()) {
-                correctAnswerList = list.stream()
-                        .filter(QuestionOption::getCorrect)
-                        .map(QuestionOption::getPos)
-                        .collect(Collectors.toList());
-            } else {
-                correctAnswerList = list.stream()
-                        .filter(QuestionOption::getCorrect)
-                        .map(QuestionOption::getContent)
-                        .collect(Collectors.toList());
-            }
-
-            questionAnswer.setCorrectAnswer(correctAnswerList.toArray(new Object[0]));
-            map.put(questionId, questionAnswer);
-        });
-        return map;
-    }
-}

+ 0 - 181
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/service/QuestionService.java

@@ -1,181 +0,0 @@
-package cn.reghao.tnb.content.app.exam.service;
-
-import cn.reghao.jutil.jdk.converter.DateTimeConverter;
-import cn.reghao.jutil.jdk.web.db.Page;
-import cn.reghao.jutil.jdk.web.db.PageList;
-import cn.reghao.jutil.jdk.web.result.Result;
-import cn.reghao.jutil.jdk.string.SnowFlake;
-import cn.reghao.tnb.common.auth.UserContext;
-import cn.reghao.tnb.common.db.KeyValue;
-import cn.reghao.tnb.content.app.exam.db.mapper.QuestionMapper;
-import cn.reghao.tnb.content.app.exam.db.mapper.QuestionOptionMapper;
-import cn.reghao.tnb.content.app.exam.db.mapper.SubjectMapper;
-import cn.reghao.tnb.content.app.exam.model.constant.QuestionLevel;
-import cn.reghao.tnb.content.app.exam.model.constant.QuestionType;
-import cn.reghao.tnb.content.app.exam.model.dto.QuestionAddDto;
-import cn.reghao.tnb.content.app.exam.model.po.Question;
-import cn.reghao.tnb.content.app.exam.model.po.QuestionOption;
-import cn.reghao.tnb.content.app.exam.model.po.Subject;
-import cn.reghao.tnb.content.app.exam.model.query.QuestionQuery;
-import cn.reghao.tnb.content.app.exam.model.vo.QuestionDetail;
-import cn.reghao.tnb.content.app.exam.model.vo.QuestionOptionDetail;
-import cn.reghao.tnb.content.app.exam.model.vo.QuestionView;
-import org.springframework.stereotype.Service;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.stream.Collectors;
-
-/**
- * @author reghao
- * @date 2024-08-24 23:58:28
- */
-@Service
-public class QuestionService {
-    private final QuestionMapper questionMapper;
-    private final QuestionOptionMapper questionOptionMapper;
-    private final SubjectMapper subjectMapper;
-    private SnowFlake idGenerator;
-
-    public QuestionService(QuestionMapper questionMapper, QuestionOptionMapper questionOptionMapper,
-                           SubjectMapper subjectMapper) {
-        this.questionMapper = questionMapper;
-        this.questionOptionMapper = questionOptionMapper;
-        this.subjectMapper = subjectMapper;
-        this.idGenerator = new SnowFlake(1L, 1L);
-    }
-
-    public Result addQuestion(QuestionAddDto questionAddDto) {
-        long questionId = idGenerator.nextId();
-        int type = questionAddDto.getQuestionType();
-        if (type == QuestionType.QUESTION6.getCode()) {
-            Question question = new Question(questionId, questionAddDto, true);
-            questionMapper.save(question);
-
-            int subjectId = question.getSubjectId();
-            Arrays.stream(questionAddDto.getChildren()).forEach(questionAddDto1 -> {
-                long questionId1 = idGenerator.nextId();
-                Question question1 = new Question(questionId1, questionAddDto1);
-                question1.setPid(questionId);
-                question1.setSubjectId(subjectId);
-                List<QuestionOption> options1 = getQuestionOptions(questionAddDto1);
-                save(question1, options1);
-            });
-        } else {
-            Question question = new Question(questionId, questionAddDto);
-            List<QuestionOption> options = getQuestionOptions(questionAddDto);
-            save(question, options);
-        }
-
-        if (type == QuestionType.QUESTION1.getCode()) {
-        } else if (type == QuestionType.QUESTION2.getCode()) {
-        } else if (type == QuestionType.QUESTION3.getCode()) {
-        } else if (type == QuestionType.QUESTION4.getCode()) {
-        } else if (type == QuestionType.QUESTION5.getCode()) {
-        } else if (type == QuestionType.QUESTION6.getCode()) {
-        } else {
-        }
-
-        return Result.success();
-    }
-
-    public Result deleteQuestion(long questionId) {
-        Question question = questionMapper.findByQuestionId(questionId);
-        if (question.getChild()) {
-            List<Question> children = questionMapper.findByPid(questionId);
-            children.forEach(question1 -> {
-                long questionId1 = question1.getQuestionId();
-                questionOptionMapper.deleteByQuestionId(questionId1);
-                questionMapper.deleteByQuestionId(questionId1);
-            });
-        }
-
-        questionOptionMapper.deleteByQuestionId(questionId);
-        questionMapper.deleteByQuestionId(questionId);
-        return Result.success();
-    }
-
-    private List<QuestionOption> getQuestionOptions(QuestionAddDto questionAddDto) {
-        QuestionAddDto.Option[] optionArr = questionAddDto.getOptions();
-        List<QuestionOption> options = new ArrayList<>(optionArr.length);
-        for (int i = 0; i < optionArr.length; i++) {
-            int pos = i+1;
-            QuestionOption questionOption = new QuestionOption(pos, optionArr[i]);
-            options.add(questionOption);
-        }
-
-        return options;
-    }
-
-    private void save(Question question, List<QuestionOption> options) {
-        questionMapper.save(question);
-        long questionId = question.getQuestionId();
-        options.forEach(questionOption -> questionOption.setQuestionId(questionId));
-        if (!options.isEmpty()) {
-            questionOptionMapper.saveAll(options);
-        }
-    }
-
-    public PageList<QuestionView> getQuestions(QuestionQuery questionQuery) {
-        int total = questionMapper.countByCriteria(questionQuery);
-        Page page = questionQuery.getPage();
-        List<Question> list = questionMapper.findQuestionByPage(page, questionQuery);
-        List<QuestionView> list1 = list.stream().map(this::getQuestionView).collect(Collectors.toList());
-        return PageList.pageList(page, total, list1);
-    }
-
-    private QuestionView getQuestionView(Question question) {
-        long questionId = question.getQuestionId();
-        int subjectId = question.getSubjectId();
-        Subject subject = subjectMapper.findById(subjectId);
-        int type = question.getType();
-        String typeStr = QuestionType.getDescByCode(type);
-        int level = question.getLevel();
-        String levelStr = QuestionLevel.getDescByCode(level);
-
-        String createBy = UserContext.getUserId() + "";
-        String createAt = DateTimeConverter.format(question.getCreateTime());
-        return new QuestionView(questionId, subject.getName(), typeStr, type, levelStr, question.getContent(), createBy, createAt);
-    }
-
-    public QuestionDetail getQuestionDetail(long questionId) {
-        Question question = questionMapper.findByQuestionId(questionId);
-        List<QuestionOptionDetail> options = questionOptionMapper.findByQuestionId(questionId).stream()
-                .map(QuestionOptionDetail::new)
-                .collect(Collectors.toList());
-
-        int subjectId = question.getSubjectId();
-        Subject subject = subjectMapper.findById(subjectId);
-        int type = question.getType();
-        String typeStr = QuestionType.getDescByCode(type);
-        int level = question.getLevel();
-        String levelStr = QuestionLevel.getDescByCode(level);
-        QuestionDetail questionDetail = new QuestionDetail(question, subject.getName(), typeStr, levelStr, options);
-        if (type == QuestionType.QUESTION6.getCode()) {
-            List<QuestionDetail> list1 = questionMapper.findByPid(questionId).stream().map(question1 -> {
-                long questionId1 = question1.getQuestionId();
-                int type1 = question1.getType();
-                String typeStr1 = QuestionType.getDescByCode(type1);
-                int level1 = question1.getLevel();
-                String levelStr1 = QuestionLevel.getDescByCode(level1);
-                List<QuestionOptionDetail> options1 = questionOptionMapper.findByQuestionId(questionId1).stream()
-                        .map(QuestionOptionDetail::new)
-                        .collect(Collectors.toList());
-                return new QuestionDetail(question1, subject.getName(), typeStr1, levelStr1, options1);
-            }).collect(Collectors.toList());
-            questionDetail.setChildren(list1);
-        }
-
-        return questionDetail;
-    }
-
-    public List<KeyValue> getKeyValues() {
-        return Arrays.stream(QuestionType.values())
-                .map(type -> {
-                    int code = type.getCode();
-                    String desc = type.getDesc();
-                    return new KeyValue(code, desc);
-                }).collect(Collectors.toList());
-    }
-}

+ 0 - 51
content/content-service/src/main/java/cn/reghao/tnb/content/app/exam/service/SubjectService.java

@@ -1,51 +0,0 @@
-package cn.reghao.tnb.content.app.exam.service;
-
-import cn.reghao.jutil.jdk.web.db.PageList;
-import cn.reghao.tnb.common.db.KeyValue;
-import cn.reghao.tnb.content.app.exam.db.mapper.PaperMapper;
-import cn.reghao.tnb.content.app.exam.db.mapper.QuestionMapper;
-import cn.reghao.tnb.content.app.exam.db.mapper.SubjectMapper;
-import cn.reghao.tnb.content.app.exam.model.vo.SubjectInfo;
-import org.springframework.stereotype.Service;
-
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * @author reghao
- * @date 2024-08-24 23:23:54
- */
-@Service
-public class SubjectService {
-    private final SubjectMapper subjectMapper;
-    private final QuestionMapper questionMapper;
-    private final PaperMapper paperMapper;
-
-    public SubjectService(SubjectMapper subjectMapper, QuestionMapper questionMapper, PaperMapper paperMapper) {
-        this.subjectMapper = subjectMapper;
-        this.questionMapper = questionMapper;
-        this.paperMapper = paperMapper;
-    }
-
-    public PageList<SubjectInfo> getSubjectInfos(int pageNumber, int pageSize) {
-        List<SubjectInfo> list = subjectMapper.findAll().stream().map(subject -> {
-            /*int id = subject.getId();
-            List<GroupCount> list1 = questionMapper.findGroupBySubjectId(id);
-            list1.forEach(groupCount -> {
-                int type = Integer.parseInt(groupCount.getId());
-                int total = groupCount.getTotal();
-            });
-            int paperCount = paperMapper.countBySubjectId(id);*/
-            return new SubjectInfo(subject);
-        }).collect(Collectors.toList());
-        return PageList.pageList(pageNumber, pageSize, list.size(), list);
-    }
-
-    public List<KeyValue> getKeyValues() {
-        return subjectMapper.findAll().stream().map(subject -> {
-            int id = subject.getId();
-            String name = subject.getName();
-            return new KeyValue(id, name);
-        }).collect(Collectors.toList());
-    }
-}

+ 0 - 70
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/controller/CartController.java

@@ -1,70 +0,0 @@
-package cn.reghao.tnb.content.app.mall.controller;
-
-import cn.reghao.tnb.common.web.WebResult;
-import cn.reghao.tnb.common.auth.AuthUser;
-import cn.reghao.tnb.common.auth.UserContext;
-import cn.reghao.tnb.content.app.mall.model.dto.CartDto;
-import cn.reghao.tnb.content.app.mall.model.dto.BuyProductDto;
-import cn.reghao.tnb.content.app.mall.model.vo.CartCard;
-import cn.reghao.tnb.content.app.mall.service.BuyService;
-import cn.reghao.tnb.content.app.mall.service.CartService;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import org.springframework.http.MediaType;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-04-16 10:54:44
- */
-@Tag(name = "购物车接口")
-@RestController
-@RequestMapping("/api/mall/cart")
-public class CartController {
-    private final CartService cartService;
-    private final BuyService buyService;
-
-    public CartController(CartService cartService, BuyService buyService) {
-        this.cartService = cartService;
-        this.buyService = buyService;
-    }
-
-    @Operation(summary = "将商品加入购物车", description = "N")
-    @AuthUser
-    @PostMapping("")
-    public String addCart(@RequestBody @Validated CartDto cartDto) {
-        long loginUser = UserContext.getUserId();
-        long itemId = cartDto.getItemId();
-        int num = cartDto.getNum();
-        cartService.addCartItem(loginUser, itemId, num);
-        return WebResult.success();
-    }
-
-    @Operation(summary = "从购物车中删除商品", description = "N")
-    @AuthUser
-    @DeleteMapping("/{itemId}")
-    public String deleteItem(@PathVariable("itemId") Long itemId) {
-        long loginUser = UserContext.getUserId();
-        cartService.deleteCartItem(loginUser, itemId);
-        return WebResult.success();
-    }
-
-    @Operation(summary = "获取购物车中的商品", description = "N")
-    @AuthUser
-    @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getCartItems() {
-        long loginUser = UserContext.getUserId();
-        List<CartCard> list = cartService.getUserCart(loginUser);
-        return WebResult.success(list);
-    }
-
-    @Operation(summary = "购买购物车商品", description = "N")
-    @PostMapping("/buy")
-    public String buyCartItems(@RequestBody @Validated BuyProductDto buyProductDto) {
-        long orderId = buyService.buyCartItems(buyProductDto);
-        return WebResult.success(orderId);
-    }
-}

+ 0 - 51
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/controller/DeliveryController.java

@@ -1,51 +0,0 @@
-package cn.reghao.tnb.content.app.mall.controller;
-
-import cn.reghao.tnb.common.web.WebResult;
-import cn.reghao.tnb.common.auth.AuthUser;
-import cn.reghao.tnb.common.auth.UserContext;
-import cn.reghao.tnb.content.app.mall.model.po.Delivery;
-import cn.reghao.tnb.content.app.mall.service.DeliveryService;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-04-26 11:45:14
- */
-@Tag(name = "收货地址接口")
-@RestController
-@RequestMapping("/api/mall/delivery")
-public class DeliveryController {
-    private final DeliveryService deliveryService;
-
-    public DeliveryController(DeliveryService deliveryService) {
-        this.deliveryService = deliveryService;
-    }
-
-    @Operation(summary = "添加收获地址", description = "N")
-    @AuthUser
-    @PostMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String addDeliveryAddress() {
-        return WebResult.success();
-    }
-
-    @Operation(summary = "删除收获地址", description = "N")
-    @AuthUser
-    @DeleteMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String deleteDeliveryAddress() {
-        return WebResult.success();
-    }
-
-    @Operation(summary = "获取用户的收获地址列表", description = "N")
-    @AuthUser
-    @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getDeliveryAddress() {
-        long loginUser = UserContext.getUserId();
-        List<Delivery> list = deliveryService.getUserAddresses(loginUser);
-        return WebResult.success(list);
-    }
-}

+ 0 - 55
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/controller/LogisticsController.java

@@ -1,55 +0,0 @@
-package cn.reghao.tnb.content.app.mall.controller;
-
-import cn.reghao.tnb.common.web.WebResult;
-import cn.reghao.tnb.common.auth.AuthUser;
-import cn.reghao.tnb.common.auth.UserContext;
-import cn.reghao.tnb.content.app.mall.model.po.Logistics;
-import cn.reghao.tnb.content.app.mall.model.po.LogisticsProgress;
-import cn.reghao.tnb.content.app.mall.service.LogisticsService;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import org.springframework.http.MediaType;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-09-19 09:06:30
- */
-@Tag(name = "订单物流接口")
-@RestController
-@RequestMapping("/api/mall/logistics")
-public class LogisticsController {
-    private final LogisticsService logisticsService;
-
-    public LogisticsController(LogisticsService logisticsService) {
-        this.logisticsService = logisticsService;
-    }
-
-    @Operation(summary = "添加订单物流", description = "N")
-    @AuthUser
-    @PostMapping(value = "/order", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String putOrderLogistics(@RequestBody @Validated Logistics logistics) {
-        logisticsService.putOrderLogistics(logistics);
-        return WebResult.success();
-    }
-
-    @Operation(summary = "更新订单物流进度", description = "N")
-    @AuthUser
-    @PostMapping(value = "/progress", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String putOrderLogisticsProgress(@RequestBody @Validated LogisticsProgress logisticsProgress) {
-        logisticsService.putOrderLogisticsProgress(logisticsProgress);
-        return WebResult.success();
-    }
-
-    @Operation(summary = "获取订单物流进度", description = "N")
-    @AuthUser
-    @GetMapping(value = "/order/{orderId}", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getOrderLogistics(@PathVariable("orderId") Long orderId) {
-        long userId = UserContext.getUserId();
-        List<LogisticsProgress> list = logisticsService.getOrderLogistics(userId, orderId);
-        return WebResult.success(list);
-    }
-}

+ 0 - 84
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/controller/ProductController.java

@@ -1,84 +0,0 @@
-package cn.reghao.tnb.content.app.mall.controller;
-
-import cn.reghao.jutil.jdk.web.db.PageList;
-import cn.reghao.jutil.jdk.web.result.Result;
-import cn.reghao.tnb.common.web.WebResult;
-import cn.reghao.tnb.content.api.dto.TaobaoItem;
-import cn.reghao.tnb.content.app.mall.model.dto.BuyProductDto;
-import cn.reghao.tnb.content.app.mall.model.dto.ProductAddDto;
-import cn.reghao.tnb.content.app.mall.model.po.Product;
-import cn.reghao.tnb.content.app.mall.service.BuyService;
-import cn.reghao.tnb.content.app.mall.service.ProductService;
-import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
-import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
-import com.netflix.hystrix.contrib.javanica.conf.HystrixPropertiesManager;
-import io.swagger.v3.oas.annotations.tags.Tag;
-import io.swagger.v3.oas.annotations.Operation;
-import org.springframework.http.MediaType;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * @author reghao
- * @date 2024-04-16 10:53:54
- */
-@Tag(name = "商品接口")
-@RestController
-@RequestMapping("/api/mall/product")
-public class ProductController {
-    private final ProductService productService;
-    private final BuyService buyService;
-
-    public ProductController(ProductService productService, BuyService buyService) {
-        this.productService = productService;
-        this.buyService = buyService;
-    }
-
-    @Operation(summary = "添加淘宝商品", description = "N")
-    @PostMapping("/taobao")
-    public String addCam(@RequestBody @Validated TaobaoItem taobaoItem) {
-        productService.add(taobaoItem);
-        return WebResult.success();
-    }
-
-    @Operation(summary = "发布商品", description = "N")
-    @PostMapping("")
-    public String addProduct(@RequestBody @Validated ProductAddDto productAddDto) throws Exception {
-        Result result = productService.addProduct(productAddDto);
-        return WebResult.result(result);
-    }
-
-    @Operation(summary = "获取商品列表", description = "N")
-    @GetMapping(value = "", produces = MediaType.APPLICATION_JSON_VALUE)
-    public String getProducts(@RequestParam("page") int page) {
-        PageList<Product> pageList = productService.getPage(page);
-        return WebResult.success(pageList);
-    }
-
-    @Operation(summary = "获取商品详情", description = "N")
-    @GetMapping(value = "/{itemId}", produces = MediaType.APPLICATION_JSON_VALUE)
-    @HystrixCommand(
-            fallbackMethod = "getProductFallback",
-            commandProperties = {
-                    @HystrixProperty(name = HystrixPropertiesManager.CIRCUIT_BREAKER_ENABLED, value = "false"),
-                    @HystrixProperty(name="metrics.rollingStats.timeInMilliseconds", value="5000"),
-                    @HystrixProperty(name="circuitBreaker.requestVolumeThreshold", value="4"),
-                    @HystrixProperty(name="circuitBreaker.errorThresholdPercentage", value="50"),
-                    @HystrixProperty(name="circuitBreaker.sleepWindowInMilliseconds", value="3000")
-            })
-    public String getProduct(@PathVariable("itemId") Long itemId) {
-        Product product = productService.getProduct(itemId);
-        return WebResult.success(product);
-    }
-
-    public String getProductFallback(Long itemId) {
-        return WebResult.fallback("fallback");
-    }
-
-    @Operation(summary = "购买商品", description = "N")
-    @PostMapping("/buy")
-    public String buyProduct(@RequestBody @Validated BuyProductDto buyProductDto) {
-        long orderId = buyService.buyProduct(buyProductDto);
-        return WebResult.success(orderId);
-    }
-}

+ 0 - 16
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/db/mapper/DeliveryMapper.java

@@ -1,16 +0,0 @@
-package cn.reghao.tnb.content.app.mall.db.mapper;
-
-import cn.reghao.jutil.jdk.web.db.BaseMapper;
-import cn.reghao.tnb.content.app.mall.model.po.Delivery;
-import org.apache.ibatis.annotations.Mapper;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-04-19 09:46:32
- */
-@Mapper
-public interface DeliveryMapper extends BaseMapper<Delivery> {
-    List<Delivery> findByOwner(long owner);
-}

+ 0 - 15
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/db/mapper/LogisticsMapper.java

@@ -1,15 +0,0 @@
-package cn.reghao.tnb.content.app.mall.db.mapper;
-
-import cn.reghao.jutil.jdk.web.db.BaseMapper;
-import cn.reghao.tnb.content.app.mall.model.po.Logistics;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * @author reghao
- * @date 2024-09-19 09:01:13
- */
-@Mapper
-public interface LogisticsMapper extends BaseMapper<Logistics> {
-    Logistics findByOrderId(long orderId);
-    Logistics findByLogisticsId(String logisticsId);
-}

+ 0 - 16
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/db/mapper/LogisticsProgressMapper.java

@@ -1,16 +0,0 @@
-package cn.reghao.tnb.content.app.mall.db.mapper;
-
-import cn.reghao.jutil.jdk.web.db.BaseMapper;
-import cn.reghao.tnb.content.app.mall.model.po.LogisticsProgress;
-import org.apache.ibatis.annotations.Mapper;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-09-19 09:23:55
- */
-@Mapper
-public interface LogisticsProgressMapper extends BaseMapper<LogisticsProgress> {
-    List<LogisticsProgress> findByLogisticsId(String logisticsId);
-}

+ 0 - 18
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/db/mapper/ProductMapper.java

@@ -1,18 +0,0 @@
-package cn.reghao.tnb.content.app.mall.db.mapper;
-
-import cn.reghao.jutil.jdk.web.db.BaseMapper;
-import cn.reghao.tnb.content.app.mall.model.po.Product;
-import org.apache.ibatis.annotations.Mapper;
-import org.apache.ibatis.annotations.Param;
-
-/**
- * @author reghao
- * @date 2024-04-16 10:56:38
- */
-@Mapper
-public interface ProductMapper extends BaseMapper<Product> {
-    void updateStockMinus(@Param("itemId") long itemId, @Param("num") int num);
-    void updateStockPlus(@Param("itemId") long itemId, @Param("num") int num);
-
-    Product findByItemId(long itemId);
-}

+ 0 - 16
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/db/mapper/ProductSnapshotMapper.java

@@ -1,16 +0,0 @@
-package cn.reghao.tnb.content.app.mall.db.mapper;
-
-import cn.reghao.jutil.jdk.web.db.BaseMapper;
-import cn.reghao.tnb.content.api.dto.ItemSnapshot;
-import cn.reghao.tnb.content.app.mall.model.po.ProductSnapshot;
-import org.apache.ibatis.annotations.Mapper;
-
-/**
- * @author reghao
- * @date 2024-04-26 16:37:48
- */
-@Mapper
-public interface ProductSnapshotMapper extends BaseMapper<ProductSnapshot> {
-    ProductSnapshot findByOrderId(long orderId);
-    ItemSnapshot findItemSnapshotByOrderId(long orderId);
-}

+ 0 - 52
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/db/repository/MallRepository.java

@@ -1,52 +0,0 @@
-package cn.reghao.tnb.content.app.mall.db.repository;
-
-import cn.reghao.tnb.content.api.dto.ItemSnapshot;
-import cn.reghao.tnb.content.app.mall.db.mapper.ProductMapper;
-import cn.reghao.tnb.content.app.mall.db.mapper.ProductSnapshotMapper;
-import cn.reghao.tnb.content.app.mall.model.po.Product;
-import cn.reghao.tnb.content.app.mall.model.po.ProductSnapshot;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.cache.annotation.Cacheable;
-import org.springframework.stereotype.Repository;
-import org.springframework.transaction.annotation.Transactional;
-
-/**
- * @author reghao
- * @date 2024-04-16 15:27:35
- */
-@Slf4j
-@Repository
-public class MallRepository {
-    private final ProductMapper productMapper;
-    private final ProductSnapshotMapper productSnapshotMapper;
-
-    public MallRepository(ProductMapper productMapper, ProductSnapshotMapper productSnapshotMapper) {
-        this.productMapper = productMapper;
-        this.productSnapshotMapper = productSnapshotMapper;
-    }
-
-    // TODO 需要锁来保证库存变化的准确性
-    @Transactional(rollbackFor = Exception.class)
-    public void updateProduct(int amount, ProductSnapshot productSnapshot) {
-        long productId = productSnapshot.getItemId();
-        // 减商品库存
-        productMapper.updateStockMinus(productId, amount);
-        productSnapshotMapper.save(productSnapshot);
-    }
-
-    @Transactional(rollbackFor = Exception.class)
-    public void updateCancelOrder(long productId, int amount) {
-        // 恢复商品库存
-        productMapper.updateStockMinus(productId, amount);
-    }
-
-    //@Cacheable(cacheNames = "tnb:mall:product", key = "#itemId", unless = "#result == null")
-    public Product getProduct(Long itemId) {
-        log.info("miss cache");
-        return productMapper.findByItemId(itemId);
-    }
-
-    public ItemSnapshot getItemSnapshot(long orderId) {
-        return productSnapshotMapper.findItemSnapshotByOrderId(orderId);
-    }
-}

+ 0 - 13
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/feign/DiscoveryClientConfig.java

@@ -1,13 +0,0 @@
-package cn.reghao.tnb.content.app.mall.feign;
-
-import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * @author reghao
- * @date 2025-07-24 09:41:04
- */
-@Configuration
-@EnableDiscoveryClient
-public class DiscoveryClientConfig {
-}

+ 0 - 79
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/feign/FeignClientConfig.java

@@ -1,79 +0,0 @@
-package cn.reghao.tnb.content.app.mall.feign;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.cloud.client.circuitbreaker.CircuitBreaker;
-import org.springframework.cloud.client.circuitbreaker.CircuitBreakerFactory;
-import org.springframework.cloud.client.circuitbreaker.ConfigBuilder;
-import org.springframework.cloud.client.circuitbreaker.NoFallbackAvailableException;
-import org.springframework.cloud.openfeign.EnableFeignClients;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.function.Function;
-import java.util.function.Supplier;
-
-/**
- * @author reghao
- * @date 2025-07-20 17:25:49
- */
-@Slf4j
-@Configuration
-@EnableFeignClients
-public class FeignClientConfig {
-    @Bean
-    MyCircuitBreaker myCircuitBreaker() {
-        return new MyCircuitBreaker();
-    }
-
-    @SuppressWarnings("rawtypes")
-    @Bean
-    CircuitBreakerFactory circuitBreakerFactory(MyCircuitBreaker myCircuitBreaker) {
-        return new CircuitBreakerFactory() {
-            @Override
-            public CircuitBreaker create(String id) {
-                log.info("Creating a circuit breaker with id [{}]", id);
-                return myCircuitBreaker;
-            }
-
-            @Override
-            protected ConfigBuilder configBuilder(String id) {
-                return Object::new;
-            }
-
-            @Override
-            public void configureDefault(Function defaultConfiguration) {
-
-            }
-        };
-    }
-
-    static class MyCircuitBreaker implements CircuitBreaker {
-        AtomicBoolean runWasCalled = new AtomicBoolean();
-
-        @Override
-        public <T> T run(Supplier<T> toRun) {
-            try {
-                this.runWasCalled.set(true);
-                return toRun.get();
-            }
-            catch (Throwable throwable) {
-                throw new NoFallbackAvailableException("No fallback available.", throwable);
-            }
-        }
-
-        @Override
-        public <T> T run(Supplier<T> toRun, Function<Throwable, T> fallback) {
-            try {
-                return run(toRun);
-            }
-            catch (Throwable throwable) {
-                return fallback.apply(throwable);
-            }
-        }
-
-        public void clear() {
-            this.runWasCalled.set(false);
-        }
-    }
-}

+ 0 - 51
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/feign/LoadBalanceConfig.java

@@ -1,51 +0,0 @@
-package cn.reghao.tnb.content.app.mall.feign;
-
-//import com.netflix.loadbalancer.IRule;
-//import com.netflix.loadbalancer.RoundRobinRule;
-import org.springframework.cloud.client.ServiceInstance;
-import org.springframework.cloud.client.loadbalancer.LoadBalanced;
-import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClient;
-import org.springframework.cloud.loadbalancer.core.RandomLoadBalancer;
-import org.springframework.cloud.loadbalancer.core.ReactorLoadBalancer;
-import org.springframework.cloud.loadbalancer.core.RoundRobinLoadBalancer;
-import org.springframework.cloud.loadbalancer.core.ServiceInstanceListSupplier;
-import org.springframework.cloud.loadbalancer.support.LoadBalancerClientFactory;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.env.Environment;
-import org.springframework.web.client.RestTemplate;
-
-/**
- * @author reghao
- * @date 2025-07-23 15:40:24
- */
-@LoadBalancerClient(name = "user-service", configuration = LoadBalanceConfig.CustomLoadBalancerConfiguration.class)
-@Configuration
-public class LoadBalanceConfig {
-    /*@Bean
-    public IRule iRule() {
-        return new RoundRobinRule();
-    }*/
-
-    @Bean(name = "lbRestTemplate")
-    // 提供客户端负载均衡
-    @LoadBalanced
-    public RestTemplate restTemplate() {
-        return new RestTemplate();
-    }
-
-    static class CustomLoadBalancerConfiguration {
-        @Bean
-        ReactorLoadBalancer<ServiceInstance> randomLoadBalancer(Environment environment,
-                                                                LoadBalancerClientFactory loadBalancerClientFactory) {
-            String name = environment.getProperty(LoadBalancerClientFactory.PROPERTY_NAME);
-            // 随机负载均衡策略
-            RandomLoadBalancer randomLoadBalancer = new RandomLoadBalancer(
-                    loadBalancerClientFactory.getLazyProvider(name, ServiceInstanceListSupplier.class), name);
-            // 轮询负载均衡策略
-            RoundRobinLoadBalancer roundRobinLoadBalancer = new RoundRobinLoadBalancer(
-                    loadBalancerClientFactory.getLazyProvider(name, ServiceInstanceListSupplier.class), name);
-            return roundRobinLoadBalancer;
-        }
-    }
-}

+ 0 - 51
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/feign/UserDiscoveryClient.java

@@ -1,51 +0,0 @@
-package cn.reghao.tnb.content.app.mall.feign;
-
-import cn.reghao.tnb.auth.api.iface.AccountQuery;
-import cn.reghao.tnb.user.api.dto.UserInfo;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.dubbo.config.annotation.DubboReference;
-import org.springframework.cloud.client.ServiceInstance;
-import org.springframework.cloud.client.discovery.DiscoveryClient;
-import org.springframework.stereotype.Service;
-import org.springframework.web.client.RestTemplate;
-
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2025-07-23 17:18:00
- */
-@Slf4j
-@Service
-public class UserDiscoveryClient {
-    @DubboReference(check = false, retries = 0, timeout = 1000, mock = "fallback")
-    private AccountQuery accountQuery;
-
-    String serviceName = "user-service";
-    private DiscoveryClient discoveryClient;
-    // 必须使用 new 新建, 否则会被 Ribbon 拦截器拦截,改变 URL 行为
-    private RestTemplate restTemplate = new RestTemplate();
-
-    public UserDiscoveryClient(DiscoveryClient discoveryClient) {
-        this.discoveryClient = discoveryClient;
-    }
-
-    public UserInfo getUserInfo(long userId) {
-        List<ServiceInstance> list = discoveryClient.getInstances(serviceName);
-        if (list.isEmpty()) {
-            return null;
-        }
-
-        ServiceInstance serviceInstance = list.get(0);
-        String url = serviceInstance.getUri().toString();
-        String url1 = String.format("%s//api/user/hystrix/info1?userId=%s", url, userId);
-
-        UserInfo userInfo = restTemplate.getForObject(url1, UserInfo.class);
-        if (userInfo != null) {
-            long userIdLong = accountQuery.getUserIdLong(userInfo.getUserId());
-            log.info("{} -> {}", userIdLong, userInfo.getScreenName());
-        }
-
-        return userInfo;
-    }
-}

+ 0 - 28
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/feign/UserFeignClient.java

@@ -1,28 +0,0 @@
-package cn.reghao.tnb.content.app.mall.feign;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.http.MediaType;
-import org.springframework.stereotype.Component;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-
-/**
- * @author reghao
- * @date 2025-07-19 23:57:25
- */
-@FeignClient(name = "user-service", fallback = UserFeignClient.UserFeignClientImpl.class)
-public interface UserFeignClient {
-    @GetMapping(value = "/api/user/hystrix/info", produces = MediaType.APPLICATION_JSON_VALUE)
-    String getUserInfo(@RequestParam("userId") Long userId);
-
-    @Slf4j
-    @Component
-    class UserFeignClientImpl implements UserFeignClient {
-        @Override
-        public String getUserInfo(Long userId) {
-            log.info("getUserInfo fallback");
-            return "";
-        }
-    }
-}

+ 0 - 47
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/feign/UserLoadBalancerClient.java

@@ -1,47 +0,0 @@
-package cn.reghao.tnb.content.app.mall.feign;
-
-import cn.reghao.tnb.auth.api.iface.AccountQuery;
-import cn.reghao.tnb.user.api.dto.UserInfo;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.dubbo.config.annotation.DubboReference;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.stereotype.Service;
-import org.springframework.util.LinkedMultiValueMap;
-import org.springframework.util.MultiValueMap;
-import org.springframework.web.client.RestTemplate;
-
-/**
- * @author reghao
- * @date 2025-07-23 17:18:27
- */
-@Slf4j
-@Service
-public class UserLoadBalancerClient {
-    @DubboReference(check = false, retries = 0, timeout = 1000, mock = "fallback")
-    private AccountQuery accountQuery;
-
-    String serviceName = "user-service";
-    // 基于 Ribbon 的 RestTemplate
-    private RestTemplate lbRestTemplate;
-
-    public UserLoadBalancerClient(@Qualifier("lbRestTemplate") RestTemplate lbRestTemplate) {
-        this.lbRestTemplate = lbRestTemplate;
-    }
-
-    public UserInfo getUserInfo(long userId) {
-        String serviceUrlPrefix = String.format("http://%s", serviceName);
-        String url1 = String.format("%s//api/user/hystrix/info1?userId=%s", serviceUrlPrefix, userId);
-        UserInfo userInfo = lbRestTemplate.getForObject(url1, UserInfo.class);
-        if (userInfo != null) {
-            long userIdLong = accountQuery.getUserIdLong(userInfo.getUserId());
-            log.info("{} -> {}", userIdLong, userInfo.getScreenName());
-        }
-        return userInfo;
-    }
-
-    public void add(long userId) {
-        MultiValueMap<String, Object> paramMap = new LinkedMultiValueMap<String, Object>();
-        paramMap.add("userId", userId);
-        // UserInfo userInfo = lbRestTemplate.postForObject(url1, paramMap, UserInfo.class);
-    }
-}

+ 0 - 43
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/constant/LogisticsStatus.java

@@ -1,43 +0,0 @@
-package cn.reghao.tnb.content.app.mall.model.constant;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author reghao
- * @date 2024-09-19 11:27:40
- */
-public enum LogisticsStatus {
-    status1(1, "已发货"),
-    status2(2, "已揽件"),
-    status3(3, "运输中"),
-    status4(4, "派送中"),
-    status5(5, "待取件"),
-    status6(6, "已签收");
-
-    private final int code;
-    private final String desc;
-
-    private static Map<Integer, LogisticsStatus> map = new HashMap<>();
-    static {
-        for (LogisticsStatus status : LogisticsStatus.values()) {
-            map.put(status.code, status);
-        }
-    }
-    LogisticsStatus(int code, String desc) {
-        this.code = code;
-        this.desc = desc;
-    }
-
-    public Integer getCode() {
-        return code;
-    }
-
-    public String getDesc() {
-        return desc;
-    }
-
-    public static LogisticsStatus getByCode(int code) {
-        return map.get(code);
-    }
-}

+ 0 - 23
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/dto/BuyItem.java

@@ -1,23 +0,0 @@
-package cn.reghao.tnb.content.app.mall.model.dto;
-
-import lombok.Getter;
-import lombok.Setter;
-
-import jakarta.validation.constraints.NotNull;
-
-/**
- * @author reghao
- * @date 2024-04-26 15:34:11
- */
-@Setter
-@Getter
-public class BuyItem {
-    @NotNull
-    private Long itemId;
-    @NotNull
-    private Integer num;
-    @NotNull
-    private Long shopId;
-    @NotNull
-    private Long sellerId;
-}

+ 0 - 19
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/dto/BuyProductDto.java

@@ -1,19 +0,0 @@
-package cn.reghao.tnb.content.app.mall.model.dto;
-
-import lombok.Getter;
-
-import jakarta.validation.constraints.NotNull;
-import jakarta.validation.constraints.Size;
-import java.util.List;
-
-/**
- * @author reghao
- * @date 2024-04-16 15:59:27
- */
-@Getter
-public class BuyProductDto {
-    @NotNull
-    private Long deliveryId;
-    @Size(min = 1, max = 100)
-    private List<BuyItem> items;
-}

+ 0 - 17
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/dto/CartDto.java

@@ -1,17 +0,0 @@
-package cn.reghao.tnb.content.app.mall.model.dto;
-
-import lombok.Getter;
-
-import jakarta.validation.constraints.NotNull;
-
-/**
- * @author reghao
- * @date 2024-04-16 15:05:08
- */
-@Getter
-public class CartDto {
-    @NotNull
-    private Long itemId;
-    @NotNull
-    private Integer num;
-}

+ 0 - 18
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/dto/ProductAddDto.java

@@ -1,18 +0,0 @@
-package cn.reghao.tnb.content.app.mall.model.dto;
-
-import lombok.Getter;
-import lombok.Setter;
-
-/**
- * @author reghao
- * @date 2024-11-08 09:31:00
- */
-@Setter
-@Getter
-public class ProductAddDto {
-    private String title;
-    private String coverFileId;
-    private Integer coverChannelCode;
-    private Double price;
-    private Integer amount;
-}

+ 0 - 21
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/po/Delivery.java

@@ -1,21 +0,0 @@
-package cn.reghao.tnb.content.app.mall.model.po;
-
-import cn.reghao.jutil.jdk.web.db.BaseObject;
-import lombok.AllArgsConstructor;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-/**
- * @author reghao
- * @date 2024-04-19 09:43:06
- */
-@NoArgsConstructor
-@AllArgsConstructor
-@Setter
-@Getter
-public class Delivery extends BaseObject<Integer> {
-    private Long deliveryId;
-    private String address;
-    private Long owner;
-}

+ 0 - 19
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/po/Logistics.java

@@ -1,19 +0,0 @@
-package cn.reghao.tnb.content.app.mall.model.po;
-
-import lombok.Getter;
-
-import jakarta.validation.constraints.NotNull;
-
-/**
- * @author reghao
- * @date 2024-09-19 09:00:07
- */
-@Getter
-public class Logistics {
-    @NotNull
-    private Long orderId;
-    @NotNull
-    private String tpl;
-    @NotNull
-    private String logisticsId;
-}

+ 0 - 31
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/po/LogisticsProgress.java

@@ -1,31 +0,0 @@
-package cn.reghao.tnb.content.app.mall.model.po;
-
-import cn.reghao.tnb.content.app.mall.model.constant.LogisticsStatus;
-import lombok.Getter;
-import lombok.Setter;
-
-import java.time.LocalDateTime;
-
-/**
- * @author reghao
- * @date 2024-09-19 09:22:10
- */
-@Setter
-@Getter
-public class LogisticsProgress {
-    private Long orderId;
-    private String logisticsId;
-    private Integer status;
-    private String current;
-    private LocalDateTime createAt;
-
-    public LogisticsProgress() {
-        this.createAt = LocalDateTime.now();
-    }
-
-    public LogisticsProgress(String logisticsId) {
-        this.status = LogisticsStatus.status1.getCode();
-        this.current = "包裹正在等待揽收";
-        this.createAt = LocalDateTime.now();
-    }
-}

+ 0 - 49
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/po/Product.java

@@ -1,49 +0,0 @@
-package cn.reghao.tnb.content.app.mall.model.po;
-
-import cn.reghao.jutil.jdk.web.db.BaseObject;
-import cn.reghao.tnb.common.auth.UserContext;
-import cn.reghao.tnb.content.api.dto.TaobaoItem;
-import cn.reghao.tnb.content.app.mall.model.dto.ProductAddDto;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-/**
- * @author reghao
- * @date 2024-04-16 10:56:20
- */
-@NoArgsConstructor
-@Setter
-@Getter
-public class Product extends BaseObject<Integer> {
-    private Long itemId;
-    private String itemUrl;
-    private String title;
-    private String picUrl;
-    private Double price;
-    private String monthSale;
-    private Integer stock;
-    private Long shopId;
-    private Long sellerId;
-
-    public Product(TaobaoItem taobaoItem) {
-        this.itemId = taobaoItem.getItemId();
-        this.itemUrl = taobaoItem.getItemUrl();
-        this.title = taobaoItem.getTitle();
-        this.picUrl = taobaoItem.getPicUrl();
-        this.price = taobaoItem.getPrice();
-        this.monthSale = taobaoItem.getMonthSale();
-        this.stock = 1000;
-        this.shopId = taobaoItem.getShopId();
-        this.sellerId = taobaoItem.getSellerId();
-    }
-
-    public Product(ProductAddDto productAddDto, long productId, String coverUrl) {
-        this.itemId = productId;
-        this.title = productAddDto.getTitle();
-        this.picUrl = coverUrl;
-        this.price = productAddDto.getPrice();
-        this.stock = productAddDto.getAmount();
-        this.sellerId = UserContext.getUserId();
-    }
-}

+ 0 - 29
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/po/ProductSnapshot.java

@@ -1,29 +0,0 @@
-package cn.reghao.tnb.content.app.mall.model.po;
-
-import cn.reghao.jutil.jdk.web.db.BaseObject;
-import lombok.Getter;
-import lombok.NoArgsConstructor;
-import lombok.Setter;
-
-/**
- * @author reghao
- * @date 2024-04-26 16:37:29
- */
-@NoArgsConstructor
-@Getter
-@Setter
-public class ProductSnapshot extends BaseObject<Integer> {
-    private Long orderId;
-    private Long itemId;
-    private String title;
-    private String picUrl;
-    private Double price;
-
-    public ProductSnapshot(long orderId, Product product) {
-        this.orderId = orderId;
-        this.itemId = product.getItemId();
-        this.title = product.getTitle();
-        this.picUrl = product.getPicUrl();
-        this.price = product.getPrice();
-    }
-}

+ 0 - 27
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/model/vo/CartCard.java

@@ -1,27 +0,0 @@
-package cn.reghao.tnb.content.app.mall.model.vo;
-
-import cn.reghao.tnb.content.app.mall.model.po.Product;
-
-/**
- * @author reghao
- * @date 2024-04-16 15:16:56
- */
-public class CartCard {
-    private Long itemId;
-    private String title;
-    private String picUrl;
-    private Double price;
-    private Integer num;
-    private Long shopId;
-    private Long sellerId;
-
-    public CartCard(Product product, int num) {
-        this.itemId = product.getItemId();
-        this.title = product.getTitle();
-        this.picUrl = product.getPicUrl();
-        this.price = product.getPrice();
-        this.num = num;
-        this.shopId = product.getShopId();
-        this.sellerId = product.getSellerId();
-    }
-}

+ 0 - 50
content/content-service/src/main/java/cn/reghao/tnb/content/app/mall/rpc/MallServiceImpl.java

@@ -1,50 +0,0 @@
-package cn.reghao.tnb.content.app.mall.rpc;
-
-import cn.reghao.tnb.content.api.dto.ItemSnapshot;
-import cn.reghao.tnb.content.api.iface.MallService;
-import cn.reghao.tnb.content.app.mall.db.repository.MallRepository;
-import cn.reghao.tnb.content.app.mall.model.po.Product;
-import cn.reghao.tnb.content.app.mall.service.CartService;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.dubbo.config.annotation.DubboService;
-import org.springframework.stereotype.Service;
-
-/**
- * @author reghao
- * @date 2024-12-04 11:37:41
- */
-@Slf4j
-@DubboService
-@Service
-public class MallServiceImpl implements MallService {
-    private final MallRepository mallRepository;
-    private final CartService cartService;
-
-    public MallServiceImpl(MallRepository mallRepository,CartService cartService) {
-        this.mallRepository = mallRepository;
-        this.cartService = cartService;
-    }
-
-    public void updateCancelOrder(long productId, int amount) {
-        mallRepository.updateCancelOrder(productId, amount);
-        log.info("cancel order");
-    }
-
-    public double getProductPrice(long itemId) {
-        Product product = mallRepository.getProduct(itemId);
-        return product.getPrice();
-    }
-
-    public void deleteCartItem(long userId, long productId) {
-        cartService.deleteCartItem(userId, productId);
-    }
-
-    public ItemSnapshot getItemSnapshot(long orderId) {
-        return mallRepository.getItemSnapshot(orderId);
-    }
-
-    public long getSellerId(long itemId) {
-        Product product = mallRepository.getProduct(itemId);
-        return product.getSellerId();
-    }
-}

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.