|
@@ -2,6 +2,7 @@ package com.yohobuy.platform.operations.service.impl; |
|
@@ -2,6 +2,7 @@ package com.yohobuy.platform.operations.service.impl; |
2
|
|
2
|
|
3
|
import com.alibaba.fastjson.JSON;
|
3
|
import com.alibaba.fastjson.JSON;
|
4
|
import com.google.common.collect.Lists;
|
4
|
import com.google.common.collect.Lists;
|
|
|
5
|
+import com.yoho.tools.common.beans.Response;
|
5
|
import com.yohobuy.platform.common.convert.BeanConvert;
|
6
|
import com.yohobuy.platform.common.convert.BeanConvert;
|
6
|
import com.yohobuy.platform.common.convert.Convert;
|
7
|
import com.yohobuy.platform.common.convert.Convert;
|
7
|
import com.yohobuy.platform.common.error.ErrorCode;
|
8
|
import com.yohobuy.platform.common.error.ErrorCode;
|
|
@@ -31,6 +32,7 @@ import com.yohobuy.platform.operations.convert.ActivtyTemplatedFloorConvert; |
|
@@ -31,6 +32,7 @@ import com.yohobuy.platform.operations.convert.ActivtyTemplatedFloorConvert; |
31
|
import com.yohobuy.platform.operations.helper.ActTempFloorHelper;
|
32
|
import com.yohobuy.platform.operations.helper.ActTempFloorHelper;
|
32
|
import com.yohobuy.platform.operations.helper.ActivityTemplatedFloorDetailHelper;
|
33
|
import com.yohobuy.platform.operations.helper.ActivityTemplatedFloorDetailHelper;
|
33
|
import com.yohobuy.platform.operations.model.ActivtyTemplatedVo;
|
34
|
import com.yohobuy.platform.operations.model.ActivtyTemplatedVo;
|
|
|
35
|
+import com.yohobuy.platform.operations.model.FreshCdnUrlBO;
|
34
|
import com.yohobuy.platform.operations.service.check.ActivtyTemplatedCheckService;
|
36
|
import com.yohobuy.platform.operations.service.check.ActivtyTemplatedCheckService;
|
35
|
import com.yohobuy.platform.operations.service.check.WebShareCheckService;
|
37
|
import com.yohobuy.platform.operations.service.check.WebShareCheckService;
|
36
|
import org.apache.commons.collections.CollectionUtils;
|
38
|
import org.apache.commons.collections.CollectionUtils;
|
|
@@ -41,9 +43,12 @@ import org.slf4j.LoggerFactory; |
|
@@ -41,9 +43,12 @@ import org.slf4j.LoggerFactory; |
41
|
import org.springframework.beans.factory.annotation.Autowired;
|
43
|
import org.springframework.beans.factory.annotation.Autowired;
|
42
|
import org.springframework.beans.factory.annotation.Value;
|
44
|
import org.springframework.beans.factory.annotation.Value;
|
43
|
import org.springframework.stereotype.Service;
|
45
|
import org.springframework.stereotype.Service;
|
|
|
46
|
+import org.springframework.web.client.RestTemplate;
|
44
|
|
47
|
|
|
|
48
|
+import javax.annotation.Resource;
|
45
|
import java.util.ArrayList;
|
49
|
import java.util.ArrayList;
|
46
|
import java.util.List;
|
50
|
import java.util.List;
|
|
|
51
|
+import java.util.Map;
|
47
|
import java.util.Optional;
|
52
|
import java.util.Optional;
|
48
|
|
53
|
|
49
|
/**
|
54
|
/**
|
|
@@ -86,7 +91,8 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo> |
|
@@ -86,7 +91,8 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo> |
86
|
|
91
|
|
87
|
@Value("${activity.url:http://activity.yoho.cn/feature/}")
|
92
|
@Value("${activity.url:http://activity.yoho.cn/feature/}")
|
88
|
private String activityUrl;
|
93
|
private String activityUrl;
|
89
|
-
|
94
|
+ @Resource(name="restTemplate")
|
|
|
95
|
+ RestTemplate restTemplate;
|
90
|
|
96
|
|
91
|
@Override
|
97
|
@Override
|
92
|
public int add(ActivtyTemplatedBo bo) throws PlatformException {
|
98
|
public int add(ActivtyTemplatedBo bo) throws PlatformException {
|
|
@@ -557,6 +563,23 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo> |
|
@@ -557,6 +563,23 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo> |
557
|
if (CollectionUtils.isNotEmpty(atftList)){
|
563
|
if (CollectionUtils.isNotEmpty(atftList)){
|
558
|
atftMapper.insertBatch(atftList);
|
564
|
atftMapper.insertBatch(atftList);
|
559
|
}
|
565
|
}
|
|
|
566
|
+ //调用接口刷新CDN
|
|
|
567
|
+ logger.info("ActivtyTemplatedService :: upateActivityTemplate fresh cdn begin");
|
|
|
568
|
+ String url = "https://activity.yoho.cn/feature/"+bo.getId()+".html";
|
|
|
569
|
+ FreshCdnUrlBO freshCdnUrlBO = new FreshCdnUrlBO();
|
|
|
570
|
+ freshCdnUrlBO.setUrl(url);
|
|
|
571
|
+ logger.info("ActivtyTemplatedService :: upateActivityTemplate fresh cdn begin url is {}, auth_code is {}", url, freshCdnUrlBO.getAuth_code());
|
|
|
572
|
+ try{
|
|
|
573
|
+ Response<Object> resp = restTemplate.postForObject("/service/account/v1/Profile/getMenuByPid", freshCdnUrlBO, Response.class);
|
|
|
574
|
+ if (resp.getCode() == 200){
|
|
|
575
|
+ logger.info("ActivtyTemplatedService :: upateActivityTemplate fresh cdn success");
|
|
|
576
|
+ }else {
|
|
|
577
|
+ logger.error("ActivtyTemplatedService :: upateActivityTemplate fresh cdn error, code is {},message is {}, date is {}",resp.getCode(),resp.getMessage(),resp.getData());
|
|
|
578
|
+ }
|
|
|
579
|
+ }catch (Exception e){
|
|
|
580
|
+ logger.error("ActivtyTemplatedService :: upateActivityTemplate fresh cdn error, error is {}", e);
|
|
|
581
|
+ }
|
|
|
582
|
+
|
560
|
}
|
583
|
}
|
561
|
|
584
|
|
562
|
/**
|
585
|
/**
|