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

头条项目出价预警

zxa 3 éve
szülő
commit
040522b581

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

@@ -277,7 +277,7 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
     /**
      * 校验转化出价,并预警
      */
-    private void checkBidType(Long accountId, JSONObject detail) {
+    public void checkBidType(Long accountId, JSONObject detail) {
         JSONObject json = userAllocationService.getProjectByAccountId(accountId);
         if (Check.isNull(json) || Check.isNull(detail)) {
             return;

+ 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 lombok.extern.slf4j.Slf4j;
 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.vo.MonitorBytedanceAdVo;
 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.system.service.ISysRoleService;
 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 java.util.HashSet;
@@ -22,89 +29,97 @@ import java.util.Set;
 
 /**
  * 头条定时任务-监测连接预警
+ *
  * @author zian Y
- * @date   2021-12-28
  * @version V1.0
+ * @date 2021-12-28
  */
 @RestController
 @RequestMapping("/ad/bytedancePlanJobController")
-@Api(tags="头条定时任务")
+@Api(tags = "头条定时任务")
 @Slf4j
 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);
+    }
 
 
 }