Commit 1d7ba66e45e2f27b8a0a925d0a937017c6a5544b
1 parent
d2e80d623c
Exists in
master
and in
6 other branches
update
Showing 4 changed files with 71 additions and 6 deletions
- platform-common/src/main/java/com/lyms/platform/common/enums/CourseStatusEnums.java
- platform-dal/src/main/java/com/lyms/platform/pojo/CourseModel.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-common/src/main/java/com/lyms/platform/common/enums/CourseStatusEnums.java
View file @
1d7ba66
platform-dal/src/main/java/com/lyms/platform/pojo/CourseModel.java
View file @
1d7ba66
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/CourseController.java
View file @
1d7ba66
| ... | ... | @@ -4,6 +4,7 @@ |
| 4 | 4 | import com.lyms.platform.common.annotation.TokenRequired; |
| 5 | 5 | import com.lyms.platform.common.base.BaseController; |
| 6 | 6 | import com.lyms.platform.common.base.LoginContext; |
| 7 | +import com.lyms.platform.common.enums.CourseStatusEnums; | |
| 7 | 8 | import com.lyms.platform.common.result.BaseResponse; |
| 8 | 9 | import com.lyms.platform.operate.web.facade.CourseFacade; |
| 9 | 10 | import com.lyms.platform.operate.web.request.CourseRequest; |
| ... | ... | @@ -67,7 +68,7 @@ |
| 67 | 68 | public BaseResponse getCoureseList( |
| 68 | 69 | HttpServletRequest request) { |
| 69 | 70 | |
| 70 | - return courseFacade.getCoureseList(null, 2, null, null, | |
| 71 | + return courseFacade.getCoureseList(null, CourseStatusEnums.YFB.getId(), null, null, | |
| 71 | 72 | null, null, null, null, getUserId(request), null); |
| 72 | 73 | } |
| 73 | 74 | |
| ... | ... | @@ -160,6 +161,20 @@ |
| 160 | 161 | @TokenRequired |
| 161 | 162 | public BaseResponse publishCourese(HttpServletRequest request, @PathVariable(value = "id") String id) { |
| 162 | 163 | return courseFacade.publishCourese(id); |
| 164 | + } | |
| 165 | + | |
| 166 | + | |
| 167 | + /** | |
| 168 | + * 取消课程 | |
| 169 | + * @param request | |
| 170 | + * @param id | |
| 171 | + * @return | |
| 172 | + */ | |
| 173 | + @RequestMapping(method = RequestMethod.GET, value = "/cancelCourese/{id}") | |
| 174 | + @ResponseBody | |
| 175 | + @TokenRequired | |
| 176 | + public BaseResponse cancelCourese(HttpServletRequest request, @PathVariable(value = "id") String id) { | |
| 177 | + return courseFacade.cancelCourese(id); | |
| 163 | 178 | } |
| 164 | 179 | |
| 165 | 180 |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/facade/CourseFacade.java
View file @
1d7ba66
| ... | ... | @@ -11,6 +11,7 @@ |
| 11 | 11 | import com.lyms.platform.common.utils.*; |
| 12 | 12 | import com.lyms.platform.operate.web.request.CourseRequest; |
| 13 | 13 | import com.lyms.platform.operate.web.result.CourseResult; |
| 14 | +import com.lyms.platform.operate.web.result.PatientCourseResult; | |
| 14 | 15 | import com.lyms.platform.operate.web.utils.MessageCenterService; |
| 15 | 16 | import com.lyms.platform.operate.web.worker.CourseCountWorker; |
| 16 | 17 | import com.lyms.platform.permission.model.*; |
| ... | ... | @@ -289,6 +290,53 @@ |
| 289 | 290 | return objectResponse; |
| 290 | 291 | } |
| 291 | 292 | |
| 293 | + | |
| 294 | + /** | |
| 295 | + * 取消课程 | |
| 296 | + * @param id | |
| 297 | + * @return | |
| 298 | + */ | |
| 299 | + public BaseResponse cancelCourese(final String id) { | |
| 300 | + BaseResponse objectResponse = new BaseResponse(); | |
| 301 | + | |
| 302 | + if (StringUtils.isNotEmpty(id)) | |
| 303 | + { | |
| 304 | + CourseModel model = new CourseModel(); | |
| 305 | + model.setStatus(CourseStatusEnums.YQX.getId()); | |
| 306 | + model.setId(id); | |
| 307 | + model.setModified(new Date()); | |
| 308 | + model.setPublishTime(new Date()); | |
| 309 | + courseService.updateCourse(model); | |
| 310 | + | |
| 311 | + final CourseModel courseModel = courseService.getCourseById(id); | |
| 312 | + | |
| 313 | + new Thread(new Runnable(){ | |
| 314 | + @Override | |
| 315 | + public void run() { | |
| 316 | + | |
| 317 | + PatientCourseQuery patientCourseQuery = new PatientCourseQuery(); | |
| 318 | + patientCourseQuery.setYn(YnEnums.YES.getId()); | |
| 319 | + patientCourseQuery.setCourseId(id); | |
| 320 | + | |
| 321 | + List<PatientCourseModel> patientCourseModels = patientCourseService.queryPatientCourseList(patientCourseQuery); | |
| 322 | + if (CollectionUtils.isNotEmpty(patientCourseModels)) | |
| 323 | + { | |
| 324 | + for (PatientCourseModel model : patientCourseModels) | |
| 325 | + { | |
| 326 | + saveMsg(model.getHospitalId(),model.getPhone(),model.getPatientId(), | |
| 327 | + courseModel.getCourseName(),courseModel.getCourseSpeaker(),model.getId(),model.getCourseId(), | |
| 328 | + "您本次参加的孕妇学校课程已经取消,请注意安排时间。"); | |
| 329 | + } | |
| 330 | + } | |
| 331 | + } | |
| 332 | + }).start(); | |
| 333 | + } | |
| 334 | + | |
| 335 | + objectResponse.setErrorcode(ErrorCodeConstants.SUCCESS); | |
| 336 | + objectResponse.setErrormsg("成功"); | |
| 337 | + return objectResponse; | |
| 338 | + } | |
| 339 | + | |
| 292 | 340 | public BaseResponse getCoureseById(String id) { |
| 293 | 341 | CourseResult result = new CourseResult(); |
| 294 | 342 | CourseQuery query = new CourseQuery(); |
| 295 | 343 | |
| ... | ... | @@ -427,14 +475,16 @@ |
| 427 | 475 | |
| 428 | 476 | String courseName = CollectionUtils.isNotEmpty(courseModels1) ? courseModels1.get(0).getCourseName() : ""; |
| 429 | 477 | saveMsg(patientCourseModel.getHospitalId(),patientCourseModel.getPhone(),patientCourseModel.getPatientId(), |
| 430 | - courseName,speaker,patientCourseModel.getId(),patientCourseModel.getCourseId()); | |
| 478 | + courseName,speaker,patientCourseModel.getId(),patientCourseModel.getCourseId(), | |
| 479 | + "您本次参加的孕妇学校课程已经结束,请点击详情回顾课程内容并对本次课程评分。我们会根据您的评价结果相应做相应的评估的课程调整等。"); | |
| 431 | 480 | } |
| 432 | 481 | } |
| 433 | 482 | } |
| 434 | 483 | } |
| 435 | 484 | } |
| 436 | 485 | |
| 437 | - private void saveMsg(String hospitalId,String phone,String patientId,String courseName,String doctorName,String patientCourseId,String courseId) | |
| 486 | + private void saveMsg(String hospitalId,String phone,String patientId,String courseName,String doctorName,String patientCourseId,String courseId, | |
| 487 | + String msg) | |
| 438 | 488 | { |
| 439 | 489 | |
| 440 | 490 | OrganizationQuery orgQuery = new OrganizationQuery(); |
| ... | ... | @@ -454,7 +504,7 @@ |
| 454 | 504 | List<MsgRequest> messages = new ArrayList<>(); |
| 455 | 505 | MsgRequest mr = new MsgRequest(); |
| 456 | 506 | |
| 457 | - String content = "【" + messagePrefix + "】您本次参加的孕妇学校课程已经结束,请点击详情回顾课程内容并对本次课程评分。我们会根据您的评价结果相应做相应的评估的课程调整等。"; | |
| 507 | + String content = "【" + messagePrefix + "】"+msg; | |
| 458 | 508 | mr.setFirst(content); |
| 459 | 509 | mr.setObjType(ServiceObjEnums.YUNOBJ.getId()); |
| 460 | 510 | mr.setPhone(phone); |