|
@@ -1,20 +1,30 @@
|
|
|
package com.qs.mp.web.controller.api.channel.mall;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.qs.mp.admin.domain.TicketBox;
|
|
|
import com.qs.mp.admin.domain.vo.TicketBoxListVO;
|
|
|
import com.qs.mp.admin.domain.param.TicketBoxParam;
|
|
|
import com.qs.mp.admin.domain.vo.TicketBoxVO;
|
|
|
import com.qs.mp.admin.service.ITicketAwardsPrizeService;
|
|
|
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.core.domain.AjaxResult;
|
|
|
import com.qs.mp.common.core.page.TableDataInfo;
|
|
|
+import com.qs.mp.common.enums.TicketBoxSaleChannelTypeEnum;
|
|
|
import com.qs.mp.common.enums.TicketBoxStatusEnum;
|
|
|
import com.qs.mp.common.utils.StringUtils;
|
|
|
+import com.qs.mp.utils.SecurityUtils;
|
|
|
import com.qs.mp.web.controller.common.BaseApiController;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import ma.glasnost.orika.MapperFacade;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -40,6 +50,9 @@ public class ChannelTicketController extends BaseApiController {
|
|
|
@Autowired
|
|
|
private MapperFacade mapperFacade;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IChannelService channelService;
|
|
|
+
|
|
|
/**
|
|
|
* 盲票进货列表
|
|
|
*/
|
|
@@ -48,11 +61,37 @@ public class ChannelTicketController extends BaseApiController {
|
|
|
public TableDataInfo list(@RequestBody TicketBoxParam param) {
|
|
|
// TODO 根据标签过滤
|
|
|
startPage();
|
|
|
- List<TicketBox> ticketBoxes = ticketBoxService.list(
|
|
|
- new LambdaQueryWrapper<TicketBox>().eq(TicketBox::getType, param.getType())
|
|
|
- .eq(null != param.getCategoryId() && 0 != param.getCategoryId(), TicketBox::getCategoryId, param.getCategoryId())
|
|
|
- .eq(TicketBox::getStatus, TicketBoxStatusEnum.PUT_ON)
|
|
|
- .orderByDesc(TicketBox::getSortWeight));
|
|
|
+ Long channelId = SecurityUtils.getLoginUser().getChannelId();
|
|
|
+ Channel channel = channelService.getById(channelId);
|
|
|
+ List<Long> channelIds = new ArrayList<>();
|
|
|
+ if (StringUtils.isBlank(channel.getChannelNo())) {
|
|
|
+ String[] split = StringUtils.split(channel.getChannelNo(), ".");
|
|
|
+ for (String s : split) {
|
|
|
+ channelIds.add(Long.valueOf(s));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ QueryWrapper<TicketBox> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.eq("t1.type",param.getType());
|
|
|
+ if (Objects.nonNull(param.getCategoryId()) && param.getCategoryId() != 0) {
|
|
|
+ queryWrapper.eq("t1.category_id",param.getCategoryId());
|
|
|
+ }
|
|
|
+ queryWrapper.eq("t1.status", TicketBoxStatusEnum.PUT_ON);
|
|
|
+ queryWrapper.orderByDesc("t1.sort_weight");
|
|
|
+
|
|
|
+ queryWrapper.nested(wrapper -> {
|
|
|
+ wrapper.eq("t1.sale_channel_type", TicketBoxSaleChannelTypeEnum.ALL.getValue());
|
|
|
+ if (channelIds.size() != 0) {
|
|
|
+ wrapper.or().in("t2.channel_id",channelIds);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ List<TicketBox> ticketBoxes = ticketBoxService.listBySaleChannel(queryWrapper);
|
|
|
+
|
|
|
+// List<TicketBox> ticketBoxes = ticketBoxService.list(
|
|
|
+// new LambdaQueryWrapper<TicketBox>().eq(TicketBox::getType, param.getType())
|
|
|
+// .eq(null != param.getCategoryId() && 0 != param.getCategoryId(), TicketBox::getCategoryId, param.getCategoryId())
|
|
|
+// .eq(TicketBox::getStatus, TicketBoxStatusEnum.PUT_ON)
|
|
|
+// .orderByDesc(TicketBox::getSortWeight));
|
|
|
List<TicketBoxListVO> ticketBoxListVOList = mapperFacade.mapAsList(ticketBoxes, TicketBoxListVO.class);
|
|
|
TableDataInfo rspData = getDataTable(ticketBoxes);
|
|
|
rspData.setRows(ticketBoxListVOList);
|