|  | @@ -1,17 +1,24 @@
 | 
	
		
			
				|  |  |  package com.yonge.cooleshow.student.controller;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import com.alibaba.fastjson.JSON;
 | 
	
		
			
				|  |  | +import com.baomidou.mybatisplus.core.metadata.IPage;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.auth.api.entity.SysUser;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.dto.ActivityEvaluationRecordDto;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.dto.EvaluationRecordDto;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.entity.SysMusicCompareRecord;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.queryInfo.UserRewardQueryInfo;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.service.ActivityEvaluationRecordService;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.biz.dal.service.ActivityPlanService;
 | 
	
		
			
				|  |  | -import com.yonge.cooleshow.biz.dal.vo.MusicActivityVo;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.service.ActivityUserRewardService;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.vo.CheckVo;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.biz.dal.vo.activity.UserRewardWrapper;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.common.controller.BaseController;
 | 
	
		
			
				|  |  |  import com.yonge.cooleshow.common.entity.HttpResponseResult;
 | 
	
		
			
				|  |  | -import com.yonge.toolset.base.exception.BizException;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.common.enums.YesOrNoEnum;
 | 
	
		
			
				|  |  | +import com.yonge.cooleshow.student.io.request.ActivityVo;
 | 
	
		
			
				|  |  | +import com.yonge.toolset.base.page.PageInfo;
 | 
	
		
			
				|  |  | +import com.yonge.toolset.mybatis.support.PageUtil;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  |  import org.slf4j.Logger;
 | 
	
	
		
			
				|  | @@ -20,7 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.http.HttpStatus;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import java.util.Objects;
 | 
	
		
			
				|  |  | +import java.util.List;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  @Api(tags = "学生活动接口")
 | 
	
	
		
			
				|  | @@ -37,6 +44,9 @@ public class StudentActivityController extends BaseController {
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private ActivityEvaluationRecordService activityEvaluationRecordService;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private ActivityUserRewardService activityUserRewardService;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @ApiOperation(value = "评测活动参与项目", notes = "评测项目id")
 | 
	
		
			
				|  |  |      @PostMapping(value = "/evaluation/{evaluationId}")
 | 
	
		
			
				|  |  |      public HttpResponseResult<Boolean> joinEvaluation(@PathVariable Long evaluationId) {
 | 
	
	
		
			
				|  | @@ -76,5 +86,54 @@ public class StudentActivityController extends BaseController {
 | 
	
		
			
				|  |  |          }
 | 
	
		
			
				|  |  |          return succeed();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "检查是否存在未领奖")
 | 
	
		
			
				|  |  | +    @GetMapping("/checkReceiveReward")
 | 
	
		
			
				|  |  | +    public HttpResponseResult<CheckVo> checkReceiveReward(){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        SysUser user = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | +        if (user == null || null == user.getId()) {
 | 
	
		
			
				|  |  | +            return failed(HttpStatus.FORBIDDEN, "请登录");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        Boolean b = activityUserRewardService.checkReceiveReward(user.getId(), ClientEnum.STUDENT);
 | 
	
		
			
				|  |  | +        YesOrNoEnum check = b?YesOrNoEnum.YES:YesOrNoEnum.NO;
 | 
	
		
			
				|  |  | +        CheckVo checkVo = new CheckVo();
 | 
	
		
			
				|  |  | +        checkVo.setCheck(check);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return succeed(checkVo);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "查看领奖列表")
 | 
	
		
			
				|  |  | +    @PostMapping("/receiveRewardList")
 | 
	
		
			
				|  |  | +    public HttpResponseResult<PageInfo<ActivityVo.ReceiveRewardList>> receiveRewardList(@RequestBody ActivityVo.ReceiveRewardQuery query){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        SysUser user = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | +        if (user == null || null == user.getId()) {
 | 
	
		
			
				|  |  | +            return failed(HttpStatus.FORBIDDEN, "请登录");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        IPage<UserRewardWrapper> iPage = activityUserRewardService.receiveRewardList(PageUtil.getPage(query), UserRewardQueryInfo.from(query.jsonString()));
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        // 数据转换
 | 
	
		
			
				|  |  | +        List<ActivityVo.ReceiveRewardList> pageInfos = JSON.parseArray(JSON.toJSONString(iPage.getRecords()),
 | 
	
		
			
				|  |  | +                                                                                        ActivityVo.ReceiveRewardList.class);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return succeed(PageUtil.getPageInfo(iPage,pageInfos));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "领取奖品")
 | 
	
		
			
				|  |  | +    @PostMapping("/receiveReward/{receiveRewardId}")
 | 
	
		
			
				|  |  | +    public HttpResponseResult<CheckVo> receiveReward(@PathVariable Long receiveRewardId){
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        SysUser user = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | +        if (user == null || null == user.getId()) {
 | 
	
		
			
				|  |  | +            return failed(HttpStatus.FORBIDDEN, "请登录");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        return status(activityUserRewardService.receiveReward(user.getId(), receiveRewardId));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 | 
	
		
			
				|  |  |  
 |