|
@@ -1,14 +1,21 @@
|
|
package cn.com.ctop.kuaishou.modules.ai.service.impl;
|
|
package cn.com.ctop.kuaishou.modules.ai.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.ResultMapUtils;
|
|
import cn.com.ctop.common.module.utils.ResultMapUtils;
|
|
import cn.com.ctop.common.module.utils.StatusCode;
|
|
import cn.com.ctop.common.module.utils.StatusCode;
|
|
import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouAccountSpeedExploreLog;
|
|
import cn.com.ctop.kuaishou.modules.ai.entity.KuaishouAccountSpeedExploreLog;
|
|
import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouAccountSpeedExploreLogMapper;
|
|
import cn.com.ctop.kuaishou.modules.ai.mapper.KuaishouAccountSpeedExploreLogMapper;
|
|
import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAccountSpeedExploreLogService;
|
|
import cn.com.ctop.kuaishou.modules.ai.service.IKuaishouAccountSpeedExploreLogService;
|
|
|
|
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import org.jeecg.common.util.DateUtils;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
|
+import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -20,9 +27,12 @@ import java.util.Map;
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
public class KuaishouAccountSpeedExploreLogServiceImpl extends ServiceImpl<KuaishouAccountSpeedExploreLogMapper, KuaishouAccountSpeedExploreLog> implements IKuaishouAccountSpeedExploreLogService {
|
|
public class KuaishouAccountSpeedExploreLogServiceImpl extends ServiceImpl<KuaishouAccountSpeedExploreLogMapper, KuaishouAccountSpeedExploreLog> implements IKuaishouAccountSpeedExploreLogService {
|
|
-
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private ICtopOauthTokenService tokenService;
|
|
|
|
+ @Autowired
|
|
|
|
+ private IKuaishouInterfaceService kuaishouInterfaceService;
|
|
@Override
|
|
@Override
|
|
- public Map<String, Object> openSpeedExplore(KuaishouAccountSpeedExploreLog kuaishouAccountSpeedExploreLog) {
|
|
|
|
|
|
+ public Map<String, Object> openSpeedExplore(KuaishouAccountSpeedExploreLog kuaishouAccountSpeedExploreLog) throws Exception{
|
|
Map<String,Object> result = new HashMap<>();
|
|
Map<String,Object> result = new HashMap<>();
|
|
//查询当前账户是否加速探索中
|
|
//查询当前账户是否加速探索中
|
|
KuaishouAccountSpeedExploreLog getEntity = this.getByParams(kuaishouAccountSpeedExploreLog.getAccountId(),1);
|
|
KuaishouAccountSpeedExploreLog getEntity = this.getByParams(kuaishouAccountSpeedExploreLog.getAccountId(),1);
|
|
@@ -34,10 +44,28 @@ public class KuaishouAccountSpeedExploreLogServiceImpl extends ServiceImpl<Kuais
|
|
kuaishouAccountSpeedExploreLog.setStatus(1);
|
|
kuaishouAccountSpeedExploreLog.setStatus(1);
|
|
this.save(kuaishouAccountSpeedExploreLog);
|
|
this.save(kuaishouAccountSpeedExploreLog);
|
|
//触发加速探索任务
|
|
//触发加速探索任务
|
|
-
|
|
|
|
|
|
+ this.startSpeedExplore(kuaishouAccountSpeedExploreLog);
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private void startSpeedExplore(KuaishouAccountSpeedExploreLog kuaishouAccountSpeedExploreLog) throws Exception{
|
|
|
|
+ Date endDate = new Date();
|
|
|
|
+ String anotherDay = DateUtils.getAnotherDay("yyyy-MM-dd", DateUtils.formatDate(endDate), -1);
|
|
|
|
+ SimpleDateFormat sim = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
+ Date startDate = sim.parse(anotherDay);
|
|
|
|
+ CtopOauthToken token = tokenService.getTokenByAccountId(kuaishouAccountSpeedExploreLog.getAccountId());
|
|
|
|
+ //1: 拉取账户下所有的广告组信息
|
|
|
|
+ kuaishouInterfaceService.getGroupList(token, startDate, endDate);
|
|
|
|
+ //2: 查询处于学习期的广告组数据
|
|
|
|
+ kuaishouInterfaceService.getAdvertiserGroupReportDaily(token,startDate,endDate);
|
|
|
|
+ //3:根据转化目标查询相应的符合条件的广告组数据
|
|
|
|
+ //优化目标 2 行为数 180 激活数 53 表单数 190 付费 191 首日ROI
|
|
|
|
+ Integer convertType = kuaishouAccountSpeedExploreLog.getConvertType();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public KuaishouAccountSpeedExploreLog getByParams(Long accountId, Integer status) {
|
|
public KuaishouAccountSpeedExploreLog getByParams(Long accountId, Integer status) {
|
|
QueryWrapper<KuaishouAccountSpeedExploreLog> queryWrapper = new QueryWrapper<>();
|
|
QueryWrapper<KuaishouAccountSpeedExploreLog> queryWrapper = new QueryWrapper<>();
|