|
@@ -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)) {
|
|
|
continue;
|
|
|
}
|
|
|
- Long newBid = 0L;
|
|
|
+ BigDecimal newBid = null;
|
|
|
if ("to".equals(operationType)) {
|
|
|
//金额直接赋值
|
|
|
if ("price".equals(operationValue)) {
|
|
|
- newBid = new BigDecimal(operationThreshold).longValue();
|
|
|
+ newBid = new BigDecimal(operationThreshold);
|
|
|
} else {//百分比需计算
|
|
|
- newBid = new BigDecimal(operationThreshold).multiply(oldBid).longValue();
|
|
|
+ newBid = new BigDecimal(operationThreshold).multiply(oldBid);
|
|
|
}
|
|
|
} else {
|
|
|
newBid = calculatedValue(oldBid, operationType, operationValue, operationThreshold, maxValue, minValue, 1);
|
|
|
}
|
|
|
//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";
|
|
|
if (code == 0) {
|
|
|
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)) {
|
|
|
continue;
|
|
|
}
|
|
|
- Long newBudget = 0L;
|
|
|
+ BigDecimal newBudget = null;
|
|
|
if ("to".equals(operationType)) {
|
|
|
//金额直接赋值
|
|
|
if ("price".equals(operationValue)) {
|
|
|
- newBudget = new BigDecimal(operationThreshold).longValue();
|
|
|
+ newBudget = new BigDecimal(operationThreshold);
|
|
|
} else {//百分比需计算
|
|
|
- newBudget = new BigDecimal(operationThreshold).multiply(oldBudget).longValue();
|
|
|
+ newBudget = new BigDecimal(operationThreshold).multiply(oldBudget);
|
|
|
}
|
|
|
} else {
|
|
|
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();
|
|
|
}
|
|
|
} else {
|
|
|
- newBid = calculatedValue(oldBidDecimal, operationType, operationValue, operationThreshold, maxValue, minValue, 2);
|
|
|
+ newBid = calculatedValue(oldBidDecimal, operationType, operationValue, operationThreshold, maxValue, minValue, 2).longValue();
|
|
|
}
|
|
|
JSONObject unitJson = new JSONObject();
|
|
|
unitJson.put("advertiser_id", accountId);
|
|
@@ -662,7 +662,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
newBudget = new BigDecimal(operationThreshold).multiply(oldBudgetDecimal).longValue();
|
|
|
}
|
|
|
} 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, "规则引擎修改预算");
|
|
|
BigDecimal divide = new BigDecimal(newBudget + "").divide(new BigDecimal("1000"));
|
|
@@ -792,7 +792,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
* @return
|
|
|
* @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 maxValue = new BigDecimal(fmaxValue);
|
|
|
BigDecimal minValue = new BigDecimal(fminValue);
|
|
@@ -830,7 +830,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
value = goal.multiply(threshold);
|
|
|
}
|
|
|
}
|
|
|
- return value.longValue();
|
|
|
+ return value;
|
|
|
} else {
|
|
|
goal = goal.divide(new BigDecimal("1000"));
|
|
|
//操作金额
|
|
@@ -864,7 +864,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
|
value = goal.multiply(threshold);
|
|
|
}
|
|
|
}
|
|
|
- return value.multiply(new BigDecimal("1000")).longValue();
|
|
|
+ return value.multiply(new BigDecimal("1000"));
|
|
|
}
|
|
|
}
|
|
|
|