|
@@ -19,6 +19,8 @@ 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.domain.ChannelUserRel;
|
|
|
+import com.qs.mp.channel.domain.vo.ChannelVO;
|
|
|
import com.qs.mp.channel.service.IChannelService;
|
|
|
import com.qs.mp.common.annotation.Log;
|
|
|
import com.qs.mp.common.constant.Constants;
|
|
@@ -154,7 +156,6 @@ public class CouponMgrController extends BaseApiController {
|
|
|
}
|
|
|
}
|
|
|
// 查询门店限制列表
|
|
|
- List<Channel> channelList = new ArrayList<>();
|
|
|
List<CouponChannel> couponChannelList = new ArrayList<>();
|
|
|
LambdaQueryWrapper<CouponChannel> couponChanneQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
couponChanneQueryWrapper.eq(CouponChannel::getCouponId, coupon.getCouponId());
|
|
@@ -163,11 +164,19 @@ public class CouponMgrController extends BaseApiController {
|
|
|
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);
|
|
|
+ QueryWrapper<Channel> queryWrapper = new QueryWrapper<>();
|
|
|
+ queryWrapper.in("t1.channel_id", channelIdList);
|
|
|
+ List<ChannelVO> list = channelService.selectSaleSiteList(queryWrapper);
|
|
|
+
|
|
|
+ if(null != list && list.size() > 0) {
|
|
|
+ for(ChannelVO channelVO : list) {
|
|
|
+ if(null != channelVO && null != channelVO.getChannelId()
|
|
|
+ && StringUtils.isNotBlank(channelVO.getChannelNo())) {
|
|
|
+ channelVO.setParentsName(getParentsName(channelVO.getChannelNo()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ couponVO.setChannelList(list);
|
|
|
}
|
|
|
}
|
|
|
return AjaxResult.success(couponVO);
|
|
@@ -341,4 +350,36 @@ public class CouponMgrController extends BaseApiController {
|
|
|
return AjaxResult.success("代金券删除成功");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ private String getParentsName(String channelNo) {
|
|
|
+ if(StringUtils.isNotBlank(channelNo)) {
|
|
|
+ String[] noArray = channelNo.split("\\.");
|
|
|
+ if(null != noArray && noArray.length > 0) {
|
|
|
+ List<String> noList = new ArrayList<String>();
|
|
|
+ String parentNo = "";
|
|
|
+ for (int i = 0; i < noArray.length; i++) {
|
|
|
+ if(null != noArray[i] && StringUtils.isNotBlank(noArray[i])) {
|
|
|
+ parentNo += (i>0?".":"")+noArray[i];
|
|
|
+ if(StringUtils.isNotBlank(parentNo) && !parentNo.equals(channelNo)) {
|
|
|
+ noList.add(parentNo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(noList.size() > 0 ) {
|
|
|
+ LambdaQueryWrapper<Channel> queryWrapper = new LambdaQueryWrapper<Channel>();
|
|
|
+ queryWrapper.gt(Channel::getLevel, 0);
|
|
|
+ queryWrapper.in(Channel::getChannelNo,noList);
|
|
|
+ queryWrapper.orderByAsc(Channel::getLevel);
|
|
|
+ List<Channel> list = channelService.list(queryWrapper);
|
|
|
+ if(null != list && list.size() >0) {
|
|
|
+ String names = list.stream().map(Channel::getName).collect(Collectors.joining(" > "));
|
|
|
+ return names;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
}
|