Authored by zhaoqing

添加默认模板

... ... @@ -171,6 +171,10 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo>
activtyTemplated.setUpdateTime(currentTime);
int tempCnt = activtyTemplatedMapper.insertSelective(activtyTemplated);
bo.setId(activtyTemplated.getId());
//添加活动的同时添加默认模板
if (tempCnt > 0){
addDefaultTemplate(activtyTemplated.getId());
}
//feed back activity-templated's id to bind web-share
if (isNotSideBarMode && tempCnt>0 && this.needGenerateShareUrl(bo.getWebShare())){
logService.recordLog(bo.getId(), LogActionType.add, JSON.toJSONString(bo),bo.getUserInfoResponseBO());
... ... @@ -179,6 +183,16 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo>
return tempCnt;
}
public void addDefaultTemplate(Integer activityId){
ActivtyTemplateLink activtyTemplateLink = new ActivtyTemplateLink();
activtyTemplateLink.setActivityId(activityId);
activtyTemplateLink.setShowTime(DateUtil.getCurrentTimeSeconds());
activtyTemplateLink.setTemplateName("默认模板");
activtyTemplateLink.setIsDefault(1);
activtyTemplateLink.setCreateTime(DateUtil.getCurrentTimeSeconds());
activityTemplateLinkMapper.insertActivityTemplateLink(activtyTemplateLink);
}
private boolean needGenerateShareUrl(WebShareBO webShareBO){
Optional<WebShareBO> webShareBOOptional = Optional.ofNullable(webShareBO);
return !webShareBOOptional.isPresent()
... ...