فهرست منبع

账户绑定授权开始时间

huangxuechao 4 سال پیش
والد
کامیت
7a8ab5cd5c

+ 7 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/CallbackController.java

@@ -30,6 +30,7 @@ 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.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
@@ -50,7 +51,7 @@ public class CallbackController {
     private IKuaishouInterfaceService kuaishouInterfaceService;
     @Autowired
     private IBindAccountAuthService bindAccountAuthService;
-    @Autowired
+    @Resource
     private UserAllocationMapper allocationMapper;
     @Autowired
     private ICtopOauthTokenService ctopOauthTokenService;
@@ -147,6 +148,7 @@ public class CallbackController {
                     //创建人
                     String userId = json.getString("userId");
                     Long projectId = json.getLong("projectId");
+                    String authBeginTime = json.getString("authBeginTime");
                     BigDecimal warningProportion = json.getBigDecimal("WarningProportion");
                     BigDecimal warningAmount = json.getBigDecimal("WarningAmount");
                     String systemType = json.getString("systemType");
@@ -185,6 +187,7 @@ public class CallbackController {
                     userAllocation.setSystemType(systemType);
                     // 获取快手昵称
                     userAllocation.setAuthName((String) advertiseBaseInfoMap.get("userName"));
+                    userAllocation.setAuthBeginTime(authBeginTime);
                     userAllocation.setMediaId(mediaId);
                     userAllocation.setAccountId(accountId);
                     userAllocation.setProjectId(projectId);
@@ -274,6 +277,7 @@ public class CallbackController {
             String userId = json.getString("userId");
             //创建人
             String userName = json.getString("userName");
+            String authBeginTime = json.getString("authBeginTime");
             Long projectId = json.getLong("projectId");
             BigDecimal warningProportion = json.getBigDecimal("WarningProportion");
             BigDecimal warningAmount = json.getBigDecimal("WarningAmount");
@@ -339,6 +343,7 @@ public class CallbackController {
                             userAllocation.setProjectId(projectId);
                             userAllocation.setSystemType(systemType);
                             userAllocation.setAuthName((String) advertiserDataMap.get("name"));
+                            userAllocation.setAuthBeginTime(authBeginTime);
                             userAllocation.setAdvertiserId(advertiserId);
                             userAllocation.setWarningProportion(warningProportion);
                             userAllocation.setWarningAmount(warningAmount);
@@ -391,6 +396,7 @@ public class CallbackController {
                     userAllocation.setProjectId(projectId);
                     userAllocation.setSystemType(systemType);
                     userAllocation.setAuthName((String) advertiserDataMap.get("name"));
+                    userAllocation.setAuthBeginTime(authBeginTime);
                     userAllocation.setAdvertiserId(advertiserId);
                     userAllocation.setWarningProportion(warningProportion);
                     userAllocation.setWarningAmount(warningAmount);

+ 7 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/UserAllocation.java

@@ -104,6 +104,13 @@ public class UserAllocation implements Serializable {
     @ApiModelProperty(value = "授权名称")
     private String authName;
 
+    /**
+     * 授权开始时间
+     */
+    @Excel(name = "授权开始时间", width = 15)
+    @ApiModelProperty(value = "授权开始时间")
+    private String authBeginTime;
+
 
     /**
      * 0 启动

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/ISysUserService.java

@@ -272,4 +272,6 @@ public interface ISysUserService extends IService<SysUser> {
     Map<String, String> getUserMapByMap(Map<String, String> userIdMap);
 
     String getRoleCodeByUserId(String userId);
+
+    Integer updUserDesignLeaderById(String userId,String userName,String roleId);
 }

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

@@ -4,6 +4,7 @@ import cn.com.ctop.common.module.entity.CtopOauthToken;
 import cn.com.ctop.common.module.entity.OauthConfig;
 import cn.com.ctop.common.module.entity.UserAllocation;
 import cn.com.ctop.common.module.enums.MaterialEnum;
+import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.IMaterialCutFrameService;
 import cn.com.ctop.common.module.service.IOauthConfigService;
 import cn.com.ctop.common.module.service.IUserAllocationService;
@@ -127,7 +128,8 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
     private IKuaishouPopulationGroupService populationGroupService;
     @Autowired
     private IKuaishouAppPackageService appPackageService;
-
+    @Autowired
+    private UserAllocationMapper allocationMapper;
     @Override
     public void getAdvertiserReportHourly(CtopOauthToken token, Date startDate, Date endDate) {
         try {
@@ -778,21 +780,27 @@ public class KuaishouInterfaceServiceImpl implements IKuaishouInterfaceService {
 
     @Override
     public void loadKuaishouDataSingle(CtopOauthToken token) throws java.text.ParseException {
-
-
-        Date endDate = new Date();
-        for (int i = 0; i < 7; i++) {
-            Date getStartDate = DateUtils.addDay(endDate, -i);
+        String beginDateStr = allocationMapper.getUserAllocation(token.getAccountId()).getAuthBeginTime();
+        Date beginDate = DateUtils.parseDate(beginDateStr,DateUtils.WEB_FORMAT);
+        Date endDate = DateUtils.addDay(new Date(),-1);
+        while (!beginDate.after(endDate)){
+            beginDate = DateUtils.addDay(beginDate,1);
+            getAdvertiserReportHourly(token, beginDate, endDate);
+            getAdvertiserReportDaily(token, beginDate, endDate, null);
+        }
+//        Date endDate = new Date();
+//        for (int i = 0; i < 7; i++) {
+//            Date getStartDate = DateUtils.addDay(endDate, -i);
             //1: 获取广告主信息数据
-            getAdvertiserReportHourly(token, getStartDate, getStartDate);
-            getAdvertiserReportDaily(token, getStartDate, getStartDate, null);
+//            getAdvertiserReportHourly(token, beginDate, endDate);
+//            getAdvertiserReportDaily(token, beginDate, endDate, null);
             //2:获取广告计划信息数据
             // getAdvertiserCampaignReportHourly(token, getStartDate, getStartDate);
             //3:获取广告组信息数据
             // getAdvertiserGroupReportHourly(token, getStartDate, getStartDate);
             //4: 获取广告创意信息数据
             // getAdvertiserCreativeReportHourly(token, getStartDate, getStartDate);
-        }
+//        }
         //获取全量广告计划数据
         getCampaignList(token, null, null);
         //获取全量广组主数据

+ 15 - 5
module-toutiao/src/main/java/cn/com/ctop/toutiao/modules/report/service/impl/ReportServiceImpl.java

@@ -2,6 +2,7 @@ package cn.com.ctop.toutiao.modules.report.service.impl;
 
 import cn.com.ctop.common.module.entity.*;
 import cn.com.ctop.common.module.enums.BytedanceConvertType;
+import cn.com.ctop.common.module.mapper.UserAllocationMapper;
 import cn.com.ctop.common.module.service.*;
 import cn.com.ctop.common.module.utils.Check;
 import cn.com.ctop.common.module.utils.CtopAdConstant;
@@ -73,6 +74,8 @@ public class ReportServiceImpl implements IReportService {
     private IByteDanceAdvertiserDataService advertiserDataService;
     @Autowired
     private IBytedanceInterfaceService bytedanceInterfaceService;
+    @Autowired
+    private UserAllocationMapper allocationMapper;
 
     @Override
     public void getAdvertiserReport(CtopOauthToken token, Date startDate, Date endDate, String bytedanceReportTypePl) {
@@ -441,11 +444,18 @@ public class ReportServiceImpl implements IReportService {
 
     @Override
     public void loadBytedanceHistoryData(CtopOauthToken token) {
-        for (int i = 1; i < 180; i++) {
-            Date getDate = DateUtils.addDay(new Date(), -i);
-            this.getAdvertiserCreativeReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-            this.getAdvertiserPlanReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
-            this.getAdvertiserReport(token, getDate, getDate, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+        String beginDateStr = allocationMapper.getUserAllocation(token.getAccountId()).getAuthBeginTime();
+        Date beginDate = DateUtils.parseDate(beginDateStr,DateUtils.WEB_FORMAT);
+        Date endDate2 = DateUtils.addDay(new Date(),-1);
+        while (!beginDate.after(endDate2)){
+            beginDate = DateUtils.addDay(beginDate,1);
+//        for (int i = 1; i < 180; i++) {
+            Date getDate = DateUtils.addDay(new Date(),1);
+            this.getAdvertiserCreativeReport(token, beginDate, endDate2, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+            this.getAdvertiserPlanReport(token, beginDate, endDate2, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+            this.getAdvertiserReport(token, beginDate, endDate2, CtopAdConstant.BYTEDANCE_REPORT_TYPE_DAILY);
+//        }
+
         }
 
         try {