|
|
package com.yoho.search.recall.scene.beans.persional;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yoho.core.rest.client.ServiceCaller;
|
|
|
import com.yoho.search.core.personalized.models.SortPriceArea;
|
|
|
import com.yoho.search.core.personalized.models.UserPersonalFactorReq;
|
|
|
import com.yoho.search.core.personalized.models.UserPersonalFactorRsp;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
...
|
...
|
@@ -16,12 +21,10 @@ class UserPersionalFactorComponent { |
|
|
|
|
|
private static final Logger RECALL_NEW_LOGGER = LoggerFactory.getLogger("RECALL");
|
|
|
|
|
|
// @Autowired
|
|
|
// private ServiceCaller serviceCaller;
|
|
|
@Autowired
|
|
|
private ServiceCaller serviceCaller;
|
|
|
|
|
|
//serviceCaller.asyncCall("message.publishIosUser", iosTokenBO, Integer.class);
|
|
|
|
|
|
private static final String SERVICE_NAME = "bigdata.userPersionalFactorRsp";
|
|
|
private static final String SERVICE_NAME = "bigdata.searchPersonalFactors";
|
|
|
private static final int timeOut = 100;
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -51,21 +54,20 @@ class UserPersionalFactorComponent { |
|
|
}
|
|
|
|
|
|
private UserPersonalFactorRsp queryUserPersionalFactorRsp(int uid, String udid){
|
|
|
// try {
|
|
|
// UserPersonalFactorReq userPersionalFactorReq = new UserPersonalFactorReq(uid,udid);
|
|
|
// JSONObject result = serviceCaller.call(SERVICE_NAME,userPersionalFactorReq,JSONObject.class,timeOut);
|
|
|
// RECALL_NEW_LOGGER.info("UserPersionalFactorComponent.result is[{}]",result.toJSONString());
|
|
|
// JSONObject userPersonalFactorRspJSon = result.getJSONObject("data");
|
|
|
// UserPersonalFactorRsp rsp = JSON.toJavaObject(userPersonalFactorRspJSon,UserPersonalFactorRsp.class);
|
|
|
// if(rsp==null ||rsp.getBrandIds()==null || rsp.getSortPriceAreas()==null){
|
|
|
// RECALL_NEW_LOGGER.error("query bigdata fail, result is [{}]",result.toJSONString());
|
|
|
// return null;
|
|
|
// }
|
|
|
// return rsp;
|
|
|
// }catch (Exception e){
|
|
|
// logger.error(e.getMessage(),e);
|
|
|
// return null;
|
|
|
// }
|
|
|
return null;
|
|
|
try {
|
|
|
UserPersonalFactorReq userPersionalFactorReq = new UserPersonalFactorReq(uid,udid);
|
|
|
JSONObject result = serviceCaller.call(SERVICE_NAME,userPersionalFactorReq,JSONObject.class,timeOut);
|
|
|
RECALL_NEW_LOGGER.info("UserPersionalFactorComponent.result is[{}]",result.toJSONString());
|
|
|
JSONObject userPersonalFactorRspJSon = result.getJSONObject("data");
|
|
|
UserPersonalFactorRsp rsp = JSON.toJavaObject(userPersonalFactorRspJSon,UserPersonalFactorRsp.class);
|
|
|
if(rsp==null ||rsp.getBrandIds()==null || rsp.getSortPriceAreas()==null){
|
|
|
RECALL_NEW_LOGGER.error("query bigdata fail, result is [{}]",result.toJSONString());
|
|
|
return null;
|
|
|
}
|
|
|
return rsp;
|
|
|
}catch (Exception e){
|
|
|
logger.error(e.getMessage(),e);
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
} |
...
|
...
|
|