|  | @@ -2,12 +2,20 @@ package com.ym.mec.student.controller;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  import com.ym.mec.auth.api.client.SysUserFeignService;
 | 
	
		
			
				|  |  |  import com.ym.mec.auth.api.entity.SysUser;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.ClassGroupDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.PracticeGroupDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.SysConfigDao;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.dto.PracticeGroupBuyDto;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.ClassGroup;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.PracticeGroup;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.enums.GroupType;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.enums.MessageTypeEnum;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.PracticeGroupService;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.service.SysMessageService;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.controller.BaseController;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.entity.HttpResponseResult;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.exception.BizException;
 | 
	
		
			
				|  |  | +import com.ym.mec.thirdparty.message.MessageSenderPluginContext;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
	
		
			
				|  | @@ -31,6 +39,15 @@ public class PracticeGroupController extends BaseController {
 | 
	
		
			
				|  |  |      private SysUserFeignService sysUserFeignService;
 | 
	
		
			
				|  |  |      List<Integer> excludeOrganIds=new ArrayList<>(Arrays.asList(new Integer[]{36}));
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private SysMessageService sysMessageService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private PracticeGroupDao practiceGroupDao;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private ClassGroupDao classGroupDao;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private SysConfigDao sysConfigDao;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @ApiOperation("获取学生的陪练课")
 | 
	
		
			
				|  |  |      @GetMapping(value = "/findUserPracticeCourses")
 | 
	
		
			
				|  |  |      public Object findUserPracticeCourses(){
 | 
	
	
		
			
				|  | @@ -187,4 +204,37 @@ public class PracticeGroupController extends BaseController {
 | 
	
		
			
				|  |  |          return practiceGroupService.repay(sysUser.getId(),groupId);
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @ApiOperation("陪练课完成报告推送")
 | 
	
		
			
				|  |  | +    @GetMapping(value = "/reportPush")
 | 
	
		
			
				|  |  | +    public HttpResponseResult reportPush(Integer userId, String pushType){
 | 
	
		
			
				|  |  | +        SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | +        if (sysUser == null) {
 | 
	
		
			
				|  |  | +            return failed(HttpStatus.FORBIDDEN, "请登录");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
 | 
	
		
			
				|  |  | +        PracticeGroup userFreePracticeGroup = practiceGroupDao.getUserFreePracticeGroup(userId);
 | 
	
		
			
				|  |  | +        ClassGroup classGroup = classGroupDao.findByMusicGroupAndType(userFreePracticeGroup.getId().toString(), GroupType.PRACTICE.getCode());
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        String pushUrl = baseApiUrl + "/#/reportDetail?classGroupId=" + classGroup.getId();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        String smsUrl = baseApiUrl + "/#/transfer?url=http://mstudev.dayaedu.com&hash=reportDetail&classGroupId=" + classGroup.getId();
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        SysUser student = sysUserFeignService.queryUserById(userId);
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if(pushType.equals("ALL")||pushType.equals("JIGUANG")){
 | 
	
		
			
				|  |  | +            Map<Integer, String> userMap = new HashMap<>();
 | 
	
		
			
				|  |  | +            userMap.put(userId, userId.toString());
 | 
	
		
			
				|  |  | +            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.JIGUANG, MessageTypeEnum.PRACTICE_COMPLETED_STUDY_REPORT,
 | 
	
		
			
				|  |  | +                    userMap, null, 0, "4?" + pushUrl, "STUDENT", pushUrl);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        if(pushType.equals("ALL")||pushType.equals("SMS")){
 | 
	
		
			
				|  |  | +            Map<Integer, String> userPhoneMap = new HashMap<>();
 | 
	
		
			
				|  |  | +            userPhoneMap.put(userId, student.getPhone());
 | 
	
		
			
				|  |  | +            sysMessageService.batchSendMessage(MessageSenderPluginContext.MessageSender.YIMEI, MessageTypeEnum.PRACTICE_COMPLETED_STUDY_REPORT,
 | 
	
		
			
				|  |  | +                    userPhoneMap, null, 0, null, "STUDENT", smsUrl);
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +        return succeed();
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  |  }
 |