Forráskód Böngészése

Merge branch 'V1.1.8'

zhaoxian 4 éve
szülő
commit
56cbcb810d

+ 1 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/AlarmRuleRecordMapper.java

@@ -12,4 +12,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  */
 public interface AlarmRuleRecordMapper extends BaseMapper<AlarmRuleRecord> {
 
+    void deleteByTime();
 }

+ 6 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmRuleRecordMapper.xml

@@ -2,4 +2,10 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="cn.com.ctop.alarm.modules.mapper.AlarmRuleRecordMapper">
 
+    <delete id="deleteByTime">
+        delete
+        from ctop_alarm_rule_record
+        where create_time &lt;= DATE_SUB(NOW(), INTERVAL 10 DAY)
+    </delete>
+
 </mapper>

+ 8 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/mapper/xml/AlarmRuleRecordServiceImpl.java

@@ -4,6 +4,7 @@ import cn.com.ctop.alarm.modules.entity.AlarmRuleRecord;
 import cn.com.ctop.alarm.modules.mapper.AlarmRuleRecordMapper;
 import cn.com.ctop.alarm.modules.service.IAlarmRuleRecordService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 /**
@@ -16,4 +17,11 @@ import org.springframework.stereotype.Service;
 @Service
 public class AlarmRuleRecordServiceImpl extends ServiceImpl<AlarmRuleRecordMapper, AlarmRuleRecord> implements IAlarmRuleRecordService {
 
+    @Autowired
+    private AlarmRuleRecordMapper alarmRuleRecordMapper;
+
+    @Override
+    public void deleteByTime() {
+        alarmRuleRecordMapper.deleteByTime();
+    }
 }

+ 1 - 0
module-alarm/src/main/java/cn/com/ctop/alarm/modules/service/IAlarmRuleRecordService.java

@@ -11,4 +11,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface IAlarmRuleRecordService extends IService<AlarmRuleRecord> {
 
+    void deleteByTime();
 }

+ 76 - 35
module-common/src/main/java/cn/com/ctop/common/module/entity/RuleDateUnitKuaishou.java

@@ -1,51 +1,92 @@
 package cn.com.ctop.common.module.entity;
 
-import java.math.BigDecimal;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
 
+import java.math.BigDecimal;
+
 /**
  * 快手预警组数据
  */
 @Data
 @TableName("ctop_rule_data_unit_kuaishou")
 public class RuleDateUnitKuaishou {
-    
-	/**id*/
-	private Long id;
-	/**accountId*/
-	private Long accountId;
-    /**planId*/
+
+    /**
+     * id
+     */
+    private Long id;
+    /**
+     * accountId
+     */
+    private Long accountId;
+    /**
+     * planId
+     */
     private Long planId;
-	/**unitId*/
-	private Long unitId;
-	/**unitName*/
-	private String unitName;
-	/**消耗*/
-	private BigDecimal charge;
-
-	private Long convertNum;
-
-	private BigDecimal convertCost;
-
-	/**activation*/
-	private Long activation;
-	/**激活单价*/
-	private BigDecimal activationCost;
-	/**注册数*/
-	private Long eventRegister;
-	/**表单*/
-	private BigDecimal registerCost;
-	/**表单*/
-	private Long formCount;
-	/**表单提交单价*/
-	private BigDecimal formCost;
-	/**付费*/
-	private Long eventPay;
-	/**付费单价*/
-	private BigDecimal payCost;
+    /**
+     * unitId
+     */
+    private Long unitId;
+    /**
+     * unitName
+     */
+    private String unitName;
+    /**
+     * 消耗
+     */
+    private BigDecimal charge;
+
+    private Long convertNum;
+
+    private BigDecimal convertCost;
+
+    /**
+     * activation
+     */
+    private Long activation;
+    /**
+     * 激活单价
+     */
+    private BigDecimal activationCost;
+    /**
+     * 注册数
+     */
+    private Long eventRegister;
+    /**
+     * 表单
+     */
+    private BigDecimal registerCost;
+    /**
+     * 表单
+     */
+    private Long formCount;
+    /**
+     * 表单提交单价
+     */
+    private BigDecimal formCost;
+    /**
+     * 付费
+     */
+    private Long eventPay;
+    /**
+     * 深度转化目标出价
+     */
+    private Long deepConversionBid;
+    /**
+     * 深度转化目标 3: 付费,7: 次日留存,10: 完件, 11: 授信 ,0:无
+     */
+    private Integer deepConversionType;
+    /**
+     * 安卓版本  3:不限, 4: 4.x+, 5: 5.x+, 6: 6.x+, 7: 7.x+;
+     */
+    private Integer androidOsv;
+    /**
+     * 付费单价
+     */
+    private BigDecimal payCost;
 
     private Integer status;
 
-	private java.util.Date createTime;
+    private java.util.Date createTime;
 }

+ 4 - 0
module-common/src/main/java/cn/com/ctop/common/module/utils/KuaishouInterfaceConstant.java

@@ -358,5 +358,9 @@ public class KuaishouInterfaceConstant {
      * 查询广告组的加速探索报表接口
      */
     public static final String QUERY_SPEED_EXPLORE_REPORT = "/rest/openapi/v1/report/speed_explore";
+  /**
+     * 辅助探索
+     */
+    public static final String AD_UNIT_EXPLORE_SUPPORT = "/rest/openapi/v1/ad_unit/explore/support";
 
 }

+ 21 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaishouAlarmRuleRecordJob.java

@@ -0,0 +1,21 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.alarm.modules.service.IAlarmRuleRecordService;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class KuaishouAlarmRuleRecordJob {
+    @Autowired
+    private IAlarmRuleRecordService alarmRuleRecordService;
+
+    /**
+     * 预警规则记录表 定期删除,只保留10天数据
+     */
+    @XxlJob("cleanAlarmRuleRecordJob")
+    public void execute() throws Exception {
+        alarmRuleRecordService.deleteByTime();
+    }
+}

+ 16 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/controller/KuaishouGroupExploreController.java

@@ -118,6 +118,22 @@ public class KuaishouGroupExploreController {
         }
     }
 
+    /**
+     * 辅助探索
+     *
+     * @param data
+     * @return
+     */
+    @PostMapping(value = "/adUnitExploreSupport")
+    public Result<Object> adUnitExploreSupport(@RequestBody JSONObject data) {
+        try {
+            return kuaishouGroupExploreService.adUnitExploreSupport(data);
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+            return Result.error("操作失败");
+        }
+    }
+
 
     /**
      * 添加

+ 20 - 18
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/mapper/xml/EtlKuaishouReportAccountDailyMapper.xml

@@ -285,13 +285,13 @@
                      AND media_id =2
                      GROUP BY user_id) t) as 'totle'
                  FROM (
-                     SELECT sum(charge) as 'charge', t2.user_id 'userId' FROM ctop_etl_kuaishou_report_account_daily t1
+                     SELECT sum (charge) as 'charge', t2.user_id 'userId' FROM ctop_etl_kuaishou_report_account_daily t1
                      LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
                      WHERE t1.stat_date &gt;= #{mStartDate}
                      AND t1.stat_date &lt;= #{today}
                      AND media_id =2
                      GROUP BY user_id
-                     ORDER BY SUM(charge) DESC
+                     ORDER BY SUM (charge) DESC
                      ) t, (select @rownum := 0) a
              ) tt
         WHERE tt.userId = #{userId}
@@ -520,22 +520,22 @@
     </select>
 
     <select id="projectPageListTotal" resultType="java.lang.Integer">
-        SELECT IFNULL(SUM(1),0) from
-            (
-                SELECT
-                    t3.id
-                FROM ctop_etl_kuaishou_report_account_daily t1
-                         LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
-                         INNER JOIN ctop_project t3 ON t2.project_id = t3.id
-                where t1.stat_date &gt;= #{startTime}
-                  AND t1.stat_date &lt;= #{endTime}
-                GROUP BY t3.id
-                HAVING SUM(charge)>0
-            ) t
+        SELECT IFNULL(SUM(1), 0)
+        from (
+                 SELECT t3.id
+                 FROM ctop_etl_kuaishou_report_account_daily t1
+                          LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
+                          INNER JOIN ctop_project t3 ON t2.project_id = t3.id
+                 where t1.stat_date &gt;= #{startTime}
+                   AND t1.stat_date &lt;= #{endTime}
+                 GROUP BY t3.id
+                 HAVING SUM(charge) > 0
+             ) t
     </select>
 
     <select id="selectList" resultType="cn.com.ctop.kuaishou.modules.report.entity.EtlKuaishouReportAccountHourly">
-        SELECT * from ctop_etl_kuaishou_report_account_daily
+        SELECT *
+        from ctop_etl_kuaishou_report_account_daily
         WHERE stat_date &gt;= #{startDate}
           and stat_date &lt;= #{endDate}
     </select>
@@ -572,8 +572,9 @@
         ctop_etl_kuaishou_report_account_daily t1
         LEFT JOIN ctop_user_allocation t2 ON t1.account_id = t2.account_id
         LEFT JOIN(
-        SELECT user_id,COUNT(1) 'accountCount' FROM ctop_user_allocation i1
-        INNER JOIN ctop_etl_kuaishou_report_account_daily  i2 ON i1.account_id = i2.account_id
+        SELECT user_id,COUNT(1) 'accountCount' FROM (
+        SELECT user_id,i1.account_id FROM ctop_user_allocation i1
+        INNER JOIN ctop_etl_kuaishou_report_account_daily i2 ON i1.account_id = i2.account_id
         AND i2.stat_date &gt;= #{startTime}
         and i2.stat_date &lt;= #{endTime}
         WHERE user_id IN
@@ -581,7 +582,8 @@
                  open="(" separator="," close=")">
             #{id}
         </foreach>
-        GROUP BY user_id
+        GROUP BY user_id,i1.account_id
+        )t GROUP BY user_id
         ) t3 ON t2.user_id = t3.user_id
         LEFT JOIN (
         SELECT

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

@@ -27,4 +27,6 @@ public interface IKuaishouGroupExploreService extends IService<KuaishouGroupExpl
     void unitOpenSpeedExplore(Long accountId, Long unitId, BigDecimal groupAccount,Long accountExploreId);
 
     void getReportByAccount(CtopOauthToken token);
+
+    Result<Object> adUnitExploreSupport(JSONObject data);
 }

+ 49 - 3
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/KuaishouGroupExploreServiceImpl.java

@@ -2,12 +2,17 @@ package cn.com.ctop.kuaishou.modules.report.service.impl;
 
 import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.service.ICtopOauthTokenService;
-import cn.com.ctop.common.module.utils.*;
+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.common.module.utils.StatusCode;
 import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouGroupSpeedExploreLog;
 import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouGroupSpeedExploreLogService;
 import cn.com.ctop.kuaishou.modules.report.entity.KuaishouGroupExplore;
 import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouGroupExploreMapper;
 import cn.com.ctop.kuaishou.modules.report.service.IKuaishouGroupExploreService;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -226,7 +231,7 @@ public class KuaishouGroupExploreServiceImpl extends ServiceImpl<KuaishouGroupEx
     }
 
     @Override
-    public void unitOpenSpeedExplore(Long accountId, Long unitId, BigDecimal groupAccount,Long accountExploreId) {
+    public void unitOpenSpeedExplore(Long accountId, Long unitId, BigDecimal groupAccount, Long accountExploreId) {
         KuaishouGroupSpeedExploreLog groupSpeedExploreLog = new KuaishouGroupSpeedExploreLog();
         groupSpeedExploreLog.setAccountExploreId(accountExploreId);
         groupSpeedExploreLog.setAccountId(accountId);
@@ -247,7 +252,7 @@ public class KuaishouGroupExploreServiceImpl extends ServiceImpl<KuaishouGroupEx
                 String message = resultJson.getString("message");
                 groupSpeedExploreLog.setStatus(code);
                 groupSpeedExploreLog.setMessage(message);
-            }else{
+            } else {
                 groupSpeedExploreLog.setStatus(StatusCode.KUAISHOU_SPEED_EXPLORE_FAIL.getCode());
                 groupSpeedExploreLog.setMessage(StatusCode.KUAISHOU_SPEED_EXPLORE_FAIL.getDesc());
             }
@@ -264,5 +269,46 @@ public class KuaishouGroupExploreServiceImpl extends ServiceImpl<KuaishouGroupEx
         //1:查询此账户下设置了加速探索的组
     }
 
+    @Override
+    public Result<Object> adUnitExploreSupport(JSONObject data) {
+        try {
+            Long accountId = data.getLong("accountId");
+            if (Check.isNull(accountId)) {
+                return Result.error("请选择广告主");
+            }
+            JSONArray supportUnitIds = data.getJSONArray("supportUnitIds");
+            if (Check.isNull(supportUnitIds)) {
+                return Result.error("请填写辅助探索广告组集");
+            }
+            Long unitId = data.getLong("unitId");
+            if (Check.isNull(unitId)) {
+                return Result.error("请填写要设置辅助探索的广告组");
+            }
+            CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+            String url = PropertiesUtils.getConfig("kuaishou_api_url") + KuaishouInterfaceConstant.AD_UNIT_EXPLORE_SUPPORT;
+            Map<String, String> header = new HashMap<>();
+            header.put("Access-Token", token.getAccessToken());
+            header.put("Content-Type", "application/json");
+            JSONObject params = new JSONObject();
+            params.put("advertiser_id", accountId);
+            params.put("support_unit_ids", supportUnitIds);
+            params.put("unit_id", unitId);
+            String result = HttpUtils.httpPostRequest(url, params, header);
+            JSONObject resultJson = JSONObject.parseObject(result);
+            if (!Check.isNull(resultJson)) {
+                Integer code = resultJson.getInteger("code");
+                if (code == 0) {
+                    return Result.ok(resultJson.getJSONObject("data"));
+                } else {
+                    log.info("辅助探索失败,accountId:{},返回信息:{}", accountId, resultJson);
+                    return Result.error("辅助探索失败," + resultJson.getString("message"));
+                }
+            }
+        } catch (Exception e) {
+            log.error("辅助探索失败", e);
+        }
+        return Result.error("辅助探索失败");
+    }
+
 
 }

+ 56 - 41
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/RuleKuaiShouPlanServiceImpl.java

@@ -11,7 +11,9 @@ import cn.com.ctop.common.module.service.IRuleDatePlanKuaishouService;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.HttpUtils;
 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.service.IKuaiShouGroupService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouGroupTargetService;
 import cn.com.ctop.kuaishou.modules.report.service.IRuleKuaiShouPlanService;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
@@ -29,7 +31,7 @@ import java.util.List;
 import java.util.Map;
 
 @Service
-public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaishouMapper, RuleDatePlanKuaishou>  implements IRuleKuaiShouPlanService {
+public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaishouMapper, RuleDatePlanKuaishou> implements IRuleKuaiShouPlanService {
 
     @Autowired
     ICtopOauthTokenService oauthTokenService;
@@ -46,6 +48,9 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
     @Autowired
     IKuaiShouGroupService kuaiShouGroupService;
 
+    @Autowired
+    private IKuaiShouGroupTargetService kuaiShouGroupTargetService;
+
     @Override
     public void cleanRuleDataPlan(Long accountId, int page) {
         JSONObject param = new JSONObject();
@@ -82,8 +87,8 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
         param.put("advertiser_id", accountId);
         param.put("page_size", 500);
         param.put("page", page);
-        param.put("start_date",startDate);
-        param.put("end_date",endDate);
+        param.put("start_date", startDate);
+        param.put("end_date", endDate);
 
         Map<String, String> headers = new HashMap<>();
         headers.put("Access-Token", oauthTokenService.getTokenByAccountId(accountId).getAccessToken());
@@ -152,7 +157,7 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
                 batch.add(plan);
             }
         });
-        if(!batch.isEmpty()) {
+        if (!batch.isEmpty()) {
             planKuaishouService.saveOrUpdateBatch(batch);
         }
     }
@@ -162,23 +167,32 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
         details.forEach(detail -> {
             JSONObject unitDetail = (JSONObject) detail;
             RuleDateUnitKuaishou unit = new RuleDateUnitKuaishou();
-            QueryWrapper<KuaiShouGroup> wrapper=new QueryWrapper<>();
-            wrapper.eq("unit_id",unitDetail.getLong("unit_id"));
+            QueryWrapper<KuaiShouGroup> wrapper = new QueryWrapper<>();
+            wrapper.eq("unit_id", unitDetail.getLong("unit_id"));
             KuaiShouGroup group = kuaiShouGroupService.getOne(wrapper);
-            if(group!=null){
+            if (group != null) {
                 Integer status = group.getStatus();
                 Integer putStatus = group.getPutStatus();
-                if((status == 20 || status == 19) && putStatus == 1){
+                if ((status == 20 || status == 19) && putStatus == 1) {
+                    QueryWrapper<KuaiShouGroupTarget> targetWrapper = new QueryWrapper<>();
+                    targetWrapper.eq("unit_id", unitDetail.getLong("unit_id"));
+                    KuaiShouGroupTarget groupTarget = kuaiShouGroupTargetService.getOne(targetWrapper);
+                    if (!Check.isNull(groupTarget)) {
+                        unit.setAndroidOsv(groupTarget.getAndroidOsv());
+                    }
                     unit.setId(unitDetail.getLong("unit_id"));
                     unit.setAccountId(accountId);
                     unit.setPlanId(unitDetail.getLong("campaign_id"));
                     unit.setUnitId(unitDetail.getLong("unit_id"));
                     unit.setUnitName(unitDetail.getString("unit_name"));
                     unit.setCharge(unitDetail.getBigDecimal("charge"));
+                    unit.setDeepConversionBid(group.getDeepConversionBid());
+                    unit.setDeepConversionType(group.getDeepConversionType());
+
                     //未知优化目标数据存空
-                    if(group.getOcpxActionType()!=0){
-                        unit.setConvertNum(handleConvertNum(group.getOcpxActionType(),unitDetail));
-                        if(null!=unit.getConvertNum()&&unit.getConvertNum()!=0){
+                    if (group.getOcpxActionType() != 0) {
+                        unit.setConvertNum(handleConvertNum(group.getOcpxActionType(), unitDetail));
+                        if (null != unit.getConvertNum() && unit.getConvertNum() != 0) {
                             unit.setConvertCost(unitDetail.getBigDecimal("charge").divide(BigDecimal.valueOf(unit.getConvertNum()), 2, RoundingMode.HALF_UP));
                         }
                     }
@@ -187,7 +201,7 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
             }
 
         });
-        if(!batch.isEmpty()){
+        if (!batch.isEmpty()) {
             unitKuaishouService.saveOrUpdateBatch(batch);
         }
     }
@@ -204,49 +218,49 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
                 target.setAccountId(accountId);
                 target.setPlanId(unitDetail.getLong("campaign_id"));
                 target.setUnitId(unitDetail.getLong("unit_id"));
-                target.setSceneId(unitDetail.getJSONArray("scene_id")==null?"":unitDetail.getJSONArray("scene_id").toString());
+                target.setSceneId(unitDetail.getJSONArray("scene_id") == null ? "" : unitDetail.getJSONArray("scene_id").toString());
                 //获取组定向信息
                 JSONObject unitTarget = unitDetail.getJSONObject("target");
                 //地域
                 JSONArray region = unitTarget.getJSONArray("region");
-                target.setRegion(region==null?"":region.toJSONString());
+                target.setRegion(region == null ? "" : region.toJSONString());
                 //性别
                 Integer gender = unitDetail.getJSONObject("target").getInteger("gender");
-                target.setGender(gender==null?0:gender);
+                target.setGender(gender == null ? 0 : gender);
                 //年龄
                 JSONArray agesRange = unitTarget.getJSONArray("ages_range");
-                target.setAgesRange(agesRange==null?"":agesRange.toJSONString());
+                target.setAgesRange(agesRange == null ? "" : agesRange.toJSONString());
                 //操作系统
                 Integer platformOs = unitTarget.getInteger("platform_os");
-                target.setPlatformOs(platformOs==null?0:platformOs);
+                target.setPlatformOs(platformOs == null ? 0 : platformOs);
                 //设类类型
                 JSONArray deviceBrand = unitTarget.getJSONArray("device_brand");
-                target.setDeviceBrand(deviceBrand==null?"":deviceBrand.toJSONString());
+                target.setDeviceBrand(deviceBrand == null ? "" : deviceBrand.toJSONString());
                 //设备价格
                 JSONArray devicePrice = unitTarget.getJSONArray("device_price");
-                target.setDevicePrice(devicePrice==null?"":devicePrice.toJSONString());
+                target.setDevicePrice(devicePrice == null ? "" : devicePrice.toJSONString());
                 //过滤已转化人群
                 Integer filterConvertedLevel = unitTarget.getInteger("filter_converted_level");
                 target.setFilterConvertedLevel(filterConvertedLevel);
                 //人群包定向
                 JSONArray population = unitTarget.getJSONArray("population");
-                target.setPopulation(population==null?"":population.toJSONString());
+                target.setPopulation(population == null ? "" : population.toJSONString());
                 //人群包排除
                 JSONArray excludePopulation = unitTarget.getJSONArray("exclude_population");
-                target.setExcludePopulation(excludePopulation==null?"":excludePopulation.toJSONString());
+                target.setExcludePopulation(excludePopulation == null ? "" : excludePopulation.toJSONString());
                 //应用商店
                 JSONArray appStore = unitDetail.getJSONArray("app_store");
-                target.setAppStore(appStore==null?"":appStore.toJSONString());
+                target.setAppStore(appStore == null ? "" : appStore.toJSONString());
                 //商业兴趣
                 JSONArray businessInterest = unitTarget.getJSONArray("business_interest");
-                target.setBusinessInterest(businessInterest==null?"":businessInterest.toJSONString());
+                target.setBusinessInterest(businessInterest == null ? "" : businessInterest.toJSONString());
                 //网络环境
                 Integer network = unitTarget.getInteger("network");
-                target.setNetwork(network==null?0:network);
+                target.setNetwork(network == null ? 0 : network);
 
                 Integer isOpen = unitDetail.getJSONObject("target").getJSONObject("intelli_extend").getInteger("is_open");
-                target.setIsOpen(isOpen==null?0:isOpen);
-                target.setScheduleTime(unitDetail.getString("schedule_time")==null?"":unitDetail.getString("schedule_time"));
+                target.setIsOpen(isOpen == null ? 0 : isOpen);
+                target.setScheduleTime(unitDetail.getString("schedule_time") == null ? "" : unitDetail.getString("schedule_time"));
 
                 batch.add(target);
             }
@@ -265,48 +279,49 @@ public class RuleKuaiShouPlanServiceImpl extends ServiceImpl<RuleDatePlanKuaisho
      * 383: 授信,event_credit_grant_app
      * 384: 完件 event_jin_jian_app
      * 715:微信复制 event_add_wechat
+     *
      * @param ocpxActionType
      * @param detail
      * @return
      */
-    private Long handleConvertNum(int ocpxActionType,JSONObject detail){
-        Long convertNum=null;
-        switch (ocpxActionType){
+    private Long handleConvertNum(int ocpxActionType, JSONObject detail) {
+        Long convertNum = null;
+        switch (ocpxActionType) {
             case 2:
-                convertNum=detail.getLong("bclick");
+                convertNum = detail.getLong("bclick");
                 break;
             case 10:
-                convertNum=detail.getLong("aclick");
+                convertNum = detail.getLong("aclick");
                 break;
             case 11:
-                convertNum=detail.getLong("photo_click");
+                convertNum = detail.getLong("photo_click");
                 break;
             case 31:
-                convertNum=detail.getLong("download_completed");
+                convertNum = detail.getLong("download_completed");
                 break;
             case 53:
-                convertNum=detail.getLong("form_count");
+                convertNum = detail.getLong("form_count");
                 break;
             case 180:
-                convertNum=detail.getLong("activation");
+                convertNum = detail.getLong("activation");
                 break;
             case 190:
-                convertNum=detail.getLong("event_pay");
+                convertNum = detail.getLong("event_pay");
                 break;
             case 191:
-                convertNum=detail.getDouble("event_pay_first_day_roi").longValue();
+                convertNum = detail.getDouble("event_pay_first_day_roi").longValue();
                 break;
             case 348:
-                convertNum=detail.getLong("event_valid_clues");
+                convertNum = detail.getLong("event_valid_clues");
                 break;
             case 383:
-                convertNum=detail.getLong("event_credit_grant_app");
+                convertNum = detail.getLong("event_credit_grant_app");
                 break;
             case 384:
-                convertNum=detail.getLong("event_jin_jian_app");
+                convertNum = detail.getLong("event_jin_jian_app");
                 break;
             case 715:
-                convertNum=detail.getLong("event_add_wechat");
+                convertNum = detail.getLong("event_add_wechat");
                 break;
         }
         return convertNum;