Authored by wangshusheng

Merge branch 'test6.8.5' into gray

Conflicts:
	pom.xml
@@ -32,7 +32,7 @@ public final class ActivityTemplatedFloorDetailHelper { @@ -32,7 +32,7 @@ public final class ActivityTemplatedFloorDetailHelper {
32 private static Logger logger = LoggerFactory.getLogger(ActivityTemplatedFloorDetailHelper.class); 32 private static Logger logger = LoggerFactory.getLogger(ActivityTemplatedFloorDetailHelper.class);
33 33
34 public static Set<Integer> paramTypeIntSet = Sets.newHashSet(TempCompParamType.number.getIntVal(), 34 public static Set<Integer> paramTypeIntSet = Sets.newHashSet(TempCompParamType.number.getIntVal(),
35 - TempCompParamType.string.getIntVal(),TempCompParamType.image.getIntVal(),TempCompParamType.date.getIntVal()); 35 + TempCompParamType.string.getIntVal(),TempCompParamType.image.getIntVal(),TempCompParamType.date.getIntVal(),TempCompParamType.text.getIntVal());
36 36
37 37
38 private static final Convert convert = new BeanConvert(); 38 private static final Convert convert = new BeanConvert();
@@ -6,6 +6,7 @@ import com.yohobuy.platform.model.common.api.BizObjName; @@ -6,6 +6,7 @@ import com.yohobuy.platform.model.common.api.BizObjName;
6 import com.yohobuy.platform.model.common.api.Message; 6 import com.yohobuy.platform.model.common.api.Message;
7 import com.yohobuy.platform.model.common.api.OperationName; 7 import com.yohobuy.platform.model.common.api.OperationName;
8 import com.yohobuy.platform.model.operations.ActivtyTemplatedBo; 8 import com.yohobuy.platform.model.operations.ActivtyTemplatedBo;
  9 +import com.yohobuy.platform.model.operations.request.ActivityTemplateLinkBo;
9 import com.yohobuy.platform.model.operations.request.ActivityTemplatedPageBo; 10 import com.yohobuy.platform.model.operations.request.ActivityTemplatedPageBo;
10 import com.yohobuy.platform.operations.model.ActivtyTemplatedVo; 11 import com.yohobuy.platform.operations.model.ActivtyTemplatedVo;
11 import com.yohobuy.platform.operations.service.impl.ActivtyTemplatedService; 12 import com.yohobuy.platform.operations.service.impl.ActivtyTemplatedService;
@@ -72,6 +73,50 @@ public class ActivtyTemplatedController extends BasicController{ @@ -72,6 +73,50 @@ public class ActivtyTemplatedController extends BasicController{
72 } 73 }
73 } 74 }
74 75
  76 + /**
  77 + * 添加活动与模板的关联关系
  78 + * @param req
  79 + * @return
  80 + */
  81 + @RequestMapping(value = "/addActivityTemplateLink")
  82 + @ResponseBody
  83 + public ApiResponse addActivityTemplateLink(@RequestBody ActivityTemplateLinkBo req){
  84 + logger.info("ActivtyTemplatedController.addActivityTemplateLink req {}",req);
  85 + if (req == null){
  86 + return handleParamIsNull();
  87 + }
  88 + try {
  89 + if (req.getTemplateId() != null){
  90 + activtyTemplatedService.upateActivityTemplateLink(req);
  91 + }else{
  92 + Integer templateId = activtyTemplatedService.addActivityTemplateLink(req);
  93 + req.setTemplateId(templateId);
  94 + }
  95 + return new ApiResponse.ApiResponseBuilder()
  96 + .code(SUCCESS)
  97 + .data(req)
  98 + .message(Message.buildApiMessage(BizObjName.ACTIVITY_TEMPLATED,
  99 + OperationName.SAVE, Message.SUCCESS))
  100 + .build();
  101 + }catch (Exception e){
  102 + logger.error("addActivityTemplateLink occur error",e);
  103 + return handleException(e);
  104 + }
  105 + }
  106 +
  107 + @RequestMapping(value = "/deleteActivityTemplateLink")
  108 + @ResponseBody
  109 + public ApiResponse deleteActivityTemplateLink(@RequestBody Integer templateId){
  110 + logger.info("ActivtyTemplatedController :: deleteActivityTemplateLink templateId {}",templateId);
  111 + try {
  112 + activtyTemplatedService.deleteActivityTemplate(templateId);
  113 + }catch (Exception e){
  114 + logger.info("ActivtyTemplatedController :: deleteActivityTemplateLink error!", e);
  115 + return new ApiResponse.ApiResponseBuilder().code(500).build();
  116 + }
  117 + return new ApiResponse.ApiResponseBuilder().code(200).build();
  118 + }
  119 +
75 @RequestMapping(value = "/getActivtyTemplated") 120 @RequestMapping(value = "/getActivtyTemplated")
76 @ResponseBody 121 @ResponseBody
77 public ApiResponse getActivtyTemplated(@RequestParam("id") Integer id){ 122 public ApiResponse getActivtyTemplated(@RequestParam("id") Integer id){
@@ -86,6 +131,22 @@ public class ActivtyTemplatedController extends BasicController{ @@ -86,6 +131,22 @@ public class ActivtyTemplatedController extends BasicController{
86 .build(); 131 .build();
87 } 132 }
88 133
  134 + @RequestMapping(value = "/getTemplateInfoByTemplateId")
  135 + @ResponseBody
  136 + public ApiResponse getTemplateInfoByTemplateId(@RequestBody Integer templateId){
  137 + logger.info("ActivtyTemplatedController.getTemplateInfoByTemplateId templateId {}",templateId);
  138 + if (templateId == null){
  139 + return handleParamIsNull();
  140 + }
  141 + ActivtyTemplatedBo bo = activtyTemplatedService.getTemplateInfoByTemplateId(templateId);
  142 + return new ApiResponse.ApiResponseBuilder()
  143 + .code(SUCCESS)
  144 + .data(bo)
  145 + .message(Message.buildApiMessage(BizObjName.ACTIVITY_TEMPLATED,
  146 + OperationName.QUERY, Message.SUCCESS))
  147 + .build();
  148 + }
  149 +
89 @RequestMapping(value = "/getActivtyTemplatedBaseInfo") 150 @RequestMapping(value = "/getActivtyTemplatedBaseInfo")
90 @ResponseBody 151 @ResponseBody
91 public ApiResponse getActivtyTemplatedBaseInfo(@RequestParam("id") Integer id){ 152 public ApiResponse getActivtyTemplatedBaseInfo(@RequestParam("id") Integer id){
@@ -109,6 +170,7 @@ public class ActivtyTemplatedController extends BasicController{ @@ -109,6 +170,7 @@ public class ActivtyTemplatedController extends BasicController{
109 activtyTemplatedService.update(req); 170 activtyTemplatedService.update(req);
110 return new ApiResponse.ApiResponseBuilder() 171 return new ApiResponse.ApiResponseBuilder()
111 .code(SUCCESS) 172 .code(SUCCESS)
  173 + .data(req)
112 .message(Message.buildApiMessage(BizObjName.ACTIVITY_TEMPLATED, 174 .message(Message.buildApiMessage(BizObjName.ACTIVITY_TEMPLATED,
113 OperationName.UPDATE, Message.SUCCESS)) 175 OperationName.UPDATE, Message.SUCCESS))
114 .build(); 176 .build();
@@ -11,14 +11,8 @@ import com.yohobuy.platform.common.util.DateUtil; @@ -11,14 +11,8 @@ import com.yohobuy.platform.common.util.DateUtil;
11 import com.yohobuy.platform.common.util.IntegerUtils; 11 import com.yohobuy.platform.common.util.IntegerUtils;
12 import com.yohobuy.platform.dal.cms.IWebShareDao; 12 import com.yohobuy.platform.dal.cms.IWebShareDao;
13 import com.yohobuy.platform.dal.cms.model.WebShare; 13 import com.yohobuy.platform.dal.cms.model.WebShare;
14 -import com.yohobuy.platform.dal.operations.ActivtyTemplatedFloorDetailMapper;  
15 -import com.yohobuy.platform.dal.operations.ActivtyTemplatedFloorMapper;  
16 -import com.yohobuy.platform.dal.operations.ActivtyTemplatedFloorTableMapper;  
17 -import com.yohobuy.platform.dal.operations.ActivtyTemplatedMapper;  
18 -import com.yohobuy.platform.dal.operations.model.ActivtyTemplated;  
19 -import com.yohobuy.platform.dal.operations.model.ActivtyTemplatedFloor;  
20 -import com.yohobuy.platform.dal.operations.model.ActivtyTemplatedFloorDetail;  
21 -import com.yohobuy.platform.dal.operations.model.ActivtyTemplatedFloorTable; 14 +import com.yohobuy.platform.dal.operations.*;
  15 +import com.yohobuy.platform.dal.operations.model.*;
22 import com.yohobuy.platform.model.cms.bo.WebShareBO; 16 import com.yohobuy.platform.model.cms.bo.WebShareBO;
23 import com.yohobuy.platform.model.common.CheckResult; 17 import com.yohobuy.platform.model.common.CheckResult;
24 import com.yohobuy.platform.model.common.PageResponseVO; 18 import com.yohobuy.platform.model.common.PageResponseVO;
@@ -27,6 +21,7 @@ import com.yohobuy.platform.model.operations.consistant.ActivtyTemplatedStatus; @@ -27,6 +21,7 @@ import com.yohobuy.platform.model.operations.consistant.ActivtyTemplatedStatus;
27 import com.yohobuy.platform.model.operations.consistant.FloorDetailStatus; 21 import com.yohobuy.platform.model.operations.consistant.FloorDetailStatus;
28 import com.yohobuy.platform.model.operations.consistant.LogActionType; 22 import com.yohobuy.platform.model.operations.consistant.LogActionType;
29 import com.yohobuy.platform.model.operations.consistant.TempCompParamType; 23 import com.yohobuy.platform.model.operations.consistant.TempCompParamType;
  24 +import com.yohobuy.platform.model.operations.request.ActivityTemplateLinkBo;
30 import com.yohobuy.platform.model.operations.request.ActivityTemplatedPageBo; 25 import com.yohobuy.platform.model.operations.request.ActivityTemplatedPageBo;
31 import com.yohobuy.platform.model.users.response.UserInfoResponseBO; 26 import com.yohobuy.platform.model.users.response.UserInfoResponseBO;
32 import com.yohobuy.platform.operations.constants.CommonStatus; 27 import com.yohobuy.platform.operations.constants.CommonStatus;
@@ -84,6 +79,9 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo> @@ -84,6 +79,9 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo>
84 @Autowired 79 @Autowired
85 private ActivtyTemplatedFloorDetailMapper atfdMapper; 80 private ActivtyTemplatedFloorDetailMapper atfdMapper;
86 81
  82 + @Autowired
  83 + private ActivtyTemplateLinkMapper activityTemplateLinkMapper;
  84 +
87 private static Convert convert = new BeanConvert(); 85 private static Convert convert = new BeanConvert();
88 86
89 @Value("${activity.url:http://activity.yoho.cn/feature/}") 87 @Value("${activity.url:http://activity.yoho.cn/feature/}")
@@ -337,12 +335,43 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo> @@ -337,12 +335,43 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo>
337 return null; 335 return null;
338 } 336 }
339 logger.info("in getById, ActivtyTemplated id {}, title {}, status {}", id, templated.getTitle(), templated.getStatus()); 337 logger.info("in getById, ActivtyTemplated id {}, title {}, status {}", id, templated.getTitle(), templated.getStatus());
340 - List<ActivtyTemplatedFloorBo> floorBos = atfService.getByTemplatedId(templated.getId()); 338 + List<ActivtyTemplateLink> atlList = activityTemplateLinkMapper.selectActivityTemplateLinkList(id);
  339 + if (CollectionUtils.isEmpty(atlList)){
  340 + return null;
  341 + }
  342 + ActivtyTemplateLink activtyTemplateLink = getCurrentTemplateId(atlList);
  343 + List<ActivtyTemplatedFloorBo> floorBos = atfService.getByTemplatedId(activtyTemplateLink.getTemplateId());
341 ActivtyTemplatedBo templatedBo = ActivtyTemplatedConvert.do2Bo(templated); 344 ActivtyTemplatedBo templatedBo = ActivtyTemplatedConvert.do2Bo(templated);
342 templatedBo.setFloors(floorBos); 345 templatedBo.setFloors(floorBos);
  346 + List<ActivityTemplateLinkBo> linkList = convert.convertFromList(atlList,ActivityTemplateLinkBo.class);
  347 + ActivityTemplateLinkBo atlBo = new ActivityTemplateLinkBo();
  348 + convert.convertFrom(activtyTemplateLink, atlBo, ActivityTemplateLinkBo.class);
  349 + atlBo.setShowTimeStr(DateUtil.int2DateStr(atlBo.getShowTime(),DateUtil.DATE_TIME_FORMAT));
  350 + templatedBo.setLinkList(linkList);
  351 + templatedBo.setAtLink(atlBo);
343 return templatedBo; 352 return templatedBo;
344 } 353 }
345 354
  355 + public ActivtyTemplateLink getCurrentTemplateId(List<ActivtyTemplateLink> atlList){
  356 + Integer currentTime = DateUtil.getCurrentTimeSeconds();
  357 + ActivtyTemplateLink atl = null;
  358 + for (ActivtyTemplateLink activtyTemplateLink : atlList){
  359 + if (null != activtyTemplateLink.getShowTime() && activtyTemplateLink.getShowTime() < currentTime){
  360 + atl = activtyTemplateLink;
  361 + break;
  362 + }
  363 + }
  364 + if (atl == null){
  365 + for (ActivtyTemplateLink activtyTemplateLink : atlList){
  366 + if (null != activtyTemplateLink.getIsDefault() && activtyTemplateLink.getIsDefault() == 1){
  367 + atl = activtyTemplateLink;
  368 + break;
  369 + }
  370 + }
  371 + }
  372 + return atl;
  373 + }
  374 +
346 375
347 public ActivtyTemplatedBo getBaseInfoById(Integer id) { 376 public ActivtyTemplatedBo getBaseInfoById(Integer id) {
348 if (!IntegerUtils.withInBizSign(id)){ 377 if (!IntegerUtils.withInBizSign(id)){
@@ -471,9 +500,9 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo> @@ -471,9 +500,9 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo>
471 activtyTemplated.setUpdateUser(this.buildOperatorInfo(bo.getUserInfoResponseBO())); 500 activtyTemplated.setUpdateUser(this.buildOperatorInfo(bo.getUserInfoResponseBO()));
472 activtyTemplatedMapper.updateByPrimaryKeySelective(activtyTemplated); 501 activtyTemplatedMapper.updateByPrimaryKeySelective(activtyTemplated);
473 //2.根据模板ID依次删除除主表外其他表的相关数据,activty_templated_floor,activty_templated_floor_detail,activty_templated_floor_table 502 //2.根据模板ID依次删除除主表外其他表的相关数据,activty_templated_floor,activty_templated_floor_detail,activty_templated_floor_table
474 - atfMapper.deleteByTempId(bo.getId());  
475 - atftMapper.deleteByTempId(bo.getId());  
476 - atfdMapper.deleteByTempId(bo.getId()); 503 + atfMapper.deleteByTempId(bo.getTemplateId());
  504 + atftMapper.deleteByTempId(bo.getTemplateId());
  505 + atfdMapper.deleteByTempId(bo.getTemplateId());
477 506
478 //3.依次将相关数据插入以上相关表中 507 //3.依次将相关数据插入以上相关表中
479 List<ActivtyTemplatedFloor> atfList = Lists.newArrayList(); 508 List<ActivtyTemplatedFloor> atfList = Lists.newArrayList();
@@ -481,14 +510,14 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo> @@ -481,14 +510,14 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo>
481 for(ActivtyTemplatedFloorBo floorBo: bo.getFloors()){ 510 for(ActivtyTemplatedFloorBo floorBo: bo.getFloors()){
482 //处理activty_templated_floor表数据 511 //处理activty_templated_floor表数据
483 ActivtyTemplatedFloor atf = ActivtyTemplatedFloorConvert.bo2Do(floorBo); 512 ActivtyTemplatedFloor atf = ActivtyTemplatedFloorConvert.bo2Do(floorBo);
484 - atf.setActivtyTemplatedId(bo.getId()); 513 + atf.setActivtyTemplatedId(bo.getTemplateId());
485 //activty_templated_floor表数据入库 514 //activty_templated_floor表数据入库
486 atfMapper.insertSelective(atf); 515 atfMapper.insertSelective(atf);
487 //处理activty_templated_floor_table表数据 516 //处理activty_templated_floor_table表数据
488 if (StringUtils.isNotBlank(floorBo.getTableComp())){ 517 if (StringUtils.isNotBlank(floorBo.getTableComp())){
489 ActivtyTemplatedFloorTable table = new ActivtyTemplatedFloorTable(); 518 ActivtyTemplatedFloorTable table = new ActivtyTemplatedFloorTable();
490 table.setStatus(1); 519 table.setStatus(1);
491 - table.setActivtyTemplatedId(bo.getId()); 520 + table.setActivtyTemplatedId(bo.getTemplateId());
492 table.setFloorId(atf.getId()); 521 table.setFloorId(atf.getId());
493 table.setTableComp(floorBo.getTableComp()); 522 table.setTableComp(floorBo.getTableComp());
494 atftList.add(table); 523 atftList.add(table);
@@ -497,14 +526,14 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo> @@ -497,14 +526,14 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo>
497 floorBo.setId(atf.getId()); 526 floorBo.setId(atf.getId());
498 List<ActivtyTemplatedFloorDetail> atfdp = Lists.newArrayList(); 527 List<ActivtyTemplatedFloorDetail> atfdp = Lists.newArrayList();
499 if (CollectionUtils.isNotEmpty(floorBo.getParams())) { 528 if (CollectionUtils.isNotEmpty(floorBo.getParams())) {
500 - atfdp = ActivityTemplatedFloorDetailHelper.buildDetailsOfFloor(bo.getId(), FloorDetailStatus.open.getIntVal(), floorBo); 529 + atfdp = ActivityTemplatedFloorDetailHelper.buildDetailsOfFloor(bo.getTemplateId(), FloorDetailStatus.open.getIntVal(), floorBo);
501 } 530 }
502 if (CollectionUtils.isNotEmpty(atfdp)){ 531 if (CollectionUtils.isNotEmpty(atfdp)){
503 atfdMapper.insertBatch(atfdp); 532 atfdMapper.insertBatch(atfdp);
504 } 533 }
505 List<ActivtyTemplatedFloorDetailBo> atfdc = Lists.newArrayList(); 534 List<ActivtyTemplatedFloorDetailBo> atfdc = Lists.newArrayList();
506 if (CollectionUtils.isNotEmpty(floorBo.getComponents())){ 535 if (CollectionUtils.isNotEmpty(floorBo.getComponents())){
507 - atfdc = buildDetailBo(bo.getId(), floorBo.getId(), floorBo.getComponents()); 536 + atfdc = buildDetailBo(bo.getTemplateId(), floorBo.getId(), floorBo.getComponents());
508 } 537 }
509 if (CollectionUtils.isNotEmpty(atfdc)){ 538 if (CollectionUtils.isNotEmpty(atfdc)){
510 atfdService.insertDetailBatch(atfdc); 539 atfdService.insertDetailBatch(atfdc);
@@ -687,14 +716,36 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo> @@ -687,14 +716,36 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo>
687 row += activtyTemplatedMapper.insertSelective(templated); 716 row += activtyTemplatedMapper.insertSelective(templated);
688 // clone activity templated id(new) 717 // clone activity templated id(new)
689 int cloneATId = templated.getId(); 718 int cloneATId = templated.getId();
690 - //  
691 - List<ActivtyTemplatedFloor> floors = atfMapper.selectByTemplatedId(id); 719 + //根据原活动ID查询其默认模板
  720 + List<ActivtyTemplateLink> activtyTemplateLinkList = activityTemplateLinkMapper.selectActivityTemplateLinkList(id);
  721 + if (CollectionUtils.isEmpty(activtyTemplateLinkList)){
  722 + return 0;
  723 + }
  724 + Integer templateId = 0;
  725 + for (ActivtyTemplateLink activtyTemplateLink : activtyTemplateLinkList){
  726 + if (activtyTemplateLink.getIsDefault() == 1){
  727 + templateId = activtyTemplateLink.getTemplateId();
  728 + break;
  729 + }
  730 + }
  731 + if (templateId == 0){
  732 + return 0;
  733 + }
  734 + //生成颗粒活动的默认复制模板
  735 + ActivtyTemplateLink activtyTemplateLink = new ActivtyTemplateLink();
  736 + activtyTemplateLink.setActivityId(cloneATId);
  737 + activtyTemplateLink.setIsDefault(1);
  738 + activtyTemplateLink.setTemplateName("默认模板");
  739 + activtyTemplateLink.setCreateTime(DateUtil.getCurrentTimeSeconds());
  740 + activtyTemplateLink.setShowTime(DateUtil.getCurrentTimeSeconds());
  741 + activityTemplateLinkMapper.insertActivityTemplateLink(activtyTemplateLink);
  742 + List<ActivtyTemplatedFloor> floors = atfMapper.selectByTemplatedId(templateId);
692 if (CollectionUtils.isEmpty(floors)){ 743 if (CollectionUtils.isEmpty(floors)){
693 logger.warn("{}.deepClone floors of id {} is empty", getClass().getSimpleName(),id); 744 logger.warn("{}.deepClone floors of id {} is empty", getClass().getSimpleName(),id);
694 return row; 745 return row;
695 } 746 }
696 logger.warn("{}.deepClone floors of id {} size {}", getClass().getSimpleName(), id, floors.size()); 747 logger.warn("{}.deepClone floors of id {} size {}", getClass().getSimpleName(), id, floors.size());
697 - row += atfService.cloneFloors(id, cloneATId, floors); 748 + row += atfService.cloneFloors(templateId, activtyTemplateLink.getTemplateId(), floors);
698 //add log 749 //add log
699 if (row > 0) { 750 if (row > 0) {
700 logService.recordLog(id, LogActionType.clone, null, vo.getUserInfoResponseBO()); 751 logService.recordLog(id, LogActionType.clone, null, vo.getUserInfoResponseBO());
@@ -833,4 +884,89 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo> @@ -833,4 +884,89 @@ public class ActivtyTemplatedService implements BaseService<ActivtyTemplatedBo>
833 return list; 884 return list;
834 } 885 }
835 886
  887 + /**
  888 + * 添加活动与模板的关联关系
  889 + *
  890 + * @param req
  891 + */
  892 + public Integer addActivityTemplateLink(ActivityTemplateLinkBo req) {
  893 + ActivtyTemplateLink activtyTemplateLink = new ActivtyTemplateLink();
  894 + convert.convertFrom(req, activtyTemplateLink, ActivtyTemplateLink.class);
  895 + activtyTemplateLink.setShowTime(DateUtil.getTimeSeconds(req.getShowTimeStr()));
  896 + ActivtyTemplateLink activtyTemplateLinkDefault = activityTemplateLinkMapper.selectDefaultTemplateById(req.getActivityId());
  897 + if (activtyTemplateLinkDefault != null){
  898 + activtyTemplateLink.setIsDefault(2);
  899 + }else {
  900 + activtyTemplateLink.setTemplateName("默认模板");
  901 + activtyTemplateLink.setIsDefault(1);
  902 + }
  903 + activtyTemplateLink.setCreateTime(DateUtil.getCurrentTimeSeconds());
  904 + activityTemplateLinkMapper.insertActivityTemplateLink(activtyTemplateLink);
  905 + if (req.getCopy()){
  906 + req.setTemplateId(activtyTemplateLink.getTemplateId());
  907 + copyDefaultTemplate(req);
  908 + }
  909 + return activtyTemplateLink.getTemplateId();
  910 + }
  911 +
  912 + public void copyDefaultTemplate(ActivityTemplateLinkBo req){
  913 + //查询出默认模板,对默认模板进行复制
  914 + ActivtyTemplateLink activtyTemplateLinkDefault = activityTemplateLinkMapper.selectDefaultTemplateById(req.getActivityId());
  915 + if (activtyTemplateLinkDefault != null){
  916 + List<ActivtyTemplatedFloor> floors = atfMapper.selectByTemplatedId(activtyTemplateLinkDefault.getTemplateId());
  917 + atfService.cloneFloors(activtyTemplateLinkDefault.getTemplateId(),req.getTemplateId(),floors);
  918 + }
  919 + }
  920 +
  921 + public ActivtyTemplatedBo getTemplateInfoByTemplateId(Integer templateId) {
  922 + if (!IntegerUtils.withInBizSign(templateId)){
  923 + logger.warn("{}.getTemplateInfoByTemplateId param id {}", getClass().getSimpleName(), templateId);
  924 + return null;
  925 + }
  926 + ActivtyTemplateLink activtyTemplateLink = activityTemplateLinkMapper.selectTemplateInfoByTemplateId(templateId);
  927 + if (null == activtyTemplateLink){
  928 + logger.warn("ActivtyTemplatedService :: getTemplateInfoByTemplateId get no data!");
  929 + return null;
  930 + }
  931 + List<ActivtyTemplateLink> atlList = activityTemplateLinkMapper.selectActivityTemplateLinkList(activtyTemplateLink.getActivityId());
  932 + if (CollectionUtils.isEmpty(atlList)){
  933 + return null;
  934 + }
  935 + ActivtyTemplated templated = activtyTemplatedMapper.selectByPrimaryKey(activtyTemplateLink.getActivityId());
  936 + if (templated==null){
  937 + logger.warn("{}.getTemplateInfoByTemplateId param id {}, ActivtyTemplated not exist in db", getClass().getSimpleName(), activtyTemplateLink.getActivityId());
  938 + return null;
  939 + }
  940 + logger.info("in getTemplateInfoByTemplateId, ActivtyTemplated id {}, title {}, status {}", activtyTemplateLink.getActivityId(), templated.getTitle(), templated.getStatus());
  941 +
  942 + List<ActivtyTemplatedFloorBo> floorBos = atfService.getByTemplatedId(activtyTemplateLink.getTemplateId());
  943 + ActivtyTemplatedBo templatedBo = ActivtyTemplatedConvert.do2Bo(templated);
  944 + templatedBo.setFloors(floorBos);
  945 + List<ActivityTemplateLinkBo> linkList = convert.convertFromList(atlList,ActivityTemplateLinkBo.class);
  946 + ActivityTemplateLinkBo atlBo = new ActivityTemplateLinkBo();
  947 + convert.convertFrom(activtyTemplateLink, atlBo, ActivityTemplateLinkBo.class);
  948 + atlBo.setShowTimeStr(DateUtil.int2DateStr(atlBo.getShowTime(),DateUtil.DATE_TIME_FORMAT));
  949 + templatedBo.setLinkList(linkList);
  950 + templatedBo.setAtLink(atlBo);
  951 + return templatedBo;
  952 + }
  953 +
  954 + public void upateActivityTemplateLink(ActivityTemplateLinkBo req) {
  955 + ActivtyTemplateLink activtyTemplateLink = new ActivtyTemplateLink();
  956 + convert.convertFrom(req, activtyTemplateLink, ActivtyTemplateLink.class);
  957 + activtyTemplateLink.setShowTime(DateUtil.getTimeSeconds(req.getShowTimeStr()));
  958 + activityTemplateLinkMapper.upateActivityTemplateLink(activtyTemplateLink);
  959 + if (req.getCopy()){
  960 + copyDefaultTemplate(req);
  961 + }
  962 + }
  963 +
  964 + public void deleteActivityTemplate(Integer templateId) {
  965 + //删除link表
  966 + activityTemplateLinkMapper.deleteByTempId(templateId);
  967 + //删除其他相关数据
  968 + atfMapper.deleteByTempId(templateId);
  969 + atftMapper.deleteByTempId(templateId);
  970 + atfdMapper.deleteByTempId(templateId);
  971 + }
836 } 972 }
@@ -24,7 +24,7 @@ @@ -24,7 +24,7 @@
24 <dependency> 24 <dependency>
25 <groupId>com.yoho.service.platform.model</groupId> 25 <groupId>com.yoho.service.platform.model</groupId>
26 <artifactId>platform-service-model</artifactId> 26 <artifactId>platform-service-model</artifactId>
27 - <version>1.2.3-6.8.4-SNAPSHOT</version> 27 + <version>1.2.3-6.8.5-SNAPSHOT</version>
28 </dependency> 28 </dependency>
29 <dependency> 29 <dependency>
30 <groupId>com.yoho.dsf.yhplatform</groupId> 30 <groupId>com.yoho.dsf.yhplatform</groupId>
@@ -54,7 +54,7 @@ @@ -54,7 +54,7 @@
54 <dependency> 54 <dependency>
55 <groupId>com.yohobuy.platform</groupId> 55 <groupId>com.yohobuy.platform</groupId>
56 <artifactId>platform-common</artifactId> 56 <artifactId>platform-common</artifactId>
57 - <version>1.0.3-6.8.4-SNAPSHOT</version> 57 + <version>1.0.3-6.8.5-SNAPSHOT</version>
58 </dependency> 58 </dependency>
59 </dependencies> 59 </dependencies>
60 </dependencyManagement> 60 </dependencyManagement>
@@ -121,6 +121,7 @@ datasources: @@ -121,6 +121,7 @@ datasources:
121 - com.yohobuy.platform.dal.operations.ActivtyTemplatedFloorMapper 121 - com.yohobuy.platform.dal.operations.ActivtyTemplatedFloorMapper
122 - com.yohobuy.platform.dal.operations.ActivtyTemplatedLogMapper 122 - com.yohobuy.platform.dal.operations.ActivtyTemplatedLogMapper
123 - com.yohobuy.platform.dal.operations.ActivtyTemplatedMapper 123 - com.yohobuy.platform.dal.operations.ActivtyTemplatedMapper
  124 + - com.yohobuy.platform.dal.operations.ActivtyTemplateLinkMapper
124 - com.yohobuy.platform.dal.operations.TemplatedComponentMapper 125 - com.yohobuy.platform.dal.operations.TemplatedComponentMapper
125 - com.yohobuy.platform.dal.operations.TemplatedComponentParamMapper 126 - com.yohobuy.platform.dal.operations.TemplatedComponentParamMapper
126 - com.yohobuy.platform.dal.operations.ActivtyTemplatedFloorTableMapper 127 - com.yohobuy.platform.dal.operations.ActivtyTemplatedFloorTableMapper
@@ -119,6 +119,7 @@ datasources: @@ -119,6 +119,7 @@ datasources:
119 - com.yohobuy.platform.dal.operations.ActivtyTemplatedFloorMapper 119 - com.yohobuy.platform.dal.operations.ActivtyTemplatedFloorMapper
120 - com.yohobuy.platform.dal.operations.ActivtyTemplatedLogMapper 120 - com.yohobuy.platform.dal.operations.ActivtyTemplatedLogMapper
121 - com.yohobuy.platform.dal.operations.ActivtyTemplatedMapper 121 - com.yohobuy.platform.dal.operations.ActivtyTemplatedMapper
  122 + - com.yohobuy.platform.dal.operations.ActivtyTemplateLinkMapper
122 - com.yohobuy.platform.dal.operations.TemplatedComponentMapper 123 - com.yohobuy.platform.dal.operations.TemplatedComponentMapper
123 - com.yohobuy.platform.dal.operations.TemplatedComponentParamMapper 124 - com.yohobuy.platform.dal.operations.TemplatedComponentParamMapper
124 - com.yohobuy.platform.dal.operations.ActivtyTemplatedFloorTableMapper 125 - com.yohobuy.platform.dal.operations.ActivtyTemplatedFloorTableMapper