瀏覽代碼

Merge branch 'V2.0.1' into test

zhaoxian 3 年之前
父節點
當前提交
e62cb7c77f

+ 1 - 1
jeecg-boot-module-system/src/main/java/cn/com/ctop/alarm/modules/service/ExternalLinkService.java

@@ -10,5 +10,5 @@ import java.math.BigDecimal;
  */
 public interface ExternalLinkService {
 
-    String editBytedancePlanCpaBidOrBudget(Long accountId, String adId, BigDecimal cpaBid, String adScheduleTime,Long budget);
+    Integer editBytedancePlanCpaBidOrBudget(Long accountId, String adId, BigDecimal cpaBid, String adScheduleTime,Long budget);
 }

+ 20 - 5
jeecg-boot-module-system/src/main/java/cn/com/ctop/alarm/modules/service/impl/ExternalLinkServiceImpl.java

@@ -3,7 +3,9 @@ package cn.com.ctop.alarm.modules.service.impl;
 import cn.com.ctop.alarm.modules.service.ExternalLinkService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
+import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
@@ -15,14 +17,17 @@ import java.math.BigDecimal;
 @Service
 public class ExternalLinkServiceImpl implements ExternalLinkService {
     //修改头条CPABID出价,投放时间
-    private static final String URL_UPDATE_CPABID = "http://118.24.244.213:8808/bytedance-api/advertiser/bytedanceReportController/updateADCpaBid";
+//    private static final String URL_UPDATE_CPABID = "http://139.186.165.84:8808/bytedance-api/advertiser/bytedanceReportController/updateADCpaBid";
     //线上IP  http://118.24.244.213:8808/bytedance-api/advertiser/bytedanceReportController/updateADCpaBid
     //测试IP  http://139.186.165.84:8808/bytedance-api/advertiser/bytedanceReportController/updateADCpaBid
+    @Value("${rule.bytedanceUrl}")
+    private String URL_UPDATE_CPABID;
+
 
     @Override
-    public String editBytedancePlanCpaBidOrBudget(Long accountId, String adId, BigDecimal cpaBid, String adScheduleTime, Long budget) {
+    public Integer editBytedancePlanCpaBidOrBudget(Long accountId, String adId, BigDecimal cpaBid, String adScheduleTime, Long budget) {
         StringBuffer buf = new StringBuffer();
-        buf.append("?accountId=").append(accountId).append("&adId=").append(adId);
+        buf.append("bytedance-api/advertiser/bytedanceReportController/updateADCpaBid?accountId=").append(accountId).append("&adId=").append(adId);
         if (!Check.isNull(cpaBid)) {
             buf.append("&cpaBid=").append(cpaBid);
         }
@@ -33,9 +38,19 @@ public class ExternalLinkServiceImpl implements ExternalLinkService {
             buf.append("&budget=").append(budget);
         }
         log.info("调用微服务接口,修改头条计划出价、预算、投放时间段。。。。。。start");
-        HttpUtils.httpGet(URL_UPDATE_CPABID + buf.toString(), null, null);
+        String result = HttpUtils.httpGet(URL_UPDATE_CPABID + buf.toString(), null, null);
         log.info("调用微服务接口,修改头条计划出价、预算、投放时间段。。。。。。end");
-        return null;
+        JSONObject jsonObject = JSONObject.parseObject(result);
+        Integer code = -1;
+        if (!Check.isNull(jsonObject)) {
+            code = jsonObject.getInteger("code");
+            if (code != 0) {
+                log.error("调用微服务接口,修改头条计划失败,入参={};-------------------message={}", buf.toString(), jsonObject.getString("message"));
+            }
+        } else {
+            log.error("调用微服务接口,修改头条计划失败,入参={};-------------------返回结果:{}", result);
+        }
+        return code;
     }
 
 

+ 6 - 6
jeecg-boot-module-system/src/main/java/cn/com/ctop/alarm/modules/service/impl/RuleGroupServiceImpl.java

@@ -534,9 +534,9 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                         newBid = calculatedValue(oldBid, operationType, operationValue, operationThreshold, maxValue, minValue, 1);
                     }
                     //TODO
-                    String code = externalLinkService.editBytedancePlanCpaBidOrBudget(accountId, planId.toString(), new BigDecimal(newBid.toString()), null, null);
+                    Integer code = externalLinkService.editBytedancePlanCpaBidOrBudget(accountId, planId.toString(), new BigDecimal(newBid.toString()), null, null);
                     String message = "success";
-                    if (code.equals("")) {
+                    if (code == 0) {
                         alreadyOperatedList.add(obj);
                     } else {
                         message = "fail";
@@ -561,9 +561,9 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                         newBudget = calculatedValue(oldBudget, operationType, operationValue, operationThreshold, maxValue, minValue, 1);
                     }
                     //TODO
-                    String code = externalLinkService.editBytedancePlanCpaBidOrBudget(accountId, planId.toString(), null, null, newBudget);
+                    Integer code = externalLinkService.editBytedancePlanCpaBidOrBudget(accountId, planId.toString(), null, null, newBudget);
                     String message = "success";
-                    if (code.equals("")) {
+                    if (code == 0) {
                         alreadyOperatedList.add(obj);
                     } else {
                         message = "fail";
@@ -573,9 +573,9 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                     //修改投放时间
                 } else if ("TIME".equals(operate) && !byteDancePlan.getScheduleTime().equals(operationThreshold)) {
                     //TODO
-                    String code = externalLinkService.editBytedancePlanCpaBidOrBudget(accountId, planId.toString(), null, operationThreshold, null);
+                    Integer code = externalLinkService.editBytedancePlanCpaBidOrBudget(accountId, planId.toString(), null, operationThreshold, null);
                     String message = "success";
-                    if (code.equals("")) {
+                    if (code == 0) {
                         alreadyOperatedList.add(obj);
                     } else {
                         message = "fail";

+ 3 - 1
jeecg-cloud-module/jeecg-cloud-system-start/src/main/resources/application-dev.yml

@@ -265,4 +265,6 @@ ai:
     callback-unit-url: http://192.168.1.193:31012/ai_callback_add_group
     callback-creative-url: http://192.168.1.193:31012/ai_callback_add_creative
 xxl-job:
-  requestUrl: http://jiaoyangapi.shyouteng.com.cn
+  requestUrl: http://jiaoyangapi.shyouteng.com.cn
+rule:
+    bytedanceUrl: http://139.186.165.84:8808/

+ 2 - 0
jeecg-cloud-module/jeecg-cloud-system-start/src/main/resources/application-prod.yml

@@ -265,3 +265,5 @@ ai:
     callback-creative-url: http://139.186.27.96::31012/ai_callback_add_creative
 xxl-job:
   requestUrl: http://jiaoyangapi.shyouteng.com.cn
+rule:
+  bytedanceUrl: http://118.24.244.213:8808/