|
@@ -508,6 +508,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
String maxValue = Check.isNull(thresholdJson.getString("maxValue")) ? "-1" : thresholdJson.getString("maxValue");
|
|
String maxValue = Check.isNull(thresholdJson.getString("maxValue")) ? "-1" : thresholdJson.getString("maxValue");
|
|
String minValue = Check.isNull(thresholdJson.getString("minValue")) ? "-1" : thresholdJson.getString("minValue");
|
|
String minValue = Check.isNull(thresholdJson.getString("minValue")) ? "-1" : thresholdJson.getString("minValue");
|
|
|
|
|
|
|
|
+
|
|
if (type == 1 || type == 3) {
|
|
if (type == 1 || type == 3) {
|
|
Long planId = obj.getLong("planId");//头条
|
|
Long planId = obj.getLong("planId");//头条
|
|
if (Check.isNull(planId)) {
|
|
if (Check.isNull(planId)) {
|
|
@@ -593,17 +594,18 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
if ("BID".equals(operate)) {
|
|
if ("BID".equals(operate)) {
|
|
Integer bidType = kuaiShouGroup.getBidType();
|
|
Integer bidType = kuaiShouGroup.getBidType();
|
|
Long oldBid = Check.isNull(kuaiShouGroup.getBid()) ? 0L : kuaiShouGroup.getBid();
|
|
Long oldBid = Check.isNull(kuaiShouGroup.getBid()) ? 0L : kuaiShouGroup.getBid();
|
|
|
|
+ BigDecimal oldBidDecimal = new BigDecimal(oldBid.toString());
|
|
if (bidType == 10) {
|
|
if (bidType == 10) {
|
|
- oldBid = kuaiShouGroup.getCpaBid();
|
|
|
|
|
|
+ oldBidDecimal = new BigDecimal(String.valueOf(kuaiShouGroup.getCpaBid()));
|
|
}
|
|
}
|
|
- if (("up".equals(operationType) && oldBid - Long.valueOf(maxValue) == 0) || ("down".equals(operationType) && oldBid - Long.valueOf(minValue) == 0)) {
|
|
|
|
|
|
+ if (("up".equals(operationType) && oldBidDecimal.compareTo(new BigDecimal(maxValue)) == 0) || ("down".equals(operationType) && oldBidDecimal.compareTo(new BigDecimal(minValue)) == 0)) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
Long newBid = 0L;
|
|
Long newBid = 0L;
|
|
if ("to".equals(operationType)) {
|
|
if ("to".equals(operationType)) {
|
|
newBid = new BigDecimal(operationThreshold).multiply(new BigDecimal(1000 + "")).longValue();
|
|
newBid = new BigDecimal(operationThreshold).multiply(new BigDecimal(1000 + "")).longValue();
|
|
} else {
|
|
} else {
|
|
- newBid = calculatedValue(new BigDecimal(oldBid.toString()), operationType, operationValue, operationThreshold, maxValue, minValue);
|
|
|
|
|
|
+ newBid = calculatedValue(oldBidDecimal, operationType, operationValue, operationThreshold, maxValue, minValue);
|
|
}
|
|
}
|
|
JSONObject unitJson = new JSONObject();
|
|
JSONObject unitJson = new JSONObject();
|
|
unitJson.put("advertiser_id", accountId);
|
|
unitJson.put("advertiser_id", accountId);
|
|
@@ -637,14 +639,15 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
//修改预算
|
|
//修改预算
|
|
} else if ("BUDGET".equals(operate)) {
|
|
} else if ("BUDGET".equals(operate)) {
|
|
Long oldBudget = Check.isNull(kuaiShouGroup.getDayBudget()) ? 0L : kuaiShouGroup.getDayBudget();
|
|
Long oldBudget = Check.isNull(kuaiShouGroup.getDayBudget()) ? 0L : kuaiShouGroup.getDayBudget();
|
|
- if (("up".equals(operationType) && oldBudget - Long.valueOf(maxValue) == 0) || ("down".equals(operationType) && oldBudget - Long.valueOf(minValue) == 0)) {
|
|
|
|
|
|
+ BigDecimal oldBudgetDecimal = new BigDecimal(oldBudget.toString());
|
|
|
|
+ if (("up".equals(operationType) && oldBudgetDecimal.compareTo(new BigDecimal(maxValue)) == 0) || ("down".equals(operationType) && oldBudgetDecimal.compareTo(new BigDecimal(minValue)) == 0)) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
Long newBudget = 0L;
|
|
Long newBudget = 0L;
|
|
if ("to".equals(operationType)) {
|
|
if ("to".equals(operationType)) {
|
|
newBudget = new BigDecimal(operationThreshold).multiply(new BigDecimal(1000 + "")).longValue();
|
|
newBudget = new BigDecimal(operationThreshold).multiply(new BigDecimal(1000 + "")).longValue();
|
|
} else {
|
|
} else {
|
|
- newBudget = calculatedValue(new BigDecimal(oldBudget.toString()), operationType, operationValue, operationThreshold, maxValue, minValue);
|
|
|
|
|
|
+ newBudget = calculatedValue(oldBudgetDecimal, operationType, operationValue, operationThreshold, maxValue, minValue);
|
|
}
|
|
}
|
|
Map<String, Object> updateMap = kuaiShouUpdateService.updateUnitDayBudget(token.getAccessToken(), accountId, unitId, newBudget, "规则引擎修改预算");
|
|
Map<String, Object> updateMap = kuaiShouUpdateService.updateUnitDayBudget(token.getAccessToken(), accountId, unitId, newBudget, "规则引擎修改预算");
|
|
String message = "success";
|
|
String message = "success";
|
|
@@ -803,7 +806,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
if (value.compareTo(minValue) == -1) {
|
|
if (value.compareTo(minValue) == -1) {
|
|
value = minValue;
|
|
value = minValue;
|
|
}
|
|
}
|
|
- return value.longValue();
|
|
|
|
|
|
+ return value.multiply(new BigDecimal(1000 + "")).longValue();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1668,6 +1671,8 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
ruleGroup.setOperate(groupJson.getString("operate"));
|
|
ruleGroup.setOperate(groupJson.getString("operate"));
|
|
ruleGroup.setSendType(groupJson.getString("sendType"));
|
|
ruleGroup.setSendType(groupJson.getString("sendType"));
|
|
ruleGroup.setOperation(groupJson.getInteger("operation"));
|
|
ruleGroup.setOperation(groupJson.getInteger("operation"));
|
|
|
|
+ ruleGroup.setOperationType(groupJson.getString("operationType"));
|
|
|
|
+ ruleGroup.setOperationValue(groupJson.getString("operationValue"));
|
|
boolean save = ruleGroupService.save(ruleGroup); // 新增规则组
|
|
boolean save = ruleGroupService.save(ruleGroup); // 新增规则组
|
|
if (save) {
|
|
if (save) {
|
|
for (int j = 0; j < ruleIds.size(); j++) {
|
|
for (int j = 0; j < ruleIds.size(); j++) {
|