Authored by liangyi.chen@yoho.cn

Fix Es Bug

1 package com.yoho.datasync.consumer.handler.listener.community; 1 package com.yoho.datasync.consumer.handler.listener.community;
2 2
3 -import com.alibaba.fastjson.JSON; 3 +import com.alibaba.fastjson.JSONObject;
4 import com.yoho.datasync.consumer.common.EventEnum; 4 import com.yoho.datasync.consumer.common.EventEnum;
5 import com.yoho.datasync.consumer.common.IndexConstant; 5 import com.yoho.datasync.consumer.common.IndexConstant;
6 import com.yoho.datasync.consumer.handler.config.ConfigReaderUtil; 6 import com.yoho.datasync.consumer.handler.config.ConfigReaderUtil;
@@ -47,7 +47,12 @@ public class UserInfoListener extends AbstractMqListener<UserInfo> { @@ -47,7 +47,12 @@ public class UserInfoListener extends AbstractMqListener<UserInfo> {
47 boolean syncFlag = configReaderUtil.getBoolean("sync.es.flag", false); 47 boolean syncFlag = configReaderUtil.getBoolean("sync.es.flag", false);
48 if(syncFlag){ 48 if(syncFlag){
49 //更新用户信息索引到ES 添加到队列中 49 //更新用户信息索引到ES 添加到队列中
50 - ESBluk esBluk = new ESBluk(JSON.toJSONString(userInfo),String.valueOf(userInfo.getYohoUid()), 50 + JSONObject userInfoJson = new JSONObject();
  51 + userInfoJson.put("nick_name",userInfo.getNickName());
  52 + userInfoJson.put("gender",userInfo.getGender());
  53 + userInfoJson.put("head_ico",userInfo.getHeadIco());
  54 + userInfoJson.put("yoho_uid",userInfo.getYohoUid());
  55 + ESBluk esBluk = new ESBluk(userInfoJson.toJSONString(),String.valueOf(userInfo.getYohoUid()),
51 IndexConstant.INDEX_NAME.GRASS,IndexConstant.INDEX_TYPE.USER_INFO,false); 56 IndexConstant.INDEX_NAME.GRASS,IndexConstant.INDEX_TYPE.USER_INFO,false);
52 esUpdateProcess.add(esBluk); 57 esUpdateProcess.add(esBluk);
53 logger.info("add userInfo data to queue for sync to es"); 58 logger.info("add userInfo data to queue for sync to es");