|
@@ -19,6 +19,7 @@ import org.jeecg.ctop.material.entity.vo.KuaiShouOperateVo;
|
|
|
import org.jeecg.ctop.material.mapper.MaterialStareMapper;
|
|
|
import org.jeecg.ctop.material.service.MaterialStareService;
|
|
|
import org.jeecg.ctop.material.utils.FeidNotNullUtils;
|
|
|
+import org.jeecg.ctop.material.utils.LinkUtil;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
@@ -701,6 +702,134 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
return Result.successMsg("查询饼图数据成功。",resultMap);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Result kuaiShouRealTimeUnitDateInfo(long accountId, Integer pageNum, Integer pageSize) {
|
|
|
+
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
+ // ==>> 20220202
|
|
|
+ String now = sdf.format(new Date());
|
|
|
+ long nowDate = Long.valueOf(now);
|
|
|
+
|
|
|
+ PageHelper.startPage(pageNum,pageSize);
|
|
|
+ List<JSONObject> ListUnit = materialStareMapper.kuaiShouRealTimeUnitDateInfo(accountId,nowDate);
|
|
|
+ for (JSONObject unitVo : ListUnit) {
|
|
|
+
|
|
|
+ //优化目标
|
|
|
+ Integer conver = Check.isNull(unitVo.getInteger("ocpx_action_type")) ? 0 : unitVo.getInteger("ocpx_action_type");
|
|
|
+
|
|
|
+ //优化目标: 激活, 付费, 行为, 表单提交, 注册, 唤起应用, 关键行为
|
|
|
+ //对应转化数 激活数,付费数,行为数,表单提交数,注册数,唤起应用次数,关键行为数
|
|
|
+ //优化目标id 来源---ctop_kuaishou_ocpx_action_type_config
|
|
|
+ unitVo.put("converNum",0);//默认
|
|
|
+ //激活
|
|
|
+ if (conver == 180) {
|
|
|
+ unitVo.put("converNum",unitVo.getInteger("activation"));
|
|
|
+ }
|
|
|
+ //付费
|
|
|
+ if (conver == 190) {
|
|
|
+ unitVo.put("converNum",unitVo.getInteger("eventPay"));
|
|
|
+ }
|
|
|
+ //行为
|
|
|
+ if (conver == 2) {
|
|
|
+ unitVo.put("converNum",unitVo.getInteger("bClick"));
|
|
|
+ }
|
|
|
+ //表单提交
|
|
|
+ if (conver == 53) {
|
|
|
+ unitVo.put("converNum",unitVo.getInteger("formCount"));
|
|
|
+ }
|
|
|
+ //注册
|
|
|
+ if (conver == 396) {
|
|
|
+ unitVo.put("converNum",unitVo.getInteger("eventRegister"));
|
|
|
+ }
|
|
|
+ //唤起应用
|
|
|
+ if (conver == 324) {
|
|
|
+ unitVo.put("converNum",unitVo.getInteger("eventAppInvoked"));
|
|
|
+ }
|
|
|
+ //关键行为
|
|
|
+ if (conver == 773) {
|
|
|
+ unitVo.put("converNum",unitVo.getInteger("keyAction"));
|
|
|
+ }
|
|
|
+
|
|
|
+ //转化成本 = 花费 / 转化数
|
|
|
+ double converCost = unitVo.getInteger("converNum") == 0 ? 0 : unitVo.getDouble("charge") / unitVo.getInteger("converNum");
|
|
|
+ unitVo.put("converCost",converCost);
|
|
|
+
|
|
|
+
|
|
|
+ //操作建议
|
|
|
+
|
|
|
+ //消耗
|
|
|
+ Double charge = unitVo.getDoubleValue("charge");
|
|
|
+
|
|
|
+ //出价 单位:厘
|
|
|
+ long bid = new Long("1000");
|
|
|
+ //2:CPC
|
|
|
+ if (unitVo.getInteger("bidType") == 2){
|
|
|
+ bid = unitVo.getLong("bid");
|
|
|
+ //10:OCPM
|
|
|
+ }else if(unitVo.getInteger("bidType") == 10){
|
|
|
+ bid = unitVo.getLong("cpaBid");
|
|
|
+ }
|
|
|
+ Double price = new Double(bid/1000).doubleValue();
|
|
|
+
|
|
|
+ //转化数量
|
|
|
+ Integer converNum = unitVo.getInteger("converNum");
|
|
|
+
|
|
|
+ unitVo.put("operationAgree","暂无");
|
|
|
+ unitVo.put("operationContent","暂无");
|
|
|
+ unitVo.put("operationAgreeInfo","暂无");
|
|
|
+
|
|
|
+ //1. 转化成本大于出价×120%,消耗大于500元:
|
|
|
+ if ((converCost > price * 1.2) && (charge > 500)) {
|
|
|
+ unitVo.put("operationAgree","高成本 | 有消耗");
|
|
|
+ unitVo.put("operationContent","建议限制预算");
|
|
|
+ unitVo.put("operationAgreeInfo","当前广告组转化成本偏高且消耗大于500,建议限制预算;");
|
|
|
+ }
|
|
|
+ //2. 转化成本大于出价×120%,转化数大于10小于等于50:
|
|
|
+ if (converCost > price * 1.2 && LinkUtil.isInTheInterval(String.valueOf(converNum), "(10,50)")) {
|
|
|
+
|
|
|
+ unitVo.put("operationAgree","高成本 | 有转化");
|
|
|
+ unitVo.put("operationContent","建议限制预算");
|
|
|
+ unitVo.put("operationAgreeInfo","当前广告组成本大于出价×120%且转化数介于10-50之间;");
|
|
|
+ }
|
|
|
+ //3. 转化成本大于出价×120%,转化数大于50
|
|
|
+ if (converCost > price * 1.2 && LinkUtil.isInTheInterval(String.valueOf(converNum), "(50,∞)")) {
|
|
|
+ unitVo.put("operationAgree","高成本 | 有转化");
|
|
|
+ unitVo.put("operationContent","建议降低出价");
|
|
|
+ unitVo.put("operationAgreeInfo","当前转化成本大于出价×120%,转化数大于50,建议降低出价;");
|
|
|
+ }
|
|
|
+ //4. 转化成本小于等于出价×120%,转化数大于10小于等于50
|
|
|
+ if (converCost <= price * 1.2 && LinkUtil.isInTheInterval(String.valueOf(converNum), "(10,50]")) {
|
|
|
+ unitVo.put("operationAgree","成本合理 | 有转化");
|
|
|
+ unitVo.put("operationContent","建议复制推广组或放开预算");
|
|
|
+ unitVo.put("operationAgreeInfo","当前转化成本小于等于出价×120%,转化数大于10小于等于50,建议复制推广组或放开预算;");
|
|
|
+ }
|
|
|
+ //5. 消耗大于0小于等于100,转化数大于0小于等于10:
|
|
|
+ if (LinkUtil.isInTheInterval(String.valueOf(charge), "(0,100]") && LinkUtil.isInTheInterval(String.valueOf(converNum), "(0,10]")) {
|
|
|
+ unitVo.put("operationAgree","消耗少 | 转化少");
|
|
|
+ unitVo.put("operationContent","建议启用加速探索");
|
|
|
+ unitVo.put("operationAgreeInfo","当前广告组消耗大于0小于等于100,转化数大于0小于等于10,建议加速探索;");
|
|
|
+ }
|
|
|
+ //6. 消耗大于等于500,转化数等于0:
|
|
|
+ if (charge >= 500 && converNum == 0) {
|
|
|
+ unitVo.put("operationAgree","有消耗 | 无转化");
|
|
|
+ unitVo.put("operationContent","建议暂停广告组");
|
|
|
+ unitVo.put("operationAgreeInfo","当前广告组消耗大于等于500且转化数等于0,建议暂停推广组;");
|
|
|
+ }
|
|
|
+ //7. 消耗大于100小于等于500
|
|
|
+ if (LinkUtil.isInTheInterval(String.valueOf(charge), "(100,500]")) {
|
|
|
+ unitVo.put("operationAgree","有一定消耗");
|
|
|
+ unitVo.put("operationContent","建议继续观察");
|
|
|
+ unitVo.put("operationAgreeInfo","当前广告组消耗大于100小于等于500,建议继续观察;");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ PageInfo<JSONObject> pageInfo = new PageInfo<>(ListUnit);
|
|
|
+ return Result.successMsg("查询快手组当天实时数据成功。",pageInfo);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
//===========================================查询下级员工========================
|
|
|
|