package com.ssj.aijia.parents.controller; import com.alibaba.dubbo.config.annotation.Reference; import com.ssj.bean.sys.appinfo.bean.AppInfo; import com.ssj.framework.core.common.controller.BaseController; import com.ssj.framework.core.security.annotation.IgnoreSecurity; import com.ssj.framework.core.security.annotation.ModifySecurity; import com.ssj.framework.core.security.manager.TokenManager; import com.ssj.framework.core.util.ResponseConstant; import com.ssj.framework.core.util.ResponseEntity; import com.ssj.framework.core.util.StringUtil; import com.ssj.service.conch.common.service.ConchCommonService; import com.ssj.service.conch.conch.service.ConchDerverService; import com.ssj.service.conch.parents.dto.*; import com.ssj.service.conch.parents.request.*; import com.ssj.service.conch.parents.request.version4.*; import com.ssj.service.conch.parents.service.ParentService; import com.ssj.service.conch.schoolmaster.dto.CourseDateDataDto; import com.ssj.service.conch.schoolmaster.request.ConfirmAdjustSchoolHoursRequest; import com.ssj.service.conch.schoolmaster.request.TeacherCoursePlanDetailRequest; import com.ssj.service.conch.schoolmaster.service.SchoolService; import com.ssj.service.conch.zyb.request.ZuoybDayReq; import com.ssj.service.sys.situation.service.ILearningSituationMain; import com.ssj.service.sys.situation.service.LearningSituationService; import com.ssj.service.weixin.user.dto.AppWxUserInfo; import com.ssj.service.weixin.user.service.UserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort.Direction; import org.springframework.web.bind.annotation.*; import java.util.HashMap; import java.util.List; import java.util.Map; /** * @author ZhangCaibao * @version 2018年4月13日 下午5:52:07 * 类说明 */ @Api(value = "家长端相关的接口", tags = "家长端相关的接口") @RestController @RequestMapping("/api/parents/parents") public class ParentsController extends BaseController { @Reference(version = "1.0" ,timeout = 60000) private ParentService parentService; @Autowired private TokenManager tokenManager; @Reference(version = "1.0" ,timeout = 60000) private ConchDerverService conchDerverService; @Reference(version = "1.0" ,timeout = 60000) private ConchCommonService conchCommonService; @Reference(version = "1.0" ,timeout = 60000) private UserService userService; @Reference(version = "1.0" ,timeout = 60000) private SchoolService schoolService; @Reference(version = "1.0" ,timeout = 60000) private LearningSituationService learningSituationService; @ApiOperation(value = "家长端APP微信授权登录") @IgnoreSecurity @ModifySecurity @RequestMapping(value = "/appAuthlogin", method = RequestMethod.POST) public ResponseEntity appAuthlogin( @RequestBody (required=true) ParentAuthLoginReq param) { ResponseEntity responseEntity = null; try{ responseEntity = parentService.appAuthlogin(param); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @ApiOperation(value = "APP授权保存用户的基本信息") @RequestMapping(value = "/saveAppUserInfo", method = RequestMethod.POST) public ResponseEntity saveAppUserInfo(@RequestParam(name = "accessToken") String accessToken, @RequestBody (required=true) AppWxUserInfo info ) { ResponseEntity responseEntity = new ResponseEntity(); try { if(StringUtil.isEmpty(info.getUnionid())){ responseEntity.failure("用户unionid为空"); return responseEntity; } if(StringUtil.isEmpty(info.getOpenid())){ responseEntity.failure("用户openid为空"); return responseEntity; } if(StringUtil.isEmpty(info.getNickname())){ responseEntity.failure("用户普通用户昵称为空"); return responseEntity; } userService.saveAppUser(accessToken, info); responseEntity.success("保存成功"); } catch (Exception e) { responseEntity.failure(ResponseConstant.CODE_000, "服务器发生异常,请稍后重试"); } return responseEntity; } /** * 退出登录 * @param accessToken * @return */ @ApiOperation(value = "退出登录") @IgnoreSecurity @RequestMapping(value = "/logout", method = RequestMethod.POST) public ResponseEntity logout(@RequestParam(name = "accessToken") String accessToken) { tokenManager.removeToken(accessToken); return new ResponseEntity().success(); } /** *===============================首页=================================== */ @RequestMapping(value = "/childSmarttimeList", method = RequestMethod.POST) @ApiOperation(value = "孩子相册", httpMethod = "POST", notes = "孩子相册") public ResponseEntity childSmarttimeList(@RequestParam(name = "accessToken") String accessToken, @RequestBody ChildSmarttimeListReq req){ ResponseEntity responseEntity = new ResponseEntity(); try{ Map params = new HashMap(); params.put("vipId", req.getVipId()); Pageable pageable = initPage(req.getPageNo(), req.getPageSize()); Map result = parentService.childSmarttimeList(params, pageable); responseEntity.success(result, "成功"); } catch (Exception e){ responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @IgnoreSecurity @RequestMapping(value = "/getChildLocation", method = RequestMethod.POST) @ApiOperation(value = "获取孩子定位信息", httpMethod = "POST", notes = "获取孩子定位信息") public ResponseEntity getChildLocation(@RequestParam(name = "accessToken") String accessToken, @RequestBody VipReq req){ ResponseEntity responseEntity; try{ responseEntity = parentService.getChildLocation(req.getVipId()); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/getSayList", method = RequestMethod.POST) @ApiOperation(value = "爸妈说消息列表", httpMethod = "POST", notes = "爸妈说消息列表") public ResponseEntity getSayList(@RequestParam(name = "accessToken") String accessToken){ ResponseEntity responseEntity = new ResponseEntity(); try { String userId = tokenManager.getUserId(accessToken); Map data = new HashMap() ; List dataList = parentService.getSayList(userId); data.put("list", dataList); responseEntity.success(data,"成功"); } catch (Exception e) { responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/getMessageList", method = RequestMethod.POST) @ApiOperation(value = "获取消息列表", httpMethod = "POST", notes = "获取消息列表") public ResponseEntity getMessageList(@RequestParam(name = "accessToken") String accessToken,@RequestBody MessageReq req){ ResponseEntity responseEntity; try{ Pageable pageable = initPage(req.getPageNo(),req.getPageSize(),Direction.DESC,"created"); responseEntity = parentService.getMessageList(req, pageable); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/getPhotoList", method = RequestMethod.POST) @IgnoreSecurity @ApiOperation(value = "首页轮播图片", httpMethod = "POST", notes = "首页轮播图片") public ResponseEntity getPhotoList(@RequestBody PhotoReq req){ ResponseEntity responseEntity; try{ responseEntity = parentService.getPhotoList(req.getPhoneType()); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } /** *==============================作业模块================================== */ @RequestMapping(value = "/homeworkTask", method = RequestMethod.POST) @ApiOperation(value = "作业任务", httpMethod = "POST", notes = "作业任务") public ResponseEntity homeworkTask (@RequestParam(name = "accessToken") String accessToken, @RequestBody HomeworkTaskReq req){ ResponseEntity responseEntity = new ResponseEntity(); try{ Pageable pageable = initPage(req.getPageNo(), req.getPageSize()); Map data = parentService.getHistoryTask(req.getVipId(), req.getMaxCreateTime(), pageable); data.put("todayTask", parentService.searchTodayHomeworkTask(req.getVipId())); responseEntity.success(data, "成功"); } catch (Exception e){ logger.error("异常", e); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/correctDetail", method = RequestMethod.POST) @ApiOperation(value = "单科批改详情", httpMethod = "POST", notes = "单科批改详情") public ResponseEntity correctDetail (@RequestParam(name = "accessToken") String accessToken, @RequestBody CorrectDetailReq req){ ResponseEntity responseEntity = new ResponseEntity(); try{ Map data = parentService.correctDetail(req.getVipId(), req.getSubject(), req.getDate()); if ((Boolean)data.get("isSuccess")){ responseEntity.success(data.get("data"), "成功"); } else { responseEntity.failure(ResponseConstant.CODE_000, "失败"); } } catch (Exception e){ logger.error("异常", e); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/homeworkReport", method = RequestMethod.POST) @ApiOperation(value = "作业反馈报告", httpMethod = "POST", notes = "作业反馈报告") public ResponseEntity homeworkReport (@RequestParam(name = "accessToken") String accessToken, @RequestBody HomeworkReportReq req){ ResponseEntity responseEntity = new ResponseEntity(); try{ if (StringUtils.isNotBlank(req.getVipId()) && StringUtils.isNotBlank(req.getDate())) { Map data = parentService.findHomeworkReport(req.getVipId(), req.getDate()); responseEntity.success(data, "成功"); }else { logger.error("请求参数有误,vipId={}, date={}", req.getVipId(), req.getDate()); responseEntity.failure(ResponseConstant.CODE_000, "请求参数有误"); } } catch (Exception e){ logger.error("异常", e); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/queryAssessment", method = RequestMethod.POST) @ApiOperation(value = "查询课堂评价", httpMethod = "POST", notes = "查询课堂评价") public ResponseEntity queryAssessment (@RequestParam(name = "accessToken") String accessToken, @RequestBody QueryAssessmentReq req){ ResponseEntity responseEntity = new ResponseEntity(); try{ Map data = parentService.queryAssessment(req.getVipId(), req.getDate()); responseEntity.success(data, "成功"); } catch (Exception e){ logger.error("异常", e); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/assessment", method = RequestMethod.POST) @ApiOperation(value = "作业课堂评价提交", httpMethod = "POST", notes = "课堂评价") public ResponseEntity assessment (@RequestParam(name = "accessToken") String accessToken, @RequestBody AssessmentReq req){ ResponseEntity responseEntity = new ResponseEntity(); try{ parentService.submitAssessment(req); responseEntity.success(); } catch (Exception e){ logger.error("异常", e); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } /** *==============================学情模块================================== */ @RequestMapping(value = "/learningSituationAbstract", method = RequestMethod.POST) @ApiOperation(value = "学情整体情况", httpMethod = "POST", notes = "学情整体情况") public ResponseEntity learningSituationAbstract (@RequestParam(name = "accessToken") String accessToken, @RequestBody CorrectDetailReq req){ ResponseEntity responseEntity = new ResponseEntity(); try{ LearningSituationAbstractDto data = parentService.learningSituationAbstract(req.getVipId()); responseEntity.success(data, "成功"); } catch (Exception e){ responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/knowledgeAtlas", method = RequestMethod.POST) @ApiOperation(value = "知识图谱", httpMethod = "POST", notes = "知识图谱") public ResponseEntity knowledgeAtlas(@RequestParam(name = "accessToken") String accessToken, @RequestBody CourseHowReq req){ ResponseEntity responseEntity = null; try{ responseEntity = parentService.knowledgeAtlas(req); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/recent", method = RequestMethod.POST) @ApiOperation(value = "学习历史-当日学习任务日历", httpMethod = "POST", notes = "学习历史-当日学习任务日历") public ResponseEntity recent(@RequestParam(name = "accessToken") String accessToken, @RequestBody VipReq req){ ResponseEntity responseEntity = null; try{ responseEntity = parentService.recent(req.getVipId()); } catch (Exception e){ logger.error("7天任务异常", e); responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/calendarTrack", method = RequestMethod.POST) @ApiOperation(value = "学习历史-历史学习任务日历", httpMethod = "POST", notes = "学习历史-历史学习任务日历") public ResponseEntity calendarTrack(@RequestParam(name = "accessToken") String accessToken, @RequestBody ZuoybDayReq req){ ResponseEntity responseEntity = null; try{ responseEntity = parentService.calendarTrack(req); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/learningSituationDetail", method = RequestMethod.POST) @ApiOperation(value = "学情学科情况", httpMethod = "POST", notes = "学情学科情况") public ResponseEntity learningSituationDetail (@RequestParam(name = "accessToken") String accessToken, @RequestBody CorrectDetailReq req){ ResponseEntity responseEntity = new ResponseEntity(); try{ LearningSituationDetailDto data = learningSituationService.learningSituationDetail(req.getVipId(), req.getSubject()); responseEntity.success(data, "成功"); } catch (Exception e){ logger.error("异常", e); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } //------------------------------------------------------------------难题模块------------------------------------- @RequestMapping(value = "/unAnsweredProblemList", method = RequestMethod.POST) @ApiOperation(value = "未解答难题列表", httpMethod = "POST", notes = "未解答难题列表") public ResponseEntity unAnsweredProblemList(@RequestParam(name = "accessToken") String accessToken,@RequestBody UnAnsweredProblemReq req){ ResponseEntity responseEntity; try{ Pageable pageable = initPage(req.getPageNo(), req.getPageSize()); responseEntity = parentService.unAnsweredProblemList(req,pageable); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/answeredProblemKnowHow", method = RequestMethod.POST) @ApiOperation(value = "已解答难题知识点汇总", httpMethod = "POST", notes = "已解答难题知识点汇总") public ResponseEntity answeredProblemKnowHow(@RequestParam(name = "accessToken") String accessToken,@RequestBody ProblemKnowHowReq req){ ResponseEntity responseEntity; try{ responseEntity = parentService.answeredProblemKnowHow(req); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/answeredProblemList", method = RequestMethod.POST) @ApiOperation(value = "已解答难题列表", httpMethod = "POST", notes = "已解答难题列表") public ResponseEntity answeredProblemList(@RequestParam(name = "accessToken") String accessToken,@RequestBody AnsweredProblemReq req){ ResponseEntity responseEntity; try{ Pageable pageable = initPage(req.getPageNo(), req.getPageSize()); responseEntity = parentService.answeredProblemList(req,pageable); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/answeredProblemDetail", method = RequestMethod.POST) @ApiOperation(value = "已解答难题详情", httpMethod = "POST", notes = "已解答难题详情") public ResponseEntity answeredProblemDetail(@RequestParam(name = "accessToken") String accessToken,@RequestBody FindProblemRequest req){ ResponseEntity responseEntity; try{ responseEntity = parentService.answeredProblemDetail(req); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/calendarAnsweredProblem", method = RequestMethod.POST) @ApiOperation(value = "任务日历查询某天已解答难题列表", httpMethod = "POST", notes = "任务日历查询某天已解答难题列表") public ResponseEntity calendarAnsweredProblem(@RequestParam(name = "accessToken") String accessToken,@RequestBody AnswdProblemOnedayReq req){ ResponseEntity responseEntity; try{ responseEntity = parentService.calendarAnsweredProblem(req); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } //------------------------------------------------------------------一对一模块------------------------------------- @RequestMapping(value = "/lessonServiceManager", method = RequestMethod.POST) @ApiOperation(value = "一对一学习任务", httpMethod = "POST", notes = "一对一学习任务") public ResponseEntity lessonServiceManager(@RequestParam(name = "accessToken") String accessToken,@RequestBody VipReq req){ ResponseEntity responseEntity = null; try{ String userId = tokenManager.getUserId(accessToken); responseEntity = parentService.lessonServiceManager(userId,req.getVipId()); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/applyCourseTime", method = RequestMethod.POST) @ModifySecurity @ApiOperation(value = "申请调课", httpMethod = "POST", notes = "申请调课") public ResponseEntity applyCourseTime(@RequestParam(name = "accessToken") String accessToken,@RequestBody ApplyCourseTimeReq req){ ResponseEntity responseEntity = null; try{ responseEntity = parentService.applyCourseTime(req); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/applyChangeTeacher", method = RequestMethod.POST) @ModifySecurity @ApiOperation(value = "申请换老师", httpMethod = "POST", notes = "申请换老师") public ResponseEntity applyChangeTeacher(@RequestParam(name = "accessToken") String accessToken,@RequestBody ApplyTeacherReq req){ ResponseEntity responseEntity = null; try{ responseEntity = parentService.applyChangeTeacher(req); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/confirmTeacher", method = RequestMethod.POST) @ModifySecurity @ApiOperation(value = "校长换老师后-家长确认", httpMethod = "POST", notes = "校长换老师后-家长确认") public ResponseEntity confirmTeacher(@RequestParam(name = "accessToken") String accessToken,@RequestBody LessonReq req){ ResponseEntity responseEntity = new ResponseEntity(); try{ responseEntity = parentService.confirmTeacher(req.getLessonServiceId()); } catch (Exception e){ responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/teacherCoursePlanDetail", method = RequestMethod.POST) @ApiOperation(value = "获取当前老师排课状况", httpMethod = "POST", notes = "获取当前老师排课状况") public ResponseEntity teacherCoursePlanDetail(@RequestParam(name = "accessToken") String accessToken,@RequestBody TeacherCoursePlanDetailRequest req){ ResponseEntity responseEntity = new ResponseEntity(); try{ List> result = parentService.teacherCoursePlanDetail(req); Map data = new HashMap(); data.put("list", result); responseEntity.success(data, "成功"); } catch (Exception e){ logger.error("异常", e); } return responseEntity; } @RequestMapping(value = "/getStudentCourseData", method = RequestMethod.POST) @ApiOperation(value = "获取当前课程情况", httpMethod = "POST", notes = "获取当前课程情况") public ResponseEntity getStudentCourseData(@RequestParam(name = "accessToken") String accessToken, @RequestBody ConfirmAdjustSchoolHoursRequest request) { ResponseEntity responseEntity = new ResponseEntity(); try { List list = schoolService.findStudentCourseData(request.getBizId(), request.getTime()); Map data = new HashMap<>(); data.put("list", list); responseEntity.success(data, "成功"); } catch (Exception e) { logger.error("异常", e); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/getTeacherCourseTimeDetail", method = RequestMethod.POST) @ApiOperation(value = "获取当前老师排课状况V1", httpMethod = "POST", notes = "获取当前老师排课状况Vq") public ResponseEntity getTeacherCourseTimeDetail(@RequestParam(name = "accessToken") String accessToken, @RequestBody TeacherCoursePlanDetailRequest request) { ResponseEntity responseEntity = new ResponseEntity(); try { List> result = schoolService.getTeacherCourseTimeDetail(request); Map data = new HashMap(); data.put("list", result); responseEntity.success(data, "成功"); } catch (Exception e) { logger.error("异常信息", e); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/lessonFeedbackList", method = RequestMethod.POST) @ApiOperation(value = "往期反馈记录", httpMethod = "POST", notes = "往期反馈记录") public ResponseEntity lessonFeedbackList(@RequestParam(name = "accessToken") String accessToken,@RequestBody LessonReq req){ ResponseEntity responseEntity; try{ responseEntity = parentService.lessonFeedbackList(req); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/calendarLessonFeedback", method = RequestMethod.POST) @ApiOperation(value = "一对一任务日历反馈记录", httpMethod = "POST", notes = "一对一任务日历反馈记录") public ResponseEntity calendarLessonFeedback(@RequestParam(name = "accessToken") String accessToken,@RequestBody HomeworkReportReq req){ ResponseEntity responseEntity; try{ responseEntity = parentService.calendarLessonFeedback(req); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/lessonFeedbackDetails", method = RequestMethod.POST) @ApiOperation(value = "一对一反馈报告", httpMethod = "POST", notes = "一对一反馈报告") public ResponseEntity lessonFeedbackDetails(@RequestParam(name = "accessToken") String accessToken,@RequestBody CourseReq req){ ResponseEntity responseEntity; try{ responseEntity = parentService.lessonFeedbackDetails(req,accessToken); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/getCourseAssessment", method = RequestMethod.POST) @ApiOperation(value = "一对一反馈-查看课堂评价", httpMethod = "POST", notes = "一对一反馈-查看课堂评价") public ResponseEntity getCourseAssessment(@RequestParam(name = "accessToken") String accessToken,@RequestBody CourseReq req){ ResponseEntity responseEntity; try { responseEntity = parentService.getCourseAssessment(req); } catch (Exception e) { responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/superScholarLessonFeedbackDetails", method = RequestMethod.POST) @ApiOperation(value = "学霸一对一反馈报告", httpMethod = "POST", notes = "学霸一对一反馈报告") public ResponseEntity superScholarLessonFeedbackDetails(@RequestParam(name = "accessToken") String accessToken,@RequestBody CourseReq req){ ResponseEntity responseEntity = new ResponseEntity(); try { if (StringUtils.isNotBlank(req.getCourseId())){ SuperScholarFeedbackDto data = parentService.superScholar121Feedback(req.getCourseId()); responseEntity.success(data,"成功"); } else { responseEntity.failure(ResponseConstant.CODE_000, "请传输正确的课程编号"); } } catch (Exception e) { logger.error("学霸一对一反馈报告异常", e); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/upCourseAssessment", method = RequestMethod.POST) @ModifySecurity @ApiOperation(value = "一对一反馈-课堂评价", httpMethod = "POST", notes = "一对一反馈-课堂评价") public ResponseEntity upCourseAssessment(@RequestParam(name = "accessToken") String accessToken,@RequestBody CourseAssessmentReq req){ ResponseEntity responseEntity; try { responseEntity = parentService.upCourseAssessment(req); } catch (Exception e) { responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } //------------------------------------------------------------------我的信息------------------------------------- @RequestMapping(value = "/getMyInfo", method = RequestMethod.POST) @ApiOperation(value = "我的信息", httpMethod = "POST", notes = "我的信息") public ResponseEntity getMyInfo(@RequestParam(name = "accessToken") String accessToken){ ResponseEntity responseEntity = new ResponseEntity(); try{ String parentId = tokenManager.getUserId(accessToken); ParentsInfoDto result = parentService.getMyInfo(parentId); responseEntity.success(result,"成功"); } catch (Exception e){ responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/getMyChildInfo", method = RequestMethod.POST) @ApiOperation(value = "查询孩子信息", httpMethod = "POST", notes = "查询孩子信息") public ResponseEntity getMyChildInfo(@RequestParam(name = "accessToken") String accessToken,@RequestBody VipReq req){ ResponseEntity responseEntity = new ResponseEntity(); try{ String userId = tokenManager.getUserId(accessToken); ChildDto result = parentService.getMyChildInfo(userId,req.getVipId()); responseEntity.success(result,"成功"); } catch (Exception e){ responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/upMyChildInfo", method = RequestMethod.POST) @ApiOperation(value = "修改孩子信息", httpMethod = "POST", notes = "修改孩子信息") public ResponseEntity upMyChildInfo(@RequestParam(name = "accessToken") String accessToken,@RequestBody ChildInfoReq req){ ResponseEntity responseEntity = new ResponseEntity(); try{ parentService.upMyChildInfo(req); responseEntity.success(); } catch (Exception e){ responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/getSchoolList", method = RequestMethod.POST) @ApiOperation(value = "获取学校列表", httpMethod = "POST", notes = "获取学校列表") public ResponseEntity getSchoolList(@RequestParam(name = "accessToken") String accessToken,@RequestBody QuerySchoolList req){ ResponseEntity responseEntity = new ResponseEntity(); try { Map params = new HashMap(); List> list = parentService.getSchoolList(req); params.put("list", list); responseEntity.success(params,"获取数据成功!"); } catch (Exception e) { responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/myOrdersInfo", method = RequestMethod.POST) @ApiOperation(value = "我的订单", httpMethod = "POST", notes = "我的订单") public ResponseEntity myOrdersInfo(@RequestParam(name = "accessToken") String accessToken,@RequestBody OrderReq req){ ResponseEntity responseEntity = null; try{ String userId = tokenManager.getUserId(accessToken); responseEntity = parentService.myOrdersInfo(userId,req); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/payOrder", method = RequestMethod.POST) @ModifySecurity @ApiOperation(value = "我的订单-支付", httpMethod = "POST", notes = "我的订单-支付") public ResponseEntity payOrder(@RequestParam(name = "accessToken") String accessToken,@RequestBody PayOrderReq req){ return parentService.payOrder(req,accessToken); } @RequestMapping(value = "/applyOrderRefund", method = RequestMethod.POST) @ApiOperation(value = "我的订单-发起退款", httpMethod = "POST", notes = "我的订单-发起退款") public ResponseEntity applyOrderRefund(@RequestParam(name = "accessToken") String accessToken,@RequestBody RefundReq req){ ResponseEntity responseEntity = null; try{ String userId = tokenManager.getUserId(accessToken); responseEntity = parentService.applyOrderRefund(userId, req.getOrderNo()); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/confirmOrderRefund", method = RequestMethod.POST) @ModifySecurity @ApiOperation(value = "我的订单-确定退款", httpMethod = "POST", notes = "我的订单-确定退款") public ResponseEntity confirmOrderRefund(@RequestParam(name = "accessToken") String accessToken,@RequestBody ConfirmRefundReq req){ ResponseEntity responseEntity = null; try{ String userId = tokenManager.getUserId(accessToken); responseEntity = parentService.confirmOrderRefund(userId, req); } catch (Exception e){ responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/untieDerver", method = RequestMethod.POST) @ModifySecurity @ApiOperation(value = "解绑小塾", httpMethod = "POST", notes = "解绑小塾") public ResponseEntity untieDerver(@RequestParam(name = "accessToken") String accessToken,@RequestBody UntieDerverReq req){ ResponseEntity responseEntity = null; try { responseEntity = conchDerverService.untyingParents(req.getDerver(), tokenManager.getUserId(accessToken)); } catch (Exception e) { responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @ApiOperation(value = "解绑小塾内部专用",httpMethod = "POST") @IgnoreSecurity @ModifySecurity @RequestMapping(value = "/untieDerverByCeshi", method = RequestMethod.POST) public ResponseEntity untieDerverByCeshi(@RequestParam(name = "parentId") String parentId, @RequestParam(name = "derver") String derver) { ResponseEntity responseEntity = new ResponseEntity(); try { responseEntity =conchDerverService.untyingParents(derver, parentId); responseEntity.success(); } catch (Exception e) { logger.error("解绑小塾异常", e); responseEntity.failure(ResponseConstant.CODE_500, "解绑小塾异常"); } return responseEntity; } @RequestMapping(value = "/swipeQrCode", method = RequestMethod.POST) @ModifySecurity @ApiOperation(value = "app扫描二维码通用接口", httpMethod = "POST", notes = "app扫描二维码通用接口") public ResponseEntity swipeQrCode(@RequestParam(name = "accessToken") String accessToken,@RequestBody SwipeQrCodeReq req){ ResponseEntity responseEntity = null; try { String userId = tokenManager.getUserId(accessToken); responseEntity = conchCommonService.swipeQrCode(userId,req); } catch (Exception e) { responseEntity = new ResponseEntity(); responseEntity.failure(ResponseConstant.CODE_500, "服务器发生异常,请稍后重试"); } return responseEntity; } @RequestMapping(value = "/version", method = RequestMethod.POST) @IgnoreSecurity @ApiOperation(value = "获取当前版本", httpMethod = "POST", notes = "获取当前版本") public ResponseEntity version() { ResponseEntity responseEntity = new ResponseEntity(); try { AppInfo appInfo = parentService.getVersion(2); Map map = new HashMap<>(16); if(appInfo != null){ map.put("id",appInfo.getId()); map.put("version",appInfo.getVersion()); map.put("fileKey",appInfo.getFileKey()); map.put("versionType",appInfo.getVersionType()); map.put("issueNum",appInfo.getIssueNum()); map.put("createTime",appInfo.getCreateTime()); map.put("isDelete",appInfo.getIsDelete()); map.put("needUpdate",appInfo.getNeedUpdate()); } responseEntity.success(map, "成功"); } catch (Exception e) { logger.error("获取当前版本异常", e); responseEntity.failure(ResponseConstant.CODE_500, e.getMessage()); } logger.info("version end"); return responseEntity; } @RequestMapping(value = "/setPushRemind", method = RequestMethod.POST) @ApiOperation(value = "设置推送消息提醒接口", httpMethod = "POST", notes = "设置推送消息提醒接口") public ResponseEntity setPushRemind(@RequestParam(name = "accessToken") String accessToken,@RequestBody PushRemindReq req) { ResponseEntity responseEntity = new ResponseEntity(); try { String userId = tokenManager.getUserId(accessToken); parentService.setPushRemind(userId,req); responseEntity.success(); } catch (Exception e) { logger.error("设置推送消息提醒接口异常", e); responseEntity.failure(ResponseConstant.CODE_500, e.getMessage()); } return responseEntity; } @RequestMapping(value = "/sendSms", method = RequestMethod.POST) @IgnoreSecurity @ApiOperation(value = "发送短信验证码", httpMethod = "POST", notes = "发送短信验证码") public ResponseEntity sendSms(@RequestBody SmsSendReq req) { ResponseEntity responseEntity = new ResponseEntity(); try { parentService.sendSms(req.getPhoneNumber(), req.getType()); responseEntity.success(); } catch (Exception e) { logger.error("发送短信验证码接口异常", e); responseEntity.failure(ResponseConstant.CODE_500, e.getMessage()); } return responseEntity; } @RequestMapping(value = "/confirmSms", method = RequestMethod.POST) @IgnoreSecurity @ApiOperation(value = "验证短信验证码", httpMethod = "POST", notes = "验证短信验证码") public ResponseEntity confirmSms(@RequestBody SmsConfirmReq req) { ResponseEntity responseEntity; try { responseEntity = parentService.confirmSms(req.getPhoneNumber(), req.getCode()); if (responseEntity.getCode().equals("999")) { //清除验证码 tokenManager.delString(req.getPhoneNumber()); } return responseEntity; } catch (Exception e) { responseEntity = new ResponseEntity(); logger.error("发送短信验证码接口异常", e); responseEntity.failure(ResponseConstant.CODE_500, e.getMessage()); } return responseEntity; } @Reference(version = "1.0" ,timeout = 60000) private ILearningSituationMain learningSituationMain; @RequestMapping(value = "/learningSituation", method = RequestMethod.POST) @IgnoreSecurity @ApiOperation(value = "学情手动计算", httpMethod = "POST", notes = "学情手动计算") public ResponseEntity learningSituation(@RequestBody SmsConfirmReq req) { ResponseEntity responseEntity = new ResponseEntity(); try { learningSituationMain.querySituation(); responseEntity.success(); } catch (Exception e) { logger.error("学情手动计算", e); responseEntity.failure(ResponseConstant.CODE_500, e.getMessage()); } return responseEntity; } }