ソースを参照

渠道列表增加是否可以转门店标识

Chris-zy 1 年間 前
コミット
8f98423d2a

+ 16 - 2
mp-admin/src/main/java/com/qs/mp/web/controller/api/admin/ChannelMgrController.java

@@ -33,6 +33,7 @@ import java.util.Map;
 import java.util.stream.Collectors;
 
 import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.stereotype.Component;
@@ -152,6 +153,19 @@ public class ChannelMgrController extends BaseApiController {
         queryWrapper.eq(null != channel && null != channel.getCityId(), "t1.city_id", channel.getCityId());
         queryWrapper.eq(null != channel && null != channel.getAreaId(), "t1.area_id", channel.getAreaId());
         list = channelService.selectChannelList(queryWrapper);
+        for(ChannelVO channelVO : list){
+            //判断当前渠道下有无子渠道和门店
+            LambdaQueryWrapper<Channel> queryWrapper1 = new LambdaQueryWrapper<>();
+            queryWrapper1.eq(Channel::getParentId, channelVO.getChannelId());
+            queryWrapper1.gt(Channel::getLevel, -1);
+            int channelCount = channelService.count(queryWrapper1);
+            if (channelCount > 0) {
+                channelVO.setIsTransform(false);
+            }else {
+                channelVO.setIsTransform(true);
+            }
+        }
+
         return getDataTable(list);
     }
 
@@ -411,12 +425,12 @@ public class ChannelMgrController extends BaseApiController {
         if (null == channel || null == channel.getChannelId()) {
             return AjaxResult.error("渠道'" + channel.getName() + "'转门店失败,渠道ID异常");
         }
-        //判断当前渠道下有无子渠道
+        //判断当前渠道下有无子渠道和门店
         LambdaQueryWrapper<Channel> queryWrapper = new LambdaQueryWrapper<>();
         if (null != channelParam.getChannelId()) {
             queryWrapper.eq(Channel::getParentId, channelParam.getChannelId());
         }
-        queryWrapper.gt(Channel::getLevel, 0);
+        queryWrapper.gt(Channel::getLevel, -1);
         int channelCount = channelService.count(queryWrapper);
         if (channelCount > 0) {
             return AjaxResult.error("当前渠道存在子渠道不能转为门店!");

+ 6 - 0
mp-service/src/main/java/com/qs/mp/channel/domain/vo/ChannelVO.java

@@ -1,5 +1,6 @@
 package com.qs.mp.channel.domain.vo;
 
+import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.qs.mp.channel.domain.Channel;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -39,5 +40,10 @@ public class ChannelVO extends Channel {
     @ApiModelProperty("线上销售(显示盲票销售张数)")
     long onLineSaleCnt; // 线上销售(显示盲票销售张数)
 
+    /**
+     * 是否可转为门店标识
+     */
+    @ApiModelProperty("是否可转为门店标识")
+    private Boolean isTransform;
 
 }