|
@@ -100,43 +100,6 @@ public class TicketBoxServiceImpl extends ServiceImpl<TicketBoxMapper, TicketBox
|
|
|
return getBaseMapper().listBySaleChannel(queryWrapper);
|
|
|
}
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
-
|
|
|
- String test = "1";
|
|
|
- String[] split = test.split("\\.");
|
|
|
- for (String s : split) {
|
|
|
- System.out.println("s = " + s);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- List<String> channelNoList = new ArrayList<>();
|
|
|
- channelNoList.add("1");
|
|
|
- channelNoList.add("25.1.31");
|
|
|
- channelNoList.add("47");
|
|
|
- for (int i = 0; i < channelNoList.size(); i++) {
|
|
|
- for (int j = 0; j < channelNoList.size(); j++) {
|
|
|
- if (i == j) {
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- String[] a = channelNoList.get(i).split("\\.");
|
|
|
- String[] b = channelNoList.get(j).split("\\.");
|
|
|
-
|
|
|
- for (String s : a) {
|
|
|
- for (String s1 : b) {
|
|
|
- if (s.equals(s1)) {
|
|
|
- System.out.println("i = " + channelNoList.get(i));
|
|
|
- System.out.println("j = " + channelNoList.get(j));
|
|
|
- System.out.println("重复了");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -173,7 +136,8 @@ public class TicketBoxServiceImpl extends ServiceImpl<TicketBoxMapper, TicketBox
|
|
|
}
|
|
|
// 校验嵌套问题
|
|
|
List<String> channelNoList = channelService.list(new LambdaQueryWrapper<Channel>()
|
|
|
- .in(Channel::getChannelId, channelIdList))
|
|
|
+ .in(Channel::getChannelId, channelIdList)
|
|
|
+ .orderByDesc(Channel::getLevel))
|
|
|
.stream().map(Channel::getChannelNo)
|
|
|
.collect(Collectors.toList());
|
|
|
for (int i = 0; i < channelNoList.size(); i++) {
|
|
@@ -181,14 +145,10 @@ public class TicketBoxServiceImpl extends ServiceImpl<TicketBoxMapper, TicketBox
|
|
|
if (i == j) {
|
|
|
continue;
|
|
|
}
|
|
|
- String[] splitOne = channelNoList.get(i).split("\\.");
|
|
|
- String[] splitTwo = channelNoList.get(j).split("\\.");
|
|
|
- for (String one : splitOne) {
|
|
|
- for (String two : splitTwo) {
|
|
|
- if (one.equals(two)) {
|
|
|
- throw new ServiceException("已选择更高级的渠道,不支持渠道相互嵌套!");
|
|
|
- }
|
|
|
- }
|
|
|
+
|
|
|
+ boolean flag = channelNoList.get(i).startsWith(channelNoList.get(j) + ".");
|
|
|
+ if (flag) {
|
|
|
+ throw new ServiceException("已选择更高级的渠道,不支持渠道相互嵌套!");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -371,7 +331,8 @@ public class TicketBoxServiceImpl extends ServiceImpl<TicketBoxMapper, TicketBox
|
|
|
|
|
|
// 校验嵌套问题
|
|
|
List<String> channelNoList = channelService.list(new LambdaQueryWrapper<Channel>()
|
|
|
- .in(Channel::getChannelId, channelIdList))
|
|
|
+ .in(Channel::getChannelId, channelIdList)
|
|
|
+ .orderByDesc(Channel::getLevel))
|
|
|
.stream().map(Channel::getChannelNo)
|
|
|
.collect(Collectors.toList());
|
|
|
for (int i = 0; i < channelNoList.size(); i++) {
|
|
@@ -379,14 +340,9 @@ public class TicketBoxServiceImpl extends ServiceImpl<TicketBoxMapper, TicketBox
|
|
|
if (i == j) {
|
|
|
continue;
|
|
|
}
|
|
|
- String[] splitOne = channelNoList.get(i).split("\\.");
|
|
|
- String[] splitTwo = channelNoList.get(j).split("\\.");
|
|
|
- for (String one : splitOne) {
|
|
|
- for (String two : splitTwo) {
|
|
|
- if (one.equals(two)) {
|
|
|
- throw new ServiceException("已选择更高级的渠道,不支持渠道相互嵌套!");
|
|
|
- }
|
|
|
- }
|
|
|
+ boolean flag = channelNoList.get(i).startsWith(channelNoList.get(j) + ".");
|
|
|
+ if (flag) {
|
|
|
+ throw new ServiceException("已选择更高级的渠道,不支持渠道相互嵌套!");
|
|
|
}
|
|
|
}
|
|
|
}
|