Commit 5db71ad8e38f24d50b5f6016093dde24b9f89f50
1 parent
c9362aba37
Exists in
master
and in
6 other branches
孕妇学校
Showing 6 changed files with 88 additions and 11 deletions
- platform-dal/src/main/java/com/lyms/platform/pojo/CourseModel.java
- platform-dal/src/main/java/com/lyms/platform/query/CourseQuery.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CourseController.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/CourseRequest.java
- platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CourseResult.java
platform-dal/src/main/java/com/lyms/platform/pojo/CourseModel.java
View file @
5db71ad
| ... | ... | @@ -25,8 +25,12 @@ |
| 25 | 25 | //课程时间 |
| 26 | 26 | private Date courseTime; |
| 27 | 27 | |
| 28 | + | |
| 29 | + //课程结束时间 | |
| 30 | + private Date courseEndTime; | |
| 31 | + | |
| 28 | 32 | //时长 |
| 29 | - private String timeLong; | |
| 33 | + private Integer timeLong; | |
| 30 | 34 | |
| 31 | 35 | //上线人数 |
| 32 | 36 | private Integer limitNum; |
| ... | ... | @@ -62,6 +66,14 @@ |
| 62 | 66 | |
| 63 | 67 | private String hospitalId; |
| 64 | 68 | |
| 69 | + public Date getCourseEndTime() { | |
| 70 | + return courseEndTime; | |
| 71 | + } | |
| 72 | + | |
| 73 | + public void setCourseEndTime(Date courseEndTime) { | |
| 74 | + this.courseEndTime = courseEndTime; | |
| 75 | + } | |
| 76 | + | |
| 65 | 77 | public Integer getYn() { |
| 66 | 78 | return yn; |
| 67 | 79 | } |
| 68 | 80 | |
| ... | ... | @@ -158,11 +170,11 @@ |
| 158 | 170 | this.courseTime = courseTime; |
| 159 | 171 | } |
| 160 | 172 | |
| 161 | - public String getTimeLong() { | |
| 173 | + public Integer getTimeLong() { | |
| 162 | 174 | return timeLong; |
| 163 | 175 | } |
| 164 | 176 | |
| 165 | - public void setTimeLong(String timeLong) { | |
| 177 | + public void setTimeLong(Integer timeLong) { | |
| 166 | 178 | this.timeLong = timeLong; |
| 167 | 179 | } |
| 168 | 180 |
platform-dal/src/main/java/com/lyms/platform/query/CourseQuery.java
View file @
5db71ad
| ... | ... | @@ -71,6 +71,8 @@ |
| 71 | 71 | |
| 72 | 72 | private String hospitalId; |
| 73 | 73 | |
| 74 | + private Date courseEndTime; | |
| 75 | + | |
| 74 | 76 | @Override |
| 75 | 77 | public MongoQuery convertToQuery() { |
| 76 | 78 | MongoCondition condition = MongoCondition.newInstance(); |
| 77 | 79 | |
| ... | ... | @@ -128,7 +130,13 @@ |
| 128 | 130 | } |
| 129 | 131 | } |
| 130 | 132 | |
| 133 | + if (null != courseEndTime) { | |
| 134 | + if (null != c1) { | |
| 135 | + c1 = Criteria.where("courseEndTime").lte(courseEndTime); | |
| 136 | + } | |
| 137 | + } | |
| 131 | 138 | |
| 139 | + | |
| 132 | 140 | if (null != createdStart) { |
| 133 | 141 | if (null != c1) { |
| 134 | 142 | c1 = c1.and("created").gte(createdStart); |
| ... | ... | @@ -151,6 +159,13 @@ |
| 151 | 159 | return condition.toMongoQuery(); |
| 152 | 160 | } |
| 153 | 161 | |
| 162 | + public Date getCourseEndTime() { | |
| 163 | + return courseEndTime; | |
| 164 | + } | |
| 165 | + | |
| 166 | + public void setCourseEndTime(Date courseEndTime) { | |
| 167 | + this.courseEndTime = courseEndTime; | |
| 168 | + } | |
| 154 | 169 | |
| 155 | 170 | public String getId() { |
| 156 | 171 | return id; |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CourseController.java
View file @
5db71ad
| ... | ... | @@ -39,6 +39,22 @@ |
| 39 | 39 | |
| 40 | 40 | |
| 41 | 41 | /** |
| 42 | + * 更新课程 | |
| 43 | + * @param model | |
| 44 | + * @param request | |
| 45 | + * @return | |
| 46 | + */ | |
| 47 | + @RequestMapping(method = RequestMethod.POST, value = "/updateCourese") | |
| 48 | + @ResponseBody | |
| 49 | + @TokenRequired | |
| 50 | + public BaseResponse updateCourese(@RequestBody CourseRequest model, | |
| 51 | + HttpServletRequest request) { | |
| 52 | + | |
| 53 | + return courseFacade.updateCourese(model,getUserId(request)); | |
| 54 | + } | |
| 55 | + | |
| 56 | + | |
| 57 | + /** | |
| 42 | 58 | * 课程列表 |
| 43 | 59 | * @param request |
| 44 | 60 | * @return |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java
View file @
5db71ad
| ... | ... | @@ -13,7 +13,6 @@ |
| 13 | 13 | import com.lyms.platform.common.utils.DateUtil; |
| 14 | 14 | import com.lyms.platform.operate.web.request.CourseRequest; |
| 15 | 15 | import com.lyms.platform.operate.web.result.CourseResult; |
| 16 | -import com.lyms.platform.operate.web.result.PatientCourseResult; | |
| 17 | 16 | import com.lyms.platform.permission.model.Users; |
| 18 | 17 | import com.lyms.platform.permission.service.UsersService; |
| 19 | 18 | import com.lyms.platform.pojo.CourseModel; |
| ... | ... | @@ -68,7 +67,7 @@ |
| 68 | 67 | courseService.addCourse(model); |
| 69 | 68 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 70 | 69 | objectResponse.setErrormsg("成功"); |
| 71 | - return null; | |
| 70 | + return objectResponse; | |
| 72 | 71 | } |
| 73 | 72 | |
| 74 | 73 | private CourseModel getCoureseModel(CourseRequest request) |
| ... | ... | @@ -81,6 +80,10 @@ |
| 81 | 80 | model.setCourseDesc(request.getCourseDesc()); |
| 82 | 81 | model.setCourseTypeId(request.getCourseTypeId()); |
| 83 | 82 | model.setCourseTime(DateUtil.parseYMDHM(request.getCourseTime())); |
| 83 | + | |
| 84 | + Integer longTime = model.getTimeLong() == null ? 0 : model.getTimeLong()*60*1000; | |
| 85 | + | |
| 86 | + model.setCourseEndTime(new Date(DateUtil.parseYMDHM(request.getCourseTime()).getTime() + longTime)); | |
| 84 | 87 | model.setTimeLong(request.getTimeLong()); |
| 85 | 88 | model.setLimitNum(request.getLimitNum()); |
| 86 | 89 | model.setCourseSpeaker(request.getCourseSpeaker()); |
| ... | ... | @@ -247,6 +250,37 @@ |
| 247 | 250 | objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); |
| 248 | 251 | objectResponse.setErrormsg("成功"); |
| 249 | 252 | return objectResponse; |
| 253 | + } | |
| 254 | + | |
| 255 | + public BaseResponse updateCourese(CourseRequest request, Integer userId) { | |
| 256 | + BaseResponse objectResponse = new BaseResponse(); | |
| 257 | + CourseModel model = getCoureseModel(request); | |
| 258 | + model.setModified(new Date()); | |
| 259 | + courseService.updateCourse(model); | |
| 260 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 261 | + objectResponse.setErrormsg("成功"); | |
| 262 | + return objectResponse; | |
| 263 | + } | |
| 264 | + | |
| 265 | + | |
| 266 | + /** | |
| 267 | + * 处理结束的课程 | |
| 268 | + */ | |
| 269 | + public void handCoureseEnd() | |
| 270 | + { | |
| 271 | + CourseQuery query = new CourseQuery(); | |
| 272 | + query.setYn(YnEnums.YES.getId()); | |
| 273 | + query.setStatus(CourseStatusEnums.YFB.getId()); | |
| 274 | + query.setCourseEndTime(new Date()); | |
| 275 | + List<CourseModel> courseModels = courseService.queryCourseList(query); | |
| 276 | + if (CollectionUtils.isNotEmpty(courseModels)) | |
| 277 | + { | |
| 278 | + for (CourseModel model : courseModels) | |
| 279 | + { | |
| 280 | + model.setStatus(CourseStatusEnums.YJS.getId()); | |
| 281 | + courseService.updateCourse(model); | |
| 282 | + } | |
| 283 | + } | |
| 250 | 284 | } |
| 251 | 285 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/request/CourseRequest.java
View file @
5db71ad
| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | private String courseTime; |
| 21 | 21 | |
| 22 | 22 | //时长 |
| 23 | - private String timeLong; | |
| 23 | + private Integer timeLong; | |
| 24 | 24 | |
| 25 | 25 | //上线人数 |
| 26 | 26 | private Integer limitNum; |
| 27 | 27 | |
| ... | ... | @@ -75,11 +75,11 @@ |
| 75 | 75 | this.courseTime = courseTime; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - public String getTimeLong() { | |
| 78 | + public Integer getTimeLong() { | |
| 79 | 79 | return timeLong; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public void setTimeLong(String timeLong) { | |
| 82 | + public void setTimeLong(Integer timeLong) { | |
| 83 | 83 | this.timeLong = timeLong; |
| 84 | 84 | } |
| 85 | 85 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/result/CourseResult.java
View file @
5db71ad
| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | private String courseTime; |
| 21 | 21 | |
| 22 | 22 | //时长 |
| 23 | - private String timeLong; | |
| 23 | + private Integer timeLong; | |
| 24 | 24 | |
| 25 | 25 | //上线人数 |
| 26 | 26 | private Integer limitNum; |
| 27 | 27 | |
| ... | ... | @@ -88,11 +88,11 @@ |
| 88 | 88 | this.courseTime = courseTime; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | - public String getTimeLong() { | |
| 91 | + public Integer getTimeLong() { | |
| 92 | 92 | return timeLong; |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | - public void setTimeLong(String timeLong) { | |
| 95 | + public void setTimeLong(Integer timeLong) { | |
| 96 | 96 | this.timeLong = timeLong; |
| 97 | 97 | } |
| 98 | 98 |