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