个人教学实验记录查询

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 = "查询班级实验列表信息")
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 = "查看成绩")
R queryAchievement();

@ -27,7 +27,9 @@ public interface ProjectRcordControllerApi {
R getUserScore(Integer userid);
@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 = "修改实验报告分数")
R update(ProjectRecordEntity projectRecord);

@ -32,12 +32,13 @@ public class ClassTeachingController implements ClassTeachingApi {
*/
@Override
@GetMapping("userRecord")
public R queryTestRecord(@RequestParam Integer page, @RequestParam Integer size, Integer month,@RequestParam String startTime,@RequestParam String endTime,
String condition, @RequestParam Integer status,@RequestParam Integer isCode){
public R queryTestRecord(@RequestParam Integer page, @RequestParam Integer size, Integer month,String startTime,String endTime,
String condition, @RequestParam Integer status){
ProjectRecordVo recordVo = new ProjectRecordVo();
if (isCode==0){
if (status!=0) {//不限定实验状态
if (status==1||status==2||status==3) {//限定实验状态
recordVo.setStatus(status);
}else{//不限定实验状态
recordVo.setStatus(null);
}
if(!StringUtils.isEmpty(condition)){
recordVo.setCondition(condition);
@ -45,20 +46,15 @@ public class ClassTeachingController implements ClassTeachingApi {
if(!StringUtils.isEmpty(month)) {
recordVo.setMonth(month);
}else {
recordVo.setMonth(0);
recordVo.setMonth(null);
if(!StringUtils.isEmpty(startTime)) {
recordVo.setStartTime(startTime);
}if(!StringUtils.isEmpty(endTime)) {
recordVo.setEndTime(endTime);
}
}
recordVo.setIsCode(isCode);
PageUtils page1 = classTeachingService.queryClassRecord(page,size,recordVo);
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 java.util.Arrays;
import java.util.List;
/**
*
@ -98,15 +99,27 @@ public class ProjectRecordController implements ProjectRcordControllerApi {
/**
* 导出个人项目记录
* @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);
@PostMapping("/user/exportProjectRecord")
public void exportProjectRecord(HttpServletResponse response,@RequestBody ProjectRecordVo list)throws Exception{
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);
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);
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);

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

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

@ -6,6 +6,7 @@ import com.msdw.tms.entity.ProjectRecordEntity;
import com.msdw.tms.entity.vo.ProjectRecordVo;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
*
@ -22,7 +23,7 @@ public interface ProjectRecordService extends IService<ProjectRecordEntity> {
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);

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

@ -70,11 +70,13 @@ public class ProjectRecordServiceImpl extends ServiceImpl<ProjectRecordDao, Proj
}
@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());
List<ProjectRecordVo> projectRecordVos = this.baseMapper.getByUserRecordImport(projectRecord);
List<ProjectRecordVo> projectRecordVos = this.baseMapper.getByUserRecordImport(projectRecord,projectIds);
List<ProjectRecordImportRequest> importRequests = projectRecordVos.stream().map(project -> {
ProjectRecordImportRequest request = new ProjectRecordImportRequest();

@ -10,6 +10,7 @@
SELECT
id,
experimental_class_name,
surplus_time,
experiment_duration,
experimental_name,
experimental_number,
@ -19,11 +20,27 @@
FROM
tms_experimental_teaching
WHERE
`status` = #{cla.status}
and is_code = #{cla.isCode}
is_del=0
<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.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>
</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>

@ -69,9 +69,14 @@
tms_project_record tpr
LEFT JOIN tms_project tp ON tpr.projectId = tp.projectId
WHERE
tpr.userId = #{userid}
tpr.userId = #{pro.userid}
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>
<!-- 个人实验预览-->

Loading…
Cancel
Save