Sfoglia il codice sorgente

优惠券使用方位指定盲票回显

guanglong 3 anni fa
parent
commit
29c8f56e82

+ 34 - 8
mp-admin/src/main/java/com/qs/mp/web/controller/api/admin/CouponMgrController.java

@@ -9,6 +9,7 @@ import com.qs.mp.admin.domain.CouponChannel;
 import com.qs.mp.admin.domain.CouponTicket;
 import com.qs.mp.admin.domain.Goods;
 import com.qs.mp.admin.domain.GoodsSku;
+import com.qs.mp.admin.domain.TicketBox;
 import com.qs.mp.admin.domain.param.CouponParam;
 import com.qs.mp.admin.domain.param.GoodsParam;
 import com.qs.mp.admin.domain.vo.CouponVO;
@@ -16,6 +17,9 @@ import com.qs.mp.admin.domain.vo.GoodsVO;
 import com.qs.mp.admin.service.ICouponChannelService;
 import com.qs.mp.admin.service.ICouponService;
 import com.qs.mp.admin.service.ICouponTicketService;
+import com.qs.mp.admin.service.ITicketBoxService;
+import com.qs.mp.channel.domain.Channel;
+import com.qs.mp.channel.service.IChannelService;
 import com.qs.mp.common.constant.UserConstants;
 import com.qs.mp.common.core.domain.AjaxResult;
 import com.qs.mp.common.core.page.TableDataInfo;
@@ -63,8 +67,14 @@ public class CouponMgrController extends BaseApiController {
 	@Autowired
 	private ICouponTicketService couponTicketService;
 	
+	@Autowired
+	private ITicketBoxService ticketBoxService;
+	
 	@Autowired
 	private ICouponChannelService couponChannelService;
+	
+	@Autowired
+	private IChannelService channelService;
 
 	@Autowired
 	private ISysUserService userService;
@@ -109,6 +119,7 @@ public class CouponMgrController extends BaseApiController {
 		}
 		CouponVO couponVO = new CouponVO();
 		BeanUtils.copyProperties(coupon, couponVO);
+		List<TicketBox> ticketBoxList = new ArrayList<>();
 		// 查询盲票限制列表
 		List<CouponTicket> ticketList = new ArrayList<>();
 		LambdaQueryWrapper<CouponTicket> ticketQueryWrapper = new LambdaQueryWrapper<>();
@@ -116,16 +127,31 @@ public class CouponMgrController extends BaseApiController {
 		ticketQueryWrapper.orderByDesc(CouponTicket::getCreatedTime);
 		ticketList = couponTicketService.list(ticketQueryWrapper);
 		if(null != ticketList && ticketList.size() > 0) {
-			couponVO.setBoxIdList(ticketList.stream().map(CouponTicket::getBoxId).collect(Collectors.toList()));
+			List<String> boxIdList = ticketList.stream().map(CouponTicket::getBoxId).collect(Collectors.toList());
+			if(null != boxIdList && boxIdList.size() > 0) {
+				LambdaQueryWrapper<TicketBox> ticketBoxQueryWrapper = new LambdaQueryWrapper<>();
+				ticketBoxQueryWrapper.in(TicketBox::getBoxId, boxIdList);
+				ticketBoxQueryWrapper.orderByDesc(TicketBox::getCreatedTime);
+				ticketBoxList = ticketBoxService.list(ticketBoxQueryWrapper);
+				couponVO.setTicketBoxList(ticketBoxList);
+			}
 		}
 		// 查询门店限制列表
-		List<CouponChannel> channelList = new ArrayList<>();
-		LambdaQueryWrapper<CouponChannel> channelQueryWrapper = new LambdaQueryWrapper<>();
-		channelQueryWrapper.eq(CouponChannel::getCouponId, coupon.getCouponId());
-		channelQueryWrapper.orderByDesc(CouponChannel::getCreatedTime);
-		channelList = couponChannelService.list(channelQueryWrapper);
-		if(null != channelList && channelList.size() > 0) {
-			couponVO.setChannelIdList(channelList.stream().map(CouponChannel::getChannelId).collect(Collectors.toList()));
+		List<Channel> channelList = new ArrayList<>();
+		List<CouponChannel> couponChannelList = new ArrayList<>();
+		LambdaQueryWrapper<CouponChannel> couponChanneQueryWrapper = new LambdaQueryWrapper<>();
+		couponChanneQueryWrapper.eq(CouponChannel::getCouponId, coupon.getCouponId());
+		couponChanneQueryWrapper.orderByDesc(CouponChannel::getCreatedTime);
+		couponChannelList = couponChannelService.list(couponChanneQueryWrapper);
+		if(null != couponChannelList && couponChannelList.size() > 0) {
+			List<Long> channelIdList = couponChannelList.stream().map(CouponChannel::getChannelId).collect(Collectors.toList());
+			if(null != channelIdList && channelIdList.size() > 0) {
+				LambdaQueryWrapper<Channel> channelQueryWrapper = new LambdaQueryWrapper<>();
+				channelQueryWrapper.in(Channel::getChannelId, channelIdList);
+				channelQueryWrapper.orderByDesc(Channel::getCreatedTime);
+				channelList = channelService.list(channelQueryWrapper);
+				couponVO.setChannelList(channelList);
+			}
 		}
 		return AjaxResult.success(couponVO);
 	}

+ 4 - 2
mp-service/src/main/java/com/qs/mp/admin/domain/vo/CouponVO.java

@@ -4,6 +4,8 @@ import com.alibaba.fastjson.annotation.JSONField;
 import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.qs.mp.admin.domain.CouponTicket;
 import com.qs.mp.admin.domain.GoodsSku;
+import com.qs.mp.admin.domain.TicketBox;
+import com.qs.mp.channel.domain.Channel;
 import com.qs.mp.common.enums.CouponDiscountTypeEnum;
 import com.qs.mp.common.enums.CouponDistributeTypeEnum;
 import com.qs.mp.common.enums.CouponStatusEnum;
@@ -26,12 +28,12 @@ public class CouponVO {
 	/**
 	 * 盲票购买优惠券使用范围限制列表
 	 */
-	private List<String> boxIdList;
+	private List<TicketBox> ticketBoxList;
 	
 	/**
 	 * 经销商门店优惠券使用范围限制列表
 	 */
-	private List<Long> channelIdList;
+	private List<Channel> channelList;
 	
 	
   /**