个人教学实验记录查询

hehai
mzh820631607 4 years ago
parent 8ba68c306c
commit e35ca64653
  1. 2
      src/main/java/com/msdw/tms/api/ClassTeachingApi.java
  2. 4
      src/main/java/com/msdw/tms/api/ProjectRcordControllerApi.java
  3. 16
      src/main/java/com/msdw/tms/controller/ClassTeachingController.java
  4. 21
      src/main/java/com/msdw/tms/controller/ProjectRecordController.java
  5. 3
      src/main/java/com/msdw/tms/dao/ClassTeachingDao.java
  6. 2
      src/main/java/com/msdw/tms/dao/ProjectRecordDao.java
  7. 3
      src/main/java/com/msdw/tms/entity/ExperimentalTeachingEntity.java
  8. 5
      src/main/java/com/msdw/tms/entity/vo/ProjectRecordVo.java
  9. 3
      src/main/java/com/msdw/tms/service/ProjectRecordService.java
  10. 11
      src/main/java/com/msdw/tms/service/impl/ClassTeachingServiceImpl.java
  11. 6
      src/main/java/com/msdw/tms/service/impl/ProjectRecordServiceImpl.java
  12. 21
      src/main/resources/mapper/tms/ClassTeachingDao.xml
  13. 9
      src/main/resources/mapper/tms/ProjectRecordDao.xml

@ -14,7 +14,7 @@ public interface ClassTeachingApi {
@ApiOperation(value = "查询班级实验列表信息",notes = "查询班级实验列表信息") @ApiOperation(value = "查询班级实验列表信息",notes = "查询班级实验列表信息")
R queryTestRecord(Integer page, Integer size, Integer month, String startTime, String endTime, R queryTestRecord(Integer page, Integer size, Integer month, String startTime, String endTime,
String condition, Integer status, Integer isCode); String condition, Integer status);
@ApiOperation(value = "查看成绩",notes = "查看成绩") @ApiOperation(value = "查看成绩",notes = "查看成绩")
R queryAchievement(); R queryAchievement();

@ -27,7 +27,9 @@ public interface ProjectRcordControllerApi {
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,ProjectRecordVo list)throws Exception;
// @ApiOperation(value = "个人实验记录导出",notes = "个人实验记录导出")
// void exportProjectRecord(HttpServletResponse response,Integer userId)throws Exception;
@ApiOperation(value = "修改实验报告分数",notes = "修改实验报告分数") @ApiOperation(value = "修改实验报告分数",notes = "修改实验报告分数")
R update(ProjectRecordEntity projectRecord); R update(ProjectRecordEntity projectRecord);

@ -32,12 +32,13 @@ public class ClassTeachingController implements ClassTeachingApi {
*/ */
@Override @Override
@GetMapping("userRecord") @GetMapping("userRecord")
public R queryTestRecord(@RequestParam Integer page, @RequestParam Integer size, Integer month,@RequestParam String startTime,@RequestParam String endTime, public R queryTestRecord(@RequestParam Integer page, @RequestParam Integer size, Integer month,String startTime,String endTime,
String condition, @RequestParam Integer status,@RequestParam Integer isCode){ String condition, @RequestParam Integer status){
ProjectRecordVo recordVo = new ProjectRecordVo(); ProjectRecordVo recordVo = new ProjectRecordVo();
if (isCode==0){ if (status==1||status==2||status==3) {//限定实验状态
if (status!=0) {//不限定实验状态
recordVo.setStatus(status); recordVo.setStatus(status);
}else{//不限定实验状态
recordVo.setStatus(null);
} }
if(!StringUtils.isEmpty(condition)){ if(!StringUtils.isEmpty(condition)){
recordVo.setCondition(condition); recordVo.setCondition(condition);
@ -45,20 +46,15 @@ public class ClassTeachingController implements ClassTeachingApi {
if(!StringUtils.isEmpty(month)) { if(!StringUtils.isEmpty(month)) {
recordVo.setMonth(month); recordVo.setMonth(month);
}else { }else {
recordVo.setMonth(0); recordVo.setMonth(null);
if(!StringUtils.isEmpty(startTime)) { if(!StringUtils.isEmpty(startTime)) {
recordVo.setStartTime(startTime); recordVo.setStartTime(startTime);
}if(!StringUtils.isEmpty(endTime)) { }if(!StringUtils.isEmpty(endTime)) {
recordVo.setEndTime(endTime); recordVo.setEndTime(endTime);
} }
} }
recordVo.setIsCode(isCode);
PageUtils page1 = classTeachingService.queryClassRecord(page,size,recordVo); PageUtils page1 = classTeachingService.queryClassRecord(page,size,recordVo);
return R.ok().put("page", page1); return R.ok().put("page", page1);
}else if (isCode==1){
return R.error("无需邀请码");
}
return R.error("错误操作,isCode 不能为空");
} }
/** /**

@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
/** /**
* *
@ -98,15 +99,27 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
/** /**
* 导出个人项目记录 * 导出个人项目记录
* @param response * @param response
* @param userId
* @throws Exception * @throws Exception
*/ */
@Override @Override
@GetMapping("/user/exportProjectRecord") @PostMapping("/user/exportProjectRecord")
public void exportProjectRecord(HttpServletResponse response,@RequestParam("userId") Integer userId)throws Exception{ public void exportProjectRecord(HttpServletResponse response,@RequestBody ProjectRecordVo list)throws Exception{
projectRecordService.exportProjectRecord(response,userId); projectRecordService.exportProjectRecord(response,list);
} }
// /**
// * 导出个人项目记录
// * @param response
// * @param userId
// * @throws Exception
// */
// @Override
// @GetMapping("/user/exportProjectRecord")
// public void exportProjectRecord(HttpServletResponse response,@RequestParam("userId") Integer userId)throws Exception{
// projectRecordService.exportProjectRecord(response,userId);
// }
/** /**
* 信息 * 信息
*/ */

@ -12,4 +12,7 @@ public interface ClassTeachingDao {
ExperimentalTeachingEntity queryInvitationCode(ExperimentalTeachingEntity experimentEntity); ExperimentalTeachingEntity queryInvitationCode(ExperimentalTeachingEntity experimentEntity);
IPage<ProjectRecordVo> getByClassRecord(Page page1, @Param("cla") ProjectRecordVo recordVo); IPage<ProjectRecordVo> getByClassRecord(Page page1, @Param("cla") ProjectRecordVo recordVo);
void updateSurplusTime(@Param("cla") ProjectRecordVo recordVo);
void updateSurplusTimeNull(@Param("cla") ProjectRecordVo recordVo);
} }

@ -24,7 +24,7 @@ public interface ProjectRecordDao extends BaseMapper<ProjectRecordEntity> {
IPage<ProjectRecordVo> getByUserExperimentRecord(Page page,@Param("pro") ProjectRecordEntity projectRecordEntity); IPage<ProjectRecordVo> getByUserExperimentRecord(Page page,@Param("pro") ProjectRecordEntity projectRecordEntity);
List<ProjectRecordVo> getByUserRecordImport(ProjectRecordEntity projectRecordEntity); List<ProjectRecordVo> getByUserRecordImport(@Param("pro") ProjectRecordEntity projectRecordEntity,List<Integer> projectIds);
ProjectRecordVo getByUserScore(@Param("userid") Integer userId,@Param("isdel") Integer isdel); ProjectRecordVo getByUserScore(@Param("userid") Integer userId,@Param("isdel") Integer isdel);

@ -45,5 +45,6 @@ public class ExperimentalTeachingEntity {
private Integer isCode; private Integer isCode;
//绑定用户Id //绑定用户Id
private Integer userId; private Integer userId;
//实验倒计时
private String surplusTime;
} }

@ -80,6 +80,11 @@ public class ProjectRecordVo extends ProjectRecordEntity implements Serializable
*/ */
private String experimentalClassName; private String experimentalClassName;
/**
* 封装多个项目id
*/
private List<Integer> projectIds;
// /** // /**
// * 班级实验状态,0 不限,1 未发布,2 进行中,3 已完成 // * 班级实验状态,0 不限,1 未发布,2 进行中,3 已完成
// */ // */

@ -6,6 +6,7 @@ import com.msdw.tms.entity.ProjectRecordEntity;
import com.msdw.tms.entity.vo.ProjectRecordVo; import com.msdw.tms.entity.vo.ProjectRecordVo;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List;
/** /**
* *
@ -22,7 +23,7 @@ public interface ProjectRecordService extends IService<ProjectRecordEntity> {
ProjectRecordVo queryUserScore(Integer userId); ProjectRecordVo queryUserScore(Integer userId);
void exportProjectRecord(HttpServletResponse response,Integer userId)throws Exception; void exportProjectRecord(HttpServletResponse response, ProjectRecordVo vo)throws Exception;
PageUtils querySchoolRecord(Integer page,Integer size,ProjectRecordVo projectRecord); PageUtils querySchoolRecord(Integer page,Integer size,ProjectRecordVo projectRecord);

@ -11,6 +11,7 @@ import com.msdw.tms.service.ClassTeachingService;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service @Service
public class ClassTeachingServiceImpl implements ClassTeachingService { public class ClassTeachingServiceImpl implements ClassTeachingService {
@ -23,11 +24,21 @@ public class ClassTeachingServiceImpl implements ClassTeachingService {
return ex; return ex;
} }
/**
* 查询班级实验信息
* @param page
* @param size
* @param recordVo
* @return
*/
@Override @Override
@Transactional
public PageUtils queryClassRecord(Integer page, Integer size, ProjectRecordVo recordVo) { public PageUtils queryClassRecord(Integer page, Integer size, ProjectRecordVo recordVo) {
//分页对象 //分页对象
Page<T> page1 = new Page<>(page, size); Page<T> page1 = new Page<>(page, size);
recordVo.setIsdel(Constant.IsDel.NOT_DEL.getType()); recordVo.setIsdel(Constant.IsDel.NOT_DEL.getType());
this.classMapper.updateSurplusTimeNull(recordVo);//将已结束的实验的倒计时重置为0
this.classMapper.updateSurplusTime(recordVo);//倒计时:设定倒计时的剩余时间
IPage<ProjectRecordVo> schoolRecord = this.classMapper.getByClassRecord(page1, recordVo); IPage<ProjectRecordVo> schoolRecord = this.classMapper.getByClassRecord(page1, recordVo);
PageUtils pageUtils = new PageUtils(schoolRecord); PageUtils pageUtils = new PageUtils(schoolRecord);
return pageUtils; return pageUtils;

@ -70,11 +70,13 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
} }
@Override @Override
public void exportProjectRecord(HttpServletResponse response,Integer userId)throws Exception{ public void exportProjectRecord(HttpServletResponse response,ProjectRecordVo vo)throws Exception{
//获取数据 //获取数据
Integer userId = vo.getUserId();
List<Integer> projectIds = vo.getProjectIds();
ProjectRecordEntity projectRecord = new ProjectRecordEntity().setUserid(userId).setIsdel(Constant.IsDel.NOT_DEL.getType()); ProjectRecordEntity projectRecord = new ProjectRecordEntity().setUserid(userId).setIsdel(Constant.IsDel.NOT_DEL.getType());
List<ProjectRecordVo> projectRecordVos = this.baseMapper.getByUserRecordImport(projectRecord); List<ProjectRecordVo> projectRecordVos = this.baseMapper.getByUserRecordImport(projectRecord,projectIds);
List<ProjectRecordImportRequest> importRequests = projectRecordVos.stream().map(project -> { List<ProjectRecordImportRequest> importRequests = projectRecordVos.stream().map(project -> {
ProjectRecordImportRequest request = new ProjectRecordImportRequest(); ProjectRecordImportRequest request = new ProjectRecordImportRequest();

@ -10,6 +10,7 @@
SELECT SELECT
id, id,
experimental_class_name, experimental_class_name,
surplus_time,
experiment_duration, experiment_duration,
experimental_name, experimental_name,
experimental_number, experimental_number,
@ -19,11 +20,27 @@
FROM FROM
tms_experimental_teaching tms_experimental_teaching
WHERE WHERE
`status` = #{cla.status} is_del=0
and is_code = #{cla.isCode} <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>
<if test="cla.month!=null">and DATE_SUB(CURDATE(), INTERVAL #{cla.month} month ) &lt;= date(stop_time)</if> <if test="cla.month!=null">and DATE_SUB(CURDATE(), INTERVAL #{cla.month} month ) &lt;= date(stop_time)</if>
</select> </select>
<update id="updateSurplusTime" parameterType="com.msdw.tms.entity.ExperimentalTeachingEntity">
UPDATE tms_experimental_teaching
SET surplus_time = TIMEDIFF( stop_time, NOW( ) )
WHERE
now( ) >= start_time
AND stop_time >= now( )
AND is_del=0
</update>
<update id="updateSurplusTimeNull" parameterType="com.msdw.tms.entity.ExperimentalTeachingEntity">
UPDATE tms_experimental_teaching
SET surplus_time = 0
WHERE
now( ) >= stop_time
AND is_del=0
</update>
</mapper> </mapper>

@ -69,9 +69,14 @@
tms_project_record tpr tms_project_record tpr
LEFT JOIN tms_project tp ON tpr.projectId = tp.projectId LEFT JOIN tms_project tp ON tpr.projectId = tp.projectId
WHERE WHERE
tpr.userId = #{userid} tpr.userId = #{pro.userid}
AND AND
tpr.isdel = #{isdel} tpr.isdel = #{pro.isdel}
<if test="projectIds!=null"> AND tpr.projectId IN
<foreach collection="projectIds" item="projectId" separator=",">
#{projectId}
</foreach>
</if>
</select> </select>
<!-- 个人实验预览--> <!-- 个人实验预览-->

Loading…
Cancel
Save