Kaynağa Gözat

非空校验

yangzian 4 yıl önce
ebeveyn
işleme
fcec079405

+ 1 - 1
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/entity/AiBytedanceAdvertiserStrategy.java

@@ -86,7 +86,7 @@ public class AiBytedanceAdvertiserStrategy{
 	/**优先从系统应用商店下载(投放目标)*/
 	private String adDownloadMode;
 	/**转化目标OPCM时必填(投放目标)*/
-	private Integer adConvertId;
+	private Long adConvertId;
 	/**直达链接(投放目标)*/
 	private String adOpenUrl;
 	/**附加创意类型(投放目标)*/

+ 20 - 9
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/impl/AiBytedanceAdvertiserStrategyServiceImpl.java

@@ -156,34 +156,43 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         Map<String,Object> mapPrice = new HashMap<>();
         //1-修改出价
         if (BytedanceConstant.UPDTYPE_BID.equals(updAdStaOrCpaOrBudget.getType())) {
-              mapPrice.put("ad_id",updAdStaOrCpaOrBudget.getAdId());
+            if (Check.isNull(updAdStaOrCpaOrBudget.getBId())){
+                return Result.errorMsg("出价不能为空,请重新输入。");
+            }
+            aiBytedanceAdvertiserStrategyMapper.updCpaById(updAdStaOrCpaOrBudget.getId(),updAdStaOrCpaOrBudget.getBId());
+          /*
+            mapPrice.put("ad_id",updAdStaOrCpaOrBudget.getAdId());
             mapPrice.put("bid",updAdStaOrCpaOrBudget.getBId());
             priceList.add(mapPrice);
-
+*/
             // api 更新计划出价 TODO
          /* updResult = marketing.updatePlanBid(token,updAdStaOrCpaOrBudget.getAccountId(),priceList);
             if (!"200".equals(updResult.getCode())){
                 return Result.error(updResult.getMessage());
             }*/
             // 修改 出价
-            priceList.forEach(map-> {
+          /*  priceList.forEach(map-> {
                 aiBytedanceAdvertiserStrategyMapper.updCpaById(updAdStaOrCpaOrBudget.getId(),updAdStaOrCpaOrBudget.getBId());
-            });
+            });*/
         }
         //2-修改预算
         if (BytedanceConstant.UPDTYPE_BUDGET.equals(updAdStaOrCpaOrBudget.getType())) {
-            mapPrice.put("ad_id",updAdStaOrCpaOrBudget.getAdId());
+            if (Check.isNull(updAdStaOrCpaOrBudget.getBudget())){
+                return Result.errorMsg("预算不能为空,请重新输入。");
+            }
+            aiBytedanceAdvertiserStrategyMapper.updBudgetById(updAdStaOrCpaOrBudget.getId(),updAdStaOrCpaOrBudget.getBudget());
+           /* mapPrice.put("ad_id",updAdStaOrCpaOrBudget.getAdId());
             mapPrice.put("budget",updAdStaOrCpaOrBudget.getBudget());
-            priceList.add(mapPrice);
+            priceList.add(mapPrice);*/
             // api 修改计划 预算
            /* updResult = marketing.updatePlanBudget(token,updAdStaOrCpaOrBudget.getAccountId(),priceList);
             if (!"200".equals(updResult.getCode())){
                 return Result.error(updResult.getMessage());
             }*/
             // 修改 预算 TODO
-            priceList.forEach(map-> {
+            /*priceList.forEach(map-> {
                 aiBytedanceAdvertiserStrategyMapper.updBudgetById(updAdStaOrCpaOrBudget.getId(),updAdStaOrCpaOrBudget.getBudget());
-            });
+            });*/
         }
         return Result.successMsg("修改"+(BytedanceConstant.UPDTYPE_BID.equals(updAdStaOrCpaOrBudget.getType()) ? "出价" : "预算")+"成功。", updResult.getResult());
     }
@@ -423,7 +432,6 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
      * @param aiBytedanceAdvertiserStrategy
      * @return: org.jeecg.common.api.vo.Result
      * @author: zianY
-     * @time: 2021/5/6 10:26
      */
     public Result addBytedanceStrategy(AiBytedanceAdvertiserStrategy aiBytedanceAdvertiserStrategy) {
         // 数据入库 string[] 转 string
@@ -433,12 +441,15 @@ public class AiBytedanceAdvertiserStrategyServiceImpl extends ServiceImpl<AiByte
         aiBytedanceAdvertiserStrategy.setCreativeInventoryType(StringUtils.join(aiBytedanceAdvertiserStrategy.getCreativeInventoryTypes(), ","));
         //创意标签
         aiBytedanceAdvertiserStrategy.setCreativeAdKeywords(StringUtils.join(aiBytedanceAdvertiserStrategy.getAdKeywords(), ","));
+        //状态(0开 1关)
+        aiBytedanceAdvertiserStrategy.setStatus(0);
 
         //添加素材信息
         MaterialImageInfo imageInfo = new MaterialImageInfo();
         imageInfo.setUrl(aiBytedanceAdvertiserStrategy.getImageUrl());
         imageInfo.setUserId(aiBytedanceAdvertiserStrategy.getUserId());
         materialImageInfoService.initImageCode(imageInfo);
+
         aiBytedanceAdvertiserStrategyMapper.insert(aiBytedanceAdvertiserStrategy);
 
         return Result.successMsg("新增成功。",aiBytedanceAdvertiserStrategy);

+ 9 - 3
jeecg-boot-module-system/src/main/java/org/jeecg/modules/bytedance/advertise/controller/AiBytedanceAdvertiserStrategyController.java

@@ -199,11 +199,17 @@ public class AiBytedanceAdvertiserStrategyController {
 			result.error500("未找到对应实体");
 		}else {
 			//商品卖点
-			aiBytedanceAdvertiserStrategy.setProductSellingPoints(aiBytedanceAdvertiserStrategy.getCreativeProductSellingPoints().split(","));
+			if (!Check.isNull(aiBytedanceAdvertiserStrategy.getCreativeProductSellingPoints())){
+				aiBytedanceAdvertiserStrategy.setProductSellingPoints(aiBytedanceAdvertiserStrategy.getCreativeProductSellingPoints().split(","));
+			}
 			//广告位置
-			aiBytedanceAdvertiserStrategy.setCreativeInventoryTypes(aiBytedanceAdvertiserStrategy.getCreativeInventoryType().split(","));
+			if (!Check.isNull(aiBytedanceAdvertiserStrategy.getCreativeInventoryType())){
+				aiBytedanceAdvertiserStrategy.setCreativeInventoryTypes(aiBytedanceAdvertiserStrategy.getCreativeInventoryType().split(","));
+			}
 			//创意标签
-			aiBytedanceAdvertiserStrategy.setAdKeywords(aiBytedanceAdvertiserStrategy.getCreativeAdKeywords().split(","));
+			if (!Check.isNull(aiBytedanceAdvertiserStrategy.getCreativeAdKeywords())){
+				aiBytedanceAdvertiserStrategy.setAdKeywords(aiBytedanceAdvertiserStrategy.getCreativeAdKeywords().split(","));
+			}
 			//素材图片url
 			MaterialImageInfo materialImageInfo = materialImageInfoService.getByCode(aiBytedanceAdvertiserStrategy.getCreativeProductImageCode());
 			aiBytedanceAdvertiserStrategy.setImageUrl(materialImageInfo.getUrl());