v0.1缺陷管理

hehai
mzh820631607 4 years ago
parent fa8aa0a999
commit e691bb63ba
  1. 5
      src/main/java/com/msdw/tms/api/ProjectRcordControllerApi.java
  2. 19
      src/main/java/com/msdw/tms/controller/ProjectRecordController.java
  3. 43
      src/main/java/com/msdw/tms/entity/request/ExperimentProjectRecordImportRequest.java
  4. 42
      src/main/java/com/msdw/tms/entity/request/ProjectRecordImportRequest.java
  5. 2
      src/main/java/com/msdw/tms/service/ProjectRecordService.java
  6. 42
      src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java
  7. 6
      src/main/java/com/msdw/tms/service/impl/QuestionsServiceImpl.java
  8. BIN
      src/main/resources/excel-template/实验报告导出模板.xlsx
  9. BIN
      src/main/resources/excel-template/教学实验报告导出模板.xlsx
  10. BIN
      src/main/resources/excel-template/虚拟仿真实验报告导出模板.xlsx
  11. 5
      src/main/resources/mapper/tms/ClassTeachingDao.xml

@ -26,8 +26,11 @@ public interface ProjectRcordControllerApi {
@ApiOperation(value = "个人实验概览",notes = "个人实验概览") @ApiOperation(value = "个人实验概览",notes = "个人实验概览")
R getUserScore(Integer userid); R getUserScore(Integer userid);
@ApiOperation(value = "个人实验记录导出",notes = "个人实验记录导出") @ApiOperation(value = "个人虚拟仿真实验记录导出",notes = "个人虚拟仿真实验记录导出")
void exportProjectRecord(HttpServletResponse response,Integer userId)throws Exception; void exportProjectRecord(HttpServletResponse response,Integer userId)throws Exception;
@ApiOperation(value = "个人教学实验记录导出",notes = "个人教学实验记录导出")
void exportExperimentProjectRecord(HttpServletResponse response,Integer userId)throws Exception;
// @ApiOperation(value = "个人实验记录导出",notes = "个人实验记录导出") // @ApiOperation(value = "个人实验记录导出",notes = "个人实验记录导出")
// void exportProjectRecord(HttpServletResponse response,Integer userId)throws Exception; // void exportProjectRecord(HttpServletResponse response,Integer userId)throws Exception;

@ -56,7 +56,7 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
* 用户端虚拟仿真实验记录 * 用户端虚拟仿真实验记录
* @param page * @param page
* @param size * @param size
* @param userid * @param
* @return * @return
*/ */
@Override @Override
@ -109,7 +109,7 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
/** /**
* 导出个人项目记录 * 导出个人虚拟仿真实验记录
* @param response * @param response
* @param userId * @param userId
* @throws Exception * @throws Exception
@ -117,7 +117,20 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
@Override @Override
@GetMapping("/user/exportProjectRecord") @GetMapping("/user/exportProjectRecord")
public void exportProjectRecord(HttpServletResponse response,@RequestParam("userId") Integer userId)throws Exception{ public void exportProjectRecord(HttpServletResponse response,@RequestParam("userId") Integer userId)throws Exception{
projectRecordService.exportProjectRecord(response,userId); projectRecordService.exportProjectRecord(response,userId);
}
/**
* 导出个人教学实验记录
* @param response
* @param userId
* @throws Exception
*/
@Override
@GetMapping("/user/exportExperimentProjectRecord")
public void exportExperimentProjectRecord(HttpServletResponse response,@RequestParam("userId") Integer userId)throws Exception{
projectRecordService.exportExperimentProjectRecord(response,userId);
} }
/** /**

@ -0,0 +1,43 @@
package com.msdw.tms.entity.request;
import com.msdw.tms.common.utils.poi.ExcelAttribute;
import lombok.Data;
/**
* 教学实验记录导出模板
*/
@Data
public class ExperimentProjectRecordImportRequest {
/**
* 实验班级名称
*/
@ExcelAttribute(sort = 0)
private String experimentalClassName;
/**
* 实验项目名称
*/
@ExcelAttribute(sort = 1)
private String projectName;
/**
* 得分
*/
@ExcelAttribute(sort = 2)
private Integer score;
/**
* 耗时
*/
@ExcelAttribute(sort = 3)
private Integer timeSum;
/**
* 起始时间
*/
@ExcelAttribute(sort = 4)
private String startTime;
/**
* 结束时间
*/
@ExcelAttribute(sort = 5)
private String endTime;
}

@ -3,6 +3,9 @@ package com.msdw.tms.entity.request;
import com.msdw.tms.common.utils.poi.ExcelAttribute; import com.msdw.tms.common.utils.poi.ExcelAttribute;
import lombok.Data; import lombok.Data;
/**
* 虚拟仿真试验记录导出模板
*/
@Data @Data
public class ProjectRecordImportRequest { public class ProjectRecordImportRequest {
@ -18,36 +21,45 @@ public class ProjectRecordImportRequest {
// private String userRecordstate; // private String userRecordstate;
// //
// private Integer recordstate; // private Integer recordstate;
/** // /**
* 实验班级名称 // * 得分
*/ // */
@ExcelAttribute(sort = 1) // @ExcelAttribute(sort = 2)
private String experimental_class_name; // private Integer score;
// /**
// * 耗时
// */
// @ExcelAttribute(sort = 3)
// private Integer timeSum;
// /**
// * 起始时间
// */
// @ExcelAttribute(sort = 4)
// private String startTime;
// /**
// * 结束时间
// */
// @ExcelAttribute(sort = 5)
// private String endTime;
/** /**
* 得分 * 得分
*/ */
@ExcelAttribute(sort = 2) @ExcelAttribute(sort = 1)
private Integer score; private Integer score;
/** /**
* 耗时 * 耗时
*/ */
@ExcelAttribute(sort = 3) @ExcelAttribute(sort = 2)
private Integer timeSum; private Integer timeSum;
/** /**
* 起始时间 * 起始时间
*/ */
@ExcelAttribute(sort = 4) @ExcelAttribute(sort = 3)
private String startTime; private String startTime;
/** /**
* 结束时间 * 结束时间
*/ */
@ExcelAttribute(sort = 5) @ExcelAttribute(sort = 4)
private String endTime; private String endTime;
/**
* 结束时间
*/
@ExcelAttribute(sort = 6)
private String abc;
} }

@ -25,6 +25,8 @@ public interface ProjectRecordService extends IService<ProjectRecordEntity> {
void exportProjectRecord(HttpServletResponse response, Integer userId)throws Exception; void exportProjectRecord(HttpServletResponse response, Integer userId)throws Exception;
void exportExperimentProjectRecord(HttpServletResponse response, Integer userId)throws Exception;
PageUtils querySchoolRecord(Integer page,Integer size,ProjectRecordVo projectRecord); PageUtils querySchoolRecord(Integer page,Integer size,ProjectRecordVo projectRecord);
boolean updateUserRecord(ProjectRecordEntity projectRecord); boolean updateUserRecord(ProjectRecordEntity projectRecord);

@ -8,6 +8,7 @@ import com.msdw.tms.common.utils.PageUtils;
import com.msdw.tms.common.utils.poi.ExcelExportUtil; import com.msdw.tms.common.utils.poi.ExcelExportUtil;
import com.msdw.tms.dao.ProjectRecordDao; import com.msdw.tms.dao.ProjectRecordDao;
import com.msdw.tms.entity.ProjectRecordEntity; import com.msdw.tms.entity.ProjectRecordEntity;
import com.msdw.tms.entity.request.ExperimentProjectRecordImportRequest;
import com.msdw.tms.entity.request.ProjectRecordImportRequest; import com.msdw.tms.entity.request.ProjectRecordImportRequest;
import com.msdw.tms.entity.vo.ProjectRecordExportVo; import com.msdw.tms.entity.vo.ProjectRecordExportVo;
import com.msdw.tms.entity.vo.ProjectRecordVo; import com.msdw.tms.entity.vo.ProjectRecordVo;
@ -19,9 +20,8 @@ import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream; import java.io.InputStream;
import java.util.List; import java.util.List;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -86,12 +86,44 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
}).collect(Collectors.toList()); }).collect(Collectors.toList());
//2.加载模板流数据 //2.加载模板流数据
org.springframework.core.io.Resource resource = new ClassPathResource("excel-template/实验报告导出模板.xlsx"); // org.springframework.core.io.Resource resource = new ClassPathResource("excel-template/虚拟仿真实验报告导出模板.xlsx");
FileInputStream fis = new FileInputStream(resource.getFile()); // FileInputStream fis = new FileInputStream(resource.getFile());
ClassPathResource resource = new ClassPathResource("excel-template/虚拟仿真实验报告导出模板.xlsx");
InputStream inputStream = resource.getInputStream();
//3、通过工具类下载文件 //3、通过工具类下载文件
new ExcelExportUtil(ProjectRecordImportRequest.class, Constant.ROW_INDEX, Constant.STYLE_INDEX). new ExcelExportUtil(ProjectRecordImportRequest.class, Constant.ROW_INDEX, Constant.STYLE_INDEX).
export(response, fis, importRequests, "实验报告导出.xlsx"); export(response, inputStream, importRequests, "虚拟仿真实验报告.xlsx");
// new ExcelExportUtil(ProjectRecordImportRequest.class, Constant.ROW_INDEX, Constant.STYLE_INDEX).
// export(response, fis, importRequests, "实验报告导出.xlsx");
}
/**
* 导出个人教学试验记录
*/
@Override
public void exportExperimentProjectRecord(HttpServletResponse response,Integer userId)throws Exception{
//获取数据
ProjectRecordEntity projectRecord = new ProjectRecordEntity().setUserid(userId).setIsdel(Constant.IsDel.NOT_DEL.getType());
List<ProjectRecordExportVo> projectRecordVos = this.baseMapper.getByUserRecordImport(projectRecord);
List<ExperimentProjectRecordImportRequest> importRequests = projectRecordVos.stream().map(project -> {
ExperimentProjectRecordImportRequest request = new ExperimentProjectRecordImportRequest();
BeanUtils.copyProperties(project, request);
// request.setUserRecordstate(project.getRecordstate().equals(1) ? "已完成":"待评分");
return request;
}).collect(Collectors.toList());
//2.加载模板流数据
ClassPathResource resource = new ClassPathResource("excel-template/教学实验报告导出模板.xlsx");
InputStream inputStream = resource.getInputStream();
//3、通过工具类下载文件
new ExcelExportUtil(ExperimentProjectRecordImportRequest.class, Constant.ROW_INDEX, Constant.STYLE_INDEX).
export(response, inputStream, importRequests, "教学实验报告.xlsx");
} }
@Override @Override

@ -39,6 +39,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneId;
@ -623,10 +624,11 @@ public class QuestionsServiceImpl extends ServiceImpl<QuestionsDao, QuestionsEnt
//2.加载模板流数据 //2.加载模板流数据
org.springframework.core.io.Resource resource = new ClassPathResource("excel-template/试题导入失败数据导出模板.xlsx"); org.springframework.core.io.Resource resource = new ClassPathResource("excel-template/试题导入失败数据导出模板.xlsx");
FileInputStream fis = new FileInputStream(resource.getFile()); // FileInputStream fis = new FileInputStream(resource.getFile());
InputStream inputStream = resource.getInputStream();
//3、通过工具类下载文件 //3、通过工具类下载文件
new ExcelExportUtil(QuestionsImportFailureVO.class, Constant.ROW_INDEX, Constant.STYLE_INDEX). new ExcelExportUtil(QuestionsImportFailureVO.class, Constant.ROW_INDEX, Constant.STYLE_INDEX).
export(response, fis, parse, "导入失败数据表.xlsx"); export(response, inputStream, parse, "导入失败数据表.xlsx");
} }
} }

@ -24,11 +24,6 @@
tms_experimental_teaching tms_experimental_teaching
WHERE WHERE
is_del=0 is_del=0
AND
type!=1
AND
`status`!= 1
<if test="cla.status!=null">and `status` = #{cla.status}</if> <if test="cla.status!=null">and `status` = #{cla.status}</if>
<if test="cla.condition!=null">and ( project_name like concat('%',#{cla.condition},'%') or experimental_class_name like concat('%',#{cla.condition},'%') )</if> <if test="cla.condition!=null">and ( project_name like concat('%',#{cla.condition},'%') or experimental_class_name like concat('%',#{cla.condition},'%') )</if>
<if test="cla.startTime!=null and cla.endTime!=null">and stop_time between #{cla.endTime} and #{cla.startTime}</if> <if test="cla.startTime!=null and cla.endTime!=null">and stop_time between #{cla.endTime} and #{cla.startTime}</if>

Loading…
Cancel
Save