|
|
package com.yohobuy.platform.grass.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.yoho.core.rest.client.ServiceCaller;
|
|
|
import com.yohobuy.platform.common.util.MapUtil;
|
|
|
import com.yohobuy.platform.grass.service.IGrassRefreshCacheService;
|
|
|
import com.yohobuy.platform.model.grass.request.GrassCacheReq;
|
|
|
import org.apache.commons.collections4.MapUtils;
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Executors;
|
|
|
|
...
|
...
|
@@ -42,21 +38,25 @@ public class GrassRefreshCacheServiceImpl implements IGrassRefreshCacheService{ |
|
|
}
|
|
|
logger.info("refreshGrassCache: param is {}", reqVO);
|
|
|
executorService.execute(() -> {
|
|
|
Map<String, Object> reqMap = new HashMap<>();
|
|
|
reqMap.put("elementId",reqVO.getElementId());
|
|
|
reqMap.put("clearCode",reqVO.getClearCode());
|
|
|
reqMap.put("uid",reqVO.getUid());
|
|
|
reqMap.put("topicId",reqVO.getTopicId());
|
|
|
reqMap.put("topicIdList",reqVO.getTopicIdList());
|
|
|
String elementId = reqVO.getElementId();
|
|
|
int clearCode = reqVO.getClearCode();
|
|
|
int uid = reqVO.getUid();
|
|
|
Integer topicId = reqVO.getTopicId() ;
|
|
|
List<String> topicList = reqVO.getTopicIdList();
|
|
|
try{
|
|
|
String url = apiUrl + "?method=clear.grass.cache";
|
|
|
|
|
|
// String url = apiUrl + "?method=clear.grass.cache&elementId=" + elementId + "&clearCode=" + clearCode + "&uid=" + uid+"&userType=" +reqVO.getUserType();
|
|
|
// if(topicId != null){
|
|
|
// url += "&topicId=" + topicId;
|
|
|
// }
|
|
|
logger.info("before refreshGrassCache, url is: {}, reqVo is {}", url, reqVO);
|
|
|
serviceCaller.get("app.clearGrassCache", url, reqMap, String.class, null);
|
|
|
StringBuilder url = new StringBuilder(apiUrl + "?method=clear.grass.cache&elementId=" + elementId + "&clearCode=" + clearCode + "&uid=" + uid + "&userType=" + reqVO.getUserType());
|
|
|
|
|
|
if(topicId != null){
|
|
|
url.append("&topicId=").append(topicId);
|
|
|
}
|
|
|
if(CollectionUtils.isNotEmpty(topicList)){
|
|
|
for (String s : topicList) {
|
|
|
url.append("&topicIdList=").append(s);
|
|
|
}
|
|
|
}
|
|
|
logger.info("before refreshGrassCache, url is: {}, reqVo is {}", url.toString(), reqVO);
|
|
|
serviceCaller.get("app.clearGrassCache", url.toString(), null, String.class, null);
|
|
|
}catch (Exception e){
|
|
|
logger.info("failed refreshGrassCache, reqVo is {}, error is {}", reqVO, e);
|
|
|
}
|
...
|
...
|
|