Authored by gemingdan

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

... ... @@ -7,6 +7,7 @@ public class UnionUicRegister {
private String mobile;
private String businessLine;
private String clientType;
private String udid;
... ... @@ -137,4 +138,12 @@ public class UnionUicRegister {
public void setIp(String ip) {
this.ip = ip == null ? null : ip.trim();
}
public String getClientType() {
return clientType;
}
public void setClientType(String clientType) {
this.clientType = clientType;
}
}
\ No newline at end of file
... ...
package com.yoho.unions.server.mqconsumer;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.rabbitmq.YhConsumer;
import com.yoho.unions.dal.UnionUicRegisterMapper;
import com.yoho.unions.dal.model.UnionUicRegister;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -31,13 +33,22 @@ public class UnionUicRegisterConsumer implements YhConsumer {
}
UnionUicRegister register =JSONObject.parseObject(o.toString(),UnionUicRegister.class);
// RegisterMessageBO jsonObject =JSONObject.parseObject(o.toString(),RegisterMessageBO.class);
if (register != null&&register.getSendCouponStatus().equals("Y")) {
if (register != null&&register.getSendCouponStatus().equals("Y")&&checkClientType(register.getClientType())) {
//设备首次注册,记录注册用户
logger.info("UnionUicRegisterConsumer,handleMessage sucess.insert {}", register);
logger.info("UnionUicRegisterConsumer,handleMessage sucess.insert {}", JSON.toJSONString(register));
unionUicRegisterMapper.insert(register);
}
} catch (Exception e) {
logger.warn("UnionUicRegisterConsumer,handleMessage fail! obj is {}, e is {}",o,e);
}
}
private boolean checkClientType(String clientType) {
if (StringUtils.isNotBlank(clientType) &&
(clientType.equals("miniapp") || clientType.equals("h5") ||
clientType.equals("android") || clientType.equals("iphone") )) {
return true;
}
return false;
}
}
... ...
... ... @@ -63,7 +63,7 @@ public class TouTiaoServiceImpl extends UnionServiceImpl implements IUnionServic
try {
String callbackurl = clickBO.getCallbackurl();
if (StringUtils.isBlank(callbackurl)) {
log.warn("TouTiaoServiceImpl.visitCallbackUrl end,callbackurl is null,clickBO is {}.",clickBO);
activeUnion.warn("TouTiaoServiceImpl.visitCallbackUrl end,callbackurl is null,clickBO is {}.",clickBO);
return Pair.of(500, "TouTiaoServiceImpl Callback callbackurl异常");
}
url = callbackurl + "&event_type=6";//6: 次留
... ...
... ... @@ -307,7 +307,7 @@ public class UnionServiceImpl implements IUnionService, IBusinessExportService,
String union_type = oclick.getUnion_type();
StringBuffer buffer = new StringBuffer();
UnionTypeMatch unionTypeMatch = unionTypeMatchDAO.selectByPrimaryKey(Long.valueOf(union_type));
if(unionTypeMatch!=null && org.apache.commons.lang.StringUtils.isNotEmpty(String.valueOf(unionTypeMatch.getUnionTypeMatch()))){
if (unionTypeMatch != null && unionTypeMatch.getUnionTypeMatch() != null && unionTypeMatch.getUnionTypeMatch() >0L) {
union_type = String.valueOf(unionTypeMatch.getUnionTypeMatch());
}
String bean =buffer.append("UnionServiceImpl").append("_").append(union_type).toString();
... ...