diff --git a/src/main/java/com/msdw/tms/entity/vo/QuestionsDetailVO.java b/src/main/java/com/msdw/tms/entity/vo/QuestionsDetailVO.java index e9426cc..43dbb70 100644 --- a/src/main/java/com/msdw/tms/entity/vo/QuestionsDetailVO.java +++ b/src/main/java/com/msdw/tms/entity/vo/QuestionsDetailVO.java @@ -102,7 +102,7 @@ public class QuestionsDetailVO implements Serializable { /** * 创建时间 */ - private Date createTime; + private String createTime; /** * 修改人 */ @@ -110,7 +110,7 @@ public class QuestionsDetailVO implements Serializable { /** * 修改时间,用于排序,创建时,修改时间等于创建时间 */ - private Date modifyTime; + private String modifyTime; /** * 试题科目 */ diff --git a/src/main/java/com/msdw/tms/entity/vo/QuestionsVO.java b/src/main/java/com/msdw/tms/entity/vo/QuestionsVO.java new file mode 100644 index 0000000..9f37451 --- /dev/null +++ b/src/main/java/com/msdw/tms/entity/vo/QuestionsVO.java @@ -0,0 +1,52 @@ +package com.msdw.tms.entity.vo; + +import lombok.Data; +import lombok.ToString; + +import java.io.Serializable; + +/** + * 试题列表展示信息 + * + * @author gongsj + * @email gongsj@gmail.com + * @date 2020-08-19 09:28:06 + */ +@Data +@ToString +public class QuestionsVO implements Serializable { + + /** + * 自增主键 + */ + private Integer id; + /** + * 题型号:用于区分是什么题型 + */ + private Integer questionTypeNo; + /** + * 题型名称 + */ + private String questionType; + /** + * 题干信息 + */ + private String questionStem; + /** + * 正确答案 + */ + private String answer; + /** + * 答案解析 + */ + private String answerAnalysis; + /** + * 修改时间,用于排序,创建时,修改时间等于创建时间 + */ + private String modifyTime; + /** + * 试题科目 + */ + private String subjects; + +} diff --git a/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java b/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java index 4bc53cb..db621c2 100644 --- a/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java +++ b/src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java @@ -20,6 +20,7 @@ import com.msdw.tms.entity.response.CommonCode; import com.msdw.tms.entity.vo.EvaluationRulesVO; import com.msdw.tms.entity.vo.EvaluationVO; import com.msdw.tms.entity.vo.QuestionsDetailVO; +import com.msdw.tms.entity.vo.QuestionsVO; import com.msdw.tms.service.AliyunOssService; import com.msdw.tms.service.EvaluationRulesService; import com.msdw.tms.service.QuestionsService; @@ -33,6 +34,10 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.time.Instant; +import java.time.LocalDateTime; +import java.time.ZoneId; +import java.time.format.DateTimeFormatter; import java.util.*; import java.util.stream.Collectors; @@ -89,14 +94,30 @@ public class QuestionsServiceImpl extends ServiceImpl list = (List) questionsPage.getList(); -// -// list.stream().map(item -> { -// -// }) + PageUtils questionsPage = new PageUtils(questionsEntityIPage); + List list = (List) questionsPage.getList(); - return new PageUtils(questionsEntityIPage); + List collect = list.stream().map(item -> { + QuestionsVO questionsVO = new QuestionsVO(); + BeanUtils.copyProperties(item, questionsVO); + + //处理时间格式 + questionsVO.setModifyTime(handleTime(item.getModifyTime())); + + return questionsVO; + }).collect(Collectors.toList()); + + questionsPage.setList(collect); + + return questionsPage; + } + + //处理时间格式 + private String handleTime(Date date) { + Instant instant = date.toInstant(); + ZoneId zoneId = ZoneId.systemDefault(); + LocalDateTime localDateTime = instant.atZone(zoneId).toLocalDateTime(); + return localDateTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); // 当前日期和时间 } @Override @@ -106,6 +127,12 @@ public class QuestionsServiceImpl extends ServiceImpl