浏览代码

规则引擎,修改bug,头条逻辑修改

zhaoxian 3 年之前
父节点
当前提交
84e98ddf35

+ 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 {
 public interface ExternalLinkService {
 
 
-    Integer editBytedancePlanCpaBidOrBudget(Long accountId, String adId, BigDecimal cpaBid, String adScheduleTime,Long budget);
+    Integer editBytedancePlanCpaBidOrBudget(Long accountId, String adId, BigDecimal cpaBid, String adScheduleTime,BigDecimal budget);
 }
 }

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

@@ -25,7 +25,7 @@ public class ExternalLinkServiceImpl implements ExternalLinkService {
 
 
 
 
     @Override
     @Override
-    public Integer editBytedancePlanCpaBidOrBudget(Long accountId, String adId, BigDecimal cpaBid, String adScheduleTime, Long budget) {
+    public Integer editBytedancePlanCpaBidOrBudget(Long accountId, String adId, BigDecimal cpaBid, String adScheduleTime, BigDecimal budget) {
         StringBuffer buf = new StringBuffer();
         StringBuffer buf = new StringBuffer();
         buf.append("bytedance-api/advertiser/bytedanceReportController/updateADCpaBid?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)) {
         if (!Check.isNull(cpaBid)) {

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

@@ -522,19 +522,19 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                     if (("up".equals(operationType) && oldBid.compareTo(new BigDecimal(maxValue)) == 0) || ("down".equals(operationType) && oldBid.compareTo(new BigDecimal(minValue)) == 0)) {
                     if (("up".equals(operationType) && oldBid.compareTo(new BigDecimal(maxValue)) == 0) || ("down".equals(operationType) && oldBid.compareTo(new BigDecimal(minValue)) == 0)) {
                         continue;
                         continue;
                     }
                     }
-                    Long newBid = 0L;
+                    BigDecimal newBid = null;
                     if ("to".equals(operationType)) {
                     if ("to".equals(operationType)) {
                         //金额直接赋值
                         //金额直接赋值
                         if ("price".equals(operationValue)) {
                         if ("price".equals(operationValue)) {
-                            newBid = new BigDecimal(operationThreshold).longValue();
+                            newBid = new BigDecimal(operationThreshold);
                         } else {//百分比需计算
                         } else {//百分比需计算
-                            newBid = new BigDecimal(operationThreshold).multiply(oldBid).longValue();
+                            newBid = new BigDecimal(operationThreshold).multiply(oldBid);
                         }
                         }
                     } else {
                     } else {
                         newBid = calculatedValue(oldBid, operationType, operationValue, operationThreshold, maxValue, minValue, 1);
                         newBid = calculatedValue(oldBid, operationType, operationValue, operationThreshold, maxValue, minValue, 1);
                     }
                     }
                     //TODO
                     //TODO
-                    Integer code = externalLinkService.editBytedancePlanCpaBidOrBudget(accountId, planId.toString(), new BigDecimal(newBid.toString()), null, null);
+                    Integer code = externalLinkService.editBytedancePlanCpaBidOrBudget(accountId, planId.toString(), newBid, null, null);
                     String message = "success";
                     String message = "success";
                     if (code == 0) {
                     if (code == 0) {
                         alreadyOperatedList.add(obj);
                         alreadyOperatedList.add(obj);
@@ -549,13 +549,13 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                     if (("up".equals(operationType) && oldBudget.compareTo(new BigDecimal(maxValue)) == 0) || ("down".equals(operationType) && oldBudget.compareTo(new BigDecimal(minValue)) == 0)) {
                     if (("up".equals(operationType) && oldBudget.compareTo(new BigDecimal(maxValue)) == 0) || ("down".equals(operationType) && oldBudget.compareTo(new BigDecimal(minValue)) == 0)) {
                         continue;
                         continue;
                     }
                     }
-                    Long newBudget = 0L;
+                    BigDecimal newBudget = null;
                     if ("to".equals(operationType)) {
                     if ("to".equals(operationType)) {
                         //金额直接赋值
                         //金额直接赋值
                         if ("price".equals(operationValue)) {
                         if ("price".equals(operationValue)) {
-                            newBudget = new BigDecimal(operationThreshold).longValue();
+                            newBudget = new BigDecimal(operationThreshold);
                         } else {//百分比需计算
                         } else {//百分比需计算
-                            newBudget = new BigDecimal(operationThreshold).multiply(oldBudget).longValue();
+                            newBudget = new BigDecimal(operationThreshold).multiply(oldBudget);
                         }
                         }
                     } else {
                     } else {
                         newBudget = calculatedValue(oldBudget, operationType, operationValue, operationThreshold, maxValue, minValue, 1);
                         newBudget = calculatedValue(oldBudget, operationType, operationValue, operationThreshold, maxValue, minValue, 1);
@@ -614,7 +614,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                             newBid = new BigDecimal(operationThreshold).multiply(oldBidDecimal).longValue();
                             newBid = new BigDecimal(operationThreshold).multiply(oldBidDecimal).longValue();
                         }
                         }
                     } else {
                     } else {
-                        newBid = calculatedValue(oldBidDecimal, operationType, operationValue, operationThreshold, maxValue, minValue, 2);
+                        newBid = calculatedValue(oldBidDecimal, operationType, operationValue, operationThreshold, maxValue, minValue, 2).longValue();
                     }
                     }
                     JSONObject unitJson = new JSONObject();
                     JSONObject unitJson = new JSONObject();
                     unitJson.put("advertiser_id", accountId);
                     unitJson.put("advertiser_id", accountId);
@@ -662,7 +662,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                             newBudget = new BigDecimal(operationThreshold).multiply(oldBudgetDecimal).longValue();
                             newBudget = new BigDecimal(operationThreshold).multiply(oldBudgetDecimal).longValue();
                         }
                         }
                     } else {
                     } else {
-                        newBudget = calculatedValue(oldBudgetDecimal, operationType, operationValue, operationThreshold, maxValue, minValue, 2);
+                        newBudget = calculatedValue(oldBudgetDecimal, operationType, operationValue, operationThreshold, maxValue, minValue, 2).longValue();
                     }
                     }
                     Map<String, Object> updateMap = kuaiShouUpdateService.updateUnitDayBudget(token.getAccessToken(), accountId, unitId, newBudget, "规则引擎修改预算");
                     Map<String, Object> updateMap = kuaiShouUpdateService.updateUnitDayBudget(token.getAccessToken(), accountId, unitId, newBudget, "规则引擎修改预算");
                     BigDecimal divide = new BigDecimal(newBudget + "").divide(new BigDecimal("1000"));
                     BigDecimal divide = new BigDecimal(newBudget + "").divide(new BigDecimal("1000"));
@@ -792,7 +792,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
      * @return
      * @return
      * @throws
      * @throws
      */
      */
-    private static Long calculatedValue(BigDecimal goal, String operationType, String operationValue, String operationThreshold, String fmaxValue, String fminValue, Integer type) {
+    private static BigDecimal calculatedValue(BigDecimal goal, String operationType, String operationValue, String operationThreshold, String fmaxValue, String fminValue, Integer type) {
         BigDecimal threshold = new BigDecimal(operationThreshold);
         BigDecimal threshold = new BigDecimal(operationThreshold);
         BigDecimal maxValue = new BigDecimal(fmaxValue);
         BigDecimal maxValue = new BigDecimal(fmaxValue);
         BigDecimal minValue = new BigDecimal(fminValue);
         BigDecimal minValue = new BigDecimal(fminValue);
@@ -830,7 +830,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                     value = goal.multiply(threshold);
                     value = goal.multiply(threshold);
                 }
                 }
             }
             }
-            return value.longValue();
+            return value;
         } else {
         } else {
             goal = goal.divide(new BigDecimal("1000"));
             goal = goal.divide(new BigDecimal("1000"));
             //操作金额
             //操作金额
@@ -864,7 +864,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
                     value = goal.multiply(threshold);
                     value = goal.multiply(threshold);
                 }
                 }
             }
             }
-            return value.multiply(new BigDecimal("1000")).longValue();
+            return value.multiply(new BigDecimal("1000"));
         }
         }
     }
     }