|
@@ -72,7 +72,6 @@ public class AdPlanConfController {
|
|
|
private final TencentAssetDramaMapper tencentAssetDramaMapper;
|
|
private final TencentAssetDramaMapper tencentAssetDramaMapper;
|
|
|
private final TencentAssetFictionMapper tencentAssetFictionMapper;
|
|
private final TencentAssetFictionMapper tencentAssetFictionMapper;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
@GetMapping("/gdtSuspendByConfId")
|
|
@GetMapping("/gdtSuspendByConfId")
|
|
|
public Result<Void> gdtSuspendByConfId(@NotNull Long confId) {
|
|
public Result<Void> gdtSuspendByConfId(@NotNull Long confId) {
|
|
|
AdPlanConf adPlanConf = adPlanConfService.getById(confId);
|
|
AdPlanConf adPlanConf = adPlanConfService.getById(confId);
|
|
@@ -86,16 +85,16 @@ public class AdPlanConfController {
|
|
|
}
|
|
}
|
|
|
adPlanConfService.gdtSuspendByConf(adPlanConf);
|
|
adPlanConfService.gdtSuspendByConf(adPlanConf);
|
|
|
adPlanConfService.lambdaUpdate()
|
|
adPlanConfService.lambdaUpdate()
|
|
|
- .eq(AdPlanConf::getId, confId)
|
|
|
|
|
- .set(AdPlanConf::getSystemSuspendProcessStatus, 1)
|
|
|
|
|
- .update();
|
|
|
|
|
|
|
+ .eq(AdPlanConf::getId, confId)
|
|
|
|
|
+ .set(AdPlanConf::getSystemSuspendProcessStatus, 1)
|
|
|
|
|
+ .update();
|
|
|
return Result.success("暂停执行中");
|
|
return Result.success("暂停执行中");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("/gdtSuspendByPlanIds/{confId}")
|
|
@PostMapping("/gdtSuspendByPlanIds/{confId}")
|
|
|
- public Result<Void> gdtSuspendByPlanIds (@PathVariable Long confId, @RequestBody Long planIds){
|
|
|
|
|
|
|
+ public Result<Void> gdtSuspendByPlanIds(@PathVariable Long confId, @RequestBody Long planIds) {
|
|
|
if (planIds == null) {
|
|
if (planIds == null) {
|
|
|
- return Result.success("请选择要暂停广告");
|
|
|
|
|
|
|
+ return Result.success("请选择要暂停广告");
|
|
|
}
|
|
}
|
|
|
AdPlanConf adPlanConf = adPlanConfService.getById(confId);
|
|
AdPlanConf adPlanConf = adPlanConfService.getById(confId);
|
|
|
if (adPlanConf == null) {
|
|
if (adPlanConf == null) {
|
|
@@ -108,9 +107,9 @@ public class AdPlanConfController {
|
|
|
}
|
|
}
|
|
|
adPlanConfService.gdtSuspendByPlanIds(adPlanConf, planIds);
|
|
adPlanConfService.gdtSuspendByPlanIds(adPlanConf, planIds);
|
|
|
adPlanConfService.lambdaUpdate()
|
|
adPlanConfService.lambdaUpdate()
|
|
|
- .eq(AdPlanConf::getId, confId)
|
|
|
|
|
- .set(AdPlanConf::getSystemSuspendProcessStatus, 1)
|
|
|
|
|
- .update();
|
|
|
|
|
|
|
+ .eq(AdPlanConf::getId, confId)
|
|
|
|
|
+ .set(AdPlanConf::getSystemSuspendProcessStatus, 1)
|
|
|
|
|
+ .update();
|
|
|
return Result.success();
|
|
return Result.success();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -127,16 +126,16 @@ public class AdPlanConfController {
|
|
|
}
|
|
}
|
|
|
adPlanConfService.gdtDeleteByConf(adPlanConf);
|
|
adPlanConfService.gdtDeleteByConf(adPlanConf);
|
|
|
adPlanConfService.lambdaUpdate()
|
|
adPlanConfService.lambdaUpdate()
|
|
|
- .eq(AdPlanConf::getId, confId)
|
|
|
|
|
- .set(AdPlanConf::getSystemSuspendProcessStatus, 1)
|
|
|
|
|
- .update();
|
|
|
|
|
|
|
+ .eq(AdPlanConf::getId, confId)
|
|
|
|
|
+ .set(AdPlanConf::getSystemSuspendProcessStatus, 1)
|
|
|
|
|
+ .update();
|
|
|
return Result.success("暂停执行中");
|
|
return Result.success("暂停执行中");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@PostMapping("/gdtDeleteByPlanIds/{confId}")
|
|
@PostMapping("/gdtDeleteByPlanIds/{confId}")
|
|
|
- public Result<Void> gdtDeleteByPlanIds (@PathVariable Long confId, @RequestBody Long planIds){
|
|
|
|
|
|
|
+ public Result<Void> gdtDeleteByPlanIds(@PathVariable Long confId, @RequestBody Long planIds) {
|
|
|
if (planIds == null) {
|
|
if (planIds == null) {
|
|
|
- return Result.success("请选择要暂停广告");
|
|
|
|
|
|
|
+ return Result.success("请选择要暂停广告");
|
|
|
}
|
|
}
|
|
|
AdPlanConf adPlanConf = adPlanConfService.getById(confId);
|
|
AdPlanConf adPlanConf = adPlanConfService.getById(confId);
|
|
|
if (adPlanConf == null) {
|
|
if (adPlanConf == null) {
|
|
@@ -149,9 +148,9 @@ public class AdPlanConfController {
|
|
|
}
|
|
}
|
|
|
adPlanConfService.gdtDeleteByPlanIds(adPlanConf, planIds);
|
|
adPlanConfService.gdtDeleteByPlanIds(adPlanConf, planIds);
|
|
|
adPlanConfService.lambdaUpdate()
|
|
adPlanConfService.lambdaUpdate()
|
|
|
- .eq(AdPlanConf::getId, confId)
|
|
|
|
|
- .set(AdPlanConf::getSystemSuspendProcessStatus, 1)
|
|
|
|
|
- .update();
|
|
|
|
|
|
|
+ .eq(AdPlanConf::getId, confId)
|
|
|
|
|
+ .set(AdPlanConf::getSystemSuspendProcessStatus, 1)
|
|
|
|
|
+ .update();
|
|
|
return Result.success();
|
|
return Result.success();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -175,7 +174,8 @@ public class AdPlanConfController {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- public record TencentAsset(Integer assetType, Long assetId, String assetName) {}
|
|
|
|
|
|
|
+ public record TencentAsset(Integer assetType, Long assetId, String assetName) {
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
private List<AdPlan> buildPlans(String jobNumber, UpdateAdPlanConfRequest request, AccountGroup accountGroup,
|
|
private List<AdPlan> buildPlans(String jobNumber, UpdateAdPlanConfRequest request, AccountGroup accountGroup,
|
|
|
List<AccountGroupAccountRelationship> relationships) {
|
|
List<AccountGroupAccountRelationship> relationships) {
|
|
@@ -185,59 +185,82 @@ public class AdPlanConfController {
|
|
|
List<AdPlan> plans = new ArrayList<>();
|
|
List<AdPlan> plans = new ArrayList<>();
|
|
|
Integer dramaAmount = request.getDramaAmount();
|
|
Integer dramaAmount = request.getDramaAmount();
|
|
|
Integer fictionAmount = request.getFictionAmount();
|
|
Integer fictionAmount = request.getFictionAmount();
|
|
|
- //获取短剧 relationships.size * dramaAmount
|
|
|
|
|
|
|
+ // 获取短剧 relationships.size * dramaAmount
|
|
|
|
|
+ // 1短剧2小说3混合
|
|
|
Integer assetType = request.getAssetType();
|
|
Integer assetType = request.getAssetType();
|
|
|
|
|
+ // 1随机2最新
|
|
|
Integer assetModel = request.getAssetModel();
|
|
Integer assetModel = request.getAssetModel();
|
|
|
- List<TencentAsset> assets = new ArrayList<>();
|
|
|
|
|
|
|
+ List<TencentAsset> dramaAssets = new ArrayList<>();
|
|
|
|
|
+ List<TencentAsset> fictionAssets = new ArrayList<>();
|
|
|
if (assetType == 1 && dramaAmount > 0) {
|
|
if (assetType == 1 && dramaAmount > 0) {
|
|
|
List<TencentAssetDrama> dramas = new ArrayList<>();
|
|
List<TencentAssetDrama> dramas = new ArrayList<>();
|
|
|
if (assetModel == 1) {
|
|
if (assetModel == 1) {
|
|
|
- dramas = tencentAssetDramaMapper.selectList(new LambdaQueryWrapper<TencentAssetDrama>().eq(TencentAssetDrama::getJobNumber, jobNumber).last("order by rand() limit " + dramaAmount * relationships.size()));
|
|
|
|
|
|
|
+ dramas = tencentAssetDramaMapper.selectList(
|
|
|
|
|
+ new LambdaQueryWrapper<TencentAssetDrama>().eq(TencentAssetDrama::getJobNumber, jobNumber)
|
|
|
|
|
+ .last("order by rand() limit " + dramaAmount * relationships.size()));
|
|
|
} else {
|
|
} else {
|
|
|
- dramas = tencentAssetDramaMapper.randomNewAsset(jobNumber, dramaAmount * relationships.size() * 2, dramaAmount * relationships.size());
|
|
|
|
|
|
|
+ dramas = tencentAssetDramaMapper.randomNewAsset(jobNumber, dramaAmount * relationships.size() * 2,
|
|
|
|
|
+ dramaAmount * relationships.size());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (dramas.size() < dramaAmount * relationships.size()) {
|
|
if (dramas.size() < dramaAmount * relationships.size()) {
|
|
|
throw new IllegalArgumentException("短剧数量不足,请在短剧资产管理同步");
|
|
throw new IllegalArgumentException("短剧数量不足,请在短剧资产管理同步");
|
|
|
}
|
|
}
|
|
|
- assets = dramas.stream().map(drama -> new TencentAsset(1, drama.getMarketingAssetId(), drama.getMarketingAssetName())).toList();
|
|
|
|
|
|
|
+ dramaAssets = dramas.stream()
|
|
|
|
|
+ .map(drama -> new TencentAsset(1, drama.getMarketingAssetId(), drama.getMarketingAssetName()))
|
|
|
|
|
+ .toList();
|
|
|
}
|
|
}
|
|
|
if (assetType == 2 && fictionAmount > 0) {
|
|
if (assetType == 2 && fictionAmount > 0) {
|
|
|
List<TencentAssetFiction> fictions = new ArrayList<>();
|
|
List<TencentAssetFiction> fictions = new ArrayList<>();
|
|
|
if (assetModel == 1) {
|
|
if (assetModel == 1) {
|
|
|
- fictions = tencentAssetFictionMapper.selectList(new LambdaQueryWrapper<TencentAssetFiction>().eq(TencentAssetFiction::getJobNumber, jobNumber).last("order by rand() limit " + fictionAmount * relationships.size()));
|
|
|
|
|
|
|
+ fictions = tencentAssetFictionMapper.selectList(
|
|
|
|
|
+ new LambdaQueryWrapper<TencentAssetFiction>().eq(TencentAssetFiction::getJobNumber, jobNumber)
|
|
|
|
|
+ .last("order by rand() limit " + fictionAmount * relationships.size()));
|
|
|
} else {
|
|
} else {
|
|
|
- fictions = tencentAssetFictionMapper.randomNewAsset(jobNumber, fictionAmount * relationships.size() * 2, fictionAmount * relationships.size());
|
|
|
|
|
|
|
+ fictions = tencentAssetFictionMapper.randomNewAsset(jobNumber, fictionAmount * relationships.size() * 2,
|
|
|
|
|
+ fictionAmount * relationships.size());
|
|
|
}
|
|
}
|
|
|
if (fictions.size() < fictionAmount * relationships.size()) {
|
|
if (fictions.size() < fictionAmount * relationships.size()) {
|
|
|
throw new IllegalArgumentException("小说数量不足,请在小说资产管理同步");
|
|
throw new IllegalArgumentException("小说数量不足,请在小说资产管理同步");
|
|
|
}
|
|
}
|
|
|
- assets = fictions.stream().map(fiction -> new TencentAsset(2, fiction.getMarketingAssetId(), fiction.getMarketingAssetName())).toList();
|
|
|
|
|
|
|
+ fictionAssets = fictions.stream()
|
|
|
|
|
+ .map(fiction -> new TencentAsset(2, fiction.getMarketingAssetId(), fiction.getMarketingAssetName()))
|
|
|
|
|
+ .toList();
|
|
|
}
|
|
}
|
|
|
if (assetType == 3) {
|
|
if (assetType == 3) {
|
|
|
if (dramaAmount > 0) {
|
|
if (dramaAmount > 0) {
|
|
|
List<TencentAssetDrama> dramas = new ArrayList<>();
|
|
List<TencentAssetDrama> dramas = new ArrayList<>();
|
|
|
if (assetModel == 1) {
|
|
if (assetModel == 1) {
|
|
|
- dramas = tencentAssetDramaMapper.selectList(new LambdaQueryWrapper<TencentAssetDrama>().eq(TencentAssetDrama::getJobNumber, jobNumber).last("order by rand() limit " + dramaAmount * relationships.size()));
|
|
|
|
|
|
|
+ dramas = tencentAssetDramaMapper.selectList(
|
|
|
|
|
+ new LambdaQueryWrapper<TencentAssetDrama>().eq(TencentAssetDrama::getJobNumber, jobNumber)
|
|
|
|
|
+ .last("order by rand() limit " + dramaAmount * relationships.size()));
|
|
|
} else {
|
|
} else {
|
|
|
- dramas = tencentAssetDramaMapper.randomNewAsset(jobNumber, dramaAmount * relationships.size() * 2, dramaAmount * relationships.size());
|
|
|
|
|
|
|
+ dramas = tencentAssetDramaMapper.randomNewAsset(jobNumber, dramaAmount * relationships.size() * 2,
|
|
|
|
|
+ dramaAmount * relationships.size());
|
|
|
}
|
|
}
|
|
|
if (dramas.size() < dramaAmount * relationships.size()) {
|
|
if (dramas.size() < dramaAmount * relationships.size()) {
|
|
|
throw new IllegalArgumentException("短剧数量不足,请在短剧资产管理同步");
|
|
throw new IllegalArgumentException("短剧数量不足,请在短剧资产管理同步");
|
|
|
}
|
|
}
|
|
|
- assets.addAll(dramas.stream().map(drama -> new TencentAsset(1, drama.getMarketingAssetId(), drama.getMarketingAssetName())).toList());
|
|
|
|
|
|
|
+ dramaAssets.addAll(dramas.stream()
|
|
|
|
|
+ .map(drama -> new TencentAsset(1, drama.getMarketingAssetId(), drama.getMarketingAssetName()))
|
|
|
|
|
+ .toList());
|
|
|
}
|
|
}
|
|
|
if (fictionAmount > 0) {
|
|
if (fictionAmount > 0) {
|
|
|
List<TencentAssetFiction> fictions = new ArrayList<>();
|
|
List<TencentAssetFiction> fictions = new ArrayList<>();
|
|
|
if (assetModel == 1) {
|
|
if (assetModel == 1) {
|
|
|
- fictions = tencentAssetFictionMapper.selectList(new LambdaQueryWrapper<TencentAssetFiction>().eq(TencentAssetFiction::getJobNumber, jobNumber).last("order by rand() limit " + fictionAmount * relationships.size()));
|
|
|
|
|
|
|
+ fictions = tencentAssetFictionMapper.selectList(new LambdaQueryWrapper<TencentAssetFiction>()
|
|
|
|
|
+ .eq(TencentAssetFiction::getJobNumber, jobNumber)
|
|
|
|
|
+ .last("order by rand() limit " + fictionAmount * relationships.size()));
|
|
|
} else {
|
|
} else {
|
|
|
- fictions = tencentAssetFictionMapper.randomNewAsset(jobNumber, fictionAmount * relationships.size() * 2, fictionAmount * relationships.size());
|
|
|
|
|
|
|
+ fictions = tencentAssetFictionMapper.randomNewAsset(jobNumber,
|
|
|
|
|
+ fictionAmount * relationships.size() * 2, fictionAmount * relationships.size());
|
|
|
}
|
|
}
|
|
|
if (fictions.size() < fictionAmount * relationships.size()) {
|
|
if (fictions.size() < fictionAmount * relationships.size()) {
|
|
|
throw new IllegalArgumentException("小说数量不足,请在小说资产管理同步");
|
|
throw new IllegalArgumentException("小说数量不足,请在小说资产管理同步");
|
|
|
}
|
|
}
|
|
|
- assets.addAll(fictions.stream().map(fiction -> new TencentAsset(2, fiction.getMarketingAssetId(), fiction.getMarketingAssetName())).toList());
|
|
|
|
|
|
|
+ fictionAssets.addAll(fictions.stream().map(
|
|
|
|
|
+ fiction -> new TencentAsset(2, fiction.getMarketingAssetId(), fiction.getMarketingAssetName()))
|
|
|
|
|
+ .toList());
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -246,78 +269,158 @@ public class AdPlanConfController {
|
|
|
String[] targetArray = targets.split(",");
|
|
String[] targetArray = targets.split(",");
|
|
|
String[] siteArray = sites.split(",");
|
|
String[] siteArray = sites.split(",");
|
|
|
int dramaIndex = 0;
|
|
int dramaIndex = 0;
|
|
|
|
|
+ int fictionIndex = 0;
|
|
|
|
|
+ int planIndex = 0;
|
|
|
|
|
+ System.out.println("dramaSize: " + dramaAssets.size() + " fictionSize: " + fictionAssets.size());
|
|
|
for (AccountGroupAccountRelationship relationship : relationships) {
|
|
for (AccountGroupAccountRelationship relationship : relationships) {
|
|
|
- Long accountId = relationship.getAccountId();
|
|
|
|
|
- for (int k = 0; k < assets.size(); k++) {
|
|
|
|
|
- Long assetId = assets.get(k).assetId();
|
|
|
|
|
- String assetName = assets.get(k).assetName();
|
|
|
|
|
- Integer asset_type = assets.get(k).assetType();
|
|
|
|
|
- dramaIndex++;
|
|
|
|
|
- for (String target : targetArray) {
|
|
|
|
|
|
|
+ if ((assetType == 1 || assetType == 3) && dramaAmount > 0) {
|
|
|
|
|
+ for (int i = 0; i < dramaAmount; i++) {
|
|
|
|
|
+ System.out.println("dramaIndex: " + dramaIndex);
|
|
|
|
|
+ Long assetId = dramaAssets.get(dramaIndex).assetId();
|
|
|
|
|
+ String assetName = dramaAssets.get(dramaIndex).assetName();
|
|
|
|
|
+ Integer asset_type = dramaAssets.get(dramaIndex).assetType();
|
|
|
|
|
+ for (String target : targetArray) {
|
|
|
for (String site : siteArray) {
|
|
for (String site : siteArray) {
|
|
|
- // 创建广告计划配置
|
|
|
|
|
- // 广告名称:一般是“账户分组名”+“日期时间”+"自增编号"
|
|
|
|
|
- String planName = accountGroupName.trim() + "-" + dateTime + "-" + dramaIndex;
|
|
|
|
|
- AdPlan adPlan = new AdPlan();
|
|
|
|
|
- adPlan.setAdPlanConfId(request.getId());
|
|
|
|
|
- adPlan.setAccountId(accountId);
|
|
|
|
|
- adPlan.setAdgroupId(0L);
|
|
|
|
|
- adPlan.setAdgroupName(planName);
|
|
|
|
|
- adPlan.setAdType(request.getAdType());
|
|
|
|
|
- adPlan.setTarget(target);
|
|
|
|
|
- adPlan.setSite(site);
|
|
|
|
|
- adPlan.setConversionId(request.getConversionId());
|
|
|
|
|
- adPlan.setAssetType(asset_type);
|
|
|
|
|
- if (asset_type == 1) {
|
|
|
|
|
- adPlan.setDramaId(assetId);
|
|
|
|
|
- adPlan.setDramaName(assetName);
|
|
|
|
|
- } else if (asset_type == 2) {
|
|
|
|
|
- adPlan.setFictionId(assetId);
|
|
|
|
|
- adPlan.setFictionName(assetName);
|
|
|
|
|
- }
|
|
|
|
|
- adPlan.setBidAmount(request.getBidAmount());
|
|
|
|
|
- //adType=2-ROI
|
|
|
|
|
- if (request.getAdType().equals(2)) {
|
|
|
|
|
- adPlan.setDeepConversionWorthRate(request.getDeepConversionWorthRate());
|
|
|
|
|
- } else {
|
|
|
|
|
- adPlan.setDeepConversionWorthRate(BigDecimal.ZERO);
|
|
|
|
|
- }
|
|
|
|
|
- adPlan.setWxCorpid(request.getWxCorpid());
|
|
|
|
|
- plans.add(adPlan);
|
|
|
|
|
- List<AdPlanCreative> adPlanCreatives = new ArrayList<>();
|
|
|
|
|
- adPlan.setAdCreatives(adPlanCreatives);
|
|
|
|
|
- int j = 0;
|
|
|
|
|
- for (OssFile creativeFile : creativeFileArr) {
|
|
|
|
|
- j++;
|
|
|
|
|
- String creativeUrl = creativeFile.getFileUrl();
|
|
|
|
|
- String originalFileName = creativeFile.getOriginalFileName();
|
|
|
|
|
- // 去除文件后缀
|
|
|
|
|
- String fileName = originalFileName != null
|
|
|
|
|
- ? originalFileName.replaceAll("\\.[^.]+$", "")
|
|
|
|
|
- : creativeUrl.substring(creativeUrl.lastIndexOf("/") + 1);
|
|
|
|
|
- String creativeName = accountGroupName.trim() + "-" + dateTime + "-" + j + "-" + fileName;
|
|
|
|
|
- AdPlanCreative adPlanCreative = new AdPlanCreative();
|
|
|
|
|
- adPlanCreative.setCreativeFileUrl(creativeUrl);
|
|
|
|
|
- adPlanCreative.setCreativeFileMd5(creativeFile.getFileMd5());
|
|
|
|
|
- adPlanCreative.setCreativeFileType(creativeFile.getFileType());
|
|
|
|
|
- adPlanCreative.setCreativeId(0L);
|
|
|
|
|
- adPlanCreative.setCreativeName(creativeName);
|
|
|
|
|
- adPlanCreative.setCreativeText(request.getCreativeText());
|
|
|
|
|
- adPlanCreative.setImageId(0L);
|
|
|
|
|
- adPlanCreative.setVideoId(0L);
|
|
|
|
|
- adPlanCreative.setBrandImageId(0L);
|
|
|
|
|
- adPlanCreative.setBrandName(request.getBrandName());
|
|
|
|
|
- adPlanCreative.setBrandImageUrl(request.getBrandImageFile().getFileUrl());
|
|
|
|
|
- adPlanCreative.setBrandImageFileMd5(request.getBrandImageFile().getFileMd5());
|
|
|
|
|
- adPlanCreative.setButtonText(request.getButtonText());
|
|
|
|
|
- adPlanCreative.setPageIds(request.getPageIds());
|
|
|
|
|
- adPlanCreatives.add(adPlanCreative);
|
|
|
|
|
|
|
+ dramaIndex++;
|
|
|
|
|
+ planIndex++;
|
|
|
|
|
+ // 创建广告计划配置
|
|
|
|
|
+ // 广告名称:一般是“账户分组名”+“日期时间”+"自增编号"
|
|
|
|
|
+ String planName = accountGroupName.trim() + "-" + dateTime + "-" + planIndex;
|
|
|
|
|
+ AdPlan adPlan = new AdPlan();
|
|
|
|
|
+ adPlan.setAdPlanConfId(request.getId());
|
|
|
|
|
+ adPlan.setAccountId(relationship.getAccountId());
|
|
|
|
|
+ adPlan.setAdgroupId(0L);
|
|
|
|
|
+ adPlan.setAdgroupName(planName);
|
|
|
|
|
+ adPlan.setAdType(request.getAdType());
|
|
|
|
|
+ adPlan.setTarget(target);
|
|
|
|
|
+ adPlan.setSite(site);
|
|
|
|
|
+ adPlan.setConversionId(request.getConversionId());
|
|
|
|
|
+ adPlan.setAssetType(asset_type);
|
|
|
|
|
+ if (asset_type == 1) {
|
|
|
|
|
+ adPlan.setDramaId(assetId);
|
|
|
|
|
+ adPlan.setDramaName(assetName);
|
|
|
|
|
+ } else if (asset_type == 2) {
|
|
|
|
|
+ adPlan.setFictionId(assetId);
|
|
|
|
|
+ adPlan.setFictionName(assetName);
|
|
|
|
|
+ }
|
|
|
|
|
+ adPlan.setBidAmount(request.getBidAmount());
|
|
|
|
|
+ // adType=2-ROI
|
|
|
|
|
+ if (request.getAdType().equals(2)) {
|
|
|
|
|
+ adPlan.setDeepConversionWorthRate(request.getDeepConversionWorthRate());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ adPlan.setDeepConversionWorthRate(BigDecimal.ZERO);
|
|
|
|
|
+ }
|
|
|
|
|
+ adPlan.setWxCorpid(request.getWxCorpid());
|
|
|
|
|
+ plans.add(adPlan);
|
|
|
|
|
+ List<AdPlanCreative> adPlanCreatives = new ArrayList<>();
|
|
|
|
|
+ adPlan.setAdCreatives(adPlanCreatives);
|
|
|
|
|
+ int j = 0;
|
|
|
|
|
+ for (OssFile creativeFile : creativeFileArr) {
|
|
|
|
|
+ j++;
|
|
|
|
|
+ String creativeUrl = creativeFile.getFileUrl();
|
|
|
|
|
+ String originalFileName = creativeFile.getOriginalFileName();
|
|
|
|
|
+ // 去除文件后缀
|
|
|
|
|
+ String fileName = originalFileName != null
|
|
|
|
|
+ ? originalFileName.replaceAll("\\.[^.]+$", "")
|
|
|
|
|
+ : creativeUrl.substring(creativeUrl.lastIndexOf("/") + 1);
|
|
|
|
|
+ String creativeName = accountGroupName.trim() + "-" + dateTime + "-" + j + "-"
|
|
|
|
|
+ + fileName;
|
|
|
|
|
+ AdPlanCreative adPlanCreative = new AdPlanCreative();
|
|
|
|
|
+ adPlanCreative.setCreativeFileUrl(creativeUrl);
|
|
|
|
|
+ adPlanCreative.setCreativeFileMd5(creativeFile.getFileMd5());
|
|
|
|
|
+ adPlanCreative.setCreativeFileType(creativeFile.getFileType());
|
|
|
|
|
+ adPlanCreative.setCreativeId(0L);
|
|
|
|
|
+ adPlanCreative.setCreativeName(creativeName);
|
|
|
|
|
+ adPlanCreative.setCreativeText(request.getCreativeText());
|
|
|
|
|
+ adPlanCreative.setImageId(0L);
|
|
|
|
|
+ adPlanCreative.setVideoId(0L);
|
|
|
|
|
+ adPlanCreative.setBrandImageId(0L);
|
|
|
|
|
+ adPlanCreative.setBrandName(request.getBrandName());
|
|
|
|
|
+ adPlanCreative.setBrandImageUrl(request.getBrandImageFile().getFileUrl());
|
|
|
|
|
+ adPlanCreative.setBrandImageFileMd5(request.getBrandImageFile().getFileMd5());
|
|
|
|
|
+ adPlanCreative.setButtonText(request.getButtonText());
|
|
|
|
|
+ adPlanCreative.setPageIds(request.getPageIds());
|
|
|
|
|
+ adPlanCreatives.add(adPlanCreative);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ if ((assetType == 2 || assetType == 3) && fictionAmount > 0) {
|
|
|
|
|
+ for (int j = 0; j < fictionAmount; j++) {
|
|
|
|
|
+ Long assetId = fictionAssets.get(fictionIndex).assetId();
|
|
|
|
|
+ String assetName = fictionAssets.get(fictionIndex).assetName();
|
|
|
|
|
+ Integer asset_type = fictionAssets.get(fictionIndex).assetType();
|
|
|
|
|
+ System.out.println("fictionIndex: " + fictionIndex);
|
|
|
|
|
+ for (String target : targetArray) {
|
|
|
|
|
+ for (String site : siteArray) {
|
|
|
|
|
+ fictionIndex++;
|
|
|
|
|
+ planIndex++;
|
|
|
|
|
+ // 创建广告计划配置
|
|
|
|
|
+ // 广告名称:一般是“账户分组名”+“日期时间”+"自增编号"
|
|
|
|
|
+ String planName = accountGroupName.trim() + "-" + dateTime + "-" + planIndex;
|
|
|
|
|
+ AdPlan adPlan = new AdPlan();
|
|
|
|
|
+ adPlan.setAdPlanConfId(request.getId());
|
|
|
|
|
+ adPlan.setAccountId(relationship.getAccountId());
|
|
|
|
|
+ adPlan.setAdgroupId(0L);
|
|
|
|
|
+ adPlan.setAdgroupName(planName);
|
|
|
|
|
+ adPlan.setAdType(request.getAdType());
|
|
|
|
|
+ adPlan.setTarget(target);
|
|
|
|
|
+ adPlan.setSite(site);
|
|
|
|
|
+ adPlan.setConversionId(request.getConversionId());
|
|
|
|
|
+ adPlan.setAssetType(asset_type);
|
|
|
|
|
+ if (asset_type == 1) {
|
|
|
|
|
+ adPlan.setDramaId(assetId);
|
|
|
|
|
+ adPlan.setDramaName(assetName);
|
|
|
|
|
+ } else if (asset_type == 2) {
|
|
|
|
|
+ adPlan.setFictionId(assetId);
|
|
|
|
|
+ adPlan.setFictionName(assetName);
|
|
|
|
|
+ }
|
|
|
|
|
+ adPlan.setBidAmount(request.getBidAmount());
|
|
|
|
|
+ // adType=2-ROI
|
|
|
|
|
+ if (request.getAdType().equals(2)) {
|
|
|
|
|
+ adPlan.setDeepConversionWorthRate(request.getDeepConversionWorthRate());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ adPlan.setDeepConversionWorthRate(BigDecimal.ZERO);
|
|
|
|
|
+ }
|
|
|
|
|
+ adPlan.setWxCorpid(request.getWxCorpid());
|
|
|
|
|
+ plans.add(adPlan);
|
|
|
|
|
+ List<AdPlanCreative> adPlanCreatives = new ArrayList<>();
|
|
|
|
|
+ adPlan.setAdCreatives(adPlanCreatives);
|
|
|
|
|
+ int ci = 0;
|
|
|
|
|
+ for (OssFile creativeFile : creativeFileArr) {
|
|
|
|
|
+ ci++;
|
|
|
|
|
+ String creativeUrl = creativeFile.getFileUrl();
|
|
|
|
|
+ String originalFileName = creativeFile.getOriginalFileName();
|
|
|
|
|
+ // 去除文件后缀
|
|
|
|
|
+ String fileName = originalFileName != null
|
|
|
|
|
+ ? originalFileName.replaceAll("\\.[^.]+$", "")
|
|
|
|
|
+ : creativeUrl.substring(creativeUrl.lastIndexOf("/") + 1);
|
|
|
|
|
+ String creativeName = accountGroupName.trim() + "-" + dateTime + "-" + ci + "-"
|
|
|
|
|
+ + fileName;
|
|
|
|
|
+ AdPlanCreative adPlanCreative = new AdPlanCreative();
|
|
|
|
|
+ adPlanCreative.setCreativeFileUrl(creativeUrl);
|
|
|
|
|
+ adPlanCreative.setCreativeFileMd5(creativeFile.getFileMd5());
|
|
|
|
|
+ adPlanCreative.setCreativeFileType(creativeFile.getFileType());
|
|
|
|
|
+ adPlanCreative.setCreativeId(0L);
|
|
|
|
|
+ adPlanCreative.setCreativeName(creativeName);
|
|
|
|
|
+ adPlanCreative.setCreativeText(request.getCreativeText());
|
|
|
|
|
+ adPlanCreative.setImageId(0L);
|
|
|
|
|
+ adPlanCreative.setVideoId(0L);
|
|
|
|
|
+ adPlanCreative.setBrandImageId(0L);
|
|
|
|
|
+ adPlanCreative.setBrandName(request.getBrandName());
|
|
|
|
|
+ adPlanCreative.setBrandImageUrl(request.getBrandImageFile().getFileUrl());
|
|
|
|
|
+ adPlanCreative.setBrandImageFileMd5(request.getBrandImageFile().getFileMd5());
|
|
|
|
|
+ adPlanCreative.setButtonText(request.getButtonText());
|
|
|
|
|
+ adPlanCreative.setPageIds(request.getPageIds());
|
|
|
|
|
+ adPlanCreatives.add(adPlanCreative);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
return plans;
|
|
return plans;
|
|
|
}
|
|
}
|
|
@@ -382,7 +485,7 @@ public class AdPlanConfController {
|
|
|
|
|
|
|
|
@GetMapping("/syncSystemStatus/{id}")
|
|
@GetMapping("/syncSystemStatus/{id}")
|
|
|
public Result<Void> syncSystemStatus(@PathVariable Long id, @AuthUser SysUser sysUser) {
|
|
public Result<Void> syncSystemStatus(@PathVariable Long id, @AuthUser SysUser sysUser) {
|
|
|
- //redis锁 1分钟
|
|
|
|
|
|
|
+ // redis锁 1分钟
|
|
|
String lockKey = "ad_plan_conf_sync_system_status_lock_" + id;
|
|
String lockKey = "ad_plan_conf_sync_system_status_lock_" + id;
|
|
|
Boolean isLocked = redisTemplate.opsForValue().setIfAbsent(lockKey, "1", 1, TimeUnit.MINUTES);
|
|
Boolean isLocked = redisTemplate.opsForValue().setIfAbsent(lockKey, "1", 1, TimeUnit.MINUTES);
|
|
|
if (!isLocked) {
|
|
if (!isLocked) {
|
|
@@ -391,7 +494,10 @@ public class AdPlanConfController {
|
|
|
adPlanService.syncAdPlanStatus(id);
|
|
adPlanService.syncAdPlanStatus(id);
|
|
|
adPlanCreativeService.syncAdPlanCreativeStatus(id);
|
|
adPlanCreativeService.syncAdPlanCreativeStatus(id);
|
|
|
adPlanDailyReportService.syncDailyReport(id);
|
|
adPlanDailyReportService.syncDailyReport(id);
|
|
|
- try {TimeUnit.SECONDS.sleep(2L);} catch (InterruptedException e) {}
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ TimeUnit.SECONDS.sleep(2L);
|
|
|
|
|
+ } catch (InterruptedException e) {
|
|
|
|
|
+ }
|
|
|
return Result.success("同步系统状态执行中");
|
|
return Result.success("同步系统状态执行中");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -491,10 +597,8 @@ public class AdPlanConfController {
|
|
|
@Operation(summary = "获取广告计划配置列表", description = "分页获取当前用户的所有广告计划配置")
|
|
@Operation(summary = "获取广告计划配置列表", description = "分页获取当前用户的所有广告计划配置")
|
|
|
@McpTool(name = "get-my-ad-plan-config-list", description = "分页获取当前用户的所有广告计划配置")
|
|
@McpTool(name = "get-my-ad-plan-config-list", description = "分页获取当前用户的所有广告计划配置")
|
|
|
public Result<Page<AdPlanConf>> getMyAdPlanConfigList(
|
|
public Result<Page<AdPlanConf>> getMyAdPlanConfigList(
|
|
|
- @McpToolParam(description = "页码")
|
|
|
|
|
- @Parameter(description = "页码", example = "1") @RequestParam(defaultValue = "1") Integer pageNum,
|
|
|
|
|
- @McpToolParam(description = "每页大小")
|
|
|
|
|
- @Parameter(description = "每页大小", example = "10") @RequestParam(defaultValue = "10") Integer pageSize,
|
|
|
|
|
|
|
+ @McpToolParam(description = "页码") @Parameter(description = "页码", example = "1") @RequestParam(defaultValue = "1") Integer pageNum,
|
|
|
|
|
+ @McpToolParam(description = "每页大小") @Parameter(description = "每页大小", example = "10") @RequestParam(defaultValue = "10") Integer pageSize,
|
|
|
@AuthUser SysUser sysUser) {
|
|
@AuthUser SysUser sysUser) {
|
|
|
try {
|
|
try {
|
|
|
Page<AdPlanConf> page = adPlanConfService.getUserAdPlanConfs(
|
|
Page<AdPlanConf> page = adPlanConfService.getUserAdPlanConfs(
|