|
@@ -1223,24 +1223,20 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
|
|
|
}
|
|
|
|
|
|
//通过账户范围计划层级查询
|
|
|
- private Result<Object> doPlanLevel(Long accountId, List<KuaishouChannelCreateStrategy> strategys, String
|
|
|
- appName, int count) throws
|
|
|
+ private Result<Object> doPlanLevel(Long accountId, List<KuaishouChannelCreateStrategy> strategys, String appName, int count) throws
|
|
|
Exception {
|
|
|
- List<Integer> haveCycleTimesList = channelMapper.queryUsedLevel(strategys);
|
|
|
- if (Check.isNull(haveCycleTimesList)) {
|
|
|
+ List<Integer> usageTimesTypes = channelMapper.queryUsedLevel(strategys);
|
|
|
+ if (Check.isNull(usageTimesTypes)) {
|
|
|
return Result.error("渠道号已无效");
|
|
|
}
|
|
|
- for (Integer haveCycleTimes : haveCycleTimesList) {
|
|
|
+ for (Integer usageTimes : usageTimesTypes) {
|
|
|
//获取可用渠道号,筛查出一个返回给前端
|
|
|
- List<KuaishouChannel> list = channelMapper.queryChannelByHaveCycleTimes(haveCycleTimes, "plan", strategys);
|
|
|
+ List<KuaishouChannel> list = channelMapper.queryChannelByUsageTimes(usageTimes, "plan", strategys,appName);
|
|
|
if (Check.isNull(list)) {
|
|
|
continue;
|
|
|
}
|
|
|
for (KuaishouChannel channel : list) {
|
|
|
-// Integer cycleTimes = channel.getCycleTimes();//可循环次数
|
|
|
- Integer usageTimes = channel.getUsageTimes();//使用次数
|
|
|
- //优先判断已经循环的次数 大于 使用次数
|
|
|
- if (haveCycleTimes > usageTimes) {
|
|
|
+ //1 关联单品,无单品则跳过
|
|
|
if (channel.getIsHaveItem() == 1) {
|
|
|
List<KuaishouChannelItems> items = channelItemsRelService.queryItems(channel.getId());
|
|
|
if (Check.isNull(items) || items.isEmpty()) {
|
|
@@ -1248,7 +1244,7 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
|
|
|
}
|
|
|
channel.setItems(items);
|
|
|
}
|
|
|
- // 符合条件,获取该渠道号
|
|
|
+ // 获取绑定应用的渠道号
|
|
|
KuaishouChannelRel channelRel = channelRelService.queryByAccountChannelCode(channel.getChannelCode(), accountId, appName);
|
|
|
if (Check.isNull(channelRel)) {
|
|
|
continue;
|
|
@@ -1269,15 +1265,7 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
|
|
|
channel.setAppId(channelRel.getAppId());
|
|
|
return Result.ok(channel);
|
|
|
}
|
|
|
- } else {
|
|
|
- //判断可循环次数 大于 已经循环的次数
|
|
|
-// if (cycleTimes > haveCycleTimes) {
|
|
|
-// //已循环次数+1
|
|
|
-// channel.setHaveCycleTimes(haveCycleTimes + 1);
|
|
|
-// this.saveOrUpdate(channel);
|
|
|
-// }
|
|
|
- continue;
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
if (count == 0) {
|
|
@@ -1294,7 +1282,7 @@ public class KuaishouChannelServiceImpl extends ServiceImpl<KuaishouChannelMappe
|
|
|
return Result.error("渠道号已无效");
|
|
|
}
|
|
|
for (Integer haveCycleTimes : haveCycleTimesList) {
|
|
|
- List<KuaishouChannel> list = channelMapper.queryChannelByHaveCycleTimes(haveCycleTimes, "group", strategys);
|
|
|
+ List<KuaishouChannel> list = channelMapper.queryChannelByUsageTimes(haveCycleTimes, "group", strategys,appName);
|
|
|
if (Check.isNull(list)) {
|
|
|
continue;
|
|
|
}
|