|
|
package com.yoho.ufo.service.impl;
|
|
|
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Map.Entry;
|
|
|
import java.util.Set;
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import org.apache.commons.collections.CollectionUtils;
|
...
|
...
|
@@ -14,10 +16,12 @@ import org.slf4j.helpers.MessageFormatter; |
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
|
import com.google.common.collect.Sets;
|
|
|
import com.yoho.core.common.utils.DateUtil;
|
|
|
import com.yoho.core.rest.client.ServiceCaller;
|
|
|
import com.yoho.product.dal.SelfSizeMapper;
|
|
|
import com.yoho.product.dal.SelfSizeUidMapper;
|
|
|
import com.yoho.product.model.SelfSize;
|
...
|
...
|
@@ -72,6 +76,9 @@ public class SelfSizeServiceImpl implements ISelfSizeService { |
|
|
@Autowired
|
|
|
private UserProxyService userProxyService;
|
|
|
|
|
|
@Autowired
|
|
|
private ServiceCaller serviceCaller;
|
|
|
|
|
|
@Override
|
|
|
public PageResponseBO<SelfSizeRsp> queryList(SelfSizeReq req){
|
|
|
int total = selfSizeMapper.selectTotalByCondition(req);
|
...
|
...
|
@@ -217,6 +224,9 @@ public class SelfSizeServiceImpl implements ISelfSizeService { |
|
|
// }
|
|
|
UserHelper userInfo = new UserHelper();
|
|
|
int num = selfSizeMapper.upadteAuditResult(req.getId(), req.getStatus(), userInfo.getUserId());
|
|
|
//清商品详情缓存
|
|
|
clearProductDetailCache(selfSize.getProductId());
|
|
|
|
|
|
if(num > 0 && req.getStatus().intValue() == 1) {//审核通过
|
|
|
Product product = productMapper.selectByPrimaryKey(selfSize.getProductId());
|
|
|
Size size = ufoSizeMapper.selectOneById(selfSize.getSizeId());
|
...
|
...
|
@@ -239,6 +249,15 @@ public class SelfSizeServiceImpl implements ISelfSizeService { |
|
|
return num;
|
|
|
}
|
|
|
|
|
|
private JSONObject clearProductDetailCache(Integer productId) {
|
|
|
String args = "ufo-gateway.clearProductDetailCache";
|
|
|
LOGGER.info("asyncCallClearCache call ufo-gateway enter productId is {}, interface is {}", productId, args);
|
|
|
Map<String,Integer> request = Collections.singletonMap("id", productId);
|
|
|
JSONObject jsonObject = serviceCaller.asyncCall(args, request, JSONObject.class).get(5, TimeUnit.SECONDS);
|
|
|
LOGGER.info("asyncCallClearCache call ufo-gateway productId is {}, interface is {},result is {}", productId, args, jsonObject);
|
|
|
return jsonObject;
|
|
|
}
|
|
|
|
|
|
private String getReplacedContent(String content ,Object... params) {
|
|
|
return MessageFormatter.arrayFormat(content, params).getMessage();
|
|
|
}
|
...
|
...
|
|