Selaa lähdekoodia

规则引擎,修改bug

zhaoxian 3 vuotta sitten
vanhempi
commit
9c4eff52d5

+ 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);
 }

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

@@ -3,6 +3,7 @@ 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.stereotype.Service;
 
@@ -20,7 +21,7 @@ public class ExternalLinkServiceImpl implements ExternalLinkService {
     //测试IP  http://139.186.165.84:8808/bytedance-api/advertiser/bytedanceReportController/updateADCpaBid
 
     @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);
         if (!Check.isNull(cpaBid)) {
@@ -33,9 +34,14 @@ 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 = jsonObject.getInteger("code");
+        if(code!=0){
+            log.error("调用微服务接口,修改头条计划失败,入参={},message={}",buf.toString(),jsonObject.getString("message"));
+        }
+        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";