前言一、开启关卡学习
1.1 开启关卡1.2设置完成时间/关闭时间 二、查询学科、阶段、关卡
2.1 根据阶段名称查询所有的关卡学习信息(管理员操作)2.2 根据用户名称和阶段名称查询所有的关卡学习信息(用户操作)2.3 根据学科名称查询关卡学习信息(管理员操作)2.4 根据用户名称和学科名称查询关卡学习信息(用户操作) 总结 前言
第一次做一个关于团队的合作项目——禅道,肯定做的不是那么顺利,但是根据流程走还是可以做下来的,后面的冲刺有这次的经验就会相对简单一些。在最开始分配任务的时候,一定要和相关人员讨论好需求,不然会浪费大量时间。在本次冲刺阶段我主要任务是开启关卡学习和查询学科、阶段、关卡功能。
一、开启关卡学习 1.1 开启关卡功能:通过对未开始的关卡进行学习。在开启的时候要注意修改状态为进行中。部分代码如下:
@RequestMapping(value = "/startCustomspassStudy") @ResponseBody public ResultInfo startStageStudy( @RequestParam(value = "id") int id, @RequestParam(value = "start") String start, @RequestParam(value = "end") String end) throws ParseException { ResultInfo info=customspassService.startCustomspassStudy(id,start,end); return info; }
@Override public ResultInfo startCustomspassStudy(int id, String _start, String _end) throws ParseException { ResultInfo info=new ResultInfo(); info.setFlag(true); //将日期转为java日期 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); Date start1 = sdf.parse(_start); Date end1 = sdf.parse(_end); java.sql.Date start = new java.sql.Date(start1.getTime()); java.sql.Date end = new java.sql.Date(end1.getTime());// System.out.println(email); try { //添加关卡学习记录 customspassMapper.startCustomspassStudy(id, start, end); //根据关卡学习id修改status=3(进行中) customspassMapper.updateStusyCustomspassStatusById(id); }catch (Exception e){ info.setFlag(false); info.setErrorMsg("开启关卡失败"); e.printStackTrace(); } return info; }
1.2设置完成时间/关闭时间功能:通过关卡编号来设置完成时间/关闭时间。都要修改相应的状态(已完成、已关闭)部分代码如下:
@RequestMapping("/updateFinishTimeById") @ResponseBody public ResultInfo updateFinishTimeById( @RequestParam(value = "id") int id, @RequestParam(value = "actualFinishTime") String actualFinishTime ) throws ParseException { ResultInfo info=customspassService.updateFinishTimeById(id,actualFinishTime); return info; }
@Override public ResultInfo updateFinishTimeById(int id, String _actualFinishTime) throws ParseException { ResultInfo info=new ResultInfo(); info.setFlag(true); //Java日期转为sql日期 SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd"); Date actualFinishTime1 = sdf.parse(_actualFinishTime); java.sql.Date actualFinishTime = new java.sql.Date(actualFinishTime1.getTime()); try { //设置实际完成时间 customspassMapper.updateFinishTimeById(id,actualFinishTime); //修改status=0 customspassMapper.updateFinishStatusById(id); //根据id查询StudyCustomspass StudyCustomspass studyCustomspass = customspassMapper.selectStudyCustomspassById(id); //计算实际完成的天数 Long actualFinishDay = between_days(studyCustomspass.getStart(), studyCustomspass.getActualFinishTime()); //判断该关卡是否逾期,是:修改status=2 Long aLong = between_days(studyCustomspass.getActualFinishTime(), studyCustomspass.getEnd()); if (aLong<0){ //根据关卡学习id修改status=2 customspassMapper.updateStatusById(id); //计算开始时间、结束时间相差的天数 Long betweenDays = between_days(studyCustomspass.getStart(), studyCustomspass.getEnd()); customspassMapper.updateActualFinishDayById(id,betweenDays); }else { //根据关卡学习id设置实际完成天数 customspassMapper.updateActualFinishDayById(id,actualFinishDay); } }catch (Exception e){ info.setFlag(false); info.setErrorMsg("设置失败"); } return info; }
二、查询学科、阶段、关卡功能:根据阶段名称、用户名称、学科名称查询关卡学习信息。
2.1 根据阶段名称查询所有的关卡学习信息(管理员操作)部分代码如下:
@Override public ResultInfo selectStudyCustomspassByStageName(String stageName) { ResultInfo info=new ResultInfo(); info.setFlag(true); try { List
@Select("SELECT * FROM study_customspass WHERe customspassId IN(n" + "tSELECt customspassId FROM stage_customspass WHERe stageId IN(n" + "ttSELECt stageId FROM stage WHERe `name`=#{stageName} n" + "t)n" + ")") List
部分代码如下:
@Override public ResultInfo selectStudyCustomspassByUsernameAndStageName(String username, String stageName) { ResultInfo info=new ResultInfo(); info.setFlag(true); try { List
@Select("SELECT * FROM study_customspass WHERe customspassId IN(n" + "tSELECt customspassId FROM stage_customspass WHERe stageId IN(n" + "ttSELECt stageId FROM stage WHERe `name`=#{stageName} n" + "t)n" + ")AND username=#{username}") List
部分代码如下:
@Override public ResultInfo selectStudyCustomspassBySubjectName(String subjectName) { ResultInfo info=new ResultInfo(); info.setFlag(true); try { Subject subject = subjectMapper.selectSubjectBySubjectName(subjectName); List
@Select("SELECT * FROM study_customspass WHERe customspassId IN(n" + "tSELECt customspassId FROM stage_customspass WHERe stageId IN(n" + "ttSELECt stageId FROM subject_stage WHERe subjectId=#{subjectId}n" + "t)n" + ")") List
部分代码如下:
@Override public ResultInfo selectStudyCustomspassByUsernameAndSubjectName(String username, String subjectName) { ResultInfo info=new ResultInfo(); info.setFlag(true); try { Subject subject = subjectMapper.selectSubjectBySubjectName(subjectName); List
@Select("SELECT * FROM study_customspass WHERe customspassId IN(n" + "tSELECt customspassId FROM stage_customspass WHERe stageId IN(n" + "ttSELECt stageId FROM subject_stage WHERe subjectId=#{subjectId}n" + "t)n" + ")AND username=#{username}") List
在本次冲刺阶段学习很多,不仅是框架知识层面的学习,还有团队层面的学习,这在团队合作中是相当重要的。在最开始就是因为我们没有把需求理解一致,导致后面出现许多问题,所以团队配合十分重要。在此冲刺中还用到了番茄钟,让自己在一定的时间段里面让自己专注在一件事件中,也让我收获颇多。在后面的冲刺中也会利用这次的经验做的更好!