1
|
package com.yoho.ufo.service.impl;
|
1
|
package com.yoho.ufo.service.impl;
|
2
|
|
2
|
|
|
|
3
|
+import java.util.Collections;
|
3
|
import java.util.List;
|
4
|
import java.util.List;
|
4
|
import java.util.Map;
|
5
|
import java.util.Map;
|
5
|
import java.util.Map.Entry;
|
6
|
import java.util.Map.Entry;
|
6
|
import java.util.Set;
|
7
|
import java.util.Set;
|
|
|
8
|
+import java.util.concurrent.TimeUnit;
|
7
|
import java.util.stream.Collectors;
|
9
|
import java.util.stream.Collectors;
|
8
|
|
10
|
|
9
|
import org.apache.commons.collections.CollectionUtils;
|
11
|
import org.apache.commons.collections.CollectionUtils;
|
|
@@ -14,10 +16,12 @@ import org.slf4j.helpers.MessageFormatter; |
|
@@ -14,10 +16,12 @@ import org.slf4j.helpers.MessageFormatter; |
14
|
import org.springframework.beans.factory.annotation.Autowired;
|
16
|
import org.springframework.beans.factory.annotation.Autowired;
|
15
|
import org.springframework.stereotype.Service;
|
17
|
import org.springframework.stereotype.Service;
|
16
|
|
18
|
|
|
|
19
|
+import com.alibaba.fastjson.JSONObject;
|
17
|
import com.google.common.collect.Lists;
|
20
|
import com.google.common.collect.Lists;
|
18
|
import com.google.common.collect.Maps;
|
21
|
import com.google.common.collect.Maps;
|
19
|
import com.google.common.collect.Sets;
|
22
|
import com.google.common.collect.Sets;
|
20
|
import com.yoho.core.common.utils.DateUtil;
|
23
|
import com.yoho.core.common.utils.DateUtil;
|
|
|
24
|
+import com.yoho.core.rest.client.ServiceCaller;
|
21
|
import com.yoho.product.dal.SelfSizeMapper;
|
25
|
import com.yoho.product.dal.SelfSizeMapper;
|
22
|
import com.yoho.product.dal.SelfSizeUidMapper;
|
26
|
import com.yoho.product.dal.SelfSizeUidMapper;
|
23
|
import com.yoho.product.model.SelfSize;
|
27
|
import com.yoho.product.model.SelfSize;
|
|
@@ -72,6 +76,9 @@ public class SelfSizeServiceImpl implements ISelfSizeService { |
|
@@ -72,6 +76,9 @@ public class SelfSizeServiceImpl implements ISelfSizeService { |
72
|
@Autowired
|
76
|
@Autowired
|
73
|
private UserProxyService userProxyService;
|
77
|
private UserProxyService userProxyService;
|
74
|
|
78
|
|
|
|
79
|
+ @Autowired
|
|
|
80
|
+ private ServiceCaller serviceCaller;
|
|
|
81
|
+
|
75
|
@Override
|
82
|
@Override
|
76
|
public PageResponseBO<SelfSizeRsp> queryList(SelfSizeReq req){
|
83
|
public PageResponseBO<SelfSizeRsp> queryList(SelfSizeReq req){
|
77
|
int total = selfSizeMapper.selectTotalByCondition(req);
|
84
|
int total = selfSizeMapper.selectTotalByCondition(req);
|
|
@@ -217,6 +224,9 @@ public class SelfSizeServiceImpl implements ISelfSizeService { |
|
@@ -217,6 +224,9 @@ public class SelfSizeServiceImpl implements ISelfSizeService { |
217
|
// }
|
224
|
// }
|
218
|
UserHelper userInfo = new UserHelper();
|
225
|
UserHelper userInfo = new UserHelper();
|
219
|
int num = selfSizeMapper.upadteAuditResult(req.getId(), req.getStatus(), userInfo.getUserId());
|
226
|
int num = selfSizeMapper.upadteAuditResult(req.getId(), req.getStatus(), userInfo.getUserId());
|
|
|
227
|
+ //清商品详情缓存
|
|
|
228
|
+ clearProductDetailCache(selfSize.getProductId());
|
|
|
229
|
+
|
220
|
if(num > 0 && req.getStatus().intValue() == 1) {//审核通过
|
230
|
if(num > 0 && req.getStatus().intValue() == 1) {//审核通过
|
221
|
Product product = productMapper.selectByPrimaryKey(selfSize.getProductId());
|
231
|
Product product = productMapper.selectByPrimaryKey(selfSize.getProductId());
|
222
|
Size size = ufoSizeMapper.selectOneById(selfSize.getSizeId());
|
232
|
Size size = ufoSizeMapper.selectOneById(selfSize.getSizeId());
|
|
@@ -239,6 +249,15 @@ public class SelfSizeServiceImpl implements ISelfSizeService { |
|
@@ -239,6 +249,15 @@ public class SelfSizeServiceImpl implements ISelfSizeService { |
239
|
return num;
|
249
|
return num;
|
240
|
}
|
250
|
}
|
241
|
|
251
|
|
|
|
252
|
+ private JSONObject clearProductDetailCache(Integer productId) {
|
|
|
253
|
+ String args = "ufo-gateway.clearProductDetailCache";
|
|
|
254
|
+ LOGGER.info("asyncCallClearCache call ufo-gateway enter productId is {}, interface is {}", productId, args);
|
|
|
255
|
+ Map<String,Integer> request = Collections.singletonMap("id", productId);
|
|
|
256
|
+ JSONObject jsonObject = serviceCaller.asyncCall(args, request, JSONObject.class).get(5, TimeUnit.SECONDS);
|
|
|
257
|
+ LOGGER.info("asyncCallClearCache call ufo-gateway productId is {}, interface is {},result is {}", productId, args, jsonObject);
|
|
|
258
|
+ return jsonObject;
|
|
|
259
|
+ }
|
|
|
260
|
+
|
242
|
private String getReplacedContent(String content ,Object... params) {
|
261
|
private String getReplacedContent(String content ,Object... params) {
|
243
|
return MessageFormatter.arrayFormat(content, params).getMessage();
|
262
|
return MessageFormatter.arrayFormat(content, params).getMessage();
|
244
|
}
|
263
|
}
|