|
@@ -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);
|
|
|
}
|