Browse Source

Merge remote-tracking branch 'origin/master'

syh 4 years ago
parent
commit
9c1558e515

+ 143 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/MaterialImageVideoInfoController.java

@@ -0,0 +1,143 @@
+package org.jeecg.modules.ctop.controller;
+
+import cn.com.ctop.common.module.entity.MaterialImageVideoInfo;
+import cn.com.ctop.common.module.service.IMaterialImageVideoInfoService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletRequest;
+import java.util.Arrays;
+
+/**
+ * 视频封面关联表信息
+ * @author jeecg-boot
+ * @date   2020-12-17
+ * @version V1.0
+ */
+@Slf4j
+@Api(tags="视频封面关联表信息")
+@RestController
+@RequestMapping("/com.cn/materialImageVideoInfo")
+public class MaterialImageVideoInfoController {
+	@Autowired
+	private IMaterialImageVideoInfoService materialImageVideoInfoService;
+
+	/**
+	  * 分页列表查询
+	 * @param materialImageVideoInfo
+	 * @param pageNo
+	 * @param pageSize
+	 * @param req
+	 * @return
+	 */
+	@GetMapping(value = "/list")
+	public Result<IPage<MaterialImageVideoInfo>> queryPageList(MaterialImageVideoInfo materialImageVideoInfo,
+															   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+															   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+															   HttpServletRequest req) {
+		Result<IPage<MaterialImageVideoInfo>> result = new Result<>();
+		QueryWrapper<MaterialImageVideoInfo> queryWrapper = QueryGenerator.initQueryWrapper(materialImageVideoInfo, req.getParameterMap());
+		Page<MaterialImageVideoInfo> page = new Page<MaterialImageVideoInfo>(pageNo, pageSize);
+		IPage<MaterialImageVideoInfo> pageList = materialImageVideoInfoService.page(page, queryWrapper);
+		result.setSuccess(true);
+		result.setResult(pageList);
+		return result;
+	}
+
+	/**
+	  *   添加
+	 * @param materialImageVideoInfo
+	 * @return
+	 */
+	@PostMapping(value = "/add")
+	public Result<MaterialImageVideoInfo> add(@RequestBody MaterialImageVideoInfo materialImageVideoInfo) {
+		Result<MaterialImageVideoInfo> result = new Result<>();
+		try {
+			materialImageVideoInfoService.save(materialImageVideoInfo);
+			result.success("添加成功!");
+		} catch (Exception e) {
+			log.error(e.getMessage(),e);
+			result.error500("操作失败");
+		}
+		return result;
+	}
+
+	/**
+	  *  编辑
+	 * @param materialImageVideoInfo
+	 * @return
+	 */
+	@PutMapping(value = "/edit")
+	public Result<MaterialImageVideoInfo> edit(@RequestBody MaterialImageVideoInfo materialImageVideoInfo) {
+		Result<MaterialImageVideoInfo> result = new Result<MaterialImageVideoInfo>();
+		MaterialImageVideoInfo materialImageVideoInfoEntity = materialImageVideoInfoService.getById(materialImageVideoInfo.getId());
+		if(materialImageVideoInfoEntity==null) {
+			result.error500("未找到对应实体");
+		}else {
+			boolean ok = materialImageVideoInfoService.updateById(materialImageVideoInfo);
+			if(ok) {
+				result.success("修改成功!");
+			}
+		}
+
+		return result;
+	}
+
+	/**
+	  *   通过id删除
+	 * @param id
+	 * @return
+	 */
+	@DeleteMapping(value = "/delete")
+	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
+		try {
+			materialImageVideoInfoService.removeById(id);
+		} catch (Exception e) {
+			log.error("删除失败",e.getMessage());
+			return Result.error("删除失败!");
+		}
+		return Result.ok("删除成功!");
+	}
+
+	/**
+	  *  批量删除
+	 * @param ids
+	 * @return
+	 */
+	@DeleteMapping(value = "/deleteBatch")
+	public Result<MaterialImageVideoInfo> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
+		Result<MaterialImageVideoInfo> result = new Result<>();
+		if(ids==null || "".equals(ids.trim())) {
+			result.error500("参数不识别!");
+		}else {
+			this.materialImageVideoInfoService.removeByIds(Arrays.asList(ids.split(",")));
+			result.success("删除成功!");
+		}
+		return result;
+	}
+
+	/**
+	  * 通过id查询
+	 * @param id
+	 * @return
+	 */
+	@GetMapping(value = "/queryById")
+	public Result<MaterialImageVideoInfo> queryById(@RequestParam(name="id",required=true) String id) {
+		Result<MaterialImageVideoInfo> result = new Result<>();
+		MaterialImageVideoInfo materialImageVideoInfo = materialImageVideoInfoService.getById(id);
+		if(materialImageVideoInfo==null) {
+			result.error500("未找到对应实体");
+		}else {
+			result.setResult(materialImageVideoInfo);
+			result.setSuccess(true);
+		}
+		return result;
+	}
+}

+ 41 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/MaterialImageVideoInfo.java

@@ -0,0 +1,41 @@
+package cn.com.ctop.common.module.entity;
+
+import java.io.Serializable;
+import java.util.Date;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import org.springframework.format.annotation.DateTimeFormat;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+/**
+ * 视频封面关联表信息
+ * @author jeecg-boot
+ * @date   2020-12-17
+ * @version V1.0
+ */
+@Data
+@TableName("ctop_material_image_video_info")
+public class MaterialImageVideoInfo {
+    
+	/**id*/
+	@TableId(type = IdType.AUTO)
+	private java.lang.Long id;
+	/**视频md5码*/
+	@Excel(name = "视频md5码", width = 15)
+	private java.lang.String videoCode;
+	/**封面md5码*/
+	@Excel(name = "封面md5码", width = 15)
+	private java.lang.String coverCode;
+	/**createTime*/
+	private java.util.Date createTime;
+	/**updateTime*/
+	private java.util.Date updateTime;
+}

+ 14 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/MaterialImageVideoInfoMapper.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.common.module.mapper;
+
+import cn.com.ctop.common.module.entity.MaterialImageVideoInfo;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * 视频封面关联表信息
+ * @author: jeecg-boot
+ * @date:   2020-12-17
+ * @cersion: V1.0
+ */
+public interface MaterialImageVideoInfoMapper extends BaseMapper<MaterialImageVideoInfo> {
+
+}

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/MaterialImageVideoInfoMapper.xml

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.com.ctop.common.module.mapper.MaterialImageVideoInfoMapper">
+
+</mapper>

+ 14 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IMaterialImageVideoInfoService.java

@@ -0,0 +1,14 @@
+package cn.com.ctop.common.module.service;
+
+import cn.com.ctop.common.module.entity.MaterialImageVideoInfo;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * @Description: 视频封面关联表信息
+ * @Author: jeecg-boot
+ * @Date:   2020-12-17
+ * @Version: V1.0
+ */
+public interface IMaterialImageVideoInfoService extends IService<MaterialImageVideoInfo> {
+
+}

+ 18 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/MaterialImageVideoInfoServiceImpl.java

@@ -0,0 +1,18 @@
+package cn.com.ctop.common.module.service.impl;
+
+import cn.com.ctop.common.module.entity.MaterialImageVideoInfo;
+import cn.com.ctop.common.module.mapper.MaterialImageVideoInfoMapper;
+import cn.com.ctop.common.module.service.IMaterialImageVideoInfoService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * 视频封面关联表信息
+ * @author jeecg-boot
+ * @date   2020-12-17
+ * @version V1.0
+ */
+@Service
+public class MaterialImageVideoInfoServiceImpl extends ServiceImpl<MaterialImageVideoInfoMapper, MaterialImageVideoInfo> implements IMaterialImageVideoInfoService {
+
+}

+ 18 - 20
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaiShouGroupServiceImpl.java

@@ -4,12 +4,7 @@ import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
 import cn.com.ctop.common.module.utils.PropertiesUtils;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppInfo;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroupTarget;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouSchedule;
+import cn.com.ctop.kuaishou.modules.batch.entity.*;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAppInfoMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
 import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupTargetMapper;
@@ -26,11 +21,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -297,7 +288,7 @@ public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, K
         String bidTypeStr = json.getString("bidType"); // 出价方式
         JSONArray bidTypeArr = JSONArray.parseArray(bidTypeStr);
         String ocpxActionTypeStr = json.getString("ocpxActionType"); // 优化目标
-        JSONArray bidArr = JSONArray.parseArray(ocpxActionTypeStr);
+        JSONArray ocpxArr = JSONArray.parseArray(ocpxActionTypeStr);
         if (!Check.isNull(details)) {
             List<KuaiShouGroup> groups = new ArrayList<>();
             List<KuaiShouAppInfo> appInfos = new ArrayList<>();
@@ -317,14 +308,6 @@ public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, K
                     Integer put_status = detail.getInteger("put_status");
                     if (put_status == 1) { // 组状态为 投放中的
                         if (status != 15) { // 广告组状态为非暂停
-                            Boolean ocpxTrueOrFalse = false;
-                            for (int j = 0; j < bidArr.size(); j++) {
-                                Integer ocpxActionType = (Integer) bidArr.get(j);
-                                if (ocpxActionType.equals(ocpx_action_type)) {
-                                    ocpxTrueOrFalse = true;
-                                    break;
-                                }
-                            }
                             Boolean bidTypeTrueOrFalse = false;
                             for (int j = 0; j < bidTypeArr.size(); j++) {
                                 Integer bidType = (Integer) bidTypeArr.get(j);
@@ -333,6 +316,21 @@ public class KuaiShouGroupServiceImpl extends ServiceImpl<KuaiShouGroupMapper, K
                                     break;
                                 }
                             }
+
+                            Boolean ocpxTrueOrFalse = false;
+                            if (ocpx_action_type == 0) {
+                                ocpxTrueOrFalse = true;
+                            } else {
+                                for (int j = 0; j < ocpxArr.size(); j++) {
+                                    Integer ocpxActionType = (Integer) ocpxArr.get(j);
+                                    if (ocpxActionType.equals(ocpx_action_type)) {
+                                        ocpxTrueOrFalse = true;
+                                        break;
+                                    }
+                                }
+                            }
+
+
                             if (!bidTypeTrueOrFalse || !ocpxTrueOrFalse) { // 出价方式设置非法
                                 if (day_budget > 500 * 1000 || day_budget == 0) { // 预算大于500 或者不限制预算 需要发送通知 并且进行暂停操作
                                     executorBidTypeService.submit(new Runnable() {

+ 24 - 73
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/batch/service/impl/KuaishouInterfaceServiceImpl.java

@@ -4,69 +4,18 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.enums.MaterialEnum;
 import cn.com.ctop.common.module.service.IUserAllocationService;
-import cn.com.ctop.common.module.utils.Check;
-import cn.com.ctop.common.module.utils.CtopAdConstant;
-import cn.com.ctop.common.module.utils.HttpUtils;
-import cn.com.ctop.common.module.utils.JsonUtil;
-import cn.com.ctop.common.module.utils.KuaishouInterfaceConstant;
-import cn.com.ctop.common.module.utils.PropertiesUtils;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAdvertiserBaseInfo;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouAppList;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCampaign;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouConversionInfos;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouConversionTypes;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouCreative;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouDailyFlows;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouGroup;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouImageGet;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouRegionListChildren;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouRegionListParent;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouTargetingTags;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaiShouVideoGet;
-import cn.com.ctop.kuaishou.modules.batch.entity.KuaishouPopulation;
+import cn.com.ctop.common.module.utils.*;
+import cn.com.ctop.kuaishou.modules.batch.entity.*;
 import cn.com.ctop.kuaishou.modules.batch.entity.vo.ConvertVo;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAdvertiserBaseInfoMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouAppListMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouConversionInfosMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouConversionTypesMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouGroupMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouRegionListChildrenMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouRegionListParentMapper;
-import cn.com.ctop.kuaishou.modules.batch.mapper.KuaiShouTargetingTagsMapper;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouAdvertiserBaseInfoService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCampaignService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCreativeService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouDailyFlowsService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouHistoryReportTaskService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouImageGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouOverRunSendMessageService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouVideoGetService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
-import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouPopulationService;
-import cn.com.ctop.kuaishou.modules.batch.service.IWarningOperationService;
+import cn.com.ctop.kuaishou.modules.batch.mapper.*;
+import cn.com.ctop.kuaishou.modules.batch.service.*;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResult;
 import cn.com.ctop.kuaishou.modules.material.entity.KuaishouResultToken;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyAccount;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCampaign;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreative;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyCreativeStatistic;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportDailyGroup;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyAccount;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCampaign;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCreative;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyCreativeStatistic;
-import cn.com.ctop.kuaishou.modules.report.entity.KuaishouReportHourlyGroup;
+import cn.com.ctop.kuaishou.modules.report.entity.*;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyAccountMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCampaignMapper;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyGroupMapper;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCampaignService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCreativeService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportDailyCreativeStatisticService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyAccountService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyCampaignService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyCreativeService;
-import cn.com.ctop.kuaishou.modules.report.service.IKuaishouReportHourlyGroupService;
+import cn.com.ctop.kuaishou.modules.report.service.*;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -100,11 +49,7 @@ import java.io.IOException;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 
@@ -1016,9 +961,9 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     returnMap.put("success", true);
                     // 创建成功 拉取广告组信息
 
-                    Thread thread = new Thread(){
+                    Thread thread = new Thread() {
                         @Override
-                        public void run(){
+                        public void run() {
                             try {
                                 Thread.sleep(500);
                             } catch (InterruptedException e) {
@@ -1291,7 +1236,7 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
         String bidTypeStr = json.getString("bidType"); // 出价方式
         JSONArray bidTypeArr = JSONArray.parseArray(bidTypeStr);
         String ocpxActionTypeStr = json.getString("ocpxActionType"); // 优化目标
-        JSONArray bidArr = JSONArray.parseArray(ocpxActionTypeStr);
+        JSONArray ocpxArr = JSONArray.parseArray(ocpxActionTypeStr);
         if (!Check.isNull(details)) {
             List<KuaiShouGroup> groups = new ArrayList<>();
             for (int i = 0; i < details.size(); i++) {
@@ -1308,14 +1253,6 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                     Integer put_status = detail.getInteger("put_status");
                     if (put_status == 1) { // 组状态为 投放中的
                         if (status != 15) { // 广告组状态为非暂停
-                            Boolean ocpxTrueOrFalse = false;
-                            for (int j = 0; j < bidArr.size(); j++) {
-                                Integer ocpxActionType = (Integer) bidArr.get(j);
-                                if (ocpxActionType.equals(ocpx_action_type)) {
-                                    ocpxTrueOrFalse = true;
-                                    break;
-                                }
-                            }
                             Boolean bidTypeTrueOrFalse = false;
                             for (int j = 0; j < bidTypeArr.size(); j++) {
                                 Integer bidType = (Integer) bidTypeArr.get(j);
@@ -1324,6 +1261,20 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
                                     break;
                                 }
                             }
+                            Boolean ocpxTrueOrFalse = false;
+                            if (ocpx_action_type == 0) {
+                                ocpxTrueOrFalse = true;
+                            } else {
+                                for (int j = 0; j < ocpxArr.size(); j++) {
+                                    Integer ocpxActionType = (Integer) ocpxArr.get(j);
+                                    if (ocpxActionType.equals(ocpx_action_type)) {
+                                        ocpxTrueOrFalse = true;
+                                        break;
+                                    }
+                                }
+                            }
+
+
                             if (!bidTypeTrueOrFalse || !ocpxTrueOrFalse) { // 出价方式设置非法
                                 if (day_budget > 500 * 1000 || day_budget == 0) { // 预算大于500 或者不限制预算 需要发送通知 并且进行暂停操作
                                     executorBidTypeService.submit(new Runnable() {

+ 63 - 12
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/KuaishouAudienceReportDailyAccountMapper.xml

@@ -7,14 +7,14 @@
         account_id as accountId,
         province,
         age_segment as ageSegment,
-        business_interest_tags as businessInterestTags ,
+        business_interest_tags as businessInterestTags,
         city,
         client,
         gender,
         SUM(charge) as charge,
         SUM(activation) as activation,
         SUM(event_next_day_stay) as eventNextDayStay,
-        ROUND(SUM(event_next_day_stay)/SUM(activation)*100,2)as eventNextDayStayRatio
+        IFNULL(ROUND(SUM(event_next_day_stay)/SUM(activation)*100,2),0) as eventNextDayStayRatio
         FROM ctop_kuaishou_audience_report_daily_account
         where 1=1
         <if test="accountId != null">
@@ -50,8 +50,17 @@
             AND audience_type = #{audienceType}
             GROUP BY business_interest_tags
         </if>
-        <if test="orderType!= null">
-            ORDER BY #{orderType}
+        <if test="orderType == 'charge' ">
+            ORDER BY charge
+        </if>
+        <if test="orderType == 'activation' ">
+            ORDER BY activation
+        </if>
+        <if test="orderType == 'eventNextDayStayRatio'">
+            ORDER BY eventNextDayStayRatio
+        </if>
+        <if test="orderType == 'eventNextDayStay'">
+            ORDER BY eventNextDayStay
         </if>
         <if test="upOrDown == 'desc' || upOrDown == 'DESC'">
             DESC
@@ -73,8 +82,8 @@
         SUM(photo_click) as photoClick,
         SUM(aclick) as aclick,
         SUM(bclick) as bclick,
-        ROUND(SUM(photo_click)/SUM(photo_show)*100,2) as photoClickRatio,
-        ROUND(SUM(bclick)/SUM(aclick)*100,2) as actionRatio
+        IFNULL(ROUND(SUM(photo_click)/SUM(photo_show)*100,2),0) as photoClickRatio,
+        IFNULL(ROUND(SUM(bclick)/SUM(aclick)*100,2),0) as actionRatio
         FROM ctop_kuaishou_audience_report_daily_account
         where 1=1
         <if test="accountId != null">
@@ -113,7 +122,7 @@
     </select>
 
     <select id="querybusinessTypeReportForm" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT
+        (SELECT
         stat_date as statDate,
         account_id as accountId,
         business_interest_tags as businessInterestTags ,
@@ -122,10 +131,11 @@
         sum(charge) as totalCost,
         SUM(aclick) as aclick,
         SUM(bclick) as bclick,
-        ROUND(SUM(photo_click)/SUM(photo_show)*100,2) as photoClickRatio,
-        ROUND(SUM(bclick)/SUM(aclick)*100,2) as actionRatio
+        IFNULL(ROUND(SUM(photo_click)/SUM(photo_show)*100,2),0) as photoClickRatio,
+        IFNULL(ROUND(SUM(bclick)/SUM(aclick)*100,2),0) as actionRatio
         FROM ctop_kuaishou_audience_report_daily_account
         where 1=1
+        AND business_interest_tags != '其他'
         <if test="accountId != null">
             and account_id = #{accountId}
         </if>
@@ -137,13 +147,54 @@
         </if>
         AND audience_type = 'businessInterestTags'
         GROUP BY business_interest_tags
-        ORDER BY totalCost  desc
-        limit 10
+        ORDER BY totalCost desc
+        limit 9
+        )
+        <if test="count > 0 ">
+            union all
+            SELECT
+            statDate as statDate,
+            accountId as accountId,
+            businessInterestTags as businessInterestTags,
+            SUM(photoShow) as photoShow,
+            SUM(photoClick) as photoClick,
+            sum(charge) AS totalCost,
+            SUM(aclick) as aclick,
+            SUM(bclick) as bclick,
+            ROUND(SUM(photoClick)/SUM(photoShow)*100,2) as photoClickRatio,
+            ROUND(SUM(bclick)/SUM(aclick)*100,2) as actionRatio
+            FROM (
+            SELECT
+            stat_date as statDate,
+            account_id as accountId,
+            '其他' as businessInterestTags,
+            SUM(photo_show) as photoShow,
+            SUM(photo_click) as photoClick,
+            sum(charge) AS charge,
+            SUM(aclick) as aclick,
+            SUM(bclick) as bclick
+            FROM ctop_kuaishou_audience_report_daily_account t
+            where 1=1
+            <if test="accountId != null">
+                and account_id = #{accountId}
+            </if>
+            <if test="startTime != null">
+                AND stat_date &gt;= #{startTime}
+            </if>
+            <if test="endTime != null">
+                AND stat_date &lt;= #{endTime}
+            </if>
+            AND audience_type = 'businessInterestTags'
+            GROUP BY business_interest_tags
+            ORDER BY charge
+            limit 0,#{count}
+            ) t1
+        </if>
     </select>
 
 
     <select id="querybusinessTypeCount" resultType="java.lang.Integer">
-        SELECT count(1) FROM(
+        SELECT count(1) FROM (
         SELECT
         1
         FROM ctop_kuaishou_audience_report_daily_account

+ 2 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouAudienceReportDailyAccountServiceImpl.java

@@ -75,6 +75,8 @@ public class KuaishouAudienceReportDailyAccountServiceImpl extends ServiceImpl<K
             data.put("client", clients);
         }
         audienceReport.setAudienceType("businessInterestTags");
+        int count = accountMapper.querybusinessTypeCount(audienceReport);
+        audienceReport.setCount(count - 9);
         List<JSONObject> bussiness = accountMapper.querybusinessTypeReportForm(audienceReport);
         if (!Check.isNull(bussiness)) {
             data.put("businessInterestTags", bussiness);