...
|
...
|
@@ -519,6 +519,8 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo> |
|
|
activtyTemplated.setUpdateTime(DateUtil.getCurrentTimeSeconds());
|
|
|
activtyTemplated.setUpdateUser(this.buildOperatorInfo(bo.getUserInfoResponseBO()));
|
|
|
activtyTemplatedMapper.updateByPrimaryKeySelective(activtyTemplated);
|
|
|
//判断该模板是否是首次添加内容
|
|
|
List<ActivtyTemplatedFloor> floorList = atfMapper.selectByTemplatedId(bo.getTemplateId());
|
|
|
//2.根据模板ID依次删除除主表外其他表的相关数据,activty_templated_floor,activty_templated_floor_detail,activty_templated_floor_table
|
|
|
atfMapper.deleteByTempId(bo.getTemplateId());
|
|
|
atftMapper.deleteByTempId(bo.getTemplateId());
|
...
|
...
|
@@ -563,12 +565,25 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo> |
|
|
if (CollectionUtils.isNotEmpty(atftList)){
|
|
|
atftMapper.insertBatch(atftList);
|
|
|
}
|
|
|
//调用接口刷新CDN
|
|
|
logger.info("ActivtyTemplatedService :: upateActivityTemplate fresh cdn begin");
|
|
|
String url = "https://activity.yoho.cn/feature/"+bo.getId()+".html";
|
|
|
FreshCdnUrlBO freshCdnUrlBO = new FreshCdnUrlBO();
|
|
|
if (floorList.size() <= 0 && bo.isPushCdn()){
|
|
|
//首次添加 调用接口预热CDN
|
|
|
logger.info("ActivtyTemplatedService :: upateActivityTemplate warm_up cdn begin");
|
|
|
freshCdnUrlBO.setRequest_type("warm_up");
|
|
|
warmAndFresh(bo, freshCdnUrlBO);
|
|
|
}else if (floorList.size() > 0 ){
|
|
|
//修改 调用接口刷新CDN
|
|
|
logger.info("ActivtyTemplatedService :: upateActivityTemplate refresh cdn begin");
|
|
|
freshCdnUrlBO.setRequest_type("refresh");
|
|
|
warmAndFresh(bo, freshCdnUrlBO);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private void warmAndFresh(ActivtyTemplatedBo bo, FreshCdnUrlBO freshCdnUrlBO) {
|
|
|
|
|
|
String url = "https://activity.yoho.cn/feature/"+bo.getId()+".html";
|
|
|
freshCdnUrlBO.setUrl(url);
|
|
|
logger.info("ActivtyTemplatedService :: upateActivityTemplate fresh cdn begin url is {}, auth_code is {}", url, freshCdnUrlBO.getAuth_code());
|
|
|
logger.info("ActivtyTemplatedService :: upateActivityTemplate fresh cdn begin url is {},auth_code is {}, type is {}", url, freshCdnUrlBO.getAuth_code(), freshCdnUrlBO.getRequest_type());
|
|
|
try{
|
|
|
Response<Object> resp = restTemplate.postForObject("http://ops-apigateway.yohops.com/release/cdn/refresh", freshCdnUrlBO, Response.class);
|
|
|
if (resp.getCode() == 200){
|
...
|
...
|
@@ -579,7 +594,6 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo> |
|
|
}catch (Exception e){
|
|
|
logger.error("ActivtyTemplatedService :: upateActivityTemplate fresh cdn error, error is {}", e);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
...
|
...
|
|