zhangkaikai 1 год назад
Родитель
Сommit
94a4adffb8

+ 18 - 0
mp-admin/src/main/java/com/qs/mp/web/controller/api/admin/TicketBoxMgrController.java

@@ -122,6 +122,24 @@ public class TicketBoxMgrController extends BaseApiController {
         return getDataTable(list);
     }
 
+    @PostMapping("/list/underChannel")
+    @PreAuthorize("@ss.hasPermi('business:ticket:list')")
+    @ApiOperation("查询门店下盲票组列表")
+    @ApiResponses(
+            @ApiResponse(code = 200, message = "查询成功", response = TicketBox.class)
+    )
+    public TableDataInfo listUnderChannel(@RequestBody TicketBoxQueryParam ticketBoxQueryParam) {
+        startPage();
+        QueryWrapper<TicketBox> ticketBoxQueryWrapper = new QueryWrapper<>();
+        ticketBoxQueryWrapper.eq("t1.status", TicketBoxStatusEnum.PUT_ON)
+                .eq("t1.sale_channel_type", TicketBoxSaleChannelTypeEnum.SHOP.getValue())
+                .eq("t2.channel_id", ticketBoxQueryParam.getChannelId());
+
+        List<TicketBox> ticketBoxList = ticketBoxService.listBySaleChannel(ticketBoxQueryWrapper);
+        return getDataTable(ticketBoxList);
+    }
+
+
     @PostMapping("/update")
     @PreAuthorize("@ss.hasPermi('business:ticket:edit')")
     @ApiOperation("更新盲票信息")

+ 12 - 0
mp-admin/src/main/java/com/qs/mp/web/controller/api/user/UserShareController.java

@@ -9,6 +9,7 @@ import com.qs.mp.user.domain.vo.UserShareVO;
 import com.qs.mp.utils.SecurityUtils;
 import com.qs.mp.web.controller.common.BaseApiController;
 import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiModelProperty;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -60,4 +61,15 @@ public class UserShareController extends BaseApiController {
 		}
 		return new AjaxResult(Type.SUCCESS, "", rst);
 	}
+
+	@PostMapping("/ticket/code/generate")
+	@ApiModelProperty("生成指定门店下盲票二维码")
+	public AjaxResult generateTicketUnderChannelCode(@RequestBody  JSONObject jsonObject) {
+		String type = jsonObject.getString("type");
+		String channelId = jsonObject.getString("channelId");// 渠道ID
+		String appId = AppSourceEnum.MSDQ.getAppId();
+		Long userId = SecurityUtils.getUserId();
+		String rst = wxUrlLinkService.generateUnlimitCode("pages/index/index", channelId + "&" + userId + "&" + type, appId);;
+		return new AjaxResult(Type.SUCCESS, "", rst);
+	}
 }

+ 7 - 1
mp-common/src/main/java/com/qs/mp/common/enums/TicketBoxSaleChannelTypeEnum.java

@@ -11,8 +11,14 @@ import lombok.AllArgsConstructor;
  */
 public enum TicketBoxSaleChannelTypeEnum implements IEnum<Integer> {
 
+    // 线下票渠道
     ALL(1, "所有渠道"),
-    PART(2, "部分渠道");
+    PART(2, "部分渠道"),
+
+    // 线上票渠道
+    HOMEPAGE(3,"首页售卖"),
+    SHOP(4,"指定门店")
+    ;
 
     private int value;
     private final String desc;

+ 1 - 1
mp-service/src/main/java/com/qs/mp/admin/domain/param/TicketBoxCreateParam.java

@@ -26,7 +26,7 @@ public class TicketBoxCreateParam {
 	@ApiModelProperty(value = "图片",required=true)
 	private String picUrl;
 
-	@ApiModelProperty("销售渠道类型  1 所有渠道 2 指定渠道")
+	@ApiModelProperty("销售渠道类型  1 所有渠道 2 指定渠道 3 线上票首页售卖 4 线上票指定门店售卖")
 	private Integer saleChannelType;
 
 	@ApiModelProperty("渠道商id列表")

+ 3 - 0
mp-service/src/main/java/com/qs/mp/admin/domain/param/TicketBoxQueryParam.java

@@ -33,5 +33,8 @@ public class TicketBoxQueryParam {
     @ApiModelProperty("排除的盲票组id列表")
     private List<String> excludeBoxIds;
 
+    @ApiModelProperty("盲票指定的渠道")
+    private String channelId;
+
 
 }

+ 25 - 2
mp-service/src/main/java/com/qs/mp/admin/service/impl/TicketBoxServiceImpl.java

@@ -184,8 +184,11 @@ public class TicketBoxServiceImpl extends ServiceImpl<TicketBoxMapper, TicketBox
         }
 
         // 清除指定渠道内容
-        ticketBoxChannelService.remove(
-            new LambdaUpdateWrapper<TicketBoxChannel>().eq(TicketBoxChannel::getBoxId, ticketBox.getBoxId()));
+        if (TicketBoxSaleChannelTypeEnum.ALL.getValue().equals(param.getSaleChannelType())
+                || TicketBoxSaleChannelTypeEnum.PART.getValue().equals(param.getSaleChannelType())) {
+            ticketBoxChannelService.remove(
+                    new LambdaUpdateWrapper<TicketBoxChannel>().eq(TicketBoxChannel::getBoxId, ticketBox.getBoxId()));
+        }
 
         // 指定渠道
         if (TicketBoxSaleChannelTypeEnum.PART.getValue().equals(param.getSaleChannelType())) {
@@ -472,6 +475,26 @@ public class TicketBoxServiceImpl extends ServiceImpl<TicketBoxMapper, TicketBox
             ticketBoxChannelService.saveBatch(ticketBoxChannelList);
         }
 
+        // 线上票指定门店
+        if (TicketBoxSaleChannelTypeEnum.SHOP.getValue().equals(param.getSaleChannelType())) {
+            List<Long> channelIdList = param.getChannelIdList();
+            if (CollectionUtils.isEmpty(channelIdList)) {
+                throw new ServiceException("门店列表为空");
+            }
+            if (channelIdList.size() > 1) {
+                throw new ServiceException("只能指定一个门店");
+            }
+
+            List<TicketBoxChannel> onlineTicketBoxChannelList = new ArrayList<>();
+            for (Long channelId : channelIdList) {
+                TicketBoxChannel ticketBoxChannel = new TicketBoxChannel();
+                ticketBoxChannel.setBoxId(ticketBox.getBoxId());
+                ticketBoxChannel.setChannelId(channelId);
+                onlineTicketBoxChannelList.add(ticketBoxChannel);
+            }
+            ticketBoxChannelService.saveBatch(onlineTicketBoxChannelList);
+        }
+
         // 创建奖级
         List<TicketAwards> ticketAwardsList = new ArrayList<>();
         List<TicketAwardsPrize> awardsPrizeList = new ArrayList<>();