|  | @@ -0,0 +1,46 @@
 | 
	
		
			
				|  |  | +package com.ym.service.Impl;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import com.alibaba.fastjson.JSONObject;
 | 
	
		
			
				|  |  | +import com.ym.dao.HereWhiteDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.util.http.HttpUtil;
 | 
	
		
			
				|  |  | +import com.ym.pojo.HereWhite;
 | 
	
		
			
				|  |  | +import com.ym.service.HereWhiteService;
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  | +import org.springframework.beans.factory.annotation.Value;
 | 
	
		
			
				|  |  | +import org.springframework.stereotype.Service;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +import java.util.HashMap;
 | 
	
		
			
				|  |  | +import java.util.Map;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +@Service
 | 
	
		
			
				|  |  | +public class HereWhiteServiceImpl implements HereWhiteService {
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Value("${cn.rongcloud.hereWhite.url}")
 | 
	
		
			
				|  |  | +    private String hereWhiteUrl;
 | 
	
		
			
				|  |  | +    @Value("${cn.rongcloud.hereWhite.token}")
 | 
	
		
			
				|  |  | +    private String hereWhiteToken;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private HereWhiteDao hereWhiteDao;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public String create(String name, Integer userNum) throws Exception {
 | 
	
		
			
				|  |  | +        JSONObject json = new JSONObject();
 | 
	
		
			
				|  |  | +        json.put("name",name);
 | 
	
		
			
				|  |  | +        json.put("limit",userNum);
 | 
	
		
			
				|  |  | +        json.put("mode","transitory");
 | 
	
		
			
				|  |  | +        String url = "/room?token=" + hereWhiteToken;
 | 
	
		
			
				|  |  | +        return requestParam(json,url);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    private String requestParam(JSONObject json,String url) throws Exception {
 | 
	
		
			
				|  |  | +        Map<String, String> headers = new HashMap<>(1);
 | 
	
		
			
				|  |  | +        headers.put("Content-Type","application/json");
 | 
	
		
			
				|  |  | +        return HttpUtil.postForHttps(hereWhiteUrl + url, json.toJSONString(), headers);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    @Override
 | 
	
		
			
				|  |  | +    public HereWhite join(Integer courseScheduleId) throws Exception {
 | 
	
		
			
				|  |  | +        return hereWhiteDao.findById(courseScheduleId);
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +}
 |