Bläddra i källkod

Merge branch 'test'

zxa 3 år sedan
förälder
incheckning
e2b06ac902

+ 3 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/mapper/ByteDanceCreativeMapper.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.bytedance.advertise.mapper;
 package org.jeecg.modules.bytedance.advertise.mapper;
 
 
+import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.bytedance.advertise.entity.ByteDanceCreative;
 import org.jeecg.modules.bytedance.advertise.entity.ByteDanceCreative;
@@ -15,4 +16,6 @@ import java.util.List;
 public interface ByteDanceCreativeMapper extends BaseMapper<ByteDanceCreative> {
 public interface ByteDanceCreativeMapper extends BaseMapper<ByteDanceCreative> {
 
 
     void replaceBatch(@Param(value = "creatives") List<ByteDanceCreative> creatives);
     void replaceBatch(@Param(value = "creatives") List<ByteDanceCreative> creatives);
+
+    List<JSONObject> getBytedanceOcpxTypeList();
 }
 }

+ 8 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/mapper/xml/ByteDanceCreativeMapper.xml

@@ -45,4 +45,12 @@
             )
             )
         </foreach>
         </foreach>
     </insert>
     </insert>
+
+    <select id="getBytedanceOcpxTypeList" resultType="com.alibaba.fastjson.JSONObject">
+        select
+               ocpx_action_type as 'ocpxActionType',
+               ocpx_action_name as 'ocpxActionName'
+        from ctop_bytedance_ocpx_action_type_config
+    </select>
+
 </mapper>
 </mapper>

+ 219 - 9
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/advertise/service/impl/ByteDanceAdvertiserDataServiceImpl.java

@@ -3,19 +3,41 @@ package org.jeecg.modules.bytedance.advertise.service.impl;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
-import org.jeecg.modules.bytedance.advertise.entity.*;
+import org.jeecg.modules.bytedance.advertise.dockapi.MarketingService;
+import org.jeecg.modules.bytedance.advertise.entity.ByteDanceAdvertisePlan;
+import org.jeecg.modules.bytedance.advertise.entity.ByteDanceCreative;
+import org.jeecg.modules.bytedance.advertise.entity.ByteDanceVideoInfo;
+import org.jeecg.modules.bytedance.advertise.entity.BytedanceImageInfo;
 import org.jeecg.modules.bytedance.advertise.mapper.ByteDanceCreativeMapper;
 import org.jeecg.modules.bytedance.advertise.mapper.ByteDanceCreativeMapper;
-import org.jeecg.modules.bytedance.advertise.service.*;
+import org.jeecg.modules.bytedance.advertise.mapper.MonitorBytedanceActionTrackUrlMapper;
+import org.jeecg.modules.bytedance.advertise.service.IByteDanceAdvertisePlanService;
+import org.jeecg.modules.bytedance.advertise.service.IByteDanceAdvertiserDataService;
+import org.jeecg.modules.bytedance.advertise.service.IByteDanceCreativeMaterialService;
+import org.jeecg.modules.bytedance.advertise.service.IByteDanceVideoInfoService;
+import org.jeecg.modules.bytedance.advertise.service.IBytedanceImageInfoService;
 import org.jeecg.modules.bytedance.common.entity.CtopOauthToken;
 import org.jeecg.modules.bytedance.common.entity.CtopOauthToken;
+import org.jeecg.modules.bytedance.common.entity.UserAllocation;
 import org.jeecg.modules.bytedance.common.service.ICtopOauthTokenService;
 import org.jeecg.modules.bytedance.common.service.ICtopOauthTokenService;
-import org.jeecg.modules.bytedance.common.utils.*;
+import org.jeecg.modules.bytedance.common.service.IUserAllocationService;
+import org.jeecg.modules.bytedance.common.utils.Check;
+import org.jeecg.modules.bytedance.common.utils.CorpWexinUtils;
+import org.jeecg.modules.bytedance.common.utils.HttpUtils;
+import org.jeecg.modules.bytedance.common.utils.PropertiesUtils;
+import org.jeecg.modules.bytedance.common.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.context.annotation.Primary;
 import org.springframework.context.annotation.Primary;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
 
 
 /**
 /**
  * @author 宋英豪
  * @author 宋英豪
@@ -43,6 +65,15 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     private ByteDanceCreativeMapper creativeMapper;
     private ByteDanceCreativeMapper creativeMapper;
     @Autowired
     @Autowired
     private IByteDanceVideoInfoService videoInfoService;
     private IByteDanceVideoInfoService videoInfoService;
+    @Autowired
+    private IUserAllocationService userAllocationService;
+    @Resource
+    private CorpWexinUtils corpWexinUtils;
+    @Resource
+    private MonitorBytedanceActionTrackUrlMapper monitorBytedanceActionTrackUrlMapper;
+    @Resource
+    private MarketingService marketingServiceImpl;
+
 
 
     @Override
     @Override
     public JSONObject getAdvertiserList(String token, Long accountId) {
     public JSONObject getAdvertiserList(String token, Long accountId) {
@@ -156,7 +187,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     }
     }
 
 
     @Override
     @Override
-    public ByteDanceAdvertisePlan getSinglePlanById(CtopOauthToken token, String id){
+    public ByteDanceAdvertisePlan getSinglePlanById(CtopOauthToken token, String id) {
         JSONArray getIds = new JSONArray();
         JSONArray getIds = new JSONArray();
         getIds.add(id);
         getIds.add(id);
         // 请求地址
         // 请求地址
@@ -232,6 +263,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         }
         }
         for (int i = 0; i < data.size(); i++) {
         for (int i = 0; i < data.size(); i++) {
             JSONObject dataObject = data.getJSONObject(i);
             JSONObject dataObject = data.getJSONObject(i);
+            checkBidType(token.getAccountId(), dataObject);
             ByteDanceAdvertisePlan advertisePlan = new ByteDanceAdvertisePlan(dataObject, String.valueOf(token.getAccountId()));
             ByteDanceAdvertisePlan advertisePlan = new ByteDanceAdvertisePlan(dataObject, String.valueOf(token.getAccountId()));
             BigDecimal deepCpabid = dataObject.getBigDecimal("deep_cpabid");
             BigDecimal deepCpabid = dataObject.getBigDecimal("deep_cpabid");
             if (null != deepCpabid) {
             if (null != deepCpabid) {
@@ -242,6 +274,188 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         getAd(token, pageNum + 1, ids, date, updateDate);
         getAd(token, pageNum + 1, ids, date, updateDate);
     }
     }
 
 
+    /**
+     * 校验转化出价,并预警
+     */
+    public void checkBidType(Long accountId, JSONObject detail) {
+        JSONObject json = userAllocationService.getProjectByAccountId(accountId);
+        if (Check.isNull(json) || Check.isNull(detail)) {
+            return;
+        }
+        //转化目标map
+        Map<String, String> ocpxMap = new HashMap<>();
+        String ocpxTypeStr = json.getString("ocpxActionType");
+        if (!Check.isNull(ocpxTypeStr)) {
+            JSONArray ocpxArr = JSONArray.parseArray(ocpxTypeStr);
+            for (int i = 0; i < ocpxArr.size(); i++) {
+                JSONObject obj = ocpxArr.getJSONObject(i);
+                ocpxMap.put(obj.getString("ocpxCode"), obj.getString("maxValue"));
+            }
+        }
+
+        //深度转化目标map
+        Map<String, String> deepMap = new HashMap<>();
+        String deepTypeStr = json.getString("deepConversionType");
+        if (!Check.isNull(deepTypeStr)) {
+            JSONArray deepArr = JSONArray.parseArray(deepTypeStr);
+            for (int i = 0; i < deepArr.size(); i++) {
+                JSONObject obj = deepArr.getJSONObject(i);
+                deepMap.put(obj.getString("deepCode"), obj.getString("deepValue"));
+            }
+        }
+
+        //转化目标
+        String ocpxActionType = detail.getString("external_action");
+        //转化目标出价
+        String cpaBid = detail.getString("cpa_bid");
+        //深度转化目标
+        String deepConversionType = detail.getString("deep_external_action");
+        //深度转化目标出价
+        String deepConversionBid = detail.getString("deep_cpabid");
+
+        //计划ID
+        Long planId = detail.getLong("ad_id");
+        //计划名称
+        String planName = detail.getString("name");
+        //投放状态
+        String status = detail.getString("status");
+        //操作状态
+        String optStatus = detail.getString("opt_status");
+        if ("AD_STATUS_ENABLE".equals(optStatus) && !"AD_STATUS_DISABLE".equals(status)) { // 操作状态为‘启用’,广告计划投放状态 非‘暂停’
+            Map<String, String> textMap = new HashMap<>();
+            List<JSONObject> lists = creativeMapper.getBytedanceOcpxTypeList();
+            for (JSONObject da : lists) {
+                textMap.put(da.getString("ocpxActionType"), da.getString("ocpxActionName"));
+            }
+            String msgType = "";
+            String msgBid = "";
+
+            //转化目标标识
+            Boolean typeFalg = true;
+            //出价标识
+            Boolean bidFalg = true;
+            //转化目标
+            if (!Check.isNull(ocpxActionType)) {
+                if (ocpxMap.isEmpty()) {
+                    typeFalg = false;
+                    String msg = Check.isNull(textMap.get(ocpxActionType)) ? ocpxActionType : textMap.get(ocpxActionType);
+                    msgType = "项目未设转化,但计划转化:" + msg;
+                } else {
+                    //转化出价
+                    String ocpxBid = ocpxMap.get(ocpxActionType);
+                    //通过转化目标没有查询到转化出价,判断为转化目标不一致,触发关停
+                    if (Check.isNull(ocpxBid)) {
+                        typeFalg = false;
+                        String msg = Check.isNull(textMap.get(ocpxActionType)) ? ocpxActionType : textMap.get(ocpxActionType);
+                        msgType = "计划转化:" + msg;
+                    } else {
+                        //未查询到转化出价,说明出价不一致,触发出价关停。
+                        if (Check.isNull(cpaBid)) {
+                            bidFalg = false;
+                            msgBid = "计划出价为空";
+                        } else {
+                            BigDecimal cpa = new BigDecimal(cpaBid).multiply(new BigDecimal("1000"));
+                            BigDecimal ocpx = new BigDecimal(ocpxBid);
+                            if (cpa.compareTo(ocpx) == 1) {
+                                //计划转化出价cpa 大于 项目设置最大转化出价,则关停
+                                bidFalg = false;
+                                msgBid = "计划出价:" + cpaBid;
+                            }
+                        }
+                    }
+                }
+            }
+            //深度转化目标
+            if (typeFalg && bidFalg) {
+                if (!Check.isNull(deepConversionType) && deepMap.isEmpty()) {
+                    typeFalg = false;
+                    String msg = Check.isNull(textMap.get(deepConversionType)) ? deepConversionType : textMap.get(deepConversionType);
+                    msgType = "项目未设深度转化,但计划深度转化:" + msg;
+                } else if (!Check.isNull(deepConversionType)) {
+                    String deepBid = deepMap.get(deepConversionType);
+                    if (Check.isNull(deepBid)) {
+                        //通过key未获取值,说明不包含该目标,进行关停
+                        typeFalg = false;
+                        String msg = Check.isNull(textMap.get(deepConversionType)) ? deepConversionType : textMap.get(deepConversionType);
+                        msgType = "计划深度转化:" + msg;
+                    } else {
+                        //未查询到转化出价,说明出价不一致,触发出价关停。
+                        if (Check.isNull(deepConversionBid)) {
+                            bidFalg = false;
+                            msgBid = "计划深度出价为空";
+                        } else {
+                            BigDecimal cpa = new BigDecimal(deepConversionBid).multiply(new BigDecimal("1000"));
+                            BigDecimal ocpx = new BigDecimal(deepBid);
+                            if (cpa.compareTo(ocpx) == 1) {
+                                //计划转化出价cpa 大于 项目设置最大转化出价,则关停
+                                bidFalg = false;
+                                msgBid = "计划深度出价:" + deepConversionBid;
+                            }
+                        }
+                    }
+                }
+            }
+            if (!typeFalg) { // 出价方式设置非法
+                String text = getBidTypeText(json.getString("projectName"), accountId, planId, planName, msgType);
+                sendMsg(accountId, planId, text);
+                detail.put("opt_status", "opt_AD_STATUS_DISABLE");
+            }
+            if (!bidFalg) {
+                String text = getOverBidMessage(json.getString("projectName"), accountId, planId, planName, msgBid);
+                sendMsg(accountId, planId, text);
+                detail.put("opt_status", "opt_AD_STATUS_DISABLE");
+            }
+        }
+
+    }
+
+    private void sendMsg(Long accountId, Long planId, String text) {
+        //关停计划
+        CtopOauthToken token = tokenService.getTokenByAccountId(accountId);
+        marketingServiceImpl.updPlanStatus(token, Arrays.asList(planId), "disable");
+        log.info("出价方式预警,accountId:{}==>计划id:{}=====转化目标不一致,计划已【关停】============", accountId, planId);
+        try {
+            UserAllocation account = userAllocationService.getByAccountId(accountId);
+            String userId = "";
+            if (!Check.isNull(account)) {
+                userId = account.getUserId();
+            }
+            JSONObject jsonObject = monitorBytedanceActionTrackUrlMapper.getWChatIdByUserId(userId);
+            corpWexinUtils.sendMessageByWeChatId(jsonObject, text);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    //转化方式错误消息生成
+    private String getBidTypeText(String projectName, Long advertiserId, Long unitId, String unit_name, String msgType) {
+        StringBuilder text = new StringBuilder();
+        text.append("出价方式错误预警").append("<br/>")
+                .append("您的项目:").append(projectName + ",").append("<br/>")
+                .append("下的账户:").append(advertiserId + ",").append("<br/>")
+                .append("广告计划id:").append(unitId).append("<br/>")
+                .append("广告计划名称:").append(unit_name).append("<br/>")
+                .append("出价方式设置错误。").append("<br/>")
+                .append(msgType).append("<br/>")
+                .append("系统已执行暂停此计划,请您及时查看!");
+        return text.toString();
+    }
+
+    //出价过高预警消息生成
+    private String getOverBidMessage(String projectName, Long accountId, Long planId, String planName, String msgBid) {
+        StringBuilder text = new StringBuilder();
+        text.append("出价过高预警").append("<br/>")
+                .append("您的项目:").append(projectName + ",").append("<br/>")
+                .append("下的账户:").append(accountId + ",").append("<br/>")
+                .append("广告计划id为:").append(planId).append("<br/>")
+                .append("广告计划名称为:").append(planName).append("<br/>")
+                .append("出价设置过高。").append("<br/>")
+                .append(msgBid).append("<br/>")
+                .append("系统已执行暂停此计划,请您及时查看!");
+        return text.toString();
+    }
+
+
     @Override
     @Override
     public Map<String, Object> getAdvertiserPlan(CtopOauthToken token, String ids, String date, String updateDate) {
     public Map<String, Object> getAdvertiserPlan(CtopOauthToken token, String ids, String date, String updateDate) {
         getAd(token, 1, ids, date, updateDate);
         getAd(token, 1, ids, date, updateDate);
@@ -286,8 +500,6 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     }
     }
 
 
 
 
-
-
     private void getCreativeByPage(CtopOauthToken token, String date, int pageNum) {
     private void getCreativeByPage(CtopOauthToken token, String date, int pageNum) {
         JSONObject resultObject = getCreative(token, date, pageNum);
         JSONObject resultObject = getCreative(token, date, pageNum);
         Integer code = resultObject.getInteger("code");
         Integer code = resultObject.getInteger("code");
@@ -475,8 +687,6 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     }
     }
 
 
 
 
-
-
     /**
     /**
      * 获取流量包数据接口
      * 获取流量包数据接口
      *
      *

+ 1 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/common/mapper/UserAllocationMapper.java

@@ -47,4 +47,5 @@ public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
     Set<String> recursiveQuerySubordinateByLeader(@Param("leaderId") String leaderId);
     Set<String> recursiveQuerySubordinateByLeader(@Param("leaderId") String leaderId);
     Set<String> recursiveQuerySubordinateByLeaders(@Param("leaderIds") Set<String> leaderId);
     Set<String> recursiveQuerySubordinateByLeaders(@Param("leaderIds") Set<String> leaderId);
 
 
+    JSONObject getProjectByAccountId(Long accountId);
 }
 }

+ 15 - 1
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/common/mapper/xml/UserAllocationMapper.xml

@@ -173,7 +173,21 @@
         </foreach>
         </foreach>
     </select>
     </select>
 
 
-
+    <select id="getProjectByAccountId" resultType="com.alibaba.fastjson.JSONObject">
+        select id                   'projectId',
+               project_name         'projectName',
+               max_bid              'maxBid',
+               bid_type             'bidType',
+               ocpx_action_type     'ocpxActionType',
+               deep_conversion_type 'deepConversionType'
+        from ctop_project
+        where id = (
+            select project_id
+            from ctop_user_allocation
+            where account_id = #{accountId}
+            limit 1
+            )
+    </select>
 
 
 
 
 </mapper>
 </mapper>

+ 2 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/common/service/IUserAllocationService.java

@@ -45,4 +45,6 @@ public interface IUserAllocationService extends IService<UserAllocation> {
 
 
     //递归查询下级
     //递归查询下级
     Set<String> recursiveQuerySubordinate(String userId);
     Set<String> recursiveQuerySubordinate(String userId);
+
+    JSONObject getProjectByAccountId(Long accountId);
 }
 }

+ 6 - 0
jeecg-boot-bytedance/src/main/java/org/jeecg/modules/bytedance/common/service/impl/UserAllocationServiceImpl.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.jeecg.modules.bytedance.common.entity.UserAllocation;
 import org.jeecg.modules.bytedance.common.entity.UserAllocation;
 import org.jeecg.modules.bytedance.common.mapper.UserAllocationMapper;
 import org.jeecg.modules.bytedance.common.mapper.UserAllocationMapper;
 import org.jeecg.modules.bytedance.common.service.IUserAllocationService;
 import org.jeecg.modules.bytedance.common.service.IUserAllocationService;
+import org.jeecg.modules.bytedance.common.utils.Check;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
@@ -154,6 +155,11 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
         return result;
         return result;
     }
     }
 
 
+    @Override
+    public JSONObject getProjectByAccountId(Long accountId) {
+        return baseMapper.getProjectByAccountId(accountId);
+    }
+
     //递归查询
     //递归查询
     private Set<String> querySubordinate(Set<String> leaderIds, Set<String> result) {
     private Set<String> querySubordinate(Set<String> leaderIds, Set<String> result) {
         if (leaderIds.isEmpty()) {
         if (leaderIds.isEmpty()) {

+ 91 - 76
jeecg-boot-module-system/src/main/java/org/jeecg/modules/bytedance/advertise/controller/BytedancePlanJobController.java

@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import io.swagger.annotations.ApiParam;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.util.DateUtils;
+import org.jeecg.modules.bytedance.advertise.service.IByteDanceAdvertiserDataService;
 import org.jeecg.modules.bytedance.advertise.service.IMonitorBytedanceService;
 import org.jeecg.modules.bytedance.advertise.service.IMonitorBytedanceService;
 import org.jeecg.modules.bytedance.advertise.vo.MonitorBytedanceAdVo;
 import org.jeecg.modules.bytedance.advertise.vo.MonitorBytedanceAdVo;
 import org.jeecg.modules.bytedance.common.constant.BytedanceConstant;
 import org.jeecg.modules.bytedance.common.constant.BytedanceConstant;
@@ -14,7 +16,12 @@ import org.jeecg.modules.bytedance.common.service.IUserAllocationService;
 import org.jeecg.modules.bytedance.common.utils.Check;
 import org.jeecg.modules.bytedance.common.utils.Check;
 import org.jeecg.modules.system.service.ISysRoleService;
 import org.jeecg.modules.system.service.ISysRoleService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.util.HashSet;
 import java.util.HashSet;
@@ -22,89 +29,97 @@ import java.util.Set;
 
 
 /**
 /**
  * 头条定时任务-监测连接预警
  * 头条定时任务-监测连接预警
+ *
  * @author zian Y
  * @author zian Y
- * @date   2021-12-28
  * @version V1.0
  * @version V1.0
+ * @date 2021-12-28
  */
  */
 @RestController
 @RestController
 @RequestMapping("/ad/bytedancePlanJobController")
 @RequestMapping("/ad/bytedancePlanJobController")
-@Api(tags="头条定时任务")
+@Api(tags = "头条定时任务")
 @Slf4j
 @Slf4j
 public class BytedancePlanJobController {
 public class BytedancePlanJobController {
 
 
-	@Autowired
-	private IMonitorBytedanceService monitorBytedanceService;
-
-	@Resource
-	private IUserAllocationService userAllocationService;
-
-	@Autowired
-	private ISysRoleService sysRoleService;;
-
-	@Resource
-	private ICtopOauthTokenService tokenService;
-
-	@ApiOperation(value = "监测预警-点击监测链接", notes = "监测预警-点击监测链接")
-	@GetMapping(value = "/monitorBytedanceActionTrackUrl")
-	public Result monitorBytedanceActionTrackUrl(@RequestParam String accountId) {
-		return monitorBytedanceService.monitorBytedanceActionTrackUrl(accountId);
-	}
-
-
-	@ApiOperation(value = "监测预警-新增", notes = "监测预警-新增")
-	@PostMapping(value = "/insertAccountTrackUrl")
-	public Result insertAccountTrackUrl(@RequestBody MonitorBytedanceAdVo monitorBytedanceAdVo) {
-		return monitorBytedanceService.insertAccountTrackUrl(monitorBytedanceAdVo);
-	}
-
-	@ApiOperation(value = "监测预警-修改", notes = "监测预警-修改")
-	@PostMapping(value = "/updAccountActionTrackUrl")
-	public Result updAccountActionTrackUrl(@RequestBody MonitorBytedanceAdVo monitorBytedanceAdVo) {
-		return monitorBytedanceService.updAccountActionTrackUrl(monitorBytedanceAdVo);
-	}
-
-
-	@ApiOperation(value = "监测预警-查询", notes = "监测预警-查询")
-	@GetMapping(value = "/selectAccountActionTrackUrlList")
-	public Result selectAccountActionTrackUrlList(
-			@ApiParam("用户id") @RequestParam(value = "userId") String userId,
-			@ApiParam("账户id") @RequestParam(value = "accountId",required = false) String accountId,
-			@ApiParam("是否开启监测链接预警 1-开启 2-不开启") @RequestParam(value = "warningFlag",required = false) String warningFlag,
-			@RequestParam(value = "pageNo",defaultValue = "1") Integer pageNo,
-			@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize) {
-		//获取用户角色code
-		String roleCode = sysRoleService.getRoleCodeByUserId(userId);
-		if (Check.isNull(roleCode)){
-			return Result.errorMsg("无法查询到该用户角色信息。");
-		}
-		Set<String> operatorUserIds = new HashSet<>();
-		if(!BytedanceConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)){
-			//查询所有包含自己的下级
-			operatorUserIds = userAllocationService.recursiveQuerySubordinate(userId);
-		}
-		return monitorBytedanceService.selectAccountActionTrackUrlList(accountId,warningFlag,operatorUserIds,pageNo,pageSize);
-
-
-	}
-
-
-
-
-
-
-	@GetMapping(value = "/testActionTrackUrl")
-	public Result testActionTrackUrl(@RequestParam("accountId") String accountId,
-									 @RequestParam("assetId") Long assetId,
-									 @RequestParam("downloadUrl") String downloadUrl
-									 ) {
-
-		CtopOauthToken token = tokenService.getTokenByAccountId(Long.valueOf(accountId));
-
-		 monitorBytedanceService.trackUrlContrast(token,accountId,assetId,downloadUrl,"");
-
-		return Result.successMsg("success",null);
-	}
-
+    @Autowired
+    private IMonitorBytedanceService monitorBytedanceService;
+
+    @Resource
+    private IUserAllocationService userAllocationService;
+
+    @Autowired
+    private ISysRoleService sysRoleService;
+    ;
+
+    @Resource
+    private ICtopOauthTokenService tokenService;
+
+    @Autowired
+    private IByteDanceAdvertiserDataService advertiserDataService;
+
+    @ApiOperation(value = "监测预警-点击监测链接", notes = "监测预警-点击监测链接")
+    @GetMapping(value = "/monitorBytedanceActionTrackUrl")
+    public Result monitorBytedanceActionTrackUrl(@RequestParam String accountId) {
+        return monitorBytedanceService.monitorBytedanceActionTrackUrl(accountId);
+    }
+
+    @ApiOperation(value = "转化目标、转化出价预警", notes = "转化目标、转化出价预警")
+    @GetMapping(value = "/ocpxActionTypeTrackUrl")
+    public Result ocpxActionTypeTrackUrl(@RequestParam String accountId) {
+        CtopOauthToken token = tokenService.getOauthTokenByAccountId(accountId);
+        advertiserDataService.getAdvertiserPlan(token, "", DateUtils.formatDate(), DateUtils.formatDate());
+        return Result.successMsg("成功", null);
+    }
+
+
+    @ApiOperation(value = "监测预警-新增", notes = "监测预警-新增")
+    @PostMapping(value = "/insertAccountTrackUrl")
+    public Result insertAccountTrackUrl(@RequestBody MonitorBytedanceAdVo monitorBytedanceAdVo) {
+        return monitorBytedanceService.insertAccountTrackUrl(monitorBytedanceAdVo);
+    }
+
+    @ApiOperation(value = "监测预警-修改", notes = "监测预警-修改")
+    @PostMapping(value = "/updAccountActionTrackUrl")
+    public Result updAccountActionTrackUrl(@RequestBody MonitorBytedanceAdVo monitorBytedanceAdVo) {
+        return monitorBytedanceService.updAccountActionTrackUrl(monitorBytedanceAdVo);
+    }
+
+
+    @ApiOperation(value = "监测预警-查询", notes = "监测预警-查询")
+    @GetMapping(value = "/selectAccountActionTrackUrlList")
+    public Result selectAccountActionTrackUrlList(
+            @ApiParam("用户id") @RequestParam(value = "userId") String userId,
+            @ApiParam("账户id") @RequestParam(value = "accountId", required = false) String accountId,
+            @ApiParam("是否开启监测链接预警 1-开启 2-不开启") @RequestParam(value = "warningFlag", required = false) String warningFlag,
+            @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
+            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) {
+        //获取用户角色code
+        String roleCode = sysRoleService.getRoleCodeByUserId(userId);
+        if (Check.isNull(roleCode)) {
+            return Result.errorMsg("无法查询到该用户角色信息。");
+        }
+        Set<String> operatorUserIds = new HashSet<>();
+        if (!BytedanceConstant.COMMON_ROLE_CODE_ADMIN.equals(roleCode)) {
+            //查询所有包含自己的下级
+            operatorUserIds = userAllocationService.recursiveQuerySubordinate(userId);
+        }
+        return monitorBytedanceService.selectAccountActionTrackUrlList(accountId, warningFlag, operatorUserIds, pageNo, pageSize);
+
+
+    }
+
+
+    @GetMapping(value = "/testActionTrackUrl")
+    public Result testActionTrackUrl(@RequestParam("accountId") String accountId,
+                                     @RequestParam("assetId") Long assetId,
+                                     @RequestParam("downloadUrl") String downloadUrl
+    ) {
+
+        CtopOauthToken token = tokenService.getTokenByAccountId(Long.valueOf(accountId));
+
+        monitorBytedanceService.trackUrlContrast(token, accountId, assetId, downloadUrl, "");
+
+        return Result.successMsg("success", null);
+    }
 
 
 
 
 }
 }

+ 2 - 2
jeecg-boot-module-system/src/main/resources/application-test.yml

@@ -151,8 +151,8 @@ spring:
      host: 127.0.0.1
      host: 127.0.0.1
      lettuce:
      lettuce:
        pool:
        pool:
-         max-active: 8   #最大连接数据库连接数,设 0 为没有限制
-         max-idle: 8     #最大等待连接中的数量,设 0 为没有限制
+         max-active: 10   #最大连接数据库连接数,设 0 为没有限制
+         max-idle: 10     #最大等待连接中的数量,设 0 为没有限制
          max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
          max-wait: -1ms  #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
          min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
          min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
        shutdown-timeout: 100ms
        shutdown-timeout: 100ms