|
|
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&®ister.getSendCouponStatus().equals("Y")) {
|
|
|
if (register != null&®ister.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;
|
|
|
}
|
|
|
} |
...
|
...
|
|