ClickUnionRest.java 21.9 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524
/**
 * 
 */
package com.yoho.unions.server.restapi;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yoho.service.model.union.request.ActivateDeviceIdReqBO;
import com.yoho.service.model.union.request.ClickUnionRequestBO;
import com.yoho.service.model.union.request.UnionLogsReqBO;
import com.yoho.service.model.union.response.PageUnionActivityLogsRspBO;
import com.yoho.service.model.union.response.PageUnionClickLogsRspBO;
import com.yoho.service.model.union.response.UnionResponse;
import com.yoho.unions.common.ApiResponse;
import com.yoho.unions.common.enums.ClientTypeEnum;
import com.yoho.unions.common.utils.SpringContextUtil;
import com.yoho.unions.dal.IUnionTypeMatchDAO;
import com.yoho.unions.dal.model.UnionTypeMatch;
import com.yoho.unions.interceptor.RemoteIPInterceptor;
import com.yoho.unions.server.service.IMobvistaService;
import com.yoho.unions.server.service.IUnionService;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Enumeration;

/**
 * 描述:统一的联盟入口
 * 
 * @author ping.huang
 * 2016年5月10日
 */
@Controller
@RequestMapping("/ClickUnionRest")
public class ClickUnionRest {
	
	static Logger log = LoggerFactory.getLogger(ClickUnionRest.class);
	
	static Logger clickUnion = LoggerFactory.getLogger("clickUnion");
	@Resource(name="unionServiceImpl")
	IUnionService unionService;
	@Resource
	IMobvistaService mobvistaService;
	@Resource
	IUnionTypeMatchDAO unionTypeMatchDAO;

	/**
	 * 添加联盟
	 * @param vo
	 * @return
	 */
	@RequestMapping("/addUnion")
	@ResponseBody
	public UnionResponse addUnion(ClickUnionRequestBO request) {
		if (StringUtils.isEmpty(request.getUnion_type())) {
			return new UnionResponse(201, "union_type is empty");
		}
		clickUnion.info("addUnion with param is {}", request);
		if ("iphone".equals(request.getClient_type())) {
			request.setClient_type(ClientTypeEnum.IOS.getName());
		}
		String IP = RemoteIPInterceptor.getRemoteIP();
//		String IP = "42.236.215.29, 123.151.42.48";
		String clientIp = null;
		if(StringUtils.isNotEmpty(IP)){
			String[] IPS = IP.split(",");
			clientIp = IPS[0];
		}
		request.setClientIp(clientIp);
		//针对td做一下特殊处理,如果是0_0_ios_10.2 这种情况,则把0.0给截取掉
		String td = request.getTd();
		if (StringUtils.isNotEmpty(td)&&td.startsWith("0_0")){
			String[] td1 = td.split("0_0_");
			request.setTd(td1[1]);
		}
		//增加监控,把接口报上去,根据client_type来判断
		request.setInterfaceType("addUnion_ios");
		if(StringUtils.isNotEmpty(request.getClient_type())&&request.getClient_type().equals(ClientTypeEnum.ANDROID.getName())){
			request.setInterfaceType("addUnion_android");
		}
		clickUnion.info("addUnion with param is {}", request);
		UnionResponse response = unionService.clickUnion(request);
//		log.info("addUnion with result is {}, and request is {}", response, request);
		return response;
	}

	@RequestMapping("/addCommonUnion")
	@ResponseBody
	public UnionResponse addCommonUnion(HttpServletRequest httpServletRequest) {
//		log.info("addCommonUnion with param is {}", JSON.toJSONString(httpServletRequest.getParameterMap()));
		clickUnion.info("addCommonUnion with param is {}", JSON.toJSONString(httpServletRequest.getParameterMap()));

		String union_type = httpServletRequest.getParameter("union_type");
		//根据union_type区分不同的厂商
		StringBuffer stringBuffer = new StringBuffer();
		String bean = stringBuffer.append("UnionServiceImpl").append("_").append(union_type).toString();
		boolean containsBean = SpringContextUtil.containsBean(bean);
		ClickUnionRequestBO request = null;
		if(containsBean){
			IUnionService service = SpringContextUtil.getBean(bean, IUnionService.class);
			request = service.clickHttpRequestTOBO(httpServletRequest,request);
		}else {
			request = unionService.clickHttpRequestTOBO(httpServletRequest,request);
		}
		String IP = RemoteIPInterceptor.getRemoteIP();
		String clientIp = null;
		if(StringUtils.isNotEmpty(IP)){
			String[] IPS = IP.split(",");
			clientIp = IPS[0];
		}
		request.setClientIp(clientIp);
//		IUnionService service = SpringContextUtil.getBean(bean, IUnionService.class);
		clickUnion.info("addCommonUnion request is {}",request);
		UnionResponse response = unionService.clickUnion(request);
//		clickUnion.info("addUnion with result is {}, and request is {}", response, request);
		return response;
	}
	
	/**
	 * 对特殊的联盟进行特殊处理
	 * @param bo
	 * @param request
	 * @param response
	 */
	@RequestMapping("/addUnion4Special")
	public void addUnion4Special(ClickUnionRequestBO bo, HttpServletRequest request, HttpServletResponse response) {
		log.info("addUnion4Special with param is {}", bo);
		try {
			String clientIp = null;
			String IP = RemoteIPInterceptor.getRemoteIP();
			if(StringUtils.isNotEmpty(IP)){
				String[] IPS = IP.split(",");
				clientIp = IPS[0];
			}
			bo.setClientIp(clientIp);
			String agent = request.getHeader("user-agent");
			log.info("user-agent={}", agent);
			if (StringUtils.isEmpty(agent)) {
				log.warn("addUnion4Special user-agent is empty with bo={}", bo);
				return;
			}
			if (agent.toLowerCase().indexOf("mac os x") < 0 && agent.toLowerCase().indexOf("iphone") < 0) {
				log.warn("addUnion4Special is not ios with user-agent={}, bo={}", agent, bo);
				return;
			}
			if (agent.indexOf(" like") < agent.indexOf(" OS ") + 4) {
				log.warn("addUnion4Special agent is not correct with user-agent={}, bo={}", agent, bo);
				return;
			}

			String version = agent.substring(agent.indexOf(" OS ") + 4, agent.indexOf(" like"));
			log.info("addUnion4Special version={}", version);
			bo.setTd("ios_" + version.replaceAll("_", "."));
			bo.setClient_type("ios");
			bo.setAppid("490655927");
			log.info("addUnion4Special request={}", bo);
			unionService.clickUnion(bo);
			log.info("addUnion4Special with result is {}, and request is {}", response, bo);
			clickUnion.info("addUnion4Special request is {}", bo);
			response.setStatus(301);
			response.sendRedirect("https://itunes.apple.com/us/app/id490655927?ls=1&mt=8");
		} catch (IOException e) {
			log.error("addUnion4Special error with request={}", bo, e);
		}
	}
	
	@RequestMapping(value = {"/addUnion4Jump", "/addUnion4Jump/goitunes", "/addUnion4Jump/goandroid"})
	public void addUnion4Stream(ClickUnionRequestBO bo, HttpServletRequest request, HttpServletResponse response) {
		clickUnion.info("addUnion4Stream ClickUnionRequestBO{}", bo);
		if (null == bo || StringUtils.isEmpty(bo.getUnion_type())) {
			return;
		}
		String downloadDirect = "Y";
		if(null != request && null != request.getRequestURI() && request.getRequestURI().endsWith("goitunes")){
			downloadDirect = "ios";
		}else if(null != request && null != request.getRequestURI() && request.getRequestURI().endsWith("goandroid")){
			downloadDirect = "android";
		}
		String clientIp = null;
		String IP = RemoteIPInterceptor.getRemoteIP();

		if(StringUtils.isNotEmpty(IP)){
			String[] IPS = IP.split(",");
			clientIp = IPS[0];
		}
		bo.setClientIp(clientIp);
		bo.setClient_type("android");
		bo.setAppid("com.yoho");
		String agent = request.getHeader("user-agent");
		clickUnion.info("addUnion4Stream user-agent={}", agent);
		if(StringUtils.isBlank(agent)){
			return;
		}
		agent = agent.toLowerCase();
		bo.setUserAgent(agent);
		String url = "http://cdn.yoho.cn/app-downfiles/yohoBuy_YOHO_2953.apk";
		try {
			if (!StringUtils.isEmpty(agent)) {
				//对encode的进行处理
				String agentEncode = URLDecoder.decode(agent,"UTF-8");
				if(!agent.equals(agentEncode)){   //encode前后不相等,说明经过了encode处理,则需要decode
					agent = agentEncode;
				}

				if (agent.indexOf("mac os x") >= 0 || agent.indexOf("iphone") >= 0 ||agent.indexOf("ipad")>0) {
					if(agent.contains("os")&&agent.contains("like")){
						String version = agent.substring(agent.indexOf(" os ") + 4, agent.indexOf(" like"));
						bo.setTd("ios_" + version.replaceAll("_", "."));
						bo.setClient_type("ios");
						bo.setAppid("490655927");
						url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
					}
					//youku;5.4;ios;10.2;iphone6,1  ---这种情况比较多
					else if(agent.contains("youku")){
						String version = "";
						if(agent.contains("ios")){
							int first = agent.indexOf("ios;")+4;
							String version1 = agent.substring(first);
							version = version1.substring(version1.indexOf(" ")+1, version1.indexOf(";"));
							bo.setTd("ios_" + version.replaceAll("_", "."));
							bo.setClient_type("ios");
							bo.setAppid("490655927");
							url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
						} //youku;5.4.1;iphone os;8.4.1;iphone6,2
						else if(agent.contains("os")){
							int first = agent.indexOf("os;") + 3;
							String version1 = agent.substring(first);
							version = version1.substring(version1.indexOf(" ") + 1, version1.indexOf(";"));
							bo.setTd("ios_" + version.replaceAll("_", "."));
							bo.setClient_type("ios");
							bo.setAppid("490655927");
							url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
						}
					}
					//momochat/7.5.6 ios/664 (iphone 6; ios 10.2; zh_cn; iphone7,2; s1)
					else if(agent.contains("momochat")){
                        String version  = "";
						if(agent.contains("ios")&&agent.contains("os")){
							int first = agent.indexOf(" os ")+3;
							String version1 = agent.substring(first);
							version = version1.substring(version1.indexOf(" ")+1, version1.indexOf(";"));
							bo.setTd("ios_" + version.replaceAll("_", "."));
							bo.setClient_type("ios");
							bo.setAppid("490655927");
							url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
						}
                        else if(agent.contains("ios")){
                            int first = agent.indexOf(" ios ")+4;
                            String version1 = agent.substring(first);
                            version = version1.substring(version1.indexOf(" ")+1, version1.indexOf(";"));
                            bo.setTd("ios_" + version.replaceAll("_", "."));
                            bo.setClient_type("ios");
                            bo.setAppid("490655927");
                            url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
                        }  //momochat/7.5.6 ios/664 (iphone 6s; iphone os 9.2; zh_cn; iphone8,1; s1)
                        else if(agent.contains("os")){
                            int first = agent.indexOf(" os ")+3;
                            String version1 = agent.substring(first);
                            version = version1.substring(version1.indexOf(" ")+1, version1.indexOf(";"));
                            bo.setTd("ios_" + version.replaceAll("_", "."));
                            bo.setClient_type("ios");
                            bo.setAppid("490655927");
                            url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
                        }
                    }
					else if(agent.contains("ios/")){
						String version= "";
						if(agent.contains("mozilla")){  //	mozilla/5.0,ios/10.0.2,client/5.8.1,device/iphone6.2,theme/red
							version = agent.substring(agent.indexOf("ios/")+4,agent.indexOf("client")-1);
						}else if (agent.contains("iphone")) {  //huazhu/ios/iphone9,2/10.2.1/6.5.3
							int last  = agent.lastIndexOf("/");
							String version1 = agent.substring(0,last);
							version = version1.substring(version1.lastIndexOf("/") + 1, version1.length());
							bo.setTd("ios_" + version.replaceAll("_", "."));
							bo.setClient_type("ios");
							bo.setAppid("490655927");
							url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
						}else{                                //ios/6.6 com.jugg.doctor ipad5,3/8.3/768x1024/2.0 /1---这个应该就是ios_6.6
							version = agent.substring(agent.indexOf("ios/")+4,agent.indexOf(" "));
							bo.setTd("ios_" + version.replaceAll("_", "."));
							bo.setClient_type("ios");
							bo.setAppid("490655927");
							url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
						}
					}
					//365jia news client/cn.ahurls.news/3.5.0_300500.209/ios(7.1|0|iphone)/59c2ed8b88175124c539e0c7a96a18d4eedb3d6c(none|none)/640x1136@2
					else if(agent.contains("/ios")){
						int first = agent.indexOf("/ios(") + 5;
						String version1 = agent.substring(first);
						String version = version1.substring(0,version1.indexOf("|"));
						bo.setTd("ios_" + version.replaceAll("_", "."));
						bo.setClient_type("ios");
						bo.setAppid("490655927");
						url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
					}
					else if (agent.contains("ios")){
						String version = "";
						if(agent.contains("letvshop")){
							//letvshop;1.6.6;iphone 6plus;ios-iphone;9.2;zh_cn
							int lastIndex = agent.lastIndexOf(";");
							String version1 = agent.substring(0,lastIndex);
							version = agent.substring(version1.lastIndexOf(";")+1,lastIndex);
							bo.setTd("ios_" + version.replaceAll("_", "."));
							bo.setClient_type("ios");
							bo.setAppid("490655927");
							url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
						}else if(agent.contains("jxsg")) {  //jxsg_ios-1.2.5/0.0.2 (iphone7,2; ios 10.2.1)
							int first = agent.lastIndexOf("ios ") + 4;
							String version1 = agent.substring(first);
							int lastIndex = version1.indexOf(")");
							version = version1.substring(version1.indexOf(" ") + 1, lastIndex);
							bo.setTd("ios_" + version.replaceAll("_", "."));
							bo.setClient_type("ios");
							bo.setAppid("490655927");
							url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
						}else{
							int first = agent.lastIndexOf("ios ") + 4;
							String version1 = agent.substring(first);
							int lastIndex = version1.indexOf(";");
							version = version1.substring(0, lastIndex);
							bo.setTd("ios_" + version.replaceAll("_", "."));
							bo.setClient_type("ios");
							bo.setAppid("490655927");
							url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
						}
					}

				} else {
					int index = agent.lastIndexOf("android");
					if (index > 0) {
						String version = agent.substring(index + 8, index + 11);
						bo.setTd("android_" + version.replaceAll("_", ""));
						bo.setClient_type("android");
						bo.setAppid("com.yoho");
					}
				}
			}
		} catch (Exception e) {
			log.error("addUnion4Stream error with request={}", bo, e);
		}
		try {

			//增加监控,把接口报上去,根据client_type来判断
			bo.setInterfaceType("addUnion4Jump_ios");
			if(StringUtils.isNotEmpty(bo.getClient_type())&&bo.getClient_type().equals(ClientTypeEnum.ANDROID.getName())){
				bo.setInterfaceType("addUnion4Jump_android");
			}
			StringBuffer stringBuffer = new StringBuffer();
			//根据union_type区分不同的厂商
			String union_type = bo.getUnion_type();
			//先去union_type_match表里面查看,是否有对应关系
			UnionTypeMatch unionTypeMatch = unionTypeMatchDAO.selectByPrimaryKey(Long.valueOf(union_type));
			if(unionTypeMatch!=null && StringUtils.isNotEmpty(String.valueOf(unionTypeMatch.getUnionTypeMatch()))){
				union_type = String.valueOf(unionTypeMatch.getUnionTypeMatch());
			}
			String bean = stringBuffer.append("UnionServiceImpl").append("_").append(union_type).toString();
			boolean containsBean = SpringContextUtil.containsBean(bean);
			if (containsBean) {
				IUnionService service = SpringContextUtil.getBean(bean, IUnionService.class);
				bo = service.clickHttpRequestTOBO(request, bo);
			}
			unionService.clickUnion(bo);
			clickUnion.info("addUnion4Jump request is {}",bo);
//			log.info("addUnion4Stream with request is {}", bo);
			response.setStatus(301);
			//response.setHeader("Location",url);
			//如果不需要直接下载, 配置参数downloadDirect=N, 跳转应用宝下载
			if(null != downloadDirect && "ios".equals(downloadDirect.trim())){
				url = "https://itunes.apple.com/cn/app/yoho!-you-huo/id490655927?mt=8";
			}else if(null != downloadDirect && "android".equals(downloadDirect.trim())){
				url = "http://a.app.qq.com/o/simple.jsp?pkgname=com.yoho&g_f=995445";
			}
			response.sendRedirect(url);
		} catch (Exception e) {
			log.error("addUnion4Stream error with request={}", bo, e);
		}
	}

	@RequestMapping("/addMonitor")
	@ResponseBody
	public JSON addMonitor(ClickUnionRequestBO bo, HttpServletRequest request, HttpServletResponse response) {
		if (StringUtils.isEmpty(bo.getUnion_type())) {
			return new JSONObject();
		}
		clickUnion.info("addMonitor with param is {}", bo);
		try {

			Enumeration<String> e = request.getParameterNames();
			while (e.hasMoreElements()) {
				String key = e.nextElement();
				clickUnion.info("addMonitor with key={}, value={}", key, request.getParameter(key));
			}
			String IP = RemoteIPInterceptor.getRemoteIP();
			String clientIp = null;
			if(StringUtils.isNotEmpty(IP)){
				String[] IPS = IP.split(",");
				clientIp = IPS[0];
			}

			bo.setClientIp(clientIp);
			String agent = request.getHeader("user-agent");
			clickUnion.info("addMonitor user-agent={}", agent);
			try{
				if (!StringUtils.isEmpty(agent)) {
					if (agent.toLowerCase().indexOf("mac os x") >= 0 || agent.toLowerCase().indexOf("iphone") >= 0) {
						String version = agent.substring(agent.indexOf(" OS ") + 4, agent.indexOf(" like"));
						bo.setTd("ios_" + version.replaceAll("_", "."));
						bo.setClient_type("ios");
						bo.setAppid("1048984814");
					}else {
						int index = agent.indexOf("android");
						if (index > 0) {
							String version = agent.substring(index + 8, index + 11);
							bo.setTd("android_"+version.replaceAll("_",""));
							bo.setClient_type("android");
							bo.setAppid("com.yoho");
						}
						
					}
				}
			}catch (Exception e1){
				log.error("addMonitor error with request={}",e1.getMessage());
			}

			//增加监控,把接口报上去,根据client_type来判断
			bo.setInterfaceType("addMonitor_ios");
			if(StringUtils.isNotEmpty(bo.getClient_type())&&bo.getClient_type().equals(ClientTypeEnum.ANDROID.getName())){
				bo.setInterfaceType("addMonitor_android");
			}
			clickUnion.info("addMonitor request={}", bo);
			//根据union_type区分不同的厂商
			String union_type = request.getParameter("union_type");
			//先去union_type_match表里面查看,是否有对应关系
			UnionTypeMatch unionTypeMatch = unionTypeMatchDAO.selectByPrimaryKey(Long.valueOf(union_type));
			if(unionTypeMatch!=null && StringUtils.isNotEmpty(String.valueOf(unionTypeMatch.getUnionTypeMatch()))){
				union_type = String.valueOf(unionTypeMatch.getUnionTypeMatch());
			}
			StringBuffer stringBuffer = new StringBuffer();
			String bean = stringBuffer.append("UnionServiceImpl").append("_").append(union_type).toString();
			boolean containsBean = SpringContextUtil.containsBean(bean);
			if(containsBean){
				IUnionService service = SpringContextUtil.getBean(bean, IUnionService.class);
				bo = service.clickHttpRequestTOBO(request,bo);
			}
			unionService.clickUnion(bo);
			clickUnion.info("addMonitor with param is {}", bo);
//			log.info("addMonitor with result is {}, and request is {}", response, bo);
			response.setStatus(200);
			JSONObject j = new JSONObject();
			//智慧推对接口返回有要求,定制一下
			if(union_type.equals("100000000000453")){
				j.put("ret", 0);
				j.put("msg","成功");
			}else{
				j.put("ret","0");
			}

			return j;

		} catch (Exception e) {
			log.error("addMonitor error with request={}", bo, e);
		}
		return new JSONObject();
	}

	@RequestMapping("/queryUnionClickLogs")
	@ResponseBody
	public ApiResponse queryUnionClickLogs(UnionLogsReqBO unionLogsReqBO){
		log.info("enter queryUnionClickLogs. param unionLogsReqBO={}", unionLogsReqBO);
		if(unionLogsReqBO==null){
			return new ApiResponse.ApiResponseBuilder().code(500).message("缺少参数").build();
		}
		try {
			PageUnionClickLogsRspBO pageUnionClickLogsRspBO = unionService.queryUnionClickLogs(unionLogsReqBO);
			return new ApiResponse.ApiResponseBuilder().code(200).message("成功").data(pageUnionClickLogsRspBO).build();
		} catch (Exception e) {
			log.warn("queryActivateDeviceId occurs Exception e {}",e.getMessage());
			return new ApiResponse.ApiResponseBuilder().code(500).message("失败").build();
		}
	}

	@RequestMapping("/queryUnionActivityLogs")
	@ResponseBody
	public ApiResponse queryUnionActivityLogs(UnionLogsReqBO unionLogsReqBO){
		log.info("enter queryUnionActivityLogs. param unionLogsReqBO={}", unionLogsReqBO);
		if(unionLogsReqBO==null){
			return new ApiResponse.ApiResponseBuilder().code(500).message("缺少参数").build();
		}
		try {
			PageUnionActivityLogsRspBO pageUnionActivityLogsRspBO = unionService.queryUnionActivityLogs(unionLogsReqBO);
			return new ApiResponse.ApiResponseBuilder().code(200).message("成功").data(pageUnionActivityLogsRspBO ).build();
		} catch (Exception e) {
			log.warn("queryActivateDeviceId occurs Exception e {}",e.getMessage());
			return new ApiResponse.ApiResponseBuilder().code(500).message("失败").build();
		}
	}

	@RequestMapping("/queryPVandUV")
	@ResponseBody
	public ApiResponse queryPVandUV(UnionLogsReqBO unionLogsReqBO){
		log.info("enter queryPVandUV. param unionLogsReqBO={}", unionLogsReqBO);
		if(unionLogsReqBO ==null){
			return new ApiResponse.ApiResponseBuilder().code(500).message("缺少参数").build();
		}
		try{
			PageUnionActivityLogsRspBO pageUnionActivityLogsRspBO = unionService.queryUnionPVandUV(unionLogsReqBO);
			return new ApiResponse.ApiResponseBuilder().code(200).message("成功").data(pageUnionActivityLogsRspBO ).build();
		}catch (Exception e){
			return new ApiResponse.ApiResponseBuilder().code(500).message("失败").build();
		}
	}

}