parent
95ab621590
commit
c0f08da047
56 changed files with 2277 additions and 43 deletions
@ -0,0 +1,33 @@ |
|||||||
|
package cn.soul2.demo.controller; |
||||||
|
|
||||||
|
import cn.soul2.demo.repository.IExternalBackhaulRepository; |
||||||
|
import cn.soul2.demo.utils.base.BackUtils; |
||||||
|
import cn.soul2.demo.vo.base.Back; |
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Soul2 |
||||||
|
* @date 2024-03-12 10:30 |
||||||
|
*/ |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
@RestController |
||||||
|
@RequestMapping("/external") |
||||||
|
public class ExternalBackhaulController { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private IExternalBackhaulRepository externalBackhaulRepository; |
||||||
|
|
||||||
|
@PostMapping("wjx") |
||||||
|
public Back<Boolean> wjx(@RequestBody JSONObject backhaul) { |
||||||
|
externalBackhaulRepository.save(backhaul, "wjx", null); |
||||||
|
return BackUtils.success(Boolean.TRUE); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,53 @@ |
|||||||
|
package cn.soul2.demo.controller; |
||||||
|
|
||||||
|
import cn.soul2.demo.dto.QuestionnaireDTO; |
||||||
|
import cn.soul2.demo.dto.base.UpdateStatusDTO; |
||||||
|
import cn.soul2.demo.repository.IQuestionnaireRepository; |
||||||
|
import cn.soul2.demo.utils.base.BackUtils; |
||||||
|
import cn.soul2.demo.vo.QuestionnaireVO; |
||||||
|
import cn.soul2.demo.vo.base.Back; |
||||||
|
import cn.soul2.demo.vo.base.VPage; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||||
|
import org.springframework.web.bind.annotation.RestController; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Soul2 |
||||||
|
* @date 2024-03-12 12:28 |
||||||
|
*/ |
||||||
|
|
||||||
|
@Slf4j |
||||||
|
@RestController |
||||||
|
@RequestMapping("/questionnaire") |
||||||
|
public class QuestionnaireController { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private IQuestionnaireRepository questionnaireRepository; |
||||||
|
|
||||||
|
@PostMapping("saveOrUpdate") |
||||||
|
public Back<Boolean> saveOrUpdate(@RequestBody QuestionnaireDTO dto) { |
||||||
|
return BackUtils.success(questionnaireRepository.saveOrUpdate(dto)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("page") |
||||||
|
public Back<VPage<QuestionnaireVO>> page(@RequestBody QuestionnaireDTO dto) { |
||||||
|
return BackUtils.success(questionnaireRepository.page(dto)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("remove") |
||||||
|
public Back<Boolean> remove(@RequestBody List<String> ids) { |
||||||
|
return BackUtils.success(questionnaireRepository.removeByIds(ids)); |
||||||
|
} |
||||||
|
|
||||||
|
@PostMapping("status") |
||||||
|
public Back<Boolean> status(@RequestBody UpdateStatusDTO dto) { |
||||||
|
return BackUtils.success(questionnaireRepository.updateStatus(dto)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,35 @@ |
|||||||
|
package cn.soul2.demo.dto; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Soul2 |
||||||
|
* @date 2024-03-13 10:55 |
||||||
|
*/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@Accessors(chain = true) |
||||||
|
public class AnswerDetailsSaveDTO { |
||||||
|
|
||||||
|
/** |
||||||
|
* 答卷id |
||||||
|
*/ |
||||||
|
private String answerSheetId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目id |
||||||
|
*/ |
||||||
|
private String subjectId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 回答内容(文字/选项id) |
||||||
|
*/ |
||||||
|
private String answerContent; |
||||||
|
|
||||||
|
/** |
||||||
|
* 得分 |
||||||
|
*/ |
||||||
|
private Integer points; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
package cn.soul2.demo.dto; |
||||||
|
|
||||||
|
import cn.soul2.demo.dto.base.PageParams; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Soul2 |
||||||
|
* @date 2024-03-13 13:42 |
||||||
|
*/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@Accessors(chain = true) |
||||||
|
public class AnswerPageQueryDTO extends PageParams { |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态 |
||||||
|
*/ |
||||||
|
private Integer status; |
||||||
|
|
||||||
|
/** |
||||||
|
* 答卷人 |
||||||
|
*/ |
||||||
|
private String respondent; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,42 @@ |
|||||||
|
package cn.soul2.demo.dto; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Soul2 |
||||||
|
* @date 2024-03-13 10:39 |
||||||
|
*/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@Accessors(chain = true) |
||||||
|
public class AnswerSheetSaveDTO { |
||||||
|
|
||||||
|
/** |
||||||
|
* 问卷id |
||||||
|
*/ |
||||||
|
private String qnId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 二维码id |
||||||
|
*/ |
||||||
|
private String qrId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态 |
||||||
|
*/ |
||||||
|
private Integer status; |
||||||
|
|
||||||
|
/** |
||||||
|
* 答题详情 |
||||||
|
*/ |
||||||
|
private List<AnswerDetailsSaveDTO> details; |
||||||
|
|
||||||
|
/** |
||||||
|
* 答卷人 |
||||||
|
*/ |
||||||
|
private String respondent; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
package cn.soul2.demo.dto; |
||||||
|
|
||||||
|
import cn.soul2.demo.dto.base.PageParams; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Soul2 |
||||||
|
* @date 2024-03-12 11:28 |
||||||
|
*/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@Accessors(chain = true) |
||||||
|
public class ExternalBackhaulDTO extends PageParams { |
||||||
|
|
||||||
|
/** |
||||||
|
* 来自谁 |
||||||
|
*/ |
||||||
|
private String originalBy; |
||||||
|
|
||||||
|
/** |
||||||
|
* 回传来源平台 |
||||||
|
*/ |
||||||
|
private String externalName; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,27 @@ |
|||||||
|
package cn.soul2.demo.dto; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.util.Collection; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Soul2 |
||||||
|
* @date 2024-03-13 15:21 |
||||||
|
*/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@Accessors(chain = true) |
||||||
|
public class QnSubjectRefDTO { |
||||||
|
|
||||||
|
/** |
||||||
|
* 问卷Id |
||||||
|
*/ |
||||||
|
private String qnId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目id |
||||||
|
*/ |
||||||
|
private Collection<String> subjectIds; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,51 @@ |
|||||||
|
package cn.soul2.demo.dto; |
||||||
|
|
||||||
|
import cn.soul2.demo.dto.base.PageParams; |
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Soul2 |
||||||
|
* @date 2024-03-12 12:29 |
||||||
|
*/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@Accessors(chain = true) |
||||||
|
public class QuestionnaireDTO extends PageParams { |
||||||
|
|
||||||
|
/** |
||||||
|
* id |
||||||
|
*/ |
||||||
|
private String id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 名称 |
||||||
|
*/ |
||||||
|
private String name; |
||||||
|
|
||||||
|
/** |
||||||
|
* 二维码id |
||||||
|
*/ |
||||||
|
private String qrId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态:0:禁用;1:启用; |
||||||
|
*/ |
||||||
|
private Short status; |
||||||
|
|
||||||
|
/** |
||||||
|
* 开始时间 |
||||||
|
*/ |
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||||
|
private LocalDateTime startTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 结束时间 |
||||||
|
*/ |
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||||
|
private LocalDateTime endTime; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,48 @@ |
|||||||
|
package cn.soul2.demo.dto; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Soul2 |
||||||
|
* @date 2024-03-13 13:03 |
||||||
|
*/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@Accessors(chain = true) |
||||||
|
public class SubjectDTO { |
||||||
|
|
||||||
|
/** |
||||||
|
* id |
||||||
|
*/ |
||||||
|
private String id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目标题 |
||||||
|
*/ |
||||||
|
private String title; |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目内容 |
||||||
|
*/ |
||||||
|
private String content; |
||||||
|
|
||||||
|
/** |
||||||
|
* 排列序号 |
||||||
|
*/ |
||||||
|
private Short sort; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 题目类型:0-单选;1-多选;2-文字 |
||||||
|
*/ |
||||||
|
private Short type; |
||||||
|
|
||||||
|
/** |
||||||
|
* 选项 |
||||||
|
*/ |
||||||
|
private List<SubjectItemDTO> items; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,43 @@ |
|||||||
|
package cn.soul2.demo.dto; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Soul2 |
||||||
|
* @date 2024-03-13 13:04 |
||||||
|
*/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@Accessors(chain = true) |
||||||
|
public class SubjectItemDTO { |
||||||
|
|
||||||
|
/** |
||||||
|
* id |
||||||
|
*/ |
||||||
|
private String itemId; |
||||||
|
/** |
||||||
|
* 选项内容 |
||||||
|
*/ |
||||||
|
private String content; |
||||||
|
|
||||||
|
/** |
||||||
|
* 排列序号 |
||||||
|
*/ |
||||||
|
private Short sort; |
||||||
|
/** |
||||||
|
* 权重 |
||||||
|
*/ |
||||||
|
private Object weights; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分值 |
||||||
|
*/ |
||||||
|
private Integer points; |
||||||
|
|
||||||
|
/** |
||||||
|
* 是正确答案 |
||||||
|
*/ |
||||||
|
private Short isRight; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,27 @@ |
|||||||
|
package cn.soul2.demo.dto; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.util.Collection; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Soul2 |
||||||
|
* @date 2024-03-13 15:21 |
||||||
|
*/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@Accessors(chain = true) |
||||||
|
public class SubjectItemRefDTO { |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目id |
||||||
|
*/ |
||||||
|
private String subjectId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 选项id |
||||||
|
*/ |
||||||
|
private Collection<String> itemIds; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,25 @@ |
|||||||
|
package cn.soul2.demo.dto.base; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Soul2 |
||||||
|
* @date 2024-03-12 12:39 |
||||||
|
*/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@Accessors(chain = true) |
||||||
|
public class UpdateStatusDTO { |
||||||
|
|
||||||
|
/** |
||||||
|
* id |
||||||
|
*/ |
||||||
|
private String id; |
||||||
|
|
||||||
|
/** |
||||||
|
* status |
||||||
|
*/ |
||||||
|
private String status; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,87 @@ |
|||||||
|
package cn.soul2.demo.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||||
|
import com.baomidou.mybatisplus.extension.activerecord.Model; |
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 答卷详情表 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
@Getter |
||||||
|
@Setter |
||||||
|
@Accessors(chain = true) |
||||||
|
@TableName("tb_answer_details") |
||||||
|
public class AnswerDetailsDO extends Model<AnswerDetailsDO> { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
/** |
||||||
|
* id |
||||||
|
*/ |
||||||
|
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||||
|
private String id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态:0:禁用;1:启用; |
||||||
|
*/ |
||||||
|
@TableField("status") |
||||||
|
private Short status; |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新时间 |
||||||
|
*/ |
||||||
|
@TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE) |
||||||
|
private LocalDateTime updatedTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建时间 |
||||||
|
*/ |
||||||
|
@TableField(value = "created_time", fill = FieldFill.INSERT) |
||||||
|
private LocalDateTime createdTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除标识: 0-存在; 1-删除 |
||||||
|
*/ |
||||||
|
@TableField("removed") |
||||||
|
@TableLogic |
||||||
|
private Short removed; |
||||||
|
|
||||||
|
/** |
||||||
|
* 答卷id |
||||||
|
*/ |
||||||
|
@TableField("answer_sheet_id") |
||||||
|
private String answerSheetId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目id |
||||||
|
*/ |
||||||
|
@TableField("subject_id") |
||||||
|
private String subjectId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 回答内容(文字/选项id) |
||||||
|
*/ |
||||||
|
@TableField("answer_content") |
||||||
|
private String answerContent; |
||||||
|
|
||||||
|
/** |
||||||
|
* 得分 |
||||||
|
*/ |
||||||
|
@TableField("points") |
||||||
|
private Integer points; |
||||||
|
|
||||||
|
@Override |
||||||
|
public Serializable pkVal() { |
||||||
|
return this.id; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,81 @@ |
|||||||
|
package cn.soul2.demo.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||||
|
import com.baomidou.mybatisplus.extension.activerecord.Model; |
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 答卷表 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-13 12:36:58 |
||||||
|
*/ |
||||||
|
@Getter |
||||||
|
@Setter |
||||||
|
@Accessors(chain = true) |
||||||
|
@TableName("tb_answer_sheet") |
||||||
|
public class AnswerSheetDO extends Model<AnswerSheetDO> { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
/** |
||||||
|
* id |
||||||
|
*/ |
||||||
|
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||||
|
private String id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态:0:未提交;1:已提交; |
||||||
|
*/ |
||||||
|
@TableField("status") |
||||||
|
private Short status; |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新时间 |
||||||
|
*/ |
||||||
|
@TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE) |
||||||
|
private LocalDateTime updatedTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建时间 |
||||||
|
*/ |
||||||
|
@TableField(value = "created_time", fill = FieldFill.INSERT) |
||||||
|
private LocalDateTime createdTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除标识: 0-存在; 1-删除 |
||||||
|
*/ |
||||||
|
@TableField("removed") |
||||||
|
@TableLogic |
||||||
|
private Short removed; |
||||||
|
|
||||||
|
/** |
||||||
|
* 问卷id |
||||||
|
*/ |
||||||
|
@TableField("qn_id") |
||||||
|
private String qnId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 二维码id |
||||||
|
*/ |
||||||
|
@TableField("qr_id") |
||||||
|
private String qrId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 答卷人 |
||||||
|
*/ |
||||||
|
@TableField("respondent") |
||||||
|
private String respondent; |
||||||
|
|
||||||
|
@Override |
||||||
|
public Serializable pkVal() { |
||||||
|
return this.id; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,75 @@ |
|||||||
|
package cn.soul2.demo.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||||
|
import com.baomidou.mybatisplus.extension.activerecord.Model; |
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 第三方结果回传表 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:29:17 |
||||||
|
*/ |
||||||
|
@Getter |
||||||
|
@Setter |
||||||
|
@Accessors(chain = true) |
||||||
|
@TableName("tb_external_backhaul") |
||||||
|
public class ExternalBackhaulDO extends Model<ExternalBackhaulDO> { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
/** |
||||||
|
* id |
||||||
|
*/ |
||||||
|
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||||
|
private String id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 原始信息 |
||||||
|
*/ |
||||||
|
@TableField("original_backhaul") |
||||||
|
private String originalBackhaul; |
||||||
|
|
||||||
|
/** |
||||||
|
* 来自谁 |
||||||
|
*/ |
||||||
|
@TableField("original_by") |
||||||
|
private String originalBy; |
||||||
|
|
||||||
|
/** |
||||||
|
* 回传来源平台 |
||||||
|
*/ |
||||||
|
@TableField("external_name") |
||||||
|
private String externalName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新时间 |
||||||
|
*/ |
||||||
|
@TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE) |
||||||
|
private LocalDateTime updatedTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建时间 |
||||||
|
*/ |
||||||
|
@TableField(value = "created_time", fill = FieldFill.INSERT) |
||||||
|
private LocalDateTime createdTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除标识: 0-存在; 1-删除 |
||||||
|
*/ |
||||||
|
@TableField("removed") |
||||||
|
@TableLogic |
||||||
|
private Short removed; |
||||||
|
|
||||||
|
@Override |
||||||
|
public Serializable pkVal() { |
||||||
|
return this.id; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,75 @@ |
|||||||
|
package cn.soul2.demo.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||||
|
import com.baomidou.mybatisplus.extension.activerecord.Model; |
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 问卷表 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-11 23:11:45 |
||||||
|
*/ |
||||||
|
@Getter |
||||||
|
@Setter |
||||||
|
@Accessors(chain = true) |
||||||
|
@TableName("tb_questionnaire") |
||||||
|
public class QuestionnaireDO extends Model<QuestionnaireDO> { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
/** |
||||||
|
* id |
||||||
|
*/ |
||||||
|
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||||
|
private String id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 名称 |
||||||
|
*/ |
||||||
|
@TableField("name") |
||||||
|
private String name; |
||||||
|
|
||||||
|
/** |
||||||
|
* 二维码id |
||||||
|
*/ |
||||||
|
@TableField("qr_id") |
||||||
|
private String qrId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态:0:禁用;1:启用; |
||||||
|
*/ |
||||||
|
@TableField("status") |
||||||
|
private Short status; |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新时间 |
||||||
|
*/ |
||||||
|
@TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE) |
||||||
|
private LocalDateTime updatedTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建时间 |
||||||
|
*/ |
||||||
|
@TableField(value = "created_time", fill = FieldFill.INSERT) |
||||||
|
private LocalDateTime createdTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除标识: 0-存在; 1-删除 |
||||||
|
*/ |
||||||
|
@TableField("removed") |
||||||
|
@TableLogic |
||||||
|
private Short removed; |
||||||
|
|
||||||
|
@Override |
||||||
|
public Serializable pkVal() { |
||||||
|
return this.id; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,69 @@ |
|||||||
|
package cn.soul2.demo.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||||
|
import com.baomidou.mybatisplus.extension.activerecord.Model; |
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 题目-问卷连接表 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-13 15:35:52 |
||||||
|
*/ |
||||||
|
@Getter |
||||||
|
@Setter |
||||||
|
@Accessors(chain = true) |
||||||
|
@TableName("tb_ref_questionnaire_subject") |
||||||
|
public class RefQuestionnaireSubjectDO extends Model<RefQuestionnaireSubjectDO> { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
/** |
||||||
|
* id |
||||||
|
*/ |
||||||
|
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||||
|
private String id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 问卷id |
||||||
|
*/ |
||||||
|
@TableField("qn_id") |
||||||
|
private String qnId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目id |
||||||
|
*/ |
||||||
|
@TableField("subject_id") |
||||||
|
private String subjectId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新时间 |
||||||
|
*/ |
||||||
|
@TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE) |
||||||
|
private LocalDateTime updatedTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建时间 |
||||||
|
*/ |
||||||
|
@TableField(value = "created_time", fill = FieldFill.INSERT) |
||||||
|
private LocalDateTime createdTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除标识: 0-存在; 1-删除 |
||||||
|
*/ |
||||||
|
@TableField("removed") |
||||||
|
@TableLogic |
||||||
|
private Short removed; |
||||||
|
|
||||||
|
@Override |
||||||
|
public Serializable pkVal() { |
||||||
|
return this.id; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,69 @@ |
|||||||
|
package cn.soul2.demo.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||||
|
import com.baomidou.mybatisplus.extension.activerecord.Model; |
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 题目-选项连接表 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-13 15:35:52 |
||||||
|
*/ |
||||||
|
@Getter |
||||||
|
@Setter |
||||||
|
@Accessors(chain = true) |
||||||
|
@TableName("tb_ref_subject_items") |
||||||
|
public class RefSubjectItemsDO extends Model<RefSubjectItemsDO> { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
/** |
||||||
|
* id |
||||||
|
*/ |
||||||
|
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||||
|
private String id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新时间 |
||||||
|
*/ |
||||||
|
@TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE) |
||||||
|
private LocalDateTime updatedTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建时间 |
||||||
|
*/ |
||||||
|
@TableField(value = "created_time", fill = FieldFill.INSERT) |
||||||
|
private LocalDateTime createdTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除标识: 0-存在; 1-删除 |
||||||
|
*/ |
||||||
|
@TableField("removed") |
||||||
|
@TableLogic |
||||||
|
private Short removed; |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目id |
||||||
|
*/ |
||||||
|
@TableField("subject_id") |
||||||
|
private String subjectId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 选项id |
||||||
|
*/ |
||||||
|
@TableField("item_id") |
||||||
|
private String itemId; |
||||||
|
|
||||||
|
@Override |
||||||
|
public Serializable pkVal() { |
||||||
|
return this.id; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,87 @@ |
|||||||
|
package cn.soul2.demo.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||||
|
import com.baomidou.mybatisplus.extension.activerecord.Model; |
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 题目表 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
@Getter |
||||||
|
@Setter |
||||||
|
@Accessors(chain = true) |
||||||
|
@TableName("tb_subject") |
||||||
|
public class SubjectDO extends Model<SubjectDO> { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
/** |
||||||
|
* id |
||||||
|
*/ |
||||||
|
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||||
|
private String id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目标题 |
||||||
|
*/ |
||||||
|
@TableField("title") |
||||||
|
private String title; |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目内容 |
||||||
|
*/ |
||||||
|
@TableField("content") |
||||||
|
private String content; |
||||||
|
|
||||||
|
/** |
||||||
|
* 排列序号 |
||||||
|
*/ |
||||||
|
@TableField("sort") |
||||||
|
private Short sort; |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态:0:禁用;1:启用; |
||||||
|
*/ |
||||||
|
@TableField("status") |
||||||
|
private Short status; |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新时间 |
||||||
|
*/ |
||||||
|
@TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE) |
||||||
|
private LocalDateTime updatedTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建时间 |
||||||
|
*/ |
||||||
|
@TableField(value = "created_time", fill = FieldFill.INSERT) |
||||||
|
private LocalDateTime createdTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除标识: 0-存在; 1-删除 |
||||||
|
*/ |
||||||
|
@TableField("removed") |
||||||
|
@TableLogic |
||||||
|
private Short removed; |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目类型:0-单选;1-多选;2-文字 |
||||||
|
*/ |
||||||
|
@TableField("type") |
||||||
|
private Short type; |
||||||
|
|
||||||
|
@Override |
||||||
|
public Serializable pkVal() { |
||||||
|
return null; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,93 @@ |
|||||||
|
package cn.soul2.demo.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||||
|
import com.baomidou.mybatisplus.extension.activerecord.Model; |
||||||
|
import lombok.Getter; |
||||||
|
import lombok.Setter; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 题选项表 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
@Getter |
||||||
|
@Setter |
||||||
|
@Accessors(chain = true) |
||||||
|
@TableName("tb_subject_items") |
||||||
|
public class SubjectItemsDO extends Model<SubjectItemsDO> { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
/** |
||||||
|
* id |
||||||
|
*/ |
||||||
|
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||||
|
private String id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 选项内容 |
||||||
|
*/ |
||||||
|
@TableField("content") |
||||||
|
private String content; |
||||||
|
|
||||||
|
/** |
||||||
|
* 排列序号 |
||||||
|
*/ |
||||||
|
@TableField("sort") |
||||||
|
private Short sort; |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态:0:禁用;1:启用; |
||||||
|
*/ |
||||||
|
@TableField("status") |
||||||
|
private Short status; |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新时间 |
||||||
|
*/ |
||||||
|
@TableField(value = "updated_time", fill = FieldFill.INSERT_UPDATE) |
||||||
|
private LocalDateTime updatedTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 创建时间 |
||||||
|
*/ |
||||||
|
@TableField(value = "created_time", fill = FieldFill.INSERT) |
||||||
|
private LocalDateTime createdTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 删除标识: 0-存在; 1-删除 |
||||||
|
*/ |
||||||
|
@TableField("removed") |
||||||
|
@TableLogic |
||||||
|
private Short removed; |
||||||
|
|
||||||
|
/** |
||||||
|
* 权重 |
||||||
|
*/ |
||||||
|
@TableField("weights") |
||||||
|
private Object weights; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分值 |
||||||
|
*/ |
||||||
|
@TableField("points") |
||||||
|
private Integer points; |
||||||
|
|
||||||
|
/** |
||||||
|
* 是正确答案 |
||||||
|
*/ |
||||||
|
@TableField("is_right") |
||||||
|
private Short isRight; |
||||||
|
|
||||||
|
@Override |
||||||
|
public Serializable pkVal() { |
||||||
|
return this.id; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package cn.soul2.demo.mapper; |
||||||
|
|
||||||
|
import cn.soul2.demo.entity.AnswerDetailsDO; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 答卷详情表 Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
public interface AnswerDetailsMapper extends BaseMapper<AnswerDetailsDO> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package cn.soul2.demo.mapper; |
||||||
|
|
||||||
|
import cn.soul2.demo.entity.AnswerSheetDO; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 答卷表 Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
public interface AnswerSheetMapper extends BaseMapper<AnswerSheetDO> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package cn.soul2.demo.mapper; |
||||||
|
|
||||||
|
import cn.soul2.demo.entity.ExternalBackhaulDO; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 第三方结果回传表 Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:29:17 |
||||||
|
*/ |
||||||
|
public interface ExternalBackhaulMapper extends BaseMapper<ExternalBackhaulDO> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package cn.soul2.demo.mapper; |
||||||
|
|
||||||
|
import cn.soul2.demo.entity.QuestionnaireDO; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 问卷表 Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-11 23:11:45 |
||||||
|
*/ |
||||||
|
public interface QuestionnaireMapper extends BaseMapper<QuestionnaireDO> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package cn.soul2.demo.mapper; |
||||||
|
|
||||||
|
import cn.soul2.demo.entity.RefQuestionnaireSubjectDO; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 题目-问卷连接表 Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
public interface RefQuestionnaireSubjectMapper extends BaseMapper<RefQuestionnaireSubjectDO> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package cn.soul2.demo.mapper; |
||||||
|
|
||||||
|
import cn.soul2.demo.entity.RefSubjectItemsDO; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 题目-选项连接表 Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
public interface RefSubjectItemsMapper extends BaseMapper<RefSubjectItemsDO> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package cn.soul2.demo.mapper; |
||||||
|
|
||||||
|
import cn.soul2.demo.entity.SubjectItemsDO; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 题选项表 Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
public interface SubjectItemsMapper extends BaseMapper<SubjectItemsDO> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package cn.soul2.demo.mapper; |
||||||
|
|
||||||
|
import cn.soul2.demo.entity.SubjectDO; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 题目表 Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
public interface SubjectMapper extends BaseMapper<SubjectDO> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,27 @@ |
|||||||
|
package cn.soul2.demo.repository; |
||||||
|
|
||||||
|
import cn.soul2.demo.entity.AnswerDetailsDO; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
|
||||||
|
import java.util.Collection; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 答卷详情表 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
public interface IAnswerDetailsRepository extends IService<AnswerDetailsDO> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据答卷id查找答题记录 |
||||||
|
* |
||||||
|
* @param sheetIds sheet ids |
||||||
|
* @return {@link List}<{@link AnswerDetailsDO}> |
||||||
|
*/ |
||||||
|
List<AnswerDetailsDO> listBySheetIds(Collection<String> sheetIds); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,39 @@ |
|||||||
|
package cn.soul2.demo.repository; |
||||||
|
|
||||||
|
import cn.soul2.demo.dto.AnswerPageQueryDTO; |
||||||
|
import cn.soul2.demo.entity.AnswerSheetDO; |
||||||
|
import cn.soul2.demo.vo.AnswerSheetVO; |
||||||
|
import cn.soul2.demo.vo.base.VPage; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
|
||||||
|
import java.util.Collection; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 答卷表 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
public interface IAnswerSheetRepository extends IService<AnswerSheetDO> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询答题详情 |
||||||
|
* |
||||||
|
* @param dto 查询条件 |
||||||
|
* @return {@link VPage}<{@link AnswerSheetVO}> |
||||||
|
*/ |
||||||
|
VPage<AnswerSheetVO> page(AnswerPageQueryDTO dto); |
||||||
|
|
||||||
|
/** |
||||||
|
* 保存答卷 |
||||||
|
* |
||||||
|
* @param sheet 答卷 |
||||||
|
* @return {@link Boolean} |
||||||
|
*/ |
||||||
|
Boolean saveSheet(AnswerSheetVO sheet); |
||||||
|
|
||||||
|
Boolean removeSheetByIds(Collection<String> sheetIds); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
package cn.soul2.demo.repository; |
||||||
|
|
||||||
|
import cn.soul2.demo.dto.ExternalBackhaulDTO; |
||||||
|
import cn.soul2.demo.entity.ExternalBackhaulDO; |
||||||
|
import cn.soul2.demo.vo.ExternalBackhaulVO; |
||||||
|
import cn.soul2.demo.vo.base.VPage; |
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 第三方结果回传表 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:29:17 |
||||||
|
*/ |
||||||
|
public interface IExternalBackhaulRepository extends IService<ExternalBackhaulDO> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 保存第三方平台返回的问卷结果 |
||||||
|
* |
||||||
|
* @param jo 问卷结果 |
||||||
|
* @param externalName 第三方平台名称 |
||||||
|
* @param originalBy 问卷填写者 |
||||||
|
* @return {@link Boolean} |
||||||
|
*/ |
||||||
|
Boolean save(JSONObject jo, String externalName, String originalBy); |
||||||
|
|
||||||
|
/** |
||||||
|
* 分页查询 |
||||||
|
* |
||||||
|
* @param dto 查询条件 |
||||||
|
* @return {@link VPage}<{@link ExternalBackhaulVO}> |
||||||
|
*/ |
||||||
|
VPage<ExternalBackhaulVO> page(ExternalBackhaulDTO dto); |
||||||
|
} |
@ -0,0 +1,26 @@ |
|||||||
|
package cn.soul2.demo.repository; |
||||||
|
|
||||||
|
import cn.soul2.demo.dto.QuestionnaireDTO; |
||||||
|
import cn.soul2.demo.dto.base.UpdateStatusDTO; |
||||||
|
import cn.soul2.demo.entity.QuestionnaireDO; |
||||||
|
import cn.soul2.demo.vo.QuestionnaireVO; |
||||||
|
import cn.soul2.demo.vo.base.VPage; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 问卷表 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-11 23:11:45 |
||||||
|
*/ |
||||||
|
public interface IQuestionnaireRepository extends IService<QuestionnaireDO> { |
||||||
|
|
||||||
|
VPage<QuestionnaireVO> page(QuestionnaireDTO dto); |
||||||
|
|
||||||
|
Boolean saveOrUpdate(QuestionnaireDTO dto); |
||||||
|
|
||||||
|
Boolean updateStatus(UpdateStatusDTO dto); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,38 @@ |
|||||||
|
package cn.soul2.demo.repository; |
||||||
|
|
||||||
|
import cn.soul2.demo.dto.QnSubjectRefDTO; |
||||||
|
import cn.soul2.demo.entity.RefQuestionnaireSubjectDO; |
||||||
|
import cn.soul2.demo.entity.SubjectDO; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
|
||||||
|
import java.util.Collection; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 题目-问卷连接表 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
public interface IRefQuestionnaireSubjectRepository extends IService<RefQuestionnaireSubjectDO> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 根据问卷id查询所有题目 |
||||||
|
* |
||||||
|
* @param qnIds 问卷id |
||||||
|
* @return {@link List}<{@link SubjectDO}> |
||||||
|
*/ |
||||||
|
List<SubjectDO> getSubjects(Collection<String> qnIds); |
||||||
|
|
||||||
|
/** |
||||||
|
* 连接问卷-题目 |
||||||
|
* |
||||||
|
* @param dto QnId and subjectIds |
||||||
|
* @return {@link Boolean} |
||||||
|
*/ |
||||||
|
Boolean connectSubjects(QnSubjectRefDTO dto); |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,55 @@ |
|||||||
|
package cn.soul2.demo.repository; |
||||||
|
|
||||||
|
import cn.soul2.demo.dto.SubjectItemRefDTO; |
||||||
|
import cn.soul2.demo.entity.RefSubjectItemsDO; |
||||||
|
import cn.soul2.demo.entity.SubjectItemsDO; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
|
||||||
|
import java.util.Collection; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 题目-选项连接表 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
public interface IRefSubjectItemsRepository extends IService<RefSubjectItemsDO> { |
||||||
|
|
||||||
|
/** |
||||||
|
* 通过题目id查询选项 |
||||||
|
* |
||||||
|
* @param subjectIds 题目id |
||||||
|
* @return {@link List}<{@link SubjectItemsDO}> |
||||||
|
*/ |
||||||
|
List<SubjectItemsDO> getSubjectItems(Collection<String> subjectIds); |
||||||
|
|
||||||
|
/** |
||||||
|
* 连接题目-选项 |
||||||
|
* |
||||||
|
* @param dto SubjectId and Subject items Id |
||||||
|
* @return {@link Boolean} |
||||||
|
*/ |
||||||
|
Boolean connectItems(SubjectItemRefDTO dto); |
||||||
|
|
||||||
|
/** |
||||||
|
* 解除连接 |
||||||
|
* |
||||||
|
* @param itemIds 选项id |
||||||
|
* @param andDestroy 同时删除选项记录 |
||||||
|
* @return {@link Boolean} |
||||||
|
*/ |
||||||
|
Boolean disConnectItems(Collection<String> itemIds, Boolean andDestroy); |
||||||
|
|
||||||
|
/** |
||||||
|
* 解除连接 |
||||||
|
* |
||||||
|
* @param subjectId 题目id |
||||||
|
* @param andDestroy 同时删除选项记录 |
||||||
|
* @return {@link Boolean} |
||||||
|
*/ |
||||||
|
Boolean disConnectItems(String subjectId, Boolean andDestroy); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,17 @@ |
|||||||
|
package cn.soul2.demo.repository; |
||||||
|
|
||||||
|
import cn.soul2.demo.entity.SubjectItemsDO; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 题选项表 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
public interface ISubjectItemsRepository extends IService<SubjectItemsDO> { |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,19 @@ |
|||||||
|
package cn.soul2.demo.repository; |
||||||
|
|
||||||
|
import cn.soul2.demo.dto.SubjectDTO; |
||||||
|
import cn.soul2.demo.entity.SubjectDO; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 题目表 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
public interface ISubjectRepository extends IService<SubjectDO> { |
||||||
|
|
||||||
|
Boolean saveOrUpdate(SubjectDTO dto); |
||||||
|
|
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
package cn.soul2.demo.repository.impl; |
||||||
|
|
||||||
|
import cn.soul2.demo.entity.AnswerDetailsDO; |
||||||
|
import cn.soul2.demo.mapper.AnswerDetailsMapper; |
||||||
|
import cn.soul2.demo.repository.IAnswerDetailsRepository; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.Collection; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 答卷详情表 服务实现类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class AnswerDetailsRepositoryImpl extends ServiceImpl<AnswerDetailsMapper, AnswerDetailsDO> implements IAnswerDetailsRepository { |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<AnswerDetailsDO> listBySheetIds(Collection<String> sheetIds) { |
||||||
|
if (CollectionUtils.isNotEmpty(sheetIds)) { |
||||||
|
LambdaQueryWrapper<AnswerDetailsDO> query = Wrappers.lambdaQuery(); |
||||||
|
query.in(AnswerDetailsDO::getAnswerSheetId, sheetIds); |
||||||
|
return super.list(query); |
||||||
|
} else { |
||||||
|
return new ArrayList<>(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,131 @@ |
|||||||
|
package cn.soul2.demo.repository.impl; |
||||||
|
|
||||||
|
import cn.soul2.demo.dto.AnswerPageQueryDTO; |
||||||
|
import cn.soul2.demo.entity.AnswerDetailsDO; |
||||||
|
import cn.soul2.demo.entity.AnswerSheetDO; |
||||||
|
import cn.soul2.demo.entity.QrDO; |
||||||
|
import cn.soul2.demo.entity.QuestionnaireDO; |
||||||
|
import cn.soul2.demo.mapper.AnswerSheetMapper; |
||||||
|
import cn.soul2.demo.repository.IAnswerDetailsRepository; |
||||||
|
import cn.soul2.demo.repository.IAnswerSheetRepository; |
||||||
|
import cn.soul2.demo.repository.IQrRepository; |
||||||
|
import cn.soul2.demo.repository.IQuestionnaireRepository; |
||||||
|
import cn.soul2.demo.utils.base.PageUtils; |
||||||
|
import cn.soul2.demo.vo.AnswerDetailsVO; |
||||||
|
import cn.soul2.demo.vo.AnswerSheetVO; |
||||||
|
import cn.soul2.demo.vo.base.VPage; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.springframework.beans.BeanUtils; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
import org.springframework.transaction.interceptor.TransactionAspectSupport; |
||||||
|
|
||||||
|
import javax.transaction.Transactional; |
||||||
|
import java.util.Collection; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.Set; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 答卷表 服务实现类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class AnswerSheetRepositoryImpl extends ServiceImpl<AnswerSheetMapper, AnswerSheetDO> implements IAnswerSheetRepository { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private IQuestionnaireRepository questionnaireRepository; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private IQrRepository qrRepository; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private IAnswerDetailsRepository detailsRepository; |
||||||
|
|
||||||
|
@Override |
||||||
|
public VPage<AnswerSheetVO> page(AnswerPageQueryDTO dto) { |
||||||
|
LambdaQueryWrapper<AnswerSheetDO> query = Wrappers.lambdaQuery(); |
||||||
|
query.eq(StringUtils.isNotBlank(dto.getRespondent()), AnswerSheetDO::getRespondent, dto.getRespondent()) |
||||||
|
.eq(dto.getStatus() != null, AnswerSheetDO::getStatus, dto.getStatus()) |
||||||
|
.orderByDesc(AnswerSheetDO::getUpdatedTime).orderByDesc(AnswerSheetDO::getCreatedTime); |
||||||
|
VPage<AnswerSheetDO> page = PageUtils.to(super.page(PageUtils.build(dto), query)); |
||||||
|
List<AnswerSheetDO> rows = page.getRows(); |
||||||
|
Set<String> qnSet = rows.stream().map(AnswerSheetDO::getQnId).collect(Collectors.toSet()); |
||||||
|
Set<String> qrSet = rows.stream().map(AnswerSheetDO::getQrId).collect(Collectors.toSet()); |
||||||
|
|
||||||
|
Map<String, QuestionnaireDO> qnMap = questionnaireRepository.listByIds(qnSet).stream().collect(Collectors.toMap(QuestionnaireDO::getId, o -> o, (o1, o2) -> o1)); |
||||||
|
Map<String, QrDO> qrMap = qrRepository.listByIds(qrSet).stream().collect(Collectors.toMap(QrDO::getId, o -> o, (o1, o2) -> o1)); |
||||||
|
List<AnswerDetailsDO> detailsDOList = detailsRepository.listBySheetIds(rows.stream().map(AnswerSheetDO::getId).collect(Collectors.toList())); |
||||||
|
|
||||||
|
return PageUtils.to(page, rows.stream().map(row -> { |
||||||
|
AnswerSheetVO vo = new AnswerSheetVO(); |
||||||
|
BeanUtils.copyProperties(row, vo); |
||||||
|
if (qnMap.containsKey(row.getQnId())) { |
||||||
|
vo.setQnName(qnMap.get(row.getQnId()).getName()); |
||||||
|
} |
||||||
|
if (qrMap.containsKey(row.getQrId())) { |
||||||
|
vo.setQnName(qrMap.get(row.getQrId()).getTip()); |
||||||
|
} |
||||||
|
vo.setDetails(detailsDOList.stream().filter(d -> d.getAnswerSheetId().equals(row.getId())).map(d -> { |
||||||
|
AnswerDetailsVO detailsVO = new AnswerDetailsVO(); |
||||||
|
BeanUtils.copyProperties(d, detailsVO); |
||||||
|
return detailsVO; |
||||||
|
}).collect(Collectors.toList())); |
||||||
|
|
||||||
|
return vo; |
||||||
|
}).collect(Collectors.toList())); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
@Transactional |
||||||
|
public Boolean saveSheet(AnswerSheetVO sheet) { |
||||||
|
AnswerSheetDO sheetDO = new AnswerSheetDO(); |
||||||
|
BeanUtils.copyProperties(sheet, sheetDO); |
||||||
|
boolean saved = super.save(sheetDO); |
||||||
|
if (saved) { |
||||||
|
List<AnswerDetailsDO> details = sheet.getDetails().stream().map(d -> { |
||||||
|
AnswerDetailsDO detail = new AnswerDetailsDO(); |
||||||
|
BeanUtils.copyProperties(d, detail); |
||||||
|
detail.setAnswerSheetId(sheetDO.getId()); |
||||||
|
return detail; |
||||||
|
}).collect(Collectors.toList()); |
||||||
|
if (!detailsRepository.saveBatch(details)) { |
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
||||||
|
return Boolean.FALSE; |
||||||
|
} |
||||||
|
} else { |
||||||
|
return Boolean.FALSE; |
||||||
|
} |
||||||
|
return Boolean.TRUE; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
@Transactional |
||||||
|
public Boolean removeSheetByIds(Collection<String> sheetIds) { |
||||||
|
LambdaUpdateWrapper<AnswerDetailsDO> update = Wrappers.lambdaUpdate(); |
||||||
|
update.in(AnswerDetailsDO::getAnswerSheetId, sheetIds); |
||||||
|
|
||||||
|
boolean removed = detailsRepository.remove(update); |
||||||
|
|
||||||
|
if (removed) { |
||||||
|
try { |
||||||
|
super.removeByIds(sheetIds); |
||||||
|
return Boolean.TRUE; |
||||||
|
} catch (Exception e) { |
||||||
|
// 如果删除失败,可以记录日志或进行其他处理
|
||||||
|
throw new RuntimeException("删除答题详情失败 | ", e); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
return Boolean.FALSE; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,54 @@ |
|||||||
|
package cn.soul2.demo.repository.impl; |
||||||
|
|
||||||
|
import cn.soul2.demo.dto.ExternalBackhaulDTO; |
||||||
|
import cn.soul2.demo.entity.ExternalBackhaulDO; |
||||||
|
import cn.soul2.demo.mapper.ExternalBackhaulMapper; |
||||||
|
import cn.soul2.demo.repository.IExternalBackhaulRepository; |
||||||
|
import cn.soul2.demo.utils.base.PageUtils; |
||||||
|
import cn.soul2.demo.vo.ExternalBackhaulVO; |
||||||
|
import cn.soul2.demo.vo.base.VPage; |
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.springframework.beans.BeanUtils; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 第三方结果回传表 服务实现类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:29:17 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class ExternalBackhaulRepositoryImpl extends ServiceImpl<ExternalBackhaulMapper, ExternalBackhaulDO> implements IExternalBackhaulRepository { |
||||||
|
|
||||||
|
@Override |
||||||
|
public VPage<ExternalBackhaulVO> page(ExternalBackhaulDTO dto) { |
||||||
|
LambdaQueryWrapper<ExternalBackhaulDO> query = Wrappers.lambdaQuery(); |
||||||
|
query.eq(ExternalBackhaulDO::getExternalName, dto.getExternalName()) |
||||||
|
.likeRight(ExternalBackhaulDO::getOriginalBy, dto.getOriginalBy()); |
||||||
|
VPage<ExternalBackhaulDO> page = PageUtils.to(super.page(PageUtils.build(dto), query)); |
||||||
|
return PageUtils.to(page, page.getRows().stream().map(e -> { |
||||||
|
ExternalBackhaulVO vo = new ExternalBackhaulVO(); |
||||||
|
BeanUtils.copyProperties(e, vo); |
||||||
|
return vo; |
||||||
|
}).collect(Collectors.toList())); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Boolean save(JSONObject jo, String externalName, String originalBy) { |
||||||
|
ExternalBackhaulDO backhaul = new ExternalBackhaulDO(); |
||||||
|
backhaul.setExternalName(externalName) |
||||||
|
.setOriginalBackhaul(jo.toJSONString()); |
||||||
|
if (StringUtils.isNotBlank(originalBy)) { |
||||||
|
backhaul.setOriginalBy(originalBy); |
||||||
|
} |
||||||
|
return super.save(backhaul); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,65 @@ |
|||||||
|
package cn.soul2.demo.repository.impl; |
||||||
|
|
||||||
|
import cn.soul2.demo.dto.QuestionnaireDTO; |
||||||
|
import cn.soul2.demo.dto.base.UpdateStatusDTO; |
||||||
|
import cn.soul2.demo.entity.QuestionnaireDO; |
||||||
|
import cn.soul2.demo.mapper.QuestionnaireMapper; |
||||||
|
import cn.soul2.demo.repository.IQuestionnaireRepository; |
||||||
|
import cn.soul2.demo.utils.base.PageUtils; |
||||||
|
import cn.soul2.demo.vo.QuestionnaireVO; |
||||||
|
import cn.soul2.demo.vo.base.VPage; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.springframework.beans.BeanUtils; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 问卷表 服务实现类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-11 23:11:45 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class QuestionnaireRepositoryImpl extends ServiceImpl<QuestionnaireMapper, QuestionnaireDO> implements IQuestionnaireRepository { |
||||||
|
|
||||||
|
@Override |
||||||
|
public VPage<QuestionnaireVO> page(QuestionnaireDTO dto) { |
||||||
|
LambdaQueryWrapper<QuestionnaireDO> query = Wrappers.lambdaQuery(); |
||||||
|
query.likeRight(StringUtils.isNotBlank(dto.getName()), QuestionnaireDO::getName, dto.getName()) |
||||||
|
.eq(StringUtils.isNotBlank(dto.getId()), QuestionnaireDO::getId, dto.getId()); |
||||||
|
if (dto.getStartTime() != null && dto.getEndTime() != null) { |
||||||
|
query.between(QuestionnaireDO::getUpdatedTime, dto.getStartTime(), dto.getEndTime()); |
||||||
|
} else { |
||||||
|
query.ge(dto.getStartTime() != null, QuestionnaireDO::getUpdatedTime, dto.getStartTime()) |
||||||
|
.le(dto.getEndTime() != null, QuestionnaireDO::getUpdatedTime, dto.getEndTime()); |
||||||
|
} |
||||||
|
query.orderByDesc(QuestionnaireDO::getUpdatedTime).orderByDesc(QuestionnaireDO::getCreatedTime); |
||||||
|
VPage<QuestionnaireDO> page = PageUtils.to(super.page(PageUtils.build(dto), query)); |
||||||
|
return PageUtils.to(page, page.getRows().stream().map(e -> { |
||||||
|
QuestionnaireVO vo = new QuestionnaireVO(); |
||||||
|
BeanUtils.copyProperties(e, vo); |
||||||
|
return vo; |
||||||
|
}).collect(Collectors.toList())); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Boolean saveOrUpdate(QuestionnaireDTO dto) { |
||||||
|
QuestionnaireDO entity = new QuestionnaireDO(); |
||||||
|
BeanUtils.copyProperties(dto, entity); |
||||||
|
return super.save(entity); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Boolean updateStatus(UpdateStatusDTO dto) { |
||||||
|
LambdaUpdateWrapper<QuestionnaireDO> update = Wrappers.lambdaUpdate(); |
||||||
|
update.set(QuestionnaireDO::getStatus, dto.getStatus()).eq(QuestionnaireDO::getId, dto.getId()); |
||||||
|
return super.update(update); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,60 @@ |
|||||||
|
package cn.soul2.demo.repository.impl; |
||||||
|
|
||||||
|
import cn.soul2.demo.dto.QnSubjectRefDTO; |
||||||
|
import cn.soul2.demo.entity.RefQuestionnaireSubjectDO; |
||||||
|
import cn.soul2.demo.entity.SubjectDO; |
||||||
|
import cn.soul2.demo.mapper.RefQuestionnaireSubjectMapper; |
||||||
|
import cn.soul2.demo.repository.IRefQuestionnaireSubjectRepository; |
||||||
|
import cn.soul2.demo.repository.ISubjectRepository; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.Collection; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Set; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 题目-问卷连接表 服务实现类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class RefQuestionnaireSubjectRepositoryImpl extends ServiceImpl<RefQuestionnaireSubjectMapper, RefQuestionnaireSubjectDO> implements IRefQuestionnaireSubjectRepository { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ISubjectRepository subjectRepository; |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<SubjectDO> getSubjects(Collection<String> qnIds) { |
||||||
|
if (CollectionUtils.isNotEmpty(qnIds)) { |
||||||
|
LambdaQueryWrapper<RefQuestionnaireSubjectDO> query = Wrappers.lambdaQuery(); |
||||||
|
query.in(RefQuestionnaireSubjectDO::getQnId, qnIds); |
||||||
|
Set<String> set = super.list(query).stream().map(RefQuestionnaireSubjectDO::getSubjectId).collect(Collectors.toSet()); |
||||||
|
if (CollectionUtils.isNotEmpty(set)) { |
||||||
|
return subjectRepository.listByIds(set); |
||||||
|
} else { |
||||||
|
return new ArrayList<>(); |
||||||
|
} |
||||||
|
} else { |
||||||
|
return new ArrayList<>(); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Boolean connectSubjects(QnSubjectRefDTO dto) { |
||||||
|
return super.saveBatch(dto.getSubjectIds().stream().map(s -> { |
||||||
|
RefQuestionnaireSubjectDO ref = new RefQuestionnaireSubjectDO(); |
||||||
|
ref.setSubjectId(s).setQnId(dto.getQnId()); |
||||||
|
return ref; |
||||||
|
}).collect(Collectors.toList())); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,102 @@ |
|||||||
|
package cn.soul2.demo.repository.impl; |
||||||
|
|
||||||
|
import cn.soul2.demo.dto.SubjectItemRefDTO; |
||||||
|
import cn.soul2.demo.entity.RefSubjectItemsDO; |
||||||
|
import cn.soul2.demo.entity.SubjectItemsDO; |
||||||
|
import cn.soul2.demo.mapper.RefSubjectItemsMapper; |
||||||
|
import cn.soul2.demo.repository.IRefSubjectItemsRepository; |
||||||
|
import cn.soul2.demo.repository.ISubjectItemsRepository; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
import org.springframework.transaction.annotation.Transactional; |
||||||
|
import org.springframework.transaction.interceptor.TransactionAspectSupport; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.Collection; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Set; |
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 题目-选项连接表 服务实现类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class RefSubjectItemsRepositoryImpl extends ServiceImpl<RefSubjectItemsMapper, RefSubjectItemsDO> implements IRefSubjectItemsRepository { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ISubjectItemsRepository itemsRepository; |
||||||
|
|
||||||
|
@Override |
||||||
|
public List<SubjectItemsDO> getSubjectItems(Collection<String> subjectIds) { |
||||||
|
if (CollectionUtils.isNotEmpty(subjectIds)) { |
||||||
|
LambdaQueryWrapper<RefSubjectItemsDO> query = Wrappers.lambdaQuery(); |
||||||
|
query.in(RefSubjectItemsDO::getSubjectId, subjectIds); |
||||||
|
Set<String> set = super.list(query).stream().map(RefSubjectItemsDO::getItemId).collect(Collectors.toSet()); |
||||||
|
if (CollectionUtils.isNotEmpty(set)) { |
||||||
|
return itemsRepository.listByIds(set); |
||||||
|
} else { |
||||||
|
return new ArrayList<>(); |
||||||
|
} |
||||||
|
} |
||||||
|
return new ArrayList<>(); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Boolean connectItems(SubjectItemRefDTO dto) { |
||||||
|
return super.saveBatch(dto.getItemIds().stream().map(s -> { |
||||||
|
RefSubjectItemsDO ref = new RefSubjectItemsDO(); |
||||||
|
ref.setSubjectId(s).setSubjectId(dto.getSubjectId()); |
||||||
|
return ref; |
||||||
|
}).collect(Collectors.toList())); |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
@Transactional |
||||||
|
public Boolean disConnectItems(Collection<String> itemIds, Boolean andDestroy) { |
||||||
|
if (CollectionUtils.isNotEmpty(itemIds)) { |
||||||
|
LambdaUpdateWrapper<RefSubjectItemsDO> update = Wrappers.lambdaUpdate(); |
||||||
|
update.in(RefSubjectItemsDO::getItemId, itemIds); |
||||||
|
if (andDestroy) { |
||||||
|
boolean itemRemoved = itemsRepository.removeByIds(itemIds); |
||||||
|
if (!itemRemoved) { |
||||||
|
return Boolean.FALSE; |
||||||
|
} |
||||||
|
} |
||||||
|
boolean removed = super.remove(update); |
||||||
|
if (!removed) { |
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
||||||
|
} |
||||||
|
return removed; |
||||||
|
} |
||||||
|
return Boolean.TRUE; |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
public Boolean disConnectItems(String subjectId, Boolean andDestroy) { |
||||||
|
LambdaUpdateWrapper<RefSubjectItemsDO> update = Wrappers.lambdaUpdate(); |
||||||
|
update.eq(RefSubjectItemsDO::getSubjectId, subjectId); |
||||||
|
if (andDestroy) { |
||||||
|
LambdaQueryWrapper<RefSubjectItemsDO> query = Wrappers.lambdaQuery(); |
||||||
|
query.eq(RefSubjectItemsDO::getSubjectId, subjectId); |
||||||
|
boolean itemsRemoved = itemsRepository.removeByIds(super.list(query).stream().map(RefSubjectItemsDO::getItemId).collect(Collectors.toList())); |
||||||
|
if (!itemsRemoved) { |
||||||
|
return Boolean.FALSE; |
||||||
|
} |
||||||
|
} |
||||||
|
boolean removed = super.remove(update); |
||||||
|
if (!removed) { |
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
||||||
|
} |
||||||
|
return removed; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
package cn.soul2.demo.repository.impl; |
||||||
|
|
||||||
|
import cn.soul2.demo.entity.SubjectItemsDO; |
||||||
|
import cn.soul2.demo.mapper.SubjectItemsMapper; |
||||||
|
import cn.soul2.demo.repository.ISubjectItemsRepository; |
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 题选项表 服务实现类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class SubjectItemsRepositoryImpl extends ServiceImpl<SubjectItemsMapper, SubjectItemsDO> implements ISubjectItemsRepository { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,63 @@ |
|||||||
|
package cn.soul2.demo.repository.impl; |
||||||
|
|
||||||
|
import cn.soul2.demo.dto.SubjectDTO; |
||||||
|
import cn.soul2.demo.entity.SubjectDO; |
||||||
|
import cn.soul2.demo.entity.SubjectItemsDO; |
||||||
|
import cn.soul2.demo.mapper.SubjectMapper; |
||||||
|
import cn.soul2.demo.repository.IRefSubjectItemsRepository; |
||||||
|
import cn.soul2.demo.repository.ISubjectItemsRepository; |
||||||
|
import cn.soul2.demo.repository.ISubjectRepository; |
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
|
import org.apache.commons.lang3.StringUtils; |
||||||
|
import org.springframework.beans.BeanUtils; |
||||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
import org.springframework.transaction.annotation.Transactional; |
||||||
|
import org.springframework.transaction.interceptor.TransactionAspectSupport; |
||||||
|
|
||||||
|
import java.util.stream.Collectors; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 题目表 服务实现类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author Soul2 |
||||||
|
* @since 2024-03-12 10:10:24 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class SubjectRepositoryImpl extends ServiceImpl<SubjectMapper, SubjectDO> implements ISubjectRepository { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private ISubjectItemsRepository itemsRepository; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private IRefSubjectItemsRepository refSubjectItemsRepository; |
||||||
|
|
||||||
|
@Override |
||||||
|
@Transactional |
||||||
|
public Boolean saveOrUpdate(SubjectDTO dto) { |
||||||
|
SubjectDO entity = new SubjectDO(); |
||||||
|
BeanUtils.copyProperties(dto, entity); |
||||||
|
if (StringUtils.isNotBlank(entity.getId())) { |
||||||
|
// delete old connections when updating
|
||||||
|
refSubjectItemsRepository.disConnectItems(entity.getId(), true); |
||||||
|
} |
||||||
|
if (super.saveOrUpdate(entity)) { |
||||||
|
boolean itemsSaved = itemsRepository.saveBatch(dto.getItems().stream().map(e -> { |
||||||
|
SubjectItemsDO item = new SubjectItemsDO(); |
||||||
|
BeanUtils.copyProperties(e, item); |
||||||
|
if (StringUtils.isNotEmpty(item.getId())) { |
||||||
|
item.setId(item.getId()); |
||||||
|
} |
||||||
|
return item; |
||||||
|
}).collect(Collectors.toList())); |
||||||
|
if (!itemsSaved) { |
||||||
|
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly(); |
||||||
|
return Boolean.FALSE; |
||||||
|
} |
||||||
|
return Boolean.TRUE; |
||||||
|
} |
||||||
|
return Boolean.FALSE; |
||||||
|
} |
||||||
|
} |
@ -1,10 +0,0 @@ |
|||||||
package cn.soul2.demo.service; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Soul2 |
|
||||||
* @date 2024-03-11 15:20 |
|
||||||
*/ |
|
||||||
|
|
||||||
public interface IQrService { |
|
||||||
|
|
||||||
} |
|
@ -1,12 +0,0 @@ |
|||||||
package cn.soul2.demo.service; |
|
||||||
|
|
||||||
import org.springframework.stereotype.Service; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Soul2 |
|
||||||
* @date 2024-03-11 15:20 |
|
||||||
*/ |
|
||||||
|
|
||||||
@Service |
|
||||||
public class QrServiceImpl implements IQrService { |
|
||||||
} |
|
@ -0,0 +1,45 @@ |
|||||||
|
package cn.soul2.demo.vo; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Soul2 |
||||||
|
* @date 2024-03-13 11:35 |
||||||
|
*/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@Accessors(chain = true) |
||||||
|
public class AnswerDetailsVO { |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目id |
||||||
|
*/ |
||||||
|
private String subjectId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目标题 |
||||||
|
*/ |
||||||
|
private String title; |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目内容 |
||||||
|
*/ |
||||||
|
private String content; |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目类型:0-单选;1-多选;2-文字 |
||||||
|
*/ |
||||||
|
private Short type; |
||||||
|
|
||||||
|
/** |
||||||
|
* 回答内容(文字/选项) |
||||||
|
*/ |
||||||
|
private String answerContent; |
||||||
|
|
||||||
|
/** |
||||||
|
* 得分, 分数>0时为答对 |
||||||
|
*/ |
||||||
|
private Integer points; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,52 @@ |
|||||||
|
package cn.soul2.demo.vo; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Soul2 |
||||||
|
* @date 2024-03-13 11:34 |
||||||
|
*/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@Accessors(chain = true) |
||||||
|
public class AnswerSheetVO { |
||||||
|
|
||||||
|
/** |
||||||
|
* 问卷id |
||||||
|
*/ |
||||||
|
private String qnId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 问卷名称 |
||||||
|
*/ |
||||||
|
private String qnName; |
||||||
|
|
||||||
|
/** |
||||||
|
* 二维码id |
||||||
|
*/ |
||||||
|
private String qrId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 二维码注释 |
||||||
|
*/ |
||||||
|
private String qrTip; |
||||||
|
|
||||||
|
/** |
||||||
|
* 提交状态 |
||||||
|
*/ |
||||||
|
private Integer status; |
||||||
|
|
||||||
|
/** |
||||||
|
* 答题详情 |
||||||
|
*/ |
||||||
|
private List<AnswerDetailsVO> details; |
||||||
|
|
||||||
|
/** |
||||||
|
* 答卷人 |
||||||
|
*/ |
||||||
|
private String respondent; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,35 @@ |
|||||||
|
package cn.soul2.demo.vo; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Soul2 |
||||||
|
* @date 2024-03-12 11:22 |
||||||
|
*/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@Accessors(chain = true) |
||||||
|
public class ExternalBackhaulVO { |
||||||
|
|
||||||
|
/** |
||||||
|
* id |
||||||
|
*/ |
||||||
|
private String id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 原始信息 |
||||||
|
*/ |
||||||
|
private String originalBackhaul; |
||||||
|
|
||||||
|
/** |
||||||
|
* 来自谁 |
||||||
|
*/ |
||||||
|
private String originalBy; |
||||||
|
|
||||||
|
/** |
||||||
|
* 回传来源平台 |
||||||
|
*/ |
||||||
|
private String externalName; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,42 @@ |
|||||||
|
package cn.soul2.demo.vo; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.time.LocalDateTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Soul2 |
||||||
|
* @date 2024-03-12 12:29 |
||||||
|
*/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@Accessors(chain = true) |
||||||
|
public class QuestionnaireVO { |
||||||
|
|
||||||
|
/** |
||||||
|
* id |
||||||
|
*/ |
||||||
|
private String id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 名称 |
||||||
|
*/ |
||||||
|
private String name; |
||||||
|
|
||||||
|
/** |
||||||
|
* 二维码id |
||||||
|
*/ |
||||||
|
private String qrId; |
||||||
|
|
||||||
|
/** |
||||||
|
* 状态:0:禁用;1:启用; |
||||||
|
*/ |
||||||
|
private Short status; |
||||||
|
|
||||||
|
/** |
||||||
|
* 更新时间 |
||||||
|
*/ |
||||||
|
private LocalDateTime updatedTime; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,43 @@ |
|||||||
|
package cn.soul2.demo.vo; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Soul2 |
||||||
|
* @date 2024-03-13 13:04 |
||||||
|
*/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@Accessors(chain = true) |
||||||
|
public class SubjectItemVO { |
||||||
|
|
||||||
|
/** |
||||||
|
* id |
||||||
|
*/ |
||||||
|
private String itemId; |
||||||
|
/** |
||||||
|
* 选项内容 |
||||||
|
*/ |
||||||
|
private String content; |
||||||
|
|
||||||
|
/** |
||||||
|
* 排列序号 |
||||||
|
*/ |
||||||
|
private Short sort; |
||||||
|
/** |
||||||
|
* 权重 |
||||||
|
*/ |
||||||
|
private Object weights; |
||||||
|
|
||||||
|
/** |
||||||
|
* 分值 |
||||||
|
*/ |
||||||
|
private Integer points; |
||||||
|
|
||||||
|
/** |
||||||
|
* 是正确答案 |
||||||
|
*/ |
||||||
|
private Short isRight; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,48 @@ |
|||||||
|
package cn.soul2.demo.vo; |
||||||
|
|
||||||
|
import lombok.Data; |
||||||
|
import lombok.experimental.Accessors; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author Soul2 |
||||||
|
* @date 2024-03-13 13:03 |
||||||
|
*/ |
||||||
|
|
||||||
|
@Data |
||||||
|
@Accessors(chain = true) |
||||||
|
public class SubjectVO { |
||||||
|
|
||||||
|
/** |
||||||
|
* id |
||||||
|
*/ |
||||||
|
private String id; |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目标题 |
||||||
|
*/ |
||||||
|
private String title; |
||||||
|
|
||||||
|
/** |
||||||
|
* 题目内容 |
||||||
|
*/ |
||||||
|
private String content; |
||||||
|
|
||||||
|
/** |
||||||
|
* 排列序号 |
||||||
|
*/ |
||||||
|
private Short sort; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 题目类型:0-单选;1-多选;2-文字 |
||||||
|
*/ |
||||||
|
private Short type; |
||||||
|
|
||||||
|
/** |
||||||
|
* 选项 |
||||||
|
*/ |
||||||
|
private List<SubjectItemVO> items; |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue