|
|
@@ -1,972 +0,0 @@
|
|
|
-package com.ssj.aijia.student.controller;
|
|
|
-
|
|
|
-import com.alibaba.dubbo.config.annotation.Reference;
|
|
|
-import com.ssj.bean.sys.homework.domain.HomeworkPicture;
|
|
|
-import com.ssj.bean.weixin.libmy.domain.LibVip;
|
|
|
-import com.ssj.framework.basic.utils.DateHelper;
|
|
|
-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.PropertiesUtil;
|
|
|
-import com.ssj.framework.core.util.ResponseConstant;
|
|
|
-import com.ssj.framework.core.util.ResponseEntity;
|
|
|
-import com.ssj.framework.weixin.util.DateUtil;
|
|
|
-import com.ssj.service.conch.common.service.ConchCommonService;
|
|
|
-import com.ssj.service.conch.conch.request.DeleteHomeworkRequest;
|
|
|
-import com.ssj.service.conch.conch.service.ConchDerverService;
|
|
|
-import com.ssj.service.conch.conch.service.IntegralDetailService;
|
|
|
-import com.ssj.service.conch.parents.dto.CorrectDetailDto;
|
|
|
-import com.ssj.service.conch.parents.dto.CorrectDetailDto2;
|
|
|
-import com.ssj.service.conch.parents.request.ShareReq;
|
|
|
-import com.ssj.service.conch.parents.request.version4.ChildSmarttimeListReq;
|
|
|
-import com.ssj.service.conch.parents.request.version4.HomeworkTaskReq;
|
|
|
-import com.ssj.service.conch.parents.v2.service.ParentV2Service;
|
|
|
-import com.ssj.service.conch.student.dto.*;
|
|
|
-import com.ssj.service.conch.student.request.*;
|
|
|
-import com.ssj.service.conch.student.service.StudentService;
|
|
|
-import com.ssj.service.conch.teacher.request.oneonly.RephotoReq;
|
|
|
-import com.ssj.service.sys.homework.service.HomeworkPictureService;
|
|
|
-import com.ssj.service.sys.schoolmatecircle.service.SSJUserFriendApplyService;
|
|
|
-import com.ssj.service.sys.schoolmatecircle.service.SSJUserFriendService;
|
|
|
-import com.ssj.service.sys.schoolmatecircle.service.SchoolmateMessageService;
|
|
|
-import com.ssj.service.weixin.library.service.ILibVipService;
|
|
|
-import com.ssj.service.weixin.sales.service.LibVipServiceService;
|
|
|
-import com.ssj.service.weixin.user.request.LoginTypeParam;
|
|
|
-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.text.ParseException;
|
|
|
-import java.text.SimpleDateFormat;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-
|
|
|
-@Api(value = "学生端相关的接口", tags = "学生端相关的接口")
|
|
|
-@RestController
|
|
|
-@RequestMapping("/api/student/student")
|
|
|
-public class StudentController extends BaseController {
|
|
|
-
|
|
|
- @Autowired
|
|
|
- private TokenManager tokenManager;
|
|
|
-
|
|
|
- @Reference(version = "1.0" ,timeout = 60000)
|
|
|
- private StudentService studentService;
|
|
|
-
|
|
|
- @Reference(version = "1.0" ,timeout = 60000)
|
|
|
- private ConchCommonService conchCommonService;
|
|
|
-
|
|
|
- @Reference(version = "1.0" ,timeout = 60000)
|
|
|
- private ParentV2Service parentV2Service;
|
|
|
-
|
|
|
-
|
|
|
- @Reference(version = "1.0" ,timeout = 60000)
|
|
|
- private SSJUserFriendService userFriendService;
|
|
|
-
|
|
|
- @Reference(version = "1.0" ,timeout = 60000)
|
|
|
- private SSJUserFriendApplyService userFriendApplyService;
|
|
|
- @Reference(version = "1.0" ,timeout = 60000)
|
|
|
- private SchoolmateMessageService schoolmateMessageService;
|
|
|
- @Reference(version = "1.0" ,timeout = 60000)
|
|
|
- private HomeworkPictureService homeworkPictureService;
|
|
|
- @Reference(version = "1.0" ,timeout = 60000)
|
|
|
- private ConchDerverService conchDerverService;
|
|
|
- @Reference(version = "1.0" ,timeout = 60000)
|
|
|
- private LibVipServiceService libVipServiceService;
|
|
|
- @Reference(version = "1.0" ,timeout = 60000)
|
|
|
- private IntegralDetailService integralDetailService;
|
|
|
- @Reference(version = "1.0" ,timeout = 60000)
|
|
|
- private ILibVipService vipService;
|
|
|
-
|
|
|
- @RequestMapping(value = "/homepageInfo", method = RequestMethod.POST)
|
|
|
- @IgnoreSecurity
|
|
|
- @ApiOperation(value = "首页", httpMethod = "POST", response = ResponseEntity.class, notes = "首页")
|
|
|
- public ResponseEntity homepageInfo(@RequestParam(name = "accessToken") String accessToken, @RequestBody IndexReq req) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
-
|
|
|
- String vipId = req.getVipId();
|
|
|
- if (StringUtils.isBlank(vipId)) {
|
|
|
- return responseEntity.failure("学生id不能为空");
|
|
|
- }
|
|
|
-
|
|
|
- try {
|
|
|
- Map<String, Object> resultMap = new HashMap<>();
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- long count = schoolmateMessageService.countByUserId(userId);
|
|
|
- Integer blurredPictureSum = homeworkPictureService.countByVipIdAndIsMark(vipId);
|
|
|
- resultMap.put("count", count);//同学圈消息数量
|
|
|
- if (blurredPictureSum > 0) {//存在模糊作业图片
|
|
|
- resultMap.put("isVague", 1);
|
|
|
- } else {
|
|
|
- resultMap.put("isVague", 0);
|
|
|
- }
|
|
|
- /** 加入作业吧服务结束日期 by duyy on 2019-04-12*/
|
|
|
- String zybEndDate = libVipServiceService.selectZybEndTimeByVipId(vipId);
|
|
|
- resultMap.put("zybEndDate", zybEndDate == null ? "" : zybEndDate);
|
|
|
- resultMap.put("whetherSignIn",integralDetailService.findTodaySignData(vipId));
|
|
|
- LibVip vip = vipService.getById(vipId);
|
|
|
- resultMap.put("isBind",vip==null?2:StringUtils.isEmpty(vip.getLibId())?2:1);
|
|
|
- responseEntity.success(resultMap, "查询成功");
|
|
|
- return responseEntity;
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("学生pad端:", e);
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * ========================================我的==========================================
|
|
|
- */
|
|
|
- @RequestMapping(value = "/swipeQrCode", method = RequestMethod.POST)
|
|
|
- @IgnoreSecurity
|
|
|
- @ApiOperation(value = "扫二维码通用接口", httpMethod = "POST", response = ResponseEntity.class, notes = "扫二维码通用接口")
|
|
|
- public ResponseEntity swipeQrCode(@RequestBody SwipeQrCodeRequest request) {
|
|
|
- ResponseEntity responseEntity = null;
|
|
|
- try {
|
|
|
- responseEntity = conchCommonService.swipeQrCode(request);
|
|
|
- } catch (Exception e) {
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/changeAccount", method = RequestMethod.POST)
|
|
|
- @IgnoreSecurity
|
|
|
- @ModifySecurity
|
|
|
- @ApiOperation(value = "切换账号", httpMethod = "POST", response = ResponseEntity.class, notes = "切换账号")
|
|
|
- public ResponseEntity changeAccount(@RequestParam(name = "accessToken") String accessToken, @RequestBody StudentVipReq request) {
|
|
|
- ResponseEntity responseEntity = null;
|
|
|
- try {
|
|
|
- responseEntity = studentService.changeAccount(accessToken,request.getVipId(),request.getPlatform(),request.getXingeToken());
|
|
|
- } catch (Exception e) {
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/getMyInfo", method = RequestMethod.POST)
|
|
|
- @IgnoreSecurity
|
|
|
- @ApiOperation(value = "获取我的信息", httpMethod = "POST", response = ResponseEntity.class, notes = "切换账号")
|
|
|
- public ResponseEntity getMyInfo(@RequestParam(name = "accessToken") String accessToken) {
|
|
|
- ResponseEntity responseEntity = null;
|
|
|
- try {
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- responseEntity = studentService.getMyInfo(userId);
|
|
|
- } catch (Exception e) {
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * ========================================同学圈==========================================
|
|
|
- */
|
|
|
- @RequestMapping(value = "/schoolmateCircleList", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "查询分享/答题榜列表", httpMethod = "POST", notes = "查询分享/答题榜列表")
|
|
|
- public ResponseEntity schoolmateCircleList(@RequestParam(name = "accessToken") String accessToken, @RequestBody SchoolmateCircleReq req){
|
|
|
- ResponseEntity responseEntity;
|
|
|
- logger.info("accessToken:"+accessToken+"*****查询同学圈列表入参:"+req.toString());
|
|
|
- try{
|
|
|
- Map<String, Object> params = new HashMap<>(16);
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- params.put("userId", userId);
|
|
|
- params.put("type",req.getType());
|
|
|
- params.put("authority",req.getAuthority());
|
|
|
- params.put("maxCreateTime",req.getMaxCreateTime());
|
|
|
- Pageable pageable = initPage(req.getPageNo(), req.getPageSize());
|
|
|
- responseEntity = studentService.schoolmateCircleList(params, pageable);
|
|
|
- } catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/setLike", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "点赞", httpMethod = "POST", notes = "点赞")
|
|
|
- public ResponseEntity setLike(@RequestParam(name = "accessToken") String accessToken, @RequestBody SetLikeReq req){
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- logger.info("accessToken:"+accessToken+"*****点赞入参:"+req.toString());
|
|
|
- try{
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- /** 该功能需验证是否有购买作业吧服务 by duyy on 2019-04-12*/
|
|
|
- if(!libVipServiceService.checkZybExistOrExpiredByChildUserId(userId)) {
|
|
|
- responseEntity.failure("您还不是作业吧会员,不可进行此操作");
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
- responseEntity = studentService.setLike(req.getHeadId(),req.getType(),userId);
|
|
|
- } catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/firstLevelCommentsList", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "查询一级评论(答题榜)", httpMethod = "POST", notes = "查询一级评论")
|
|
|
- public ResponseEntity firstLevelCommentsList(@RequestParam(name = "accessToken") String accessToken, @RequestBody FirstLevelCommentsReq req){
|
|
|
- ResponseEntity responseEntity;
|
|
|
- logger.info("accessToken:"+accessToken+"*****查询一级评论(答题榜):"+req.toString());
|
|
|
- try{
|
|
|
- Map<String, Object> params = new HashMap<>(16);
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- params.put("userId",userId);
|
|
|
- params.put("schoolmateCircleId",req.getSchoolmateCircleId());
|
|
|
- params.put("maxCreateTime",req.getMaxCreateTime());
|
|
|
- Pageable pageable = initPage(req.getPageNo(), req.getPageSize());
|
|
|
- responseEntity = studentService.firstLevelCommentsList(params,pageable);
|
|
|
- } catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/secondLevelCommentsList", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "查询一级评论下二级评论(答题榜)", httpMethod = "POST", notes = "查询一级评论下二级评论")
|
|
|
- public ResponseEntity secondLevelCommentsList(@RequestParam(name = "accessToken") String accessToken, @RequestBody SecondLevelCommentsReq req){
|
|
|
- ResponseEntity responseEntity;
|
|
|
- logger.info("accessToken:"+accessToken+"*****查询一级评论下二级评论(答题榜):"+req.toString());
|
|
|
- try{
|
|
|
- Map<String, Object> params = new HashMap<>(16);
|
|
|
- Pageable pageable = initPage(req.getPageNo(), req.getPageSize());
|
|
|
- params.put("commentId",req.getCommentId());
|
|
|
- params.put("maxCreateTime",req.getMaxCreateTime());
|
|
|
- responseEntity = studentService.secondLevelCommentsList(params,pageable);
|
|
|
- } catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/findCommentsList", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "查询评论(分享)", httpMethod = "POST", notes = "查询评论(分享)")
|
|
|
- public ResponseEntity findCommentsList(@RequestParam(name = "accessToken") String accessToken, @RequestBody FirstLevelCommentsReq req){
|
|
|
- ResponseEntity responseEntity;
|
|
|
- logger.info("accessToken:"+accessToken+"*****查询评论(分享):"+req.toString());
|
|
|
- try{
|
|
|
- Map<String, Object> params = new HashMap<>(16);
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- params.put("userId",userId);
|
|
|
- Pageable pageable = initPage(req.getPageNo(), req.getPageSize());
|
|
|
- params.put("schoolmateCircleId",req.getSchoolmateCircleId());
|
|
|
- params.put("maxCreateTime",req.getMaxCreateTime());
|
|
|
- responseEntity = studentService.findCommentsList(params,pageable);
|
|
|
- } catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/queryShortcuts", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "查询快捷回复内容", httpMethod = "POST", notes = "查询快捷回复内容")
|
|
|
- public ResponseEntity queryShortcuts(@RequestParam(name = "accessToken") String accessToken){
|
|
|
- ResponseEntity responseEntity;
|
|
|
- try{
|
|
|
- responseEntity = studentService.queryShortcuts();
|
|
|
- } catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/replySchoolmateCircle", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "回复同学圈评论", httpMethod = "POST", notes = "回复同学圈评论")
|
|
|
- public ResponseEntity replySchoolmateCircle(@RequestParam(name = "accessToken") String accessToken, @RequestBody ReplySchoolmateCircleReq req){
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- logger.info("accessToken:"+accessToken+"*****回复同学圈评论:"+req.toString());
|
|
|
- try{
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- /** 该功能需验证是否有购买作业吧服务 by duyy on 2019-04-12*/
|
|
|
- if(!libVipServiceService.checkZybExistOrExpiredByChildUserId(userId)) {
|
|
|
- responseEntity.failure("您还不是作业吧会员,不可进行此操作");
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
- responseEntity = studentService.replySchoolmateCircle(req.getSchoolmateCircleId(),req.getContent(),userId,req.getMaterial());
|
|
|
- } catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/replyComments", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "回复答题榜下评论人评论下其他评论人评论", httpMethod = "POST", notes = "回复答题榜下评论人评论下其他评论人评论")
|
|
|
- public ResponseEntity replyComments(@RequestParam(name = "accessToken") String accessToken, @RequestBody ReplyCommentsReq req){
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- logger.info("accessToken:"+accessToken+"*****回复答题榜下评论人评论下其他评论人评论:"+req.toString());
|
|
|
- try{
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- /** 该功能需验证是否有购买作业吧服务 by duyy on 2019-04-12*/
|
|
|
- if(!libVipServiceService.checkZybExistOrExpiredByChildUserId(userId)) {
|
|
|
- responseEntity.failure("您还不是作业吧会员,不可进行此操作");
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
- responseEntity = studentService.replyComments(userId,req.getContent(),req.getCommentId(),req.getBeCommentedUserId(),req.getType());
|
|
|
- } catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/sendSchoolmateCircle", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "发同学圈", httpMethod = "POST", notes = "发同学圈")
|
|
|
- public ResponseEntity sendSchoolmateCircle(@RequestParam(name = "accessToken") String accessToken, @RequestBody SendSchoolmateCircleReq req){
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- logger.info("accessToken:"+accessToken+"*****发同学圈:"+req.toString());
|
|
|
- try{
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- /** 该功能需验证是否有购买作业吧服务 by duyy on 2019-04-12*/
|
|
|
- if(!libVipServiceService.checkZybExistOrExpiredByChildUserId(userId)) {
|
|
|
- responseEntity.failure("您还不是作业吧会员,不可进行此操作");
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
- responseEntity = studentService.sendSchoolmateCircle(req.getType(),userId,req.getContent(),req.getMaterial());
|
|
|
- } catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/queryCircleMessageCount", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "查询同学圈消息总数", httpMethod = "POST", response = ResponseEntity.class, notes = "查询同学圈消息总数")
|
|
|
- public ResponseEntity queryCircleMessageCount(@RequestParam(name = "accessToken") String accessToken) {
|
|
|
- ResponseEntity responseEntity;
|
|
|
- try {
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- responseEntity = studentService.queryCircleMessageCount(userId);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/circleMessageList", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "同学圈消息列表", httpMethod = "POST", response = ResponseEntity.class, notes = "同学圈消息列表")
|
|
|
- public ResponseEntity circleMessageList(@RequestParam(name = "accessToken") String accessToken) {
|
|
|
- ResponseEntity responseEntity;
|
|
|
- try {
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- responseEntity = studentService.circleMessageList(userId);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/acceptSolution", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "采纳解答", httpMethod = "POST", response = ResponseEntity.class, notes = "采纳解答")
|
|
|
- public ResponseEntity acceptSolution(@RequestParam(name = "accessToken") String accessToken,
|
|
|
- @RequestBody AcceptSolutionRequest req) {
|
|
|
- ResponseEntity responseEntity;
|
|
|
- logger.info("accessToken:"+accessToken+"*****采纳解答:"+req.toString());
|
|
|
- try {
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- responseEntity = studentService.acceptSolution(req.getCommentId(), userId);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/schoolmateCircleDetail", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "查询分享/答题榜详情", httpMethod = "POST", notes = "查询分享/答题榜详情")
|
|
|
- public ResponseEntity schoolmateCircleDetail(@RequestParam(name = "accessToken") String accessToken, @RequestBody SchoolmateDetailReq req){
|
|
|
- ResponseEntity responseEntity;
|
|
|
- logger.info("accessToken:"+accessToken+"*****查询分享/答题榜详情:"+req.toString());
|
|
|
- try{
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- Pageable pageable = initPage(req.getPageNo(), req.getPageSize());
|
|
|
- responseEntity = studentService.schoolmateCircleDetail(req.getId(), userId, pageable);
|
|
|
- } catch (Exception e){
|
|
|
- e.printStackTrace();
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
- /**
|
|
|
- * ========================================排行榜==========================================
|
|
|
- */
|
|
|
- @RequestMapping(value = "/rankingList", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "查询排行榜", httpMethod = "POST", response = ResponseEntity.class, notes = "查询排行榜")
|
|
|
- public ResponseEntity rankingList(@RequestParam(name = "accessToken") String accessToken, @RequestBody RankingListRequest request) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try {
|
|
|
- List<CircleCommentRankDto> list = studentService.rankingList(request.getType(), request.getTime());
|
|
|
- Map<String, Object> 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 = "/wrongTopicBook", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "查询错题本列表", httpMethod = "POST", response = ResponseEntity.class, notes = "查询错题本列表")
|
|
|
- public ResponseEntity wrongTopicBook(@RequestParam(name = "accessToken") String accessToken, @RequestBody WrongTopicBookRequest request) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try {
|
|
|
- Pageable pageable = initPage(request.getPageNo(), request.getPageSize());
|
|
|
- String maxCreateTime = request.getMaxCreateTime();
|
|
|
- Map<String, Object> data = studentService.wrongTopicBook(request.getVipId(), request.getSubject(),
|
|
|
- maxCreateTime == null ? DateUtil.format_yyyyMMddHHmmss(new Date()) : maxCreateTime, request.getType(), pageable);
|
|
|
- responseEntity.success(data,"成功");
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("查询错题本列表", e);
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "查询错题本列表");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/wrongTopicDetail", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "查询错题详情", httpMethod = "POST", response = ResponseEntity.class, notes = "查询错题详情")
|
|
|
- public ResponseEntity wrongTopicDetail(@RequestParam(name = "accessToken") String accessToken, @RequestBody HomeworkRequest request) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try {
|
|
|
- WrongTopicDetailDto data = studentService.wrongTopicDetail(request.getWorkId());
|
|
|
- responseEntity.success(data,"成功");
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("查询错题详情", e);
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "查询错题详情");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/correctWrongTopic", method = RequestMethod.POST)
|
|
|
- @ModifySecurity
|
|
|
- @ApiOperation(value = "订正错题", httpMethod = "POST", response = ResponseEntity.class, notes = "订正错题")
|
|
|
- public ResponseEntity correctWrongTopic(@RequestParam(name = "accessToken") String accessToken, @RequestBody CorrectWrongTopicRequest request) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try {
|
|
|
- boolean data = studentService.reviseWrongTopic(request);
|
|
|
- if (data) {
|
|
|
- responseEntity.success("成功");
|
|
|
- } else {
|
|
|
- responseEntity.failure("订正失败");
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("订正错题", e);
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "订正错题");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- /**
|
|
|
- * ========================================难题==========================================
|
|
|
- */
|
|
|
- @RequestMapping(value = "/problemList", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "难题列表", httpMethod = "POST", response = ResponseEntity.class, notes = "难题列表")
|
|
|
- public ResponseEntity problemList(@RequestParam(name = "accessToken") String accessToken, @RequestBody ProblemReq req) {
|
|
|
- ResponseEntity responseEntity;
|
|
|
- try{
|
|
|
- Pageable pageable = initPage(req.getPageNo(), req.getPageSize());
|
|
|
- responseEntity = studentService.problemList(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", response = ResponseEntity.class, notes = "已解答难题详情")
|
|
|
- public ResponseEntity answeredProblemDetail(@RequestParam(name = "accessToken") String accessToken, @RequestBody ProblemIdRequest req) {
|
|
|
- ResponseEntity responseEntity;
|
|
|
- try{
|
|
|
- responseEntity = studentService.answeredProblemDetail(req);
|
|
|
- } catch (Exception e){
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
- /**
|
|
|
- * ========================================作业==========================================
|
|
|
- */
|
|
|
- @RequestMapping(value = "/homeworkTask", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "作业任务", httpMethod = "POST", response = ResponseEntity.class, notes = "作业任务")
|
|
|
- public ResponseEntity homeworkTask(@RequestParam(name = "accessToken") String accessToken, @RequestBody HomeworkTaskReq request) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try {
|
|
|
- Pageable pageable = initPage(request.getPageNo(), request.getPageSize());
|
|
|
- Map<String, Object> data = studentService.homeworkTask(request.getVipId(), request.getMaxCreateTime(), pageable);
|
|
|
- responseEntity.success(data,"成功");
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("学生端-作业任务", e);
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "作业任务");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/homeworkTaskDetail", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "作业任务详情", httpMethod = "POST", response = ResponseEntity.class, notes = "作业任务详情")
|
|
|
- public ResponseEntity homeworkTaskDetail(@RequestParam(name = "accessToken") String accessToken, @RequestBody HomeworkRequest request) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try {
|
|
|
- CorrectDetailDto data = studentService.homeworkTaskDetail(request.getWorkId());
|
|
|
- if (data != null) {
|
|
|
- responseEntity.success(data,"成功");
|
|
|
- } else {
|
|
|
- responseEntity.failure("未查询到作业原图");
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("学生端-作业任务详情", e);
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "作业任务详情");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/homeworkTaskDetail2", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "作业任务详情2", httpMethod = "POST", response = ResponseEntity.class, notes = "作业任务详情2")
|
|
|
- public ResponseEntity homeworkTaskDetail2(@RequestParam(name = "accessToken") String accessToken, @RequestBody HomeworkRequest request) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try {
|
|
|
- CorrectDetailDto2 data = studentService.homeworkTaskDetail2(request.getWorkId());
|
|
|
- if (data != null) {
|
|
|
- responseEntity.success(data,"成功");
|
|
|
- } else {
|
|
|
- responseEntity.failure("未查询到作业原图");
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("学生端-作业任务详情", e);
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "作业任务详情");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/startHomework", method = RequestMethod.POST)
|
|
|
- @ModifySecurity
|
|
|
- @ApiOperation(value = "开始作业", httpMethod = "POST", response = ResponseEntity.class, notes = "开始作业")
|
|
|
- public ResponseEntity startHomework(@RequestParam(name = "accessToken") String accessToken, @RequestBody StartHomeworkReq req) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try {
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- /** 该功能需验证是否有购买作业吧服务 by duyy on 2019-04-12*/
|
|
|
- if(!libVipServiceService.checkZybExistOrExpiredByChildUserId(userId)) {
|
|
|
- responseEntity.failure("您还不是作业吧会员,不可进行此操作");
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
- responseEntity = studentService.startHomework(req.getVipId(),req.getCourseName(),req.getCurrentTime());
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("学生端-开始作业", e);
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/endHomework", method = RequestMethod.POST)
|
|
|
- @ModifySecurity
|
|
|
- @ApiOperation(value = "完成作业", httpMethod = "POST", response = ResponseEntity.class, notes = "完成作业")
|
|
|
- public ResponseEntity endHomework(@RequestParam(name = "accessToken") String accessToken, @RequestBody EndHomeworkReq req) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try {
|
|
|
- studentService.endHomework(req.getHomeworkId(), req.getEndTime(), req.getUsedTime());
|
|
|
- responseEntity.success();
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("学生端-完成作业", e);
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/deleteHomework", method = RequestMethod.POST)
|
|
|
- @ModifySecurity
|
|
|
- @ApiOperation(value = "删除未拍照作业计时", httpMethod = "POST", response = ResponseEntity.class, notes = "删除未拍照作业计时")
|
|
|
- public ResponseEntity deleteHomework(@RequestParam(name = "accessToken") String accessToken, @RequestBody DeleteHomeworkRequest req) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try {
|
|
|
- studentService.deleteHomework(req.getHomeworkId(),req.getUsedTime());
|
|
|
- responseEntity.success();
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("学生端-删除未拍照作业计时", e);
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/replaceVagueImg", method = RequestMethod.POST)
|
|
|
- @ModifySecurity
|
|
|
- @ApiOperation(value = "模糊更替", httpMethod = "POST", response = ResponseEntity.class, notes = "模糊更替")
|
|
|
- public ResponseEntity replaceVagueImg(@RequestParam(name = "accessToken") String accessToken, @RequestBody RephotoReq req) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
-
|
|
|
- String homeworkPictureId = req.getPhotoId();
|
|
|
- if (StringUtils.isBlank(homeworkPictureId)) {
|
|
|
- return responseEntity.failure("作业图片id不能为空");
|
|
|
- }
|
|
|
-
|
|
|
- String fileKey = req.getFileKey();
|
|
|
- if (StringUtils.isBlank(fileKey)) {
|
|
|
- return responseEntity.failure("新图片路径不能为空");
|
|
|
- }
|
|
|
-
|
|
|
- try {
|
|
|
- HomeworkPicture homeworkPicture = homeworkPictureService.getById(homeworkPictureId);
|
|
|
- if (homeworkPicture == null) {
|
|
|
- return responseEntity.failure("作业图片不存在");
|
|
|
- }
|
|
|
- homeworkPicture.setType(3);
|
|
|
- return homeworkPictureService.replaceVagueImgAndPushConch(homeworkPicture, fileKey, null);
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error(String.format("模糊更替失败:homeworkPictureId->%s,fileKey->%s,异常:%s", homeworkPictureId, fileKey, e));
|
|
|
- responseEntity.failure(ResponseConstant.CODE_000, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
-
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * ========================================小时光==========================================
|
|
|
- */
|
|
|
- @RequestMapping(value = "/smarttime", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "我的小时光", httpMethod = "POST", response = ResponseEntity.class, notes = "我的小时光")
|
|
|
- public ResponseEntity smarttime(@RequestParam(name = "accessToken") String accessToken, @RequestBody ChildSmarttimeListReq req) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try{
|
|
|
- Map<String, Object> params = new HashMap<String, Object>();
|
|
|
- params.put("vipId", req.getVipId());
|
|
|
- Pageable pageable = initPage(req.getPageNo(), req.getPageSize());
|
|
|
- Map<String, Object> result = studentService.smarttime(params, pageable);
|
|
|
- responseEntity.success(result, "成功");
|
|
|
- } catch (Exception e){
|
|
|
- logger.error("学生端-我的小时光", e);
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * ========================================通用==========================================
|
|
|
- */
|
|
|
- @RequestMapping(value = "/uploadPicture", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "上传(作业-难题-小时光)", httpMethod = "POST", response = ResponseEntity.class, notes = "上传(作业-难题-小时光)")
|
|
|
- public ResponseEntity uploadPicture(@RequestParam(name = "accessToken") String accessToken, @RequestBody UploadPictureReq req) {
|
|
|
- ResponseEntity responseEntity = null;
|
|
|
- try{
|
|
|
- responseEntity = studentService.uploadPicture(req);
|
|
|
- } catch (Exception e){
|
|
|
- logger.error("学生端-上传(作业-难题-小时光)", e);
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/getOrgTeacherBindInfo", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "查询难题老师绑定情况", httpMethod = "POST", notes = "小塾作业计时+拍照(无网络情况)")
|
|
|
- public ResponseEntity getOrgTeacherBindInfo(@RequestParam(name = "accessToken") String accessToken, @RequestBody StudentBindInfoReq req) {
|
|
|
- ResponseEntity responseEntity;
|
|
|
- try {
|
|
|
- String subject = "";
|
|
|
- if(req.getSubject().equals("YUWEN")) {
|
|
|
- subject = "语文";
|
|
|
- }else if(req.getSubject().equals("YINGYU")) {
|
|
|
- subject = "英语";
|
|
|
- }else if(req.getSubject().equals("SHUXUE")) {
|
|
|
- subject = "数学";
|
|
|
- }
|
|
|
- responseEntity = conchDerverService.getOrgTeacherBindInfo(req.getVipId(), subject);
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error(e.toString());
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/childPicture", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "查看(作业-难题-小时光)服务器图片", httpMethod = "POST", response = ResponseEntity.class, notes = "查看(作业-难题-小时光)服务器图片")
|
|
|
- public ResponseEntity childPicture(@RequestParam(name = "accessToken") String accessToken, @RequestBody ChildPictureReq req) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try{
|
|
|
-
|
|
|
- Map<String, Object> params = new HashMap<String, Object>();
|
|
|
- params.put("EQ_isDelete", 0);
|
|
|
- params.put("EQ_vipId", req.getVipId());
|
|
|
- params.put("LTE_createTime", req.getMaxCreateTime());
|
|
|
- Pageable pageable = initPage(req.getPageNo(), req.getPageSize(), Direction.DESC, "createTime");
|
|
|
- Map<String, Object> data = studentService.childPicture(req.getType(),params,pageable);
|
|
|
- responseEntity.success(data, "成功");
|
|
|
- } catch (Exception e){
|
|
|
- logger.error("异常", e);
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 返回登录方式,便于Ios调过校验。如果是0则表示是ios_pad扫码登录页面,1则表示是ios正常登录注册界面
|
|
|
- *
|
|
|
- * @return
|
|
|
- */
|
|
|
- @ApiOperation(value = "返回登录方式",httpMethod = "POST")
|
|
|
- @IgnoreSecurity
|
|
|
- @RequestMapping(value = "/getLoginType",method = RequestMethod.POST)
|
|
|
- public ResponseEntity getLoginType(@RequestBody (required=true) LoginTypeParam param) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- //判断传入的审核时间和服务器当前时间对比是否小于7天
|
|
|
- try {
|
|
|
- String loginType = PropertiesUtil.getValue("IOS_PAD_LOGIN_TYPE");
|
|
|
-
|
|
|
- Map<String, Object> data = new HashMap<String,Object>();
|
|
|
-
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- int days = DateHelper.daysBetween(sdf.parse(param.getValidateTime()),new Date());
|
|
|
- if(days <= 7 && loginType.equals("1")) {
|
|
|
- //如果小于7天那么就是账号密码登录 并且 数据库中返回登录方式是账号密码方式 则返回账号密码的方式登录
|
|
|
- data.put("loginType", "1");
|
|
|
- responseEntity.success(data,"成功");
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
- data.put("loginType", "0");
|
|
|
- responseEntity.success(data,"成功");
|
|
|
- } catch (ParseException e) {
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "返回登录方式异常");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/test", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "定时任务测试", httpMethod = "POST", response = ResponseEntity.class, notes = "定时任务测试")
|
|
|
- public ResponseEntity test(@RequestParam(name = "accessToken") String accessToken) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try{
|
|
|
- studentService.test();
|
|
|
- responseEntity.success("成功");
|
|
|
- } catch (Exception e){
|
|
|
- logger.error("异常", e);
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * ========================================好友功能==========================================
|
|
|
- */
|
|
|
- @ApiOperation(value = "查看好友列表",httpMethod = "POST")
|
|
|
- @RequestMapping(value = "/findFriends",method = RequestMethod.POST)
|
|
|
- public ResponseEntity findFriends(@RequestParam(name = "accessToken") String accessToken) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try{
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- List<UserFriendDto> dtoList = userFriendService.findFriends(userId);
|
|
|
- Map<String, Object> data = new HashMap<String,Object>();
|
|
|
- data.put("friendList", dtoList);
|
|
|
- responseEntity.success(data,"成功");
|
|
|
- } catch (Exception e){
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "添加好友申请",httpMethod = "POST")
|
|
|
- @ModifySecurity
|
|
|
- @RequestMapping(value = "/addFriendApply",method = RequestMethod.POST)
|
|
|
- public ResponseEntity addFriendApply(@RequestParam(name = "accessToken") String accessToken,@RequestBody FriendUserIdReq req) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try{
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- /** 该功能需验证是否有购买作业吧服务,如果添加的好友不是会员,提示失败 by duyy on 2019-04-12*/
|
|
|
- if(!libVipServiceService.checkZybExistOrExpiredByChildUserId(userId)) {
|
|
|
- responseEntity.failure("您还不是作业吧会员,不可进行此操作");
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
- if(!libVipServiceService.checkZybExistOrExpiredByChildUserId(req.getFriendUserId())) {
|
|
|
- responseEntity.failure("您添加的好友还不是作业吧会员,不可进行此操作");
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
- userFriendApplyService.addFriendApply(userId,req.getFriendUserId());
|
|
|
- responseEntity.success();
|
|
|
- } catch (Exception e){
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "新朋友好友申请列表",httpMethod = "POST")
|
|
|
- @RequestMapping(value = "/friendsApplyInfo",method = RequestMethod.POST)
|
|
|
- public ResponseEntity friendsApplyInfo(@RequestParam(name = "accessToken") String accessToken) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try{
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- List<NewUserFriendsApplyDto> dtoList = userFriendApplyService.friendsApplyInfo(userId);
|
|
|
- Map<String, Object> data = new HashMap<String,Object>();
|
|
|
- data.put("friendList", dtoList);
|
|
|
- responseEntity.success(data,"成功");
|
|
|
- } catch (Exception e){
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "同意/忽略添加好友",httpMethod = "POST")
|
|
|
- @ModifySecurity
|
|
|
- @RequestMapping(value = "/addFriend",method = RequestMethod.POST)
|
|
|
- public ResponseEntity addFriend(@RequestParam(name = "accessToken") String accessToken,@RequestBody FriendUserIdConfirmReq req) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try{
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- userFriendService.addFriend(userId,req.getFriendUserId(),req.getStatus());
|
|
|
- responseEntity.success();
|
|
|
- } catch (Exception e){
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "删除好友",httpMethod = "POST")
|
|
|
- @ModifySecurity
|
|
|
- @RequestMapping(value = "/deleteFriend",method = RequestMethod.POST)
|
|
|
- public ResponseEntity deleteFriend(@RequestParam(name = "accessToken") String accessToken,@RequestBody FriendUserIdReq req) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try{
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- userFriendService.deleteFriend(userId,req.getFriendUserId());
|
|
|
- responseEntity.success();
|
|
|
- } catch (Exception e){
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "查找好友",httpMethod = "POST")
|
|
|
- @RequestMapping(value = "/searchFriends",method = RequestMethod.POST)
|
|
|
- public ResponseEntity searchFriends(@RequestParam(name = "accessToken") String accessToken,@RequestBody FriendUserNameReq req) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try{
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- /** 该功能需验证是否有购买作业吧服务 by duyy on 2019-04-12*/
|
|
|
- if(!libVipServiceService.checkZybExistOrExpiredByChildUserId(userId)) {
|
|
|
- responseEntity.failure("您还不是作业吧会员,不可进行此操作");
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- List<UserFriendsApplyDto> dtoList = userFriendApplyService.searchFriends(userId,req.getFriendUserName());
|
|
|
- Map<String, Object> data = new HashMap<String,Object>();
|
|
|
- data.put("friendList", dtoList);
|
|
|
- responseEntity.success(data,"成功");
|
|
|
- } catch (Exception e){
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "好友申请历史",httpMethod = "POST")
|
|
|
- @RequestMapping(value = "/historyFriendsApply",method = RequestMethod.POST)
|
|
|
- public ResponseEntity historyFriendsApply(@RequestParam(name = "accessToken") String accessToken) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try{
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- List<UserFriendsApplyDto> dtoList = userFriendApplyService.historyFriendsApply(userId);
|
|
|
- Map<String, Object> data = new HashMap<String,Object>();
|
|
|
- data.put("friendList", dtoList);
|
|
|
- responseEntity.success(data,"成功");
|
|
|
- } catch (Exception e){
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/homeworkCheckIn", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "作业登记", httpMethod = "POST", notes = "作业登记")
|
|
|
- public ResponseEntity homeworkCheckIn(@RequestParam(name = "accessToken") String accessToken, @RequestBody IpadHomeworkCheckInReq req) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try {
|
|
|
- String userId = tokenManager.getUserId(accessToken);
|
|
|
- /** 该功能需验证是否有购买作业吧服务 by duyy on 2019-04-12*/
|
|
|
- if(!libVipServiceService.checkZybExistOrExpiredByChildUserId(userId)) {
|
|
|
- responseEntity.failure("您还不是作业吧会员,不可进行此操作");
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
- studentService.homeworkCheckIn(req);
|
|
|
- responseEntity.success();
|
|
|
- } catch (Exception e) {
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "/getHomeworkCheckIn", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "获取作业登记图片", httpMethod = "POST", notes = "获取当天作业登记图片")
|
|
|
- public ResponseEntity getHomeworkCheckIn(@RequestParam(name = "accessToken") String accessToken, @RequestBody IpadHomeworkCheckInReq req) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- try {
|
|
|
- List<String> checkInImgList = studentService.getHomeworkCheckIn(req);
|
|
|
- Map<String, Object> data = new HashMap<String, Object>();
|
|
|
- data.put("checkInImgList", checkInImgList);
|
|
|
- responseEntity.success(data, "成功");
|
|
|
- } catch (Exception e) {
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * ==========================签到==========================
|
|
|
- */
|
|
|
- @RequestMapping(value = "/signIn", method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "签到", httpMethod = "POST", notes = "签到")
|
|
|
- public ResponseEntity signIn(@RequestParam(name = "accessToken") String accessToken, @RequestBody IndexReq req) {
|
|
|
- ResponseEntity responseEntity = new ResponseEntity();
|
|
|
- String vipId = req.getVipId();
|
|
|
- if (StringUtils.isBlank(vipId)) {
|
|
|
- return responseEntity.failure("学生id不能为空");
|
|
|
- }
|
|
|
- try {
|
|
|
- responseEntity = integralDetailService.signToday(req.getVipId());
|
|
|
- } catch (Exception e) {
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "签到失败,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-
|
|
|
- @RequestMapping(value = "shareMsgAddIntegral",method = RequestMethod.POST)
|
|
|
- @ApiOperation(value = "分享增加积分",httpMethod = "POST",notes = "分享增加积分")
|
|
|
- public ResponseEntity shareMsgAddIntegral(@RequestParam(name = "accessToken") String accessToken, @RequestBody ShareReq req){
|
|
|
- ResponseEntity responseEntity;
|
|
|
- try {
|
|
|
- responseEntity = parentV2Service.shareMsgAddIntegral(req);
|
|
|
- } catch (Exception e) {
|
|
|
- responseEntity = new ResponseEntity();
|
|
|
- responseEntity.failure(ResponseConstant.CODE_500, "系统繁忙,请稍后重试");
|
|
|
- }
|
|
|
- return responseEntity;
|
|
|
- }
|
|
|
-}
|