| | |
| | | if(!memberCouponPageVoList.isEmpty()){ |
| | | String relGoodsIds; |
| | | HashSet<Long> shopIdSet = new HashSet<>(); |
| | | HashSet<Long> goodsIdSet = new HashSet<>(); |
| | | HashSet<String> goodsIdSet = new HashSet<>(); |
| | | String[] goodsIdArr; |
| | | for(AppMemberCouponPageVo appGetAbleCouponPageVo : memberCouponPageVoList){ |
| | | if(appGetAbleCouponPageVo.getShopId()!=null){ |
| | | shopIdSet.add(appGetAbleCouponPageVo.getShopId()); |
| | |
| | | if(appGetAbleCouponPageVo.getCouponType()==4){ |
| | | appGetAbleCouponPageVo.setVerifyCode("2-"+appGetAbleCouponPageVo.getMemberCouponId()); |
| | | } |
| | | if(StringUtils.isNotBlank(appGetAbleCouponPageVo.getRelGoodsIds())&&!appGetAbleCouponPageVo.getRelGoodsIds().contains(",")){ |
| | | goodsIdSet.add(Long.valueOf(appGetAbleCouponPageVo.getRelGoodsIds())); |
| | | if(StringUtils.isNotBlank(appGetAbleCouponPageVo.getRelGoodsIds())){ |
| | | relGoodsIds = appGetAbleCouponPageVo.getRelGoodsIds(); |
| | | goodsIdArr = relGoodsIds.split(","); |
| | | for(String str : goodsIdArr){ |
| | | goodsIdSet.add(str); |
| | | } |
| | | } |
| | | } |
| | | //获取关联商户和商品信息并转换为Map |
| | | String shopJoinedString = String.join(",", shopIdSet.stream().map(Object::toString).collect(Collectors.toList())); |
| | | String shopJoinedString; |
| | | Map<Long, MgtSimpleShopVo> shopMap = null; |
| | | if(shopIdSet!=null&&!shopIdSet.isEmpty()) { |
| | | shopJoinedString = String.join(",", shopIdSet.stream().map(Object::toString).collect(Collectors.toList())); |
| | | MgtBaseBathDto mgtBaseBathDto = new MgtBaseBathDto(); |
| | | mgtBaseBathDto.setIds(shopJoinedString); |
| | | List<MgtSimpleShopVo> simpleShopVoList = remoteShopService.listShopSimpleVoByIds(mgtBaseBathDto).getData(); |
| | | shopMap = simpleShopVoList.stream() |
| | | .collect(Collectors.toMap(MgtSimpleShopVo::getShopId, Function.identity())); |
| | | } |
| | | String goodsJoinedString = null; |
| | | if(goodsIdSet!=null&&!goodsIdSet.isEmpty()){ |
| | | goodsJoinedString = String.join(",", goodsIdSet.stream().map(Object::toString).collect(Collectors.toList())); |
| | | } |
| | | MgtBaseBathDto mgtBaseBathDto = new MgtBaseBathDto(); |
| | | mgtBaseBathDto.setIds(shopJoinedString); |
| | | List<MgtSimpleShopVo> simpleShopVoList = remoteShopService.listShopSimpleVoByIds(mgtBaseBathDto).getData(); |
| | | Map<Long, MgtSimpleShopVo> shopMap = simpleShopVoList.stream() |
| | | .collect(Collectors.toMap(MgtSimpleShopVo::getShopId, Function.identity())); |
| | | Map<String, Goods> goodsMap = null; |
| | | if(goodsJoinedString!=null){ |
| | | List<Goods> goodsList = remoteGoodsService.listGoodsByGoodsId(goodsJoinedString).getData(); |
| | |
| | | .collect(Collectors.toMap(Goods::getGoodsId, Function.identity())); |
| | | } |
| | | //处理返回信息 |
| | | String shopLimit = "全场通用"; |
| | | String goodsLimit = null; |
| | | String shopLimit = "全门店通用"; |
| | | String goodsLimit; |
| | | StringJoiner goodsNameSj; |
| | | for(AppMemberCouponPageVo appGetAbleCouponPageVo : memberCouponPageVoList){ |
| | | goodsLimit = null; |
| | | goodsNameSj = new StringJoiner(","); |
| | | //商户限制 |
| | | if(appGetAbleCouponPageVo.getShopId()!=null){ |
| | | if(!member.getRelationShopId().equals(appGetAbleCouponPageVo.getShopId())){ |
| | | shopLimit = shopMap.get(appGetAbleCouponPageVo.getShopId()).getShopName()+"可用"; |
| | | } |
| | | shopLimit = shopMap.get(appGetAbleCouponPageVo.getShopId()).getShopName()+"可用"; |
| | | } |
| | | appGetAbleCouponPageVo.setShopLimit(shopLimit); |
| | | //商品限制 |
| | | relGoodsIds = appGetAbleCouponPageVo.getRelGoodsIds(); |
| | | if(StringUtils.isNotBlank(relGoodsIds)&&!relGoodsIds.contains(",")){ |
| | | goodsLimit = goodsMap.get(relGoodsIds).getGoodsName(); |
| | | if(StringUtils.isNotBlank(relGoodsIds)){ |
| | | relGoodsIds = appGetAbleCouponPageVo.getRelGoodsIds(); |
| | | goodsIdArr = relGoodsIds.split(","); |
| | | for(String goodsIs : goodsIdArr){ |
| | | if(goodsMap.get(goodsIs)!=null){ |
| | | goodsNameSj.add(goodsMap.get(goodsIs).getGoodsName()); |
| | | }else{ |
| | | log.debug("用户优惠券未找到关联商品"+appGetAbleCouponPageVo.getMemberCouponId()+"-"+appGetAbleCouponPageVo.getRelGoodsIds()); |
| | | } |
| | | } |
| | | goodsLimit = goodsNameSj.toString(); |
| | | } |
| | | appGetAbleCouponPageVo.setGoodsLimit(goodsLimit); |
| | | //核销商店 |