Authored by Ge

update

package com.yoho.unions.server.service.impl;
import com.yoho.service.model.union.request.ActivateUnionRequestBO;
import com.yoho.service.model.union.request.ClickUnionRequestBO;
import com.yoho.unions.server.service.IUnionService;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.net.URLDecoder;
/**
* 汇川对接
* Created by zhengwen.ge on 2017/9/21.
*/
@Service("UnionServiceImpl_6")
public class HuiChuanServiceImpl extends UnionServiceImpl implements IUnionService {
static Logger log = LoggerFactory.getLogger(HuiChuanServiceImpl.class);
public ClickUnionRequestBO clickHttpRequestTOBO(HttpServletRequest request, ClickUnionRequestBO bo){
bo = new ClickUnionRequestBO();
String idfa = request.getParameter("IDFA_SUM");
String imei = request.getParameter("IMEI_SUM");
bo.setIdfa(idfa);
bo.setImei(imei);
bo.setUnion_type(request.getParameter("UNION_TYPE"));
String callBackUrl = request.getParameter("CALLBACK_URL");
bo.setCallbackurl(callBackUrl);
log.info("HuiChuan request is {}",bo);
return bo;
}
@Override
public String getCallbackUrl(ClickUnionRequestBO clickBO, ActivateUnionRequestBO activateUnionRequestBO) {
try{
if(null!=clickBO.getCallbackurl()){
String url = URLDecoder.decode(clickBO.getCallbackurl(),"UTF-8");
return url;
}
}catch (Exception e){
log.warn("getCallbackUrl exception is {}",e.getMessage());
}
return null;
}
}
... ...
... ... @@ -302,6 +302,14 @@ public class UnionServiceImpl implements IUnionService,ApplicationEventPublisher
}
value = yhValueOperations.get(key);
}
if(StringUtils.isEmpty(value)){
if (ClientTypeEnum.IOS.getName().equals(request.getClient_type())) {
key = UNION_KEY + "_" + MD5.md5(request.getIdfa().toUpperCase()).toUpperCase() + "_" + request.getAppkey();
} else if (ClientTypeEnum.ANDROID.getName().equals(request.getClient_type())) {
key = UNION_KEY + "_" + MD5.md5(request.getImei().toUpperCase()).toUpperCase() + "_" + request.getAppkey();
}
value = yhValueOperations.get(key);
}
}
activeUnion.info("activateUnion with get redis first with key={}, value={}", key, value);
... ...