Authored by gemingdan

用户设备首单注册记录过滤修改

@@ -7,6 +7,7 @@ public class UnionUicRegister { @@ -7,6 +7,7 @@ public class UnionUicRegister {
7 private String mobile; 7 private String mobile;
8 8
9 private String businessLine; 9 private String businessLine;
  10 + private String clientType;
10 11
11 private String udid; 12 private String udid;
12 13
@@ -137,4 +138,12 @@ public class UnionUicRegister { @@ -137,4 +138,12 @@ public class UnionUicRegister {
137 public void setIp(String ip) { 138 public void setIp(String ip) {
138 this.ip = ip == null ? null : ip.trim(); 139 this.ip = ip == null ? null : ip.trim();
139 } 140 }
  141 +
  142 + public String getClientType() {
  143 + return clientType;
  144 + }
  145 +
  146 + public void setClientType(String clientType) {
  147 + this.clientType = clientType;
  148 + }
140 } 149 }
1 package com.yoho.unions.server.mqconsumer; 1 package com.yoho.unions.server.mqconsumer;
2 2
  3 +import com.alibaba.fastjson.JSON;
3 import com.alibaba.fastjson.JSONObject; 4 import com.alibaba.fastjson.JSONObject;
4 import com.yoho.core.rabbitmq.YhConsumer; 5 import com.yoho.core.rabbitmq.YhConsumer;
5 import com.yoho.unions.dal.UnionUicRegisterMapper; 6 import com.yoho.unions.dal.UnionUicRegisterMapper;
6 import com.yoho.unions.dal.model.UnionUicRegister; 7 import com.yoho.unions.dal.model.UnionUicRegister;
  8 +import org.apache.commons.lang3.StringUtils;
7 import org.slf4j.Logger; 9 import org.slf4j.Logger;
8 import org.slf4j.LoggerFactory; 10 import org.slf4j.LoggerFactory;
9 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
@@ -31,13 +33,22 @@ public class UnionUicRegisterConsumer implements YhConsumer { @@ -31,13 +33,22 @@ public class UnionUicRegisterConsumer implements YhConsumer {
31 } 33 }
32 UnionUicRegister register =JSONObject.parseObject(o.toString(),UnionUicRegister.class); 34 UnionUicRegister register =JSONObject.parseObject(o.toString(),UnionUicRegister.class);
33 // RegisterMessageBO jsonObject =JSONObject.parseObject(o.toString(),RegisterMessageBO.class); 35 // RegisterMessageBO jsonObject =JSONObject.parseObject(o.toString(),RegisterMessageBO.class);
34 - if (register != null&&register.getSendCouponStatus().equals("Y")) { 36 + if (register != null&&register.getSendCouponStatus().equals("Y")&&checkClientType(register.getClientType())) {
35 //设备首次注册,记录注册用户 37 //设备首次注册,记录注册用户
36 - logger.info("UnionUicRegisterConsumer,handleMessage sucess.insert {}", register); 38 + logger.info("UnionUicRegisterConsumer,handleMessage sucess.insert {}", JSON.toJSONString(register));
37 unionUicRegisterMapper.insert(register); 39 unionUicRegisterMapper.insert(register);
38 } 40 }
39 } catch (Exception e) { 41 } catch (Exception e) {
40 logger.warn("UnionUicRegisterConsumer,handleMessage fail! obj is {}, e is {}",o,e); 42 logger.warn("UnionUicRegisterConsumer,handleMessage fail! obj is {}, e is {}",o,e);
41 } 43 }
42 } 44 }
  45 +
  46 + private boolean checkClientType(String clientType) {
  47 + if (StringUtils.isNotBlank(clientType) &&
  48 + (clientType.equals("miniapp") || clientType.equals("h5") ||
  49 + clientType.equals("android") || clientType.equals("iphone") )) {
  50 + return true;
  51 + }
  52 + return false;
  53 + }
43 } 54 }
@@ -63,7 +63,7 @@ public class TouTiaoServiceImpl extends UnionServiceImpl implements IUnionServic @@ -63,7 +63,7 @@ public class TouTiaoServiceImpl extends UnionServiceImpl implements IUnionServic
63 try { 63 try {
64 String callbackurl = clickBO.getCallbackurl(); 64 String callbackurl = clickBO.getCallbackurl();
65 if (StringUtils.isBlank(callbackurl)) { 65 if (StringUtils.isBlank(callbackurl)) {
66 - log.warn("TouTiaoServiceImpl.visitCallbackUrl end,callbackurl is null,clickBO is {}.",clickBO); 66 + activeUnion.warn("TouTiaoServiceImpl.visitCallbackUrl end,callbackurl is null,clickBO is {}.",clickBO);
67 return Pair.of(500, "TouTiaoServiceImpl Callback callbackurl异常"); 67 return Pair.of(500, "TouTiaoServiceImpl Callback callbackurl异常");
68 } 68 }
69 url = callbackurl + "&event_type=6";//6: 次留 69 url = callbackurl + "&event_type=6";//6: 次留
@@ -307,7 +307,7 @@ public class UnionServiceImpl implements IUnionService, IBusinessExportService, @@ -307,7 +307,7 @@ public class UnionServiceImpl implements IUnionService, IBusinessExportService,
307 String union_type = oclick.getUnion_type(); 307 String union_type = oclick.getUnion_type();
308 StringBuffer buffer = new StringBuffer(); 308 StringBuffer buffer = new StringBuffer();
309 UnionTypeMatch unionTypeMatch = unionTypeMatchDAO.selectByPrimaryKey(Long.valueOf(union_type)); 309 UnionTypeMatch unionTypeMatch = unionTypeMatchDAO.selectByPrimaryKey(Long.valueOf(union_type));
310 - if(unionTypeMatch!=null && org.apache.commons.lang.StringUtils.isNotEmpty(String.valueOf(unionTypeMatch.getUnionTypeMatch()))){ 310 + if (unionTypeMatch != null && unionTypeMatch.getUnionTypeMatch() != null && unionTypeMatch.getUnionTypeMatch() >0L) {
311 union_type = String.valueOf(unionTypeMatch.getUnionTypeMatch()); 311 union_type = String.valueOf(unionTypeMatch.getUnionTypeMatch());
312 } 312 }
313 String bean =buffer.append("UnionServiceImpl").append("_").append(union_type).toString(); 313 String bean =buffer.append("UnionServiceImpl").append("_").append(union_type).toString();