|
@@ -25,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -147,6 +148,8 @@ public class KuaiShouRealTimeController {
|
|
|
@RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum,
|
|
|
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize) {
|
|
|
|
|
|
+ DecimalFormat df = new DecimalFormat("#.000");
|
|
|
+
|
|
|
String nowDate = DateUtils.getNowDate("yyyy-MM-dd");
|
|
|
CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
|
|
|
//广告主 当天 实时 组 数据信息
|
|
@@ -158,6 +161,17 @@ public class KuaiShouRealTimeController {
|
|
|
for (KuaishouReportHourlyGroup unitInfo : unitList) {
|
|
|
unitInfo.setTotalCount(Integer.valueOf(unitData.get("totalCount").toString()));
|
|
|
|
|
|
+ //激活成本 = 花费 / 激活数
|
|
|
+ String activationCost = "0";
|
|
|
+
|
|
|
+
|
|
|
+ if (unitInfo.getCharge().doubleValue() != new Double(0) && unitInfo.getActivation() != 0l){
|
|
|
+ Double activation_cost = unitInfo.getCharge().doubleValue() / unitInfo.getActivation();
|
|
|
+ activationCost = df.format(activation_cost);
|
|
|
+ }
|
|
|
+ unitInfo.setActivationCost(activationCost);
|
|
|
+
|
|
|
+
|
|
|
//获取广告组的出价
|
|
|
JSONArray unitPrice = kuaishouInterfaceService.getKuaishouUnitList(token, unitInfo.getUnitId(),null, null , 1);
|
|
|
//优化目标
|
|
@@ -205,6 +219,10 @@ public class KuaiShouRealTimeController {
|
|
|
}
|
|
|
//转化成本 = 花费 / 转化数
|
|
|
unitInfo.setConverCost(Check.isNull(unitInfo.getCharge()) || Check.isNull(unitInfo.getConverNum()) ? 0 : unitInfo.getCharge().doubleValue() / unitInfo.getConverNum().doubleValue());
|
|
|
+ if (unitInfo.getConverCost().isNaN() || unitInfo.getConverCost().isInfinite()){
|
|
|
+ unitInfo.setConverCost(new Double(0));
|
|
|
+ }
|
|
|
+
|
|
|
//操作建议
|
|
|
//消耗
|
|
|
Double charge = unitInfo.getCharge().doubleValue();
|
|
@@ -214,6 +232,9 @@ public class KuaiShouRealTimeController {
|
|
|
Integer converNum = unitInfo.getConverNum();
|
|
|
//转化成本
|
|
|
Double converCost = unitInfo.getConverCost();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
//1. 转化成本大于出价×120%,消耗大于500元:
|
|
|
if ((converCost > bid * 1.2) && (charge > 500)){
|
|
|
unitInfo.setOperationAgree("高成本 | 有消耗");
|