| | |
| | | import com.mindskip.xzs.service.ExamTemplatesService; |
| | | import com.mindskip.xzs.utility.PageInfoHelper; |
| | | import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVM; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.validation.Valid; |
| | |
| | | |
| | | @RestController("AdminExamTemplatesController") |
| | | @RequestMapping(value = "/api/admin/exam/templates") |
| | | @Slf4j |
| | | public class ExamTemplatesController extends BaseApiController { |
| | | |
| | | private final ExamTemplatesService examTemplatesService; |
| | |
| | | |
| | | @RequestMapping(value = "/edit", method = RequestMethod.POST) |
| | | public RestResponse edit(@RequestBody @Valid ExamPaperEditRequestVM model) { |
| | | log.info("--------->参数{}",model); |
| | | examTemplatesService.add(model); |
| | | return RestResponse.ok(); |
| | | } |
| | |
| | | package com.mindskip.xzs.domain; |
| | | |
| | | import java.io.Serializable; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | public class ExamTemplates implements Serializable { |
| | | |
| | |
| | | private Date ctime; |
| | | private String status; |
| | | private String menuIds; |
| | | private List<String> limitDateTime; |
| | | private LocalDateTime startTime; |
| | | private LocalDateTime endTime; |
| | | |
| | | public LocalDateTime getStartTime() { |
| | | return startTime; |
| | | } |
| | | |
| | | public void setStartTime(LocalDateTime startTime) { |
| | | this.startTime = startTime; |
| | | } |
| | | |
| | | public LocalDateTime getEndTime() { |
| | | return endTime; |
| | | } |
| | | |
| | | public void setEndTime(LocalDateTime endTime) { |
| | | this.endTime = endTime; |
| | | } |
| | | |
| | | public List<String> getLimitDateTime() { |
| | | return limitDateTime; |
| | | } |
| | | |
| | | public void setLimitDateTime(List<String> limitDateTime) { |
| | | this.limitDateTime = limitDateTime; |
| | | } |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | |
| | | this.menuIds = menuIds; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "ExamTemplates{" + |
| | | "id=" + id + |
| | | ", name='" + name + '\'' + |
| | | ", paperType='" + paperType + '\'' + |
| | | ", suggestTime='" + suggestTime + '\'' + |
| | | ", titleName='" + titleName + '\'' + |
| | | ", ctime='" + ctime + '\'' + |
| | | ", status='" + status + '\'' + |
| | | ", menuIds='" + menuIds + '\'' + |
| | | '}'; |
| | | } |
| | | |
| | | } |
| | |
| | | import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVM; |
| | | import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperTitleItemVM; |
| | | import com.mindskip.xzs.viewmodel.admin.exam.QuestionTypeVM; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service |
| | | @Slf4j |
| | | public class ExamTemplatesServiceImpl extends BaseServiceImpl<ExamTemplates> implements ExamTemplatesService { |
| | | |
| | | private final ExamTemplatesMapper examTemplatesMapper; |
| | |
| | | } |
| | | |
| | | ExamTemplates examTemplates = ExamTemplatesClassConvert.INSTANCE.ExamPaperEditRequestVMToExamTemplates(model); |
| | | |
| | | DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | LocalDateTime startTime = LocalDateTime.parse(model.getLimitDateTime().get(0),dateTimeFormatter); |
| | | LocalDateTime endTime = LocalDateTime.parse(model.getLimitDateTime().get(1),dateTimeFormatter); |
| | | |
| | | examTemplates.setCtime(new Date()); |
| | | examTemplates.setTitleName(model.getTitleItems().get(0).getName()); |
| | | examTemplates.setStatus(model.getStatus()); |
| | | examTemplates.setMenuIds(model.getMenuIds()); |
| | | examTemplates.setStartTime(startTime); |
| | | examTemplates.setEndTime(endTime); |
| | | examTemplatesMapper.add(examTemplates); |
| | | |
| | | List<ExamTemplatesQuestion> examTemplatesQuestions = ExamTemplatesClassConvert.INSTANCE.QuestionTypeVMListToExamTemplatesQuestionList(model.getQuestionTypeVMS()) |
| | |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import javax.validation.constraints.Size; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | public void setMenuIds(String menuIds) { |
| | | this.menuIds = menuIds; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "ExamPaperEditRequestVM{" + |
| | | "id=" + id + |
| | | ", level=" + level + |
| | | ", subjectId=" + Arrays.toString(subjectId) + |
| | | ", paperType=" + paperType + |
| | | ", name='" + name + '\'' + |
| | | ", suggestTime=" + suggestTime + |
| | | ", limitDateTime=" + limitDateTime + |
| | | ", titleItems=" + titleItems + |
| | | ", score='" + score + '\'' + |
| | | ", departmentIds=" + Arrays.toString(departmentIds) + |
| | | ", userIds=" + Arrays.toString(userIds) + |
| | | ", subjectSource=" + subjectSource + |
| | | ", questionTypeVMS=" + questionTypeVMS + |
| | | ", aggregateSource=" + aggregateSource + |
| | | ", userId=" + Arrays.toString(userId) + |
| | | ", type='" + type + '\'' + |
| | | ", status='" + status + '\'' + |
| | | ", menuIds='" + menuIds + '\'' + |
| | | '}'; |
| | | } |
| | | } |