Authored by zhaoqing

添加默认模板

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