private List<Long> mergeIds( List<Long> pgcList, List<DcPromotionAwardDTO> hisAwardList, List<DcPromotionItemDTO>... allPromotionItemList) { List<Long> mergeIdList = new ArrayList<Long>(); if (CollectionUtils.isNotEmpty(pgcList)) { mergeIdList.addAll(pgcList); } for (List<DcPromotionItemDTO> promotionItemList : allPromotionItemList) { if (CollectionUtils.isNotEmpty(promotionItemList)) { for (DcPromotionItemDTO pi : promotionItemList) { mergeIdList.add(pi.getItemId()); } } } if (CollectionUtils.isNotEmpty(hisAwardList)) { for (DcPromotionAwardDTO pa : hisAwardList) { mergeIdList.add(pa.getItemId()); } } return mergeIdList; }
@Override public String execute() throws Exception { promotion = getPromotion(); if (promotion != null) { Long promotionId = promotion.getId(); // 活动商品 DcPromotionItemSearchCondition promotionCondition = new DcPromotionItemSearchCondition(); promotionCondition.setPromotionId(promotionId); // 历史获奖 DcPromotionAwardCondition awardCondition = new DcPromotionAwardCondition(); awardCondition.setPromotionType(DcPromotionTypeEnum.PK.getType()); awardCondition.setReviewStatus(DcPromotionAwardReviewStatusEnums.SUCCESS.getStatus()); awardHisList = dcPromotionAwardService.getAwardsNoPagination(awardCondition, new Pagination(1, 15)); } // 取出所有ID的商品 List<Long> idList = mergeIds(null, awardHisList); DcPromotionItemDTO myPromotionItem = getMyPromotionItem(); if (myPromotionItem != null) { idList.add(myPromotionItem.getItemId()); } List<DcItemDTO> itemList = dcItemService.getItemsByIds(idList); itemMap = new HashMap<Long, DcItemDTO>(); for (DcItemDTO dto : itemList) { itemMap.put(dto.getId(), dto); } return SUCCESS; }